www/static/admin/decap-cms.js

492 γραμμές
4,8 MiB
JavaScript

2024-01-31 07:38:11 +02:00
/*! For license information please see decap-cms.js.LICENSE.txt */
2025-01-28 00:57:15 +02:00
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("DecapCms",[],t):"object"==typeof exports?exports.DecapCms=t():e.DecapCms=t()}(window,(()=>(()=>{var __webpack_modules__={55034:(e,t,n)=>{"use strict";const r=n(11976),i=n.g.Date;class o extends i{constructor(e){super(e),this.isDate=!0}toISOString(){return`${this.getUTCFullYear()}-${r(2,this.getUTCMonth()+1)}-${r(2,this.getUTCDate())}`}}e.exports=e=>{const t=new o(e);if(isNaN(t))throw new TypeError("Invalid Datetime");return t}},59697:(e,t,n)=>{"use strict";const r=n(11976);class i extends Date{constructor(e){super(e+"Z"),this.isFloating=!0}toISOString(){return`${this.getUTCFullYear()}-${r(2,this.getUTCMonth()+1)}-${r(2,this.getUTCDate())}T${r(2,this.getUTCHours())}:${r(2,this.getUTCMinutes())}:${r(2,this.getUTCSeconds())}.${r(3,this.getUTCMilliseconds())}`}}e.exports=e=>{const t=new i(e);if(isNaN(t))throw new TypeError("Invalid Datetime");return t}},12446:e=>{"use strict";e.exports=e=>{const t=new Date(e);if(isNaN(t))throw new TypeError("Invalid Datetime");return t}},70256:(e,t,n)=>{"use strict";const r=n(11976);class i extends Date{constructor(e){super(`0000-01-01T${e}Z`),this.isTime=!0}toISOString(){return`${r(2,this.getUTCHours())}:${r(2,this.getUTCMinutes())}:${r(2,this.getUTCSeconds())}.${r(3,this.getUTCMilliseconds())}`}}e.exports=e=>{const t=new i(e);if(isNaN(t))throw new TypeError("Invalid Datetime");return t}},11976:e=>{"use strict";e.exports=(e,t)=>{for(t=String(t);t.length<e;)t="0"+t;return t}},86056:e=>{"use strict";const t=1114112;class n extends Error{constructor(e,t,r){super("[ParserError] "+e,t,r),this.name="ParserError",this.code="ParserError",Error.captureStackTrace&&Error.captureStackTrace(this,n)}}class r{constructor(e){this.parser=e,this.buf="",this.returned=null,this.result=null,this.resultTable=null,this.resultArr=null}}class i{constructor(){this.pos=0,this.col=0,this.line=0,this.obj={},this.ctx=this.obj,this.stack=[],this._buf="",this.char=null,this.ii=0,this.state=new r(this.parseStart)}parse(e){if(0===e.length||null==e.length)return;let t;for(this._buf=String(e),this.ii=-1,this.char=-1;!1===t||this.nextChar();)t=this.runOne();this._buf=null}nextChar(){return 10===this.char&&(++this.line,this.col=-1),++this.ii,this.char=this._buf.codePointAt(this.ii),++this.pos,++this.col,this.haveBuffer()}haveBuffer(){return this.ii<this._buf.length}runOne(){return this.state.parser.call(this,this.state.returned)}finish(){let e;this.char=t;do{e=this.state.parser,this.runOne()}while(this.state.parser!==e);return this.ctx=null,this.state=null,this._buf=null,this.obj}next(e){if("function"!=typeof e)throw new n("Tried to set state to non-existent state: "+JSON.stringify(e));this.state.parser=e}goto(e){return this.next(e),this.runOne()}call(e,t){t&&this.next(t),this.stack.push(this.state),this.state=new r(e)}callNow(e,t){return this.call(e,t),this.runOne()}return(e){if(0===this.stack.length)throw this.error(new n("Stack underflow"));void 0===e&&(e=this.state.buf),this.state=this.stack.pop(),this.state.returned=e}returnNow(e){return this.return(e),this.runOne()}consume(){if(this.char===t)throw this.error(new n("Unexpected end-of-buffer"));this.state.buf+=this._buf[this.ii]}error(e){return e.line=this.line,e.col=this.col,e.pos=this.pos,e}parseStart(){throw new n("Must declare a parseStart method")}}i.END=t,i.Error=n,e.exports=i},77146:(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";module.exports=makeParserClass(__webpack_require__(86056)),module.exports.makeParserClass=makeParserClass;class TomlError extends Error{constructor(e){super(e),this.name="TomlError",Error.captureStackTrace&&Error.captureStackTrace(this,TomlError),this.fromTOML=!0,this.wrapped=null}}TomlError.wrap=e=>{const t=new TomlError(e.message);return t.code=e.code,t.wrapped=e,t},module.exports.TomlError=TomlError;const createDateTime=__webpack_require__(12446),createDateTimeFloat=__webpack_require__(59697),createDate=__webpack_require__(55034),createTime=__webpack_require__(70256),CTRL_I=9,CTRL_J=10,CTR
|| (${s} == "string" && ${i} && ${i} == +${i})`).assign(l,a._`+${i}`);case"integer":return void r.elseIf(a._`${s} === "boolean" || ${i} === null
|| (${s} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(l,a._`+${i}`);case"boolean":return void r.elseIf(a._`${i} === "false" || ${i} === 0 || ${i} === null`).assign(l,!1).elseIf(a._`${i} === "true" || ${i} === 1`).assign(l,!0);case"null":return r.elseIf(a._`${i} === "" || ${i} === 0 || ${i} === false`),void r.assign(l,null);case"array":r.elseIf(a._`${s} === "string" || ${s} === "number"
|| ${s} === "boolean" || ${i} === null`).assign(l,a._`[${i}]`)}}r.else(),h(e),r.endIf(),r.if(a._`${l} !== undefined`,(()=>{r.assign(i,l),function({gen:e,parentData:t,parentDataProperty:n},r){e.if(a._`${t} !== undefined`,(()=>e.assign(a._`${t}[${n}]`,r)))}(e,l)}))}(e,t,s):h(e)}))}return u};const c=new Set(["string","number","integer","boolean","null"]);function d(e,t,n,r=l.Correct){const i=r===l.Correct?a.operators.EQ:a.operators.NEQ;let o;switch(e){case"null":return a._`${t} ${i} null`;case"array":o=a._`Array.isArray(${t})`;break;case"object":o=a._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=s(a._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=s();break;default:return a._`typeof ${t} ${i} ${e}`}return r===l.Correct?o:(0,a.not)(o);function s(e=a.nil){return(0,a.and)(a._`typeof ${t} == "number"`,e,n?a._`isFinite(${t})`:a.nil)}}function p(e,t,n,r){if(1===e.length)return d(e[0],t,n,r);let i;const o=(0,s.toHash)(e);if(o.array&&o.object){const e=a._`typeof ${t} != "object"`;i=o.null?e:a._`!${t} || ${e}`,delete o.null,delete o.array,delete o.object}else i=a.nil;o.number&&delete o.integer;for(const e in o)i=(0,a.and)(i,d(e,t,n,r));return i}t.checkDataType=d,t.checkDataTypes=p;const f={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?a._`{type: ${e}}`:a._`{type: ${t}}`};function h(e){const t=function(e){const{gen:t,data:n,schema:r}=e,i=(0,s.schemaRefOrVal)(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:e}}(e);(0,o.reportError)(t,f)}t.reportTypeError=h},2332:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;const r=n(36313),i=n(22500);function o(e,t,n){const{gen:o,compositeRule:a,data:s,opts:l}=e;if(void 0===n)return;const u=r._`${s}${(0,r.getProperty)(t)}`;if(a)return void(0,i.checkStrictMode)(e,`default is ignored for: ${u}`);let c=r._`${u} === undefined`;"empty"===l.useDefaults&&(c=r._`${c} || ${u} === null || ${u} === ""`),o.if(c,r._`${u} = ${(0,r.stringify)(n)}`)}t.assignDefaults=function(e,t){const{properties:n,items:r}=e.schema;if("object"===t&&n)for(const t in n)o(e,t,n[t].default);else"array"===t&&Array.isArray(r)&&r.forEach(((t,n)=>o(e,n,t.default)))}},49029:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;const r=n(61525),i=n(28051),o=n(74312),a=n(28051),s=n(2332),l=n(78716),u=n(69456),c=n(36313),d=n(73861),p=n(40195),f=n(22500),h=n(84101);function m({gen:e,validateName:t,schema:n,schemaEnv:r,opts:i},o){i.code.es5?e.func(t,c._`${d.default.data}, ${d.default.valCxt}`,r.$async,(()=>{e.code(c._`"use strict"; ${g(n,i)}`),function(e,t){e.if(d.default.valCxt,(()=>{e.var(d.default.instancePath,c._`${d.default.valCxt}.${d.default.instancePath}`),e.var(d.default.parentData,c._`${d.default.valCxt}.${d.default.parentData}`),e.var(d.default.parentDataProperty,c._`${d.default.valCxt}.${d.default.parentDataProperty}`),e.var(d.default.rootData,c._`${d.default.valCxt}.${d.default.rootData}`),t.dynamicRef&&e.var(d.default.dynamicAnchors,c._`${d.default.valCxt}.${d.default.dynamicAnchors}`)}),(()=>{e.var(d.default.instancePath,c._`""`),e.var(d.default.parentData,c._`undefined`),e.var(d.default.parentDataProperty,c._`undefined`),e.var(d.default.rootData,d.default.data),t.dynamicRef&&e.var(d.default.dynamicAnchors,c._`{}`)}))}(e,i),e.code(o)})):e.func(t,c._`${d.default.data}, ${function(e){return c._`{${d.default.instancePath}="", ${d.default.parentData}, ${d.default.parentDataProperty}, ${d.default.rootData}=${d.default.data}${e.dynamicRef?c._`, ${d.default.dynamicAnchors}={}`:c.nil}}={}`}(i)}`,r.$async,(()=>e.code(g(n,i)).code(o)))}function g(e,t){const n="object"==typeof e&&e[t.schemaId];return n&&(t.code.source||t.code.process)?c._`/*# sourceURL=${n} */`:c.nil}function v({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const n in e)if(t.RULES.all[n])return!0;return!1}function y(e){return"boolean"!=typeof e.schema}function b(e){(0,f.checkUnknownRule
missingProperty: ${i},
depsCount: ${t},
deps: ${n}}`};const a={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){const[t,n]=function({schema:e}){const t={},n={};for(const r in e)"__proto__"!==r&&((Array.isArray(e[r])?t:n)[r]=e[r]);return[t,n]}(e);s(e,t),l(e,n)}};function s(e,t=e.schema){const{gen:n,data:i,it:a}=e;if(0===Object.keys(t).length)return;const s=n.let("missing");for(const l in t){const u=t[l];if(0===u.length)continue;const c=(0,o.propertyInData)(n,i,l,a.opts.ownProperties);e.setParams({property:l,depsCount:u.length,deps:u.join(", ")}),a.allErrors?n.if(c,(()=>{for(const t of u)(0,o.checkReportMissingProp)(e,t)})):(n.if(r._`${c} && (${(0,o.checkMissingProp)(e,u,s)})`),(0,o.reportMissingProp)(e,s),n.else())}}function l(e,t=e.schema){const{gen:n,data:r,keyword:a,it:s}=e,l=n.name("valid");for(const u in t)(0,i.alwaysValidSchema)(s,t[u])||(n.if((0,o.propertyInData)(n,r,u,s.opts.ownProperties),(()=>{const t=e.subschema({keyword:a,schemaProp:u},l);e.mergeValidEvaluated(t,l)}),(()=>n.var(l,!0))),e.ok(l))}t.validatePropertyDeps=s,t.validateSchemaDeps=l,t.default=a},88681:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(36313),i=n(22500),o={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>r.str`must match "${e.ifClause}" schema`,params:({params:e})=>r._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:n,it:o}=e;void 0===n.then&&void 0===n.else&&(0,i.checkStrictMode)(o,'"if" without "then" and "else" is ignored');const s=a(o,"then"),l=a(o,"else");if(!s&&!l)return;const u=t.let("valid",!0),c=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},c);e.mergeEvaluated(t)}(),e.reset(),s&&l){const n=t.let("ifClause");e.setParams({ifClause:n}),t.if(c,d("then",n),d("else",n))}else s?t.if(c,d("then")):t.if((0,r.not)(c),d("else"));function d(n,i){return()=>{const o=e.subschema({keyword:n},c);t.assign(u,c),e.mergeValidEvaluated(o,u),i?t.assign(i,r._`${n}`):e.setParams({ifClause:n})}}e.pass(u,(()=>e.error(!0)))}};function a(e,t){const n=e.schema[t];return void 0!==n&&!(0,i.alwaysValidSchema)(e,n)}t.default=o},88650:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(55469),i=n(36550),o=n(70744),a=n(76553),s=n(19175),l=n(69181),u=n(26739),c=n(77275),d=n(4441),p=n(21540),f=n(58516),h=n(49637),m=n(42561),g=n(79376),v=n(88681),y=n(7451);t.default=function(e=!1){const t=[f.default,h.default,m.default,g.default,v.default,y.default,u.default,c.default,l.default,d.default,p.default];return e?t.push(i.default,a.default):t.push(r.default,o.default),t.push(s.default),t}},70744:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;const r=n(36313),i=n(22500),o=n(78213),a={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:n}=e;if(Array.isArray(t))return s(e,"additionalItems",t);n.items=!0,(0,i.alwaysValidSchema)(n,t)||e.ok((0,o.validateArray)(e))}};function s(e,t,n=e.schema){const{gen:o,parentSchema:a,data:s,keyword:l,it:u}=e;!function(e){const{opts:r,errSchemaPath:o}=u,a=n.length,s=a===e.minItems&&(a===e.maxItems||!1===e[t]);if(r.strictTuples&&!s){const e=`"${l}" is ${a}-tuple, but minItems or maxItems/${t} are not specified or different at path "${o}"`;(0,i.checkStrictMode)(u,e,r.strictTuples)}}(a),u.opts.unevaluated&&n.length&&!0!==u.items&&(u.items=i.mergeEvaluated.items(o,n.length,u.items));const c=o.name("valid"),d=o.const("len",r._`${s}.length`);n.forEach(((t,n)=>{(0,i.alwaysValidSchema)(u,t)||(o.if(r._`${d} > ${n}`,(()=>e.subschema({keyword:l,schemaProp:n,dataProp:n},c))),e.ok(c))}))}t.validateTuple=s,t.default=a},76553:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(36313),i=n(22500),o=n(78213),a=n(55469),s={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>r.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>r._`{limit: ${e}}`},code(e){const{schema
Only one editor component of type "code-block" may be registered. Previously registered code
block component(s) will be overwritten.
`),Ps.editorComponents=Ps.editorComponents.delete(e.id))}Ps.editorComponents=Ps.editorComponents.set(t.id,t)},getEditorComponents:Fs,registerRemarkPlugin:function(e){Ps.remarkPlugins.push(e)},getRemarkPlugins:Bs,registerWidgetValueSerializer:function(e,t){Ps.widgetValueSerializers[e]=t},getWidgetValueSerializer:zs,registerBackend:function(e,t){e&&t?Ps.backends[e]?console.error(`Backend [${e}] already registered. Please choose a different name.`):Ps.backends[e]={init:(...e)=>new t(...e)}:console.error("Backend parameters invalid. example: CMS.registerBackend('myBackend', BackendClass)")},getBackend:Us,registerMediaLibrary:function(e,t){if(Ps.mediaLibraries.find((t=>e.name===t.name)))throw new Error(`A media library named ${e.name} has already been registered.`);Ps.mediaLibraries.push(As(As({},e),{},{options:t}))},getMediaLibrary:qs,registerLocale:function(e,t){e&&t?Ps.locales[e]=t:console.error("Locale parameters invalid. example: CMS.registerLocale('locale', phrases)")},getLocale:Hs,registerEventListener:function({name:e,handler:t},n={}){$s(e),Ps.eventHandlers[e].push({handler:t,options:n})},removeEventListener:function({name:e,handler:t}){$s(e),Ps.eventHandlers[e]=t?Ps.eventHandlers[e].filter((e=>e.handler!==t)):[]},getEventListeners:function(e){return $s(e),[...Ps.eventHandlers[e]]},invokeEvent:Ws,registerCustomFormat:function(e,t,n){Ps.formats[e]={extension:t,formatter:n}},getCustomFormats:function(){return Ps.formats},getCustomFormatsExtensions:Vs,getCustomFormatsFormatters:Gs};function Rs(){return Ps.previewStyles}function Ms(e){return Ps.templates[e]}function Is(e,t,n,r={}){if(Array.isArray(e))e.forEach((e=>{"object"!=typeof e?console.error(`Cannot register widget: ${e}`):Is(e)}));else if("string"==typeof e){const i="string"==typeof t?Ps.widgets[t].control:t;Ps.widgets[e]={control:i,preview:n,schema:r}}else if("object"==typeof e){const{name:t,controlComponent:n,previewComponent:r,schema:i={},allowMapValue:o,globalStyles:a}=e,s=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Cs);if(Ps.widgets[t]&&console.warn(gs`
Multiple widgets registered with name "${t}". Only the last widget registered with
this name will be used.
`),!n)throw Error(`Widget "${t}" registered without \`controlComponent\`.`);Ps.widgets[t]=As({control:n,preview:r,schema:i,globalStyles:a,allowMapValue:o},s)}else console.error("`registerWidget` failed, called with incorrect arguments.")}function Ls(e){return Ps.widgets[e]}function Ns(){return bi(Object.entries(Ps.widgets),(e=>e.map((([e,t])=>As({name:e},t)))))}function js(e){return Ls(e||"string")||Ls("unknown")}function Fs(){return Ps.editorComponents}function Bs(){return Ps.remarkPlugins}function zs(e){return Ps.widgetValueSerializers[e]}function Us(e){return Ps.backends[e]}function qs(e){return Ps.mediaLibraries.find((t=>t.name===e))}function $s(e){if(!Ts.includes(e))throw new Error(`Invalid event name '${e}'`)}async function Ws({name:e,data:t}){$s(e);const n=Ps.eventHandlers[e];let r=As({},t);for(const{handler:e,options:i}of n){const n=await e(r,i);if(void 0!==n){const e=r.entry.set("data",n);r=As(As({},t),{},{entry:e})}}return r.entry.get("data")}function Hs(e){return Ps.locales[e]}function Vs(){return Object.entries(Ps.formats).reduce((function(e,[t,{extension:n}]){return As(As({},e),{},{[t]:n})}),{})}function Gs(){return Object.entries(Ps.formats).reduce((function(e,[t,{formatter:n}]){return As(As({},e),{},{[t]:n})}),{})}function Ks(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ys(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ks(Object(n),!0).forEach((function(t){var r,i,o;r=e,i=t,o=n[t],i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(i),i in r?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ks(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}const Zs=["yaml-frontmatter","toml-frontmatter","json-frontmatter"],Xs={yml:"yml",yaml:"yml",toml:"toml",json:"json",frontmatter:"md","json-frontmatter":"md","toml-frontmatter":"md","yaml-frontmatter":"md"},Qs={yml:Ra,yaml:Ra,toml:za,json:Ua,md:Qa,markdown:Qa,html:Qa};function Js(e,t){const n=Ys({yml:Ra,yaml:Ra,toml:za,json:Ua,frontmatter:Qa,"json-frontmatter":ts(t),"toml-frontmatter":es(t),"yaml-frontmatter":Ja(t)},Gs());if(e in n)return n[e];throw new Error(`No formatter available with name: ${e}`)}function el(e,t){const n=e.get("frontmatter_delimiter"),r=(i=n,kr.List.isList(i)?n.toArray():n);var i;const o=e.get("format");if(o)return Js(o,r);const a=t&&t.path;if(a){const e=a.split(".").pop();if(e)return Ci()(Qs,e)}const s=e.get("extension");return s?Ci()(Qs,s):Js("frontmatter",r)}var tl=__webpack_require__(45455),nl=__webpack_require__.n(tl),rl=__webpack_require__(93433),il=__webpack_require__.n(rl),ol=__webpack_require__(39714),al=__webpack_require__.n(ol);const sl="simple",ll="editorial_workflow",ul=(0,kr.OrderedMap)({DRAFT:"draft",PENDING_REVIEW:"pending_review",PENDING_PUBLISH:"pending_publish"});(0,kr.Map)({[ul.get("DRAFT")]:"Draft",[ul.get("PENDING_REVIEW")]:"Waiting for Review",[ul.get("PENDING_PUBLISH")]:"Waiting to go live"});var cl,dl=__webpack_require__(96477),pl=__webpack_require__.n(dl),fl=__webpack_require__(66454),hl=__webpack_require__(53521),ml=__webpack_require__.n(hl),gl=new Uint8Array(16);function vl(){if(!cl&&!(cl="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return cl(gl)}const yl=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3
Collection "${t.get("name")}" configuration error:
\`preview_path_date_field\` must be a field with a valid date. Ignoring \`preview_path\`.
`),o;throw e}return`${o}/${il()(h," /")}`}function yu(e,t,n,r,i,o){if(!t||!t.get("data"))return e;let a=t.get("data").set(i,r);a=du(t.get("path"),a,n.get("folder"));const s=lu(t,Df(n,"date"))||null,l=a.getIn(cu(Pf(n))),u=gu(o,[r,a.get("dirname")]);return su(e,s,l,a,u)}var bu=__webpack_require__(18149),wu=__webpack_require__.n(bu),_u=__webpack_require__(4335),xu=__webpack_require__.n(_u);function ku(e,t="",n="",r={}){return{collection:e,slug:t,path:n,partial:r.partial||!1,raw:r.raw||"",data:r.data||{},label:r.label||null,isModification:xu()(r.isModification)?r.isModification:null,mediaFiles:r.mediaFiles||[],author:r.author||"",updatedOn:r.updatedOn||"",status:r.status||"",meta:r.meta||{},i18n:r.i18n||{}}}function Eu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Cu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Eu(Object(n),!0).forEach((function(t){var r,i,o;r=e,i=t,o=n[t],i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(i),i in r?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Eu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}const{fetchWithTimeout:Su}=mo;class Au{constructor(e){if(this.config=e,null==e.get("applicationID")||null==e.get("apiKey"))throw"The Algolia search integration needs the credentials (applicationID and apiKey) in the integration configuration.";this.applicationID=e.get("applicationID"),this.apiKey=e.get("apiKey");const t=e.get("indexPrefix");this.indexPrefix=t?`${t}-`:"",this.searchURL=`https://${this.applicationID}-dsn.algolia.net/1`,this.entriesCache={collection:null,page:null,entries:[]}}requestHeaders(e={}){return Cu({"X-Algolia-API-Key":this.apiKey,"X-Algolia-Application-Id":this.applicationID,"Content-Type":"application/json"},e)}parseJsonResponse(e){return e.json().then((t=>e.ok?t:Promise.reject(t)))}urlFor(e,t){const n=[];if(t.params)for(const e in t.params)n.push(`${e}=${encodeURIComponent(t.params[e])}`);return n.length&&(e+=`?${n.join("&")}`),e}request(e,t={}){const n=this.requestHeaders(t.headers||{}),r=this.urlFor(e,t);return Su(r,Cu(Cu({},t),{},{headers:n})).then((e=>{const t=e.headers.get("Content-Type");return t&&t.match(/json/)?this.parseJsonResponse(e):e.text()}))}search(e,t,n){const r=e.map((e=>({indexName:`${this.indexPrefix}${e}`,params:`query=${t}&page=${n}`})));return this.request(`${this.searchURL}/indexes/*/queries`,{method:"POST",body:JSON.stringify({requests:r})}).then((t=>{const r=t.results.map(((t,n)=>t.hits.map((t=>{const r=t.path.split("/").pop().replace(/\.[^.]+$/,"");return ku(e[n],r,t.path,{data:t.data,partial:!0})}))));return{entries:Li()(r),pagination:n}}))}searchBy(e,t,n){return this.request(`${this.searchURL}/indexes/${this.indexPrefix}${t}`,{params:{restrictSearchableAttributes:e,query:n}})}listEntries(e,t){return this.entriesCache.collection===e&&this.entriesCache.page===t?Promise.resolve({page:this.entriesCache.page,entries:this.entriesCache.entries}):this.request(`${this.searchURL}/indexes/${this.indexPrefix}${e.get("name")}`,{params:{page:t}}).then((t=>{const n=t.hits.map((t=>{const n=Cf(e,t.path);return ku(e.get("name"),n,t.path,{data:t.data,partial:!0})}));return this.entriesCache={collection:e,pagination:t.page,entries:n},{entries:n,pagination:t.page}}))}async listAllEntries(e){const t={hitsPerPage:1e3};let n=await this.request(`${this.searchURL}/indexes/${this.indexPrefix}${e.get("name")}`,{params:t}),{nbPages:r=0,hits:i,page:o}=n;for(o+=1;o<r;)n=await this.request(`${this.searchURL}/indexes/${this.indexPr
${jb};
`,n),afterOpen:"",beforeClose:""},overlayClassName:{base:i`
${Fb};
`,afterOpen:i`
${"\n background-color: rgba(0, 0, 0, 0.6);\n opacity: 1;\n "};
`,beforeClose:i`
${"\n background-color: rgba(0, 0, 0, 0);\n opacity: 0;\n "};
`}},t))))}}function zb(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=zb(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}var Ub,qb,$b;Ub=Bb,qb="propTypes",$b={children:ie().node.isRequired,isOpen:ie().bool.isRequired,className:ie().string,onClose:ie().func.isRequired},qb=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(qb),qb in Ub?Object.defineProperty(Ub,qb,{value:$b,enumerable:!0,configurable:!0,writable:!0}):Ub[qb]=$b;const Wb=function(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=zb(e))&&(r&&(r+=" "),r+=t);return r},Hb=e=>"number"==typeof e&&!isNaN(e),Vb=e=>"string"==typeof e,Gb=e=>"function"==typeof e,Kb=e=>Vb(e)||Gb(e)?e:null,Yb=e=>(0,o.isValidElement)(e)||Vb(e)||Gb(e)||Hb(e);function Zb(e){let{enter:t,exit:n,appendPosition:r=!1,collapse:i=!0,collapseDuration:a=300}=e;return function(e){let{children:s,position:l,preventExitTransition:u,done:c,nodeRef:d,isIn:p}=e;const f=r?`${t}--${l}`:t,h=r?`${n}--${l}`:n,m=(0,o.useRef)(0);return(0,o.useLayoutEffect)((()=>{const e=d.current,t=f.split(" "),n=r=>{r.target===d.current&&(e.dispatchEvent(new Event("d")),e.removeEventListener("animationend",n),e.removeEventListener("animationcancel",n),0===m.current&&"animationcancel"!==r.type&&e.classList.remove(...t))};e.classList.add(...t),e.addEventListener("animationend",n),e.addEventListener("animationcancel",n)}),[]),(0,o.useEffect)((()=>{const e=d.current,t=()=>{e.removeEventListener("animationend",t),i?function(e,t,n){void 0===n&&(n=300);const{scrollHeight:r,style:i}=e;requestAnimationFrame((()=>{i.minHeight="initial",i.height=r+"px",i.transition=`all ${n}ms`,requestAnimationFrame((()=>{i.height="0",i.padding="0",i.margin="0",setTimeout(t,n)}))}))}(e,c,a):c()};p||(u?t():(m.current=1,e.className+=` ${h}`,e.addEventListener("animationend",t)))}),[p]),o.createElement(o.Fragment,null,s)}}function Xb(e,t){return null!=e?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}const Qb={list:new Map,emitQueue:new Map,on(e,t){return this.list.has(e)||this.list.set(e,[]),this.list.get(e).push(t),this},off(e,t){if(t){const n=this.list.get(e).filter((e=>e!==t));return this.list.set(e,n),this}return this.list.delete(e),this},cancelEmit(e){const t=this.emitQueue.get(e);return t&&(t.forEach(clearTimeout),this.emitQueue.delete(e)),this},emit(e){this.list.has(e)&&this.list.get(e).forEach((t=>{const n=setTimeout((()=>{t(...[].slice.call(arguments,1))}),0);this.emitQueue.has(e)||this.emitQueue.set(e,[]),this.emitQueue.get(e).push(n)}))}},Jb=e=>{let{theme:t,type:n,...r}=e;return o.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"colored"===t?"currentColor":`var(--toastify-icon-color-${n})`,...r})},ew={info:function(e){return o.createElement(Jb,{...e},o.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return o.createElement(Jb,{...e},o.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:functi
from {
transform: rotate(0deg);
}
2024-01-31 07:38:11 +02:00
2025-01-28 00:57:15 +02:00
to {
transform: rotate(360deg);
}
`},yx=gb("div",{target:"ep2bezb2",label:"LoaderText"})({name:"xpdb8l",styles:"width:auto!important;height:auto!important;text-align:center;color:#767676;margin-top:55px;line-height:35px"}),bx=gb("div",{target:"ep2bezb1",label:"LoaderItem"})({name:"12zl32h",styles:"position:absolute;white-space:nowrap;transform:translateX(-50%)"});class wx extends o.Component{constructor(...e){super(...e),mx(this,"state",{currentItem:0}),mx(this,"setAnimation",(()=>{if(this.interval)return;const{children:e}=this.props;this.interval=setInterval((()=>{const t=this.state.currentItem===e.length-1?0:this.state.currentItem+1;this.setState({currentItem:t})}),5e3)})),mx(this,"renderChild",(()=>{const{children:e}=this.props,{currentItem:t}=this.state;return e?"string"==typeof e?xn(yx,null,e):Array.isArray(e)?(this.setAnimation(),xn(yx,null,xn(hx,{className:{enter:gx.enter,enterActive:gx.enterActive,exit:gx.exit,exitActive:gx.exitActive},timeout:500},xn(bx,{key:t},e[t])))):void 0:null}))}componentWillUnmount(){this.interval&&clearInterval(this.interval)}render(){const{className:e}=this.props;return xn("div",{className:e},this.renderChild())}}mx(wx,"propTypes",{children:ie().node,className:ie().string});const _x=gb(wx,{target:"ep2bezb0",label:"StyledLoader"})("display:",(e=>e.active?"block":"none"),";position:absolute;top:50%;left:50%;margin:0;text-align:center;z-index:",hr.zIndex1000,";transform:translateX(-50%) translateY(-50%);&:before,&:after{content:'';position:absolute;top:0%;left:50%;width:2.2857rem;height:2.2857rem;margin:0 0 0 -1.1429rem;border-radius:500rem;border-style:solid;border-width:0.2em;}&:before{border-color:rgba(0, 0, 0, 0.1);}&:after{animation:",vx.loader," 0.6s linear;animation-iteration-count:infinite;border-color:",Kn.active," transparent transparent;box-shadow:0 0 0 1px transparent;}");function xx(e){ad.push(Yl(e))}var kx=__webpack_require__(16760),Ex=__webpack_require__.n(kx);const Cx=gb("div",{target:"el0uck02",label:"SearchContainer"})({name:"sycyb7",styles:"height:37px;display:flex;align-items:center;position:relative;width:400px"}),Sx=gb("input",{target:"el0uck01",label:"SearchInput"})("background-color:#eff0f4;border-radius:",Yn.borderRadius,";font-size:14px;padding:10px 6px 10px 32px;width:100%;position:relative;z-index:",hr.zIndex1,";&:focus{outline:none;box-shadow:inset 0 0 0 2px ",Kn.active,";}"),Ax=gb(O_,{target:"el0uck00",label:"SearchIcon"})("position:absolute;top:50%;left:6px;z-index:",hr.zIndex2,";transform:translate(0, -50%);");function Tx({value:e,onChange:t,onKeyDown:n,placeholder:r,disabled:i}){return xn(Cx,null,xn(Ax,{type:"search",size:"small"}),xn(Sx,{value:e,onChange:t,onKeyDown:n,placeholder:r,disabled:i}))}Tx.propTypes={value:ie().string,onChange:ie().func.isRequired,onKeyDown:ie().func.isRequired,placeholder:ie().string.isRequired,disabled:ie().bool};const Ox=Tx,Px=gb("button",{target:"estf6121",label:"CloseButton"})(cr.button,";",er,";position:absolute;margin-right:-40px;left:-40px;top:-40px;width:40px;height:40px;border-radius:50%;background-color:white;padding:0;display:flex;justify-content:center;align-items:center;"),Dx=gb("h1",{target:"estf6120",label:"LibraryTitle"})("line-height:36px;font-size:22px;text-align:left;margin-bottom:25px;color:",(e=>e.isPrivate&&Kn.textFieldBorder),";");function Rx({onClose:e,title:t,isPrivate:n}){return xn("div",null,xn(Px,{onClick:e},xn(O_,{type:"close"})),xn(Dx,{isPrivate:n},t))}Rx.propTypes={onClose:ie().func.isRequired,title:ie().string.isRequired,isPrivate:ie().bool};const Mx=Rx;function Ix(e,t,n){return t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Lx={button:En(cr.button,";",cr.default,";display:inline-block;margin-left:15px;margin-right:2px;&[disabled]{",cr.disabled,";cursor:default;};label:button;",";lab
this.wrappedControlValid is not a function. Are you sure widget
"${e.get("widget")}" is registered?
`);const r=this.wrappedControlValid();return"boolean"==typeof r?{error:!r}:Object.prototype.hasOwnProperty.call(r,"error")?r:r instanceof Promise?(r.then((()=>{this.validate({error:!1})}),(t=>{const n={type:Yu.CUSTOM,message:`${e.get("label",e.get("name"))} - ${t}.`};this.validate({error:n})})),{error:{type:Yu.CUSTOM,parentIds:n,message:t("editor.editorControlPane.widget.processing",{fieldLabel:e.get("label",e.get("name"))})}}):{error:!1}})),IA(this,"getObjectValue",(()=>this.props.value||(0,kr.Map)())),IA(this,"onChangeObject",((e,t,n)=>{const r=this.getObjectValue().set(e.get("name"),t);return this.props.onChange(r,n&&{[this.props.field.get("name")]:n})})),IA(this,"setInactiveStyle",(()=>{this.props.setInactiveStyle(),this.props.field.has("pattern")&&!NA(this.getValidateValue())&&this.validate()}))}shouldComponentUpdate(e){return(!this.props.isLoadingAsset||!e.isLoadingAsset)&&(this.wrappedControlShouldComponentUpdate?this.wrappedControlShouldComponentUpdate(e):this.props.value!==e.value||this.props.classNameWrapper!==e.classNameWrapper||this.props.hasActiveStyle!==e.hasActiveStyle)}render(){const{controlComponent:e,entry:t,collection:n,config:r,field:i,value:a,mediaPaths:s,metadata:l,onChange:u,onValidateObject:c,onOpenMediaLibrary:d,onRemoveMediaControl:p,onPersistMedia:f,onClearMediaControl:h,onAddAsset:m,onRemoveInsertedMedia:g,getAsset:v,classNameWrapper:y,classNameWidget:b,classNameWidgetActive:w,classNameLabel:_,classNameLabelActive:x,setActiveStyle:k,hasActiveStyle:E,editorControl:C,uniqueFieldId:S,resolveWidget:A,widget:T,getEditorComponents:O,query:P,queryHits:D,clearSearch:R,clearFieldErrors:M,isFetching:I,loadEntry:L,fieldsErrors:N,controlRef:j,isEditorComponent:F,isNewEditorComponent:B,parentIds:z,t:U,isDisabled:q,isFieldDuplicate:$,isFieldHidden:W,locale:H,isParentListCollapsed:V}=this.props;return o.createElement(e,{entry:t,collection:n,config:r,field:i,value:a,mediaPaths:s,metadata:l,onChange:u,onChangeObject:this.onChangeObject,onValidateObject:c,onOpenMediaLibrary:d,onClearMediaControl:h,onRemoveMediaControl:p,onPersistMedia:f,onAddAsset:m,onRemoveInsertedMedia:g,getAsset:v,forID:S,ref:this.processInnerControlRef,validate:this.validate,classNameWrapper:y,classNameWidget:b,classNameWidgetActive:w,classNameLabel:_,classNameLabelActive:x,setActiveStyle:k,setInactiveStyle:()=>this.setInactiveStyle(),hasActiveStyle:E,editorControl:C,resolveWidget:A,widget:T,getEditorComponents:O,getRemarkPlugins:Bs,query:P,queryHits:D,clearSearch:R,clearFieldErrors:M,isFetching:I,loadEntry:L,isEditorComponent:F,isNewEditorComponent:B,fieldsErrors:N,controlRef:j,parentIds:z,t:U,isDisabled:q,isFieldDuplicate:$,isFieldHidden:W,locale:H,isParentListCollapsed:V})}}IA(jA,"propTypes",{controlComponent:ie().func.isRequired,field:Q_().map.isRequired,hasActiveStyle:ie().bool,setActiveStyle:ie().func.isRequired,setInactiveStyle:ie().func.isRequired,classNameWrapper:ie().string.isRequired,classNameWidget:ie().string.isRequired,classNameWidgetActive:ie().string.isRequired,classNameLabel:ie().string.isRequired,classNameLabelActive:ie().string.isRequired,value:ie().oneOfType([ie().node,ie().object,ie().string,ie().bool]),mediaPaths:Q_().map.isRequired,metadata:Q_().map,fieldsErrors:Q_().map,onChange:ie().func.isRequired,onValidate:ie().func,onOpenMediaLibrary:ie().func.isRequired,onClearMediaControl:ie().func.isRequired,onRemoveMediaControl:ie().func.isRequired,onPersistMedia:ie().func.isRequired,onAddAsset:ie().func.isRequired,onRemoveInsertedMedia:ie().func.isRequired,getAsset:ie().func.isRequired,resolveWidget:ie().func.isRequired,widget:ie().object.isRequired,getEditorComponents:ie().func.isRequired,isFetching:ie().bool,controlRef:ie().func,query:ie().func.isRequired,clearSearch:ie().func.isRequired,clearFieldErrors:ie().func.isRequired,queryHits:ie().oneOfType([ie().array,ie().object]),editorControl:ie().elementType.isRequired,uniqueFieldId:ie().string.isRequired,loadEntry:ie().func.isRequired,t:ie().func.isRequired,onValidateObject:ie().func,isEditorComponent:ie().bool,isNewEditorComponent:ie().bool,entry:Q_().map.isRequired
${I&&$A.hidden};
`},xn(HA,null,B.globalStyles&&xn(kn,{styles:En(B.globalStyles,";;label:EditorControl;",";label:styles;")}),xn(KA,{field:i,isActive:S||this.state.styleActive,hasErrors:G,uniqueFieldId:this.uniqueFieldId,isFieldOptional:q,t:P}),H&&xn(VA,null,H.map((e=>e.message&&"string"==typeof e.message&&xn("li",{key:e.message.trim().replace(/[^a-z0-9]+/gi,"-")},e.message))))),xn(jA,{classNameWrapper:z(o`
${$A.widget};
`,{[o`
${$A.widgetActive};
`]:S||this.state.styleActive},{[o`
${$A.widgetError};
`]:G},{[o`
${$A.disabled}
`]:M}),classNameWidget:o`
${$A.widget};
`,classNameWidgetActive:o`
${$A.widgetActive};
`,classNameLabel:o`
${$A.label};
`,classNameLabelActive:o`
${$A.labelActive};
`,controlComponent:B.control,entry:t,collection:n,config:r,field:i,uniqueFieldId:this.uniqueFieldId,value:e,mediaPaths:s,metadata:W,onChange:(e,t)=>{u(i,e,t),k(this.uniqueFieldId)},onValidate:g&&gC()(g,this.uniqueFieldId),onOpenMediaLibrary:c,onClearMediaControl:d,onRemoveMediaControl:p,onRemoveInsertedMedia:h,onPersistMedia:m,onAddAsset:f,getAsset:l,hasActiveStyle:S||this.state.styleActive,setActiveStyle:()=>this.setState({styleActive:!0}),setInactiveStyle:()=>this.setState({styleActive:!1}),resolveWidget:js,widget:B,getEditorComponents:Fs,ref:v&&gC()(v,i),controlRef:y,editorControl:ZA,query:b,loadEntry:E,queryHits:w[this.uniqueFieldId]||[],clearSearch:x,clearFieldErrors:k,isFetching:_,fieldsErrors:a,onValidateObject:$,isEditorComponent:A,isNewEditorComponent:T,parentIds:O,t:P,validateMetaField:D,isDisabled:M,isFieldDuplicate:L,isFieldHidden:N,isLoadingAsset:R,locale:j,isParentListCollapsed:F}),U&&xn(GA,{active:S||this.state.styleActive,error:G},xn(DA(),{remarkPlugins:[MA()],allowedElements:["a","strong","em","del"],unwrapDisallowed:!0,components:{a:e=>{let{node:t}=e,n=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,FA);return xn("a",UA({},n,{target:"_blank",rel:"noopener noreferrer",style:{color:"inherit"}}))}}},U)))))}}qA(YA,"propTypes",{value:ie().oneOfType([ie().node,ie().object,ie().string,ie().bool]),field:Q_().map.isRequired,fieldsMetaData:Q_().map,fieldsErrors:Q_().map,mediaPaths:Q_().map.isRequired,boundGetAsset:ie().func.isRequired,onChange:ie().func.isRequired,openMediaLibrary:ie().func.isRequired,addAsset:ie().func.isRequired,removeInsertedMedia:ie().func.isRequired,persistMedia:ie().func.isRequired,onValidate:ie().func,processControlRef:ie().func,controlRef:ie().func,query:ie().func.isRequired,queryHits:ie().object,isFetching:ie().bool,clearSearch:ie().func.isRequired,clearFieldErrors:ie().func.isRequired,loadEntry:ie().func.isRequired,t:ie().func.isRequired,isEditorComponent:ie().bool,isNewEditorComponent:ie().bool,parentIds:ie().arrayOf(ie().string),entry:Q_().map.isRequired,collection:Q_().map.isRequired,isDisabled:ie().bool,isHidden:ie().bool,isFieldDuplicate:ie().func,isFieldHidden:ie().func,locale:ie().string,isParentListCollapsed:ie().bool}),qA(YA,"defaultProps",{parentIds:[]});const ZA=G((function(e){const{collections:t,entryDraft:n}=e,r=n.get("entry"),i=t.get(n.getIn(["entry","collection"])),o=Sm(e.medias);return{mediaPaths:e.mediaLibrary.get("controlMedia"),isFetching:e.search.isFetching,queryHits:e.search.queryHits,config:e.config,entry:r,collection:i,isLoadingAsset:o,loadEntry:async function(n,r){const i=t.get(n);if(i)return await Sp(e,i,r);throw new Error(`Can't find collection '${n}'`)},validateMetaField:(t,n,r)=>function(e,t,n,r,i){if(n.get("meta")&&"path"===n.get("name")){var o;if(!r)return Mp(r,"invalidPath",i);const n=r.split("/").map(gu(e.config.slug)).join("/");if(r!==n)return Mp(r,"invalidPath",i);const a=Nd(t,(0,kr.fromJS)({entry:{meta:{path:r}}})),s=a?function(e,t,n){const r=ef(e,t),i=r&&r.map((n=>Jp(e,t,n)));return i&&i.find((e=>(null==e?void 0:e.get("path"))===n))}(e.entries,t.get("name"),a):void 0,l=null==s?void 0:s.get("path"),u=null===(o=e.entryDraft)||void 0===o?void 0:o.getIn(["entry","path"]);if(l&&l!==u)return Mp(r,"pathExists",i)}return{error:!1}}(e,i,t,n,r)}}),(function(e){return zA(zA({},(0,vr.DE)({openMediaLibrary:Sc,clearMediaControl:Ec,removeMediaControl:Cc,removeInsertedMedia:Tc,persistMedia:Dc,addAsset:td,query:Wu,clearSearch:$u,clearFieldErrors:kp},e)),{},{boundGetAsset:(t,n)=>id(e,t,n)})}),(function(e,t,n){return zA(zA(zA(zA({},e),t),n),{},{boundGetAsset:t.boundGetAsset(e.collection,e.entry)})}))((0,gr.Iu)()(YA)),XA=ZA;function QA(e,t,n){return t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPri
2024-01-31 07:38:11 +02:00
Decap CMS is adding labels to ${t.length} of your Editorial Workflow
entries. The "Workflow" tab will be unavailable during this migration. You may use other
areas of the CMS during this time. Note that closing the CMS will pause the migration.
2025-01-28 00:57:15 +02:00
`)),n+=1,await this.migratePullRequest(e,`${n} of ${t.length}`);e=(await this.getPullRequests(void 0,OR.Open,(e=>PR(e,this.cmsLabelPrefix)))).map((e=>e.head.ref))}return e}async getStatuses(e,t){const n=xP(this.generateContentKey(e,t)),r=(await this.getBranchPullRequest(n)).head.sha;return(await this.request(`${this.originRepoURL}/commits/${r}/status`)).statuses.map((e=>({context:e.context,target_url:e.target_url,state:e.state===TR.Success?LP.Success:LP.Other})))}async persistFiles(e,t,n){const r=t.concat(e),i=r.map((e=>this.uploadBlob(e)));if(await Promise.all(i),n.useWorkflow){const i=t.map((({sha:e,path:t})=>({path:il()(t,"/"),sha:e}))),o=e[0].slug;return this.editorialWorkflowGit(r,o,i,n)}return this.getDefaultBranch().then((e=>this.updateTree(e.commit.sha,r))).then((e=>this.commit(n.commitMessage,e))).then((e=>this.patchBranch(this.branch,e.sha)))}async getFileSha(e,{repoURL:t=this.repoURL,branch:n=this.branch}={}){const r=e.split("/"),i=wR()(r),o=xR()(r).join("/"),a=`${t}/git/trees/${n}:${encodeURIComponent(o)}`,s=(await this.request(a)).tree.find((e=>e.path===i));if(s)return s.sha;throw new vo("Not Found",404,SR)}async deleteFiles(e,t){if(this.useOpenAuthoring)return Promise.reject("Cannot delete published entries as an Open Authoring user!");const n=await this.getDefaultBranch(),r=e.map((e=>({path:e,sha:null}))),i=await this.updateTree(n.commit.sha,r),o=await this.commit(t,i);await this.patchBranch(this.branch,o.sha)}async createBranchAndPullRequest(e,t,n){return await this.createBranch(e,t),this.createPR(n,e)}async updatePullRequestLabels(e,t){await this.request(`${this.repoURL}/issues/${e}/labels`,{method:"PUT",body:JSON.stringify({labels:t})})}async diffFromFile(e){return{path:e.filename,newFile:"added"===e.status,sha:e.sha,binary:"renamed"!==e.status&&!e.patch||e.filename.endsWith(".svg")}}async editorialWorkflowGit(e,t,n,r){const i=xP(this.generateContentKey(r.collectionName,t));if(r.unpublished){const{files:t}=await this.getDifferences(this.branch,await this.getHeadReference(i)),o=await Promise.all(t.map((e=>this.diffFromFile(e)))),a=[];for(const e of o.filter((e=>e.binary)))n.some((t=>t.path===e.path))||a.push({path:e.path,sha:null});const s=await this.rebaseBranch(i),l=a.concat(e),u=await this.updateTree(s.sha,l,i),c=await this.commit(r.commitMessage,u);return this.patchBranch(i,c.sha,{force:!0})}{const t=await this.getDefaultBranch(),n=await this.updateTree(t.commit.sha,e),o=await this.commit(r.commitMessage,n);if(this.useOpenAuthoring)await this.createBranch(i,o.sha);else{const e=await this.createBranchAndPullRequest(i,o.sha,r.commitMessage);await this.setPullRequestStatus(e,r.status||this.initialWorkflowStatus)}}}async getDifferences(e,t){const n=this.useOpenAuthoring?10:1;for(let r=1;r<=n;r++)try{return await this.request(`${this.originRepoURL}/compare/${e}...${t}`)}catch(e){if(r===n)throw console.warn(`Reached maximum number of attempts '${n}' for getDifferences`),e;await new Promise((e=>setTimeout(e,500*r)))}throw new vo("Not Found",404,SR)}async rebaseSingleCommit(e,t){const n=DR((await this.getDifferences(t.parents[0].sha,t.sha)).files);if(n.length>0){const r=await this.updateTree(e.sha,n),{message:i,author:o,committer:a}=t.commit;return await this.createCommit(i,r.sha,[e.sha],o,a)}return t}async rebaseCommits(e,t){return 0===t.length||t[0].parents[0].sha===e.sha?wR()(t):t.reduce(((e,t)=>e.then((e=>{const n=e,r=t;return this.rebaseSingleCommit(n,r)}))),Promise.resolve(e))}async rebaseBranch(e){try{const{base_commit:t,commits:n}=await this.getDifferences(this.branch,await this.getHeadReference(e));return await this.rebaseCommits(t,n)}catch(e){throw console.error(e),e}}async setPullRequestStatus(e,t){const n=[...e.labels.filter((e=>!gP(e.name,this.cmsLabelPrefix))).map((e=>e.name)),yP(t,this.cmsLabelPrefix)];await this.updatePullRequestLabels(e.number,n)}async updateUnpublishedEntryStatus(e,t,n){const r=this.generateContentKey(e,t),i=xP(r),o=await this.getBranchPullRequest(i);if(this.useOpenAuthoring){if("pending_publish"===status)throw new Error('Open Authoring entries may not be set to
2024-01-31 07:38:11 +02:00
fragment RepositoryParts on Repository {
id
isFork
}
2025-01-28 00:57:15 +02:00
`,ej=ZN`
2024-01-31 07:38:11 +02:00
fragment BlobWithTextParts on Blob {
id
text
is_binary: isBinary
}
2025-01-28 00:57:15 +02:00
`,tj=ZN`
2024-01-31 07:38:11 +02:00
fragment ObjectParts on GitObject {
id
sha: oid
}
2025-01-28 00:57:15 +02:00
`,nj=ZN`
2024-01-31 07:38:11 +02:00
fragment BranchParts on Ref {
commit: target {
...ObjectParts
}
id
name
prefix
repository {
...RepositoryParts
}
}
2025-01-28 00:57:15 +02:00
${tj}
${JN}
`,rj=ZN`
2024-01-31 07:38:11 +02:00
fragment PullRequestParts on PullRequest {
id
baseRefName
baseRefOid
body
headRefName
headRefOid
number
state
title
merged_at: mergedAt
updated_at: updatedAt
user: author {
login
... on User {
name
}
}
repository {
...RepositoryParts
}
labels(last: 100) {
nodes {
name
}
}
}
2025-01-28 00:57:15 +02:00
${JN}
`,ij=(ZN`
2024-01-31 07:38:11 +02:00
fragment TreeEntryParts on TreeEntry {
path: name
sha: oid
type
mode
}
2025-01-28 00:57:15 +02:00
`,ZN`
2024-01-31 07:38:11 +02:00
fragment FileEntryParts on TreeEntry {
name
sha: oid
type
blob: object {
... on Blob {
size: byteSize
}
}
}
2025-01-28 00:57:15 +02:00
`),oj=ZN`
2024-01-31 07:38:11 +02:00
query repoPermission($owner: String!, $name: String!) {
repository(owner: $owner, name: $name) {
...RepositoryParts
viewerPermission
}
}
2025-01-28 00:57:15 +02:00
${JN}
`,aj=ZN`
2024-01-31 07:38:11 +02:00
query {
viewer {
id
avatar_url: avatarUrl
name
login
}
}
2025-01-28 00:57:15 +02:00
`,sj=ZN`
2024-01-31 07:38:11 +02:00
query blob($owner: String!, $name: String!, $expression: String!) {
repository(owner: $owner, name: $name) {
...RepositoryParts
object(expression: $expression) {
... on Blob {
...BlobWithTextParts
}
}
}
}
2025-01-28 00:57:15 +02:00
${JN}
${ej}
`,lj=ZN`
2024-01-31 07:38:11 +02:00
query statues($owner: String!, $name: String!, $sha: GitObjectID!) {
repository(owner: $owner, name: $name) {
...RepositoryParts
object(oid: $sha) {
...ObjectParts
... on Commit {
status {
id
contexts {
id
context
state
target_url: targetUrl
}
}
}
}
}
}
2025-01-28 00:57:15 +02:00
${JN}
${tj}
`;function uj(e){return ZN`
query files($owner: String!, $name: String!, $expression: String!) {
repository(owner: $owner, name: $name) {
...RepositoryParts
object(expression: $expression) {
${function(e=1){const t="PLACE_HOLDER";let n=gs`
...ObjectParts
... on Tree {
entries {
...FileEntryParts
${t}
}
}
`;for(let r=0;r<e-1;r++)n=n.replace(t,gs`
object {
... on Tree {
entries {
...FileEntryParts
${t}
}
}
}
`);return n=n.replace(t,""),n}(e)}
}
}
}
${JN}
${tj}
${ij}
`}const cj="\nbranch: ref(qualifiedName: $qualifiedName) {\n ...BranchParts\n}\n",dj=ZN`
2024-01-31 07:38:11 +02:00
query branch($owner: String!, $name: String!, $qualifiedName: String!) {
repository(owner: $owner, name: $name) {
...RepositoryParts
2025-01-28 00:57:15 +02:00
${cj}
2024-01-31 07:38:11 +02:00
}
}
2025-01-28 00:57:15 +02:00
${JN}
${nj}
`,pj=ZN`
2024-01-31 07:38:11 +02:00
query openAuthoringBranches($owner: String!, $name: String!, $refPrefix: String!) {
repository(owner: $owner, name: $name) {
...RepositoryParts
refs(refPrefix: $refPrefix, last: 100) {
nodes {
...BranchParts
}
}
}
}
2025-01-28 00:57:15 +02:00
${JN}
${nj}
`,fj=ZN`
2024-01-31 07:38:11 +02:00
query repository($owner: String!, $name: String!) {
repository(owner: $owner, name: $name) {
...RepositoryParts
}
}
2025-01-28 00:57:15 +02:00
${JN}
`,hj="\npullRequest(number: $number) {\n ...PullRequestParts\n}\n",mj=ZN`
2024-01-31 07:38:11 +02:00
query pullRequest($owner: String!, $name: String!, $number: Int!) {
repository(owner: $owner, name: $name) {
id
2025-01-28 00:57:15 +02:00
${hj}
2024-01-31 07:38:11 +02:00
}
}
2025-01-28 00:57:15 +02:00
${rj}
`,gj=ZN`
2024-01-31 07:38:11 +02:00
query pullRequests($owner: String!, $name: String!, $head: String, $states: [PullRequestState!]) {
repository(owner: $owner, name: $name) {
id
pullRequests(last: 100, headRefName: $head, states: $states) {
nodes {
...PullRequestParts
}
}
}
}
2025-01-28 00:57:15 +02:00
${rj}
`,vj=ZN`
2024-01-31 07:38:11 +02:00
query pullRequestAndBranch($owner: String!, $name: String!, $originRepoOwner: String!, $originRepoName: String!, $qualifiedName: String!, $number: Int!) {
repository(owner: $owner, name: $name) {
...RepositoryParts
2025-01-28 00:57:15 +02:00
${cj}
2024-01-31 07:38:11 +02:00
}
origin: repository(owner: $originRepoOwner, name: $originRepoName) {
...RepositoryParts
2025-01-28 00:57:15 +02:00
${hj}
2024-01-31 07:38:11 +02:00
}
}
2025-01-28 00:57:15 +02:00
${JN}
${nj}
${rj}
`,yj=ZN`
2024-01-31 07:38:11 +02:00
query fileSha($owner: String!, $name: String!, $expression: String!) {
repository(owner: $owner, name: $name) {
...RepositoryParts
file: object(expression: $expression) {
...ObjectParts
}
}
}
2025-01-28 00:57:15 +02:00
${JN}
${tj}
`,bj=ZN`
mutation updateRef($input: UpdateRefInput!) {
updateRef(input: $input) {
branch: ref {
...BranchParts
2024-01-31 07:38:11 +02:00
}
}
2025-01-28 00:57:15 +02:00
}
${nj}
`,wj="\ndeleteRef(input: $deleteRefInput) {\n clientMutationId\n}\n",_j=ZN`
mutation deleteRef($deleteRefInput: DeleteRefInput!) {
${wj}
}
`,xj="\nclosePullRequest(input: $closePullRequestInput) {\n clientMutationId\n pullRequest {\n ...PullRequestParts\n }\n}\n",kj=ZN`
mutation closePullRequestAndDeleteBranch($closePullRequestInput: ClosePullRequestInput!) {
${xj}
}
${rj}
`,Ej=ZN`
mutation closePullRequestAndDeleteBranch(
$closePullRequestInput: ClosePullRequestInput!
$deleteRefInput: DeleteRefInput!
) {
${xj}
${wj}
}
${rj}
`,Cj="\n createPullRequest(input: $createPullRequestInput) {\n clientMutationId\n pullRequest {\n ...PullRequestParts\n }\n}\n ",Sj=ZN`
mutation createPullRequest($createPullRequestInput: CreatePullRequestInput!) {
${Cj}
}
${rj}
`,Aj=ZN`
mutation createBranch($createRefInput: CreateRefInput!) {
createRef(input: $createRefInput) {
branch: ref {
...BranchParts
}
}
}
${nj}
`,Tj=ZN`
mutation createBranchAndPullRequest(
$createRefInput: CreateRefInput!
$createPullRequestInput: CreatePullRequestInput!
) {
createRef(input: $createRefInput) {
branch: ref {
...BranchParts
}
}
${Cj}
}
${nj}
${rj}
`,Oj=ZN`
mutation reopenPullRequest($reopenPullRequestInput: ReopenPullRequestInput!) {
reopenPullRequest(input: $reopenPullRequestInput) {
clientMutationId
pullRequest {
...PullRequestParts
2024-01-31 07:38:11 +02:00
}
}
}
2025-01-28 00:57:15 +02:00
${rj}
`;function Pj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Dj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pj(Object(n),!0).forEach((function(t){Rj(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pj(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Rj(e,t,n){return t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Mj="no-cache",Ij="cache-first",Lj=new yL({introspectionQueryResultData:VL()});function Nj(e){return Dj(Dj({},e),{},{labels:e.labels.nodes,head:{ref:e.headRefName,sha:e.headRefOid,repo:{fork:e.repository.isFork}},base:{ref:e.baseRefName,sha:e.baseRefOid}})}class jj extends MR{constructor(e){super(e),Rj(this,"client",void 0),this.client=this.getApolloClient()}getApolloClient(){const e=WL(((e,{headers:t})=>({headers:Dj(Dj({"Content-Type":"application/json; charset=utf-8"},t),{},{authorization:this.token?`${this.tokenKeyword} ${this.token}`:""})}))),t=$L({uri:`${this.apiRoot}/graphql`});return new OI({link:e.concat(t),cache:new LL({fragmentMatcher:Lj}),defaultOptions:{watchQuery:{fetchPolicy:Mj,errorPolicy:"ignore"},query:{fetchPolicy:Mj,errorPolicy:"all"}}})}reset(){return this.client.resetStore()}async getRepository(e,t){const{data:n}=await this.query({query:fj,variables:{owner:e,name:t},fetchPolicy:Ij});return n.repository}query(e){return this.client.query(e).catch((e=>{throw new vo(e.message,500,"GitHub")}))}async mutate(e){try{return await this.client.mutate(e)}catch(s){const l=s.graphQLErrors;if(Array.isArray(l)&&l.some((e=>"Ref cannot be created."===e.message))){var t,n;const r=(null==e||null===(t=e.variables)||void 0===t||null===(n=t.createRefInput)||void 0===n?void 0:n.name)||"",i=il()(r,"refs/heads/");i&&await jP(i,(e=>this.getBranch(e)),SR)}else if(Array.isArray(l)&&l.some((e=>new RegExp(`A ref named "refs/heads/${dP}/.+?" already exists in the repository.`).test(e.message)))){var r,i,o,a;const t=(null==e||null===(r=e.variables)||void 0===r||null===(i=r.createRefInput)||void 0===i?void 0:i.name)||"",n=(null==e||null===(o=e.variables)||void 0===o||null===(a=o.createRefInput)||void 0===a?void 0:a.oid)||"",s=il()(t,"refs/heads/");if(s&&s.startsWith(`${dP}/`)&&n)try{return await this.backupBranch(s),await this.deleteBranch(s),await this.client.mutate(e)}catch(e){console.log(e)}}throw new vo(s.message,500,"GitHub")}}async hasWriteAccess(){const{repoOwner:e,repoName:t}=this;try{const{data:n}=await this.query({query:oj,variables:{owner:e,name:t},fetchPolicy:Ij}),{viewerPermission:r}=n.repository;return["ADMIN","MAINTAIN","WRITE"].includes(r)}catch(e){throw console.error("Problem fetching repo data from GitHub"),e}}async user(){const{data:e}=await this.query({query:aj,fetchPolicy:Ij});return e.viewer}async retrieveBlobObject(e,t,n,r={}){const{data:i}=await this.query(Dj({query:sj,variables:{owner:e,name:t,expression:n}},r));if(i.repository.object){const{is_binary:e,text:t}=i.repository.object;return{isNull:!1,isBinary:e,text:t}}return{isNull:!0}}getOwnerAndNameFromRepoUrl(e){let{repoOwner:t,repoName:n}=this;return e===this.originRepoURL&&({originRepoOwner:t,originRepoName:n}=this),{owner:t,name:n}}async readFile(e,t,{branch:n=this.branch,repoURL:r=this.repoURL,parseText:i=!0}={}){return t||(t=await this.getFileSha(e,{repoURL:r,branch:n})),await RP(t,(()=>this.fetchBlobContent({sha:t,repoURL:r,parseText:i})),Fo,i)}async fetchBlobContent({sha:e,repoURL:t,parseText:n}){if(!n)return super.fetchBlobContent({sha:e,repoURL:t,parseText:n});c
Repo "${this.repo}" not found.
Please ensure the repo information is spelled correctly.
If the repo is private, make sure you're logged into a GitHub account with access.
If your repo is under an organization, ensure the organization has granted access to Decap CMS.
`,e}))&&!this.bypassWriteAccessCheckForAppTokens)throw new Error("Your GitHub user account does not have access to this repo.");return zj(zj({},n),{},{token:e.token,useOpenAuthoring:this.useOpenAuthoring})}logout(){if(this.token=null,this.api&&this.api.reset&&"function"==typeof this.api.reset)return this.api.reset()}getToken(){return Promise.resolve(this.token)}async entriesByFolder(e,t,n){const r=this.api.originRepoURL;let i;const o=await Zo((()=>this.api.listFiles(e,{repoURL:r,depth:n}).then((e=>{const n=e.filter((e=>yo(e,t))),r=this.getCursorAndFiles(n,1);return i=r.cursor,r.files}))),((e,t)=>this.api.readFile(e,t,{repoURL:r})),this.api.readFileMetadata.bind(this.api),SR);return o[Lo]=i,o}async allEntriesByFolder(e,t,n,r){const i=this.api.originRepoURL;return await Zo((()=>this.api.listFiles(e,{repoURL:i,depth:n}).then((e=>e.filter((e=>(!r||r.test(e.path))&&yo(e,t)))))),((e,t)=>this.api.readFile(e,t,{repoURL:i})),this.api.readFileMetadata.bind(this.api),SR)}entriesByFiles(e){const t=this.useOpenAuthoring?this.api.originRepoURL:this.api.repoURL;return Xo(e,((e,n)=>this.api.readFile(e,n,{repoURL:t}).catch((()=>""))),this.api.readFileMetadata.bind(this.api),SR)}getEntry(e){const t=this.api.originRepoURL;return this.api.readFile(e,null,{repoURL:t}).then((t=>({file:{path:e,id:null},data:t}))).catch((()=>({file:{path:e,id:null},data:""})))}getMedia(e=this.mediaFolder){return this.api.listFiles(e).then((e=>e.map((({id:e,name:t,size:n,path:r})=>({id:e,name:t,size:n,displayURL:{id:e,path:r},path:r})))))}async getMediaFile(e){const t=await ea(e,null,this.api.readFile.bind(this.api)),n=Wo(e),r=Jo(n,t),i=URL.createObjectURL(r);return{id:await Xu(t),displayURL:i,path:e,name:n,size:r.size,file:r,url:i}}getMediaDisplayURL(e){return this._mediaDisplayURLSem=this._mediaDisplayURLSem||Co()(10),ta(e,this.api.readFile.bind(this.api),this._mediaDisplayURLSem)}persistEntry(e,t){return na(this.lock,(()=>this.api.persistFiles(e.dataFiles,e.assets,t)),"Failed to acquire persist entry lock")}async persistMedia(e,t){try{await this.api.persistFiles([],[e],t);const{sha:n,path:r,fileObj:i}=e,o=i?URL.createObjectURL(i):"";return{id:n,name:i.name,size:i.size,displayURL:o,path:il()(r,"/")}}catch(e){throw console.error(e),e}}deleteFiles(e,t){return this.api.deleteFiles(e,t)}async traverseCursor(e,t){const n=e.meta,r=e.data.get("files").toJS();let i;switch(t){case"first":default:i=this.getCursorAndFiles(r,1);break;case"last":i=this.getCursorAndFiles(r,n.get("pageCount"));break;case"next":i=this.getCursorAndFiles(r,n.get("page")+1);break;case"prev":i=this.getCursorAndFiles(r,n.get("page")-1)}return{entries:await Xo(i.files,((e,t)=>this.api.readFile(e,t,{repoURL:this.api.originRepoURL}).catch((()=>""))),this.api.readFileMetadata.bind(this.api),SR),cursor:i.cursor}}async loadMediaFile(e,t){const n=await ea(t.path,t.id,((t,n,{parseText:r})=>this.api.readFile(t,n,{branch:e,parseText:r}))),r=Wo(t.path),i=Jo(r,n);return{id:t.id,displayURL:URL.createObjectURL(i),path:t.path,name:r,size:i.size,file:i}}async unpublishedEntries(){const e=await Qo((()=>this.api.listUnpublishedBranches().then((e=>e.map((e=>_P(e)))))));return e}async unpublishedEntry({id:e,collection:t,slug:n}){if(e)return await this.api.retrieveUnpublishedEntryData(e);if(t&&n){const e=this.api.generateContentKey(t,n);return await this.api.retrieveUnpublishedEntryData(e)}throw new Error("Missing unpublished entry id or collection and slug")}getBranch(e,t){return xP(this.api.generateContentKey(e,t))}async unpublishedEntryDataFile(e,t,n,r){const i=this.getBranch(e,t);return await this.api.readFile(n,r,{branch:i})}async unpublishedEntryMediaFile(e,t,n,r){const i=this.getBranch(e,t);return await this.loadMediaFile(i,{path:n,id:r})}async getDeployPreview(e,t){try{const n=NP(await this.api.getStatuses(e,t),this.previewContext);if(n){const{target_url:e,state:t}=n;return{url:e,status:t}}return null}catch(e){return null}}updateUnpublishedEntryStatus(e,t,n){return na(this.lock,(()=>this.api.updateUnpublishedEntryStatus(e,t,n)),"Failed to acquire update entry status lock")}deleteUnpublishedEntry(e,t){re
2024-01-31 07:38:11 +02:00
query files($repo: ID!, $branch: String!, $path: String!, $recursive: Boolean!, $cursor: String) {
project(fullPath: $repo) {
repository {
tree(ref: $branch, path: $path, recursive: $recursive) {
blobs(after: $cursor) {
nodes {
type
id: sha
path
name
}
pageInfo {
endCursor
hasNextPage
}
}
}
}
}
}
2025-01-28 00:57:15 +02:00
`,sF=ZN`
2024-01-31 07:38:11 +02:00
query blobs($repo: ID!, $branch: String!, $paths: [String!]!) {
project(fullPath: $repo) {
repository {
blobs(ref: $branch, paths: $paths) {
nodes {
id
data: rawBlob
}
}
}
}
}
2025-01-28 00:57:15 +02:00
`;function lF(e){return ZN`
query lastCommits($repo: ID!, $branch: String!) {
project(fullPath: $repo) {
repository {
${e.map(((e,t)=>gs`
tree${t}: tree(ref: $branch, path: "${e}") {
lastCommit {
authorName
authoredDate
author {
id
username
name
publicEmail
}
}
2024-01-31 07:38:11 +02:00
}
2025-01-28 00:57:15 +02:00
`)).join("\n")}
}
2024-01-31 07:38:11 +02:00
}
2025-01-28 00:57:15 +02:00
}
`}function uF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function cF(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?uF(Object(n),!0).forEach((function(t){dF(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uF(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function dF(e,t,n){return t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const pF="no-cache",fF="GitLab";var hF=function(e){return e.CREATE="create",e.DELETE="delete",e.MOVE="move",e.UPDATE="update",e}(hF||{}),mF=function(e){return e.Pending="pending",e.Running="running",e.Success="success",e.Failed="failed",e.Canceled="canceled",e}(mF||{});function gF(e,t,n){for(let r=0;r<e.length;r+=t)n(e.slice(r,r+t))}class vF{constructor(e){dF(this,"apiRoot",void 0),dF(this,"graphQLAPIRoot",void 0),dF(this,"token",void 0),dF(this,"branch",void 0),dF(this,"useOpenAuthoring",void 0),dF(this,"repo",void 0),dF(this,"repoURL",void 0),dF(this,"commitAuthor",void 0),dF(this,"squashMerges",void 0),dF(this,"initialWorkflowStatus",void 0),dF(this,"cmsLabelPrefix",void 0),dF(this,"graphQLClient",void 0),dF(this,"withAuthorizationHeaders",(e=>{const t=mo.withHeaders(this.token?{Authorization:`Bearer ${this.token}`}:{},e);return Promise.resolve(t)})),dF(this,"buildRequest",(async e=>{const t=mo.withRoot(this.apiRoot)(e),n=await this.withAuthorizationHeaders(t);return n.has("cache")?n:mo.withNoCache(n)})),dF(this,"request",(async e=>{try{return TP(this,e)}catch(e){throw new vo(e.message,null,fF)}})),dF(this,"responseToJSON",_o({format:"json",apiName:fF})),dF(this,"responseToBlob",_o({format:"blob",apiName:fF})),dF(this,"responseToText",_o({format:"text",apiName:fF})),dF(this,"requestJSON",(e=>this.request(e).then(this.responseToJSON))),dF(this,"requestText",(e=>this.request(e).then(this.responseToText))),dF(this,"user",(()=>this.requestJSON("/user"))),dF(this,"WRITE_ACCESS",30),dF(this,"MAINTAINER_ACCESS",40),dF(this,"hasWriteAccess",(async()=>{const{shared_with_groups:e,permissions:t}=await this.requestJSON(this.repoURL),{project_access:n,group_access:r}=t;if(n&&n.access_level>=this.WRITE_ACCESS)return!0;if(r&&r.access_level>=this.WRITE_ACCESS)return!0;if(e&&e.length>0){const t=(i=e).reduce(((e,t)=>t.group_access_level>e.group_access_level?t:e),i[0]);if(t.group_access_level>=this.MAINTAINER_ACCESS)return!0;if(t.group_access_level>=this.WRITE_ACCESS)try{const e=await this.getDefaultBranch();if(e.developers_can_merge&&e.developers_can_push)return!0}catch(e){console.log("Failed getting default branch",e)}}var i;return!1})),dF(this,"readFile",(async(e,t,{parseText:n=!0,branch:r=this.branch}={})=>await RP(t,(async()=>await this.request({url:`${this.repoURL}/repository/files/${encodeURIComponent(e)}/raw`,params:{ref:r},cache:"no-store"}).then(n?this.responseToText:this.responseToBlob)),Fo,n))),dF(this,"getCursorFromHeaders",(e=>{const t=parseInt(e.get("X-Page"),10),n=parseInt(e.get("X-Total-Pages"),10),r=parseInt(e.get("X-Per-Page"),10),i=parseInt(e.get("X-Total"),10),o=xo(e.get("Link")),a=(0,kr.Map)(o).keySeq().flatMap((e=>"prev"===e&&t>1||"next"===e&&t<n||"first"===e&&t>1||"last"===e&&t<n?[e]:[]));return Io.create({actions:a,meta:{page:t,count:i,pageSize:r,pageCount:n},data:{links:o}})})),dF(this,"getCursor",(({headers:e})=>this.getCursorFromHeaders(e))),dF(this,"fetchCursor",(e=>Hi()([mo.withMethod("HEAD"),this.request,oF(this.getCursor)])(e))),dF(this,"fetchCursorAndEntries",(e=>Hi()([mo.withMethod("GET"),this.request,e=>Promise.all([e.t
Repo "${this.repo}" not found.
Please ensure the repo information is spelled correctly.
If the repo is private, make sure you're logged into a GitLab account with access.
`,e})))throw new Error("Your GitLab user account does not have access to this repo.");if(!this.isBranchConfigured){const e=await async function(e){let t;const{token:n,backend:r,repo:i,apiRoot:o}=e;switch(r){case"gitlab":t=`/projects/${encodeURIComponent(i)}`;break;case"bitbucket":t=`/repositories/${i}`;break;default:t=`/repos/${i}`}const a=await DP(t,{token:n,backend:r,apiRoot:o});let s;if("bitbucket"===r){const{mainbranch:{name:e}}=a;s=e}else{const{default_branch:e}=a;s=e}return s}({backend:"gitlab",repo:this.repo,token:this.token,apiRoot:this.apiRoot});e&&(this.branch=e)}return bF(bF({},t),{},{login:t.username,token:e.token})}async logout(){this.token=null}getToken(){return Promise.resolve(this.token)}filterFile(e,t,n,r){const i=Oi()(t.path.split(e)[1]||"/","/");return yo(t,n)&&i.split("/").length<=r}async entriesByFolder(e,t,n){let r;const i=await Zo((()=>this.api.listFiles(e,n>1).then((({files:i,cursor:o})=>(r=o.mergeMeta({folder:e,extension:t,depth:n}),i.filter((r=>this.filterFile(e,r,t,n))))))),this.api.readFile.bind(this.api),this.api.readFileMetadata.bind(this.api),fF);return i[Lo]=r,i}async listAllFiles(e,t,n){return(await this.api.listAllFiles(e,n>1)).filter((r=>this.filterFile(e,r,t,n)))}async allEntriesByFolder(e,t,n){const r=await aa({listAllFiles:()=>this.listAllFiles(e,t,n),readFile:this.api.readFile.bind(this.api),readFileMetadata:this.api.readFileMetadata.bind(this.api),apiName:fF,branch:this.branch,localForage:Fo,folder:e,extension:t,depth:n,getDefaultBranch:()=>this.api.getDefaultBranch().then((e=>({name:e.name,sha:e.commit.id}))),isShaExistsInBranch:this.api.isShaExistsInBranch.bind(this.api),getDifferences:(e,t)=>this.api.getDifferences(e,t),getFileId:e=>this.api.getFileId(e,this.branch),filterFile:r=>this.filterFile(e,r,t,n),customFetch:this.useGraphQL?e=>this.api.readFilesGraphQL(e):void 0});return r}entriesByFiles(e){return Xo(e,this.api.readFile.bind(this.api),this.api.readFileMetadata.bind(this.api),fF)}getEntry(e){return this.api.readFile(e).then((t=>({file:{path:e,id:null},data:t})))}getMedia(e=this.mediaFolder){return this.api.listAllFiles(e).then((e=>e.map((({id:e,name:t,path:n})=>({id:e,name:t,path:n,displayURL:{id:e,name:t,path:n}})))))}getMediaDisplayURL(e){return this._mediaDisplayURLSem=this._mediaDisplayURLSem||Co()(10),ta(e,this.api.readFile.bind(this.api),this._mediaDisplayURLSem)}async getMediaFile(e){const t=Wo(e),n=await ea(e,null,this.api.readFile.bind(this.api)),r=Jo(t,n),i=URL.createObjectURL(r);return{id:await Xu(n),displayURL:i,path:e,name:t,size:r.size,file:r,url:i}}async persistEntry(e,t){return na(this.lock,(()=>this.api.persistFiles(e.dataFiles,e.assets,t)),"Failed to acquire persist entry lock")}async persistMedia(e,t){const n=e.fileObj,[r]=await Promise.all([Xu(n),this.api.persistFiles([],[e],t)]),{path:i}=e,o=URL.createObjectURL(n);return{displayURL:o,path:il()(i,"/"),name:n.name,size:n.size,file:n,url:o,id:r}}deleteFiles(e,t){return this.api.deleteFiles(e,t)}traverseCursor(e,t){return this.api.traverseCursor(e,t).then((async({entries:t,cursor:n})=>{var r,i,o;const[a,s,l]=[null===(r=e.meta)||void 0===r?void 0:r.get("folder"),null===(i=e.meta)||void 0===i?void 0:i.get("depth"),null===(o=e.meta)||void 0===o?void 0:o.get("extension")];return a&&s&&l&&(t=t.filter((e=>this.filterFile(a,e,l,s))),n=n.mergeMeta({folder:a,extension:l,depth:s})),{entries:await Xo(t,this.api.readFile.bind(this.api),this.api.readFileMetadata.bind(this.api),fF),cursor:n}}))}loadMediaFile(e,t){return ea(t.path,null,((t,n,{parseText:r})=>this.api.readFile(t,n,{branch:e,parseText:r}))).then((e=>{const n=Wo(t.path),r=Jo(n,e);return{id:t.path,displayURL:URL.createObjectURL(r),path:t.path,name:n,size:r.size,file:r}}))}async loadEntryMediaFiles(e,t){return await Promise.all(t.map((t=>this.loadMediaFile(e,t))))}async unpublishedEntries(){const e=await Qo((()=>this.api.listUnpublishedBranches().then((e=>e.map((e=>_P(e)))))));return e}async unpublishedEntry({id:e,collection:t,slug:n}){if(e)return await this.api.retrieveUnpublishedEntryData(e);if(t&&n){const e=bP(t,n);return await this.api.retrieveUnpu
source.repository.full_name = "${this.repo}"
AND state = "${hB.OPEN}"
AND destination.branch.name = "${this.branch}"
AND comment_count > 0
AND ${t}
`}}),r=await Promise.all(n.values.map((e=>this.getPullRequestLabel(e.id))));return n.values.filter(((e,t)=>gP(r[t],this.cmsLabelPrefix)))}async getBranchPullRequest(e){const t=await this.getPullRequests(e);if(t.length<=0)throw new Oo("content is not under editorial workflow",!0);return t[0]}async listUnpublishedBranches(){return console.log("%c Checking for Unpublished entries","line-height: 30px;text-align: center;font-weight: bold"),(await this.getPullRequests()).map((e=>e.source.branch.name))}async retrieveUnpublishedEntryData(e){const{collection:t,slug:n}=wP(e),r=xP(e),i=await this.getBranchPullRequest(r),o=await this.getDifferences(r),a=vP(await this.getPullRequestLabel(i.id),this.cmsLabelPrefix),s=i.updated_on,l=i.author.display_name;return{collection:t,slug:n,status:a,diffs:o.filter((e=>"deleted"!==e.status)).map((e=>({path:e.path,newFile:e.newFile,id:""}))),updatedAt:s,pullRequestAuthor:l}}async updateUnpublishedEntryStatus(e,t,n){const r=xP(bP(e,t)),i=await this.getBranchPullRequest(r);await this.addPullRequestComment(i,yP(n,this.cmsLabelPrefix))}async mergePullRequest(e){await this.requestJSON({method:"POST",url:`${this.repoURL}/pullrequests/${e.id}/merge`,headers:{"Content-Type":vB},body:JSON.stringify({message:fP,close_source_branch:!0,merge_strategy:this.mergeStrategy})})}async publishUnpublishedEntry(e,t){const n=xP(bP(e,t)),r=await this.getBranchPullRequest(n);await this.mergePullRequest(r)}async declinePullRequest(e){await this.requestJSON({method:"POST",url:`${this.repoURL}/pullrequests/${e.id}/decline`})}async deleteBranch(e){await this.request({method:"DELETE",url:`${this.repoURL}/refs/branches/${e}`})}async deleteUnpublishedEntry(e,t){const n=xP(bP(e,t)),r=await this.getBranchPullRequest(n);await this.declinePullRequest(r),await this.deleteBranch(n)}async getPullRequestStatuses(e){return(await this.requestJSON({url:`${this.repoURL}/pullrequests/${e.id}/statuses`,params:{pagelen:100}})).values}async getStatuses(e,t){const n=xP(bP(e,t)),r=await this.getBranchPullRequest(n);return(await this.getPullRequestStatuses(r)).map((({key:e,state:t,url:n})=>({context:e,state:t===mB.Successful?LP.Success:LP.Other,target_url:n})))}async getUnpublishedEntrySha(e,t){const n=xP(bP(e,t));return(await this.getBranchPullRequest(n)).destination.commit.hash}}function wB(e,t,n){return t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const _B=gb(O_,{target:"e15sc0jo0",label:"LoginButtonIcon"})({name:"1gnqu05",styles:"margin-right:18px"});class xB extends o.Component{constructor(...e){super(...e),wB(this,"state",{}),wB(this,"handleLogin",(e=>{e.preventDefault(),this.auth.authenticate(this.authSettings,((e,t)=>{e?this.setState({loginError:e.toString()}):this.props.onLogin(t)}))}))}componentDidMount(){const{auth_type:e=""}=this.props.config.backend;if("implicit"===e){const{base_url:e="https://bitbucket.org",auth_endpoint:t="site/oauth2/authorize",app_id:n=""}=this.props.config.backend;this.auth=new WP({base_url:e,auth_endpoint:t,app_id:n,clearHash:this.props.clearHash}),this.auth.completeAuth(((e,t)=>{e?this.setState({loginError:e.toString()}):this.props.onLogin(t)})),this.authSettings={scope:"repository:write"}}else this.auth=new pR({base_url:this.props.base_url,site_id:"localhost"===document.location.host.split(":")[0]?"demo.decapcms.org":this.props.siteId,auth_endpoint:this.props.authEndpoint}),this.authSettings={provider:"bitbucket",scope:"repo"}}render(){const{inProgress:e,config:t,t:n}=this.props;return xn(nD,{onLogin:this.handleLogin,loginDisabled:e,loginErrorMessage:this.state.loginError,logoUrl:t.logo_url,siteUrl:t.site_url,renderButtonContent:()=>xn(o.Fragment,null,xn(_B,{type:"bitbucket"}),n(e?"auth.loggingIn":"auth.loginWithBitbucket")),t:n})}}wB(xB,"propTypes",{onLogin:
Repo "${this.repo}" not found.
Please ensure the repo information is spelled correctly.
If the repo is private, make sure you're logged into a Bitbucket account with access.
`,e})))throw new Error("Your BitBucket user account does not have access to this repo.");const t=await this.api.user();return DB(DB({},t),{},{name:t.display_name,login:t.username,token:e.token,avatar_url:t.links.avatar.href,refresh_token:e.refresh_token})}getRefreshedAccessToken(){if("implicit"===this.authType)throw new WF("Can't refresh access token when using implicit auth");if(this.refreshedTokenPromise)return this.refreshedTokenPromise;if(!this.authenticator){const e={base_url:this.baseUrl,site_id:this.siteId};this.authenticator=new pR(e)}return this.refreshedTokenPromise=this.authenticator.refresh({provider:"bitbucket",refresh_token:this.refreshToken}).then((({token:e,refresh_token:t})=>(this.token=e,this.refreshToken=t,this.refreshedTokenPromise=void 0,this.updateUserCredentials({token:e,refresh_token:t}),e))),this.refreshedTokenPromise}logout(){this.token=null}getToken(){return this.refreshedTokenPromise?this.refreshedTokenPromise:Promise.resolve(this.token)}async entriesByFolder(e,t,n){let r;const i=await this.api.defaultBranchCommitSha(),o=await Zo((()=>this.api.listFiles(e,n,20,this.branch).then((({entries:e,cursor:n})=>(r=n.mergeMeta({extension:t}),e.filter((e=>yo(e,t))))))),((e,t)=>this.api.readFile(e,t,{head:i})),this.api.readFileMetadata.bind(this.api),gB);return o[Lo]=r,o}async listAllFiles(e,t,n){return(await this.api.listAllFiles(e,n,this.branch)).filter((e=>yo(e,t)))}async allEntriesByFolder(e,t,n){const r=await this.api.defaultBranchCommitSha();return await aa({listAllFiles:()=>this.listAllFiles(e,t,n),readFile:(e,t)=>this.api.readFile(e,t,{head:r}),readFileMetadata:this.api.readFileMetadata.bind(this.api),apiName:gB,branch:this.branch,localForage:Fo,folder:e,extension:t,depth:n,getDefaultBranch:()=>Promise.resolve({name:this.branch,sha:r}),isShaExistsInBranch:this.api.isShaExistsInBranch.bind(this.api),getDifferences:(e,t)=>this.api.getDifferences(e,t),getFileId:e=>Promise.resolve(this.api.getFileId(r,e)),filterFile:e=>yo(e,t)})}async entriesByFiles(e){const t=await this.api.defaultBranchCommitSha();return Xo(e,((e,n)=>this.api.readFile(e,n,{head:t})),this.api.readFileMetadata.bind(this.api),gB)}getEntry(e){return this.api.readFile(e).then((t=>({file:{path:e,id:null},data:t})))}getMedia(e=this.mediaFolder){return this.api.listAllFiles(e,1,this.branch).then((e=>e.map((({id:e,name:t,path:n})=>({id:e,name:t,path:n,displayURL:{id:e,path:n}})))))}getLargeMediaClient(){return this._largeMediaClientPromise||(this._largeMediaClientPromise=(async()=>{const e=await this.api.readFile(".gitattributes").then((e=>lB(e))).catch((e=>(404===e.status?console.log("This 404 was expected and handled appropriately."):console.error(e),[])));return new OB(!!(this.largeMediaURL&&e.length>0),this.largeMediaURL,e,this.requestFunction)})()),this._largeMediaClientPromise}getMediaDisplayURL(e){return this._mediaDisplayURLSem=this._mediaDisplayURLSem||Co()(10),ta(e,this.api.readFile.bind(this.api),this._mediaDisplayURLSem)}async getMediaFile(e){const t=Wo(e),n=Jo(t,await ea(e,null,this.api.readFile.bind(this.api))),r=URL.createObjectURL(n);return{id:await Xu(n),displayURL:r,path:e,name:t,size:n.size,file:n,url:r}}async persistEntry(e,t){const n=await this.getLargeMediaClient();return na(this.lock,(async()=>this.api.persistFiles(e.dataFiles,n.enabled?await cB(n,e.assets):e.assets,t)),"Failed to acquire persist entry lock")}async persistMedia(e,t){const{fileObj:n,path:r}=e,i=n?URL.createObjectURL(n):"",o=await this.getLargeMediaClient(),a=r.startsWith("/")?r.slice(1):r;if(!o.enabled||!o.matchPath(a))return this._persistMedia(e,t);const s=await uB(o,n,r);return DB(DB({},await this._persistMedia(s,t)),{},{displayURL:i})}async _persistMedia(e,t){const n=e.fileObj,[r]=await Promise.all([Xu(n),this.api.persistFiles([],[e],t)]),i=URL.createObjectURL(n);return{displayURL:i,path:il()(e.path,"/k"),name:n.name,size:n.size,id:r,file:n,url:i}}deleteFiles(e,t){return this.api.deleteFiles(e,t)}traverseCursor(e,t){return this.api.traverseCursor(e,t).then((async({entries:t,cursor:n})=>{var r;const i=null===(r=e.meta)||void 0===r?void 0:r.get(
Decap CMS config: ${e.get("name")} field: property "options" has been deprecated for the
${e.get("widget")} widget and will be removed in the next major release. Rather than
\`field.options.media_library\`, apply media library options for this widget under
\`field.media_library\`.
`)));function kW({forImage:e}={}){var t;return t=class extends o.Component{constructor(t){super(t),oW(this,"handleChange",(t=>{const{field:n,onOpenMediaLibrary:r,value:i}=this.props;t.preventDefault();const o=this.getMediaLibraryFieldOptions();return r({controlID:this.controlID,forImage:e,privateUpload:n.get("private"),value:_W(i),allowMultiple:!!o.get("allow_multiple",!0),config:o.get("config"),field:n})})),oW(this,"handleUrl",(e=>t=>{t.preventDefault();const n=window.prompt(this.props.t(`editor.editorWidgets.${e}.promptUrl`));if(n)return this.props.onChange(n)})),oW(this,"handleRemove",(e=>(e.preventDefault(),this.props.onClearMediaControl(this.controlID),this.props.onChange("")))),oW(this,"onRemoveOne",(e=>()=>{const t=_W(this.props.value);return t.splice(e,1),this.props.onChange(function(e){return Array.isArray(e)?e.length:kr.List.isList(e)?e.size:e?1:0}(t)>0?[...t]:null)})),oW(this,"onReplaceOne",(t=>()=>{const{field:n,onOpenMediaLibrary:r,value:i}=this.props,o=this.getMediaLibraryFieldOptions();return r({controlID:this.controlID,forImage:e,privateUpload:n.get("private"),value:_W(i),replaceIndex:t,allowMultiple:!1,config:o.get("config"),field:n})})),oW(this,"getMediaLibraryFieldOptions",(()=>{const{field:e}=this.props;return e.hasIn(["options","media_library"])?(xW(e),e.getIn(["options","media_library"],(0,kr.Map)())):e.get("media_library",(0,kr.Map)())})),oW(this,"allowsMultiple",(()=>{const e=this.getMediaLibraryFieldOptions();return e.get("config",!1)&&e.get("config").get("multiple",!1)})),oW(this,"onSortEnd",(({oldIndex:e,newIndex:t})=>{const{value:n}=this.props,r=(i=n,o=e,a=t,function(e,t,n){const r=t<0?e.length+t:t;if(r>=0&&r<e.length){const r=n<0?e.length+n:n,[i]=e.splice(t,1);e.splice(r,0,i)}}(i=[...i],o,a),i);var i,o,a;return this.props.onChange(r)})),oW(this,"getValidateValue",(()=>{const{value:e}=this.props;return e?wW(e)?e.map((e=>Wo(e))):Wo(e):e})),oW(this,"renderFileLink",(e=>{if(!e||e.length<=50)return e;const t=`${e.slice(0,25)}${e.slice(-24)}`;return xn(mW,{href:e,rel:"noopener",target:"_blank"},t)})),oW(this,"renderFileLinks",(()=>{const{value:e}=this.props;return wW(e)?xn(gW,null,xn(vW,null,e.map((e=>xn("li",{key:e},this.renderFileLink(e)))))):xn(gW,null,this.renderFileLink(e))})),oW(this,"renderImages",(()=>{const{getAsset:e,value:t,field:n}=this.props,r=function(e){return wW(e)?_W(e).map((e=>({id:xl(),value:e}))):e}(t);if(wW(t))return xn(hW,{items:r,onSortEnd:this.onSortEnd,onRemoveOne:this.onRemoveOne,onReplaceOne:this.onReplaceOne,distance:4,getAsset:e,field:n,axis:"xy",lockToContainerEdges:!0});const i=e(t,n);return xn(sW,null,xn(cW,{src:i||""}))})),oW(this,"renderSelection",(t=>{const{t:n,field:r}=this.props,i=this.allowsMultiple();return xn("div",null,e?this.renderImages():null,xn("div",null,e?null:this.renderFileLinks(),xn(yW,{onClick:this.handleChange},n(`editor.editorWidgets.${t}.${this.allowsMultiple()?"addMore":"chooseDifferent"}`)),r.get("choose_url",!0)&&!this.allowsMultiple()?xn(yW,{onClick:this.handleUrl(t)},n(`editor.editorWidgets.${t}.replaceUrl`)):null,xn(bW,{onClick:this.handleRemove},n(`editor.editorWidgets.${t}.remove${i?"All":""}`))))})),oW(this,"renderNoSelection",(e=>{const{t,field:n}=this.props;return xn(o.Fragment,null,xn(yW,{onClick:this.handleChange},t(`editor.editorWidgets.${e}.choose${this.allowsMultiple()?"Multiple":""}`)),n.get("choose_url",!0)?xn(yW,{onClick:this.handleUrl(e)},t(`editor.editorWidgets.${e}.chooseUrl`)):null)})),this.controlID=xl()}shouldComponentUpdate(e){if(this.props.value!==e.value||this.props.getAsset!==e.getAsset)return!0;const t=e.mediaPaths.get(this.controlID);return!(!t||e.value===t)}componentDidUpdate(){const{mediaPaths:e,value:t,onRemoveInsertedMedia:n,onChange:r}=this.props,i=e.get(this.controlID);i&&i!==t?r(i):i&&i===t&&n(this.controlID)}componentWillUnmount(){this.props.onRemoveMediaControl(this.controlID)}render(){const{value:t,classNameWrapper:n}=this.props,r=e?"image":"file";return xn("div",{className:n},xn("span",null,t?this.renderSelection(r):this.renderNoSelection(r)))}},oW(t,"propTypes",{field:ie().object.isRequired,getAsset
${AQ({minimal:n.get("minimal")})}
`),value:l,onChange:c})))))}OQ.propTypes={onChange:ie().func.isRequired,onMode:ie().func.isRequired,className:ie().string.isRequired,value:ie().string,field:Q_().map.isRequired,isShowModeToggle:ie().bool.isRequired,t:ie().func.isRequired};const PQ=OQ;function DQ(){return DQ=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},DQ.apply(this,arguments)}function RQ(e){return xn("div",DQ({css:En("height:32px;cursor:text;position:relative;z-index:",hr.zIndex1,";margin-top:-16px;;label:InsertionPoint;",";label:css;")},e))}const MQ=function({attributes:e,children:t,element:n}){const r=sX(),i=LZ.findPath(r,n);function o(e){zK.insertNodes(r,SQ(),{select:!0,at:e})}const a=0===i[0],s=r.children[i[0]+1],l=i[0]===r.children.length-1||r.isVoid(s);return xn("div",DQ({},e,{onClick:function(e){e.stopPropagation()},contentEditable:!1}),a&&xn(RQ,{onClick:function(){o(i)}}),t,l&&xn(RQ,{onClick:function(){o([...i.slice(0,-1),i[i.length-1]+1])}}))};var IQ=__webpack_require__(17620),LQ=__webpack_require__.n(IQ);function NQ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function jQ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?NQ(Object(n),!0).forEach((function(t){FQ(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):NQ(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function FQ(e,t,n){return t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var BQ={name:"1xfnuhy-Shortcode",styles:"margin-top:0;margin-bottom:16px;&:first-of-type{margin-top:0;};label:Shortcode;"};const zQ=function(e){const t=sX(),{element:n,dataKey:r="shortcodeData",children:i}=e,a=d2,s=f2().get(n.data.shortcode),l=(0,kr.fromJS)(LQ()(s,["id","fromBlock","toBlock","toPreview","pattern","icon"])),[u,c]=(0,o.useState)((0,kr.fromJS)(n.data[r]));function d(){const e=LZ.findPath(t,n);zK.select(t,e)}const p=LZ.findPath(t,n),f=t.selection&&p&&fK.isRange(t.selection)&&fK.includes(t.selection,p);return!l.isEmpty()&&xn("div",{onClick:d,onFocus:d},xn(a,{css:BQ,value:u,field:l,onChange:function(e,i,o){const a=LZ.findPath(t,n),s={data:jQ(jQ({},n.data),{},{[r]:i.toJS(),metadata:o})};zK.setNodes(t,s,{at:a}),c(i)},isEditorComponent:!0,onValidateObject:()=>{},isNewEditorComponent:n.data.shortcodeNew,isSelected:f}),i)};function UQ(){return UQ=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},UQ.apply(this,arguments)}const qQ="16px",$Q="\n font-weight: 700;\n line-height: 1;\n",WQ=gb("h1",{target:"evlbpgx13",label:"StyledH1"})($Q,";font-size:32px;margin-top:16px;"),HQ=gb("h2",{target:"evlbpgx12",label:"StyledH2"})($Q,";font-size:24px;margin-top:12px;"),VQ=gb("h3",{target:"evlbpgx11",label:"StyledH3"})($Q,";font-size:20px;"),GQ=gb("h4",{target:"evlbpgx10",label:"StyledH4"})($Q,";font-size:18px;margin-top:8px;"),KQ=gb("h5",{target:"evlbpgx9",label:"StyledH5"})($Q,";font-size:16px;margin-top:8px;"),YQ=KQ.withComponent("h6",{target:"evlbpgx14",label:"StyledH6"}),ZQ=gb("p",{target:"evlbpgx8",label:"StyledP"})("margin-bottom:",qQ,";"),XQ=gb("blockquote",{target:"evlbpgx7",label:"StyledBlockQuote"})("padding-left:16px;border-left:3px solid ",Kn.background,";margin-left:0;margin-right:0;margin-bottom:",qQ,";"),QQ=gb("code",{target:"evlbpgx6",label:"StyledCode"})("background-color:"
${i2({minimal:i.get("minimal")})}
`)},0!==g.length&&xn(BX,{className:e`
padding: 16px 20px 0;
`,renderElement:y,renderLeaf:b,onKeyDown:w,autoFocus:!1}),xn(o2,{onClick:_}))))))}s2.propTypes={onAddAsset:ie().func.isRequired,getAsset:ie().func.isRequired,onChange:ie().func.isRequired,onMode:ie().func.isRequired,className:ie().string.isRequired,value:ie().string,field:Q_().map.isRequired,getEditorComponents:ie().func.isRequired,getRemarkPlugins:ie().func.isRequired,isShowModeToggle:ie().bool.isRequired,t:ie().func.isRequired};const l2=s2;function u2(e,t,n){return t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const c2="cms.md-mode";let d2,p2=()=>(0,kr.Map)();function f2(){return p2()}class h2 extends o.Component{constructor(e){var t;super(e),u2(this,"handleMode",(e=>{this.setState({mode:e,pendingFocus:!0}),localStorage.setItem(c2,e)})),u2(this,"processRef",(e=>this.ref=e)),u2(this,"setFocusReceived",(()=>{this.setState({pendingFocus:!1})})),u2(this,"getAllowedModes",(()=>this.props.field.get("modes",(0,kr.List)(["rich_text","raw"])).toArray())),d2=e.editorControl;const n=null!==(t=localStorage.getItem(c2))&&void 0!==t?t:"rich_text";p2=e.getEditorComponents,this.state={mode:-1!==this.getAllowedModes().indexOf(n)?n:this.getAllowedModes()[0],pendingFocus:!1}}render(){const{onChange:e,onAddAsset:t,getAsset:n,value:r,classNameWrapper:i,field:o,getEditorComponents:a,getRemarkPlugins:s,resolveWidget:l,t:u,isDisabled:c}=this.props,{mode:d,pendingFocus:p}=this.state,f=this.getAllowedModes().length>1,h=xn("div",{className:"cms-editor-visual",ref:this.processRef},xn(l2,{onChange:e,onAddAsset:t,isShowModeToggle:f,onMode:this.handleMode,getAsset:n,className:i,value:r,field:o,getEditorComponents:a,getRemarkPlugins:s,resolveWidget:l,pendingFocus:p&&this.setFocusReceived,t:u,isDisabled:c})),m=xn("div",{className:"cms-editor-raw",ref:this.processRef},xn(PQ,{onChange:e,onAddAsset:t,isShowModeToggle:f,onMode:this.handleMode,getAsset:n,className:i,value:r,field:o,pendingFocus:p&&this.setFocusReceived,t:u}));return"rich_text"===d?h:m}}u2(h2,"propTypes",{onChange:ie().func.isRequired,onAddAsset:ie().func.isRequired,getAsset:ie().func.isRequired,classNameWrapper:ie().string.isRequired,editorControl:ie().elementType.isRequired,value:ie().string,field:Q_().map.isRequired,getEditorComponents:ie().func,t:ie().func.isRequired}),u2(h2,"defaultProps",{value:""});var m2=__webpack_require__(35368),g2=__webpack_require__.n(m2);class v2 extends o.Component{render(){const{value:e,getAsset:t,resolveWidget:n,field:r,getRemarkPlugins:i}=this.props;if(null===e)return null;const o=function(e,{getAsset:t,resolveWidget:n,remarkPlugins:r=[]}={}){const i=I0(e,r),o=y1()().use(L1,{plugins:f2(),getAsset:t,resolveWidget:n}).use(S1(),{allowDangerousHTML:!0}).runSync(i);return y1()().use(T1(),{allowDangerousHtml:!0,allowDangerousCharacters:!0,closeSelfClosing:!0,entities:{useNamedReferences:!0}}).stringify(o)}(e,{getAsset:t,resolveWidget:n},null==i||i()),a=null!=r&&r.get("sanitize_preview",!1)?g2().sanitize(o):o;return xn(Kz,{dangerouslySetInnerHTML:{__html:a}})}}!function(e,t,n){t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(v2,"propTypes",{getAsset:ie().func.isRequired,resolveWidget:ie().func.isRequired,value:ie().string});const y2=v2,b2={properties:{minimal:{type:"boolean"},buttons:{type:"array",items:{type:"string",enum:["bold","italic","code","link","heading-one","heading-two","heading-three","heading-four","heading-five","heading-six","quote","bulleted-list","nu
${R2}
`,{[e`
${"\n padding: 6px 14px 14px;\n border-top: 0;\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n "}
`]:r},{[e`
border-color: ${Kn.textFieldBorder};
`]:!!r&&!i})},r?null:xn(P2,{collapsed:a,onCollapseToggle:this.handleCollapseToggle,heading:a&&this.objectLabel(),t:o}),xn("div",{className:u({[e`
${"\n display: none;\n "}
`]:a})},this.renderFields(s,l))))):xn("h3",null,"No field(s) defined for this widget")}}function I2({field:e}){return xn(Kz,null,e&&e.get("fields")||e.get("field")||null)}D2(M2,"propTypes",{onChangeObject:ie().func.isRequired,onValidateObject:ie().func,value:ie().oneOfType([ie().node,ie().object,ie().bool]),field:ie().object,forID:ie().string,classNameWrapper:ie().string.isRequired,forList:ie().bool,controlRef:ie().func,editorControl:ie().elementType.isRequired,resolveWidget:ie().func.isRequired,clearFieldErrors:ie().func.isRequired,fieldsErrors:Q_().map,hasError:ie().bool,t:ie().func,locale:ie().string,collapsed:ie().bool}),D2(M2,"defaultProps",{value:(0,kr.Map)()}),I2.propTypes={field:ie().node};const L2=I2,N2={properties:{collapsed:{type:"boolean"},i18n:{type:"boolean"}}};function j2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function F2(e,t,n){return t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const B2={Widget:function(e={}){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j2(Object(n),!0).forEach((function(t){F2(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j2(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({name:"object",controlComponent:M2,previewComponent:L2,schema:N2},e)},controlComponent:M2,previewComponent:L2},z2=B2,U2=gb("div",{target:"e11ki7in3",label:"TopBar"})("display:flex;justify-content:space-between;height:26px;border-radius:",Yn.borderRadius," ",Yn.borderRadius," 0 0;position:relative;"),q2=gb("button",{target:"e11ki7in2",label:"TopBarButton"})(cr.button,";color:",Kn.controlLabel,";background:transparent;font-size:16px;line-height:1;padding:0;width:32px;text-align:center;cursor:pointer;display:flex;justify-content:center;align-items:center;"),$2=gb(q2.withComponent("span",{target:"e11ki7in4",label:"TopBarButtonSpan"}),{target:"e11ki7in1",label:"DragIconContainer"})({name:"1nwpzc",styles:"width:100%;cursor:move"});function W2({Wrapper:e,id:t}){return xn(e,{id:t},xn($2,null,xn(O_,{type:"drag-handle",size:"small"})))}function H2(e){const{className:t,collapsed:n,onCollapseToggle:r,onRemove:i,dragHandle:o,id:a}=e;return xn(U2,{className:t},r?xn(q2,{onClick:r},xn(O_,{type:"chevron",size:"small",direction:n?"right":"down"})):null,o?xn(W2,{Wrapper:o,id:a}):null,i?xn(q2,{onClick:i},xn(O_,{type:"close",size:"small"})):null)}H2.propTypes={className:ie().string,collapsed:ie().bool,onCollapseToggle:ie().func,onRemove:ie().func};const V2=gb(H2,{target:"e11ki7in0",label:"StyledListItemTopBar"})("display:flex;justify-content:space-between;height:26px;border-radius:",Yn.borderRadius," ",Yn.borderRadius," 0 0;position:relative;"),G2="types",K2="typeKey",Y2="type";function Z2(e,t){const n=X2(e),r=e.get(G2),i=t.get(n);return r.find((e=>e.get("name")===i))}function X2(e){return e.get(K2,Y2)}function Q2(e,t,n){return t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function J2(){return J2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},J2.apply(this,argumen
${"\n display: none;\n "};
`]:m}),value:e,field:v,onChangeObject:this.handleChangeFor(t),editorControl:r,resolveWidget:u,metadata:o,forList:!0,onValidateObject:i,clearFieldErrors:a,fieldsErrors:s,ref:this.processControlRef,controlRef:l,validationKey:g,collapsed:m,"data-testid":`object-control-${g}`,hasError:y,parentIds:[...c,d,g]}))))}));const{field:t,value:n}=e,r=t.get("collapsed",!0),i=n&&Array(n.size).fill(r)||[],o=n&&Array.from({length:n.size},(()=>xl()))||[];this.state={listCollapsed:r,itemsCollapsed:i,value:this.valueToString(n),keys:o}}shouldComponentUpdate(){return!0}handleChangeFor(e){return(t,n,r)=>{const{value:i,metadata:o,onChange:a,field:s}=this.props,l=s.get("name"),u="object"===s.getIn(["field","widget"]),c=this.getValueType()!==u5||this.getValueType()===u5&&u?this.getObjectValue(e).set(t.get("name"),n):n,d={[l]:Object.assign(o?o.toJS():{},r||{})};a(i.set(e,c),d)}}objectLabel(e){const{field:t,entry:n}=this.props;switch(this.getValueType()){case d5:{if(!f5(t,e))return;const r=Z2(t,e),i=r.get("label",r.get("name")),o=r.get("summary",t.get("summary"));return o?p5(o,n,i,e):i}case u5:{const r=t.get("field"),i=r.get("label",r.get("name")),o=t.get("summary"),a=(0,kr.fromJS)({[r.get("name")]:e});return o?p5(o,n,i,a):i}case c5:{if(!f5(t,e))return;const r=t.get("fields"),i=r&&r.first(),o=e.get(i.get("name")),a=t.get("summary");return((a?p5(a,n,o,e):o)||`No ${i.get("name")}`).toString()}}return""}renderErroneousTypedItem(e,t){const n=function(e,t){const n=X2(e),r=t.get(n);let i;return i=r?`Error: item has illegal '${n}' property: '${r}'`:`Error: item has no '${n}' property`,i}(this.props.field,t),r=`item-${e}`;return xn(s5,{css:[o5.listControlItem,o5.listControlItemCollapsed,";label:ListControl;"],index:e,key:r},xn(n5,{onCollapseToggle:null,onRemove:gC()(this.handleRemove,e,r),dragHandle:l5,id:r}),xn(r5,{collapsed:!0,error:!0},n))}renderListControl(){const{value:e,forID:t,field:n,classNameWrapper:r,t:i}=this.props,{itemsCollapsed:o,listCollapsed:a,keys:s}=this.state,l=e||(0,kr.List)(),u=n.get("label",n.get("name")),c=n.get("label_singular")||n.get("label",n.get("name")),d=1===l.size?c.toLowerCase():u.toLowerCase(),p=n.get("minimize_collapsed",!1),f=o.every((e=>!0===e))&&(a||!p),h=s.map((e=>({id:e})));return xn(Tn,null,(({cx:e,css:o})=>xn("div",{id:t,className:e(r,o`
${i5}
`)},xn(P2,{allowAdd:n.get("allow_add",!0),onAdd:this.handleAdd,types:n.get(G2,null),onAddType:e=>this.handleAddType(e,X2(n)),heading:`${l.size} ${d}`,label:c.toLowerCase(),onCollapseToggle:this.handleCollapseAllToggle,collapsed:f,t:i}),(!f||!p)&&xn(a5,{items:h,keys:s,onSortEnd:this.onSortEnd},l.map(this.renderItem)))))}renderInput(){const{forID:e,classNameWrapper:t}=this.props,{value:n}=this.state;return xn("input",{type:"text",id:e,value:n,onChange:this.handleChange,onFocus:this.handleFocus,onBlur:this.handleBlur,className:t})}render(){return null!==this.getValueType()?this.renderListControl():this.renderInput()}}Q2(m5,"propTypes",{metadata:Q_().map,onChange:ie().func.isRequired,onChangeObject:ie().func.isRequired,onValidateObject:ie().func.isRequired,validate:ie().func.isRequired,value:Q_().list,field:ie().object,forID:ie().string,controlRef:ie().func,mediaPaths:Q_().map.isRequired,getAsset:ie().func.isRequired,onOpenMediaLibrary:ie().func.isRequired,onAddAsset:ie().func.isRequired,onRemoveInsertedMedia:ie().func.isRequired,classNameWrapper:ie().string.isRequired,setActiveStyle:ie().func.isRequired,setInactiveStyle:ie().func.isRequired,editorControl:ie().elementType.isRequired,resolveWidget:ie().func.isRequired,clearFieldErrors:ie().func.isRequired,fieldsErrors:Q_().map.isRequired,entry:Q_().map.isRequired,t:ie().func}),Q2(m5,"defaultProps",{value:(0,kr.List)(),parentIds:[]});const g5={properties:{allow_add:{type:"boolean"},collapsed:{type:"boolean"},summary:{type:"string"},minimize_collapsed:{type:"boolean"},label_singular:{type:"string"},i18n:{type:"boolean"},min:{type:"number"},max:{type:"number"}}};function v5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function y5(e,t,n){return t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const b5=z2.previewComponent,w5={Widget:function(e={}){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v5(Object(n),!0).forEach((function(t){y5(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v5(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({name:"list",controlComponent:m5,previewComponent:b5,schema:g5},e)},controlComponent:m5,previewComponent:b5},_5=w5;var x5,k5,E5,C5=__webpack_require__(84636),S5=__webpack_require__.n(C5),A5=BV(jV),T5=(x5=A5,E5=k5=function(e){tH(n,e);var t=sH(n);function n(e){var r;return XW(this,n),(r=t.call(this)).select=void 0,r.lastRequest=void 0,r.mounted=!1,r.handleInputChange=function(e,t){var n=r.props,i=n.cacheOptions,o=function(e,t,n){if(n){var r=n(e,t);if("string"==typeof r)return r}return e}(e,t,n.onInputChange);if(!o)return delete r.lastRequest,void r.setState({inputValue:"",loadedInputValue:"",loadedOptions:[],isLoading:!1,passEmptyOptions:!1});if(i&&r.state.optionsCache[o])r.setState({inputValue:o,loadedInputValue:o,loadedOptions:r.state.optionsCache[o],isLoading:!1,passEmptyOptions:!1});else{var a=r.lastRequest={};r.setState({inputValue:o,isLoading:!0,passEmptyOptions:!r.state.loadedInputValue},(function(){r.loadOptions(o,(function(e){r.mounted&&a===r.lastRequest&&(delete r.lastRequest,r.setState((function(t){return{isLoading:!1,loadedInputValue:o,loadedOptions:e||[],passEmptyOptions:!1,optionsCache:e?oH(oH({},t.optionsCache),{},(0,nH.Z)({},o,e)):t.optionsCache}})))}))}))}return o},r.state={defaultOptions:Array.isArray(e.defaultOptions)?e.defaultOptions:void 0,inputValue:void 0!==e.inputValue?e.inputValue:"",isLoading:!0===e.defaultOptions,loadedOptions:[],passEmptyOpti
${s9()};
padding: 0;
overflow: hidden;
height: ${e};
`),ref:this.mapContainer})))}},Uoe(n,"propTypes",{onChange:ie().func.isRequired,field:ie().object.isRequired,height:ie().string,value:ie().node}),Uoe(n,"defaultProps",{value:"",height:"400px"}),n}(),Yoe={Widget:function(e={}){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Voe(Object(n),!0).forEach((function(t){Goe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Voe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({name:"map",controlComponent:Koe,previewComponent:Woe,schema:Hoe},e)},controlComponent:Koe,previewComponent:Woe},Zoe=Yoe;var Xoe=__webpack_require__(89945),Qoe=__webpack_require__.n(Xoe),Joe=__webpack_require__(33147),eae=__webpack_require__.n(Joe),tae=__webpack_require__(10264),nae=__webpack_require__.n(tae);function rae(e,t,n){return t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}fa().extend(Qoe()),fa().extend(eae()),fa().extend(nae());var iae={name:"1tfa1p6-Buttons",styles:"display:flex;gap:20px;width:fit-content;label:Buttons;"};function oae({t:e,handleChange:t,getNow:n}){return xn("div",{css:iae},xn("button",{css:En(cr.button," ",cr.widget,";;label:Buttons;",";label:css;"),onClick:()=>t(n()),"data-testid":"now-button"},e("editor.editorWidgets.datetime.now")),xn("button",{css:En(cr.button," ",cr.widget,";;label:Buttons;",";label:css;"),onClick:()=>t(""),"data-testid":"clear-button"},e("editor.editorWidgets.datetime.clear")))}var aae={name:"1mn76l5-DateTimeControl",styles:"font-size:0.8em;color:#666;label:DateTimeControl;"},sae={name:"ptu1mf-DateTimeControl",styles:"display:flex!important;gap:20px;align-items:center;label:DateTimeControl;"};class lae extends o.Component{constructor(...e){super(...e),rae(this,"isUtc",this.props.field.get("picker_utc")||!1),rae(this,"isValidDate",(e=>fa()(e,this.getFormat().inputFormat).isValid()||""===e)),rae(this,"handleChange",(e=>{if(!this.isValidDate(e))return;const{onChange:t}=this.props;if(""===e)t("");else{const{format:n,inputFormat:r}=this.getFormat();t(fa()(e,r).format(n))}})),rae(this,"onInputChange",(e=>{const t=e.target.value;this.handleChange(t)}))}componentDidMount(){const{value:e}=this.props;"{{now}}"===e&&this.handleChange(this.getNow())}escapeZ(e){return/Z(?![\]])/.test(e)?e.replace("Z","[Z]"):e}getFormat(){const{field:e}=this.props;let t="datetime-local",n="YYYY-MM-DDTHH:mm",r="YYYY-MM-DDTHH:mm:ss.SSS[Z]",i=null==e?void 0:e.get("format"),o=null==e?void 0:e.get("date_format"),a=null==e?void 0:e.get("time_format");return!0===o&&(o="YYYY-MM-DD"),!0===a&&(a="HH:mm"),this.isUtc&&(i=this.escapeZ(i),o=this.escapeZ(o),a=this.escapeZ(a)),"string"==typeof o&&"string"==typeof a?r=`${o}T${a}`:"string"==typeof a?(t="time",r=a):"string"==typeof o&&(t="date",r=o),"string"==typeof i&&(r=i,t="datetime-local"),!1===o&&(t="time"),!1===a&&(t="date"),"datetime-local"===t&&(n="YYYY-MM-DDTHH:mm"),"date"===t&&(n="YYYY-MM-DD"),"time"===t&&(n="HH:mm"),{format:r,inputType:t,inputFormat:n}}getNow(){const{inputFormat:e}=this.getFormat();return this.isUtc?fa().utc().format(e):fa()().format(e)}formatInputValue(e){if(""===e)return e;const{format:t,inputFormat:n}=this.getFormat(),r=this.isUtc?fa().utc(e,t).format(n):fa()(e,t).format(n);return this.isValidDate(r)?r:this.isUtc?fa().utc(e).format(n):fa()(e).format(n)}render(){const{forID:e,value:t,classNameWrapper:n,setActiveStyle:r,setInactiveStyle:i,t:o,isDisabled:a}=this.props,{inputType:s}=this.getFormat();return xn("div",{className:n,css:sae},xn("input",{id:e,"data-testid":e,type:s,value:t?this.formatInputValue(t):"",onChange:this.onInputChange,onFocus:r,onBlur:i,disabled:a}),this.isUtc&&xn("span",{css:aae},"UTC"
${_ae()};
${kae()};
2024-01-31 07:38:11 +02:00
${"\n padding: 0;\n"};
2025-01-28 00:57:15 +02:00
`)},!o&&xn(Cae,{onClick:this.showSettings}),o&&xn(Iae,{hideSettings:this.hideSettings,forID:t,modes:Uae,mode:zae(c||Bae),theme:qae.find((e=>e===l)),themes:qae,keyMap:{value:a,label:a},keyMaps:this.getKeyMapOptions(),allowLanguageSelection:this.allowLanguageSelection,onChangeLang:e=>this.setState({lang:e}),onChangeTheme:e=>this.setState({theme:e}),onChangeKeyMap:e=>this.setState({keyMap:e})}),xn(vae.Rt,{key:s,id:t,className:i`
2024-01-31 07:38:11 +02:00
height: 100%;
border-radius: 0 3px 3px;
overflow: hidden;
.CodeMirror {
height: auto !important;
cursor: text;
min-height: 300px;
}
.CodeMirror-scroll {
min-height: 300px;
}
2025-01-28 00:57:15 +02:00
`,options:Nae(Nae({lineNumbers:!0},n.codeMirrorConfig),{},{extraKeys:Nae({"Shift-Tab":"indentLess",Tab:"indentMore"},n.codeMirrorConfig.extraKeys||{}),theme:l,mode:d,keyMap:a,viewportMargin:1/0}),detach:!0,editorDidMount:e=>{this.cm=e,r&&this.handleFocus()},value:u,onChange:(e,t,n)=>this.handleChange(n),onFocus:this.handleFocus,onBlur:this.handleBlur}))))}}function Hae(e){return xn(Kz,null,xn("pre",null,xn("code",null,(t=e.value,n=e.field,Yi()(t)?t:kr.Map.isMap(t)?t.get(n.getIn(["keys","code"],"code"),""):""))));var t,n}jae(Wae,"propTypes",{field:Q_().map.isRequired,onChange:ie().func.isRequired,value:ie().node,forID:ie().string.isRequired,classNameWrapper:ie().string.isRequired,widget:ie().object.isRequired,isParentListCollapsed:ie().bool}),Hae.propTypes={value:ie().node};const Vae=Hae,Gae={properties:{default_language:{type:"string"},allow_language_selection:{type:"boolean"},output_code_only:{type:"boolean"},keys:{type:"object",properties:{code:{type:"string"},lang:{type:"string"}}}}};function Kae(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Yae(e,t,n){return t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Zae={Widget:function(e={}){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Kae(Object(n),!0).forEach((function(t){Yae(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kae(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({name:"code",controlComponent:Wae,previewComponent:Vae,schema:Gae,allowMapValue:!0,codeMirrorConfig:{}},e)},controlComponent:Wae,previewComponent:Vae},Xae=Zae;var Qae=__webpack_require__(7151),Jae={},ese=function(e,t,n,r){var i=e+"-"+t+"-"+n+(r?"-server":"");if(Jae[i])return Jae[i];var o=function(e,t,n,r){if("undefined"==typeof document&&!r)return null;var i=r?new r:document.createElement("canvas");i.width=2*n,i.height=2*n;var o=i.getContext("2d");return o?(o.fillStyle=e,o.fillRect(0,0,i.width,i.height),o.fillStyle=t,o.fillRect(0,0,n,n),o.translate(n,n),o.fillRect(0,0,n,n),i.toDataURL()):null}(e,t,n,r);return Jae[i]=o,o},tse=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nse=function(e){var t=e.white,n=e.grey,r=e.size,i=e.renderers,a=e.borderRadius,s=e.boxShadow,l=e.children,u=(0,Qae.ZP)({default:{grid:{borderRadius:a,boxShadow:s,absolute:"0px 0px 0px 0px",background:"url("+ese(t,n,r,i.canvas)+") center left"}}});return(0,o.isValidElement)(l)?o.cloneElement(l,tse({},l.props,{style:tse({},l.props.style,u.grid)})):o.createElement("div",{style:u.grid})};nse.defaultProps={size:8,white:"transparent",grey:"rgba(0,0,0,.08)",renderers:{}};const rse=nse;var ise=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ose=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function ase(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var sse=function(e){function t(){var e,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,o=Arr
Repo "${this.repo}" not found.
Please ensure the repo information is spelled correctly.
If the repo is private, make sure you're logged into a Gitea account with access.
If your repo is under an organization, ensure the organization has granted access to Static
CMS.
`,e})))throw new Error("Your Gitea user account does not have access to this repo.");return{name:n.full_name,login:n.login,avatar_url:n.avatar_url,token:e.token}}logout(){if(this.token=null,this.api&&this.api.reset&&"function"==typeof this.api.reset)return this.api.reset()}getToken(){return Promise.resolve(this.token)}async entriesByFolder(e,t,n){const r=this.api.originRepoURL;let i;const o=await Zo((()=>this.api.listFiles(e,{repoURL:r,depth:n}).then((e=>{const n=e.filter((e=>yo(e,t))),r=this.getCursorAndFiles(n,1);return i=r.cursor,r.files}))),((e,t)=>this.api.readFile(e,t,{repoURL:r})),this.api.readFileMetadata.bind(this.api),CF);return o[Lo]=i,o}async allEntriesByFolder(e,t,n){const r=this.api.originRepoURL;return await Zo((()=>this.api.listFiles(e,{repoURL:r,depth:n}).then((e=>e.filter((e=>yo(e,t)))))),((e,t)=>this.api.readFile(e,t,{repoURL:r})),this.api.readFileMetadata.bind(this.api),CF)}entriesByFiles(e){const t=this.api.repoURL;return Xo(e,((e,n)=>this.api.readFile(e,n,{repoURL:t}).catch((()=>""))),this.api.readFileMetadata.bind(this.api),CF)}getEntry(e){const t=this.api.originRepoURL;return this.api.readFile(e,null,{repoURL:t}).then((t=>({file:{path:e,id:null},data:t}))).catch((()=>({file:{path:e,id:null},data:""})))}async getMedia(e=this.mediaFolder,t){return e?this.api.listFiles(e,void 0,t).then((e=>e.map((({id:e,name:t,size:n,path:r,type:i})=>({id:e,name:t,size:n,displayURL:{id:e,path:r},path:r,isDirectory:"tree"===i}))))):[]}async getMediaFile(e){const t=await ea(e,null,this.api.readFile.bind(this.api)),n=Wo(e),r=Jo(n,t),i=URL.createObjectURL(r);return{id:await Xu(t),displayURL:i,path:e,name:n,size:r.size,file:r,url:i}}getMediaDisplayURL(e){return this._mediaDisplayURLSem=this._mediaDisplayURLSem||Co()(10),ta(e,this.api.readFile.bind(this.api),this._mediaDisplayURLSem)}persistEntry(e,t){return na(this.lock,(()=>this.api.persistFiles(e.dataFiles,e.assets,t)),"Failed to acquire persist entry lock")}async persistMedia(e,t){try{await this.api.persistFiles([],[e],t);const{sha:n,path:r,fileObj:i}=e,o=URL.createObjectURL(i);return{id:n,name:i.name,size:i.size,displayURL:o,path:il()(r,"/")}}catch(e){throw console.error(e),e}}deleteFiles(e,t){return this.api.deleteFiles(e,t)}async traverseCursor(e,t){const n=e.meta,r=e.data.get("files").toJS();let i;switch(t){case"first":default:i=this.getCursorAndFiles(r,1);break;case"last":i=this.getCursorAndFiles(r,n.get("pageCount"));break;case"next":i=this.getCursorAndFiles(r,n.get("page")+1);break;case"prev":i=this.getCursorAndFiles(r,n.get("page")-1)}return{entries:await Xo(i.files,((e,t)=>this.api.readFile(e,t,{repoURL:this.api.originRepoURL}).catch((()=>""))),this.api.readFileMetadata.bind(this.api),CF),cursor:i.cursor}}async unpublishedEntries(){return{}}async unpublishedEntry(){return{}}async unpublishedEntryDataFile(){return{}}async unpublishedEntryMediaFile(){return{}}async updateUnpublishedEntryStatus(){}async publishUnpublishedEntry(){}async deleteUnpublishedEntry(){}async getDeployPreview(){return{}}}),cP.registerBackend("bitbucket",jB),cP.registerBackend("test-repo",class{constructor(e,t={}){Pz(this,"mediaFolder",void 0),Pz(this,"options",void 0),this.options=t,this.mediaFolder=e.media_folder}isGitBackend(){return!1}status(){return Promise.resolve({auth:{status:!0},api:{status:!0,statusPage:""}})}authComponent(){return Oz}restoreUser(){return this.authenticate()}authenticate(){return Promise.resolve()}logout(){return null}getToken(){return Promise.resolve("")}traverseCursor(e,t){const{folder:n,extension:r,index:i,pageCount:o,depth:a}=e.data.toObject(),s="next"===t?i+1:"prev"===t?i-1:"first"===t?0:"last"===t?o:0,l=Nz(window.repoFiles,n,r,a).map((e=>({data:e.content,file:{path:e.path,id:e.path}}))),u=l.slice(s*Iz,s*Iz+Iz),c=Lz(n,r,l,s,a);return Promise.resolve({entries:u,cursor:c})}entriesByFolder(e,t,n){const r=(e?Nz(window.repoFiles,e,t,n):[]).map((e=>({data:e.content,file:{path:e.path,id:e.path}}))),i=Lz(e,t,r,0,n),o=Ez()(r,Iz);return o[Lo]=i,Promise.resolve(o)}entriesByFiles(e){return Promise.all(e.map((e=>({file:e,data:Dz(e.path,window.repoFiles).content}))
2024-01-31 07:38:11 +02:00
//# sourceMappingURL=decap-cms.js.map