zerocodejs 1.0.1-beta.1 → 1.0.1-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +164 -0
- package/README.md +97 -96
- package/dist/components/ZeroCodeEditor.vue.d.ts.map +1 -1
- package/dist/core/composables/useZeroCodeRenderer.d.ts.map +1 -1
- package/dist/core/utils/edit-panel-fields.d.ts +17 -0
- package/dist/core/utils/edit-panel-fields.d.ts.map +1 -0
- package/dist/core/utils/template-processor.d.ts +6 -1
- package/dist/core/utils/template-processor.d.ts.map +1 -1
- package/dist/features/editor/components/EditPanel.vue.d.ts +1 -0
- package/dist/features/editor/components/EditPanel.vue.d.ts.map +1 -1
- package/dist/features/editor/composables/useEditMode.d.ts +4 -16
- package/dist/features/editor/composables/useEditMode.d.ts.map +1 -1
- package/dist/features/parts-manager/components/PartsManagerPanel.vue.d.ts.map +1 -1
- package/dist/features/parts-manager/composables/usePartsManager.d.ts +1 -0
- package/dist/features/parts-manager/composables/usePartsManager.d.ts.map +1 -1
- package/dist/features/preview/PreviewArea.vue.d.ts.map +1 -1
- package/dist/i18n/index.d.ts +18 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/locales/en.d.ts +9 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/ja.d.ts +9 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/zerocode.es.js +13733 -14317
- package/dist/zerocode.umd.js +57 -62
- package/dist/zerocodejs.css +1 -1
- package/package.json +6 -5
- package/dist/__tests__/fixtures/sample-data.d.ts +0 -23
- package/dist/__tests__/fixtures/sample-data.d.ts.map +0 -1
- package/dist/__tests__/fixtures/sample-templates.d.ts +0 -25
- package/dist/__tests__/fixtures/sample-templates.d.ts.map +0 -1
- package/dist/core/utils/component-initializer.test.d.ts +0 -2
- package/dist/core/utils/component-initializer.test.d.ts.map +0 -1
- package/dist/core/utils/field-extractor.test.d.ts +0 -2
- package/dist/core/utils/field-extractor.test.d.ts.map +0 -1
- package/dist/core/utils/image-utils.test.d.ts +0 -2
- package/dist/core/utils/image-utils.test.d.ts.map +0 -1
- package/dist/core/utils/path-utils.test.d.ts +0 -2
- package/dist/core/utils/path-utils.test.d.ts.map +0 -1
- package/dist/core/utils/storage.test.d.ts +0 -2
- package/dist/core/utils/storage.test.d.ts.map +0 -1
- package/dist/core/utils/template-processor.test.d.ts +0 -2
- package/dist/core/utils/template-processor.test.d.ts.map +0 -1
- package/dist/core/utils/template-utils.test.d.ts +0 -2
- package/dist/core/utils/template-utils.test.d.ts.map +0 -1
- package/dist/core/utils/validation.test.d.ts +0 -2
- package/dist/core/utils/validation.test.d.ts.map +0 -1
- package/dist/css/common.css +0 -677
- package/dist/css/docs.css +0 -396
- package/dist/css/index.css +0 -1039
- package/dist/css/page.css +0 -290
- package/dist/css/sample.css +0 -26
- package/dist/css/site-common.css +0 -218
- package/dist/footer.html +0 -10
- package/dist/header.html +0 -10
- package/dist/images/customer-avatar.jpg +0 -0
- package/dist/images/default-avatar.jpg +0 -0
- package/dist/images/default.jpg +0 -0
- package/dist/images/hero-bg.jpg +0 -0
- package/dist/images/kv_image.jpg +0 -0
- package/dist/images/page-specific-hero.jpg +0 -0
- package/dist/images/sample-1.jpg +0 -0
- package/dist/images/sample-2.jpg +0 -0
- package/dist/images/sample-3.jpg +0 -0
- package/dist/images/zcode_top_01.png +0 -0
- package/dist/js/accordion.js +0 -24
- package/dist/js/common.js +0 -1093
- package/dist/zerocode.es.js.map +0 -1
- package/dist/zerocode.umd.js.map +0 -1
package/dist/zerocode.umd.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
(function(en,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(en=typeof globalThis<"u"?globalThis:en||self,a(en.ZeroCode={},en.Vue))})(this,(function(en,a){"use strict";const Oc=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Wm=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,o)=>o?o.toUpperCase():n.toLowerCase()),Gm=t=>{const e=Wm(t);return e.charAt(0).toUpperCase()+e.slice(1)},qm=(...t)=>t.filter((e,n,o)=>!!e&&e.trim()!==""&&o.indexOf(e)===n).join(" ").trim(),Dc=t=>t==="";var rr={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const Km=({name:t,iconNode:e,absoluteStrokeWidth:n,"absolute-stroke-width":o,strokeWidth:r,"stroke-width":i,size:s=rr.width,color:l=rr.stroke,...c},{slots:d})=>a.h("svg",{...rr,...c,width:s,height:s,stroke:l,"stroke-width":Dc(n)||Dc(o)||n===!0||o===!0?Number(r||i||rr["stroke-width"])*24/Number(s):r||i||rr["stroke-width"],class:qm("lucide",c.class,...t?[`lucide-${Oc(Gm(t))}-icon`,`lucide-${Oc(t)}`]:["lucide-icon"])},[...e.map(u=>a.h(...u)),...d.default?[d.default()]:[]]);const He=(t,e)=>(n,{slots:o,attrs:r})=>a.h(Km,{...r,...n,iconNode:e,name:t},o);const ir=He("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);const Jm=He("bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);const sr=He("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const si=He("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Vn=He("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const Xm=He("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const Ym=He("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);const Qm=He("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const Rc=He("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);const na=He("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const Zm=He("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);const eg=He("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);const tg=He("list-ordered",[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]]);const ng=He("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]);const og=He("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);const Pc=He("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);const uo=He("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Lc=He("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);const $c=He("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const oa=He("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);const rg=He("strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);const Bn=He("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);const Vc=He("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const Qe=He("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const Bc=He("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);class ig{styleElements=new Map;container=null;setContainer(e){this.container!==e&&(this.container=e,this.removeAllCSS())}applyCSS(e){if(!this.container){console.warn("[PageCSSManager] Container not set");return}if(!e||!e.trim()){this.removeCSS("default");return}this.applyCSSForCategory("default",e)}applyMultipleCSS(e){if(!this.container){console.warn("[PageCSSManager] Container not set");return}["common","individual","special"].forEach(o=>{const r=e[o];r&&r.trim()?this.applyCSSForCategory(o,r):this.removeCSS(o)})}applyCSSForCategory(e,n){if(!this.container)return;let o=this.styleElements.get(e);o||(o=document.createElement("style"),o.id=`zcode-css-style-${e}`,o.setAttribute("data-zcode-css","true"),o.setAttribute("data-zcode-css-category",e),this.container.appendChild(o),this.styleElements.set(e,o)),o.textContent=n}removeCSS(e="default"){const n=this.styleElements.get(e);n&&(n.remove(),this.styleElements.delete(e))}removeAllCSS(){this.styleElements.forEach(e=>{e.remove()}),this.styleElements.clear()}cleanup(){this.removeAllCSS(),this.container=null}}const sg=["innerHTML"],ag={key:0,class:"zcode-empty-state"},Fc=a.defineComponent({__name:"PreviewArea",props:{cmsData:{type:Object},fullPageHtml:{type:String},onAddClick:{type:Function},allowDynamicContentInteraction:{type:Boolean}},setup(t,{expose:e}){const n=t,o=a.ref(null),r=a.ref(null),i=new ig;let s=null,l=!1;const c=u=>{if(n.allowDynamicContentInteraction===!1){const f=u.target;(f.tagName==="A"||f.closest("a"))&&(u.preventDefault(),u.stopPropagation())}};a.watch(()=>n.fullPageHtml,()=>{a.nextTick(()=>{r.value&&(l=!0,s&&s.disconnect(),s=new MutationObserver(()=>{l&&(l=!1,a.nextTick(()=>{window.dispatchEvent(new CustomEvent("zcode-dom-updated",{})),s&&(s.disconnect(),s=null)}))}),s.observe(r.value,{childList:!0,subtree:!0,characterData:!0}))})},{immediate:!1}),a.watch(()=>[n.cmsData.css?.common,n.cmsData.css?.individual,n.cmsData.css?.special],()=>{a.nextTick(()=>{d()})},{deep:!0});function d(){if(!o.value)return;const u=o.value.getRootNode();u instanceof ShadowRoot?i.setContainer(u):i.setContainer(document.head);const f={common:n.cmsData.css?.common,individual:n.cmsData.css?.individual,special:n.cmsData.css?.special};i.applyMultipleCSS(f)}return a.onMounted(()=>{a.nextTick(()=>{r.value&&(window.dispatchEvent(new CustomEvent("zcode-dom-updated",{})),r.value.addEventListener("click",c,!0)),d()})}),a.onUnmounted(()=>{s&&(s.disconnect(),s=null),r.value&&r.value.removeEventListener("click",c,!0),i.cleanup()}),e({previewArea:o}),(u,f)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"previewArea",ref:o},[a.createElementVNode("div",{ref_key:"htmlContainer",ref:r,innerHTML:t.fullPageHtml},null,8,sg),t.cmsData.page.length===0&&t.onAddClick?(a.openBlock(),a.createElementBlock("div",ag,[f[1]||(f[1]=a.createElementVNode("p",null,"パーツを追加してください",-1)),a.createElementVNode("button",{class:"zcode-add-btn",onClick:f[0]||(f[0]=p=>t.onAddClick("page.0"))}," + パーツを追加 ")])):a.createCommentVNode("",!0)],512))}});function ra(){if(typeof window<"u"&&typeof DOMParser<"u")return DOMParser;if(typeof require<"u")try{const{JSDOM:t}=require("jsdom");return new t().window.DOMParser}catch{throw new Error("jsdom is required for server-side rendering. Please install it: npm install jsdom")}if(typeof DOMParser<"u")return DOMParser;throw new Error("DOMParser is not available in this environment")}function lg(t){const e=window;e.__zcmsShadowRoots||(e.__zcmsShadowRoots=new Map);const n=`script-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return e.__zcmsShadowRoots.set(n,t),`
|
|
1
|
+
(function(Qt,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],s):(Qt=typeof globalThis<"u"?globalThis:Qt||self,s(Qt.ZeroCode={},Qt.Vue))})(this,(function(Qt,s){"use strict";const pc=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),um=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,o)=>o?o.toUpperCase():t.toLowerCase()),fm=n=>{const e=um(n);return e.charAt(0).toUpperCase()+e.slice(1)},pm=(...n)=>n.filter((e,t,o)=>!!e&&e.trim()!==""&&o.indexOf(e)===t).join(" ").trim(),hc=n=>n==="";var Qo={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const hm=({name:n,iconNode:e,absoluteStrokeWidth:t,"absolute-stroke-width":o,strokeWidth:r,"stroke-width":i,size:a=Qo.width,color:l=Qo.stroke,...c},{slots:d})=>s.h("svg",{...Qo,...c,width:a,height:a,stroke:l,"stroke-width":hc(t)||hc(o)||t===!0||o===!0?Number(r||i||Qo["stroke-width"])*24/Number(a):r||i||Qo["stroke-width"],class:pm("lucide",c.class,...n?[`lucide-${pc(fm(n))}-icon`,`lucide-${pc(n)}`]:["lucide-icon"])},[...e.map(u=>s.h(...u)),...d.default?[d.default()]:[]]);const He=(n,e)=>(t,{slots:o,attrs:r})=>s.h(hm,{...r,...t,iconNode:e,name:n},o);const Zo=He("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);const mm=He("bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);const er=He("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Yr=He("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Rn=He("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const gm=He("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const ym=He("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);const bm=He("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const mc=He("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);const Us=He("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const xm=He("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);const km=He("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);const Em=He("list-ordered",[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]]);const wm=He("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]);const Sm=He("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);const gc=He("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);const co=He("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const yc=He("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);const bc=He("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const Ws=He("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);const Cm=He("strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);const Ln=He("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);const xc=He("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const Xe=He("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const kc=He("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);class Nm{styleElements=new Map;container=null;setContainer(e){this.container!==e&&(this.container=e,this.removeAllCSS())}applyCSS(e){if(!this.container){console.warn("[PageCSSManager] Container not set");return}if(!e||!e.trim()){this.removeCSS("default");return}this.applyCSSForCategory("default",e)}applyMultipleCSS(e){if(!this.container){console.warn("[PageCSSManager] Container not set");return}["common","individual","special"].forEach(o=>{const r=e[o];r&&r.trim()?this.applyCSSForCategory(o,r):this.removeCSS(o)})}applyCSSForCategory(e,t){if(!this.container)return;let o=this.styleElements.get(e);o||(o=document.createElement("style"),o.id=`zcode-css-style-${e}`,o.setAttribute("data-zcode-css","true"),o.setAttribute("data-zcode-css-category",e),this.container.appendChild(o),this.styleElements.set(e,o)),o.textContent=t}removeCSS(e="default"){const t=this.styleElements.get(e);t&&(t.remove(),this.styleElements.delete(e))}removeAllCSS(){this.styleElements.forEach(e=>{e.remove()}),this.styleElements.clear()}cleanup(){this.removeAllCSS(),this.container=null}}const vm=["innerHTML"],Tm={key:0,class:"zcode-empty-state"},Ec=s.defineComponent({__name:"PreviewArea",props:{cmsData:{type:Object},fullPageHtml:{type:String},onAddClick:{type:Function},allowDynamicContentInteraction:{type:Boolean}},setup(n,{expose:e}){const t=n,o=s.ref(null),r=s.ref(null),i=new Nm;let a=null,l=!1;const c=u=>{if(t.allowDynamicContentInteraction===!1){const f=u.target;(f.tagName==="A"||f.closest("a"))&&(u.preventDefault(),u.stopPropagation())}};s.watch(()=>t.fullPageHtml,()=>{s.nextTick(()=>{r.value&&(l=!0,a&&a.disconnect(),a=new MutationObserver(()=>{l&&(l=!1,s.nextTick(()=>{window.dispatchEvent(new CustomEvent("zcode-dom-updated",{})),a&&(a.disconnect(),a=null)}))}),a.observe(r.value,{childList:!0,subtree:!0,characterData:!0}))})},{immediate:!1}),s.watch(()=>[t.cmsData.css?.common,t.cmsData.css?.individual,t.cmsData.css?.special],()=>{s.nextTick(()=>{d()})},{deep:!0});function d(){if(!o.value)return;const u=o.value.getRootNode();u instanceof ShadowRoot?i.setContainer(u):i.setContainer(document.head);const f={common:t.cmsData.css?.common,individual:t.cmsData.css?.individual,special:t.cmsData.css?.special};i.applyMultipleCSS(f)}return s.onMounted(()=>{s.nextTick(()=>{r.value&&(window.dispatchEvent(new CustomEvent("zcode-dom-updated",{})),r.value.addEventListener("click",c,!0)),d()})}),s.onUnmounted(()=>{a&&(a.disconnect(),a=null),r.value&&r.value.removeEventListener("click",c,!0),i.cleanup()}),e({previewArea:o}),(u,f)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"previewArea",ref:o},[s.createElementVNode("div",{ref_key:"htmlContainer",ref:r,innerHTML:n.fullPageHtml},null,8,vm),n.cmsData.page.length===0&&n.onAddClick?(s.openBlock(),s.createElementBlock("div",Tm,[s.createElementVNode("p",null,s.toDisplayString(u.$t("emptyState.message")),1),s.createElementVNode("button",{class:"zcode-add-btn",onClick:f[0]||(f[0]=p=>n.onAddClick("page.0"))},s.toDisplayString(u.$t("emptyState.addPart")),1)])):s.createCommentVNode("",!0)],512))}});function zm(n,e){typeof console<"u"&&(console.warn("[intlify] "+n),e&&console.warn(e.stack))}const wc=typeof window<"u",$n=(n,e=!1)=>e?Symbol.for(n):Symbol(n),Mm=(n,e,t)=>Am({l:n,k:e,s:t}),Am=n=>JSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),it=n=>typeof n=="number"&&isFinite(n),Im=n=>Tc(n)==="[object Date]",Qr=n=>Tc(n)==="[object RegExp]",Zr=n=>Ve(n)&&Object.keys(n).length===0,xt=Object.assign,_m=Object.create,Be=(n=null)=>_m(n);let Sc;const ei=()=>Sc||(Sc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:Be());function Cc(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/").replace(/=/g,"=")}function Nc(n){return n.replace(/&(?![a-zA-Z0-9#]{2,6};)/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function Om(n){return n=n.replace(/(\w+)\s*=\s*"([^"]*)"/g,(o,r,i)=>`${r}="${Nc(i)}"`),n=n.replace(/(\w+)\s*=\s*'([^']*)'/g,(o,r,i)=>`${r}='${Nc(i)}'`),/\s*on\w+\s*=\s*["']?[^"'>]+["']?/gi.test(n)&&(n=n.replace(/(\s+)(on)(\w+\s*=)/gi,"$1on$3")),[/(\s+(?:href|src|action|formaction)\s*=\s*["']?)\s*javascript:/gi,/(style\s*=\s*["'][^"']*url\s*\(\s*)javascript:/gi].forEach(o=>{n=n.replace(o,"$1javascript:")}),n}const Dm=Object.prototype.hasOwnProperty;function Zt(n,e){return Dm.call(n,e)}const ot=Array.isArray,Ke=n=>typeof n=="function",ke=n=>typeof n=="string",Ge=n=>typeof n=="boolean",$e=n=>n!==null&&typeof n=="object",Pm=n=>$e(n)&&Ke(n.then)&&Ke(n.catch),vc=Object.prototype.toString,Tc=n=>vc.call(n),Ve=n=>{if(!$e(n))return!1;const e=Object.getPrototypeOf(n);return e===null||e.constructor===Object},Rm=n=>n==null?"":ot(n)||Ve(n)&&n.toString===vc?JSON.stringify(n,null,2):String(n);function Lm(n,e=""){return n.reduce((t,o,r)=>r===0?t+o:t+e+o,"")}function ti(n){let e=n;return()=>++e}const ni=n=>!$e(n)||ot(n);function oi(n,e){if(ni(n)||ni(e))throw new Error("Invalid value");const t=[{src:n,des:e}];for(;t.length;){const{src:o,des:r}=t.pop();Object.keys(o).forEach(i=>{i!=="__proto__"&&($e(o[i])&&!$e(r[i])&&(r[i]=Array.isArray(o[i])?[]:Be()),ni(r[i])||ni(o[i])?r[i]=o[i]:t.push({src:o[i],des:r[i]}))})}}function $m(n,e,t){return{line:n,column:e,offset:t}}function ri(n,e,t){return{start:n,end:e}}const Vm=/\{([0-9a-zA-Z]+)\}/g;function zc(n,...e){return e.length===1&&Bm(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),n.replace(Vm,(t,o)=>e.hasOwnProperty(o)?e[o]:"")}const Mc=Object.assign,Ac=n=>typeof n=="string",Bm=n=>n!==null&&typeof n=="object";function Ic(n,e=""){return n.reduce((t,o,r)=>r===0?t+o:t+e+o,"")}const qs={USE_MODULO_SYNTAX:1,__EXTEND_POINT__:2},Fm={[qs.USE_MODULO_SYNTAX]:"Use modulo before '{{0}}'."};function jm(n,e,...t){const o=zc(Fm[n],...t||[]),r={message:String(o),code:n};return e&&(r.location=e),r}const Se={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16,__EXTEND_POINT__:17},Hm={[Se.EXPECTED_TOKEN]:"Expected token: '{0}'",[Se.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[Se.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[Se.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[Se.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[Se.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[Se.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[Se.EMPTY_PLACEHOLDER]:"Empty placeholder",[Se.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[Se.INVALID_LINKED_FORMAT]:"Invalid linked format",[Se.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[Se.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[Se.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[Se.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[Se.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[Se.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function zo(n,e,t={}){const{domain:o,messages:r,args:i}=t,a=zc((r||Hm)[n]||"",...i||[]),l=new SyntaxError(String(a));return l.code=n,e&&(l.location=e),l.domain=o,l}function Um(n){throw n}const xn=" ",Wm="\r",kt=`
|
|
2
|
+
`,qm="\u2028",Gm="\u2029";function Km(n){const e=n;let t=0,o=1,r=1,i=0;const a=k=>e[k]===Wm&&e[k+1]===kt,l=k=>e[k]===kt,c=k=>e[k]===Gm,d=k=>e[k]===qm,u=k=>a(k)||l(k)||c(k)||d(k),f=()=>t,p=()=>o,h=()=>r,m=()=>i,g=k=>a(k)||c(k)||d(k)?kt:e[k],y=()=>g(t),b=()=>g(t+i);function z(){return i=0,u(t)&&(o++,r=0),a(t)&&t++,t++,r++,e[t]}function w(){return a(t+i)&&i++,i++,e[t+i]}function T(){t=0,o=1,r=1,i=0}function A(k=0){i=k}function M(){const k=t+i;for(;k!==t;)z();i=0}return{index:f,line:p,column:h,peekOffset:m,charAt:g,currentChar:y,currentPeek:b,next:z,peek:w,reset:T,resetPeek:A,skipToPeek:M}}const Vn=void 0,Jm=".",_c="'",Xm="tokenizer";function Ym(n,e={}){const t=e.location!==!1,o=Km(n),r=()=>o.index(),i=()=>$m(o.line(),o.column(),o.index()),a=i(),l=r(),c={currentType:14,offset:l,startLoc:a,endLoc:a,lastType:14,lastOffset:l,lastStartLoc:a,lastEndLoc:a,braceNest:0,inLinked:!1,text:""},d=()=>c,{onError:u}=e;function f(v,I,J,...he){const Ae=d();if(I.column+=J,I.offset+=J,u){const ye=t?ri(Ae.startLoc,I):null,U=zo(v,ye,{domain:Xm,args:he});u(U)}}function p(v,I,J){v.endLoc=i(),v.currentType=I;const he={type:I};return t&&(he.loc=ri(v.startLoc,v.endLoc)),J!=null&&(he.value=J),he}const h=v=>p(v,14);function m(v,I){return v.currentChar()===I?(v.next(),I):(f(Se.EXPECTED_TOKEN,i(),0,I),"")}function g(v){let I="";for(;v.currentPeek()===xn||v.currentPeek()===kt;)I+=v.currentPeek(),v.peek();return I}function y(v){const I=g(v);return v.skipToPeek(),I}function b(v){if(v===Vn)return!1;const I=v.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I===95}function z(v){if(v===Vn)return!1;const I=v.charCodeAt(0);return I>=48&&I<=57}function w(v,I){const{currentType:J}=I;if(J!==2)return!1;g(v);const he=b(v.currentPeek());return v.resetPeek(),he}function T(v,I){const{currentType:J}=I;if(J!==2)return!1;g(v);const he=v.currentPeek()==="-"?v.peek():v.currentPeek(),Ae=z(he);return v.resetPeek(),Ae}function A(v,I){const{currentType:J}=I;if(J!==2)return!1;g(v);const he=v.currentPeek()===_c;return v.resetPeek(),he}function M(v,I){const{currentType:J}=I;if(J!==8)return!1;g(v);const he=v.currentPeek()===".";return v.resetPeek(),he}function k(v,I){const{currentType:J}=I;if(J!==9)return!1;g(v);const he=b(v.currentPeek());return v.resetPeek(),he}function E(v,I){const{currentType:J}=I;if(!(J===8||J===12))return!1;g(v);const he=v.currentPeek()===":";return v.resetPeek(),he}function x(v,I){const{currentType:J}=I;if(J!==10)return!1;const he=()=>{const ye=v.currentPeek();return ye==="{"?b(v.peek()):ye==="@"||ye==="%"||ye==="|"||ye===":"||ye==="."||ye===xn||!ye?!1:ye===kt?(v.peek(),he()):O(v,!1)},Ae=he();return v.resetPeek(),Ae}function B(v){g(v);const I=v.currentPeek()==="|";return v.resetPeek(),I}function $(v){const I=g(v),J=v.currentPeek()==="%"&&v.peek()==="{";return v.resetPeek(),{isModulo:J,hasSpace:I.length>0}}function O(v,I=!0){const J=(Ae=!1,ye="",U=!1)=>{const Q=v.currentPeek();return Q==="{"?ye==="%"?!1:Ae:Q==="@"||!Q?ye==="%"?!0:Ae:Q==="%"?(v.peek(),J(Ae,"%",!0)):Q==="|"?ye==="%"||U?!0:!(ye===xn||ye===kt):Q===xn?(v.peek(),J(!0,xn,U)):Q===kt?(v.peek(),J(!0,kt,U)):!0},he=J();return I&&v.resetPeek(),he}function D(v,I){const J=v.currentChar();return J===Vn?Vn:I(J)?(v.next(),J):null}function P(v){const I=v.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36}function q(v){return D(v,P)}function W(v){const I=v.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36||I===45}function R(v){return D(v,W)}function K(v){const I=v.charCodeAt(0);return I>=48&&I<=57}function X(v){return D(v,K)}function te(v){const I=v.charCodeAt(0);return I>=48&&I<=57||I>=65&&I<=70||I>=97&&I<=102}function oe(v){return D(v,te)}function G(v){let I="",J="";for(;I=X(v);)J+=I;return J}function Z(v){y(v);const I=v.currentChar();return I!=="%"&&f(Se.EXPECTED_TOKEN,i(),0,I),v.next(),"%"}function Y(v){let I="";for(;;){const J=v.currentChar();if(J==="{"||J==="}"||J==="@"||J==="|"||!J)break;if(J==="%")if(O(v))I+=J,v.next();else break;else if(J===xn||J===kt)if(O(v))I+=J,v.next();else{if(B(v))break;I+=J,v.next()}else I+=J,v.next()}return I}function ee(v){y(v);let I="",J="";for(;I=R(v);)J+=I;return v.currentChar()===Vn&&f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),J}function le(v){y(v);let I="";return v.currentChar()==="-"?(v.next(),I+=`-${G(v)}`):I+=G(v),v.currentChar()===Vn&&f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),I}function ge(v){return v!==_c&&v!==kt}function Ne(v){y(v),m(v,"'");let I="",J="";for(;I=D(v,ge);)I==="\\"?J+=Re(v):J+=I;const he=v.currentChar();return he===kt||he===Vn?(f(Se.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,i(),0),he===kt&&(v.next(),m(v,"'")),J):(m(v,"'"),J)}function Re(v){const I=v.currentChar();switch(I){case"\\":case"'":return v.next(),`\\${I}`;case"u":return C(v,I,4);case"U":return C(v,I,6);default:return f(Se.UNKNOWN_ESCAPE_SEQUENCE,i(),0,I),""}}function C(v,I,J){m(v,I);let he="";for(let Ae=0;Ae<J;Ae++){const ye=oe(v);if(!ye){f(Se.INVALID_UNICODE_ESCAPE_SEQUENCE,i(),0,`\\${I}${he}${v.currentChar()}`);break}he+=ye}return`\\${I}${he}`}function L(v){return v!=="{"&&v!=="}"&&v!==xn&&v!==kt}function V(v){y(v);let I="",J="";for(;I=D(v,L);)J+=I;return J}function S(v){let I="",J="";for(;I=q(v);)J+=I;return J}function N(v){const I=J=>{const he=v.currentChar();return he==="{"||he==="%"||he==="@"||he==="|"||he==="("||he===")"||!he||he===xn?J:(J+=he,v.next(),I(J))};return I("")}function F(v){y(v);const I=m(v,"|");return y(v),I}function ne(v,I){let J=null;switch(v.currentChar()){case"{":return I.braceNest>=1&&f(Se.NOT_ALLOW_NEST_PLACEHOLDER,i(),0),v.next(),J=p(I,2,"{"),y(v),I.braceNest++,J;case"}":return I.braceNest>0&&I.currentType===2&&f(Se.EMPTY_PLACEHOLDER,i(),0),v.next(),J=p(I,3,"}"),I.braceNest--,I.braceNest>0&&y(v),I.inLinked&&I.braceNest===0&&(I.inLinked=!1),J;case"@":return I.braceNest>0&&f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),J=me(v,I)||h(I),I.braceNest=0,J;default:{let Ae=!0,ye=!0,U=!0;if(B(v))return I.braceNest>0&&f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),J=p(I,1,F(v)),I.braceNest=0,I.inLinked=!1,J;if(I.braceNest>0&&(I.currentType===5||I.currentType===6||I.currentType===7))return f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),I.braceNest=0,De(v,I);if(Ae=w(v,I))return J=p(I,5,ee(v)),y(v),J;if(ye=T(v,I))return J=p(I,6,le(v)),y(v),J;if(U=A(v,I))return J=p(I,7,Ne(v)),y(v),J;if(!Ae&&!ye&&!U)return J=p(I,13,V(v)),f(Se.INVALID_TOKEN_IN_PLACEHOLDER,i(),0,J.value),y(v),J;break}}return J}function me(v,I){const{currentType:J}=I;let he=null;const Ae=v.currentChar();switch((J===8||J===9||J===12||J===10)&&(Ae===kt||Ae===xn)&&f(Se.INVALID_LINKED_FORMAT,i(),0),Ae){case"@":return v.next(),he=p(I,8,"@"),I.inLinked=!0,he;case".":return y(v),v.next(),p(I,9,".");case":":return y(v),v.next(),p(I,10,":");default:return B(v)?(he=p(I,1,F(v)),I.braceNest=0,I.inLinked=!1,he):M(v,I)||E(v,I)?(y(v),me(v,I)):k(v,I)?(y(v),p(I,12,S(v))):x(v,I)?(y(v),Ae==="{"?ne(v,I)||he:p(I,11,N(v))):(J===8&&f(Se.INVALID_LINKED_FORMAT,i(),0),I.braceNest=0,I.inLinked=!1,De(v,I))}}function De(v,I){let J={type:14};if(I.braceNest>0)return ne(v,I)||h(I);if(I.inLinked)return me(v,I)||h(I);switch(v.currentChar()){case"{":return ne(v,I)||h(I);case"}":return f(Se.UNBALANCED_CLOSING_BRACE,i(),0),v.next(),p(I,3,"}");case"@":return me(v,I)||h(I);default:{if(B(v))return J=p(I,1,F(v)),I.braceNest=0,I.inLinked=!1,J;const{isModulo:Ae,hasSpace:ye}=$(v);if(Ae)return ye?p(I,0,Y(v)):p(I,4,Z(v));if(O(v))return p(I,0,Y(v));break}}return J}function Te(){const{currentType:v,offset:I,startLoc:J,endLoc:he}=c;return c.lastType=v,c.lastOffset=I,c.lastStartLoc=J,c.lastEndLoc=he,c.offset=r(),c.startLoc=i(),o.currentChar()===Vn?p(c,14):De(o,c)}return{nextToken:Te,currentOffset:r,currentPosition:i,context:d}}const Qm="parser",Zm=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function eg(n,e,t){switch(n){case"\\\\":return"\\";case"\\'":return"'";default:{const o=parseInt(e||t,16);return o<=55295||o>=57344?String.fromCodePoint(o):"�"}}}function tg(n={}){const e=n.location!==!1,{onError:t,onWarn:o}=n;function r(w,T,A,M,...k){const E=w.currentPosition();if(E.offset+=M,E.column+=M,t){const x=e?ri(A,E):null,B=zo(T,x,{domain:Qm,args:k});t(B)}}function i(w,T,A,M,...k){const E=w.currentPosition();if(E.offset+=M,E.column+=M,o){const x=e?ri(A,E):null;o(jm(T,x,k))}}function a(w,T,A){const M={type:w};return e&&(M.start=T,M.end=T,M.loc={start:A,end:A}),M}function l(w,T,A,M){e&&(w.end=T,w.loc&&(w.loc.end=A))}function c(w,T){const A=w.context(),M=a(3,A.offset,A.startLoc);return M.value=T,l(M,w.currentOffset(),w.currentPosition()),M}function d(w,T){const A=w.context(),{lastOffset:M,lastStartLoc:k}=A,E=a(5,M,k);return E.index=parseInt(T,10),w.nextToken(),l(E,w.currentOffset(),w.currentPosition()),E}function u(w,T,A){const M=w.context(),{lastOffset:k,lastStartLoc:E}=M,x=a(4,k,E);return x.key=T,A===!0&&(x.modulo=!0),w.nextToken(),l(x,w.currentOffset(),w.currentPosition()),x}function f(w,T){const A=w.context(),{lastOffset:M,lastStartLoc:k}=A,E=a(9,M,k);return E.value=T.replace(Zm,eg),w.nextToken(),l(E,w.currentOffset(),w.currentPosition()),E}function p(w){const T=w.nextToken(),A=w.context(),{lastOffset:M,lastStartLoc:k}=A,E=a(8,M,k);return T.type!==12?(r(w,Se.UNEXPECTED_EMPTY_LINKED_MODIFIER,A.lastStartLoc,0),E.value="",l(E,M,k),{nextConsumeToken:T,node:E}):(T.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,A.lastStartLoc,0,en(T)),E.value=T.value||"",l(E,w.currentOffset(),w.currentPosition()),{node:E})}function h(w,T){const A=w.context(),M=a(7,A.offset,A.startLoc);return M.value=T,l(M,w.currentOffset(),w.currentPosition()),M}function m(w){const T=w.context(),A=a(6,T.offset,T.startLoc);let M=w.nextToken();if(M.type===9){const k=p(w);A.modifier=k.node,M=k.nextConsumeToken||w.nextToken()}switch(M.type!==10&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,en(M)),M=w.nextToken(),M.type===2&&(M=w.nextToken()),M.type){case 11:M.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,en(M)),A.key=h(w,M.value||"");break;case 5:M.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,en(M)),A.key=u(w,M.value||"");break;case 6:M.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,en(M)),A.key=d(w,M.value||"");break;case 7:M.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,en(M)),A.key=f(w,M.value||"");break;default:{r(w,Se.UNEXPECTED_EMPTY_LINKED_KEY,T.lastStartLoc,0);const k=w.context(),E=a(7,k.offset,k.startLoc);return E.value="",l(E,k.offset,k.startLoc),A.key=E,l(A,k.offset,k.startLoc),{nextConsumeToken:M,node:A}}}return l(A,w.currentOffset(),w.currentPosition()),{node:A}}function g(w){const T=w.context(),A=T.currentType===1?w.currentOffset():T.offset,M=T.currentType===1?T.endLoc:T.startLoc,k=a(2,A,M);k.items=[];let E=null,x=null;do{const O=E||w.nextToken();switch(E=null,O.type){case 0:O.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,en(O)),k.items.push(c(w,O.value||""));break;case 6:O.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,en(O)),k.items.push(d(w,O.value||""));break;case 4:x=!0;break;case 5:O.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,en(O)),k.items.push(u(w,O.value||"",!!x)),x&&(i(w,qs.USE_MODULO_SYNTAX,T.lastStartLoc,0,en(O)),x=null);break;case 7:O.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,en(O)),k.items.push(f(w,O.value||""));break;case 8:{const D=m(w);k.items.push(D.node),E=D.nextConsumeToken||null;break}}}while(T.currentType!==14&&T.currentType!==1);const B=T.currentType===1?T.lastOffset:w.currentOffset(),$=T.currentType===1?T.lastEndLoc:w.currentPosition();return l(k,B,$),k}function y(w,T,A,M){const k=w.context();let E=M.items.length===0;const x=a(1,T,A);x.cases=[],x.cases.push(M);do{const B=g(w);E||(E=B.items.length===0),x.cases.push(B)}while(k.currentType!==14);return E&&r(w,Se.MUST_HAVE_MESSAGES_IN_PLURAL,A,0),l(x,w.currentOffset(),w.currentPosition()),x}function b(w){const T=w.context(),{offset:A,startLoc:M}=T,k=g(w);return T.currentType===14?k:y(w,A,M,k)}function z(w){const T=Ym(w,Mc({},n)),A=T.context(),M=a(0,A.offset,A.startLoc);return e&&M.loc&&(M.loc.source=w),M.body=b(T),n.onCacheKey&&(M.cacheKey=n.onCacheKey(w)),A.currentType!==14&&r(T,Se.UNEXPECTED_LEXICAL_ANALYSIS,A.lastStartLoc,0,w[A.offset]||""),l(M,T.currentOffset(),T.currentPosition()),M}return{parse:z}}function en(n){if(n.type===14)return"EOF";const e=(n.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function ng(n,e={}){const t={ast:n,helpers:new Set};return{context:()=>t,helper:i=>(t.helpers.add(i),i)}}function Oc(n,e){for(let t=0;t<n.length;t++)Gs(n[t],e)}function Gs(n,e){switch(n.type){case 1:Oc(n.cases,e),e.helper("plural");break;case 2:Oc(n.items,e);break;case 6:{Gs(n.key,e),e.helper("linked"),e.helper("type");break}case 5:e.helper("interpolate"),e.helper("list");break;case 4:e.helper("interpolate"),e.helper("named");break}}function og(n,e={}){const t=ng(n);t.helper("normalize"),n.body&&Gs(n.body,t);const o=t.context();n.helpers=Array.from(o.helpers)}function rg(n){const e=n.body;return e.type===2?Dc(e):e.cases.forEach(t=>Dc(t)),n}function Dc(n){if(n.items.length===1){const e=n.items[0];(e.type===3||e.type===9)&&(n.static=e.value,delete e.value)}else{const e=[];for(let t=0;t<n.items.length;t++){const o=n.items[t];if(!(o.type===3||o.type===9)||o.value==null)break;e.push(o.value)}if(e.length===n.items.length){n.static=Ic(e);for(let t=0;t<n.items.length;t++){const o=n.items[t];(o.type===3||o.type===9)&&delete o.value}}}}const ig="minifier";function Mo(n){switch(n.t=n.type,n.type){case 0:{const e=n;Mo(e.body),e.b=e.body,delete e.body;break}case 1:{const e=n,t=e.cases;for(let o=0;o<t.length;o++)Mo(t[o]);e.c=t,delete e.cases;break}case 2:{const e=n,t=e.items;for(let o=0;o<t.length;o++)Mo(t[o]);e.i=t,delete e.items,e.static&&(e.s=e.static,delete e.static);break}case 3:case 9:case 8:case 7:{const e=n;e.value&&(e.v=e.value,delete e.value);break}case 6:{const e=n;Mo(e.key),e.k=e.key,delete e.key,e.modifier&&(Mo(e.modifier),e.m=e.modifier,delete e.modifier);break}case 5:{const e=n;e.i=e.index,delete e.index;break}case 4:{const e=n;e.k=e.key,delete e.key;break}default:throw zo(Se.UNHANDLED_MINIFIER_NODE_TYPE,null,{domain:ig,args:[n.type]})}delete n.type}const sg="parser";function ag(n,e){const{filename:t,breakLineCode:o,needIndent:r}=e,i=e.location!==!1,a={filename:t,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:o,needIndent:r,indentLevel:0};i&&n.loc&&(a.source=n.loc.source);const l=()=>a;function c(g,y){a.code+=g}function d(g,y=!0){const b=y?o:"";c(r?b+" ".repeat(g):b)}function u(g=!0){const y=++a.indentLevel;g&&d(y)}function f(g=!0){const y=--a.indentLevel;g&&d(y)}function p(){d(a.indentLevel)}return{context:l,push:c,indent:u,deindent:f,newline:p,helper:g=>`_${g}`,needIndent:()=>a.needIndent}}function lg(n,e){const{helper:t}=n;n.push(`${t("linked")}(`),Ao(n,e.key),e.modifier?(n.push(", "),Ao(n,e.modifier),n.push(", _type")):n.push(", undefined, _type"),n.push(")")}function cg(n,e){const{helper:t,needIndent:o}=n;n.push(`${t("normalize")}([`),n.indent(o());const r=e.items.length;for(let i=0;i<r&&(Ao(n,e.items[i]),i!==r-1);i++)n.push(", ");n.deindent(o()),n.push("])")}function dg(n,e){const{helper:t,needIndent:o}=n;if(e.cases.length>1){n.push(`${t("plural")}([`),n.indent(o());const r=e.cases.length;for(let i=0;i<r&&(Ao(n,e.cases[i]),i!==r-1);i++)n.push(", ");n.deindent(o()),n.push("])")}}function ug(n,e){e.body?Ao(n,e.body):n.push("null")}function Ao(n,e){const{helper:t}=n;switch(e.type){case 0:ug(n,e);break;case 1:dg(n,e);break;case 2:cg(n,e);break;case 6:lg(n,e);break;case 8:n.push(JSON.stringify(e.value),e);break;case 7:n.push(JSON.stringify(e.value),e);break;case 5:n.push(`${t("interpolate")}(${t("list")}(${e.index}))`,e);break;case 4:n.push(`${t("interpolate")}(${t("named")}(${JSON.stringify(e.key)}))`,e);break;case 9:n.push(JSON.stringify(e.value),e);break;case 3:n.push(JSON.stringify(e.value),e);break;default:throw zo(Se.UNHANDLED_CODEGEN_NODE_TYPE,null,{domain:sg,args:[e.type]})}}const fg=(n,e={})=>{const t=Ac(e.mode)?e.mode:"normal",o=Ac(e.filename)?e.filename:"message.intl";e.sourceMap;const r=e.breakLineCode!=null?e.breakLineCode:t==="arrow"?";":`
|
|
3
|
+
`,i=e.needIndent?e.needIndent:t!=="arrow",a=n.helpers||[],l=ag(n,{filename:o,breakLineCode:r,needIndent:i});l.push(t==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),l.indent(i),a.length>0&&(l.push(`const { ${Ic(a.map(u=>`${u}: _${u}`),", ")} } = ctx`),l.newline()),l.push("return "),Ao(l,n),l.deindent(i),l.push("}"),delete n.helpers;const{code:c,map:d}=l.context();return{ast:n,code:c,map:d?d.toJSON():void 0}};function pg(n,e={}){const t=Mc({},e),o=!!t.jit,r=!!t.minify,i=t.optimize==null?!0:t.optimize,l=tg(t).parse(n);return o?(i&&rg(l),r&&Mo(l),{ast:l,code:""}):(og(l,t),fg(l,t))}function hg(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(ei().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(ei().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function an(n){return $e(n)&&Ks(n)===0&&(Zt(n,"b")||Zt(n,"body"))}const Pc=["b","body"];function mg(n){return Bn(n,Pc)}const Rc=["c","cases"];function gg(n){return Bn(n,Rc,[])}const Lc=["s","static"];function yg(n){return Bn(n,Lc)}const $c=["i","items"];function bg(n){return Bn(n,$c,[])}const Vc=["t","type"];function Ks(n){return Bn(n,Vc)}const Bc=["v","value"];function ii(n,e){const t=Bn(n,Bc);if(t!=null)return t;throw tr(e)}const Fc=["m","modifier"];function xg(n){return Bn(n,Fc)}const jc=["k","key"];function kg(n){const e=Bn(n,jc);if(e)return e;throw tr(6)}function Bn(n,e,t){for(let o=0;o<e.length;o++){const r=e[o];if(Zt(n,r)&&n[r]!=null)return n[r]}return t}const Hc=[...Pc,...Rc,...Lc,...$c,...jc,...Fc,...Bc,...Vc];function tr(n){return new Error(`unhandled node type: ${n}`)}const Fn=[];Fn[0]={w:[0],i:[3,0],"[":[4],o:[7]},Fn[1]={w:[1],".":[2],"[":[4],o:[7]},Fn[2]={w:[2],i:[3,0],0:[3,0]},Fn[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},Fn[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},Fn[5]={"'":[4,0],o:8,l:[5,0]},Fn[6]={'"':[4,0],o:8,l:[6,0]};const Eg=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function wg(n){return Eg.test(n)}function Sg(n){const e=n.charCodeAt(0),t=n.charCodeAt(n.length-1);return e===t&&(e===34||e===39)?n.slice(1,-1):n}function Cg(n){if(n==null)return"o";switch(n.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return n;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function Ng(n){const e=n.trim();return n.charAt(0)==="0"&&isNaN(parseInt(n))?!1:wg(e)?Sg(e):"*"+e}function vg(n){const e=[];let t=-1,o=0,r=0,i,a,l,c,d,u,f;const p=[];p[0]=()=>{a===void 0?a=l:a+=l},p[1]=()=>{a!==void 0&&(e.push(a),a=void 0)},p[2]=()=>{p[0](),r++},p[3]=()=>{if(r>0)r--,o=4,p[0]();else{if(r=0,a===void 0||(a=Ng(a),a===!1))return!1;p[1]()}};function h(){const m=n[t+1];if(o===5&&m==="'"||o===6&&m==='"')return t++,l="\\"+m,p[0](),!0}for(;o!==null;)if(t++,i=n[t],!(i==="\\"&&h())){if(c=Cg(i),f=Fn[o],d=f[c]||f.l||8,d===8||(o=d[0],d[1]!==void 0&&(u=p[d[1]],u&&(l=i,u()===!1))))return;if(o===7)return e}}const Uc=new Map;function Tg(n,e){return $e(n)?n[e]:null}function zg(n,e){if(!$e(n))return null;let t=Uc.get(e);if(t||(t=vg(e),t&&Uc.set(e,t)),!t)return null;const o=t.length;let r=n,i=0;for(;i<o;){const a=t[i];if(Hc.includes(a)&&an(r))return null;const l=r[a];if(l===void 0||Ke(r))return null;r=l,i++}return r}const Mg=n=>n,Ag=n=>"",Ig="text",_g=n=>n.length===0?"":Lm(n),Og=Rm;function Wc(n,e){return n=Math.abs(n),e===2?n?n>1?1:0:1:n?Math.min(n,2):0}function Dg(n){const e=it(n.pluralIndex)?n.pluralIndex:-1;return n.named&&(it(n.named.count)||it(n.named.n))?it(n.named.count)?n.named.count:it(n.named.n)?n.named.n:e:e}function Pg(n,e){e.count||(e.count=n),e.n||(e.n=n)}function Rg(n={}){const e=n.locale,t=Dg(n),o=$e(n.pluralRules)&&ke(e)&&Ke(n.pluralRules[e])?n.pluralRules[e]:Wc,r=$e(n.pluralRules)&&ke(e)&&Ke(n.pluralRules[e])?Wc:void 0,i=b=>b[o(t,b.length,r)],a=n.list||[],l=b=>a[b],c=n.named||Be();it(n.pluralIndex)&&Pg(t,c);const d=b=>c[b];function u(b){const z=Ke(n.messages)?n.messages(b):$e(n.messages)?n.messages[b]:!1;return z||(n.parent?n.parent.message(b):Ag)}const f=b=>n.modifiers?n.modifiers[b]:Mg,p=Ve(n.processor)&&Ke(n.processor.normalize)?n.processor.normalize:_g,h=Ve(n.processor)&&Ke(n.processor.interpolate)?n.processor.interpolate:Og,m=Ve(n.processor)&&ke(n.processor.type)?n.processor.type:Ig,y={list:l,named:d,plural:i,linked:(b,...z)=>{const[w,T]=z;let A="text",M="";z.length===1?$e(w)?(M=w.modifier||M,A=w.type||A):ke(w)&&(M=w||M):z.length===2&&(ke(w)&&(M=w||M),ke(T)&&(A=T||A));const k=u(b)(y),E=A==="vnode"&&ot(k)&&M?k[0]:k;return M?f(M)(E,A):E},message:u,type:m,interpolate:h,normalize:p,values:xt(Be(),a,c)};return y}const Lg=qs.__EXTEND_POINT__,uo=ti(Lg),$g={FALLBACK_TO_TRANSLATE:uo(),CANNOT_FORMAT_NUMBER:uo(),FALLBACK_TO_NUMBER_FORMAT:uo(),CANNOT_FORMAT_DATE:uo(),FALLBACK_TO_DATE_FORMAT:uo(),EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:uo(),__EXTEND_POINT__:uo()},qc=Se.__EXTEND_POINT__,fo=ti(qc),tn={INVALID_ARGUMENT:qc,INVALID_DATE_ARGUMENT:fo(),INVALID_ISO_DATE_ARGUMENT:fo(),NOT_SUPPORT_NON_STRING_MESSAGE:fo(),NOT_SUPPORT_LOCALE_PROMISE_VALUE:fo(),NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:fo(),NOT_SUPPORT_LOCALE_TYPE:fo(),__EXTEND_POINT__:fo()};function ln(n){return zo(n,null,void 0)}function Js(n,e){return e.locale!=null?Gc(e.locale):Gc(n.locale)}let Xs;function Gc(n){if(ke(n))return n;if(Ke(n)){if(n.resolvedOnce&&Xs!=null)return Xs;if(n.constructor.name==="Function"){const e=n();if(Pm(e))throw ln(tn.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return Xs=e}else throw ln(tn.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw ln(tn.NOT_SUPPORT_LOCALE_TYPE)}function Vg(n,e,t){return[...new Set([t,...ot(e)?e:$e(e)?Object.keys(e):ke(e)?[e]:[t]])]}function Kc(n,e,t){const o=ke(t)?t:ai,r=n;r.__localeChainCache||(r.__localeChainCache=new Map);let i=r.__localeChainCache.get(o);if(!i){i=[];let a=[t];for(;ot(a);)a=Jc(i,a,e);const l=ot(e)||!Ve(e)?e:e.default?e.default:null;a=ke(l)?[l]:l,ot(a)&&Jc(i,a,!1),r.__localeChainCache.set(o,i)}return i}function Jc(n,e,t){let o=!0;for(let r=0;r<e.length&&Ge(o);r++){const i=e[r];ke(i)&&(o=Bg(n,e[r],t))}return o}function Bg(n,e,t){let o;const r=e.split("-");do{const i=r.join("-");o=Fg(n,i,t),r.splice(-1,1)}while(r.length&&o===!0);return o}function Fg(n,e,t){let o=!1;if(!n.includes(e)&&(o=!0,e)){o=e[e.length-1]!=="!";const r=e.replace(/!/g,"");n.push(r),(ot(t)||Ve(t))&&t[r]&&(o=t[r])}return o}const jg="9.14.5",si=-1,ai="en-US",Xc="",Yc=n=>`${n.charAt(0).toLocaleUpperCase()}${n.substr(1)}`;function Hg(){return{upper:(n,e)=>e==="text"&&ke(n)?n.toUpperCase():e==="vnode"&&$e(n)&&"__v_isVNode"in n?n.children.toUpperCase():n,lower:(n,e)=>e==="text"&&ke(n)?n.toLowerCase():e==="vnode"&&$e(n)&&"__v_isVNode"in n?n.children.toLowerCase():n,capitalize:(n,e)=>e==="text"&&ke(n)?Yc(n):e==="vnode"&&$e(n)&&"__v_isVNode"in n?Yc(n.children):n}}let Qc;function Zc(n){Qc=n}let ed;function Ug(n){ed=n}let td;function Wg(n){td=n}const fA=n=>{};let nd=null;const od=n=>{nd=n},qg=()=>nd;let rd=0;function Gg(n={}){const e=Ke(n.onWarn)?n.onWarn:zm,t=ke(n.version)?n.version:jg,o=ke(n.locale)||Ke(n.locale)?n.locale:ai,r=Ke(o)?ai:o,i=ot(n.fallbackLocale)||Ve(n.fallbackLocale)||ke(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:r,a=Ve(n.messages)?n.messages:Ys(r),l=Ve(n.datetimeFormats)?n.datetimeFormats:Ys(r),c=Ve(n.numberFormats)?n.numberFormats:Ys(r),d=xt(Be(),n.modifiers,Hg()),u=n.pluralRules||Be(),f=Ke(n.missing)?n.missing:null,p=Ge(n.missingWarn)||Qr(n.missingWarn)?n.missingWarn:!0,h=Ge(n.fallbackWarn)||Qr(n.fallbackWarn)?n.fallbackWarn:!0,m=!!n.fallbackFormat,g=!!n.unresolving,y=Ke(n.postTranslation)?n.postTranslation:null,b=Ve(n.processor)?n.processor:null,z=Ge(n.warnHtmlMessage)?n.warnHtmlMessage:!0,w=!!n.escapeParameter,T=Ke(n.messageCompiler)?n.messageCompiler:Qc,A=Ke(n.messageResolver)?n.messageResolver:ed||Tg,M=Ke(n.localeFallbacker)?n.localeFallbacker:td||Vg,k=$e(n.fallbackContext)?n.fallbackContext:void 0,E=n,x=$e(E.__datetimeFormatters)?E.__datetimeFormatters:new Map,B=$e(E.__numberFormatters)?E.__numberFormatters:new Map,$=$e(E.__meta)?E.__meta:{};rd++;const O={version:t,cid:rd,locale:o,fallbackLocale:i,messages:a,modifiers:d,pluralRules:u,missing:f,missingWarn:p,fallbackWarn:h,fallbackFormat:m,unresolving:g,postTranslation:y,processor:b,warnHtmlMessage:z,escapeParameter:w,messageCompiler:T,messageResolver:A,localeFallbacker:M,fallbackContext:k,onWarn:e,__meta:$};return O.datetimeFormats=l,O.numberFormats=c,O.__datetimeFormatters=x,O.__numberFormatters=B,O}const Ys=n=>({[n]:Be()});function Qs(n,e,t,o,r){const{missing:i,onWarn:a}=n;if(i!==null){const l=i(n,t,e,r);return ke(l)?l:e}else return e}function nr(n,e,t){const o=n;o.__localeChainCache=new Map,n.localeFallbacker(n,t,e)}function Kg(n,e){return n===e?!1:n.split("-")[0]===e.split("-")[0]}function Jg(n,e){const t=e.indexOf(n);if(t===-1)return!1;for(let o=t+1;o<e.length;o++)if(Kg(n,e[o]))return!0;return!1}function Zs(n){return t=>Xg(t,n)}function Xg(n,e){const t=mg(e);if(t==null)throw tr(0);if(Ks(t)===1){const i=gg(t);return n.plural(i.reduce((a,l)=>[...a,id(n,l)],[]))}else return id(n,t)}function id(n,e){const t=yg(e);if(t!=null)return n.type==="text"?t:n.normalize([t]);{const o=bg(e).reduce((r,i)=>[...r,ea(n,i)],[]);return n.normalize(o)}}function ea(n,e){const t=Ks(e);switch(t){case 3:return ii(e,t);case 9:return ii(e,t);case 4:{const o=e;if(Zt(o,"k")&&o.k)return n.interpolate(n.named(o.k));if(Zt(o,"key")&&o.key)return n.interpolate(n.named(o.key));throw tr(t)}case 5:{const o=e;if(Zt(o,"i")&&it(o.i))return n.interpolate(n.list(o.i));if(Zt(o,"index")&&it(o.index))return n.interpolate(n.list(o.index));throw tr(t)}case 6:{const o=e,r=xg(o),i=kg(o);return n.linked(ea(n,i),r?ea(n,r):void 0,n.type)}case 7:return ii(e,t);case 8:return ii(e,t);default:throw new Error(`unhandled node on format message part: ${t}`)}}const sd=n=>n;let Io=Be();function ad(n,e={}){let t=!1;const o=e.onError||Um;return e.onError=r=>{t=!0,o(r)},{...pg(n,e),detectError:t}}const Yg=(n,e)=>{if(!ke(n))throw ln(tn.NOT_SUPPORT_NON_STRING_MESSAGE);{Ge(e.warnHtmlMessage)&&e.warnHtmlMessage;const o=(e.onCacheKey||sd)(n),r=Io[o];if(r)return r;const{code:i,detectError:a}=ad(n,e),l=new Function(`return ${i}`)();return a?l:Io[o]=l}};function Qg(n,e){if(__INTLIFY_JIT_COMPILATION__&&!__INTLIFY_DROP_MESSAGE_COMPILER__&&ke(n)){Ge(e.warnHtmlMessage)&&e.warnHtmlMessage;const o=(e.onCacheKey||sd)(n),r=Io[o];if(r)return r;const{ast:i,detectError:a}=ad(n,{...e,location:!1,jit:!0}),l=Zs(i);return a?l:Io[o]=l}else{const t=n.cacheKey;if(t){const o=Io[t];return o||(Io[t]=Zs(n))}else return Zs(n)}}const ld=()=>"",kn=n=>Ke(n);function cd(n,...e){const{fallbackFormat:t,postTranslation:o,unresolving:r,messageCompiler:i,fallbackLocale:a,messages:l}=n,[c,d]=ta(...e),u=Ge(d.missingWarn)?d.missingWarn:n.missingWarn,f=Ge(d.fallbackWarn)?d.fallbackWarn:n.fallbackWarn,p=Ge(d.escapeParameter)?d.escapeParameter:n.escapeParameter,h=!!d.resolvedMessage,m=ke(d.default)||Ge(d.default)?Ge(d.default)?i?c:()=>c:d.default:t?i?c:()=>c:"",g=t||m!=="",y=Js(n,d);p&&Zg(d);let[b,z,w]=h?[c,y,l[y]||Be()]:dd(n,c,y,a,f,u),T=b,A=c;if(!h&&!(ke(T)||an(T)||kn(T))&&g&&(T=m,A=T),!h&&(!(ke(T)||an(T)||kn(T))||!ke(z)))return r?si:c;let M=!1;const k=()=>{M=!0},E=kn(T)?T:ud(n,c,z,T,A,k);if(M)return T;const x=ny(n,z,w,d),B=Rg(x),$=ey(n,E,B);let O=o?o($,c):$;return p&&ke(O)&&(O=Om(O)),O}function Zg(n){ot(n.list)?n.list=n.list.map(e=>ke(e)?Cc(e):e):$e(n.named)&&Object.keys(n.named).forEach(e=>{ke(n.named[e])&&(n.named[e]=Cc(n.named[e]))})}function dd(n,e,t,o,r,i){const{messages:a,onWarn:l,messageResolver:c,localeFallbacker:d}=n,u=d(n,o,t);let f=Be(),p,h=null;const m="translate";for(let g=0;g<u.length&&(p=u[g],f=a[p]||Be(),(h=c(f,e))===null&&(h=f[e]),!(ke(h)||an(h)||kn(h)));g++)if(!Jg(p,u)){const y=Qs(n,e,p,i,m);y!==e&&(h=y)}return[h,p,f]}function ud(n,e,t,o,r,i){const{messageCompiler:a,warnHtmlMessage:l}=n;if(kn(o)){const d=o;return d.locale=d.locale||t,d.key=d.key||e,d}if(a==null){const d=(()=>o);return d.locale=t,d.key=e,d}const c=a(o,ty(n,t,r,o,l,i));return c.locale=t,c.key=e,c.source=o,c}function ey(n,e,t){return e(t)}function ta(...n){const[e,t,o]=n,r=Be();if(!ke(e)&&!it(e)&&!kn(e)&&!an(e))throw ln(tn.INVALID_ARGUMENT);const i=it(e)?String(e):(kn(e),e);return it(t)?r.plural=t:ke(t)?r.default=t:Ve(t)&&!Zr(t)?r.named=t:ot(t)&&(r.list=t),it(o)?r.plural=o:ke(o)?r.default=o:Ve(o)&&xt(r,o),[i,r]}function ty(n,e,t,o,r,i){return{locale:e,key:t,warnHtmlMessage:r,onError:a=>{throw i&&i(a),a},onCacheKey:a=>Mm(e,t,a)}}function ny(n,e,t,o){const{modifiers:r,pluralRules:i,messageResolver:a,fallbackLocale:l,fallbackWarn:c,missingWarn:d,fallbackContext:u}=n,p={locale:e,modifiers:r,pluralRules:i,messages:h=>{let m=a(t,h);if(m==null&&u){const[,,g]=dd(u,h,e,l,c,d);m=a(g,h)}if(ke(m)||an(m)){let g=!1;const b=ud(n,h,e,m,h,()=>{g=!0});return g?ld:b}else return kn(m)?m:ld}};return n.processor&&(p.processor=n.processor),o.list&&(p.list=o.list),o.named&&(p.named=o.named),it(o.plural)&&(p.pluralIndex=o.plural),p}function fd(n,...e){const{datetimeFormats:t,unresolving:o,fallbackLocale:r,onWarn:i,localeFallbacker:a}=n,{__datetimeFormatters:l}=n,[c,d,u,f]=na(...e),p=Ge(u.missingWarn)?u.missingWarn:n.missingWarn;Ge(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn;const h=!!u.part,m=Js(n,u),g=a(n,r,m);if(!ke(c)||c==="")return new Intl.DateTimeFormat(m,f).format(d);let y={},b,z=null;const w="datetime format";for(let M=0;M<g.length&&(b=g[M],y=t[b]||{},z=y[c],!Ve(z));M++)Qs(n,c,b,p,w);if(!Ve(z)||!ke(b))return o?si:c;let T=`${b}__${c}`;Zr(f)||(T=`${T}__${JSON.stringify(f)}`);let A=l.get(T);return A||(A=new Intl.DateTimeFormat(b,xt({},z,f)),l.set(T,A)),h?A.formatToParts(d):A.format(d)}const pd=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function na(...n){const[e,t,o,r]=n,i=Be();let a=Be(),l;if(ke(e)){const c=e.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!c)throw ln(tn.INVALID_ISO_DATE_ARGUMENT);const d=c[3]?c[3].trim().startsWith("T")?`${c[1].trim()}${c[3].trim()}`:`${c[1].trim()}T${c[3].trim()}`:c[1].trim();l=new Date(d);try{l.toISOString()}catch{throw ln(tn.INVALID_ISO_DATE_ARGUMENT)}}else if(Im(e)){if(isNaN(e.getTime()))throw ln(tn.INVALID_DATE_ARGUMENT);l=e}else if(it(e))l=e;else throw ln(tn.INVALID_ARGUMENT);return ke(t)?i.key=t:Ve(t)&&Object.keys(t).forEach(c=>{pd.includes(c)?a[c]=t[c]:i[c]=t[c]}),ke(o)?i.locale=o:Ve(o)&&(a=o),Ve(r)&&(a=r),[i.key||"",l,i,a]}function hd(n,e,t){const o=n;for(const r in t){const i=`${e}__${r}`;o.__datetimeFormatters.has(i)&&o.__datetimeFormatters.delete(i)}}function md(n,...e){const{numberFormats:t,unresolving:o,fallbackLocale:r,onWarn:i,localeFallbacker:a}=n,{__numberFormatters:l}=n,[c,d,u,f]=oa(...e),p=Ge(u.missingWarn)?u.missingWarn:n.missingWarn;Ge(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn;const h=!!u.part,m=Js(n,u),g=a(n,r,m);if(!ke(c)||c==="")return new Intl.NumberFormat(m,f).format(d);let y={},b,z=null;const w="number format";for(let M=0;M<g.length&&(b=g[M],y=t[b]||{},z=y[c],!Ve(z));M++)Qs(n,c,b,p,w);if(!Ve(z)||!ke(b))return o?si:c;let T=`${b}__${c}`;Zr(f)||(T=`${T}__${JSON.stringify(f)}`);let A=l.get(T);return A||(A=new Intl.NumberFormat(b,xt({},z,f)),l.set(T,A)),h?A.formatToParts(d):A.format(d)}const gd=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function oa(...n){const[e,t,o,r]=n,i=Be();let a=Be();if(!it(e))throw ln(tn.INVALID_ARGUMENT);const l=e;return ke(t)?i.key=t:Ve(t)&&Object.keys(t).forEach(c=>{gd.includes(c)?a[c]=t[c]:i[c]=t[c]}),ke(o)?i.locale=o:Ve(o)&&(a=o),Ve(r)&&(a=r),[i.key||"",l,i,a]}function yd(n,e,t){const o=n;for(const r in t){const i=`${e}__${r}`;o.__numberFormatters.has(i)&&o.__numberFormatters.delete(i)}}hg();const oy="9.14.5";function ry(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(ei().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(ei().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}const iy=$g.__EXTEND_POINT__,En=ti(iy);En(),En(),En(),En(),En(),En(),En(),En(),En();const bd=tn.__EXTEND_POINT__,Mt=ti(bd),wn={UNEXPECTED_RETURN_TYPE:bd,INVALID_ARGUMENT:Mt(),MUST_BE_CALL_SETUP_TOP:Mt(),NOT_INSTALLED:Mt(),NOT_AVAILABLE_IN_LEGACY_MODE:Mt(),REQUIRED_VALUE:Mt(),INVALID_VALUE:Mt(),CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:Mt(),NOT_INSTALLED_WITH_PROVIDE:Mt(),UNEXPECTED_ERROR:Mt(),NOT_COMPATIBLE_LEGACY_VUE_I18N:Mt(),BRIDGE_SUPPORT_VUE_2_ONLY:Mt(),MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION:Mt(),NOT_AVAILABLE_COMPOSITION_IN_LEGACY:Mt(),__EXTEND_POINT__:Mt()};function jn(n,...e){return zo(n,null,void 0)}const ra=$n("__translateVNode"),ia=$n("__datetimeParts"),sa=$n("__numberParts"),sy=$n("__setPluralRules"),ay=$n("__injectWithOption"),aa=$n("__dispose");function or(n){if(!$e(n)||an(n))return n;for(const e in n)if(Zt(n,e))if(!e.includes("."))$e(n[e])&&or(n[e]);else{const t=e.split("."),o=t.length-1;let r=n,i=!1;for(let a=0;a<o;a++){if(t[a]==="__proto__")throw new Error(`unsafe key: ${t[a]}`);if(t[a]in r||(r[t[a]]=Be()),!$e(r[t[a]])){i=!0;break}r=r[t[a]]}if(i||(an(r)?Hc.includes(t[o])||delete n[e]:(r[t[o]]=n[e],delete n[e])),!an(r)){const a=r[t[o]];$e(a)&&or(a)}}return n}function xd(n,e){const{messages:t,__i18n:o,messageResolver:r,flatJson:i}=e,a=Ve(t)?t:ot(o)?Be():{[n]:Be()};if(ot(o)&&o.forEach(l=>{if("locale"in l&&"resource"in l){const{locale:c,resource:d}=l;c?(a[c]=a[c]||Be(),oi(d,a[c])):oi(d,a)}else ke(l)&&oi(JSON.parse(l),a)}),r==null&&i)for(const l in a)Zt(a,l)&&or(a[l]);return a}function kd(n){return n.type}function ly(n,e,t){let o=$e(e.messages)?e.messages:Be();"__i18nGlobal"in t&&(o=xd(n.locale.value,{messages:o,__i18n:t.__i18nGlobal}));const r=Object.keys(o);r.length&&r.forEach(i=>{n.mergeLocaleMessage(i,o[i])});{if($e(e.datetimeFormats)){const i=Object.keys(e.datetimeFormats);i.length&&i.forEach(a=>{n.mergeDateTimeFormat(a,e.datetimeFormats[a])})}if($e(e.numberFormats)){const i=Object.keys(e.numberFormats);i.length&&i.forEach(a=>{n.mergeNumberFormat(a,e.numberFormats[a])})}}}function Ed(n){return s.createVNode(s.Text,null,n,0)}const wd="__INTLIFY_META__",Sd=()=>[],cy=()=>!1;let Cd=0;function Nd(n){return((e,t,o,r)=>n(t,o,s.getCurrentInstance()||void 0,r))}const pA=()=>{const n=s.getCurrentInstance();let e=null;return n&&(e=kd(n)[wd])?{[wd]:e}:null};function vd(n={},e){const{__root:t,__injectWithOption:o}=n,r=t===void 0,i=n.flatJson,a=wc?s.ref:s.shallowRef,l=!!n.translateExistCompatible;let c=Ge(n.inheritLocale)?n.inheritLocale:!0;const d=a(t&&c?t.locale.value:ke(n.locale)?n.locale:ai),u=a(t&&c?t.fallbackLocale.value:ke(n.fallbackLocale)||ot(n.fallbackLocale)||Ve(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:d.value),f=a(xd(d.value,n)),p=a(Ve(n.datetimeFormats)?n.datetimeFormats:{[d.value]:{}}),h=a(Ve(n.numberFormats)?n.numberFormats:{[d.value]:{}});let m=t?t.missingWarn:Ge(n.missingWarn)||Qr(n.missingWarn)?n.missingWarn:!0,g=t?t.fallbackWarn:Ge(n.fallbackWarn)||Qr(n.fallbackWarn)?n.fallbackWarn:!0,y=t?t.fallbackRoot:Ge(n.fallbackRoot)?n.fallbackRoot:!0,b=!!n.fallbackFormat,z=Ke(n.missing)?n.missing:null,w=Ke(n.missing)?Nd(n.missing):null,T=Ke(n.postTranslation)?n.postTranslation:null,A=t?t.warnHtmlMessage:Ge(n.warnHtmlMessage)?n.warnHtmlMessage:!0,M=!!n.escapeParameter;const k=t?t.modifiers:Ve(n.modifiers)?n.modifiers:{};let E=n.pluralRules||t&&t.pluralRules,x;x=(()=>{r&&od(null);const U={version:oy,locale:d.value,fallbackLocale:u.value,messages:f.value,modifiers:k,pluralRules:E,missing:w===null?void 0:w,missingWarn:m,fallbackWarn:g,fallbackFormat:b,unresolving:!0,postTranslation:T===null?void 0:T,warnHtmlMessage:A,escapeParameter:M,messageResolver:n.messageResolver,messageCompiler:n.messageCompiler,__meta:{framework:"vue"}};U.datetimeFormats=p.value,U.numberFormats=h.value,U.__datetimeFormatters=Ve(x)?x.__datetimeFormatters:void 0,U.__numberFormatters=Ve(x)?x.__numberFormatters:void 0;const Q=Gg(U);return r&&od(Q),Q})(),nr(x,d.value,u.value);function $(){return[d.value,u.value,f.value,p.value,h.value]}const O=s.computed({get:()=>d.value,set:U=>{d.value=U,x.locale=d.value}}),D=s.computed({get:()=>u.value,set:U=>{u.value=U,x.fallbackLocale=u.value,nr(x,d.value,U)}}),P=s.computed(()=>f.value),q=s.computed(()=>p.value),W=s.computed(()=>h.value);function R(){return Ke(T)?T:null}function K(U){T=U,x.postTranslation=U}function X(){return z}function te(U){U!==null&&(w=Nd(U)),z=U,x.missing=w}const oe=(U,Q,ve,Le,dt,Tt)=>{$();let Lt;try{r||(x.fallbackContext=t?qg():void 0),Lt=U(x)}finally{r||(x.fallbackContext=void 0)}if(ve!=="translate exists"&&it(Lt)&&Lt===si||ve==="translate exists"&&!Lt){const[$t,Xt]=Q();return t&&y?Le(t):dt($t)}else{if(Tt(Lt))return Lt;throw jn(wn.UNEXPECTED_RETURN_TYPE)}};function G(...U){return oe(Q=>Reflect.apply(cd,null,[Q,...U]),()=>ta(...U),"translate",Q=>Reflect.apply(Q.t,Q,[...U]),Q=>Q,Q=>ke(Q))}function Z(...U){const[Q,ve,Le]=U;if(Le&&!$e(Le))throw jn(wn.INVALID_ARGUMENT);return G(Q,ve,xt({resolvedMessage:!0},Le||{}))}function Y(...U){return oe(Q=>Reflect.apply(fd,null,[Q,...U]),()=>na(...U),"datetime format",Q=>Reflect.apply(Q.d,Q,[...U]),()=>Xc,Q=>ke(Q))}function ee(...U){return oe(Q=>Reflect.apply(md,null,[Q,...U]),()=>oa(...U),"number format",Q=>Reflect.apply(Q.n,Q,[...U]),()=>Xc,Q=>ke(Q))}function le(U){return U.map(Q=>ke(Q)||it(Q)||Ge(Q)?Ed(String(Q)):Q)}const Ne={normalize:le,interpolate:U=>U,type:"vnode"};function Re(...U){return oe(Q=>{let ve;const Le=Q;try{Le.processor=Ne,ve=Reflect.apply(cd,null,[Le,...U])}finally{Le.processor=null}return ve},()=>ta(...U),"translate",Q=>Q[ra](...U),Q=>[Ed(Q)],Q=>ot(Q))}function C(...U){return oe(Q=>Reflect.apply(md,null,[Q,...U]),()=>oa(...U),"number format",Q=>Q[sa](...U),Sd,Q=>ke(Q)||ot(Q))}function L(...U){return oe(Q=>Reflect.apply(fd,null,[Q,...U]),()=>na(...U),"datetime format",Q=>Q[ia](...U),Sd,Q=>ke(Q)||ot(Q))}function V(U){E=U,x.pluralRules=E}function S(U,Q){return oe(()=>{if(!U)return!1;const ve=ke(Q)?Q:d.value,Le=ne(ve),dt=x.messageResolver(Le,U);return l?dt!=null:an(dt)||kn(dt)||ke(dt)},()=>[U],"translate exists",ve=>Reflect.apply(ve.te,ve,[U,Q]),cy,ve=>Ge(ve))}function N(U){let Q=null;const ve=Kc(x,u.value,d.value);for(let Le=0;Le<ve.length;Le++){const dt=f.value[ve[Le]]||{},Tt=x.messageResolver(dt,U);if(Tt!=null){Q=Tt;break}}return Q}function F(U){const Q=N(U);return Q??(t?t.tm(U)||{}:{})}function ne(U){return f.value[U]||{}}function me(U,Q){if(i){const ve={[U]:Q};for(const Le in ve)Zt(ve,Le)&&or(ve[Le]);Q=ve[U]}f.value[U]=Q,x.messages=f.value}function De(U,Q){f.value[U]=f.value[U]||{};const ve={[U]:Q};if(i)for(const Le in ve)Zt(ve,Le)&&or(ve[Le]);Q=ve[U],oi(Q,f.value[U]),x.messages=f.value}function Te(U){return p.value[U]||{}}function v(U,Q){p.value[U]=Q,x.datetimeFormats=p.value,hd(x,U,Q)}function I(U,Q){p.value[U]=xt(p.value[U]||{},Q),x.datetimeFormats=p.value,hd(x,U,Q)}function J(U){return h.value[U]||{}}function he(U,Q){h.value[U]=Q,x.numberFormats=h.value,yd(x,U,Q)}function Ae(U,Q){h.value[U]=xt(h.value[U]||{},Q),x.numberFormats=h.value,yd(x,U,Q)}Cd++,t&&wc&&(s.watch(t.locale,U=>{c&&(d.value=U,x.locale=U,nr(x,d.value,u.value))}),s.watch(t.fallbackLocale,U=>{c&&(u.value=U,x.fallbackLocale=U,nr(x,d.value,u.value))}));const ye={id:Cd,locale:O,fallbackLocale:D,get inheritLocale(){return c},set inheritLocale(U){c=U,U&&t&&(d.value=t.locale.value,u.value=t.fallbackLocale.value,nr(x,d.value,u.value))},get availableLocales(){return Object.keys(f.value).sort()},messages:P,get modifiers(){return k},get pluralRules(){return E||{}},get isGlobal(){return r},get missingWarn(){return m},set missingWarn(U){m=U,x.missingWarn=m},get fallbackWarn(){return g},set fallbackWarn(U){g=U,x.fallbackWarn=g},get fallbackRoot(){return y},set fallbackRoot(U){y=U},get fallbackFormat(){return b},set fallbackFormat(U){b=U,x.fallbackFormat=b},get warnHtmlMessage(){return A},set warnHtmlMessage(U){A=U,x.warnHtmlMessage=U},get escapeParameter(){return M},set escapeParameter(U){M=U,x.escapeParameter=U},t:G,getLocaleMessage:ne,setLocaleMessage:me,mergeLocaleMessage:De,getPostTranslationHandler:R,setPostTranslationHandler:K,getMissingHandler:X,setMissingHandler:te,[sy]:V};return ye.datetimeFormats=q,ye.numberFormats=W,ye.rt=Z,ye.te=S,ye.tm=F,ye.d=Y,ye.n=ee,ye.getDateTimeFormat=Te,ye.setDateTimeFormat=v,ye.mergeDateTimeFormat=I,ye.getNumberFormat=J,ye.setNumberFormat=he,ye.mergeNumberFormat=Ae,ye[ay]=o,ye[ra]=Re,ye[ia]=L,ye[sa]=C,ye}const la={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:n=>n==="parent"||n==="global",default:"parent"},i18n:{type:Object}};function dy({slots:n},e){return e.length===1&&e[0]==="default"?(n.default?n.default():[]).reduce((o,r)=>[...o,...r.type===s.Fragment?r.children:[r]],[]):e.reduce((t,o)=>{const r=n[o];return r&&(t[o]=r()),t},Be())}function Td(n){return s.Fragment}xt({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:n=>it(n)||!isNaN(n)}},la);function uy(n){return ot(n)&&!ke(n[0])}function zd(n,e,t,o){const{slots:r,attrs:i}=e;return()=>{const a={part:!0};let l=Be();n.locale&&(a.locale=n.locale),ke(n.format)?a.key=n.format:$e(n.format)&&(ke(n.format.key)&&(a.key=n.format.key),l=Object.keys(n.format).reduce((p,h)=>t.includes(h)?xt(Be(),p,{[h]:n.format[h]}):p,Be()));const c=o(n.value,a,l);let d=[a.key];ot(c)?d=c.map((p,h)=>{const m=r[p.type],g=m?m({[p.type]:p.value,index:h,parts:c}):[p.value];return uy(g)&&(g[0].key=`${p.type}-${h}`),g}):ke(c)&&(d=[c]);const u=xt(Be(),i),f=ke(n.tag)||$e(n.tag)?n.tag:Td();return s.h(f,u,d)}}xt({value:{type:Number,required:!0},format:{type:[String,Object]}},la),xt({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},la);const fy=$n("global-vue-i18n");function py(n={},e){const t=Ge(n.globalInjection)?n.globalInjection:!0,o=!0,r=new Map,[i,a]=hy(n),l=$n("");function c(f){return r.get(f)||null}function d(f,p){r.set(f,p)}function u(f){r.delete(f)}{const f={get mode(){return"composition"},get allowComposition(){return o},async install(p,...h){if(p.__VUE_I18N_SYMBOL__=l,p.provide(p.__VUE_I18N_SYMBOL__,f),Ve(h[0])){const y=h[0];f.__composerExtend=y.__composerExtend,f.__vueI18nExtend=y.__vueI18nExtend}let m=null;t&&(m=wy(p,f.global));const g=p.unmount;p.unmount=()=>{m&&m(),f.dispose(),g()}},get global(){return a},dispose(){i.stop()},__instances:r,__getInstance:c,__setInstance:d,__deleteInstance:u};return f}}function Vt(n={}){const e=s.getCurrentInstance();if(e==null)throw jn(wn.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw jn(wn.NOT_INSTALLED);const t=my(e),o=yy(t),r=kd(e),i=gy(n,r);if(i==="global")return ly(o,n,r),o;if(i==="parent"){let c=by(t,e,n.__useComponent);return c==null&&(c=o),c}const a=t;let l=a.__getInstance(e);if(l==null){const c=xt({},n);"__i18n"in r&&(c.__i18n=r.__i18n),o&&(c.__root=o),l=vd(c),a.__composerExtend&&(l[aa]=a.__composerExtend(l)),ky(a,e,l),a.__setInstance(e,l)}return l}function hy(n,e,t){const o=s.effectScope();{const r=o.run(()=>vd(n));if(r==null)throw jn(wn.UNEXPECTED_ERROR);return[o,r]}}function my(n){{const e=s.inject(n.isCE?fy:n.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw jn(n.isCE?wn.NOT_INSTALLED_WITH_PROVIDE:wn.UNEXPECTED_ERROR);return e}}function gy(n,e){return Zr(n)?"__i18n"in e?"local":"global":n.useScope?n.useScope:"local"}function yy(n){return n.mode==="composition"?n.global:n.global.__composer}function by(n,e,t=!1){let o=null;const r=e.root;let i=xy(e,t);for(;i!=null;){const a=n;if(n.mode==="composition"&&(o=a.__getInstance(i)),o!=null||r===i)break;i=i.parent}return o}function xy(n,e=!1){return n==null?null:e&&n.vnode.ctx||n.parent}function ky(n,e,t){s.onMounted(()=>{},e),s.onUnmounted(()=>{const o=t;n.__deleteInstance(e);const r=o[aa];r&&(r(),delete o[aa])},e)}const Ey=["locale","fallbackLocale","availableLocales"],Md=["t","rt","d","n","tm","te"];function wy(n,e){const t=Object.create(null);return Ey.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i)throw jn(wn.UNEXPECTED_ERROR);const a=s.isRef(i.value)?{get(){return i.value.value},set(l){i.value.value=l}}:{get(){return i.get&&i.get()}};Object.defineProperty(t,r,a)}),n.config.globalProperties.$i18n=t,Md.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i||!i.value)throw jn(wn.UNEXPECTED_ERROR);Object.defineProperty(n.config.globalProperties,`$${r}`,i)}),()=>{delete n.config.globalProperties.$i18n,Md.forEach(r=>{delete n.config.globalProperties[`$${r}`]})}}ry(),__INTLIFY_JIT_COMPILATION__?Zc(Qg):Zc(Yg),Ug(zg),Wg(Kc);function ca(){if(typeof window<"u"&&typeof DOMParser<"u")return DOMParser;if(typeof require<"u")try{const{JSDOM:n}=require("jsdom");return new n().window.DOMParser}catch{throw new Error("jsdom is required for server-side rendering. Please install it: npm install jsdom")}if(typeof DOMParser<"u")return DOMParser;throw new Error("DOMParser is not available in this environment")}function Sy(n){const e=window;e.__zcmsShadowRoots||(e.__zcmsShadowRoots=new Map);const t=`script-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return e.__zcmsShadowRoots.set(t,n),`
|
|
2
4
|
(function() {
|
|
3
|
-
const scriptId = '${
|
|
5
|
+
const scriptId = '${t}'
|
|
4
6
|
const shadowRoot = window.__zcmsShadowRoots?.get(scriptId)
|
|
5
7
|
if (!shadowRoot || !(shadowRoot instanceof ShadowRoot)) {
|
|
6
8
|
return
|
|
@@ -334,30 +336,24 @@
|
|
|
334
336
|
}
|
|
335
337
|
})
|
|
336
338
|
})()
|
|
337
|
-
`}function Mo(t,e=!1){const n=t,o=t.querySelector("script[data-zcode-shadow-extension]");if(o)if(e){if(n.__zcmsEventListeners){const i=n.__zcmsEventListeners;i.forEach(function(s){s.forEach(function(l){t.removeEventListener(l.eventName,l.handler,!0)})}),i.clear()}o.remove(),n.__zcmsJQueryExtended&&delete n.__zcmsJQueryExtended,n.__zcmsNativeAPIExtended&&delete n.__zcmsNativeAPIExtended}else return;const r=document.createElement("script");r.setAttribute("data-zcode-shadow-extension","true"),r.textContent=lg(t),t.insertBefore(r,t.firstChild)}function cg(){if(typeof window>"u")return 20;try{let t=document.querySelector(".zcode-toolbar");if(!t){const n=document.querySelectorAll("zcode-cms, zcode-editor");for(const o of Array.from(n)){const r=o.shadowRoot;if(r){const i=r.querySelector(".zcode-toolbar");if(i){t=i;break}}}}if(!t)return 20;const e=t.getBoundingClientRect();return e.height>0?e.height:20}catch(t){return console.warn("Failed to get toolbar height:",t),20}}function ar(t,e=0){if(!(typeof window>"u"||!t))try{const n=t.getBoundingClientRect(),o=window.pageYOffset||document.documentElement.scrollTop,r=cg(),i=n.top+o-r-e;window.scrollTo({top:Math.max(0,i),behavior:"smooth"})}catch(n){console.warn("Failed to scroll to element:",n);try{const o=t.getBoundingClientRect(),r=window.pageYOffset||document.documentElement.scrollTop,i=o.top+r-20;window.scrollTo({top:Math.max(0,i),behavior:"smooth"})}catch(o){console.error("Scroll fallback also failed:",o)}}}const{entries:jc,setPrototypeOf:Uc,isFrozen:dg,getPrototypeOf:ug,getOwnPropertyDescriptor:fg}=Object;let{freeze:wt,seal:Ft,create:ia}=Object,{apply:sa,construct:aa}=typeof Reflect<"u"&&Reflect;wt||(wt=function(e){return e}),Ft||(Ft=function(e){return e}),sa||(sa=function(e,n){for(var o=arguments.length,r=new Array(o>2?o-2:0),i=2;i<o;i++)r[i-2]=arguments[i];return e.apply(n,r)}),aa||(aa=function(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return new e(...o)});const ai=Nt(Array.prototype.forEach),pg=Nt(Array.prototype.lastIndexOf),Hc=Nt(Array.prototype.pop),lr=Nt(Array.prototype.push),hg=Nt(Array.prototype.splice),li=Nt(String.prototype.toLowerCase),la=Nt(String.prototype.toString),ca=Nt(String.prototype.match),cr=Nt(String.prototype.replace),mg=Nt(String.prototype.indexOf),gg=Nt(String.prototype.trim),tn=Nt(Object.prototype.hasOwnProperty),St=Nt(RegExp.prototype.test),dr=bg(TypeError);function Nt(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return sa(t,e,o)}}function bg(t){return function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return aa(t,n)}}function De(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:li;Uc&&Uc(t,null);let o=e.length;for(;o--;){let r=e[o];if(typeof r=="string"){const i=n(r);i!==r&&(dg(e)||(e[o]=i),r=i)}t[r]=!0}return t}function yg(t){for(let e=0;e<t.length;e++)tn(t,e)||(t[e]=null);return t}function cn(t){const e=ia(null);for(const[n,o]of jc(t))tn(t,n)&&(Array.isArray(o)?e[n]=yg(o):o&&typeof o=="object"&&o.constructor===Object?e[n]=cn(o):e[n]=o);return e}function ur(t,e){for(;t!==null;){const o=fg(t,e);if(o){if(o.get)return Nt(o.get);if(typeof o.value=="function")return Nt(o.value)}t=ug(t)}function n(){return null}return n}const Wc=wt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),da=wt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ua=wt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),xg=wt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),fa=wt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Eg=wt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Gc=wt(["#text"]),qc=wt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),pa=wt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Kc=wt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ci=wt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),kg=Ft(/\{\{[\w\W]*|[\w\W]*\}\}/gm),wg=Ft(/<%[\w\W]*|[\w\W]*%>/gm),Sg=Ft(/\$\{[\w\W]*/gm),Ng=Ft(/^data-[\-\w.\u00B7-\uFFFF]+$/),Cg=Ft(/^aria-[\-\w]+$/),Jc=Ft(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),vg=Ft(/^(?:\w+script|data):/i),Tg=Ft(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Xc=Ft(/^html$/i),zg=Ft(/^[a-z][.\w]*(-[.\w]+)+$/i);var Yc=Object.freeze({__proto__:null,ARIA_ATTR:Cg,ATTR_WHITESPACE:Tg,CUSTOM_ELEMENT:zg,DATA_ATTR:Ng,DOCTYPE_NAME:Xc,ERB_EXPR:wg,IS_ALLOWED_URI:Jc,IS_SCRIPT_OR_DATA:vg,MUSTACHE_EXPR:kg,TMPLIT_EXPR:Sg});const fr={element:1,text:3,progressingInstruction:7,comment:8,document:9},_g=function(){return typeof window>"u"?null:window},Ag=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let o=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(o=n.getAttribute(r));const i="dompurify"+(o?"#"+o:"");try{return e.createPolicy(i,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Qc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Zc(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_g();const e=xe=>Zc(xe);if(e.version="3.3.1",e.removed=[],!t||!t.document||t.document.nodeType!==fr.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const o=n,r=o.currentScript,{DocumentFragment:i,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:h}=t,m=c.prototype,b=ur(m,"cloneNode"),g=ur(m,"remove"),x=ur(m,"nextSibling"),v=ur(m,"childNodes"),w=ur(m,"parentNode");if(typeof s=="function"){const xe=n.createElement("template");xe.content&&xe.content.ownerDocument&&(n=xe.content.ownerDocument)}let T,M="";const{implementation:A,createNodeIterator:y,createDocumentFragment:E,getElementsByTagName:S}=n,{importNode:D}=o;let W=Qc();e.isSupported=typeof jc=="function"&&typeof w=="function"&&A&&A.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:z,ERB_EXPR:P,TMPLIT_EXPR:V,DATA_ATTR:j,ARIA_ATTR:L,IS_SCRIPT_OR_DATA:H,ATTR_WHITESPACE:Q,CUSTOM_ELEMENT:G}=Yc;let{IS_ALLOWED_URI:se}=Yc,Z=null;const X=De({},[...Wc,...da,...ua,...fa,...Gc]);let J=null;const K=De({},[...qc,...pa,...Kc,...ci]);let Y=Object.seal(ia(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ce=null,Ee=null;const _e=Object.seal(ia(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Le=!0,C=!0,N=!1,O=!0,k=!1,U=!0,te=!1,me=!1,ve=!1,Ve=!1,Ce=!1,_=!1,I=!0,q=!1;const fe="user-content-";let Ae=!0,Te=!1,we={},B=null;const ee=De({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Me=null;const $=De({},["audio","video","img","source","image","track"]);let F=null;const re=De({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ae="http://www.w3.org/1998/Math/MathML",ke="http://www.w3.org/2000/svg",Fe="http://www.w3.org/1999/xhtml";let st=Fe,xn=!1,oi=null;const Tc=De({},[ae,ke,Fe],la);let Zo=De({},["mi","mo","mn","ms","mtext"]),er=De({},["annotation-xml"]);const zc=De({},["title","style","font","a","script"]);let Pn=null;const ri=["application/xhtml+xml","text/html"],Ln="text/html";let Ze=null,En=null;const Xs=n.createElement("form"),Ys=function(R){return R instanceof RegExp||R instanceof Function},tr=function(){let R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(En&&En===R)){if((!R||typeof R!="object")&&(R={}),R=cn(R),Pn=ri.indexOf(R.PARSER_MEDIA_TYPE)===-1?Ln:R.PARSER_MEDIA_TYPE,Ze=Pn==="application/xhtml+xml"?la:li,Z=tn(R,"ALLOWED_TAGS")?De({},R.ALLOWED_TAGS,Ze):X,J=tn(R,"ALLOWED_ATTR")?De({},R.ALLOWED_ATTR,Ze):K,oi=tn(R,"ALLOWED_NAMESPACES")?De({},R.ALLOWED_NAMESPACES,la):Tc,F=tn(R,"ADD_URI_SAFE_ATTR")?De(cn(re),R.ADD_URI_SAFE_ATTR,Ze):re,Me=tn(R,"ADD_DATA_URI_TAGS")?De(cn($),R.ADD_DATA_URI_TAGS,Ze):$,B=tn(R,"FORBID_CONTENTS")?De({},R.FORBID_CONTENTS,Ze):ee,ce=tn(R,"FORBID_TAGS")?De({},R.FORBID_TAGS,Ze):cn({}),Ee=tn(R,"FORBID_ATTR")?De({},R.FORBID_ATTR,Ze):cn({}),we=tn(R,"USE_PROFILES")?R.USE_PROFILES:!1,Le=R.ALLOW_ARIA_ATTR!==!1,C=R.ALLOW_DATA_ATTR!==!1,N=R.ALLOW_UNKNOWN_PROTOCOLS||!1,O=R.ALLOW_SELF_CLOSE_IN_ATTR!==!1,k=R.SAFE_FOR_TEMPLATES||!1,U=R.SAFE_FOR_XML!==!1,te=R.WHOLE_DOCUMENT||!1,Ve=R.RETURN_DOM||!1,Ce=R.RETURN_DOM_FRAGMENT||!1,_=R.RETURN_TRUSTED_TYPE||!1,ve=R.FORCE_BODY||!1,I=R.SANITIZE_DOM!==!1,q=R.SANITIZE_NAMED_PROPS||!1,Ae=R.KEEP_CONTENT!==!1,Te=R.IN_PLACE||!1,se=R.ALLOWED_URI_REGEXP||Jc,st=R.NAMESPACE||Fe,Zo=R.MATHML_TEXT_INTEGRATION_POINTS||Zo,er=R.HTML_INTEGRATION_POINTS||er,Y=R.CUSTOM_ELEMENT_HANDLING||{},R.CUSTOM_ELEMENT_HANDLING&&Ys(R.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Y.tagNameCheck=R.CUSTOM_ELEMENT_HANDLING.tagNameCheck),R.CUSTOM_ELEMENT_HANDLING&&Ys(R.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Y.attributeNameCheck=R.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),R.CUSTOM_ELEMENT_HANDLING&&typeof R.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Y.allowCustomizedBuiltInElements=R.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),k&&(C=!1),Ce&&(Ve=!0),we&&(Z=De({},Gc),J=[],we.html===!0&&(De(Z,Wc),De(J,qc)),we.svg===!0&&(De(Z,da),De(J,pa),De(J,ci)),we.svgFilters===!0&&(De(Z,ua),De(J,pa),De(J,ci)),we.mathMl===!0&&(De(Z,fa),De(J,Kc),De(J,ci))),R.ADD_TAGS&&(typeof R.ADD_TAGS=="function"?_e.tagCheck=R.ADD_TAGS:(Z===X&&(Z=cn(Z)),De(Z,R.ADD_TAGS,Ze))),R.ADD_ATTR&&(typeof R.ADD_ATTR=="function"?_e.attributeCheck=R.ADD_ATTR:(J===K&&(J=cn(J)),De(J,R.ADD_ATTR,Ze))),R.ADD_URI_SAFE_ATTR&&De(F,R.ADD_URI_SAFE_ATTR,Ze),R.FORBID_CONTENTS&&(B===ee&&(B=cn(B)),De(B,R.FORBID_CONTENTS,Ze)),R.ADD_FORBID_CONTENTS&&(B===ee&&(B=cn(B)),De(B,R.ADD_FORBID_CONTENTS,Ze)),Ae&&(Z["#text"]=!0),te&&De(Z,["html","head","body"]),Z.table&&(De(Z,["tbody"]),delete ce.tbody),R.TRUSTED_TYPES_POLICY){if(typeof R.TRUSTED_TYPES_POLICY.createHTML!="function")throw dr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof R.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw dr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=R.TRUSTED_TYPES_POLICY,M=T.createHTML("")}else T===void 0&&(T=Ag(h,r)),T!==null&&typeof M=="string"&&(M=T.createHTML(""));wt&&wt(R),En=R}},Qs=De({},[...da,...ua,...xg]),Zs=De({},[...fa,...Eg]),ea=function(R){let ie=w(R);(!ie||!ie.tagName)&&(ie={namespaceURI:st,tagName:"template"});const ge=li(R.tagName),Xe=li(ie.tagName);return oi[R.namespaceURI]?R.namespaceURI===ke?ie.namespaceURI===Fe?ge==="svg":ie.namespaceURI===ae?ge==="svg"&&(Xe==="annotation-xml"||Zo[Xe]):!!Qs[ge]:R.namespaceURI===ae?ie.namespaceURI===Fe?ge==="math":ie.namespaceURI===ke?ge==="math"&&er[Xe]:!!Zs[ge]:R.namespaceURI===Fe?ie.namespaceURI===ke&&!er[Xe]||ie.namespaceURI===ae&&!Zo[Xe]?!1:!Zs[ge]&&(zc[ge]||!Qs[ge]):!!(Pn==="application/xhtml+xml"&&oi[R.namespaceURI]):!1},Zt=function(R){lr(e.removed,{element:R});try{w(R).removeChild(R)}catch{g(R)}},kn=function(R,ie){try{lr(e.removed,{attribute:ie.getAttributeNode(R),from:ie})}catch{lr(e.removed,{attribute:null,from:ie})}if(ie.removeAttribute(R),R==="is")if(Ve||Ce)try{Zt(ie)}catch{}else try{ie.setAttribute(R,"")}catch{}},ta=function(R){let ie=null,ge=null;if(ve)R="<remove></remove>"+R;else{const rt=ca(R,/^[\r\n\t ]+/);ge=rt&&rt[0]}Pn==="application/xhtml+xml"&&st===Fe&&(R='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+R+"</body></html>");const Xe=T?T.createHTML(R):R;if(st===Fe)try{ie=new p().parseFromString(Xe,Pn)}catch{}if(!ie||!ie.documentElement){ie=A.createDocument(st,"template",null);try{ie.documentElement.innerHTML=xn?M:Xe}catch{}}const kt=ie.body||ie.documentElement;return R&&ge&&kt.insertBefore(n.createTextNode(ge),kt.childNodes[0]||null),st===Fe?S.call(ie,te?"html":"body")[0]:te?ie.documentElement:kt},ii=function(R){return y.call(R.ownerDocument||R,R,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},le=function(R){return R instanceof f&&(typeof R.nodeName!="string"||typeof R.textContent!="string"||typeof R.removeChild!="function"||!(R.attributes instanceof u)||typeof R.removeAttribute!="function"||typeof R.setAttribute!="function"||typeof R.namespaceURI!="string"||typeof R.insertBefore!="function"||typeof R.hasChildNodes!="function")},de=function(R){return typeof l=="function"&&R instanceof l};function be(xe,R,ie){ai(xe,ge=>{ge.call(e,R,ie,En)})}const Ge=function(R){let ie=null;if(be(W.beforeSanitizeElements,R,null),le(R))return Zt(R),!0;const ge=Ze(R.nodeName);if(be(W.uponSanitizeElement,R,{tagName:ge,allowedTags:Z}),U&&R.hasChildNodes()&&!de(R.firstElementChild)&&St(/<[/\w!]/g,R.innerHTML)&&St(/<[/\w!]/g,R.textContent)||R.nodeType===fr.progressingInstruction||U&&R.nodeType===fr.comment&&St(/<[/\w]/g,R.data))return Zt(R),!0;if(!(_e.tagCheck instanceof Function&&_e.tagCheck(ge))&&(!Z[ge]||ce[ge])){if(!ce[ge]&&At(ge)&&(Y.tagNameCheck instanceof RegExp&&St(Y.tagNameCheck,ge)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(ge)))return!1;if(Ae&&!B[ge]){const Xe=w(R)||R.parentNode,kt=v(R)||R.childNodes;if(kt&&Xe){const rt=kt.length;for(let Lt=rt-1;Lt>=0;--Lt){const $n=b(kt[Lt],!0);$n.__removalCount=(R.__removalCount||0)+1,Xe.insertBefore($n,x(R))}}}return Zt(R),!0}return R instanceof c&&!ea(R)||(ge==="noscript"||ge==="noembed"||ge==="noframes")&&St(/<\/no(script|embed|frames)/i,R.innerHTML)?(Zt(R),!0):(k&&R.nodeType===fr.text&&(ie=R.textContent,ai([z,P,V],Xe=>{ie=cr(ie,Xe," ")}),R.textContent!==ie&&(lr(e.removed,{element:R.cloneNode()}),R.textContent=ie)),be(W.afterSanitizeElements,R,null),!1)},et=function(R,ie,ge){if(I&&(ie==="id"||ie==="name")&&(ge in n||ge in Xs))return!1;if(!(C&&!Ee[ie]&&St(j,ie))){if(!(Le&&St(L,ie))){if(!(_e.attributeCheck instanceof Function&&_e.attributeCheck(ie,R))){if(!J[ie]||Ee[ie]){if(!(At(R)&&(Y.tagNameCheck instanceof RegExp&&St(Y.tagNameCheck,R)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(R))&&(Y.attributeNameCheck instanceof RegExp&&St(Y.attributeNameCheck,ie)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(ie,R))||ie==="is"&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&St(Y.tagNameCheck,ge)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(ge))))return!1}else if(!F[ie]){if(!St(se,cr(ge,Q,""))){if(!((ie==="src"||ie==="xlink:href"||ie==="href")&&R!=="script"&&mg(ge,"data:")===0&&Me[R])){if(!(N&&!St(H,cr(ge,Q,"")))){if(ge)return!1}}}}}}}return!0},At=function(R){return R!=="annotation-xml"&&ca(R,G)},Lm=function(R){be(W.beforeSanitizeAttributes,R,null);const{attributes:ie}=R;if(!ie||le(R))return;const ge={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:J,forceKeepAttr:void 0};let Xe=ie.length;for(;Xe--;){const kt=ie[Xe],{name:rt,namespaceURI:Lt,value:$n}=kt,nr=Ze(rt),_c=$n;let bt=rt==="value"?_c:gg(_c);if(ge.attrName=nr,ge.attrValue=bt,ge.keepAttr=!0,ge.forceKeepAttr=void 0,be(W.uponSanitizeAttribute,R,ge),bt=ge.attrValue,q&&(nr==="id"||nr==="name")&&(kn(rt,R),bt=fe+bt),U&&St(/((--!?|])>)|<\/(style|title|textarea)/i,bt)){kn(rt,R);continue}if(nr==="attributename"&&ca(bt,"href")){kn(rt,R);continue}if(ge.forceKeepAttr)continue;if(!ge.keepAttr){kn(rt,R);continue}if(!O&&St(/\/>/i,bt)){kn(rt,R);continue}k&&ai([z,P,V],Vm=>{bt=cr(bt,Vm," ")});const $m=Ze(R.nodeName);if(!et($m,nr,bt)){kn(rt,R);continue}if(T&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!Lt)switch(h.getAttributeType($m,nr)){case"TrustedHTML":{bt=T.createHTML(bt);break}case"TrustedScriptURL":{bt=T.createScriptURL(bt);break}}if(bt!==_c)try{Lt?R.setAttributeNS(Lt,rt,bt):R.setAttribute(rt,bt),le(R)?Zt(R):Hc(e.removed)}catch{kn(rt,R)}}be(W.afterSanitizeAttributes,R,null)},bM=function xe(R){let ie=null;const ge=ii(R);for(be(W.beforeSanitizeShadowDOM,R,null);ie=ge.nextNode();)be(W.uponSanitizeShadowNode,ie,null),Ge(ie),Lm(ie),ie.content instanceof i&&xe(ie.content);be(W.afterSanitizeShadowDOM,R,null)};return e.sanitize=function(xe){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ie=null,ge=null,Xe=null,kt=null;if(xn=!xe,xn&&(xe="<!-->"),typeof xe!="string"&&!de(xe))if(typeof xe.toString=="function"){if(xe=xe.toString(),typeof xe!="string")throw dr("dirty is not a string, aborting")}else throw dr("toString is not a function");if(!e.isSupported)return xe;if(me||tr(R),e.removed=[],typeof xe=="string"&&(Te=!1),Te){if(xe.nodeName){const $n=Ze(xe.nodeName);if(!Z[$n]||ce[$n])throw dr("root node is forbidden and cannot be sanitized in-place")}}else if(xe instanceof l)ie=ta("<!---->"),ge=ie.ownerDocument.importNode(xe,!0),ge.nodeType===fr.element&&ge.nodeName==="BODY"||ge.nodeName==="HTML"?ie=ge:ie.appendChild(ge);else{if(!Ve&&!k&&!te&&xe.indexOf("<")===-1)return T&&_?T.createHTML(xe):xe;if(ie=ta(xe),!ie)return Ve?null:_?M:""}ie&&ve&&Zt(ie.firstChild);const rt=ii(Te?xe:ie);for(;Xe=rt.nextNode();)Ge(Xe),Lm(Xe),Xe.content instanceof i&&bM(Xe.content);if(Te)return xe;if(Ve){if(Ce)for(kt=E.call(ie.ownerDocument);ie.firstChild;)kt.appendChild(ie.firstChild);else kt=ie;return(J.shadowroot||J.shadowrootmode)&&(kt=D.call(o,kt,!0)),kt}let Lt=te?ie.outerHTML:ie.innerHTML;return te&&Z["!doctype"]&&ie.ownerDocument&&ie.ownerDocument.doctype&&ie.ownerDocument.doctype.name&&St(Xc,ie.ownerDocument.doctype.name)&&(Lt="<!DOCTYPE "+ie.ownerDocument.doctype.name+`>
|
|
338
|
-
`+Lt),k&&ai([z,P,V],$n=>{Lt=cr(Lt,$n," ")}),T&&_?T.createHTML(Lt):Lt},e.setConfig=function(){let xe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};tr(xe),me=!0},e.clearConfig=function(){En=null,me=!1},e.isValidAttribute=function(xe,R,ie){En||tr({});const ge=Ze(xe),Xe=Ze(R);return et(ge,Xe,ie)},e.addHook=function(xe,R){typeof R=="function"&&lr(W[xe],R)},e.removeHook=function(xe,R){if(R!==void 0){const ie=pg(W[xe],R);return ie===-1?void 0:hg(W[xe],ie,1)[0]}return Hc(W[xe])},e.removeHooks=function(xe){W[xe]=[]},e.removeAllHooks=function(){W=Qc()},e}var Mg=Zc();function ed(t){return Mg.sanitize(t,{ALLOWED_TAGS:["p","br","strong","em","s","u","ul","ol","li","a","hr"],ALLOWED_ATTR:["href","target","rel"],ALLOW_DATA_ATTR:!1,FORBID_TAGS:["script","iframe","object","embed","form","input","button","style"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur"]})}function it(t){return typeof t!="string"?"":t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function Ct(t){if(!t||typeof t!="string")return"";const e=t.trim(),n=e.toLowerCase();return n.startsWith("javascript:")||n.startsWith("vbscript:")||n.startsWith("file:")?"":n.startsWith("data:")?n.startsWith("data:image/")?e:"":e}const pe={TEXT_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):([^}]+)\}/g,TEXT_FIELD:/\{\$(\w+):([^}]+)\}/g,RICH_TEXT_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):rich(?::[^}]+)?\}/g,RICH_TEXT_FIELD:/\{\$(\w+):(.+?):rich(?::[^}]+)?\}/g,TEXTAREA_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):textarea(?::[^}]+)?\}/g,TEXTAREA_FIELD:/\{\$(\w+):(.+?):textarea(?::[^}]+)?\}/g,IMAGE_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):image(?::[^}]+)?\}/g,IMAGE_FIELD:/\{\$(\w+):(.+?):image(?::[^}]+)?\}/g,SELECT_FIELD_WITH_GROUP:/\(\$(\w+)\.(\w+)@:([^)]+)\)/g,SELECT_FIELD:/\(\$(\w+)@:([^)]+)\)/g,RADIO_CHECKBOX_FIELD_WITH_GROUP:/\(\$(\w+)\.(\w+):([^)]+)\)/g,RADIO_FIELD:/\(\$(\w+):([^)]+)\)/g,BACKEND_DATA:/\{@([\w.[\]]+)\}/g};function Ig(t){const e={};for(const n of t){if(n==="required"){e.required=!0;continue}if(n==="readonly"){e.readonly=!0;continue}if(n==="disabled"){e.disabled=!0;continue}if(n.startsWith("max=")){const o=Number(n.slice(4));Number.isFinite(o)&&(e.maxLength=o)}}return e}function ze(t){const e=t.split(":"),n=[],o=r=>r==="required"||r==="readonly"||r==="disabled"||/^max=\d+$/.test(r);for(;e.length>0&&o(e[e.length-1]);)n.unshift(e.pop());return{defaultValue:e.join(":"),validation:Ig(n)}}function Fn(t){const e=[],n=new Set,o=ra(),s=new o().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template");if(!s)return e;const l=d=>{if(d.nodeType===Node.TEXT_NODE){const u=d.textContent||"",f=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(u.matchAll(f)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]){const U=k[1],te=k[2];if(!n.has(U)){const{defaultValue:me,validation:ve}=ze(k[3]);e.push({fieldName:U,groupName:te,type:"rich",defaultValue:me,optional:!0,...ve}),n.add(U)}}});const h=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(u.matchAll(h)).forEach(k=>{if(k&&k[1]&&k[2]){const U=k[1];if(!n.has(U)){const{defaultValue:te,validation:me}=ze(k[2]);e.push({fieldName:U,type:"rich",defaultValue:te,optional:!0,...me}),n.add(U)}}});const b=new RegExp(pe.RICH_TEXT_FIELD_WITH_GROUP.source,pe.RICH_TEXT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(b)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]){const U=k[1],te=k[2];if(!n.has(U)){const{defaultValue:me,validation:ve}=ze(k[3]);e.push({fieldName:U,groupName:te,type:"rich",defaultValue:me,...ve}),n.add(U)}}});const x=new RegExp(pe.RICH_TEXT_FIELD.source,pe.RICH_TEXT_FIELD.flags);Array.from(u.matchAll(x)).forEach(k=>{if(k&&k[1]&&k[2]){const U=k[1];if(!n.has(U)){const{defaultValue:te,validation:me}=ze(k[2]);e.push({fieldName:U,type:"rich",defaultValue:te,...me}),n.add(U)}}});const w=/\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/g;Array.from(u.matchAll(w)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"textarea",defaultValue:U,optional:!0,...te}),n.add(k[1])}});const M=/\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/g;Array.from(u.matchAll(M)).forEach(k=>{if(k&&k[1]&&k[2]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[2]);e.push({fieldName:k[1],type:"textarea",defaultValue:U,optional:!0,...te}),n.add(k[1])}});const y=new RegExp(pe.TEXTAREA_FIELD_WITH_GROUP.source,pe.TEXTAREA_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(y)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"textarea",defaultValue:U,...te}),n.add(k[1])}});const S=new RegExp(pe.TEXTAREA_FIELD.source,pe.TEXTAREA_FIELD.flags);Array.from(u.matchAll(S)).forEach(k=>{if(k&&k[1]&&k[2]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[2]);e.push({fieldName:k[1],type:"textarea",defaultValue:U,...te}),n.add(k[1])}});const W=/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(u.matchAll(W)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"image",defaultValue:U,optional:!0,...te}),n.add(k[1])}});const P=/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(u.matchAll(P)).forEach(k=>{if(k&&k[1]&&k[2]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[2]);e.push({fieldName:k[1],type:"image",defaultValue:U,optional:!0,...te}),n.add(k[1])}});const j=new RegExp(pe.IMAGE_FIELD_WITH_GROUP.source,pe.IMAGE_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(j)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"image",defaultValue:U,...te}),n.add(k[1])}});const H=new RegExp(pe.IMAGE_FIELD.source,pe.IMAGE_FIELD.flags);Array.from(u.matchAll(H)).forEach(k=>{if(k&&k[1]&&k[2]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[2]);e.push({fieldName:k[1],type:"image",defaultValue:U,...te}),n.add(k[1])}});const G=/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g;Array.from(u.matchAll(G)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"text",defaultValue:U,optional:!0,...te}),n.add(k[1])}});const Z=/\{\$(\w+)\?:([^}]+)\}/g;Array.from(u.matchAll(Z)).forEach(k=>{if(k&&k[0]&&!/:rich(?::[^}]*)?\}$/.test(k[0])&&!/:image(?::[^}]*)?\}$/.test(k[0])&&!/:textarea(?::[^}]*)?\}$/.test(k[0])&&!k[0].includes(".")&&k[1]&&k[2]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[2]);e.push({fieldName:k[1],type:"text",defaultValue:U,optional:!0,...te}),n.add(k[1])}});const J=new RegExp(pe.TEXT_FIELD_WITH_GROUP.source,pe.TEXT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(J)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"text",defaultValue:U,...te}),n.add(k[1])}});const Y=new RegExp(pe.TEXT_FIELD.source,pe.TEXT_FIELD.flags);Array.from(u.matchAll(Y)).forEach(k=>{if(k&&k[0]&&!/:rich(?::[^}]*)?\}$/.test(k[0])&&!/:image(?::[^}]*)?\}$/.test(k[0])&&!/:textarea(?::[^}]*)?\}$/.test(k[0])&&!k[0].includes(".")&&k[1]&&k[2]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[2]);e.push({fieldName:k[1],type:"text",defaultValue:U,...te}),n.add(k[1])}});const Ee=new RegExp(pe.SELECT_FIELD_WITH_GROUP.source,pe.SELECT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(Ee)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const U=k[1],te=k[2],me=k[3];me.includes("|")?e.push({fieldName:U,groupName:te,type:"select",options:me.split("|")}):me.includes(",")&&e.push({fieldName:U,groupName:te,type:"select-multiple",options:me.split(",")}),n.add(U)}}),(u.match(pe.SELECT_FIELD)||[]).forEach(k=>{const U=k.match(/\(\$(\w+)@:([^)]+)\)/);if(U&&!n.has(U[1])){const te=U[1],me=U[2];me.includes("|")?e.push({fieldName:te,type:"select",options:me.split("|")}):me.includes(",")&&e.push({fieldName:te,type:"select-multiple",options:me.split(",")}),n.add(te)}});const C=new RegExp(pe.RADIO_CHECKBOX_FIELD_WITH_GROUP.source,pe.RADIO_CHECKBOX_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(C)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const U=k[1],te=k[2],me=k[3];me.includes("|")?e.push({fieldName:U,groupName:te,type:"radio",options:me.split("|")}):me.includes(",")&&e.push({fieldName:U,groupName:te,type:"checkbox",options:me.split(",")}),n.add(U)}}),(u.match(pe.RADIO_FIELD)||[]).forEach(k=>{const U=k.match(/\(\$(\w+):([^)]+)\)/);if(U&&!n.has(U[1])){const te=U[1],me=U[2];me.includes("|")?e.push({fieldName:te,type:"radio",options:me.split("|")}):me.includes(",")&&e.push({fieldName:te,type:"checkbox",options:me.split(",")}),n.add(te)}});return}else if(d.nodeType===Node.ELEMENT_NODE){const u=d,f=u.getAttribute("z-if");f&&!n.has(f)&&(e.push({fieldName:f,type:"boolean",defaultValue:"true"}),n.add(f));const p=u.getAttribute("z-tag");if(p){const m=p.match(/^\$(\w+)(?::(.+))?$/);if(m){const b=m[1],g=m[2];if(!n.has(b)){const x=g?g.split("|").map(T=>T.trim()):void 0,v=u.tagName.toLowerCase();let w=v;x&&!x.includes(v)&&(typeof process<"u"&&process.env?.NODE_ENV==="development"&&console.warn(`[ZeroCode] z-tag="${p}": 現在のタグ名 "${v}" が選択肢に含まれていません。デフォルト値として "${x[0]}" を使用します。`),w=x[0]),e.push({fieldName:b,type:"tag",defaultValue:w,options:x,optional:!1}),n.add(b)}}}Array.from(u.attributes).forEach(m=>{const b=m.value,g=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(b.matchAll(g)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"rich",defaultValue:N,optional:!0,...O}),n.add(C[1])}});const v=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(b.matchAll(v)).forEach(C=>{if(C&&C[1]&&C[2]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[2]);e.push({fieldName:C[1],type:"rich",defaultValue:N,optional:!0,...O}),n.add(C[1])}});const T=new RegExp(pe.RICH_TEXT_FIELD_WITH_GROUP.source,pe.RICH_TEXT_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(T)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"rich",defaultValue:N,...O}),n.add(C[1])}});const A=new RegExp(pe.RICH_TEXT_FIELD.source,pe.RICH_TEXT_FIELD.flags);Array.from(b.matchAll(A)).forEach(C=>{if(C&&C[1]&&C[2]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[2]);e.push({fieldName:C[1],type:"rich",defaultValue:N,...O}),n.add(C[1])}});const E=/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(b.matchAll(E)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"image",defaultValue:N,optional:!0,...O}),n.add(C[1])}});const D=/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(b.matchAll(D)).forEach(C=>{if(C&&C[1]&&C[2]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[2]);e.push({fieldName:C[1],type:"image",defaultValue:N,optional:!0,...O}),n.add(C[1])}});const z=new RegExp(pe.IMAGE_FIELD_WITH_GROUP.source,pe.IMAGE_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(z)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"image",defaultValue:N,...O}),n.add(C[1])}});const V=new RegExp(pe.IMAGE_FIELD.source,pe.IMAGE_FIELD.flags);Array.from(b.matchAll(V)).forEach(C=>{if(C&&C[1]&&C[2]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[2]);e.push({fieldName:C[1],type:"image",defaultValue:N,...O}),n.add(C[1])}});const L=/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g;Array.from(b.matchAll(L)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"text",defaultValue:N,optional:!0,...O}),n.add(C[1])}});const Q=/\{\$(\w+)\?:([^}]+)\}/g;Array.from(b.matchAll(Q)).forEach(C=>{if(C&&C[0]&&!/:rich(?::[^}]*)?\}$/.test(C[0])&&!/:image(?::[^}]*)?\}$/.test(C[0])&&!/:textarea(?::[^}]*)?\}$/.test(C[0])&&!C[0].includes(".")&&C[1]&&C[2]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[2]);e.push({fieldName:C[1],type:"text",defaultValue:N,optional:!0,...O}),n.add(C[1])}});const se=new RegExp(pe.TEXT_FIELD_WITH_GROUP.source,pe.TEXT_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(se)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"text",defaultValue:N,...O}),n.add(C[1])}});const X=new RegExp(pe.TEXT_FIELD.source,pe.TEXT_FIELD.flags);Array.from(b.matchAll(X)).forEach(C=>{if(C&&C[0]&&!/:rich(?::[^}]*)?\}$/.test(C[0])&&!/:image(?::[^}]*)?\}$/.test(C[0])&&!/:textarea(?::[^}]*)?\}$/.test(C[0])&&!C[0].includes(".")&&C[1]&&C[2]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[2]);e.push({fieldName:C[1],type:"text",defaultValue:N,...O}),n.add(C[1])}});const K=new RegExp(pe.SELECT_FIELD_WITH_GROUP.source,pe.SELECT_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(K)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const N=C[1],O=C[2],k=C[3];k.includes("|")?e.push({fieldName:N,groupName:O,type:"select",options:k.split("|")}):k.includes(",")&&e.push({fieldName:N,groupName:O,type:"select-multiple",options:k.split(",")}),n.add(N)}}),(b.match(pe.SELECT_FIELD)||[]).forEach(C=>{const N=C.match(/\(\$(\w+)@:([^)]+)\)/);if(N&&!n.has(N[1])){const O=N[1],k=N[2];k.includes("|")?e.push({fieldName:O,type:"select",options:k.split("|")}):k.includes(",")&&e.push({fieldName:O,type:"select-multiple",options:k.split(",")}),n.add(O)}});const Ee=new RegExp(pe.RADIO_CHECKBOX_FIELD_WITH_GROUP.source,pe.RADIO_CHECKBOX_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(Ee)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const N=C[1],O=C[2],k=C[3];k.includes("|")?e.push({fieldName:N,groupName:O,type:"radio",options:k.split("|")}):k.includes(",")&&e.push({fieldName:N,groupName:O,type:"checkbox",options:k.split(",")}),n.add(N)}}),(b.match(pe.RADIO_FIELD)||[]).forEach(C=>{const N=C.match(/\(\$(\w+):([^)]+)\)/);if(N&&!n.has(N[1])){const O=N[1],k=N[2];k.includes("|")?e.push({fieldName:O,type:"radio",options:k.split("|")}):k.includes(",")&&e.push({fieldName:O,type:"checkbox",options:k.split(",")}),n.add(O)}})}),Array.from(d.childNodes).forEach(m=>l(m));return}else if(d.nodeType===Node.DOCUMENT_FRAGMENT_NODE){Array.from(d.childNodes).forEach(f=>l(f));return}};return Array.from(s.content.childNodes).forEach(d=>l(d)),e}function td(t,e){const n=ra(),i=new n().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template");if(!i||!i.content.firstElementChild)return console.warn("Failed to parse HTML:",t),t;const s=i.content.firstElementChild;return Object.entries(e).forEach(([l,c])=>{s.setAttribute(l,c)}),s.outerHTML}function di(t,e,n,o,r=[]){const i=[...n,...o,...r];if(t){const s=i.find(l=>l.id===t);if(s)return s.url}if(e){const s=i.find(l=>l.id===e);if(s)return console.warn(`Image not found: ${t}, using default: ${e}`),s.url}return console.warn(`Image not found: ${t}, default: ${e}`),""}function Og(t){return typeof t=="object"&&t!==null}function nd(t,e){if(!t||!e)return"";try{const n=[];let o="";for(let i=0;i<e.length;i++){const s=e[i];s==="["||s==="]"||s==="."?o&&(n.push(o),o=""):o+=s}o&&n.push(o);let r=t;for(let i=0;i<n.length;i++){const s=n[i];if(s.match(/^\d+$/)){const l=parseInt(s,10);if(Array.isArray(r)&&l>=0&&l<r.length)r=r[l];else return""}else if(Og(r)&&s in r)r=r[s];else return""}return r==null?"":String(r)}catch(n){return console.warn(`[ZeroCode] Failed to resolve backend data path: ${e}`,n),""}}function Dg(t,e){return!t||!e?t:t.replace(/\{(\w+)\}/g,(n,o)=>{const r=e[o];return r==null?n:String(r)})}function ui(t,e,n,o,r,i=!0,s=[],l=[],c=[],d){const u=ra(),f=new u,p=f.parseFromString(`<template>${t}</template>`,"text/html"),h=p.querySelector("template");if(!h||!h.content)return console.error("Failed to parse template HTML"),t;const m=y=>{if(y.nodeType===Node.TEXT_NODE){let E=y.textContent||"";d&&(E=E.replace(pe.BACKEND_DATA,(Z,X)=>nd(d,X)));let D=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(E),W=!1;if(D&&y.parentNode?W=!0:D=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(E),D&&y.parentNode){const Z=D[1],X=W?D[3]:D[2],{defaultValue:J}=ze(X),K=e[Z];if(typeof K=="boolean"){const N=y.parentNode,O=D.index||0,k=E.substring(0,O),U=E.substring(O+D[0].length);k&&N.insertBefore(p.createTextNode(k),y),U&&N.insertBefore(p.createTextNode(U),y),y.parentNode&&y.parentNode.removeChild(y);return}let Y=K===void 0?"":typeof K=="string"?K:String(K||J);i||(Y=ed(Y));const ce=y.parentNode,Ee=D.index||0,_e=E.substring(0,Ee),Le=E.substring(Ee+D[0].length);Y?Y.trim().startsWith("<p")||(Y=`<p>${Y}</p>`):Y="";const C=p.createElement("div");C.innerHTML=Y,_e&&ce.insertBefore(p.createTextNode(_e),y),Array.from(C.childNodes).forEach(N=>{ce.insertBefore(N.cloneNode(!0),y)}),Le&&ce.insertBefore(p.createTextNode(Le),y),y.parentNode&&y.parentNode.removeChild(y);return}let P=new RegExp(pe.RICH_TEXT_FIELD_WITH_GROUP.source,pe.RICH_TEXT_FIELD_WITH_GROUP.flags).exec(E),V=!1;if(P&&y.parentNode?V=!0:P=new RegExp(pe.RICH_TEXT_FIELD.source,pe.RICH_TEXT_FIELD.flags).exec(E),P&&y.parentNode){const Z=P[1],X=V?P[3]:P[2],J=e[Z];let K=J===void 0?"":typeof J=="string"?J:String(J||X);i||(K=ed(K));const Y=y.parentNode,ce=P.index||0,Ee=E.substring(0,ce),_e=E.substring(ce+P[0].length);K?K.trim().startsWith("<p")||(K=`<p>${K}</p>`):K="<p></p>";const Le=p.createElement("div");Le.innerHTML=K,Ee&&Y.insertBefore(p.createTextNode(Ee),y),Array.from(Le.childNodes).forEach(C=>{Y.insertBefore(C.cloneNode(!0),y)}),_e&&Y.insertBefore(p.createTextNode(_e),y),y.parentNode&&y.parentNode.removeChild(y);return}let L=/\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(E),H=!1;if(L&&y.parentNode?H=!0:L=/\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(E),L&&y.parentNode){const Z=L[1],X=H?L[3]:L[2],{defaultValue:J}=ze(X),K=e[Z],Y=K===void 0?"":String(K||J),ce=y.parentNode,Ee=L.index||0,_e=E.substring(0,Ee),Le=E.substring(Ee+L[0].length);_e&&ce.insertBefore(p.createTextNode(_e),y);const C=Y.split(`
|
|
339
|
-
`);if(
|
|
340
|
-
`);if(Le.forEach((C,N)=>{C&&Y.insertBefore(p.createTextNode(C),y),N<Le.length-1&&Y.insertBefore(p.createElement("br"),y)}),_e){const C=p.createTextNode(_e);Y.insertBefore(C,y),m(C)}y.parentNode&&y.parentNode.removeChild(y);return}E=E.replace(/\{\$(\w+)\?:([^}]+)\}/g,(Z,X,J)=>{if(/:textarea(?::[^}]*)?$/.test(Z))return Z;const K=e[X];if(K===void 0||typeof K=="boolean")return"";const{defaultValue:Y}=ze(J);return String(K||Y)}),E=E.replace(/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,(Z,X,J,K)=>{if(/:textarea(?::[^}]*)?$/.test(Z))return Z;const Y=e[X];if(Y===void 0||typeof Y=="boolean")return"";const{defaultValue:ce}=ze(K);return String(Y||ce)}),E=E.replace(pe.TEXT_FIELD_WITH_GROUP,(Z,X,J,K)=>{const Y=e[X];if(Y===void 0)return"";const{defaultValue:ce}=ze(K);return String(Y||ce)}),E=E.replace(pe.TEXT_FIELD,(Z,X,J)=>{const K=e[X];if(K===void 0)return"";const{defaultValue:Y}=ze(J);return String(K||Y)}),y.textContent=E}else if(y.nodeType===Node.ELEMENT_NODE){const E=y,S=[];Array.from(E.attributes).forEach(D=>{const W=D.value;let z=D.value;const P=D.name.toLowerCase();if(P==="z-if"||P==="z-for"||P==="z-slot"||P==="z-empty"||P==="z-tag"||P.startsWith("data-zcode-"))return;const V=/^\{\$[\w.]+?\?:[^}]+\}(?::(rich|image|textarea))?$/.test(W.trim());d&&((P==="href"||P==="src"||P==="action")&&(z=Dg(z,d)),z=z.replace(pe.BACKEND_DATA,(j,L)=>{const H=nd(d,L);return P==="href"||P==="src"||P==="action"?Ct(H):it(H)})),z=z.replace(/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,(j,L,H)=>{const Q=e[L];if(Q===void 0||typeof Q=="boolean")return"";const{defaultValue:G}=ze(H);return it(String(Q||G))}),z=z.replace(/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,(j,L,H,Q)=>{const G=e[L];if(G===void 0||typeof G=="boolean")return"";const{defaultValue:se}=ze(Q);return it(String(G||se))}),z=z.replace(/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g,(j,L,H)=>{const Q=e[L];if(Q===void 0)return"";const{defaultValue:G}=ze(H),se=typeof Q=="string"?Q:String(Q||G),Z=di(se,G,s,l,c),X=typeof Z=="string"?Z:String(Z||G);return P==="href"||P==="src"?Ct(X):it(X)}),z=z.replace(/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g,(j,L,H,Q)=>{const G=e[L];if(G===void 0)return"";const{defaultValue:se}=ze(Q),Z=typeof G=="string"?G:String(G||se),X=di(Z,se,s,l,c),J=typeof X=="string"?X:String(X||se);return P==="href"||P==="src"?Ct(J):it(J)}),z=z.replace(pe.RICH_TEXT_FIELD_WITH_GROUP,(j,L,H,Q)=>{const G=e[L];return G===void 0?"":it(String(G||Q))}),z=z.replace(pe.RICH_TEXT_FIELD,(j,L,H)=>{const Q=e[L];return Q===void 0?"":it(String(Q||H))}),z=z.replace(pe.IMAGE_FIELD_WITH_GROUP,(j,L,H,Q)=>{const G=e[L];if(G===void 0)return"";const se=di(G||Q,Q,s,l,c);return P==="href"||P==="src"?Ct(se||Q):it(se||Q)}),z=z.replace(pe.IMAGE_FIELD,(j,L,H)=>{const Q=e[L];if(Q===void 0)return"";const G=di(Q||H,H,s,l,c);return P==="href"||P==="src"?Ct(G||H):it(G||H)}),z=z.replace(/\{\$(\w+)\?:([^}]+)\}/g,(j,L,H)=>{const Q=e[L];if(Q===void 0||typeof Q=="boolean")return"";const{defaultValue:G}=ze(H),se=String(Q||G);return P==="href"||P==="src"||P==="action"?Ct(se):it(se)}),z=z.replace(/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,(j,L,H,Q)=>{const G=e[L];if(G===void 0||typeof G=="boolean")return"";const{defaultValue:se}=ze(Q),Z=String(G||se);return P==="href"||P==="src"||P==="action"?Ct(Z):it(Z)}),z=z.replace(pe.TEXT_FIELD_WITH_GROUP,(j,L,H,Q)=>{const G=e[L];if(G===void 0)return"";const{defaultValue:se}=ze(Q),Z=String(G||se);return P==="href"||P==="src"||P==="action"?Ct(Z):it(Z)}),z=z.replace(pe.TEXT_FIELD,(j,L,H)=>{const Q=e[L];if(Q===void 0)return"";const{defaultValue:G}=ze(H),se=String(Q||G);return P==="href"||P==="src"||P==="action"?Ct(se):it(se)}),V&&z.trim()===""?S.push(D.name):D.value=z}),S.forEach(D=>{E.removeAttribute(D)})}Array.from(y.childNodes).forEach(E=>m(E))};m(h.content);const b=y=>{if(y.nodeType===Node.TEXT_NODE){let E=y.textContent||"";E=E.replace(pe.SELECT_FIELD_WITH_GROUP,(S,D,W,z)=>{if(z.includes("|"))return e[D]||z.split("|")[0];if(z.includes(",")){const P=e[D],V=Array.isArray(P)?P:[],j=z.split(",");return V.filter(L=>typeof L=="string"&&j.includes(L)).join(" ")}return e[D]||z}),E=E.replace(pe.SELECT_FIELD,(S,D,W)=>{if(W.includes("|")){const P=e[D];return typeof P=="string"?P:W.split("|")[0]}else if(W.includes(",")){const P=e[D],V=Array.isArray(P)?P:[],j=W.split(",");return V.filter(L=>typeof L=="string"&&j.includes(L)).join(" ")}const z=e[D];return typeof z=="string"?z:W}),E=E.replace(pe.RADIO_CHECKBOX_FIELD_WITH_GROUP,(S,D,W,z)=>{if(z.includes("|")){const V=e[D];return typeof V=="string"?V:z.split("|")[0]}else if(z.includes(",")){const V=e[D],j=Array.isArray(V)?V:[],L=z.split(",");return j.filter(H=>typeof H=="string"&&L.includes(H)).join(" ")}const P=e[D];return typeof P=="string"?P:z}),E=E.replace(pe.RADIO_FIELD,(S,D,W)=>{if(W.includes("|")){const P=e[D];return typeof P=="string"?P:W.split("|")[0]}else if(W.includes(",")){const P=e[D],V=Array.isArray(P)?P:[],j=W.split(",");return V.filter(L=>typeof L=="string"&&j.includes(L)).join(" ")}const z=e[D];return typeof z=="string"?z:W}),y.textContent=E}else y.nodeType===Node.ELEMENT_NODE&&Array.from(y.attributes).forEach(S=>{let D=S.value;const W=S.name.toLowerCase();D=D.replace(pe.SELECT_FIELD_WITH_GROUP,(z,P,V,j)=>{let L;if(j.includes("|"))L=e[P]||j.split("|")[0];else if(j.includes(",")){const H=e[P],Q=Array.isArray(H)?H:[],G=j.split(",");L=Q.filter(se=>typeof se=="string"&&G.includes(se)).join(" ")}else{const H=e[P];L=typeof H=="string"?H:j}return W==="href"||W==="src"||W==="action"?Ct(String(L)):it(String(L))}),D=D.replace(pe.SELECT_FIELD,(z,P,V)=>{let j;if(V.includes("|"))j=e[P]||V.split("|")[0];else if(V.includes(",")){const L=e[P],H=Array.isArray(L)?L:[],Q=V.split(",");j=H.filter(G=>typeof G=="string"&&Q.includes(G)).join(" ")}else{const L=e[P];j=typeof L=="string"?L:V}return W==="href"||W==="src"||W==="action"?Ct(String(j)):it(String(j))}),D=D.replace(pe.RADIO_CHECKBOX_FIELD_WITH_GROUP,(z,P,V,j)=>{let L;if(j.includes("|"))L=e[P]||j.split("|")[0];else if(j.includes(",")){const H=e[P],Q=Array.isArray(H)?H:[],G=j.split(",");L=Q.filter(se=>typeof se=="string"&&G.includes(se)).join(" ")}else{const H=e[P];L=typeof H=="string"?H:j}return W==="href"||W==="src"||W==="action"?Ct(String(L)):it(String(L))}),D=D.replace(pe.RADIO_FIELD,(z,P,V)=>{let j;if(V.includes("|"))j=e[P]||V.split("|")[0];else if(V.includes(",")){const L=e[P],H=Array.isArray(L)?L:[],Q=V.split(",");j=H.filter(G=>typeof G=="string"&&Q.includes(G)).join(" ")}else{const L=e[P];j=typeof L=="string"?L:V}return W==="href"||W==="src"||W==="action"?Ct(String(j)):it(String(j))}),S.value=D});y.childNodes.forEach(E=>b(E))};b(h.content),h.content.querySelectorAll("[z-if]").forEach(y=>{const E=y.getAttribute("z-if");E?(e[E]!==void 0?e[E]:!0)?y.removeAttribute("z-if"):y.remove():y.removeAttribute("z-if")}),h.content.querySelectorAll("[z-tag]").forEach(y=>{const E=y.getAttribute("z-tag");if(E){const S=E.match(/^\$(\w+)(?::(.+))?$/);if(S){const D=S[1],W=e[D],z=typeof W=="string"?W:y.tagName.toLowerCase(),P=["h1","h2","h3","h4","h5","h6","div","p","span","li","ul","ol","section","article","aside","nav","header","footer","main","figure","figcaption","blockquote","pre","code","table","thead","tbody","tr","th","td"],V=typeof z=="string"?z.toLowerCase():z;if(typeof V=="string"&&P.includes(V)){const j=p.createElement(V);Array.from(y.attributes).forEach(L=>{L.name!=="z-tag"&&j.setAttribute(L.name,L.value)}),Array.from(y.childNodes).forEach(L=>{j.appendChild(L.cloneNode(!0))}),y.parentNode?.replaceChild(j,y)}}}}),h.content.querySelectorAll("[z-empty]").forEach(y=>{const E=y.getAttribute("z-empty");if(E){const S=E.match(/^\$(\w+)$/);if(S){const D=S[1],W=e[D];(P=>{if(P==null||P==="")return!0;if(typeof P=="string"){const V=P.trim();if(V===""||V==="<p></p>"||V==="<p> </p>"||/^<p>\s*<\/p>$/i.test(V)||/^<p>\s*<br\s*\/?>\s*<\/p>$/i.test(V))return!0}return!1})(W)?y.remove():y.removeAttribute("z-empty")}else y.removeAttribute("z-empty")}else y.removeAttribute("z-empty")});const w=()=>{Array.from(h.content.querySelectorAll("[z-for]")).forEach(E=>{const S=E.getAttribute("z-for");if(!S){E.removeAttribute("z-for");return}const D=S.match(/^(\w+)\s+in\s+(.+)$/);if(!D){console.warn(`[ZeroCode] Invalid z-for syntax: ${S}`),E.removeAttribute("z-for");return}const[,W,z]=D;if(!z.startsWith("{@")||!z.endsWith("}")){console.warn(`[ZeroCode] z-for only supports backend data: ${z}`),E.removeAttribute("z-for");return}const P=z.slice(2,-1);if(!d){E.remove();return}let V;try{const L=P.split(".");let H=d;for(const Q of L)if(H&&typeof H=="object"&&Q in H)H=H[Q];else{H=null;break}V=H}catch(L){console.warn(`[ZeroCode] Failed to resolve data source: ${P}`,L),E.remove();return}if(!Array.isArray(V)||V.length===0){E.remove();return}const j=document.createDocumentFragment();V.forEach(L=>{const H=E.cloneNode(!0);H.removeAttribute("z-for"),T(H,W,L,e,d),j.appendChild(H)}),E.parentNode&&E.parentNode.replaceChild(j,E)})},T=(y,E,S,D,W,z)=>{const P=j=>{if(j.nodeType===Node.TEXT_NODE){let L=j.textContent||"";const H=new RegExp(`\\{${E}\\.([\\w\\.\\[\\]]+)\\}`,"g");L=L.replace(H,(Q,G)=>{try{const se=G.split(/[.[\]]/).filter(X=>X);let Z=S;for(const X of se)if(X.match(/^\d+$/)){const J=parseInt(X,10);if(Array.isArray(Z)&&J>=0&&J<Z.length)Z=Z[J];else return""}else if(Z&&typeof Z=="object"&&X in Z)Z=Z[X];else return"";return Z==null?"":String(Z)}catch{return""}}),L=L.replace(new RegExp(`\\{${E}\\}`,"g"),()=>typeof S=="object"&&S!==null?JSON.stringify(S):String(S)),j.textContent=L}else if(j.nodeType===Node.ELEMENT_NODE){const L=j;Array.from(L.attributes).forEach(H=>{let Q=H.value;const G=new RegExp(`\\{${E}\\.([\\w\\.\\[\\]]+)\\}`,"g");Q=Q.replace(G,(se,Z)=>{try{const X=Z.split(/[.[\]]/).filter(Y=>Y);let J=S;for(const Y of X)if(Y.match(/^\d+$/)){const ce=parseInt(Y,10);if(Array.isArray(J)&&ce>=0&&ce<J.length)J=J[ce];else return""}else if(J&&typeof J=="object"&&Y in J)J=J[Y];else return"";const K=J==null?"":String(J);return H.name==="href"||H.name==="src"||H.name==="action"?Ct(K):it(K)}catch{return""}}),Q=Q.replace(new RegExp(`\\{${E}\\}`,"g"),()=>{const se=typeof S=="object"&&S!==null?JSON.stringify(S):String(S);return H.name==="href"||H.name==="src"||H.name==="action"?Ct(se):it(se)}),H.value=Q}),Array.from(L.childNodes).forEach(H=>P(H))}};Array.from(y.childNodes).forEach(j=>P(j));const V=y.innerHTML;if(V){const j=ui(V,D,n,o,r,i,s,l,c,W);y.innerHTML=j}};w();const M=y=>{y.forEach(E=>{const S=E.getAttribute("z-slot")||"default",D=e.slots?.[S];let W=[];if(Array.isArray(D)?W=D:D&&typeof D=="object"&&D.children&&(W=D.children||[]),W.length===0){E.removeAttribute("z-slot"),i?(E.setAttribute("data-zcode-empty-slot",S),E.setAttribute("data-zcode-slot-path",n?`${n}.slots.${S}`:`slots.${S}`),E.innerHTML=`<div class="zcode-empty-slot" data-zcode-empty-slot-content>
|
|
341
|
-
<button class="zcode-add-slot-btn" data-zcode-add-slot
|
|
342
|
-
</div>`):E.innerHTML="";return}const z=W.map((j,L)=>{const H=n?`${n}.slots.${S}.${L}`:`slots.${S}.${L}`;return r(j,H)}).join("");E.removeAttribute("z-slot");const V=f.parseFromString(`<template>${z}</template>`,"text/html").querySelector("template");if(V&&V.content)for(E.innerHTML="";V.content.firstChild;)E.appendChild(V.content.firstChild);else E.innerHTML=z})},A=Array.from(h.content.querySelectorAll("[z-slot]"));return M(A),h.innerHTML}function dn(t,e){const n=t.split(".");let o=e;for(const r of n)if(o==null||typeof o!="object"||(/^\d+$/.test(r)?o=o[parseInt(r)]:o=o[r],o===void 0))return null;return o}function jn(){return`zcode-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function Rg(t){return t.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^\s*([a-zA-Z])/,e=>e.toUpperCase())}function Pg(t){return Rg(t)}function od(t){const e=t.split(".");if(e.length<=2&&e[0]==="page")return null;if(e.includes("slots")){let o=-1;for(let r=e.length-1;r>=0;r--)if(e[r]==="slots"){o=r;break}if(o!==-1&&o<e.length-1){const r=e[e.length-1];if(!isNaN(parseInt(r)))return e.slice(0,o).join(".")}}const n=e.slice(0,-1);return n.length===0?null:n.join(".")}function ha(t,e){const n=[...e.common,...e.individual,...e.special];for(const o of n){const r=o.parts.find(i=>i.id===t);if(r)return r}return null}function fi(t,e=!0){function n(i){return ha(i,t.parts)}function o(i,s="",l=new Set){if(l.has(s))return console.warn(`循環参照を検出しました: ${s}`),`<div class="zcode-error-message">循環参照が検出されました: ${s}</div>`;l.add(s);const c=i.part_id,d=n(c);if(!d)return`<div class="zcode-error-message">パーツが見つかりません: ${c}</div>`;const u=ui(d.body,i,s,n,(f,p)=>o(f,p,l),e,t.images.common,t.images.individual,t.images.special,t.backendData);return e?td(u,{"data-zcode-id":i.id,"data-zcode-path":s,"data-zcode-part":c}):u}return{fullPageHtml:a.computed(()=>t.page.map((i,s)=>o(i,`page.${s}`)).join("")),renderComponentToHtml:o,findPart:n}}const ma=a.defineComponent({__name:"ZeroCodePreview",props:{cmsData:{type:Object},allowDynamicContentInteraction:{type:Boolean}},setup(t,{expose:e}){const n=t,{fullPageHtml:o}=fi(n.cmsData,!1),r=a.ref(null),i=a.computed(()=>r.value?.previewArea||null);return e({previewArea:i}),(s,l)=>(a.openBlock(),a.createBlock(Fc,{ref_key:"previewAreaRef",ref:r,"cms-data":t.cmsData,"full-page-html":a.unref(o),"allow-dynamic-content-interaction":t.allowDynamicContentInteraction},null,8,["cms-data","full-page-html","allow-dynamic-content-interaction"]))}}),Lg={class:"zcode-toolbar"},$g=["title"],rd=a.defineComponent({__name:"Toolbar",props:{currentMode:{type:String},viewMode:{type:String},availableModes:{type:Array},allowDynamicContentInteraction:{type:Boolean}},emits:["switch-mode","switch-view-mode","open-settings","toggle-dynamic-content"],setup(t,{emit:e}){const n=t,o=e,r=i=>{n.viewMode==="preview"?(o("switch-view-mode","manage"),a.nextTick(()=>{o("switch-mode",i)})):o("switch-mode",i)};return(i,s)=>(a.openBlock(),a.createElementBlock("div",Lg,[a.createElementVNode("button",{class:a.normalizeClass([{active:t.viewMode==="preview"},"zcode-view-mode-btn zcode-view-mode-preview"]),onClick:s[0]||(s[0]=l=>i.$emit("switch-view-mode",t.viewMode==="preview"?"manage":"preview"))},[a.createVNode(a.unref(Qm),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.viewMode")),1)],2),!t.availableModes||t.availableModes.includes("edit")?(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass([{active:t.currentMode==="edit"&&t.viewMode==="manage"},"zcode-mode-btn zcode-mode-edit"]),onClick:s[1]||(s[1]=l=>r("edit"))},[a.createVNode(a.unref(Pc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.editMode")),1)],2)):a.createCommentVNode("",!0),!t.availableModes||t.availableModes.includes("add")?(a.openBlock(),a.createElementBlock("button",{key:1,class:a.normalizeClass([{active:t.currentMode==="add"&&t.viewMode==="manage"},"zcode-mode-btn zcode-mode-add"]),onClick:s[2]||(s[2]=l=>r("add"))},[a.createVNode(a.unref(uo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.addMode")),1)],2)):a.createCommentVNode("",!0),!t.availableModes||t.availableModes.includes("reorder")?(a.openBlock(),a.createElementBlock("button",{key:2,class:a.normalizeClass([{active:t.currentMode==="reorder"&&t.viewMode==="manage"},"zcode-mode-btn zcode-mode-reorder"]),onClick:s[3]||(s[3]=l=>r("reorder"))},[a.createVNode(a.unref(ir),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.reorderMode")),1)],2)):a.createCommentVNode("",!0),!t.availableModes||t.availableModes.includes("delete")?(a.openBlock(),a.createElementBlock("button",{key:3,class:a.normalizeClass([{active:t.currentMode==="delete"&&t.viewMode==="manage"},"zcode-mode-btn zcode-mode-delete"]),onClick:s[4]||(s[4]=l=>r("delete"))},[a.createVNode(a.unref(Bn),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.deleteMode")),1)],2)):a.createCommentVNode("",!0),a.createElementVNode("button",{class:"zcode-settings-btn",title:i.$t("toolbar.settings"),onClick:s[5]||(s[5]=l=>i.$emit("open-settings"))},[a.createVNode(a.unref($c),{size:16})],8,$g)]))}});function un(t,e){typeof console<"u"&&(console.warn("[intlify] "+t),e&&console.warn(e.stack))}const id={};function sd(t){id[t]||(id[t]=!0,un(t))}const wn=typeof window<"u";let $t,fo;if(process.env.NODE_ENV!=="production"){const t=wn&&window.performance;t&&t.mark&&t.measure&&t.clearMarks&&t.clearMeasures&&($t=e=>{t.mark(e)},fo=(e,n,o)=>{t.measure(e,n,o),t.clearMarks(n),t.clearMarks(o)})}const Vg=/\{([0-9a-zA-Z]+)\}/g;function ga(t,...e){return e.length===1&&Re(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),t.replace(Vg,(n,o)=>e.hasOwnProperty(o)?e[o]:"")}const fn=(t,e=!1)=>e?Symbol.for(t):Symbol(t),Bg=(t,e,n)=>Fg({l:t,k:e,s:n}),Fg=t=>JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),at=t=>typeof t=="number"&&isFinite(t),jg=t=>ud(t)==="[object Date]",pi=t=>ud(t)==="[object RegExp]",hi=t=>$e(t)&&Object.keys(t).length===0,yt=Object.assign,Ug=Object.create,Be=(t=null)=>Ug(t);let ad;const pr=()=>ad||(ad=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:Be());function ld(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/").replace(/=/g,"=")}function cd(t){return t.replace(/&(?![a-zA-Z0-9#]{2,6};)/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function Hg(t){return t=t.replace(/(\w+)\s*=\s*"([^"]*)"/g,(o,r,i)=>`${r}="${cd(i)}"`),t=t.replace(/(\w+)\s*=\s*'([^']*)'/g,(o,r,i)=>`${r}='${cd(i)}'`),/\s*on\w+\s*=\s*["']?[^"'>]+["']?/gi.test(t)&&(process.env.NODE_ENV!=="production"&&un("Potentially dangerous event handlers detected in translation. Consider removing onclick, onerror, etc. from your translation messages."),t=t.replace(/(\s+)(on)(\w+\s*=)/gi,"$1on$3")),[/(\s+(?:href|src|action|formaction)\s*=\s*["']?)\s*javascript:/gi,/(style\s*=\s*["'][^"']*url\s*\(\s*)javascript:/gi].forEach(o=>{t=t.replace(o,"$1javascript:")}),t}const Wg=Object.prototype.hasOwnProperty;function nn(t,e){return Wg.call(t,e)}const tt=Array.isArray,qe=t=>typeof t=="function",he=t=>typeof t=="string",Ke=t=>typeof t=="boolean",Re=t=>t!==null&&typeof t=="object",Gg=t=>Re(t)&&qe(t.then)&&qe(t.catch),dd=Object.prototype.toString,ud=t=>dd.call(t),$e=t=>{if(!Re(t))return!1;const e=Object.getPrototypeOf(t);return e===null||e.constructor===Object},qg=t=>t==null?"":tt(t)||$e(t)&&t.toString===dd?JSON.stringify(t,null,2):String(t);function Kg(t,e=""){return t.reduce((n,o,r)=>r===0?n+o:n+e+o,"")}const fd=2;function Jg(t,e=0,n=t.length){const o=t.split(/\r?\n/);let r=0;const i=[];for(let s=0;s<o.length;s++)if(r+=o[s].length+1,r>=e){for(let l=s-fd;l<=s+fd||n>r;l++){if(l<0||l>=o.length)continue;const c=l+1;i.push(`${c}${" ".repeat(3-String(c).length)}| ${o[l]}`);const d=o[l].length;if(l===s){const u=e-(r-d)+1,f=Math.max(1,n>r?d-u:n-e);i.push(" | "+" ".repeat(u)+"^".repeat(f))}else if(l>s){if(n>r){const u=Math.max(Math.min(n-r,d),1);i.push(" | "+"^".repeat(u))}r+=d+1}}break}return i.join(`
|
|
343
|
-
`)}function mi(t){let e=t;return()=>++e}function pd(){const t=new Map;return{events:t,on(n,o){const r=t.get(n);r&&r.push(o)||t.set(n,[o])},off(n,o){const r=t.get(n);r&&r.splice(r.indexOf(o)>>>0,1)},emit(n,o){(t.get(n)||[]).slice().map(r=>r(o)),(t.get("*")||[]).slice().map(r=>r(n,o))}}}const gi=t=>!Re(t)||tt(t);function bi(t,e){if(gi(t)||gi(e))throw new Error("Invalid value");const n=[{src:t,des:e}];for(;n.length;){const{src:o,des:r}=n.pop();Object.keys(o).forEach(i=>{i!=="__proto__"&&(Re(o[i])&&!Re(r[i])&&(r[i]=Array.isArray(o[i])?[]:Be()),gi(r[i])||gi(o[i])?r[i]=o[i]:n.push({src:o[i],des:r[i]}))})}}function Xg(t,e,n){return{line:t,column:e,offset:n}}function yi(t,e,n){return{start:t,end:e}}const Yg=/\{([0-9a-zA-Z]+)\}/g;function hd(t,...e){return e.length===1&&Qg(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),t.replace(Yg,(n,o)=>e.hasOwnProperty(o)?e[o]:"")}const md=Object.assign,gd=t=>typeof t=="string",Qg=t=>t!==null&&typeof t=="object";function bd(t,e=""){return t.reduce((n,o,r)=>r===0?n+o:n+e+o,"")}const xi={USE_MODULO_SYNTAX:1,__EXTEND_POINT__:2},Zg={[xi.USE_MODULO_SYNTAX]:"Use modulo before '{{0}}'."};function eb(t,e,...n){const o=hd(Zg[t],...n||[]),r={message:String(o),code:t};return e&&(r.location=e),r}const Se={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16,__EXTEND_POINT__:17},tb={[Se.EXPECTED_TOKEN]:"Expected token: '{0}'",[Se.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[Se.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[Se.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[Se.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[Se.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[Se.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[Se.EMPTY_PLACEHOLDER]:"Empty placeholder",[Se.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[Se.INVALID_LINKED_FORMAT]:"Invalid linked format",[Se.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[Se.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[Se.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[Se.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[Se.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[Se.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function Io(t,e,n={}){const{domain:o,messages:r,args:i}=n,s=hd((r||tb)[t]||"",...i||[]),l=new SyntaxError(String(s));return l.code=t,e&&(l.location=e),l.domain=o,l}function nb(t){throw t}const ob=/<\/?[\w\s="/.':;#-\/]+>/,rb=t=>ob.test(t),Sn=" ",ib="\r",vt=`
|
|
344
|
-
`,sb="\u2028",ab="\u2029";function lb(t){const e=t;let n=0,o=1,r=1,i=0;const s=y=>e[y]===ib&&e[y+1]===vt,l=y=>e[y]===vt,c=y=>e[y]===ab,d=y=>e[y]===sb,u=y=>s(y)||l(y)||c(y)||d(y),f=()=>n,p=()=>o,h=()=>r,m=()=>i,b=y=>s(y)||c(y)||d(y)?vt:e[y],g=()=>b(n),x=()=>b(n+i);function v(){return i=0,u(n)&&(o++,r=0),s(n)&&n++,n++,r++,e[n]}function w(){return s(n+i)&&i++,i++,e[n+i]}function T(){n=0,o=1,r=1,i=0}function M(y=0){i=y}function A(){const y=n+i;for(;y!==n;)v();i=0}return{index:f,line:p,column:h,peekOffset:m,charAt:b,currentChar:g,currentPeek:x,next:v,peek:w,reset:T,resetPeek:M,skipToPeek:A}}const Un=void 0,cb=".",yd="'",db="tokenizer";function ub(t,e={}){const n=e.location!==!1,o=lb(t),r=()=>o.index(),i=()=>Xg(o.line(),o.column(),o.index()),s=i(),l=r(),c={currentType:14,offset:l,startLoc:s,endLoc:s,lastType:14,lastOffset:l,lastStartLoc:s,lastEndLoc:s,braceNest:0,inLinked:!1,text:""},d=()=>c,{onError:u}=e;function f(_,I,q,...fe){const Ae=d();if(I.column+=q,I.offset+=q,u){const Te=n?yi(Ae.startLoc,I):null,we=Io(_,Te,{domain:db,args:fe});u(we)}}function p(_,I,q){_.endLoc=i(),_.currentType=I;const fe={type:I};return n&&(fe.loc=yi(_.startLoc,_.endLoc)),q!=null&&(fe.value=q),fe}const h=_=>p(_,14);function m(_,I){return _.currentChar()===I?(_.next(),I):(f(Se.EXPECTED_TOKEN,i(),0,I),"")}function b(_){let I="";for(;_.currentPeek()===Sn||_.currentPeek()===vt;)I+=_.currentPeek(),_.peek();return I}function g(_){const I=b(_);return _.skipToPeek(),I}function x(_){if(_===Un)return!1;const I=_.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I===95}function v(_){if(_===Un)return!1;const I=_.charCodeAt(0);return I>=48&&I<=57}function w(_,I){const{currentType:q}=I;if(q!==2)return!1;b(_);const fe=x(_.currentPeek());return _.resetPeek(),fe}function T(_,I){const{currentType:q}=I;if(q!==2)return!1;b(_);const fe=_.currentPeek()==="-"?_.peek():_.currentPeek(),Ae=v(fe);return _.resetPeek(),Ae}function M(_,I){const{currentType:q}=I;if(q!==2)return!1;b(_);const fe=_.currentPeek()===yd;return _.resetPeek(),fe}function A(_,I){const{currentType:q}=I;if(q!==8)return!1;b(_);const fe=_.currentPeek()===".";return _.resetPeek(),fe}function y(_,I){const{currentType:q}=I;if(q!==9)return!1;b(_);const fe=x(_.currentPeek());return _.resetPeek(),fe}function E(_,I){const{currentType:q}=I;if(!(q===8||q===12))return!1;b(_);const fe=_.currentPeek()===":";return _.resetPeek(),fe}function S(_,I){const{currentType:q}=I;if(q!==10)return!1;const fe=()=>{const Te=_.currentPeek();return Te==="{"?x(_.peek()):Te==="@"||Te==="%"||Te==="|"||Te===":"||Te==="."||Te===Sn||!Te?!1:Te===vt?(_.peek(),fe()):z(_,!1)},Ae=fe();return _.resetPeek(),Ae}function D(_){b(_);const I=_.currentPeek()==="|";return _.resetPeek(),I}function W(_){const I=b(_),q=_.currentPeek()==="%"&&_.peek()==="{";return _.resetPeek(),{isModulo:q,hasSpace:I.length>0}}function z(_,I=!0){const q=(Ae=!1,Te="",we=!1)=>{const B=_.currentPeek();return B==="{"?Te==="%"?!1:Ae:B==="@"||!B?Te==="%"?!0:Ae:B==="%"?(_.peek(),q(Ae,"%",!0)):B==="|"?Te==="%"||we?!0:!(Te===Sn||Te===vt):B===Sn?(_.peek(),q(!0,Sn,we)):B===vt?(_.peek(),q(!0,vt,we)):!0},fe=q();return I&&_.resetPeek(),fe}function P(_,I){const q=_.currentChar();return q===Un?Un:I(q)?(_.next(),q):null}function V(_){const I=_.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36}function j(_){return P(_,V)}function L(_){const I=_.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36||I===45}function H(_){return P(_,L)}function Q(_){const I=_.charCodeAt(0);return I>=48&&I<=57}function G(_){return P(_,Q)}function se(_){const I=_.charCodeAt(0);return I>=48&&I<=57||I>=65&&I<=70||I>=97&&I<=102}function Z(_){return P(_,se)}function X(_){let I="",q="";for(;I=G(_);)q+=I;return q}function J(_){g(_);const I=_.currentChar();return I!=="%"&&f(Se.EXPECTED_TOKEN,i(),0,I),_.next(),"%"}function K(_){let I="";for(;;){const q=_.currentChar();if(q==="{"||q==="}"||q==="@"||q==="|"||!q)break;if(q==="%")if(z(_))I+=q,_.next();else break;else if(q===Sn||q===vt)if(z(_))I+=q,_.next();else{if(D(_))break;I+=q,_.next()}else I+=q,_.next()}return I}function Y(_){g(_);let I="",q="";for(;I=H(_);)q+=I;return _.currentChar()===Un&&f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),q}function ce(_){g(_);let I="";return _.currentChar()==="-"?(_.next(),I+=`-${X(_)}`):I+=X(_),_.currentChar()===Un&&f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),I}function Ee(_){return _!==yd&&_!==vt}function _e(_){g(_),m(_,"'");let I="",q="";for(;I=P(_,Ee);)I==="\\"?q+=Le(_):q+=I;const fe=_.currentChar();return fe===vt||fe===Un?(f(Se.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,i(),0),fe===vt&&(_.next(),m(_,"'")),q):(m(_,"'"),q)}function Le(_){const I=_.currentChar();switch(I){case"\\":case"'":return _.next(),`\\${I}`;case"u":return C(_,I,4);case"U":return C(_,I,6);default:return f(Se.UNKNOWN_ESCAPE_SEQUENCE,i(),0,I),""}}function C(_,I,q){m(_,I);let fe="";for(let Ae=0;Ae<q;Ae++){const Te=Z(_);if(!Te){f(Se.INVALID_UNICODE_ESCAPE_SEQUENCE,i(),0,`\\${I}${fe}${_.currentChar()}`);break}fe+=Te}return`\\${I}${fe}`}function N(_){return _!=="{"&&_!=="}"&&_!==Sn&&_!==vt}function O(_){g(_);let I="",q="";for(;I=P(_,N);)q+=I;return q}function k(_){let I="",q="";for(;I=j(_);)q+=I;return q}function U(_){const I=q=>{const fe=_.currentChar();return fe==="{"||fe==="%"||fe==="@"||fe==="|"||fe==="("||fe===")"||!fe||fe===Sn?q:(q+=fe,_.next(),I(q))};return I("")}function te(_){g(_);const I=m(_,"|");return g(_),I}function me(_,I){let q=null;switch(_.currentChar()){case"{":return I.braceNest>=1&&f(Se.NOT_ALLOW_NEST_PLACEHOLDER,i(),0),_.next(),q=p(I,2,"{"),g(_),I.braceNest++,q;case"}":return I.braceNest>0&&I.currentType===2&&f(Se.EMPTY_PLACEHOLDER,i(),0),_.next(),q=p(I,3,"}"),I.braceNest--,I.braceNest>0&&g(_),I.inLinked&&I.braceNest===0&&(I.inLinked=!1),q;case"@":return I.braceNest>0&&f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),q=ve(_,I)||h(I),I.braceNest=0,q;default:{let Ae=!0,Te=!0,we=!0;if(D(_))return I.braceNest>0&&f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),q=p(I,1,te(_)),I.braceNest=0,I.inLinked=!1,q;if(I.braceNest>0&&(I.currentType===5||I.currentType===6||I.currentType===7))return f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),I.braceNest=0,Ve(_,I);if(Ae=w(_,I))return q=p(I,5,Y(_)),g(_),q;if(Te=T(_,I))return q=p(I,6,ce(_)),g(_),q;if(we=M(_,I))return q=p(I,7,_e(_)),g(_),q;if(!Ae&&!Te&&!we)return q=p(I,13,O(_)),f(Se.INVALID_TOKEN_IN_PLACEHOLDER,i(),0,q.value),g(_),q;break}}return q}function ve(_,I){const{currentType:q}=I;let fe=null;const Ae=_.currentChar();switch((q===8||q===9||q===12||q===10)&&(Ae===vt||Ae===Sn)&&f(Se.INVALID_LINKED_FORMAT,i(),0),Ae){case"@":return _.next(),fe=p(I,8,"@"),I.inLinked=!0,fe;case".":return g(_),_.next(),p(I,9,".");case":":return g(_),_.next(),p(I,10,":");default:return D(_)?(fe=p(I,1,te(_)),I.braceNest=0,I.inLinked=!1,fe):A(_,I)||E(_,I)?(g(_),ve(_,I)):y(_,I)?(g(_),p(I,12,k(_))):S(_,I)?(g(_),Ae==="{"?me(_,I)||fe:p(I,11,U(_))):(q===8&&f(Se.INVALID_LINKED_FORMAT,i(),0),I.braceNest=0,I.inLinked=!1,Ve(_,I))}}function Ve(_,I){let q={type:14};if(I.braceNest>0)return me(_,I)||h(I);if(I.inLinked)return ve(_,I)||h(I);switch(_.currentChar()){case"{":return me(_,I)||h(I);case"}":return f(Se.UNBALANCED_CLOSING_BRACE,i(),0),_.next(),p(I,3,"}");case"@":return ve(_,I)||h(I);default:{if(D(_))return q=p(I,1,te(_)),I.braceNest=0,I.inLinked=!1,q;const{isModulo:Ae,hasSpace:Te}=W(_);if(Ae)return Te?p(I,0,K(_)):p(I,4,J(_));if(z(_))return p(I,0,K(_));break}}return q}function Ce(){const{currentType:_,offset:I,startLoc:q,endLoc:fe}=c;return c.lastType=_,c.lastOffset=I,c.lastStartLoc=q,c.lastEndLoc=fe,c.offset=r(),c.startLoc=i(),o.currentChar()===Un?p(c,14):Ve(o,c)}return{nextToken:Ce,currentOffset:r,currentPosition:i,context:d}}const fb="parser",pb=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function hb(t,e,n){switch(t){case"\\\\":return"\\";case"\\'":return"'";default:{const o=parseInt(e||n,16);return o<=55295||o>=57344?String.fromCodePoint(o):"�"}}}function mb(t={}){const e=t.location!==!1,{onError:n,onWarn:o}=t;function r(w,T,M,A,...y){const E=w.currentPosition();if(E.offset+=A,E.column+=A,n){const S=e?yi(M,E):null,D=Io(T,S,{domain:fb,args:y});n(D)}}function i(w,T,M,A,...y){const E=w.currentPosition();if(E.offset+=A,E.column+=A,o){const S=e?yi(M,E):null;o(eb(T,S,y))}}function s(w,T,M){const A={type:w};return e&&(A.start=T,A.end=T,A.loc={start:M,end:M}),A}function l(w,T,M,A){e&&(w.end=T,w.loc&&(w.loc.end=M))}function c(w,T){const M=w.context(),A=s(3,M.offset,M.startLoc);return A.value=T,l(A,w.currentOffset(),w.currentPosition()),A}function d(w,T){const M=w.context(),{lastOffset:A,lastStartLoc:y}=M,E=s(5,A,y);return E.index=parseInt(T,10),w.nextToken(),l(E,w.currentOffset(),w.currentPosition()),E}function u(w,T,M){const A=w.context(),{lastOffset:y,lastStartLoc:E}=A,S=s(4,y,E);return S.key=T,M===!0&&(S.modulo=!0),w.nextToken(),l(S,w.currentOffset(),w.currentPosition()),S}function f(w,T){const M=w.context(),{lastOffset:A,lastStartLoc:y}=M,E=s(9,A,y);return E.value=T.replace(pb,hb),w.nextToken(),l(E,w.currentOffset(),w.currentPosition()),E}function p(w){const T=w.nextToken(),M=w.context(),{lastOffset:A,lastStartLoc:y}=M,E=s(8,A,y);return T.type!==12?(r(w,Se.UNEXPECTED_EMPTY_LINKED_MODIFIER,M.lastStartLoc,0),E.value="",l(E,A,y),{nextConsumeToken:T,node:E}):(T.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,M.lastStartLoc,0,on(T)),E.value=T.value||"",l(E,w.currentOffset(),w.currentPosition()),{node:E})}function h(w,T){const M=w.context(),A=s(7,M.offset,M.startLoc);return A.value=T,l(A,w.currentOffset(),w.currentPosition()),A}function m(w){const T=w.context(),M=s(6,T.offset,T.startLoc);let A=w.nextToken();if(A.type===9){const y=p(w);M.modifier=y.node,A=y.nextConsumeToken||w.nextToken()}switch(A.type!==10&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),A=w.nextToken(),A.type===2&&(A=w.nextToken()),A.type){case 11:A.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),M.key=h(w,A.value||"");break;case 5:A.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),M.key=u(w,A.value||"");break;case 6:A.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),M.key=d(w,A.value||"");break;case 7:A.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),M.key=f(w,A.value||"");break;default:{r(w,Se.UNEXPECTED_EMPTY_LINKED_KEY,T.lastStartLoc,0);const y=w.context(),E=s(7,y.offset,y.startLoc);return E.value="",l(E,y.offset,y.startLoc),M.key=E,l(M,y.offset,y.startLoc),{nextConsumeToken:A,node:M}}}return l(M,w.currentOffset(),w.currentPosition()),{node:M}}function b(w){const T=w.context(),M=T.currentType===1?w.currentOffset():T.offset,A=T.currentType===1?T.endLoc:T.startLoc,y=s(2,M,A);y.items=[];let E=null,S=null;do{const z=E||w.nextToken();switch(E=null,z.type){case 0:z.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(z)),y.items.push(c(w,z.value||""));break;case 6:z.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(z)),y.items.push(d(w,z.value||""));break;case 4:S=!0;break;case 5:z.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(z)),y.items.push(u(w,z.value||"",!!S)),S&&(i(w,xi.USE_MODULO_SYNTAX,T.lastStartLoc,0,on(z)),S=null);break;case 7:z.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(z)),y.items.push(f(w,z.value||""));break;case 8:{const P=m(w);y.items.push(P.node),E=P.nextConsumeToken||null;break}}}while(T.currentType!==14&&T.currentType!==1);const D=T.currentType===1?T.lastOffset:w.currentOffset(),W=T.currentType===1?T.lastEndLoc:w.currentPosition();return l(y,D,W),y}function g(w,T,M,A){const y=w.context();let E=A.items.length===0;const S=s(1,T,M);S.cases=[],S.cases.push(A);do{const D=b(w);E||(E=D.items.length===0),S.cases.push(D)}while(y.currentType!==14);return E&&r(w,Se.MUST_HAVE_MESSAGES_IN_PLURAL,M,0),l(S,w.currentOffset(),w.currentPosition()),S}function x(w){const T=w.context(),{offset:M,startLoc:A}=T,y=b(w);return T.currentType===14?y:g(w,M,A,y)}function v(w){const T=ub(w,md({},t)),M=T.context(),A=s(0,M.offset,M.startLoc);return e&&A.loc&&(A.loc.source=w),A.body=x(T),t.onCacheKey&&(A.cacheKey=t.onCacheKey(w)),M.currentType!==14&&r(T,Se.UNEXPECTED_LEXICAL_ANALYSIS,M.lastStartLoc,0,w[M.offset]||""),l(A,T.currentOffset(),T.currentPosition()),A}return{parse:v}}function on(t){if(t.type===14)return"EOF";const e=(t.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function gb(t,e={}){const n={ast:t,helpers:new Set};return{context:()=>n,helper:i=>(n.helpers.add(i),i)}}function xd(t,e){for(let n=0;n<t.length;n++)ba(t[n],e)}function ba(t,e){switch(t.type){case 1:xd(t.cases,e),e.helper("plural");break;case 2:xd(t.items,e);break;case 6:{ba(t.key,e),e.helper("linked"),e.helper("type");break}case 5:e.helper("interpolate"),e.helper("list");break;case 4:e.helper("interpolate"),e.helper("named");break}}function bb(t,e={}){const n=gb(t);n.helper("normalize"),t.body&&ba(t.body,n);const o=n.context();t.helpers=Array.from(o.helpers)}function yb(t){const e=t.body;return e.type===2?Ed(e):e.cases.forEach(n=>Ed(n)),t}function Ed(t){if(t.items.length===1){const e=t.items[0];(e.type===3||e.type===9)&&(t.static=e.value,delete e.value)}else{const e=[];for(let n=0;n<t.items.length;n++){const o=t.items[n];if(!(o.type===3||o.type===9)||o.value==null)break;e.push(o.value)}if(e.length===t.items.length){t.static=bd(e);for(let n=0;n<t.items.length;n++){const o=t.items[n];(o.type===3||o.type===9)&&delete o.value}}}}const xb="minifier";function Oo(t){switch(t.t=t.type,t.type){case 0:{const e=t;Oo(e.body),e.b=e.body,delete e.body;break}case 1:{const e=t,n=e.cases;for(let o=0;o<n.length;o++)Oo(n[o]);e.c=n,delete e.cases;break}case 2:{const e=t,n=e.items;for(let o=0;o<n.length;o++)Oo(n[o]);e.i=n,delete e.items,e.static&&(e.s=e.static,delete e.static);break}case 3:case 9:case 8:case 7:{const e=t;e.value&&(e.v=e.value,delete e.value);break}case 6:{const e=t;Oo(e.key),e.k=e.key,delete e.key,e.modifier&&(Oo(e.modifier),e.m=e.modifier,delete e.modifier);break}case 5:{const e=t;e.i=e.index,delete e.index;break}case 4:{const e=t;e.k=e.key,delete e.key;break}default:throw Io(Se.UNHANDLED_MINIFIER_NODE_TYPE,null,{domain:xb,args:[t.type]})}delete t.type}const Eb="parser";function kb(t,e){const{filename:n,breakLineCode:o,needIndent:r}=e,i=e.location!==!1,s={filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:o,needIndent:r,indentLevel:0};i&&t.loc&&(s.source=t.loc.source);const l=()=>s;function c(b,g){s.code+=b}function d(b,g=!0){const x=g?o:"";c(r?x+" ".repeat(b):x)}function u(b=!0){const g=++s.indentLevel;b&&d(g)}function f(b=!0){const g=--s.indentLevel;b&&d(g)}function p(){d(s.indentLevel)}return{context:l,push:c,indent:u,deindent:f,newline:p,helper:b=>`_${b}`,needIndent:()=>s.needIndent}}function wb(t,e){const{helper:n}=t;t.push(`${n("linked")}(`),Do(t,e.key),e.modifier?(t.push(", "),Do(t,e.modifier),t.push(", _type")):t.push(", undefined, _type"),t.push(")")}function Sb(t,e){const{helper:n,needIndent:o}=t;t.push(`${n("normalize")}([`),t.indent(o());const r=e.items.length;for(let i=0;i<r&&(Do(t,e.items[i]),i!==r-1);i++)t.push(", ");t.deindent(o()),t.push("])")}function Nb(t,e){const{helper:n,needIndent:o}=t;if(e.cases.length>1){t.push(`${n("plural")}([`),t.indent(o());const r=e.cases.length;for(let i=0;i<r&&(Do(t,e.cases[i]),i!==r-1);i++)t.push(", ");t.deindent(o()),t.push("])")}}function Cb(t,e){e.body?Do(t,e.body):t.push("null")}function Do(t,e){const{helper:n}=t;switch(e.type){case 0:Cb(t,e);break;case 1:Nb(t,e);break;case 2:Sb(t,e);break;case 6:wb(t,e);break;case 8:t.push(JSON.stringify(e.value),e);break;case 7:t.push(JSON.stringify(e.value),e);break;case 5:t.push(`${n("interpolate")}(${n("list")}(${e.index}))`,e);break;case 4:t.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(e.key)}))`,e);break;case 9:t.push(JSON.stringify(e.value),e);break;case 3:t.push(JSON.stringify(e.value),e);break;default:throw Io(Se.UNHANDLED_CODEGEN_NODE_TYPE,null,{domain:Eb,args:[e.type]})}}const vb=(t,e={})=>{const n=gd(e.mode)?e.mode:"normal",o=gd(e.filename)?e.filename:"message.intl";e.sourceMap;const r=e.breakLineCode!=null?e.breakLineCode:n==="arrow"?";":`
|
|
345
|
-
`,i=e.needIndent?e.needIndent:n!=="arrow",s=t.helpers||[],l=kb(t,{filename:o,breakLineCode:r,needIndent:i});l.push(n==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),l.indent(i),s.length>0&&(l.push(`const { ${bd(s.map(u=>`${u}: _${u}`),", ")} } = ctx`),l.newline()),l.push("return "),Do(l,t),l.deindent(i),l.push("}"),delete t.helpers;const{code:c,map:d}=l.context();return{ast:t,code:c,map:d?d.toJSON():void 0}};function Tb(t,e={}){const n=md({},e),o=!!n.jit,r=!!n.minify,i=n.optimize==null?!0:n.optimize,l=mb(n).parse(t);return o?(i&&yb(l),r&&Oo(l),{ast:l,code:""}):(bb(l,n),vb(l,n))}function zb(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(pr().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(pr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function jt(t){return Re(t)&&ya(t)===0&&(nn(t,"b")||nn(t,"body"))}const kd=["b","body"];function _b(t){return Hn(t,kd)}const wd=["c","cases"];function Ab(t){return Hn(t,wd,[])}const Sd=["s","static"];function Mb(t){return Hn(t,Sd)}const Nd=["i","items"];function Ib(t){return Hn(t,Nd,[])}const Cd=["t","type"];function ya(t){return Hn(t,Cd)}const vd=["v","value"];function Ei(t,e){const n=Hn(t,vd);if(n!=null)return n;throw hr(e)}const Td=["m","modifier"];function Ob(t){return Hn(t,Td)}const zd=["k","key"];function Db(t){const e=Hn(t,zd);if(e)return e;throw hr(6)}function Hn(t,e,n){for(let o=0;o<e.length;o++){const r=e[o];if(nn(t,r)&&t[r]!=null)return t[r]}return n}const _d=[...kd,...wd,...Sd,...Nd,...zd,...Td,...vd,...Cd];function hr(t){return new Error(`unhandled node type: ${t}`)}const Wn=[];Wn[0]={w:[0],i:[3,0],"[":[4],o:[7]},Wn[1]={w:[1],".":[2],"[":[4],o:[7]},Wn[2]={w:[2],i:[3,0],0:[3,0]},Wn[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},Wn[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},Wn[5]={"'":[4,0],o:8,l:[5,0]},Wn[6]={'"':[4,0],o:8,l:[6,0]};const Rb=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function Pb(t){return Rb.test(t)}function Lb(t){const e=t.charCodeAt(0),n=t.charCodeAt(t.length-1);return e===n&&(e===34||e===39)?t.slice(1,-1):t}function $b(t){if(t==null)return"o";switch(t.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return t;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function Vb(t){const e=t.trim();return t.charAt(0)==="0"&&isNaN(parseInt(t))?!1:Pb(e)?Lb(e):"*"+e}function Bb(t){const e=[];let n=-1,o=0,r=0,i,s,l,c,d,u,f;const p=[];p[0]=()=>{s===void 0?s=l:s+=l},p[1]=()=>{s!==void 0&&(e.push(s),s=void 0)},p[2]=()=>{p[0](),r++},p[3]=()=>{if(r>0)r--,o=4,p[0]();else{if(r=0,s===void 0||(s=Vb(s),s===!1))return!1;p[1]()}};function h(){const m=t[n+1];if(o===5&&m==="'"||o===6&&m==='"')return n++,l="\\"+m,p[0](),!0}for(;o!==null;)if(n++,i=t[n],!(i==="\\"&&h())){if(c=$b(i),f=Wn[o],d=f[c]||f.l||8,d===8||(o=d[0],d[1]!==void 0&&(u=p[d[1]],u&&(l=i,u()===!1))))return;if(o===7)return e}}const Ad=new Map;function Fb(t,e){return Re(t)?t[e]:null}function jb(t,e){if(!Re(t))return null;let n=Ad.get(e);if(n||(n=Bb(e),n&&Ad.set(e,n)),!n)return null;const o=n.length;let r=t,i=0;for(;i<o;){const s=n[i];if(_d.includes(s)&&jt(r))return null;const l=r[s];if(l===void 0||qe(r))return null;r=l,i++}return r}const Ub=t=>t,Hb=t=>"",Wb="text",Gb=t=>t.length===0?"":Kg(t),qb=qg;function Md(t,e){return t=Math.abs(t),e===2?t?t>1?1:0:1:t?Math.min(t,2):0}function Kb(t){const e=at(t.pluralIndex)?t.pluralIndex:-1;return t.named&&(at(t.named.count)||at(t.named.n))?at(t.named.count)?t.named.count:at(t.named.n)?t.named.n:e:e}function Jb(t,e){e.count||(e.count=t),e.n||(e.n=t)}function Xb(t={}){const e=t.locale,n=Kb(t),o=Re(t.pluralRules)&&he(e)&&qe(t.pluralRules[e])?t.pluralRules[e]:Md,r=Re(t.pluralRules)&&he(e)&&qe(t.pluralRules[e])?Md:void 0,i=x=>x[o(n,x.length,r)],s=t.list||[],l=x=>s[x],c=t.named||Be();at(t.pluralIndex)&&Jb(n,c);const d=x=>c[x];function u(x){const v=qe(t.messages)?t.messages(x):Re(t.messages)?t.messages[x]:!1;return v||(t.parent?t.parent.message(x):Hb)}const f=x=>t.modifiers?t.modifiers[x]:Ub,p=$e(t.processor)&&qe(t.processor.normalize)?t.processor.normalize:Gb,h=$e(t.processor)&&qe(t.processor.interpolate)?t.processor.interpolate:qb,m=$e(t.processor)&&he(t.processor.type)?t.processor.type:Wb,g={list:l,named:d,plural:i,linked:(x,...v)=>{const[w,T]=v;let M="text",A="";v.length===1?Re(w)?(A=w.modifier||A,M=w.type||M):he(w)&&(A=w||A):v.length===2&&(he(w)&&(A=w||A),he(T)&&(M=T||M));const y=u(x)(g),E=M==="vnode"&&tt(y)&&A?y[0]:y;return A?f(A)(E,M):E},message:u,type:m,interpolate:h,normalize:p,values:yt(Be(),s,c)};return g}let mr=null;function Yb(t){mr=t}function Qb(t,e,n){mr&&mr.emit("i18n:init",{timestamp:Date.now(),i18n:t,version:e,meta:n})}const Zb=ey("function:translate");function ey(t){return e=>mr&&mr.emit(t,e)}const Id=xi.__EXTEND_POINT__,po=mi(Id),Tt={NOT_FOUND_KEY:Id,FALLBACK_TO_TRANSLATE:po(),CANNOT_FORMAT_NUMBER:po(),FALLBACK_TO_NUMBER_FORMAT:po(),CANNOT_FORMAT_DATE:po(),FALLBACK_TO_DATE_FORMAT:po(),EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:po(),__EXTEND_POINT__:po()},ty={[Tt.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[Tt.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[Tt.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[Tt.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[Tt.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[Tt.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[Tt.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER]:"This project is using Custom Message Compiler, which is an experimental feature. It may receive breaking changes or be removed in the future."};function ho(t,...e){return ga(ty[t],...e)}const Od=Se.__EXTEND_POINT__,mo=mi(Od),lt={INVALID_ARGUMENT:Od,INVALID_DATE_ARGUMENT:mo(),INVALID_ISO_DATE_ARGUMENT:mo(),NOT_SUPPORT_NON_STRING_MESSAGE:mo(),NOT_SUPPORT_LOCALE_PROMISE_VALUE:mo(),NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:mo(),NOT_SUPPORT_LOCALE_TYPE:mo(),__EXTEND_POINT__:mo()};function pn(t){return Io(t,null,process.env.NODE_ENV!=="production"?{messages:ny}:void 0)}const ny={[lt.INVALID_ARGUMENT]:"Invalid arguments",[lt.INVALID_DATE_ARGUMENT]:"The date provided is an invalid Date object.Make sure your Date represents a valid date.",[lt.INVALID_ISO_DATE_ARGUMENT]:"The argument provided is not a valid ISO date string",[lt.NOT_SUPPORT_NON_STRING_MESSAGE]:"Not support non-string message",[lt.NOT_SUPPORT_LOCALE_PROMISE_VALUE]:"cannot support promise value",[lt.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION]:"cannot support async function",[lt.NOT_SUPPORT_LOCALE_TYPE]:"cannot support locale type"};function xa(t,e){return e.locale!=null?Dd(e.locale):Dd(t.locale)}let Ea;function Dd(t){if(he(t))return t;if(qe(t)){if(t.resolvedOnce&&Ea!=null)return Ea;if(t.constructor.name==="Function"){const e=t();if(Gg(e))throw pn(lt.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return Ea=e}else throw pn(lt.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw pn(lt.NOT_SUPPORT_LOCALE_TYPE)}function oy(t,e,n){return[...new Set([n,...tt(e)?e:Re(e)?Object.keys(e):he(e)?[e]:[n]])]}function Rd(t,e,n){const o=he(n)?n:wi,r=t;r.__localeChainCache||(r.__localeChainCache=new Map);let i=r.__localeChainCache.get(o);if(!i){i=[];let s=[n];for(;tt(s);)s=Pd(i,s,e);const l=tt(e)||!$e(e)?e:e.default?e.default:null;s=he(l)?[l]:l,tt(s)&&Pd(i,s,!1),r.__localeChainCache.set(o,i)}return i}function Pd(t,e,n){let o=!0;for(let r=0;r<e.length&&Ke(o);r++){const i=e[r];he(i)&&(o=ry(t,e[r],n))}return o}function ry(t,e,n){let o;const r=e.split("-");do{const i=r.join("-");o=iy(t,i,n),r.splice(-1,1)}while(r.length&&o===!0);return o}function iy(t,e,n){let o=!1;if(!t.includes(e)&&(o=!0,e)){o=e[e.length-1]!=="!";const r=e.replace(/!/g,"");t.push(r),(tt(n)||$e(n))&&n[r]&&(o=n[r])}return o}const sy="9.14.5",ki=-1,wi="en-US",Si="",Ld=t=>`${t.charAt(0).toLocaleUpperCase()}${t.substr(1)}`;function ay(){return{upper:(t,e)=>e==="text"&&he(t)?t.toUpperCase():e==="vnode"&&Re(t)&&"__v_isVNode"in t?t.children.toUpperCase():t,lower:(t,e)=>e==="text"&&he(t)?t.toLowerCase():e==="vnode"&&Re(t)&&"__v_isVNode"in t?t.children.toLowerCase():t,capitalize:(t,e)=>e==="text"&&he(t)?Ld(t):e==="vnode"&&Re(t)&&"__v_isVNode"in t?Ld(t.children):t}}let $d;function Vd(t){$d=t}let Bd;function ly(t){Bd=t}let Fd;function cy(t){Fd=t}let jd=null;const dy=t=>{jd=t},uy=()=>jd;let Ud=null;const Hd=t=>{Ud=t},fy=()=>Ud;let Wd=0;function py(t={}){const e=qe(t.onWarn)?t.onWarn:un,n=he(t.version)?t.version:sy,o=he(t.locale)||qe(t.locale)?t.locale:wi,r=qe(o)?wi:o,i=tt(t.fallbackLocale)||$e(t.fallbackLocale)||he(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:r,s=$e(t.messages)?t.messages:ka(r),l=$e(t.datetimeFormats)?t.datetimeFormats:ka(r),c=$e(t.numberFormats)?t.numberFormats:ka(r),d=yt(Be(),t.modifiers,ay()),u=t.pluralRules||Be(),f=qe(t.missing)?t.missing:null,p=Ke(t.missingWarn)||pi(t.missingWarn)?t.missingWarn:!0,h=Ke(t.fallbackWarn)||pi(t.fallbackWarn)?t.fallbackWarn:!0,m=!!t.fallbackFormat,b=!!t.unresolving,g=qe(t.postTranslation)?t.postTranslation:null,x=$e(t.processor)?t.processor:null,v=Ke(t.warnHtmlMessage)?t.warnHtmlMessage:!0,w=!!t.escapeParameter,T=qe(t.messageCompiler)?t.messageCompiler:$d;process.env.NODE_ENV!=="production"&&qe(t.messageCompiler)&&sd(ho(Tt.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER));const M=qe(t.messageResolver)?t.messageResolver:Bd||Fb,A=qe(t.localeFallbacker)?t.localeFallbacker:Fd||oy,y=Re(t.fallbackContext)?t.fallbackContext:void 0,E=t,S=Re(E.__datetimeFormatters)?E.__datetimeFormatters:new Map,D=Re(E.__numberFormatters)?E.__numberFormatters:new Map,W=Re(E.__meta)?E.__meta:{};Wd++;const z={version:n,cid:Wd,locale:o,fallbackLocale:i,messages:s,modifiers:d,pluralRules:u,missing:f,missingWarn:p,fallbackWarn:h,fallbackFormat:m,unresolving:b,postTranslation:g,processor:x,warnHtmlMessage:v,escapeParameter:w,messageCompiler:T,messageResolver:M,localeFallbacker:A,fallbackContext:y,onWarn:e,__meta:W};return z.datetimeFormats=l,z.numberFormats=c,z.__datetimeFormatters=S,z.__numberFormatters=D,process.env.NODE_ENV!=="production"&&(z.__v_emitter=E.__v_emitter!=null?E.__v_emitter:void 0),process.env.NODE_ENV!=="production"&&Qb(z,n,W),z}const ka=t=>({[t]:Be()});function Ni(t,e){return t instanceof RegExp?t.test(e):t}function Gd(t,e){return t instanceof RegExp?t.test(e):t}function wa(t,e,n,o,r){const{missing:i,onWarn:s}=t;if(process.env.NODE_ENV!=="production"){const l=t.__v_emitter;l&&l.emit("missing",{locale:n,key:e,type:r,groupId:`${r}:${e}`})}if(i!==null){const l=i(t,n,e,r);return he(l)?l:e}else return process.env.NODE_ENV!=="production"&&Gd(o,e)&&s(ho(Tt.NOT_FOUND_KEY,{key:e,locale:n})),e}function gr(t,e,n){const o=t;o.__localeChainCache=new Map,t.localeFallbacker(t,n,e)}function qd(t,e){return t===e?!1:t.split("-")[0]===e.split("-")[0]}function hy(t,e){const n=e.indexOf(t);if(n===-1)return!1;for(let o=n+1;o<e.length;o++)if(qd(t,e[o]))return!0;return!1}function Sa(t){return n=>my(n,t)}function my(t,e){const n=_b(e);if(n==null)throw hr(0);if(ya(n)===1){const i=Ab(n);return t.plural(i.reduce((s,l)=>[...s,Kd(t,l)],[]))}else return Kd(t,n)}function Kd(t,e){const n=Mb(e);if(n!=null)return t.type==="text"?n:t.normalize([n]);{const o=Ib(e).reduce((r,i)=>[...r,Na(t,i)],[]);return t.normalize(o)}}function Na(t,e){const n=ya(e);switch(n){case 3:return Ei(e,n);case 9:return Ei(e,n);case 4:{const o=e;if(nn(o,"k")&&o.k)return t.interpolate(t.named(o.k));if(nn(o,"key")&&o.key)return t.interpolate(t.named(o.key));throw hr(n)}case 5:{const o=e;if(nn(o,"i")&&at(o.i))return t.interpolate(t.list(o.i));if(nn(o,"index")&&at(o.index))return t.interpolate(t.list(o.index));throw hr(n)}case 6:{const o=e,r=Ob(o),i=Db(o);return t.linked(Na(t,i),r?Na(t,r):void 0,t.type)}case 7:return Ei(e,n);case 8:return Ei(e,n);default:throw new Error(`unhandled node on format message part: ${n}`)}}const gy="Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.";function Jd(t,e){e&&rb(t)&&un(ga(gy,{source:t}))}const Xd=t=>t;let Ro=Be();function Yd(t){t.code===xi.USE_MODULO_SYNTAX&&un(`The use of named interpolation with modulo syntax is deprecated. It will be removed in v10.
|
|
346
|
-
reference: https://vue-i18n.intlify.dev/guide/essentials/syntax#rails-i18n-format
|
|
347
|
-
(message compiler warning message: ${t.message})`)}function Qd(t,e={}){let n=!1;const o=e.onError||nb;return e.onError=r=>{n=!0,o(r)},{...Tb(t,e),detectError:n}}const by=(t,e)=>{if(!he(t))throw pn(lt.NOT_SUPPORT_NON_STRING_MESSAGE);process.env.NODE_ENV!=="production"&&(e.onWarn=Yd);{const n=Ke(e.warnHtmlMessage)?e.warnHtmlMessage:!0;process.env.NODE_ENV!=="production"&&Jd(t,n);const r=(e.onCacheKey||Xd)(t),i=Ro[r];if(i)return i;const{code:s,detectError:l}=Qd(t,e),c=new Function(`return ${s}`)();return l?c:Ro[r]=c}};function yy(t,e){if(process.env.NODE_ENV!=="production"&&(e.onWarn=Yd),__INTLIFY_JIT_COMPILATION__&&!__INTLIFY_DROP_MESSAGE_COMPILER__&&he(t)){const n=Ke(e.warnHtmlMessage)?e.warnHtmlMessage:!0;process.env.NODE_ENV!=="production"&&Jd(t,n);const r=(e.onCacheKey||Xd)(t),i=Ro[r];if(i)return i;const{ast:s,detectError:l}=Qd(t,{...e,location:process.env.NODE_ENV!=="production",jit:!0}),c=Sa(s);return l?c:Ro[r]=c}else{if(process.env.NODE_ENV!=="production"&&!jt(t))return un(`the message that is resolve with key '${e.key}' is not supported for jit compilation`),(()=>t);const n=t.cacheKey;if(n){const o=Ro[n];return o||(Ro[n]=Sa(t))}else return Sa(t)}}const Zd=()=>"",Ut=t=>qe(t);function eu(t,...e){const{fallbackFormat:n,postTranslation:o,unresolving:r,messageCompiler:i,fallbackLocale:s,messages:l}=t,[c,d]=Ca(...e),u=Ke(d.missingWarn)?d.missingWarn:t.missingWarn,f=Ke(d.fallbackWarn)?d.fallbackWarn:t.fallbackWarn,p=Ke(d.escapeParameter)?d.escapeParameter:t.escapeParameter,h=!!d.resolvedMessage,m=he(d.default)||Ke(d.default)?Ke(d.default)?i?c:()=>c:d.default:n?i?c:()=>c:"",b=n||m!=="",g=xa(t,d);p&&xy(d);let[x,v,w]=h?[c,g,l[g]||Be()]:tu(t,c,g,s,f,u),T=x,M=c;if(!h&&!(he(T)||jt(T)||Ut(T))&&b&&(T=m,M=T),!h&&(!(he(T)||jt(T)||Ut(T))||!he(v)))return r?ki:c;if(process.env.NODE_ENV!=="production"&&he(T)&&t.messageCompiler==null)return un(`The message format compilation is not supported in this build. Because message compiler isn't included. You need to pre-compilation all message format. So translate function return '${c}'.`),c;let A=!1;const y=()=>{A=!0},E=Ut(T)?T:nu(t,c,v,T,M,y);if(A)return T;const S=Sy(t,v,w,d),D=Xb(S),W=Ey(t,E,D);let z=o?o(W,c):W;if(p&&he(z)&&(z=Hg(z)),process.env.NODE_ENV!=="production"){const P={timestamp:Date.now(),key:he(c)?c:Ut(T)?T.key:"",locale:v||(Ut(T)?T.locale:""),format:he(T)?T:Ut(T)?T.source:"",message:z};P.meta=yt({},t.__meta,uy()||{}),Zb(P)}return z}function xy(t){tt(t.list)?t.list=t.list.map(e=>he(e)?ld(e):e):Re(t.named)&&Object.keys(t.named).forEach(e=>{he(t.named[e])&&(t.named[e]=ld(t.named[e]))})}function tu(t,e,n,o,r,i){const{messages:s,onWarn:l,messageResolver:c,localeFallbacker:d}=t,u=d(t,o,n);let f=Be(),p,h=null,m=n,b=null;const g="translate";for(let x=0;x<u.length;x++){if(p=b=u[x],process.env.NODE_ENV!=="production"&&n!==p&&!qd(n,p)&&Ni(r,e)&&l(ho(Tt.FALLBACK_TO_TRANSLATE,{key:e,target:p})),process.env.NODE_ENV!=="production"&&n!==p){const M=t.__v_emitter;M&&M.emit("fallback",{type:g,key:e,from:m,to:b,groupId:`${g}:${e}`})}f=s[p]||Be();let v=null,w,T;if(process.env.NODE_ENV!=="production"&&wn&&(v=window.performance.now(),w="intlify-message-resolve-start",T="intlify-message-resolve-end",$t&&$t(w)),(h=c(f,e))===null&&(h=f[e]),process.env.NODE_ENV!=="production"&&wn){const M=window.performance.now(),A=t.__v_emitter;A&&v&&h&&A.emit("message-resolve",{type:"message-resolve",key:e,message:h,time:M-v,groupId:`${g}:${e}`}),w&&T&&$t&&fo&&($t(T),fo("intlify message resolve",w,T))}if(he(h)||jt(h)||Ut(h))break;if(!hy(p,u)){const M=wa(t,e,p,i,g);M!==e&&(h=M)}m=b}return[h,p,f]}function nu(t,e,n,o,r,i){const{messageCompiler:s,warnHtmlMessage:l}=t;if(Ut(o)){const p=o;return p.locale=p.locale||n,p.key=p.key||e,p}if(s==null){const p=(()=>o);return p.locale=n,p.key=e,p}let c=null,d,u;process.env.NODE_ENV!=="production"&&wn&&(c=window.performance.now(),d="intlify-message-compilation-start",u="intlify-message-compilation-end",$t&&$t(d));const f=s(o,ky(t,n,r,o,l,i));if(process.env.NODE_ENV!=="production"&&wn){const p=window.performance.now(),h=t.__v_emitter;h&&c&&h.emit("message-compilation",{type:"message-compilation",message:o,time:p-c,groupId:`translate:${e}`}),d&&u&&$t&&fo&&($t(u),fo("intlify message compilation",d,u))}return f.locale=n,f.key=e,f.source=o,f}function Ey(t,e,n){let o=null,r,i;process.env.NODE_ENV!=="production"&&wn&&(o=window.performance.now(),r="intlify-message-evaluation-start",i="intlify-message-evaluation-end",$t&&$t(r));const s=e(n);if(process.env.NODE_ENV!=="production"&&wn){const l=window.performance.now(),c=t.__v_emitter;c&&o&&c.emit("message-evaluation",{type:"message-evaluation",value:s,time:l-o,groupId:`translate:${e.key}`}),r&&i&&$t&&fo&&($t(i),fo("intlify message evaluation",r,i))}return s}function Ca(...t){const[e,n,o]=t,r=Be();if(!he(e)&&!at(e)&&!Ut(e)&&!jt(e))throw pn(lt.INVALID_ARGUMENT);const i=at(e)?String(e):(Ut(e),e);return at(n)?r.plural=n:he(n)?r.default=n:$e(n)&&!hi(n)?r.named=n:tt(n)&&(r.list=n),at(o)?r.plural=o:he(o)?r.default=o:$e(o)&&yt(r,o),[i,r]}function ky(t,e,n,o,r,i){return{locale:e,key:n,warnHtmlMessage:r,onError:s=>{if(i&&i(s),process.env.NODE_ENV!=="production"){const l=wy(o),c=`Message compilation error: ${s.message}`,d=s.location&&l&&Jg(l,s.location.start.offset,s.location.end.offset),u=t.__v_emitter;u&&l&&u.emit("compile-error",{message:l,error:s.message,start:s.location&&s.location.start.offset,end:s.location&&s.location.end.offset,groupId:`translate:${n}`}),console.error(d?`${c}
|
|
348
|
-
${d}`:c)}else throw s},onCacheKey:s=>Bg(e,n,s)}}function wy(t){if(he(t))return t;if(t.loc&&t.loc.source)return t.loc.source}function Sy(t,e,n,o){const{modifiers:r,pluralRules:i,messageResolver:s,fallbackLocale:l,fallbackWarn:c,missingWarn:d,fallbackContext:u}=t,p={locale:e,modifiers:r,pluralRules:i,messages:h=>{let m=s(n,h);if(m==null&&u){const[,,b]=tu(u,h,e,l,c,d);m=s(b,h)}if(he(m)||jt(m)){let b=!1;const x=nu(t,h,e,m,h,()=>{b=!0});return b?Zd:x}else return Ut(m)?m:Zd}};return t.processor&&(p.processor=t.processor),o.list&&(p.list=o.list),o.named&&(p.named=o.named),at(o.plural)&&(p.pluralIndex=o.plural),p}const ou=typeof Intl<"u",ru={dateTimeFormat:ou&&typeof Intl.DateTimeFormat<"u",numberFormat:ou&&typeof Intl.NumberFormat<"u"};function iu(t,...e){const{datetimeFormats:n,unresolving:o,fallbackLocale:r,onWarn:i,localeFallbacker:s}=t,{__datetimeFormatters:l}=t;if(process.env.NODE_ENV!=="production"&&!ru.dateTimeFormat)return i(ho(Tt.CANNOT_FORMAT_DATE)),Si;const[c,d,u,f]=va(...e),p=Ke(u.missingWarn)?u.missingWarn:t.missingWarn,h=Ke(u.fallbackWarn)?u.fallbackWarn:t.fallbackWarn,m=!!u.part,b=xa(t,u),g=s(t,r,b);if(!he(c)||c==="")return new Intl.DateTimeFormat(b,f).format(d);let x={},v,w=null,T=b,M=null;const A="datetime format";for(let S=0;S<g.length;S++){if(v=M=g[S],process.env.NODE_ENV!=="production"&&b!==v&&Ni(h,c)&&i(ho(Tt.FALLBACK_TO_DATE_FORMAT,{key:c,target:v})),process.env.NODE_ENV!=="production"&&b!==v){const D=t.__v_emitter;D&&D.emit("fallback",{type:A,key:c,from:T,to:M,groupId:`${A}:${c}`})}if(x=n[v]||{},w=x[c],$e(w))break;wa(t,c,v,p,A),T=M}if(!$e(w)||!he(v))return o?ki:c;let y=`${v}__${c}`;hi(f)||(y=`${y}__${JSON.stringify(f)}`);let E=l.get(y);return E||(E=new Intl.DateTimeFormat(v,yt({},w,f)),l.set(y,E)),m?E.formatToParts(d):E.format(d)}const su=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function va(...t){const[e,n,o,r]=t,i=Be();let s=Be(),l;if(he(e)){const c=e.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!c)throw pn(lt.INVALID_ISO_DATE_ARGUMENT);const d=c[3]?c[3].trim().startsWith("T")?`${c[1].trim()}${c[3].trim()}`:`${c[1].trim()}T${c[3].trim()}`:c[1].trim();l=new Date(d);try{l.toISOString()}catch{throw pn(lt.INVALID_ISO_DATE_ARGUMENT)}}else if(jg(e)){if(isNaN(e.getTime()))throw pn(lt.INVALID_DATE_ARGUMENT);l=e}else if(at(e))l=e;else throw pn(lt.INVALID_ARGUMENT);return he(n)?i.key=n:$e(n)&&Object.keys(n).forEach(c=>{su.includes(c)?s[c]=n[c]:i[c]=n[c]}),he(o)?i.locale=o:$e(o)&&(s=o),$e(r)&&(s=r),[i.key||"",l,i,s]}function au(t,e,n){const o=t;for(const r in n){const i=`${e}__${r}`;o.__datetimeFormatters.has(i)&&o.__datetimeFormatters.delete(i)}}function lu(t,...e){const{numberFormats:n,unresolving:o,fallbackLocale:r,onWarn:i,localeFallbacker:s}=t,{__numberFormatters:l}=t;if(process.env.NODE_ENV!=="production"&&!ru.numberFormat)return i(ho(Tt.CANNOT_FORMAT_NUMBER)),Si;const[c,d,u,f]=Ta(...e),p=Ke(u.missingWarn)?u.missingWarn:t.missingWarn,h=Ke(u.fallbackWarn)?u.fallbackWarn:t.fallbackWarn,m=!!u.part,b=xa(t,u),g=s(t,r,b);if(!he(c)||c==="")return new Intl.NumberFormat(b,f).format(d);let x={},v,w=null,T=b,M=null;const A="number format";for(let S=0;S<g.length;S++){if(v=M=g[S],process.env.NODE_ENV!=="production"&&b!==v&&Ni(h,c)&&i(ho(Tt.FALLBACK_TO_NUMBER_FORMAT,{key:c,target:v})),process.env.NODE_ENV!=="production"&&b!==v){const D=t.__v_emitter;D&&D.emit("fallback",{type:A,key:c,from:T,to:M,groupId:`${A}:${c}`})}if(x=n[v]||{},w=x[c],$e(w))break;wa(t,c,v,p,A),T=M}if(!$e(w)||!he(v))return o?ki:c;let y=`${v}__${c}`;hi(f)||(y=`${y}__${JSON.stringify(f)}`);let E=l.get(y);return E||(E=new Intl.NumberFormat(v,yt({},w,f)),l.set(y,E)),m?E.formatToParts(d):E.format(d)}const cu=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function Ta(...t){const[e,n,o,r]=t,i=Be();let s=Be();if(!at(e))throw pn(lt.INVALID_ARGUMENT);const l=e;return he(n)?i.key=n:$e(n)&&Object.keys(n).forEach(c=>{cu.includes(c)?s[c]=n[c]:i[c]=n[c]}),he(o)?i.locale=o:$e(o)&&(s=o),$e(r)&&(s=r),[i.key||"",l,i,s]}function du(t,e,n){const o=t;for(const r in n){const i=`${e}__${r}`;o.__numberFormatters.has(i)&&o.__numberFormatters.delete(i)}}zb();function Ny(){return uu().__VUE_DEVTOOLS_GLOBAL_HOOK__}function uu(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const Cy=typeof Proxy=="function",vy="devtools-plugin:setup",Ty="plugin:settings:set";let Po,za;function zy(){var t;return Po!==void 0||(typeof window<"u"&&window.performance?(Po=!0,za=window.performance):typeof globalThis<"u"&&(!((t=globalThis.perf_hooks)===null||t===void 0)&&t.performance)?(Po=!0,za=globalThis.perf_hooks.performance):Po=!1),Po}function _y(){return zy()?za.now():Date.now()}class Ay{constructor(e,n){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=n;const o={};if(e.settings)for(const s in e.settings){const l=e.settings[s];o[s]=l.defaultValue}const r=`__vue-devtools-plugin-settings__${e.id}`;let i=Object.assign({},o);try{const s=localStorage.getItem(r),l=JSON.parse(s);Object.assign(i,l)}catch{}this.fallbacks={getSettings(){return i},setSettings(s){try{localStorage.setItem(r,JSON.stringify(s))}catch{}i=s},now(){return _y()}},n&&n.on(Ty,(s,l)=>{s===this.plugin.id&&this.fallbacks.setSettings(l)}),this.proxiedOn=new Proxy({},{get:(s,l)=>this.target?this.target.on[l]:(...c)=>{this.onQueue.push({method:l,args:c})}}),this.proxiedTarget=new Proxy({},{get:(s,l)=>this.target?this.target[l]:l==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(l)?(...c)=>(this.targetQueue.push({method:l,args:c,resolve:()=>{}}),this.fallbacks[l](...c)):(...c)=>new Promise(d=>{this.targetQueue.push({method:l,args:c,resolve:d})})})}async setRealTarget(e){this.target=e;for(const n of this.onQueue)this.target.on[n.method](...n.args);for(const n of this.targetQueue)n.resolve(await this.target[n.method](...n.args))}}function My(t,e){const n=t,o=uu(),r=Ny(),i=Cy&&n.enableEarlyProxy;if(r&&(o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!i))r.emit(vy,t,e);else{const s=i?new Ay(n,r):null;(o.__VUE_DEVTOOLS_PLUGINS__=o.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:n,setupFn:e,proxy:s}),s&&e(s.proxiedTarget)}}const Iy="9.14.5";function Oy(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(pr().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(pr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}const fu=Tt.__EXTEND_POINT__,Nn=mi(fu),Mt={FALLBACK_TO_ROOT:fu,NOT_SUPPORTED_PRESERVE:Nn(),NOT_SUPPORTED_FORMATTER:Nn(),NOT_SUPPORTED_PRESERVE_DIRECTIVE:Nn(),NOT_SUPPORTED_GET_CHOICE_INDEX:Nn(),COMPONENT_NAME_LEGACY_COMPATIBLE:Nn(),NOT_FOUND_PARENT_SCOPE:Nn(),IGNORE_OBJ_FLATTEN:Nn(),NOTICE_DROP_ALLOW_COMPOSITION:Nn(),NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG:Nn()},Dy={[Mt.FALLBACK_TO_ROOT]:"Fall back to {type} '{key}' with root locale.",[Mt.NOT_SUPPORTED_PRESERVE]:"Not supported 'preserve'.",[Mt.NOT_SUPPORTED_FORMATTER]:"Not supported 'formatter'.",[Mt.NOT_SUPPORTED_PRESERVE_DIRECTIVE]:"Not supported 'preserveDirectiveContent'.",[Mt.NOT_SUPPORTED_GET_CHOICE_INDEX]:"Not supported 'getChoiceIndex'.",[Mt.COMPONENT_NAME_LEGACY_COMPATIBLE]:"Component name legacy compatible: '{name}' -> 'i18n'",[Mt.NOT_FOUND_PARENT_SCOPE]:"Not found parent scope. use the global scope.",[Mt.IGNORE_OBJ_FLATTEN]:"Ignore object flatten: '{key}' key has an string value",[Mt.NOTICE_DROP_ALLOW_COMPOSITION]:"'allowComposition' option will be dropped in the next major version. For more information, please see 👉 https://tinyurl.com/2p97mcze",[Mt.NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG]:"'translateExistCompatible' option will be dropped in the next major version."};function Ci(t,...e){return ga(Dy[t],...e)}const pu=lt.__EXTEND_POINT__,It=mi(pu),Je={UNEXPECTED_RETURN_TYPE:pu,INVALID_ARGUMENT:It(),MUST_BE_CALL_SETUP_TOP:It(),NOT_INSTALLED:It(),NOT_AVAILABLE_IN_LEGACY_MODE:It(),REQUIRED_VALUE:It(),INVALID_VALUE:It(),CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:It(),NOT_INSTALLED_WITH_PROVIDE:It(),UNEXPECTED_ERROR:It(),NOT_COMPATIBLE_LEGACY_VUE_I18N:It(),BRIDGE_SUPPORT_VUE_2_ONLY:It(),MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION:It(),NOT_AVAILABLE_COMPOSITION_IN_LEGACY:It(),__EXTEND_POINT__:It()};function Cn(t,...e){return Io(t,null,process.env.NODE_ENV!=="production"?{messages:Ry,args:e}:void 0)}const Ry={[Je.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[Je.INVALID_ARGUMENT]:"Invalid argument",[Je.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[Je.NOT_INSTALLED]:"Need to install with `app.use` function",[Je.UNEXPECTED_ERROR]:"Unexpected error",[Je.NOT_AVAILABLE_IN_LEGACY_MODE]:"Not available in legacy mode",[Je.REQUIRED_VALUE]:"Required in value: {0}",[Je.INVALID_VALUE]:"Invalid value",[Je.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[Je.NOT_INSTALLED_WITH_PROVIDE]:"Need to install with `provide` function",[Je.NOT_COMPATIBLE_LEGACY_VUE_I18N]:"Not compatible legacy VueI18n.",[Je.BRIDGE_SUPPORT_VUE_2_ONLY]:"vue-i18n-bridge support Vue 2.x only",[Je.MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION]:"Must define ‘i18n’ option or custom block in Composition API with using local scope in Legacy API mode",[Je.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]:"Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly"},_a=fn("__translateVNode"),Aa=fn("__datetimeParts"),Ma=fn("__numberParts"),br=fn("__enableEmitter"),Ia=fn("__disableEmitter"),Py=fn("__setPluralRules"),Ly=fn("__injectWithOption"),Oa=fn("__dispose");function yr(t){if(!Re(t)||jt(t))return t;for(const e in t)if(nn(t,e))if(!e.includes("."))Re(t[e])&&yr(t[e]);else{const n=e.split("."),o=n.length-1;let r=t,i=!1;for(let s=0;s<o;s++){if(n[s]==="__proto__")throw new Error(`unsafe key: ${n[s]}`);if(n[s]in r||(r[n[s]]=Be()),!Re(r[n[s]])){process.env.NODE_ENV!=="production"&&un(Ci(Mt.IGNORE_OBJ_FLATTEN,{key:n[s]})),i=!0;break}r=r[n[s]]}if(i||(jt(r)?_d.includes(n[o])||delete t[e]:(r[n[o]]=t[e],delete t[e])),!jt(r)){const s=r[n[o]];Re(s)&&yr(s)}}return t}function hu(t,e){const{messages:n,__i18n:o,messageResolver:r,flatJson:i}=e,s=$e(n)?n:tt(o)?Be():{[t]:Be()};if(tt(o)&&o.forEach(l=>{if("locale"in l&&"resource"in l){const{locale:c,resource:d}=l;c?(s[c]=s[c]||Be(),bi(d,s[c])):bi(d,s)}else he(l)&&bi(JSON.parse(l),s)}),r==null&&i)for(const l in s)nn(s,l)&&yr(s[l]);return s}function mu(t){return t.type}function $y(t,e,n){let o=Re(e.messages)?e.messages:Be();"__i18nGlobal"in n&&(o=hu(t.locale.value,{messages:o,__i18n:n.__i18nGlobal}));const r=Object.keys(o);r.length&&r.forEach(i=>{t.mergeLocaleMessage(i,o[i])});{if(Re(e.datetimeFormats)){const i=Object.keys(e.datetimeFormats);i.length&&i.forEach(s=>{t.mergeDateTimeFormat(s,e.datetimeFormats[s])})}if(Re(e.numberFormats)){const i=Object.keys(e.numberFormats);i.length&&i.forEach(s=>{t.mergeNumberFormat(s,e.numberFormats[s])})}}}function gu(t){return a.createVNode(a.Text,null,t,0)}const bu="__INTLIFY_META__",yu=()=>[],Vy=()=>!1;let xu=0;function Eu(t){return((e,n,o,r)=>t(n,o,a.getCurrentInstance()||void 0,r))}const By=()=>{const t=a.getCurrentInstance();let e=null;return t&&(e=mu(t)[bu])?{[bu]:e}:null};function ku(t={},e){const{__root:n,__injectWithOption:o}=t,r=n===void 0,i=t.flatJson,s=wn?a.ref:a.shallowRef,l=!!t.translateExistCompatible;process.env.NODE_ENV!=="production"&&l&&sd(Ci(Mt.NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG));let c=Ke(t.inheritLocale)?t.inheritLocale:!0;const d=s(n&&c?n.locale.value:he(t.locale)?t.locale:wi),u=s(n&&c?n.fallbackLocale.value:he(t.fallbackLocale)||tt(t.fallbackLocale)||$e(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:d.value),f=s(hu(d.value,t)),p=s($e(t.datetimeFormats)?t.datetimeFormats:{[d.value]:{}}),h=s($e(t.numberFormats)?t.numberFormats:{[d.value]:{}});let m=n?n.missingWarn:Ke(t.missingWarn)||pi(t.missingWarn)?t.missingWarn:!0,b=n?n.fallbackWarn:Ke(t.fallbackWarn)||pi(t.fallbackWarn)?t.fallbackWarn:!0,g=n?n.fallbackRoot:Ke(t.fallbackRoot)?t.fallbackRoot:!0,x=!!t.fallbackFormat,v=qe(t.missing)?t.missing:null,w=qe(t.missing)?Eu(t.missing):null,T=qe(t.postTranslation)?t.postTranslation:null,M=n?n.warnHtmlMessage:Ke(t.warnHtmlMessage)?t.warnHtmlMessage:!0,A=!!t.escapeParameter;const y=n?n.modifiers:$e(t.modifiers)?t.modifiers:{};let E=t.pluralRules||n&&n.pluralRules,S;S=(()=>{r&&Hd(null);const B={version:Iy,locale:d.value,fallbackLocale:u.value,messages:f.value,modifiers:y,pluralRules:E,missing:w===null?void 0:w,missingWarn:m,fallbackWarn:b,fallbackFormat:x,unresolving:!0,postTranslation:T===null?void 0:T,warnHtmlMessage:M,escapeParameter:A,messageResolver:t.messageResolver,messageCompiler:t.messageCompiler,__meta:{framework:"vue"}};B.datetimeFormats=p.value,B.numberFormats=h.value,B.__datetimeFormatters=$e(S)?S.__datetimeFormatters:void 0,B.__numberFormatters=$e(S)?S.__numberFormatters:void 0,process.env.NODE_ENV!=="production"&&(B.__v_emitter=$e(S)?S.__v_emitter:void 0);const ee=py(B);return r&&Hd(ee),ee})(),gr(S,d.value,u.value);function W(){return[d.value,u.value,f.value,p.value,h.value]}const z=a.computed({get:()=>d.value,set:B=>{d.value=B,S.locale=d.value}}),P=a.computed({get:()=>u.value,set:B=>{u.value=B,S.fallbackLocale=u.value,gr(S,d.value,B)}}),V=a.computed(()=>f.value),j=a.computed(()=>p.value),L=a.computed(()=>h.value);function H(){return qe(T)?T:null}function Q(B){T=B,S.postTranslation=B}function G(){return v}function se(B){B!==null&&(w=Eu(B)),v=B,S.missing=w}function Z(B,ee){return B!=="translate"||!ee.resolvedMessage}const X=(B,ee,Me,$,F,re)=>{W();let ae;try{process.env.NODE_ENV,r||(S.fallbackContext=n?fy():void 0),ae=B(S)}finally{process.env.NODE_ENV,r||(S.fallbackContext=void 0)}if(Me!=="translate exists"&&at(ae)&&ae===ki||Me==="translate exists"&&!ae){const[ke,Fe]=ee();if(process.env.NODE_ENV!=="production"&&n&&he(ke)&&Z(Me,Fe)&&(g&&(Ni(b,ke)||Gd(m,ke))&&un(Ci(Mt.FALLBACK_TO_ROOT,{key:ke,type:Me})),process.env.NODE_ENV!=="production")){const{__v_emitter:st}=S;st&&g&&st.emit("fallback",{type:Me,key:ke,to:"global",groupId:`${Me}:${ke}`})}return n&&g?$(n):F(ke)}else{if(re(ae))return ae;throw Cn(Je.UNEXPECTED_RETURN_TYPE)}};function J(...B){return X(ee=>Reflect.apply(eu,null,[ee,...B]),()=>Ca(...B),"translate",ee=>Reflect.apply(ee.t,ee,[...B]),ee=>ee,ee=>he(ee))}function K(...B){const[ee,Me,$]=B;if($&&!Re($))throw Cn(Je.INVALID_ARGUMENT);return J(ee,Me,yt({resolvedMessage:!0},$||{}))}function Y(...B){return X(ee=>Reflect.apply(iu,null,[ee,...B]),()=>va(...B),"datetime format",ee=>Reflect.apply(ee.d,ee,[...B]),()=>Si,ee=>he(ee))}function ce(...B){return X(ee=>Reflect.apply(lu,null,[ee,...B]),()=>Ta(...B),"number format",ee=>Reflect.apply(ee.n,ee,[...B]),()=>Si,ee=>he(ee))}function Ee(B){return B.map(ee=>he(ee)||at(ee)||Ke(ee)?gu(String(ee)):ee)}const Le={normalize:Ee,interpolate:B=>B,type:"vnode"};function C(...B){return X(ee=>{let Me;const $=ee;try{$.processor=Le,Me=Reflect.apply(eu,null,[$,...B])}finally{$.processor=null}return Me},()=>Ca(...B),"translate",ee=>ee[_a](...B),ee=>[gu(ee)],ee=>tt(ee))}function N(...B){return X(ee=>Reflect.apply(lu,null,[ee,...B]),()=>Ta(...B),"number format",ee=>ee[Ma](...B),yu,ee=>he(ee)||tt(ee))}function O(...B){return X(ee=>Reflect.apply(iu,null,[ee,...B]),()=>va(...B),"datetime format",ee=>ee[Aa](...B),yu,ee=>he(ee)||tt(ee))}function k(B){E=B,S.pluralRules=E}function U(B,ee){return X(()=>{if(!B)return!1;const Me=he(ee)?ee:d.value,$=ve(Me),F=S.messageResolver($,B);return l?F!=null:jt(F)||Ut(F)||he(F)},()=>[B],"translate exists",Me=>Reflect.apply(Me.te,Me,[B,ee]),Vy,Me=>Ke(Me))}function te(B){let ee=null;const Me=Rd(S,u.value,d.value);for(let $=0;$<Me.length;$++){const F=f.value[Me[$]]||{},re=S.messageResolver(F,B);if(re!=null){ee=re;break}}return ee}function me(B){const ee=te(B);return ee??(n?n.tm(B)||{}:{})}function ve(B){return f.value[B]||{}}function Ve(B,ee){if(i){const Me={[B]:ee};for(const $ in Me)nn(Me,$)&&yr(Me[$]);ee=Me[B]}f.value[B]=ee,S.messages=f.value}function Ce(B,ee){f.value[B]=f.value[B]||{};const Me={[B]:ee};if(i)for(const $ in Me)nn(Me,$)&&yr(Me[$]);ee=Me[B],bi(ee,f.value[B]),S.messages=f.value}function _(B){return p.value[B]||{}}function I(B,ee){p.value[B]=ee,S.datetimeFormats=p.value,au(S,B,ee)}function q(B,ee){p.value[B]=yt(p.value[B]||{},ee),S.datetimeFormats=p.value,au(S,B,ee)}function fe(B){return h.value[B]||{}}function Ae(B,ee){h.value[B]=ee,S.numberFormats=h.value,du(S,B,ee)}function Te(B,ee){h.value[B]=yt(h.value[B]||{},ee),S.numberFormats=h.value,du(S,B,ee)}xu++,n&&wn&&(a.watch(n.locale,B=>{c&&(d.value=B,S.locale=B,gr(S,d.value,u.value))}),a.watch(n.fallbackLocale,B=>{c&&(u.value=B,S.fallbackLocale=B,gr(S,d.value,u.value))}));const we={id:xu,locale:z,fallbackLocale:P,get inheritLocale(){return c},set inheritLocale(B){c=B,B&&n&&(d.value=n.locale.value,u.value=n.fallbackLocale.value,gr(S,d.value,u.value))},get availableLocales(){return Object.keys(f.value).sort()},messages:V,get modifiers(){return y},get pluralRules(){return E||{}},get isGlobal(){return r},get missingWarn(){return m},set missingWarn(B){m=B,S.missingWarn=m},get fallbackWarn(){return b},set fallbackWarn(B){b=B,S.fallbackWarn=b},get fallbackRoot(){return g},set fallbackRoot(B){g=B},get fallbackFormat(){return x},set fallbackFormat(B){x=B,S.fallbackFormat=x},get warnHtmlMessage(){return M},set warnHtmlMessage(B){M=B,S.warnHtmlMessage=B},get escapeParameter(){return A},set escapeParameter(B){A=B,S.escapeParameter=B},t:J,getLocaleMessage:ve,setLocaleMessage:Ve,mergeLocaleMessage:Ce,getPostTranslationHandler:H,setPostTranslationHandler:Q,getMissingHandler:G,setMissingHandler:se,[Py]:k};return we.datetimeFormats=j,we.numberFormats=L,we.rt=K,we.te=U,we.tm=me,we.d=Y,we.n=ce,we.getDateTimeFormat=_,we.setDateTimeFormat=I,we.mergeDateTimeFormat=q,we.getNumberFormat=fe,we.setNumberFormat=Ae,we.mergeNumberFormat=Te,we[Ly]=o,we[_a]=C,we[Aa]=O,we[Ma]=N,process.env.NODE_ENV!=="production"&&(we[br]=B=>{S.__v_emitter=B},we[Ia]=()=>{S.__v_emitter=void 0}),we}const Da={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:t=>t==="parent"||t==="global",default:"parent"},i18n:{type:Object}};function Fy({slots:t},e){return e.length===1&&e[0]==="default"?(t.default?t.default():[]).reduce((o,r)=>[...o,...r.type===a.Fragment?r.children:[r]],[]):e.reduce((n,o)=>{const r=t[o];return r&&(n[o]=r()),n},Be())}function wu(t){return a.Fragment}yt({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:t=>at(t)||!isNaN(t)}},Da);function jy(t){return tt(t)&&!he(t[0])}function Su(t,e,n,o){const{slots:r,attrs:i}=e;return()=>{const s={part:!0};let l=Be();t.locale&&(s.locale=t.locale),he(t.format)?s.key=t.format:Re(t.format)&&(he(t.format.key)&&(s.key=t.format.key),l=Object.keys(t.format).reduce((p,h)=>n.includes(h)?yt(Be(),p,{[h]:t.format[h]}):p,Be()));const c=o(t.value,s,l);let d=[s.key];tt(c)?d=c.map((p,h)=>{const m=r[p.type],b=m?m({[p.type]:p.value,index:h,parts:c}):[p.value];return jy(b)&&(b[0].key=`${p.type}-${h}`),b}):he(c)&&(d=[c]);const u=yt(Be(),i),f=he(t.tag)||Re(t.tag)?t.tag:wu();return a.h(f,u,d)}}yt({value:{type:Number,required:!0},format:{type:[String,Object]}},Da),yt({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},Da);const Ra={"vue-devtools-plugin-vue-i18n":"Vue I18n devtools","vue-i18n-resource-inspector":"I18n Resources","vue-i18n-timeline":"Vue I18n"},Uy={"vue-i18n-resource-inspector":"Search for scopes ..."},Hy={"vue-i18n-timeline":16764185},Nu="vue-i18n: composer properties";let Pa;async function Wy(t,e){return new Promise((n,o)=>{try{My({id:"vue-devtools-plugin-vue-i18n",label:Ra["vue-devtools-plugin-vue-i18n"],packageName:"vue-i18n",homepage:"https://vue-i18n.intlify.dev",logo:"https://vue-i18n.intlify.dev/vue-i18n-devtools-logo.png",componentStateTypes:[Nu],app:t},r=>{Pa=r,r.on.visitComponentTree(({componentInstance:s,treeNode:l})=>{Gy(s,l,e)}),r.on.inspectComponent(({componentInstance:s,instanceData:l})=>{s.vnode.el&&s.vnode.el.__VUE_I18N__&&l&&(e.mode==="legacy"?s.vnode.el.__VUE_I18N__!==e.global.__composer&&vu(l,s.vnode.el.__VUE_I18N__):vu(l,s.vnode.el.__VUE_I18N__))}),r.addInspector({id:"vue-i18n-resource-inspector",label:Ra["vue-i18n-resource-inspector"],icon:"language",treeFilterPlaceholder:Uy["vue-i18n-resource-inspector"]}),r.on.getInspectorTree(s=>{s.app===t&&s.inspectorId==="vue-i18n-resource-inspector"&&Yy(s,e)});const i=new Map;r.on.getInspectorState(async s=>{if(s.app===t&&s.inspectorId==="vue-i18n-resource-inspector")if(r.unhighlightElement(),Zy(s,e),s.nodeId==="global"){if(!i.has(s.app)){const[l]=await r.getComponentInstances(s.app);i.set(s.app,l)}r.highlightElement(i.get(s.app))}else{const l=Qy(s.nodeId,e);l&&r.highlightElement(l)}}),r.on.editInspectorState(s=>{s.app===t&&s.inspectorId==="vue-i18n-resource-inspector"&&t1(s,e)}),r.addTimelineLayer({id:"vue-i18n-timeline",label:Ra["vue-i18n-timeline"],color:Hy["vue-i18n-timeline"]}),n(!0)})}catch(r){console.error(r),o(!1)}})}function Cu(t){return t.type.name||t.type.displayName||t.type.__file||"Anonymous"}function Gy(t,e,n){const o=n.mode==="composition"?n.global:n.global.__composer;if(t&&t.vnode.el&&t.vnode.el.__VUE_I18N__&&t.vnode.el.__VUE_I18N__!==o){const r={label:`i18n (${Cu(t)} Scope)`,textColor:0,backgroundColor:16764185};e.tags.push(r)}}function vu(t,e){const n=Nu;t.state.push({type:n,key:"locale",editable:!0,value:e.locale.value}),t.state.push({type:n,key:"availableLocales",editable:!1,value:e.availableLocales}),t.state.push({type:n,key:"fallbackLocale",editable:!0,value:e.fallbackLocale.value}),t.state.push({type:n,key:"inheritLocale",editable:!0,value:e.inheritLocale}),t.state.push({type:n,key:"messages",editable:!1,value:La(e.messages.value)}),t.state.push({type:n,key:"datetimeFormats",editable:!1,value:e.datetimeFormats.value}),t.state.push({type:n,key:"numberFormats",editable:!1,value:e.numberFormats.value})}function La(t){const e={};return Object.keys(t).forEach(n=>{const o=t[n];qe(o)&&"source"in o?e[n]=Xy(o):jt(o)&&o.loc&&o.loc.source?e[n]=o.loc.source:Re(o)?e[n]=La(o):e[n]=o}),e}const qy={"<":"<",">":">",'"':""","&":"&"};function Ky(t){return t.replace(/[<>"&]/g,Jy)}function Jy(t){return qy[t]||t}function Xy(t){return{_custom:{type:"function",display:`<span>ƒ</span> ${t.source?`("${Ky(t.source)}")`:"(?)"}`}}}function Yy(t,e){t.rootNodes.push({id:"global",label:"Global Scope"});const n=e.mode==="composition"?e.global:e.global.__composer;for(const[o,r]of e.__instances){const i=e.mode==="composition"?r:r.__composer;n!==i&&t.rootNodes.push({id:i.id.toString(),label:`${Cu(o)} Scope`})}}function Qy(t,e){let n=null;if(t!=="global"){for(const[o,r]of e.__instances.entries())if(r.id.toString()===t){n=o;break}}return n}function Tu(t,e){if(t==="global")return e.mode==="composition"?e.global:e.global.__composer;{const n=Array.from(e.__instances.values()).find(o=>o.id.toString()===t);return n?e.mode==="composition"?n:n.__composer:null}}function Zy(t,e){const n=Tu(t.nodeId,e);return n&&(t.state=e1(n)),null}function e1(t){const e={},n="Locale related info",o=[{type:n,key:"locale",editable:!0,value:t.locale.value},{type:n,key:"fallbackLocale",editable:!0,value:t.fallbackLocale.value},{type:n,key:"availableLocales",editable:!1,value:t.availableLocales},{type:n,key:"inheritLocale",editable:!0,value:t.inheritLocale}];e[n]=o;const r="Locale messages info",i=[{type:r,key:"messages",editable:!1,value:La(t.messages.value)}];e[r]=i;{const s="Datetime formats info",l=[{type:s,key:"datetimeFormats",editable:!1,value:t.datetimeFormats.value}];e[s]=l;const c="Datetime formats info",d=[{type:c,key:"numberFormats",editable:!1,value:t.numberFormats.value}];e[c]=d}return e}function $a(t,e){if(Pa){let n;e&&"groupId"in e&&(n=e.groupId,delete e.groupId),Pa.addTimelineEvent({layerId:"vue-i18n-timeline",event:{title:t,groupId:n,time:Date.now(),meta:{},data:e||{},logType:t==="compile-error"?"error":t==="fallback"||t==="missing"?"warning":"default"}})}}function t1(t,e){const n=Tu(t.nodeId,e);if(n){const[o]=t.path;o==="locale"&&he(t.state.value)?n.locale.value=t.state.value:o==="fallbackLocale"&&(he(t.state.value)||tt(t.state.value)||Re(t.state.value))?n.fallbackLocale.value=t.state.value:o==="inheritLocale"&&Ke(t.state.value)&&(n.inheritLocale=t.state.value)}}const n1=fn("global-vue-i18n");function o1(t={},e){const n=Ke(t.globalInjection)?t.globalInjection:!0,o=!0,r=new Map,[i,s]=r1(t),l=fn(process.env.NODE_ENV!=="production"?"vue-i18n":"");process.env.NODE_ENV;function c(f){return r.get(f)||null}function d(f,p){r.set(f,p)}function u(f){r.delete(f)}{const f={get mode(){return"composition"},get allowComposition(){return o},async install(p,...h){if(process.env.NODE_ENV!=="production"&&(p.__VUE_I18N__=f),p.__VUE_I18N_SYMBOL__=l,p.provide(p.__VUE_I18N_SYMBOL__,f),$e(h[0])){const g=h[0];f.__composerExtend=g.__composerExtend,f.__vueI18nExtend=g.__vueI18nExtend}let m=null;n&&(m=f1(p,f.global));const b=p.unmount;if(p.unmount=()=>{m&&m(),f.dispose(),b()},process.env.NODE_ENV!=="production"){if(!await Wy(p,f))throw Cn(Je.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);const x=pd();{const v=s;v[br]&&v[br](x)}x.on("*",$a)}},get global(){return s},dispose(){i.stop()},__instances:r,__getInstance:c,__setInstance:d,__deleteInstance:u};return f}}function rn(t={}){const e=a.getCurrentInstance();if(e==null)throw Cn(Je.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw Cn(Je.NOT_INSTALLED);const n=i1(e),o=a1(n),r=mu(e),i=s1(t,r);if(i==="global")return $y(o,t,r),o;if(i==="parent"){let c=l1(n,e,t.__useComponent);return c==null&&(process.env.NODE_ENV!=="production"&&un(Ci(Mt.NOT_FOUND_PARENT_SCOPE)),c=o),c}const s=n;let l=s.__getInstance(e);if(l==null){const c=yt({},t);"__i18n"in r&&(c.__i18n=r.__i18n),o&&(c.__root=o),l=ku(c),s.__composerExtend&&(l[Oa]=s.__composerExtend(l)),d1(s,e,l),s.__setInstance(e,l)}return l}function r1(t,e,n){const o=a.effectScope();{const r=o.run(()=>ku(t));if(r==null)throw Cn(Je.UNEXPECTED_ERROR);return[o,r]}}function i1(t){{const e=a.inject(t.isCE?n1:t.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw Cn(t.isCE?Je.NOT_INSTALLED_WITH_PROVIDE:Je.UNEXPECTED_ERROR);return e}}function s1(t,e){return hi(t)?"__i18n"in e?"local":"global":t.useScope?t.useScope:"local"}function a1(t){return t.mode==="composition"?t.global:t.global.__composer}function l1(t,e,n=!1){let o=null;const r=e.root;let i=c1(e,n);for(;i!=null;){const s=t;if(t.mode==="composition"&&(o=s.__getInstance(i)),o!=null||r===i)break;i=i.parent}return o}function c1(t,e=!1){return t==null?null:e&&t.vnode.ctx||t.parent}function d1(t,e,n){let o=null;a.onMounted(()=>{if(process.env.NODE_ENV!=="production"&&e.vnode.el){e.vnode.el.__VUE_I18N__=n,o=pd();const r=n;r[br]&&r[br](o),o.on("*",$a)}},e),a.onUnmounted(()=>{const r=n;process.env.NODE_ENV!=="production"&&e.vnode.el&&e.vnode.el.__VUE_I18N__&&(o&&o.off("*",$a),r[Ia]&&r[Ia](),delete e.vnode.el.__VUE_I18N__),t.__deleteInstance(e);const i=r[Oa];i&&(i(),delete r[Oa])},e)}const u1=["locale","fallbackLocale","availableLocales"],zu=["t","rt","d","n","tm","te"];function f1(t,e){const n=Object.create(null);return u1.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i)throw Cn(Je.UNEXPECTED_ERROR);const s=a.isRef(i.value)?{get(){return i.value.value},set(l){i.value.value=l}}:{get(){return i.get&&i.get()}};Object.defineProperty(n,r,s)}),t.config.globalProperties.$i18n=n,zu.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i||!i.value)throw Cn(Je.UNEXPECTED_ERROR);Object.defineProperty(t.config.globalProperties,`$${r}`,i)}),()=>{delete t.config.globalProperties.$i18n,zu.forEach(r=>{delete t.config.globalProperties[`$${r}`]})}}if(Oy(),__INTLIFY_JIT_COMPILATION__?Vd(yy):Vd(by),ly(jb),cy(Rd),process.env.NODE_ENV!=="production"){const t=pr();t.__INTLIFY__=!0,Yb(t.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}process.env.NODE_ENV;const _u="zcode-user-settings";function Lo(){try{const t=localStorage.getItem(_u);return t?JSON.parse(t):{}}catch(t){return console.warn("[ZeroCode] Failed to load user settings:",t),{}}}function Va(t){try{const e=Lo(),n={locale:t.locale??e.locale,cms:t.cms?{...e.cms||{},...t.cms}:e.cms,dev:t.dev?{...e.dev||{},...t.dev}:e.dev};localStorage.setItem(_u,JSON.stringify(n))}catch(e){console.warn("[ZeroCode] Failed to save user settings:",e)}}function p1(t=null){const e=Lo();return e.locale!==void 0?e.locale:t}function Au(){return Lo().cms||{}}function vi(t){const e=Lo();Va({cms:{...e.cms,...t}})}function h1(t,e){return Au()[t]??e}function Mu(){return Lo().dev||{}}function Ba(t){const e=Lo();Va({dev:{...e.dev,...t}})}function m1(t,e){return Mu()[t]??e}const Iu="zcode-dont-show-css-warning-parts";function g1(){try{return sessionStorage.getItem(Iu)==="true"}catch{return!1}}function b1(t){try{sessionStorage.setItem(Iu,String(t))}catch(e){console.warn("[ZeroCode] Failed to save CSS warning setting:",e)}}const y1={class:"zcode-settings-panel-header"},x1={class:"zcode-settings-panel-header-title",role:"heading","aria-level":"3"},E1={class:"zcode-settings-panel-header-actions"},k1=["value","aria-label"],w1={value:"ja"},S1={value:"en"},N1={class:"zcode-settings-panel-content"},C1={key:0},v1={key:0,class:"zcode-setting-item"},T1={class:"zcode-setting-label"},z1=["checked"],_1=["title"],A1={key:0,class:"zcode-setting-description"},M1={key:1,class:"zcode-setting-item"},I1={class:"zcode-setting-label"},O1=["checked"],D1=["title"],R1={key:0,class:"zcode-setting-description"},P1={key:2,class:"zcode-setting-item"},L1={class:"zcode-setting-label"},$1=["checked"],V1=["title"],B1={key:0,class:"zcode-setting-description"},F1={key:3,class:"zcode-setting-item"},j1={class:"zcode-setting-label"},U1=["checked"],H1=["title"],W1={key:0,class:"zcode-setting-description"},G1={key:1,class:"zcode-setting-item"},q1={class:"zcode-setting-info"},Ou=a.defineComponent({__name:"SettingsPanel",props:{isOpen:{type:Boolean},viewMode:{type:String},mode:{type:String},allowDynamicContentInteraction:{type:Boolean},devRightPadding:{type:Boolean},enableContextMenu:{type:Boolean},showSaveConfirm:{type:Boolean}},emits:["close","toggle-dynamic-content","toggle-dev-padding","toggle-context-menu","toggle-save-confirm"],setup(t){const e=t,{locale:n}=rn(),o=a.computed(()=>n.value||"ja");function r(u){const p=u.target.value;n.value=p,Va({locale:p})}const i=a.ref(!1),s=a.ref(!1),l=a.ref(!1),c=a.ref(!1),d=a.computed(()=>e.devRightPadding!==void 0?e.devRightPadding:!1);return(u,f)=>t.isOpen?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-settings-panel-overlay",onClick:f[10]||(f[10]=a.withModifiers(p=>u.$emit("close"),["self"]))},[a.createElementVNode("div",{class:"zcode-settings-panel",onClick:f[9]||(f[9]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",y1,[a.createElementVNode("div",x1,a.toDisplayString(u.$t("settings.title")),1),a.createElementVNode("div",E1,[a.createElementVNode("select",{value:o.value,class:"zcode-language-select","aria-label":u.$t("settings.language.label"),onChange:r},[a.createElementVNode("option",w1,a.toDisplayString(u.$t("settings.language.ja")),1),a.createElementVNode("option",S1,a.toDisplayString(u.$t("settings.language.en")),1)],40,k1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":"$t('common.close')",onClick:f[0]||(f[0]=p=>u.$emit("close"))},[a.createVNode(a.unref(Qe),{size:18})])])]),a.createElementVNode("div",N1,[t.viewMode==="manage"?(a.openBlock(),a.createElementBlock("div",C1,[e.mode==="toolbar"||e.mode===void 0?(a.openBlock(),a.createElementBlock("div",v1,[a.createElementVNode("label",T1,[a.createElementVNode("input",{type:"checkbox",checked:e.allowDynamicContentInteraction??!1,class:"zcode-setting-checkbox",onChange:f[1]||(f[1]=p=>u.$emit("toggle-dynamic-content",p.target.checked))},null,40,z1),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.enableDynamicContent")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[2]||(f[2]=a.withModifiers(p=>i.value=!i.value,["stop"]))},[a.createVNode(a.unref(Vn),{size:16})],8,_1)]),i.value?(a.openBlock(),a.createElementBlock("div",A1,a.toDisplayString(u.$t("settings.enableDynamicContentDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),e.mode==="toolbar"||e.mode===void 0?(a.openBlock(),a.createElementBlock("div",M1,[a.createElementVNode("label",I1,[a.createElementVNode("input",{type:"checkbox",checked:d.value,class:"zcode-setting-checkbox",onChange:f[3]||(f[3]=p=>u.$emit("toggle-dev-padding",p.target.checked))},null,40,O1),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.devRightPadding")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[4]||(f[4]=a.withModifiers(p=>s.value=!s.value,["stop"]))},[a.createVNode(a.unref(Vn),{size:16})],8,D1)]),s.value?(a.openBlock(),a.createElementBlock("div",R1,a.toDisplayString(u.$t("settings.devRightPaddingDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),e.mode==="toolbar"||e.mode===void 0?(a.openBlock(),a.createElementBlock("div",P1,[a.createElementVNode("label",L1,[a.createElementVNode("input",{type:"checkbox",checked:e.enableContextMenu??!1,class:"zcode-setting-checkbox",onChange:f[5]||(f[5]=p=>u.$emit("toggle-context-menu",p.target.checked))},null,40,$1),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.enableContextMenu")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[6]||(f[6]=a.withModifiers(p=>l.value=!l.value,["stop"]))},[a.createVNode(a.unref(Vn),{size:16})],8,V1)]),l.value?(a.openBlock(),a.createElementBlock("div",B1,a.toDisplayString(u.$t("settings.enableContextMenuDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),e.mode==="dev-tabs"?(a.openBlock(),a.createElementBlock("div",F1,[a.createElementVNode("label",j1,[a.createElementVNode("input",{type:"checkbox",checked:e.showSaveConfirm??!0,class:"zcode-setting-checkbox",onChange:f[7]||(f[7]=p=>u.$emit("toggle-save-confirm",p.target.checked))},null,40,U1),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.showSaveConfirm")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[8]||(f[8]=a.withModifiers(p=>c.value=!c.value,["stop"]))},[a.createVNode(a.unref(Vn),{size:16})],8,H1)]),c.value?(a.openBlock(),a.createElementBlock("div",W1,a.toDisplayString(u.$t("settings.showSaveConfirmDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)])):(a.openBlock(),a.createElementBlock("div",G1,[a.createElementVNode("div",q1,a.toDisplayString(u.$t("settings.previewModeInfo")),1)]))])])])):a.createCommentVNode("",!0)}});function pt(t){this.content=t}pt.prototype={constructor:pt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var o=n&&n!=t?this.remove(n):this,r=o.find(t),i=o.content.slice();return r==-1?i.push(n||t,e):(i[r+1]=e,n&&(i[r]=n)),new pt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new pt(n)},addToStart:function(t,e){return new pt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new pt(n)},addBefore:function(t,e,n){var o=this.remove(e),r=o.content.slice(),i=o.find(t);return r.splice(i==-1?r.length:i,0,e,n),new pt(r)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=pt.from(t),t.size?new pt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=pt.from(t),t.size?new pt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=pt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},pt.from=function(t){if(t instanceof pt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new pt(e)};function Du(t,e,n){for(let o=0;;o++){if(o==t.childCount||o==e.childCount)return t.childCount==e.childCount?null:n;let r=t.child(o),i=e.child(o);if(r==i){n+=r.nodeSize;continue}if(!r.sameMarkup(i))return n;if(r.isText&&r.text!=i.text){for(let s=0;r.text[s]==i.text[s];s++)n++;return n}if(r.content.size||i.content.size){let s=Du(r.content,i.content,n+1);if(s!=null)return s}n+=r.nodeSize}}function Ru(t,e,n,o){for(let r=t.childCount,i=e.childCount;;){if(r==0||i==0)return r==i?null:{a:n,b:o};let s=t.child(--r),l=e.child(--i),c=s.nodeSize;if(s==l){n-=c,o-=c;continue}if(!s.sameMarkup(l))return{a:n,b:o};if(s.isText&&s.text!=l.text){let d=0,u=Math.min(s.text.length,l.text.length);for(;d<u&&s.text[s.text.length-d-1]==l.text[l.text.length-d-1];)d++,n--,o--;return{a:n,b:o}}if(s.content.size||l.content.size){let d=Ru(s.content,l.content,n-1,o-1);if(d)return d}n-=c,o-=c}}class ne{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,n,o,r=0,i){for(let s=0,l=0;l<n;s++){let c=this.content[s],d=l+c.nodeSize;if(d>e&&o(c,r+l,i||null,s)!==!1&&c.content.size){let u=l+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,n-u),o,r+u)}l=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,o,r){let i="",s=!0;return this.nodesBetween(e,n,(l,c)=>{let d=l.isText?l.text.slice(Math.max(e,c)-c,n-c):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&d||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=d},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,o=e.firstChild,r=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(o)&&(r[r.length-1]=n.withText(n.text+o.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new ne(r,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let o=[],r=0;if(n>e)for(let i=0,s=0;s<n;i++){let l=this.content[i],c=s+l.nodeSize;c>e&&((s<e||c>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),o.push(l),r+=l.nodeSize),s=c}return new ne(o,r)}cutByIndex(e,n){return e==n?ne.empty:e==0&&n==this.content.length?this:new ne(this.content.slice(e,n))}replaceChild(e,n){let o=this.content[e];if(o==n)return this;let r=this.content.slice(),i=this.size+n.nodeSize-o.nodeSize;return r[e]=n,new ne(r,i)}addToStart(e){return new ne([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ne(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,o=0;n<this.content.length;n++){let r=this.content[n];e(r,o,n),o+=r.nodeSize}}findDiffStart(e,n=0){return Du(this,e,n)}findDiffEnd(e,n=this.size,o=e.size){return Ru(this,e,n,o)}findIndex(e){if(e==0)return Ti(0,e);if(e==this.size)return Ti(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,o=0;;n++){let r=this.child(n),i=o+r.nodeSize;if(i>=e)return i==e?Ti(n+1,i):Ti(n,o);o=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return ne.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new ne(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ne.empty;let n,o=0;for(let r=0;r<e.length;r++){let i=e[r];o+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(n||(n=e.slice(0,r)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new ne(n||e,o)}static from(e){if(!e)return ne.empty;if(e instanceof ne)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ne([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}ne.empty=new ne([],0);const Fa={index:0,offset:0};function Ti(t,e){return Fa.index=t,Fa.offset=e,Fa}function zi(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let o=0;o<t.length;o++)if(!zi(t[o],e[o]))return!1}else{for(let o in t)if(!(o in e)||!zi(t[o],e[o]))return!1;for(let o in e)if(!(o in t))return!1}return!0}let je=class Ac{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,o=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!o&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,r)),n.push(this),o=!0),n&&n.push(i)}}return n||(n=e.slice()),o||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&zi(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[n.type];if(!o)throw new RangeError(`There is no mark type ${n.type} in this schema`);let r=o.create(n.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(n[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ac.none;if(e instanceof Ac)return[e];let n=e.slice();return n.sort((o,r)=>o.type.rank-r.type.rank),n}};je.none=[];class _i extends Error{}class ue{constructor(e,n,o){this.content=e,this.openStart=n,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let o=Lu(this.content,e+this.openStart,n);return o&&new ue(o,this.openStart,this.openEnd)}removeBetween(e,n){return new ue(Pu(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return ue.empty;let o=n.openStart||0,r=n.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ue(ne.fromJSON(e,n.content),o,r)}static maxOpen(e,n=!0){let o=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)r++;return new ue(e,o,r)}}ue.empty=new ue(ne.empty,0,0);function Pu(t,e,n){let{index:o,offset:r}=t.findIndex(e),i=t.maybeChild(o),{index:s,offset:l}=t.findIndex(n);if(r==e||i.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(o!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(o,i.copy(Pu(i.content,e-r-1,n-r-1)))}function Lu(t,e,n,o){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r);if(i==e||s.isText)return o&&!o.canReplace(r,r,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=Lu(s.content,e-i-1,n,s);return l&&t.replaceChild(r,s.copy(l))}function K1(t,e,n){if(n.openStart>t.depth)throw new _i("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new _i("Inconsistent open depths");return $u(t,e,n,0)}function $u(t,e,n,o){let r=t.index(o),i=t.node(o);if(r==e.index(o)&&o<t.depth-n.openStart){let s=$u(t,e,n,o+1);return i.copy(i.content.replaceChild(r,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==o&&e.depth==o){let s=t.parent,l=s.content;return bo(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=J1(n,t);return bo(i,Bu(t,s,l,e,o))}else return bo(i,Ai(t,e,o))}function Vu(t,e){if(!e.type.compatibleContent(t.type))throw new _i("Cannot join "+e.type.name+" onto "+t.type.name)}function ja(t,e,n){let o=t.node(n);return Vu(o,e.node(n)),o}function go(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function xr(t,e,n,o){let r=(e||t).node(n),i=0,s=e?e.index(n):r.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(go(t.nodeAfter,o),i++));for(let l=i;l<s;l++)go(r.child(l),o);e&&e.depth==n&&e.textOffset&&go(e.nodeBefore,o)}function bo(t,e){return t.type.checkContent(e),t.copy(e)}function Bu(t,e,n,o,r){let i=t.depth>r&&ja(t,e,r+1),s=o.depth>r&&ja(n,o,r+1),l=[];return xr(null,t,r,l),i&&s&&e.index(r)==n.index(r)?(Vu(i,s),go(bo(i,Bu(t,e,n,o,r+1)),l)):(i&&go(bo(i,Ai(t,e,r+1)),l),xr(e,n,r,l),s&&go(bo(s,Ai(n,o,r+1)),l)),xr(o,null,r,l),new ne(l)}function Ai(t,e,n){let o=[];if(xr(null,t,n,o),t.depth>n){let r=ja(t,e,n+1);go(bo(r,Ai(t,e,n+1)),o)}return xr(e,null,n,o),new ne(o)}function J1(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)r=e.node(i).copy(ne.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class Er{constructor(e,n,o){this.pos=e,this.path=n,this.parentOffset=o,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let o=this.pos-this.path[this.path.length-1],r=e.child(n);return o?e.child(n).cut(o):r}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let o=this.path[n*3],r=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)r+=o.child(i).nodeSize;return r}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return je.none;if(this.textOffset)return e.child(n).marks;let o=e.maybeChild(n-1),r=e.maybeChild(n);if(!o){let l=o;o=r,r=l}let i=o.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!r||!i[s].isInSet(r.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let o=n.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!r||!o[i].isInSet(r.marks))&&(o=o[i--].removeFromSet(o));return o}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!n||n(this.node(o))))return new Mi(this,e,o);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let o=[],r=0,i=n;for(let s=e;;){let{index:l,offset:c}=s.content.findIndex(i),d=i-c;if(o.push(s,l,r+c),!d||(s=s.child(l),s.isText))break;i=d-1,r+=c+1}return new Er(n,o,i)}static resolveCached(e,n){let o=Fu.get(e);if(o)for(let i=0;i<o.elts.length;i++){let s=o.elts[i];if(s.pos==n)return s}else Fu.set(e,o=new X1);let r=o.elts[o.i]=Er.resolve(e,n);return o.i=(o.i+1)%Y1,r}}class X1{constructor(){this.elts=[],this.i=0}}const Y1=12,Fu=new WeakMap;class Mi{constructor(e,n,o){this.$from=e,this.$to=n,this.depth=o}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Q1=Object.create(null);let Gn=class Mc{constructor(e,n,o,r=je.none){this.type=e,this.attrs=n,this.marks=r,this.content=o||ne.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,o,r=0){this.content.nodesBetween(e,n,o,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,o,r){return this.content.textBetween(e,n,o,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,o){return this.type==e&&zi(this.attrs,n||e.defaultAttrs||Q1)&&je.sameSet(this.marks,o||je.none)}copy(e=null){return e==this.content?this:new Mc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Mc(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,o=!1){if(e==n)return ue.empty;let r=this.resolve(e),i=this.resolve(n),s=o?0:r.sharedDepth(n),l=r.start(s),d=r.node(s).content.cut(r.pos-l,i.pos-l);return new ue(d,r.depth-s,i.depth-s)}replace(e,n,o){return K1(this.resolve(e),this.resolve(n),o)}nodeAt(e){for(let n=this;;){let{index:o,offset:r}=n.content.findIndex(e);if(n=n.maybeChild(o),!n)return null;if(r==e||n.isText)return n;e-=r+1}}childAfter(e){let{index:n,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(n),index:n,offset:o};let r=this.content.child(n-1);return{node:r,index:n-1,offset:o-r.nodeSize}}resolve(e){return Er.resolveCached(this,e)}resolveNoCache(e){return Er.resolve(this,e)}rangeHasMark(e,n,o){let r=!1;return n>e&&this.nodesBetween(e,n,i=>(o.isInSet(i.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),ju(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,o=ne.empty,r=0,i=o.childCount){let s=this.contentMatchAt(e).matchFragment(o,r,i),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let c=r;c<i;c++)if(!this.type.allowsMarks(o.child(c).marks))return!1;return!0}canReplaceWith(e,n,o,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(o),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=je.none;for(let n=0;n<this.marks.length;n++){let o=this.marks[n];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!je.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let o;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,o)}let r=ne.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};Gn.prototype.text=void 0;class Ii extends Gn{constructor(e,n,o,r){if(super(e,n,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ju(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ii(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ii(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function ju(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class yo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let o=new Z1(e,n);if(o.next==null)return yo.empty;let r=Uu(o);o.next&&o.err("Unexpected trailing text");let i=s0(i0(r));return a0(i,o),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,o=e.childCount){let r=this;for(let i=n;r&&i<o;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let o=0;o<e.next.length;o++)if(this.next[n].type==e.next[o].type)return!0;return!1}fillBefore(e,n=!1,o=0){let r=[this];function i(s,l){let c=s.matchFragment(e,o);if(c&&(!n||c.validEnd))return ne.from(l.map(d=>d.createAndFill()));for(let d=0;d<s.next.length;d++){let{type:u,next:f}=s.next[d];if(!(u.isText||u.hasRequiredAttrs())&&r.indexOf(f)==-1){r.push(f);let p=i(f,l.concat(u));if(p)return p}}return null}return i(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let r=o.shift(),i=r.match;if(i.matchType(e)){let s=[];for(let l=r;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:c}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!r.type||c.validEnd)&&(o.push({match:l.contentMatch,type:l,via:r}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(o){e.push(o);for(let r=0;r<o.next.length;r++)e.indexOf(o.next[r].next)==-1&&n(o.next[r].next)}return n(this),e.map((o,r)=>{let i=r+(o.validEnd?"*":" ")+" ";for(let s=0;s<o.next.length;s++)i+=(s?", ":"")+o.next[s].type.name+"->"+e.indexOf(o.next[s].next);return i}).join(`
|
|
349
|
-
`)}}yo.empty=new yo(!0);class Z1{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Uu(t){let e=[];do e.push(e0(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function e0(t){let e=[];do e.push(t0(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function t0(t){let e=r0(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=n0(t,e);else break;return e}function Hu(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function n0(t,e){let n=Hu(t),o=n;return t.eat(",")&&(t.next!="}"?o=Hu(t):o=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:o,expr:e}}function o0(t,e){let n=t.nodeTypes,o=n[e];if(o)return[o];let r=[];for(let i in n){let s=n[i];s.isInGroup(e)&&r.push(s)}return r.length==0&&t.err("No node type or group '"+e+"' found"),r}function r0(t){if(t.eat("(")){let e=Uu(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=o0(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function i0(t){let e=[[]];return r(i(t,0),n()),e;function n(){return e.push([])-1}function o(s,l,c){let d={term:c,to:l};return e[s].push(d),d}function r(s,l){s.forEach(c=>c.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((c,d)=>c.concat(i(d,l)),[]);if(s.type=="seq")for(let c=0;;c++){let d=i(s.exprs[c],l);if(c==s.exprs.length-1)return d;r(d,l=n())}else if(s.type=="star"){let c=n();return o(l,c),r(i(s.expr,c),c),[o(c)]}else if(s.type=="plus"){let c=n();return r(i(s.expr,l),c),r(i(s.expr,c),c),[o(c)]}else{if(s.type=="opt")return[o(l)].concat(i(s.expr,l));if(s.type=="range"){let c=l;for(let d=0;d<s.min;d++){let u=n();r(i(s.expr,c),u),c=u}if(s.max==-1)r(i(s.expr,c),c);else for(let d=s.min;d<s.max;d++){let u=n();o(c,u),r(i(s.expr,c),u),c=u}return[o(c)]}else{if(s.type=="name")return[o(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Wu(t,e){return e-t}function Gu(t,e){let n=[];return o(e),n.sort(Wu);function o(r){let i=t[r];if(i.length==1&&!i[0].term)return o(i[0].to);n.push(r);for(let s=0;s<i.length;s++){let{term:l,to:c}=i[s];!l&&n.indexOf(c)==-1&&o(c)}}}function s0(t){let e=Object.create(null);return n(Gu(t,0));function n(o){let r=[];o.forEach(s=>{t[s].forEach(({term:l,to:c})=>{if(!l)return;let d;for(let u=0;u<r.length;u++)r[u][0]==l&&(d=r[u][1]);Gu(t,c).forEach(u=>{d||r.push([l,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let i=e[o.join(",")]=new yo(o.indexOf(t.length-1)>-1);for(let s=0;s<r.length;s++){let l=r[s][1].sort(Wu);i.next.push({type:r[s][0],next:e[l.join(",")]||n(l)})}return i}}function a0(t,e){for(let n=0,o=[t];n<o.length;n++){let r=o[n],i=!r.validEnd,s=[];for(let l=0;l<r.next.length;l++){let{type:c,next:d}=r.next[l];s.push(c.name),i&&!(c.isText||c.hasRequiredAttrs())&&(i=!1),o.indexOf(d)==-1&&o.push(d)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function qu(t){let e=Object.create(null);for(let n in t){let o=t[n];if(!o.hasDefault)return null;e[n]=o.default}return e}function Ku(t,e){let n=Object.create(null);for(let o in t){let r=e&&e[o];if(r===void 0){let i=t[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}n[o]=r}return n}function Ju(t,e,n,o){for(let r in e)if(!(r in t))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let r in t){let i=t[r];i.validate&&i.validate(e[r])}}function Xu(t,e){let n=Object.create(null);if(e)for(let o in e)n[o]=new c0(t,o,e[o]);return n}let Yu=class Bm{constructor(e,n,o){this.name=e,this.schema=n,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=Xu(e,o.attrs),this.defaultAttrs=qu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==yo.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Ku(this.attrs,e)}create(e=null,n,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Gn(this,this.computeAttrs(e),ne.from(n),je.setFrom(o))}createChecked(e=null,n,o){return n=ne.from(n),this.checkContent(n),new Gn(this,this.computeAttrs(e),n,je.setFrom(o))}createAndFill(e=null,n,o){if(e=this.computeAttrs(e),n=ne.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let r=this.contentMatch.matchFragment(n),i=r&&r.fillBefore(ne.empty,!0);return i?new Gn(this,e,n.append(i),je.setFrom(o)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Ju(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?n&&n.push(e[o]):n||(n=e.slice(0,o));return n?n.length?n:je.none:e}static compile(e,n){let o=Object.create(null);e.forEach((i,s)=>o[i]=new Bm(i,n,s));let r=n.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let i in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function l0(t,e,n){let o=n.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${t}, got ${i}`)}}class c0{constructor(e,n,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?l0(e,n,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class Oi{constructor(e,n,o,r){this.name=e,this.rank=n,this.schema=o,this.spec=r,this.attrs=Xu(e,r.attrs),this.excluded=null;let i=qu(this.attrs);this.instance=i?new je(this,i):null}create(e=null){return!e&&this.instance?this.instance:new je(this,Ku(this.attrs,e))}static compile(e,n){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new Oi(i,r++,n,s)),o}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Ju(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Qu{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let r in e)n[r]=e[r];n.nodes=pt.from(e.nodes),n.marks=pt.from(e.marks||{}),this.nodes=Yu.compile(this.spec.nodes,this),this.marks=Oi.compile(this.spec.marks,this);let o=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let i=this.nodes[r],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=o[s]||(o[s]=yo.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?Zu(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let r in this.marks){let i=this.marks[r],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:Zu(this,s.split(" "))}this.nodeFromJSON=r=>Gn.fromJSON(this,r),this.markFromJSON=r=>je.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,o,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Yu){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,o,r)}text(e,n){let o=this.nodes.text;return new Ii(o,o.defaultAttrs,e,je.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Zu(t,e){let n=[];for(let o=0;o<e.length;o++){let r=e[o],i=t.marks[r],s=i;if(i)n.push(i);else for(let l in t.marks){let c=t.marks[l];(r=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(r)>-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return n}function d0(t){return t.tag!=null}function u0(t){return t.style!=null}let kr=class Ic{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let o=this.matchedStyles=[];n.forEach(r=>{if(d0(r))this.tags.push(r);else if(u0(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let o=new of(this,n,!1);return o.addAll(e,je.none,n.from,n.to),o.finish()}parseSlice(e,n={}){let o=new of(this,n,!0);return o.addAll(e,je.none,n.from,n.to),ue.maxOpen(o.finish())}matchTag(e,n,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if(h0(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let c=s.getAttrs(n);if(c===!1)continue;s.attrs=c||void 0}return s}}}static schemaRules(e){let n=[];function o(r){let i=r.priority==null?50:r.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<i)break}n.splice(s,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(s=>{o(s=rf(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(s=>{o(s=rf(s)),s.node||s.ignore||s.mark||(s.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ic(e,Ic.schemaRules(e)))}};const ef={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},f0={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},tf={ol:!0,ul:!0},wr=1,Ua=2,Sr=4;function nf(t,e,n){return e!=null?(e?wr:0)|(e==="full"?Ua:0):t&&t.whitespace=="pre"?wr|Ua:n&~Sr}class Di{constructor(e,n,o,r,i,s){this.type=e,this.attrs=n,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=je.none,this.match=i||(s&Sr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ne.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&wr)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let n=ne.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ne.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ef.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class of{constructor(e,n,o){this.parser=e,this.options=n,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=n.topNode,i,s=nf(null,n.preserveWhitespace,0)|(o?Sr:0);r?i=new Di(r.type,r.attrs,je.none,!0,n.topMatch||r.type.contentMatch,s):o?i=new Di(null,null,je.none,!0,null,s):i=new Di(e.schema.topNodeType,null,je.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let o=e.nodeValue,r=this.top,i=r.options&Ua?"full":this.localPreserveWS||(r.options&wr)>0,{schema:s}=this.parser;if(i==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i)if(i==="full")o=o.replace(/\r\n?/g,`
|
|
350
|
-
`);
|
|
351
|
-
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],s=o.getPropertyValue(i);if(s)for(let l=void 0;;){let c=this.parser.matchStyle(i,s,this,l);if(!c)break;if(c.ignore)return null;if(c.clearMark?n=n.filter(d=>!c.clearMark(d)):n=n.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)l=c;else break}}return n}addElementByRule(e,n,o,r){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let c=this.enter(s,n.attrs||null,o,n.preserveWhitespace);c&&(i=!0,o=c)}else{let c=this.parser.schema.marks[n.mark];o=o.concat(c.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,o,!1));else{let c=e;typeof n.contentElement=="string"?c=e.querySelector(n.contentElement):typeof n.contentElement=="function"?c=n.contentElement(e):n.contentElement&&(c=n.contentElement),this.findAround(e,c,!0),this.addAll(c,o),this.findAround(e,c,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,o,r){let i=o||0;for(let s=o?e.childNodes[o]:e.firstChild,l=r==null?null:e.childNodes[r];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,o){let r,i;for(let s=this.open,l=0;s>=0;s--){let c=this.nodes[s],d=c.findWrapping(e);if(d&&(!r||r.length>d.length+l)&&(r=d,i=c,!d.length))break;if(c.solid){if(o)break;l+=2}}if(!r)return null;this.sync(i);for(let s=0;s<r.length;s++)n=this.enterInner(r[s],null,n,!1);return n}insertNode(e,n,o){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let r=this.findPlace(e,n,o);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=je.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):sf(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,o,r){let i=this.findPlace(e.create(n),o,!1);return i&&(i=this.enterInner(e,n,o,!0,r)),i}enterInner(e,n,o,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=nf(e,i,s.options);s.options&Sr&&s.content.length==0&&(l|=Sr);let c=je.none;return o=o.filter(d=>(s.type?s.type.allowsMarkType(d.type):sf(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new Di(e,n,c,r,null,l)),this.open++,o}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=wr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let o=this.nodes[n].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==n&&(this.find[o].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,o){if(e!=n&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&n.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),s=(l,c)=>{for(;l>=0;l--){let d=n[l];if(d==""){if(l==n.length-1||l==0)continue;for(;c>=i;c--)if(s(l-1,c))return!0;return!1}else{let u=c>0||c==0&&r?this.nodes[c].type:o&&c>=i?o.node(c-i).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;c--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let n in this.parser.schema.nodes){let o=this.parser.schema.nodes[n];if(o.isTextblock&&o.defaultAttrs)return o}}}function p0(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&tf.hasOwnProperty(o)&&n?(n.appendChild(e),e=n):o=="li"?n=e:o&&(n=null)}}function h0(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function rf(t){let e={};for(let n in t)e[n]=t[n];return e}function sf(t,e){let n=e.schema.nodes;for(let o in n){let r=n[o];if(!r.allowsMarkType(t))continue;let i=[],s=l=>{i.push(l);for(let c=0;c<l.edgeCount;c++){let{type:d,next:u}=l.edge(c);if(d==e||i.indexOf(u)<0&&s(u))return!0}};if(s(r.contentMatch))return!0}}class xo{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},o){o||(o=Ha(n).createDocumentFragment());let r=o,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,c=0;for(;l<i.length&&c<s.marks.length;){let d=s.marks[c];if(!this.marks[d.type.name]){c++;continue}if(!d.eq(i[l][0])||d.type.spec.spanning===!1)break;l++,c++}for(;l<i.length;)r=i.pop()[1];for(;c<s.marks.length;){let d=s.marks[c++],u=this.serializeMark(d,s.isInline,n);u&&(i.push([d,r]),r.appendChild(u.dom),r=u.contentDOM||u.dom)}}r.appendChild(this.serializeNodeInner(s,n))}),o}serializeNodeInner(e,n){let{dom:o,contentDOM:r}=Ri(Ha(n),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,r)}return o}serializeNode(e,n={}){let o=this.serializeNodeInner(e,n);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(o),o=i.dom)}return o}serializeMark(e,n,o={}){let r=this.marks[e.type.name];return r&&Ri(Ha(o),r(e,n),null,e.attrs)}static renderSpec(e,n,o=null,r){return Ri(e,n,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new xo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=af(e.nodes);return n.text||(n.text=o=>o.text),n}static marksFromSchema(e){return af(e.marks)}}function af(t){let e={};for(let n in t){let o=t[n].spec.toDOM;o&&(e[n]=o)}return e}function Ha(t){return t.document||window.document}const lf=new WeakMap;function m0(t){let e=lf.get(t);return e===void 0&&lf.set(t,e=g0(t)),e}function g0(t){let e=null;function n(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let r=0;r<o.length;r++)n(o[r]);else for(let r in o)n(o[r])}return n(t),e}function Ri(t,e,n,o){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],i;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(i=m0(o))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=r.indexOf(" ");s>0&&(n=r.slice(0,s),r=r.slice(s+1));let l,c=n?t.createElementNS(n,r):t.createElement(r),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let f in d)if(d[f]!=null){let p=f.indexOf(" ");p>0?c.setAttributeNS(f.slice(0,p),f.slice(p+1),d[f]):f=="style"&&c.style?c.style.cssText=d[f]:c.setAttribute(f,d[f])}}for(let f=u;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:h,contentDOM:m}=Ri(t,p,n,o);if(c.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:c,contentDOM:l}}const cf=65535,df=Math.pow(2,16);function b0(t,e){return t+e*df}function uf(t){return t&cf}function y0(t){return(t-(t&cf))/df}const ff=1,pf=2,Pi=4,hf=8;class Wa{constructor(e,n,o){this.pos=e,this.delInfo=n,this.recover=o}get deleted(){return(this.delInfo&hf)>0}get deletedBefore(){return(this.delInfo&(ff|Pi))>0}get deletedAfter(){return(this.delInfo&(pf|Pi))>0}get deletedAcross(){return(this.delInfo&Pi)>0}}class Vt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Vt.empty)return Vt.empty}recover(e){let n=0,o=uf(e);if(!this.inverted)for(let r=0;r<o;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+n+y0(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,o){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?r:0);if(c>e)break;let d=this.ranges[l+i],u=this.ranges[l+s],f=c+d;if(e<=f){let p=d?e==c?-1:e==f?1:n:n,h=c+r+(p<0?0:u);if(o)return h;let m=e==(n<0?c:f)?null:b0(l/3,e-c),b=e==c?pf:e==f?ff:Pi;return(n<0?e!=c:e!=f)&&(b|=hf),new Wa(h,b,m)}r+=u-d}return o?e+r:new Wa(e+r,0,null)}touches(e,n){let o=0,r=uf(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?o:0);if(c>e)break;let d=this.ranges[l+i],u=c+d;if(e<=u&&l==r*3)return!0;o+=this.ranges[l+s]-d}return!1}forEach(e){let n=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],l=s-(this.inverted?i:0),c=s+(this.inverted?0:i),d=this.ranges[r+n],u=this.ranges[r+o];e(l,l+d,c,c+u),i+=u-d}}invert(){return new Vt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Vt.empty:new Vt(e<0?[0,-e,0]:[0,0,e])}}Vt.empty=new Vt([]);class Li{constructor(e,n,o=0,r=e?e.length:0){this.mirror=n,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Li(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,o=this._maps.length;n<e._maps.length;n++){let r=e.getMirror(n);this.appendMap(e._maps[n],r!=null&&r<n?o+r:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,o=this._maps.length+e._maps.length;n>=0;n--){let r=e.getMirror(n);this.appendMap(e._maps[n].invert(),r!=null&&r>n?o-r-1:void 0)}}invert(){let e=new Li;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,o){let r=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,n);if(l.recover!=null){let c=this.getMirror(i);if(c!=null&&c>i&&c<this.to){i=c,e=this._maps[c].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return o?e:new Wa(e,r,null)}}const Ga=Object.create(null);class xt{getMap(){return Vt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=Ga[n.stepType];if(!o)throw new RangeError(`No step type ${n.stepType} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in Ga)throw new RangeError("Duplicate use of step JSON ID "+e);return Ga[e]=n,n.prototype.jsonID=e,n}}class nt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new nt(e,null)}static fail(e){return new nt(null,e)}static fromReplace(e,n,o,r){try{return nt.ok(e.replace(n,o,r))}catch(i){if(i instanceof _i)return nt.fail(i.message);throw i}}}function qa(t,e,n){let o=[];for(let r=0;r<t.childCount;r++){let i=t.child(r);i.content.size&&(i=i.copy(qa(i.content,e,i))),i.isInline&&(i=e(i,n,r)),o.push(i)}return ne.fromArray(o)}class qn extends xt{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new ue(qa(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),n.openStart,n.openEnd);return nt.fromReplace(e,this.from,this.to,i)}invert(){return new sn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new qn(n.pos,o.pos,this.mark)}merge(e){return e instanceof qn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new qn(n.from,n.to,e.markFromJSON(n.mark))}}xt.jsonID("addMark",qn);class sn extends xt{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=new ue(qa(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return nt.fromReplace(e,this.from,this.to,o)}invert(){return new qn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new sn(n.pos,o.pos,this.mark)}merge(e){return e instanceof sn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new sn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new sn(n.from,n.to,e.markFromJSON(n.mark))}}xt.jsonID("removeMark",sn);class Kn extends xt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return nt.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return nt.fromReplace(e,this.pos,this.pos+1,new ue(ne.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let o=this.mark.addToSet(n.marks);if(o.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(o))return new Kn(this.pos,n.marks[r]);return new Kn(this.pos,this.mark)}}return new Eo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Kn(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Kn(n.pos,e.markFromJSON(n.mark))}}xt.jsonID("addNodeMark",Kn);class Eo extends xt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return nt.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return nt.fromReplace(e,this.pos,this.pos+1,new ue(ne.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Kn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Eo(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Eo(n.pos,e.markFromJSON(n.mark))}}xt.jsonID("removeNodeMark",Eo);class ct extends xt{constructor(e,n,o,r=!1){super(),this.from=e,this.to=n,this.slice=o,this.structure=r}apply(e){return this.structure&&Ka(e,this.from,this.to)?nt.fail("Structure replace would overwrite content"):nt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Vt([this.from,this.to-this.from,this.slice.size])}invert(e){return new ct(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deletedAcross&&o.deletedAcross?null:new ct(n.pos,Math.max(n.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ct)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?ue.empty:new ue(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ct(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?ue.empty:new ue(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ct(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ct(n.from,n.to,ue.fromJSON(e,n.slice),!!n.structure)}}xt.jsonID("replace",ct);class dt extends xt{constructor(e,n,o,r,i,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Ka(e,this.from,this.gapFrom)||Ka(e,this.gapTo,this.to)))return nt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return nt.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,n.content);return o?nt.fromReplace(e,this.from,this.to,o):nt.fail("Content does not fit in gap")}getMap(){return new Vt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new dt(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return n.deletedAcross&&o.deletedAcross||r<n.pos||i>o.pos?null:new dt(n.pos,o.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new dt(n.from,n.to,n.gapFrom,n.gapTo,ue.fromJSON(e,n.slice),n.insert,!!n.structure)}}xt.jsonID("replaceAround",dt);function Ka(t,e,n){let o=t.resolve(e),r=n-e,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let s=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function x0(t,e,n,o){let r=[],i=[],s,l;t.doc.nodesBetween(e,n,(c,d,u)=>{if(!c.isInline)return;let f=c.marks;if(!o.isInSet(f)&&u.type.allowsMarkType(o.type)){let p=Math.max(d,e),h=Math.min(d+c.nodeSize,n),m=o.addToSet(f);for(let b=0;b<f.length;b++)f[b].isInSet(m)||(s&&s.to==p&&s.mark.eq(f[b])?s.to=h:r.push(s=new sn(p,h,f[b])));l&&l.to==p?l.to=h:i.push(l=new qn(p,h,o))}}),r.forEach(c=>t.step(c)),i.forEach(c=>t.step(c))}function E0(t,e,n,o){let r=[],i=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;i++;let c=null;if(o instanceof Oi){let d=s.marks,u;for(;u=o.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else o?o.isInSet(s.marks)&&(c=[o]):c=s.marks;if(c&&c.length){let d=Math.min(l+s.nodeSize,n);for(let u=0;u<c.length;u++){let f=c[u],p;for(let h=0;h<r.length;h++){let m=r[h];m.step==i-1&&f.eq(r[h].style)&&(p=m)}p?(p.to=d,p.step=i):r.push({style:f,from:Math.max(l,e),to:d,step:i})}}}),r.forEach(s=>t.step(new sn(s.from,s.to,s.style)))}function Ja(t,e,n,o=n.contentMatch,r=!0){let i=t.doc.nodeAt(e),s=[],l=e+1;for(let c=0;c<i.childCount;c++){let d=i.child(c),u=l+d.nodeSize,f=o.matchType(d.type);if(!f)s.push(new ct(l,u,ue.empty));else{o=f;for(let p=0;p<d.marks.length;p++)n.allowsMarkType(d.marks[p].type)||t.step(new sn(l,u,d.marks[p]));if(r&&d.isText&&n.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(d.text);)m||(m=new ue(ne.from(n.schema.text(" ",n.allowedMarks(d.marks))),0,0)),s.push(new ct(l+p.index,l+p.index+p[0].length,m))}}l=u}if(!o.validEnd){let c=o.fillBefore(ne.empty,!0);t.replace(l,l,new ue(c,0,0))}for(let c=s.length-1;c>=0;c--)t.step(s[c])}function k0(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function $o(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let o=t.depth,r=0,i=0;;--o){let s=t.$from.node(o),l=t.$from.index(o)+r,c=t.$to.indexAfter(o)-i;if(o<t.depth&&s.canReplace(l,c,n))return o;if(o==0||s.type.spec.isolating||!k0(s,l,c))break;l&&(r=1),c<s.childCount&&(i=1)}return null}function w0(t,e,n){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),c=s,d=l,u=ne.empty,f=0;for(let m=i,b=!1;m>n;m--)b||o.index(m)>0?(b=!0,u=ne.from(o.node(m).copy(u)),f++):c--;let p=ne.empty,h=0;for(let m=i,b=!1;m>n;m--)b||r.after(m+1)<r.end(m)?(b=!0,p=ne.from(r.node(m).copy(p)),h++):d++;t.step(new dt(c,d,s,l,new ue(u.append(p),f,h),u.size-f,!0))}function Xa(t,e,n=null,o=t){let r=S0(t,e),i=r&&N0(o,e);return i?r.map(mf).concat({type:e,attrs:n}).concat(i.map(mf)):null}function mf(t){return{type:t,attrs:null}}function S0(t,e){let{parent:n,startIndex:o,endIndex:r}=t,i=n.contentMatchAt(o).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(o,r,s)?i:null}function N0(t,e){let{parent:n,startIndex:o,endIndex:r}=t,i=n.child(o),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let c=(s.length?s[s.length-1]:e).contentMatch;for(let d=o;c&&d<r;d++)c=c.matchType(n.child(d).type);return!c||!c.validEnd?null:s}function C0(t,e,n){let o=ne.empty;for(let s=n.length-1;s>=0;s--){if(o.size){let l=n[s].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=ne.from(n[s].type.create(n[s].attrs,o))}let r=e.start,i=e.end;t.step(new dt(r,i,r,i,new ue(o,0,0),n.length,!0))}function v0(t,e,n,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{let c=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,c)&&T0(t.doc,t.mapping.slice(i).map(l),o)){let d=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?d=!1:!h&&m&&(d=!0)}d===!1&&bf(t,s,l,i),Ja(t,t.mapping.slice(i).map(l,1),o,void 0,d===null);let u=t.mapping.slice(i),f=u.map(l,1),p=u.map(l+s.nodeSize,1);return t.step(new dt(f,p,f+1,p-1,new ue(ne.from(o.create(c,null,s.marks)),0,0),1,!0)),d===!0&&gf(t,s,l,i),!1}})}function gf(t,e,n,o){e.forEach((r,i)=>{if(r.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(r.text);){let c=t.mapping.slice(o).map(n+1+i+s.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function bf(t,e,n,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let s=t.mapping.slice(o).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
|
|
352
|
-
`))}})}function T0(t,e,n){let o=t.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,n)}function z0(t,e,n,o,r){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(o,null,r||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new dt(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ue(ne.from(s),0,0),1,!0))}function vn(t,e,n=1,o){let r=t.resolve(e),i=r.depth-n,s=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let d=r.depth-1,u=n-2;d>i;d--,u--){let f=r.node(d),p=r.index(d);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(p,f.childCount),m=o&&o[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let b=o&&o[u]||f;if(!f.canReplace(p+1,f.childCount)||!b.type.validContent(h))return!1}let l=r.indexAfter(i),c=o&&o[0];return r.node(i).canReplaceWith(l,l,c?c.type:r.node(i+1).type)}function _0(t,e,n=1,o){let r=t.doc.resolve(e),i=ne.empty,s=ne.empty;for(let l=r.depth,c=r.depth-n,d=n-1;l>c;l--,d--){i=ne.from(r.node(l).copy(i));let u=o&&o[d];s=ne.from(u?u.type.create(u.attrs,s):r.node(l).copy(s))}t.step(new ct(e,e,new ue(i.append(s),n,n),!0))}function Jn(t,e){let n=t.resolve(e),o=n.index();return yf(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(o,o+1)}function A0(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:o}=t.type.schema;for(let r=0;r<e.childCount;r++){let i=e.child(r),s=i.type==o?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function yf(t,e){return!!(t&&e&&!t.isLeaf&&A0(t,e))}function $i(t,e,n=-1){let o=t.resolve(e);for(let r=o.depth;;r--){let i,s,l=o.index(r);if(r==o.depth?(i=o.nodeBefore,s=o.nodeAfter):n>0?(i=o.node(r+1),l++,s=o.node(r).maybeChild(l)):(i=o.node(r).maybeChild(l-1),s=o.node(r+1)),i&&!i.isTextblock&&yf(i,s)&&o.node(r).canReplace(l,l+1))return e;if(r==0)break;e=n<0?o.before(r):o.after(r)}}function M0(t,e,n){let o=null,{linebreakReplacement:r}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(r&&s.inlineContent){let u=s.whitespace=="pre",f=!!s.contentMatch.matchType(r);u&&!f?o=!1:!u&&f&&(o=!0)}let l=t.steps.length;if(o===!1){let u=t.doc.resolve(e+n);bf(t,u.node(),u.before(),l)}s.inlineContent&&Ja(t,e+n-1,s,i.node().contentMatchAt(i.index()),o==null);let c=t.mapping.slice(l),d=c.map(e-n);if(t.step(new ct(d,c.map(e+n,-1),ue.empty,!0)),o===!0){let u=t.doc.resolve(d);gf(t,u.node(),u.before(),t.steps.length)}return t}function I0(t,e,n){let o=t.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),n))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,n))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,n))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function O0(t,e,n){let o=t.resolve(e);if(!n.content.size)return e;let r=n.content;for(let i=0;i<n.openStart;i++)r=r.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=o.depth;s>=0;s--){let l=s==o.depth?0:o.pos<=(o.start(s+1)+o.end(s+1))/2?-1:1,c=o.index(s)+(l>0?1:0),d=o.node(s),u=!1;if(i==1)u=d.canReplace(c,c,r);else{let f=d.contentMatchAt(c).findWrapping(r.firstChild.type);u=f&&d.canReplaceWith(c,c,f[0])}if(u)return l==0?o.pos:l<0?o.before(s+1):o.after(s+1)}return null}function Vi(t,e,n=e,o=ue.empty){if(e==n&&!o.size)return null;let r=t.resolve(e),i=t.resolve(n);return xf(r,i,o)?new ct(e,n,o):new D0(r,i,o).fit()}function xf(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class D0{constructor(e,n,o){this.$from=e,this.$to=n,this.unplaced=o,this.frontier=[],this.placed=ne.empty;for(let r=0;r<=e.depth;r++){let i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=ne.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let i=this.placed,s=o.depth,l=r.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let c=new ue(i,s,l);return e>-1?new dt(o.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||o.pos!=this.$to.pos?new ct(o.pos,r.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let i=n.firstChild;if(n.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){e=o;break}n=i.content}for(let n=1;n<=2;n++)for(let o=n==1?e:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=Ya(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:c,match:d}=this.frontier[l],u,f=null;if(n==1&&(s?d.matchType(s.type)||(f=d.fillBefore(ne.from(s),!1)):i&&c.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(n==2&&s&&(u=d.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:u};if(i&&d.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=Ya(e,n);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new ue(e,n+1,Math.max(o,r.size+n>=e.size-o?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=Ya(e,n);if(r.childCount<=1&&n>0){let i=e.size-n<=n+r.size;this.unplaced=new ue(Nr(e,n-1,1),n-1,i?n-1:o)}else this.unplaced=new ue(Nr(e,n,1),n,o)}placeNodes({sliceDepth:e,frontierDepth:n,parent:o,inject:r,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let b=0;b<i.length;b++)this.openFrontierNode(i[b]);let s=this.unplaced,l=o?o.content:s.content,c=s.openStart-e,d=0,u=[],{match:f,type:p}=this.frontier[n];if(r){for(let b=0;b<r.childCount;b++)u.push(r.child(b));f=f.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;d<l.childCount;){let b=l.child(d),g=f.matchType(b.type);if(!g)break;d++,(d>1||c==0||b.content.size)&&(f=g,u.push(Ef(b.mark(p.allowedMarks(b.marks)),d==1?c:0,d==l.childCount?h:-1)))}let m=d==l.childCount;m||(h=-1),this.placed=Cr(this.placed,n,ne.from(u)),this.frontier[n].match=f,m&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let b=0,g=l;b<h;b++){let x=g.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),g=x.content}this.unplaced=m?e==0?ue.empty:new ue(Nr(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new ue(Nr(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Qa(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:o,type:r}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Qa(e,n,r,o,i);if(s){for(let l=n-1;l>=0;l--){let{match:c,type:d}=this.frontier[l],u=Qa(e,l,d,c,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Cr(this.placed,n.depth,n.fit)),e=n.move;for(let o=n.depth+1;o<=e.depth;o++){let r=e.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,i)}return e}openFrontierNode(e,n=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Cr(this.placed,this.depth,ne.from(e.create(n,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ne.empty,!0);n.childCount&&(this.placed=Cr(this.placed,this.frontier.length,n))}}function Nr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Nr(t.firstChild.content,e-1,n)))}function Cr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Cr(t.lastChild.content,e-1,n)))}function Ya(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Ef(t,e,n){if(e<=0)return t;let o=t.content;return e>1&&(o=o.replaceChild(0,Ef(o.firstChild,e-1,o.childCount==1?n-1:0))),e>0&&(o=t.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(ne.empty,!0)))),t.copy(o)}function Qa(t,e,n,o,r){let i=t.node(e),s=r?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,s);return l&&!R0(n,i.content,s)?l:null}function R0(t,e,n){for(let o=n;o<e.childCount;o++)if(!t.allowsMarks(e.child(o).marks))return!0;return!1}function P0(t){return t.spec.defining||t.spec.definingForContent}function L0(t,e,n,o){if(!o.size)return t.deleteRange(e,n);let r=t.doc.resolve(e),i=t.doc.resolve(n);if(xf(r,i,o))return t.step(new ct(e,n,o));let s=wf(r,i);s[s.length-1]==0&&s.pop();let l=-(r.depth+1);s.unshift(l);for(let p=r.depth,h=r.pos-1;p>0;p--,h--){let m=r.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(p)>-1?l=p:r.before(p)==h&&s.splice(1,0,-p)}let c=s.indexOf(l),d=[],u=o.openStart;for(let p=o.content,h=0;;h++){let m=p.firstChild;if(d.push(m),h==o.openStart)break;p=m.content}for(let p=u-1;p>=0;p--){let h=d[p],m=P0(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))u=p;else if(m||!h.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let h=(p+u+1)%(o.openStart+1),m=d[h];if(m)for(let b=0;b<s.length;b++){let g=s[(b+c)%s.length],x=!0;g<0&&(x=!1,g=-g);let v=r.node(g-1),w=r.index(g-1);if(v.canReplaceWith(w,w,m.type,m.marks))return t.replace(r.before(g),x?i.after(g):n,new ue(kf(o.content,0,o.openStart,h),h,o.openEnd))}}let f=t.steps.length;for(let p=s.length-1;p>=0&&(t.replace(e,n,o),!(t.steps.length>f));p--){let h=s[p];h<0||(e=r.before(h),n=i.after(h))}}function kf(t,e,n,o,r){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(kf(i.content,e+1,n,o,i)))}if(e>o){let i=r.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(ne.empty,!0))}return t}function $0(t,e,n,o){if(!o.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let r=I0(t.doc,e,o.type);r!=null&&(e=n=r)}t.replaceRange(e,n,new ue(ne.from(o),0,0))}function V0(t,e,n){let o=t.doc.resolve(e),r=t.doc.resolve(n),i=wf(o,r);for(let s=0;s<i.length;s++){let l=i[s],c=s==i.length-1;if(c&&l==0||o.node(l).type.contentMatch.validEnd)return t.delete(o.start(l),r.end(l));if(l>0&&(c||o.node(l-1).canReplace(o.index(l-1),r.indexAfter(l-1))))return t.delete(o.before(l),r.after(l))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(e-o.start(s)==o.depth-s&&n>o.end(s)&&r.end(s)-n!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return t.delete(o.before(s),n);t.delete(e,n)}function wf(t,e){let n=[],o=Math.min(t.depth,e.depth);for(let r=o;r>=0;r--){let i=t.start(r);if(i<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&n.push(r)}return n}class Vo extends xt{constructor(e,n,o){super(),this.pos=e,this.attr=n,this.value=o}apply(e){let n=e.nodeAt(this.pos);if(!n)return nt.fail("No node at attribute step's position");let o=Object.create(null);for(let i in n.attrs)o[i]=n.attrs[i];o[this.attr]=this.value;let r=n.type.create(o,null,n.marks);return nt.fromReplace(e,this.pos,this.pos+1,new ue(ne.from(r),0,n.isLeaf?0:1))}getMap(){return Vt.empty}invert(e){return new Vo(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Vo(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Vo(n.pos,n.attr,n.value)}}xt.jsonID("attr",Vo);class vr extends xt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let r in e.attrs)n[r]=e.attrs[r];n[this.attr]=this.value;let o=e.type.create(n,e.content,e.marks);return nt.ok(o)}getMap(){return Vt.empty}invert(e){return new vr(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new vr(n.attr,n.value)}}xt.jsonID("docAttr",vr);let Bo=class extends Error{};Bo=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},Bo.prototype=Object.create(Error.prototype),Bo.prototype.constructor=Bo,Bo.prototype.name="TransformError";class Sf{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Li}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Bo(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,o=ue.empty){let r=Vi(this.doc,e,n,o);return r&&this.step(r),this}replaceWith(e,n,o){return this.replace(e,n,new ue(ne.from(o),0,0))}delete(e,n){return this.replace(e,n,ue.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,o){return L0(this,e,n,o),this}replaceRangeWith(e,n,o){return $0(this,e,n,o),this}deleteRange(e,n){return V0(this,e,n),this}lift(e,n){return w0(this,e,n),this}join(e,n=1){return M0(this,e,n),this}wrap(e,n){return C0(this,e,n),this}setBlockType(e,n=e,o,r=null){return v0(this,e,n,o,r),this}setNodeMarkup(e,n,o=null,r){return z0(this,e,n,o,r),this}setNodeAttribute(e,n,o){return this.step(new Vo(e,n,o)),this}setDocAttribute(e,n){return this.step(new vr(e,n)),this}addNodeMark(e,n){return this.step(new Kn(e,n)),this}removeNodeMark(e,n){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(n instanceof je)n.isInSet(o.marks)&&this.step(new Eo(e,n));else{let r=o.marks,i,s=[];for(;i=n.isInSet(r);)s.push(new Eo(e,i)),r=i.removeFromSet(r);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,n=1,o){return _0(this,e,n,o),this}addMark(e,n,o){return x0(this,e,n,o),this}removeMark(e,n,o){return E0(this,e,n,o),this}clearIncompatible(e,n,o){return Ja(this,e,n,o),this}}const Za=Object.create(null);class Pe{constructor(e,n,o){this.$anchor=e,this.$head=n,this.ranges=o||[new B0(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=ue.empty){let o=n.content.lastChild,r=null;for(let l=0;l<n.openEnd;l++)r=o,o=o.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:c,$to:d}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(c.pos),u.map(d.pos),l?ue.empty:n),l==0&&vf(e,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,n){let o=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:l}=r[i],c=e.mapping.slice(o),d=c.map(s.pos),u=c.map(l.pos);i?e.deleteRange(d,u):(e.replaceRangeWith(d,u,n),vf(e,o,n.isInline?-1:1))}}static findFrom(e,n,o=!1){let r=e.parent.inlineContent?new Oe(e):Fo(e.node(0),e.parent,e.pos,e.index(),n,o);if(r)return r;for(let i=e.depth-1;i>=0;i--){let s=n<0?Fo(e.node(0),e.node(i),e.before(i+1),e.index(i),n,o):Fo(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,o);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Bt(e.node(0))}static atStart(e){return Fo(e,e,0,0,1)||new Bt(e)}static atEnd(e){return Fo(e,e,e.content.size,e.childCount,-1)||new Bt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Za[n.type];if(!o)throw new RangeError(`No selection type ${n.type} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in Za)throw new RangeError("Duplicate use of selection JSON ID "+e);return Za[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Oe.between(this.$anchor,this.$head).getBookmark()}}Pe.prototype.visible=!0;class B0{constructor(e,n){this.$from=e,this.$to=n}}let Nf=!1;function Cf(t){!Nf&&!t.parent.inlineContent&&(Nf=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Oe extends Pe{constructor(e,n=e){Cf(e),Cf(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let o=e.resolve(n.map(this.head));if(!o.parent.inlineContent)return Pe.near(o);let r=e.resolve(n.map(this.anchor));return new Oe(r.parent.inlineContent?r:o,o)}replace(e,n=ue.empty){if(super.replace(e,n),n==ue.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof Oe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Bi(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Oe(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,o=n){let r=e.resolve(n);return new this(r,o==n?r:e.resolve(o))}static between(e,n,o){let r=e.pos-n.pos;if((!o||r)&&(o=r>=0?1:-1),!n.parent.inlineContent){let i=Pe.findFrom(n,o,!0)||Pe.findFrom(n,-o,!0);if(i)n=i.$head;else return Pe.near(n,o)}return e.parent.inlineContent||(r==0?e=n:(e=(Pe.findFrom(e,-o,!0)||Pe.findFrom(e,o,!0)).$anchor,e.pos<n.pos!=r<0&&(e=n))),new Oe(e,n)}}Pe.jsonID("text",Oe);class Bi{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Bi(e.map(this.anchor),e.map(this.head))}resolve(e){return Oe.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ne extends Pe{constructor(e){let n=e.nodeAfter,o=e.node(0).resolve(e.pos+n.nodeSize);super(e,o),this.node=n}map(e,n){let{deleted:o,pos:r}=n.mapResult(this.anchor),i=e.resolve(r);return o?Pe.near(i):new Ne(i)}content(){return new ue(ne.from(this.node),0,0)}eq(e){return e instanceof Ne&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new el(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ne(e.resolve(n.anchor))}static create(e,n){return new Ne(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ne.prototype.visible=!1,Pe.jsonID("node",Ne);class el{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:o}=e.mapResult(this.anchor);return n?new Bi(o,o):new el(o)}resolve(e){let n=e.resolve(this.anchor),o=n.nodeAfter;return o&&Ne.isSelectable(o)?new Ne(n):Pe.near(n)}}class Bt extends Pe{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ue.empty){if(n==ue.empty){e.delete(0,e.doc.content.size);let o=Pe.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Bt(e)}map(e){return new Bt(e)}eq(e){return e instanceof Bt}getBookmark(){return F0}}Pe.jsonID("all",Bt);const F0={map(){return this},resolve(t){return new Bt(t)}};function Fo(t,e,n,o,r,i=!1){if(e.inlineContent)return Oe.create(t,n);for(let s=o-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let l=e.child(s);if(l.isAtom){if(!i&&Ne.isSelectable(l))return Ne.create(t,n-(r<0?l.nodeSize:0))}else{let c=Fo(t,l,n+r,r<0?l.childCount:0,r,i);if(c)return c}n+=l.nodeSize*r}return null}function vf(t,e,n){let o=t.steps.length-1;if(o<e)return;let r=t.steps[o];if(!(r instanceof ct||r instanceof dt))return;let i=t.mapping.maps[o],s;i.forEach((l,c,d,u)=>{s==null&&(s=u)}),t.setSelection(Pe.near(t.doc.resolve(s),n))}const Tf=1,Fi=2,zf=4;class j0 extends Sf{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Tf)&~Fi,this.storedMarks=null,this}get selectionSet(){return(this.updated&Tf)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Fi,this}ensureMarks(e){return je.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Fi)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Fi,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let o=this.selection;return n&&(e=e.mark(this.storedMarks||(o.empty?o.$from.marks():o.$from.marksAcross(o.$to)||je.none))),o.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,o){let r=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(o==null&&(o=n),!e)return this.deleteRange(n,o);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=o==n?s.marks():s.marksAcross(this.doc.resolve(o))}return this.replaceRangeWith(n,o,r.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Pe.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=zf,this}get scrolledIntoView(){return(this.updated&zf)>0}}function _f(t,e){return!e||!t?t:t.bind(e)}class Tr{constructor(e,n,o){this.name=e,this.init=_f(n.init,o),this.apply=_f(n.apply,o)}}const U0=[new Tr("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Tr("selection",{init(t,e){return t.selection||Pe.atStart(e.doc)},apply(t){return t.selection}}),new Tr("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,o){return o.selection.$cursor?t.storedMarks:null}}),new Tr("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class tl{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=U0.slice(),n&&n.forEach(o=>{if(this.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");this.plugins.push(o),this.pluginsByKey[o.key]=o,o.spec.state&&this.fields.push(new Tr(o.key,o.spec.state,o))})}}class jo{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let o=0;o<this.config.plugins.length;o++)if(o!=n){let r=this.config.plugins[o];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],o=this.applyInner(e),r=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let c=r?r[s].n:0,d=r?r[s].state:this,u=c<n.length&&l.spec.appendTransaction.call(l,c?n.slice(c):n,d,o);if(u&&o.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!r){r=[];for(let f=0;f<this.config.plugins.length;f++)r.push(f<s?{state:o,n:n.length}:{state:this,n:0})}n.push(u),o=o.applyInner(u),i=!0}r&&(r[s]={state:o,n:n.length})}}if(!i)return{state:o,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new jo(this.config),o=this.config.fields;for(let r=0;r<o.length;r++){let i=o[r];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new j0(this)}static create(e){let n=new tl(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new jo(n);for(let r=0;r<n.fields.length;r++)o[n.fields[r].name]=n.fields[r].init(e,o);return o}reconfigure(e){let n=new tl(this.schema,e.plugins),o=n.fields,r=new jo(n);for(let i=0;i<o.length;i++){let s=o[i].name;r[s]=this.hasOwnProperty(s)?this[s]:o[i].init(e,r)}return r}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(o=>o.toJSON())),e&&typeof e=="object")for(let o in e){if(o=="doc"||o=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[o],i=r.spec.state;i&&i.toJSON&&(n[o]=i.toJSON.call(r,this[r.key]))}return n}static fromJSON(e,n,o){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new tl(e.schema,e.plugins),i=new jo(r);return r.fields.forEach(s=>{if(s.name=="doc")i.doc=Gn.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=Pe.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(o)for(let l in o){let c=o[l],d=c.spec.state;if(c.key==s.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[s.name]=d.fromJSON.call(c,e,n[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function Af(t,e,n){for(let o in t){let r=t[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=Af(r,e,{})),n[o]=r}return n}class Ot{constructor(e){this.spec=e,this.props={},e.props&&Af(e.props,this,this.props),this.key=e.key?e.key.key:Mf("plugin")}getState(e){return e[this.key]}}const nl=Object.create(null);function Mf(t){return t in nl?t+"$"+ ++nl[t]:(nl[t]=0,t+"$")}class an{constructor(e="key"){this.key=Mf(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ol=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function If(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Of=(t,e,n)=>{let o=If(t,n);if(!o)return!1;let r=rl(o);if(!r){let s=o.blockRange(),l=s&&$o(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(jf(t,r,e,-1))return!0;if(o.parent.content.size==0&&(Uo(i,"end")||Ne.isSelectable(i)))for(let s=o.depth;;s--){let l=Vi(t.doc,o.before(s),o.after(s),ue.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=t.tr.step(l);c.setSelection(Uo(i,"end")?Pe.findFrom(c.doc.resolve(c.mapping.map(r.pos,-1)),-1):Ne.create(c.doc,r.pos-i.nodeSize)),e(c.scrollIntoView())}return!0}if(s==1||o.node(s-1).childCount>1)break}return i.isAtom&&r.depth==o.depth-1?(e&&e(t.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),!0):!1},H0=(t,e,n)=>{let o=If(t,n);if(!o)return!1;let r=rl(o);return r?Df(t,r,e):!1},W0=(t,e,n)=>{let o=Pf(t,n);if(!o)return!1;let r=il(o);return r?Df(t,r,e):!1};function Df(t,e,n){let o=e.nodeBefore,r=o,i=e.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let u=r.lastChild;if(!u)return!1;r=u}let s=e.nodeAfter,l=s,c=e.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let d=Vi(t.doc,i,c,ue.empty);if(!d||d.from!=i||d instanceof ct&&d.slice.size>=c-i)return!1;if(n){let u=t.tr.step(d);u.setSelection(Oe.create(u.doc,i)),n(u.scrollIntoView())}return!0}function Uo(t,e,n=!1){for(let o=t;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(n&&o.childCount!=1)return!1}return!1}const Rf=(t,e,n)=>{let{$head:o,empty:r}=t.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):o.parentOffset>0)return!1;i=rl(o)}let s=i&&i.nodeBefore;return!s||!Ne.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Ne.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function rl(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Pf(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Lf=(t,e,n)=>{let o=Pf(t,n);if(!o)return!1;let r=il(o);if(!r)return!1;let i=r.nodeAfter;if(jf(t,r,e,1))return!0;if(o.parent.content.size==0&&(Uo(i,"start")||Ne.isSelectable(i))){let s=Vi(t.doc,o.before(),o.after(),ue.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(Uo(i,"start")?Pe.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):Ne.create(l.doc,l.mapping.map(r.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&r.depth==o.depth-1?(e&&e(t.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0):!1},$f=(t,e,n)=>{let{$head:o,empty:r}=t.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):o.parentOffset<o.parent.content.size)return!1;i=il(o)}let s=i&&i.nodeAfter;return!s||!Ne.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Ne.create(t.doc,i.pos)).scrollIntoView()),!0)};function il(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const G0=(t,e)=>{let n=t.selection,o=n instanceof Ne,r;if(o){if(n.node.isTextblock||!Jn(t.doc,n.from))return!1;r=n.from}else if(r=$i(t.doc,n.from,-1),r==null)return!1;if(e){let i=t.tr.join(r);o&&i.setSelection(Ne.create(i.doc,r-t.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},q0=(t,e)=>{let n=t.selection,o;if(n instanceof Ne){if(n.node.isTextblock||!Jn(t.doc,n.to))return!1;o=n.to}else if(o=$i(t.doc,n.to,1),o==null)return!1;return e&&e(t.tr.join(o).scrollIntoView()),!0},K0=(t,e)=>{let{$from:n,$to:o}=t.selection,r=n.blockRange(o),i=r&&$o(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},Vf=(t,e)=>{let{$head:n,$anchor:o}=t.selection;return!n.parent.type.spec.code||!n.sameParent(o)?!1:(e&&e(t.tr.insertText(`
|
|
353
|
-
`).scrollIntoView()),!0)};function sl(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const J0=(t,e)=>{let{$head:n,$anchor:o}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(o))return!1;let r=n.node(-1),i=n.indexAfter(-1),s=sl(r.contentMatchAt(i));if(!s||!r.canReplaceWith(i,i,s))return!1;if(e){let l=n.after(),c=t.tr.replaceWith(l,l,s.createAndFill());c.setSelection(Pe.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},Bf=(t,e)=>{let n=t.selection,{$from:o,$to:r}=n;if(n instanceof Bt||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=sl(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,l=t.tr.insert(s,i.createAndFill());l.setSelection(Oe.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},Ff=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(vn(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let o=n.blockRange(),r=o&&$o(o);return r==null?!1:(e&&e(t.tr.lift(o,r).scrollIntoView()),!0)};function X0(t){return(e,n)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof Ne&&e.selection.node.isBlock)return!o.parentOffset||!vn(e.doc,o.pos)?!1:(n&&n(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.depth)return!1;let i=[],s,l,c=!1,d=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){c=o.end(h)==o.pos+(o.depth-h),d=o.start(h)==o.pos-(o.depth-h),l=sl(o.node(h-1).contentMatchAt(o.indexAfter(h-1))),i.unshift(c&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof Oe||e.selection instanceof Bt)&&u.deleteSelection();let f=u.mapping.map(o.pos),p=vn(u.doc,f,i.length,i);if(p||(i[0]=l?{type:l}:null,p=vn(u.doc,f,i.length,i)),!p)return!1;if(u.split(f,i.length,i),!c&&d&&o.node(s).type!=l){let h=u.mapping.map(o.before(s)),m=u.doc.resolve(h);l&&o.node(s-1).canReplaceWith(m.index(),m.index()+1,l)&&u.setNodeMarkup(u.mapping.map(o.before(s)),l)}return n&&n(u.scrollIntoView()),!0}}const Y0=X0(),Q0=(t,e)=>{let{$from:n,to:o}=t.selection,r,i=n.sharedDepth(o);return i==0?!1:(r=n.before(i),e&&e(t.tr.setSelection(Ne.create(t.doc,r))),!0)};function Z0(t,e,n){let o=e.nodeBefore,r=e.nodeAfter,i=e.index();return!o||!r||!o.type.compatibleContent(r.type)?!1:!o.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(r.isTextblock||Jn(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function jf(t,e,n,o){let r=e.nodeBefore,i=e.nodeAfter,s,l,c=r.type.spec.isolating||i.type.spec.isolating;if(!c&&Z0(t,e,n))return!0;let d=!c&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(s=(l=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,m=ne.empty;for(let x=s.length-1;x>=0;x--)m=ne.from(s[x].create(null,m));m=ne.from(r.copy(m));let b=t.tr.step(new dt(e.pos-1,h,e.pos,h,new ue(m,1,0),s.length,!0)),g=b.doc.resolve(h+2*s.length);g.nodeAfter&&g.nodeAfter.type==r.type&&Jn(b.doc,g.pos)&&b.join(g.pos),n(b.scrollIntoView())}return!0}let u=i.type.spec.isolating||o>0&&c?null:Pe.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),p=f&&$o(f);if(p!=null&&p>=e.depth)return n&&n(t.tr.lift(f,p).scrollIntoView()),!0;if(d&&Uo(i,"start",!0)&&Uo(r,"end")){let h=r,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let b=i,g=1;for(;!b.isTextblock;b=b.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,b.content)){if(n){let x=ne.empty;for(let w=m.length-1;w>=0;w--)x=ne.from(m[w].copy(x));let v=t.tr.step(new dt(e.pos-m.length,e.pos+i.nodeSize,e.pos+g,e.pos+i.nodeSize-g,new ue(x,m.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function Uf(t){return function(e,n){let o=e.selection,r=t<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return r.node(i).isTextblock?(n&&n(e.tr.setSelection(Oe.create(e.doc,t<0?r.start(i):r.end(i)))),!0):!1}}const ex=Uf(-1),tx=Uf(1);function nx(t,e=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i),l=s&&Xa(s,t,e);return l?(o&&o(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Hf(t,e=null){return function(n,o){let r=!1;for(let i=0;i<n.selection.ranges.length&&!r;i++){let{$from:{pos:s},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(s,l,(c,d)=>{if(r)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)r=!0;else{let u=n.doc.resolve(d),f=u.index();r=u.parent.canReplaceWith(f,f+1,t)}})}if(!r)return!1;if(o){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:c}}=n.selection.ranges[s];i.setBlockType(l,c,t,e)}o(i.scrollIntoView())}return!0}}function al(...t){return function(e,n,o){for(let r=0;r<t.length;r++)if(t[r](e,n,o))return!0;return!1}}al(ol,Of,Rf),al(ol,Lf,$f),al(Vf,Bf,Ff,Y0),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function ox(t,e=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i);if(!s)return!1;let l=o?n.tr:null;return rx(l,s,t,e)?(o&&o(l.scrollIntoView()),!0):!1}}function rx(t,e,n,o=null){let r=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=s.resolve(e.start-2);i=new Mi(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new Mi(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=Xa(i,n,o,e);return l?(t&&ix(t,e,l,r,n),!0):!1}function ix(t,e,n,o,r){let i=ne.empty;for(let u=n.length-1;u>=0;u--)i=ne.from(n[u].type.create(n[u].attrs,i));t.step(new dt(e.start-(o?2:0),e.end,e.start,e.end,new ue(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==r&&(s=u+1);let l=n.length-s,c=e.start+n.length-(o?2:0),d=e.parent;for(let u=e.startIndex,f=e.endIndex,p=!0;u<f;u++,p=!1)!p&&vn(t.doc,c,l)&&(t.split(c,l),c+=2*l),c+=d.child(u).nodeSize;return t}function sx(t){return function(e,n){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,s=>s.childCount>0&&s.firstChild.type==t);return i?n?o.node(i.depth-1).type==t?ax(e,n,t,i):lx(e,n,i):!0:!1}}function ax(t,e,n,o){let r=t.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new dt(i-1,s,i,s,new ue(ne.from(n.create(null,o.parent.copy())),1,0),1,!0)),o=new Mi(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const l=$o(o);if(l==null)return!1;r.lift(o,l);let c=r.doc.resolve(r.mapping.map(i,-1)-1);return Jn(r.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&r.join(c.pos),e(r.scrollIntoView()),!0}function lx(t,e,n){let o=t.tr,r=n.parent;for(let h=n.end,m=n.endIndex-1,b=n.startIndex;m>b;m--)h-=r.child(m).nodeSize,o.delete(h-1,h+1);let i=o.doc.resolve(n.start),s=i.nodeAfter;if(o.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,c=n.endIndex==r.childCount,d=i.node(-1),u=i.index(-1);if(!d.canReplace(u+(l?0:1),u+1,s.content.append(c?ne.empty:ne.from(r))))return!1;let f=i.pos,p=f+s.nodeSize;return o.step(new dt(f-(l?1:0),p+(c?1:0),f+1,p-1,new ue((l?ne.empty:ne.from(r.copy(ne.empty))).append(c?ne.empty:ne.from(r.copy(ne.empty))),l?0:1,c?0:1),l?0:1)),e(o.scrollIntoView()),!0}function cx(t){return function(e,n){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,d=>d.childCount>0&&d.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,c=l.child(s-1);if(c.type!=t)return!1;if(n){let d=c.lastChild&&c.lastChild.type==l.type,u=ne.from(d?t.create():null),f=new ue(ne.from(t.create(null,ne.from(l.type.create(null,u)))),d?3:1,0),p=i.start,h=i.end;n(e.tr.step(new dt(p-(d?3:1),h,p,h,f,1,!0)).scrollIntoView())}return!0}}const ht=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ho=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let ll=null;const Tn=function(t,e,n){let o=ll||(ll=document.createRange());return o.setEnd(t,n??t.nodeValue.length),o.setStart(t,e||0),o},dx=function(){ll=null},ko=function(t,e,n,o){return n&&(Wf(t,e,n,o,-1)||Wf(t,e,n,o,1))},ux=/^(img|br|input|textarea|hr)$/i;function Wf(t,e,n,o,r){for(var i;;){if(t==n&&e==o)return!0;if(e==(r<0?0:Ht(t))){let s=t.parentNode;if(!s||s.nodeType!=1||zr(t)||ux.test(t.nodeName)||t.contentEditable=="false")return!1;e=ht(t)+(r<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(r<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=r;else return!1;else t=s,e=r<0?Ht(t):0}else return!1}}function Ht(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function fx(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Ht(t)}else if(t.parentNode&&!zr(t))e=ht(t),t=t.parentNode;else return null}}function px(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!zr(t))e=ht(t)+1,t=t.parentNode;else return null}}function hx(t,e,n){for(let o=e==0,r=e==Ht(t);o||r;){if(t==n)return!0;let i=ht(t);if(t=t.parentNode,!t)return!1;o=o&&i==0,r=r&&i==Ht(t)}}function zr(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const ji=function(t){return t.focusNode&&ko(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function wo(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function mx(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function gx(t,e,n){if(t.caretPositionFromPoint)try{let o=t.caretPositionFromPoint(e,n);if(o)return{node:o.offsetNode,offset:Math.min(Ht(o.offsetNode),o.offset)}}catch{}if(t.caretRangeFromPoint){let o=t.caretRangeFromPoint(e,n);if(o)return{node:o.startContainer,offset:Math.min(Ht(o.startContainer),o.startOffset)}}}const hn=typeof navigator<"u"?navigator:null,Gf=typeof document<"u"?document:null,Xn=hn&&hn.userAgent||"",cl=/Edge\/(\d+)/.exec(Xn),qf=/MSIE \d/.exec(Xn),dl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Xn),Dt=!!(qf||dl||cl),Yn=qf?document.documentMode:dl?+dl[1]:cl?+cl[1]:0,Wt=!Dt&&/gecko\/(\d+)/i.test(Xn);Wt&&+(/Firefox\/(\d+)/.exec(Xn)||[0,0])[1];const ul=!Dt&&/Chrome\/(\d+)/.exec(Xn),ut=!!ul,Kf=ul?+ul[1]:0,mt=!Dt&&!!hn&&/Apple Computer/.test(hn.vendor),Wo=mt&&(/Mobile\/\w+/.test(Xn)||!!hn&&hn.maxTouchPoints>2),Gt=Wo||(hn?/Mac/.test(hn.platform):!1),Jf=hn?/Win/.test(hn.platform):!1,zn=/Android \d/.test(Xn),_r=!!Gf&&"webkitFontSmoothing"in Gf.documentElement.style,bx=_r?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function yx(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function _n(t,e){return typeof t=="number"?t:t[e]}function xx(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,o=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*o}}function Xf(t,e,n){let o=t.someProp("scrollThreshold")||0,r=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=Ho(s);continue}let l=s,c=l==i.body,d=c?yx(i):xx(l),u=0,f=0;if(e.top<d.top+_n(o,"top")?f=-(d.top-e.top+_n(r,"top")):e.bottom>d.bottom-_n(o,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+_n(r,"top")-d.top:e.bottom-d.bottom+_n(r,"bottom")),e.left<d.left+_n(o,"left")?u=-(d.left-e.left+_n(r,"left")):e.right>d.right-_n(o,"right")&&(u=e.right-d.right+_n(r,"right")),u||f)if(c)i.defaultView.scrollBy(u,f);else{let h=l.scrollLeft,m=l.scrollTop;f&&(l.scrollTop+=f),u&&(l.scrollLeft+=u);let b=l.scrollLeft-h,g=l.scrollTop-m;e={left:e.left-b,top:e.top-g,right:e.right-b,bottom:e.bottom-g}}let p=c?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:Ho(s)}}function Ex(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),o,r;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=t.root.elementFromPoint(i,s);if(!l||l==t.dom||!t.dom.contains(l))continue;let c=l.getBoundingClientRect();if(c.top>=n-20){o=l,r=c.top;break}}return{refDOM:o,refTop:r,stack:Yf(t.dom)}}function Yf(t){let e=[],n=t.ownerDocument;for(let o=t;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),t!=n);o=Ho(o));return e}function kx({refDOM:t,refTop:e,stack:n}){let o=t?t.getBoundingClientRect().top:0;Qf(n,o==0?0:o-e)}function Qf(t,e){for(let n=0;n<t.length;n++){let{dom:o,top:r,left:i}=t[n];o.scrollTop!=r+e&&(o.scrollTop=r+e),o.scrollLeft!=i&&(o.scrollLeft=i)}}let Go=null;function wx(t){if(t.setActive)return t.setActive();if(Go)return t.focus(Go);let e=Yf(t);t.focus(Go==null?{get preventScroll(){return Go={preventScroll:!0},!0}}:void 0),Go||(Go=!1,Qf(e,0))}function Zf(t,e){let n,o=2e8,r,i=0,s=e.top,l=e.top,c,d;for(let u=t.firstChild,f=0;u;u=u.nextSibling,f++){let p;if(u.nodeType==1)p=u.getClientRects();else if(u.nodeType==3)p=Tn(u).getClientRects();else continue;for(let h=0;h<p.length;h++){let m=p[h];if(m.top<=s&&m.bottom>=l){s=Math.max(m.bottom,s),l=Math.min(m.top,l);let b=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(b<o){n=u,o=b,r=b&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&b&&(i=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=u,d={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=f+1)}}return!n&&c&&(n=c,r=d,o=0),n&&n.nodeType==3?Sx(n,r):!n||o&&n.nodeType==1?{node:t,offset:i}:Zf(n,r)}function Sx(t,e){let n=t.nodeValue.length,o=document.createRange(),r;for(let i=0;i<n;i++){o.setEnd(t,i+1),o.setStart(t,i);let s=Qn(o,1);if(s.top!=s.bottom&&fl(e,s)){r={node:t,offset:i+(e.left>=(s.left+s.right)/2?1:0)};break}}return o.detach(),r||{node:t,offset:0}}function fl(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Nx(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Cx(t,e,n){let{node:o,offset:r}=Zf(e,n),i=-1;if(o.nodeType==1&&!o.firstChild){let s=o.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(o,r,i)}function vx(t,e,n,o){let r=-1;for(let i=e,s=!1;i!=t.dom;){let l=t.docView.nearestDesc(i,!0),c;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((c=l.dom.getBoundingClientRect()).width||c.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&c.left>o.left||c.top>o.top?r=l.posBefore:(!s&&c.right<o.left||c.bottom<o.top)&&(r=l.posAfter),s=!0),!l.contentDOM&&r<0&&!l.node.isText))return(l.node.isBlock?o.top<(c.top+c.bottom)/2:o.left<(c.left+c.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return r>-1?r:t.docView.posFromDOM(e,n,-1)}function ep(t,e,n){let o=t.childNodes.length;if(o&&n.top<n.bottom)for(let r=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-n.top)/(n.bottom-n.top))-2)),i=r;;){let s=t.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let c=0;c<l.length;c++){let d=l[c];if(fl(e,d))return ep(s,e,d)}}if((i=(i+1)%o)==r)break}return t}function Tx(t,e){let n=t.dom.ownerDocument,o,r=0,i=gx(n,e.left,e.top);i&&({node:o,offset:r}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let d=t.dom.getBoundingClientRect();if(!fl(e,d)||(s=ep(t.dom,e,d),!s))return null}if(mt)for(let d=s;o&&d;d=Ho(d))d.draggable&&(o=void 0);if(s=Nx(s,e),o){if(Wt&&o.nodeType==1&&(r=Math.min(r,o.childNodes.length),r<o.childNodes.length)){let u=o.childNodes[r],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&r++}let d;_r&&r&&o.nodeType==1&&(d=o.childNodes[r-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&r--,o==t.dom&&r==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(r==0||o.nodeType!=1||o.childNodes[r-1].nodeName!="BR")&&(l=vx(t,o,r,e))}l==null&&(l=Cx(t,s,e));let c=t.docView.nearestDesc(s,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function tp(t){return t.top<t.bottom||t.left<t.right}function Qn(t,e){let n=t.getClientRects();if(n.length){let o=n[e<0?0:n.length-1];if(tp(o))return o}return Array.prototype.find.call(n,tp)||t.getBoundingClientRect()}const zx=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function np(t,e,n){let{node:o,offset:r,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=_r||Wt;if(o.nodeType==3)if(s&&(zx.test(o.nodeValue)||(n<0?!r:r==o.nodeValue.length))){let c=Qn(Tn(o,r,r),n);if(Wt&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let d=Qn(Tn(o,r-1,r-1),-1);if(d.top==c.top){let u=Qn(Tn(o,r,r+1),-1);if(u.top!=c.top)return Ar(u,u.left<d.left)}}return c}else{let c=r,d=r,u=n<0?1:-1;return n<0&&!r?(d++,u=-1):n>=0&&r==o.nodeValue.length?(c--,u=1):n<0?c--:d++,Ar(Qn(Tn(o,c,d),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&r&&(n<0||r==Ht(o))){let c=o.childNodes[r-1];if(c.nodeType==1)return pl(c.getBoundingClientRect(),!1)}if(i==null&&r<Ht(o)){let c=o.childNodes[r];if(c.nodeType==1)return pl(c.getBoundingClientRect(),!0)}return pl(o.getBoundingClientRect(),n>=0)}if(i==null&&r&&(n<0||r==Ht(o))){let c=o.childNodes[r-1],d=c.nodeType==3?Tn(c,Ht(c)-(s?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return Ar(Qn(d,1),!1)}if(i==null&&r<Ht(o)){let c=o.childNodes[r];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?Tn(c,0,s?0:1):c.nodeType==1?c:null:null;if(d)return Ar(Qn(d,-1),!0)}return Ar(Qn(o.nodeType==3?Tn(o):o,-n),n>=0)}function Ar(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function pl(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function op(t,e,n){let o=t.state,r=t.root.activeElement;o!=e&&t.updateState(e),r!=t.dom&&t.focus();try{return n()}finally{o!=e&&t.updateState(o),r!=t.dom&&r&&r.focus()}}function _x(t,e,n){let o=e.selection,r=n=="up"?o.$from:o.$to;return op(t,e,()=>{let{node:i}=t.docView.domFromPos(r.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=np(t,r.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let c;if(l.nodeType==1)c=l.getClientRects();else if(l.nodeType==3)c=Tn(l,0,l.nodeValue.length).getClientRects();else continue;for(let d=0;d<c.length;d++){let u=c[d];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const Ax=/[\u0590-\u08ac]/;function Mx(t,e,n){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let r=o.parentOffset,i=!r,s=r==o.parent.content.size,l=t.domSelection();return l?!Ax.test(o.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:s:op(t,e,()=>{let{focusNode:c,focusOffset:d,anchorNode:u,anchorOffset:f}=t.domSelectionRange(),p=l.caretBidiLevel;l.modify("move",n,"character");let h=o.depth?t.docView.domAfterPos(o.before()):t.dom,{focusNode:m,focusOffset:b}=t.domSelectionRange(),g=m&&!h.contains(m.nodeType==1?m:m.parentNode)||c==m&&d==b;try{l.collapse(u,f),c&&(c!=u||d!=f)&&l.extend&&l.extend(c,d)}catch{}return p!=null&&(l.caretBidiLevel=p),g}):o.pos==o.start()||o.pos==o.end()}let rp=null,ip=null,sp=!1;function Ix(t,e,n){return rp==e&&ip==n?sp:(rp=e,ip=n,sp=n=="up"||n=="down"?_x(t,e,n):Mx(t,e,n))}const qt=0,ap=1,So=2,mn=3;class Mr{constructor(e,n,o,r){this.parent=e,this.children=n,this.dom=o,this.contentDOM=r,this.dirty=qt,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,o){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,o=this.posAtStart;;n++){let r=this.children[n];if(r==e)return o;o+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=n>ht(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!1;break}if(i.previousSibling)break}if(r==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!0;break}if(i.nextSibling)break}}return r??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let o=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),s;if(i&&(!n||i.node))if(o&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))o=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let o=n;o;o=o.parent)if(o==this)return n}posFromDOM(e,n,o){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,n,o)}return-1}descAt(e){for(let n=0,o=0;n<this.children.length;n++){let r=this.children[n],i=o+r.size;if(o==e&&i!=o){for(;!r.border&&r.children.length;)for(let s=0;s<r.children.length;s++){let l=r.children[s];if(l.size){r=l;break}}return r}if(e<i)return r.descAt(e-o-r.border);o=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,r=0;for(let i=0;o<this.children.length;o++){let s=this.children[o],l=i+s.size;if(l>e||s instanceof dp){r=e-i;break}i=l}if(r)return this.children[o].domFromPos(r-this.children[o].border,n);for(let i;o&&!(i=this.children[o-1]).size&&i instanceof lp&&i.side>=0;o--);if(n<=0){let i,s=!0;for(;i=o?this.children[o-1]:null,!(!i||i.dom.parentNode==this.contentDOM);o--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?ht(i.dom)+1:0}}else{let i,s=!0;for(;i=o<this.children.length?this.children[o]:null,!(!i||i.dom.parentNode==this.contentDOM);o++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?ht(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let s=o,l=0;;l++){let c=this.children[l],d=s+c.size;if(r==-1&&e<=d){let u=s+c.border;if(e>=u&&n<=d-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,n,u);e=s;for(let f=l;f>0;f--){let p=this.children[f-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=ht(p.dom)+1;break}e-=p.size}r==-1&&(r=0)}if(r>-1&&(d>n||l==this.children.length-1)){n=d;for(let u=l+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=ht(f.dom);break}n+=f.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=d}return{node:this.contentDOM,from:e,to:n,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:o}=this.domFromPos(e,0);if(n.nodeType!=1||o==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[o]}setSelection(e,n,o,r=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let h=0,m=0;h<this.children.length;h++){let b=this.children[h],g=m+b.size;if(i>m&&s<g)return b.setSelection(e-m-b.border,n-m-b.border,o,r);m=g}let l=this.domFromPos(e,e?-1:1),c=n==e?l:this.domFromPos(n,n?-1:1),d=o.root.getSelection(),u=o.domSelectionRange(),f=!1;if((Wt||mt)&&e==n){let{node:h,offset:m}=l;if(h.nodeType==3){if(f=!!(m&&h.nodeValue[m-1]==`
|
|
354
|
-
`),f&&m==h.nodeValue.length)for(let b=h,g;b;b=b.parentNode){if(g=b.nextSibling){g.nodeName=="BR"&&(l=c={node:g.parentNode,offset:ht(g)+1});break}let x=b.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let b=h.childNodes[m-1];f=b&&(b.nodeName=="BR"||b.contentEditable=="false")}}if(Wt&&u.focusNode&&u.focusNode!=c.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(r=!0)}if(!(r||f&&mt)&&ko(l.node,l.offset,u.anchorNode,u.anchorOffset)&&ko(c.node,c.offset,u.focusNode,u.focusOffset))return;let p=!1;if((d.extend||e==n)&&!(f&&Wt)){d.collapse(l.node,l.offset);try{e!=n&&d.extend(c.node,c.offset),p=!0}catch{}}if(!p){if(e>n){let m=l;l=c,c=m}let h=document.createRange();h.setEnd(c.node,c.offset),h.setStart(l.node,l.offset),d.removeAllRanges(),d.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let o=0,r=0;r<this.children.length;r++){let i=this.children[r],s=o+i.size;if(o==s?e<=s&&n>=o:e<s&&n>o){let l=o+i.border,c=s-i.border;if(e>=l&&n<=c){this.dirty=e==o||n==s?So:ap,e==l&&n==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=mn:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?So:mn}o=s}this.dirty=So}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let o=e==1?So:ap;n.dirty<o&&(n.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class lp extends Mr{constructor(e,n,o,r){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(o,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==qt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Ox extends Mr{constructor(e,n,o,r){super(e,[],n,null),this.textDOM=o,this.text=r}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class No extends Mr{constructor(e,n,o,r,i){super(e,[],o,r),this.mark=n,this.spec=i}static create(e,n,o,r){let i=r.nodeViews[n.type.name],s=i&&i(n,r,o);return(!s||!s.dom)&&(s=xo.renderSpec(document,n.type.spec.toDOM(n,o),null,n.attrs)),new No(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&mn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=mn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=qt){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=qt}}slice(e,n,o){let r=No.create(this.parent,this.mark,!0,o),i=this.children,s=this.size;n<s&&(i=ml(i,n,s,o)),e>0&&(i=ml(i,0,e,o));for(let l=0;l<i.length;l++)i[l].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Zn extends Mr{constructor(e,n,o,r,i,s,l,c,d){super(e,[],i,s),this.node=n,this.outerDeco=o,this.innerDeco=r,this.nodeDOM=l}static create(e,n,o,r,i,s){let l=i.nodeViews[n.type.name],c,d=l&&l(n,i,()=>{if(!c)return s;if(c.parent)return c.parent.posBeforeChild(c)},o,r),u=d&&d.dom,f=d&&d.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=xo.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let p=u;return u=pp(u,o,n),d?c=new Dx(e,n,o,r,u,f||null,p,d,i,s+1):n.isText?new Ui(e,n,o,r,u,p,i):new Zn(e,n,o,r,u,f||null,p,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let o=this.children[n];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>ne.empty)}return e}matchesNode(e,n,o){return this.dirty==qt&&e.eq(this.node)&&Hi(n,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let o=this.node.inlineContent,r=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,c=new Px(this,s&&s.node,e);Vx(this.node,this.innerDeco,(d,u,f)=>{d.spec.marks?c.syncToMarks(d.spec.marks,o,e,u):d.type.side>=0&&!f&&c.syncToMarks(u==this.node.childCount?je.none:this.node.child(u).marks,o,e,u),c.placeWidget(d,e,r)},(d,u,f,p)=>{c.syncToMarks(d.marks,o,e,p);let h;c.findNodeMatch(d,u,f,p)||l&&e.state.selection.from>r&&e.state.selection.to<r+d.nodeSize&&(h=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(d,u,f,h,e)||c.updateNextNode(d,u,f,e,p,r)||c.addNode(d,u,f,e,r),r+=d.nodeSize}),c.syncToMarks([],o,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==So)&&(s&&this.protectLocalComposition(e,s),up(this.contentDOM,this.children,e),Wo&&Bx(this.dom))}localCompositionInfo(e,n){let{from:o,to:r}=e.state.selection;if(!(e.state.selection instanceof Oe)||o<n||r>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=Fx(this.node.content,s,o-n,r-n);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:o,text:r}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new Ox(this,i,n,r);e.input.compositionNodes.push(s),this.children=ml(this.children,o,o+r.length,e,s)}update(e,n,o,r){return this.dirty==mn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,o,r),!0)}updateInner(e,n,o,r){this.updateOuterDeco(n),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=qt}updateOuterDeco(e){if(Hi(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=fp(this.dom,this.nodeDOM,hl(this.outerDeco,this.node,n),hl(e,this.node,n)),this.dom!=o&&(o.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function cp(t,e,n,o,r){pp(o,e,t);let i=new Zn(void 0,t,e,n,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}class Ui extends Zn{constructor(e,n,o,r,i,s,l){super(e,n,o,r,i,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,o,r){return this.dirty==mn||this.dirty!=qt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=qt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=qt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,o){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,o)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,o){let r=this.node.cut(e,n),i=document.createTextNode(r.text);return new Ui(this.parent,r,this.outerDeco,this.innerDeco,i,i,o)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=mn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class dp extends Mr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==qt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Dx extends Zn{constructor(e,n,o,r,i,s,l,c,d,u){super(e,n,o,r,i,s,l,d,u),this.spec=c}update(e,n,o,r){if(this.dirty==mn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,o);return i&&this.updateInner(e,n,o,r),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,o,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,o,r){this.spec.setSelection?this.spec.setSelection(e,n,o.root):super.setSelection(e,n,o,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function up(t,e,n){let o=t.firstChild,r=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==t){for(;l!=o;)o=hp(o),r=!0;o=o.nextSibling}else r=!0,t.insertBefore(l,o);if(s instanceof No){let c=o?o.previousSibling:t.lastChild;up(s.contentDOM,s.children,n),o=c?c.nextSibling:t.firstChild}}for(;o;)o=hp(o),r=!0;r&&n.trackWrites==t&&(n.trackWrites=null)}const Ir=function(t){t&&(this.nodeName=t)};Ir.prototype=Object.create(null);const Co=[new Ir];function hl(t,e,n){if(t.length==0)return Co;let o=n?Co[0]:new Ir,r=[o];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&r.push(o=new Ir(s.nodeName));for(let l in s){let c=s[l];c!=null&&(n&&r.length==1&&r.push(o=new Ir(e.isInline?"span":"div")),l=="class"?o.class=(o.class?o.class+" ":"")+c:l=="style"?o.style=(o.style?o.style+";":"")+c:l!="nodeName"&&(o[l]=c))}}}return r}function fp(t,e,n,o){if(n==Co&&o==Co)return e;let r=e;for(let i=0;i<o.length;i++){let s=o[i],l=n[i];if(i){let c;l&&l.nodeName==s.nodeName&&r!=t&&(c=r.parentNode)&&c.nodeName.toLowerCase()==s.nodeName||(c=document.createElement(s.nodeName),c.pmIsDeco=!0,c.appendChild(r),l=Co[0]),r=c}Rx(r,l||Co[0],s)}return r}function Rx(t,e,n){for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&!(o in n)&&t.removeAttribute(o);for(let o in n)o!="class"&&o!="style"&&o!="nodeName"&&n[o]!=e[o]&&t.setAttribute(o,n[o]);if(e.class!=n.class){let o=e.class?e.class.split(" ").filter(Boolean):[],r=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.remove(o[i]);for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.add(r[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=o.exec(e.style);)t.style.removeProperty(r[1])}n.style&&(t.style.cssText+=n.style)}}function pp(t,e,n){return fp(t,t,Co,hl(e,n,t.nodeType!=1))}function Hi(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function hp(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Px{constructor(e,n,o){this.lock=n,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Lx(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let o=e;o<n;o++)this.top.children[o].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,o,r){let i=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;i<l&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=qt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let c=-1,d=this.top.children.length;r<this.preMatch.index&&(d=Math.min(this.index+3,d));for(let u=this.index;u<d;u++){let f=this.top.children[u];if(f.matchesMark(e[s])&&!this.isLocked(f.dom)){c=u;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let u=No.create(this.top,e[s],n,o);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,o,r){let i=-1,s;if(r>=this.preMatch.index&&(s=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,o))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,c=Math.min(this.top.children.length,l+5);l<c;l++){let d=this.top.children[l];if(d.matchesNode(e,n,o)&&!this.preMatch.matched.has(d)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,o,r,i){let s=this.top.children[r];return s.dirty==mn&&s.dom==s.contentDOM&&(s.dirty=So),s.update(e,n,o,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let o=e.pmViewDesc;if(o){for(let r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==o)return r}return-1}e=n}}updateNextNode(e,n,o,r,i,s){for(let l=this.index;l<this.top.children.length;l++){let c=this.top.children[l];if(c instanceof Zn){let d=this.preMatch.matched.get(c);if(d!=null&&d!=i)return!1;let u=c.dom,f,p=this.isLocked(u)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=mn&&Hi(n,c.outerDeco));if(!p&&c.update(e,n,o,r))return this.destroyBetween(this.index,l),c.dom!=u&&(this.changed=!0),this.index++,!0;if(!p&&(f=this.recreateWrapper(c,e,n,o,r,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=So,f.updateChildren(r,s+1),f.dirty=qt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,o,r,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Hi(o,e.outerDeco)||!r.eq(e.innerDeco))return null;let l=Zn.create(this.top,n,o,r,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let c of l.children)c.parent=l}return e.destroy(),l}addNode(e,n,o,r,i){let s=Zn.create(this.top,e,n,o,r,i);s.contentDOM&&s.updateChildren(r,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,o){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let i=new lp(this.top,e,n,o);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof No;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Ui)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((mt||ut)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let o=document.createElement(e);e=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),e=="BR"&&(o.className="ProseMirror-trailingBreak");let r=new dp(this.top,[],o,null);n!=this.top?n.children.push(r):n.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Lx(t,e){let n=e,o=n.children.length,r=t.childCount,i=new Map,s=[];e:for(;r>0;){let l;for(;;)if(o){let d=n.children[o-1];if(d instanceof No)n=d,o=d.children.length;else{l=d,o--;break}}else{if(n==e)break e;o=n.parent.children.indexOf(n),n=n.parent}let c=l.node;if(c){if(c!=t.child(r-1))break;--r,i.set(l,r),s.push(l)}}return{index:r,matched:i,matches:s.reverse()}}function $x(t,e){return t.type.side-e.type.side}function Vx(t,e,n,o){let r=e.locals(t),i=0;if(r.length==0){for(let d=0;d<t.childCount;d++){let u=t.child(d);o(u,r,e.forChild(i,u),d),i+=u.nodeSize}return}let s=0,l=[],c=null;for(let d=0;;){let u,f;for(;s<r.length&&r[s].to==i;){let g=r[s++];g.widget&&(u?(f||(f=[u])).push(g):u=g)}if(u)if(f){f.sort($x);for(let g=0;g<f.length;g++)n(f[g],d,!!c)}else n(u,d,!!c);let p,h;if(c)h=-1,p=c,c=null;else if(d<t.childCount)h=d,p=t.child(d++);else break;for(let g=0;g<l.length;g++)l[g].to<=i&&l.splice(g--,1);for(;s<r.length&&r[s].from<=i&&r[s].to>i;)l.push(r[s++]);let m=i+p.nodeSize;if(p.isText){let g=m;s<r.length&&r[s].from<g&&(g=r[s].from);for(let x=0;x<l.length;x++)l[x].to<g&&(g=l[x].to);g<m&&(c=p.cut(g-i),p=p.cut(0,g-i),m=g,h=-1)}else for(;s<r.length&&r[s].to<m;)s++;let b=p.isInline&&!p.isLeaf?l.filter(g=>!g.inline):l.slice();o(p,b,e.forChild(i,p),h),i=m}}function Bx(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Fx(t,e,n,o){for(let r=0,i=0;r<t.childCount&&i<=o;){let s=t.child(r++),l=i;if(i+=s.nodeSize,!s.isText)continue;let c=s.text;for(;r<t.childCount;){let d=t.child(r++);if(i+=d.nodeSize,!d.isText)break;c+=d.text}if(i>=n){if(i>=o&&c.slice(o-e.length-l,o-l)==e)return o-e.length;let d=l<o?c.lastIndexOf(e,o-l-1):-1;if(d>=0&&d+e.length+l>=n)return l+d;if(n==o&&c.length>=o+e.length-l&&c.slice(o-l,o-l+e.length)==e)return o}}return-1}function ml(t,e,n,o,r){let i=[];for(let s=0,l=0;s<t.length;s++){let c=t[s],d=l,u=l+=c.size;d>=n||u<=e?i.push(c):(d<e&&i.push(c.slice(0,e-d,o)),r&&(i.push(r),r=void 0),u>n&&i.push(c.slice(n-d,c.size,o)))}return i}function gl(t,e=null){let n=t.domSelectionRange(),o=t.state.doc;if(!n.focusNode)return null;let r=t.docView.nearestDesc(n.focusNode),i=r&&r.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=o.resolve(s),c,d;if(ji(n)){for(c=s;r&&!r.node;)r=r.parent;let f=r.node;if(r&&f.isAtom&&Ne.isSelectable(f)&&r.parent&&!(f.isInline&&hx(n.focusNode,n.focusOffset,r.dom))){let p=r.posBefore;d=new Ne(s==p?l:o.resolve(p))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=s,p=s;for(let h=0;h<n.rangeCount;h++){let m=n.getRangeAt(h);f=Math.min(f,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),p=Math.max(p,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[c,s]=p==t.state.selection.anchor?[p,f]:[f,p],l=o.resolve(s)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=o.resolve(c);if(!d){let f=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;d=yl(t,u,l,f)}return d}function mp(t){return t.editable?t.hasFocus():wp(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function An(t,e=!1){let n=t.state.selection;if(xp(t,n),!!mp(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ut){let o=t.domSelectionRange(),r=t.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&ko(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Ux(t);else{let{anchor:o,head:r}=n,i,s;gp&&!(n instanceof Oe)&&(n.$from.parent.inlineContent||(i=bp(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=bp(t,n.to))),t.docView.setSelection(o,r,t,e),gp&&(i&&yp(i),s&&yp(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&jx(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const gp=mt||ut&&Kf<63;function bp(t,e){let{node:n,offset:o}=t.docView.domFromPos(e,0),r=o<n.childNodes.length?n.childNodes[o]:null,i=o?n.childNodes[o-1]:null;if(mt&&r&&r.contentEditable=="false")return bl(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return bl(r);if(i)return bl(i)}}function bl(t){return t.contentEditable="true",mt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function yp(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function jx(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),o=n.anchorNode,r=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=o||n.anchorOffset!=r)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!mp(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Ux(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,o=n.nodeName=="IMG";o?e.collapse(n.parentNode,ht(n)+1):e.collapse(n,0),!o&&!t.state.selection.visible&&Dt&&Yn<=11&&(n.disabled=!0,n.disabled=!1)}function xp(t,e){if(e instanceof Ne){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Ep(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Ep(t)}function Ep(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function yl(t,e,n,o){return t.someProp("createSelectionBetween",r=>r(t,e,n))||Oe.between(e,n,o)}function kp(t){return t.editable&&!t.hasFocus()?!1:wp(t)}function wp(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Hx(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ko(e.node,e.offset,n.anchorNode,n.anchorOffset)}function xl(t,e){let{$anchor:n,$head:o}=t.selection,r=e>0?n.max(o):n.min(o),i=r.parent.inlineContent?r.depth?t.doc.resolve(e>0?r.after():r.before()):null:r;return i&&Pe.findFrom(i,e)}function eo(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Sp(t,e,n){let o=t.state.selection;if(o instanceof Oe)if(n.indexOf("s")>-1){let{$head:r}=o,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(r.pos+i.nodeSize*(e<0?-1:1));return eo(t,new Oe(o.$anchor,s))}else if(o.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let r=xl(t.state,e);return r&&r instanceof Ne?eo(t,r):!1}else if(!(Gt&&n.indexOf("m")>-1)){let r=o.$head,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?r.pos-i.nodeSize:r.pos;return i.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?Ne.isSelectable(i)?eo(t,new Ne(e<0?t.state.doc.resolve(r.pos-i.nodeSize):r)):_r?eo(t,new Oe(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof Ne&&o.node.isInline)return eo(t,new Oe(e>0?o.$to:o.$from));{let r=xl(t.state,e);return r?eo(t,r):!1}}}function Wi(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Or(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function qo(t,e){return e<0?Wx(t):Gx(t)}function Wx(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r,i,s=!1;for(Wt&&n.nodeType==1&&o<Wi(n)&&Or(n.childNodes[o],-1)&&(s=!0);;)if(o>0){if(n.nodeType!=1)break;{let l=n.childNodes[o-1];if(Or(l,-1))r=n,i=--o;else if(l.nodeType==3)n=l,o=n.nodeValue.length;else break}}else{if(Np(n))break;{let l=n.previousSibling;for(;l&&Or(l,-1);)r=n.parentNode,i=ht(l),l=l.previousSibling;if(l)n=l,o=Wi(n);else{if(n=n.parentNode,n==t.dom)break;o=0}}}s?El(t,n,o):r&&El(t,r,i)}function Gx(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r=Wi(n),i,s;for(;;)if(o<r){if(n.nodeType!=1)break;let l=n.childNodes[o];if(Or(l,1))i=n,s=++o;else break}else{if(Np(n))break;{let l=n.nextSibling;for(;l&&Or(l,1);)i=l.parentNode,s=ht(l)+1,l=l.nextSibling;if(l)n=l,o=0,r=Wi(n);else{if(n=n.parentNode,n==t.dom)break;o=r=0}}}i&&El(t,i,s)}function Np(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function qx(t,e){for(;t&&e==t.childNodes.length&&!zr(t);)e=ht(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Kx(t,e){for(;t&&!e&&!zr(t);)e=ht(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function El(t,e,n){if(e.nodeType!=3){let i,s;(s=qx(e,n))?(e=s,n=0):(i=Kx(e,n))&&(e=i,n=i.nodeValue.length)}let o=t.domSelection();if(!o)return;if(ji(o)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),o.removeAllRanges(),o.addRange(i)}else o.extend&&o.extend(e,n);t.domObserver.setCurSelection();let{state:r}=t;setTimeout(()=>{t.state==r&&An(t)},50)}function Cp(t,e){let n=t.state.doc.resolve(e);if(!(ut||Jf)&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left>r.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function vp(t,e,n){let o=t.state.selection;if(o instanceof Oe&&!o.empty||n.indexOf("s")>-1||Gt&&n.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=xl(t.state,e);if(s&&s instanceof Ne)return eo(t,s)}if(!r.parent.inlineContent){let s=e<0?r:i,l=o instanceof Bt?Pe.near(s,e):Pe.findFrom(s,e);return l?eo(t,l):!1}return!1}function Tp(t,e){if(!(t.state.selection instanceof Oe))return!0;let{$head:n,$anchor:o,empty:r}=t.state.selection;if(!n.sameParent(o))return!0;if(!r)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function zp(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Jx(t){if(!mt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let o=e.firstChild;zp(t,o,"true"),setTimeout(()=>zp(t,o,"false"),20)}return!1}function Xx(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Yx(t,e){let n=e.keyCode,o=Xx(e);if(n==8||Gt&&n==72&&o=="c")return Tp(t,-1)||qo(t,-1);if(n==46&&!e.shiftKey||Gt&&n==68&&o=="c")return Tp(t,1)||qo(t,1);if(n==13||n==27)return!0;if(n==37||Gt&&n==66&&o=="c"){let r=n==37?Cp(t,t.state.selection.from)=="ltr"?-1:1:-1;return Sp(t,r,o)||qo(t,r)}else if(n==39||Gt&&n==70&&o=="c"){let r=n==39?Cp(t,t.state.selection.from)=="ltr"?1:-1:1;return Sp(t,r,o)||qo(t,r)}else{if(n==38||Gt&&n==80&&o=="c")return vp(t,-1,o)||qo(t,-1);if(n==40||Gt&&n==78&&o=="c")return Jx(t)||vp(t,1,o)||qo(t,1);if(o==(Gt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function kl(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:o,openStart:r,openEnd:i}=e;for(;r>1&&i>1&&o.childCount==1&&o.firstChild.childCount==1;){r--,i--;let h=o.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),o=h.content}let s=t.someProp("clipboardSerializer")||xo.fromSchema(t.state.schema),l=Pp(),c=l.createElement("div");c.appendChild(s.serializeFragment(o,{document:l}));let d=c.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=Dp[d.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=l.createElement(u[h]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),f++}d=c.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${r} ${i}${f?` -${f}`:""} ${JSON.stringify(n)}`);let p=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
|
|
355
|
-
|
|
356
|
-
`);return{dom:c,text:p,slice:e}}function _p(t,e,n,o,r){let i=r.parent.type.spec.code,s,l;if(!n&&!e)return null;let c=!!e&&(o||i||!n);if(c){if(t.someProp("transformPastedText",p=>{e=p(e,i||o,t)}),i)return l=new ue(ne.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
357
|
-
`))),0,0),t.someProp("transformPasted",p=>{l=p(l,t,!0)}),l;let f=t.someProp("clipboardTextParser",p=>p(e,r,o,t));if(f)l=f;else{let p=r.marks(),{schema:h}=t.state,m=xo.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(b=>{let g=s.appendChild(document.createElement("p"));b&&g.appendChild(m.serializeNode(h.text(b,p)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),s=tE(n),_r&&nE(s);let d=s&&s.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||kr.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||u),context:r,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!Qx.test(p.parentNode.nodeName)?{ignore:!0}:null}})),u)l=oE(Op(l,+u[1],+u[2]),u[4]);else if(l=ue.maxOpen(Zx(l.content,r),!0),l.openStart||l.openEnd){let f=0,p=0;for(let h=l.content.firstChild;f<l.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=l.content.lastChild;p<l.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);l=Op(l,f,p)}return t.someProp("transformPasted",f=>{l=f(l,t,c)}),l}const Qx=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Zx(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(l=>{if(!s)return;let c=r.findWrapping(l.type),d;if(!c)return s=null;if(d=s.length&&i.length&&Mp(c,i,l,s[s.length-1],0))s[s.length-1]=d;else{s.length&&(s[s.length-1]=Ip(s[s.length-1],i.length));let u=Ap(l,c);s.push(u),r=r.matchType(u.type),i=c}}),s)return ne.from(s)}return t}function Ap(t,e,n=0){for(let o=e.length-1;o>=n;o--)t=e[o].create(null,ne.from(t));return t}function Mp(t,e,n,o,r){if(r<t.length&&r<e.length&&t[r]==e[r]){let i=Mp(t,e,n,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==t.length-1?n.type:t[r+1]))return o.copy(o.content.append(ne.from(Ap(n,t,r+1))))}}function Ip(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Ip(t.lastChild,e-1)),o=t.contentMatchAt(t.childCount).fillBefore(ne.empty,!0);return t.copy(n.append(o))}function wl(t,e,n,o,r,i){let s=e<0?t.firstChild:t.lastChild,l=s.content;return t.childCount>1&&(i=0),r<o-1&&(l=wl(l,e,n,o,r+1,i)),r>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=r).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(ne.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function Op(t,e,n){return e<t.openStart&&(t=new ue(wl(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ue(wl(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Dp={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Rp=null;function Pp(){return Rp||(Rp=document.implementation.createHTMLDocument("title"))}let Sl=null;function eE(t){let e=window.trustedTypes;return e?(Sl||(Sl=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Sl.createHTML(t)):t}function tE(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Pp().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t),r;if((r=o&&Dp[o[1].toLowerCase()])&&(t=r.map(i=>"<"+i+">").join("")+t+r.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=eE(t),r)for(let i=0;i<r.length;i++)n=n.querySelector(r[i])||n;return n}function nE(t){let e=t.querySelectorAll(ut?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let o=e[n];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),o)}}function oE(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return t}let{content:r,openStart:i,openEnd:s}=t;for(let l=o.length-2;l>=0;l-=2){let c=n.nodes[o[l]];if(!c||c.hasRequiredAttrs())break;r=ne.from(c.create(o[l+1],r)),i++,s++}return new ue(r,i,s)}const zt={},_t={},rE={touchstart:!0,touchmove:!0};class iE{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function sE(t){for(let e in zt){let n=zt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=o=>{lE(t,o)&&!Cl(t,o)&&(t.editable||!(o.type in _t))&&n(t,o)},rE[e]?{passive:!0}:void 0)}mt&&t.dom.addEventListener("input",()=>null),Nl(t)}function to(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function aE(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Nl(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=o=>Cl(t,o))})}function Cl(t,e){return t.someProp("handleDOMEvents",n=>{let o=n[e.type];return o?o(t,e)||e.defaultPrevented:!1})}function lE(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function cE(t,e){!Cl(t,e)&&zt[e.type]&&(t.editable||!(e.type in _t))&&zt[e.type](t,e)}_t.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!$p(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(zn&&ut&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Wo&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let o=Date.now();t.input.lastIOSEnter=o,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==o&&(t.someProp("handleKeyDown",r=>r(t,wo(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",o=>o(t,n))||Yx(t,n)?n.preventDefault():to(t,"key")},_t.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},_t.keypress=(t,e)=>{let n=e;if($p(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Gt&&n.metaKey)return;if(t.someProp("handleKeyPress",r=>r(t,n))){n.preventDefault();return}let o=t.state.selection;if(!(o instanceof Oe)||!o.$from.sameParent(o.$to)){let r=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!t.someProp("handleTextInput",s=>s(t,o.$from.pos,o.$to.pos,r,i))&&t.dispatch(i()),n.preventDefault()}};function Gi(t){return{left:t.clientX,top:t.clientY}}function dE(t,e){let n=e.x-t.clientX,o=e.y-t.clientY;return n*n+o*o<100}function vl(t,e,n,o,r){if(o==-1)return!1;let i=t.state.doc.resolve(o);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,l=>s>i.depth?l(t,n,i.nodeAfter,i.before(s),r,!0):l(t,n,i.node(s),i.before(s),r,!1)))return!0;return!1}function Ko(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let o=t.state.tr.setSelection(e);o.setMeta("pointer",!0),t.dispatch(o)}function uE(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),o=n.nodeAfter;return o&&o.isAtom&&Ne.isSelectable(o)?(Ko(t,new Ne(n)),!0):!1}function fE(t,e){if(e==-1)return!1;let n=t.state.selection,o,r;n instanceof Ne&&(o=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(Ne.isSelectable(l)){o&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?r=i.before(n.$from.depth):r=i.before(s);break}}return r!=null?(Ko(t,Ne.create(t.state.doc,r)),!0):!1}function pE(t,e,n,o,r){return vl(t,"handleClickOn",e,n,o)||t.someProp("handleClick",i=>i(t,e,o))||(r?fE(t,n):uE(t,n))}function hE(t,e,n,o){return vl(t,"handleDoubleClickOn",e,n,o)||t.someProp("handleDoubleClick",r=>r(t,e,o))}function mE(t,e,n,o){return vl(t,"handleTripleClickOn",e,n,o)||t.someProp("handleTripleClick",r=>r(t,e,o))||gE(t,n,o)}function gE(t,e,n){if(n.button!=0)return!1;let o=t.state.doc;if(e==-1)return o.inlineContent?(Ko(t,Oe.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let i=r.depth+1;i>0;i--){let s=i>r.depth?r.nodeAfter:r.node(i),l=r.before(i);if(s.inlineContent)Ko(t,Oe.create(o,l+1,l+1+s.content.size));else if(Ne.isSelectable(s))Ko(t,Ne.create(o,l));else continue;return!0}}function Tl(t){return qi(t)}const Lp=Gt?"metaKey":"ctrlKey";zt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let o=Tl(t),r=Date.now(),i="singleClick";r-t.input.lastClick.time<500&&dE(n,t.input.lastClick)&&!n[Lp]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:r,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=t.posAtCoords(Gi(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new bE(t,s,n,!!o)):(i=="doubleClick"?hE:mE)(t,s.pos,s.inside,n)?n.preventDefault():to(t,"pointer"))};class bE{constructor(e,n,o,r){this.view=e,this.pos=n,this.event=o,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[Lp],this.allowDefault=o.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const l=r?null:o.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:d}=e.state;(o.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||d instanceof Ne&&d.from<=s&&d.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Wt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),to(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>An(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Gi(e))),this.updateAllowDefault(e),this.allowDefault||!n?to(this.view,"pointer"):pE(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||mt&&this.mightDrag&&!this.mightDrag.node.isAtom||ut&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Ko(this.view,Pe.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):to(this.view,"pointer")}move(e){this.updateAllowDefault(e),to(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}zt.touchstart=t=>{t.input.lastTouch=Date.now(),Tl(t),to(t,"pointer")},zt.touchmove=t=>{t.input.lastTouch=Date.now(),to(t,"pointer")},zt.contextmenu=t=>Tl(t);function $p(t,e){return t.composing?!0:mt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const yE=zn?5e3:-1;_t.compositionstart=_t.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Oe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)||ut&&Jf&&xE(t)))t.markCursor=t.state.storedMarks||n.marks(),qi(t,!0),t.markCursor=null;else if(qi(t,!e.selection.empty),Wt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let o=t.domSelectionRange();for(let r=o.focusNode,i=o.focusOffset;r&&r.nodeType==1&&i!=0;){let s=i<0?r.lastChild:r.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=t.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else r=s,i=-1}}t.input.composing=!0}Vp(t,yE)};function xE(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let o=e.childNodes[n];return o.nodeType==1&&o.contentEditable=="false"}_t.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Vp(t,20))};function Vp(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>qi(t),e))}function Bp(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=kE());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function EE(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=fx(e.focusNode,e.focusOffset),o=px(e.focusNode,e.focusOffset);if(n&&o&&n!=o){let r=o.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||o==i)return i;if(!r||!r.isText(o.nodeValue))return o;if(t.input.compositionNode==o){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return o}}return n||o}function kE(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function qi(t,e=!1){if(!(zn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Bp(t),e||t.docView&&t.docView.dirty){let n=gl(t),o=t.state.selection;return n&&!n.eq(o)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!o.$from.node(o.$from.sharedDepth(o.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function wE(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),r=document.createRange();r.selectNodeContents(e),t.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Dr=Dt&&Yn<15||Wo&&bx<604;zt.copy=_t.cut=(t,e)=>{let n=e,o=t.state.selection,r=n.type=="cut";if(o.empty)return;let i=Dr?null:n.clipboardData,s=o.content(),{dom:l,text:c}=kl(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",c)):wE(t,l),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function SE(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function NE(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,o=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),o.parentNode&&o.parentNode.removeChild(o),n?Rr(t,o.value,null,r,e):Rr(t,o.textContent,o.innerHTML,r,e)},50)}function Rr(t,e,n,o,r){let i=_p(t,e,n,o,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,r,i||ue.empty)))return!0;if(!i)return!1;let s=SE(i),l=s?t.state.tr.replaceSelectionWith(s,o):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Fp(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}_t.paste=(t,e)=>{let n=e;if(t.composing&&!zn)return;let o=Dr?null:n.clipboardData,r=t.input.shiftKey&&t.input.lastKeyCode!=45;o&&Rr(t,Fp(o),o.getData("text/html"),r,n)?n.preventDefault():NE(t,n)};class jp{constructor(e,n,o){this.slice=e,this.move=n,this.node=o}}const CE=Gt?"altKey":"ctrlKey";function Up(t,e){let n=t.someProp("dragCopies",o=>!o(e));return n??!e[CE]}zt.dragstart=(t,e)=>{let n=e,o=t.input.mouseDown;if(o&&o.done(),!n.dataTransfer)return;let r=t.state.selection,i=r.empty?null:t.posAtCoords(Gi(n)),s;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof Ne?r.to-1:r.to))){if(o&&o.mightDrag)s=Ne.create(t.state.doc,o.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(s=Ne.create(t.state.doc,f.posBefore))}}let l=(s||t.state.selection).content(),{dom:c,text:d,slice:u}=kl(t,l);(!n.dataTransfer.files.length||!ut||Kf>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Dr?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",Dr||n.dataTransfer.setData("text/plain",d),t.dragging=new jp(u,Up(t,n),s)},zt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},_t.dragover=_t.dragenter=(t,e)=>e.preventDefault(),_t.drop=(t,e)=>{try{vE(t,e,t.dragging)}finally{t.dragging=null}};function vE(t,e,n){if(!e.dataTransfer)return;let o=t.posAtCoords(Gi(e));if(!o)return;let r=t.state.doc.resolve(o.pos),i=n&&n.slice;i?t.someProp("transformPasted",h=>{i=h(i,t,!1)}):i=_p(t,Fp(e.dataTransfer),Dr?null:e.dataTransfer.getData("text/html"),!1,r);let s=!!(n&&Up(t,e));if(t.someProp("handleDrop",h=>h(t,e,i||ue.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?O0(t.state.doc,r.pos,i):r.pos;l==null&&(l=r.pos);let c=t.state.tr;if(s){let{node:h}=n;h?h.replace(c):c.deleteSelection()}let d=c.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=c.doc;if(u?c.replaceRangeWith(d,d,i.content.firstChild):c.replaceRange(d,d,i),c.doc.eq(f))return;let p=c.doc.resolve(d);if(u&&Ne.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new Ne(p));else{let h=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,b,g,x)=>h=x),c.setSelection(yl(t,p,c.doc.resolve(h)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}zt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&An(t)},20))},zt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},zt.beforeinput=(t,e)=>{if(ut&&zn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:o}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=o||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,wo(8,"Backspace")))))return;let{$cursor:r}=t.state.selection;r&&r.pos>0&&t.dispatch(t.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let t in _t)zt[t]=_t[t];function Pr(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Ki{constructor(e,n){this.toDOM=e,this.spec=n||vo,this.side=this.spec.side||0}map(e,n,o,r){let{pos:i,deleted:s}=e.mapResult(n.from+r,this.side<0?-1:1);return s?null:new ln(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof Ki&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Pr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class no{constructor(e,n){this.attrs=e,this.spec=n||vo}map(e,n,o,r){let i=e.map(n.from+r,this.spec.inclusiveStart?-1:1)-o,s=e.map(n.to+r,this.spec.inclusiveEnd?1:-1)-o;return i>=s?null:new ln(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof no&&Pr(this.attrs,e.attrs)&&Pr(this.spec,e.spec)}static is(e){return e.type instanceof no}destroy(){}}class zl{constructor(e,n){this.attrs=e,this.spec=n||vo}map(e,n,o,r){let i=e.mapResult(n.from+r,1);if(i.deleted)return null;let s=e.mapResult(n.to+r,-1);return s.deleted||s.pos<=i.pos?null:new ln(i.pos-o,s.pos-o,this)}valid(e,n){let{index:o,offset:r}=e.content.findIndex(n.from),i;return r==n.from&&!(i=e.child(o)).isText&&r+i.nodeSize==n.to}eq(e){return this==e||e instanceof zl&&Pr(this.attrs,e.attrs)&&Pr(this.spec,e.spec)}destroy(){}}class ln{constructor(e,n,o){this.from=e,this.to=n,this.type=o}copy(e,n){return new ln(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,o){return this.type.map(e,this,n,o)}static widget(e,n,o){return new ln(e,e,new Ki(n,o))}static inline(e,n,o,r){return new ln(e,n,new no(o,r))}static node(e,n,o,r){return new ln(e,n,new zl(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof no}get widget(){return this.type instanceof Ki}}const Jo=[],vo={};class ft{constructor(e,n){this.local=e.length?e:Jo,this.children=n.length?n:Jo}static create(e,n){return n.length?Ji(n,e,0,vo):Et}find(e,n,o){let r=[];return this.findInner(e??0,n??1e9,r,0,o),r}findInner(e,n,o,r,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&o.push(l.copy(l.from+r,l.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,o,r+l,i)}}map(e,n,o){return this==Et||e.maps.length==0?this:this.mapInner(e,n,0,0,o||vo)}mapInner(e,n,o,r,i){let s;for(let l=0;l<this.local.length;l++){let c=this.local[l].map(e,o,r);c&&c.type.valid(n,c)?(s||(s=[])).push(c):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?TE(this.children,s||[],e,n,o,r,i):s?new ft(s.sort(To),Jo):Et}add(e,n){return n.length?this==Et?ft.create(e,n):this.addInner(e,n,0):this}addInner(e,n,o){let r,i=0;e.forEach((l,c)=>{let d=c+o,u;if(u=Wp(n,l,d)){for(r||(r=this.children.slice());i<r.length&&r[i]<c;)i+=3;r[i]==c?r[i+2]=r[i+2].addInner(l,u,d+1):r.splice(i,0,c,c+l.nodeSize,Ji(u,l,d+1,vo)),i+=3}});let s=Hp(i?Gp(n):n,-o);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new ft(s.length?this.local.concat(s).sort(To):this.local,r||this.children)}remove(e){return e.length==0||this==Et?this:this.removeInner(e,0)}removeInner(e,n){let o=this.children,r=this.local;for(let i=0;i<o.length;i+=3){let s,l=o[i]+n,c=o[i+1]+n;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>l&&f.to<c&&(e[u]=null,(s||(s=[])).push(f));if(!s)continue;o==this.children&&(o=this.children.slice());let d=o[i+2].removeInner(s,l+1);d!=Et?o[i+2]=d:(o.splice(i,3),i-=3)}if(r.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<r.length;l++)r[l].eq(s,n)&&(r==this.local&&(r=this.local.slice()),r.splice(l--,1))}return o==this.children&&r==this.local?this:r.length||o.length?new ft(r,o):Et}forChild(e,n){if(this==Et)return this;if(n.isLeaf)return ft.empty;let o,r;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(o=this.children[l+2]);break}let i=e+1,s=i+n.content.size;for(let l=0;l<this.local.length;l++){let c=this.local[l];if(c.from<s&&c.to>i&&c.type instanceof no){let d=Math.max(i,c.from)-i,u=Math.min(s,c.to)-i;d<u&&(r||(r=[])).push(c.copy(d,u))}}if(r){let l=new ft(r.sort(To),Jo);return o?new oo([l,o]):l}return o||Et}eq(e){if(this==e)return!0;if(!(e instanceof ft)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return _l(this.localsInner(e))}localsInner(e){if(this==Et)return Jo;if(e.inlineContent||!this.local.some(no.is))return this.local;let n=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof no||n.push(this.local[o]);return n}forEachSet(e){e(this)}}ft.empty=new ft([],[]),ft.removeOverlap=_l;const Et=ft.empty;class oo{constructor(e){this.members=e}map(e,n){const o=this.members.map(r=>r.map(e,n,vo));return oo.from(o)}forChild(e,n){if(n.isLeaf)return ft.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,n);i!=Et&&(i instanceof oo?o=o.concat(i.members):o.push(i))}return oo.from(o)}eq(e){if(!(e instanceof oo)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,o=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!n)n=i;else{o&&(n=n.slice(),o=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?_l(o?n:n.sort(To)):Jo}static from(e){switch(e.length){case 0:return Et;case 1:return e[0];default:return new oo(e.every(n=>n instanceof ft)?e:e.reduce((n,o)=>n.concat(o instanceof ft?o:o.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function TE(t,e,n,o,r,i,s){let l=t.slice();for(let d=0,u=i;d<n.maps.length;d++){let f=0;n.maps[d].forEach((p,h,m,b)=>{let g=b-m-(h-p);for(let x=0;x<l.length;x+=3){let v=l[x+1];if(v<0||p>v+u-f)continue;let w=l[x]+u-f;h>=w?l[x+1]=p<=w?-2:-1:p>=u&&g&&(l[x]+=g,l[x+1]+=g)}f+=g}),u=n.maps[d].map(u,-1)}let c=!1;for(let d=0;d<l.length;d+=3)if(l[d+1]<0){if(l[d+1]==-2){c=!0,l[d+1]=-1;continue}let u=n.map(t[d]+i),f=u-r;if(f<0||f>=o.content.size){c=!0;continue}let p=n.map(t[d+1]+i,-1),h=p-r,{index:m,offset:b}=o.content.findIndex(f),g=o.maybeChild(m);if(g&&b==f&&b+g.nodeSize==h){let x=l[d+2].mapInner(n,g,u+1,t[d]+i+1,s);x!=Et?(l[d]=f,l[d+1]=h,l[d+2]=x):(l[d+1]=-2,c=!0)}else c=!0}if(c){let d=zE(l,t,e,n,r,i,s),u=Ji(d,o,0,s);e=u.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,p=0;f<u.children.length;f+=3){let h=u.children[f];for(;p<l.length&&l[p]<h;)p+=3;l.splice(p,0,u.children[f],u.children[f+1],u.children[f+2])}}return new ft(e.sort(To),l)}function Hp(t,e){if(!e||!t.length)return t;let n=[];for(let o=0;o<t.length;o++){let r=t[o];n.push(new ln(r.from+e,r.to+e,r.type))}return n}function zE(t,e,n,o,r,i,s){function l(c,d){for(let u=0;u<c.local.length;u++){let f=c.local[u].map(o,r,d);f?n.push(f):s.onRemove&&s.onRemove(c.local[u].spec)}for(let u=0;u<c.children.length;u+=3)l(c.children[u+2],c.children[u]+d+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&l(t[c+2],e[c]+i+1);return n}function Wp(t,e,n){if(e.isLeaf)return null;let o=n+e.nodeSize,r=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<o&&((r||(r=[])).push(s),t[i]=null);return r}function Gp(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Ji(t,e,n,o){let r=[],i=!1;e.forEach((l,c)=>{let d=Wp(t,l,c+n);if(d){i=!0;let u=Ji(d,l,n+c+1,o);u!=Et&&r.push(c,c+l.nodeSize,u)}});let s=Hp(i?Gp(t):t,-n).sort(To);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(o.onRemove&&o.onRemove(s[l].spec),s.splice(l--,1));return s.length||r.length?new ft(s,r):Et}function To(t,e){return t.from-e.from||t.to-e.to}function _l(t){let e=t;for(let n=0;n<e.length-1;n++){let o=e[n];if(o.from!=o.to)for(let r=n+1;r<e.length;r++){let i=e[r];if(i.from==o.from){i.to!=o.to&&(e==t&&(e=t.slice()),e[r]=i.copy(i.from,o.to),qp(e,r+1,i.copy(o.to,i.to)));continue}else{i.from<o.to&&(e==t&&(e=t.slice()),e[n]=o.copy(o.from,i.from),qp(e,r,o.copy(i.from,o.to)));break}}}return e}function qp(t,e,n){for(;e<t.length&&To(n,t[e])>0;)e++;t.splice(e,0,n)}function Al(t){let e=[];return t.someProp("decorations",n=>{let o=n(t.state);o&&o!=Et&&e.push(o)}),t.cursorWrapper&&e.push(ft.create(t.state.doc,[t.cursorWrapper.deco])),oo.from(e)}const _E={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},AE=Dt&&Yn<=11;class ME{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class IE{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ME,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let r=0;r<o.length;r++)this.queue.push(o[r]);Dt&&Yn<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():mt&&e.composing&&o.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),AE&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,_E)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(kp(this.view)){if(this.suppressingSelectionUpdates)return An(this.view);if(Dt&&Yn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ko(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,o;for(let i=e.focusNode;i;i=Ho(i))n.add(i);for(let i=e.anchorNode;i;i=Ho(i))if(n.has(i)){o=i;break}let r=o&&this.view.docView.nearestDesc(o);if(r&&r.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let o=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&kp(e)&&!this.ignoreSelectionChange(o),i=-1,s=-1,l=!1,c=[];if(e.editable)for(let u=0;u<n.length;u++){let f=this.registerMutation(n[u],c);f&&(i=i<0?f.from:Math.min(f.from,i),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(l=!0))}if(Wt&&c.length){let u=c.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,p]=u;f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let p of u){let h=p.parentNode;h&&h.nodeName=="LI"&&(!f||RE(e,f)!=h)&&p.remove()}}}else if((ut||mt)&&c.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of c)if(u.nodeName=="BR"&&u.parentNode){let f=u.nextSibling;f&&f.nodeType==1&&f.contentEditable=="false"&&u.parentNode.removeChild(u)}}let d=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ji(o)&&(d=gl(e))&&d.eq(Pe.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,An(e),this.currentSelection.set(o),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,s),OE(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,PE(e,c)),this.handleDOMChange(i,s,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||An(e),this.currentSelection.set(o))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let f=e.addedNodes[u];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let r=e.previousSibling,i=e.nextSibling;if(Dt&&Yn<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:f,nextSibling:p}=e.addedNodes[u];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(r=f),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(i=p)}let s=r&&r.parentNode==e.target?ht(r)+1:0,l=o.localPosFromDOM(e.target,s,-1),c=i&&i.parentNode==e.target?ht(i):e.target.childNodes.length,d=o.localPosFromDOM(e.target,c,1);return{from:l,to:d}}else return e.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Kp=new WeakMap,Jp=!1;function OE(t){if(!Kp.has(t)&&(Kp.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Wt,Jp)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Jp=!0}}function Xp(t,e){let n=e.startContainer,o=e.startOffset,r=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return ko(s.node,s.offset,r,i)&&([n,o,r,i]=[r,i,n,o]),{anchorNode:n,anchorOffset:o,focusNode:r,focusOffset:i}}function DE(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return Xp(t,r)}let n;function o(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",o,!0),n?Xp(t,n):null}function RE(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let o=t.docView.nearestDesc(n,!0);if(o&&o.node.isBlock)return n}return null}function PE(t,e){var n;let{focusNode:o,focusOffset:r}=t.domSelectionRange();for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=i.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let l=s;for(;;){let c=l.firstChild;if(!c||c.nodeType!=1||c.contentEditable=="false"||/^(BR|IMG)$/.test(c.nodeName))break;l=c}l.insertBefore(i,l.firstChild),o==i&&t.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function LE(t,e,n){let{node:o,fromOffset:r,toOffset:i,from:s,to:l}=t.docView.parseRange(e,n),c=t.domSelectionRange(),d,u=c.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],ji(c)||d.push({node:c.focusNode,offset:c.focusOffset})),ut&&t.input.lastKeyCode===8)for(let g=i;g>r;g--){let x=o.childNodes[g-1],v=x.pmViewDesc;if(x.nodeName=="BR"&&!v){i=g;break}if(!v||v.size)break}let f=t.state.doc,p=t.someProp("domParser")||kr.fromSchema(t.state.schema),h=f.resolve(s),m=null,b=p.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:r,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:$E,context:h});if(d&&d[0].pos!=null){let g=d[0].pos,x=d[1]&&d[1].pos;x==null&&(x=g),m={anchor:g+s,head:x+s}}return{doc:b,sel:m,from:s,to:l}}function $E(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(mt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||mt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const VE=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function BE(t,e,n,o,r){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let y=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,E=gl(t,y);if(E&&!t.state.selection.eq(E)){if(ut&&zn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",D=>D(t,wo(13,"Enter"))))return;let S=t.state.tr.setSelection(E);y=="pointer"?S.setMeta("pointer",!0):y=="key"&&S.scrollIntoView(),i&&S.setMeta("composition",i),t.dispatch(S)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let c=t.state.selection,d=LE(t,e,n),u=t.state.doc,f=u.slice(d.from,d.to),p,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(p=t.state.selection.to,h="end"):(p=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let m=UE(f.content,d.doc.content,d.from,p,h);if(m&&t.input.domChangeCount++,(Wo&&t.input.lastIOSEnter>Date.now()-225||zn)&&r.some(y=>y.nodeType==1&&!VE.test(y.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",y=>y(t,wo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(o&&c instanceof Oe&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let y=Yp(t,t.state.doc,d.sel);if(y&&!y.eq(t.state.selection)){let E=t.state.tr.setSelection(y);i&&E.setMeta("composition",i),t.dispatch(E)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof Oe&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=d.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=d.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),Dt&&Yn<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)==" "&&(m.start--,m.endA--,m.endB--);let b=d.doc.resolveNoCache(m.start-d.from),g=d.doc.resolveNoCache(m.endB-d.from),x=u.resolve(m.start),v=b.sameParent(g)&&b.parent.inlineContent&&x.end()>=m.endA;if((Wo&&t.input.lastIOSEnter>Date.now()-225&&(!v||r.some(y=>y.nodeName=="DIV"||y.nodeName=="P"))||!v&&b.pos<d.doc.content.size&&(!b.sameParent(g)||!b.parent.inlineContent)&&b.pos<g.pos&&!/\S/.test(d.doc.textBetween(b.pos,g.pos,"","")))&&t.someProp("handleKeyDown",y=>y(t,wo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&jE(u,m.start,m.endA,b,g)&&t.someProp("handleKeyDown",y=>y(t,wo(8,"Backspace")))){zn&&ut&&t.domObserver.suppressSelectionUpdates();return}ut&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),zn&&!v&&b.start()!=g.start()&&g.parentOffset==0&&b.depth==g.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,g=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{t.someProp("handleKeyDown",function(y){return y(t,wo(13,"Enter"))})},20));let w=m.start,T=m.endA,M=y=>{let E=y||t.state.tr.replace(w,T,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let S=Yp(t,E.doc,d.sel);S&&!(ut&&t.composing&&S.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(S.head==w||S.head==E.mapping.map(T)-1)||Dt&&S.empty&&S.head==w)&&E.setSelection(S)}return i&&E.setMeta("composition",i),E.scrollIntoView()},A;if(v)if(b.pos==g.pos){Dt&&Yn<=11&&b.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>An(t),20));let y=M(t.state.tr.delete(w,T)),E=u.resolve(m.start).marksAcross(u.resolve(m.endA));E&&y.ensureMarks(E),t.dispatch(y)}else if(m.endA==m.endB&&(A=FE(b.parent.content.cut(b.parentOffset,g.parentOffset),x.parent.content.cut(x.parentOffset,m.endA-x.start())))){let y=M(t.state.tr);A.type=="add"?y.addMark(w,T,A.mark):y.removeMark(w,T,A.mark),t.dispatch(y)}else if(b.parent.child(b.index()).isText&&b.index()==g.index()-(g.textOffset?0:1)){let y=b.parent.textBetween(b.parentOffset,g.parentOffset),E=()=>M(t.state.tr.insertText(y,w,T));t.someProp("handleTextInput",S=>S(t,w,T,y,E))||t.dispatch(E())}else t.dispatch(M());else t.dispatch(M())}function Yp(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:yl(t,e.resolve(n.anchor),e.resolve(n.head))}function FE(t,e){let n=t.firstChild.marks,o=e.firstChild.marks,r=n,i=o,s,l,c;for(let u=0;u<o.length;u++)r=o[u].removeFromSet(r);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(r.length==1&&i.length==0)l=r[0],s="add",c=u=>u.mark(l.addToSet(u.marks));else if(r.length==0&&i.length==1)l=i[0],s="remove",c=u=>u.mark(l.removeFromSet(u.marks));else return null;let d=[];for(let u=0;u<e.childCount;u++)d.push(c(e.child(u)));if(ne.from(d).eq(t))return{mark:l,type:s}}function jE(t,e,n,o,r){if(n-e<=r.pos-o.pos||Ml(o,!0,!1)<r.pos)return!1;let i=t.resolve(e);if(!o.parent.isTextblock){let l=i.nodeAfter;return l!=null&&n==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(Ml(i,!0,!0));return!s.parent.isTextblock||s.pos>n||Ml(s,!0,!1)<n?!1:o.parent.content.cut(o.parentOffset).eq(s.parent.content)}function Ml(t,e,n){let o=t.depth,r=e?t.end():t.pos;for(;o>0&&(e||t.indexAfter(o)==t.node(o).childCount);)o--,r++,e=!1;if(n){let i=t.node(o).maybeChild(t.indexAfter(o));for(;i&&!i.isLeaf;)i=i.firstChild,r++}return r}function UE(t,e,n,o,r){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(r=="end"){let c=Math.max(0,i-Math.min(s,l));o-=s+c-i}if(s<i&&t.size<e.size){let c=o<=i&&o>=s?i-o:0;i-=c,i&&i<e.size&&Qp(e.textBetween(i-1,i+1))&&(i+=c?1:-1),l=i+(l-s),s=i}else if(l<i){let c=o<=i&&o>=l?i-o:0;i-=c,i&&i<t.size&&Qp(t.textBetween(i-1,i+1))&&(i+=c?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function Qp(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Zp{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new iE,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(rh),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=nh(this),th(this),this.nodeViews=oh(this),this.docView=cp(this.state.doc,eh(this),Al(this),this.dom,this),this.domObserver=new IE(this,(o,r,i,s)=>BE(this,o,r,i,s)),this.domObserver.start(),sE(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Nl(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(rh),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let o in this._props)n[o]=this._props[o];n.state=this.state;for(let o in e)n[o]=e[o];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var o;let r=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(Bp(this),s=!0),this.state=e;let l=r.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=oh(this);WE(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Nl(this),this.editable=nh(this),th(this);let c=Al(this),d=eh(this),u=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(e.doc,d,c);(f||!e.selection.eq(r.selection))&&(s=!0);let p=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Ex(this);if(s){this.domObserver.stop();let h=f&&(Dt||ut)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&HE(r.selection,e.selection);if(f){let m=ut?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=EE(this)),(i||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=cp(e.doc,d,c,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Hx(this))?An(this,h):(xp(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),!((o=this.dragging)===null||o===void 0)&&o.node&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():p&&kx(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Ne){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Xf(this,n.getBoundingClientRect(),e)}else Xf(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let o=this.directPlugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let o=this.state.plugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let o=this.pluginViews[n];o.update&&o.update(this,e)}}updateDraggedNode(e,n){let o=e.node,r=-1;if(this.state.doc.nodeAt(o.from)==o.node)r=o.from;else{let i=o.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==o.node&&(r=i)}this.dragging=new jp(e.slice,e.move,r<0?void 0:Ne.create(this.state.doc,r))}someProp(e,n){let o=this._props&&this._props[e],r;if(o!=null&&(r=n?n(o):o))return r;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(r=n?n(l):l))return r}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(r=n?n(l):l))return r}}hasFocus(){if(Dt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&wx(this.dom),An(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Tx(this,e)}coordsAtPos(e,n=1){return np(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,o=-1){let r=this.docView.posFromDOM(e,n,o);if(r==null)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,n){return Ix(this,n||this.state,e)}pasteHTML(e,n){return Rr(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Rr(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return kl(this,e)}destroy(){this.docView&&(aE(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Al(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,dx())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return cE(this,e)}domSelectionRange(){let e=this.domSelection();return e?mt&&this.root.nodeType===11&&mx(this.dom.ownerDocument)==this.dom&&DE(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Zp.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function eh(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let o in n)o=="class"?e.class+=" "+n[o]:o=="style"?e.style=(e.style?e.style+";":"")+n[o]:!e[o]&&o!="contenteditable"&&o!="nodeName"&&(e[o]=String(n[o]))}),e.translate||(e.translate="no"),[ln.node(0,t.state.doc.content.size,e)]}function th(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:ln.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function nh(t){return!t.someProp("editable",e=>e(t.state)===!1)}function HE(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function oh(t){let e=Object.create(null);function n(o){for(let r in o)Object.prototype.hasOwnProperty.call(e,r)||(e[r]=o[r])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function WE(t,e){let n=0,o=0;for(let r in t){if(t[r]!=e[r])return!0;n++}for(let r in e)o++;return n!=o}function rh(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var ro={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Xi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},GE=typeof navigator<"u"&&/Mac/.test(navigator.platform),qE=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),gt=0;gt<10;gt++)ro[48+gt]=ro[96+gt]=String(gt);for(var gt=1;gt<=24;gt++)ro[gt+111]="F"+gt;for(var gt=65;gt<=90;gt++)ro[gt]=String.fromCharCode(gt+32),Xi[gt]=String.fromCharCode(gt);for(var Il in ro)Xi.hasOwnProperty(Il)||(Xi[Il]=ro[Il]);function KE(t){var e=GE&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||qE&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Xi:ro)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const JE=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),XE=typeof navigator<"u"&&/Win/.test(navigator.platform);function YE(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let o,r,i,s;for(let l=0;l<e.length-1;l++){let c=e[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))JE?s=!0:r=!0;else throw new Error("Unrecognized modifier name: "+c)}return o&&(n="Alt-"+n),r&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function QE(t){let e=Object.create(null);for(let n in t)e[YE(n)]=t[n];return e}function Ol(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function ZE(t){return new Ot({props:{handleKeyDown:ek(t)}})}function ek(t){let e=QE(t);return function(n,o){let r=KE(o),i,s=e[Ol(r,o)];if(s&&s(n.state,n.dispatch,n))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[Ol(r,o,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!(XE&&o.ctrlKey&&o.altKey)&&(i=ro[o.keyCode])&&i!=r){let l=e[Ol(i,o)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var tk=Object.defineProperty,Dl=(t,e)=>{for(var n in e)tk(t,n,{get:e[n],enumerable:!0})};function Yi(t){const{state:e,transaction:n}=t;let{selection:o}=n,{doc:r}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return o},get doc(){return r},get tr(){return o=n.selection,r=n.doc,i=n.storedMarks,n}}}var Qi=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:o}=e,{tr:r}=n,i=this.buildProps(r);return Object.fromEntries(Object.entries(t).map(([s,l])=>[s,(...d)=>{const u=l(...d)(i);return!r.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(r),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:o,state:r}=this,{view:i}=o,s=[],l=!!t,c=t||r.tr,d=()=>(!l&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(c),s.every(f=>f===!0)),u={...Object.fromEntries(Object.entries(n).map(([f,p])=>[f,(...m)=>{const b=this.buildProps(c,e),g=p(...m)(b);return s.push(g),u}])),run:d};return u}createCan(t){const{rawCommands:e,state:n}=this,o=!1,r=t||n.tr,i=this.buildProps(r,o);return{...Object.fromEntries(Object.entries(e).map(([l,c])=>[l,(...d)=>c(...d)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,o)}}buildProps(t,e=!0){const{rawCommands:n,editor:o,state:r}=this,{view:i}=o,s={tr:t,editor:o,view:i,state:Yi({state:r,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([l,c])=>[l,(...d)=>c(...d)(s)]))}};return s}},ih={};Dl(ih,{blur:()=>nk,clearContent:()=>ok,clearNodes:()=>rk,command:()=>ik,createParagraphNear:()=>sk,cut:()=>ak,deleteCurrentNode:()=>lk,deleteNode:()=>ck,deleteRange:()=>dk,deleteSelection:()=>uk,enter:()=>fk,exitCode:()=>pk,extendMarkRange:()=>hk,first:()=>mk,focus:()=>bk,forEach:()=>yk,insertContent:()=>xk,insertContentAt:()=>wk,joinBackward:()=>Ck,joinDown:()=>Nk,joinForward:()=>vk,joinItemBackward:()=>Tk,joinItemForward:()=>zk,joinTextblockBackward:()=>_k,joinTextblockForward:()=>Ak,joinUp:()=>Sk,keyboardShortcut:()=>Ik,lift:()=>Ok,liftEmptyBlock:()=>Dk,liftListItem:()=>Rk,newlineInCode:()=>Pk,resetAttributes:()=>Lk,scrollIntoView:()=>$k,selectAll:()=>Vk,selectNodeBackward:()=>Bk,selectNodeForward:()=>Fk,selectParentNode:()=>jk,selectTextblockEnd:()=>Uk,selectTextblockStart:()=>Hk,setContent:()=>Wk,setMark:()=>uw,setMeta:()=>fw,setNode:()=>pw,setNodeSelection:()=>hw,setTextDirection:()=>mw,setTextSelection:()=>gw,sinkListItem:()=>bw,splitBlock:()=>yw,splitListItem:()=>xw,toggleList:()=>Ew,toggleMark:()=>kw,toggleNode:()=>ww,toggleWrap:()=>Sw,undoInputRule:()=>Nw,unsetAllMarks:()=>Cw,unsetMark:()=>vw,unsetTextDirection:()=>Tw,updateAttributes:()=>zw,wrapIn:()=>_w,wrapInList:()=>Aw});var nk=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),ok=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),rk=()=>({state:t,tr:e,dispatch:n})=>{const{selection:o}=e,{ranges:r}=o;return n&&r.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(l,c)=>{if(l.type.isText)return;const{doc:d,mapping:u}=e,f=d.resolve(u.map(c)),p=d.resolve(u.map(c+l.nodeSize)),h=f.blockRange(p);if(!h)return;const m=$o(h);if(l.type.isTextblock){const{defaultType:b}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,b)}(m||m===0)&&e.lift(h,m)})}),!0},ik=t=>e=>t(e),sk=()=>({state:t,dispatch:e})=>Bf(t,e),ak=(t,e)=>({editor:n,tr:o})=>{const{state:r}=n,i=r.doc.slice(t.from,t.to);o.deleteRange(t.from,t.to);const s=o.mapping.map(e);return o.insert(s,i.content),o.setSelection(new Oe(o.doc.resolve(Math.max(s-1,0)))),!0},lk=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,o=n.$anchor.node();if(o.content.size>0)return!1;const r=t.selection.$anchor;for(let i=r.depth;i>0;i-=1)if(r.node(i).type===o.type){if(e){const l=r.before(i),c=r.after(i);t.delete(l,c).scrollIntoView()}return!0}return!1};function ot(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var ck=t=>({tr:e,state:n,dispatch:o})=>{const r=ot(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r){if(o){const c=i.before(s),d=i.after(s);e.delete(c,d).scrollIntoView()}return!0}return!1},dk=t=>({tr:e,dispatch:n})=>{const{from:o,to:r}=t;return n&&e.delete(o,r),!0},uk=()=>({state:t,dispatch:e})=>ol(t,e),fk=()=>({commands:t})=>t.keyboardShortcut("Enter"),pk=()=>({state:t,dispatch:e})=>J0(t,e);function Rl(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Zi(t,e,n={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>n.strict?e[r]===t[r]:Rl(e[r])?e[r].test(t[r]):e[r]===t[r]):!0}function sh(t,e,n={}){return t.find(o=>o.type===e&&Zi(Object.fromEntries(Object.keys(n).map(r=>[r,o.attrs[r]])),n))}function ah(t,e,n={}){return!!sh(t,e,n)}function Pl(t,e,n){var o;if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(u=>u.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(u=>u.type===e)||(n=n||((o=r.node.marks[0])==null?void 0:o.attrs),!sh([...r.node.marks],e,n)))return;let s=r.index,l=t.start()+r.offset,c=s+1,d=l+r.node.nodeSize;for(;s>0&&ah([...t.parent.child(s-1).marks],e,n);)s-=1,l-=t.parent.child(s).nodeSize;for(;c<t.parent.childCount&&ah([...t.parent.child(c).marks],e,n);)d+=t.parent.child(c).nodeSize,c+=1;return{from:l,to:d}}function Mn(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var hk=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const i=Mn(t,o.schema),{doc:s,selection:l}=n,{$from:c,from:d,to:u}=l;if(r){const f=Pl(c,i,e);if(f&&f.from<=d&&f.to>=u){const p=Oe.create(s,f.from,f.to);n.setSelection(p)}}return!0},mk=t=>e=>{const n=typeof t=="function"?t(e):t;for(let o=0;o<n.length;o+=1)if(n[o](e))return!0;return!1};function lh(t){return t instanceof Oe}function zo(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function ch(t,e=null){if(!e)return null;const n=Pe.atStart(t),o=Pe.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return o;const r=n.from,i=o.to;return e==="all"?Oe.create(t,zo(0,r,i),zo(t.content.size,r,i)):Oe.create(t,zo(e,r,i),zo(e,r,i))}function dh(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function es(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function gk(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var bk=(t=null,e={})=>({editor:n,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(es()||dh())&&o.dom.focus(),gk()&&!es()&&!dh()&&o.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(o.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};if(o.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!lh(n.state.selection))return s(),!0;const l=ch(r.doc,t)||n.state.selection,c=n.state.selection.eq(l);return i&&(c||r.setSelection(l),c&&r.storedMarks&&r.setStoredMarks(r.storedMarks),s()),!0},yk=(t,e)=>n=>t.every((o,r)=>e(o,{...n,index:r})),xk=(t,e)=>({tr:n,commands:o})=>o.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),uh=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const o=e[n];o.nodeType===3&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?t.removeChild(o):o.nodeType===1&&uh(o)}return t};function ts(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return uh(n)}function Lr(t,e,n){if(t instanceof Gn||t instanceof ne)return t;n={slice:!0,parseOptions:{},...n};const o=typeof t=="object"&&t!==null,r=typeof t=="string";if(o)try{if(Array.isArray(t)&&t.length>0)return ne.fromArray(t.map(l=>e.nodeFromJSON(l)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),Lr("",e,n)}if(r){if(n.errorOnInvalidContent){let s=!1,l="";const c=new Qu({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(s=!0,l=typeof d=="string"?d:d.outerHTML,null)}]}})});if(n.slice?kr.fromSchema(c).parseSlice(ts(t),n.parseOptions):kr.fromSchema(c).parse(ts(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=kr.fromSchema(e);return n.slice?i.parseSlice(ts(t),n.parseOptions).content:i.parse(ts(t),n.parseOptions)}return Lr("",e,n)}function Ek(t,e,n){const o=t.steps.length-1;if(o<e)return;const r=t.steps[o];if(!(r instanceof ct||r instanceof dt))return;const i=t.mapping.maps[o];let s=0;i.forEach((l,c,d,u)=>{s===0&&(s=u)}),t.setSelection(Pe.near(t.doc.resolve(s),n))}var kk=t=>!("type"in t),wk=(t,e,n)=>({tr:o,dispatch:r,editor:i})=>{var s;if(r){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const c=g=>{i.emit("contentError",{editor:i,error:g,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Lr(e,i.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(g){c(g)}try{l=Lr(e,i.schema,{parseOptions:d,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(g){return c(g),!1}let{from:u,to:f}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},p=!0,h=!0;if((kk(l)?l:[l]).forEach(g=>{g.check(),p=p?g.isText&&g.marks.length===0:!1,h=h?g.isBlock:!1}),u===f&&h){const{parent:g}=o.doc.resolve(u);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(u-=1,f+=1)}let b;if(p){if(Array.isArray(e))b=e.map(g=>g.text||"").join("");else if(e instanceof ne){let g="";e.forEach(x=>{x.text&&(g+=x.text)}),b=g}else typeof e=="object"&&e&&e.text?b=e.text:b=e;o.insertText(b,u,f)}else{b=l;const g=o.doc.resolve(u),x=g.node(),v=g.parentOffset===0,w=x.isText||x.isTextblock,T=x.content.size>0;v&&w&&T&&(u=Math.max(0,u-1)),o.replaceWith(u,f,b)}n.updateSelection&&Ek(o,o.steps.length-1,-1),n.applyInputRules&&o.setMeta("applyInputRules",{from:u,text:b}),n.applyPasteRules&&o.setMeta("applyPasteRules",{from:u,text:b})}return!0},Sk=()=>({state:t,dispatch:e})=>G0(t,e),Nk=()=>({state:t,dispatch:e})=>q0(t,e),Ck=()=>({state:t,dispatch:e})=>Of(t,e),vk=()=>({state:t,dispatch:e})=>Lf(t,e),Tk=()=>({state:t,dispatch:e,tr:n})=>{try{const o=$i(t.doc,t.selection.$from.pos,-1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},zk=()=>({state:t,dispatch:e,tr:n})=>{try{const o=$i(t.doc,t.selection.$from.pos,1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},_k=()=>({state:t,dispatch:e})=>H0(t,e),Ak=()=>({state:t,dispatch:e})=>W0(t,e);function fh(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Mk(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let o,r,i,s;for(let l=0;l<e.length-1;l+=1){const c=e[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))es()||fh()?s=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return o&&(n=`Alt-${n}`),r&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var Ik=t=>({editor:e,view:n,tr:o,dispatch:r})=>{const i=Mk(t).split(/-(?!$)/),s=i.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{n.someProp("handleKeyDown",d=>d(n,l))});return c?.steps.forEach(d=>{const u=d.map(o.mapping);u&&r&&o.maybeStep(u)}),!0};function io(t,e,n={}){const{from:o,to:r,empty:i}=t.selection,s=e?ot(e,t.schema):null,l=[];t.doc.nodesBetween(o,r,(f,p)=>{if(f.isText)return;const h=Math.max(o,p),m=Math.min(r,p+f.nodeSize);l.push({node:f,from:h,to:m})});const c=r-o,d=l.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>Zi(f.node.attrs,n,{strict:!1}));return i?!!d.length:d.reduce((f,p)=>f+p.to-p.from,0)>=c}var Ok=(t,e={})=>({state:n,dispatch:o})=>{const r=ot(t,n.schema);return io(n,r,e)?K0(n,o):!1},Dk=()=>({state:t,dispatch:e})=>Ff(t,e),Rk=t=>({state:e,dispatch:n})=>{const o=ot(t,e.schema);return sx(o)(e,n)},Pk=()=>({state:t,dispatch:e})=>Vf(t,e);function ns(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function ph(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((o,r)=>(n.includes(r)||(o[r]=t[r]),o),{})}var Lk=(t,e)=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const l=ns(typeof t=="string"?t:t.name,o.schema);if(!l)return!1;l==="node"&&(i=ot(t,o.schema)),l==="mark"&&(s=Mn(t,o.schema));let c=!1;return n.selection.ranges.forEach(d=>{o.doc.nodesBetween(d.$from.pos,d.$to.pos,(u,f)=>{i&&i===u.type&&(c=!0,r&&n.setNodeMarkup(f,void 0,ph(u.attrs,e))),s&&u.marks.length&&u.marks.forEach(p=>{s===p.type&&(c=!0,r&&n.addMark(f,f+u.nodeSize,s.create(ph(p.attrs,e))))})})}),c},$k=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Vk=()=>({tr:t,dispatch:e})=>{if(e){const n=new Bt(t.doc);t.setSelection(n)}return!0},Bk=()=>({state:t,dispatch:e})=>Rf(t,e),Fk=()=>({state:t,dispatch:e})=>$f(t,e),jk=()=>({state:t,dispatch:e})=>Q0(t,e),Uk=()=>({state:t,dispatch:e})=>tx(t,e),Hk=()=>({state:t,dispatch:e})=>ex(t,e);function Ll(t,e,n={},o={}){return Lr(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:o.errorOnInvalidContent})}var Wk=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:o={}}={})=>({editor:r,tr:i,dispatch:s,commands:l})=>{const{doc:c}=i;if(o.preserveWhitespace!=="full"){const d=Ll(t,r.schema,o,{errorOnInvalidContent:e??r.options.enableContentCheck});return s&&i.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:c.content.size},t,{parseOptions:o,errorOnInvalidContent:e??r.options.enableContentCheck})};function hh(t,e){const n=Mn(e,t.schema),{from:o,to:r,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(o,r,c=>{s.push(...c.marks)});const l=s.find(c=>c.type.name===n.name);return l?{...l.attrs}:{}}function mh(t,e){const n=new Sf(t);return e.forEach(o=>{o.steps.forEach(r=>{n.step(r)})}),n}function Gk(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function qk(t,e,n){const o=[];return t.nodesBetween(e.from,e.to,(r,i)=>{n(r)&&o.push({node:r,pos:i})}),o}function Kk(t,e){for(let n=t.depth;n>0;n-=1){const o=t.node(n);if(e(o))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:o}}}function rs(t){return e=>Kk(e.$from,t)}function ye(t,e,n){return t.config[e]===void 0&&t.parent?ye(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?ye(t.parent,e,n):null}):t.config[e]}function $l(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},o=ye(e,"addExtensions",n);return o?[e,...$l(o())]:e}).flat(10)}function Vl(t,e){const n=xo.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function gh(t){return typeof t=="function"}function Ue(t,e=void 0,...n){return gh(t)?e?t.bind(e)(...n):t(...n):t}function Jk(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Xo(t){const e=t.filter(r=>r.type==="extension"),n=t.filter(r=>r.type==="node"),o=t.filter(r=>r.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:o}}function bh(t){const e=[],{nodeExtensions:n,markExtensions:o}=Xo(t),r=[...n,...o],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage,extensions:r},c=ye(s,"addGlobalAttributes",l);if(!c)return;c().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([p,h])=>{e.push({type:f,name:p,attribute:{...i,...h}})})})})}),r.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},c=ye(s,"addAttributes",l);if(!c)return;const d=c();Object.entries(d).forEach(([u,f])=>{const p={...i,...f};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:s.name,name:u,attribute:p})})}),e}function Rt(...t){return t.filter(e=>!!e).reduce((e,n)=>{const o={...e};return Object.entries(n).forEach(([r,i])=>{if(!o[r]){o[r]=i;return}if(r==="class"){const l=i?String(i).split(" "):[],c=o[r]?o[r].split(" "):[],d=l.filter(u=>!c.includes(u));o[r]=[...c,...d].join(" ")}else if(r==="style"){const l=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],c=o[r]?o[r].split(";").map(u=>u.trim()).filter(Boolean):[],d=new Map;c.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),l.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),o[r]=Array.from(d.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else o[r]=i}),o},{})}function $r(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,o)=>Rt(n,o),{})}function Xk(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function yh(t,e){return"style"in t?t:{...t,getAttrs:n=>{const o=t.getAttrs?t.getAttrs(n):t.attrs;if(o===!1)return!1;const r=e.reduce((i,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(n):Xk(n.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...o,...r}}}}function xh(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Jk(n)?!1:n!=null))}function Eh(t){var e,n;const o={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(o.default=t.attribute.default),((n=t?.attribute)==null?void 0:n.validate)!==void 0&&(o.validate=t.attribute.validate),[t.name,o]}function Yk(t,e){var n;const o=bh(t),{nodeExtensions:r,markExtensions:i}=Xo(t),s=(n=r.find(d=>ye(d,"topNode")))==null?void 0:n.name,l=Object.fromEntries(r.map(d=>{const u=o.filter(x=>x.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=t.reduce((x,v)=>{const w=ye(v,"extendNodeSchema",f);return{...x,...w?w(d):{}}},{}),h=xh({...p,content:Ue(ye(d,"content",f)),marks:Ue(ye(d,"marks",f)),group:Ue(ye(d,"group",f)),inline:Ue(ye(d,"inline",f)),atom:Ue(ye(d,"atom",f)),selectable:Ue(ye(d,"selectable",f)),draggable:Ue(ye(d,"draggable",f)),code:Ue(ye(d,"code",f)),whitespace:Ue(ye(d,"whitespace",f)),linebreakReplacement:Ue(ye(d,"linebreakReplacement",f)),defining:Ue(ye(d,"defining",f)),isolating:Ue(ye(d,"isolating",f)),attrs:Object.fromEntries(u.map(Eh))}),m=Ue(ye(d,"parseHTML",f));m&&(h.parseDOM=m.map(x=>yh(x,u)));const b=ye(d,"renderHTML",f);b&&(h.toDOM=x=>b({node:x,HTMLAttributes:$r(x,u)}));const g=ye(d,"renderText",f);return g&&(h.toText=g),[d.name,h]})),c=Object.fromEntries(i.map(d=>{const u=o.filter(g=>g.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=t.reduce((g,x)=>{const v=ye(x,"extendMarkSchema",f);return{...g,...v?v(d):{}}},{}),h=xh({...p,inclusive:Ue(ye(d,"inclusive",f)),excludes:Ue(ye(d,"excludes",f)),group:Ue(ye(d,"group",f)),spanning:Ue(ye(d,"spanning",f)),code:Ue(ye(d,"code",f)),attrs:Object.fromEntries(u.map(Eh))}),m=Ue(ye(d,"parseHTML",f));m&&(h.parseDOM=m.map(g=>yh(g,u)));const b=ye(d,"renderHTML",f);return b&&(h.toDOM=g=>b({mark:g,HTMLAttributes:$r(g,u)})),[d.name,h]}));return new Qu({topNode:s,nodes:l,marks:c})}function Qk(t){const e=t.filter((n,o)=>t.indexOf(n)!==o);return Array.from(new Set(e))}function is(t){return t.sort((n,o)=>{const r=ye(n,"priority")||100,i=ye(o,"priority")||100;return r>i?-1:r<i?1:0})}function kh(t){const e=is($l(t)),n=Qk(e.map(o=>o.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),e}function wh(t,e,n){const{from:o,to:r}=e,{blockSeparator:i=`
|
|
358
|
-
|
|
359
|
-
`,textSerializers:s={}}=n||{};let l="";return t.nodesBetween(o,r,(c,d,u,f)=>{var p;c.isBlock&&d>o&&(l+=i);const h=s?.[c.type.name];if(h)return u&&(l+=h({node:c,pos:d,parent:u,index:f,range:e})),!1;c.isText&&(l+=(p=c?.text)==null?void 0:p.slice(Math.max(o,d)-d,r-d))}),l}function Zk(t,e){const n={from:0,to:t.content.size};return wh(t,n,e)}function Sh(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function ew(t,e){const n=ot(e,t.schema),{from:o,to:r}=t.selection,i=[];t.doc.nodesBetween(o,r,l=>{i.push(l)});const s=i.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function Nh(t,e){const n=ns(typeof e=="string"?e:e.name,t.schema);return n==="node"?ew(t,e):n==="mark"?hh(t,e):{}}function tw(t,e=JSON.stringify){const n={};return t.filter(o=>{const r=e(o);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function nw(t){const e=tw(t);return e.length===1?e:e.filter((n,o)=>!e.filter((i,s)=>s!==o).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function Ch(t){const{mapping:e,steps:n}=t,o=[];return e.maps.forEach((r,i)=>{const s=[];if(r.ranges.length)r.forEach((l,c)=>{s.push({from:l,to:c})});else{const{from:l,to:c}=n[i];if(l===void 0||c===void 0)return;s.push({from:l,to:c})}s.forEach(({from:l,to:c})=>{const d=e.slice(i).map(l,-1),u=e.slice(i).map(c),f=e.invert().map(d,-1),p=e.invert().map(u);o.push({oldRange:{from:f,to:p},newRange:{from:d,to:u}})})}),nw(o)}function Bl(t,e,n){const o=[];return t===e?n.resolve(t).marks().forEach(r=>{const i=n.resolve(t),s=Pl(i,r.type);s&&o.push({mark:r,...s})}):n.nodesBetween(t,e,(r,i)=>{!r||r?.nodeSize===void 0||o.push(...r.marks.map(s=>({from:i,to:i+r.nodeSize,mark:s})))}),o}var ow=(t,e,n,o=20)=>{const r=t.doc.resolve(n);let i=o,s=null;for(;i>0&&s===null;){const l=r.node(i);l?.type.name===e?s=l:i-=1}return[s,i]};function ss(t,e){return e.nodes[t]||e.marks[t]||null}function as(t,e,n){return Object.fromEntries(Object.entries(n).filter(([o])=>{const r=t.find(i=>i.type===e&&i.name===o);return r?r.attribute.keepOnSplit:!1}))}var rw=(t,e=500)=>{let n="";const o=t.parentOffset;return t.parent.nodesBetween(Math.max(0,o-e),o,(r,i,s,l)=>{var c,d;const u=((d=(c=r.type.spec).toText)==null?void 0:d.call(c,{node:r,pos:i,parent:s,index:l}))||r.textContent||"%leaf%";n+=r.isAtom&&!r.isText?u:u.slice(0,Math.max(0,o-i))}),n};function Fl(t,e,n={}){const{empty:o,ranges:r}=t.selection,i=e?Mn(e,t.schema):null;if(o)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>i?i.name===f.type.name:!0).find(f=>Zi(f.attrs,n,{strict:!1}));let s=0;const l=[];if(r.forEach(({$from:f,$to:p})=>{const h=f.pos,m=p.pos;t.doc.nodesBetween(h,m,(b,g)=>{if(!b.isText&&!b.marks.length)return;const x=Math.max(h,g),v=Math.min(m,g+b.nodeSize),w=v-x;s+=w,l.push(...b.marks.map(T=>({mark:T,from:x,to:v})))})}),s===0)return!1;const c=l.filter(f=>i?i.name===f.mark.type.name:!0).filter(f=>Zi(f.mark.attrs,n,{strict:!1})).reduce((f,p)=>f+p.to-p.from,0),d=l.filter(f=>i?f.mark.type!==i&&f.mark.type.excludes(i):!0).reduce((f,p)=>f+p.to-p.from,0);return(c>0?c+d:c)>=s}function iw(t,e,n={}){if(!e)return io(t,null,n)||Fl(t,null,n);const o=ns(e,t.schema);return o==="node"?io(t,e,n):o==="mark"?Fl(t,e,n):!1}var sw=(t,e)=>{const{$from:n,$to:o,$anchor:r}=t.selection;if(e){const i=rs(l=>l.type.name===e)(t.selection);if(!i)return!1;const s=t.doc.resolve(i.pos+1);return r.pos+1===s.end()}return!(o.parentOffset<o.parent.nodeSize-2||n.pos!==o.pos)},aw=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function vh(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Th(t,e){const{nodeExtensions:n}=Xo(e),o=n.find(s=>s.name===t);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=Ue(ye(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function jl(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var o;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((o=t.text)!=null?o:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let r=!0;return t.content.forEach(i=>{r!==!1&&(jl(i,{ignoreWhitespace:n,checkChildren:e})||(r=!1))}),r}return!1}var zh=class Fm{constructor(e){this.position=e}static fromJSON(e){return new Fm(e.position)}toJSON(){return{position:this.position}}};function lw(t,e){const n=e.mapping.mapResult(t.position);return{position:new zh(n.pos),mapResult:n}}function cw(t){return new zh(t)}function dw(t,e,n){var o;const{selection:r}=e;let i=null;if(lh(r)&&(i=r.$cursor),i){const l=(o=t.storedMarks)!=null?o:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(d=>d.type.excludes(n)))}const{ranges:s}=r;return s.some(({$from:l,$to:c})=>{let d=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,c.pos,(u,f,p)=>{if(d)return!1;if(u.isInline){const h=!p||p.type.allowsMarkType(n),m=!!n.isInSet(u.marks)||!u.marks.some(b=>b.type.excludes(n));d=h&&m}return!d}),d})}var uw=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const{selection:i}=n,{empty:s,ranges:l}=i,c=Mn(t,o.schema);if(r)if(s){const d=hh(o,c);n.addStoredMark(c.create({...d,...e}))}else l.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;o.doc.nodesBetween(u,f,(p,h)=>{const m=Math.max(h,u),b=Math.min(h+p.nodeSize,f);p.marks.find(x=>x.type===c)?p.marks.forEach(x=>{c===x.type&&n.addMark(m,b,c.create({...x.attrs,...e}))}):n.addMark(m,b,c.create(e))})});return dw(o,n,c)},fw=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),pw=(t,e={})=>({state:n,dispatch:o,chain:r})=>{const i=ot(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:l})=>Hf(i,{...s,...e})(n)?!0:l.clearNodes()).command(({state:l})=>Hf(i,{...s,...e})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},hw=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,r=zo(t,0,o.content.size),i=Ne.create(o,r);e.setSelection(i)}return!0},mw=(t,e)=>({tr:n,state:o,dispatch:r})=>{const{selection:i}=o;let s,l;return typeof e=="number"?(s=e,l=e):e&&"from"in e&&"to"in e?(s=e.from,l=e.to):(s=i.from,l=i.to),r&&n.doc.nodesBetween(s,l,(c,d)=>{c.isText||n.setNodeMarkup(d,void 0,{...c.attrs,dir:t})}),!0},gw=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,{from:r,to:i}=typeof t=="number"?{from:t,to:t}:t,s=Oe.atStart(o).from,l=Oe.atEnd(o).to,c=zo(r,s,l),d=zo(i,s,l),u=Oe.create(o,c,d);e.setSelection(u)}return!0},bw=t=>({state:e,dispatch:n})=>{const o=ot(t,e.schema);return cx(o)(e,n)};function _h(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const o=n.filter(r=>e?.includes(r.type.name));t.tr.ensureMarks(o)}}var yw=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:o,editor:r})=>{const{selection:i,doc:s}=e,{$from:l,$to:c}=i,d=r.extensionManager.attributes,u=as(d,l.node().type.name,l.node().attrs);if(i instanceof Ne&&i.node.isBlock)return!l.parentOffset||!vn(s,l.pos)?!1:(o&&(t&&_h(n,r.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const f=c.parentOffset===c.parent.content.size,p=l.depth===0?void 0:Gk(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:u}]:void 0,m=vn(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&vn(e.doc,e.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:u}]:void 0),o){if(m&&(i instanceof Oe&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),p&&!f&&!l.parentOffset&&l.parent.type!==p)){const b=e.mapping.map(l.before()),g=e.doc.resolve(b);l.node(-1).canReplaceWith(g.index(),g.index()+1,p)&&e.setNodeMarkup(e.mapping.map(l.before()),p)}t&&_h(n,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},xw=(t,e={})=>({tr:n,state:o,dispatch:r,editor:i})=>{var s;const l=ot(t,o.schema),{$from:c,$to:d}=o.selection,u=o.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(d))return!1;const f=c.node(-1);if(f.type!==l)return!1;const p=i.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(r){let x=ne.empty;const v=c.index(-1)?1:c.index(-2)?2:3;for(let E=c.depth-v;E>=c.depth-3;E-=1)x=ne.from(c.node(E).copy(x));const w=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,T={...as(p,c.node().type.name,c.node().attrs),...e},M=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(T))||void 0;x=x.append(ne.from(l.createAndFill(null,M)||void 0));const A=c.before(c.depth-(v-1));n.replace(A,c.after(-w),new ue(x,4-v,0));let y=-1;n.doc.nodesBetween(A,n.doc.content.size,(E,S)=>{if(y>-1)return!1;E.isTextblock&&E.content.size===0&&(y=S+1)}),y>-1&&n.setSelection(Oe.near(n.doc.resolve(y))),n.scrollIntoView()}return!0}const h=d.pos===c.end()?f.contentMatchAt(0).defaultType:null,m={...as(p,f.type.name,f.attrs),...e},b={...as(p,c.node().type.name,c.node().attrs),...e};n.delete(c.pos,d.pos);const g=h?[{type:l,attrs:m},{type:h,attrs:b}]:[{type:l,attrs:m}];if(!vn(n.doc,c.pos,2))return!1;if(r){const{selection:x,storedMarks:v}=o,{splittableMarks:w}=i.extensionManager,T=v||x.$to.parentOffset&&x.$from.marks();if(n.split(c.pos,2,g).scrollIntoView(),!T||!r)return!0;const M=T.filter(A=>w.includes(A.type.name));n.ensureMarks(M)}return!0},Ul=(t,e)=>{const n=rs(s=>s.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(o===void 0)return!0;const r=t.doc.nodeAt(o);return n.node.type===r?.type&&Jn(t.doc,n.pos)&&t.join(n.pos),!0},Hl=(t,e)=>{const n=rs(s=>s.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(n.start).after(n.depth);if(o===void 0)return!0;const r=t.doc.nodeAt(o);return n.node.type===r?.type&&Jn(t.doc,o)&&t.join(o),!0},Ew=(t,e,n,o={})=>({editor:r,tr:i,state:s,dispatch:l,chain:c,commands:d,can:u})=>{const{extensions:f,splittableMarks:p}=r.extensionManager,h=ot(t,s.schema),m=ot(e,s.schema),{selection:b,storedMarks:g}=s,{$from:x,$to:v}=b,w=x.blockRange(v),T=g||b.$to.parentOffset&&b.$from.marks();if(!w)return!1;const M=rs(A=>Th(A.type.name,f))(b);if(w.depth>=1&&M&&w.depth-M.depth<=1){if(M.node.type===h)return d.liftListItem(m);if(Th(M.node.type.name,f)&&h.validContent(M.node.content)&&l)return c().command(()=>(i.setNodeMarkup(M.pos,h),!0)).command(()=>Ul(i,h)).command(()=>Hl(i,h)).run()}return!n||!T||!l?c().command(()=>u().wrapInList(h,o)?!0:d.clearNodes()).wrapInList(h,o).command(()=>Ul(i,h)).command(()=>Hl(i,h)).run():c().command(()=>{const A=u().wrapInList(h,o),y=T.filter(E=>p.includes(E.type.name));return i.ensureMarks(y),A?!0:d.clearNodes()}).wrapInList(h,o).command(()=>Ul(i,h)).command(()=>Hl(i,h)).run()},kw=(t,e={},n={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=n,s=Mn(t,o.schema);return Fl(o,s,e)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,e)},ww=(t,e,n={})=>({state:o,commands:r})=>{const i=ot(t,o.schema),s=ot(e,o.schema),l=io(o,i,n);let c;return o.selection.$anchor.sameParent(o.selection.$head)&&(c=o.selection.$anchor.parent.attrs),l?r.setNode(s,c):r.setNode(i,{...c,...n})},Sw=(t,e={})=>({state:n,commands:o})=>{const r=ot(t,n.schema);return io(n,r,e)?o.lift(r):o.wrapIn(r,e)},Nw=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let o=0;o<n.length;o+=1){const r=n[o];let i;if(r.spec.isInputRules&&(i=r.getState(t))){if(e){const s=t.tr,l=i.transform;for(let c=l.steps.length-1;c>=0;c-=1)s.step(l.steps[c].invert(l.docs[c]));if(i.text){const c=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,c))}else s.delete(i.from,i.to)}return!0}}return!1},Cw=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:o,ranges:r}=n;return o||e&&r.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},vw=(t,e={})=>({tr:n,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=n,c=Mn(t,o.schema),{$from:d,empty:u,ranges:f}=l;if(!r)return!0;if(u&&s){let{from:p,to:h}=l;const m=(i=d.marks().find(g=>g.type===c))==null?void 0:i.attrs,b=Pl(d,c,m);b&&(p=b.from,h=b.to),n.removeMark(p,h,c)}else f.forEach(p=>{n.removeMark(p.$from.pos,p.$to.pos,c)});return n.removeStoredMark(c),!0},Tw=t=>({tr:e,state:n,dispatch:o})=>{const{selection:r}=n;let i,s;return typeof t=="number"?(i=t,s=t):t&&"from"in t&&"to"in t?(i=t.from,s=t.to):(i=r.from,s=r.to),o&&e.doc.nodesBetween(i,s,(l,c)=>{if(l.isText)return;const d={...l.attrs};delete d.dir,e.setNodeMarkup(c,void 0,d)}),!0},zw=(t,e={})=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const l=ns(typeof t=="string"?t:t.name,o.schema);if(!l)return!1;l==="node"&&(i=ot(t,o.schema)),l==="mark"&&(s=Mn(t,o.schema));let c=!1;return n.selection.ranges.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;let p,h,m,b;n.selection.empty?o.doc.nodesBetween(u,f,(g,x)=>{i&&i===g.type&&(c=!0,m=Math.max(x,u),b=Math.min(x+g.nodeSize,f),p=x,h=g)}):o.doc.nodesBetween(u,f,(g,x)=>{x<u&&i&&i===g.type&&(c=!0,m=Math.max(x,u),b=Math.min(x+g.nodeSize,f),p=x,h=g),x>=u&&x<=f&&(i&&i===g.type&&(c=!0,r&&n.setNodeMarkup(x,void 0,{...g.attrs,...e})),s&&g.marks.length&&g.marks.forEach(v=>{if(s===v.type&&(c=!0,r)){const w=Math.max(x,u),T=Math.min(x+g.nodeSize,f);n.addMark(w,T,s.create({...v.attrs,...e}))}}))}),h&&(p!==void 0&&r&&n.setNodeMarkup(p,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(g=>{s===g.type&&r&&n.addMark(m,b,s.create({...g.attrs,...e}))}))}),c},_w=(t,e={})=>({state:n,dispatch:o})=>{const r=ot(t,n.schema);return nx(r,e)(n,o)},Aw=(t,e={})=>({state:n,dispatch:o})=>{const r=ot(t,n.schema);return ox(r,e)(n,o)},Mw=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(o=>o.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(o=>o!==e):delete this.callbacks[t]),this}once(t,e){const n=(...o)=>{this.off(t,n),e.apply(this,o)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Ah=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},Iw=(t,e)=>{if(Rl(e))return e.exec(t);const n=e(t);if(!n)return null;const o=[n.text];return o.index=n.index,o.input=t,o.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(n.replaceWith)),o};function ls(t){var e;const{editor:n,from:o,to:r,text:i,rules:s,plugin:l}=t,{view:c}=n;if(c.composing)return!1;const d=c.state.doc.resolve(o);if(d.parent.type.spec.code||(e=d.nodeBefore||d.nodeAfter)!=null&&e.marks.find(p=>p.type.spec.code))return!1;let u=!1;const f=rw(d)+i;return s.forEach(p=>{if(u)return;const h=Iw(f,p.find);if(!h)return;const m=c.state.tr,b=Yi({state:c.state,transaction:m}),g={from:o-(h[0].length-i.length),to:r},{commands:x,chain:v,can:w}=new Qi({editor:n,state:b});p.handler({state:b,range:g,match:h,commands:x,chain:v,can:w})===null||!m.steps.length||(p.undoable&&m.setMeta(l,{transform:m,from:o,to:r,text:i}),c.dispatch(m),u=!0)}),u}function Ow(t){const{editor:e,rules:n}=t,o=new Ot({state:{init(){return null},apply(r,i,s){const l=r.getMeta(o);if(l)return l;const c=r.getMeta("applyInputRules");return c&&setTimeout(()=>{let{text:u}=c;typeof u=="string"?u=u:u=Vl(ne.from(u),s.schema);const{from:f}=c,p=f+u.length;ls({editor:e,from:f,to:p,text:u,rules:n,plugin:o})}),r.selectionSet||r.docChanged?null:i}},props:{handleTextInput(r,i,s,l){return ls({editor:e,from:i,to:s,text:l,rules:n,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:i}=r.state.selection;i&&ls({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:o})}),!1)},handleKeyDown(r,i){if(i.key!=="Enter")return!1;const{$cursor:s}=r.state.selection;return s?ls({editor:e,from:s.pos,to:s.pos,text:`
|
|
360
|
-
`,rules:n,plugin:o}):!1}},isInputRules:!0});return o}function Dw(t){return Object.prototype.toString.call(t).slice(8,-1)}function cs(t){return Dw(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Mh(t,e){const n={...t};return cs(t)&&cs(e)&&Object.keys(e).forEach(o=>{cs(e[o])&&cs(t[o])?n[o]=Mh(t[o],e[o]):n[o]=e[o]}),n}var Wl=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...Ue(ye(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Ue(ye(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>Mh(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Vr=class jm extends Wl{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new jm(n)}static handleExit({editor:e,mark:n}){const{tr:o}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const s=r.marks();if(!!!s.find(d=>d?.type.name===n.name))return!1;const c=s.find(d=>d?.type.name===n.name);return c&&o.removeStoredMark(c),o.insertText(" ",r.pos),e.view.dispatch(o),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Rw(t){return typeof t=="number"}var Pw=class{constructor(t){this.find=t.find,this.handler=t.handler}},Lw=(t,e,n)=>{if(Rl(e))return[...t.matchAll(e)];const o=e(t,n);return o?o.map(r=>{const i=[r.text];return i.index=r.index,i.input=t,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function $w(t){const{editor:e,state:n,from:o,to:r,rule:i,pasteEvent:s,dropEvent:l}=t,{commands:c,chain:d,can:u}=new Qi({editor:e,state:n}),f=[];return n.doc.nodesBetween(o,r,(h,m)=>{var b,g,x,v,w;if((g=(b=h.type)==null?void 0:b.spec)!=null&&g.code||!(h.isText||h.isTextblock||h.isInline))return;const T=(w=(v=(x=h.content)==null?void 0:x.size)!=null?v:h.nodeSize)!=null?w:0,M=Math.max(o,m),A=Math.min(r,m+T);if(M>=A)return;const y=h.isText?h.text||"":h.textBetween(M-m,A-m,void 0,"");Lw(y,i.find,s).forEach(S=>{if(S.index===void 0)return;const D=M+S.index+1,W=D+S[0].length,z={from:n.tr.mapping.map(D),to:n.tr.mapping.map(W)},P=i.handler({state:n,range:z,match:S,commands:c,chain:d,can:u,pasteEvent:s,dropEvent:l});f.push(P)})}),f.every(h=>h!==null)}var ds=null,Vw=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function Bw(t){const{editor:e,rules:n}=t;let o=null,r=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const c=({state:u,from:f,to:p,rule:h,pasteEvt:m})=>{const b=u.tr,g=Yi({state:u,transaction:b});if(!(!$w({editor:e,state:g,from:Math.max(f-1,0),to:p.b-1,rule:h,pasteEvent:m,dropEvent:l})||!b.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,b}};return n.map(u=>new Ot({view(f){const p=m=>{var b;o=(b=f.dom.parentElement)!=null&&b.contains(m.target)?f.dom.parentElement:null,o&&(ds=e)},h=()=>{ds&&(ds=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(f,p)=>{if(i=o===f.dom.parentElement,l=p,!i){const h=ds;h?.isEditable&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,p)=>{var h;const m=(h=p.clipboardData)==null?void 0:h.getData("text/html");return s=p,r=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(f,p,h)=>{const m=f[0],b=m.getMeta("uiEvent")==="paste"&&!r,g=m.getMeta("uiEvent")==="drop"&&!i,x=m.getMeta("applyPasteRules"),v=!!x;if(!b&&!g&&!v)return;if(v){let{text:M}=x;typeof M=="string"?M=M:M=Vl(ne.from(M),h.schema);const{from:A}=x,y=A+M.length,E=Vw(M);return c({rule:u,state:h,from:A,to:{b:y},pasteEvt:E})}const w=p.doc.content.findDiffStart(h.doc.content),T=p.doc.content.findDiffEnd(h.doc.content);if(!(!Rw(w)||!T||w===T.b))return c({rule:u,state:h,from:w,to:T,pasteEvt:s})}}))}var us=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=kh(t),this.schema=Yk(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ss(e.name,this.schema)},o=ye(e,"addCommands",n);return o?{...t,...o()}:t},{})}get plugins(){const{editor:t}=this;return is([...this.extensions].reverse()).flatMap(o=>{const r={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:t,type:ss(o.name,this.schema)},i=[],s=ye(o,"addKeyboardShortcuts",r);let l={};if(o.type==="mark"&&ye(o,"exitable",r)&&(l.ArrowRight=()=>Vr.handleExit({editor:t,mark:o})),s){const p=Object.fromEntries(Object.entries(s()).map(([h,m])=>[h,()=>m({editor:t})]));l={...l,...p}}const c=ZE(l);i.push(c);const d=ye(o,"addInputRules",r);if(vh(o,t.options.enableInputRules)&&d){const p=d();if(p&&p.length){const h=Ow({editor:t,rules:p}),m=Array.isArray(h)?h:[h];i.push(...m)}}const u=ye(o,"addPasteRules",r);if(vh(o,t.options.enablePasteRules)&&u){const p=u();if(p&&p.length){const h=Bw({editor:t,rules:p});i.push(...h)}}const f=ye(o,"addProseMirrorPlugins",r);if(f){const p=f();i.push(...p)}return i})}get attributes(){return bh(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Xo(this.extensions);return Object.fromEntries(e.filter(n=>!!ye(n,"addNodeView")).map(n=>{const o=this.attributes.filter(c=>c.type===n.name),r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ot(n.name,this.schema)},i=ye(n,"addNodeView",r);if(!i)return[];const s=i();if(!s)return[];const l=(c,d,u,f,p)=>{const h=$r(c,o);return s({node:c,view:d,getPos:u,decorations:f,innerDecorations:p,editor:t,extension:n,HTMLAttributes:h})};return[n.name,l]}))}dispatchTransaction(t){const{editor:e}=this;return is([...this.extensions].reverse()).reduceRight((o,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:ss(r.name,this.schema)},s=ye(r,"dispatchTransaction",i);return s?l=>{s.call(i,{transaction:l,next:o})}:o},t)}get markViews(){const{editor:t}=this,{markExtensions:e}=Xo(this.extensions);return Object.fromEntries(e.filter(n=>!!ye(n,"addMarkView")).map(n=>{const o=this.attributes.filter(l=>l.type===n.name),r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Mn(n.name,this.schema)},i=ye(n,"addMarkView",r);if(!i)return[];const s=(l,c,d)=>{const u=$r(l,o);return i()({mark:l,view:c,inline:d,editor:t,extension:n,HTMLAttributes:u,updateAttributes:f=>{Qw(l,t,f)}})};return[n.name,s]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const o={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ss(e.name,this.schema)};e.type==="mark"&&((n=Ue(ye(e,"keepOnSplit",o)))==null||n)&&this.splittableMarks.push(e.name);const r=ye(e,"onBeforeCreate",o),i=ye(e,"onCreate",o),s=ye(e,"onUpdate",o),l=ye(e,"onSelectionUpdate",o),c=ye(e,"onTransaction",o),d=ye(e,"onFocus",o),u=ye(e,"onBlur",o),f=ye(e,"onDestroy",o);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),u&&this.editor.on("blur",u),f&&this.editor.on("destroy",f)})}};us.resolve=kh,us.sort=is,us.flatten=$l;var Fw={};Dl(Fw,{ClipboardTextSerializer:()=>Ih,Commands:()=>Oh,Delete:()=>Dh,Drop:()=>Rh,Editable:()=>Ph,FocusEvents:()=>$h,Keymap:()=>Vh,Paste:()=>Bh,Tabindex:()=>Fh,TextDirection:()=>jh,focusEventsPluginKey:()=>Lh});var Kt=class Um extends Wl{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new Um(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},Ih=Kt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ot({key:new an("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:o,selection:r}=e,{ranges:i}=r,s=Math.min(...i.map(u=>u.$from.pos)),l=Math.max(...i.map(u=>u.$to.pos)),c=Sh(n);return wh(o,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),Oh=Kt.create({name:"commands",addCommands(){return{...ih}}}),Dh=Kt.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,o,r;const i=()=>{var s,l,c,d;if((d=(c=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:c.call(l,t))!=null?d:t.getMeta("y-sync$"))return;const u=mh(t.before,[t,...e]);Ch(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(m,b)=>{const g=b+m.nodeSize-2,x=h.oldRange.from<=b&&g<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:b,to:g,newFrom:u.mapping.map(b),newTo:u.mapping.map(g),deletedRange:h.oldRange,newRange:h.newRange,partial:!x,editor:this.editor,transaction:t,combinedTransform:u})})});const p=u.mapping;u.steps.forEach((h,m)=>{var b,g;if(h instanceof sn){const x=p.slice(m).map(h.from,-1),v=p.slice(m).map(h.to),w=p.invert().map(x,-1),T=p.invert().map(v),M=(b=u.doc.nodeAt(x-1))==null?void 0:b.marks.some(y=>y.eq(h.mark)),A=(g=u.doc.nodeAt(v))==null?void 0:g.marks.some(y=>y.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:w,to:T},newRange:{from:x,to:v},partial:!!(A||M),editor:this.editor,transaction:t,combinedTransform:u})}})};(r=(o=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:o.async)==null||r?setTimeout(i,0):i()}}),Rh=Kt.create({name:"drop",addProseMirrorPlugins(){return[new Ot({key:new an("tiptapDrop"),props:{handleDrop:(t,e,n,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:o})}}})]}}),Ph=Kt.create({name:"editable",addProseMirrorPlugins(){return[new Ot({key:new an("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Lh=new an("focusEvents"),$h=Kt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ot({key:Lh,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const o=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,n)=>{t.isFocused=!1;const o=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),Vh=Kt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:c,doc:d}=l,{empty:u,$anchor:f}=c,{pos:p,parent:h}=f,m=f.parent.isTextblock&&p>0?l.doc.resolve(p-1):f,b=m.parent.type.spec.isolating,g=f.pos-f.parentOffset,x=b&&m.parent.childCount===1?g===f.pos:Pe.atStart(d).from===p;return!u||!h.type.isTextblock||h.textContent.length||!x||x&&f.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),o={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...o},i={...o,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return es()||fh()?i:r},addProseMirrorPlugins(){return[new Ot({key:new an("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(b=>b.getMeta("composition")))return;const o=t.some(b=>b.docChanged)&&!e.doc.eq(n.doc),r=t.some(b=>b.getMeta("preventClearDocument"));if(!o||r)return;const{empty:i,from:s,to:l}=e.selection,c=Pe.atStart(e.doc).from,d=Pe.atEnd(e.doc).to;if(i||!(s===c&&l===d)||!jl(n.doc))return;const p=n.tr,h=Yi({state:n,transaction:p}),{commands:m}=new Qi({editor:this.editor,state:h});if(m.clearNodes(),!!p.steps.length)return p}})]}}),Bh=Kt.create({name:"paste",addProseMirrorPlugins(){return[new Ot({key:new an("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Fh=Kt.create({name:"tabindex",addProseMirrorPlugins(){return[new Ot({key:new an("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),jh=Kt.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Xo(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Ot({key:new an("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),jw=class or{constructor(e,n,o=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=o,this.resolvedPos=e,this.editor=n,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,o=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,o=this.to-1}this.editor.commands.insertContentAt({from:n,to:o},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new or(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new or(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new or(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,o)=>{const r=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=this.pos+o+(i?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(s);if(!r&&l.depth<=this.depth)return;const c=new or(l,this.editor,r,r?n:null);r&&(c.actualDepth=this.depth+1),e.push(new or(l,this.editor,r,r?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let o=null,r=this.parent;for(;r&&!o;){if(r.node.type.name===e)if(Object.keys(n).length>0){const i=r.node.attrs,s=Object.keys(n);for(let l=0;l<s.length;l+=1){const c=s[l];if(i[c]!==n[c])break}}else o=r;r=r.parent}return o}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},o=!1){let r=[];if(!this.children||this.children.length===0)return r;const i=Object.keys(n);return this.children.forEach(s=>{o&&r.length>0||(s.node.type.name===e&&i.every(c=>n[c]===s.node.attrs[c])&&r.push(s),!(o&&r.length>0)&&(r=r.concat(s.querySelectorAll(e,n,o))))}),r}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},Uw=`.ProseMirror {
|
|
339
|
+
`}function _o(n,e=!1){const t=n,o=n.querySelector("script[data-zcode-shadow-extension]");if(o)if(e){if(t.__zcmsEventListeners){const i=t.__zcmsEventListeners;i.forEach(function(a){a.forEach(function(l){n.removeEventListener(l.eventName,l.handler,!0)})}),i.clear()}o.remove(),t.__zcmsJQueryExtended&&delete t.__zcmsJQueryExtended,t.__zcmsNativeAPIExtended&&delete t.__zcmsNativeAPIExtended}else return;const r=document.createElement("script");r.setAttribute("data-zcode-shadow-extension","true"),r.textContent=Sy(n),n.insertBefore(r,n.firstChild)}function Cy(){if(typeof window>"u")return 20;try{let n=document.querySelector(".zcode-toolbar");if(!n){const t=document.querySelectorAll("zcode-cms, zcode-editor");for(const o of Array.from(t)){const r=o.shadowRoot;if(r){const i=r.querySelector(".zcode-toolbar");if(i){n=i;break}}}}if(!n)return 20;const e=n.getBoundingClientRect();return e.height>0?e.height:20}catch(n){return console.warn("Failed to get toolbar height:",n),20}}function rr(n,e=0){if(!(typeof window>"u"||!n))try{const t=n.getBoundingClientRect(),o=window.pageYOffset||document.documentElement.scrollTop,r=Cy(),i=t.top+o-r-e;window.scrollTo({top:Math.max(0,i),behavior:"smooth"})}catch(t){console.warn("Failed to scroll to element:",t);try{const o=n.getBoundingClientRect(),r=window.pageYOffset||document.documentElement.scrollTop,i=o.top+r-20;window.scrollTo({top:Math.max(0,i),behavior:"smooth"})}catch(o){console.error("Scroll fallback also failed:",o)}}}const{entries:Ad,setPrototypeOf:Id,isFrozen:Ny,getPrototypeOf:vy,getOwnPropertyDescriptor:Ty}=Object;let{freeze:Et,seal:Bt,create:da}=Object,{apply:ua,construct:fa}=typeof Reflect<"u"&&Reflect;Et||(Et=function(e){return e}),Bt||(Bt=function(e){return e}),ua||(ua=function(e,t){for(var o=arguments.length,r=new Array(o>2?o-2:0),i=2;i<o;i++)r[i-2]=arguments[i];return e.apply(t,r)}),fa||(fa=function(e){for(var t=arguments.length,o=new Array(t>1?t-1:0),r=1;r<t;r++)o[r-1]=arguments[r];return new e(...o)});const li=St(Array.prototype.forEach),zy=St(Array.prototype.lastIndexOf),_d=St(Array.prototype.pop),ir=St(Array.prototype.push),My=St(Array.prototype.splice),ci=St(String.prototype.toLowerCase),pa=St(String.prototype.toString),ha=St(String.prototype.match),sr=St(String.prototype.replace),Ay=St(String.prototype.indexOf),Iy=St(String.prototype.trim),nn=St(Object.prototype.hasOwnProperty),wt=St(RegExp.prototype.test),ar=_y(TypeError);function St(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,o=new Array(t>1?t-1:0),r=1;r<t;r++)o[r-1]=arguments[r];return ua(n,e,o)}}function _y(n){return function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return fa(n,t)}}function _e(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ci;Id&&Id(n,null);let o=e.length;for(;o--;){let r=e[o];if(typeof r=="string"){const i=t(r);i!==r&&(Ny(e)||(e[o]=i),r=i)}n[r]=!0}return n}function Oy(n){for(let e=0;e<n.length;e++)nn(n,e)||(n[e]=null);return n}function cn(n){const e=da(null);for(const[t,o]of Ad(n))nn(n,t)&&(Array.isArray(o)?e[t]=Oy(o):o&&typeof o=="object"&&o.constructor===Object?e[t]=cn(o):e[t]=o);return e}function lr(n,e){for(;n!==null;){const o=Ty(n,e);if(o){if(o.get)return St(o.get);if(typeof o.value=="function")return St(o.value)}n=vy(n)}function t(){return null}return t}const Od=Et(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ma=Et(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ga=Et(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Dy=Et(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),ya=Et(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Py=Et(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Dd=Et(["#text"]),Pd=Et(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),ba=Et(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Rd=Et(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),di=Et(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ry=Bt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ly=Bt(/<%[\w\W]*|[\w\W]*%>/gm),$y=Bt(/\$\{[\w\W]*/gm),Vy=Bt(/^data-[\-\w.\u00B7-\uFFFF]+$/),By=Bt(/^aria-[\-\w]+$/),Ld=Bt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Fy=Bt(/^(?:\w+script|data):/i),jy=Bt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),$d=Bt(/^html$/i),Hy=Bt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Vd=Object.freeze({__proto__:null,ARIA_ATTR:By,ATTR_WHITESPACE:jy,CUSTOM_ELEMENT:Hy,DATA_ATTR:Vy,DOCTYPE_NAME:$d,ERB_EXPR:Ly,IS_ALLOWED_URI:Ld,IS_SCRIPT_OR_DATA:Fy,MUSTACHE_EXPR:Ry,TMPLIT_EXPR:$y});const cr={element:1,text:3,progressingInstruction:7,comment:8,document:9},Uy=function(){return typeof window>"u"?null:window},Wy=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let o=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(o=t.getAttribute(r));const i="dompurify"+(o?"#"+o:"");try{return e.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Bd=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Fd(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Uy();const e=we=>Fd(we);if(e.version="3.3.1",e.removed=[],!n||!n.document||n.document.nodeType!==cr.document||!n.Element)return e.isSupported=!1,e;let{document:t}=n;const o=t,r=o.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:h}=n,m=c.prototype,g=lr(m,"cloneNode"),y=lr(m,"remove"),b=lr(m,"nextSibling"),z=lr(m,"childNodes"),w=lr(m,"parentNode");if(typeof a=="function"){const we=t.createElement("template");we.content&&we.content.ownerDocument&&(t=we.content.ownerDocument)}let T,A="";const{implementation:M,createNodeIterator:k,createDocumentFragment:E,getElementsByTagName:x}=t,{importNode:B}=o;let $=Bd();e.isSupported=typeof Ad=="function"&&typeof w=="function"&&M&&M.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:O,ERB_EXPR:D,TMPLIT_EXPR:P,DATA_ATTR:q,ARIA_ATTR:W,IS_SCRIPT_OR_DATA:R,ATTR_WHITESPACE:K,CUSTOM_ELEMENT:X}=Vd;let{IS_ALLOWED_URI:te}=Vd,oe=null;const G=_e({},[...Od,...ma,...ga,...ya,...Dd]);let Z=null;const Y=_e({},[...Pd,...ba,...Rd,...di]);let ee=Object.seal(da(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),le=null,ge=null;const Ne=Object.seal(da(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Re=!0,C=!0,L=!1,V=!0,S=!1,N=!0,F=!1,ne=!1,me=!1,De=!1,Te=!1,v=!1,I=!0,J=!1;const he="user-content-";let Ae=!0,ye=!1,U={},Q=null;const ve=_e({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Le=null;const dt=_e({},["audio","video","img","source","image","track"]);let Tt=null;const Lt=_e({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),$t="http://www.w3.org/1998/Math/MathML",Xt="http://www.w3.org/2000/svg",j="http://www.w3.org/1999/xhtml";let H=j,ie=!1,de=null;const Oe=_e({},[$t,Xt,j],pa);let Ye=_e({},["mi","mo","mn","ms","mtext"]),gn=_e({},["annotation-xml"]);const Kr=_e({},["title","style","font","a","script"]);let On=null;const Jr=["application/xhtml+xml","text/html"],Dn="text/html";let Qe=null,yn=null;const $s=t.createElement("form"),Vs=function(_){return _ instanceof RegExp||_ instanceof Function},Jo=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(yn&&yn===_)){if((!_||typeof _!="object")&&(_={}),_=cn(_),On=Jr.indexOf(_.PARSER_MEDIA_TYPE)===-1?Dn:_.PARSER_MEDIA_TYPE,Qe=On==="application/xhtml+xml"?pa:ci,oe=nn(_,"ALLOWED_TAGS")?_e({},_.ALLOWED_TAGS,Qe):G,Z=nn(_,"ALLOWED_ATTR")?_e({},_.ALLOWED_ATTR,Qe):Y,de=nn(_,"ALLOWED_NAMESPACES")?_e({},_.ALLOWED_NAMESPACES,pa):Oe,Tt=nn(_,"ADD_URI_SAFE_ATTR")?_e(cn(Lt),_.ADD_URI_SAFE_ATTR,Qe):Lt,Le=nn(_,"ADD_DATA_URI_TAGS")?_e(cn(dt),_.ADD_DATA_URI_TAGS,Qe):dt,Q=nn(_,"FORBID_CONTENTS")?_e({},_.FORBID_CONTENTS,Qe):ve,le=nn(_,"FORBID_TAGS")?_e({},_.FORBID_TAGS,Qe):cn({}),ge=nn(_,"FORBID_ATTR")?_e({},_.FORBID_ATTR,Qe):cn({}),U=nn(_,"USE_PROFILES")?_.USE_PROFILES:!1,Re=_.ALLOW_ARIA_ATTR!==!1,C=_.ALLOW_DATA_ATTR!==!1,L=_.ALLOW_UNKNOWN_PROTOCOLS||!1,V=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,S=_.SAFE_FOR_TEMPLATES||!1,N=_.SAFE_FOR_XML!==!1,F=_.WHOLE_DOCUMENT||!1,De=_.RETURN_DOM||!1,Te=_.RETURN_DOM_FRAGMENT||!1,v=_.RETURN_TRUSTED_TYPE||!1,me=_.FORCE_BODY||!1,I=_.SANITIZE_DOM!==!1,J=_.SANITIZE_NAMED_PROPS||!1,Ae=_.KEEP_CONTENT!==!1,ye=_.IN_PLACE||!1,te=_.ALLOWED_URI_REGEXP||Ld,H=_.NAMESPACE||j,Ye=_.MATHML_TEXT_INTEGRATION_POINTS||Ye,gn=_.HTML_INTEGRATION_POINTS||gn,ee=_.CUSTOM_ELEMENT_HANDLING||{},_.CUSTOM_ELEMENT_HANDLING&&Vs(_.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ee.tagNameCheck=_.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_.CUSTOM_ELEMENT_HANDLING&&Vs(_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ee.attributeNameCheck=_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ee.allowCustomizedBuiltInElements=_.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),S&&(C=!1),Te&&(De=!0),U&&(oe=_e({},Dd),Z=[],U.html===!0&&(_e(oe,Od),_e(Z,Pd)),U.svg===!0&&(_e(oe,ma),_e(Z,ba),_e(Z,di)),U.svgFilters===!0&&(_e(oe,ga),_e(Z,ba),_e(Z,di)),U.mathMl===!0&&(_e(oe,ya),_e(Z,Rd),_e(Z,di))),_.ADD_TAGS&&(typeof _.ADD_TAGS=="function"?Ne.tagCheck=_.ADD_TAGS:(oe===G&&(oe=cn(oe)),_e(oe,_.ADD_TAGS,Qe))),_.ADD_ATTR&&(typeof _.ADD_ATTR=="function"?Ne.attributeCheck=_.ADD_ATTR:(Z===Y&&(Z=cn(Z)),_e(Z,_.ADD_ATTR,Qe))),_.ADD_URI_SAFE_ATTR&&_e(Tt,_.ADD_URI_SAFE_ATTR,Qe),_.FORBID_CONTENTS&&(Q===ve&&(Q=cn(Q)),_e(Q,_.FORBID_CONTENTS,Qe)),_.ADD_FORBID_CONTENTS&&(Q===ve&&(Q=cn(Q)),_e(Q,_.ADD_FORBID_CONTENTS,Qe)),Ae&&(oe["#text"]=!0),F&&_e(oe,["html","head","body"]),oe.table&&(_e(oe,["tbody"]),delete le.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw ar('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ar('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=_.TRUSTED_TYPES_POLICY,A=T.createHTML("")}else T===void 0&&(T=Wy(h,r)),T!==null&&typeof A=="string"&&(A=T.createHTML(""));Et&&Et(_),yn=_}},Bs=_e({},[...ma,...ga,...Dy]),Fs=_e({},[...ya,...Py]),js=function(_){let ae=w(_);(!ae||!ae.tagName)&&(ae={namespaceURI:H,tagName:"template"});const be=ci(_.tagName),qe=ci(ae.tagName);return de[_.namespaceURI]?_.namespaceURI===Xt?ae.namespaceURI===j?be==="svg":ae.namespaceURI===$t?be==="svg"&&(qe==="annotation-xml"||Ye[qe]):!!Bs[be]:_.namespaceURI===$t?ae.namespaceURI===j?be==="math":ae.namespaceURI===Xt?be==="math"&&gn[qe]:!!Fs[be]:_.namespaceURI===j?ae.namespaceURI===Xt&&!gn[qe]||ae.namespaceURI===$t&&!Ye[qe]?!1:!Fs[be]&&(Kr[be]||!Bs[be]):!!(On==="application/xhtml+xml"&&de[_.namespaceURI]):!1},Yt=function(_){ir(e.removed,{element:_});try{w(_).removeChild(_)}catch{y(_)}},bn=function(_,ae){try{ir(e.removed,{attribute:ae.getAttributeNode(_),from:ae})}catch{ir(e.removed,{attribute:null,from:ae})}if(ae.removeAttribute(_),_==="is")if(De||Te)try{Yt(ae)}catch{}else try{ae.setAttribute(_,"")}catch{}},Hs=function(_){let ae=null,be=null;if(me)_="<remove></remove>"+_;else{const nt=ha(_,/^[\r\n\t ]+/);be=nt&&nt[0]}On==="application/xhtml+xml"&&H===j&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const qe=T?T.createHTML(_):_;if(H===j)try{ae=new p().parseFromString(qe,On)}catch{}if(!ae||!ae.documentElement){ae=M.createDocument(H,"template",null);try{ae.documentElement.innerHTML=ie?A:qe}catch{}}const bt=ae.body||ae.documentElement;return _&&be&&bt.insertBefore(t.createTextNode(be),bt.childNodes[0]||null),H===j?x.call(ae,F?"html":"body")[0]:F?ae.documentElement:bt},Xr=function(_){return k.call(_.ownerDocument||_,_,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},ce=function(_){return _ instanceof f&&(typeof _.nodeName!="string"||typeof _.textContent!="string"||typeof _.removeChild!="function"||!(_.attributes instanceof u)||typeof _.removeAttribute!="function"||typeof _.setAttribute!="function"||typeof _.namespaceURI!="string"||typeof _.insertBefore!="function"||typeof _.hasChildNodes!="function")},ue=function(_){return typeof l=="function"&&_ instanceof l};function xe(we,_,ae){li(we,be=>{be.call(e,_,ae,yn)})}const We=function(_){let ae=null;if(xe($.beforeSanitizeElements,_,null),ce(_))return Yt(_),!0;const be=Qe(_.nodeName);if(xe($.uponSanitizeElement,_,{tagName:be,allowedTags:oe}),N&&_.hasChildNodes()&&!ue(_.firstElementChild)&&wt(/<[/\w!]/g,_.innerHTML)&&wt(/<[/\w!]/g,_.textContent)||_.nodeType===cr.progressingInstruction||N&&_.nodeType===cr.comment&&wt(/<[/\w]/g,_.data))return Yt(_),!0;if(!(Ne.tagCheck instanceof Function&&Ne.tagCheck(be))&&(!oe[be]||le[be])){if(!le[be]&&zt(be)&&(ee.tagNameCheck instanceof RegExp&&wt(ee.tagNameCheck,be)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(be)))return!1;if(Ae&&!Q[be]){const qe=w(_)||_.parentNode,bt=z(_)||_.childNodes;if(bt&&qe){const nt=bt.length;for(let Dt=nt-1;Dt>=0;--Dt){const Pn=g(bt[Dt],!0);Pn.__removalCount=(_.__removalCount||0)+1,qe.insertBefore(Pn,b(_))}}}return Yt(_),!0}return _ instanceof c&&!js(_)||(be==="noscript"||be==="noembed"||be==="noframes")&&wt(/<\/no(script|embed|frames)/i,_.innerHTML)?(Yt(_),!0):(S&&_.nodeType===cr.text&&(ae=_.textContent,li([O,D,P],qe=>{ae=sr(ae,qe," ")}),_.textContent!==ae&&(ir(e.removed,{element:_.cloneNode()}),_.textContent=ae)),xe($.afterSanitizeElements,_,null),!1)},Ze=function(_,ae,be){if(I&&(ae==="id"||ae==="name")&&(be in t||be in $s))return!1;if(!(C&&!ge[ae]&&wt(q,ae))){if(!(Re&&wt(W,ae))){if(!(Ne.attributeCheck instanceof Function&&Ne.attributeCheck(ae,_))){if(!Z[ae]||ge[ae]){if(!(zt(_)&&(ee.tagNameCheck instanceof RegExp&&wt(ee.tagNameCheck,_)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(_))&&(ee.attributeNameCheck instanceof RegExp&&wt(ee.attributeNameCheck,ae)||ee.attributeNameCheck instanceof Function&&ee.attributeNameCheck(ae,_))||ae==="is"&&ee.allowCustomizedBuiltInElements&&(ee.tagNameCheck instanceof RegExp&&wt(ee.tagNameCheck,be)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(be))))return!1}else if(!Tt[ae]){if(!wt(te,sr(be,K,""))){if(!((ae==="src"||ae==="xlink:href"||ae==="href")&&_!=="script"&&Ay(be,"data:")===0&&Le[_])){if(!(L&&!wt(R,sr(be,K,"")))){if(be)return!1}}}}}}}return!0},zt=function(_){return _!=="annotation-xml"&&ha(_,X)},om=function(_){xe($.beforeSanitizeAttributes,_,null);const{attributes:ae}=_;if(!ae||ce(_))return;const be={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Z,forceKeepAttr:void 0};let qe=ae.length;for(;qe--;){const bt=ae[qe],{name:nt,namespaceURI:Dt,value:Pn}=bt,Xo=Qe(nt),cc=Pn;let mt=nt==="value"?cc:Iy(cc);if(be.attrName=Xo,be.attrValue=mt,be.keepAttr=!0,be.forceKeepAttr=void 0,xe($.uponSanitizeAttribute,_,be),mt=be.attrValue,J&&(Xo==="id"||Xo==="name")&&(bn(nt,_),mt=he+mt),N&&wt(/((--!?|])>)|<\/(style|title|textarea)/i,mt)){bn(nt,_);continue}if(Xo==="attributename"&&ha(mt,"href")){bn(nt,_);continue}if(be.forceKeepAttr)continue;if(!be.keepAttr){bn(nt,_);continue}if(!V&&wt(/\/>/i,mt)){bn(nt,_);continue}S&&li([O,D,P],im=>{mt=sr(mt,im," ")});const rm=Qe(_.nodeName);if(!Ze(rm,Xo,mt)){bn(nt,_);continue}if(T&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!Dt)switch(h.getAttributeType(rm,Xo)){case"TrustedHTML":{mt=T.createHTML(mt);break}case"TrustedScriptURL":{mt=T.createScriptURL(mt);break}}if(mt!==cc)try{Dt?_.setAttributeNS(Dt,nt,mt):_.setAttribute(nt,mt),ce(_)?Yt(_):_d(e.removed)}catch{bn(nt,_)}}xe($.afterSanitizeAttributes,_,null)},uA=function we(_){let ae=null;const be=Xr(_);for(xe($.beforeSanitizeShadowDOM,_,null);ae=be.nextNode();)xe($.uponSanitizeShadowNode,ae,null),We(ae),om(ae),ae.content instanceof i&&we(ae.content);xe($.afterSanitizeShadowDOM,_,null)};return e.sanitize=function(we){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ae=null,be=null,qe=null,bt=null;if(ie=!we,ie&&(we="<!-->"),typeof we!="string"&&!ue(we))if(typeof we.toString=="function"){if(we=we.toString(),typeof we!="string")throw ar("dirty is not a string, aborting")}else throw ar("toString is not a function");if(!e.isSupported)return we;if(ne||Jo(_),e.removed=[],typeof we=="string"&&(ye=!1),ye){if(we.nodeName){const Pn=Qe(we.nodeName);if(!oe[Pn]||le[Pn])throw ar("root node is forbidden and cannot be sanitized in-place")}}else if(we instanceof l)ae=Hs("<!---->"),be=ae.ownerDocument.importNode(we,!0),be.nodeType===cr.element&&be.nodeName==="BODY"||be.nodeName==="HTML"?ae=be:ae.appendChild(be);else{if(!De&&!S&&!F&&we.indexOf("<")===-1)return T&&v?T.createHTML(we):we;if(ae=Hs(we),!ae)return De?null:v?A:""}ae&&me&&Yt(ae.firstChild);const nt=Xr(ye?we:ae);for(;qe=nt.nextNode();)We(qe),om(qe),qe.content instanceof i&&uA(qe.content);if(ye)return we;if(De){if(Te)for(bt=E.call(ae.ownerDocument);ae.firstChild;)bt.appendChild(ae.firstChild);else bt=ae;return(Z.shadowroot||Z.shadowrootmode)&&(bt=B.call(o,bt,!0)),bt}let Dt=F?ae.outerHTML:ae.innerHTML;return F&&oe["!doctype"]&&ae.ownerDocument&&ae.ownerDocument.doctype&&ae.ownerDocument.doctype.name&&wt($d,ae.ownerDocument.doctype.name)&&(Dt="<!DOCTYPE "+ae.ownerDocument.doctype.name+`>
|
|
340
|
+
`+Dt),S&&li([O,D,P],Pn=>{Dt=sr(Dt,Pn," ")}),T&&v?T.createHTML(Dt):Dt},e.setConfig=function(){let we=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Jo(we),ne=!0},e.clearConfig=function(){yn=null,ne=!1},e.isValidAttribute=function(we,_,ae){yn||Jo({});const be=Qe(we),qe=Qe(_);return Ze(be,qe,ae)},e.addHook=function(we,_){typeof _=="function"&&ir($[we],_)},e.removeHook=function(we,_){if(_!==void 0){const ae=zy($[we],_);return ae===-1?void 0:My($[we],ae,1)[0]}return _d($[we])},e.removeHooks=function(we){$[we]=[]},e.removeAllHooks=function(){$=Bd()},e}var qy=Fd();function jd(n){return qy.sanitize(n,{ALLOWED_TAGS:["p","br","strong","em","s","u","ul","ol","li","a","hr"],ALLOWED_ATTR:["href","target","rel"],ALLOW_DATA_ATTR:!1,FORBID_TAGS:["script","iframe","object","embed","form","input","button","style"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur"]})}function rt(n){return typeof n!="string"?"":n.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function Ct(n){if(!n||typeof n!="string")return"";const e=n.trim(),t=e.toLowerCase();return t.startsWith("javascript:")||t.startsWith("vbscript:")||t.startsWith("file:")?"":t.startsWith("data:")?t.startsWith("data:image/")?e:"":e}const pe={TEXT_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):([^}]+)\}/g,TEXT_FIELD:/\{\$(\w+):([^}]+)\}/g,RICH_TEXT_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):rich(?::[^}]+)?\}/g,RICH_TEXT_FIELD:/\{\$(\w+):(.+?):rich(?::[^}]+)?\}/g,TEXTAREA_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):textarea(?::[^}]+)?\}/g,TEXTAREA_FIELD:/\{\$(\w+):(.+?):textarea(?::[^}]+)?\}/g,IMAGE_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):image(?::[^}]+)?\}/g,IMAGE_FIELD:/\{\$(\w+):(.+?):image(?::[^}]+)?\}/g,SELECT_FIELD_WITH_GROUP:/\(\$(\w+)\.(\w+)@:([^)]+)\)/g,SELECT_FIELD:/\(\$(\w+)@:([^)]+)\)/g,RADIO_CHECKBOX_FIELD_WITH_GROUP:/\(\$(\w+)\.(\w+):([^)]+)\)/g,RADIO_FIELD:/\(\$(\w+):([^)]+)\)/g,BACKEND_DATA:/\{@([\w.[\]]+)\}/g};function Gy(n){const e={};for(const t of n){if(t==="required"){e.required=!0;continue}if(t==="readonly"){e.readonly=!0;continue}if(t==="disabled"){e.disabled=!0;continue}if(t.startsWith("max=")){const o=Number(t.slice(4));Number.isFinite(o)&&(e.maxLength=o)}}return e}function ze(n){const e=n.split(":"),t=[],o=r=>r==="required"||r==="readonly"||r==="disabled"||/^max=\d+$/.test(r);for(;e.length>0&&o(e[e.length-1]);)t.unshift(e.pop());return{defaultValue:e.join(":"),validation:Gy(t)}}function Hn(n){const e=[],t=new Set,o=ca(),a=new o().parseFromString(`<template>${n}</template>`,"text/html").querySelector("template");if(!a)return e;const l=d=>{if(d.nodeType===Node.TEXT_NODE){const u=d.textContent||"",f=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(u.matchAll(f)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]){const N=S[1],F=S[2];if(!t.has(N)){const{defaultValue:ne,validation:me}=ze(S[3]);e.push({fieldName:N,groupName:F,type:"rich",defaultValue:ne,optional:!0,...me}),t.add(N)}}});const h=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(u.matchAll(h)).forEach(S=>{if(S&&S[1]&&S[2]){const N=S[1];if(!t.has(N)){const{defaultValue:F,validation:ne}=ze(S[2]);e.push({fieldName:N,type:"rich",defaultValue:F,optional:!0,...ne}),t.add(N)}}});const g=new RegExp(pe.RICH_TEXT_FIELD_WITH_GROUP.source,pe.RICH_TEXT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(g)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]){const N=S[1],F=S[2];if(!t.has(N)){const{defaultValue:ne,validation:me}=ze(S[3]);e.push({fieldName:N,groupName:F,type:"rich",defaultValue:ne,...me}),t.add(N)}}});const b=new RegExp(pe.RICH_TEXT_FIELD.source,pe.RICH_TEXT_FIELD.flags);Array.from(u.matchAll(b)).forEach(S=>{if(S&&S[1]&&S[2]){const N=S[1];if(!t.has(N)){const{defaultValue:F,validation:ne}=ze(S[2]);e.push({fieldName:N,type:"rich",defaultValue:F,...ne}),t.add(N)}}});const w=/\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/g;Array.from(u.matchAll(w)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:N,validation:F}=ze(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"textarea",defaultValue:N,optional:!0,...F}),t.add(S[1])}});const A=/\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/g;Array.from(u.matchAll(A)).forEach(S=>{if(S&&S[1]&&S[2]&&!t.has(S[1])){const{defaultValue:N,validation:F}=ze(S[2]);e.push({fieldName:S[1],type:"textarea",defaultValue:N,optional:!0,...F}),t.add(S[1])}});const k=new RegExp(pe.TEXTAREA_FIELD_WITH_GROUP.source,pe.TEXTAREA_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(k)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:N,validation:F}=ze(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"textarea",defaultValue:N,...F}),t.add(S[1])}});const x=new RegExp(pe.TEXTAREA_FIELD.source,pe.TEXTAREA_FIELD.flags);Array.from(u.matchAll(x)).forEach(S=>{if(S&&S[1]&&S[2]&&!t.has(S[1])){const{defaultValue:N,validation:F}=ze(S[2]);e.push({fieldName:S[1],type:"textarea",defaultValue:N,...F}),t.add(S[1])}});const $=/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(u.matchAll($)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:N,validation:F}=ze(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"image",defaultValue:N,optional:!0,...F}),t.add(S[1])}});const D=/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(u.matchAll(D)).forEach(S=>{if(S&&S[1]&&S[2]&&!t.has(S[1])){const{defaultValue:N,validation:F}=ze(S[2]);e.push({fieldName:S[1],type:"image",defaultValue:N,optional:!0,...F}),t.add(S[1])}});const q=new RegExp(pe.IMAGE_FIELD_WITH_GROUP.source,pe.IMAGE_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(q)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:N,validation:F}=ze(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"image",defaultValue:N,...F}),t.add(S[1])}});const R=new RegExp(pe.IMAGE_FIELD.source,pe.IMAGE_FIELD.flags);Array.from(u.matchAll(R)).forEach(S=>{if(S&&S[1]&&S[2]&&!t.has(S[1])){const{defaultValue:N,validation:F}=ze(S[2]);e.push({fieldName:S[1],type:"image",defaultValue:N,...F}),t.add(S[1])}});const X=/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g;Array.from(u.matchAll(X)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:N,validation:F}=ze(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"text",defaultValue:N,optional:!0,...F}),t.add(S[1])}});const oe=/\{\$(\w+)\?:([^}]+)\}/g;Array.from(u.matchAll(oe)).forEach(S=>{if(S&&S[0]&&!/:rich(?::[^}]*)?\}$/.test(S[0])&&!/:image(?::[^}]*)?\}$/.test(S[0])&&!/:textarea(?::[^}]*)?\}$/.test(S[0])&&!S[0].includes(".")&&S[1]&&S[2]&&!t.has(S[1])){const{defaultValue:N,validation:F}=ze(S[2]);e.push({fieldName:S[1],type:"text",defaultValue:N,optional:!0,...F}),t.add(S[1])}});const Z=new RegExp(pe.TEXT_FIELD_WITH_GROUP.source,pe.TEXT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(Z)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:N,validation:F}=ze(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"text",defaultValue:N,...F}),t.add(S[1])}});const ee=new RegExp(pe.TEXT_FIELD.source,pe.TEXT_FIELD.flags);Array.from(u.matchAll(ee)).forEach(S=>{if(S&&S[0]&&!/:rich(?::[^}]*)?\}$/.test(S[0])&&!/:image(?::[^}]*)?\}$/.test(S[0])&&!/:textarea(?::[^}]*)?\}$/.test(S[0])&&!S[0].includes(".")&&S[1]&&S[2]&&!t.has(S[1])){const{defaultValue:N,validation:F}=ze(S[2]);e.push({fieldName:S[1],type:"text",defaultValue:N,...F}),t.add(S[1])}});const ge=new RegExp(pe.SELECT_FIELD_WITH_GROUP.source,pe.SELECT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(ge)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const N=S[1],F=S[2],ne=S[3];ne.includes("|")?e.push({fieldName:N,groupName:F,type:"select",options:ne.split("|")}):ne.includes(",")&&e.push({fieldName:N,groupName:F,type:"select-multiple",options:ne.split(",")}),t.add(N)}}),(u.match(pe.SELECT_FIELD)||[]).forEach(S=>{const N=S.match(/\(\$(\w+)@:([^)]+)\)/);if(N&&!t.has(N[1])){const F=N[1],ne=N[2];ne.includes("|")?e.push({fieldName:F,type:"select",options:ne.split("|")}):ne.includes(",")&&e.push({fieldName:F,type:"select-multiple",options:ne.split(",")}),t.add(F)}});const C=new RegExp(pe.RADIO_CHECKBOX_FIELD_WITH_GROUP.source,pe.RADIO_CHECKBOX_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(C)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const N=S[1],F=S[2],ne=S[3];ne.includes("|")?e.push({fieldName:N,groupName:F,type:"radio",options:ne.split("|")}):ne.includes(",")&&e.push({fieldName:N,groupName:F,type:"checkbox",options:ne.split(",")}),t.add(N)}}),(u.match(pe.RADIO_FIELD)||[]).forEach(S=>{const N=S.match(/\(\$(\w+):([^)]+)\)/);if(N&&!t.has(N[1])){const F=N[1],ne=N[2];ne.includes("|")?e.push({fieldName:F,type:"radio",options:ne.split("|")}):ne.includes(",")&&e.push({fieldName:F,type:"checkbox",options:ne.split(",")}),t.add(F)}});return}else if(d.nodeType===Node.ELEMENT_NODE){const u=d,f=u.getAttribute("z-if");f&&!t.has(f)&&(e.push({fieldName:f,type:"boolean",defaultValue:"true"}),t.add(f));const p=u.getAttribute("z-tag");if(p){const m=p.match(/^\$(\w+)(?::(.+))?$/);if(m){const g=m[1],y=m[2];if(!t.has(g)){const b=y?y.split("|").map(T=>T.trim()):void 0,z=u.tagName.toLowerCase();let w=z;b&&!b.includes(z)&&(w=b[0]),e.push({fieldName:g,type:"tag",defaultValue:w,options:b,optional:!1}),t.add(g)}}}Array.from(u.attributes).forEach(m=>{const g=m.value,y=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(g.matchAll(y)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const{defaultValue:L,validation:V}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"rich",defaultValue:L,optional:!0,...V}),t.add(C[1])}});const z=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(g.matchAll(z)).forEach(C=>{if(C&&C[1]&&C[2]&&!t.has(C[1])){const{defaultValue:L,validation:V}=ze(C[2]);e.push({fieldName:C[1],type:"rich",defaultValue:L,optional:!0,...V}),t.add(C[1])}});const T=new RegExp(pe.RICH_TEXT_FIELD_WITH_GROUP.source,pe.RICH_TEXT_FIELD_WITH_GROUP.flags);Array.from(g.matchAll(T)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const{defaultValue:L,validation:V}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"rich",defaultValue:L,...V}),t.add(C[1])}});const M=new RegExp(pe.RICH_TEXT_FIELD.source,pe.RICH_TEXT_FIELD.flags);Array.from(g.matchAll(M)).forEach(C=>{if(C&&C[1]&&C[2]&&!t.has(C[1])){const{defaultValue:L,validation:V}=ze(C[2]);e.push({fieldName:C[1],type:"rich",defaultValue:L,...V}),t.add(C[1])}});const E=/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(g.matchAll(E)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const{defaultValue:L,validation:V}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"image",defaultValue:L,optional:!0,...V}),t.add(C[1])}});const B=/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(g.matchAll(B)).forEach(C=>{if(C&&C[1]&&C[2]&&!t.has(C[1])){const{defaultValue:L,validation:V}=ze(C[2]);e.push({fieldName:C[1],type:"image",defaultValue:L,optional:!0,...V}),t.add(C[1])}});const O=new RegExp(pe.IMAGE_FIELD_WITH_GROUP.source,pe.IMAGE_FIELD_WITH_GROUP.flags);Array.from(g.matchAll(O)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const{defaultValue:L,validation:V}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"image",defaultValue:L,...V}),t.add(C[1])}});const P=new RegExp(pe.IMAGE_FIELD.source,pe.IMAGE_FIELD.flags);Array.from(g.matchAll(P)).forEach(C=>{if(C&&C[1]&&C[2]&&!t.has(C[1])){const{defaultValue:L,validation:V}=ze(C[2]);e.push({fieldName:C[1],type:"image",defaultValue:L,...V}),t.add(C[1])}});const W=/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g;Array.from(g.matchAll(W)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const{defaultValue:L,validation:V}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"text",defaultValue:L,optional:!0,...V}),t.add(C[1])}});const K=/\{\$(\w+)\?:([^}]+)\}/g;Array.from(g.matchAll(K)).forEach(C=>{if(C&&C[0]&&!/:rich(?::[^}]*)?\}$/.test(C[0])&&!/:image(?::[^}]*)?\}$/.test(C[0])&&!/:textarea(?::[^}]*)?\}$/.test(C[0])&&!C[0].includes(".")&&C[1]&&C[2]&&!t.has(C[1])){const{defaultValue:L,validation:V}=ze(C[2]);e.push({fieldName:C[1],type:"text",defaultValue:L,optional:!0,...V}),t.add(C[1])}});const te=new RegExp(pe.TEXT_FIELD_WITH_GROUP.source,pe.TEXT_FIELD_WITH_GROUP.flags);Array.from(g.matchAll(te)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const{defaultValue:L,validation:V}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"text",defaultValue:L,...V}),t.add(C[1])}});const G=new RegExp(pe.TEXT_FIELD.source,pe.TEXT_FIELD.flags);Array.from(g.matchAll(G)).forEach(C=>{if(C&&C[0]&&!/:rich(?::[^}]*)?\}$/.test(C[0])&&!/:image(?::[^}]*)?\}$/.test(C[0])&&!/:textarea(?::[^}]*)?\}$/.test(C[0])&&!C[0].includes(".")&&C[1]&&C[2]&&!t.has(C[1])){const{defaultValue:L,validation:V}=ze(C[2]);e.push({fieldName:C[1],type:"text",defaultValue:L,...V}),t.add(C[1])}});const Y=new RegExp(pe.SELECT_FIELD_WITH_GROUP.source,pe.SELECT_FIELD_WITH_GROUP.flags);Array.from(g.matchAll(Y)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const L=C[1],V=C[2],S=C[3];S.includes("|")?e.push({fieldName:L,groupName:V,type:"select",options:S.split("|")}):S.includes(",")&&e.push({fieldName:L,groupName:V,type:"select-multiple",options:S.split(",")}),t.add(L)}}),(g.match(pe.SELECT_FIELD)||[]).forEach(C=>{const L=C.match(/\(\$(\w+)@:([^)]+)\)/);if(L&&!t.has(L[1])){const V=L[1],S=L[2];S.includes("|")?e.push({fieldName:V,type:"select",options:S.split("|")}):S.includes(",")&&e.push({fieldName:V,type:"select-multiple",options:S.split(",")}),t.add(V)}});const ge=new RegExp(pe.RADIO_CHECKBOX_FIELD_WITH_GROUP.source,pe.RADIO_CHECKBOX_FIELD_WITH_GROUP.flags);Array.from(g.matchAll(ge)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const L=C[1],V=C[2],S=C[3];S.includes("|")?e.push({fieldName:L,groupName:V,type:"radio",options:S.split("|")}):S.includes(",")&&e.push({fieldName:L,groupName:V,type:"checkbox",options:S.split(",")}),t.add(L)}}),(g.match(pe.RADIO_FIELD)||[]).forEach(C=>{const L=C.match(/\(\$(\w+):([^)]+)\)/);if(L&&!t.has(L[1])){const V=L[1],S=L[2];S.includes("|")?e.push({fieldName:V,type:"radio",options:S.split("|")}):S.includes(",")&&e.push({fieldName:V,type:"checkbox",options:S.split(",")}),t.add(V)}})}),Array.from(d.childNodes).forEach(m=>l(m));return}else if(d.nodeType===Node.DOCUMENT_FRAGMENT_NODE){Array.from(d.childNodes).forEach(f=>l(f));return}};return Array.from(a.content.childNodes).forEach(d=>l(d)),e}function Hd(n,e){const t=ca(),i=new t().parseFromString(`<template>${n}</template>`,"text/html").querySelector("template");if(!i||!i.content.firstElementChild)return console.warn("Failed to parse HTML:",n),n;const a=i.content.firstElementChild;return Object.entries(e).forEach(([l,c])=>{a.setAttribute(l,c)}),a.outerHTML}function ui(n,e,t,o,r=[]){const i=[...t,...o,...r];if(n){const a=i.find(l=>l.id===n);if(a)return a.url}if(e){const a=i.find(l=>l.id===e);if(a)return console.warn(`Image not found: ${n}, using default: ${e}`),a.url}return console.warn(`Image not found: ${n}, default: ${e}`),""}function Ky(n){return typeof n=="object"&&n!==null}function Ud(n,e){if(!n||!e)return"";try{const t=[];let o="";for(let i=0;i<e.length;i++){const a=e[i];a==="["||a==="]"||a==="."?o&&(t.push(o),o=""):o+=a}o&&t.push(o);let r=n;for(let i=0;i<t.length;i++){const a=t[i];if(a.match(/^\d+$/)){const l=parseInt(a,10);if(Array.isArray(r)&&l>=0&&l<r.length)r=r[l];else return""}else if(Ky(r)&&a in r)r=r[a];else return""}return r==null?"":String(r)}catch(t){return console.warn(`[ZeroCode] Failed to resolve backend data path: ${e}`,t),""}}function Jy(n,e){return!n||!e?n:n.replace(/\{(\w+)\}/g,(t,o)=>{const r=e[o];return r==null?t:String(r)})}function fi(n,e,t,o,r,i=!0,a=[],l=[],c=[],d,u){const f=ca(),p=new f,h=p.parseFromString(`<template>${n}</template>`,"text/html"),m=h.querySelector("template");if(!m||!m.content)return console.error("Failed to parse template HTML"),n;const g=E=>{if(E.nodeType===Node.TEXT_NODE){let x=E.textContent||"";d&&(x=x.replace(pe.BACKEND_DATA,(G,Z)=>Ud(d,Z)));let $=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(x),O=!1;if($&&E.parentNode?O=!0:$=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(x),$&&E.parentNode){const G=$[1],Z=O?$[3]:$[2],{defaultValue:Y}=ze(Z),ee=e[G];if(typeof ee=="boolean"){const V=E.parentNode,S=$.index||0,N=x.substring(0,S),F=x.substring(S+$[0].length);N&&V.insertBefore(h.createTextNode(N),E),F&&V.insertBefore(h.createTextNode(F),E),E.parentNode&&E.parentNode.removeChild(E);return}let le=ee===void 0?"":typeof ee=="string"?ee:String(ee||Y);i||(le=jd(le));const ge=E.parentNode,Ne=$.index||0,Re=x.substring(0,Ne),C=x.substring(Ne+$[0].length);le?le.trim().startsWith("<p")||(le=`<p>${le}</p>`):le="";const L=h.createElement("div");L.innerHTML=le,Re&&ge.insertBefore(h.createTextNode(Re),E),Array.from(L.childNodes).forEach(V=>{ge.insertBefore(V.cloneNode(!0),E)}),C&&ge.insertBefore(h.createTextNode(C),E),E.parentNode&&E.parentNode.removeChild(E);return}let P=new RegExp(pe.RICH_TEXT_FIELD_WITH_GROUP.source,pe.RICH_TEXT_FIELD_WITH_GROUP.flags).exec(x),q=!1;if(P&&E.parentNode?q=!0:P=new RegExp(pe.RICH_TEXT_FIELD.source,pe.RICH_TEXT_FIELD.flags).exec(x),P&&E.parentNode){const G=P[1],Z=q?P[3]:P[2],Y=e[G];let ee=Y===void 0?"":typeof Y=="string"?Y:String(Y||Z);i||(ee=jd(ee));const le=E.parentNode,ge=P.index||0,Ne=x.substring(0,ge),Re=x.substring(ge+P[0].length);ee?ee.trim().startsWith("<p")||(ee=`<p>${ee}</p>`):ee="<p></p>";const C=h.createElement("div");C.innerHTML=ee,Ne&&le.insertBefore(h.createTextNode(Ne),E),Array.from(C.childNodes).forEach(L=>{le.insertBefore(L.cloneNode(!0),E)}),Re&&le.insertBefore(h.createTextNode(Re),E),E.parentNode&&E.parentNode.removeChild(E);return}let R=/\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(x),K=!1;if(R&&E.parentNode?K=!0:R=/\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(x),R&&E.parentNode){const G=R[1],Z=K?R[3]:R[2],{defaultValue:Y}=ze(Z),ee=e[G],le=ee===void 0?"":String(ee||Y),ge=E.parentNode,Ne=R.index||0,Re=x.substring(0,Ne),C=x.substring(Ne+R[0].length);Re&&ge.insertBefore(h.createTextNode(Re),E);const L=le.split(`
|
|
341
|
+
`);if(L.forEach((V,S)=>{V&&ge.insertBefore(h.createTextNode(V),E),S<L.length-1&&ge.insertBefore(h.createElement("br"),E)}),C){const V=h.createTextNode(C);ge.insertBefore(V,E),g(V)}E.parentNode&&E.parentNode.removeChild(E);return}let te=new RegExp(pe.TEXTAREA_FIELD_WITH_GROUP.source,pe.TEXTAREA_FIELD_WITH_GROUP.flags).exec(x),oe=!1;if(te&&E.parentNode?oe=!0:te=new RegExp(pe.TEXTAREA_FIELD.source,pe.TEXTAREA_FIELD.flags).exec(x),te&&E.parentNode){const G=te[1],Z=oe?te[3]:te[2],Y=e[G]??Z??"",ee=String(Y),le=E.parentNode,ge=te.index||0,Ne=x.substring(0,ge),Re=x.substring(ge+te[0].length);Ne&&le.insertBefore(h.createTextNode(Ne),E);const C=ee.split(`
|
|
342
|
+
`);if(C.forEach((L,V)=>{L&&le.insertBefore(h.createTextNode(L),E),V<C.length-1&&le.insertBefore(h.createElement("br"),E)}),Re){const L=h.createTextNode(Re);le.insertBefore(L,E),g(L)}E.parentNode&&E.parentNode.removeChild(E);return}x=x.replace(/\{\$(\w+)\?:([^}]+)\}/g,(G,Z,Y)=>{if(/:textarea(?::[^}]*)?$/.test(G))return G;const ee=e[Z];if(ee===void 0||typeof ee=="boolean")return"";const{defaultValue:le}=ze(Y);return String(ee||le)}),x=x.replace(/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,(G,Z,Y,ee)=>{if(/:textarea(?::[^}]*)?$/.test(G))return G;const le=e[Z];if(le===void 0||typeof le=="boolean")return"";const{defaultValue:ge}=ze(ee);return String(le||ge)}),x=x.replace(pe.TEXT_FIELD_WITH_GROUP,(G,Z,Y,ee)=>{const le=e[Z];if(le===void 0)return"";const{defaultValue:ge}=ze(ee);return String(le||ge)}),x=x.replace(pe.TEXT_FIELD,(G,Z,Y)=>{const ee=e[Z];if(ee===void 0)return"";const{defaultValue:le}=ze(Y);return String(ee||le)}),E.textContent=x}else if(E.nodeType===Node.ELEMENT_NODE){const x=E,B=[];Array.from(x.attributes).forEach($=>{const O=$.value;let D=$.value;const P=$.name.toLowerCase();if(P==="z-if"||P==="z-for"||P==="z-slot"||P==="z-empty"||P==="z-tag"||P.startsWith("data-zcode-"))return;const q=/^\{\$[\w.]+?\?:[^}]+\}(?::(rich|image|textarea))?$/.test(O.trim());d&&((P==="href"||P==="src"||P==="action")&&(D=Jy(D,d)),D=D.replace(pe.BACKEND_DATA,(W,R)=>{const K=Ud(d,R);return P==="href"||P==="src"||P==="action"?Ct(K):rt(K)})),D=D.replace(/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,(W,R,K)=>{const X=e[R];if(X===void 0||typeof X=="boolean")return"";const{defaultValue:te}=ze(K);return rt(String(X||te))}),D=D.replace(/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,(W,R,K,X)=>{const te=e[R];if(te===void 0||typeof te=="boolean")return"";const{defaultValue:oe}=ze(X);return rt(String(te||oe))}),D=D.replace(/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g,(W,R,K)=>{const X=e[R];if(X===void 0)return"";const{defaultValue:te}=ze(K),oe=typeof X=="string"?X:String(X||te),G=ui(oe,te,a,l,c),Z=typeof G=="string"?G:String(G||te);return P==="href"||P==="src"?Ct(Z):rt(Z)}),D=D.replace(/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g,(W,R,K,X)=>{const te=e[R];if(te===void 0)return"";const{defaultValue:oe}=ze(X),G=typeof te=="string"?te:String(te||oe),Z=ui(G,oe,a,l,c),Y=typeof Z=="string"?Z:String(Z||oe);return P==="href"||P==="src"?Ct(Y):rt(Y)}),D=D.replace(pe.RICH_TEXT_FIELD_WITH_GROUP,(W,R,K,X)=>{const te=e[R];return te===void 0?"":rt(String(te||X))}),D=D.replace(pe.RICH_TEXT_FIELD,(W,R,K)=>{const X=e[R];return X===void 0?"":rt(String(X||K))}),D=D.replace(pe.IMAGE_FIELD_WITH_GROUP,(W,R,K,X)=>{const te=e[R];if(te===void 0)return"";const oe=ui(te||X,X,a,l,c);return P==="href"||P==="src"?Ct(oe||X):rt(oe||X)}),D=D.replace(pe.IMAGE_FIELD,(W,R,K)=>{const X=e[R];if(X===void 0)return"";const te=ui(X||K,K,a,l,c);return P==="href"||P==="src"?Ct(te||K):rt(te||K)}),D=D.replace(/\{\$(\w+)\?:([^}]+)\}/g,(W,R,K)=>{const X=e[R];if(X===void 0||typeof X=="boolean")return"";const{defaultValue:te}=ze(K),oe=String(X||te);return P==="href"||P==="src"||P==="action"?Ct(oe):rt(oe)}),D=D.replace(/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,(W,R,K,X)=>{const te=e[R];if(te===void 0||typeof te=="boolean")return"";const{defaultValue:oe}=ze(X),G=String(te||oe);return P==="href"||P==="src"||P==="action"?Ct(G):rt(G)}),D=D.replace(pe.TEXT_FIELD_WITH_GROUP,(W,R,K,X)=>{const te=e[R];if(te===void 0)return"";const{defaultValue:oe}=ze(X),G=String(te||oe);return P==="href"||P==="src"||P==="action"?Ct(G):rt(G)}),D=D.replace(pe.TEXT_FIELD,(W,R,K)=>{const X=e[R];if(X===void 0)return"";const{defaultValue:te}=ze(K),oe=String(X||te);return P==="href"||P==="src"||P==="action"?Ct(oe):rt(oe)}),q&&D.trim()===""?B.push($.name):$.value=D}),B.forEach($=>{x.removeAttribute($)})}Array.from(E.childNodes).forEach(x=>g(x))};g(m.content);const y=E=>{if(E.nodeType===Node.TEXT_NODE){let x=E.textContent||"";x=x.replace(pe.SELECT_FIELD_WITH_GROUP,(B,$,O,D)=>{if(D.includes("|"))return e[$]||D.split("|")[0];if(D.includes(",")){const P=e[$],q=Array.isArray(P)?P:[],W=D.split(",");return q.filter(R=>typeof R=="string"&&W.includes(R)).join(" ")}return e[$]||D}),x=x.replace(pe.SELECT_FIELD,(B,$,O)=>{if(O.includes("|")){const P=e[$];return typeof P=="string"?P:O.split("|")[0]}else if(O.includes(",")){const P=e[$],q=Array.isArray(P)?P:[],W=O.split(",");return q.filter(R=>typeof R=="string"&&W.includes(R)).join(" ")}const D=e[$];return typeof D=="string"?D:O}),x=x.replace(pe.RADIO_CHECKBOX_FIELD_WITH_GROUP,(B,$,O,D)=>{if(D.includes("|")){const q=e[$];return typeof q=="string"?q:D.split("|")[0]}else if(D.includes(",")){const q=e[$],W=Array.isArray(q)?q:[],R=D.split(",");return W.filter(K=>typeof K=="string"&&R.includes(K)).join(" ")}const P=e[$];return typeof P=="string"?P:D}),x=x.replace(pe.RADIO_FIELD,(B,$,O)=>{if(O.includes("|")){const P=e[$];return typeof P=="string"?P:O.split("|")[0]}else if(O.includes(",")){const P=e[$],q=Array.isArray(P)?P:[],W=O.split(",");return q.filter(R=>typeof R=="string"&&W.includes(R)).join(" ")}const D=e[$];return typeof D=="string"?D:O}),E.textContent=x}else E.nodeType===Node.ELEMENT_NODE&&Array.from(E.attributes).forEach(B=>{let $=B.value;const O=B.name.toLowerCase();$=$.replace(pe.SELECT_FIELD_WITH_GROUP,(D,P,q,W)=>{let R;if(W.includes("|"))R=e[P]||W.split("|")[0];else if(W.includes(",")){const K=e[P],X=Array.isArray(K)?K:[],te=W.split(",");R=X.filter(oe=>typeof oe=="string"&&te.includes(oe)).join(" ")}else{const K=e[P];R=typeof K=="string"?K:W}return O==="href"||O==="src"||O==="action"?Ct(String(R)):rt(String(R))}),$=$.replace(pe.SELECT_FIELD,(D,P,q)=>{let W;if(q.includes("|"))W=e[P]||q.split("|")[0];else if(q.includes(",")){const R=e[P],K=Array.isArray(R)?R:[],X=q.split(",");W=K.filter(te=>typeof te=="string"&&X.includes(te)).join(" ")}else{const R=e[P];W=typeof R=="string"?R:q}return O==="href"||O==="src"||O==="action"?Ct(String(W)):rt(String(W))}),$=$.replace(pe.RADIO_CHECKBOX_FIELD_WITH_GROUP,(D,P,q,W)=>{let R;if(W.includes("|"))R=e[P]||W.split("|")[0];else if(W.includes(",")){const K=e[P],X=Array.isArray(K)?K:[],te=W.split(",");R=X.filter(oe=>typeof oe=="string"&&te.includes(oe)).join(" ")}else{const K=e[P];R=typeof K=="string"?K:W}return O==="href"||O==="src"||O==="action"?Ct(String(R)):rt(String(R))}),$=$.replace(pe.RADIO_FIELD,(D,P,q)=>{let W;if(q.includes("|"))W=e[P]||q.split("|")[0];else if(q.includes(",")){const R=e[P],K=Array.isArray(R)?R:[],X=q.split(",");W=K.filter(te=>typeof te=="string"&&X.includes(te)).join(" ")}else{const R=e[P];W=typeof R=="string"?R:q}return O==="href"||O==="src"||O==="action"?Ct(String(W)):rt(String(W))}),B.value=$});E.childNodes.forEach(x=>y(x))};y(m.content),m.content.querySelectorAll("[z-if]").forEach(E=>{const x=E.getAttribute("z-if");x?(e[x]!==void 0?e[x]:!0)?E.removeAttribute("z-if"):E.remove():E.removeAttribute("z-if")}),m.content.querySelectorAll("[z-tag]").forEach(E=>{const x=E.getAttribute("z-tag");if(x){const B=x.match(/^\$(\w+)(?::(.+))?$/);if(B){const $=B[1],O=e[$],D=typeof O=="string"?O:E.tagName.toLowerCase(),P=["h1","h2","h3","h4","h5","h6","div","p","span","li","ul","ol","section","article","aside","nav","header","footer","main","figure","figcaption","blockquote","pre","code","table","thead","tbody","tr","th","td"],q=typeof D=="string"?D.toLowerCase():D;if(typeof q=="string"&&P.includes(q)){const W=h.createElement(q);Array.from(E.attributes).forEach(R=>{R.name!=="z-tag"&&W.setAttribute(R.name,R.value)}),Array.from(E.childNodes).forEach(R=>{W.appendChild(R.cloneNode(!0))}),E.parentNode?.replaceChild(W,E)}}}}),m.content.querySelectorAll("[z-empty]").forEach(E=>{const x=E.getAttribute("z-empty");if(x){const B=x.match(/^\$(\w+)$/);if(B){const $=B[1],O=e[$];(P=>{if(P==null||P==="")return!0;if(typeof P=="string"){const q=P.trim();if(q===""||q==="<p></p>"||q==="<p> </p>"||/^<p>\s*<\/p>$/i.test(q)||/^<p>\s*<br\s*\/?>\s*<\/p>$/i.test(q))return!0}return!1})(O)?E.remove():E.removeAttribute("z-empty")}else E.removeAttribute("z-empty")}else E.removeAttribute("z-empty")});const T=()=>{Array.from(m.content.querySelectorAll("[z-for]")).forEach(x=>{const B=x.getAttribute("z-for");if(!B){x.removeAttribute("z-for");return}const $=B.match(/^(\w+)\s+in\s+(.+)$/);if(!$){console.warn(`[ZeroCode] Invalid z-for syntax: ${B}`),x.removeAttribute("z-for");return}const[,O,D]=$;if(!D.startsWith("{@")||!D.endsWith("}")){console.warn(`[ZeroCode] z-for only supports backend data: ${D}`),x.removeAttribute("z-for");return}const P=D.slice(2,-1);if(!d){x.remove();return}let q;try{const R=P.split(".");let K=d;for(const X of R)if(K&&typeof K=="object"&&X in K)K=K[X];else{K=null;break}q=K}catch(R){console.warn(`[ZeroCode] Failed to resolve data source: ${P}`,R),x.remove();return}if(!Array.isArray(q)||q.length===0){x.remove();return}const W=document.createDocumentFragment();q.forEach(R=>{const K=x.cloneNode(!0);K.removeAttribute("z-for"),A(K,O,R,e,d),W.appendChild(K)}),x.parentNode&&x.parentNode.replaceChild(W,x)})},A=(E,x,B,$,O,D)=>{const P=W=>{if(W.nodeType===Node.TEXT_NODE){let R=W.textContent||"";const K=new RegExp(`\\{${x}\\.([\\w\\.\\[\\]]+)\\}`,"g");R=R.replace(K,(X,te)=>{try{const oe=te.split(/[.[\]]/).filter(Z=>Z);let G=B;for(const Z of oe)if(Z.match(/^\d+$/)){const Y=parseInt(Z,10);if(Array.isArray(G)&&Y>=0&&Y<G.length)G=G[Y];else return""}else if(G&&typeof G=="object"&&Z in G)G=G[Z];else return"";return G==null?"":String(G)}catch{return""}}),R=R.replace(new RegExp(`\\{${x}\\}`,"g"),()=>typeof B=="object"&&B!==null?JSON.stringify(B):String(B)),W.textContent=R}else if(W.nodeType===Node.ELEMENT_NODE){const R=W;Array.from(R.attributes).forEach(K=>{let X=K.value;const te=new RegExp(`\\{${x}\\.([\\w\\.\\[\\]]+)\\}`,"g");X=X.replace(te,(oe,G)=>{try{const Z=G.split(/[.[\]]/).filter(le=>le);let Y=B;for(const le of Z)if(le.match(/^\d+$/)){const ge=parseInt(le,10);if(Array.isArray(Y)&&ge>=0&&ge<Y.length)Y=Y[ge];else return""}else if(Y&&typeof Y=="object"&&le in Y)Y=Y[le];else return"";const ee=Y==null?"":String(Y);return K.name==="href"||K.name==="src"||K.name==="action"?Ct(ee):rt(ee)}catch{return""}}),X=X.replace(new RegExp(`\\{${x}\\}`,"g"),()=>{const oe=typeof B=="object"&&B!==null?JSON.stringify(B):String(B);return K.name==="href"||K.name==="src"||K.name==="action"?Ct(oe):rt(oe)}),K.value=X}),Array.from(R.childNodes).forEach(K=>P(K))}};Array.from(E.childNodes).forEach(W=>P(W));const q=E.innerHTML;if(q){const W=fi(q,$,t,o,r,i,a,l,c,O);E.innerHTML=W}};T();const M=E=>{E.forEach(x=>{const B=x.getAttribute("z-slot")||"default",$=e.slots?.[B];let O=[];if(Array.isArray($)?O=$:$&&typeof $=="object"&&$.children&&(O=$.children||[]),O.length===0){if(x.removeAttribute("z-slot"),i){x.setAttribute("data-zcode-empty-slot",B),x.setAttribute("data-zcode-slot-path",t?`${t}.slots.${B}`:`slots.${B}`);const W=u?.translations?.addSlotButton??"+ Add Part";x.innerHTML=`<div class="zcode-empty-slot" data-zcode-empty-slot-content>
|
|
343
|
+
<button class="zcode-add-slot-btn" data-zcode-add-slot>${W}</button>
|
|
344
|
+
</div>`}else x.innerHTML="";return}const D=O.map((W,R)=>{const K=t?`${t}.slots.${B}.${R}`:`slots.${B}.${R}`;return r(W,K)}).join("");x.removeAttribute("z-slot");const q=p.parseFromString(`<template>${D}</template>`,"text/html").querySelector("template");if(q&&q.content)for(x.innerHTML="";q.content.firstChild;)x.appendChild(q.content.firstChild);else x.innerHTML=D})},k=Array.from(m.content.querySelectorAll("[z-slot]"));return M(k),m.innerHTML}function dn(n,e){const t=n.split(".");let o=e;for(const r of t)if(o==null||typeof o!="object"||(/^\d+$/.test(r)?o=o[parseInt(r)]:o=o[r],o===void 0))return null;return o}function Un(){return`zcode-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function Xy(n){return n.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^\s*([a-zA-Z])/,e=>e.toUpperCase())}function Yy(n){return Xy(n)}function Wd(n){const e=n.split(".");if(e.length<=2&&e[0]==="page")return null;if(e.includes("slots")){let o=-1;for(let r=e.length-1;r>=0;r--)if(e[r]==="slots"){o=r;break}if(o!==-1&&o<e.length-1){const r=e[e.length-1];if(!isNaN(parseInt(r)))return e.slice(0,o).join(".")}}const t=e.slice(0,-1);return t.length===0?null:t.join(".")}function xa(n,e){const t=[...e.common,...e.individual,...e.special];for(const o of t){const r=o.parts.find(i=>i.id===n);if(r)return r}return null}function pi(n,e=!0){const{t}=Vt();function o(a){return xa(a,n.parts)}function r(a,l="",c=new Set){if(c.has(l))return console.warn(`循環参照を検出しました: ${l}`),`<div class="zcode-error-message">循環参照が検出されました: ${l}</div>`;c.add(l);const d=a.part_id,u=o(d);if(!u)return`<div class="zcode-error-message">パーツが見つかりません: ${d}</div>`;const f=e?{translations:{addSlotButton:t("emptyState.addPart")}}:void 0,p=fi(u.body,a,l,o,(h,m)=>r(h,m,c),e,n.images.common,n.images.individual,n.images.special,n.backendData,f);return e?Hd(p,{"data-zcode-id":a.id,"data-zcode-path":l,"data-zcode-part":d}):p}return{fullPageHtml:s.computed(()=>n.page.map((a,l)=>r(a,`page.${l}`)).join("")),renderComponentToHtml:r,findPart:o}}const ka=s.defineComponent({__name:"ZeroCodePreview",props:{cmsData:{type:Object},allowDynamicContentInteraction:{type:Boolean}},setup(n,{expose:e}){const t=n,{fullPageHtml:o}=pi(t.cmsData,!1),r=s.ref(null),i=s.computed(()=>r.value?.previewArea||null);return e({previewArea:i}),(a,l)=>(s.openBlock(),s.createBlock(Ec,{ref_key:"previewAreaRef",ref:r,"cms-data":n.cmsData,"full-page-html":s.unref(o),"allow-dynamic-content-interaction":n.allowDynamicContentInteraction},null,8,["cms-data","full-page-html","allow-dynamic-content-interaction"]))}}),Qy={class:"zcode-toolbar"},Zy=["title"],qd=s.defineComponent({__name:"Toolbar",props:{currentMode:{type:String},viewMode:{type:String},availableModes:{type:Array},allowDynamicContentInteraction:{type:Boolean}},emits:["switch-mode","switch-view-mode","open-settings","toggle-dynamic-content"],setup(n,{emit:e}){const t=n,o=e,r=i=>{t.viewMode==="preview"?(o("switch-view-mode","manage"),s.nextTick(()=>{o("switch-mode",i)})):o("switch-mode",i)};return(i,a)=>(s.openBlock(),s.createElementBlock("div",Qy,[s.createElementVNode("button",{class:s.normalizeClass([{active:n.viewMode==="preview"},"zcode-view-mode-btn zcode-view-mode-preview"]),onClick:a[0]||(a[0]=l=>i.$emit("switch-view-mode",n.viewMode==="preview"?"manage":"preview"))},[s.createVNode(s.unref(bm),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("toolbar.viewMode")),1)],2),!n.availableModes||n.availableModes.includes("edit")?(s.openBlock(),s.createElementBlock("button",{key:0,class:s.normalizeClass([{active:n.currentMode==="edit"&&n.viewMode==="manage"},"zcode-mode-btn zcode-mode-edit"]),onClick:a[1]||(a[1]=l=>r("edit"))},[s.createVNode(s.unref(gc),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("toolbar.editMode")),1)],2)):s.createCommentVNode("",!0),!n.availableModes||n.availableModes.includes("add")?(s.openBlock(),s.createElementBlock("button",{key:1,class:s.normalizeClass([{active:n.currentMode==="add"&&n.viewMode==="manage"},"zcode-mode-btn zcode-mode-add"]),onClick:a[2]||(a[2]=l=>r("add"))},[s.createVNode(s.unref(co),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("toolbar.addMode")),1)],2)):s.createCommentVNode("",!0),!n.availableModes||n.availableModes.includes("reorder")?(s.openBlock(),s.createElementBlock("button",{key:2,class:s.normalizeClass([{active:n.currentMode==="reorder"&&n.viewMode==="manage"},"zcode-mode-btn zcode-mode-reorder"]),onClick:a[3]||(a[3]=l=>r("reorder"))},[s.createVNode(s.unref(Zo),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("toolbar.reorderMode")),1)],2)):s.createCommentVNode("",!0),!n.availableModes||n.availableModes.includes("delete")?(s.openBlock(),s.createElementBlock("button",{key:3,class:s.normalizeClass([{active:n.currentMode==="delete"&&n.viewMode==="manage"},"zcode-mode-btn zcode-mode-delete"]),onClick:a[4]||(a[4]=l=>r("delete"))},[s.createVNode(s.unref(Ln),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("toolbar.deleteMode")),1)],2)):s.createCommentVNode("",!0),s.createElementVNode("button",{class:"zcode-settings-btn",title:i.$t("toolbar.settings"),onClick:a[5]||(a[5]=l=>i.$emit("open-settings"))},[s.createVNode(s.unref(bc),{size:16})],8,Zy)]))}}),Gd="zcode-user-settings";function Oo(){try{const n=localStorage.getItem(Gd);return n?JSON.parse(n):{}}catch(n){return console.warn("[ZeroCode] Failed to load user settings:",n),{}}}function Ea(n){try{const e=Oo(),t={locale:n.locale??e.locale,cms:n.cms?{...e.cms||{},...n.cms}:e.cms,dev:n.dev?{...e.dev||{},...n.dev}:e.dev};localStorage.setItem(Gd,JSON.stringify(t))}catch(e){console.warn("[ZeroCode] Failed to save user settings:",e)}}function eb(n=null){const e=Oo();return e.locale!==void 0?e.locale:n}function Kd(){return Oo().cms||{}}function hi(n){const e=Oo();Ea({cms:{...e.cms,...n}})}function tb(n,e){return Kd()[n]??e}function Jd(){return Oo().dev||{}}function wa(n){const e=Oo();Ea({dev:{...e.dev,...n}})}function nb(n,e){return Jd()[n]??e}const Xd="zcode-dont-show-css-warning-parts";function ob(){try{return sessionStorage.getItem(Xd)==="true"}catch{return!1}}function rb(n){try{sessionStorage.setItem(Xd,String(n))}catch(e){console.warn("[ZeroCode] Failed to save CSS warning setting:",e)}}const ib={class:"zcode-settings-panel-header"},sb={class:"zcode-settings-panel-header-title",role:"heading","aria-level":"3"},ab={class:"zcode-settings-panel-header-actions"},lb=["value","aria-label"],cb={value:"ja"},db={value:"en"},ub={class:"zcode-settings-panel-content"},fb={key:0},pb={key:0,class:"zcode-setting-item"},hb={class:"zcode-setting-label"},mb=["checked"],gb=["title"],yb={key:0,class:"zcode-setting-description"},bb={key:1,class:"zcode-setting-item"},xb={class:"zcode-setting-label"},kb=["checked"],Eb=["title"],wb={key:0,class:"zcode-setting-description"},Sb={key:2,class:"zcode-setting-item"},Cb={class:"zcode-setting-label"},Nb=["checked"],vb=["title"],Tb={key:0,class:"zcode-setting-description"},zb={key:3,class:"zcode-setting-item"},Mb={class:"zcode-setting-label"},Ab=["checked"],Ib=["title"],_b={key:0,class:"zcode-setting-description"},Ob={key:1,class:"zcode-setting-item"},Db={class:"zcode-setting-info"},Yd=s.defineComponent({__name:"SettingsPanel",props:{isOpen:{type:Boolean},viewMode:{type:String},mode:{type:String},allowDynamicContentInteraction:{type:Boolean},devRightPadding:{type:Boolean},enableContextMenu:{type:Boolean},showSaveConfirm:{type:Boolean}},emits:["close","toggle-dynamic-content","toggle-dev-padding","toggle-context-menu","toggle-save-confirm"],setup(n){const e=n,{locale:t}=Vt(),o=s.computed(()=>t.value||"ja");function r(u){const p=u.target.value;t.value=p,Ea({locale:p})}const i=s.ref(!1),a=s.ref(!1),l=s.ref(!1),c=s.ref(!1),d=s.computed(()=>e.devRightPadding!==void 0?e.devRightPadding:!1);return(u,f)=>n.isOpen?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-settings-panel-overlay",onClick:f[10]||(f[10]=s.withModifiers(p=>u.$emit("close"),["self"]))},[s.createElementVNode("div",{class:"zcode-settings-panel",onClick:f[9]||(f[9]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",ib,[s.createElementVNode("div",sb,s.toDisplayString(u.$t("settings.title")),1),s.createElementVNode("div",ab,[s.createElementVNode("select",{value:o.value,class:"zcode-language-select","aria-label":u.$t("settings.language.label"),onChange:r},[s.createElementVNode("option",cb,s.toDisplayString(u.$t("settings.language.ja")),1),s.createElementVNode("option",db,s.toDisplayString(u.$t("settings.language.en")),1)],40,lb),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":"$t('common.close')",onClick:f[0]||(f[0]=p=>u.$emit("close"))},[s.createVNode(s.unref(Xe),{size:18})])])]),s.createElementVNode("div",ub,[n.viewMode==="manage"?(s.openBlock(),s.createElementBlock("div",fb,[e.mode==="toolbar"||e.mode===void 0?(s.openBlock(),s.createElementBlock("div",pb,[s.createElementVNode("label",hb,[s.createElementVNode("input",{type:"checkbox",checked:e.allowDynamicContentInteraction??!1,class:"zcode-setting-checkbox",onChange:f[1]||(f[1]=p=>u.$emit("toggle-dynamic-content",p.target.checked))},null,40,mb),s.createElementVNode("span",null,s.toDisplayString(u.$t("settings.enableDynamicContent")),1),s.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[2]||(f[2]=s.withModifiers(p=>i.value=!i.value,["stop"]))},[s.createVNode(s.unref(Rn),{size:16})],8,gb)]),i.value?(s.openBlock(),s.createElementBlock("div",yb,s.toDisplayString(u.$t("settings.enableDynamicContentDescription")),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),e.mode==="toolbar"||e.mode===void 0?(s.openBlock(),s.createElementBlock("div",bb,[s.createElementVNode("label",xb,[s.createElementVNode("input",{type:"checkbox",checked:d.value,class:"zcode-setting-checkbox",onChange:f[3]||(f[3]=p=>u.$emit("toggle-dev-padding",p.target.checked))},null,40,kb),s.createElementVNode("span",null,s.toDisplayString(u.$t("settings.devRightPadding")),1),s.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[4]||(f[4]=s.withModifiers(p=>a.value=!a.value,["stop"]))},[s.createVNode(s.unref(Rn),{size:16})],8,Eb)]),a.value?(s.openBlock(),s.createElementBlock("div",wb,s.toDisplayString(u.$t("settings.devRightPaddingDescription")),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),e.mode==="toolbar"||e.mode===void 0?(s.openBlock(),s.createElementBlock("div",Sb,[s.createElementVNode("label",Cb,[s.createElementVNode("input",{type:"checkbox",checked:e.enableContextMenu??!1,class:"zcode-setting-checkbox",onChange:f[5]||(f[5]=p=>u.$emit("toggle-context-menu",p.target.checked))},null,40,Nb),s.createElementVNode("span",null,s.toDisplayString(u.$t("settings.enableContextMenu")),1),s.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[6]||(f[6]=s.withModifiers(p=>l.value=!l.value,["stop"]))},[s.createVNode(s.unref(Rn),{size:16})],8,vb)]),l.value?(s.openBlock(),s.createElementBlock("div",Tb,s.toDisplayString(u.$t("settings.enableContextMenuDescription")),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),e.mode==="dev-tabs"?(s.openBlock(),s.createElementBlock("div",zb,[s.createElementVNode("label",Mb,[s.createElementVNode("input",{type:"checkbox",checked:e.showSaveConfirm??!0,class:"zcode-setting-checkbox",onChange:f[7]||(f[7]=p=>u.$emit("toggle-save-confirm",p.target.checked))},null,40,Ab),s.createElementVNode("span",null,s.toDisplayString(u.$t("settings.showSaveConfirm")),1),s.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[8]||(f[8]=s.withModifiers(p=>c.value=!c.value,["stop"]))},[s.createVNode(s.unref(Rn),{size:16})],8,Ib)]),c.value?(s.openBlock(),s.createElementBlock("div",_b,s.toDisplayString(u.$t("settings.showSaveConfirmDescription")),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)])):(s.openBlock(),s.createElementBlock("div",Ob,[s.createElementVNode("div",Db,s.toDisplayString(u.$t("settings.previewModeInfo")),1)]))])])])):s.createCommentVNode("",!0)}});function ut(n){this.content=n}ut.prototype={constructor:ut,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var o=t&&t!=n?this.remove(t):this,r=o.find(n),i=o.content.slice();return r==-1?i.push(t||n,e):(i[r+1]=e,t&&(i[r]=t)),new ut(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new ut(t)},addToStart:function(n,e){return new ut([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new ut(t)},addBefore:function(n,e,t){var o=this.remove(e),r=o.content.slice(),i=o.find(n);return r.splice(i==-1?r.length:i,0,e,t),new ut(r)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=ut.from(n),n.size?new ut(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=ut.from(n),n.size?new ut(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=ut.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},ut.from=function(n){if(n instanceof ut)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new ut(e)};function Qd(n,e,t){for(let o=0;;o++){if(o==n.childCount||o==e.childCount)return n.childCount==e.childCount?null:t;let r=n.child(o),i=e.child(o);if(r==i){t+=r.nodeSize;continue}if(!r.sameMarkup(i))return t;if(r.isText&&r.text!=i.text){for(let a=0;r.text[a]==i.text[a];a++)t++;return t}if(r.content.size||i.content.size){let a=Qd(r.content,i.content,t+1);if(a!=null)return a}t+=r.nodeSize}}function Zd(n,e,t,o){for(let r=n.childCount,i=e.childCount;;){if(r==0||i==0)return r==i?null:{a:t,b:o};let a=n.child(--r),l=e.child(--i),c=a.nodeSize;if(a==l){t-=c,o-=c;continue}if(!a.sameMarkup(l))return{a:t,b:o};if(a.isText&&a.text!=l.text){let d=0,u=Math.min(a.text.length,l.text.length);for(;d<u&&a.text[a.text.length-d-1]==l.text[l.text.length-d-1];)d++,t--,o--;return{a:t,b:o}}if(a.content.size||l.content.size){let d=Zd(a.content,l.content,t-1,o-1);if(d)return d}t-=c,o-=c}}class re{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,t,o,r=0,i){for(let a=0,l=0;l<t;a++){let c=this.content[a],d=l+c.nodeSize;if(d>e&&o(c,r+l,i||null,a)!==!1&&c.content.size){let u=l+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,t-u),o,r+u)}l=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,o,r){let i="",a=!0;return this.nodesBetween(e,t,(l,c)=>{let d=l.isText?l.text.slice(Math.max(e,c)-c,t-c):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&d||l.isTextblock)&&o&&(a?a=!1:i+=o),i+=d},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,o=e.firstChild,r=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(o)&&(r[r.length-1]=t.withText(t.text+o.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new re(r,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let o=[],r=0;if(t>e)for(let i=0,a=0;a<t;i++){let l=this.content[i],c=a+l.nodeSize;c>e&&((a<e||c>t)&&(l.isText?l=l.cut(Math.max(0,e-a),Math.min(l.text.length,t-a)):l=l.cut(Math.max(0,e-a-1),Math.min(l.content.size,t-a-1))),o.push(l),r+=l.nodeSize),a=c}return new re(o,r)}cutByIndex(e,t){return e==t?re.empty:e==0&&t==this.content.length?this:new re(this.content.slice(e,t))}replaceChild(e,t){let o=this.content[e];if(o==t)return this;let r=this.content.slice(),i=this.size+t.nodeSize-o.nodeSize;return r[e]=t,new re(r,i)}addToStart(e){return new re([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new re(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,o=0;t<this.content.length;t++){let r=this.content[t];e(r,o,t),o+=r.nodeSize}}findDiffStart(e,t=0){return Qd(this,e,t)}findDiffEnd(e,t=this.size,o=e.size){return Zd(this,e,t,o)}findIndex(e){if(e==0)return mi(0,e);if(e==this.size)return mi(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,o=0;;t++){let r=this.child(t),i=o+r.nodeSize;if(i>=e)return i==e?mi(t+1,i):mi(t,o);o=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return re.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new re(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return re.empty;let t,o=0;for(let r=0;r<e.length;r++){let i=e[r];o+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new re(t||e,o)}static from(e){if(!e)return re.empty;if(e instanceof re)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new re([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}re.empty=new re([],0);const Sa={index:0,offset:0};function mi(n,e){return Sa.index=n,Sa.offset=e,Sa}function gi(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let o=0;o<n.length;o++)if(!gi(n[o],e[o]))return!1}else{for(let o in n)if(!(o in e)||!gi(n[o],e[o]))return!1;for(let o in e)if(!(o in n))return!1}return!0}let Fe=class dc{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,o=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!o&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),o=!0),t&&t.push(i)}}return t||(t=e.slice()),o||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&gi(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[t.type];if(!o)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=o.create(t.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(t[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return dc.none;if(e instanceof dc)return[e];let t=e.slice();return t.sort((o,r)=>o.type.rank-r.type.rank),t}};Fe.none=[];class yi extends Error{}class fe{constructor(e,t,o){this.content=e,this.openStart=t,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let o=tu(this.content,e+this.openStart,t);return o&&new fe(o,this.openStart,this.openEnd)}removeBetween(e,t){return new fe(eu(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return fe.empty;let o=t.openStart||0,r=t.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new fe(re.fromJSON(e,t.content),o,r)}static maxOpen(e,t=!0){let o=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)r++;return new fe(e,o,r)}}fe.empty=new fe(re.empty,0,0);function eu(n,e,t){let{index:o,offset:r}=n.findIndex(e),i=n.maybeChild(o),{index:a,offset:l}=n.findIndex(t);if(r==e||i.isText){if(l!=t&&!n.child(a).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(o!=a)throw new RangeError("Removing non-flat range");return n.replaceChild(o,i.copy(eu(i.content,e-r-1,t-r-1)))}function tu(n,e,t,o){let{index:r,offset:i}=n.findIndex(e),a=n.maybeChild(r);if(i==e||a.isText)return o&&!o.canReplace(r,r,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=tu(a.content,e-i-1,t,a);return l&&n.replaceChild(r,a.copy(l))}function Pb(n,e,t){if(t.openStart>n.depth)throw new yi("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new yi("Inconsistent open depths");return nu(n,e,t,0)}function nu(n,e,t,o){let r=n.index(o),i=n.node(o);if(r==e.index(o)&&o<n.depth-t.openStart){let a=nu(n,e,t,o+1);return i.copy(i.content.replaceChild(r,a))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==o&&e.depth==o){let a=n.parent,l=a.content;return ho(a,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:a,end:l}=Rb(t,n);return ho(i,ru(n,a,l,e,o))}else return ho(i,bi(n,e,o))}function ou(n,e){if(!e.type.compatibleContent(n.type))throw new yi("Cannot join "+e.type.name+" onto "+n.type.name)}function Ca(n,e,t){let o=n.node(t);return ou(o,e.node(t)),o}function po(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function dr(n,e,t,o){let r=(e||n).node(t),i=0,a=e?e.index(t):r.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(po(n.nodeAfter,o),i++));for(let l=i;l<a;l++)po(r.child(l),o);e&&e.depth==t&&e.textOffset&&po(e.nodeBefore,o)}function ho(n,e){return n.type.checkContent(e),n.copy(e)}function ru(n,e,t,o,r){let i=n.depth>r&&Ca(n,e,r+1),a=o.depth>r&&Ca(t,o,r+1),l=[];return dr(null,n,r,l),i&&a&&e.index(r)==t.index(r)?(ou(i,a),po(ho(i,ru(n,e,t,o,r+1)),l)):(i&&po(ho(i,bi(n,e,r+1)),l),dr(e,t,r,l),a&&po(ho(a,bi(t,o,r+1)),l)),dr(o,null,r,l),new re(l)}function bi(n,e,t){let o=[];if(dr(null,n,t,o),n.depth>t){let r=Ca(n,e,t+1);po(ho(r,bi(n,e,t+1)),o)}return dr(e,null,t,o),new re(o)}function Rb(n,e){let t=e.depth-n.openStart,r=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)r=e.node(i).copy(re.from(r));return{start:r.resolveNoCache(n.openStart+t),end:r.resolveNoCache(r.content.size-n.openEnd-t)}}class ur{constructor(e,t,o){this.pos=e,this.path=t,this.parentOffset=o,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let o=this.pos-this.path[this.path.length-1],r=e.child(t);return o?e.child(t).cut(o):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let o=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)r+=o.child(i).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Fe.none;if(this.textOffset)return e.child(t).marks;let o=e.maybeChild(t-1),r=e.maybeChild(t);if(!o){let l=o;o=r,r=l}let i=o.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let o=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!r||!o[i].isInSet(r.marks))&&(o=o[i--].removeFromSet(o));return o}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!t||t(this.node(o))))return new xi(this,e,o);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let o=[],r=0,i=t;for(let a=e;;){let{index:l,offset:c}=a.content.findIndex(i),d=i-c;if(o.push(a,l,r+c),!d||(a=a.child(l),a.isText))break;i=d-1,r+=c+1}return new ur(t,o,i)}static resolveCached(e,t){let o=iu.get(e);if(o)for(let i=0;i<o.elts.length;i++){let a=o.elts[i];if(a.pos==t)return a}else iu.set(e,o=new Lb);let r=o.elts[o.i]=ur.resolve(e,t);return o.i=(o.i+1)%$b,r}}class Lb{constructor(){this.elts=[],this.i=0}}const $b=12,iu=new WeakMap;class xi{constructor(e,t,o){this.$from=e,this.$to=t,this.depth=o}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Vb=Object.create(null);let Wn=class uc{constructor(e,t,o,r=Fe.none){this.type=e,this.attrs=t,this.marks=r,this.content=o||re.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,o,r=0){this.content.nodesBetween(e,t,o,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,o,r){return this.content.textBetween(e,t,o,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,o){return this.type==e&&gi(this.attrs,t||e.defaultAttrs||Vb)&&Fe.sameSet(this.marks,o||Fe.none)}copy(e=null){return e==this.content?this:new uc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new uc(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,o=!1){if(e==t)return fe.empty;let r=this.resolve(e),i=this.resolve(t),a=o?0:r.sharedDepth(t),l=r.start(a),d=r.node(a).content.cut(r.pos-l,i.pos-l);return new fe(d,r.depth-a,i.depth-a)}replace(e,t,o){return Pb(this.resolve(e),this.resolve(t),o)}nodeAt(e){for(let t=this;;){let{index:o,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(o),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(t),index:t,offset:o};let r=this.content.child(t-1);return{node:r,index:t-1,offset:o-r.nodeSize}}resolve(e){return ur.resolveCached(this,e)}resolveNoCache(e){return ur.resolve(this,e)}rangeHasMark(e,t,o){let r=!1;return t>e&&this.nodesBetween(e,t,i=>(o.isInSet(i.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),su(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,o=re.empty,r=0,i=o.childCount){let a=this.contentMatchAt(e).matchFragment(o,r,i),l=a&&a.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let c=r;c<i;c++)if(!this.type.allowsMarks(o.child(c).marks))return!1;return!0}canReplaceWith(e,t,o,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(o),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Fe.none;for(let t=0;t<this.marks.length;t++){let o=this.marks[t];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!Fe.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let o;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,o)}let r=re.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};Wn.prototype.text=void 0;class ki extends Wn{constructor(e,t,o,r){if(super(e,t,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):su(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ki(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ki(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function su(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class mo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let o=new Bb(e,t);if(o.next==null)return mo.empty;let r=au(o);o.next&&o.err("Unexpected trailing text");let i=Gb(qb(r));return Kb(i,o),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,o=e.childCount){let r=this;for(let i=t;r&&i<o;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let o=0;o<e.next.length;o++)if(this.next[t].type==e.next[o].type)return!0;return!1}fillBefore(e,t=!1,o=0){let r=[this];function i(a,l){let c=a.matchFragment(e,o);if(c&&(!t||c.validEnd))return re.from(l.map(d=>d.createAndFill()));for(let d=0;d<a.next.length;d++){let{type:u,next:f}=a.next[d];if(!(u.isText||u.hasRequiredAttrs())&&r.indexOf(f)==-1){r.push(f);let p=i(f,l.concat(u));if(p)return p}}return null}return i(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let r=o.shift(),i=r.match;if(i.matchType(e)){let a=[];for(let l=r;l.type;l=l.via)a.push(l.type);return a.reverse()}for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!r.type||c.validEnd)&&(o.push({match:l.contentMatch,type:l,via:r}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(o){e.push(o);for(let r=0;r<o.next.length;r++)e.indexOf(o.next[r].next)==-1&&t(o.next[r].next)}return t(this),e.map((o,r)=>{let i=r+(o.validEnd?"*":" ")+" ";for(let a=0;a<o.next.length;a++)i+=(a?", ":"")+o.next[a].type.name+"->"+e.indexOf(o.next[a].next);return i}).join(`
|
|
345
|
+
`)}}mo.empty=new mo(!0);class Bb{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function au(n){let e=[];do e.push(Fb(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Fb(n){let e=[];do e.push(jb(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function jb(n){let e=Wb(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Hb(n,e);else break;return e}function lu(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Hb(n,e){let t=lu(n),o=t;return n.eat(",")&&(n.next!="}"?o=lu(n):o=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:o,expr:e}}function Ub(n,e){let t=n.nodeTypes,o=t[e];if(o)return[o];let r=[];for(let i in t){let a=t[i];a.isInGroup(e)&&r.push(a)}return r.length==0&&n.err("No node type or group '"+e+"' found"),r}function Wb(n){if(n.eat("(")){let e=au(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Ub(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function qb(n){let e=[[]];return r(i(n,0),t()),e;function t(){return e.push([])-1}function o(a,l,c){let d={term:c,to:l};return e[a].push(d),d}function r(a,l){a.forEach(c=>c.to=l)}function i(a,l){if(a.type=="choice")return a.exprs.reduce((c,d)=>c.concat(i(d,l)),[]);if(a.type=="seq")for(let c=0;;c++){let d=i(a.exprs[c],l);if(c==a.exprs.length-1)return d;r(d,l=t())}else if(a.type=="star"){let c=t();return o(l,c),r(i(a.expr,c),c),[o(c)]}else if(a.type=="plus"){let c=t();return r(i(a.expr,l),c),r(i(a.expr,c),c),[o(c)]}else{if(a.type=="opt")return[o(l)].concat(i(a.expr,l));if(a.type=="range"){let c=l;for(let d=0;d<a.min;d++){let u=t();r(i(a.expr,c),u),c=u}if(a.max==-1)r(i(a.expr,c),c);else for(let d=a.min;d<a.max;d++){let u=t();o(c,u),r(i(a.expr,c),u),c=u}return[o(c)]}else{if(a.type=="name")return[o(l,void 0,a.value)];throw new Error("Unknown expr type")}}}}function cu(n,e){return e-n}function du(n,e){let t=[];return o(e),t.sort(cu);function o(r){let i=n[r];if(i.length==1&&!i[0].term)return o(i[0].to);t.push(r);for(let a=0;a<i.length;a++){let{term:l,to:c}=i[a];!l&&t.indexOf(c)==-1&&o(c)}}}function Gb(n){let e=Object.create(null);return t(du(n,0));function t(o){let r=[];o.forEach(a=>{n[a].forEach(({term:l,to:c})=>{if(!l)return;let d;for(let u=0;u<r.length;u++)r[u][0]==l&&(d=r[u][1]);du(n,c).forEach(u=>{d||r.push([l,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let i=e[o.join(",")]=new mo(o.indexOf(n.length-1)>-1);for(let a=0;a<r.length;a++){let l=r[a][1].sort(cu);i.next.push({type:r[a][0],next:e[l.join(",")]||t(l)})}return i}}function Kb(n,e){for(let t=0,o=[n];t<o.length;t++){let r=o[t],i=!r.validEnd,a=[];for(let l=0;l<r.next.length;l++){let{type:c,next:d}=r.next[l];a.push(c.name),i&&!(c.isText||c.hasRequiredAttrs())&&(i=!1),o.indexOf(d)==-1&&o.push(d)}i&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function uu(n){let e=Object.create(null);for(let t in n){let o=n[t];if(!o.hasDefault)return null;e[t]=o.default}return e}function fu(n,e){let t=Object.create(null);for(let o in n){let r=e&&e[o];if(r===void 0){let i=n[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}t[o]=r}return t}function pu(n,e,t,o){for(let r in e)if(!(r in n))throw new RangeError(`Unsupported attribute ${r} for ${t} of type ${r}`);for(let r in n){let i=n[r];i.validate&&i.validate(e[r])}}function hu(n,e){let t=Object.create(null);if(e)for(let o in e)t[o]=new Xb(n,o,e[o]);return t}let mu=class sm{constructor(e,t,o){this.name=e,this.schema=t,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=hu(e,o.attrs),this.defaultAttrs=uu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==mo.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:fu(this.attrs,e)}create(e=null,t,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Wn(this,this.computeAttrs(e),re.from(t),Fe.setFrom(o))}createChecked(e=null,t,o){return t=re.from(t),this.checkContent(t),new Wn(this,this.computeAttrs(e),t,Fe.setFrom(o))}createAndFill(e=null,t,o){if(e=this.computeAttrs(e),t=re.from(t),t.size){let a=this.contentMatch.fillBefore(t);if(!a)return null;t=a.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(re.empty,!0);return i?new Wn(this,e,t.append(i),Fe.setFrom(o)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){pu(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?t&&t.push(e[o]):t||(t=e.slice(0,o));return t?t.length?t:Fe.none:e}static compile(e,t){let o=Object.create(null);e.forEach((i,a)=>o[i]=new sm(i,t,a));let r=t.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let i in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function Jb(n,e,t){let o=t.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${n}, got ${i}`)}}class Xb{constructor(e,t,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?Jb(e,t,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class Ei{constructor(e,t,o,r){this.name=e,this.rank=t,this.schema=o,this.spec=r,this.attrs=hu(e,r.attrs),this.excluded=null;let i=uu(this.attrs);this.instance=i?new Fe(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Fe(this,fu(this.attrs,e))}static compile(e,t){let o=Object.create(null),r=0;return e.forEach((i,a)=>o[i]=new Ei(i,r++,t,a)),o}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){pu(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class gu{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=ut.from(e.nodes),t.marks=ut.from(e.marks||{}),this.nodes=mu.compile(this.spec.nodes,this),this.marks=Ei.compile(this.spec.marks,this);let o=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let i=this.nodes[r],a=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=o[a]||(o[a]=mo.parse(a,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?yu(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let r in this.marks){let i=this.marks[r],a=i.spec.excludes;i.excluded=a==null?[i]:a==""?[]:yu(this,a.split(" "))}this.nodeFromJSON=r=>Wn.fromJSON(this,r),this.markFromJSON=r=>Fe.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,o,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof mu){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,o,r)}text(e,t){let o=this.nodes.text;return new ki(o,o.defaultAttrs,e,Fe.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function yu(n,e){let t=[];for(let o=0;o<e.length;o++){let r=e[o],i=n.marks[r],a=i;if(i)t.push(i);else for(let l in n.marks){let c=n.marks[l];(r=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(r)>-1)&&t.push(a=c)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return t}function Yb(n){return n.tag!=null}function Qb(n){return n.style!=null}let fr=class fc{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let o=this.matchedStyles=[];t.forEach(r=>{if(Yb(r))this.tags.push(r);else if(Qb(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let o=new Eu(this,t,!1);return o.addAll(e,Fe.none,t.from,t.to),o.finish()}parseSlice(e,t={}){let o=new Eu(this,t,!0);return o.addAll(e,Fe.none,t.from,t.to),fe.maxOpen(o.finish())}matchTag(e,t,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if(t1(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let a=i.getAttrs(e);if(a===!1)continue;i.attrs=a||void 0}return i}}}matchStyle(e,t,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let a=this.styles[i],l=a.style;if(!(l.indexOf(e)!=0||a.context&&!o.matchesContext(a.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(a.getAttrs){let c=a.getAttrs(t);if(c===!1)continue;a.attrs=c||void 0}return a}}}static schemaRules(e){let t=[];function o(r){let i=r.priority==null?50:r.priority,a=0;for(;a<t.length;a++){let l=t[a];if((l.priority==null?50:l.priority)<i)break}t.splice(a,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(a=>{o(a=wu(a)),a.mark||a.ignore||a.clearMark||(a.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(a=>{o(a=wu(a)),a.node||a.ignore||a.mark||(a.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new fc(e,fc.schemaRules(e)))}};const bu={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Zb={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},xu={ol:!0,ul:!0},pr=1,Na=2,hr=4;function ku(n,e,t){return e!=null?(e?pr:0)|(e==="full"?Na:0):n&&n.whitespace=="pre"?pr|Na:t&~hr}class wi{constructor(e,t,o,r,i,a){this.type=e,this.attrs=t,this.marks=o,this.solid=r,this.options=a,this.content=[],this.activeMarks=Fe.none,this.match=i||(a&hr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(re.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&pr)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let t=re.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(re.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!bu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Eu{constructor(e,t,o){this.parser=e,this.options=t,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=ku(null,t.preserveWhitespace,0)|(o?hr:0);r?i=new wi(r.type,r.attrs,Fe.none,!0,t.topMatch||r.type.contentMatch,a):o?i=new wi(null,null,Fe.none,!0,null,a):i=new wi(e.schema.topNodeType,null,Fe.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let o=e.nodeValue,r=this.top,i=r.options&Na?"full":this.localPreserveWS||(r.options&pr)>0,{schema:a}=this.parser;if(i==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i)if(i==="full")o=o.replace(/\r\n?/g,`
|
|
346
|
+
`);else if(a.linebreakReplacement&&/[\r\n]/.test(o)&&this.top.findWrapping(a.linebreakReplacement.create())){let l=o.split(/\r?\n|\r/);for(let c=0;c<l.length;c++)c&&this.insertNode(a.linebreakReplacement.create(),t,!0),l[c]&&this.insertNode(a.text(l[c]),t,!/\S/.test(l[c]));o=""}else o=o.replace(/\r?\n|\r/g," ");else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let l=r.content[r.content.length-1],c=e.previousSibling;(!l||c&&c.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(o=o.slice(1))}o&&this.insertNode(a.text(o),t,!/\S/.test(o)),this.findInText(e)}else this.findInside(e)}addElement(e,t,o){let r=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),l;xu.hasOwnProperty(a)&&this.parser.normalizeLists&&e1(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(c?c.ignore:Zb.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let d,u=this.needsBlock;if(bu.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),d=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=c&&c.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),d&&this.sync(i),this.needsBlock=u}else{let d=this.readStyles(e,t);d&&this.addElementByRule(e,c,d,c.consuming===!1?l:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
347
|
+
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],a=o.getPropertyValue(i);if(a)for(let l=void 0;;){let c=this.parser.matchStyle(i,a,this,l);if(!c)break;if(c.ignore)return null;if(c.clearMark?t=t.filter(d=>!c.clearMark(d)):t=t.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)l=c;else break}}return t}addElementByRule(e,t,o,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let c=this.enter(a,t.attrs||null,o,t.preserveWhitespace);c&&(i=!0,o=c)}else{let c=this.parser.schema.marks[t.mark];o=o.concat(c.create(t.attrs))}let l=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,o,!1));else{let c=e;typeof t.contentElement=="string"?c=e.querySelector(t.contentElement):typeof t.contentElement=="function"?c=t.contentElement(e):t.contentElement&&(c=t.contentElement),this.findAround(e,c,!0),this.addAll(c,o),this.findAround(e,c,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,o,r){let i=o||0;for(let a=o?e.childNodes[o]:e.firstChild,l=r==null?null:e.childNodes[r];a!=l;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,o){let r,i;for(let a=this.open,l=0;a>=0;a--){let c=this.nodes[a],d=c.findWrapping(e);if(d&&(!r||r.length>d.length+l)&&(r=d,i=c,!d.length))break;if(c.solid){if(o)break;l+=2}}if(!r)return null;this.sync(i);for(let a=0;a<r.length;a++)t=this.enterInner(r[a],null,t,!1);return t}insertNode(e,t,o){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t,o);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let a=Fe.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Su(l.type,e.type))&&(a=l.addToSet(a));return i.content.push(e.mark(a)),!0}return!1}enter(e,t,o,r){let i=this.findPlace(e.create(t),o,!1);return i&&(i=this.enterInner(e,t,o,!0,r)),i}enterInner(e,t,o,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let l=ku(e,i,a.options);a.options&hr&&a.content.length==0&&(l|=hr);let c=Fe.none;return o=o.filter(d=>(a.type?a.type.allowsMarkType(d.type):Su(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new wi(e,t,c,r,null,l)),this.open++,o}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=pr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let o=this.nodes[t].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==t&&(this.find[o].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,o){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),a=(l,c)=>{for(;l>=0;l--){let d=t[l];if(d==""){if(l==t.length-1||l==0)continue;for(;c>=i;c--)if(a(l-1,c))return!0;return!1}else{let u=c>0||c==0&&r?this.nodes[c].type:o&&c>=i?o.node(c-i).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;c--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let t in this.parser.schema.nodes){let o=this.parser.schema.nodes[t];if(o.isTextblock&&o.defaultAttrs)return o}}}function e1(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&xu.hasOwnProperty(o)&&t?(t.appendChild(e),e=t):o=="li"?t=e:o&&(t=null)}}function t1(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function wu(n){let e={};for(let t in n)e[t]=n[t];return e}function Su(n,e){let t=e.schema.nodes;for(let o in t){let r=t[o];if(!r.allowsMarkType(n))continue;let i=[],a=l=>{i.push(l);for(let c=0;c<l.edgeCount;c++){let{type:d,next:u}=l.edge(c);if(d==e||i.indexOf(u)<0&&a(u))return!0}};if(a(r.contentMatch))return!0}}class go{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},o){o||(o=va(t).createDocumentFragment());let r=o,i=[];return e.forEach(a=>{if(i.length||a.marks.length){let l=0,c=0;for(;l<i.length&&c<a.marks.length;){let d=a.marks[c];if(!this.marks[d.type.name]){c++;continue}if(!d.eq(i[l][0])||d.type.spec.spanning===!1)break;l++,c++}for(;l<i.length;)r=i.pop()[1];for(;c<a.marks.length;){let d=a.marks[c++],u=this.serializeMark(d,a.isInline,t);u&&(i.push([d,r]),r.appendChild(u.dom),r=u.contentDOM||u.dom)}}r.appendChild(this.serializeNodeInner(a,t))}),o}serializeNodeInner(e,t){let{dom:o,contentDOM:r}=Si(va(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return o}serializeNode(e,t={}){let o=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(o),o=i.dom)}return o}serializeMark(e,t,o={}){let r=this.marks[e.type.name];return r&&Si(va(o),r(e,t),null,e.attrs)}static renderSpec(e,t,o=null,r){return Si(e,t,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new go(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Cu(e.nodes);return t.text||(t.text=o=>o.text),t}static marksFromSchema(e){return Cu(e.marks)}}function Cu(n){let e={};for(let t in n){let o=n[t].spec.toDOM;o&&(e[t]=o)}return e}function va(n){return n.document||window.document}const Nu=new WeakMap;function n1(n){let e=Nu.get(n);return e===void 0&&Nu.set(n,e=o1(n)),e}function o1(n){let e=null;function t(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let r=0;r<o.length;r++)t(o[r]);else for(let r in o)t(o[r])}return t(n),e}function Si(n,e,t,o){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],i;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(i=n1(o))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let a=r.indexOf(" ");a>0&&(t=r.slice(0,a),r=r.slice(a+1));let l,c=t?n.createElementNS(t,r):n.createElement(r),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let f in d)if(d[f]!=null){let p=f.indexOf(" ");p>0?c.setAttributeNS(f.slice(0,p),f.slice(p+1),d[f]):f=="style"&&c.style?c.style.cssText=d[f]:c.setAttribute(f,d[f])}}for(let f=u;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:h,contentDOM:m}=Si(n,p,t,o);if(c.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:c,contentDOM:l}}const vu=65535,Tu=Math.pow(2,16);function r1(n,e){return n+e*Tu}function zu(n){return n&vu}function i1(n){return(n-(n&vu))/Tu}const Mu=1,Au=2,Ci=4,Iu=8;class Ta{constructor(e,t,o){this.pos=e,this.delInfo=t,this.recover=o}get deleted(){return(this.delInfo&Iu)>0}get deletedBefore(){return(this.delInfo&(Mu|Ci))>0}get deletedAfter(){return(this.delInfo&(Au|Ci))>0}get deletedAcross(){return(this.delInfo&Ci)>0}}class Pt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Pt.empty)return Pt.empty}recover(e){let t=0,o=zu(e);if(!this.inverted)for(let r=0;r<o;r++)t+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+t+i1(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,o){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?r:0);if(c>e)break;let d=this.ranges[l+i],u=this.ranges[l+a],f=c+d;if(e<=f){let p=d?e==c?-1:e==f?1:t:t,h=c+r+(p<0?0:u);if(o)return h;let m=e==(t<0?c:f)?null:r1(l/3,e-c),g=e==c?Au:e==f?Mu:Ci;return(t<0?e!=c:e!=f)&&(g|=Iu),new Ta(h,g,m)}r+=u-d}return o?e+r:new Ta(e+r,0,null)}touches(e,t){let o=0,r=zu(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?o:0);if(c>e)break;let d=this.ranges[l+i],u=c+d;if(e<=u&&l==r*3)return!0;o+=this.ranges[l+a]-d}return!1}forEach(e){let t=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],l=a-(this.inverted?i:0),c=a+(this.inverted?0:i),d=this.ranges[r+t],u=this.ranges[r+o];e(l,l+d,c,c+u),i+=u-d}}invert(){return new Pt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Pt.empty:new Pt(e<0?[0,-e,0]:[0,0,e])}}Pt.empty=new Pt([]);class Ni{constructor(e,t,o=0,r=e?e.length:0){this.mirror=t,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Ni(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,o=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?o+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,o=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?o-r-1:void 0)}}invert(){let e=new Ni;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,o){let r=0;for(let i=this.from;i<this.to;i++){let a=this._maps[i],l=a.mapResult(e,t);if(l.recover!=null){let c=this.getMirror(i);if(c!=null&&c>i&&c<this.to){i=c,e=this._maps[c].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return o?e:new Ta(e,r,null)}}const za=Object.create(null);class gt{getMap(){return Pt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=za[t.stepType];if(!o)throw new RangeError(`No step type ${t.stepType} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in za)throw new RangeError("Duplicate use of step JSON ID "+e);return za[e]=t,t.prototype.jsonID=e,t}}class et{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new et(e,null)}static fail(e){return new et(null,e)}static fromReplace(e,t,o,r){try{return et.ok(e.replace(t,o,r))}catch(i){if(i instanceof yi)return et.fail(i.message);throw i}}}function Ma(n,e,t){let o=[];for(let r=0;r<n.childCount;r++){let i=n.child(r);i.content.size&&(i=i.copy(Ma(i.content,e,i))),i.isInline&&(i=e(i,t,r)),o.push(i)}return re.fromArray(o)}class qn extends gt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new fe(Ma(t.content,(a,l)=>!a.isAtom||!l.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),r),t.openStart,t.openEnd);return et.fromReplace(e,this.from,this.to,i)}invert(){return new on(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new qn(t.pos,o.pos,this.mark)}merge(e){return e instanceof qn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new qn(t.from,t.to,e.markFromJSON(t.mark))}}gt.jsonID("addMark",qn);class on extends gt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=new fe(Ma(t.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),t.openStart,t.openEnd);return et.fromReplace(e,this.from,this.to,o)}invert(){return new qn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new on(t.pos,o.pos,this.mark)}merge(e){return e instanceof on&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new on(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new on(t.from,t.to,e.markFromJSON(t.mark))}}gt.jsonID("removeMark",on);class Gn extends gt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return et.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return et.fromReplace(e,this.pos,this.pos+1,new fe(re.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let o=this.mark.addToSet(t.marks);if(o.length==t.marks.length){for(let r=0;r<t.marks.length;r++)if(!t.marks[r].isInSet(o))return new Gn(this.pos,t.marks[r]);return new Gn(this.pos,this.mark)}}return new yo(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Gn(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Gn(t.pos,e.markFromJSON(t.mark))}}gt.jsonID("addNodeMark",Gn);class yo extends gt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return et.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return et.fromReplace(e,this.pos,this.pos+1,new fe(re.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Gn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new yo(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new yo(t.pos,e.markFromJSON(t.mark))}}gt.jsonID("removeNodeMark",yo);class st extends gt{constructor(e,t,o,r=!1){super(),this.from=e,this.to=t,this.slice=o,this.structure=r}apply(e){return this.structure&&Aa(e,this.from,this.to)?et.fail("Structure replace would overwrite content"):et.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Pt([this.from,this.to-this.from,this.slice.size])}invert(e){return new st(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deletedAcross&&o.deletedAcross?null:new st(t.pos,Math.max(t.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof st)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?fe.empty:new fe(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new st(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?fe.empty:new fe(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new st(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new st(t.from,t.to,fe.fromJSON(e,t.slice),!!t.structure)}}gt.jsonID("replace",st);class at extends gt{constructor(e,t,o,r,i,a,l=!1){super(),this.from=e,this.to=t,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=a,this.structure=l}apply(e){if(this.structure&&(Aa(e,this.from,this.gapFrom)||Aa(e,this.gapTo,this.to)))return et.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return et.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,t.content);return o?et.fromReplace(e,this.from,this.to,o):et.fail("Content does not fit in gap")}getMap(){return new Pt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new at(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return t.deletedAcross&&o.deletedAcross||r<t.pos||i>o.pos?null:new at(t.pos,o.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new at(t.from,t.to,t.gapFrom,t.gapTo,fe.fromJSON(e,t.slice),t.insert,!!t.structure)}}gt.jsonID("replaceAround",at);function Aa(n,e,t){let o=n.resolve(e),r=t-e,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let a=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,r--}}return!1}function s1(n,e,t,o){let r=[],i=[],a,l;n.doc.nodesBetween(e,t,(c,d,u)=>{if(!c.isInline)return;let f=c.marks;if(!o.isInSet(f)&&u.type.allowsMarkType(o.type)){let p=Math.max(d,e),h=Math.min(d+c.nodeSize,t),m=o.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(a&&a.to==p&&a.mark.eq(f[g])?a.to=h:r.push(a=new on(p,h,f[g])));l&&l.to==p?l.to=h:i.push(l=new qn(p,h,o))}}),r.forEach(c=>n.step(c)),i.forEach(c=>n.step(c))}function a1(n,e,t,o){let r=[],i=0;n.doc.nodesBetween(e,t,(a,l)=>{if(!a.isInline)return;i++;let c=null;if(o instanceof Ei){let d=a.marks,u;for(;u=o.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else o?o.isInSet(a.marks)&&(c=[o]):c=a.marks;if(c&&c.length){let d=Math.min(l+a.nodeSize,t);for(let u=0;u<c.length;u++){let f=c[u],p;for(let h=0;h<r.length;h++){let m=r[h];m.step==i-1&&f.eq(r[h].style)&&(p=m)}p?(p.to=d,p.step=i):r.push({style:f,from:Math.max(l,e),to:d,step:i})}}}),r.forEach(a=>n.step(new on(a.from,a.to,a.style)))}function Ia(n,e,t,o=t.contentMatch,r=!0){let i=n.doc.nodeAt(e),a=[],l=e+1;for(let c=0;c<i.childCount;c++){let d=i.child(c),u=l+d.nodeSize,f=o.matchType(d.type);if(!f)a.push(new st(l,u,fe.empty));else{o=f;for(let p=0;p<d.marks.length;p++)t.allowsMarkType(d.marks[p].type)||n.step(new on(l,u,d.marks[p]));if(r&&d.isText&&t.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(d.text);)m||(m=new fe(re.from(t.schema.text(" ",t.allowedMarks(d.marks))),0,0)),a.push(new st(l+p.index,l+p.index+p[0].length,m))}}l=u}if(!o.validEnd){let c=o.fillBefore(re.empty,!0);n.replace(l,l,new fe(c,0,0))}for(let c=a.length-1;c>=0;c--)n.step(a[c])}function l1(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Do(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let o=n.depth,r=0,i=0;;--o){let a=n.$from.node(o),l=n.$from.index(o)+r,c=n.$to.indexAfter(o)-i;if(o<n.depth&&a.canReplace(l,c,t))return o;if(o==0||a.type.spec.isolating||!l1(a,l,c))break;l&&(r=1),c<a.childCount&&(i=1)}return null}function c1(n,e,t){let{$from:o,$to:r,depth:i}=e,a=o.before(i+1),l=r.after(i+1),c=a,d=l,u=re.empty,f=0;for(let m=i,g=!1;m>t;m--)g||o.index(m)>0?(g=!0,u=re.from(o.node(m).copy(u)),f++):c--;let p=re.empty,h=0;for(let m=i,g=!1;m>t;m--)g||r.after(m+1)<r.end(m)?(g=!0,p=re.from(r.node(m).copy(p)),h++):d++;n.step(new at(c,d,a,l,new fe(u.append(p),f,h),u.size-f,!0))}function _a(n,e,t=null,o=n){let r=d1(n,e),i=r&&u1(o,e);return i?r.map(_u).concat({type:e,attrs:t}).concat(i.map(_u)):null}function _u(n){return{type:n,attrs:null}}function d1(n,e){let{parent:t,startIndex:o,endIndex:r}=n,i=t.contentMatchAt(o).findWrapping(e);if(!i)return null;let a=i.length?i[0]:e;return t.canReplaceWith(o,r,a)?i:null}function u1(n,e){let{parent:t,startIndex:o,endIndex:r}=n,i=t.child(o),a=e.contentMatch.findWrapping(i.type);if(!a)return null;let c=(a.length?a[a.length-1]:e).contentMatch;for(let d=o;c&&d<r;d++)c=c.matchType(t.child(d).type);return!c||!c.validEnd?null:a}function f1(n,e,t){let o=re.empty;for(let a=t.length-1;a>=0;a--){if(o.size){let l=t[a].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=re.from(t[a].type.create(t[a].attrs,o))}let r=e.start,i=e.end;n.step(new at(r,i,r,i,new fe(o,0,0),t.length,!0))}function p1(n,e,t,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(a,l)=>{let c=typeof r=="function"?r(a):r;if(a.isTextblock&&!a.hasMarkup(o,c)&&h1(n.doc,n.mapping.slice(i).map(l),o)){let d=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?d=!1:!h&&m&&(d=!0)}d===!1&&Du(n,a,l,i),Ia(n,n.mapping.slice(i).map(l,1),o,void 0,d===null);let u=n.mapping.slice(i),f=u.map(l,1),p=u.map(l+a.nodeSize,1);return n.step(new at(f,p,f+1,p-1,new fe(re.from(o.create(c,null,a.marks)),0,0),1,!0)),d===!0&&Ou(n,a,l,i),!1}})}function Ou(n,e,t,o){e.forEach((r,i)=>{if(r.isText){let a,l=/\r?\n|\r/g;for(;a=l.exec(r.text);){let c=n.mapping.slice(o).map(t+1+i+a.index);n.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function Du(n,e,t,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let a=n.mapping.slice(o).map(t+1+i);n.replaceWith(a,a+1,e.type.schema.text(`
|
|
348
|
+
`))}})}function h1(n,e,t){let o=n.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,t)}function m1(n,e,t,o,r){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let a=t.create(o,null,r||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,a);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new at(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new fe(re.from(a),0,0),1,!0))}function Sn(n,e,t=1,o){let r=n.resolve(e),i=r.depth-t,a=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!a.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let d=r.depth-1,u=t-2;d>i;d--,u--){let f=r.node(d),p=r.index(d);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(p,f.childCount),m=o&&o[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=o&&o[u]||f;if(!f.canReplace(p+1,f.childCount)||!g.type.validContent(h))return!1}let l=r.indexAfter(i),c=o&&o[0];return r.node(i).canReplaceWith(l,l,c?c.type:r.node(i+1).type)}function g1(n,e,t=1,o){let r=n.doc.resolve(e),i=re.empty,a=re.empty;for(let l=r.depth,c=r.depth-t,d=t-1;l>c;l--,d--){i=re.from(r.node(l).copy(i));let u=o&&o[d];a=re.from(u?u.type.create(u.attrs,a):r.node(l).copy(a))}n.step(new st(e,e,new fe(i.append(a),t,t),!0))}function Kn(n,e){let t=n.resolve(e),o=t.index();return Pu(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(o,o+1)}function y1(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:o}=n.type.schema;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=i.type==o?n.type.schema.nodes.text:i.type;if(t=t.matchType(a),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function Pu(n,e){return!!(n&&e&&!n.isLeaf&&y1(n,e))}function vi(n,e,t=-1){let o=n.resolve(e);for(let r=o.depth;;r--){let i,a,l=o.index(r);if(r==o.depth?(i=o.nodeBefore,a=o.nodeAfter):t>0?(i=o.node(r+1),l++,a=o.node(r).maybeChild(l)):(i=o.node(r).maybeChild(l-1),a=o.node(r+1)),i&&!i.isTextblock&&Pu(i,a)&&o.node(r).canReplace(l,l+1))return e;if(r==0)break;e=t<0?o.before(r):o.after(r)}}function b1(n,e,t){let o=null,{linebreakReplacement:r}=n.doc.type.schema,i=n.doc.resolve(e-t),a=i.node().type;if(r&&a.inlineContent){let u=a.whitespace=="pre",f=!!a.contentMatch.matchType(r);u&&!f?o=!1:!u&&f&&(o=!0)}let l=n.steps.length;if(o===!1){let u=n.doc.resolve(e+t);Du(n,u.node(),u.before(),l)}a.inlineContent&&Ia(n,e+t-1,a,i.node().contentMatchAt(i.index()),o==null);let c=n.mapping.slice(l),d=c.map(e-t);if(n.step(new st(d,c.map(e+t,-1),fe.empty,!0)),o===!0){let u=n.doc.resolve(d);Ou(n,u.node(),u.before(),n.steps.length)}return n}function x1(n,e,t){let o=n.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),t))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,t))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,t))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function k1(n,e,t){let o=n.resolve(e);if(!t.content.size)return e;let r=t.content;for(let i=0;i<t.openStart;i++)r=r.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let a=o.depth;a>=0;a--){let l=a==o.depth?0:o.pos<=(o.start(a+1)+o.end(a+1))/2?-1:1,c=o.index(a)+(l>0?1:0),d=o.node(a),u=!1;if(i==1)u=d.canReplace(c,c,r);else{let f=d.contentMatchAt(c).findWrapping(r.firstChild.type);u=f&&d.canReplaceWith(c,c,f[0])}if(u)return l==0?o.pos:l<0?o.before(a+1):o.after(a+1)}return null}function Ti(n,e,t=e,o=fe.empty){if(e==t&&!o.size)return null;let r=n.resolve(e),i=n.resolve(t);return Ru(r,i,o)?new st(e,t,o):new E1(r,i,o).fit()}function Ru(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class E1{constructor(e,t,o){this.$from=e,this.$to=t,this.unplaced=o,this.frontier=[],this.placed=re.empty;for(let r=0;r<=e.depth;r++){let i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=re.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let i=this.placed,a=o.depth,l=r.depth;for(;a&&l&&i.childCount==1;)i=i.firstChild.content,a--,l--;let c=new fe(i,a,l);return e>-1?new at(o.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||o.pos!=this.$to.pos?new st(o.pos,r.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){e=o;break}t=i.content}for(let t=1;t<=2;t++)for(let o=t==1?e:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=Oa(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let a=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:c,match:d}=this.frontier[l],u,f=null;if(t==1&&(a?d.matchType(a.type)||(f=d.fillBefore(re.from(a),!1)):i&&c.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(t==2&&a&&(u=d.findWrapping(a.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:u};if(i&&d.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=Oa(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new fe(e,t+1,Math.max(o,r.size+t>=e.size-o?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=Oa(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new fe(mr(e,t-1,1),t-1,i?t-1:o)}else this.unplaced=new fe(mr(e,t,1),t,o)}placeNodes({sliceDepth:e,frontierDepth:t,parent:o,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let a=this.unplaced,l=o?o.content:a.content,c=a.openStart-e,d=0,u=[],{match:f,type:p}=this.frontier[t];if(r){for(let g=0;g<r.childCount;g++)u.push(r.child(g));f=f.matchFragment(r)}let h=l.size+e-(a.content.size-a.openEnd);for(;d<l.childCount;){let g=l.child(d),y=f.matchType(g.type);if(!y)break;d++,(d>1||c==0||g.content.size)&&(f=y,u.push(Lu(g.mark(p.allowedMarks(g.marks)),d==1?c:0,d==l.childCount?h:-1)))}let m=d==l.childCount;m||(h=-1),this.placed=gr(this.placed,t,re.from(u)),this.frontier[t].match=f,m&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<h;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=m?e==0?fe.empty:new fe(mr(a.content,e-1,1),e-1,h<0?a.openEnd:e-1):new fe(mr(a.content,e,d),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Da(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:o,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=Da(e,t,r,o,i);if(a){for(let l=t-1;l>=0;l--){let{match:c,type:d}=this.frontier[l],u=Da(e,l,d,c,!0);if(!u||u.childCount)continue e}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=gr(this.placed,t.depth,t.fit)),e=t.move;for(let o=t.depth+1;o<=e.depth;o++){let r=e.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,i)}return e}openFrontierNode(e,t=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=gr(this.placed,this.depth,re.from(e.create(t,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(re.empty,!0);t.childCount&&(this.placed=gr(this.placed,this.frontier.length,t))}}function mr(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(mr(n.firstChild.content,e-1,t)))}function gr(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(gr(n.lastChild.content,e-1,t)))}function Oa(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Lu(n,e,t){if(e<=0)return n;let o=n.content;return e>1&&(o=o.replaceChild(0,Lu(o.firstChild,e-1,o.childCount==1?t-1:0))),e>0&&(o=n.type.contentMatch.fillBefore(o).append(o),t<=0&&(o=o.append(n.type.contentMatch.matchFragment(o).fillBefore(re.empty,!0)))),n.copy(o)}function Da(n,e,t,o,r){let i=n.node(e),a=r?n.indexAfter(e):n.index(e);if(a==i.childCount&&!t.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,a);return l&&!w1(t,i.content,a)?l:null}function w1(n,e,t){for(let o=t;o<e.childCount;o++)if(!n.allowsMarks(e.child(o).marks))return!0;return!1}function S1(n){return n.spec.defining||n.spec.definingForContent}function C1(n,e,t,o){if(!o.size)return n.deleteRange(e,t);let r=n.doc.resolve(e),i=n.doc.resolve(t);if(Ru(r,i,o))return n.step(new st(e,t,o));let a=Vu(r,i);a[a.length-1]==0&&a.pop();let l=-(r.depth+1);a.unshift(l);for(let p=r.depth,h=r.pos-1;p>0;p--,h--){let m=r.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;a.indexOf(p)>-1?l=p:r.before(p)==h&&a.splice(1,0,-p)}let c=a.indexOf(l),d=[],u=o.openStart;for(let p=o.content,h=0;;h++){let m=p.firstChild;if(d.push(m),h==o.openStart)break;p=m.content}for(let p=u-1;p>=0;p--){let h=d[p],m=S1(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))u=p;else if(m||!h.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let h=(p+u+1)%(o.openStart+1),m=d[h];if(m)for(let g=0;g<a.length;g++){let y=a[(g+c)%a.length],b=!0;y<0&&(b=!1,y=-y);let z=r.node(y-1),w=r.index(y-1);if(z.canReplaceWith(w,w,m.type,m.marks))return n.replace(r.before(y),b?i.after(y):t,new fe($u(o.content,0,o.openStart,h),h,o.openEnd))}}let f=n.steps.length;for(let p=a.length-1;p>=0&&(n.replace(e,t,o),!(n.steps.length>f));p--){let h=a[p];h<0||(e=r.before(h),t=i.after(h))}}function $u(n,e,t,o,r){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy($u(i.content,e+1,t,o,i)))}if(e>o){let i=r.contentMatchAt(0),a=i.fillBefore(n).append(n);n=a.append(i.matchFragment(a).fillBefore(re.empty,!0))}return n}function N1(n,e,t,o){if(!o.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let r=x1(n.doc,e,o.type);r!=null&&(e=t=r)}n.replaceRange(e,t,new fe(re.from(o),0,0))}function v1(n,e,t){let o=n.doc.resolve(e),r=n.doc.resolve(t),i=Vu(o,r);for(let a=0;a<i.length;a++){let l=i[a],c=a==i.length-1;if(c&&l==0||o.node(l).type.contentMatch.validEnd)return n.delete(o.start(l),r.end(l));if(l>0&&(c||o.node(l-1).canReplace(o.index(l-1),r.indexAfter(l-1))))return n.delete(o.before(l),r.after(l))}for(let a=1;a<=o.depth&&a<=r.depth;a++)if(e-o.start(a)==o.depth-a&&t>o.end(a)&&r.end(a)-t!=r.depth-a&&o.start(a-1)==r.start(a-1)&&o.node(a-1).canReplace(o.index(a-1),r.index(a-1)))return n.delete(o.before(a),t);n.delete(e,t)}function Vu(n,e){let t=[],o=Math.min(n.depth,e.depth);for(let r=o;r>=0;r--){let i=n.start(r);if(i<n.pos-(n.depth-r)||e.end(r)>e.pos+(e.depth-r)||n.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==n.depth&&r==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&t.push(r)}return t}class Po extends gt{constructor(e,t,o){super(),this.pos=e,this.attr=t,this.value=o}apply(e){let t=e.nodeAt(this.pos);if(!t)return et.fail("No node at attribute step's position");let o=Object.create(null);for(let i in t.attrs)o[i]=t.attrs[i];o[this.attr]=this.value;let r=t.type.create(o,null,t.marks);return et.fromReplace(e,this.pos,this.pos+1,new fe(re.from(r),0,t.isLeaf?0:1))}getMap(){return Pt.empty}invert(e){return new Po(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Po(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Po(t.pos,t.attr,t.value)}}gt.jsonID("attr",Po);class yr extends gt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let o=e.type.create(t,e.content,e.marks);return et.ok(o)}getMap(){return Pt.empty}invert(e){return new yr(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new yr(t.attr,t.value)}}gt.jsonID("docAttr",yr);let Ro=class extends Error{};Ro=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},Ro.prototype=Object.create(Error.prototype),Ro.prototype.constructor=Ro,Ro.prototype.name="TransformError";class Bu{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ni}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Ro(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,o=fe.empty){let r=Ti(this.doc,e,t,o);return r&&this.step(r),this}replaceWith(e,t,o){return this.replace(e,t,new fe(re.from(o),0,0))}delete(e,t){return this.replace(e,t,fe.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,o){return C1(this,e,t,o),this}replaceRangeWith(e,t,o){return N1(this,e,t,o),this}deleteRange(e,t){return v1(this,e,t),this}lift(e,t){return c1(this,e,t),this}join(e,t=1){return b1(this,e,t),this}wrap(e,t){return f1(this,e,t),this}setBlockType(e,t=e,o,r=null){return p1(this,e,t,o,r),this}setNodeMarkup(e,t,o=null,r){return m1(this,e,t,o,r),this}setNodeAttribute(e,t,o){return this.step(new Po(e,t,o)),this}setDocAttribute(e,t){return this.step(new yr(e,t)),this}addNodeMark(e,t){return this.step(new Gn(e,t)),this}removeNodeMark(e,t){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(t instanceof Fe)t.isInSet(o.marks)&&this.step(new yo(e,t));else{let r=o.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new yo(e,i)),r=i.removeFromSet(r);for(let l=a.length-1;l>=0;l--)this.step(a[l])}return this}split(e,t=1,o){return g1(this,e,t,o),this}addMark(e,t,o){return s1(this,e,t,o),this}removeMark(e,t,o){return a1(this,e,t,o),this}clearIncompatible(e,t,o){return Ia(this,e,t,o),this}}const Pa=Object.create(null);class Pe{constructor(e,t,o){this.$anchor=e,this.$head=t,this.ranges=o||[new T1(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=fe.empty){let o=t.content.lastChild,r=null;for(let l=0;l<t.openEnd;l++)r=o,o=o.lastChild;let i=e.steps.length,a=this.ranges;for(let l=0;l<a.length;l++){let{$from:c,$to:d}=a[l],u=e.mapping.slice(i);e.replaceRange(u.map(c.pos),u.map(d.pos),l?fe.empty:t),l==0&&Hu(e,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let o=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:l}=r[i],c=e.mapping.slice(o),d=c.map(a.pos),u=c.map(l.pos);i?e.deleteRange(d,u):(e.replaceRangeWith(d,u,t),Hu(e,o,t.isInline?-1:1))}}static findFrom(e,t,o=!1){let r=e.parent.inlineContent?new Ie(e):Lo(e.node(0),e.parent,e.pos,e.index(),t,o);if(r)return r;for(let i=e.depth-1;i>=0;i--){let a=t<0?Lo(e.node(0),e.node(i),e.before(i+1),e.index(i),t,o):Lo(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,o);if(a)return a}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Rt(e.node(0))}static atStart(e){return Lo(e,e,0,0,1)||new Rt(e)}static atEnd(e){return Lo(e,e,e.content.size,e.childCount,-1)||new Rt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Pa[t.type];if(!o)throw new RangeError(`No selection type ${t.type} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in Pa)throw new RangeError("Duplicate use of selection JSON ID "+e);return Pa[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Ie.between(this.$anchor,this.$head).getBookmark()}}Pe.prototype.visible=!0;class T1{constructor(e,t){this.$from=e,this.$to=t}}let Fu=!1;function ju(n){!Fu&&!n.parent.inlineContent&&(Fu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class Ie extends Pe{constructor(e,t=e){ju(e),ju(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let o=e.resolve(t.map(this.head));if(!o.parent.inlineContent)return Pe.near(o);let r=e.resolve(t.map(this.anchor));return new Ie(r.parent.inlineContent?r:o,o)}replace(e,t=fe.empty){if(super.replace(e,t),t==fe.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof Ie&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new zi(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Ie(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){let r=e.resolve(t);return new this(r,o==t?r:e.resolve(o))}static between(e,t,o){let r=e.pos-t.pos;if((!o||r)&&(o=r>=0?1:-1),!t.parent.inlineContent){let i=Pe.findFrom(t,o,!0)||Pe.findFrom(t,-o,!0);if(i)t=i.$head;else return Pe.near(t,o)}return e.parent.inlineContent||(r==0?e=t:(e=(Pe.findFrom(e,-o,!0)||Pe.findFrom(e,o,!0)).$anchor,e.pos<t.pos!=r<0&&(e=t))),new Ie(e,t)}}Pe.jsonID("text",Ie);class zi{constructor(e,t){this.anchor=e,this.head=t}map(e){return new zi(e.map(this.anchor),e.map(this.head))}resolve(e){return Ie.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ce extends Pe{constructor(e){let t=e.nodeAfter,o=e.node(0).resolve(e.pos+t.nodeSize);super(e,o),this.node=t}map(e,t){let{deleted:o,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return o?Pe.near(i):new Ce(i)}content(){return new fe(re.from(this.node),0,0)}eq(e){return e instanceof Ce&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ra(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ce(e.resolve(t.anchor))}static create(e,t){return new Ce(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ce.prototype.visible=!1,Pe.jsonID("node",Ce);class Ra{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:o}=e.mapResult(this.anchor);return t?new zi(o,o):new Ra(o)}resolve(e){let t=e.resolve(this.anchor),o=t.nodeAfter;return o&&Ce.isSelectable(o)?new Ce(t):Pe.near(t)}}class Rt extends Pe{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=fe.empty){if(t==fe.empty){e.delete(0,e.doc.content.size);let o=Pe.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Rt(e)}map(e){return new Rt(e)}eq(e){return e instanceof Rt}getBookmark(){return z1}}Pe.jsonID("all",Rt);const z1={map(){return this},resolve(n){return new Rt(n)}};function Lo(n,e,t,o,r,i=!1){if(e.inlineContent)return Ie.create(n,t);for(let a=o-(r>0?0:1);r>0?a<e.childCount:a>=0;a+=r){let l=e.child(a);if(l.isAtom){if(!i&&Ce.isSelectable(l))return Ce.create(n,t-(r<0?l.nodeSize:0))}else{let c=Lo(n,l,t+r,r<0?l.childCount:0,r,i);if(c)return c}t+=l.nodeSize*r}return null}function Hu(n,e,t){let o=n.steps.length-1;if(o<e)return;let r=n.steps[o];if(!(r instanceof st||r instanceof at))return;let i=n.mapping.maps[o],a;i.forEach((l,c,d,u)=>{a==null&&(a=u)}),n.setSelection(Pe.near(n.doc.resolve(a),t))}const Uu=1,Mi=2,Wu=4;class M1 extends Bu{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Uu)&~Mi,this.storedMarks=null,this}get selectionSet(){return(this.updated&Uu)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Mi,this}ensureMarks(e){return Fe.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Mi)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Mi,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let o=this.selection;return t&&(e=e.mark(this.storedMarks||(o.empty?o.$from.marks():o.$from.marksAcross(o.$to)||Fe.none))),o.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,o){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(o==null&&(o=t),!e)return this.deleteRange(t,o);let i=this.storedMarks;if(!i){let a=this.doc.resolve(t);i=o==t?a.marks():a.marksAcross(this.doc.resolve(o))}return this.replaceRangeWith(t,o,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(Pe.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Wu,this}get scrolledIntoView(){return(this.updated&Wu)>0}}function qu(n,e){return!e||!n?n:n.bind(e)}class br{constructor(e,t,o){this.name=e,this.init=qu(t.init,o),this.apply=qu(t.apply,o)}}const A1=[new br("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new br("selection",{init(n,e){return n.selection||Pe.atStart(e.doc)},apply(n){return n.selection}}),new br("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,o){return o.selection.$cursor?n.storedMarks:null}}),new br("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class La{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=A1.slice(),t&&t.forEach(o=>{if(this.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");this.plugins.push(o),this.pluginsByKey[o.key]=o,o.spec.state&&this.fields.push(new br(o.key,o.spec.state,o))})}}class $o{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let o=0;o<this.config.plugins.length;o++)if(o!=t){let r=this.config.plugins[o];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],o=this.applyInner(e),r=null;for(;;){let i=!1;for(let a=0;a<this.config.plugins.length;a++){let l=this.config.plugins[a];if(l.spec.appendTransaction){let c=r?r[a].n:0,d=r?r[a].state:this,u=c<t.length&&l.spec.appendTransaction.call(l,c?t.slice(c):t,d,o);if(u&&o.filterTransaction(u,a)){if(u.setMeta("appendedTransaction",e),!r){r=[];for(let f=0;f<this.config.plugins.length;f++)r.push(f<a?{state:o,n:t.length}:{state:this,n:0})}t.push(u),o=o.applyInner(u),i=!0}r&&(r[a]={state:o,n:t.length})}}if(!i)return{state:o,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new $o(this.config),o=this.config.fields;for(let r=0;r<o.length;r++){let i=o[r];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new M1(this)}static create(e){let t=new La(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new $o(t);for(let r=0;r<t.fields.length;r++)o[t.fields[r].name]=t.fields[r].init(e,o);return o}reconfigure(e){let t=new La(this.schema,e.plugins),o=t.fields,r=new $o(t);for(let i=0;i<o.length;i++){let a=o[i].name;r[a]=this.hasOwnProperty(a)?this[a]:o[i].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(o=>o.toJSON())),e&&typeof e=="object")for(let o in e){if(o=="doc"||o=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[o],i=r.spec.state;i&&i.toJSON&&(t[o]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,o){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new La(e.schema,e.plugins),i=new $o(r);return r.fields.forEach(a=>{if(a.name=="doc")i.doc=Wn.fromJSON(e.schema,t.doc);else if(a.name=="selection")i.selection=Pe.fromJSON(i.doc,t.selection);else if(a.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(o)for(let l in o){let c=o[l],d=c.spec.state;if(c.key==a.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){i[a.name]=d.fromJSON.call(c,e,t[l],i);return}}i[a.name]=a.init(e,i)}}),i}}function Gu(n,e,t){for(let o in n){let r=n[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=Gu(r,e,{})),t[o]=r}return t}class At{constructor(e){this.spec=e,this.props={},e.props&&Gu(e.props,this,this.props),this.key=e.key?e.key.key:Ku("plugin")}getState(e){return e[this.key]}}const $a=Object.create(null);function Ku(n){return n in $a?n+"$"+ ++$a[n]:($a[n]=0,n+"$")}class rn{constructor(e="key"){this.key=Ku(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Va=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Ju(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Xu=(n,e,t)=>{let o=Ju(n,t);if(!o)return!1;let r=Ba(o);if(!r){let a=o.blockRange(),l=a&&Do(a);return l==null?!1:(e&&e(n.tr.lift(a,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(sf(n,r,e,-1))return!0;if(o.parent.content.size==0&&(Vo(i,"end")||Ce.isSelectable(i)))for(let a=o.depth;;a--){let l=Ti(n.doc,o.before(a),o.after(a),fe.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=n.tr.step(l);c.setSelection(Vo(i,"end")?Pe.findFrom(c.doc.resolve(c.mapping.map(r.pos,-1)),-1):Ce.create(c.doc,r.pos-i.nodeSize)),e(c.scrollIntoView())}return!0}if(a==1||o.node(a-1).childCount>1)break}return i.isAtom&&r.depth==o.depth-1?(e&&e(n.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),!0):!1},I1=(n,e,t)=>{let o=Ju(n,t);if(!o)return!1;let r=Ba(o);return r?Yu(n,r,e):!1},_1=(n,e,t)=>{let o=Zu(n,t);if(!o)return!1;let r=Fa(o);return r?Yu(n,r,e):!1};function Yu(n,e,t){let o=e.nodeBefore,r=o,i=e.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let u=r.lastChild;if(!u)return!1;r=u}let a=e.nodeAfter,l=a,c=e.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let d=Ti(n.doc,i,c,fe.empty);if(!d||d.from!=i||d instanceof st&&d.slice.size>=c-i)return!1;if(t){let u=n.tr.step(d);u.setSelection(Ie.create(u.doc,i)),t(u.scrollIntoView())}return!0}function Vo(n,e,t=!1){for(let o=n;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(t&&o.childCount!=1)return!1}return!1}const Qu=(n,e,t)=>{let{$head:o,empty:r}=n.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):o.parentOffset>0)return!1;i=Ba(o)}let a=i&&i.nodeBefore;return!a||!Ce.isSelectable(a)?!1:(e&&e(n.tr.setSelection(Ce.create(n.doc,i.pos-a.nodeSize)).scrollIntoView()),!0)};function Ba(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Zu(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const ef=(n,e,t)=>{let o=Zu(n,t);if(!o)return!1;let r=Fa(o);if(!r)return!1;let i=r.nodeAfter;if(sf(n,r,e,1))return!0;if(o.parent.content.size==0&&(Vo(i,"start")||Ce.isSelectable(i))){let a=Ti(n.doc,o.before(),o.after(),fe.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=n.tr.step(a);l.setSelection(Vo(i,"start")?Pe.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):Ce.create(l.doc,l.mapping.map(r.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&r.depth==o.depth-1?(e&&e(n.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0):!1},tf=(n,e,t)=>{let{$head:o,empty:r}=n.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):o.parentOffset<o.parent.content.size)return!1;i=Fa(o)}let a=i&&i.nodeAfter;return!a||!Ce.isSelectable(a)?!1:(e&&e(n.tr.setSelection(Ce.create(n.doc,i.pos)).scrollIntoView()),!0)};function Fa(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const O1=(n,e)=>{let t=n.selection,o=t instanceof Ce,r;if(o){if(t.node.isTextblock||!Kn(n.doc,t.from))return!1;r=t.from}else if(r=vi(n.doc,t.from,-1),r==null)return!1;if(e){let i=n.tr.join(r);o&&i.setSelection(Ce.create(i.doc,r-n.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},D1=(n,e)=>{let t=n.selection,o;if(t instanceof Ce){if(t.node.isTextblock||!Kn(n.doc,t.to))return!1;o=t.to}else if(o=vi(n.doc,t.to,1),o==null)return!1;return e&&e(n.tr.join(o).scrollIntoView()),!0},P1=(n,e)=>{let{$from:t,$to:o}=n.selection,r=t.blockRange(o),i=r&&Do(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},nf=(n,e)=>{let{$head:t,$anchor:o}=n.selection;return!t.parent.type.spec.code||!t.sameParent(o)?!1:(e&&e(n.tr.insertText(`
|
|
349
|
+
`).scrollIntoView()),!0)};function ja(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const R1=(n,e)=>{let{$head:t,$anchor:o}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(o))return!1;let r=t.node(-1),i=t.indexAfter(-1),a=ja(r.contentMatchAt(i));if(!a||!r.canReplaceWith(i,i,a))return!1;if(e){let l=t.after(),c=n.tr.replaceWith(l,l,a.createAndFill());c.setSelection(Pe.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},of=(n,e)=>{let t=n.selection,{$from:o,$to:r}=t;if(t instanceof Rt||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=ja(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let a=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,l=n.tr.insert(a,i.createAndFill());l.setSelection(Ie.create(l.doc,a+1)),e(l.scrollIntoView())}return!0},rf=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(Sn(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let o=t.blockRange(),r=o&&Do(o);return r==null?!1:(e&&e(n.tr.lift(o,r).scrollIntoView()),!0)};function L1(n){return(e,t)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof Ce&&e.selection.node.isBlock)return!o.parentOffset||!Sn(e.doc,o.pos)?!1:(t&&t(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.depth)return!1;let i=[],a,l,c=!1,d=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){c=o.end(h)==o.pos+(o.depth-h),d=o.start(h)==o.pos-(o.depth-h),l=ja(o.node(h-1).contentMatchAt(o.indexAfter(h-1))),i.unshift(c&&l?{type:l}:null),a=h;break}else{if(h==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof Ie||e.selection instanceof Rt)&&u.deleteSelection();let f=u.mapping.map(o.pos),p=Sn(u.doc,f,i.length,i);if(p||(i[0]=l?{type:l}:null,p=Sn(u.doc,f,i.length,i)),!p)return!1;if(u.split(f,i.length,i),!c&&d&&o.node(a).type!=l){let h=u.mapping.map(o.before(a)),m=u.doc.resolve(h);l&&o.node(a-1).canReplaceWith(m.index(),m.index()+1,l)&&u.setNodeMarkup(u.mapping.map(o.before(a)),l)}return t&&t(u.scrollIntoView()),!0}}const $1=L1(),V1=(n,e)=>{let{$from:t,to:o}=n.selection,r,i=t.sharedDepth(o);return i==0?!1:(r=t.before(i),e&&e(n.tr.setSelection(Ce.create(n.doc,r))),!0)};function B1(n,e,t){let o=e.nodeBefore,r=e.nodeAfter,i=e.index();return!o||!r||!o.type.compatibleContent(r.type)?!1:!o.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(r.isTextblock||Kn(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function sf(n,e,t,o){let r=e.nodeBefore,i=e.nodeAfter,a,l,c=r.type.spec.isolating||i.type.spec.isolating;if(!c&&B1(n,e,t))return!0;let d=!c&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(a=(l=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&l.matchType(a[0]||i.type).validEnd){if(t){let h=e.pos+i.nodeSize,m=re.empty;for(let b=a.length-1;b>=0;b--)m=re.from(a[b].create(null,m));m=re.from(r.copy(m));let g=n.tr.step(new at(e.pos-1,h,e.pos,h,new fe(m,1,0),a.length,!0)),y=g.doc.resolve(h+2*a.length);y.nodeAfter&&y.nodeAfter.type==r.type&&Kn(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let u=i.type.spec.isolating||o>0&&c?null:Pe.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),p=f&&Do(f);if(p!=null&&p>=e.depth)return t&&t(n.tr.lift(f,p).scrollIntoView()),!0;if(d&&Vo(i,"start",!0)&&Vo(r,"end")){let h=r,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let g=i,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(t){let b=re.empty;for(let w=m.length-1;w>=0;w--)b=re.from(m[w].copy(b));let z=n.tr.step(new at(e.pos-m.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new fe(b,m.length,0),0,!0));t(z.scrollIntoView())}return!0}}return!1}function af(n){return function(e,t){let o=e.selection,r=n<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return r.node(i).isTextblock?(t&&t(e.tr.setSelection(Ie.create(e.doc,n<0?r.start(i):r.end(i)))),!0):!1}}const F1=af(-1),j1=af(1);function H1(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,a=r.blockRange(i),l=a&&_a(a,n,e);return l?(o&&o(t.tr.wrap(a,l).scrollIntoView()),!0):!1}}function lf(n,e=null){return function(t,o){let r=!1;for(let i=0;i<t.selection.ranges.length&&!r;i++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[i];t.doc.nodesBetween(a,l,(c,d)=>{if(r)return!1;if(!(!c.isTextblock||c.hasMarkup(n,e)))if(c.type==n)r=!0;else{let u=t.doc.resolve(d),f=u.index();r=u.parent.canReplaceWith(f,f+1,n)}})}if(!r)return!1;if(o){let i=t.tr;for(let a=0;a<t.selection.ranges.length;a++){let{$from:{pos:l},$to:{pos:c}}=t.selection.ranges[a];i.setBlockType(l,c,n,e)}o(i.scrollIntoView())}return!0}}function Ha(...n){return function(e,t,o){for(let r=0;r<n.length;r++)if(n[r](e,t,o))return!0;return!1}}Ha(Va,Xu,Qu),Ha(Va,ef,tf),Ha(nf,of,rf,$1),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function U1(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,a=r.blockRange(i);if(!a)return!1;let l=o?t.tr:null;return W1(l,a,n,e)?(o&&o(l.scrollIntoView()),!0):!1}}function W1(n,e,t,o=null){let r=!1,i=e,a=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=a.resolve(e.start-2);i=new xi(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new xi(e.$from,a.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=_a(i,t,o,e);return l?(n&&q1(n,e,l,r,t),!0):!1}function q1(n,e,t,o,r){let i=re.empty;for(let u=t.length-1;u>=0;u--)i=re.from(t[u].type.create(t[u].attrs,i));n.step(new at(e.start-(o?2:0),e.end,e.start,e.end,new fe(i,0,0),t.length,!0));let a=0;for(let u=0;u<t.length;u++)t[u].type==r&&(a=u+1);let l=t.length-a,c=e.start+t.length-(o?2:0),d=e.parent;for(let u=e.startIndex,f=e.endIndex,p=!0;u<f;u++,p=!1)!p&&Sn(n.doc,c,l)&&(n.split(c,l),c+=2*l),c+=d.child(u).nodeSize;return n}function G1(n){return function(e,t){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,a=>a.childCount>0&&a.firstChild.type==n);return i?t?o.node(i.depth-1).type==n?K1(e,t,n,i):J1(e,t,i):!0:!1}}function K1(n,e,t,o){let r=n.tr,i=o.end,a=o.$to.end(o.depth);i<a&&(r.step(new at(i-1,a,i,a,new fe(re.from(t.create(null,o.parent.copy())),1,0),1,!0)),o=new xi(r.doc.resolve(o.$from.pos),r.doc.resolve(a),o.depth));const l=Do(o);if(l==null)return!1;r.lift(o,l);let c=r.doc.resolve(r.mapping.map(i,-1)-1);return Kn(r.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&r.join(c.pos),e(r.scrollIntoView()),!0}function J1(n,e,t){let o=n.tr,r=t.parent;for(let h=t.end,m=t.endIndex-1,g=t.startIndex;m>g;m--)h-=r.child(m).nodeSize,o.delete(h-1,h+1);let i=o.doc.resolve(t.start),a=i.nodeAfter;if(o.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,c=t.endIndex==r.childCount,d=i.node(-1),u=i.index(-1);if(!d.canReplace(u+(l?0:1),u+1,a.content.append(c?re.empty:re.from(r))))return!1;let f=i.pos,p=f+a.nodeSize;return o.step(new at(f-(l?1:0),p+(c?1:0),f+1,p-1,new fe((l?re.empty:re.from(r.copy(re.empty))).append(c?re.empty:re.from(r.copy(re.empty))),l?0:1,c?0:1),l?0:1)),e(o.scrollIntoView()),!0}function X1(n){return function(e,t){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,d=>d.childCount>0&&d.firstChild.type==n);if(!i)return!1;let a=i.startIndex;if(a==0)return!1;let l=i.parent,c=l.child(a-1);if(c.type!=n)return!1;if(t){let d=c.lastChild&&c.lastChild.type==l.type,u=re.from(d?n.create():null),f=new fe(re.from(n.create(null,re.from(l.type.create(null,u)))),d?3:1,0),p=i.start,h=i.end;t(e.tr.step(new at(p-(d?3:1),h,p,h,f,1,!0)).scrollIntoView())}return!0}}const ft=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Bo=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Ua=null;const Cn=function(n,e,t){let o=Ua||(Ua=document.createRange());return o.setEnd(n,t??n.nodeValue.length),o.setStart(n,e||0),o},Y1=function(){Ua=null},bo=function(n,e,t,o){return t&&(cf(n,e,t,o,-1)||cf(n,e,t,o,1))},Q1=/^(img|br|input|textarea|hr)$/i;function cf(n,e,t,o,r){for(var i;;){if(n==t&&e==o)return!0;if(e==(r<0?0:Ft(n))){let a=n.parentNode;if(!a||a.nodeType!=1||xr(n)||Q1.test(n.nodeName)||n.contentEditable=="false")return!1;e=ft(n)+(r<0?0:1),n=a}else if(n.nodeType==1){let a=n.childNodes[e+(r<0?-1:0)];if(a.nodeType==1&&a.contentEditable=="false")if(!((i=a.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=r;else return!1;else n=a,e=r<0?Ft(n):0}else return!1}}function Ft(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Z1(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Ft(n)}else if(n.parentNode&&!xr(n))e=ft(n),n=n.parentNode;else return null}}function e0(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!xr(n))e=ft(n)+1,n=n.parentNode;else return null}}function t0(n,e,t){for(let o=e==0,r=e==Ft(n);o||r;){if(n==t)return!0;let i=ft(n);if(n=n.parentNode,!n)return!1;o=o&&i==0,r=r&&i==Ft(n)}}function xr(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Ai=function(n){return n.focusNode&&bo(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function xo(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function n0(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function o0(n,e,t){if(n.caretPositionFromPoint)try{let o=n.caretPositionFromPoint(e,t);if(o)return{node:o.offsetNode,offset:Math.min(Ft(o.offsetNode),o.offset)}}catch{}if(n.caretRangeFromPoint){let o=n.caretRangeFromPoint(e,t);if(o)return{node:o.startContainer,offset:Math.min(Ft(o.startContainer),o.startOffset)}}}const un=typeof navigator<"u"?navigator:null,df=typeof document<"u"?document:null,Jn=un&&un.userAgent||"",Wa=/Edge\/(\d+)/.exec(Jn),uf=/MSIE \d/.exec(Jn),qa=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Jn),It=!!(uf||qa||Wa),Xn=uf?document.documentMode:qa?+qa[1]:Wa?+Wa[1]:0,jt=!It&&/gecko\/(\d+)/i.test(Jn);jt&&+(/Firefox\/(\d+)/.exec(Jn)||[0,0])[1];const Ga=!It&&/Chrome\/(\d+)/.exec(Jn),lt=!!Ga,ff=Ga?+Ga[1]:0,pt=!It&&!!un&&/Apple Computer/.test(un.vendor),Fo=pt&&(/Mobile\/\w+/.test(Jn)||!!un&&un.maxTouchPoints>2),Ht=Fo||(un?/Mac/.test(un.platform):!1),pf=un?/Win/.test(un.platform):!1,Nn=/Android \d/.test(Jn),kr=!!df&&"webkitFontSmoothing"in df.documentElement.style,r0=kr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function i0(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function vn(n,e){return typeof n=="number"?n:n[e]}function s0(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,o=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*o}}function hf(n,e,t){let o=n.someProp("scrollThreshold")||0,r=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let a=t||n.dom;a;){if(a.nodeType!=1){a=Bo(a);continue}let l=a,c=l==i.body,d=c?i0(i):s0(l),u=0,f=0;if(e.top<d.top+vn(o,"top")?f=-(d.top-e.top+vn(r,"top")):e.bottom>d.bottom-vn(o,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+vn(r,"top")-d.top:e.bottom-d.bottom+vn(r,"bottom")),e.left<d.left+vn(o,"left")?u=-(d.left-e.left+vn(r,"left")):e.right>d.right-vn(o,"right")&&(u=e.right-d.right+vn(r,"right")),u||f)if(c)i.defaultView.scrollBy(u,f);else{let h=l.scrollLeft,m=l.scrollTop;f&&(l.scrollTop+=f),u&&(l.scrollLeft+=u);let g=l.scrollLeft-h,y=l.scrollTop-m;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let p=c?"fixed":getComputedStyle(a).position;if(/^(fixed|sticky)$/.test(p))break;a=p=="absolute"?a.offsetParent:Bo(a)}}function a0(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),o,r;for(let i=(e.left+e.right)/2,a=t+1;a<Math.min(innerHeight,e.bottom);a+=5){let l=n.root.elementFromPoint(i,a);if(!l||l==n.dom||!n.dom.contains(l))continue;let c=l.getBoundingClientRect();if(c.top>=t-20){o=l,r=c.top;break}}return{refDOM:o,refTop:r,stack:mf(n.dom)}}function mf(n){let e=[],t=n.ownerDocument;for(let o=n;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),n!=t);o=Bo(o));return e}function l0({refDOM:n,refTop:e,stack:t}){let o=n?n.getBoundingClientRect().top:0;gf(t,o==0?0:o-e)}function gf(n,e){for(let t=0;t<n.length;t++){let{dom:o,top:r,left:i}=n[t];o.scrollTop!=r+e&&(o.scrollTop=r+e),o.scrollLeft!=i&&(o.scrollLeft=i)}}let jo=null;function c0(n){if(n.setActive)return n.setActive();if(jo)return n.focus(jo);let e=mf(n);n.focus(jo==null?{get preventScroll(){return jo={preventScroll:!0},!0}}:void 0),jo||(jo=!1,gf(e,0))}function yf(n,e){let t,o=2e8,r,i=0,a=e.top,l=e.top,c,d;for(let u=n.firstChild,f=0;u;u=u.nextSibling,f++){let p;if(u.nodeType==1)p=u.getClientRects();else if(u.nodeType==3)p=Cn(u).getClientRects();else continue;for(let h=0;h<p.length;h++){let m=p[h];if(m.top<=a&&m.bottom>=l){a=Math.max(m.bottom,a),l=Math.min(m.top,l);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<o){t=u,o=g,r=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(i=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=u,d={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=f+1)}}return!t&&c&&(t=c,r=d,o=0),t&&t.nodeType==3?d0(t,r):!t||o&&t.nodeType==1?{node:n,offset:i}:yf(t,r)}function d0(n,e){let t=n.nodeValue.length,o=document.createRange(),r;for(let i=0;i<t;i++){o.setEnd(n,i+1),o.setStart(n,i);let a=Yn(o,1);if(a.top!=a.bottom&&Ka(e,a)){r={node:n,offset:i+(e.left>=(a.left+a.right)/2?1:0)};break}}return o.detach(),r||{node:n,offset:0}}function Ka(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function u0(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function f0(n,e,t){let{node:o,offset:r}=yf(e,t),i=-1;if(o.nodeType==1&&!o.firstChild){let a=o.getBoundingClientRect();i=a.left!=a.right&&t.left>(a.left+a.right)/2?1:-1}return n.docView.posFromDOM(o,r,i)}function p0(n,e,t,o){let r=-1;for(let i=e,a=!1;i!=n.dom;){let l=n.docView.nearestDesc(i,!0),c;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((c=l.dom.getBoundingClientRect()).width||c.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!a&&c.left>o.left||c.top>o.top?r=l.posBefore:(!a&&c.right<o.left||c.bottom<o.top)&&(r=l.posAfter),a=!0),!l.contentDOM&&r<0&&!l.node.isText))return(l.node.isBlock?o.top<(c.top+c.bottom)/2:o.left<(c.left+c.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return r>-1?r:n.docView.posFromDOM(e,t,-1)}function bf(n,e,t){let o=n.childNodes.length;if(o&&t.top<t.bottom)for(let r=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-t.top)/(t.bottom-t.top))-2)),i=r;;){let a=n.childNodes[i];if(a.nodeType==1){let l=a.getClientRects();for(let c=0;c<l.length;c++){let d=l[c];if(Ka(e,d))return bf(a,e,d)}}if((i=(i+1)%o)==r)break}return n}function h0(n,e){let t=n.dom.ownerDocument,o,r=0,i=o0(t,e.left,e.top);i&&({node:o,offset:r}=i);let a=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!a||!n.dom.contains(a.nodeType!=1?a.parentNode:a)){let d=n.dom.getBoundingClientRect();if(!Ka(e,d)||(a=bf(n.dom,e,d),!a))return null}if(pt)for(let d=a;o&&d;d=Bo(d))d.draggable&&(o=void 0);if(a=u0(a,e),o){if(jt&&o.nodeType==1&&(r=Math.min(r,o.childNodes.length),r<o.childNodes.length)){let u=o.childNodes[r],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&r++}let d;kr&&r&&o.nodeType==1&&(d=o.childNodes[r-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&r--,o==n.dom&&r==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(r==0||o.nodeType!=1||o.childNodes[r-1].nodeName!="BR")&&(l=p0(n,o,r,e))}l==null&&(l=f0(n,a,e));let c=n.docView.nearestDesc(a,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function xf(n){return n.top<n.bottom||n.left<n.right}function Yn(n,e){let t=n.getClientRects();if(t.length){let o=t[e<0?0:t.length-1];if(xf(o))return o}return Array.prototype.find.call(t,xf)||n.getBoundingClientRect()}const m0=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function kf(n,e,t){let{node:o,offset:r,atom:i}=n.docView.domFromPos(e,t<0?-1:1),a=kr||jt;if(o.nodeType==3)if(a&&(m0.test(o.nodeValue)||(t<0?!r:r==o.nodeValue.length))){let c=Yn(Cn(o,r,r),t);if(jt&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let d=Yn(Cn(o,r-1,r-1),-1);if(d.top==c.top){let u=Yn(Cn(o,r,r+1),-1);if(u.top!=c.top)return Er(u,u.left<d.left)}}return c}else{let c=r,d=r,u=t<0?1:-1;return t<0&&!r?(d++,u=-1):t>=0&&r==o.nodeValue.length?(c--,u=1):t<0?c--:d++,Er(Yn(Cn(o,c,d),u),u<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&r&&(t<0||r==Ft(o))){let c=o.childNodes[r-1];if(c.nodeType==1)return Ja(c.getBoundingClientRect(),!1)}if(i==null&&r<Ft(o)){let c=o.childNodes[r];if(c.nodeType==1)return Ja(c.getBoundingClientRect(),!0)}return Ja(o.getBoundingClientRect(),t>=0)}if(i==null&&r&&(t<0||r==Ft(o))){let c=o.childNodes[r-1],d=c.nodeType==3?Cn(c,Ft(c)-(a?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return Er(Yn(d,1),!1)}if(i==null&&r<Ft(o)){let c=o.childNodes[r];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?Cn(c,0,a?0:1):c.nodeType==1?c:null:null;if(d)return Er(Yn(d,-1),!0)}return Er(Yn(o.nodeType==3?Cn(o):o,-t),t>=0)}function Er(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function Ja(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Ef(n,e,t){let o=n.state,r=n.root.activeElement;o!=e&&n.updateState(e),r!=n.dom&&n.focus();try{return t()}finally{o!=e&&n.updateState(o),r!=n.dom&&r&&r.focus()}}function g0(n,e,t){let o=e.selection,r=t=="up"?o.$from:o.$to;return Ef(n,e,()=>{let{node:i}=n.docView.domFromPos(r.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let a=kf(n,r.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let c;if(l.nodeType==1)c=l.getClientRects();else if(l.nodeType==3)c=Cn(l,0,l.nodeValue.length).getClientRects();else continue;for(let d=0;d<c.length;d++){let u=c[d];if(u.bottom>u.top+1&&(t=="up"?a.top-u.top>(u.bottom-a.top)*2:u.bottom-a.bottom>(a.bottom-u.top)*2))return!1}}return!0})}const y0=/[\u0590-\u08ac]/;function b0(n,e,t){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let r=o.parentOffset,i=!r,a=r==o.parent.content.size,l=n.domSelection();return l?!y0.test(o.parent.textContent)||!l.modify?t=="left"||t=="backward"?i:a:Ef(n,e,()=>{let{focusNode:c,focusOffset:d,anchorNode:u,anchorOffset:f}=n.domSelectionRange(),p=l.caretBidiLevel;l.modify("move",t,"character");let h=o.depth?n.docView.domAfterPos(o.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),y=m&&!h.contains(m.nodeType==1?m:m.parentNode)||c==m&&d==g;try{l.collapse(u,f),c&&(c!=u||d!=f)&&l.extend&&l.extend(c,d)}catch{}return p!=null&&(l.caretBidiLevel=p),y}):o.pos==o.start()||o.pos==o.end()}let wf=null,Sf=null,Cf=!1;function x0(n,e,t){return wf==e&&Sf==t?Cf:(wf=e,Sf=t,Cf=t=="up"||t=="down"?g0(n,e,t):b0(n,e,t))}const Ut=0,Nf=1,ko=2,fn=3;class wr{constructor(e,t,o,r){this.parent=e,this.children=t,this.dom=o,this.contentDOM=r,this.dirty=Ut,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,o){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,o=this.posAtStart;;t++){let r=this.children[t];if(r==e)return o;o+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let i,a;if(e==this.contentDOM)i=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((a=i.pmViewDesc)&&a.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(a)+a.size:this.posAtStart}else{let i,a;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((a=i.pmViewDesc)&&a.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(a):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>ft(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!1;break}if(i.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!0;break}if(i.nextSibling)break}}return r??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let o=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node))if(o&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))o=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let o=t;o;o=o.parent)if(o==this)return t}posFromDOM(e,t,o){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,o)}return-1}descAt(e){for(let t=0,o=0;t<this.children.length;t++){let r=this.children[t],i=o+r.size;if(o==e&&i!=o){for(;!r.border&&r.children.length;)for(let a=0;a<r.children.length;a++){let l=r.children[a];if(l.size){r=l;break}}return r}if(e<i)return r.descAt(e-o-r.border);o=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,r=0;for(let i=0;o<this.children.length;o++){let a=this.children[o],l=i+a.size;if(l>e||a instanceof zf){r=e-i;break}i=l}if(r)return this.children[o].domFromPos(r-this.children[o].border,t);for(let i;o&&!(i=this.children[o-1]).size&&i instanceof vf&&i.side>=0;o--);if(t<=0){let i,a=!0;for(;i=o?this.children[o-1]:null,!(!i||i.dom.parentNode==this.contentDOM);o--,a=!1);return i&&t&&a&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?ft(i.dom)+1:0}}else{let i,a=!0;for(;i=o<this.children.length?this.children[o]:null,!(!i||i.dom.parentNode==this.contentDOM);o++,a=!1);return i&&a&&!i.border&&!i.domAtom?i.domFromPos(0,t):{node:this.contentDOM,offset:i?ft(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=o,l=0;;l++){let c=this.children[l],d=a+c.size;if(r==-1&&e<=d){let u=a+c.border;if(e>=u&&t<=d-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,t,u);e=a;for(let f=l;f>0;f--){let p=this.children[f-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=ft(p.dom)+1;break}e-=p.size}r==-1&&(r=0)}if(r>-1&&(d>t||l==this.children.length-1)){t=d;for(let u=l+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=ft(f.dom);break}t+=f.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=d}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:o}=this.domFromPos(e,0);if(t.nodeType!=1||o==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[o]}setSelection(e,t,o,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let h=0,m=0;h<this.children.length;h++){let g=this.children[h],y=m+g.size;if(i>m&&a<y)return g.setSelection(e-m-g.border,t-m-g.border,o,r);m=y}let l=this.domFromPos(e,e?-1:1),c=t==e?l:this.domFromPos(t,t?-1:1),d=o.root.getSelection(),u=o.domSelectionRange(),f=!1;if((jt||pt)&&e==t){let{node:h,offset:m}=l;if(h.nodeType==3){if(f=!!(m&&h.nodeValue[m-1]==`
|
|
350
|
+
`),f&&m==h.nodeValue.length)for(let g=h,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(l=c={node:y.parentNode,offset:ft(y)+1});break}let b=g.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let g=h.childNodes[m-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(jt&&u.focusNode&&u.focusNode!=c.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(r=!0)}if(!(r||f&&pt)&&bo(l.node,l.offset,u.anchorNode,u.anchorOffset)&&bo(c.node,c.offset,u.focusNode,u.focusOffset))return;let p=!1;if((d.extend||e==t)&&!(f&&jt)){d.collapse(l.node,l.offset);try{e!=t&&d.extend(c.node,c.offset),p=!0}catch{}}if(!p){if(e>t){let m=l;l=c,c=m}let h=document.createRange();h.setEnd(c.node,c.offset),h.setStart(l.node,l.offset),d.removeAllRanges(),d.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let o=0,r=0;r<this.children.length;r++){let i=this.children[r],a=o+i.size;if(o==a?e<=a&&t>=o:e<a&&t>o){let l=o+i.border,c=a-i.border;if(e>=l&&t<=c){this.dirty=e==o||t==a?ko:Nf,e==l&&t==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=fn:i.markDirty(e-l,t-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?ko:fn}o=a}this.dirty=ko}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let o=e==1?ko:Nf;t.dirty<o&&(t.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class vf extends wr{constructor(e,t,o,r){let i,a=t.type.toDOM;if(typeof a=="function"&&(a=a(o,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(a.nodeType!=1){let l=document.createElement("span");l.appendChild(a),a=l}a.contentEditable="false",a.classList.add("ProseMirror-widget")}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Ut&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class k0 extends wr{constructor(e,t,o,r){super(e,[],t,null),this.textDOM=o,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Eo extends wr{constructor(e,t,o,r,i){super(e,[],o,r),this.mark=t,this.spec=i}static create(e,t,o,r){let i=r.nodeViews[t.type.name],a=i&&i(t,r,o);return(!a||!a.dom)&&(a=go.renderSpec(document,t.type.spec.toDOM(t,o),null,t.attrs)),new Eo(e,t,a.dom,a.contentDOM||a.dom,a)}parseRule(){return this.dirty&fn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=fn&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Ut){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=Ut}}slice(e,t,o){let r=Eo.create(this.parent,this.mark,!0,o),i=this.children,a=this.size;t<a&&(i=Ya(i,t,a,o)),e>0&&(i=Ya(i,0,e,o));for(let l=0;l<i.length;l++)i[l].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Qn extends wr{constructor(e,t,o,r,i,a,l,c,d){super(e,[],i,a),this.node=t,this.outerDeco=o,this.innerDeco=r,this.nodeDOM=l}static create(e,t,o,r,i,a){let l=i.nodeViews[t.type.name],c,d=l&&l(t,i,()=>{if(!c)return a;if(c.parent)return c.parent.posBeforeChild(c)},o,r),u=d&&d.dom,f=d&&d.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=go.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let p=u;return u=If(u,o,t),d?c=new E0(e,t,o,r,u,f||null,p,d,i,a+1):t.isText?new Ii(e,t,o,r,u,p,i):new Qn(e,t,o,r,u,f||null,p,i,a+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let o=this.children[t];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>re.empty)}return e}matchesNode(e,t,o){return this.dirty==Ut&&e.eq(this.node)&&_i(t,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let o=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,l=i&&i.pos<0,c=new S0(this,a&&a.node,e);v0(this.node,this.innerDeco,(d,u,f)=>{d.spec.marks?c.syncToMarks(d.spec.marks,o,e,u):d.type.side>=0&&!f&&c.syncToMarks(u==this.node.childCount?Fe.none:this.node.child(u).marks,o,e,u),c.placeWidget(d,e,r)},(d,u,f,p)=>{c.syncToMarks(d.marks,o,e,p);let h;c.findNodeMatch(d,u,f,p)||l&&e.state.selection.from>r&&e.state.selection.to<r+d.nodeSize&&(h=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(d,u,f,h,e)||c.updateNextNode(d,u,f,e,p,r)||c.addNode(d,u,f,e,r),r+=d.nodeSize}),c.syncToMarks([],o,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==ko)&&(a&&this.protectLocalComposition(e,a),Mf(this.contentDOM,this.children,e),Fo&&T0(this.dom))}localCompositionInfo(e,t){let{from:o,to:r}=e.state.selection;if(!(e.state.selection instanceof Ie)||o<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let a=i.nodeValue,l=z0(this.node.content,a,o-t,r-t);return l<0?null:{node:i,pos:l,text:a}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:o,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let a=new k0(this,i,t,r);e.input.compositionNodes.push(a),this.children=Ya(this.children,o,o+r.length,e,a)}update(e,t,o,r){return this.dirty==fn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,o,r),!0)}updateInner(e,t,o,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=Ut}updateOuterDeco(e){if(_i(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=Af(this.dom,this.nodeDOM,Xa(this.outerDeco,this.node,t),Xa(e,this.node,t)),this.dom!=o&&(o.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Tf(n,e,t,o,r){If(o,e,n);let i=new Qn(void 0,n,e,t,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}class Ii extends Qn{constructor(e,t,o,r,i,a,l){super(e,t,o,r,i,null,a,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,o,r){return this.dirty==fn||this.dirty!=Ut&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Ut||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=Ut,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,o){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,o)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,o){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new Ii(this.parent,r,this.outerDeco,this.innerDeco,i,i,o)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=fn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class zf extends wr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ut&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class E0 extends Qn{constructor(e,t,o,r,i,a,l,c,d,u){super(e,t,o,r,i,a,l,d,u),this.spec=c}update(e,t,o,r){if(this.dirty==fn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,o);return i&&this.updateInner(e,t,o,r),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,o,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,o,r){this.spec.setSelection?this.spec.setSelection(e,t,o.root):super.setSelection(e,t,o,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Mf(n,e,t){let o=n.firstChild,r=!1;for(let i=0;i<e.length;i++){let a=e[i],l=a.dom;if(l.parentNode==n){for(;l!=o;)o=_f(o),r=!0;o=o.nextSibling}else r=!0,n.insertBefore(l,o);if(a instanceof Eo){let c=o?o.previousSibling:n.lastChild;Mf(a.contentDOM,a.children,t),o=c?c.nextSibling:n.firstChild}}for(;o;)o=_f(o),r=!0;r&&t.trackWrites==n&&(t.trackWrites=null)}const Sr=function(n){n&&(this.nodeName=n)};Sr.prototype=Object.create(null);const wo=[new Sr];function Xa(n,e,t){if(n.length==0)return wo;let o=t?wo[0]:new Sr,r=[o];for(let i=0;i<n.length;i++){let a=n[i].type.attrs;if(a){a.nodeName&&r.push(o=new Sr(a.nodeName));for(let l in a){let c=a[l];c!=null&&(t&&r.length==1&&r.push(o=new Sr(e.isInline?"span":"div")),l=="class"?o.class=(o.class?o.class+" ":"")+c:l=="style"?o.style=(o.style?o.style+";":"")+c:l!="nodeName"&&(o[l]=c))}}}return r}function Af(n,e,t,o){if(t==wo&&o==wo)return e;let r=e;for(let i=0;i<o.length;i++){let a=o[i],l=t[i];if(i){let c;l&&l.nodeName==a.nodeName&&r!=n&&(c=r.parentNode)&&c.nodeName.toLowerCase()==a.nodeName||(c=document.createElement(a.nodeName),c.pmIsDeco=!0,c.appendChild(r),l=wo[0]),r=c}w0(r,l||wo[0],a)}return r}function w0(n,e,t){for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&!(o in t)&&n.removeAttribute(o);for(let o in t)o!="class"&&o!="style"&&o!="nodeName"&&t[o]!=e[o]&&n.setAttribute(o,t[o]);if(e.class!=t.class){let o=e.class?e.class.split(" ").filter(Boolean):[],r=t.class?t.class.split(" ").filter(Boolean):[];for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&n.classList.remove(o[i]);for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&n.classList.add(r[i]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=o.exec(e.style);)n.style.removeProperty(r[1])}t.style&&(n.style.cssText+=t.style)}}function If(n,e,t){return Af(n,n,wo,Xa(e,t,n.nodeType!=1))}function _i(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function _f(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class S0{constructor(e,t,o){this.lock=t,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=C0(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let o=e;o<t;o++)this.top.children[o].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,o,r){let i=0,a=this.stack.length>>1,l=Math.min(a,e.length);for(;i<l&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=Ut,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let c=-1,d=this.top.children.length;r<this.preMatch.index&&(d=Math.min(this.index+3,d));for(let u=this.index;u<d;u++){let f=this.top.children[u];if(f.matchesMark(e[a])&&!this.isLocked(f.dom)){c=u;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let u=Eo.create(this.top,e[a],t,o);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,o,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,o))i=this.top.children.indexOf(a,this.index);else for(let l=this.index,c=Math.min(this.top.children.length,l+5);l<c;l++){let d=this.top.children[l];if(d.matchesNode(e,t,o)&&!this.preMatch.matched.has(d)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,o,r,i){let a=this.top.children[r];return a.dirty==fn&&a.dom==a.contentDOM&&(a.dirty=ko),a.update(e,t,o,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let o=e.pmViewDesc;if(o){for(let r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==o)return r}return-1}e=t}}updateNextNode(e,t,o,r,i,a){for(let l=this.index;l<this.top.children.length;l++){let c=this.top.children[l];if(c instanceof Qn){let d=this.preMatch.matched.get(c);if(d!=null&&d!=i)return!1;let u=c.dom,f,p=this.isLocked(u)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=fn&&_i(t,c.outerDeco));if(!p&&c.update(e,t,o,r))return this.destroyBetween(this.index,l),c.dom!=u&&(this.changed=!0),this.index++,!0;if(!p&&(f=this.recreateWrapper(c,e,t,o,r,a)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=ko,f.updateChildren(r,a+1),f.dirty=Ut),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,o,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!_i(o,e.outerDeco)||!r.eq(e.innerDeco))return null;let l=Qn.create(this.top,t,o,r,i,a);if(l.contentDOM){l.children=e.children,e.children=[];for(let c of l.children)c.parent=l}return e.destroy(),l}addNode(e,t,o,r,i){let a=Qn.create(this.top,e,t,o,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,o){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let i=new vf(this.top,e,t,o);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Eo;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Ii)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((pt||lt)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let o=document.createElement(e);e=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),e=="BR"&&(o.className="ProseMirror-trailingBreak");let r=new zf(this.top,[],o,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function C0(n,e){let t=e,o=t.children.length,r=n.childCount,i=new Map,a=[];e:for(;r>0;){let l;for(;;)if(o){let d=t.children[o-1];if(d instanceof Eo)t=d,o=d.children.length;else{l=d,o--;break}}else{if(t==e)break e;o=t.parent.children.indexOf(t),t=t.parent}let c=l.node;if(c){if(c!=n.child(r-1))break;--r,i.set(l,r),a.push(l)}}return{index:r,matched:i,matches:a.reverse()}}function N0(n,e){return n.type.side-e.type.side}function v0(n,e,t,o){let r=e.locals(n),i=0;if(r.length==0){for(let d=0;d<n.childCount;d++){let u=n.child(d);o(u,r,e.forChild(i,u),d),i+=u.nodeSize}return}let a=0,l=[],c=null;for(let d=0;;){let u,f;for(;a<r.length&&r[a].to==i;){let y=r[a++];y.widget&&(u?(f||(f=[u])).push(y):u=y)}if(u)if(f){f.sort(N0);for(let y=0;y<f.length;y++)t(f[y],d,!!c)}else t(u,d,!!c);let p,h;if(c)h=-1,p=c,c=null;else if(d<n.childCount)h=d,p=n.child(d++);else break;for(let y=0;y<l.length;y++)l[y].to<=i&&l.splice(y--,1);for(;a<r.length&&r[a].from<=i&&r[a].to>i;)l.push(r[a++]);let m=i+p.nodeSize;if(p.isText){let y=m;a<r.length&&r[a].from<y&&(y=r[a].from);for(let b=0;b<l.length;b++)l[b].to<y&&(y=l[b].to);y<m&&(c=p.cut(y-i),p=p.cut(0,y-i),m=y,h=-1)}else for(;a<r.length&&r[a].to<m;)a++;let g=p.isInline&&!p.isLeaf?l.filter(y=>!y.inline):l.slice();o(p,g,e.forChild(i,p),h),i=m}}function T0(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function z0(n,e,t,o){for(let r=0,i=0;r<n.childCount&&i<=o;){let a=n.child(r++),l=i;if(i+=a.nodeSize,!a.isText)continue;let c=a.text;for(;r<n.childCount;){let d=n.child(r++);if(i+=d.nodeSize,!d.isText)break;c+=d.text}if(i>=t){if(i>=o&&c.slice(o-e.length-l,o-l)==e)return o-e.length;let d=l<o?c.lastIndexOf(e,o-l-1):-1;if(d>=0&&d+e.length+l>=t)return l+d;if(t==o&&c.length>=o+e.length-l&&c.slice(o-l,o-l+e.length)==e)return o}}return-1}function Ya(n,e,t,o,r){let i=[];for(let a=0,l=0;a<n.length;a++){let c=n[a],d=l,u=l+=c.size;d>=t||u<=e?i.push(c):(d<e&&i.push(c.slice(0,e-d,o)),r&&(i.push(r),r=void 0),u>t&&i.push(c.slice(t-d,c.size,o)))}return i}function Qa(n,e=null){let t=n.domSelectionRange(),o=n.state.doc;if(!t.focusNode)return null;let r=n.docView.nearestDesc(t.focusNode),i=r&&r.size==0,a=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(a<0)return null;let l=o.resolve(a),c,d;if(Ai(t)){for(c=a;r&&!r.node;)r=r.parent;let f=r.node;if(r&&f.isAtom&&Ce.isSelectable(f)&&r.parent&&!(f.isInline&&t0(t.focusNode,t.focusOffset,r.dom))){let p=r.posBefore;d=new Ce(a==p?l:o.resolve(p))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=a,p=a;for(let h=0;h<t.rangeCount;h++){let m=t.getRangeAt(h);f=Math.min(f,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),p=Math.max(p,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[c,a]=p==n.state.selection.anchor?[p,f]:[f,p],l=o.resolve(a)}else c=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(c<0)return null}let u=o.resolve(c);if(!d){let f=e=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;d=el(n,u,l,f)}return d}function Of(n){return n.editable?n.hasFocus():Bf(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Tn(n,e=!1){let t=n.state.selection;if(Lf(n,t),!!Of(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&<){let o=n.domSelectionRange(),r=n.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&bo(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)A0(n);else{let{anchor:o,head:r}=t,i,a;Df&&!(t instanceof Ie)&&(t.$from.parent.inlineContent||(i=Pf(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(a=Pf(n,t.to))),n.docView.setSelection(o,r,n,e),Df&&(i&&Rf(i),a&&Rf(a)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&M0(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Df=pt||lt&&ff<63;function Pf(n,e){let{node:t,offset:o}=n.docView.domFromPos(e,0),r=o<t.childNodes.length?t.childNodes[o]:null,i=o?t.childNodes[o-1]:null;if(pt&&r&&r.contentEditable=="false")return Za(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return Za(r);if(i)return Za(i)}}function Za(n){return n.contentEditable="true",pt&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Rf(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function M0(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),o=t.anchorNode,r=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=o||t.anchorOffset!=r)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Of(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function A0(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,o=t.nodeName=="IMG";o?e.collapse(t.parentNode,ft(t)+1):e.collapse(t,0),!o&&!n.state.selection.visible&&It&&Xn<=11&&(t.disabled=!0,t.disabled=!1)}function Lf(n,e){if(e instanceof Ce){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&($f(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else $f(n)}function $f(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function el(n,e,t,o){return n.someProp("createSelectionBetween",r=>r(n,e,t))||Ie.between(e,t,o)}function Vf(n){return n.editable&&!n.hasFocus()?!1:Bf(n)}function Bf(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function I0(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return bo(e.node,e.offset,t.anchorNode,t.anchorOffset)}function tl(n,e){let{$anchor:t,$head:o}=n.selection,r=e>0?t.max(o):t.min(o),i=r.parent.inlineContent?r.depth?n.doc.resolve(e>0?r.after():r.before()):null:r;return i&&Pe.findFrom(i,e)}function Zn(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Ff(n,e,t){let o=n.state.selection;if(o instanceof Ie)if(t.indexOf("s")>-1){let{$head:r}=o,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=n.state.doc.resolve(r.pos+i.nodeSize*(e<0?-1:1));return Zn(n,new Ie(o.$anchor,a))}else if(o.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let r=tl(n.state,e);return r&&r instanceof Ce?Zn(n,r):!1}else if(!(Ht&&t.indexOf("m")>-1)){let r=o.$head,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,a;if(!i||i.isText)return!1;let l=e<0?r.pos-i.nodeSize:r.pos;return i.isAtom||(a=n.docView.descAt(l))&&!a.contentDOM?Ce.isSelectable(i)?Zn(n,new Ce(e<0?n.state.doc.resolve(r.pos-i.nodeSize):r)):kr?Zn(n,new Ie(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof Ce&&o.node.isInline)return Zn(n,new Ie(e>0?o.$to:o.$from));{let r=tl(n.state,e);return r?Zn(n,r):!1}}}function Oi(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Cr(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Ho(n,e){return e<0?_0(n):O0(n)}function _0(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r,i,a=!1;for(jt&&t.nodeType==1&&o<Oi(t)&&Cr(t.childNodes[o],-1)&&(a=!0);;)if(o>0){if(t.nodeType!=1)break;{let l=t.childNodes[o-1];if(Cr(l,-1))r=t,i=--o;else if(l.nodeType==3)t=l,o=t.nodeValue.length;else break}}else{if(jf(t))break;{let l=t.previousSibling;for(;l&&Cr(l,-1);)r=t.parentNode,i=ft(l),l=l.previousSibling;if(l)t=l,o=Oi(t);else{if(t=t.parentNode,t==n.dom)break;o=0}}}a?nl(n,t,o):r&&nl(n,r,i)}function O0(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r=Oi(t),i,a;for(;;)if(o<r){if(t.nodeType!=1)break;let l=t.childNodes[o];if(Cr(l,1))i=t,a=++o;else break}else{if(jf(t))break;{let l=t.nextSibling;for(;l&&Cr(l,1);)i=l.parentNode,a=ft(l)+1,l=l.nextSibling;if(l)t=l,o=0,r=Oi(t);else{if(t=t.parentNode,t==n.dom)break;o=r=0}}}i&&nl(n,i,a)}function jf(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function D0(n,e){for(;n&&e==n.childNodes.length&&!xr(n);)e=ft(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function P0(n,e){for(;n&&!e&&!xr(n);)e=ft(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function nl(n,e,t){if(e.nodeType!=3){let i,a;(a=D0(e,t))?(e=a,t=0):(i=P0(e,t))&&(e=i,t=i.nodeValue.length)}let o=n.domSelection();if(!o)return;if(Ai(o)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),o.removeAllRanges(),o.addRange(i)}else o.extend&&o.extend(e,t);n.domObserver.setCurSelection();let{state:r}=n;setTimeout(()=>{n.state==r&&Tn(n)},50)}function Hf(n,e){let t=n.state.doc.resolve(e);if(!(lt||pf)&&t.parent.inlineContent){let r=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),a=(i.top+i.bottom)/2;if(a>r.top&&a<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(e<t.end()){let i=n.coordsAtPos(e+1),a=(i.top+i.bottom)/2;if(a>r.top&&a<r.bottom&&Math.abs(i.left-r.left)>1)return i.left>r.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Uf(n,e,t){let o=n.state.selection;if(o instanceof Ie&&!o.empty||t.indexOf("s")>-1||Ht&&t.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let a=tl(n.state,e);if(a&&a instanceof Ce)return Zn(n,a)}if(!r.parent.inlineContent){let a=e<0?r:i,l=o instanceof Rt?Pe.near(a,e):Pe.findFrom(a,e);return l?Zn(n,l):!1}return!1}function Wf(n,e){if(!(n.state.selection instanceof Ie))return!0;let{$head:t,$anchor:o,empty:r}=n.state.selection;if(!t.sameParent(o))return!0;if(!r)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let a=n.state.tr;return e<0?a.delete(t.pos-i.nodeSize,t.pos):a.delete(t.pos,t.pos+i.nodeSize),n.dispatch(a),!0}return!1}function qf(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function R0(n){if(!pt||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let o=e.firstChild;qf(n,o,"true"),setTimeout(()=>qf(n,o,"false"),20)}return!1}function L0(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function $0(n,e){let t=e.keyCode,o=L0(e);if(t==8||Ht&&t==72&&o=="c")return Wf(n,-1)||Ho(n,-1);if(t==46&&!e.shiftKey||Ht&&t==68&&o=="c")return Wf(n,1)||Ho(n,1);if(t==13||t==27)return!0;if(t==37||Ht&&t==66&&o=="c"){let r=t==37?Hf(n,n.state.selection.from)=="ltr"?-1:1:-1;return Ff(n,r,o)||Ho(n,r)}else if(t==39||Ht&&t==70&&o=="c"){let r=t==39?Hf(n,n.state.selection.from)=="ltr"?1:-1:1;return Ff(n,r,o)||Ho(n,r)}else{if(t==38||Ht&&t==80&&o=="c")return Uf(n,-1,o)||Ho(n,-1);if(t==40||Ht&&t==78&&o=="c")return R0(n)||Uf(n,1,o)||Ho(n,1);if(o==(Ht?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function ol(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:o,openStart:r,openEnd:i}=e;for(;r>1&&i>1&&o.childCount==1&&o.firstChild.childCount==1;){r--,i--;let h=o.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),o=h.content}let a=n.someProp("clipboardSerializer")||go.fromSchema(n.state.schema),l=ep(),c=l.createElement("div");c.appendChild(a.serializeFragment(o,{document:l}));let d=c.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=Qf[d.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=l.createElement(u[h]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),f++}d=c.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${r} ${i}${f?` -${f}`:""} ${JSON.stringify(t)}`);let p=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
|
|
351
|
+
|
|
352
|
+
`);return{dom:c,text:p,slice:e}}function Gf(n,e,t,o,r){let i=r.parent.type.spec.code,a,l;if(!t&&!e)return null;let c=!!e&&(o||i||!t);if(c){if(n.someProp("transformPastedText",p=>{e=p(e,i||o,n)}),i)return l=new fe(re.from(n.state.schema.text(e.replace(/\r\n?/g,`
|
|
353
|
+
`))),0,0),n.someProp("transformPasted",p=>{l=p(l,n,!0)}),l;let f=n.someProp("clipboardTextParser",p=>p(e,r,o,n));if(f)l=f;else{let p=r.marks(),{schema:h}=n.state,m=go.fromSchema(h);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=a.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(h.text(g,p)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),a=j0(t),kr&&H0(a);let d=a&&a.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let p=a.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;a=p}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||fr.fromSchema(n.state.schema)).parseSlice(a,{preserveWhitespace:!!(c||u),context:r,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!V0.test(p.parentNode.nodeName)?{ignore:!0}:null}})),u)l=U0(Yf(l,+u[1],+u[2]),u[4]);else if(l=fe.maxOpen(B0(l.content,r),!0),l.openStart||l.openEnd){let f=0,p=0;for(let h=l.content.firstChild;f<l.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=l.content.lastChild;p<l.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);l=Yf(l,f,p)}return n.someProp("transformPasted",f=>{l=f(l,n,c)}),l}const V0=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function B0(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.index(t)),i,a=[];if(n.forEach(l=>{if(!a)return;let c=r.findWrapping(l.type),d;if(!c)return a=null;if(d=a.length&&i.length&&Jf(c,i,l,a[a.length-1],0))a[a.length-1]=d;else{a.length&&(a[a.length-1]=Xf(a[a.length-1],i.length));let u=Kf(l,c);a.push(u),r=r.matchType(u.type),i=c}}),a)return re.from(a)}return n}function Kf(n,e,t=0){for(let o=e.length-1;o>=t;o--)n=e[o].create(null,re.from(n));return n}function Jf(n,e,t,o,r){if(r<n.length&&r<e.length&&n[r]==e[r]){let i=Jf(n,e,t,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==n.length-1?t.type:n[r+1]))return o.copy(o.content.append(re.from(Kf(t,n,r+1))))}}function Xf(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Xf(n.lastChild,e-1)),o=n.contentMatchAt(n.childCount).fillBefore(re.empty,!0);return n.copy(t.append(o))}function rl(n,e,t,o,r,i){let a=e<0?n.firstChild:n.lastChild,l=a.content;return n.childCount>1&&(i=0),r<o-1&&(l=rl(l,e,t,o,r+1,i)),r>=t&&(l=e<0?a.contentMatchAt(0).fillBefore(l,i<=r).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(re.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,a.copy(l))}function Yf(n,e,t){return e<n.openStart&&(n=new fe(rl(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new fe(rl(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Qf={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Zf=null;function ep(){return Zf||(Zf=document.implementation.createHTMLDocument("title"))}let il=null;function F0(n){let e=window.trustedTypes;return e?(il||(il=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),il.createHTML(n)):n}function j0(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=ep().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(n),r;if((r=o&&Qf[o[1].toLowerCase()])&&(n=r.map(i=>"<"+i+">").join("")+n+r.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=F0(n),r)for(let i=0;i<r.length;i++)t=t.querySelector(r[i])||t;return t}function H0(n){let e=n.querySelectorAll(lt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let o=e[t];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),o)}}function U0(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return n}let{content:r,openStart:i,openEnd:a}=n;for(let l=o.length-2;l>=0;l-=2){let c=t.nodes[o[l]];if(!c||c.hasRequiredAttrs())break;r=re.from(c.create(o[l+1],r)),i++,a++}return new fe(r,i,a)}const Nt={},vt={},W0={touchstart:!0,touchmove:!0};class q0{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function G0(n){for(let e in Nt){let t=Nt[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=o=>{J0(n,o)&&!al(n,o)&&(n.editable||!(o.type in vt))&&t(n,o)},W0[e]?{passive:!0}:void 0)}pt&&n.dom.addEventListener("input",()=>null),sl(n)}function eo(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function K0(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function sl(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=o=>al(n,o))})}function al(n,e){return n.someProp("handleDOMEvents",t=>{let o=t[e.type];return o?o(n,e)||e.defaultPrevented:!1})}function J0(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function X0(n,e){!al(n,e)&&Nt[e.type]&&(n.editable||!(e.type in vt))&&Nt[e.type](n,e)}vt.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!np(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Nn&<&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Fo&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let o=Date.now();n.input.lastIOSEnter=o,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==o&&(n.someProp("handleKeyDown",r=>r(n,xo(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",o=>o(n,t))||$0(n,t)?t.preventDefault():eo(n,"key")},vt.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},vt.keypress=(n,e)=>{let t=e;if(np(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ht&&t.metaKey)return;if(n.someProp("handleKeyPress",r=>r(n,t))){t.preventDefault();return}let o=n.state.selection;if(!(o instanceof Ie)||!o.$from.sameParent(o.$to)){let r=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!n.someProp("handleTextInput",a=>a(n,o.$from.pos,o.$to.pos,r,i))&&n.dispatch(i()),t.preventDefault()}};function Di(n){return{left:n.clientX,top:n.clientY}}function Y0(n,e){let t=e.x-n.clientX,o=e.y-n.clientY;return t*t+o*o<100}function ll(n,e,t,o,r){if(o==-1)return!1;let i=n.state.doc.resolve(o);for(let a=i.depth+1;a>0;a--)if(n.someProp(e,l=>a>i.depth?l(n,t,i.nodeAfter,i.before(a),r,!0):l(n,t,i.node(a),i.before(a),r,!1)))return!0;return!1}function Uo(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let o=n.state.tr.setSelection(e);o.setMeta("pointer",!0),n.dispatch(o)}function Q0(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),o=t.nodeAfter;return o&&o.isAtom&&Ce.isSelectable(o)?(Uo(n,new Ce(t)),!0):!1}function Z0(n,e){if(e==-1)return!1;let t=n.state.selection,o,r;t instanceof Ce&&(o=t.node);let i=n.state.doc.resolve(e);for(let a=i.depth+1;a>0;a--){let l=a>i.depth?i.nodeAfter:i.node(a);if(Ce.isSelectable(l)){o&&t.$from.depth>0&&a>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?r=i.before(t.$from.depth):r=i.before(a);break}}return r!=null?(Uo(n,Ce.create(n.state.doc,r)),!0):!1}function ex(n,e,t,o,r){return ll(n,"handleClickOn",e,t,o)||n.someProp("handleClick",i=>i(n,e,o))||(r?Z0(n,t):Q0(n,t))}function tx(n,e,t,o){return ll(n,"handleDoubleClickOn",e,t,o)||n.someProp("handleDoubleClick",r=>r(n,e,o))}function nx(n,e,t,o){return ll(n,"handleTripleClickOn",e,t,o)||n.someProp("handleTripleClick",r=>r(n,e,o))||ox(n,t,o)}function ox(n,e,t){if(t.button!=0)return!1;let o=n.state.doc;if(e==-1)return o.inlineContent?(Uo(n,Ie.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let i=r.depth+1;i>0;i--){let a=i>r.depth?r.nodeAfter:r.node(i),l=r.before(i);if(a.inlineContent)Uo(n,Ie.create(o,l+1,l+1+a.content.size));else if(Ce.isSelectable(a))Uo(n,Ce.create(o,l));else continue;return!0}}function cl(n){return Pi(n)}const tp=Ht?"metaKey":"ctrlKey";Nt.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let o=cl(n),r=Date.now(),i="singleClick";r-n.input.lastClick.time<500&&Y0(t,n.input.lastClick)&&!t[tp]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:r,x:t.clientX,y:t.clientY,type:i,button:t.button};let a=n.posAtCoords(Di(t));a&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new rx(n,a,t,!!o)):(i=="doubleClick"?tx:nx)(n,a.pos,a.inside,t)?t.preventDefault():eo(n,"pointer"))};class rx{constructor(e,t,o,r){this.view=e,this.pos=t,this.event=o,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[tp],this.allowDefault=o.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let u=e.state.doc.resolve(t.pos);i=u.parent,a=u.depth?u.before():0}const l=r?null:o.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:d}=e.state;(o.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||d instanceof Ce&&d.from<=a&&d.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&jt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),eo(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Tn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Di(e))),this.updateAllowDefault(e),this.allowDefault||!t?eo(this.view,"pointer"):ex(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||pt&&this.mightDrag&&!this.mightDrag.node.isAtom||lt&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Uo(this.view,Pe.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):eo(this.view,"pointer")}move(e){this.updateAllowDefault(e),eo(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Nt.touchstart=n=>{n.input.lastTouch=Date.now(),cl(n),eo(n,"pointer")},Nt.touchmove=n=>{n.input.lastTouch=Date.now(),eo(n,"pointer")},Nt.contextmenu=n=>cl(n);function np(n,e){return n.composing?!0:pt&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const ix=Nn?5e3:-1;vt.compositionstart=vt.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof Ie&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)||lt&&pf&&sx(n)))n.markCursor=n.state.storedMarks||t.marks(),Pi(n,!0),n.markCursor=null;else if(Pi(n,!e.selection.empty),jt&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let o=n.domSelectionRange();for(let r=o.focusNode,i=o.focusOffset;r&&r.nodeType==1&&i!=0;){let a=i<0?r.lastChild:r.childNodes[i-1];if(!a)break;if(a.nodeType==3){let l=n.domSelection();l&&l.collapse(a,a.nodeValue.length);break}else r=a,i=-1}}n.input.composing=!0}op(n,ix)};function sx(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let o=e.childNodes[t];return o.nodeType==1&&o.contentEditable=="false"}vt.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,op(n,20))};function op(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Pi(n),e))}function rp(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=lx());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function ax(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Z1(e.focusNode,e.focusOffset),o=e0(e.focusNode,e.focusOffset);if(t&&o&&t!=o){let r=o.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||o==i)return i;if(!r||!r.isText(o.nodeValue))return o;if(n.input.compositionNode==o){let a=t.pmViewDesc;if(!(!a||!a.isText(t.nodeValue)))return o}}return t||o}function lx(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Pi(n,e=!1){if(!(Nn&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),rp(n),e||n.docView&&n.docView.dirty){let t=Qa(n),o=n.state.selection;return t&&!t.eq(o)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!o.$from.node(o.$from.sharedDepth(o.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function cx(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),r=document.createRange();r.selectNodeContents(e),n.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Nr=It&&Xn<15||Fo&&r0<604;Nt.copy=vt.cut=(n,e)=>{let t=e,o=n.state.selection,r=t.type=="cut";if(o.empty)return;let i=Nr?null:t.clipboardData,a=o.content(),{dom:l,text:c}=ol(n,a);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",c)):cx(n,l),r&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function dx(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function ux(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,o=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),o.parentNode&&o.parentNode.removeChild(o),t?vr(n,o.value,null,r,e):vr(n,o.textContent,o.innerHTML,r,e)},50)}function vr(n,e,t,o,r){let i=Gf(n,e,t,o,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,r,i||fe.empty)))return!0;if(!i)return!1;let a=dx(i),l=a?n.state.tr.replaceSelectionWith(a,o):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ip(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}vt.paste=(n,e)=>{let t=e;if(n.composing&&!Nn)return;let o=Nr?null:t.clipboardData,r=n.input.shiftKey&&n.input.lastKeyCode!=45;o&&vr(n,ip(o),o.getData("text/html"),r,t)?t.preventDefault():ux(n,t)};class sp{constructor(e,t,o){this.slice=e,this.move=t,this.node=o}}const fx=Ht?"altKey":"ctrlKey";function ap(n,e){let t=n.someProp("dragCopies",o=>!o(e));return t??!e[fx]}Nt.dragstart=(n,e)=>{let t=e,o=n.input.mouseDown;if(o&&o.done(),!t.dataTransfer)return;let r=n.state.selection,i=r.empty?null:n.posAtCoords(Di(t)),a;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof Ce?r.to-1:r.to))){if(o&&o.mightDrag)a=Ce.create(n.state.doc,o.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(a=Ce.create(n.state.doc,f.posBefore))}}let l=(a||n.state.selection).content(),{dom:c,text:d,slice:u}=ol(n,l);(!t.dataTransfer.files.length||!lt||ff>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Nr?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",Nr||t.dataTransfer.setData("text/plain",d),n.dragging=new sp(u,ap(n,t),a)},Nt.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},vt.dragover=vt.dragenter=(n,e)=>e.preventDefault(),vt.drop=(n,e)=>{try{px(n,e,n.dragging)}finally{n.dragging=null}};function px(n,e,t){if(!e.dataTransfer)return;let o=n.posAtCoords(Di(e));if(!o)return;let r=n.state.doc.resolve(o.pos),i=t&&t.slice;i?n.someProp("transformPasted",h=>{i=h(i,n,!1)}):i=Gf(n,ip(e.dataTransfer),Nr?null:e.dataTransfer.getData("text/html"),!1,r);let a=!!(t&&ap(n,e));if(n.someProp("handleDrop",h=>h(n,e,i||fe.empty,a))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?k1(n.state.doc,r.pos,i):r.pos;l==null&&(l=r.pos);let c=n.state.tr;if(a){let{node:h}=t;h?h.replace(c):c.deleteSelection()}let d=c.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=c.doc;if(u?c.replaceRangeWith(d,d,i.content.firstChild):c.replaceRange(d,d,i),c.doc.eq(f))return;let p=c.doc.resolve(d);if(u&&Ce.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new Ce(p));else{let h=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,b)=>h=b),c.setSelection(el(n,p,c.doc.resolve(h)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))}Nt.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Tn(n)},20))},Nt.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},Nt.beforeinput=(n,e)=>{if(lt&&Nn&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:o}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=o||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,xo(8,"Backspace")))))return;let{$cursor:r}=n.state.selection;r&&r.pos>0&&n.dispatch(n.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let n in vt)Nt[n]=vt[n];function Tr(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Ri{constructor(e,t){this.toDOM=e,this.spec=t||So,this.side=this.spec.side||0}map(e,t,o,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new sn(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof Ri&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Tr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class to{constructor(e,t){this.attrs=e,this.spec=t||So}map(e,t,o,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-o,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-o;return i>=a?null:new sn(i,a,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof to&&Tr(this.attrs,e.attrs)&&Tr(this.spec,e.spec)}static is(e){return e.type instanceof to}destroy(){}}class dl{constructor(e,t){this.attrs=e,this.spec=t||So}map(e,t,o,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new sn(i.pos-o,a.pos-o,this)}valid(e,t){let{index:o,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(o)).isText&&r+i.nodeSize==t.to}eq(e){return this==e||e instanceof dl&&Tr(this.attrs,e.attrs)&&Tr(this.spec,e.spec)}destroy(){}}class sn{constructor(e,t,o){this.from=e,this.to=t,this.type=o}copy(e,t){return new sn(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,o){return this.type.map(e,this,t,o)}static widget(e,t,o){return new sn(e,e,new Ri(t,o))}static inline(e,t,o,r){return new sn(e,t,new to(o,r))}static node(e,t,o,r){return new sn(e,t,new dl(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof to}get widget(){return this.type instanceof Ri}}const Wo=[],So={};class ct{constructor(e,t){this.local=e.length?e:Wo,this.children=t.length?t:Wo}static create(e,t){return t.length?Li(t,e,0,So):yt}find(e,t,o){let r=[];return this.findInner(e??0,t??1e9,r,0,o),r}findInner(e,t,o,r,i){for(let a=0;a<this.local.length;a++){let l=this.local[a];l.from<=t&&l.to>=e&&(!i||i(l.spec))&&o.push(l.copy(l.from+r,l.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let l=this.children[a]+1;this.children[a+2].findInner(e-l,t-l,o,r+l,i)}}map(e,t,o){return this==yt||e.maps.length==0?this:this.mapInner(e,t,0,0,o||So)}mapInner(e,t,o,r,i){let a;for(let l=0;l<this.local.length;l++){let c=this.local[l].map(e,o,r);c&&c.type.valid(t,c)?(a||(a=[])).push(c):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?hx(this.children,a||[],e,t,o,r,i):a?new ct(a.sort(Co),Wo):yt}add(e,t){return t.length?this==yt?ct.create(e,t):this.addInner(e,t,0):this}addInner(e,t,o){let r,i=0;e.forEach((l,c)=>{let d=c+o,u;if(u=cp(t,l,d)){for(r||(r=this.children.slice());i<r.length&&r[i]<c;)i+=3;r[i]==c?r[i+2]=r[i+2].addInner(l,u,d+1):r.splice(i,0,c,c+l.nodeSize,Li(u,l,d+1,So)),i+=3}});let a=lp(i?dp(t):t,-o);for(let l=0;l<a.length;l++)a[l].type.valid(e,a[l])||a.splice(l--,1);return new ct(a.length?this.local.concat(a).sort(Co):this.local,r||this.children)}remove(e){return e.length==0||this==yt?this:this.removeInner(e,0)}removeInner(e,t){let o=this.children,r=this.local;for(let i=0;i<o.length;i+=3){let a,l=o[i]+t,c=o[i+1]+t;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>l&&f.to<c&&(e[u]=null,(a||(a=[])).push(f));if(!a)continue;o==this.children&&(o=this.children.slice());let d=o[i+2].removeInner(a,l+1);d!=yt?o[i+2]=d:(o.splice(i,3),i-=3)}if(r.length){for(let i=0,a;i<e.length;i++)if(a=e[i])for(let l=0;l<r.length;l++)r[l].eq(a,t)&&(r==this.local&&(r=this.local.slice()),r.splice(l--,1))}return o==this.children&&r==this.local?this:r.length||o.length?new ct(r,o):yt}forChild(e,t){if(this==yt)return this;if(t.isLeaf)return ct.empty;let o,r;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(o=this.children[l+2]);break}let i=e+1,a=i+t.content.size;for(let l=0;l<this.local.length;l++){let c=this.local[l];if(c.from<a&&c.to>i&&c.type instanceof to){let d=Math.max(i,c.from)-i,u=Math.min(a,c.to)-i;d<u&&(r||(r=[])).push(c.copy(d,u))}}if(r){let l=new ct(r.sort(Co),Wo);return o?new no([l,o]):l}return o||yt}eq(e){if(this==e)return!0;if(!(e instanceof ct)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return ul(this.localsInner(e))}localsInner(e){if(this==yt)return Wo;if(e.inlineContent||!this.local.some(to.is))return this.local;let t=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof to||t.push(this.local[o]);return t}forEachSet(e){e(this)}}ct.empty=new ct([],[]),ct.removeOverlap=ul;const yt=ct.empty;class no{constructor(e){this.members=e}map(e,t){const o=this.members.map(r=>r.map(e,t,So));return no.from(o)}forChild(e,t){if(t.isLeaf)return ct.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=yt&&(i instanceof no?o=o.concat(i.members):o.push(i))}return no.from(o)}eq(e){if(!(e instanceof no)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,o=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{o&&(t=t.slice(),o=!1);for(let a=0;a<i.length;a++)t.push(i[a])}}return t?ul(o?t:t.sort(Co)):Wo}static from(e){switch(e.length){case 0:return yt;case 1:return e[0];default:return new no(e.every(t=>t instanceof ct)?e:e.reduce((t,o)=>t.concat(o instanceof ct?o:o.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function hx(n,e,t,o,r,i,a){let l=n.slice();for(let d=0,u=i;d<t.maps.length;d++){let f=0;t.maps[d].forEach((p,h,m,g)=>{let y=g-m-(h-p);for(let b=0;b<l.length;b+=3){let z=l[b+1];if(z<0||p>z+u-f)continue;let w=l[b]+u-f;h>=w?l[b+1]=p<=w?-2:-1:p>=u&&y&&(l[b]+=y,l[b+1]+=y)}f+=y}),u=t.maps[d].map(u,-1)}let c=!1;for(let d=0;d<l.length;d+=3)if(l[d+1]<0){if(l[d+1]==-2){c=!0,l[d+1]=-1;continue}let u=t.map(n[d]+i),f=u-r;if(f<0||f>=o.content.size){c=!0;continue}let p=t.map(n[d+1]+i,-1),h=p-r,{index:m,offset:g}=o.content.findIndex(f),y=o.maybeChild(m);if(y&&g==f&&g+y.nodeSize==h){let b=l[d+2].mapInner(t,y,u+1,n[d]+i+1,a);b!=yt?(l[d]=f,l[d+1]=h,l[d+2]=b):(l[d+1]=-2,c=!0)}else c=!0}if(c){let d=mx(l,n,e,t,r,i,a),u=Li(d,o,0,a);e=u.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,p=0;f<u.children.length;f+=3){let h=u.children[f];for(;p<l.length&&l[p]<h;)p+=3;l.splice(p,0,u.children[f],u.children[f+1],u.children[f+2])}}return new ct(e.sort(Co),l)}function lp(n,e){if(!e||!n.length)return n;let t=[];for(let o=0;o<n.length;o++){let r=n[o];t.push(new sn(r.from+e,r.to+e,r.type))}return t}function mx(n,e,t,o,r,i,a){function l(c,d){for(let u=0;u<c.local.length;u++){let f=c.local[u].map(o,r,d);f?t.push(f):a.onRemove&&a.onRemove(c.local[u].spec)}for(let u=0;u<c.children.length;u+=3)l(c.children[u+2],c.children[u]+d+1)}for(let c=0;c<n.length;c+=3)n[c+1]==-1&&l(n[c+2],e[c]+i+1);return t}function cp(n,e,t){if(e.isLeaf)return null;let o=t+e.nodeSize,r=null;for(let i=0,a;i<n.length;i++)(a=n[i])&&a.from>t&&a.to<o&&((r||(r=[])).push(a),n[i]=null);return r}function dp(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Li(n,e,t,o){let r=[],i=!1;e.forEach((l,c)=>{let d=cp(n,l,c+t);if(d){i=!0;let u=Li(d,l,t+c+1,o);u!=yt&&r.push(c,c+l.nodeSize,u)}});let a=lp(i?dp(n):n,-t).sort(Co);for(let l=0;l<a.length;l++)a[l].type.valid(e,a[l])||(o.onRemove&&o.onRemove(a[l].spec),a.splice(l--,1));return a.length||r.length?new ct(a,r):yt}function Co(n,e){return n.from-e.from||n.to-e.to}function ul(n){let e=n;for(let t=0;t<e.length-1;t++){let o=e[t];if(o.from!=o.to)for(let r=t+1;r<e.length;r++){let i=e[r];if(i.from==o.from){i.to!=o.to&&(e==n&&(e=n.slice()),e[r]=i.copy(i.from,o.to),up(e,r+1,i.copy(o.to,i.to)));continue}else{i.from<o.to&&(e==n&&(e=n.slice()),e[t]=o.copy(o.from,i.from),up(e,r,o.copy(i.from,o.to)));break}}}return e}function up(n,e,t){for(;e<n.length&&Co(t,n[e])>0;)e++;n.splice(e,0,t)}function fl(n){let e=[];return n.someProp("decorations",t=>{let o=t(n.state);o&&o!=yt&&e.push(o)}),n.cursorWrapper&&e.push(ct.create(n.state.doc,[n.cursorWrapper.deco])),no.from(e)}const gx={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},yx=It&&Xn<=11;class bx{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class xx{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new bx,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let r=0;r<o.length;r++)this.queue.push(o[r]);It&&Xn<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():pt&&e.composing&&o.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),yx&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,gx)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Vf(this.view)){if(this.suppressingSelectionUpdates)return Tn(this.view);if(It&&Xn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&bo(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,o;for(let i=e.focusNode;i;i=Bo(i))t.add(i);for(let i=e.anchorNode;i;i=Bo(i))if(t.has(i)){o=i;break}let r=o&&this.view.docView.nearestDesc(o);if(r&&r.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let o=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&Vf(e)&&!this.ignoreSelectionChange(o),i=-1,a=-1,l=!1,c=[];if(e.editable)for(let u=0;u<t.length;u++){let f=this.registerMutation(t[u],c);f&&(i=i<0?f.from:Math.min(f.from,i),a=a<0?f.to:Math.max(f.to,a),f.typeOver&&(l=!0))}if(jt&&c.length){let u=c.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,p]=u;f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let p of u){let h=p.parentNode;h&&h.nodeName=="LI"&&(!f||wx(e,f)!=h)&&p.remove()}}}else if((lt||pt)&&c.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of c)if(u.nodeName=="BR"&&u.parentNode){let f=u.nextSibling;f&&f.nodeType==1&&f.contentEditable=="false"&&u.parentNode.removeChild(u)}}let d=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ai(o)&&(d=Qa(e))&&d.eq(Pe.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Tn(e),this.currentSelection.set(o),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),kx(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Sx(e,c)),this.handleDOMChange(i,a,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||Tn(e),this.currentSelection.set(o))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let f=e.addedNodes[u];t.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let r=e.previousSibling,i=e.nextSibling;if(It&&Xn<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:f,nextSibling:p}=e.addedNodes[u];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(r=f),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(i=p)}let a=r&&r.parentNode==e.target?ft(r)+1:0,l=o.localPosFromDOM(e.target,a,-1),c=i&&i.parentNode==e.target?ft(i):e.target.childNodes.length,d=o.localPosFromDOM(e.target,c,1);return{from:l,to:d}}else return e.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let fp=new WeakMap,pp=!1;function kx(n){if(!fp.has(n)&&(fp.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=jt,pp)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),pp=!0}}function hp(n,e){let t=e.startContainer,o=e.startOffset,r=e.endContainer,i=e.endOffset,a=n.domAtPos(n.state.selection.anchor);return bo(a.node,a.offset,r,i)&&([t,o,r,i]=[r,i,t,o]),{anchorNode:t,anchorOffset:o,focusNode:r,focusOffset:i}}function Ex(n,e){if(e.getComposedRanges){let r=e.getComposedRanges(n.root)[0];if(r)return hp(n,r)}let t;function o(r){r.preventDefault(),r.stopImmediatePropagation(),t=r.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",o,!0),t?hp(n,t):null}function wx(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let o=n.docView.nearestDesc(t,!0);if(o&&o.node.isBlock)return t}return null}function Sx(n,e){var t;let{focusNode:o,focusOffset:r}=n.domSelectionRange();for(let i of e)if(((t=i.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let a=i.nextSibling;for(;a&&a.nodeName!="TD"&&a.nodeName!="TH";)a=a.nextSibling;if(a){let l=a;for(;;){let c=l.firstChild;if(!c||c.nodeType!=1||c.contentEditable=="false"||/^(BR|IMG)$/.test(c.nodeName))break;l=c}l.insertBefore(i,l.firstChild),o==i&&n.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function Cx(n,e,t){let{node:o,fromOffset:r,toOffset:i,from:a,to:l}=n.docView.parseRange(e,t),c=n.domSelectionRange(),d,u=c.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],Ai(c)||d.push({node:c.focusNode,offset:c.focusOffset})),lt&&n.input.lastKeyCode===8)for(let y=i;y>r;y--){let b=o.childNodes[y-1],z=b.pmViewDesc;if(b.nodeName=="BR"&&!z){i=y;break}if(!z||z.size)break}let f=n.state.doc,p=n.someProp("domParser")||fr.fromSchema(n.state.schema),h=f.resolve(a),m=null,g=p.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:r,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:Nx,context:h});if(d&&d[0].pos!=null){let y=d[0].pos,b=d[1]&&d[1].pos;b==null&&(b=y),m={anchor:y+a,head:b+a}}return{doc:g,sel:m,from:a,to:l}}function Nx(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(pt&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||pt&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const vx=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Tx(n,e,t,o,r){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let k=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,E=Qa(n,k);if(E&&!n.state.selection.eq(E)){if(lt&&Nn&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",B=>B(n,xo(13,"Enter"))))return;let x=n.state.tr.setSelection(E);k=="pointer"?x.setMeta("pointer",!0):k=="key"&&x.scrollIntoView(),i&&x.setMeta("composition",i),n.dispatch(x)}return}let a=n.state.doc.resolve(e),l=a.sharedDepth(t);e=a.before(l+1),t=n.state.doc.resolve(t).after(l+1);let c=n.state.selection,d=Cx(n,e,t),u=n.state.doc,f=u.slice(d.from,d.to),p,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(p=n.state.selection.to,h="end"):(p=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let m=Ax(f.content,d.doc.content,d.from,p,h);if(m&&n.input.domChangeCount++,(Fo&&n.input.lastIOSEnter>Date.now()-225||Nn)&&r.some(k=>k.nodeType==1&&!vx.test(k.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",k=>k(n,xo(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(o&&c instanceof Ie&&!c.empty&&c.$head.sameParent(c.$anchor)&&!n.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let k=mp(n,n.state.doc,d.sel);if(k&&!k.eq(n.state.selection)){let E=n.state.tr.setSelection(k);i&&E.setMeta("composition",i),n.dispatch(E)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof Ie&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=d.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=d.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),It&&Xn<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)==" "&&(m.start--,m.endA--,m.endB--);let g=d.doc.resolveNoCache(m.start-d.from),y=d.doc.resolveNoCache(m.endB-d.from),b=u.resolve(m.start),z=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=m.endA;if((Fo&&n.input.lastIOSEnter>Date.now()-225&&(!z||r.some(k=>k.nodeName=="DIV"||k.nodeName=="P"))||!z&&g.pos<d.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(d.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",k=>k(n,xo(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&Mx(u,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",k=>k(n,xo(8,"Backspace")))){Nn&<&&n.domObserver.suppressSelectionUpdates();return}lt&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),Nn&&!z&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,y=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{n.someProp("handleKeyDown",function(k){return k(n,xo(13,"Enter"))})},20));let w=m.start,T=m.endA,A=k=>{let E=k||n.state.tr.replace(w,T,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let x=mp(n,E.doc,d.sel);x&&!(lt&&n.composing&&x.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(x.head==w||x.head==E.mapping.map(T)-1)||It&&x.empty&&x.head==w)&&E.setSelection(x)}return i&&E.setMeta("composition",i),E.scrollIntoView()},M;if(z)if(g.pos==y.pos){It&&Xn<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Tn(n),20));let k=A(n.state.tr.delete(w,T)),E=u.resolve(m.start).marksAcross(u.resolve(m.endA));E&&k.ensureMarks(E),n.dispatch(k)}else if(m.endA==m.endB&&(M=zx(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let k=A(n.state.tr);M.type=="add"?k.addMark(w,T,M.mark):k.removeMark(w,T,M.mark),n.dispatch(k)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let k=g.parent.textBetween(g.parentOffset,y.parentOffset),E=()=>A(n.state.tr.insertText(k,w,T));n.someProp("handleTextInput",x=>x(n,w,T,k,E))||n.dispatch(E())}else n.dispatch(A());else n.dispatch(A())}function mp(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:el(n,e.resolve(t.anchor),e.resolve(t.head))}function zx(n,e){let t=n.firstChild.marks,o=e.firstChild.marks,r=t,i=o,a,l,c;for(let u=0;u<o.length;u++)r=o[u].removeFromSet(r);for(let u=0;u<t.length;u++)i=t[u].removeFromSet(i);if(r.length==1&&i.length==0)l=r[0],a="add",c=u=>u.mark(l.addToSet(u.marks));else if(r.length==0&&i.length==1)l=i[0],a="remove",c=u=>u.mark(l.removeFromSet(u.marks));else return null;let d=[];for(let u=0;u<e.childCount;u++)d.push(c(e.child(u)));if(re.from(d).eq(n))return{mark:l,type:a}}function Mx(n,e,t,o,r){if(t-e<=r.pos-o.pos||pl(o,!0,!1)<r.pos)return!1;let i=n.resolve(e);if(!o.parent.isTextblock){let l=i.nodeAfter;return l!=null&&t==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let a=n.resolve(pl(i,!0,!0));return!a.parent.isTextblock||a.pos>t||pl(a,!0,!1)<t?!1:o.parent.content.cut(o.parentOffset).eq(a.parent.content)}function pl(n,e,t){let o=n.depth,r=e?n.end():n.pos;for(;o>0&&(e||n.indexAfter(o)==n.node(o).childCount);)o--,r++,e=!1;if(t){let i=n.node(o).maybeChild(n.indexAfter(o));for(;i&&!i.isLeaf;)i=i.firstChild,r++}return r}function Ax(n,e,t,o,r){let i=n.findDiffStart(e,t);if(i==null)return null;let{a,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(r=="end"){let c=Math.max(0,i-Math.min(a,l));o-=a+c-i}if(a<i&&n.size<e.size){let c=o<=i&&o>=a?i-o:0;i-=c,i&&i<e.size&&gp(e.textBetween(i-1,i+1))&&(i+=c?1:-1),l=i+(l-a),a=i}else if(l<i){let c=o<=i&&o>=l?i-o:0;i-=c,i&&i<n.size&&gp(n.textBetween(i-1,i+1))&&(i+=c?1:-1),a=i+(a-l),l=i}return{start:i,endA:a,endB:l}}function gp(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class yp{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new q0,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(wp),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=kp(this),xp(this),this.nodeViews=Ep(this),this.docView=Tf(this.state.doc,bp(this),fl(this),this.dom,this),this.domObserver=new xx(this,(o,r,i,a)=>Tx(this,o,r,i,a)),this.domObserver.start(),G0(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&sl(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(wp),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let o in this._props)t[o]=this._props[o];t.state=this.state;for(let o in e)t[o]=e[o];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var o;let r=this.state,i=!1,a=!1;e.storedMarks&&this.composing&&(rp(this),a=!0),this.state=e;let l=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=Ep(this);_x(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&sl(this),this.editable=kp(this),xp(this);let c=fl(this),d=bp(this),u=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(e.doc,d,c);(f||!e.selection.eq(r.selection))&&(a=!0);let p=u=="preserve"&&a&&this.dom.style.overflowAnchor==null&&a0(this);if(a){this.domObserver.stop();let h=f&&(It||lt)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&Ix(r.selection,e.selection);if(f){let m=lt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=ax(this)),(i||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=Tf(e.doc,d,c,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&I0(this))?Tn(this,h):(Lf(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),!((o=this.dragging)===null||o===void 0)&&o.node&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():p&&l0(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof Ce){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&hf(this,t.getBoundingClientRect(),e)}else hf(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let o=this.directPlugins[t];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let o=this.state.plugins[t];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let o=this.pluginViews[t];o.update&&o.update(this,e)}}updateDraggedNode(e,t){let o=e.node,r=-1;if(this.state.doc.nodeAt(o.from)==o.node)r=o.from;else{let i=o.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==o.node&&(r=i)}this.dragging=new sp(e.slice,e.move,r<0?void 0:Ce.create(this.state.doc,r))}someProp(e,t){let o=this._props&&this._props[e],r;if(o!=null&&(r=t?t(o):o))return r;for(let a=0;a<this.directPlugins.length;a++){let l=this.directPlugins[a].props[e];if(l!=null&&(r=t?t(l):l))return r}let i=this.state.plugins;if(i)for(let a=0;a<i.length;a++){let l=i[a].props[e];if(l!=null&&(r=t?t(l):l))return r}}hasFocus(){if(It){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&c0(this.dom),Tn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return h0(this,e)}coordsAtPos(e,t=1){return kf(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,o=-1){let r=this.docView.posFromDOM(e,t,o);if(r==null)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return x0(this,t||this.state,e)}pasteHTML(e,t){return vr(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return vr(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return ol(this,e)}destroy(){this.docView&&(K0(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],fl(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Y1())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return X0(this,e)}domSelectionRange(){let e=this.domSelection();return e?pt&&this.root.nodeType===11&&n0(this.dom.ownerDocument)==this.dom&&Ex(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}yp.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function bp(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let o in t)o=="class"?e.class+=" "+t[o]:o=="style"?e.style=(e.style?e.style+";":"")+t[o]:!e[o]&&o!="contenteditable"&&o!="nodeName"&&(e[o]=String(t[o]))}),e.translate||(e.translate="no"),[sn.node(0,n.state.doc.content.size,e)]}function xp(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:sn.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function kp(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Ix(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Ep(n){let e=Object.create(null);function t(o){for(let r in o)Object.prototype.hasOwnProperty.call(e,r)||(e[r]=o[r])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function _x(n,e){let t=0,o=0;for(let r in n){if(n[r]!=e[r])return!0;t++}for(let r in e)o++;return t!=o}function wp(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var oo={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},$i={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ox=typeof navigator<"u"&&/Mac/.test(navigator.platform),Dx=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ht=0;ht<10;ht++)oo[48+ht]=oo[96+ht]=String(ht);for(var ht=1;ht<=24;ht++)oo[ht+111]="F"+ht;for(var ht=65;ht<=90;ht++)oo[ht]=String.fromCharCode(ht+32),$i[ht]=String.fromCharCode(ht);for(var hl in oo)$i.hasOwnProperty(hl)||($i[hl]=oo[hl]);function Px(n){var e=Ox&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Dx&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?$i:oo)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Rx=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Lx=typeof navigator<"u"&&/Win/.test(navigator.platform);function $x(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let o,r,i,a;for(let l=0;l<e.length-1;l++){let c=e[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))Rx?a=!0:r=!0;else throw new Error("Unrecognized modifier name: "+c)}return o&&(t="Alt-"+t),r&&(t="Ctrl-"+t),a&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function Vx(n){let e=Object.create(null);for(let t in n)e[$x(t)]=n[t];return e}function ml(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function Bx(n){return new At({props:{handleKeyDown:Fx(n)}})}function Fx(n){let e=Vx(n);return function(t,o){let r=Px(o),i,a=e[ml(r,o)];if(a&&a(t.state,t.dispatch,t))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[ml(r,o,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!(Lx&&o.ctrlKey&&o.altKey)&&(i=oo[o.keyCode])&&i!=r){let l=e[ml(i,o)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var jx=Object.defineProperty,gl=(n,e)=>{for(var t in e)jx(n,t,{get:e[t],enumerable:!0})};function Vi(n){const{state:e,transaction:t}=n;let{selection:o}=t,{doc:r}=t,{storedMarks:i}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return o},get doc(){return r},get tr(){return o=t.selection,r=t.doc,i=t.storedMarks,t}}}var Bi=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:o}=e,{tr:r}=t,i=this.buildProps(r);return Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...d)=>{const u=l(...d)(i);return!r.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(r),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:o,state:r}=this,{view:i}=o,a=[],l=!!n,c=n||r.tr,d=()=>(!l&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(c),a.every(f=>f===!0)),u={...Object.fromEntries(Object.entries(t).map(([f,p])=>[f,(...m)=>{const g=this.buildProps(c,e),y=p(...m)(g);return a.push(y),u}])),run:d};return u}createCan(n){const{rawCommands:e,state:t}=this,o=!1,r=n||t.tr,i=this.buildProps(r,o);return{...Object.fromEntries(Object.entries(e).map(([l,c])=>[l,(...d)=>c(...d)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,o)}}buildProps(n,e=!0){const{rawCommands:t,editor:o,state:r}=this,{view:i}=o,a={tr:n,editor:o,view:i,state:Vi({state:r,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([l,c])=>[l,(...d)=>c(...d)(a)]))}};return a}},Sp={};gl(Sp,{blur:()=>Hx,clearContent:()=>Ux,clearNodes:()=>Wx,command:()=>qx,createParagraphNear:()=>Gx,cut:()=>Kx,deleteCurrentNode:()=>Jx,deleteNode:()=>Xx,deleteRange:()=>Yx,deleteSelection:()=>Qx,enter:()=>Zx,exitCode:()=>ek,extendMarkRange:()=>tk,first:()=>nk,focus:()=>rk,forEach:()=>ik,insertContent:()=>sk,insertContentAt:()=>ck,joinBackward:()=>fk,joinDown:()=>uk,joinForward:()=>pk,joinItemBackward:()=>hk,joinItemForward:()=>mk,joinTextblockBackward:()=>gk,joinTextblockForward:()=>yk,joinUp:()=>dk,keyboardShortcut:()=>xk,lift:()=>kk,liftEmptyBlock:()=>Ek,liftListItem:()=>wk,newlineInCode:()=>Sk,resetAttributes:()=>Ck,scrollIntoView:()=>Nk,selectAll:()=>vk,selectNodeBackward:()=>Tk,selectNodeForward:()=>zk,selectParentNode:()=>Mk,selectTextblockEnd:()=>Ak,selectTextblockStart:()=>Ik,setContent:()=>_k,setMark:()=>Qk,setMeta:()=>Zk,setNode:()=>eE,setNodeSelection:()=>tE,setTextDirection:()=>nE,setTextSelection:()=>oE,sinkListItem:()=>rE,splitBlock:()=>iE,splitListItem:()=>sE,toggleList:()=>aE,toggleMark:()=>lE,toggleNode:()=>cE,toggleWrap:()=>dE,undoInputRule:()=>uE,unsetAllMarks:()=>fE,unsetMark:()=>pE,unsetTextDirection:()=>hE,updateAttributes:()=>mE,wrapIn:()=>gE,wrapInList:()=>yE});var Hx=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),Ux=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),Wx=()=>({state:n,tr:e,dispatch:t})=>{const{selection:o}=e,{ranges:r}=o;return t&&r.forEach(({$from:i,$to:a})=>{n.doc.nodesBetween(i.pos,a.pos,(l,c)=>{if(l.type.isText)return;const{doc:d,mapping:u}=e,f=d.resolve(u.map(c)),p=d.resolve(u.map(c+l.nodeSize)),h=f.blockRange(p);if(!h)return;const m=Do(h);if(l.type.isTextblock){const{defaultType:g}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,g)}(m||m===0)&&e.lift(h,m)})}),!0},qx=n=>e=>n(e),Gx=()=>({state:n,dispatch:e})=>of(n,e),Kx=(n,e)=>({editor:t,tr:o})=>{const{state:r}=t,i=r.doc.slice(n.from,n.to);o.deleteRange(n.from,n.to);const a=o.mapping.map(e);return o.insert(a,i.content),o.setSelection(new Ie(o.doc.resolve(Math.max(a-1,0)))),!0},Jx=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,o=t.$anchor.node();if(o.content.size>0)return!1;const r=n.selection.$anchor;for(let i=r.depth;i>0;i-=1)if(r.node(i).type===o.type){if(e){const l=r.before(i),c=r.after(i);n.delete(l,c).scrollIntoView()}return!0}return!1};function tt(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var Xx=n=>({tr:e,state:t,dispatch:o})=>{const r=tt(n,t.schema),i=e.selection.$anchor;for(let a=i.depth;a>0;a-=1)if(i.node(a).type===r){if(o){const c=i.before(a),d=i.after(a);e.delete(c,d).scrollIntoView()}return!0}return!1},Yx=n=>({tr:e,dispatch:t})=>{const{from:o,to:r}=n;return t&&e.delete(o,r),!0},Qx=()=>({state:n,dispatch:e})=>Va(n,e),Zx=()=>({commands:n})=>n.keyboardShortcut("Enter"),ek=()=>({state:n,dispatch:e})=>R1(n,e);function yl(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Fi(n,e,t={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>t.strict?e[r]===n[r]:yl(e[r])?e[r].test(n[r]):e[r]===n[r]):!0}function Cp(n,e,t={}){return n.find(o=>o.type===e&&Fi(Object.fromEntries(Object.keys(t).map(r=>[r,o.attrs[r]])),t))}function Np(n,e,t={}){return!!Cp(n,e,t)}function bl(n,e,t){var o;if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(u=>u.type===e))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(u=>u.type===e)||(t=t||((o=r.node.marks[0])==null?void 0:o.attrs),!Cp([...r.node.marks],e,t)))return;let a=r.index,l=n.start()+r.offset,c=a+1,d=l+r.node.nodeSize;for(;a>0&&Np([...n.parent.child(a-1).marks],e,t);)a-=1,l-=n.parent.child(a).nodeSize;for(;c<n.parent.childCount&&Np([...n.parent.child(c).marks],e,t);)d+=n.parent.child(c).nodeSize,c+=1;return{from:l,to:d}}function zn(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var tk=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const i=zn(n,o.schema),{doc:a,selection:l}=t,{$from:c,from:d,to:u}=l;if(r){const f=bl(c,i,e);if(f&&f.from<=d&&f.to>=u){const p=Ie.create(a,f.from,f.to);t.setSelection(p)}}return!0},nk=n=>e=>{const t=typeof n=="function"?n(e):n;for(let o=0;o<t.length;o+=1)if(t[o](e))return!0;return!1};function vp(n){return n instanceof Ie}function No(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Tp(n,e=null){if(!e)return null;const t=Pe.atStart(n),o=Pe.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return o;const r=t.from,i=o.to;return e==="all"?Ie.create(n,No(0,r,i),No(n.content.size,r,i)):Ie.create(n,No(e,r,i),No(e,r,i))}function zp(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ji(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function ok(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var rk=(n=null,e={})=>({editor:t,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const a=()=>{(ji()||zp())&&o.dom.focus(),ok()&&!ji()&&!zp()&&o.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(o.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(o.hasFocus()&&n===null||n===!1)return!0;if(i&&n===null&&!vp(t.state.selection))return a(),!0;const l=Tp(r.doc,n)||t.state.selection,c=t.state.selection.eq(l);return i&&(c||r.setSelection(l),c&&r.storedMarks&&r.setStoredMarks(r.storedMarks),a()),!0},ik=(n,e)=>t=>n.every((o,r)=>e(o,{...t,index:r})),sk=(n,e)=>({tr:t,commands:o})=>o.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Mp=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const o=e[t];o.nodeType===3&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?n.removeChild(o):o.nodeType===1&&Mp(o)}return n};function Hi(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Mp(t)}function zr(n,e,t){if(n instanceof Wn||n instanceof re)return n;t={slice:!0,parseOptions:{},...t};const o=typeof n=="object"&&n!==null,r=typeof n=="string";if(o)try{if(Array.isArray(n)&&n.length>0)return re.fromArray(n.map(l=>e.nodeFromJSON(l)));const a=e.nodeFromJSON(n);return t.errorOnInvalidContent&&a.check(),a}catch(i){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",i),zr("",e,t)}if(r){if(t.errorOnInvalidContent){let a=!1,l="";const c=new gu({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(a=!0,l=typeof d=="string"?d:d.outerHTML,null)}]}})});if(t.slice?fr.fromSchema(c).parseSlice(Hi(n),t.parseOptions):fr.fromSchema(c).parse(Hi(n),t.parseOptions),t.errorOnInvalidContent&&a)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=fr.fromSchema(e);return t.slice?i.parseSlice(Hi(n),t.parseOptions).content:i.parse(Hi(n),t.parseOptions)}return zr("",e,t)}function ak(n,e,t){const o=n.steps.length-1;if(o<e)return;const r=n.steps[o];if(!(r instanceof st||r instanceof at))return;const i=n.mapping.maps[o];let a=0;i.forEach((l,c,d,u)=>{a===0&&(a=u)}),n.setSelection(Pe.near(n.doc.resolve(a),t))}var lk=n=>!("type"in n),ck=(n,e,t)=>({tr:o,dispatch:r,editor:i})=>{var a;if(r){t={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;const c=y=>{i.emit("contentError",{editor:i,error:y,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{zr(e,i.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(y){c(y)}try{l=zr(e,i.schema,{parseOptions:d,errorOnInvalidContent:(a=t.errorOnInvalidContent)!=null?a:i.options.enableContentCheck})}catch(y){return c(y),!1}let{from:u,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},p=!0,h=!0;if((lk(l)?l:[l]).forEach(y=>{y.check(),p=p?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),u===f&&h){const{parent:y}=o.doc.resolve(u);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(u-=1,f+=1)}let g;if(p){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof re){let y="";e.forEach(b=>{b.text&&(y+=b.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;o.insertText(g,u,f)}else{g=l;const y=o.doc.resolve(u),b=y.node(),z=y.parentOffset===0,w=b.isText||b.isTextblock,T=b.content.size>0;z&&w&&T&&(u=Math.max(0,u-1)),o.replaceWith(u,f,g)}t.updateSelection&&ak(o,o.steps.length-1,-1),t.applyInputRules&&o.setMeta("applyInputRules",{from:u,text:g}),t.applyPasteRules&&o.setMeta("applyPasteRules",{from:u,text:g})}return!0},dk=()=>({state:n,dispatch:e})=>O1(n,e),uk=()=>({state:n,dispatch:e})=>D1(n,e),fk=()=>({state:n,dispatch:e})=>Xu(n,e),pk=()=>({state:n,dispatch:e})=>ef(n,e),hk=()=>({state:n,dispatch:e,tr:t})=>{try{const o=vi(n.doc,n.selection.$from.pos,-1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},mk=()=>({state:n,dispatch:e,tr:t})=>{try{const o=vi(n.doc,n.selection.$from.pos,1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},gk=()=>({state:n,dispatch:e})=>I1(n,e),yk=()=>({state:n,dispatch:e})=>_1(n,e);function Ap(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function bk(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let o,r,i,a;for(let l=0;l<e.length-1;l+=1){const c=e[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))ji()||Ap()?a=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return o&&(t=`Alt-${t}`),r&&(t=`Ctrl-${t}`),a&&(t=`Meta-${t}`),i&&(t=`Shift-${t}`),t}var xk=n=>({editor:e,view:t,tr:o,dispatch:r})=>{const i=bk(n).split(/-(?!$)/),a=i.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),l=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{t.someProp("handleKeyDown",d=>d(t,l))});return c?.steps.forEach(d=>{const u=d.map(o.mapping);u&&r&&o.maybeStep(u)}),!0};function ro(n,e,t={}){const{from:o,to:r,empty:i}=n.selection,a=e?tt(e,n.schema):null,l=[];n.doc.nodesBetween(o,r,(f,p)=>{if(f.isText)return;const h=Math.max(o,p),m=Math.min(r,p+f.nodeSize);l.push({node:f,from:h,to:m})});const c=r-o,d=l.filter(f=>a?a.name===f.node.type.name:!0).filter(f=>Fi(f.node.attrs,t,{strict:!1}));return i?!!d.length:d.reduce((f,p)=>f+p.to-p.from,0)>=c}var kk=(n,e={})=>({state:t,dispatch:o})=>{const r=tt(n,t.schema);return ro(t,r,e)?P1(t,o):!1},Ek=()=>({state:n,dispatch:e})=>rf(n,e),wk=n=>({state:e,dispatch:t})=>{const o=tt(n,e.schema);return G1(o)(e,t)},Sk=()=>({state:n,dispatch:e})=>nf(n,e);function Ui(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Ip(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((o,r)=>(t.includes(r)||(o[r]=n[r]),o),{})}var Ck=(n,e)=>({tr:t,state:o,dispatch:r})=>{let i=null,a=null;const l=Ui(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=tt(n,o.schema)),l==="mark"&&(a=zn(n,o.schema));let c=!1;return t.selection.ranges.forEach(d=>{o.doc.nodesBetween(d.$from.pos,d.$to.pos,(u,f)=>{i&&i===u.type&&(c=!0,r&&t.setNodeMarkup(f,void 0,Ip(u.attrs,e))),a&&u.marks.length&&u.marks.forEach(p=>{a===p.type&&(c=!0,r&&t.addMark(f,f+u.nodeSize,a.create(Ip(p.attrs,e))))})})}),c},Nk=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),vk=()=>({tr:n,dispatch:e})=>{if(e){const t=new Rt(n.doc);n.setSelection(t)}return!0},Tk=()=>({state:n,dispatch:e})=>Qu(n,e),zk=()=>({state:n,dispatch:e})=>tf(n,e),Mk=()=>({state:n,dispatch:e})=>V1(n,e),Ak=()=>({state:n,dispatch:e})=>j1(n,e),Ik=()=>({state:n,dispatch:e})=>F1(n,e);function xl(n,e,t={},o={}){return zr(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:o.errorOnInvalidContent})}var _k=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:o={}}={})=>({editor:r,tr:i,dispatch:a,commands:l})=>{const{doc:c}=i;if(o.preserveWhitespace!=="full"){const d=xl(n,r.schema,o,{errorOnInvalidContent:e??r.options.enableContentCheck});return a&&i.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!t),!0}return a&&i.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:c.content.size},n,{parseOptions:o,errorOnInvalidContent:e??r.options.enableContentCheck})};function _p(n,e){const t=zn(e,n.schema),{from:o,to:r,empty:i}=n.selection,a=[];i?(n.storedMarks&&a.push(...n.storedMarks),a.push(...n.selection.$head.marks())):n.doc.nodesBetween(o,r,c=>{a.push(...c.marks)});const l=a.find(c=>c.type.name===t.name);return l?{...l.attrs}:{}}function Op(n,e){const t=new Bu(n);return e.forEach(o=>{o.steps.forEach(r=>{t.step(r)})}),t}function Ok(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function Dk(n,e,t){const o=[];return n.nodesBetween(e.from,e.to,(r,i)=>{t(r)&&o.push({node:r,pos:i})}),o}function Pk(n,e){for(let t=n.depth;t>0;t-=1){const o=n.node(t);if(e(o))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:o}}}function Wi(n){return e=>Pk(e.$from,n)}function Ee(n,e,t){return n.config[e]===void 0&&n.parent?Ee(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?Ee(n.parent,e,t):null}):n.config[e]}function kl(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},o=Ee(e,"addExtensions",t);return o?[e,...kl(o())]:e}).flat(10)}function El(n,e){const t=go.fromSchema(e).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(t),r.innerHTML}function Dp(n){return typeof n=="function"}function je(n,e=void 0,...t){return Dp(n)?e?n.bind(e)(...t):n(...t):n}function Rk(n={}){return Object.keys(n).length===0&&n.constructor===Object}function qo(n){const e=n.filter(r=>r.type==="extension"),t=n.filter(r=>r.type==="node"),o=n.filter(r=>r.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:o}}function Pp(n){const e=[],{nodeExtensions:t,markExtensions:o}=qo(n),r=[...t,...o],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(a=>{const l={name:a.name,options:a.options,storage:a.storage,extensions:r},c=Ee(a,"addGlobalAttributes",l);if(!c)return;c().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([p,h])=>{e.push({type:f,name:p,attribute:{...i,...h}})})})})}),r.forEach(a=>{const l={name:a.name,options:a.options,storage:a.storage},c=Ee(a,"addAttributes",l);if(!c)return;const d=c();Object.entries(d).forEach(([u,f])=>{const p={...i,...f};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:a.name,name:u,attribute:p})})}),e}function _t(...n){return n.filter(e=>!!e).reduce((e,t)=>{const o={...e};return Object.entries(t).forEach(([r,i])=>{if(!o[r]){o[r]=i;return}if(r==="class"){const l=i?String(i).split(" "):[],c=o[r]?o[r].split(" "):[],d=l.filter(u=>!c.includes(u));o[r]=[...c,...d].join(" ")}else if(r==="style"){const l=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],c=o[r]?o[r].split(";").map(u=>u.trim()).filter(Boolean):[],d=new Map;c.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),l.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),o[r]=Array.from(d.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else o[r]=i}),o},{})}function Mr(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,o)=>_t(t,o),{})}function Lk(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Rp(n,e){return"style"in n?n:{...n,getAttrs:t=>{const o=n.getAttrs?n.getAttrs(t):n.attrs;if(o===!1)return!1;const r=e.reduce((i,a)=>{const l=a.attribute.parseHTML?a.attribute.parseHTML(t):Lk(t.getAttribute(a.name));return l==null?i:{...i,[a.name]:l}},{});return{...o,...r}}}}function Lp(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Rk(t)?!1:t!=null))}function $p(n){var e,t;const o={};return!((e=n?.attribute)!=null&&e.isRequired)&&"default"in(n?.attribute||{})&&(o.default=n.attribute.default),((t=n?.attribute)==null?void 0:t.validate)!==void 0&&(o.validate=n.attribute.validate),[n.name,o]}function $k(n,e){var t;const o=Pp(n),{nodeExtensions:r,markExtensions:i}=qo(n),a=(t=r.find(d=>Ee(d,"topNode")))==null?void 0:t.name,l=Object.fromEntries(r.map(d=>{const u=o.filter(b=>b.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=n.reduce((b,z)=>{const w=Ee(z,"extendNodeSchema",f);return{...b,...w?w(d):{}}},{}),h=Lp({...p,content:je(Ee(d,"content",f)),marks:je(Ee(d,"marks",f)),group:je(Ee(d,"group",f)),inline:je(Ee(d,"inline",f)),atom:je(Ee(d,"atom",f)),selectable:je(Ee(d,"selectable",f)),draggable:je(Ee(d,"draggable",f)),code:je(Ee(d,"code",f)),whitespace:je(Ee(d,"whitespace",f)),linebreakReplacement:je(Ee(d,"linebreakReplacement",f)),defining:je(Ee(d,"defining",f)),isolating:je(Ee(d,"isolating",f)),attrs:Object.fromEntries(u.map($p))}),m=je(Ee(d,"parseHTML",f));m&&(h.parseDOM=m.map(b=>Rp(b,u)));const g=Ee(d,"renderHTML",f);g&&(h.toDOM=b=>g({node:b,HTMLAttributes:Mr(b,u)}));const y=Ee(d,"renderText",f);return y&&(h.toText=y),[d.name,h]})),c=Object.fromEntries(i.map(d=>{const u=o.filter(y=>y.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=n.reduce((y,b)=>{const z=Ee(b,"extendMarkSchema",f);return{...y,...z?z(d):{}}},{}),h=Lp({...p,inclusive:je(Ee(d,"inclusive",f)),excludes:je(Ee(d,"excludes",f)),group:je(Ee(d,"group",f)),spanning:je(Ee(d,"spanning",f)),code:je(Ee(d,"code",f)),attrs:Object.fromEntries(u.map($p))}),m=je(Ee(d,"parseHTML",f));m&&(h.parseDOM=m.map(y=>Rp(y,u)));const g=Ee(d,"renderHTML",f);return g&&(h.toDOM=y=>g({mark:y,HTMLAttributes:Mr(y,u)})),[d.name,h]}));return new gu({topNode:a,nodes:l,marks:c})}function Vk(n){const e=n.filter((t,o)=>n.indexOf(t)!==o);return Array.from(new Set(e))}function qi(n){return n.sort((t,o)=>{const r=Ee(t,"priority")||100,i=Ee(o,"priority")||100;return r>i?-1:r<i?1:0})}function Vp(n){const e=qi(kl(n)),t=Vk(e.map(o=>o.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),e}function Bp(n,e,t){const{from:o,to:r}=e,{blockSeparator:i=`
|
|
354
|
+
|
|
355
|
+
`,textSerializers:a={}}=t||{};let l="";return n.nodesBetween(o,r,(c,d,u,f)=>{var p;c.isBlock&&d>o&&(l+=i);const h=a?.[c.type.name];if(h)return u&&(l+=h({node:c,pos:d,parent:u,index:f,range:e})),!1;c.isText&&(l+=(p=c?.text)==null?void 0:p.slice(Math.max(o,d)-d,r-d))}),l}function Bk(n,e){const t={from:0,to:n.content.size};return Bp(n,t,e)}function Fp(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Fk(n,e){const t=tt(e,n.schema),{from:o,to:r}=n.selection,i=[];n.doc.nodesBetween(o,r,l=>{i.push(l)});const a=i.reverse().find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function jp(n,e){const t=Ui(typeof e=="string"?e:e.name,n.schema);return t==="node"?Fk(n,e):t==="mark"?_p(n,e):{}}function jk(n,e=JSON.stringify){const t={};return n.filter(o=>{const r=e(o);return Object.prototype.hasOwnProperty.call(t,r)?!1:t[r]=!0})}function Hk(n){const e=jk(n);return e.length===1?e:e.filter((t,o)=>!e.filter((i,a)=>a!==o).some(i=>t.oldRange.from>=i.oldRange.from&&t.oldRange.to<=i.oldRange.to&&t.newRange.from>=i.newRange.from&&t.newRange.to<=i.newRange.to))}function Hp(n){const{mapping:e,steps:t}=n,o=[];return e.maps.forEach((r,i)=>{const a=[];if(r.ranges.length)r.forEach((l,c)=>{a.push({from:l,to:c})});else{const{from:l,to:c}=t[i];if(l===void 0||c===void 0)return;a.push({from:l,to:c})}a.forEach(({from:l,to:c})=>{const d=e.slice(i).map(l,-1),u=e.slice(i).map(c),f=e.invert().map(d,-1),p=e.invert().map(u);o.push({oldRange:{from:f,to:p},newRange:{from:d,to:u}})})}),Hk(o)}function wl(n,e,t){const o=[];return n===e?t.resolve(n).marks().forEach(r=>{const i=t.resolve(n),a=bl(i,r.type);a&&o.push({mark:r,...a})}):t.nodesBetween(n,e,(r,i)=>{!r||r?.nodeSize===void 0||o.push(...r.marks.map(a=>({from:i,to:i+r.nodeSize,mark:a})))}),o}var Uk=(n,e,t,o=20)=>{const r=n.doc.resolve(t);let i=o,a=null;for(;i>0&&a===null;){const l=r.node(i);l?.type.name===e?a=l:i-=1}return[a,i]};function Gi(n,e){return e.nodes[n]||e.marks[n]||null}function Ki(n,e,t){return Object.fromEntries(Object.entries(t).filter(([o])=>{const r=n.find(i=>i.type===e&&i.name===o);return r?r.attribute.keepOnSplit:!1}))}var Wk=(n,e=500)=>{let t="";const o=n.parentOffset;return n.parent.nodesBetween(Math.max(0,o-e),o,(r,i,a,l)=>{var c,d;const u=((d=(c=r.type.spec).toText)==null?void 0:d.call(c,{node:r,pos:i,parent:a,index:l}))||r.textContent||"%leaf%";t+=r.isAtom&&!r.isText?u:u.slice(0,Math.max(0,o-i))}),t};function Sl(n,e,t={}){const{empty:o,ranges:r}=n.selection,i=e?zn(e,n.schema):null;if(o)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>i?i.name===f.type.name:!0).find(f=>Fi(f.attrs,t,{strict:!1}));let a=0;const l=[];if(r.forEach(({$from:f,$to:p})=>{const h=f.pos,m=p.pos;n.doc.nodesBetween(h,m,(g,y)=>{if(!g.isText&&!g.marks.length)return;const b=Math.max(h,y),z=Math.min(m,y+g.nodeSize),w=z-b;a+=w,l.push(...g.marks.map(T=>({mark:T,from:b,to:z})))})}),a===0)return!1;const c=l.filter(f=>i?i.name===f.mark.type.name:!0).filter(f=>Fi(f.mark.attrs,t,{strict:!1})).reduce((f,p)=>f+p.to-p.from,0),d=l.filter(f=>i?f.mark.type!==i&&f.mark.type.excludes(i):!0).reduce((f,p)=>f+p.to-p.from,0);return(c>0?c+d:c)>=a}function qk(n,e,t={}){if(!e)return ro(n,null,t)||Sl(n,null,t);const o=Ui(e,n.schema);return o==="node"?ro(n,e,t):o==="mark"?Sl(n,e,t):!1}var Gk=(n,e)=>{const{$from:t,$to:o,$anchor:r}=n.selection;if(e){const i=Wi(l=>l.type.name===e)(n.selection);if(!i)return!1;const a=n.doc.resolve(i.pos+1);return r.pos+1===a.end()}return!(o.parentOffset<o.parent.nodeSize-2||t.pos!==o.pos)},Kk=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function Up(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function Wp(n,e){const{nodeExtensions:t}=qo(e),o=t.find(a=>a.name===n);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=je(Ee(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function Cl(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var o;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((o=n.text)!=null?o:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let r=!0;return n.content.forEach(i=>{r!==!1&&(Cl(i,{ignoreWhitespace:t,checkChildren:e})||(r=!1))}),r}return!1}var qp=class am{constructor(e){this.position=e}static fromJSON(e){return new am(e.position)}toJSON(){return{position:this.position}}};function Jk(n,e){const t=e.mapping.mapResult(n.position);return{position:new qp(t.pos),mapResult:t}}function Xk(n){return new qp(n)}function Yk(n,e,t){var o;const{selection:r}=e;let i=null;if(vp(r)&&(i=r.$cursor),i){const l=(o=n.storedMarks)!=null?o:i.marks();return i.parent.type.allowsMarkType(t)&&(!!t.isInSet(l)||!l.some(d=>d.type.excludes(t)))}const{ranges:a}=r;return a.some(({$from:l,$to:c})=>{let d=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,c.pos,(u,f,p)=>{if(d)return!1;if(u.isInline){const h=!p||p.type.allowsMarkType(t),m=!!t.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(t));d=h&&m}return!d}),d})}var Qk=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=t,{empty:a,ranges:l}=i,c=zn(n,o.schema);if(r)if(a){const d=_p(o,c);t.addStoredMark(c.create({...d,...e}))}else l.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;o.doc.nodesBetween(u,f,(p,h)=>{const m=Math.max(h,u),g=Math.min(h+p.nodeSize,f);p.marks.find(b=>b.type===c)?p.marks.forEach(b=>{c===b.type&&t.addMark(m,g,c.create({...b.attrs,...e}))}):t.addMark(m,g,c.create(e))})});return Yk(o,t,c)},Zk=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),eE=(n,e={})=>({state:t,dispatch:o,chain:r})=>{const i=tt(n,t.schema);let a;return t.selection.$anchor.sameParent(t.selection.$head)&&(a=t.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:l})=>lf(i,{...a,...e})(t)?!0:l.clearNodes()).command(({state:l})=>lf(i,{...a,...e})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},tE=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,r=No(n,0,o.content.size),i=Ce.create(o,r);e.setSelection(i)}return!0},nE=(n,e)=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=o;let a,l;return typeof e=="number"?(a=e,l=e):e&&"from"in e&&"to"in e?(a=e.from,l=e.to):(a=i.from,l=i.to),r&&t.doc.nodesBetween(a,l,(c,d)=>{c.isText||t.setNodeMarkup(d,void 0,{...c.attrs,dir:n})}),!0},oE=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,{from:r,to:i}=typeof n=="number"?{from:n,to:n}:n,a=Ie.atStart(o).from,l=Ie.atEnd(o).to,c=No(r,a,l),d=No(i,a,l),u=Ie.create(o,c,d);e.setSelection(u)}return!0},rE=n=>({state:e,dispatch:t})=>{const o=tt(n,e.schema);return X1(o)(e,t)};function Gp(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const o=t.filter(r=>e?.includes(r.type.name));n.tr.ensureMarks(o)}}var iE=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:o,editor:r})=>{const{selection:i,doc:a}=e,{$from:l,$to:c}=i,d=r.extensionManager.attributes,u=Ki(d,l.node().type.name,l.node().attrs);if(i instanceof Ce&&i.node.isBlock)return!l.parentOffset||!Sn(a,l.pos)?!1:(o&&(n&&Gp(t,r.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const f=c.parentOffset===c.parent.content.size,p=l.depth===0?void 0:Ok(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:u}]:void 0,m=Sn(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&Sn(e.doc,e.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:u}]:void 0),o){if(m&&(i instanceof Ie&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),p&&!f&&!l.parentOffset&&l.parent.type!==p)){const g=e.mapping.map(l.before()),y=e.doc.resolve(g);l.node(-1).canReplaceWith(y.index(),y.index()+1,p)&&e.setNodeMarkup(e.mapping.map(l.before()),p)}n&&Gp(t,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},sE=(n,e={})=>({tr:t,state:o,dispatch:r,editor:i})=>{var a;const l=tt(n,o.schema),{$from:c,$to:d}=o.selection,u=o.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(d))return!1;const f=c.node(-1);if(f.type!==l)return!1;const p=i.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(r){let b=re.empty;const z=c.index(-1)?1:c.index(-2)?2:3;for(let E=c.depth-z;E>=c.depth-3;E-=1)b=re.from(c.node(E).copy(b));const w=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,T={...Ki(p,c.node().type.name,c.node().attrs),...e},A=((a=l.contentMatch.defaultType)==null?void 0:a.createAndFill(T))||void 0;b=b.append(re.from(l.createAndFill(null,A)||void 0));const M=c.before(c.depth-(z-1));t.replace(M,c.after(-w),new fe(b,4-z,0));let k=-1;t.doc.nodesBetween(M,t.doc.content.size,(E,x)=>{if(k>-1)return!1;E.isTextblock&&E.content.size===0&&(k=x+1)}),k>-1&&t.setSelection(Ie.near(t.doc.resolve(k))),t.scrollIntoView()}return!0}const h=d.pos===c.end()?f.contentMatchAt(0).defaultType:null,m={...Ki(p,f.type.name,f.attrs),...e},g={...Ki(p,c.node().type.name,c.node().attrs),...e};t.delete(c.pos,d.pos);const y=h?[{type:l,attrs:m},{type:h,attrs:g}]:[{type:l,attrs:m}];if(!Sn(t.doc,c.pos,2))return!1;if(r){const{selection:b,storedMarks:z}=o,{splittableMarks:w}=i.extensionManager,T=z||b.$to.parentOffset&&b.$from.marks();if(t.split(c.pos,2,y).scrollIntoView(),!T||!r)return!0;const A=T.filter(M=>w.includes(M.type.name));t.ensureMarks(A)}return!0},Nl=(n,e)=>{const t=Wi(a=>a.type===e)(n.selection);if(!t)return!0;const o=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(o===void 0)return!0;const r=n.doc.nodeAt(o);return t.node.type===r?.type&&Kn(n.doc,t.pos)&&n.join(t.pos),!0},vl=(n,e)=>{const t=Wi(a=>a.type===e)(n.selection);if(!t)return!0;const o=n.doc.resolve(t.start).after(t.depth);if(o===void 0)return!0;const r=n.doc.nodeAt(o);return t.node.type===r?.type&&Kn(n.doc,o)&&n.join(o),!0},aE=(n,e,t,o={})=>({editor:r,tr:i,state:a,dispatch:l,chain:c,commands:d,can:u})=>{const{extensions:f,splittableMarks:p}=r.extensionManager,h=tt(n,a.schema),m=tt(e,a.schema),{selection:g,storedMarks:y}=a,{$from:b,$to:z}=g,w=b.blockRange(z),T=y||g.$to.parentOffset&&g.$from.marks();if(!w)return!1;const A=Wi(M=>Wp(M.type.name,f))(g);if(w.depth>=1&&A&&w.depth-A.depth<=1){if(A.node.type===h)return d.liftListItem(m);if(Wp(A.node.type.name,f)&&h.validContent(A.node.content)&&l)return c().command(()=>(i.setNodeMarkup(A.pos,h),!0)).command(()=>Nl(i,h)).command(()=>vl(i,h)).run()}return!t||!T||!l?c().command(()=>u().wrapInList(h,o)?!0:d.clearNodes()).wrapInList(h,o).command(()=>Nl(i,h)).command(()=>vl(i,h)).run():c().command(()=>{const M=u().wrapInList(h,o),k=T.filter(E=>p.includes(E.type.name));return i.ensureMarks(k),M?!0:d.clearNodes()}).wrapInList(h,o).command(()=>Nl(i,h)).command(()=>vl(i,h)).run()},lE=(n,e={},t={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=t,a=zn(n,o.schema);return Sl(o,a,e)?r.unsetMark(a,{extendEmptyMarkRange:i}):r.setMark(a,e)},cE=(n,e,t={})=>({state:o,commands:r})=>{const i=tt(n,o.schema),a=tt(e,o.schema),l=ro(o,i,t);let c;return o.selection.$anchor.sameParent(o.selection.$head)&&(c=o.selection.$anchor.parent.attrs),l?r.setNode(a,c):r.setNode(i,{...c,...t})},dE=(n,e={})=>({state:t,commands:o})=>{const r=tt(n,t.schema);return ro(t,r,e)?o.lift(r):o.wrapIn(r,e)},uE=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let o=0;o<t.length;o+=1){const r=t[o];let i;if(r.spec.isInputRules&&(i=r.getState(n))){if(e){const a=n.tr,l=i.transform;for(let c=l.steps.length-1;c>=0;c-=1)a.step(l.steps[c].invert(l.docs[c]));if(i.text){const c=a.doc.resolve(i.from).marks();a.replaceWith(i.from,i.to,n.schema.text(i.text,c))}else a.delete(i.from,i.to)}return!0}}return!1},fE=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:o,ranges:r}=t;return o||e&&r.forEach(i=>{n.removeMark(i.$from.pos,i.$to.pos)}),!0},pE=(n,e={})=>({tr:t,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:a=!1}=e,{selection:l}=t,c=zn(n,o.schema),{$from:d,empty:u,ranges:f}=l;if(!r)return!0;if(u&&a){let{from:p,to:h}=l;const m=(i=d.marks().find(y=>y.type===c))==null?void 0:i.attrs,g=bl(d,c,m);g&&(p=g.from,h=g.to),t.removeMark(p,h,c)}else f.forEach(p=>{t.removeMark(p.$from.pos,p.$to.pos,c)});return t.removeStoredMark(c),!0},hE=n=>({tr:e,state:t,dispatch:o})=>{const{selection:r}=t;let i,a;return typeof n=="number"?(i=n,a=n):n&&"from"in n&&"to"in n?(i=n.from,a=n.to):(i=r.from,a=r.to),o&&e.doc.nodesBetween(i,a,(l,c)=>{if(l.isText)return;const d={...l.attrs};delete d.dir,e.setNodeMarkup(c,void 0,d)}),!0},mE=(n,e={})=>({tr:t,state:o,dispatch:r})=>{let i=null,a=null;const l=Ui(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=tt(n,o.schema)),l==="mark"&&(a=zn(n,o.schema));let c=!1;return t.selection.ranges.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;let p,h,m,g;t.selection.empty?o.doc.nodesBetween(u,f,(y,b)=>{i&&i===y.type&&(c=!0,m=Math.max(b,u),g=Math.min(b+y.nodeSize,f),p=b,h=y)}):o.doc.nodesBetween(u,f,(y,b)=>{b<u&&i&&i===y.type&&(c=!0,m=Math.max(b,u),g=Math.min(b+y.nodeSize,f),p=b,h=y),b>=u&&b<=f&&(i&&i===y.type&&(c=!0,r&&t.setNodeMarkup(b,void 0,{...y.attrs,...e})),a&&y.marks.length&&y.marks.forEach(z=>{if(a===z.type&&(c=!0,r)){const w=Math.max(b,u),T=Math.min(b+y.nodeSize,f);t.addMark(w,T,a.create({...z.attrs,...e}))}}))}),h&&(p!==void 0&&r&&t.setNodeMarkup(p,void 0,{...h.attrs,...e}),a&&h.marks.length&&h.marks.forEach(y=>{a===y.type&&r&&t.addMark(m,g,a.create({...y.attrs,...e}))}))}),c},gE=(n,e={})=>({state:t,dispatch:o})=>{const r=tt(n,t.schema);return H1(r,e)(t,o)},yE=(n,e={})=>({state:t,dispatch:o})=>{const r=tt(n,t.schema);return U1(r,e)(t,o)},bE=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(o=>o.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(o=>o!==e):delete this.callbacks[n]),this}once(n,e){const t=(...o)=>{this.off(n,t),e.apply(this,o)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}},Kp=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},xE=(n,e)=>{if(yl(e))return e.exec(n);const t=e(n);if(!t)return null;const o=[t.text];return o.index=t.index,o.input=n,o.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(t.replaceWith)),o};function Ji(n){var e;const{editor:t,from:o,to:r,text:i,rules:a,plugin:l}=n,{view:c}=t;if(c.composing)return!1;const d=c.state.doc.resolve(o);if(d.parent.type.spec.code||(e=d.nodeBefore||d.nodeAfter)!=null&&e.marks.find(p=>p.type.spec.code))return!1;let u=!1;const f=Wk(d)+i;return a.forEach(p=>{if(u)return;const h=xE(f,p.find);if(!h)return;const m=c.state.tr,g=Vi({state:c.state,transaction:m}),y={from:o-(h[0].length-i.length),to:r},{commands:b,chain:z,can:w}=new Bi({editor:t,state:g});p.handler({state:g,range:y,match:h,commands:b,chain:z,can:w})===null||!m.steps.length||(p.undoable&&m.setMeta(l,{transform:m,from:o,to:r,text:i}),c.dispatch(m),u=!0)}),u}function kE(n){const{editor:e,rules:t}=n,o=new At({state:{init(){return null},apply(r,i,a){const l=r.getMeta(o);if(l)return l;const c=r.getMeta("applyInputRules");return c&&setTimeout(()=>{let{text:u}=c;typeof u=="string"?u=u:u=El(re.from(u),a.schema);const{from:f}=c,p=f+u.length;Ji({editor:e,from:f,to:p,text:u,rules:t,plugin:o})}),r.selectionSet||r.docChanged?null:i}},props:{handleTextInput(r,i,a,l){return Ji({editor:e,from:i,to:a,text:l,rules:t,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:i}=r.state.selection;i&&Ji({editor:e,from:i.pos,to:i.pos,text:"",rules:t,plugin:o})}),!1)},handleKeyDown(r,i){if(i.key!=="Enter")return!1;const{$cursor:a}=r.state.selection;return a?Ji({editor:e,from:a.pos,to:a.pos,text:`
|
|
356
|
+
`,rules:t,plugin:o}):!1}},isInputRules:!0});return o}function EE(n){return Object.prototype.toString.call(n).slice(8,-1)}function Xi(n){return EE(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Jp(n,e){const t={...n};return Xi(n)&&Xi(e)&&Object.keys(e).forEach(o=>{Xi(e[o])&&Xi(n[o])?t[o]=Jp(n[o],e[o]):t[o]=e[o]}),t}var Tl=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...je(Ee(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...je(Ee(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>Jp(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},Ar=class lm extends Tl{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new lm(t)}static handleExit({editor:e,mark:t}){const{tr:o}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const a=r.marks();if(!!!a.find(d=>d?.type.name===t.name))return!1;const c=a.find(d=>d?.type.name===t.name);return c&&o.removeStoredMark(c),o.insertText(" ",r.pos),e.view.dispatch(o),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function wE(n){return typeof n=="number"}var SE=class{constructor(n){this.find=n.find,this.handler=n.handler}},CE=(n,e,t)=>{if(yl(e))return[...n.matchAll(e)];const o=e(n,t);return o?o.map(r=>{const i=[r.text];return i.index=r.index,i.input=n,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function NE(n){const{editor:e,state:t,from:o,to:r,rule:i,pasteEvent:a,dropEvent:l}=n,{commands:c,chain:d,can:u}=new Bi({editor:e,state:t}),f=[];return t.doc.nodesBetween(o,r,(h,m)=>{var g,y,b,z,w;if((y=(g=h.type)==null?void 0:g.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const T=(w=(z=(b=h.content)==null?void 0:b.size)!=null?z:h.nodeSize)!=null?w:0,A=Math.max(o,m),M=Math.min(r,m+T);if(A>=M)return;const k=h.isText?h.text||"":h.textBetween(A-m,M-m,void 0,"");CE(k,i.find,a).forEach(x=>{if(x.index===void 0)return;const B=A+x.index+1,$=B+x[0].length,O={from:t.tr.mapping.map(B),to:t.tr.mapping.map($)},D=i.handler({state:t,range:O,match:x,commands:c,chain:d,can:u,pasteEvent:a,dropEvent:l});f.push(D)})}),f.every(h=>h!==null)}var Yi=null,vE=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function TE(n){const{editor:e,rules:t}=n;let o=null,r=!1,i=!1,a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const c=({state:u,from:f,to:p,rule:h,pasteEvt:m})=>{const g=u.tr,y=Vi({state:u,transaction:g});if(!(!NE({editor:e,state:y,from:Math.max(f-1,0),to:p.b-1,rule:h,pasteEvent:m,dropEvent:l})||!g.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return t.map(u=>new At({view(f){const p=m=>{var g;o=(g=f.dom.parentElement)!=null&&g.contains(m.target)?f.dom.parentElement:null,o&&(Yi=e)},h=()=>{Yi&&(Yi=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(f,p)=>{if(i=o===f.dom.parentElement,l=p,!i){const h=Yi;h?.isEditable&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,p)=>{var h;const m=(h=p.clipboardData)==null?void 0:h.getData("text/html");return a=p,r=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(f,p,h)=>{const m=f[0],g=m.getMeta("uiEvent")==="paste"&&!r,y=m.getMeta("uiEvent")==="drop"&&!i,b=m.getMeta("applyPasteRules"),z=!!b;if(!g&&!y&&!z)return;if(z){let{text:A}=b;typeof A=="string"?A=A:A=El(re.from(A),h.schema);const{from:M}=b,k=M+A.length,E=vE(A);return c({rule:u,state:h,from:M,to:{b:k},pasteEvt:E})}const w=p.doc.content.findDiffStart(h.doc.content),T=p.doc.content.findDiffEnd(h.doc.content);if(!(!wE(w)||!T||w===T.b))return c({rule:u,state:h,from:w,to:T,pasteEvt:a})}}))}var Qi=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=Vp(n),this.schema=$k(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Gi(e.name,this.schema)},o=Ee(e,"addCommands",t);return o?{...n,...o()}:n},{})}get plugins(){const{editor:n}=this;return qi([...this.extensions].reverse()).flatMap(o=>{const r={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:n,type:Gi(o.name,this.schema)},i=[],a=Ee(o,"addKeyboardShortcuts",r);let l={};if(o.type==="mark"&&Ee(o,"exitable",r)&&(l.ArrowRight=()=>Ar.handleExit({editor:n,mark:o})),a){const p=Object.fromEntries(Object.entries(a()).map(([h,m])=>[h,()=>m({editor:n})]));l={...l,...p}}const c=Bx(l);i.push(c);const d=Ee(o,"addInputRules",r);if(Up(o,n.options.enableInputRules)&&d){const p=d();if(p&&p.length){const h=kE({editor:n,rules:p}),m=Array.isArray(h)?h:[h];i.push(...m)}}const u=Ee(o,"addPasteRules",r);if(Up(o,n.options.enablePasteRules)&&u){const p=u();if(p&&p.length){const h=TE({editor:n,rules:p});i.push(...h)}}const f=Ee(o,"addProseMirrorPlugins",r);if(f){const p=f();i.push(...p)}return i})}get attributes(){return Pp(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=qo(this.extensions);return Object.fromEntries(e.filter(t=>!!Ee(t,"addNodeView")).map(t=>{const o=this.attributes.filter(c=>c.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:tt(t.name,this.schema)},i=Ee(t,"addNodeView",r);if(!i)return[];const a=i();if(!a)return[];const l=(c,d,u,f,p)=>{const h=Mr(c,o);return a({node:c,view:d,getPos:u,decorations:f,innerDecorations:p,editor:n,extension:t,HTMLAttributes:h})};return[t.name,l]}))}dispatchTransaction(n){const{editor:e}=this;return qi([...this.extensions].reverse()).reduceRight((o,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Gi(r.name,this.schema)},a=Ee(r,"dispatchTransaction",i);return a?l=>{a.call(i,{transaction:l,next:o})}:o},n)}get markViews(){const{editor:n}=this,{markExtensions:e}=qo(this.extensions);return Object.fromEntries(e.filter(t=>!!Ee(t,"addMarkView")).map(t=>{const o=this.attributes.filter(l=>l.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:zn(t.name,this.schema)},i=Ee(t,"addMarkView",r);if(!i)return[];const a=(l,c,d)=>{const u=Mr(l,o);return i()({mark:l,view:c,inline:d,editor:n,extension:t,HTMLAttributes:u,updateAttributes:f=>{VE(l,n,f)}})};return[t.name,a]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const o={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Gi(e.name,this.schema)};e.type==="mark"&&((t=je(Ee(e,"keepOnSplit",o)))==null||t)&&this.splittableMarks.push(e.name);const r=Ee(e,"onBeforeCreate",o),i=Ee(e,"onCreate",o),a=Ee(e,"onUpdate",o),l=Ee(e,"onSelectionUpdate",o),c=Ee(e,"onTransaction",o),d=Ee(e,"onFocus",o),u=Ee(e,"onBlur",o),f=Ee(e,"onDestroy",o);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),a&&this.editor.on("update",a),l&&this.editor.on("selectionUpdate",l),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),u&&this.editor.on("blur",u),f&&this.editor.on("destroy",f)})}};Qi.resolve=Vp,Qi.sort=qi,Qi.flatten=kl;var zE={};gl(zE,{ClipboardTextSerializer:()=>Xp,Commands:()=>Yp,Delete:()=>Qp,Drop:()=>Zp,Editable:()=>eh,FocusEvents:()=>nh,Keymap:()=>oh,Paste:()=>rh,Tabindex:()=>ih,TextDirection:()=>sh,focusEventsPluginKey:()=>th});var Wt=class cm extends Tl{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new cm(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},Xp=Wt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new At({key:new rn("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:o,selection:r}=e,{ranges:i}=r,a=Math.min(...i.map(u=>u.$from.pos)),l=Math.max(...i.map(u=>u.$to.pos)),c=Fp(t);return Bp(o,{from:a,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),Yp=Wt.create({name:"commands",addCommands(){return{...Sp}}}),Qp=Wt.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,o,r;const i=()=>{var a,l,c,d;if((d=(c=(l=(a=this.editor.options.coreExtensionOptions)==null?void 0:a.delete)==null?void 0:l.filterTransaction)==null?void 0:c.call(l,n))!=null?d:n.getMeta("y-sync$"))return;const u=Op(n.before,[n,...e]);Hp(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(m,g)=>{const y=g+m.nodeSize-2,b=h.oldRange.from<=g&&y<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:y,newFrom:u.mapping.map(g),newTo:u.mapping.map(y),deletedRange:h.oldRange,newRange:h.newRange,partial:!b,editor:this.editor,transaction:n,combinedTransform:u})})});const p=u.mapping;u.steps.forEach((h,m)=>{var g,y;if(h instanceof on){const b=p.slice(m).map(h.from,-1),z=p.slice(m).map(h.to),w=p.invert().map(b,-1),T=p.invert().map(z),A=(g=u.doc.nodeAt(b-1))==null?void 0:g.marks.some(k=>k.eq(h.mark)),M=(y=u.doc.nodeAt(z))==null?void 0:y.marks.some(k=>k.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:w,to:T},newRange:{from:b,to:z},partial:!!(M||A),editor:this.editor,transaction:n,combinedTransform:u})}})};(r=(o=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:o.async)==null||r?setTimeout(i,0):i()}}),Zp=Wt.create({name:"drop",addProseMirrorPlugins(){return[new At({key:new rn("tiptapDrop"),props:{handleDrop:(n,e,t,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:o})}}})]}}),eh=Wt.create({name:"editable",addProseMirrorPlugins(){return[new At({key:new rn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),th=new rn("focusEvents"),nh=Wt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new At({key:th,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const o=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,t)=>{n.isFocused=!1;const o=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),oh=Wt.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.command(({tr:l})=>{const{selection:c,doc:d}=l,{empty:u,$anchor:f}=c,{pos:p,parent:h}=f,m=f.parent.isTextblock&&p>0?l.doc.resolve(p-1):f,g=m.parent.type.spec.isolating,y=f.pos-f.parentOffset,b=g&&m.parent.childCount===1?y===f.pos:Pe.atStart(d).from===p;return!u||!h.type.isTextblock||h.textContent.length||!b||b&&f.parent.type.name==="paragraph"?!1:a.clearNodes()}),()=>a.deleteSelection(),()=>a.joinBackward(),()=>a.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:a})=>[()=>a.deleteSelection(),()=>a.deleteCurrentNode(),()=>a.joinForward(),()=>a.selectNodeForward()]),o={Enter:()=>this.editor.commands.first(({commands:a})=>[()=>a.newlineInCode(),()=>a.createParagraphNear(),()=>a.liftEmptyBlock(),()=>a.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...o},i={...o,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ji()||Ap()?i:r},addProseMirrorPlugins(){return[new At({key:new rn("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const o=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),r=n.some(g=>g.getMeta("preventClearDocument"));if(!o||r)return;const{empty:i,from:a,to:l}=e.selection,c=Pe.atStart(e.doc).from,d=Pe.atEnd(e.doc).to;if(i||!(a===c&&l===d)||!Cl(t.doc))return;const p=t.tr,h=Vi({state:t,transaction:p}),{commands:m}=new Bi({editor:this.editor,state:h});if(m.clearNodes(),!!p.steps.length)return p}})]}}),rh=Wt.create({name:"paste",addProseMirrorPlugins(){return[new At({key:new rn("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),ih=Wt.create({name:"tabindex",addProseMirrorPlugins(){return[new At({key:new rn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),sh=Wt.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=qo(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new At({key:new rn("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),ME=class Yo{constructor(e,t,o=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=o,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,o=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,o=this.to-1}this.editor.commands.insertContentAt({from:t,to:o},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Yo(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Yo(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Yo(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,o)=>{const r=t.isBlock&&!t.isTextblock,i=t.isAtom&&!t.isText,a=this.pos+o+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!r&&l.depth<=this.depth)return;const c=new Yo(l,this.editor,r,r?t:null);r&&(c.actualDepth=this.depth+1),e.push(new Yo(l,this.editor,r,r?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let o=null,r=this.parent;for(;r&&!o;){if(r.node.type.name===e)if(Object.keys(t).length>0){const i=r.node.attrs,a=Object.keys(t);for(let l=0;l<a.length;l+=1){const c=a[l];if(i[c]!==t[c])break}}else o=r;r=r.parent}return o}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},o=!1){let r=[];if(!this.children||this.children.length===0)return r;const i=Object.keys(t);return this.children.forEach(a=>{o&&r.length>0||(a.node.type.name===e&&i.every(c=>t[c]===a.node.attrs[c])&&r.push(a),!(o&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,o))))}),r}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},AE=`.ProseMirror {
|
|
361
357
|
position: relative;
|
|
362
358
|
}
|
|
363
359
|
|
|
@@ -427,53 +423,53 @@ img.ProseMirror-separator {
|
|
|
427
423
|
|
|
428
424
|
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
429
425
|
display: block;
|
|
430
|
-
}`;function
|
|
426
|
+
}`;function IE(n,e,t){const o=document.querySelector("style[data-tiptap-style]");if(o!==null)return o;const r=document.createElement("style");return e&&r.setAttribute("nonce",e),r.setAttribute("data-tiptap-style",""),r.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(r),r}var _E=class extends bE{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Jk,createMappablePosition:Xk},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:i,moved:a})=>this.options.onDrop(r,i,a)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const t=this.createDoc(),o=Tp(t,this.options.autofocus);this.editorState=$o.create({doc:t,schema:this.schema,selection:o||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=IE(AE,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const o=Dp(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let o=t;if([].concat(e).forEach(i=>{const a=typeof i=="string"?`${i}$`:i.key;o=o.filter(l=>!l.key.startsWith(a))}),t.length===o.length)return;const r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}createExtensionManager(){var e,t;const r=[...this.options.enableCoreExtensions?[eh,Xp.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),Yp,nh,oh,ih,Zp,rh,Qp,sh.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new Qi(r,this)}createCommandManager(){this.commandManager=new Bi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=xl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(o=>o.name!=="collaboration"),this.createExtensionManager()}}),e=xl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:o}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=o?this.extensionManager.dispatchTransaction(r):r;this.editorView=new yp(e,{...t,attributes:{role:"textbox",...t?.attributes},dispatchTransaction:i,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const l=this.view.dom;l.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(u=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(u)});return}const{state:t,transactions:o}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=o.includes(e),a=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:o.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const l=o.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),c=l?.getMeta("focus"),d=l?.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:l}),d&&this.emit("blur",{editor:this,event:d.event,transaction:l}),!(e.getMeta("preventUpdate")||!o.some(u=>u.docChanged)||a.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:o.slice(1)})}getAttributes(e){return jp(this.state,e)}isActive(e,t){const o=typeof e=="string"?e:null,r=typeof e=="string"?t:e;return qk(this.state,o,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return El(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
|
|
431
427
|
|
|
432
|
-
`,textSerializers:o={}}=e||{};return
|
|
428
|
+
`,textSerializers:o={}}=e||{};return Bk(this.state.doc,{blockSeparator:t,textSerializers:{...Fp(this.schema),...o}})}get isEmpty(){return Cl(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var o;return((o=this.$doc)==null?void 0:o.querySelector(e,t))||null}$nodes(e,t){var o;return((o=this.$doc)==null?void 0:o.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new ME(t,this)}get $doc(){return this.$pos(0)}};function Ir(n){return new Kp({find:n.find,handler:({state:e,range:t,match:o})=>{const r=je(n.getAttributes,void 0,o);if(r===!1||r===null)return null;const{tr:i}=e,a=o[o.length-1],l=o[0];if(a){const c=l.search(/\S/),d=t.from+l.indexOf(a),u=d+a.length;if(wl(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===n.type&&g!==h.mark.type)).filter(h=>h.to>d).length)return null;u<t.to&&i.delete(u,t.to),d>t.from&&i.delete(t.from+c,d);const p=t.from+c+a.length;i.addMark(t.from+c,p,n.type.create(r||{})),i.removeStoredMark(n.type)}},undoable:n.undoable})}function _r(n){return new Kp({find:n.find,handler:({state:e,range:t,match:o,chain:r})=>{const i=je(n.getAttributes,void 0,o)||{},a=e.tr.delete(t.from,t.to),c=a.doc.resolve(t.from).blockRange(),d=c&&_a(c,n.type,i);if(!d)return null;if(a.wrap(c,d),n.keepMarks&&n.editor){const{selection:f,storedMarks:p}=e,{splittableMarks:h}=n.editor.extensionManager,m=p||f.$to.parentOffset&&f.$from.marks();if(m){const g=m.filter(y=>h.includes(y.type.name));a.ensureMarks(g)}}if(n.keepAttributes){const f=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(f,i).run()}const u=a.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&Kn(a.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(o,u))&&a.join(t.from-1)},undoable:n.undoable})}var OE={};gl(OE,{createAtomBlockMarkdownSpec:()=>DE,createBlockMarkdownSpec:()=>PE,createInlineMarkdownSpec:()=>$E,parseAttributes:()=>zl,parseIndentedBlocks:()=>Al,renderNestedMarkdownContent:()=>Il,serializeAttributes:()=>Ml});function zl(n){if(!n?.trim())return{};const e={},t=[],o=n.replace(/["']([^"']*)["']/g,d=>(t.push(d),`__QUOTED_${t.length-1}__`)),r=o.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(r){const d=r.map(u=>u.trim().slice(1));e.class=d.join(" ")}const i=o.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const a=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(o.matchAll(a)).forEach(([,d,u])=>{var f;const p=parseInt(((f=u.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),h=t[p];h&&(e[d]=h.slice(1,-1))});const c=o.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return c&&c.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function Ml(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(o=>e.push(`.${o}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,o])=>{t==="class"||t==="id"||(o===!0?e.push(t):o!==!1&&o!=null&&e.push(`${t}="${String(o)}"`))}),e.join(" ")}function DE(n){const{nodeName:e,name:t,parseAttributes:o=zl,serializeAttributes:r=Ml,defaultAttributes:i={},requiredAttributes:a=[],allowedAttributes:l}=n,c=t||e,d=u=>{if(!l)return u;const f={};return l.forEach(p=>{p in u&&(f[p]=u[p])}),f};return{parseMarkdown:(u,f)=>{const p={...i,...u.attributes};return f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"block",start(u){var f;const p=new RegExp(`^:::${c}(?:\\s|$)`,"m"),h=(f=u.match(p))==null?void 0:f.index;return h!==void 0?h:-1},tokenize(u,f,p){const h=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=u.match(h);if(!m)return;const g=m[1]||"",y=o(g);if(!a.find(z=>!(z in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:u=>{const f=d(u.attrs||{}),p=r(f),h=p?` {${p}}`:"";return`:::${c}${h} :::`}}}function PE(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=zl,serializeAttributes:i=Ml,defaultAttributes:a={},content:l="block",allowedAttributes:c}=n,d=t||e,u=f=>{if(!c)return f;const p={};return c.forEach(h=>{h in f&&(p[h]=f[h])}),p};return{parseMarkdown:(f,p)=>{let h;if(o){const g=o(f);h=typeof g=="string"?[{type:"text",text:g}]:g}else l==="block"?h=p.parseChildren(f.tokens||[]):h=p.parseInline(f.tokens||[]);const m={...a,...f.attributes};return p.createNode(e,m,h)},markdownTokenizer:{name:e,level:"block",start(f){var p;const h=new RegExp(`^:::${d}`,"m"),m=(p=f.match(h))==null?void 0:p.index;return m!==void 0?m:-1},tokenize(f,p,h){var m;const g=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=f.match(g);if(!y)return;const[b,z=""]=y,w=r(z);let T=1;const A=b.length;let M="";const k=/^:::([\w-]*)(\s.*)?/gm,E=f.slice(A);for(k.lastIndex=0;;){const x=k.exec(E);if(x===null)break;const B=x.index,$=x[1];if(!((m=x[2])!=null&&m.endsWith(":::"))){if($)T+=1;else if(T-=1,T===0){const O=E.slice(0,B);M=O.trim();const D=f.slice(0,A+B+x[0].length);let P=[];if(M)if(l==="block")for(P=h.blockTokens(O),P.forEach(q=>{q.text&&(!q.tokens||q.tokens.length===0)&&(q.tokens=h.inlineTokens(q.text))});P.length>0;){const q=P[P.length-1];if(q.type==="paragraph"&&(!q.text||q.text.trim()===""))P.pop();else break}else P=h.inlineTokens(M);return{type:e,raw:D,attributes:w,content:M,tokens:P}}}}}},renderMarkdown:(f,p)=>{const h=u(f.attrs||{}),m=i(h),g=m?` {${m}}`:"",y=p.renderChildren(f.content||[],`
|
|
433
429
|
|
|
434
|
-
`);return`:::${d}${
|
|
430
|
+
`);return`:::${d}${g}
|
|
435
431
|
|
|
436
|
-
${
|
|
432
|
+
${y}
|
|
437
433
|
|
|
438
|
-
:::`}}}function
|
|
434
|
+
:::`}}}function RE(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let o=t.exec(n);for(;o!==null;){const[,r,i,a]=o;e[r]=i||a,o=t.exec(n)}return e}function LE(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function $E(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=RE,serializeAttributes:i=LE,defaultAttributes:a={},selfClosing:l=!1,allowedAttributes:c}=n,d=t||e,u=p=>{if(!c)return p;const h={};return c.forEach(m=>{const g=typeof m=="string"?m:m.name,y=typeof m=="string"?void 0:m.skipIfDefault;if(g in p){const b=p[g];if(y!==void 0&&b===y)return;h[g]=b}}),h},f=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(p,h)=>{const m={...a,...p.attributes};if(l)return h.createNode(e,m);const g=o?o(p):p.content||"";return g?h.createNode(e,m,[h.createTextNode(g)]):h.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(p){const h=l?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),m=p.match(h),g=m?.index;return g!==void 0?g:-1},tokenize(p,h,m){const g=l?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),y=p.match(g);if(!y)return;let b="",z="";if(l){const[,T]=y;z=T}else{const[,T,A]=y;z=T,b=A||""}const w=r(z.trim());return{type:e,raw:y[0],content:b.trim(),attributes:w}}},renderMarkdown:p=>{let h="";o?h=o(p):p.content&&p.content.length>0&&(h=p.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const m=u(p.attrs||{}),g=i(m),y=g?` ${g}`:"";return l?`[${d}${y}]`:`[${d}${y}]${h}[/${d}]`}}}function Al(n,e,t){var o,r,i,a;const l=n.split(`
|
|
439
435
|
`),c=[];let d="",u=0;const f=e.baseIndentSize||2;for(;u<l.length;){const p=l[u],h=p.match(e.itemPattern);if(!h){if(c.length>0)break;if(p.trim()===""){u+=1,d=`${d}${p}
|
|
440
|
-
`;continue}else return}const m=e.extractItemData(h),{indentLevel:
|
|
441
|
-
`;const
|
|
442
|
-
`,u+=1;continue}else break}if((((
|
|
443
|
-
`,u+=1;else break}let
|
|
444
|
-
`);
|
|
436
|
+
`;continue}else return}const m=e.extractItemData(h),{indentLevel:g,mainContent:y}=m;d=`${d}${p}
|
|
437
|
+
`;const b=[y];for(u+=1;u<l.length;){const A=l[u];if(A.trim()===""){const k=l.slice(u+1).findIndex(B=>B.trim()!=="");if(k===-1)break;if((((r=(o=l[u+1+k].match(/^(\s*)/))==null?void 0:o[1])==null?void 0:r.length)||0)>g){b.push(A),d=`${d}${A}
|
|
438
|
+
`,u+=1;continue}else break}if((((a=(i=A.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:a.length)||0)>g)b.push(A),d=`${d}${A}
|
|
439
|
+
`,u+=1;else break}let z;const w=b.slice(1);if(w.length>0){const A=w.map(M=>M.slice(g+f)).join(`
|
|
440
|
+
`);A.trim()&&(e.customNestedParser?z=e.customNestedParser(A):z=t.blockTokens(A))}const T=e.createToken(m,z);c.push(T)}if(c.length!==0)return{items:c,raw:d}}function Il(n,e,t,o){if(!n||!Array.isArray(n.content))return"";const r=typeof t=="function"?t(o):t,[i,...a]=n.content,l=e.renderChildren([i]),c=[`${r}${l}`];return a&&a.length>0&&a.forEach(d=>{const u=e.renderChildren([d]);if(u){const f=u.split(`
|
|
445
441
|
`).map(p=>p?e.indent(p):"").join(`
|
|
446
442
|
`);c.push(f)}}),c.join(`
|
|
447
|
-
`)}function
|
|
443
|
+
`)}function VE(n,e,t={}){const{state:o}=e,{doc:r,tr:i}=o,a=n;r.descendants((l,c)=>{const d=i.mapping.map(c),u=i.mapping.map(c)+l.nodeSize;let f=null;if(l.marks.forEach(h=>{if(h!==a)return!1;f=h}),!f)return;let p=!1;if(Object.keys(t).forEach(h=>{t[h]!==f.attrs[h]&&(p=!0)}),p){const h=n.type.create({...n.attrs,...t});i.removeMark(d,u,n.type),i.addMark(d,u,h)}}),i.docChanged&&e.view.dispatch(i)}var Mn=class dm extends Tl{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new dm(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function Go(n){return new SE({find:n.find,handler:({state:e,range:t,match:o,pasteEvent:r})=>{const i=je(n.getAttributes,void 0,o,r);if(i===!1||i===null)return null;const{tr:a}=e,l=o[o.length-1],c=o[0];let d=t.to;if(l){const u=c.search(/\S/),f=t.from+c.indexOf(l),p=f+l.length;if(wl(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===n.type&&y!==m.mark.type)).filter(m=>m.to>f).length)return null;p<t.to&&a.delete(p,t.to),f>t.from&&a.delete(t.from+u,f),d=t.from+u+l.length,a.addMark(t.from+u,d,n.type.create(i||{})),a.removeStoredMark(n.type)}}})}function ah(n){return s.customRef((e,t)=>({get(){return e(),n},set(o){n=o,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var BE=class extends _E{constructor(n={}){return super(n),this.contentComponent=null,this.appContext=null,this.reactiveState=ah(this.view.state),this.reactiveExtensionStorage=ah(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),s.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(n,e){const t=super.registerPlugin(n,e);return this.reactiveState&&(this.reactiveState.value=t),t}unregisterPlugin(n){const e=super.unregisterPlugin(n);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},FE=s.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=s.ref(),t=s.getCurrentInstance();return s.watchEffect(()=>{const o=n.editor;o&&o.options.element&&e.value&&s.nextTick(()=>{var r;if(!e.value||!((r=o.view.dom)!=null&&r.parentNode))return;const i=s.unref(e.value);e.value.append(...o.view.dom.parentNode.childNodes),o.contentComponent=t.ctx._,t&&(o.appContext={...t.appContext,provides:t.provides}),o.setOptions({element:i}),o.createNodeViews()})}),s.onBeforeUnmount(()=>{const o=n.editor;o&&(o.contentComponent=null,o.appContext=null)}),{rootEl:e}},render(){return s.h("div",{ref:n=>{this.rootEl=n}})}});s.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return s.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),s.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,e;return s.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(n=this.$slots).default)==null?void 0:e.call(n))}});var jE=(n={})=>{const e=s.shallowRef();return s.onMounted(()=>{e.value=new BE(n)}),s.onBeforeUnmount(()=>{var t,o,r,i;const a=(o=(t=e.value)==null?void 0:t.view.dom)==null?void 0:o.parentNode,l=a?.cloneNode(!0);(r=a?.parentNode)==null||r.replaceChild(l,a),(i=e.value)==null||i.destroy()}),e};s.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return s.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});var HE=Mn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
448
444
|
|
|
449
|
-
`):""}),
|
|
450
|
-
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:
|
|
451
|
-
`,f+=1;else if(h.match(
|
|
445
|
+
`):""}),UE=HE,WE=Mn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",_t(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];return t.length===1&&t[0].type==="image"?e.parseChildren([t[0]]):e.createNode("paragraph",void 0,e.parseInline(t))},renderMarkdown:(n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),qE=WE,GE=Mn.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),KE=GE,lh=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...o}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,o,t]},JE=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,XE=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,YE=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,QE=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,ZE=Ar.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return lh("strong",{..._t(this.options.HTMLAttributes,n),children:lh("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Ir({find:JE,type:this.type}),Ir({find:YE,type:this.type})]},addPasteRules(){return[Go({find:XE,type:this.type}),Go({find:QE,type:this.type})]}}),ew=ZE,tw=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,nw=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,ow=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,rw=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,iw=Ar.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",_t(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Ir({find:tw,type:this.type}),Ir({find:ow,type:this.type})]},addPasteRules(){return[Go({find:nw,type:this.type}),Go({find:rw,type:this.type})]}}),sw=iw,aw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,lw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,cw=Ar.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",_t(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ir({find:aw,type:this.type})]},addPasteRules(){return[Go({find:lw,type:this.type})]}}),dw=cw,uw=Object.defineProperty,fw=(n,e)=>{for(var t in e)uw(n,t,{get:e[t],enumerable:!0})},pw="listItem",ch="textStyle",dh=/^\s*([-+*])\s$/,uh=Mn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",_t(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
446
|
+
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(pw,this.editor.getAttributes(ch)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=_r({find:dh,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=_r({find:dh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ch),editor:this.editor})),[n]}}),fh=Mn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",_t(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{if(n.type!=="list_item")return[];let t=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(r=>r.type==="paragraph"))t=e.parseChildren(n.tokens);else{const r=n.tokens[0];if(r&&r.type==="text"&&r.tokens&&r.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(r.tokens)}],n.tokens.length>1){const a=n.tokens.slice(1),l=e.parseChildren(a);t.push(...l)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(n,e,t)=>Il(n,e,o=>o.parentType==="bulletList"?"- ":o.parentType==="orderedList"?`${o.index+1}. `:"- ",t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),hw={};fw(hw,{findListItemPos:()=>Or,getNextListDepth:()=>_l,handleBackspace:()=>Ol,handleDelete:()=>Dl,hasListBefore:()=>ph,hasListItemAfter:()=>mw,hasListItemBefore:()=>hh,listItemHasSubList:()=>mh,nextListIsDeeper:()=>gh,nextListIsHigher:()=>yh});var Or=(n,e)=>{const{$from:t}=e.selection,o=tt(n,e.schema);let r=null,i=t.depth,a=t.pos,l=null;for(;i>0&&l===null;)r=t.node(i),r.type===o?l=i:(i-=1,a-=1);return l===null?null:{$pos:e.doc.resolve(a),depth:l}},_l=(n,e)=>{const t=Or(n,e);if(!t)return!1;const[,o]=Uk(e,n,t.$pos.pos+4);return o},ph=(n,e,t)=>{const{$anchor:o}=n.selection,r=Math.max(0,o.pos-2),i=n.doc.resolve(r).node();return!(!i||!t.includes(i.type.name))},hh=(n,e)=>{var t;const{$anchor:o}=e.selection,r=e.doc.resolve(o.pos-2);return!(r.index()===0||((t=r.nodeBefore)==null?void 0:t.type.name)!==n)},mh=(n,e,t)=>{if(!t)return!1;const o=tt(n,e.schema);let r=!1;return t.descendants(i=>{i.type===o&&(r=!0)}),r},Ol=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!ro(n.state,e)&&ph(n.state,e,t)){const{$anchor:l}=n.state.selection,c=n.state.doc.resolve(l.before()-1),d=[];c.node().descendants((p,h)=>{p.type.name===e&&d.push({node:p,pos:h})});const u=d.at(-1);if(!u)return!1;const f=n.state.doc.resolve(c.start()+u.pos+1);return n.chain().cut({from:l.start()-1,to:l.end()+1},f.end()).joinForward().run()}if(!ro(n.state,e)||!Kk(n.state))return!1;const o=Or(e,n.state);if(!o)return!1;const i=n.state.doc.resolve(o.$pos.pos-2).node(o.depth),a=mh(e,n.state,i);return hh(e,n.state)&&!a?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},gh=(n,e)=>{const t=_l(n,e),o=Or(n,e);return!o||!t?!1:t>o.depth},yh=(n,e)=>{const t=_l(n,e),o=Or(n,e);return!o||!t?!1:t<o.depth},Dl=(n,e)=>{if(!ro(n.state,e)||!Gk(n.state,e))return!1;const{selection:t}=n.state,{$from:o,$to:r}=t;return!t.empty&&o.sameParent(r)?!1:gh(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():yh(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},mw=(n,e)=>{var t;const{$anchor:o}=e.selection,r=e.doc.resolve(o.pos-o.parentOffset-2);return!(r.index()===r.parent.childCount-1||((t=r.nodeAfter)==null?void 0:t.type.name)!==n)},gw=Wt.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Dl(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Dl(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:o})=>{n.state.schema.nodes[t]!==void 0&&Ol(n,t,o)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:o})=>{n.state.schema.nodes[t]!==void 0&&Ol(n,t,o)&&(e=!0)}),e}}}}),bh=/^(\s*)(\d+)\.\s+(.*)$/,yw=/^\s/;function bw(n){const e=[];let t=0,o=0;for(;t<n.length;){const r=n[t],i=r.match(bh);if(!i)break;const[,a,l,c]=i,d=a.length;let u=c,f=t+1;const p=[r];for(;f<n.length;){const h=n[f];if(h.match(bh))break;if(h.trim()==="")p.push(h),u+=`
|
|
447
|
+
`,f+=1;else if(h.match(yw))p.push(h),u+=`
|
|
452
448
|
${h.slice(d+2)}`,f+=1;else break}e.push({indent:d,number:parseInt(l,10),content:u.trim(),raw:p.join(`
|
|
453
|
-
`)}),o=f,
|
|
454
|
-
`),c=((o=l[0])==null?void 0:o.trim())||"",d=[];c&&d.push({type:"paragraph",raw:c,tokens:
|
|
455
|
-
`).trim();if(u){const h=
|
|
456
|
-
`)})}r.push({type:"list_item",raw:
|
|
457
|
-
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:
|
|
458
|
-
`),[i,
|
|
459
|
-
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:
|
|
460
|
-
`):"",markdownTokenizer:{name:"taskList",level:"block",start(
|
|
449
|
+
`)}),o=f,t=f}return[e,o]}function xh(n,e,t){var o;const r=[];let i=0;for(;i<n.length;){const a=n[i];if(a.indent===e){const l=a.content.split(`
|
|
450
|
+
`),c=((o=l[0])==null?void 0:o.trim())||"",d=[];c&&d.push({type:"paragraph",raw:c,tokens:t.inlineTokens(c)});const u=l.slice(1).join(`
|
|
451
|
+
`).trim();if(u){const h=t.blockTokens(u);d.push(...h)}let f=i+1;const p=[];for(;f<n.length&&n[f].indent>e;)p.push(n[f]),f+=1;if(p.length>0){const h=Math.min(...p.map(g=>g.indent)),m=xh(p,h,t);d.push({type:"list",ordered:!0,start:p[0].number,items:m,raw:p.map(g=>g.raw).join(`
|
|
452
|
+
`)})}r.push({type:"list_item",raw:a.raw,tokens:d}),i=f}else i+=1}return r}function xw(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const o=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(r=>{if(r.type==="paragraph"||r.type==="list"||r.type==="blockquote"||r.type==="code")o.push(...e.parseChildren([r]));else if(r.type==="text"&&r.tokens){const i=e.parseChildren([r]);o.push({type:"paragraph",content:i})}else{const i=e.parseChildren([r]);i.length>0&&o.push(...i)}}),{type:"listItem",content:o}})}var kw="listItem",kh="textStyle",Eh=/^(\d+)\.\s$/,wh=Mn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",_t(this.options.HTMLAttributes,t),0]:["ol",_t(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,o=n.items?xw(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:o}:{type:"orderedList",content:o}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
453
|
+
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e?.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var o;const r=n.split(`
|
|
454
|
+
`),[i,a]=bw(r);if(i.length===0)return;const l=xh(i,0,t);return l.length===0?void 0:{type:"list",ordered:!0,start:((o=i[0])==null?void 0:o.number)||1,items:l,raw:r.slice(0,a).join(`
|
|
455
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(kw,this.editor.getAttributes(kh)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=_r({find:Eh,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=_r({find:Eh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(kh)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),Ew=/^\s*(\[([( |x])?\])\s$/,ww=Mn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",_t(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const o=e.parseChildren(n.nestedTokens);t.push(...o)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const r=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Il(n,e,r)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:o})=>{const r=document.createElement("li"),i=document.createElement("label"),a=document.createElement("span"),l=document.createElement("input"),c=document.createElement("div"),d=f=>{var p,h;l.ariaLabel=((h=(p=this.options.a11y)==null?void 0:p.checkboxLabel)==null?void 0:h.call(p,f,l.checked))||`Task item checkbox for ${f.textContent||"empty task item"}`};d(n),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",f=>f.preventDefault()),l.addEventListener("change",f=>{if(!o.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:p}=f.target;o.isEditable&&typeof t=="function"&&o.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const m=t();if(typeof m!="number")return!1;const g=h.doc.nodeAt(m);return h.setNodeMarkup(m,void 0,{...g?.attrs,checked:p}),!0}).run(),!o.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,p)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{r.setAttribute(f,p)}),r.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,i.append(l,a),r.append(i,c),Object.entries(e).forEach(([f,p])=>{r.setAttribute(f,p)});let u=new Set(Object.keys(e));return{dom:r,contentDOM:c,update:f=>{if(f.type!==this.type)return!1;r.dataset.checked=f.attrs.checked,l.checked=f.attrs.checked,d(f);const p=o.extensionManager.attributes,h=Mr(f,p),m=new Set(Object.keys(h)),g=this.options.HTMLAttributes;return u.forEach(y=>{m.has(y)||(y in g?r.setAttribute(y,g[y]):r.removeAttribute(y))}),Object.entries(h).forEach(([y,b])=>{b==null?y in g?r.setAttribute(y,g[y]):r.removeAttribute(y):r.setAttribute(y,b)}),u=m,!0}}}},addInputRules(){return[_r({find:Ew,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),Sw=Mn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",_t(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
456
|
+
`):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const o=i=>{const a=Al(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,c)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:c}),customNestedParser:o},t);return a?[{type:"taskList",raw:a.raw,items:a.items}]:t.blockTokens(i)},r=Al(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,a)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:t.inlineTokens(i.mainContent),nestedTokens:a}),customNestedParser:o},t);if(r)return{type:"taskList",raw:r.raw,items:r.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Wt.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(uh.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(fh.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(gw.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(wh.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(ww.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Sw.configure(this.options.taskList)),n}});var Cw=uh,Nw=wh,vw=fh,Tw=Mn.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",_t(this.options.HTMLAttributes,n)]},renderText(){return`
|
|
461
457
|
`},renderMarkdown:()=>`
|
|
462
|
-
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:
|
|
463
|
-
`,
|
|
458
|
+
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:o})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:r,storedMarks:i}=t;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:a}=this.options,{splittableMarks:l}=o.extensionManager,c=i||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:u})=>{if(u&&c&&a){const f=c.filter(p=>l.includes(p.type.name));d.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),zw=Tw;const Mw="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Aw="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Pl="numeric",Rl="ascii",Ll="alpha",Dr="asciinumeric",Pr="alphanumeric",$l="domain",Sh="emoji",Iw="scheme",_w="slashscheme",Vl="whitespace";function Ow(n,e){return n in e||(e[n]=[]),e[n]}function vo(n,e,t){e[Pl]&&(e[Dr]=!0,e[Pr]=!0),e[Rl]&&(e[Dr]=!0,e[Ll]=!0),e[Dr]&&(e[Pr]=!0),e[Ll]&&(e[Pr]=!0),e[Pr]&&(e[$l]=!0),e[Sh]&&(e[$l]=!0);for(const o in e){const r=Ow(o,t);r.indexOf(n)<0&&r.push(n)}}function Dw(n,e){const t={};for(const o in e)e[o].indexOf(n)>=0&&(t[o]=!0);return t}function Ot(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}Ot.groups={},Ot.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let o=0;o<e.jr.length;o++){const r=e.jr[o][0],i=e.jr[o][1];if(i&&r.test(n))return i}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,o){for(let r=0;r<n.length;r++)this.tt(n[r],e,t,o)},tr(n,e,t,o){o=o||Ot.groups;let r;return e&&e.j?r=e:(r=new Ot(e),t&&o&&vo(e,t,o)),this.jr.push([n,r]),r},ts(n,e,t,o){let r=this;const i=n.length;if(!i)return r;for(let a=0;a<i-1;a++)r=r.tt(n[a]);return r.tt(n[i-1],e,t,o)},tt(n,e,t,o){o=o||Ot.groups;const r=this;if(e&&e.j)return r.j[n]=e,e;const i=e;let a,l=r.go(n);if(l?(a=new Ot,Object.assign(a.j,l.j),a.jr.push.apply(a.jr,l.jr),a.jd=l.jd,a.t=l.t):a=new Ot,i){if(o)if(a.t&&typeof a.t=="string"){const c=Object.assign(Dw(a.t,o),t);vo(i,c,o)}else t&&vo(i,t,o);a.t=i}return r.j[n]=a,a}};const Me=(n,e,t,o,r)=>n.ta(e,t,o,r),Je=(n,e,t,o,r)=>n.tr(e,t,o,r),Ch=(n,e,t,o,r)=>n.ts(e,t,o,r),se=(n,e,t,o,r)=>n.tt(e,t,o,r),An="WORD",Bl="UWORD",Nh="ASCIINUMERICAL",vh="ALPHANUMERICAL",Rr="LOCALHOST",Fl="TLD",jl="UTLD",Zi="SCHEME",Ko="SLASH_SCHEME",Hl="NUM",Ul="WS",Wl="NL",Lr="OPENBRACE",$r="CLOSEBRACE",es="OPENBRACKET",ts="CLOSEBRACKET",ns="OPENPAREN",rs="CLOSEPAREN",is="OPENANGLEBRACKET",ss="CLOSEANGLEBRACKET",as="FULLWIDTHLEFTPAREN",ls="FULLWIDTHRIGHTPAREN",cs="LEFTCORNERBRACKET",ds="RIGHTCORNERBRACKET",us="LEFTWHITECORNERBRACKET",fs="RIGHTWHITECORNERBRACKET",ps="FULLWIDTHLESSTHAN",hs="FULLWIDTHGREATERTHAN",ms="AMPERSAND",gs="APOSTROPHE",ys="ASTERISK",io="AT",bs="BACKSLASH",xs="BACKTICK",ks="CARET",so="COLON",ql="COMMA",Es="DOLLAR",pn="DOT",ws="EQUALS",Gl="EXCLAMATION",qt="HYPHEN",Vr="PERCENT",Ss="PIPE",Cs="PLUS",Ns="POUND",Br="QUERY",Kl="QUOTE",Th="FULLWIDTHMIDDLEDOT",Jl="SEMI",hn="SLASH",Fr="TILDE",vs="UNDERSCORE",zh="EMOJI",Ts="SYM";var Mh=Object.freeze({__proto__:null,ALPHANUMERICAL:vh,AMPERSAND:ms,APOSTROPHE:gs,ASCIINUMERICAL:Nh,ASTERISK:ys,AT:io,BACKSLASH:bs,BACKTICK:xs,CARET:ks,CLOSEANGLEBRACKET:ss,CLOSEBRACE:$r,CLOSEBRACKET:ts,CLOSEPAREN:rs,COLON:so,COMMA:ql,DOLLAR:Es,DOT:pn,EMOJI:zh,EQUALS:ws,EXCLAMATION:Gl,FULLWIDTHGREATERTHAN:hs,FULLWIDTHLEFTPAREN:as,FULLWIDTHLESSTHAN:ps,FULLWIDTHMIDDLEDOT:Th,FULLWIDTHRIGHTPAREN:ls,HYPHEN:qt,LEFTCORNERBRACKET:cs,LEFTWHITECORNERBRACKET:us,LOCALHOST:Rr,NL:Wl,NUM:Hl,OPENANGLEBRACKET:is,OPENBRACE:Lr,OPENBRACKET:es,OPENPAREN:ns,PERCENT:Vr,PIPE:Ss,PLUS:Cs,POUND:Ns,QUERY:Br,QUOTE:Kl,RIGHTCORNERBRACKET:ds,RIGHTWHITECORNERBRACKET:fs,SCHEME:Zi,SEMI:Jl,SLASH:hn,SLASH_SCHEME:Ko,SYM:Ts,TILDE:Fr,TLD:Fl,UNDERSCORE:vs,UTLD:jl,UWORD:Bl,WORD:An,WS:Ul});const In=/[a-z]/,jr=new RegExp("\\p{L}","u"),Xl=new RegExp("\\p{Emoji}","u"),_n=/\d/,Yl=/\s/,Ah="\r",Ql=`
|
|
459
|
+
`,Pw="️",Rw="",Zl="";let zs=null,Ms=null;function Lw(n=[]){const e={};Ot.groups=e;const t=new Ot;zs==null&&(zs=_h(Mw)),Ms==null&&(Ms=_h(Aw)),se(t,"'",gs),se(t,"{",Lr),se(t,"}",$r),se(t,"[",es),se(t,"]",ts),se(t,"(",ns),se(t,")",rs),se(t,"<",is),se(t,">",ss),se(t,"(",as),se(t,")",ls),se(t,"「",cs),se(t,"」",ds),se(t,"『",us),se(t,"』",fs),se(t,"<",ps),se(t,">",hs),se(t,"&",ms),se(t,"*",ys),se(t,"@",io),se(t,"`",xs),se(t,"^",ks),se(t,":",so),se(t,",",ql),se(t,"$",Es),se(t,".",pn),se(t,"=",ws),se(t,"!",Gl),se(t,"-",qt),se(t,"%",Vr),se(t,"|",Ss),se(t,"+",Cs),se(t,"#",Ns),se(t,"?",Br),se(t,'"',Kl),se(t,"/",hn),se(t,";",Jl),se(t,"~",Fr),se(t,"_",vs),se(t,"\\",bs),se(t,"・",Th);const o=Je(t,_n,Hl,{[Pl]:!0});Je(o,_n,o);const r=Je(o,In,Nh,{[Dr]:!0}),i=Je(o,jr,vh,{[Pr]:!0}),a=Je(t,In,An,{[Rl]:!0});Je(a,_n,r),Je(a,In,a),Je(r,_n,r),Je(r,In,r);const l=Je(t,jr,Bl,{[Ll]:!0});Je(l,In),Je(l,_n,i),Je(l,jr,l),Je(i,_n,i),Je(i,In),Je(i,jr,i);const c=se(t,Ql,Wl,{[Vl]:!0}),d=se(t,Ah,Ul,{[Vl]:!0}),u=Je(t,Yl,Ul,{[Vl]:!0});se(t,Zl,u),se(d,Ql,c),se(d,Zl,u),Je(d,Yl,u),se(u,Ah),se(u,Ql),Je(u,Yl,u),se(u,Zl,u);const f=Je(t,Xl,zh,{[Sh]:!0});se(f,"#"),Je(f,Xl,f),se(f,Pw,f);const p=se(f,Rw);se(p,"#"),Je(p,Xl,f);const h=[[In,a],[_n,r]],m=[[In,null],[jr,l],[_n,i]];for(let g=0;g<zs.length;g++)ao(t,zs[g],Fl,An,h);for(let g=0;g<Ms.length;g++)ao(t,Ms[g],jl,Bl,m);vo(Fl,{tld:!0,ascii:!0},e),vo(jl,{utld:!0,alpha:!0},e),ao(t,"file",Zi,An,h),ao(t,"mailto",Zi,An,h),ao(t,"http",Ko,An,h),ao(t,"https",Ko,An,h),ao(t,"ftp",Ko,An,h),ao(t,"ftps",Ko,An,h),vo(Zi,{scheme:!0,ascii:!0},e),vo(Ko,{slashscheme:!0,ascii:!0},e),n=n.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<n.length;g++){const y=n[g][0],z=n[g][1]?{[Iw]:!0}:{[_w]:!0};y.indexOf("-")>=0?z[$l]=!0:In.test(y)?_n.test(y)?z[Dr]=!0:z[Rl]=!0:z[Pl]=!0,Ch(t,y,y,z)}return Ch(t,"localhost",Rr,{ascii:!0}),t.jd=new Ot(Ts),{start:t,tokens:Object.assign({groups:e},Mh)}}function Ih(n,e){const t=$w(e.replace(/[A-Z]/g,l=>l.toLowerCase())),o=t.length,r=[];let i=0,a=0;for(;a<o;){let l=n,c=null,d=0,u=null,f=-1,p=-1;for(;a<o&&(c=l.go(t[a]));)l=c,l.accepts()?(f=0,p=0,u=l):f>=0&&(f+=t[a].length,p++),d+=t[a].length,i+=t[a].length,a++;i-=f,a-=p,d-=f,r.push({t:u.t,v:e.slice(i-d,i),s:i-d,e:i})}return r}function $w(n){const e=[],t=n.length;let o=0;for(;o<t;){let r=n.charCodeAt(o),i,a=r<55296||r>56319||o+1===t||(i=n.charCodeAt(o+1))<56320||i>57343?n[o]:n.slice(o,o+2);e.push(a),o+=a.length}return e}function ao(n,e,t,o,r){let i;const a=e.length;for(let l=0;l<a-1;l++){const c=e[l];n.j[c]?i=n.j[c]:(i=new Ot(o),i.jr=r.slice(),n.j[c]=i),n=i}return i=new Ot(t),i.jr=r.slice(),n.j[e[a-1]]=i,i}function _h(n){const e=[],t=[];let o=0,r="0123456789";for(;o<n.length;){let i=0;for(;r.indexOf(n[o+i])>=0;)i++;if(i>0){e.push(t.join(""));for(let a=parseInt(n.substring(o,o+i),10);a>0;a--)t.pop();o+=i}else t.push(n[o]),o++}return e}const Hr={defaultProtocol:"http",events:null,format:Oh,formatHref:Oh,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ec(n,e=null){let t=Object.assign({},Hr);n&&(t=Object.assign(t,n instanceof ec?n.o:n));const o=t.ignoreTags,r=[];for(let i=0;i<o.length;i++)r.push(o[i].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=r}ec.prototype={o:Hr,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const o=e!=null;let r=this.o[n];return r&&(typeof r=="object"?(r=t.t in r?r[t.t]:Hr[n],typeof r=="function"&&o&&(r=r(e,t))):typeof r=="function"&&o&&(r=r(e,t.t,t)),r)},getObj(n,e,t){let o=this.o[n];return typeof o=="function"&&e!=null&&(o=o(e,t.t,t)),o},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function Oh(n){return n}function Dh(n,e){this.t="token",this.v=n,this.tk=e}Dh.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),o=n.get("format",e,this);return t&&o.length>t?o.substring(0,t)+"…":o},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=Hr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),o=n.get("formatHref",t,this),r=n.get("tagName",t,e),i=this.toFormattedString(n),a={},l=n.get("className",t,e),c=n.get("target",t,e),d=n.get("rel",t,e),u=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return a.href=o,l&&(a.class=l),c&&(a.target=c),d&&(a.rel=d),u&&Object.assign(a,u),{tagName:r,attributes:a,content:i,eventListeners:f}}};function As(n,e){class t extends Dh{constructor(r,i){super(r,i),this.t=n}}for(const o in e)t.prototype[o]=e[o];return t.t=n,t}const Ph=As("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Rh=As("text"),Vw=As("nl"),Is=As("url",{isLink:!0,toHref(n=Hr.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Rr&&n[1].t===so}}),Gt=n=>new Ot(n);function Bw({groups:n}){const e=n.domain.concat([ms,ys,io,bs,xs,ks,Es,ws,qt,Hl,Vr,Ss,Cs,Ns,hn,Ts,Fr,vs]),t=[gs,so,ql,pn,Gl,Vr,Br,Kl,Jl,is,ss,Lr,$r,ts,es,ns,rs,as,ls,cs,ds,us,fs,ps,hs],o=[ms,gs,ys,bs,xs,ks,Es,ws,qt,Lr,$r,Vr,Ss,Cs,Ns,Br,hn,Ts,Fr,vs],r=Gt(),i=se(r,Fr);Me(i,o,i),Me(i,n.domain,i);const a=Gt(),l=Gt(),c=Gt();Me(r,n.domain,a),Me(r,n.scheme,l),Me(r,n.slashscheme,c),Me(a,o,i),Me(a,n.domain,a);const d=se(a,io);se(i,io,d),se(l,io,d),se(c,io,d);const u=se(i,pn);Me(u,o,i),Me(u,n.domain,i);const f=Gt();Me(d,n.domain,f),Me(f,n.domain,f);const p=se(f,pn);Me(p,n.domain,f);const h=Gt(Ph);Me(p,n.tld,h),Me(p,n.utld,h),se(d,Rr,h);const m=se(f,qt);se(m,qt,m),Me(m,n.domain,f),Me(h,n.domain,f),se(h,pn,p),se(h,qt,m);const g=se(h,so);Me(g,n.numeric,Ph);const y=se(a,qt),b=se(a,pn);se(y,qt,y),Me(y,n.domain,a),Me(b,o,i),Me(b,n.domain,a);const z=Gt(Is);Me(b,n.tld,z),Me(b,n.utld,z),Me(z,n.domain,a),Me(z,o,i),se(z,pn,b),se(z,qt,y),se(z,io,d);const w=se(z,so),T=Gt(Is);Me(w,n.numeric,T);const A=Gt(Is),M=Gt();Me(A,e,A),Me(A,t,M),Me(M,e,A),Me(M,t,M),se(z,hn,A),se(T,hn,A);const k=se(l,so),E=se(c,so),x=se(E,hn),B=se(x,hn);Me(l,n.domain,a),se(l,pn,b),se(l,qt,y),Me(c,n.domain,a),se(c,pn,b),se(c,qt,y),Me(k,n.domain,A),se(k,hn,A),se(k,Br,A),Me(B,n.domain,A),Me(B,e,A),se(B,hn,A);const $=[[Lr,$r],[es,ts],[ns,rs],[is,ss],[as,ls],[cs,ds],[us,fs],[ps,hs]];for(let O=0;O<$.length;O++){const[D,P]=$[O],q=se(A,D);se(M,D,q),se(q,P,A);const W=Gt(Is);Me(q,e,W);const R=Gt();Me(q,t),Me(W,e,W),Me(W,t,R),Me(R,e,W),Me(R,t,R),se(W,P,A),se(R,P,A)}return se(r,Rr,z),se(r,Wl,Vw),{start:r,tokens:Mh}}function Fw(n,e,t){let o=t.length,r=0,i=[],a=[];for(;r<o;){let l=n,c=null,d=null,u=0,f=null,p=-1;for(;r<o&&!(c=l.go(t[r].t));)a.push(t[r++]);for(;r<o&&(d=c||l.go(t[r].t));)c=null,l=d,l.accepts()?(p=0,f=l):p>=0&&p++,r++,u++;if(p<0)r-=u,r<o&&(a.push(t[r]),r++);else{a.length>0&&(i.push(tc(Rh,e,a)),a=[]),r-=p,u-=p;const h=f.t,m=t.slice(r-u,r);i.push(tc(h,e,m))}}return a.length>0&&i.push(tc(Rh,e,a)),i}function tc(n,e,t){const o=t[0].s,r=t[t.length-1].e,i=e.slice(o,r);return new n(i,t)}const jw=typeof console<"u"&&console&&console.warn||(()=>{}),Hw="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ue={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Uw(){return Ot.groups={},Ue.scanner=null,Ue.parser=null,Ue.tokenQueue=[],Ue.pluginQueue=[],Ue.customSchemes=[],Ue.initialized=!1,Ue}function Lh(n,e=!1){if(Ue.initialized&&jw(`linkifyjs: already initialized - will not register custom scheme "${n}" ${Hw}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
|
|
464
460
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
465
461
|
2. Cannot start or end with "-"
|
|
466
|
-
3. "-" cannot repeat`);We.customSchemes.push([t,e])}function rN(){We.scanner=XS(We.customSchemes);for(let t=0;t<We.tokenQueue.length;t++)We.tokenQueue[t][1]({scanner:We.scanner});We.parser=ZS(We.scanner.tokens);for(let t=0;t<We.pluginQueue.length;t++)We.pluginQueue[t][1]({scanner:We.scanner,parser:We.parser});return We.initialized=!0,We}function Ec(t){return We.initialized||rN(),eN(We.parser.start,t,pm(We.scanner.start,t))}Ec.scan=pm;function Em(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const o=new yc(n),r=Ec(t),i=[];for(let s=0;s<r.length;s++){const l=r[s];l.isLink&&(!e||l.t===e)&&o.check(l)&&i.push(l.toFormattedObject(o))}return i}var kc="[\0- -\u2029 ]",iN=new RegExp(kc),sN=new RegExp(`${kc}$`),aN=new RegExp(kc,"g");function lN(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function cN(t){return new Ot({key:new an("autolink"),appendTransaction:(e,n,o)=>{const r=e.some(d=>d.docChanged)&&!n.doc.eq(o.doc),i=e.some(d=>d.getMeta("preventAutolink"));if(!r||i)return;const{tr:s}=o,l=mh(n.doc,[...e]);if(Ch(l).forEach(({newRange:d})=>{const u=qk(o.doc,d,h=>h.isTextblock);let f,p;if(u.length>1)f=u[0],p=o.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){const h=o.doc.textBetween(d.from,d.to," "," ");if(!sN.test(h))return;f=u[0],p=o.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&p){const h=p.split(iN).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],b=f.pos+p.lastIndexOf(m);if(!m)return!1;const g=Ec(m).map(x=>x.toObject(t.defaultProtocol));if(!lN(g))return!1;g.filter(x=>x.isLink).map(x=>({...x,from:b+x.start+1,to:b+x.end+1})).filter(x=>o.schema.marks.code?!o.doc.rangeHasMark(x.from,x.to,o.schema.marks.code):!0).filter(x=>t.validate(x.value)).filter(x=>t.shouldAutoLink(x.value)).forEach(x=>{Bl(x.from,x.to,o.doc).some(v=>v.mark.type===t.type)||s.addMark(x.from,x.to,t.type.create({href:x.href}))})}}),!!s.steps.length)return s}})}function dN(t){return new Ot({key:new an("handleClickLink"),props:{handleClick:(e,n,o)=>{var r,i;if(o.button!==0||!e.editable)return!1;let s=!1;if(t.enableClickSelection&&(s=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){let l=null;if(o.target instanceof HTMLAnchorElement)l=o.target;else{let f=o.target;const p=[];for(;f.nodeName!=="DIV";)p.push(f),f=f.parentNode;l=p.find(h=>h.nodeName==="A")}if(!l)return s;const c=Nh(e.state,t.type.name),d=(r=l?.href)!=null?r:c.href,u=(i=l?.target)!=null?i:c.target;l&&d&&(window.open(d,u),s=!0)}return s}}})}function uN(t){return new Ot({key:new an("handlePasteLink"),props:{handlePaste:(e,n,o)=>{const{shouldAutoLink:r}=t,{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let c="";o.content.forEach(u=>{c+=u.textContent});const d=Em(c,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===c);return!c||!d||r!==void 0&&!r(d.value)?!1:t.editor.commands.setMark(t.type,{href:d.href})}}})}function Ao(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(o=>{const r=typeof o=="string"?o:o.scheme;r&&n.push(r)}),!t||t.replace(aN,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var fN=Vr.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){xm(t);return}xm(t.scheme,t.optionalSlashes)})},onDestroy(){oN()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Ao(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const r=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Ao(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Ao(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Rt(this.options.HTMLAttributes,t),0]:["a",Rt(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n;const o=((n=t.attrs)==null?void 0:n.href)||"";return`[${e.renderChildren(t)}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:o=>!!Ao(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:o=>!!Ao(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Yo({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:o}=this.options,r=Em(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Ao(s,n),protocols:n,defaultProtocol:o}));r.length&&r.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(cN({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:o=>this.options.isAllowedUri(o,{defaultValidate:r=>!!Ao(r,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(dN({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(uN({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),pN=fN;const hN={class:"zcode-rich-text-editor"},mN={key:0,class:"zcode-rich-text-toolbar"},gN=a.defineComponent({__name:"RichTextEditor",props:{modelValue:{type:String},placeholder:{type:String}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,o=e,r=tS({extensions:[oS,iS,aS,pS,xS,SS,LS,$S,VS,FS,pN.configure({openOnClick:!1,HTMLAttributes:{class:"zcode-link"}})],content:n.modelValue||"",editorProps:{attributes:{class:"zcode-tiptap-editor","data-placeholder":n.placeholder||"テキストを入力..."}},onUpdate:({editor:s})=>{const l=s.getHTML();o("update:modelValue",l)}});a.watch(()=>n.modelValue,s=>{r.value&&r.value.getHTML()!==s&&r.value.commands.setContent(s||"")});const i=()=>{if(!r.value)return;const s=r.value.getAttributes("link").href,l=window.prompt("URLを入力してください",s);if(l!==null){if(l===""){r.value.chain().focus().extendMarkRange("link").unsetLink().run();return}r.value.chain().focus().extendMarkRange("link").setLink({href:l}).run()}};return a.onUnmounted(()=>{r.value&&r.value.destroy()}),(s,l)=>(a.openBlock(),a.createElementBlock("div",hN,[a.unref(r)?(a.openBlock(),a.createElementBlock("div",mN,[a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("bold")},"zcode-toolbar-btn"]),title:"太字",onClick:l[0]||(l[0]=c=>a.unref(r).chain().focus().toggleBold().run())},[a.createVNode(a.unref(Jm),{size:16})],2),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("italic")},"zcode-toolbar-btn"]),title:"斜体",onClick:l[1]||(l[1]=c=>a.unref(r).chain().focus().toggleItalic().run())},[a.createVNode(a.unref(Zm),{size:16})],2),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("strike")},"zcode-toolbar-btn"]),title:"取り消し線",onClick:l[2]||(l[2]=c=>a.unref(r).chain().focus().toggleStrike().run())},[a.createVNode(a.unref(rg),{size:16})],2),l[5]||(l[5]=a.createElementVNode("div",{class:"zcode-toolbar-divider"},null,-1)),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("bulletList")},"zcode-toolbar-btn"]),title:"箇条書き",onClick:l[3]||(l[3]=c=>a.unref(r).chain().focus().toggleBulletList().run())},[a.createVNode(a.unref(ng),{size:16})],2),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("orderedList")},"zcode-toolbar-btn"]),title:"番号付きリスト",onClick:l[4]||(l[4]=c=>a.unref(r).chain().focus().toggleOrderedList().run())},[a.createVNode(a.unref(tg),{size:16})],2),l[6]||(l[6]=a.createElementVNode("div",{class:"zcode-toolbar-divider"},null,-1)),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("link")},"zcode-toolbar-btn"]),title:"リンク",onClick:i},[a.createVNode(a.unref(eg),{size:16})],2)])):a.createCommentVNode("",!0),a.createVNode(a.unref(eS),{editor:a.unref(r),class:"zcode-rich-text-editor-content"},null,8,["editor"])]))}}),bN={class:"zcode-image-modal-header"},yN={class:"zcode-image-modal-header-title",role:"heading","aria-level":"3"},xN=["aria-label"],EN={key:0,class:"zcode-image-current"},kN={class:"zcode-image-current-title",role:"heading","aria-level":"4"},wN={class:"zcode-image-current-item"},SN=["src","alt"],NN={class:"zcode-image-current-name"},CN={class:"zcode-image-tabs"},vN={class:"zcode-image-grid"},TN=["onClick"],zN=["src","alt"],_N={class:"zcode-image-name"},AN={class:"zcode-image-add"},MN={class:"zcode-image-modal-actions"},IN=a.defineComponent({__name:"ImageSelectModal",props:{isOpen:{type:Boolean},imagesCommon:{type:Array},imagesIndividual:{type:Array},imagesSpecial:{type:Array},currentValue:{type:String}},emits:["update:model-value","add-image","delete-image","close"],setup(t,{emit:e}){const{t:n}=rn(),o=t,r=e,i=a.ref("common"),s=a.ref(null),l=a.ref(o.currentValue||null),c=a.computed(()=>i.value==="common"?o.imagesCommon:i.value==="individual"?o.imagesIndividual:o.imagesSpecial),d=()=>o.currentValue&&[...o.imagesCommon,...o.imagesIndividual,...o.imagesSpecial].find(g=>g.id===o.currentValue)||null,u=b=>{l.value=b.id},f=()=>{l.value&&(r("update:model-value",l.value),m())},p=()=>{l.value&&confirm(n("imagesManager.deleteImageFromModalConfirm"))&&(r("delete-image",l.value),l.value=null)},h=b=>{const x=b.target.files?.[0];if(!x)return;const v=new FileReader;v.onload=w=>{const T=w.target?.result,M={id:`img-${Date.now()}`,name:x.name,url:T,mimeType:x.type,needsUpload:!0},A=i.value==="common"?"common":i.value==="individual"?"individual":"special";r("add-image",M,A),l.value=M.id},v.readAsDataURL(x)},m=()=>{r("close")};return(b,g)=>t.isOpen?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-image-modal",onClick:a.withModifiers(m,["self"])},[a.createElementVNode("div",{class:"zcode-image-modal-content",onClick:g[4]||(g[4]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",bN,[a.createElementVNode("div",yN,a.toDisplayString(b.$t("imagesManager.selectImage")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":b.$t("common.close"),onClick:m},[a.createVNode(a.unref(Qe),{size:18})],8,xN)]),t.currentValue&&d()?(a.openBlock(),a.createElementBlock("div",EN,[a.createElementVNode("div",kN,a.toDisplayString(b.$t("imagesManager.currentlySelected")),1),a.createElementVNode("div",wN,[a.createElementVNode("img",{src:d()?.url,alt:d()?.name||"",class:"zcode-image-current-item-img"},null,8,SN),a.createElementVNode("div",NN,a.toDisplayString(d()?.name),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",CN,[a.createElementVNode("button",{class:a.normalizeClass([{active:i.value==="common"},"zcode-image-tab"]),onClick:g[0]||(g[0]=x=>i.value="common")},a.toDisplayString(b.$t("dataViewer.common")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:i.value==="individual"},"zcode-image-tab"]),onClick:g[1]||(g[1]=x=>i.value="individual")},a.toDisplayString(b.$t("dataViewer.individual")),3),t.imagesSpecial.length>0?(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass([{active:i.value==="special"},"zcode-image-tab"]),onClick:g[2]||(g[2]=x=>i.value="special")},a.toDisplayString(b.$t("dataViewer.special")),3)):a.createCommentVNode("",!0)]),a.createElementVNode("div",vN,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(c.value,x=>(a.openBlock(),a.createElementBlock("div",{key:x.id,class:a.normalizeClass([{selected:l.value===x.id},"zcode-image-item"]),onClick:v=>u(x)},[a.createElementVNode("img",{src:x.url,alt:x.name,class:"zcode-image-item-img"},null,8,zN),a.createElementVNode("div",_N,a.toDisplayString(x.name),1)],10,TN))),128))]),a.createElementVNode("div",AN,[a.createElementVNode("input",{ref_key:"fileInput",ref:s,type:"file",accept:"image/*",style:{display:"none"},onChange:h},null,544),a.createElementVNode("button",{class:"zcode-image-add-btn",onClick:g[3]||(g[3]=x=>s.value?.click())},[a.createVNode(a.unref(uo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(b.$t("imagesManager.addImage")),1)])]),a.createElementVNode("div",MN,[l.value?(a.openBlock(),a.createElementBlock("button",{key:0,class:"zcode-btn-primary zcode-image-modal-actions-btn",onClick:f},[a.createVNode(a.unref(sr),{size:16}),a.createElementVNode("span",null,a.toDisplayString(b.$t("imagesManager.select")),1)])):a.createCommentVNode("",!0),l.value?(a.openBlock(),a.createElementBlock("button",{key:1,class:"zcode-btn-danger zcode-image-modal-actions-btn",onClick:p},[a.createVNode(a.unref(Bn),{size:16}),a.createElementVNode("span",null,a.toDisplayString(b.$t("common.delete")),1)])):a.createCommentVNode("",!0)])])])):a.createCommentVNode("",!0)}}),ON={class:"zcode-edit-panel-header"},DN={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},RN=["aria-label"],PN={key:0,class:"zcode-parent-selector"},LN={key:1,class:"zcode-group-tabs"},$N=["onClick"],VN={key:2,class:"zcode-field-editor"},BN={class:"zcode-field-item-title",role:"heading","aria-level":"4"},FN={key:0,class:"zcode-text-editor"},jN=["value","placeholder","maxlength","readonly","disabled","onInput"],UN={key:0,class:"zcode-field-error-message"},HN={key:1,class:"zcode-field-counter"},WN={key:1,class:"zcode-text-editor"},GN=["value","placeholder","maxlength","readonly","disabled","onInput"],qN={key:0,class:"zcode-field-error-message"},KN={key:1,class:"zcode-field-counter"},JN={key:2,class:"zcode-rich-text-editor-wrapper"},XN={key:0,class:"zcode-field-error-message"},YN={key:3,class:"zcode-radio-editor"},QN={class:"zcode-radio-group"},ZN=["onUpdate:modelValue","name","value","onChange"],eC={class:"zcode-radio-item-label"},tC={key:4,class:"zcode-checkbox-editor"},nC={class:"zcode-checkbox-group"},oC=["onUpdate:modelValue","value","onChange"],rC={class:"zcode-checkbox-item-label"},iC={key:5,class:"zcode-select-editor"},sC=["onUpdate:modelValue","onChange"],aC=["value"],lC={key:6,class:"zcode-select-editor"},cC=["onUpdate:modelValue","size","onChange"],dC=["value"],uC={key:7,class:"zcode-tag-editor"},fC=["onUpdate:modelValue","onChange"],pC=["value"],hC={class:"zcode-tag-preview"},mC={key:8,class:"zcode-boolean-editor"},gC={class:"zcode-checkbox-item"},bC=["onUpdate:modelValue","onChange"],yC={class:"zcode-checkbox-item-label"},xC={key:9,class:"zcode-image-editor"},EC={class:"zcode-image-editor-buttons"},kC=["onClick"],wC=["title","onClick"],SC={key:0,class:"zcode-image-preview"},NC=["src","alt"],CC={key:3,class:"zcode-edit-fields"},vC={class:"zcode-edit-fields-text"},TC={class:"zcode-edit-fields-text"},zC=a.defineComponent({__name:"EditPanel",props:{editingComponent:{type:[Object,null]},editingAvailableFields:{type:Array},fieldErrors:{type:Object},currentMode:{type:String},canSelectParent:{type:Boolean},imagesCommon:{type:Array},imagesIndividual:{type:Array},imagesSpecial:{type:Array}},emits:["close","select-parent","save-field","add-image","delete-image"],setup(t,{emit:e}){const n=t,o=a.ref("all"),r=a.computed(()=>{const y=new Map;return n.editingAvailableFields.forEach(E=>{const S=E.groupName||"other";y.set(S,(y.get(S)||0)+1)}),Array.from(y.entries()).map(([E,S])=>({name:E,count:S}))}),i=a.computed(()=>r.value.length>1),s=a.computed(()=>!i.value||o.value==="all"?n.editingAvailableFields:n.editingAvailableFields.filter(y=>(y.groupName||"other")===o.value));a.watch(()=>i.value,y=>{y?o.value="all":o.value=void 0},{immediate:!0}),a.watch(()=>n.editingAvailableFields,()=>{if(i.value){if(o.value==="all")return;r.value.some(E=>E.name===o.value)||(o.value="all")}},{deep:!0});const l=e,c=a.ref({});function d(y){const E=y.label||y.fieldName,S=y.currentValue,D=y.type==="rich"&&typeof S=="string"&&S.trim()==="<p></p>"?"":S??"";return y.required&&(D===""||D===void 0||D===null)?`${E}は必須です`:typeof y.maxLength=="number"&&y.maxLength>0&&String(D).length>y.maxLength?`${E}は${y.maxLength}文字以内で入力してください`:null}function u(y,E){E?c.value[y]=E:delete c.value[y]}function f(y){return c.value[y]||n.fieldErrors?.[y]||null}const p=a.ref(!1),h=a.ref(null),m=y=>{h.value=y,p.value=!0},b=()=>{p.value=!1,h.value=null},g=y=>{y.currentValue="",l("save-field",y)},x=y=>{h.value&&(h.value.currentValue=y||"",l("save-field",h.value))},v=(y,E)=>{l("add-image",y,E)},w=y=>{l("delete-image",y),h.value?.currentValue===y&&(h.value.currentValue="",l("save-field",h.value))},T=y=>y&&[...n.imagesCommon,...n.imagesIndividual,...n.imagesSpecial].find(D=>D.id===y)?.url||null,M=(y,E)=>{const S=E.target;y.currentValue=S.value,u(y.fieldName,d(y)),l("save-field",y)},A=(y,E)=>{y.optional&&E===""?y.currentValue=void 0:y.currentValue=E,u(y.fieldName,d(y)),l("save-field",y)};return(y,E)=>t.editingComponent&&t.currentMode==="edit"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-edit-panel",onClick:E[3]||(E[3]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",ON,[a.createElementVNode("div",DN,a.toDisplayString(y.$t("editPanel.editing",{type:t.editingComponent.type})),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":y.$t("common.close"),onClick:E[0]||(E[0]=S=>y.$emit("close"))},[a.createVNode(a.unref(Qe),{size:18})],8,RN)]),t.canSelectParent?(a.openBlock(),a.createElementBlock("div",PN,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:E[1]||(E[1]=S=>y.$emit("select-parent"))},[a.createVNode(a.unref(si),{size:16}),a.createElementVNode("span",null,a.toDisplayString(y.$t("addPanel.selectParent")),1)])])):a.createCommentVNode("",!0),i.value?(a.openBlock(),a.createElementBlock("div",LN,[a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="all"},"zcode-group-tab"]),onClick:E[2]||(E[2]=S=>o.value="all")}," all ",2),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,S=>(a.openBlock(),a.createElementBlock("button",{key:S.name,class:a.normalizeClass([{active:o.value===S.name},"zcode-group-tab"]),onClick:D=>o.value=S.name},a.toDisplayString(S.name),11,$N))),128))])):a.createCommentVNode("",!0),s.value.length>0?(a.openBlock(),a.createElementBlock("div",VN,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(s.value,S=>(a.openBlock(),a.createElementBlock("div",{key:S.fieldName,class:"zcode-field-item"},[a.createElementVNode("div",BN,a.toDisplayString(S.label),1),S.type==="text"?(a.openBlock(),a.createElementBlock("div",FN,[a.createElementVNode("input",{type:"text",value:S.currentValue??"",placeholder:S.defaultValue,maxlength:S.maxLength,readonly:S.readonly,disabled:S.disabled,class:a.normalizeClass([{"zcode-field-error":f(S.fieldName)},"zcode-text-input"]),onInput:D=>M(S,D)},null,42,jN),f(S.fieldName)?(a.openBlock(),a.createElementBlock("div",UN,a.toDisplayString(f(S.fieldName)),1)):a.createCommentVNode("",!0),S.maxLength?(a.openBlock(),a.createElementBlock("div",HN,a.toDisplayString(String(S.currentValue??"").length)+" / "+a.toDisplayString(S.maxLength),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),S.type==="textarea"?(a.openBlock(),a.createElementBlock("div",WN,[a.createElementVNode("textarea",{value:S.currentValue??"",placeholder:S.defaultValue,maxlength:S.maxLength,readonly:S.readonly,disabled:S.disabled,class:a.normalizeClass([{"zcode-field-error":f(S.fieldName)},"zcode-textarea"]),rows:"4",onInput:D=>M(S,D)},null,42,GN),f(S.fieldName)?(a.openBlock(),a.createElementBlock("div",qN,a.toDisplayString(f(S.fieldName)),1)):a.createCommentVNode("",!0),S.maxLength?(a.openBlock(),a.createElementBlock("div",KN,a.toDisplayString(String(S.currentValue??"").length)+" / "+a.toDisplayString(S.maxLength),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),S.type==="rich"?(a.openBlock(),a.createElementBlock("div",JN,[a.createVNode(gN,{"model-value":S.currentValue??"",placeholder:S.defaultValue,"onUpdate:modelValue":D=>A(S,D)},null,8,["model-value","placeholder","onUpdate:modelValue"]),f(S.fieldName)?(a.openBlock(),a.createElementBlock("div",XN,a.toDisplayString(f(S.fieldName)),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),S.type==="radio"?(a.openBlock(),a.createElementBlock("div",YN,[a.createElementVNode("div",QN,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(S.options,D=>(a.openBlock(),a.createElementBlock("label",{key:D,class:"zcode-radio-item"},[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":W=>S.currentValue=W,type:"radio",name:S.fieldName,value:D,onChange:W=>y.$emit("save-field",S)},null,40,ZN),[[a.vModelRadio,S.currentValue]]),a.createElementVNode("span",eC,a.toDisplayString(D),1)]))),128))])])):a.createCommentVNode("",!0),S.type==="checkbox"?(a.openBlock(),a.createElementBlock("div",tC,[a.createElementVNode("div",nC,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(S.options,D=>(a.openBlock(),a.createElementBlock("label",{key:D,class:"zcode-checkbox-item"},[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":W=>S.currentValue=W,type:"checkbox",value:D,onChange:W=>y.$emit("save-field",S)},null,40,oC),[[a.vModelCheckbox,S.currentValue]]),a.createElementVNode("span",rC,a.toDisplayString(D),1)]))),128))])])):a.createCommentVNode("",!0),S.type==="select"?(a.openBlock(),a.createElementBlock("div",iC,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":D=>S.currentValue=D,class:"zcode-select",onChange:D=>y.$emit("save-field",S)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(S.options,D=>(a.openBlock(),a.createElementBlock("option",{key:D,value:D},a.toDisplayString(D),9,aC))),128))],40,sC),[[a.vModelSelect,S.currentValue]])])):a.createCommentVNode("",!0),S.type==="select-multiple"?(a.openBlock(),a.createElementBlock("div",lC,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":D=>S.currentValue=D,class:"zcode-select",multiple:"",size:Math.min(S.options?.length||3,5),onChange:D=>y.$emit("save-field",S)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(S.options,D=>(a.openBlock(),a.createElementBlock("option",{key:D,value:D},a.toDisplayString(D),9,dC))),128))],40,cC),[[a.vModelSelect,S.currentValue]])])):a.createCommentVNode("",!0),S.type==="tag"?(a.openBlock(),a.createElementBlock("div",uC,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":D=>S.currentValue=D,class:"zcode-select",onChange:D=>y.$emit("save-field",S)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(S.options,D=>(a.openBlock(),a.createElementBlock("option",{key:D,value:D},a.toDisplayString(D),9,pC))),128))],40,fC),[[a.vModelSelect,S.currentValue]]),a.createElementVNode("div",hC,[E[4]||(E[4]=a.createTextVNode(" 現在のタグ: ",-1)),a.createElementVNode("code",null,"<"+a.toDisplayString(S.currentValue)+">",1)])])):a.createCommentVNode("",!0),S.type==="boolean"?(a.openBlock(),a.createElementBlock("div",mC,[a.createElementVNode("label",gC,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":D=>S.currentValue=D,type:"checkbox",onChange:D=>y.$emit("save-field",S)},null,40,bC),[[a.vModelCheckbox,S.currentValue]]),a.createElementVNode("span",yC,a.toDisplayString(S.label)+"を表示",1)])])):a.createCommentVNode("",!0),S.type==="image"?(a.openBlock(),a.createElementBlock("div",xC,[a.createElementVNode("div",EC,[a.createElementVNode("button",{class:"zcode-image-select-btn",onClick:D=>m(S)},[a.createVNode(a.unref(Rc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(S.currentValue?y.$t("editPanel.replaceImage"):y.$t("editPanel.selectImage")),1)],8,kC),S.currentValue?(a.openBlock(),a.createElementBlock("button",{key:0,class:"zcode-image-clear-btn",title:y.$t("editPanel.clearImageTitle"),onClick:D=>g(S)},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(y.$t("editPanel.clearImage")),1)],8,wC)):a.createCommentVNode("",!0)]),T(S.currentValue)?(a.openBlock(),a.createElementBlock("div",SC,[a.createElementVNode("img",{src:T(S.currentValue)||"",alt:S.label,class:"zcode-image-preview-img"},null,8,NC)])):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)]))),128))])):!i.value||s.value.length===0?(a.openBlock(),a.createElementBlock("div",CC,[a.createElementVNode("div",vC,a.toDisplayString(y.$t("editPanel.id",{id:t.editingComponent.id})),1),a.createElementVNode("div",TC," Type: "+a.toDisplayString(t.editingComponent.type),1)])):a.createCommentVNode("",!0),a.createVNode(IN,{"is-open":p.value,"images-common":t.imagesCommon,"images-individual":t.imagesIndividual,"images-special":t.imagesSpecial,"current-value":h.value?.currentValue||void 0,"onUpdate:modelValue":x,onAddImage:v,onDeleteImage:w,onClose:b},null,8,["is-open","images-common","images-individual","images-special","current-value"])])):a.createCommentVNode("",!0)}}),_C={class:"zcode-delete-panel-header"},AC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},MC=["aria-label"],IC={key:0,class:"zcode-parent-selector"},OC={class:"zcode-delete-panel-content"},DC={class:"zcode-delete-warning"},RC={class:"zcode-delete-warning-text"},PC={class:"zcode-delete-actions"},LC=a.defineComponent({__name:"DeletePanel",props:{deleteConfirmComponent:{type:[Object,null]},currentMode:{type:String},canSelectParent:{type:Boolean}},emits:["confirm","cancel","select-parent"],setup(t){return(e,n)=>t.deleteConfirmComponent&&t.currentMode==="delete"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-delete-panel",onClick:n[4]||(n[4]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",_C,[a.createElementVNode("div",AC,a.toDisplayString(e.$t("deletePanel.title")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":e.$t("common.close"),onClick:n[0]||(n[0]=o=>e.$emit("cancel"))},[a.createVNode(a.unref(Qe),{size:18})],8,MC)]),t.canSelectParent?(a.openBlock(),a.createElementBlock("div",IC,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:n[1]||(n[1]=o=>e.$emit("select-parent"))},[a.createVNode(a.unref(si),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("deletePanel.selectParent")),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",OC,[a.createElementVNode("div",DC,[a.createVNode(a.unref(Vc),{size:20,class:"zcode-delete-warning-icon"}),a.createElementVNode("div",RC,a.toDisplayString(e.$t("deletePanel.confirmMessage")),1)]),a.createElementVNode("div",PC,[a.createElementVNode("button",{class:"zcode-btn-danger",onClick:n[2]||(n[2]=o=>e.$emit("confirm"))},[a.createVNode(a.unref(Bn),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("common.delete")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel",onClick:n[3]||(n[3]=o=>e.$emit("cancel"))},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("common.cancel")),1)])])])])):a.createCommentVNode("",!0)}}),$C={class:"zcode-reorder-panel-header"},VC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},BC=["aria-label"],FC={key:0,class:"zcode-parent-selector"},jC={class:"zcode-reorder-panel-content"},UC={class:"zcode-reorder-panel-content-text"},HC={class:"zcode-reorder-source"},WC=a.defineComponent({__name:"ReorderPanel",props:{reorderSourcePath:{type:String},currentMode:{type:String},canSelectParent:{type:Boolean}},emits:["cancel","select-parent"],setup(t){return(e,n)=>t.reorderSourcePath&&t.currentMode==="reorder"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-reorder-panel",onClick:n[2]||(n[2]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",$C,[a.createElementVNode("div",VC,a.toDisplayString(e.$t("reorderPanel.title")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":e.$t("common.close"),onClick:n[0]||(n[0]=o=>e.$emit("cancel"))},[a.createVNode(a.unref(Qe),{size:18})],8,BC)]),t.canSelectParent?(a.openBlock(),a.createElementBlock("div",FC,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:n[1]||(n[1]=o=>e.$emit("select-parent"))},[a.createVNode(a.unref(si),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("reorderPanel.selectParent")),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",jC,[a.createElementVNode("div",UC,a.toDisplayString(e.$t("reorderPanel.instruction")),1),a.createElementVNode("div",HC,a.toDisplayString(e.$t("reorderPanel.source",{path:t.reorderSourcePath})),1)])])):a.createCommentVNode("",!0)}}),GC={class:"zcode-add-panel-header"},qC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},KC=["aria-label"],JC={key:0,class:"zcode-parent-selector"},XC={class:"zcode-part-category-tabs"},YC=["onClick"],QC={key:1,class:"zcode-type-tabs"},ZC=["onClick"],ev={class:"zcode-add-panel-content"},tv={class:"zcode-part-list"},nv={class:"zcode-part-type-section"},ov={class:"zcode-type-section-title",role:"heading","aria-level":"3"},rv={class:"zcode-type-section-description"},iv={key:0,class:"zcode-module-buttons"},sv={class:"zcode-module-preview-header"},av={class:"zcode-module-preview-label zcode-module-preview-label-header"},lv=["aria-label"],cv=["innerHTML"],dv={key:1,class:"zcode-empty-parts"},uv={class:"zcode-empty-parts-text"},fv={class:"zcode-type-section-title",role:"heading","aria-level":"3"},pv={key:0,class:"zcode-type-section-description"},hv={class:"zcode-module-buttons"},mv=["onClick"],gv={class:"zcode-module-preview-header"},bv={class:"zcode-module-preview-label zcode-module-preview-label-header"},yv=["aria-label","onClick"],xv=["innerHTML"],Ev={key:0,class:"zcode-empty-parts"},kv={class:"zcode-empty-parts-text"},wv={key:2,class:"zcode-insert-position"},Sv={class:"zcode-insert-header"},Nv={class:"zcode-keep-adding-label zcode-keep-adding-label-position"},Cv=["checked"],vv={class:"zcode-insert-buttons"},Tv={class:"zcode-preview-modal-header"},zv={class:"zcode-preview-modal-header-title",role:"heading","aria-level":"4"},_v=["innerHTML"],Av=a.defineComponent({__name:"AddPanel",props:{addTargetPath:{type:[String,null]},addPartCategory:{type:String},addTypeTab:{type:[String,null]},addSelectedPart:{type:[Object,null]},addSelectedType:{type:[Object,null]},clickedComponent:{type:[Object,null]},availablePartTypes:{type:Array},groupedPartsByType:{type:Array},canSelectParent:{type:Boolean},getPartPreviewHtml:{type:Function},getClickedComponentPreviewHtml:{type:Function},keepAdding:{type:Boolean},hasSpecialParts:{type:Boolean},config:{type:Object}},emits:["cancel","select-parent","category-tab-click","type-tab-click","select-part","confirm-add","update-keep-adding"],setup(t){const e=t,n=a.computed(()=>e.config?.categoryOrder||"common"),o=a.computed(()=>{const d=[];return n.value==="individual"?(d.push("individual","common"),e.hasSpecialParts&&d.push("special")):n.value==="special"?(e.hasSpecialParts&&d.push("special"),d.push("common","individual")):(d.push("common","individual"),e.hasSpecialParts&&d.push("special")),d}),r=a.ref(!1),i=a.ref(null);function s(d,u){i.value={type:d,part:u,isActiveParts:!1},r.value=!0}function l(){e.addSelectedType&&e.addSelectedPart&&(i.value={type:e.addSelectedType,part:e.addSelectedPart,isActiveParts:!0},r.value=!0)}function c(){r.value=!1,i.value=null}return(d,u)=>t.addTargetPath?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-add-panel",onClick:u[9]||(u[9]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",GC,[a.createElementVNode("div",qC,a.toDisplayString(d.$t("addPanel.title")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":d.$t("common.close"),onClick:u[0]||(u[0]=f=>d.$emit("cancel"))},[a.createVNode(a.unref(Qe),{size:18})],8,KC)]),t.canSelectParent?(a.openBlock(),a.createElementBlock("div",JC,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:u[1]||(u[1]=f=>d.$emit("select-parent"))},[a.createVNode(a.unref(si),{size:16}),a.createElementVNode("span",null,a.toDisplayString(d.$t("addPanel.selectParent")),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",XC,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.value,f=>(a.openBlock(),a.createElementBlock("button",{key:f,class:a.normalizeClass([{active:t.addPartCategory===f&&t.addTypeTab!=="selected"},"zcode-category-tab"]),onClick:p=>d.$emit("category-tab-click",f)},a.toDisplayString(f==="common"?d.$t("addPanel.category.common"):f==="individual"?d.$t("addPanel.category.individual"):d.$t("dataViewer.special")),11,YC))),128)),a.createElementVNode("button",{class:a.normalizeClass([{active:t.addTypeTab==="selected"},"zcode-category-tab"]),onClick:u[2]||(u[2]=f=>d.$emit("type-tab-click","selected"))},a.toDisplayString(d.$t("addPanel.category.selected")),3)]),t.availablePartTypes.length>0&&t.addTypeTab!=="selected"?(a.openBlock(),a.createElementBlock("div",QC,[a.createElementVNode("button",{class:a.normalizeClass([{active:t.addTypeTab==="all"},"zcode-type-tab"]),onClick:u[3]||(u[3]=f=>d.$emit("type-tab-click","all"))}," all ",2),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.availablePartTypes,f=>(a.openBlock(),a.createElementBlock("button",{key:f,class:a.normalizeClass([{active:t.addTypeTab===f},"zcode-type-tab"]),onClick:p=>d.$emit("type-tab-click",f)},a.toDisplayString(f),11,ZC))),128))])):a.createCommentVNode("",!0),a.createElementVNode("div",ev,[a.createElementVNode("div",tv,[a.withDirectives(a.createElementVNode("div",nv,[a.createElementVNode("div",ov,a.toDisplayString(d.$t("addPanel.activeParts")),1),a.createElementVNode("div",rv,a.toDisplayString(d.$t("addPanel.activePartsDescription")),1),t.clickedComponent&&t.addSelectedPart&&t.addSelectedType?(a.openBlock(),a.createElementBlock("div",iv,[a.createElementVNode("div",{class:a.normalizeClass([{active:!0},"zcode-module-preview"])},[a.createElementVNode("div",sv,[a.createElementVNode("div",av,a.toDisplayString(d.$t("addPanel.activeParts")),1),a.createElementVNode("button",{type:"button",class:"zcode-module-preview-icon-btn","aria-label":d.$t("common.preview"),onClick:u[4]||(u[4]=a.withModifiers(f=>l(),["stop"]))},[a.createVNode(a.unref(Bc),{size:14})],8,lv)]),a.createElementVNode("div",{class:"zcode-module-preview-content",innerHTML:t.getClickedComponentPreviewHtml()},null,8,cv)])])):(a.openBlock(),a.createElementBlock("div",dv,[a.createElementVNode("div",uv,a.toDisplayString(d.$t("addPanel.clickPartInPreview")),1)]))],512),[[a.vShow,t.addTypeTab==="selected"]]),a.withDirectives(a.createElementVNode("div",null,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.groupedPartsByType,f=>(a.openBlock(),a.createElementBlock("div",{key:f.type,class:"zcode-part-type-section"},[a.createElementVNode("div",fv,a.toDisplayString(f.type),1),f.description?(a.openBlock(),a.createElementBlock("div",pv,a.toDisplayString(f.description),1)):a.createCommentVNode("",!0),a.createElementVNode("div",hv,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(f.parts,p=>(a.openBlock(),a.createElementBlock("div",{key:p.title,class:a.normalizeClass([{active:t.addTypeTab==="selected"&&t.clickedComponent?.part_id===p.id&&t.clickedComponent?.id?!0:t.addTypeTab!=="selected"&&t.addSelectedPart?.id===p.id},"zcode-module-preview"]),onClick:h=>d.$emit("select-part",f.typeData,p)},[a.createElementVNode("div",gv,[a.createElementVNode("div",bv,a.toDisplayString(p.title),1),a.createElementVNode("button",{type:"button",class:"zcode-module-preview-icon-btn","aria-label":d.$t("common.preview"),onClick:a.withModifiers(h=>s(f.typeData,p),["stop"])},[a.createVNode(a.unref(Bc),{size:14})],8,yv)]),a.createElementVNode("div",{class:"zcode-module-preview-content",innerHTML:t.getPartPreviewHtml(f.typeData,p)},null,8,xv)],10,mv))),128))])]))),128)),t.groupedPartsByType.length===0&&!t.addSelectedPart?(a.openBlock(),a.createElementBlock("div",Ev,[a.createElementVNode("div",kv,a.toDisplayString(d.$t("addPanel.noPartsAvailable")),1)])):a.createCommentVNode("",!0)],512),[[a.vShow,t.addTypeTab!=="selected"]])])]),t.addSelectedPart?(a.openBlock(),a.createElementBlock("div",wv,[a.createElementVNode("div",Sv,[u[10]||(u[10]=a.createElementVNode("div",{class:"zcode-insert-position-title",role:"heading","aria-level":"4"}," 追加位置を選択 ",-1)),a.createElementVNode("label",Nv,[a.createElementVNode("input",{type:"checkbox",checked:t.keepAdding,class:"zcode-keep-adding-checkbox",onChange:u[5]||(u[5]=f=>d.$emit("update-keep-adding",f.target.checked))},null,40,Cv),a.createElementVNode("span",null,a.toDisplayString(d.$t("addPanel.continueAdding")),1)])]),a.createElementVNode("div",vv,[a.createElementVNode("button",{class:"zcode-insert-btn zcode-insert-before",onClick:u[6]||(u[6]=f=>d.$emit("confirm-add","before"))},a.toDisplayString(d.$t("addPanel.addBefore")),1),a.createElementVNode("button",{class:"zcode-insert-btn zcode-insert-after",onClick:u[7]||(u[7]=f=>d.$emit("confirm-add","after"))},a.toDisplayString(d.$t("addPanel.addAfter")),1)])])):a.createCommentVNode("",!0),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[r.value&&i.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-preview-modal",onClick:c},[a.createElementVNode("div",{class:"zcode-preview-modal-content",onClick:u[8]||(u[8]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",Tv,[a.createElementVNode("div",zv,a.toDisplayString(d.$t("common.preview"))+": "+a.toDisplayString(i.value.isActiveParts?d.$t("addPanel.activeParts"):i.value.part.title),1),a.createElementVNode("button",{class:"zcode-close-btn",onClick:c},[a.createVNode(a.unref(Qe),{size:18})])]),a.createElementVNode("div",{class:"zcode-preview-modal-body",innerHTML:i.value.isActiveParts?t.getClickedComponentPreviewHtml():t.getPartPreviewHtml(i.value.type,i.value.part)},null,8,_v)])])):a.createCommentVNode("",!0)]))])):a.createCommentVNode("",!0)}}),Mv=a.defineComponent({__name:"ContextMenu",props:{isVisible:{type:Boolean},position:{type:Object},currentMode:{type:String}},emits:["select-mode","close"],setup(t,{emit:e}){const n=e;function o(i){n("select-mode",i),n("close")}function r(){n("close")}return(i,s)=>t.isVisible?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-context-menu",style:a.normalizeStyle({left:`${t.position.x}px`,top:`${t.position.y}px`}),onClick:s[4]||(s[4]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:t.currentMode==="edit"}]),onClick:s[0]||(s[0]=l=>o("edit"))},[a.createVNode(a.unref(Pc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.edit")),1)],2),a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:t.currentMode==="add"}]),onClick:s[1]||(s[1]=l=>o("add"))},[a.createVNode(a.unref(uo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.add")),1)],2),a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:t.currentMode==="reorder"}]),onClick:s[2]||(s[2]=l=>o("reorder"))},[a.createVNode(a.unref(ir),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.reorder")),1)],2),a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:t.currentMode==="delete"}]),onClick:s[3]||(s[3]=l=>o("delete"))},[a.createVNode(a.unref(Bn),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.delete")),1)],2),s[5]||(s[5]=a.createElementVNode("div",{class:"zcode-context-menu-divider"},null,-1)),a.createElementVNode("button",{class:"zcode-context-menu-item",onClick:r},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.close")),1)])],4)):a.createCommentVNode("",!0)}});function Iv(t){if(t.defaultValue!==void 0&&t.defaultValue!=="")switch(t.type){case"rich":return`<p>${t.defaultValue}</p>`;case"image":return t.defaultValue;default:return t.defaultValue}switch(t.type){case"text":case"textarea":return"";case"rich":return"<p></p>";case"radio":case"select":return t.options?.[0]||"";case"checkbox":case"select-multiple":return[];case"boolean":return!0;case"image":return"";default:return""}}function Ov(t,e){const n=ha(t.part_id,e);if(!n)return;Fn(n.body).forEach(r=>{r.optional||t[r.fieldName]===void 0&&(t[r.fieldName]=Iv(r))})}function Dv(t){function e(n){Ov(n,t.parts),n.slots&&Object.values(n.slots).forEach(o=>{(Array.isArray(o)?o:o?.children||[]).forEach(i=>{e(i)})})}t.page.forEach(n=>{e(n)})}function km(t){const e=a.reactive({page:[],css:{common:void 0,individual:void 0,special:void 0},parts:{common:[],individual:[],special:[]},images:{common:[],individual:[],special:[]},backendData:void 0});function n(){try{const i=t.page?JSON.parse(t.page):[],s=t.partsCommon?JSON.parse(t.partsCommon):[],l=t.partsIndividual?JSON.parse(t.partsIndividual):[],c=t.partsSpecial?JSON.parse(t.partsSpecial):[],d=t.imagesCommon?JSON.parse(t.imagesCommon):[],u=t.imagesIndividual?JSON.parse(t.imagesIndividual):[],f=t.imagesSpecial?JSON.parse(t.imagesSpecial):[],p=t.cssCommon!==void 0?t.cssCommon:void 0,h=t.cssIndividual!==void 0?t.cssIndividual:void 0,m=t.cssSpecial!==void 0?t.cssSpecial:void 0,b=t.backendData?JSON.parse(t.backendData):void 0;Object.assign(e,{page:i,css:{common:p,individual:h,special:m},parts:{common:s,individual:l,special:c},images:{common:d,individual:u,special:f},backendData:b}),Dv(e)}catch(i){console.error("Failed to parse props:",i)}}function o(i){if(!i)return e;const s=i.split(".");let l=e;for(const c of s)if(l==null||typeof l!="object"||(l=l[c],l===void 0))return;return l}function r(i,s){if(typeof i=="string"){const l=i.split(".");let c=e;for(let d=0;d<l.length-1;d++){const u=c[l[d]];if(u==null||typeof u!="object")return;c=u}c[l[l.length-1]]=s}else Object.assign(e,i)}return{cmsData:e,loadDataFromProps:n,getData:o,setData:r}}function Rv(){const t=a.ref("edit"),e=a.ref(!1);function n(o){t.value=o}return{currentMode:t,switchMode:n,allowDynamicContentInteraction:e}}function wm(t){const e=document.documentElement,o={edit:"--zcode-color-edit",add:"--zcode-color-add",reorder:"--zcode-color-reorder",delete:"--zcode-color-delete"}[t]||"--zcode-color-edit";return getComputedStyle(e).getPropertyValue(o).trim()||"#3b82f6"}function Yt(t,e){const n=wm(e);t.classList.remove("zcode-outline-active-edit","zcode-outline-active-add","zcode-outline-active-reorder","zcode-outline-active-delete"),t.classList.add(`zcode-outline-active-${e}`),t.style.outlineColor=n,t.style.outlineStyle="solid"}function Qt(t){t.style.outline="",t.style.outlineOffset="",t.classList.remove("zcode-outline-active-edit","zcode-outline-active-add","zcode-outline-active-reorder","zcode-outline-active-delete")}function wc(t,e){const n=wm(e);t.style.outline=`2px dashed ${n}`,t.style.outlineOffset="2px"}function yn(t){t.style.outline="",t.style.outlineOffset=""}function Pv(t,e){const n=a.ref(null),o=a.ref(-1),r=a.ref(""),i=a.ref([]);function s(u){const f=u.part_id,p=t.parts,h=[...p.common,...p.individual];let m=null;for(const g of h){const x=g.parts.find(v=>v.id===f);if(x){m=x;break}}return m?Fn(m.body).map(g=>{const x={fieldName:g.fieldName,groupName:g.groupName,label:Pg(g.fieldName),required:g.required,maxLength:g.maxLength,readonly:g.readonly,disabled:g.disabled};if(g.type==="text")return{...x,type:"text",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue};if(g.type==="textarea")return{...x,type:"textarea",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue||""};if(g.type==="rich")return{...x,type:"rich",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue||""};if(g.type==="radio")return{...x,type:"radio",options:g.options,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.options?.[0]};if(g.type==="boolean")return{...x,type:"boolean",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:!0};if(g.type==="image")return{...x,type:"image",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue||""};if(g.type==="select")return{...x,type:"select",options:g.options,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.options?.[0]};if(g.type==="select-multiple")return{...x,type:"select-multiple",options:g.options,optional:g.optional,currentValue:Array.isArray(u[g.fieldName])?u[g.fieldName]:[]};if(g.type==="tag"){const v=["h1","h2","h3","h4","h5","h6","div","p","span","li","ul","ol","section","article","aside","nav","header","footer","main","figure","figcaption","blockquote","pre","code","table","thead","tbody","tr","th","td"],w=g.options||v;return{...x,type:"tag",options:w,defaultValue:g.defaultValue||"div",currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.defaultValue||"div"}}else return{...x,type:"checkbox",options:g.options,optional:g.optional,currentValue:Array.isArray(u[g.fieldName])?u[g.fieldName]:[]}}):[]}function l(u,f){if(r.value===u){d();return}const p=u.split(".");let h=-1;if(p[0]==="page"&&p.length>=2&&(h=parseInt(p[1])),r.value&&e.value){const m=e.value.querySelector(`[data-zcode-path="${r.value}"]`);m&&Qt(m)}n.value=f,o.value=h,r.value=u,i.value=s(f),a.nextTick(()=>{if(e.value&&r.value===u){const m=e.value.querySelector(`[data-zcode-path="${u}"]`);m&&(Yt(m,"edit"),ar(m))}})}function c(u){if(n.value&&r.value){const f=dn(r.value,t);f&&(u.optional&&(u.currentValue===""||u.currentValue===null)?f[u.fieldName]=void 0:f[u.fieldName]=u.currentValue)}}function d(){if(r.value&&e.value){const u=e.value.querySelector(`[data-zcode-path="${r.value}"]`);u&&Qt(u)}n.value=null,r.value="",i.value=[]}return{editingComponent:n,editingComponentIndex:o,editingComponentPath:r,editingAvailableFields:i,handleEditClick:l,saveFieldEdit:c,closeEditPanel:d}}function Lv(t,e,n,o){const r=a.ref(null),i=a.ref(null),s=a.ref(null),l=a.ref(o?.categoryOrder==="individual"?"individual":o?.categoryOrder==="special"?"special":"common"),c=a.ref("all"),d=a.ref(null),u=a.ref(!1);function f(z){if(z.includes(".slots.")){const P=z.split(".");let V=-1;for(let j=P.length-1;j>=0;j--)if(P[j]==="slots"){V=j;break}if(V!==-1&&V+1<P.length)return P.slice(0,V+2).join(".")}return z}const p=a.computed(()=>{const z=t.parts,P=l.value==="common"?z.common:l.value==="individual"?z.individual:z.special;if(r.value&&r.value.includes(".slots.")){const j=[...z.common,...z.individual,...z.special],L=f(r.value);return b(L,j,P)}return[...new Set(P.map(j=>j.type))]});function h(z,P){const V=z.split(".");let j=-1;for(let J=V.length-1;J>=0;J--)if(V[J]==="slots"){j=J;break}if(j===-1)return null;const L=V.slice(0,j).join("."),H=V[j+1],Q=dn(L,t);if(!Q)return null;const G=Q.part_id;let se=null;for(const J of P)if(J.parts.some(K=>K.id===G)){se=J;break}if(!se)return null;const X=(se.parts.find(J=>J.id===G)||se.parts[0])?.slots?.[H];if(X){const J=X.allowedParts;if(J&&Array.isArray(J))return J}return null}const m=a.computed(()=>{const z=t.parts,P=l.value==="common"?z.common:l.value==="individual"?z.individual:z.special,V=p.value;let j=P.filter(G=>V.includes(G.type));c.value&&c.value!=="all"&&c.value!=="selected"&&(j=j.filter(G=>G.type===c.value));const L=[...z.common,...z.individual],H=r.value&&r.value.includes(".slots.")?h(f(r.value),L):null,Q=new Map;return j.forEach(G=>{Q.has(G.type)||Q.set(G.type,{type:G,parts:[]});const se=Q.get(G.type);H!==null?H.length>0&&G.parts.forEach(Z=>{H.includes(Z.id)&&se.parts.push(Z)}):G.parts.forEach(Z=>{Z.slotOnly||se.parts.push(Z)})}),Array.from(Q.values()).map(G=>({type:G.type.type,description:G.type.description,typeData:G.type,parts:G.parts}))});function b(z,P,V){const j=z.split(".");let L=-1;for(let K=j.length-1;K>=0;K--)if(j[K]==="slots"){L=K;break}if(L===-1)return[...new Set(V.map(K=>K.type))];const H=j.slice(0,L).join("."),Q=j[L+1],G=dn(H,t);if(!G)return[...new Set(V.map(K=>K.type))];const se=G.part_id;let Z=null,X=null;for(const K of P){const Y=K.parts.find(ce=>ce.id===se);if(Y){Z=K,X=Y;break}}if(!Z||!X)return[...new Set(V.map(K=>K.type))];const J=X?.slots?.[Q];if(J){const K=J.allowedParts;if(K&&Array.isArray(K)){const Y=new Set;P.forEach(Ee=>{Ee.parts.forEach(_e=>{K.includes(_e.id)&&Y.add(Ee.type)})});let ce=Array.from(Y);return ce=ce.filter(Ee=>V.some(_e=>_e.type===Ee)),ce}}return[...new Set(V.map(K=>K.type))]}function g(z,P=!1){if(r.value===z){D();return}if(r.value&&e.value){const ce=e.value.querySelector(`[data-zcode-path="${r.value}"]`);ce&&Qt(ce);const Ee=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);Ee&&Qt(Ee)}r.value=z,c.value="all",l.value="common",i.value=null,s.value=null;const V=dn(z,t);V&&V.part_id?d.value=V:d.value=null;const j=t.parts,L=j.common,H=j.individual,Q=j.special;let G=[],se=[];if(z.includes(".slots.")){const ce=[...L,...H,...Q],Ee=f(z);G=b(Ee,ce,L),se=b(Ee,ce,H)}else G=[...new Set(L.map(ce=>ce.type))],se=[...new Set(H.map(ce=>ce.type))];const Z=G.length>0,X=se.length>0,J=Q.length>0,K=o?.categoryOrder;let Y;K==="special"&&J?Y="special":K==="individual"&&X?Y="individual":K==="common"&&Z||Z?Y="common":X?Y="individual":J?Y="special":Y="common",l.value=Y,a.nextTick(()=>{if(e.value&&r.value===z){const ce=e.value.querySelector(`[data-zcode-path="${z}"]`);if(ce)Yt(ce,"add"),ar(ce);else{const Ee=f(z);if(Ee!==z){const _e=e.value.querySelector(`[data-zcode-slot-path="${Ee}"]`);_e&&(Yt(_e,"add"),ar(_e))}}}})}function x(z){l.value=z,c.value="all",i.value=null,s.value=null,u.value=!1}function v(z){if(c.value=z,z==="selected"&&d.value&&d.value.part_id){const P=t.parts,V=[...P.common,...P.individual,...P.special];for(const j of V){const L=j.parts.find(H=>H.id===d.value.part_id);if(L){i.value=j,s.value=L;break}}}else z!=="selected"&&(i.value=null,s.value=null);u.value=!1}function w(z,P){const V=M(z,P);return n(V,"")}function T(){return d.value?n(d.value,""):""}function M(z,P){const V=y(z,!1,new Set,P.id);return V.id="preview",V}function A(z,P){if(s.value?.id===P.id){i.value=null,s.value=null;return}i.value=z,s.value=P,c.value==="selected"&&(c.value="all"),u.value=!1}function y(z,P=!1,V=new Set,j){const L=j?z.parts.find(X=>X.id===j)||z.parts[0]:P&&s.value?s.value:z.parts[0];if(!L)throw new Error(`Part not found for type: ${z.type}`);const H=`${z.id}:${L.id}`;if(V.has(H)){const X=Fn(L.body),J={};return X.forEach(K=>{K.optional?J[K.fieldName]=void 0:K.type==="text"?J[K.fieldName]=K.defaultValue:K.type==="radio"?J[K.fieldName]=K.options?.[0]:K.type==="checkbox"?J[K.fieldName]=[]:K.type==="boolean"?J[K.fieldName]=!0:K.type==="rich"?J[K.fieldName]=K.defaultValue?`<p>${K.defaultValue}</p>`:"<p></p>":K.type==="image"&&(J[K.fieldName]=K.defaultValue||"")}),{id:jn(),part_id:L.id,...J}}V.add(H);const Q=Fn(L.body),G={};Q.forEach(X=>{X.optional?G[X.fieldName]=void 0:X.type==="text"?G[X.fieldName]=X.defaultValue:X.type==="radio"?G[X.fieldName]=X.options?.[0]:X.type==="checkbox"?G[X.fieldName]=[]:X.type==="boolean"?G[X.fieldName]=!0:X.type==="rich"?G[X.fieldName]=X.defaultValue?`<p>${X.defaultValue}</p>`:"<p></p>":X.type==="image"&&(G[X.fieldName]=X.defaultValue||"")});const se={id:jn(),part_id:L.id,...G},Z=L.slots;if(Z){const X={};Object.entries(Z).forEach(([J,K])=>{const Y=K.allowedParts;if(Y&&Y.length===1){const ce=Y[0],Ee=t.parts,_e=[...Ee.common,...Ee.individual,...Ee.special];let Le=null,C=null;for(const N of _e){const O=N.parts.find(k=>k.id===ce);if(O){Le=N,C=O;break}}if(Le&&C){const N=y(Le,!1,V,C.id);X[J]=[N]}else X[J]=[]}else X[J]=[]}),Object.keys(X).length>0&&(se.slots=X)}return se}function E(z){return y(z,!0)}function S(z){if(!i.value||!s.value||!r.value){console.error("Missing required values:",{addSelectedType:i.value,addSelectedPart:s.value,addTargetPath:r.value});return}let P;if(c.value==="selected"&&d.value){if(P=JSON.parse(JSON.stringify(d.value)),P.id=jn(),P.slots){const L=H=>{H.forEach(Q=>{Q.id=jn(),Q.slots&&Object.values(Q.slots).forEach(G=>{Array.isArray(G)?L(G):G&&typeof G=="object"&&G.children&&L(G.children||[])})})};Object.values(P.slots).forEach(H=>{Array.isArray(H)?L(H):H&&typeof H=="object"&&H.children&&L(H.children||[])})}}else P=E(i.value);const V=r.value,j=V.split(".");if(j[0]==="page"&&j.length===2){const L=parseInt(j[1]);z==="before"?(t.page.splice(L,0,P),u.value&&(r.value=`page.${L+1}`)):t.page.splice(L+1,0,P)}else if(j.includes("slots")){const L=f(V),H=L.split(".");let Q=-1;for(let Y=H.length-1;Y>=0;Y--)if(H[Y]==="slots"){Q=Y;break}if(Q===-1||Q>=H.length-1){console.error("Invalid slot path:",L);return}const G=H.slice(0,Q).join("."),se=H[Q+1],Z=V!==L?parseInt(j[j.length-1]):-1,X=dn(G,t);if(!X){console.error("Parent component not found:",G);return}X.slots||(X.slots={});const J=X.slots[se];let K=[];if(Array.isArray(J)?K=J:J&&typeof J=="object"&&J.children?(K=J.children||[],J.children||(J.children=[])):(X.slots[se]=[],K=X.slots[se]),Z===-1)K.push(P);else if(z==="before"){if(K.splice(Z,0,P),u.value){const Y=f(V);if(V!==Y){const ce=[...j];ce[ce.length-1]=String(Z+1),r.value=ce.join(".")}else{const Ee=[...Y.split(".")];Ee.push("0"),r.value=Ee.join(".")}}}else K.splice(Z+1,0,P);Array.isArray(X.slots[se])||(X.slots[se].children=K)}if(d.value||c.value==="selected"&&(c.value="all"),!u.value)D();else if(z==="before"&&e.value&&r.value){const L=e.value.querySelector(`[data-zcode-path="${V}"]`);L&&Qt(L),a.nextTick(()=>{if(e.value&&r.value){const H=e.value.querySelector(`[data-zcode-path="${r.value}"]`);H&&Yt(H,"add")}})}}function D(){if(r.value&&e.value){const z=e.value.querySelector(`[data-zcode-path="${r.value}"]`);z&&Qt(z);const P=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);P&&Qt(P)}r.value=null,i.value=null,s.value=null,d.value=null,l.value="common",c.value="all",u.value=!1}const W=a.computed(()=>t.parts.special.length>0);return{addTargetPath:r,addSelectedType:i,addSelectedPart:s,clickedComponent:d,addPartCategory:l,addTypeTab:c,keepAdding:u,availablePartTypes:p,groupedPartsByType:m,hasSpecialParts:W,handleAddClick:g,handleCategoryTabClick:x,handleTypeTabClick:v,selectPart:A,getPartPreviewHtml:w,getClickedComponentPreviewHtml:T,confirmAddPart:S,cancelAdd:D}}function $v(t,e,n,o){const r=a.ref(null),i=a.ref("");function s(f,p){if(i.value===f){u();return}if(i.value&&e.value){const h=e.value.querySelector(`[data-zcode-path="${i.value}"]`);h&&Qt(h)}r.value=p,i.value=f,o(()=>{if(e.value&&i.value===f){const h=e.value.querySelector(`[data-zcode-path="${f}"]`);h&&(Yt(h,"delete"),ar(h))}})}function l(){if(!i.value)return;const f=i.value,p=f.split(".");let h=null,m=null;if(p.length===2&&p[0]==="page"){const b=parseInt(p[1]);!isNaN(b)&&b>=0&&b<t.page.length&&(t.page.splice(b,1),t.page.length===0&&o(()=>{n("add")}))}else if(p.length>2&&p[0]==="page"){const b=parseInt(p[1]);if(isNaN(b)||b<0||b>=t.page.length){console.error("Invalid top-level index:",b),u();return}let g=t.page[b];const x=p.slice(2);x.length>=3&&x[0]==="slots"&&(m=x[1],h=`page.${b}`);for(let w=0;w<x.length-1;w++){if(!g||typeof g!="object"){console.error("Invalid path:",f),u();return}g=g[x[w]]}const v=x[x.length-1];if(g&&typeof g=="object")if(Array.isArray(g)){const w=parseInt(v);!isNaN(w)&&w>=0&&w<g.length?g.splice(w,1):console.error("Invalid array index:",v)}else v in g?delete g[v]:console.error("Field not found:",f);else console.error("Invalid current object:",f)}h&&m&&o(()=>{c(h,m)}),u()}function c(f,p){const h=dn(f,t);if(!h)return;const m=h.slots;if(!m||!Array.isArray(m[p]))return;const b=m[p];if(b.length===0){const g=h.part_id,x=t.parts,v=[...x.common,...x.individual];let w=null,T=null;for(const A of v){const y=A.parts.find(E=>E.id===g);if(y){w=A,T=y;break}}if(!w||!T)return;const M=T?.slots?.[p];if(M){const A=M.allowedParts;if(A&&A.length===1){const y=A[0];let E=null,S=null;for(const D of v){const W=D.parts.find(z=>z.id===y);if(W){E=D,S=W;break}}if(E&&S){const D=d(E,S.id);b.push(D)}}}}}function d(f,p){const h=p&&f.parts.find(v=>v.id===p)||f.parts[0];if(!h)throw new Error(`Part not found for type: ${f.type}`);const m=Fn(h.body),b={};m.forEach(v=>{v.optional?b[v.fieldName]=void 0:v.type==="text"?b[v.fieldName]=v.defaultValue:v.type==="radio"?b[v.fieldName]=v.options?.[0]:v.type==="checkbox"?b[v.fieldName]=[]:v.type==="boolean"?b[v.fieldName]=!0:v.type==="rich"?b[v.fieldName]=v.defaultValue?`<p>${v.defaultValue}</p>`:"<p></p>":v.type==="image"&&(b[v.fieldName]=v.defaultValue||"")});const g={id:jn(),part_id:h.id,...b},x=h.slots;if(x){const v={};Object.entries(x).forEach(([w,T])=>{const M=T.allowedParts;if(M&&M.length===1){const A=M[0],y=t.parts,E=[...y.common,...y.individual];let S=null,D=null;for(const W of E){const z=W.parts.find(P=>P.id===A);if(z){S=W,D=z;break}}if(S&&D){const W=d(S,D.id);v[w]=[W]}else v[w]=[]}else v[w]=[]}),Object.keys(v).length>0&&(g.slots=v)}return g}function u(){if(i.value&&e.value){const f=e.value.querySelector(`[data-zcode-path="${i.value}"]`);f&&Qt(f)}r.value=null,i.value=""}return{deleteConfirmComponent:r,deleteConfirmPath:i,handleDeleteClick:s,confirmDelete:l,cancelDelete:u}}function Vv(t,e){const n=a.ref("");function o(l,c){if(!l||!c)return!1;const d=l.split("."),u=c.split(".");if(d.length!==u.length||l===c)return!1;if(d.includes("slots")&&u.includes("slots")){let f=-1,p=-1;for(let x=d.length-1;x>=0;x--)if(d[x]==="slots"){f=x;break}for(let x=u.length-1;x>=0;x--)if(u[x]==="slots"){p=x;break}if(f===-1||p===-1)return!1;const h=d.slice(0,f).join("."),m=u.slice(0,p).join(".");if(h!==m)return!1;const b=d[f+1],g=u[p+1];return b===g}if(d.length>2){const f=d.slice(0,-1).join("."),p=u.slice(0,-1).join(".");if(f!==p)return!1}return!0}function r(l){if(!l)return;if(!n.value){const d=od(l);if(d&&e.value){const u=e.value.querySelector(`[data-zcode-path="${d}"]`);u&&yn(u)}if(n.value=l,e.value){const u=e.value.querySelector(`[data-zcode-path="${l}"]`);u&&(Yt(u,"reorder"),ar(u))}return}if(n.value===l){i();return}if(!o(n.value,l)){alert("この要素とは並べ替えできません。同じ階層の要素を選択してください。"),i();return}s(n.value,l)||alert("並べ替えに失敗しました。同じ階層の要素を選択してください。"),i()}function i(){if(n.value&&e.value){const l=e.value.querySelector(`[data-zcode-path="${n.value}"]`);l&&Qt(l)}n.value=""}function s(l,c){const d=l.split("."),u=c.split(".");if(d.length===2&&u.length===2&&d[0]==="page"&&u[0]==="page"){const f=parseInt(d[1]),p=parseInt(u[1]);if(!isNaN(f)&&!isNaN(p)&&f!==p){const h=[...t.page],[m]=h.splice(f,1);return h.splice(p,0,m),t.page=h,!0}return!1}else if(d.includes("slots")&&u.includes("slots")){let f=-1,p=-1;for(let y=d.length-1;y>=0;y--)if(d[y]==="slots"){f=y;break}for(let y=u.length-1;y>=0;y--)if(u[y]==="slots"){p=y;break}if(f===-1||p===-1)return!1;const h=d.slice(0,f).join("."),m=u.slice(0,p).join(".");if(h!==m)return!1;const b=d[f+1],g=u[p+1];if(b!==g)return!1;const x=parseInt(d[d.length-1]),v=parseInt(u[u.length-1]);if(isNaN(x)||isNaN(v)||x===v)return!1;const w=dn(h,t);if(!w||!w.slots||!w.slots[b])return!1;const T=w.slots[b];let M=[];if(Array.isArray(T))M=T;else if(T&&typeof T=="object"&&T.children)M=T.children||[];else return!1;const[A]=M.splice(x,1);return M.splice(v,0,A),!Array.isArray(T)&&typeof T=="object"&&T.children&&(T.children=M),!0}else if(d.length>2&&u.length>2){const f=d.slice(0,-1).join("."),p=u.slice(0,-1).join(".");if(f===p){const h=parseInt(d[d.length-1]),m=parseInt(u[u.length-1]);if(!isNaN(h)&&!isNaN(m)&&h!==m){const b=parseInt(d[1]);let g=t.page[b];for(let x=2;x<d.length-1;x++)g=g[d[x]];if(Array.isArray(g)){const[x]=g.splice(h,1);return g.splice(m,0,x),!0}}}}return!1}return{reorderSourcePath:n,handleReorderClick:r,canReorderWith:o,cancelReorder:i}}function Bv(t,e,n,o,r,i,s,l,c){const d=a.computed(()=>o.value?od(o.value):null),u=a.computed(()=>{if(!d.value)return!1;const p=dn(d.value,t);return p!=null});function f(){if(!d.value)return;const p=d.value;if(!e.value||!e.value.querySelector(`[data-zcode-path="${p}"]`))return;const m=dn(p,t);if(m){if(o.value&&e.value){const b=e.value.querySelector(`[data-zcode-path="${o.value}"]`);b&&yn(b)}switch(n.value){case"edit":r(p,m);break;case"add":i(p,!0);break;case"reorder":if(c.value){const b=e.value.querySelector(`[data-zcode-path="${c.value}"]`);b&&Qt(b),c.value=""}s(p);break;case"delete":l(p,m);break}}}return{parentPath:d,canSelectParent:u,selectParentElement:f}}function Fv(t,e,n,o,r,i,s,l,c,d,u,f,p,h){const m=new Map;function b(){if(!e.value)return;g();const x=e.value.querySelectorAll("[data-zcode-id]"),v=y=>{const E=y.target;if(!E)return;const S=E.closest("[data-zcode-add-slot]");if(!S)return;const D=S.closest("[data-zcode-slot-path]"),W=D?.getAttribute("data-zcode-slot-path");if(!W)return;y.preventDefault(),y.stopPropagation(),y.stopImmediatePropagation();const z=()=>{const P=e.value?.querySelector(`[data-zcode-slot-path="${W}"]`);P&&(yn(P),Yt(P,"add"))};if(D&&yn(D),n.value!=="add"){p("add"),a.nextTick(()=>{c(W),a.nextTick(()=>{z()})});return}z(),a.nextTick(()=>{c(W),a.nextTick(()=>{z()})})};let w=null;const T=y=>o.value===y||r.value===y||i.value===y||s.value===y,M=y=>{const S=y.target;if(!S)return;const D=S.closest("[data-zcode-slot-path]");if(!D){if(w){const z=w.getAttribute("data-zcode-slot-path")||"";(!z||!T(z))&&yn(w),w=null}return}if(w===D)return;if(w){const z=w.getAttribute("data-zcode-slot-path")||"";(!z||!T(z))&&yn(w)}w=D;const W=D.getAttribute("data-zcode-slot-path")||"";W&&!T(W)&&wc(D,n.value)},A=y=>{const E=y,S=E.target;if(!S)return;const D=E.relatedTarget,W=S.closest("[data-zcode-slot-path]");if(!W||D&&W.contains(D))return;const z=W.getAttribute("data-zcode-slot-path")||"";(!z||!T(z))&&yn(W),w===W&&(w=null)};e.value.addEventListener("click",v,!0),e.value.addEventListener("mouseover",M,!0),e.value.addEventListener("mouseout",A,!0),m.set(e.value,[{type:"click",listener:v,options:!0},{type:"mouseover",listener:M,options:!0},{type:"mouseout",listener:A,options:!0}]),x.forEach(y=>{const E=y,S=E.getAttribute("data-zcode-path");if(!S)return;const D=V=>{const j=V.target,H=j?.closest("[data-zcode-path]")?.getAttribute("data-zcode-path");if(H&&H!==S)return;j?.closest("a[href]")&&(h.value||V.preventDefault()),h.value||(V.stopPropagation(),V.stopImmediatePropagation());const G=dn(S,t);if(G)switch(yn(E),n.value){case"edit":l(S,G);break;case"add":c(S);break;case"reorder":if(i.value){const se=i.value.split("."),Z=S.split(".");if(se.length!==Z.length&&se.indexOf("rows")!==-1){const J=Z.indexOf("cells");if(J!==-1){let K=-1;for(let Y=J-1;Y>=0;Y--)if(Z[Y]==="slots"){K=Y;break}if(K!==-1){const Y=Z.slice(0,K).join(".");if(Y&&f(i.value,Y)){d(Y);return}}}}}d(S);break;case"delete":u(S,G);break}},W=V=>{if(o.value===V||r.value===V||i.value===V||s.value===V)return!0;if(V.includes(".slots.")){const L=V.split(".");let H=-1;for(let Q=L.length-1;Q>=0;Q--)if(L[Q]==="slots"){H=Q;break}if(H!==-1&&H+1<L.length){const Q=L.slice(0,H+2).join(".");return r.value===Q||o.value===Q||i.value===Q||s.value===Q}}return!1},z=()=>{W(S)||(n.value==="reorder"&&i.value?f(i.value,S)&&wc(E,n.value):wc(E,n.value)),n.value==="reorder"?E.style.cursor=i.value&&f(i.value,S)?"move":i.value?"not-allowed":"move":E.style.cursor="pointer"},P=()=>{W(S)||yn(E),E.style.cursor=""};E.addEventListener("click",D,!0),E.addEventListener("mouseenter",z),E.addEventListener("mouseleave",P),m.set(E,[{type:"click",listener:D,options:!0},{type:"mouseenter",listener:z},{type:"mouseleave",listener:P}])}),a.nextTick(()=>{a.nextTick(()=>{if(n.value==="edit"&&o.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${o.value}"]`);y&&Yt(y,"edit")}if(n.value==="add"&&r.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${r.value}"]`);if(y)Yt(y,"add");else{const E=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);E&&Yt(E,"add")}}if(n.value==="reorder"&&i.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${i.value}"]`);y&&Yt(y,"reorder")}if(n.value==="delete"&&s.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${s.value}"]`);y&&Yt(y,"delete")}})})}function g(){m.forEach((x,v)=>{x.forEach(({type:w,listener:T,options:M})=>{v.removeEventListener(w,T,M)})}),m.clear()}return{setupClickHandlers:b,cleanupEventListeners:g}}function jv(t,e,n,o,r,i,s,l,c,d,u,f,p){function h(m){t.value&&t.value.querySelectorAll("[data-zcode-path], [data-zcode-slot-path]").forEach(g=>{Qt(g),yn(g)}),e.value==="edit"&&o.value?(l.value=null,o.value=""):e.value==="add"&&r.value?(r.value=null,c.value=null,d.value=null,u.value="common",f.value=null):e.value==="reorder"&&i.value?i.value="":e.value==="delete"&&s.value&&p(),n(m)}return{switchMode:h}}function Uv(t,e,n){const o=a.ref(!1),r=a.ref({x:0,y:0});function i(p){!e.value||!t.value||!p.target.closest("[data-zcode-path]")||(p.preventDefault(),p.stopPropagation(),r.value={x:p.clientX,y:p.clientY},o.value=!0)}function s(p){n(p),o.value=!1}function l(){o.value=!1}function c(p){p.target.closest(".zcode-context-menu")||l()}function d(p){p.target.closest(".zcode-context-menu")||l()}function u(){!t.value||!e.value||(t.value.addEventListener("contextmenu",i),document.addEventListener("click",c),document.addEventListener("contextmenu",d))}function f(){t.value&&(t.value.removeEventListener("contextmenu",i),document.removeEventListener("click",c),document.removeEventListener("contextmenu",d))}return{isVisible:o,position:r,handleModeSelect:s,closeMenu:l,setupContextMenu:u,cleanupContextMenu:f}}function Hv(t){const e=t;if(!e||!e.page||!Array.isArray(e.page))return!1;for(const n of e.page)if(!n.id||!n.part_id)return!1;return!0}function Sc(t,e){const n=[],o=(r,i)=>{Object.keys(r).forEach(s=>{s.includes("image")&&r[s]===t&&n.push({path:i,component:r,fieldName:s})}),r.slots&&Object.entries(r.slots).forEach(([s,l])=>{Array.isArray(l)&&l.forEach((c,d)=>{o(c,`${i}.slots.${s}.${d}`)})})};return e.forEach((r,i)=>{o(r,`page.${i}`)}),n}const Wv={key:0,class:"zcode-save-banner zcode-save-banner--error",role:"alert"},Gv={class:"zcode-save-banner-text"},qv=["aria-label"],Kv={key:1,class:"zcode-save-controls-fixed"},Jv={class:"zcode-save-confirm-dialog"},Xv={class:"zcode-save-confirm-dialog-header"},Yv={class:"zcode-save-confirm-dialog-title"},Qv={class:"zcode-save-confirm-dialog-body"},Zv={class:"zcode-save-confirm-dialog-footer"},Hs=a.defineComponent({__name:"ZeroCodeCMS",props:{locale:{type:String},page:{type:String},cssCommon:{type:String},cssIndividual:{type:String},cssSpecial:{type:String},partsCommon:{type:String},partsIndividual:{type:String},partsSpecial:{type:String},imagesCommon:{type:String},imagesIndividual:{type:String},imagesSpecial:{type:String},config:{type:String},endpoints:{type:String},backendData:{type:String}},setup(t,{expose:e}){const{t:n}=rn(),o=t,r=a.ref("manage"),i=a.ref(!1),l=(le=>{if(!le)return{};try{return JSON.parse(le)}catch(de){return console.warn("[ZeroCodeCMS] Failed to parse config:",de),{}}})(o.config),c=(le,de,be)=>{const Ge=Au();return Ge[le]!==void 0?Ge[le]:be!==void 0?be:de},d=a.ref(c("devRightPadding",!1,l.cms?.devRightPadding)),u=a.ref(c("enableContextMenu",!1,l.cms?.enableContextMenu)),f=a.ref(c("showSaveConfirm",!0,l.cms?.showSaveConfirm)),p=a.computed(()=>d.value),h=a.ref(!1),{cmsData:m,loadDataFromProps:b,getData:g,setData:x}=km(o),{fullPageHtml:v,renderComponentToHtml:w}=fi(m,!0);function T(le){if(le!=="css")return le?g(le):g()}const M=a.ref(null),A=a.ref(null),y=a.computed(()=>A.value?.previewArea||null),{currentMode:E,switchMode:S,allowDynamicContentInteraction:D}=Rv(),W=c("allowDynamicContentInteraction",!1,l.cms?.allowDynamicContentInteraction),z=a.ref(W);D.value=W;let P=!1;a.watch(r,(le,de)=>{le==="preview"?(P=z.value,z.value=!0,D.value=!0,a.nextTick(()=>{st()})):de==="preview"&&(z.value=P,D.value=P,a.nextTick(()=>{st()})),Ln("view-mode-changed",{mode:le,previousMode:de})});const{editingComponent:V,editingComponentPath:j,editingAvailableFields:L,handleEditClick:H,saveFieldEdit:Q,closeEditPanel:G}=Pv(m,y),se=a.ref({}),Z=a.ref([]),X=a.ref({visible:!1,message:""});function J(le){if(le?.fieldName&&se.value[le.fieldName]){const de={...se.value};delete de[le.fieldName],se.value=de}Q(le)}const{addTargetPath:K,addSelectedType:Y,addSelectedPart:ce,clickedComponent:Ee,addPartCategory:_e,addTypeTab:Le,keepAdding:C,availablePartTypes:N,groupedPartsByType:O,hasSpecialParts:k,handleAddClick:U,handleCategoryTabClick:te,handleTypeTabClick:me,selectPart:ve,getPartPreviewHtml:Ve,getClickedComponentPreviewHtml:Ce,confirmAddPart:_,cancelAdd:I}=Lv(m,y,w,l),{reorderSourcePath:q,handleReorderClick:fe,canReorderWith:Ae,cancelReorder:Te}=Vv(m,y),{deleteConfirmComponent:we,deleteConfirmPath:B,handleDeleteClick:ee,confirmDelete:Me,cancelDelete:$}=$v(m,y,S,a.nextTick),{switchMode:F}=jv(y,E,S,j,K,q,B,V,Y,ce,_e,Le,$),re=a.computed(()=>E.value==="edit"&&j.value?j.value:E.value==="add"&&K.value?K.value:E.value==="reorder"&&q.value?q.value:E.value==="delete"&&B.value?B.value:null),{canSelectParent:ae,selectParentElement:ke}=Bv(m,y,E,re,H,U,fe,ee,q),Fe=a.computed(()=>!!(V.value||K.value||q.value||we.value)),st=()=>{if(y.value){const le=y.value.getRootNode();if(le instanceof ShadowRoot){let Ge=0;const et=()=>{Ge++;const At=le;if(typeof At.__zcmsSetAllowDynamicContentInteraction=="function"){At.__zcmsSetAllowDynamicContentInteraction(z.value);return}Ge<30&&setTimeout(et,50)};et()}}},{setupClickHandlers:xn,cleanupEventListeners:oi}=Fv(m,y,E,j,K,q,B,H,U,fe,ee,Ae,F,z),{isVisible:Tc,position:Zo,handleModeSelect:er,closeMenu:zc,setupContextMenu:Pn,cleanupContextMenu:ri}=Uv(y,u,F);function Ln(le,de){const be=En();if(be){const et=new CustomEvent(le,{detail:de,bubbles:!0,composed:!0});be.dispatchEvent(et);return}const Ge=new CustomEvent(le,{detail:de,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(Ge)}function Ze(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function En(){if(M.value){const de=M.value.getRootNode();if(de instanceof ShadowRoot&&de.host)return de.host;const be=M.value.closest?.("zcode-cms")||M.value.closest?.("zcode-editor");if(be)return be}const le=a.getCurrentInstance();if(le){const de=le.vnode.el;if(de instanceof HTMLElement){const be=de.getRootNode();if(be instanceof ShadowRoot&&be.host)return be.host;const Ge=de.closest?.("zcode-cms")||de.closest?.("zcode-editor");return Ge||null}if(de instanceof Node){const be=de.getRootNode();if(be instanceof ShadowRoot&&be.host)return be.host}}return null}function Xs(le){return typeof le=="object"&&le!==null}function Ys(le){return Array.isArray(le)?le.filter(de=>Xs(de)).map(de=>({path:typeof de.path=="string"?de.path:void 0,field:typeof de.field=="string"?de.field:void 0,message:typeof de.message=="string"?de.message:void 0,code:typeof de.code=="string"?de.code:void 0})):[]}function tr(le){if(!le){se.value={};return}const de={};for(const be of Z.value){const Ge=typeof be?.path=="string"?be.path:null,et=typeof be?.field=="string"?be.field:null,At=typeof be?.message=="string"?be.message:null;!et||!At||Ge&&Ge!==le||(de[et]=At)}se.value=de}const Qs=(le,de)=>{de==="common"?m.images.common.push(le):de==="individual"?m.images.individual.push(le):m.images.special.push(le)},Zs=le=>{Sc(le,m.page).forEach(et=>{Object.keys(et.component).forEach(At=>{At.includes("image")&&et.component[At]===le&&(et.component[At]="")})});const be=m.images.common.findIndex(et=>et.id===le);be!==-1&&m.images.common.splice(be,1);const Ge=m.images.individual.findIndex(et=>et.id===le);Ge!==-1&&m.images.individual.splice(Ge,1)};function ea(le){const de=le.detail;if(!Xs(de))return;const be=de;if(be.ok===!0){X.value.visible=!1,X.value.message="",Z.value=[],se.value={};return}if(be.ok!==!1)return;const Ge=Ys(be.errors);Z.value=Ge;const et=Ge.length,At=typeof Ge[0]?.message=="string"&&Ge[0].message?Ge[0].message:null;X.value.visible=!0,X.value.requestId=typeof be.requestId=="string"?be.requestId:void 0,X.value.target=typeof be.target=="string"?be.target:void 0,X.value.message=At?n("editor.saveFailedWithMessage",{count:et,message:At}):n("editor.saveFailedWithCount",{count:et}),tr(j.value||null)}a.onMounted(()=>{b(),a.nextTick(()=>{xn(),u.value&&Pn(),st(),Ln("zcode-dom-updated",{})});const le=En();le&&le.addEventListener("save-result",ea)}),a.onUnmounted(()=>{oi(),ri();const le=En();le&&le.removeEventListener("save-result",ea)}),a.watch(()=>j.value,le=>{tr(le||null)}),a.watch([()=>o.page,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial],()=>{b()}),a.watch(m,()=>{a.nextTick(()=>{xn(),Ln("zcode-dom-updated",{})})},{deep:!0}),a.watch([r,y],([le,de])=>{le==="manage"&&de?a.nextTick(()=>{xn(),u.value&&Pn(),st(),Ln("zcode-dom-updated",{})}):ri()}),a.watch(E,()=>{a.nextTick(()=>{Ln("zcode-dom-updated",{})})}),a.watch(d,le=>{vi({devRightPadding:le})}),a.watch(z,le=>{r.value==="manage"&&vi({allowDynamicContentInteraction:le}),D.value=le,a.nextTick(()=>{xn(),st(),Ln("zcode-dom-updated",{})})}),a.watch(u,le=>{vi({enableContextMenu:le}),le?a.nextTick(()=>{Pn()}):ri()}),a.watch(f,le=>{vi({showSaveConfirm:le})});function Zt(){if(!f.value){kn();return}h.value=!0}function kn(){const le=Ze();Ln("save-request",{requestId:le,source:"cms",targets:["page","images-common","images-individual"],timestamp:Date.now()})}function ta(){h.value=!1,kn()}function ii(){h.value=!1}return e({getData:T,setData:x,validateData:Hv,cmsData:m,currentMode:E,switchMode:F,allowDynamicContentInteraction:z,devRightPadding:d,devRightPaddingValue:p,settingsPanelOpen:i}),(le,de)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"containerRef",ref:M,class:a.normalizeClass(["zcode-cms-container",{"zcode-dev-padding":d.value&&Fe.value}])},[a.createVNode(rd,{"current-mode":a.unref(E),"view-mode":r.value,"allow-dynamic-content-interaction":z.value,onSwitchMode:a.unref(F),onSwitchViewMode:de[0]||(de[0]=be=>r.value=be),onOpenSettings:de[1]||(de[1]=be=>i.value=!0)},null,8,["current-mode","view-mode","allow-dynamic-content-interaction","onSwitchMode"]),X.value.visible?(a.openBlock(),a.createElementBlock("div",Wv,[a.createElementVNode("div",Gv,a.toDisplayString(X.value.message),1),a.createElementVNode("button",{class:"zcode-save-banner-close","aria-label":le.$t("common.close"),onClick:de[2]||(de[2]=be=>X.value.visible=!1)}," × ",8,qv)])):a.createCommentVNode("",!0),r.value==="manage"?(a.openBlock(),a.createElementBlock("div",Kv,[a.createElementVNode("button",{class:"zcode-save-btn",onClick:Zt},[a.createVNode(a.unref(Lc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(le.$t("common.save")),1)])])):a.createCommentVNode("",!0),r.value==="preview"?(a.openBlock(),a.createBlock(ma,{key:2,"cms-data":a.unref(m),"allow-dynamic-content-interaction":!0},null,8,["cms-data"])):a.createCommentVNode("",!0),r.value==="manage"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:3},[a.createVNode(Fc,{ref_key:"previewAreaRef",ref:A,"cms-data":a.unref(m),"full-page-html":a.unref(v),"on-add-click":a.unref(U),"allow-dynamic-content-interaction":z.value},null,8,["cms-data","full-page-html","on-add-click","allow-dynamic-content-interaction"]),a.createVNode(zC,{"editing-component":a.unref(V),"editing-available-fields":a.unref(L),"field-errors":se.value,"current-mode":a.unref(E),"can-select-parent":a.unref(ae),"images-common":a.unref(m).images.common,"images-individual":a.unref(m).images.individual,"images-special":a.unref(m).images.special,onClose:a.unref(G),onSelectParent:a.unref(ke),onSaveField:J,onAddImage:Qs,onDeleteImage:Zs},null,8,["editing-component","editing-available-fields","field-errors","current-mode","can-select-parent","images-common","images-individual","images-special","onClose","onSelectParent"]),a.createVNode(LC,{"delete-confirm-component":a.unref(we),"current-mode":a.unref(E),"can-select-parent":a.unref(ae),onConfirm:a.unref(Me),onCancel:a.unref($),onSelectParent:a.unref(ke)},null,8,["delete-confirm-component","current-mode","can-select-parent","onConfirm","onCancel","onSelectParent"]),a.createVNode(WC,{"reorder-source-path":a.unref(q),"current-mode":a.unref(E),"can-select-parent":a.unref(ae),onCancel:a.unref(Te),onSelectParent:a.unref(ke)},null,8,["reorder-source-path","current-mode","can-select-parent","onCancel","onSelectParent"]),a.createVNode(Av,{"add-target-path":a.unref(K),"add-part-category":a.unref(_e),"add-type-tab":a.unref(Le),"add-selected-part":a.unref(ce),"add-selected-type":a.unref(Y),"has-special-parts":a.unref(k),"clicked-component":a.unref(Ee),"available-part-types":a.unref(N),config:a.unref(l),"grouped-parts-by-type":a.unref(O),"can-select-parent":a.unref(ae),"get-part-preview-html":a.unref(Ve),"get-clicked-component-preview-html":a.unref(Ce),"keep-adding":a.unref(C),onCancel:a.unref(I),onSelectParent:a.unref(ke),onCategoryTabClick:a.unref(te),onTypeTabClick:a.unref(me),onSelectPart:a.unref(ve),onConfirmAdd:a.unref(_),onUpdateKeepAdding:de[3]||(de[3]=be=>C.value=be)},null,8,["add-target-path","add-part-category","add-type-tab","add-selected-part","add-selected-type","has-special-parts","clicked-component","available-part-types","config","grouped-parts-by-type","can-select-parent","get-part-preview-html","get-clicked-component-preview-html","keep-adding","onCancel","onSelectParent","onCategoryTabClick","onTypeTabClick","onSelectPart","onConfirmAdd"])],64)):a.createCommentVNode("",!0),a.createVNode(Ou,{"is-open":i.value,"view-mode":r.value,mode:"toolbar","allow-dynamic-content-interaction":z.value,"dev-right-padding":p.value,"enable-context-menu":u.value,"show-save-confirm":f.value,onClose:de[4]||(de[4]=be=>i.value=!1),onToggleDynamicContent:de[5]||(de[5]=be=>z.value=be),onToggleDevPadding:de[6]||(de[6]=be=>d.value=be),onToggleContextMenu:de[7]||(de[7]=be=>u.value=be),onToggleSaveConfirm:de[8]||(de[8]=be=>f.value=be)},null,8,["is-open","view-mode","allow-dynamic-content-interaction","dev-right-padding","enable-context-menu","show-save-confirm"]),a.createVNode(Mv,{"is-visible":a.unref(Tc),position:a.unref(Zo),"current-mode":a.unref(E),onSelectMode:a.unref(er),onClose:a.unref(zc)},null,8,["is-visible","position","current-mode","onSelectMode","onClose"]),h.value?(a.openBlock(),a.createElementBlock("div",{key:4,class:"zcode-save-confirm-dialog-overlay",onClick:a.withModifiers(ii,["self"])},[a.createElementVNode("div",Jv,[a.createElementVNode("div",Xv,[a.createElementVNode("div",Yv,a.toDisplayString(le.$t("saveConfirm.title")),1)]),a.createElementVNode("div",Qv,[a.createElementVNode("p",null,a.toDisplayString(le.$t("saveConfirm.simpleMessage")),1)]),a.createElementVNode("div",Zv,[a.createElementVNode("button",{class:"zcode-btn-secondary",onClick:ii},a.toDisplayString(le.$t("common.cancel")),1),a.createElementVNode("button",{class:"zcode-btn-primary",onClick:ta},a.toDisplayString(le.$t("saveConfirm.saveButton")),1)])])])):a.createCommentVNode("",!0)],2))}}),Sm=":root{--zcode-color-edit: #3b82f6;--zcode-color-add: #10b981;--zcode-color-reorder: #f59e0b;--zcode-color-delete: #ef4444;--zcode-color-edit-hover: #2563eb;--zcode-color-edit-bg: #eff6ff;--zcode-color-edit-bg-active: #dbeafe;--zcode-color-edit-border-hover: #93c5fd;--zcode-color-add-hover: #059669;--zcode-color-add-bg: #ecfdf5;--zcode-color-add-bg-active: #d1fae5;--zcode-color-add-border-hover: #6ee7b7;--zcode-color-reorder-bg: #fffbeb;--zcode-color-reorder-bg-active: #fef3c7;--zcode-color-reorder-border-hover: #fcd34d;--zcode-color-delete-hover: #dc2626;--zcode-color-delete-bg: #fef2f2;--zcode-color-delete-bg-active: #fee2e2;--zcode-color-delete-border-hover: #fca5a5}[class*=zcode-]{box-sizing:border-box}[class*=zcode-]:before,[class*=zcode-]:after{box-sizing:border-box}.zcode-empty-state{text-align:center;padding:60px 20px;color:#666}.zcode-empty-state-btn{margin-top:20px;padding:10px 20px;font-size:16px;background:#42b983;color:#fff;border:none;border-radius:4px;cursor:pointer;transition:background .2s}.zcode-empty-state-btn:hover{background:#359268}.zcode-edit-panel,.zcode-add-panel,.zcode-reorder-panel,.zcode-delete-panel{position:fixed;top:0;right:0;width:375px;height:100vh;background:#fff;box-shadow:-2px 0 8px #0000001a;overflow:hidden;display:flex;flex-direction:column;z-index:1002}.zcode-edit-panel-header,.zcode-add-panel-header,.zcode-reorder-panel-header,.zcode-delete-panel-header{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-shrink:0}.zcode-panel-header-title{margin:0;font-size:14px;font-weight:600;color:#1f2937}.zcode-edit-panel-header .zcode-panel-header-title{color:var(--zcode-color-edit)}.zcode-add-panel-header .zcode-panel-header-title{color:var(--zcode-color-add)}.zcode-reorder-panel-header .zcode-panel-header-title{color:var(--zcode-color-reorder)}.zcode-delete-panel-header .zcode-panel-header-title{color:var(--zcode-color-delete)}.zcode-close-btn{background:none;border:none;cursor:pointer;color:#6b7280;padding:4px 8px;line-height:1;display:flex;align-items:center;justify-content:center}.zcode-close-btn:hover{color:#1f2937}.zcode-edit-fields{padding:16px;font-size:14px;color:#6b7280;overflow-y:auto;flex:1}.zcode-add-panel-content{overflow-y:auto;flex:1}.zcode-edit-fields-text{margin:8px 0}.zcode-component-developer{border:1px dashed #ccc;padding:10px}.zcode-error-message{padding:20px;background:#fff3cd;border:1px solid #ffc107;border-radius:4px;color:#856404}.zcode-for-item{margin-bottom:10px}.zcode-field-editor{padding:16px;overflow-y:auto}.zcode-field-item-title{margin:0 0 15px;color:#2c3e50;font-size:16px;border-bottom:1px solid #eee;padding-bottom:8px}.zcode-field-editor-label{display:block;margin-bottom:8px;font-weight:500;color:#555}.zcode-text-editor{margin-bottom:20px}.zcode-text-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;transition:border-color .2s;box-sizing:border-box}.zcode-text-input:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-field-error{border-color:#ef4444!important;background-color:#fef2f2}.zcode-field-error-message{margin-top:6px;font-size:12px;color:#ef4444;line-height:1.4}.zcode-field-counter{margin-top:6px;font-size:12px;color:#6b7280;text-align:right}.zcode-text-input:disabled,.zcode-textarea:disabled{opacity:.7;cursor:not-allowed}.zcode-text-input[readonly],.zcode-textarea[readonly]{background-color:#f3f4f6;cursor:default}.zcode-radio-editor{margin-top:12px;margin-bottom:12px}.zcode-radio-group{display:flex;flex-direction:column;gap:6px}.zcode-radio-item{display:flex;align-items:center;gap:6px;cursor:pointer;margin-bottom:0;font-weight:400;color:inherit}.zcode-radio-item input[type=radio]{margin:0;cursor:pointer}.zcode-radio-item input[type=radio]:focus{outline:2px solid var(--zcode-color-edit);outline-offset:2px}.zcode-radio-item-label{font-size:14px;color:#4b5563}.zcode-checkbox-editor{margin-top:12px;margin-bottom:12px}.zcode-checkbox-item{display:flex;align-items:center;gap:6px;cursor:pointer;margin-bottom:0;font-weight:400;color:inherit}.zcode-checkbox-item input[type=checkbox]{margin:0;cursor:pointer}.zcode-checkbox-item input[type=checkbox]:focus{outline:2px solid var(--zcode-color-edit);outline-offset:2px}.zcode-checkbox-item-label{font-size:14px;color:#4b5563}.zcode-edit-actions{display:flex;gap:10px;margin-top:20px}.zcode-save-btn{flex:1;background:var(--zcode-color-edit);color:#fff;border:none;padding:10px 16px;border-radius:4px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s}.zcode-save-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-cancel-btn{flex:1;background:#f8f9fa;color:#6c757d;border:1px solid #dee2e6;padding:10px 16px;border-radius:4px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s}.zcode-cancel-btn:hover{background:#e9ecef}[data-zcode-id],[data-zcode-slot-path]{transition:outline .2s;cursor:pointer;position:relative}[data-zcode-id].zcode-outline-active-edit,[data-zcode-id].zcode-outline-active-add,[data-zcode-id].zcode-outline-active-reorder,[data-zcode-id].zcode-outline-active-delete,[data-zcode-slot-path].zcode-outline-active-edit,[data-zcode-slot-path].zcode-outline-active-add,[data-zcode-slot-path].zcode-outline-active-reorder,[data-zcode-slot-path].zcode-outline-active-delete{outline-style:solid;animation:zcode-outline-pulse-edit 1.5s ease-in-out infinite}[data-zcode-id].zcode-outline-active-edit{animation-name:zcode-outline-pulse-edit}[data-zcode-id].zcode-outline-active-add{animation-name:zcode-outline-pulse-add}[data-zcode-id].zcode-outline-active-reorder{animation-name:zcode-outline-pulse-reorder}[data-zcode-id].zcode-outline-active-delete{animation-name:zcode-outline-pulse-delete}[data-zcode-slot-path].zcode-outline-active-edit{animation-name:zcode-outline-pulse-edit}[data-zcode-slot-path].zcode-outline-active-add{animation-name:zcode-outline-pulse-add}[data-zcode-slot-path].zcode-outline-active-reorder{animation-name:zcode-outline-pulse-reorder}[data-zcode-slot-path].zcode-outline-active-delete{animation-name:zcode-outline-pulse-delete}@keyframes zcode-outline-pulse-edit{0%{outline-width:4px;outline-offset:2px;outline-color:#3cd7f6}25%{outline-width:4px;outline-offset:2px;outline-color:#3c83f6}50%{outline-width:4px;outline-offset:2px;outline-color:#493cf6}75%{outline-width:4px;outline-offset:2px;outline-color:#3c83f6}to{outline-width:4px;outline-offset:2px;outline-color:#3cd7f6}}@keyframes zcode-outline-pulse-add{0%{outline-width:4px;outline-offset:2px;outline-color:#0fb82b}25%{outline-width:4px;outline-offset:2px;outline-color:#0fb880}50%{outline-width:4px;outline-offset:2px;outline-color:#0f9cb8}75%{outline-width:4px;outline-offset:2px;outline-color:#0fb880}to{outline-width:4px;outline-offset:2px;outline-color:#0fb82b}}@keyframes zcode-outline-pulse-reorder{0%{outline-width:4px;outline-offset:2px;outline-color:#f5800a}25%{outline-width:4px;outline-offset:2px;outline-color:#f59f0a}50%{outline-width:4px;outline-offset:2px;outline-color:#f5be0a}75%{outline-width:4px;outline-offset:2px;outline-color:#f59f0a}to{outline-width:4px;outline-offset:2px;outline-color:#f5800a}}@keyframes zcode-outline-pulse-delete{0%{outline-width:4px;outline-offset:2px;outline-color:#ef437c}25%{outline-width:4px;outline-offset:2px;outline-color:#ef4343}50%{outline-width:4px;outline-offset:2px;outline-color:#ef7c43}75%{outline-width:4px;outline-offset:2px;outline-color:#ef4343}to{outline-width:4px;outline-offset:2px;outline-color:#ef437c}}.zcode-view-mode-toggle{display:flex;gap:8px}.zcode-view-mode-btn{display:flex;align-items:center;gap:6px;padding:8px 16px;border:1px solid #e5e7eb;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s;font-size:14px;font-weight:500}.zcode-dev-header{display:flex;align-items:center;justify-content:flex-start;padding:8px 16px;background:#f9fafb;border-bottom:1px solid #e5e7eb}.zcode-toolbar{position:sticky;top:0;display:flex;align-items:center;gap:8px;width:fit-content;background:#fffc;margin-bottom:10px;padding:8px 16px;border-radius:8px;box-shadow:0 2px 8px #0000001a;z-index:1001}.zcode-save-banner{position:sticky;top:54px;display:flex;align-items:flex-start;justify-content:space-between;gap:12px;width:min(720px,calc(100% - 32px));margin:0 0 10px;padding:10px 12px;border-radius:10px;border:1px solid transparent;z-index:1001;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}.zcode-save-banner--error{border-color:#fecaca;background:#fef2f2e6;color:#991b1b}.zcode-save-banner-text{font-size:13px;line-height:1.4;word-break:break-word}.zcode-save-banner-close{flex:0 0 auto;width:28px;height:28px;border-radius:8px;border:1px solid rgba(0,0,0,.06);background:#fffc;color:inherit;cursor:pointer}.zcode-save-banner-close:hover{background:#fff}.zcode-toolbar-separator{width:1px;height:24px;background-color:#e5e7eb;margin:0 4px}.zcode-dynamic-content-toggle-label{display:flex;align-items:center;gap:6px;padding:4px 8px;border-radius:4px;cursor:pointer;font-size:14px;color:#374151;-webkit-user-select:none;user-select:none}.zcode-dynamic-content-toggle-label:hover{background-color:#f3f4f6}.zcode-dynamic-content-toggle-checkbox{margin:0;cursor:pointer}.zcode-dev-container .zcode-cms-container .zcode-toolbar{display:none}.zcode-template-tabs{display:inline-flex;gap:6px;margin-right:8px}.zcode-template-tab{padding:6px 10px;border:1px solid #d1d5db;border-radius:6px;background:#fff;font-size:12px;color:#374151;cursor:pointer}.zcode-template-tab.active{background:#111827;border-color:#111827;color:#fff;font-weight:600}.zcode-css-inline-note{flex-shrink:0;margin:0 0 12px;padding:10px 12px;border:1px solid #fde68a;background:#fffbeb;border-radius:8px;color:#92400e;font-size:12px;line-height:1.6}.zcode-part-editor-preview-tab{border:1px solid #e5e7eb;border-radius:8px;background:#fff;padding:16px;min-height:240px;cursor:pointer}.zcode-part-editor-preview-hint{margin-top:10px;font-size:12px;color:#6b7280}.zcode-part-editor-pane{border:1px solid #e5e7eb;border-radius:8px;background:#fff;overflow:hidden;display:flex;flex-direction:column;min-height:0;min-width:0;flex:1}.zcode-part-editor-pane-header{padding:10px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;align-items:center;justify-content:space-between;gap:10px}.zcode-part-editor-pane-header-actions{display:flex;align-items:center;gap:8px;min-width:0}.zcode-css-warning-compact{display:flex;align-items:center;gap:6px;padding:6px 10px;background:#fffbeb;border:1px solid #fde68a;border-radius:6px;font-size:12px;color:#92400e}.zcode-css-warning-compact-icon{flex-shrink:0;color:#f59e0b}.zcode-css-warning-compact-text{white-space:nowrap;font-weight:500}.zcode-part-editor-pane-body{flex:1;min-height:0;overflow:hidden;padding:12px;display:flex;flex-direction:column}.zcode-part-editor-slots-toggle{width:100%;border:1px solid #e5e7eb;border-radius:8px;background:#f9fafb;padding:10px 12px;display:flex;align-items:center;justify-content:space-between;cursor:pointer;font-size:13px;font-weight:600;color:#374151}.zcode-part-editor-slots-toggle:hover{background:#f3f4f6}.zcode-part-editor-slots-toggle-icon{display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;border-radius:999px;border:1px solid #d1d5db;background:#fff;color:#6b7280;font-size:16px;font-weight:400}.zcode-part-editor-slots-toggle-icon.open{transform:rotate(45deg)}.zcode-part-editor-slots-body{margin-top:10px}.zcode-part-editor-topbar{margin-bottom:16px}.zcode-part-editor-topfields{display:grid;grid-template-columns:1fr 1fr;gap:12px}.zcode-part-editor-slots-top{margin-top:12px}.zcode-part-editor-slots-bottom{margin-top:24px;padding-top:24px;border-top:1px solid #e5e7eb}.zcode-save-controls-fixed{position:fixed;bottom:20px;left:20px;display:flex;align-items:center;gap:8px;padding:12px 20px;background:#fffc;border-radius:8px;box-shadow:0 4px 12px #00000026;z-index:1000}.zcode-save-btn{display:flex;align-items:center;gap:6px;padding:8px 16px;border:1px solid var(--zcode-color-edit);border-radius:6px;background:var(--zcode-color-edit);color:#fff;font-size:14px;cursor:pointer;transition:all .2s}.zcode-save-btn:hover{background:var(--zcode-color-edit-hover);border-color:var(--zcode-color-edit-hover)}.zcode-mode-btn{padding:8px 16px;border:2px solid #ddd;border-radius:6px;background:#fff;cursor:pointer;font-weight:500;transition:all .2s;font-size:14px;display:flex;align-items:center;gap:6px}.zcode-mode-btn:hover{background:#f3f4f6}.zcode-mode-edit:hover{color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg);border-color:var(--zcode-color-edit-border-hover)}.zcode-mode-reorder:hover{color:var(--zcode-color-reorder);background:var(--zcode-color-reorder-bg);border-color:var(--zcode-color-reorder-border-hover)}.zcode-mode-add:hover{color:var(--zcode-color-add);background:var(--zcode-color-add-bg);border-color:var(--zcode-color-add-border-hover)}.zcode-mode-delete:hover{color:var(--zcode-color-delete);background:var(--zcode-color-delete-bg);border-color:var(--zcode-color-delete-border-hover)}.zcode-mode-btn.active{border-color:currentColor;font-weight:600}.zcode-mode-edit.active{color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg-active);border-color:var(--zcode-color-edit)}.zcode-mode-reorder.active{color:var(--zcode-color-reorder);background:var(--zcode-color-reorder-bg-active);border-color:var(--zcode-color-reorder)}.zcode-mode-add.active{color:var(--zcode-color-add);background:var(--zcode-color-add-bg-active);border-color:var(--zcode-color-add)}.zcode-mode-delete.active{color:var(--zcode-color-delete);background:var(--zcode-color-delete-bg-active);border-color:var(--zcode-color-delete)}.zcode-view-mode-btn{padding:8px 16px;border:2px solid #ddd;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s;font-size:14px;font-weight:500;display:flex;align-items:center;gap:6px}.zcode-view-mode-btn:hover{background:#f9fafb;border-color:#d1d5db;color:#374151}.zcode-view-mode-btn.active{background:#3b82f6;color:#fff;border-color:#3b82f6}.zcode-view-mode-btn.active:hover{background:#2563eb;border-color:#2563eb}.zcode-settings-btn{display:flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:2px solid #ddd;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s}.zcode-settings-btn:hover{background:#f9fafb;border-color:#d1d5db;color:#374151}.zcode-settings-panel-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000}.zcode-settings-panel{background:#fff;border-radius:8px;box-shadow:0 10px 25px #0003;width:90%;max-width:500px;max-height:80vh;overflow-y:auto}.zcode-settings-panel-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:1px solid #e5e7eb;gap:12px}.zcode-settings-panel-header-title{margin:0;font-size:18px;font-weight:600;color:#111827;flex:1}.zcode-settings-panel-header-actions{display:flex;align-items:center;gap:12px}.zcode-language-select{padding:6px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;color:#374151;cursor:pointer;transition:border-color .2s}.zcode-language-select:hover{border-color:#9ca3af}.zcode-language-select:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61a}.zcode-settings-panel-content{padding:20px}.zcode-setting-item{margin-bottom:24px}.zcode-setting-item:last-child{margin-bottom:0}.zcode-setting-label{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:500;color:#374151;cursor:pointer;-webkit-user-select:none;user-select:none}.zcode-setting-checkbox{width:18px;height:18px;cursor:pointer}.zcode-info-btn{display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;margin-left:auto;background:none;border:none;color:#6b7280;cursor:pointer;border-radius:4px;transition:color .2s}.zcode-info-btn:hover{color:#374151}.zcode-setting-description{margin:8px 0 0 26px;font-size:13px;color:#6b7280;line-height:1.5}.zcode-setting-info{margin:0;padding:12px;background:#f3f4f6;border-radius:6px;font-size:13px}.zcode-delete-panel-content{padding:16px;flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:16px}.zcode-delete-warning{display:flex;align-items:flex-start;gap:12px;padding:12px;background:var(--zcode-color-delete-bg);border:1px solid var(--zcode-color-delete-border-hover);border-radius:6px;color:var(--zcode-color-delete)}.zcode-delete-warning svg{flex-shrink:0;margin-top:2px}.zcode-delete-warning p{margin:0;font-size:14px;font-weight:500;line-height:1.5}.zcode-delete-actions{display:flex;gap:8px;margin-top:16px}.zcode-btn-danger{flex:1;padding:10px;background:var(--zcode-color-delete);color:#fff;border:none;border-radius:6px;cursor:pointer;font-weight:600;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-btn-danger:hover{background:var(--zcode-color-delete-hover)}.zcode-btn-cancel{flex:1;padding:10px;background:#e5e7eb;color:#374151;border:none;border-radius:6px;cursor:pointer;font-weight:500;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-btn-cancel:hover{background:#d1d5db}.zcode-parent-selector{padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-parent-select-btn{width:100%;padding:8px 12px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-parent-select-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-reorder-panel-content{padding:16px;flex:1;overflow-y:auto}.zcode-reorder-panel-content-text{margin:8px 0;color:#374151}.zcode-reorder-source{font-family:monospace;font-size:12px;color:#1f2937}.zcode-field-item{margin-bottom:20px}.zcode-field-item-title{margin:0 0 8px;font-size:14px;color:#374151;font-weight:600}.zcode-group-tabs{display:flex;gap:4px;padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;flex-shrink:0;-webkit-overflow-scrolling:touch}.zcode-group-tab{padding:6px 12px;font-size:13px;font-weight:500;color:#6b7280;background:#fff;border:1px solid #d1d5db;border-radius:4px;cursor:pointer;transition:all .2s;display:flex;align-items:center;gap:4px}.zcode-group-tab:hover{background:#f3f4f6;border-color:#9ca3af;color:#374151}.zcode-group-tab.active{background:var(--zcode-color-edit);border-color:var(--zcode-color-edit);color:#fff}.zcode-group-tab.active:hover{background:var(--zcode-color-edit-hover);border-color:var(--zcode-color-edit-hover)}@media(max-width:768px){.zcode-edit-panel,.zcode-add-panel,.zcode-reorder-panel,.zcode-delete-panel{width:100%;height:auto;position:fixed;inset:auto 0 0;border-radius:12px 12px 0 0;max-height:60vh;box-shadow:0 -4px 12px #00000026;z-index:1002;animation:zcode-slide-in-up .3s ease-out}@keyframes zcode-slide-in-up{0%{transform:translateY(100%)}to{transform:translateY(0)}}.zcode-insert-position{width:100%;right:0}.zcode-edit-actions{flex-direction:column;gap:12px}.zcode-edit-actions-btn{padding:10px 16px;font-size:14px}.zcode-toolbar{top:0;left:10px;right:10px;flex-wrap:nowrap;padding:6px 8px;gap:4px;overflow-x:auto;-webkit-overflow-scrolling:touch}.zcode-toolbar-btn{width:32px;height:32px;padding:0}.zcode-toolbar-btn-text{display:none}.zcode-view-mode-btn,.zcode-mode-btn{width:32px;height:32px;padding:0;justify-content:center}.zcode-view-mode-btn span,.zcode-mode-btn span{display:none}.zcode-settings-btn{width:36px;height:36px}.zcode-delete-dialog-content{width:95%;padding:16px}.zcode-save-controls-fixed{bottom:20px;left:20px;padding:0;background:transparent;box-shadow:none}.zcode-save-btn{width:48px;height:48px;padding:0;border-radius:50%;box-shadow:0 4px 12px #00000040;display:flex;align-items:center;justify-content:center;gap:0}.zcode-save-btn span{display:none}.zcode-save-btn svg{width:20px;height:20px}.zcode-edit-panel-header,.zcode-add-panel-header,.zcode-reorder-panel-header,.zcode-delete-panel-header{padding:10px 12px}.zcode-edit-fields{padding:12px}.zcode-field-item{margin-bottom:20px}.zcode-text-input,.zcode-textarea{padding:8px 12px}.zcode-textarea{min-height:100px}.zcode-btn,.zcode-btn-primary,.zcode-btn-danger,.zcode-btn-cancel{padding:10px}.zcode-group-tab,.zcode-image-select-btn,.zcode-image-clear-btn,.zcode-parent-select-btn{padding:8px 12px}}.zcode-part-category-tabs{display:flex;gap:4px;padding:8px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-shrink:0}.zcode-category-tab{padding:6px 12px;border:1px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-size:13px;font-weight:500;color:#6b7280;transition:all .2s}.zcode-category-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-category-tab.active{background:var(--zcode-color-add);color:#fff;border-color:var(--zcode-color-add)}.zcode-type-tabs{display:flex;gap:4px;padding:8px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;flex-shrink:0;-webkit-overflow-scrolling:touch}.zcode-type-tab{padding:6px 12px;border:1px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-size:12px;font-weight:500;color:#6b7280;transition:all .2s;white-space:nowrap}.zcode-type-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-type-tab.active{background:var(--zcode-color-add);color:#fff;border-color:var(--zcode-color-add)}.zcode-part-list{flex:1;overflow-y:auto;padding:12px}.zcode-part-type-section{margin-bottom:12px;padding-bottom:8px;border-bottom:1px solid #e5e7eb}.zcode-part-type-section:last-child{border-bottom:none;margin-bottom:0}.zcode-type-section-title{font-size:14px;font-weight:600;color:#1f2937;margin:0 0 6px}.zcode-type-section-description{font-size:12px;color:#6b7280;margin:0 0 8px;line-height:1.5}.zcode-module-buttons{display:grid;grid-template-columns:1fr;gap:6px}.zcode-empty-parts{text-align:center;padding:40px 20px;color:#9ca3af}.zcode-empty-parts-text{margin:0;font-size:14px}.zcode-module-preview{border:2px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;transition:all .2s;overflow:hidden;display:flex;flex-direction:column}.zcode-module-preview:hover{border-color:#9ca3af;box-shadow:0 4px 6px #0000001a}.zcode-module-preview.active{border-color:var(--zcode-color-add);box-shadow:0 0 0 3px #10b9811a}.zcode-module-preview-label{padding:6px 10px;background:#f9fafb;border-bottom:1px solid #e5e7eb;font-size:11px;font-weight:600;color:#374151;text-align:center}.zcode-module-preview.active .zcode-module-preview-label{background:var(--zcode-color-add);color:#fff}.zcode-module-preview-header{display:flex;align-items:center;justify-content:space-between;padding:0;background:#f9fafb;border-bottom:1px solid #e5e7eb}.zcode-module-preview-header .zcode-module-preview-label{flex:1;padding:4px 8px;background:transparent;border-bottom:none;text-align:left}.zcode-module-preview-icon-btn{border:none;background:transparent;padding:0 6px 0 0;cursor:pointer;color:#6b7280;display:flex;align-items:center;justify-content:center}.zcode-module-preview-icon-btn:hover{color:#111827}.zcode-module-preview.active .zcode-module-preview-header{background:var(--zcode-color-add)}.zcode-module-preview.active .zcode-module-preview-header .zcode-module-preview-label{color:#fff}.zcode-module-preview.active .zcode-module-preview-icon-btn{color:#ecfeff}.zcode-module-preview-content{padding:0;flex:1;overflow:hidden;overflow-y:hidden}.zcode-module-preview-content *{max-width:100%}.zcode-copy-notice{display:flex;align-items:center;gap:8px;padding:8px 12px;background:#f0f9ff;border:1px solid #bae6fd;border-radius:4px;margin-bottom:12px}.zcode-copy-notice-icon{flex-shrink:0;color:#0ea5e9}.zcode-copy-notice-text{margin:0;font-size:13px;color:#075985}.zcode-insert-position{padding:12px 20px;border-top:1px solid #e5e7eb;background:#fff}.zcode-insert-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;gap:16px}.zcode-insert-position-title{margin:0;font-size:14px;font-weight:600;color:#374151;flex-shrink:0}.zcode-keep-adding-label-position{margin-top:0;flex-shrink:0;white-space:nowrap}.zcode-keep-adding-label{display:flex;align-items:center;gap:6px;font-size:14px;cursor:pointer;-webkit-user-select:none;user-select:none}.zcode-keep-adding-checkbox{width:16px;height:16px;cursor:pointer}.zcode-insert-buttons{display:flex;gap:8px}.zcode-insert-btn{flex:1;padding:12px 16px;border:2px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-size:14px;font-weight:600;color:#374151;transition:all .2s}.zcode-insert-btn:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-insert-before{border-color:var(--zcode-color-add);color:var(--zcode-color-add)}.zcode-insert-before:hover{background:var(--zcode-color-add-bg);border-color:var(--zcode-color-add-hover)}.zcode-insert-after{border-color:var(--zcode-color-add);color:var(--zcode-color-add)}.zcode-insert-after:hover{background:var(--zcode-color-add-bg);border-color:var(--zcode-color-add-hover)}.zcode-empty-slot{padding:20px;text-align:center;border:2px dashed #d1d5db;border-radius:8px;background:#f9fafb}.zcode-add-slot-btn{padding:8px 16px;background:var(--zcode-color-add);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s}.zcode-add-slot-btn:hover{background:var(--zcode-color-add-hover)}.zcode-add-btn{padding:10px 20px;font-size:16px;background:var(--zcode-color-add);color:#fff;border:none;border-radius:6px;cursor:pointer;transition:background .2s;font-weight:500}.zcode-add-btn:hover{background:var(--zcode-color-add-hover)}@media(max-width:768px){.zcode-part-category-tabs,.zcode-type-tabs{padding:8px 12px}.zcode-part-list,.zcode-part-item{padding:12px}}.zcode-rich-text-editor{border:1px solid #d1d5db;border-radius:6px;overflow:hidden;background:#fff}.zcode-rich-text-toolbar{display:flex;align-items:center;gap:4px;padding:8px;border-bottom:1px solid #d1d5db;background:#f9fafb;flex-wrap:wrap}.zcode-toolbar-btn{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid #d1d5db;border-radius:4px;background:#fff;cursor:pointer;font-size:14px;transition:all .2s;padding:0}.zcode-toolbar-btn:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-toolbar-btn.is-active{background:var(--zcode-color-edit);color:#fff;border-color:var(--zcode-color-edit)}.zcode-toolbar-divider{width:1px;height:24px;background:#d1d5db;margin:0 4px}.zcode-rich-text-editor-content{min-height:200px;max-height:400px;overflow-y:auto;padding:12px}.zcode-tiptap-editor{outline:none;white-space:pre-wrap}.zcode-tiptap-editor p.is-editor-empty:first-child:before{content:attr(data-placeholder);float:left;color:#9ca3af;pointer-events:none;height:0}.zcode-tiptap-editor p{margin:.5em 0}.zcode-tiptap-editor ul,.zcode-tiptap-editor ol{padding-left:1.5em;margin:.5em 0}.zcode-tiptap-editor ul{list-style-type:disc}.zcode-tiptap-editor ol{list-style-type:decimal}.zcode-rich-text-editor-content ul{list-style-type:disc}.zcode-rich-text-editor-content ol{list-style-type:decimal}.zcode-rich-text-editor-content ul,.zcode-rich-text-editor-content ol{padding-left:1.5em;margin:.5em 0}.zcode-tiptap-editor a.zcode-link{color:var(--zcode-color-edit);text-decoration:underline}.zcode-tiptap-editor strong{font-weight:600}.zcode-tiptap-editor em{font-style:italic}.zcode-tiptap-editor s{text-decoration:line-through}.zcode-image-editor{margin-bottom:16px}.zcode-image-editor-input{width:100%;margin-bottom:8px}.zcode-image-editor-buttons{display:flex;gap:8px;margin-bottom:12px}.zcode-image-select-btn{flex:1;padding:8px 16px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s;white-space:nowrap;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-image-select-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-image-clear-btn{flex:1;padding:8px 12px;background:#ef4444;color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s;white-space:nowrap;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-image-clear-btn:hover{background:#dc2626}.zcode-image-preview{margin-top:12px;border:1px solid #d1d5db;border-radius:6px;padding:8px;background:#f9fafb;display:flex;justify-content:center;align-items:center}.zcode-image-preview-img{max-width:100%;max-height:200px;object-fit:contain;border-radius:4px}.zcode-image-modal{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000;padding:20px}.zcode-image-modal-content{background:#fff;border-radius:12px;box-shadow:0 4px 16px #0003;max-width:800px;width:90%;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}.zcode-image-modal-content[data-edit-mode]{max-width:500px;width:100%;border-radius:8px;box-shadow:0 10px 40px #0003}.zcode-image-modal-header{display:flex;justify-content:space-between;align-items:center;padding:20px 24px;border-bottom:1px solid #e5e7eb}.zcode-image-modal-header-title{margin:0;font-size:20px;font-weight:600;color:#1f2937}.zcode-image-current{padding:16px 24px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-image-current-title{margin:0 0 12px;font-size:14px;font-weight:600;color:#6b7280}.zcode-image-current-item{display:flex;align-items:center;gap:12px}.zcode-image-current-item-img{width:60px;height:60px;object-fit:cover;border-radius:6px;border:1px solid #d1d5db}.zcode-image-current-name{font-size:14px;color:#374151;font-weight:500}.zcode-image-tabs{display:flex;border-bottom:1px solid #e5e7eb;padding:0 24px}.zcode-image-tab{padding:12px 20px;background:none;border:none;border-bottom:2px solid transparent;cursor:pointer;font-size:14px;font-weight:500;color:#6b7280;transition:all .2s}.zcode-image-tab:hover{color:#1f2937;background:#f9fafb}.zcode-image-tab.active{color:var(--zcode-color-edit);border-bottom-color:var(--zcode-color-edit)}.zcode-image-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:16px;padding:24px;overflow-y:auto;flex:1}.zcode-image-name{padding:8px;font-size:12px;color:#374151;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.zcode-image-add{padding:16px 24px;border-top:1px solid #e5e7eb;background:#f9fafb}.zcode-image-add-btn{width:100%;padding:10px 16px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-weight:500;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:8px}.zcode-image-add-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-image-modal-actions{display:flex;gap:8px;padding:16px 24px;border-top:1px solid #e5e7eb;background:#fff}.zcode-image-modal-actions-btn{flex:1}.zcode-dev-container{width:100%;min-height:100vh;display:flex;flex-direction:column;position:relative}.zcode-cms-container.zcode-dev-padding{padding-right:375px}@media(max-width:768px){.zcode-cms-container.zcode-dev-padding{padding-right:0;padding-bottom:60vh}.zcode-dev-header{flex-direction:column;align-items:stretch;padding:0;gap:8px;background:none;border-bottom:none;box-shadow:none}.zcode-dev-tab{border-bottom:1px solid #e5e7eb}}.zcode-dev-container>zcode-cms{display:block}.zcode-loading-message{padding:40px;text-align:center;color:#6b7280}.zcode-loading-message-text{margin:8px 0;font-size:14px}.zcode-dev-tabs{display:flex;gap:8px;padding:0;flex-shrink:0;width:100%;box-sizing:border-box;background:#f9fafb;justify-content:space-between}.zcode-dev-tab{padding:10px 20px;border:1px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-weight:500;font-size:14px;transition:background .15s ease,border-color .15s ease,color .15s ease,box-shadow .15s ease;display:flex;align-items:center;gap:6px;color:#6b7280;flex:1 1 0;justify-content:center;text-align:center}.zcode-dev-settings-btn{flex:0 0 auto;padding:6px;min-width:32px;justify-content:center;border-radius:4px;font-size:12px}.zcode-dev-tab:hover{background:#f3f4f6;border-color:#9ca3af;box-shadow:0 1px 3px #0f172a14}.zcode-dev-tab.active{background:var(--zcode-color-edit);color:#fff;border-color:var(--zcode-color-edit);font-weight:600;box-shadow:0 2px 6px #2563eb40}@media(max-width:768px){.zcode-dev-tabs{display:grid;grid-template-columns:repeat(2,1fr);gap:6px;background:transparent}.zcode-dev-tab{width:auto;flex:none;justify-content:flex-start;text-align:left;padding:10px 12px;font-size:13px}.zcode-dev-tab.zcode-dev-settings-btn{display:none}}.zcode-dev-settings-btn-fixed{display:none}@media(max-width:768px){.zcode-dev-settings-btn-fixed{position:fixed;bottom:20px;right:20px;width:48px;height:48px;padding:0;border:2px solid #d1d5db;border-radius:50%;background:#fff;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 12px #00000040;z-index:1000;transition:all .2s ease}.zcode-dev-settings-btn-fixed:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-dev-settings-btn-fixed svg{width:20px;height:20px}}.zcode-parts-manager{width:100%;background:#fff}.zcode-parts-manager-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center}.zcode-parts-manager-header-title{margin:0;font-size:18px;color:#1f2937}.zcode-parts-category-tabs,.zcode-images-category-tabs{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-parts-category-tab-group,.zcode-images-category-tab-group{display:flex;gap:4px}.zcode-parts-manager-content{display:flex;flex-direction:column}.zcode-parts-list-header{padding:16px;border-bottom:1px solid #e5e7eb;display:flex;justify-content:space-between;align-items:center;background:#fff}.zcode-parts-list-header-title{margin:0;font-size:14px;font-weight:600;color:#1f2937}.zcode-parts-items{padding:16px}.zcode-part-item{padding:16px;border:1px solid #e5e7eb;border-radius:8px;cursor:pointer;transition:all .2s;background:#fff;height:100%;display:flex;flex-direction:column;position:relative}.zcode-part-item:hover{border-color:#d1d5db;box-shadow:0 2px 8px #0000001a}.zcode-part-item.zcode-reorder-source{border-color:var(--zcode-color-reorder);background:#f59e0b05;box-shadow:0 0 0 1px #f59e0b1a}.zcode-reorder-source-indicator{position:absolute;top:-10px;right:10px;background:var(--zcode-color-reorder);color:#fff;padding:2px 8px;border-radius:4px;font-size:11px;font-weight:600;z-index:10}.zcode-part-item-add{border:2px dashed #d1d5db;background:#f9fafb;display:flex;align-items:center;justify-content:center;min-height:120px;cursor:pointer}.zcode-part-item-add:hover{border-color:var(--zcode-color-add);background:var(--zcode-color-add-bg);transform:translateY(-2px)}.zcode-part-item-add-content{display:flex;flex-direction:column;align-items:center;gap:8px;color:#6b7280;font-size:14px;font-weight:500}.zcode-part-item-add:hover .zcode-part-item-add-content{color:var(--zcode-color-add)}.zcode-part-item-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.zcode-part-item-actions{display:flex;gap:4px;align-items:center}.zcode-action-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-action-btn:hover{background:#e5e7eb;color:#374151}.zcode-action-btn.active{background:var(--zcode-color-reorder);color:#fff}.zcode-action-btn.zcode-delete-btn:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-part-duplicate-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-part-duplicate-btn:hover{background:var(--zcode-color-add-bg);color:var(--zcode-color-add)}.zcode-part-type{font-weight:600;font-size:14px;color:#1f2937}.zcode-part-actions{display:flex;gap:4px}.zcode-part-edit-btn,.zcode-part-delete-btn,.zcode-module-delete-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-part-edit-btn:hover{background:var(--zcode-color-edit-bg);color:var(--zcode-color-edit)}.zcode-part-delete-btn:hover,.zcode-module-delete-btn:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-part-description{font-size:13px;color:#6b7280;margin-bottom:4px}.zcode-description-empty{color:#9ca3af;font-style:italic}.zcode-part-modules{font-size:12px;color:#9ca3af}.zcode-part-type-group{margin-bottom:24px}.zcode-part-type-title{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:16px;font-weight:600;color:#1f2937;margin:0 0 12px;padding-bottom:8px;border-bottom:2px solid #e5e7eb}.zcode-part-type-actions{display:flex;align-items:center;gap:4px}.zcode-part-type-edit-btn{padding:4px 8px;border:1px solid #e5e7eb;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;transition:all .2s}.zcode-part-type-edit-btn:hover{background:var(--zcode-color-edit-bg);border-color:var(--zcode-color-edit-border-hover);color:var(--zcode-color-edit)}.zcode-part-type-items{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px}.zcode-part-preview{margin-top:12px;padding:8px;border:1px solid #e5e7eb;border-radius:6px;background:#f9fafb;max-height:150px;overflow:hidden;flex:1;min-height:0}.zcode-part-preview-content{font-size:11px;line-height:1.4;pointer-events:none;transform:scale(.75);transform-origin:top left;width:133.33%}.zcode-required{color:#ef4444;margin-left:2px}.zcode-part-modal{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000;padding:20px}.zcode-part-modal-content{background:#fff;border-radius:8px;box-shadow:0 10px 40px #0003;width:100%;max-width:95vw;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}.zcode-part-editor{display:flex;flex-direction:column;overflow:hidden;height:100%}.zcode-part-editor-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.zcode-part-editor-header-title{margin:0;font-size:16px;color:#1f2937}.zcode-part-editor-form{flex:1;overflow-y:auto;padding:24px 24px 80px}.zcode-part-editor-main{display:grid;grid-template-columns:1fr 1fr;gap:24px;align-items:stretch;min-height:0}.zcode-part-editor-fields{display:flex;flex-direction:column;gap:16px}.zcode-part-editor-preview{border:1px solid #e5e7eb;border-radius:8px;padding:16px;background:#f9fafb;position:sticky;top:0;max-height:calc(90vh - 200px);display:flex;flex-direction:column}.zcode-part-editor-preview-title{margin:0 0 12px;font-size:14px;font-weight:600;color:#1f2937}.zcode-preview-module-selector{margin-bottom:12px}.zcode-select-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;cursor:pointer}.zcode-select-input:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-editing-preview-content{flex:1;overflow-y:auto;padding:12px;background:#fff;border-radius:6px;min-height:200px;transform:scale(.9);transform-origin:top left;width:111.11%}.zcode-preview-empty{flex:1;display:flex;align-items:center;justify-content:center;color:#9ca3af;font-size:14px}.zcode-preview-modal{position:fixed;inset:0;background:#000c;display:flex;align-items:center;justify-content:center;z-index:3000;padding:20px}.zcode-preview-modal-content{background:#fff;border-radius:8px;width:90%;max-width:1200px;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}.zcode-preview-modal-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.zcode-preview-modal-header-title{margin:0;font-size:16px;color:#1f2937}.zcode-preview-modal-body{padding:24px;overflow-y:auto;flex:1}.zcode-help-modal-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:10000;padding:20px}.zcode-help-modal{background:#fff;border-radius:8px;width:90%;max-width:800px;max-height:80vh;overflow:auto;box-shadow:0 20px 25px -5px #0000001a}.zcode-help-modal-header{display:flex;justify-content:space-between;align-items:center;padding:20px 24px;border-bottom:1px solid #e5e7eb;background:#f9fafb;position:sticky;top:0;z-index:1}.zcode-help-modal-header-title{margin:0;font-size:18px;font-weight:600;color:#1f2937;display:flex;align-items:center;gap:8px}.zcode-css-warning-modal-title-icon{color:#f59e0b;flex-shrink:0}.zcode-help-modal-body{padding:24px}.zcode-help-table{width:100%;border-collapse:collapse;margin-bottom:24px}.zcode-help-table-cell{padding:14px 16px;text-align:left;border-bottom:1px solid #e5e7eb;border-right:1px solid #e5e7eb;vertical-align:top}.zcode-help-table-cell:last-child{border-right:none}.zcode-help-table-header{background:#f9fafb;font-weight:600;color:#374151;font-size:13px;text-transform:uppercase;letter-spacing:.5px}.zcode-help-table-data{font-size:14px;color:#4b5563;line-height:1.6}.zcode-help-table-data:first-child{width:35%}.zcode-help-table-data:nth-child(2){width:30%}.zcode-help-table-data:nth-child(3){width:35%}.zcode-help-table-code{background:#f3f4f6;padding:3px 8px;border-radius:4px;font-size:13px;color:#dc2626;font-family:Courier New,Courier,monospace;white-space:nowrap;border:1px solid #e5e7eb}.zcode-help-table-row:hover{background:#fafafa}.zcode-help-section{background:#f9fafb;padding:12px 16px;border-radius:6px;border:1px solid #e5e7eb;margin-bottom:16px}.zcode-help-section:last-child{margin-bottom:0}.zcode-help-section-title{margin:0 0 8px;color:#374151;font-size:14px;font-weight:600}.zcode-help-section-list{margin:0;padding-left:0;list-style-position:inside}.zcode-help-section-item{margin-bottom:6px;color:#6b7280;font-size:13px;line-height:1.6}.zcode-help-section-item:last-child{margin-bottom:0}.zcode-help-section-code{background:#f3f4f6;padding:2px 6px;border-radius:3px;font-size:12px;color:#dc2626;font-family:Courier New,Courier,monospace;border:1px solid #e5e7eb}.zcode-slots-config{display:flex;flex-direction:column;gap:16px}.zcode-slot-config-item{border:1px solid #e5e7eb;border-radius:6px;padding:12px;background:#f9fafb}.zcode-slot-config-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;padding-bottom:8px;border-bottom:1px solid #e5e7eb}.zcode-slot-config-header-title{font-size:14px;color:#1f2937}.zcode-slot-config-body{display:flex;flex-direction:column;gap:8px}.zcode-slot-config-body-label{font-size:12px;font-weight:600;color:#6b7280;margin-bottom:4px}.zcode-checkbox-group{display:flex;flex-direction:column;gap:6px}.zcode-checkbox-item{display:flex;align-items:center;gap:6px;cursor:pointer}.zcode-checkbox-item:hover{background-color:transparent}.zcode-checkbox{width:16px;height:16px;cursor:pointer;accent-color:var(--zcode-color-edit);flex-shrink:0}.zcode-checkbox-item span{font-size:13px;color:#374151;-webkit-user-select:none;user-select:none}.zcode-module-slots-config{margin-top:16px;padding-top:16px;border-top:1px solid #e5e7eb}.zcode-slot-add-section{margin-top:16px;padding:12px;border:1px dashed #d1d5db;border-radius:6px;background:#f9fafb}.zcode-slot-add-section-label{display:block;font-size:13px;font-weight:600;color:#374151;margin-bottom:8px}.zcode-slot-add-controls{display:flex;gap:8px;align-items:center}.zcode-select-input{flex:1;padding:8px 12px;border:1px solid #d1d5db;border-radius:4px;background:#fff;font-size:14px;color:#1f2937;cursor:pointer;transition:border-color .2s}.zcode-select-input:hover{border-color:#9ca3af}.zcode-select-input:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-select{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;color:#1f2937;cursor:pointer;transition:border-color .2s}.zcode-select:hover{border-color:#9ca3af}.zcode-select:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-select[multiple]{padding:4px;cursor:default}.zcode-select-option{padding:6px 8px;border-radius:4px;margin:2px 0}.zcode-select-option:checked{background:var(--zcode-color-edit-bg);color:var(--zcode-color-edit)}.zcode-tag-editor{display:flex;flex-direction:column;gap:8px}.zcode-tag-preview{font-size:12px;color:#6b7280;padding:4px 8px;background-color:#f3f4f6;border-radius:4px;font-family:Courier New,monospace}.zcode-tag-preview code{background-color:transparent;padding:0;color:#374151;font-weight:600}.zcode-slot-add-empty{margin-top:16px;padding:12px;text-align:center;color:#6b7280;font-size:13px;font-style:italic}.zcode-module-slots-config-label{font-size:13px;font-weight:600;color:#374151;margin-bottom:8px;display:block}.zcode-form-hint{font-size:12px;color:#6b7280;margin-top:4px;margin-bottom:12px;font-style:italic}.zcode-btn-small{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s;font-size:12px}.zcode-btn-small:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-module-item.active{border-color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg)}.zcode-module-delete-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-module-delete-btn:hover:not(:disabled){background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-module-delete-btn:disabled{opacity:.4;cursor:not-allowed}.zcode-module-actions{display:flex;gap:4px;align-items:center}.zcode-module-duplicate-btn,.zcode-module-copy-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-module-duplicate-btn:hover:not(:disabled),.zcode-module-copy-btn:hover:not(:disabled){background:var(--zcode-color-add-bg);color:var(--zcode-color-add)}.zcode-module-copy-btn:disabled{opacity:.4;cursor:not-allowed}.zcode-form-field{margin-bottom:16px}.zcode-form-field-label{display:block;font-size:14px;font-weight:500;color:#374151;margin-bottom:6px}.zcode-form-field-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px}.zcode-form-field-header>.zcode-form-field-label:first-child{margin-bottom:0}.zcode-form-field-actions{display:flex;align-items:center;gap:8px}.zcode-help-btn{display:flex;align-items:center;justify-content:center;padding:4px;background:transparent;border:none;color:#6b7280;cursor:pointer;border-radius:4px;transition:all .2s}.zcode-help-btn:hover{color:#374151;background:transparent}.zcode-checkbox-label{display:flex;align-items:center;gap:6px;cursor:pointer;-webkit-user-select:none;user-select:none;margin-bottom:0}.zcode-checkbox-label-inline{margin-bottom:0}.zcode-checkbox-input{width:16px;height:16px;cursor:pointer;margin:0}.zcode-checkbox-label span{font-size:13px;color:#6b7280;font-weight:400}.zcode-text-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;transition:border-color .2s}.zcode-text-input:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-monaco-editor{width:100%;flex:1;min-height:0;display:flex;flex-direction:column}.zcode-monaco-editor .monaco-editor-wrapper{flex:1;min-height:0;display:flex;flex-direction:column}.zcode-monaco-editor .monaco-editor-container{border:1px solid #d1d5db;border-radius:4px;flex:1;min-height:0;max-height:none!important}.zcode-textarea{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;font-family:monospace;resize:vertical;transition:border-color .2s}.zcode-textarea:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-modules-list{margin-bottom:12px}.zcode-module-item{padding:12px;border:1px solid #e5e7eb;border-radius:6px;margin-bottom:12px;background:#f9fafb;cursor:pointer;transition:all .2s}.zcode-module-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.zcode-module-title{font-weight:600;font-size:14px;color:#1f2937}.zcode-module-body{display:flex;flex-direction:column;gap:8px}.zcode-module-body-label{font-size:12px;font-weight:500;color:#6b7280}.zcode-part-editor-actions{display:flex;gap:8px;padding:16px 24px;border-top:1px solid #e5e7eb;background:#fff;flex-shrink:0}.zcode-part-editor-actions-btn{flex:1}.zcode-part-editor-actions-btn-primary,.zcode-btn-primary{padding:10px 20px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-weight:600;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-parts-new-btn,.zcode-images-add-btn{padding:7px 12px;font-size:13px;border-radius:4px}.zcode-btn-primary:hover{background:var(--zcode-color-edit-hover)}.zcode-btn-secondary{padding:8px 16px;background:#f3f4f6;color:#374151;border:1px solid #d1d5db;border-radius:6px;cursor:pointer;font-weight:500;font-size:14px;transition:all .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-btn-secondary:hover{background:#e5e7eb;border-color:#9ca3af}.zcode-page-css-panel{width:100%;background:#fff;display:flex;flex-direction:column;height:100%;flex:1;min-height:0}.zcode-warning-banner{padding:16px;background:#fff3cd;border-bottom:1px solid #ffc107;display:flex;gap:12px}.zcode-warning-icon{font-size:20px;flex-shrink:0}.zcode-warning-content{flex:1}.zcode-warning-title{margin:0 0 8px;font-size:14px;font-weight:700;color:#856404}.zcode-warning-list{margin:0;padding-left:20px;font-size:13px;color:#856404;line-height:1.6}.zcode-warning-list li{margin-bottom:4px}.zcode-warning-list strong{font-weight:700}.zcode-warning-inline{padding:12px;background:#fff3cd;border:1px solid #ffc107;border-radius:6px;margin-bottom:16px;display:flex;gap:12px}.zcode-warning-inline .zcode-warning-icon{font-size:18px;flex-shrink:0}.zcode-warning-inline .zcode-warning-content{flex:1}.zcode-warning-inline .zcode-warning-title{margin:0 0 8px;font-size:13px;font-weight:700;color:#856404}.zcode-warning-inline .zcode-warning-text{font-size:12px;color:#856404;line-height:1.6}.zcode-warning-inline .zcode-warning-text ul{margin:0;padding-left:20px}.zcode-warning-inline .zcode-warning-text li{margin-bottom:4px}.zcode-css-warning-modal{max-width:500px}.zcode-css-warning-modal-footer{display:flex;flex-direction:column;justify-content:center;align-items:center;padding:16px 24px;border-top:1px solid #e5e7eb;background:#f9fafb}.zcode-css-warning-modal .zcode-warning-content{padding:0}.zcode-css-warning-modal .zcode-warning-list{margin:0;padding-left:20px;font-size:14px;color:#856404;line-height:1.8;list-style-type:disc;list-style-position:outside}.zcode-css-warning-modal .zcode-warning-list li{margin-bottom:8px;list-style-type:disc}.zcode-css-warning-modal .zcode-warning-list strong{font-weight:700;color:#92400e}.zcode-page-css-content{display:flex;flex:1;overflow:hidden}.zcode-page-css-parts-selector{width:280px;border-right:1px solid #e5e7eb;display:flex;flex-direction:column;overflow:hidden;background:#f9fafb}.zcode-search-box{padding:12px;border-bottom:1px solid #e5e7eb;background:#fff}.zcode-search-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff}.zcode-search-input:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-parts-list{flex:1;overflow-y:auto;padding:12px}.zcode-parts-section{margin-bottom:24px}.zcode-parts-section:last-child{margin-bottom:0}.zcode-parts-section-title{margin:0 0 8px;padding:8px 12px;font-size:12px;font-weight:700;color:#6b7280;text-transform:uppercase;letter-spacing:.05em;background:#fff;border-radius:4px}.zcode-part-item{padding:12px;border:1px solid #e5e7eb;border-radius:6px;cursor:pointer;transition:all .2s;background:#fff;margin-bottom:8px}.zcode-part-item:hover{border-color:#d1d5db;box-shadow:0 2px 4px #0000000d}.zcode-part-item-selected{border-color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg);box-shadow:0 0 0 2px #3b82f633}.zcode-part-item-title{font-size:14px;font-weight:600;color:#1f2937;margin-bottom:4px}.zcode-part-item-id{font-size:12px;color:#6b7280;font-family:monospace}.zcode-page-css-preview{flex:1;border-right:1px solid #e5e7eb;display:flex;flex-direction:column;overflow:hidden;background:#f9fafb}.zcode-preview-container{flex:1;overflow:auto;padding:24px}.zcode-preview-content{max-width:800px;margin:0 auto;background:#fff;padding:24px;border-radius:8px;box-shadow:0 2px 8px #0000001a}.zcode-preview-content [data-zcode-highlight=true]{outline:3px solid var(--zcode-color-edit);outline-offset:4px;background:var(--zcode-color-edit-bg)}.zcode-page-css-editor{width:100%;display:flex;flex-direction:column;overflow:hidden;background:#fff;flex:1;min-height:0}.zcode-page-css-editor .zcode-form-field{flex:1;display:flex;flex-direction:column;padding:16px;overflow:hidden}.zcode-page-css-editor .zcode-form-field label{margin-bottom:8px;font-size:14px;font-weight:600;color:#1f2937}.zcode-page-css-editor .monaco-editor-wrapper{flex:1;min-height:0}.zcode-page-css-editor .monaco-editor-container{height:100%;min-height:320px;max-height:none}.zcode-page-css-actions{padding:16px;border-top:1px solid #e5e7eb;display:flex;gap:8px;justify-content:flex-end;flex-shrink:0}.zcode-page-css-actions .zcode-btn-primary,.zcode-page-css-actions .zcode-btn-secondary{flex:1}.zcode-images-manager{width:100%;background:#fff}.zcode-images-manager-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center}.zcode-images-manager-header-title{margin:0;font-size:18px;color:#1f2937}.zcode-images-manager-content{display:flex;flex-direction:column}.zcode-images-grid{padding:16px;display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:16px;align-content:start}.zcode-image-item{position:relative;border:2px solid #e5e7eb;border-radius:8px;cursor:pointer;background:#f9fafb;display:flex;flex-direction:column;overflow:hidden}.zcode-image-item>img{width:100%;height:150px;object-fit:cover;display:block;flex-shrink:0}.zcode-image-item:hover{border-color:#d1d5db;box-shadow:0 2px 8px #0000001a}.zcode-image-item.zcode-reorder-source{border-color:var(--zcode-color-reorder);background:#f59e0b05;box-shadow:0 0 0 1px #f59e0b1a}.zcode-image-item.selected{border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f633}.zcode-image-item-clickable{cursor:pointer}.zcode-image-item-img{width:100%;height:150px;object-fit:cover;display:block}.zcode-image-item-overlay{position:absolute;inset:0;pointer-events:none}.zcode-image-item-actions{position:absolute;top:8px;right:8px;display:flex;gap:4px;opacity:0;pointer-events:auto}.zcode-image-item:hover .zcode-image-item-actions{opacity:1}.zcode-image-edit-btn,.zcode-image-delete-btn{padding:8px;border:none;border-radius:4px;background:#ffffffe6;color:#374151;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-image-edit-btn:hover{background:#fff;color:var(--zcode-color-edit)}.zcode-image-delete-btn:hover{background:#fff;color:var(--zcode-color-delete)}.zcode-image-item-name{padding:8px;font-size:12px;color:#374151;text-align:center;background:#fff;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:break-all;overflow-wrap:break-word;max-width:100%}.zcode-image-editor-panel{position:static;width:auto;height:auto;background:transparent;box-shadow:none;display:block;z-index:auto}.zcode-image-editor-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.zcode-image-editor-header-title{margin:0;font-size:16px;color:#1f2937}.zcode-image-editor-form{flex:1;overflow-y:auto;padding:16px}.zcode-image-preview-large{margin-bottom:16px;border:1px solid #e5e7eb;border-radius:6px;padding:8px;background:#f9fafb;display:flex;justify-content:center;align-items:center}.zcode-image-preview-large-img{max-width:100%;max-height:200px;object-fit:contain;border-radius:4px}.zcode-image-editor-actions{display:flex;gap:8px;margin-top:16px;padding-top:16px;border-top:1px solid #e5e7eb}.zcode-image-editor-actions-btn{flex:1}@media(max-width:768px){.zcode-part-type-items{grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:12px}.zcode-part-modal{padding:10px}.zcode-part-modal-content{max-width:100%;max-height:95vh}.zcode-part-editor-main,.zcode-part-editor-topfields{grid-template-columns:1fr}.zcode-part-editor-preview{position:relative;max-height:400px}.zcode-images-grid{grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:12px}}.zcode-data-viewer{border-top:1px solid #e5e7eb;background:#fff;display:flex;flex-direction:column;min-height:200px;flex-shrink:0;height:100%;overflow:hidden}.zcode-data-viewer-header{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;padding:8px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-data-viewer-content-tabs{display:flex;gap:4px}.zcode-data-viewer-content-tab{padding:6px 12px;font-size:13px;border:1px solid #d1d5db;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;font-weight:500;transition:all .2s}.zcode-data-viewer-content-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-data-viewer-content-tab.active{background:var(--zcode-color-edit);color:#fff;border-color:var(--zcode-color-edit)}.zcode-data-viewer-tabs{display:flex;gap:4px;align-items:center}.zcode-data-viewer-tab{padding:6px 12px;font-size:13px;border:1px solid #d1d5db;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;font-weight:500;transition:all .2s}.zcode-data-viewer-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-data-viewer-tab.active{background:var(--zcode-color-add);color:#fff;border-color:var(--zcode-color-add)}.zcode-data-viewer-error{padding:12px 16px;background:#fee;color:#c33;border-bottom:1px solid #e5e7eb;font-size:13px}.zcode-data-viewer-content{flex:1;overflow:auto;position:relative}.zcode-data-viewer-display-wrapper{position:relative;width:100%;height:100%}.zcode-data-viewer-display{margin:0;padding:16px;font-family:Monaco,Menlo,Ubuntu Mono,monospace;font-size:13px;line-height:1.6;color:#f9fafb;background:#111827;white-space:pre;overflow-x:auto;border-top:1px solid #374151}.zcode-data-viewer-copy-btn{position:absolute;top:12px;right:12px;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid rgba(255,255,255,.2);border-radius:4px;background:#111827cc;color:#f9fafb;cursor:pointer;transition:all .2s;z-index:10}.zcode-data-viewer-copy-btn:hover{background:#111827f2;border-color:#ffffff4d;color:#fff}.zcode-data-viewer-copy-btn:active{transform:scale(.95)}.zcode-input-readonly,.zcode-textarea-readonly{display:none}.zcode-dev-container .zcode-input-readonly,.zcode-dev-container .zcode-textarea-readonly{display:block;background-color:#f3f4f6;color:#6b7280;border-color:#d1d5db;cursor:default;pointer-events:none}.zcode-context-menu{position:fixed;background:#fff;border:1px solid #e5e7eb;border-radius:6px;box-shadow:0 4px 12px #00000026;padding:4px;z-index:10000;min-width:160px}.zcode-context-menu-item{display:flex;align-items:center;gap:8px;width:100%;padding:8px 12px;border:none;background:transparent;text-align:left;cursor:pointer;border-radius:4px;font-size:14px;color:#374151;transition:background .2s}.zcode-context-menu-item:hover{background:#f3f4f6}.zcode-context-menu-item.active{background:var(--zcode-color-edit-bg);color:var(--zcode-color-edit);font-weight:500}.zcode-context-menu-divider{height:1px;background:#e5e7eb;margin:4px 0}.zcode-save-confirm-dialog-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:10000}.zcode-save-confirm-dialog{background:#fff;border-radius:8px;box-shadow:0 10px 25px #0003;max-width:500px;width:90%;max-height:80vh;display:flex;flex-direction:column}.zcode-save-confirm-dialog-header{padding:16px 20px;border-bottom:1px solid #e5e7eb}.zcode-save-confirm-dialog-title{font-size:18px;font-weight:600;color:#111827}.zcode-save-confirm-dialog-body{padding:20px;flex:1;overflow-y:auto}.zcode-save-confirm-dialog-body p{margin:0 0 12px;font-size:14px;color:#374151}.zcode-save-confirm-targets{list-style:none;padding:0;margin:12px 0}.zcode-save-confirm-targets li{padding:8px 12px;background:#f9fafb;border-radius:4px;margin-bottom:8px;font-size:14px;color:#374151}.zcode-save-confirm-targets li:last-child{margin-bottom:0}.zcode-save-confirm-dialog-footer{padding:16px 20px;border-top:1px solid #e5e7eb;display:flex;justify-content:flex-end;gap:12px}.zcode-btn-secondary{padding:8px 16px;background:#fff;border:1px solid #d1d5db;border-radius:6px;font-size:14px;cursor:pointer;color:#374151;transition:background-color .2s,border-color .2s}.zcode-btn-secondary:hover{background:#f9fafb;border-color:#9ca3af}.zcode-btn-primary{padding:8px 16px;background:#3b82f6;border:none;border-radius:6px;font-size:14px;cursor:pointer;color:#fff;transition:background-color .2s}.zcode-btn-primary:hover{background:#2563eb}@media(max-width:768px){.zcode-save-confirm-dialog{width:95%;max-height:90vh}.zcode-save-confirm-dialog-header{padding:12px 16px}.zcode-save-confirm-dialog-body{padding:16px}.zcode-save-confirm-dialog-footer{padding:12px 16px;flex-direction:column-reverse}.zcode-btn-secondary,.zcode-btn-primary{width:100%}}",eT={common:{close:"閉じる",save:"保存",cancel:"キャンセル",delete:"削除",edit:"編集",add:"追加",reorder:"並べ替え",preview:"プレビュー",settings:"設定",manage:"管理",view:"表示",confirm:"確定",clear:"クリア",select:"選択",replace:"差し替え",copy:"コピー",copied:"コピーしました"},toolbar:{editMode:"編集",addMode:"追加",reorderMode:"並べ替え",deleteMode:"削除",viewMode:"表示",settings:"設定"},settings:{title:"設定",language:{label:"言語",ja:"日本語",en:"English"},enableDynamicContent:"ページの動作を有効にする",enableDynamicContentDescription:"アコーディオン、タブ、モーダル、リンクなどの動的コンテンツの動作を有効にします。",devRightPadding:"編集パネル分の余白をつける",devRightPaddingDescription:"編集パネル表示時にコンテンツの右側に余白を追加します。",enableContextMenu:"右クリックメニューを有効にする",enableContextMenuDescription:"コンテンツ上で右クリックすると、編集・追加・並べ替え・削除のモードを切り替えるメニューが表示されます。",showSaveConfirm:"保存時の確認ダイアログを表示する",showSaveConfirmDescription:"保存ボタンをクリックした際に、保存対象を確認するダイアログを表示します。",previewModeInfo:"表示モードでは動的コンテンツ(アコーディオン、タブ、モーダル、リンクなど)は常に有効です。",noSettings:"設定項目はありません。"},addPanel:{title:"追加",selectParent:"親要素を選択",category:{common:"共通",individual:"個別",selected:"選択したパーツ"},typeAll:"all",activeParts:"active parts",activePartsDescription:"プレビューエリアでクリックしたパーツを、現在のデータを含む状態で追加できます。",clickPartInPreview:"プレビューエリアでパーツをクリックしてください",noPartsAvailable:"利用可能なパーツがありません",addBefore:"前に追加",addAfter:"後に追加",continueAdding:"パーツ追加を続ける"},editPanel:{title:"編集中",editing:"編集中: {type}",id:"ID: {id}",selectImage:"画像を選択",replaceImage:"差し替え",clearImage:"クリア",clearImageTitle:"画像をクリア",noFields:"編集可能なフィールドがありません"},deletePanel:{title:"削除確認",confirmMessage:"このパーツを削除しますか?",selectParent:"親要素を選択"},reorderPanel:{title:"並べ替え: 移動元を選択中",instruction:"移動先の要素をクリックしてください",source:"移動元: {path}",selectParent:"親要素を選択"},saveConfirm:{title:"保存の確認",message:"以下のデータを保存しますか?",simpleMessage:"保存しますか?",targets:{page:"ページデータ","parts-common":"パーツ(共通)","parts-individual":"パーツ(個別)","parts-special":"パーツ(特別)","parts-common-css":"CSS(共通)","parts-individual-css":"CSS(個別)","parts-special-css":"CSS(特別)","images-common":"画像(共通)","images-individual":"画像(個別)","images-special":"画像(特別)"},saveButton:"保存する"},partsManager:{createType:"新規タイプ作成",editType:"タイプ編集",typeName:"タイプ名",typeDescription:"説明",typeNamePlaceholder:"例: hero, features",typeDescriptionPlaceholder:"タイプの説明",editPart:"パーツ編集: {title}",partTitle:"タイトル",partDescription:"説明",partDescriptionPlaceholder:"パーツの説明",deletePartConfirm:`パーツ {number} を削除しますか?
|
|
467
|
-
(タイプには他のパーツが残ります)`,deleteTypeConfirm:"このタイプを削除しますか?",deleteTypeWithUsagesConfirm:"タイプ「{type}」は{count}箇所で使用されています。削除しますか?",deleteSlotConfirm:"スロット「{slotName}」を削除しますか?",selectImage:"画像選択",addPart:"パーツを追加",editTypeButton:"タイプ全体を編集",reorderType:"タイプを並べ替え",deleteTypeButton:"このタイプを削除(全パーツ含む)",editPartButton:"パーツを編集",reorderPart:"並べ替え",deletePartButton:"削除",source:"移動元",noDescription:"説明なし",partNumber:"パーツ {current} / {total}",allowedParts:"許可されるパーツ",searchParts:"パーツを検索...",addSlot:"スロットを追加",selectSlot:"スロットを選択...",defaultSlot:"デフォルトスロット",codeEdit:"コード編集",cssEditInfo:"CSS編集について",templateSuggestions:"予測変換",preview:"プレビュー:",cssEditWarning:"CSS編集について",cssEditWarningMessageCommon:"ここで編集したCSSは、すべてのページに適用される想定です。既存のCSSファイル(common.cssなど)がある場合、それらを上書きする可能性があります。",cssEditWarningMessageIndividual:"ここで編集したCSSは、ページタイプごとに適用される想定です。既存のCSSファイル(page.cssなど)がある場合、それらを上書きする可能性があります。",cssEditWarningMessageSpecial:"ここで編集したCSSは、動的ページごとに適用される想定です。既存のCSSファイル(shop111.cssなど)がある場合、それらを上書きする可能性があります。",understood:"了解しました",dontShowAgain:"次回から表示しない",templateHelp:{textField:"テキストフィールド",richText:"リッチテキスト",textarea:"複数行テキスト",image:"画像選択",radio:"ラジオボタン",checkbox:"チェックボックス",selectSingle:"セレクトボックス(単一選択)",selectMultiple:"セレクトボックス(複数選択)",conditional:"条件分岐(表示/非表示)",slot:"スロット(子要素挿入)",note:"補足",suggestionNote:"予測変換を有効にすると、<code>$</code>、<code>(</code>、<code>z</code>を入力時に自動補完が表示されます",fieldNameNote:"フィールド名は英数字とアンダースコアが使用できます",defaultValueNote:"デフォルト値は省略可能です(空文字になります)"},validationError:"エラー:",dangerousTagWarning:"<{tag}> タグが含まれています。",dangerousAttrWarning:"{attr} 属性が含まれています。",slotSettings:"スロット設定",slot:"スロット",templateHelpButton:"テンプレート記法のヘルプ",clickToEnlarge:"クリックで拡大"},imagesManager:{addImage:"画像追加",editImage:"画像編集",imageId:"画像ID",imageName:"画像名",altText:"Alt属性",deleteImageConfirm:"この画像を削除しますか?",deleteImageWithUsagesConfirm:"この画像は{count}箇所で使用されています。削除しますか?",deleteImageFromModalConfirm:"この画像を削除しますか?",addImageFailed:"画像の追加に失敗しました",selectImage:"画像を選択",currentlySelected:"現在選択中",select:"選択"},dataViewer:{page:"ページ",parts:"パーツ",images:"画像",common:"共通",individual:"個別",special:"特別",json:"JSON",html:"HTML",categoryInfo:{title:"カテゴリの役割について",common:{title:"共通",description:"サイト全体で共有されるパーツ・画像を想定しています。すべてのページで使用できる想定です。"},individual:{title:"個別",description:"ページタイプごとに共有されるパーツ・画像を想定しています。同じページタイプのすべてのページで使用できる想定です。"},special:{title:"特別",description:"動的ページ(例:店舗ごと、商品ごと)や特定の条件で使用されるパーツ・画像を想定しています。ルートモデルバインディングなどで動的に生成されるページで使用できる想定です。"}}},contextMenu:{edit:"編集",add:"追加",reorder:"並べ替え",delete:"削除",close:"閉じる"},editor:{pageManagement:"ページ管理",partsManagement:"パーツ管理",imagesManagement:"画像管理",dataViewer:"データビューアー",loading:"データを読み込み中..."}},
|
|
468
|
-
(Other parts in the type will remain)`,deleteTypeConfirm:"Do you want to delete this type?",deleteTypeWithUsagesConfirm:'Type "{type}" is used in {count} places. Do you want to delete it?',deleteSlotConfirm:'Do you want to delete slot "{slotName}"?',selectImage:"Select image",addPart:"Add part",editTypeButton:"Edit type",reorderType:"Reorder type",deleteTypeButton:"Delete this type (all parts included)",editPartButton:"Edit part",reorderPart:"Reorder",deletePartButton:"Delete",source:"Source",noDescription:"No description",partNumber:"Part {current} / {total}",allowedParts:"Allowed parts",searchParts:"Search parts...",addSlot:"Add slot",selectSlot:"Select slot...",defaultSlot:"Default slot",codeEdit:"Code editor",cssEditInfo:"About CSS editing",templateSuggestions:"Template suggestions",preview:"Preview:",cssEditWarning:"About CSS editing",cssEditWarningMessageCommon:"CSS edited here is intended to apply to all pages. If existing CSS files (e.g., common.css) exist, they may be overwritten.",cssEditWarningMessageIndividual:"CSS edited here is intended to apply per page type. If existing CSS files (e.g., page.css) exist, they may be overwritten.",cssEditWarningMessageSpecial:"CSS edited here is intended to apply per dynamic page. If existing CSS files (e.g., shop111.css) exist, they may be overwritten.",dontShowAgain:"Don't show again",templateHelp:{textField:"Text field",richText:"Rich text",textarea:"Multi-line text",image:"Image selection",radio:"Radio button",checkbox:"Checkbox",selectSingle:"Select box (single)",selectMultiple:"Select box (multiple)",conditional:"Conditional (show/hide)",slot:"Slot (child insertion)",note:"Note",suggestionNote:"When template suggestions are enabled, autocomplete will appear when typing <code>$</code>, <code>(</code>, or <code>z</code>",fieldNameNote:"Field names can use alphanumeric characters and underscores",defaultValueNote:"Default values are optional (will be empty string if omitted)"},validationError:"Error:",dangerousTagWarning:"<{tag}> tag is included.",dangerousAttrWarning:"{attr} attribute is included.",slotSettings:"Slot settings",slot:"Slot",templateHelpTitle:"Template Syntax Help",clickToEnlarge:"Click to enlarge",understood:"Understood",syntax:"Syntax",description:"Description",example:"Example",templateHelpButton:"Template syntax help"},imagesManager:{addImage:"Add image",editImage:"Edit image",imageId:"Image ID",imageName:"Image name",altText:"Alt attribute",deleteImageConfirm:"Do you want to delete this image?",deleteImageWithUsagesConfirm:"This image is used in {count} places. Do you want to delete it?",deleteImageFromModalConfirm:"Do you want to delete this image?",addImageFailed:"Failed to add image",selectImage:"Select image",currentlySelected:"Currently selected",select:"Select"},dataViewer:{page:"Page",parts:"Parts",images:"Images",common:"Common",individual:"Individual",special:"Special",json:"JSON",html:"HTML",categoryInfo:{title:"About Category Roles",common:{title:"Common",description:"Intended for parts and images shared across the entire site. Assumed to be usable on all pages."},individual:{title:"Individual",description:"Intended for parts and images shared per page type. Assumed to be usable on all pages of the same page type."},special:{title:"Special",description:"Intended for parts and images used for dynamic pages (e.g., per store, per product) or under specific conditions. Assumed to be usable on pages dynamically generated with route model binding, etc."}}},contextMenu:{edit:"Edit",add:"Add",reorder:"Reorder",delete:"Delete",close:"Close"},editor:{pageManagement:"Page Management",partsManagement:"Parts Management",imagesManagement:"Images Management",dataViewer:"Data Viewer",loading:"Loading data...",saveFailed:"Save failed",saveFailedWithCount:"Save failed ({count} items)",saveFailedWithMessage:"Save failed ({count} items): {message}",noSaveTargets:"No save targets"}};function nT(t="ja"){return o1({locale:t,fallbackLocale:"ja",messages:{ja:eT,en:tT},globalInjection:!0})}const Nm={UNDEFINED_PROPERTIES:"Cannot read properties of undefined",APP_REFERENCE:"app"};function Cm(){if(typeof window>"u")return;const t=window;t.__zcodeI18nErrorHandlerSetup||(window.addEventListener("unhandledrejection",e=>{if(e.reason&&typeof e.reason=="object"&&"message"in e.reason){const n=String(e.reason.message);if(n.includes(Nm.UNDEFINED_PROPERTIES)&&n.includes(Nm.APP_REFERENCE)){e.preventDefault();return}}}),t.__zcodeI18nErrorHandlerSetup=!0)}function oT(){if(typeof window>"u")return;const t=window;t.__VUE_I18N_FULL_INSTALL__=!1,t.__INTLIFY_PROD_DEVTOOLS__=!1,t.__VUE_I18N_PROD_DEVTOOLS__=!1}function Ws(t,e="ja"){const n=p1(null);if(n)return n;const o=t.getAttribute("locale");return o==="ja"||o==="en"?o:e}function Gs(t,e){oT();const n=nT(e);try{t.use(n)}catch(o){console.warn("[ZeroCode] Failed to setup i18n:",o)}}Cm();class rT extends HTMLElement{app=null;componentInstance=null;_shadowRoot=null;constructor(){super()}connectedCallback(){if(this.app)return;this.getAttribute("use-shadow-dom")!=="false"?(this.setupShadowDOM(),window.addEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this))):(this.setupLightDOM(),window.addEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this)))}setupLightDOM(){const e=this.getAttribute("page")||"[]",n=this.getAttribute("css-common"),o=this.getAttribute("css-individual"),r=this.getAttribute("css-special"),i=this.getAttribute("parts-common")||"[]",s=this.getAttribute("parts-individual")||"[]",l=this.getAttribute("parts-special")||"[]",c=this.getAttribute("images-common")||"[]",d=this.getAttribute("images-individual")||"[]",u=this.getAttribute("images-special")||"[]",f=Array.from(this.querySelectorAll('[slot="script"]'));f.length>0&&(this.__savedScriptSlots=f.map(h=>({src:h.src,type:h.type,async:h.async,defer:h.defer,integrity:h.integrity,crossOrigin:h.crossOrigin})));const p=Ws(this);this.app=a.createApp(Hs,{locale:p,page:e,cssCommon:n,cssIndividual:o,cssSpecial:r,partsCommon:i,partsIndividual:s,partsSpecial:l,imagesCommon:c,imagesIndividual:d,imagesSpecial:u,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||""}),Gs(this.app,p),this.componentInstance=this.app.mount(this),this.injectLightDOMCSS()}setupShadowDOM(){const e=this.shadowRoot,n=!!e;e?(this._shadowRoot=e,this.clearScripts()):(this._shadowRoot=this.attachShadow({mode:"open"}),this.injectCSS());const o=this.getAttribute("page")||"[]",r=this.getAttribute("css-common"),i=this.getAttribute("css-individual"),s=this.getAttribute("css-special"),l=this.getAttribute("parts-common")||"[]",c=this.getAttribute("parts-individual")||"[]",d=this.getAttribute("parts-special")||"[]",u=this.getAttribute("images-common")||"[]",f=this.getAttribute("images-individual")||"[]",p=this.getAttribute("images-special")||"[]",h=Ws(this);this.app=a.createApp(Hs,{locale:h,page:o,cssCommon:r,cssIndividual:i,cssSpecial:s,partsCommon:l,partsIndividual:c,partsSpecial:d,imagesCommon:u,imagesIndividual:f,imagesSpecial:p,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||""}),Gs(this.app,h),this.componentInstance=this.app.mount(this._shadowRoot),requestAnimationFrame(()=>{requestAnimationFrame(()=>{setTimeout(()=>{this.injectScript(n)},100)})})}injectCSS(){if(!this._shadowRoot)return;const e=document.createElement("style");e.textContent=Sm,this._shadowRoot.appendChild(e),this.querySelectorAll('[slot="css"]').forEach(o=>{const r=o.cloneNode(!0);r.removeAttribute("slot"),this._shadowRoot.appendChild(r),o.remove()})}injectLightDOMCSS(){this.querySelectorAll('[slot="css"]').forEach(n=>{const o=n.cloneNode(!0);o.removeAttribute("slot"),document.head.appendChild(o)})}clearScripts(){if(!this._shadowRoot)return;this._shadowRoot.querySelectorAll("script").forEach(n=>{n.remove()})}injectScript(e=!1){if(!this._shadowRoot)return;const n=this.querySelectorAll('[slot="script"]'),o=Array.from(n),r=[],i=[];o.forEach(c=>{const d=c;if(!d.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}d.src.includes("jquery")||d.src.includes("code.jquery.com")?r.push(d):i.push(d)});const s=c=>{let d=c.src;if(e)try{const f=new URL(c.src,window.location.href);f.searchParams.set("_t",Date.now().toString()),d=f.toString()}catch{d=c.src+(c.src.includes("?")?"&":"?")+"_t="+Date.now()}const u=document.createElement("script");return u.src=d,c.type&&(u.type=c.type),c.async&&(u.async=!0),c.defer&&(u.defer=!0),c.integrity&&(u.integrity=c.integrity),c.crossOrigin&&(u.crossOrigin=c.crossOrigin),u.onerror=f=>{console.error(`Failed to load script: ${c.src}`,f)},u},l=()=>{o.forEach(c=>{c.remove()})};if(r.length>0){let c=0;const d=r.length;r.forEach(u=>{const f=s(u);f.onload=()=>{c++,c===d&&(Mo(this._shadowRoot,e),setTimeout(()=>{i.forEach(p=>{this._shadowRoot.appendChild(s(p))}),l()},50))},this._shadowRoot.appendChild(f)})}else Mo(this._shadowRoot,e),i.forEach(c=>{this._shadowRoot.appendChild(s(c))}),l()}injectLightDOMScripts(){let e=[];if(this.__savedScriptSlots&&this.__savedScriptSlots.length>0)e=this.__savedScriptSlots.map(i=>{const s=document.createElement("script");return s.src=i.src,i.type&&(s.type=i.type),i.async&&(s.async=!0),i.defer&&(s.defer=!0),i.integrity&&(s.integrity=i.integrity),i.crossOrigin&&(s.crossOrigin=i.crossOrigin),s});else{const i=this.querySelectorAll('[slot="script"]');e=Array.from(i)}const n=[],o=[];e.forEach(i=>{const s=i;if(!s.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}s.src.includes("jquery")||s.src.includes("code.jquery.com")?n.push(s):o.push(s)});const r=i=>{const s=document.createElement("script");return s.src=i.src,i.type&&(s.type=i.type),i.async&&(s.async=!0),i.defer&&(s.defer=!0),i.integrity&&(s.integrity=i.integrity),i.crossOrigin&&(s.crossOrigin=i.crossOrigin),s.onerror=l=>{console.error(`Failed to load script: ${i.src}`,l)},s};if(n.length>0){let i=0;const s=n.length;n.forEach(l=>{const c=r(l);c.onload=()=>{i++,i===s&&requestAnimationFrame(()=>{o.forEach(d=>{document.body.appendChild(r(d))})})},document.body.appendChild(c)})}else o.forEach(i=>{document.body.appendChild(r(i))})}getData(e){return this.componentInstance&&this.componentInstance.getData?this.componentInstance.getData(e):null}setData(e,n){return this.componentInstance&&this.componentInstance.setData?this.componentInstance.setData(e,n):!1}get allowDynamicContentInteraction(){if(this.componentInstance){const e=this.componentInstance.allowDynamicContentInteraction;if(e!==void 0)return e&&typeof e=="object"&&"value"in e?e.value:e}return!0}set allowDynamicContentInteraction(e){if(this.componentInstance){const n=this.componentInstance.allowDynamicContentInteraction;n!==void 0&&(n&&typeof n=="object"&&"value"in n?n.value=e:this.componentInstance.allowDynamicContentInteraction=e)}}disconnectedCallback(){if(this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot){if(this._shadowRoot.__zecEventListeners){const e=this._shadowRoot.__zecEventListeners,n=this._shadowRoot;e.forEach(o=>{o.forEach(r=>{n.removeEventListener(r.eventName,r.handler,!0)})}),e.clear()}if(window.__zecShadowRoots){const e=window.__zecShadowRoots,n=this._shadowRoot;for(const[o,r]of e.entries())r===n&&e.delete(o)}}this._shadowRoot=null,window.removeEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this)),window.removeEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this))}handleDOMUpdated(){if(!this._shadowRoot||this.getAttribute("use-shadow-dom")!=="true")return;this._shadowRoot.__zecJQueryExtended&&delete this._shadowRoot.__zecJQueryExtended;const e=this._shadowRoot.querySelector("script[data-zec-shadow-extension]");e&&e.remove(),Mo(this._shadowRoot,!0)}handleLightDOMUpdated(){this.getAttribute("use-shadow-dom")!=="true"&&(this.__lightDOMScriptsLoaded||(this.injectLightDOMScripts(),this.__lightDOMScriptsLoaded=!0))}static get observedAttributes(){return["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data","use-shadow-dom"]}attributeChangedCallback(e,n,o){if(n!==o){if(e==="use-shadow-dom"){this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot&&(this._shadowRoot.innerHTML="",this._shadowRoot=null),this.connectedCallback();return}this.app&&(this.app.unmount(),this.app=null,this.componentInstance=null,this.connectedCallback())}}}customElements.get("zcode-cms")||customElements.define("zcode-cms",rT);function iT(t){const{t:e}=rn(),n=a.ref("common"),o=a.ref(null),r=a.ref(null),i=a.ref(null),s=a.ref(null),l=a.ref(!1),c=a.ref(null),d=a.ref(null),{renderComponentToHtml:u}=fi(t,!1),f=a.computed(()=>{const C=t.parts;return n.value==="common"?C.common:n.value==="individual"?C.individual:C.special}),p=a.computed(()=>{const C=f.value,N=new Map;return C.forEach(O=>{N.has(O.type)||N.set(O.type,[]),O.parts.forEach((k,U)=>{N.get(O.type).push({type:O,partIndex:U})})}),Array.from(N.entries()).map(([O,k])=>({type:O,parts:k.map(U=>({...U.type,_partIndex:U.partIndex,_displayPart:U.type.parts[U.partIndex]}))}))});function h(){const C=t.parts;return n.value==="common"?C.common:n.value==="individual"?C.individual:C.special}function m(C){return f.value.find(N=>N.type===C)||null}function b(C){return i.value&&i.value.partIndex===C&&i.value.part.slots||null}function g(C,N,O){if(i.value&&i.value.partIndex===C){const k=i.value.part;return k.slots||(k.slots={}),O(k.slots),!0}return!1}function x(C){const N={};return C.forEach(O=>{if(O.optional)N[O.fieldName]=void 0;else switch(O.type){case"text":N[O.fieldName]=O.defaultValue||"";break;case"radio":N[O.fieldName]=O.options?.[0]||"";break;case"checkbox":N[O.fieldName]=[];break;case"boolean":N[O.fieldName]=!0;break;case"rich":N[O.fieldName]=O.defaultValue?`<p>${O.defaultValue}</p>`:"<p></p>";break;case"image":N[O.fieldName]=O.defaultValue||"";break}}),N}function v(C){o.value=C,r.value=null,l.value=!1}function w(){r.value=a.reactive({id:jn(),type:"",description:"",parts:[{id:jn(),title:"part_1",description:"",body:"<div>{$content:コンテンツを入力}</div>"}]}),s.value="type",l.value=!0,o.value=null}function T(C){r.value=a.reactive(JSON.parse(JSON.stringify(C))),s.value="type",l.value=!1,o.value=C}function M(C,N){const O=C.parts[N];if(!O)return;const k=JSON.parse(JSON.stringify(O));k.slots||(k.slots={}),i.value={type:a.reactive(JSON.parse(JSON.stringify(C))),partIndex:N,part:a.reactive(k)},s.value="part"}async function A(C){const N=m(C.type);if(!N)return;const O=a.reactive(JSON.parse(JSON.stringify(N))),k={id:jn(),title:`part_${O.parts.length+1}`,description:"",body:"<div>{$content:コンテンツを入力}</div>"};O.parts.push(k);const U=O.parts.length-1;await a.nextTick(),i.value={type:O,partIndex:U,part:a.reactive(JSON.parse(JSON.stringify(k))),isNewPart:!0},s.value="part"}async function y(){if(!r.value)return;const C=Le(r.value);if(!C.valid){alert(e("partsManager.validationError")+`
|
|
462
|
+
3. "-" cannot repeat`);Ue.customSchemes.push([n,e])}function Ww(){Ue.scanner=Lw(Ue.customSchemes);for(let n=0;n<Ue.tokenQueue.length;n++)Ue.tokenQueue[n][1]({scanner:Ue.scanner});Ue.parser=Bw(Ue.scanner.tokens);for(let n=0;n<Ue.pluginQueue.length;n++)Ue.pluginQueue[n][1]({scanner:Ue.scanner,parser:Ue.parser});return Ue.initialized=!0,Ue}function nc(n){return Ue.initialized||Ww(),Fw(Ue.parser.start,n,Ih(Ue.scanner.start,n))}nc.scan=Ih;function $h(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const o=new ec(t),r=nc(n),i=[];for(let a=0;a<r.length;a++){const l=r[a];l.isLink&&(!e||l.t===e)&&o.check(l)&&i.push(l.toFormattedObject(o))}return i}var oc="[\0- -\u2029 ]",qw=new RegExp(oc),Gw=new RegExp(`${oc}$`),Kw=new RegExp(oc,"g");function Jw(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function Xw(n){return new At({key:new rn("autolink"),appendTransaction:(e,t,o)=>{const r=e.some(d=>d.docChanged)&&!t.doc.eq(o.doc),i=e.some(d=>d.getMeta("preventAutolink"));if(!r||i)return;const{tr:a}=o,l=Op(t.doc,[...e]);if(Hp(l).forEach(({newRange:d})=>{const u=Dk(o.doc,d,h=>h.isTextblock);let f,p;if(u.length>1)f=u[0],p=o.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){const h=o.doc.textBetween(d.from,d.to," "," ");if(!Gw.test(h))return;f=u[0],p=o.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&p){const h=p.split(qw).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],g=f.pos+p.lastIndexOf(m);if(!m)return!1;const y=nc(m).map(b=>b.toObject(n.defaultProtocol));if(!Jw(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:g+b.start+1,to:g+b.end+1})).filter(b=>o.schema.marks.code?!o.doc.rangeHasMark(b.from,b.to,o.schema.marks.code):!0).filter(b=>n.validate(b.value)).filter(b=>n.shouldAutoLink(b.value)).forEach(b=>{wl(b.from,b.to,o.doc).some(z=>z.mark.type===n.type)||a.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!a.steps.length)return a}})}function Yw(n){return new At({key:new rn("handleClickLink"),props:{handleClick:(e,t,o)=>{var r,i;if(o.button!==0||!e.editable)return!1;let a=!1;if(n.enableClickSelection&&(a=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){let l=null;if(o.target instanceof HTMLAnchorElement)l=o.target;else{let f=o.target;const p=[];for(;f.nodeName!=="DIV";)p.push(f),f=f.parentNode;l=p.find(h=>h.nodeName==="A")}if(!l)return a;const c=jp(e.state,n.type.name),d=(r=l?.href)!=null?r:c.href,u=(i=l?.target)!=null?i:c.target;l&&d&&(window.open(d,u),a=!0)}return a}}})}function Qw(n){return new At({key:new rn("handlePasteLink"),props:{handlePaste:(e,t,o)=>{const{shouldAutoLink:r}=n,{state:i}=e,{selection:a}=i,{empty:l}=a;if(l)return!1;let c="";o.content.forEach(u=>{c+=u.textContent});const d=$h(c,{defaultProtocol:n.defaultProtocol}).find(u=>u.isLink&&u.value===c);return!c||!d||r!==void 0&&!r(d.value)?!1:n.editor.commands.setMark(n.type,{href:d.href})}}})}function To(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(o=>{const r=typeof o=="string"?o:o.scheme;r&&t.push(r)}),!n||n.replace(Kw,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Zw=Ar.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){Lh(n);return}Lh(n.scheme,n.optionalSlashes)})},onDestroy(){Uw()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!To(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),t=/^[a-z][a-z0-9+.-]*:/i.test(n);if(e||t&&!n.includes("@"))return!0;const r=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!To(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!To(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",_t(this.options.HTMLAttributes,n),0]:["a",_t(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t;const o=((t=n.attrs)==null?void 0:t.href)||"";return`[${e.renderChildren(n)}](${o})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:o=>!!To(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:o=>!!To(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Go({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:o}=this.options,r=$h(n).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:a=>!!To(a,t),protocols:t,defaultProtocol:o}));r.length&&r.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(Xw({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:o=>this.options.isAllowedUri(o,{defaultValidate:r=>!!To(r,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(Yw({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(Qw({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),eS=Zw;const tS={class:"zcode-rich-text-editor"},nS={key:0,class:"zcode-rich-text-toolbar"},oS=s.defineComponent({__name:"RichTextEditor",props:{modelValue:{type:String},placeholder:{type:String}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,o=e,r=jE({extensions:[UE,qE,KE,ew,sw,dw,Cw,Nw,vw,zw,eS.configure({openOnClick:!1,HTMLAttributes:{class:"zcode-link"}})],content:t.modelValue||"",editorProps:{attributes:{class:"zcode-tiptap-editor","data-placeholder":t.placeholder||"テキストを入力..."}},onUpdate:({editor:a})=>{const l=a.getHTML();o("update:modelValue",l)}});s.watch(()=>t.modelValue,a=>{r.value&&r.value.getHTML()!==a&&r.value.commands.setContent(a||"")});const i=()=>{if(!r.value)return;const a=r.value.getAttributes("link").href,l=window.prompt("URLを入力してください",a);if(l!==null){if(l===""){r.value.chain().focus().extendMarkRange("link").unsetLink().run();return}r.value.chain().focus().extendMarkRange("link").setLink({href:l}).run()}};return s.onUnmounted(()=>{r.value&&r.value.destroy()}),(a,l)=>(s.openBlock(),s.createElementBlock("div",tS,[s.unref(r)?(s.openBlock(),s.createElementBlock("div",nS,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([{"is-active":s.unref(r).isActive("bold")},"zcode-toolbar-btn"]),title:"太字",onClick:l[0]||(l[0]=c=>s.unref(r).chain().focus().toggleBold().run())},[s.createVNode(s.unref(mm),{size:16})],2),s.createElementVNode("button",{type:"button",class:s.normalizeClass([{"is-active":s.unref(r).isActive("italic")},"zcode-toolbar-btn"]),title:"斜体",onClick:l[1]||(l[1]=c=>s.unref(r).chain().focus().toggleItalic().run())},[s.createVNode(s.unref(xm),{size:16})],2),s.createElementVNode("button",{type:"button",class:s.normalizeClass([{"is-active":s.unref(r).isActive("strike")},"zcode-toolbar-btn"]),title:"取り消し線",onClick:l[2]||(l[2]=c=>s.unref(r).chain().focus().toggleStrike().run())},[s.createVNode(s.unref(Cm),{size:16})],2),l[5]||(l[5]=s.createElementVNode("div",{class:"zcode-toolbar-divider"},null,-1)),s.createElementVNode("button",{type:"button",class:s.normalizeClass([{"is-active":s.unref(r).isActive("bulletList")},"zcode-toolbar-btn"]),title:"箇条書き",onClick:l[3]||(l[3]=c=>s.unref(r).chain().focus().toggleBulletList().run())},[s.createVNode(s.unref(wm),{size:16})],2),s.createElementVNode("button",{type:"button",class:s.normalizeClass([{"is-active":s.unref(r).isActive("orderedList")},"zcode-toolbar-btn"]),title:"番号付きリスト",onClick:l[4]||(l[4]=c=>s.unref(r).chain().focus().toggleOrderedList().run())},[s.createVNode(s.unref(Em),{size:16})],2),l[6]||(l[6]=s.createElementVNode("div",{class:"zcode-toolbar-divider"},null,-1)),s.createElementVNode("button",{type:"button",class:s.normalizeClass([{"is-active":s.unref(r).isActive("link")},"zcode-toolbar-btn"]),title:"リンク",onClick:i},[s.createVNode(s.unref(km),{size:16})],2)])):s.createCommentVNode("",!0),s.createVNode(s.unref(FE),{editor:s.unref(r),class:"zcode-rich-text-editor-content"},null,8,["editor"])]))}}),rS={class:"zcode-image-modal-header"},iS={class:"zcode-image-modal-header-title",role:"heading","aria-level":"3"},sS=["aria-label"],aS={key:0,class:"zcode-image-current"},lS={class:"zcode-image-current-title",role:"heading","aria-level":"4"},cS={class:"zcode-image-current-item"},dS=["src","alt"],uS={class:"zcode-image-current-name"},fS={class:"zcode-image-tabs"},pS={class:"zcode-image-grid"},hS=["onClick"],mS=["src","alt"],gS={class:"zcode-image-name"},yS={class:"zcode-image-add"},bS={class:"zcode-image-modal-actions"},xS=s.defineComponent({__name:"ImageSelectModal",props:{isOpen:{type:Boolean},imagesCommon:{type:Array},imagesIndividual:{type:Array},imagesSpecial:{type:Array},currentValue:{type:String}},emits:["update:model-value","add-image","delete-image","close"],setup(n,{emit:e}){const{t}=Vt(),o=n,r=e,i=s.ref("common"),a=s.ref(null),l=s.ref(o.currentValue||null),c=s.computed(()=>i.value==="common"?o.imagesCommon:i.value==="individual"?o.imagesIndividual:o.imagesSpecial),d=()=>o.currentValue&&[...o.imagesCommon,...o.imagesIndividual,...o.imagesSpecial].find(y=>y.id===o.currentValue)||null,u=g=>{l.value=g.id},f=()=>{l.value&&(r("update:model-value",l.value),m())},p=()=>{l.value&&confirm(t("imagesManager.deleteImageFromModalConfirm"))&&(r("delete-image",l.value),l.value=null)},h=g=>{const b=g.target.files?.[0];if(!b)return;const z=new FileReader;z.onload=w=>{const T=w.target?.result,A={id:`img-${Date.now()}`,name:b.name,url:T,mimeType:b.type,needsUpload:!0},M=i.value==="common"?"common":i.value==="individual"?"individual":"special";r("add-image",A,M),l.value=A.id},z.readAsDataURL(b)},m=()=>{r("close")};return(g,y)=>n.isOpen?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-image-modal",onClick:s.withModifiers(m,["self"])},[s.createElementVNode("div",{class:"zcode-image-modal-content",onClick:y[4]||(y[4]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",rS,[s.createElementVNode("div",iS,s.toDisplayString(g.$t("imagesManager.selectImage")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":g.$t("common.close"),onClick:m},[s.createVNode(s.unref(Xe),{size:18})],8,sS)]),n.currentValue&&d()?(s.openBlock(),s.createElementBlock("div",aS,[s.createElementVNode("div",lS,s.toDisplayString(g.$t("imagesManager.currentlySelected")),1),s.createElementVNode("div",cS,[s.createElementVNode("img",{src:d()?.url,alt:d()?.name||"",class:"zcode-image-current-item-img"},null,8,dS),s.createElementVNode("div",uS,s.toDisplayString(d()?.name),1)])])):s.createCommentVNode("",!0),s.createElementVNode("div",fS,[s.createElementVNode("button",{class:s.normalizeClass([{active:i.value==="common"},"zcode-image-tab"]),onClick:y[0]||(y[0]=b=>i.value="common")},s.toDisplayString(g.$t("dataViewer.common")),3),s.createElementVNode("button",{class:s.normalizeClass([{active:i.value==="individual"},"zcode-image-tab"]),onClick:y[1]||(y[1]=b=>i.value="individual")},s.toDisplayString(g.$t("dataViewer.individual")),3),n.imagesSpecial.length>0?(s.openBlock(),s.createElementBlock("button",{key:0,class:s.normalizeClass([{active:i.value==="special"},"zcode-image-tab"]),onClick:y[2]||(y[2]=b=>i.value="special")},s.toDisplayString(g.$t("dataViewer.special")),3)):s.createCommentVNode("",!0)]),s.createElementVNode("div",pS,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(c.value,b=>(s.openBlock(),s.createElementBlock("div",{key:b.id,class:s.normalizeClass([{selected:l.value===b.id},"zcode-image-item"]),onClick:z=>u(b)},[s.createElementVNode("img",{src:b.url,alt:b.name,class:"zcode-image-item-img"},null,8,mS),s.createElementVNode("div",gS,s.toDisplayString(b.name),1)],10,hS))),128))]),s.createElementVNode("div",yS,[s.createElementVNode("input",{ref_key:"fileInput",ref:a,type:"file",accept:"image/*",style:{display:"none"},onChange:h},null,544),s.createElementVNode("button",{class:"zcode-image-add-btn",onClick:y[3]||(y[3]=b=>a.value?.click())},[s.createVNode(s.unref(co),{size:16}),s.createElementVNode("span",null,s.toDisplayString(g.$t("imagesManager.addImage")),1)])]),s.createElementVNode("div",bS,[l.value?(s.openBlock(),s.createElementBlock("button",{key:0,class:"zcode-btn-primary zcode-image-modal-actions-btn",onClick:f},[s.createVNode(s.unref(er),{size:16}),s.createElementVNode("span",null,s.toDisplayString(g.$t("imagesManager.select")),1)])):s.createCommentVNode("",!0),l.value?(s.openBlock(),s.createElementBlock("button",{key:1,class:"zcode-btn-danger zcode-image-modal-actions-btn",onClick:p},[s.createVNode(s.unref(Ln),{size:16}),s.createElementVNode("span",null,s.toDisplayString(g.$t("common.delete")),1)])):s.createCommentVNode("",!0)])])])):s.createCommentVNode("",!0)}}),kS={key:0,class:"zcode-edit-panel-header"},ES={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},wS=["aria-label"],SS={key:1,class:"zcode-parent-selector"},CS={key:2,class:"zcode-group-tabs"},NS=["onClick"],vS={key:3,class:"zcode-field-editor"},TS={class:"zcode-field-item-title",role:"heading","aria-level":"4"},zS={key:0,class:"zcode-text-editor"},MS=["value","placeholder","maxlength","readonly","disabled","onInput"],AS={key:0,class:"zcode-field-error-message"},IS={key:1,class:"zcode-field-counter"},_S={key:1,class:"zcode-text-editor"},OS=["value","placeholder","maxlength","readonly","disabled","onInput"],DS={key:0,class:"zcode-field-error-message"},PS={key:1,class:"zcode-field-counter"},RS={key:2,class:"zcode-rich-text-editor-wrapper"},LS={key:0,class:"zcode-field-error-message"},$S={key:3,class:"zcode-radio-editor"},VS={class:"zcode-radio-group"},BS=["onUpdate:modelValue","name","value","onChange"],FS={class:"zcode-radio-item-label"},jS={key:4,class:"zcode-checkbox-editor"},HS={class:"zcode-checkbox-group"},US=["onUpdate:modelValue","value","onChange"],WS={class:"zcode-checkbox-item-label"},qS={key:5,class:"zcode-select-editor"},GS=["onUpdate:modelValue","onChange"],KS=["value"],JS={key:6,class:"zcode-select-editor"},XS=["onUpdate:modelValue","size","onChange"],YS=["value"],QS={key:7,class:"zcode-tag-editor"},ZS=["onUpdate:modelValue","onChange"],eC=["value"],tC={class:"zcode-tag-preview"},nC={key:8,class:"zcode-boolean-editor"},oC={class:"zcode-checkbox-item"},rC=["onUpdate:modelValue","onChange"],iC={class:"zcode-checkbox-item-label"},sC={key:9,class:"zcode-image-editor"},aC={class:"zcode-image-editor-buttons"},lC=["onClick"],cC=["title","onClick"],dC={key:0,class:"zcode-image-preview"},uC=["src","alt"],fC={key:4,class:"zcode-edit-fields"},pC={class:"zcode-edit-fields-text"},hC={class:"zcode-edit-fields-text"},Vh=s.defineComponent({__name:"EditPanel",props:{editingComponent:{type:[Object,null]},editingAvailableFields:{type:Array},fieldErrors:{type:Object},currentMode:{type:String},canSelectParent:{type:Boolean},imagesCommon:{type:Array},imagesIndividual:{type:Array},imagesSpecial:{type:Array},previewMode:{type:Boolean}},emits:["close","select-parent","save-field","add-image","delete-image"],setup(n,{emit:e}){const t=n,o=s.ref("all"),r=s.computed(()=>{const k=new Map;return t.editingAvailableFields.forEach(E=>{const x=E.groupName||"other";k.set(x,(k.get(x)||0)+1)}),Array.from(k.entries()).map(([E,x])=>({name:E,count:x}))}),i=s.computed(()=>r.value.length>1),a=s.computed(()=>!i.value||o.value==="all"?t.editingAvailableFields:t.editingAvailableFields.filter(k=>(k.groupName||"other")===o.value));s.watch(()=>i.value,k=>{k?o.value="all":o.value=void 0},{immediate:!0}),s.watch(()=>t.editingAvailableFields,()=>{if(i.value){if(o.value==="all")return;r.value.some(E=>E.name===o.value)||(o.value="all")}},{deep:!0});const l=e,c=s.ref({});function d(k){const E=k.label||k.fieldName,x=k.currentValue,B=k.type==="rich"&&typeof x=="string"&&x.trim()==="<p></p>"?"":x??"";return k.required&&(B===""||B===void 0||B===null)?`${E}は必須です`:typeof k.maxLength=="number"&&k.maxLength>0&&String(B).length>k.maxLength?`${E}は${k.maxLength}文字以内で入力してください`:null}function u(k,E){E?c.value[k]=E:delete c.value[k]}function f(k){return c.value[k]||t.fieldErrors?.[k]||null}const p=s.ref(!1),h=s.ref(null),m=k=>{h.value=k,p.value=!0},g=()=>{p.value=!1,h.value=null},y=k=>{k.currentValue="",l("save-field",k)},b=k=>{h.value&&(h.value.currentValue=k||"",l("save-field",h.value))},z=(k,E)=>{l("add-image",k,E)},w=k=>{l("delete-image",k),h.value?.currentValue===k&&(h.value.currentValue="",l("save-field",h.value))},T=k=>k&&[...t.imagesCommon,...t.imagesIndividual,...t.imagesSpecial].find(B=>B.id===k)?.url||null,A=(k,E)=>{const x=E.target;k.currentValue=x.value,u(k.fieldName,d(k)),l("save-field",k)},M=(k,E)=>{k.optional&&E===""?k.currentValue=void 0:k.currentValue=E,u(k.fieldName,d(k)),l("save-field",k)};return(k,E)=>n.editingComponent&&n.currentMode==="edit"?(s.openBlock(),s.createElementBlock("div",{key:0,class:s.normalizeClass(n.previewMode?"zcode-edit-panel-preview":"zcode-edit-panel"),onClick:E[3]||(E[3]=s.withModifiers(()=>{},["stop"]))},[n.previewMode?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("div",kS,[s.createElementVNode("div",ES,s.toDisplayString(k.$t("editPanel.editing",{type:n.editingComponent.type})),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":k.$t("common.close"),onClick:E[0]||(E[0]=x=>k.$emit("close"))},[s.createVNode(s.unref(Xe),{size:18})],8,wS)])),!n.previewMode&&n.canSelectParent?(s.openBlock(),s.createElementBlock("div",SS,[s.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:E[1]||(E[1]=x=>k.$emit("select-parent"))},[s.createVNode(s.unref(Yr),{size:16}),s.createElementVNode("span",null,s.toDisplayString(k.$t("addPanel.selectParent")),1)])])):s.createCommentVNode("",!0),i.value?(s.openBlock(),s.createElementBlock("div",CS,[s.createElementVNode("button",{class:s.normalizeClass([{active:o.value==="all"},"zcode-group-tab"]),onClick:E[2]||(E[2]=x=>o.value="all")}," all ",2),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(r.value,x=>(s.openBlock(),s.createElementBlock("button",{key:x.name,class:s.normalizeClass([{active:o.value===x.name},"zcode-group-tab"]),onClick:B=>o.value=x.name},s.toDisplayString(x.name),11,NS))),128))])):s.createCommentVNode("",!0),a.value.length>0?(s.openBlock(),s.createElementBlock("div",vS,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(a.value,x=>(s.openBlock(),s.createElementBlock("div",{key:x.fieldName,class:"zcode-field-item"},[s.createElementVNode("div",TS,s.toDisplayString(x.label),1),x.type==="text"?(s.openBlock(),s.createElementBlock("div",zS,[s.createElementVNode("input",{type:"text",value:x.currentValue??"",placeholder:x.defaultValue,maxlength:x.maxLength,readonly:x.readonly,disabled:x.disabled,class:s.normalizeClass([{"zcode-field-error":f(x.fieldName)},"zcode-text-input"]),onInput:B=>A(x,B)},null,42,MS),f(x.fieldName)?(s.openBlock(),s.createElementBlock("div",AS,s.toDisplayString(f(x.fieldName)),1)):s.createCommentVNode("",!0),x.maxLength?(s.openBlock(),s.createElementBlock("div",IS,s.toDisplayString(String(x.currentValue??"").length)+" / "+s.toDisplayString(x.maxLength),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),x.type==="textarea"?(s.openBlock(),s.createElementBlock("div",_S,[s.createElementVNode("textarea",{value:x.currentValue??"",placeholder:x.defaultValue,maxlength:x.maxLength,readonly:x.readonly,disabled:x.disabled,class:s.normalizeClass([{"zcode-field-error":f(x.fieldName)},"zcode-textarea"]),rows:"4",onInput:B=>A(x,B)},null,42,OS),f(x.fieldName)?(s.openBlock(),s.createElementBlock("div",DS,s.toDisplayString(f(x.fieldName)),1)):s.createCommentVNode("",!0),x.maxLength?(s.openBlock(),s.createElementBlock("div",PS,s.toDisplayString(String(x.currentValue??"").length)+" / "+s.toDisplayString(x.maxLength),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),x.type==="rich"?(s.openBlock(),s.createElementBlock("div",RS,[s.createVNode(oS,{"model-value":x.currentValue??"",placeholder:x.defaultValue,"onUpdate:modelValue":B=>M(x,B)},null,8,["model-value","placeholder","onUpdate:modelValue"]),f(x.fieldName)?(s.openBlock(),s.createElementBlock("div",LS,s.toDisplayString(f(x.fieldName)),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),x.type==="radio"?(s.openBlock(),s.createElementBlock("div",$S,[s.createElementVNode("div",VS,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(x.options,B=>(s.openBlock(),s.createElementBlock("label",{key:B,class:"zcode-radio-item"},[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":$=>x.currentValue=$,type:"radio",name:x.fieldName,value:B,onChange:$=>k.$emit("save-field",x)},null,40,BS),[[s.vModelRadio,x.currentValue]]),s.createElementVNode("span",FS,s.toDisplayString(B),1)]))),128))])])):s.createCommentVNode("",!0),x.type==="checkbox"?(s.openBlock(),s.createElementBlock("div",jS,[s.createElementVNode("div",HS,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(x.options,B=>(s.openBlock(),s.createElementBlock("label",{key:B,class:"zcode-checkbox-item"},[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":$=>x.currentValue=$,type:"checkbox",value:B,onChange:$=>k.$emit("save-field",x)},null,40,US),[[s.vModelCheckbox,x.currentValue]]),s.createElementVNode("span",WS,s.toDisplayString(B),1)]))),128))])])):s.createCommentVNode("",!0),x.type==="select"?(s.openBlock(),s.createElementBlock("div",qS,[s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":B=>x.currentValue=B,class:"zcode-select",onChange:B=>k.$emit("save-field",x)},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(x.options,B=>(s.openBlock(),s.createElementBlock("option",{key:B,value:B},s.toDisplayString(B),9,KS))),128))],40,GS),[[s.vModelSelect,x.currentValue]])])):s.createCommentVNode("",!0),x.type==="select-multiple"?(s.openBlock(),s.createElementBlock("div",JS,[s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":B=>x.currentValue=B,class:"zcode-select",multiple:"",size:Math.min(x.options?.length||3,5),onChange:B=>k.$emit("save-field",x)},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(x.options,B=>(s.openBlock(),s.createElementBlock("option",{key:B,value:B},s.toDisplayString(B),9,YS))),128))],40,XS),[[s.vModelSelect,x.currentValue]])])):s.createCommentVNode("",!0),x.type==="tag"?(s.openBlock(),s.createElementBlock("div",QS,[s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":B=>x.currentValue=B,class:"zcode-select",onChange:B=>k.$emit("save-field",x)},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(x.options,B=>(s.openBlock(),s.createElementBlock("option",{key:B,value:B},s.toDisplayString(B),9,eC))),128))],40,ZS),[[s.vModelSelect,x.currentValue]]),s.createElementVNode("div",tC,[E[4]||(E[4]=s.createTextVNode(" 現在のタグ: ",-1)),s.createElementVNode("code",null,"<"+s.toDisplayString(x.currentValue)+">",1)])])):s.createCommentVNode("",!0),x.type==="boolean"?(s.openBlock(),s.createElementBlock("div",nC,[s.createElementVNode("label",oC,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":B=>x.currentValue=B,type:"checkbox",onChange:B=>k.$emit("save-field",x)},null,40,rC),[[s.vModelCheckbox,x.currentValue]]),s.createElementVNode("span",iC,s.toDisplayString(x.label)+"を表示",1)])])):s.createCommentVNode("",!0),x.type==="image"?(s.openBlock(),s.createElementBlock("div",sC,[s.createElementVNode("div",aC,[s.createElementVNode("button",{class:"zcode-image-select-btn",onClick:B=>m(x)},[s.createVNode(s.unref(mc),{size:16}),s.createElementVNode("span",null,s.toDisplayString(x.currentValue?k.$t("editPanel.replaceImage"):k.$t("editPanel.selectImage")),1)],8,lC),x.currentValue?(s.openBlock(),s.createElementBlock("button",{key:0,class:"zcode-image-clear-btn",title:k.$t("editPanel.clearImageTitle"),onClick:B=>y(x)},[s.createVNode(s.unref(Xe),{size:16}),s.createElementVNode("span",null,s.toDisplayString(k.$t("editPanel.clearImage")),1)],8,cC)):s.createCommentVNode("",!0)]),T(x.currentValue)?(s.openBlock(),s.createElementBlock("div",dC,[s.createElementVNode("img",{src:T(x.currentValue)||"",alt:x.label,class:"zcode-image-preview-img"},null,8,uC)])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)]))),128))])):!i.value||a.value.length===0?(s.openBlock(),s.createElementBlock("div",fC,[s.createElementVNode("div",pC,s.toDisplayString(k.$t("editPanel.id",{id:n.editingComponent.id})),1),s.createElementVNode("div",hC,"Type: "+s.toDisplayString(n.editingComponent.type),1)])):s.createCommentVNode("",!0),s.createVNode(xS,{"is-open":p.value,"images-common":n.imagesCommon,"images-individual":n.imagesIndividual,"images-special":n.imagesSpecial,"current-value":h.value?.currentValue||void 0,"onUpdate:modelValue":b,onAddImage:z,onDeleteImage:w,onClose:g},null,8,["is-open","images-common","images-individual","images-special","current-value"])],2)):s.createCommentVNode("",!0)}}),mC={class:"zcode-delete-panel-header"},gC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},yC=["aria-label"],bC={key:0,class:"zcode-parent-selector"},xC={class:"zcode-delete-panel-content"},kC={class:"zcode-delete-warning"},EC={class:"zcode-delete-warning-text"},wC={class:"zcode-delete-actions"},SC=s.defineComponent({__name:"DeletePanel",props:{deleteConfirmComponent:{type:[Object,null]},currentMode:{type:String},canSelectParent:{type:Boolean}},emits:["confirm","cancel","select-parent"],setup(n){return(e,t)=>n.deleteConfirmComponent&&n.currentMode==="delete"?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-delete-panel",onClick:t[4]||(t[4]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",mC,[s.createElementVNode("div",gC,s.toDisplayString(e.$t("deletePanel.title")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":e.$t("common.close"),onClick:t[0]||(t[0]=o=>e.$emit("cancel"))},[s.createVNode(s.unref(Xe),{size:18})],8,yC)]),n.canSelectParent?(s.openBlock(),s.createElementBlock("div",bC,[s.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:t[1]||(t[1]=o=>e.$emit("select-parent"))},[s.createVNode(s.unref(Yr),{size:16}),s.createElementVNode("span",null,s.toDisplayString(e.$t("deletePanel.selectParent")),1)])])):s.createCommentVNode("",!0),s.createElementVNode("div",xC,[s.createElementVNode("div",kC,[s.createVNode(s.unref(xc),{size:20,class:"zcode-delete-warning-icon"}),s.createElementVNode("div",EC,s.toDisplayString(e.$t("deletePanel.confirmMessage")),1)]),s.createElementVNode("div",wC,[s.createElementVNode("button",{class:"zcode-btn-danger",onClick:t[2]||(t[2]=o=>e.$emit("confirm"))},[s.createVNode(s.unref(Ln),{size:16}),s.createElementVNode("span",null,s.toDisplayString(e.$t("common.delete")),1)]),s.createElementVNode("button",{class:"zcode-btn-cancel",onClick:t[3]||(t[3]=o=>e.$emit("cancel"))},[s.createVNode(s.unref(Xe),{size:16}),s.createElementVNode("span",null,s.toDisplayString(e.$t("common.cancel")),1)])])])])):s.createCommentVNode("",!0)}}),CC={class:"zcode-reorder-panel-header"},NC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},vC=["aria-label"],TC={key:0,class:"zcode-parent-selector"},zC={class:"zcode-reorder-panel-content"},MC={class:"zcode-reorder-panel-content-text"},AC={class:"zcode-reorder-source"},IC=s.defineComponent({__name:"ReorderPanel",props:{reorderSourcePath:{type:String},currentMode:{type:String},canSelectParent:{type:Boolean}},emits:["cancel","select-parent"],setup(n){return(e,t)=>n.reorderSourcePath&&n.currentMode==="reorder"?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-reorder-panel",onClick:t[2]||(t[2]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",CC,[s.createElementVNode("div",NC,s.toDisplayString(e.$t("reorderPanel.title")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":e.$t("common.close"),onClick:t[0]||(t[0]=o=>e.$emit("cancel"))},[s.createVNode(s.unref(Xe),{size:18})],8,vC)]),n.canSelectParent?(s.openBlock(),s.createElementBlock("div",TC,[s.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:t[1]||(t[1]=o=>e.$emit("select-parent"))},[s.createVNode(s.unref(Yr),{size:16}),s.createElementVNode("span",null,s.toDisplayString(e.$t("reorderPanel.selectParent")),1)])])):s.createCommentVNode("",!0),s.createElementVNode("div",zC,[s.createElementVNode("div",MC,s.toDisplayString(e.$t("reorderPanel.instruction")),1),s.createElementVNode("div",AC,s.toDisplayString(e.$t("reorderPanel.source",{path:n.reorderSourcePath})),1)])])):s.createCommentVNode("",!0)}}),_C={class:"zcode-add-panel-header"},OC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},DC=["aria-label"],PC={key:0,class:"zcode-parent-selector"},RC={class:"zcode-part-category-tabs"},LC=["onClick"],$C={key:1,class:"zcode-type-tabs"},VC=["onClick"],BC={class:"zcode-add-panel-content"},FC={class:"zcode-part-list"},jC={class:"zcode-part-type-section"},HC={class:"zcode-type-section-title",role:"heading","aria-level":"3"},UC={class:"zcode-type-section-description"},WC={key:0,class:"zcode-module-buttons"},qC={class:"zcode-module-preview-header"},GC={class:"zcode-module-preview-label zcode-module-preview-label-header"},KC=["aria-label"],JC=["innerHTML"],XC={key:1,class:"zcode-empty-parts"},YC={class:"zcode-empty-parts-text"},QC={class:"zcode-type-section-title",role:"heading","aria-level":"3"},ZC={key:0,class:"zcode-type-section-description"},eN={class:"zcode-module-buttons"},tN=["onClick"],nN={class:"zcode-module-preview-header"},oN={class:"zcode-module-preview-label zcode-module-preview-label-header"},rN=["aria-label","onClick"],iN=["innerHTML"],sN={key:0,class:"zcode-empty-parts"},aN={class:"zcode-empty-parts-text"},lN={key:2,class:"zcode-insert-position"},cN={class:"zcode-insert-header"},dN={class:"zcode-keep-adding-label zcode-keep-adding-label-position"},uN=["checked"],fN={class:"zcode-insert-buttons"},pN={class:"zcode-preview-modal-header"},hN={class:"zcode-preview-modal-header-title",role:"heading","aria-level":"4"},mN=["innerHTML"],gN=s.defineComponent({__name:"AddPanel",props:{addTargetPath:{type:[String,null]},addPartCategory:{type:String},addTypeTab:{type:[String,null]},addSelectedPart:{type:[Object,null]},addSelectedType:{type:[Object,null]},clickedComponent:{type:[Object,null]},availablePartTypes:{type:Array},groupedPartsByType:{type:Array},canSelectParent:{type:Boolean},getPartPreviewHtml:{type:Function},getClickedComponentPreviewHtml:{type:Function},keepAdding:{type:Boolean},hasSpecialParts:{type:Boolean},config:{type:Object}},emits:["cancel","select-parent","category-tab-click","type-tab-click","select-part","confirm-add","update-keep-adding"],setup(n){const e=n,t=s.computed(()=>e.config?.categoryOrder||"common"),o=s.computed(()=>{const d=[];return t.value==="individual"?(d.push("individual","common"),e.hasSpecialParts&&d.push("special")):t.value==="special"?(e.hasSpecialParts&&d.push("special"),d.push("common","individual")):(d.push("common","individual"),e.hasSpecialParts&&d.push("special")),d}),r=s.ref(!1),i=s.ref(null);function a(d,u){i.value={type:d,part:u,isActiveParts:!1},r.value=!0}function l(){e.addSelectedType&&e.addSelectedPart&&(i.value={type:e.addSelectedType,part:e.addSelectedPart,isActiveParts:!0},r.value=!0)}function c(){r.value=!1,i.value=null}return(d,u)=>n.addTargetPath?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-add-panel",onClick:u[9]||(u[9]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",_C,[s.createElementVNode("div",OC,s.toDisplayString(d.$t("addPanel.title")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":d.$t("common.close"),onClick:u[0]||(u[0]=f=>d.$emit("cancel"))},[s.createVNode(s.unref(Xe),{size:18})],8,DC)]),n.canSelectParent?(s.openBlock(),s.createElementBlock("div",PC,[s.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:u[1]||(u[1]=f=>d.$emit("select-parent"))},[s.createVNode(s.unref(Yr),{size:16}),s.createElementVNode("span",null,s.toDisplayString(d.$t("addPanel.selectParent")),1)])])):s.createCommentVNode("",!0),s.createElementVNode("div",RC,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(o.value,f=>(s.openBlock(),s.createElementBlock("button",{key:f,class:s.normalizeClass([{active:n.addPartCategory===f&&n.addTypeTab!=="selected"},"zcode-category-tab"]),onClick:p=>d.$emit("category-tab-click",f)},s.toDisplayString(f==="common"?d.$t("addPanel.category.common"):f==="individual"?d.$t("addPanel.category.individual"):d.$t("dataViewer.special")),11,LC))),128)),s.createElementVNode("button",{class:s.normalizeClass([{active:n.addTypeTab==="selected"},"zcode-category-tab"]),onClick:u[2]||(u[2]=f=>d.$emit("type-tab-click","selected"))},s.toDisplayString(d.$t("addPanel.category.selected")),3)]),n.availablePartTypes.length>0&&n.addTypeTab!=="selected"?(s.openBlock(),s.createElementBlock("div",$C,[s.createElementVNode("button",{class:s.normalizeClass([{active:n.addTypeTab==="all"},"zcode-type-tab"]),onClick:u[3]||(u[3]=f=>d.$emit("type-tab-click","all"))}," all ",2),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(n.availablePartTypes,f=>(s.openBlock(),s.createElementBlock("button",{key:f,class:s.normalizeClass([{active:n.addTypeTab===f},"zcode-type-tab"]),onClick:p=>d.$emit("type-tab-click",f)},s.toDisplayString(f),11,VC))),128))])):s.createCommentVNode("",!0),s.createElementVNode("div",BC,[s.createElementVNode("div",FC,[s.withDirectives(s.createElementVNode("div",jC,[s.createElementVNode("div",HC,s.toDisplayString(d.$t("addPanel.activeParts")),1),s.createElementVNode("div",UC,s.toDisplayString(d.$t("addPanel.activePartsDescription")),1),n.clickedComponent&&n.addSelectedPart&&n.addSelectedType?(s.openBlock(),s.createElementBlock("div",WC,[s.createElementVNode("div",{class:s.normalizeClass([{active:!0},"zcode-module-preview"])},[s.createElementVNode("div",qC,[s.createElementVNode("div",GC,s.toDisplayString(d.$t("addPanel.activeParts")),1),s.createElementVNode("button",{type:"button",class:"zcode-module-preview-icon-btn","aria-label":d.$t("common.preview"),onClick:u[4]||(u[4]=s.withModifiers(f=>l(),["stop"]))},[s.createVNode(s.unref(kc),{size:14})],8,KC)]),s.createElementVNode("div",{class:"zcode-module-preview-content",innerHTML:n.getClickedComponentPreviewHtml()},null,8,JC)])])):(s.openBlock(),s.createElementBlock("div",XC,[s.createElementVNode("div",YC,s.toDisplayString(d.$t("addPanel.clickPartInPreview")),1)]))],512),[[s.vShow,n.addTypeTab==="selected"]]),s.withDirectives(s.createElementVNode("div",null,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(n.groupedPartsByType,f=>(s.openBlock(),s.createElementBlock("div",{key:f.type,class:"zcode-part-type-section"},[s.createElementVNode("div",QC,s.toDisplayString(f.type),1),f.description?(s.openBlock(),s.createElementBlock("div",ZC,s.toDisplayString(f.description),1)):s.createCommentVNode("",!0),s.createElementVNode("div",eN,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(f.parts,p=>(s.openBlock(),s.createElementBlock("div",{key:p.title,class:s.normalizeClass([{active:n.addTypeTab==="selected"&&n.clickedComponent?.part_id===p.id&&n.clickedComponent?.id?!0:n.addTypeTab!=="selected"&&n.addSelectedPart?.id===p.id},"zcode-module-preview"]),onClick:h=>d.$emit("select-part",f.typeData,p)},[s.createElementVNode("div",nN,[s.createElementVNode("div",oN,s.toDisplayString(p.title),1),s.createElementVNode("button",{type:"button",class:"zcode-module-preview-icon-btn","aria-label":d.$t("common.preview"),onClick:s.withModifiers(h=>a(f.typeData,p),["stop"])},[s.createVNode(s.unref(kc),{size:14})],8,rN)]),s.createElementVNode("div",{class:"zcode-module-preview-content",innerHTML:n.getPartPreviewHtml(f.typeData,p)},null,8,iN)],10,tN))),128))])]))),128)),n.groupedPartsByType.length===0&&!n.addSelectedPart?(s.openBlock(),s.createElementBlock("div",sN,[s.createElementVNode("div",aN,s.toDisplayString(d.$t("addPanel.noPartsAvailable")),1)])):s.createCommentVNode("",!0)],512),[[s.vShow,n.addTypeTab!=="selected"]])])]),n.addSelectedPart?(s.openBlock(),s.createElementBlock("div",lN,[s.createElementVNode("div",cN,[u[10]||(u[10]=s.createElementVNode("div",{class:"zcode-insert-position-title",role:"heading","aria-level":"4"}," 追加位置を選択 ",-1)),s.createElementVNode("label",dN,[s.createElementVNode("input",{type:"checkbox",checked:n.keepAdding,class:"zcode-keep-adding-checkbox",onChange:u[5]||(u[5]=f=>d.$emit("update-keep-adding",f.target.checked))},null,40,uN),s.createElementVNode("span",null,s.toDisplayString(d.$t("addPanel.continueAdding")),1)])]),s.createElementVNode("div",fN,[s.createElementVNode("button",{class:"zcode-insert-btn zcode-insert-before",onClick:u[6]||(u[6]=f=>d.$emit("confirm-add","before"))},s.toDisplayString(d.$t("addPanel.addBefore")),1),s.createElementVNode("button",{class:"zcode-insert-btn zcode-insert-after",onClick:u[7]||(u[7]=f=>d.$emit("confirm-add","after"))},s.toDisplayString(d.$t("addPanel.addAfter")),1)])])):s.createCommentVNode("",!0),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[r.value&&i.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-preview-modal",onClick:c},[s.createElementVNode("div",{class:"zcode-preview-modal-content",onClick:u[8]||(u[8]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",pN,[s.createElementVNode("div",hN,s.toDisplayString(d.$t("common.preview"))+": "+s.toDisplayString(i.value.isActiveParts?d.$t("addPanel.activeParts"):i.value.part.title),1),s.createElementVNode("button",{class:"zcode-close-btn",onClick:c},[s.createVNode(s.unref(Xe),{size:18})])]),s.createElementVNode("div",{class:"zcode-preview-modal-body",innerHTML:i.value.isActiveParts?n.getClickedComponentPreviewHtml():n.getPartPreviewHtml(i.value.type,i.value.part)},null,8,mN)])])):s.createCommentVNode("",!0)]))])):s.createCommentVNode("",!0)}}),yN=s.defineComponent({__name:"ContextMenu",props:{isVisible:{type:Boolean},position:{type:Object},currentMode:{type:String}},emits:["select-mode","close"],setup(n,{emit:e}){const t=e;function o(i){t("select-mode",i),t("close")}function r(){t("close")}return(i,a)=>n.isVisible?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-context-menu",style:s.normalizeStyle({left:`${n.position.x}px`,top:`${n.position.y}px`}),onClick:a[4]||(a[4]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("button",{class:s.normalizeClass(["zcode-context-menu-item",{active:n.currentMode==="edit"}]),onClick:a[0]||(a[0]=l=>o("edit"))},[s.createVNode(s.unref(gc),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("contextMenu.edit")),1)],2),s.createElementVNode("button",{class:s.normalizeClass(["zcode-context-menu-item",{active:n.currentMode==="add"}]),onClick:a[1]||(a[1]=l=>o("add"))},[s.createVNode(s.unref(co),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("contextMenu.add")),1)],2),s.createElementVNode("button",{class:s.normalizeClass(["zcode-context-menu-item",{active:n.currentMode==="reorder"}]),onClick:a[2]||(a[2]=l=>o("reorder"))},[s.createVNode(s.unref(Zo),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("contextMenu.reorder")),1)],2),s.createElementVNode("button",{class:s.normalizeClass(["zcode-context-menu-item",{active:n.currentMode==="delete"}]),onClick:a[3]||(a[3]=l=>o("delete"))},[s.createVNode(s.unref(Ln),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("contextMenu.delete")),1)],2),a[5]||(a[5]=s.createElementVNode("div",{class:"zcode-context-menu-divider"},null,-1)),s.createElementVNode("button",{class:"zcode-context-menu-item",onClick:r},[s.createVNode(s.unref(Xe),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("contextMenu.close")),1)])],4)):s.createCommentVNode("",!0)}});function bN(n){if(n.defaultValue!==void 0&&n.defaultValue!=="")switch(n.type){case"rich":return`<p>${n.defaultValue}</p>`;case"image":return n.defaultValue;default:return n.defaultValue}switch(n.type){case"text":case"textarea":return"";case"rich":return"<p></p>";case"radio":case"select":return n.options?.[0]||"";case"checkbox":case"select-multiple":return[];case"boolean":return!0;case"image":return"";default:return""}}function xN(n,e){const t=xa(n.part_id,e);if(!t)return;Hn(t.body).forEach(r=>{r.optional||n[r.fieldName]===void 0&&(n[r.fieldName]=bN(r))})}function kN(n){function e(t){xN(t,n.parts),t.slots&&Object.values(t.slots).forEach(o=>{(Array.isArray(o)?o:o?.children||[]).forEach(i=>{e(i)})})}n.page.forEach(t=>{e(t)})}function Bh(n){const e=s.reactive({page:[],css:{common:void 0,individual:void 0,special:void 0},parts:{common:[],individual:[],special:[]},images:{common:[],individual:[],special:[]},backendData:void 0});function t(){try{const i=n.page?JSON.parse(n.page):[],a=n.partsCommon?JSON.parse(n.partsCommon):[],l=n.partsIndividual?JSON.parse(n.partsIndividual):[],c=n.partsSpecial?JSON.parse(n.partsSpecial):[],d=n.imagesCommon?JSON.parse(n.imagesCommon):[],u=n.imagesIndividual?JSON.parse(n.imagesIndividual):[],f=n.imagesSpecial?JSON.parse(n.imagesSpecial):[],p=n.cssCommon!==void 0?n.cssCommon:void 0,h=n.cssIndividual!==void 0?n.cssIndividual:void 0,m=n.cssSpecial!==void 0?n.cssSpecial:void 0,g=n.backendData?JSON.parse(n.backendData):void 0;Object.assign(e,{page:i,css:{common:p,individual:h,special:m},parts:{common:a,individual:l,special:c},images:{common:d,individual:u,special:f},backendData:g}),kN(e)}catch(i){console.error("Failed to parse props:",i)}}function o(i){if(!i)return e;const a=i.split(".");let l=e;for(const c of a)if(l==null||typeof l!="object"||(l=l[c],l===void 0))return;return l}function r(i,a){if(typeof i=="string"){const l=i.split(".");let c=e;for(let d=0;d<l.length-1;d++){const u=c[l[d]];if(u==null||typeof u!="object")return;c=u}c[l[l.length-1]]=a}else Object.assign(e,i)}return{cmsData:e,loadDataFromProps:t,getData:o,setData:r}}function EN(){const n=s.ref("edit"),e=s.ref(!1);function t(o){n.value=o}return{currentMode:n,switchMode:t,allowDynamicContentInteraction:e}}function Fh(n,e){return Hn(n.body).map(o=>{const r={fieldName:o.fieldName,groupName:o.groupName,label:Yy(o.fieldName),required:o.required,maxLength:o.maxLength,readonly:o.readonly,disabled:o.disabled},i=e[o.fieldName];if(o.type==="text")return{...r,type:"text",defaultValue:o.defaultValue,optional:o.optional,currentValue:i!==void 0?i:o.optional?void 0:o.defaultValue};if(o.type==="textarea")return{...r,type:"textarea",defaultValue:o.defaultValue,optional:o.optional,currentValue:i!==void 0?i:o.optional?void 0:o.defaultValue||""};if(o.type==="rich")return{...r,type:"rich",defaultValue:o.defaultValue,optional:o.optional,currentValue:i!==void 0?i:o.optional?void 0:o.defaultValue||""};if(o.type==="radio")return{...r,type:"radio",options:o.options,optional:o.optional,currentValue:i!==void 0?i:o.optional?void 0:o.options?.[0]};if(o.type==="boolean")return{...r,type:"boolean",defaultValue:o.defaultValue,optional:o.optional,currentValue:i!==void 0?i:!0};if(o.type==="image")return{...r,type:"image",defaultValue:o.defaultValue,optional:o.optional,currentValue:i!==void 0?i:o.optional?void 0:o.defaultValue||""};if(o.type==="select")return{...r,type:"select",options:o.options,optional:o.optional,currentValue:i!==void 0?i:o.optional?void 0:o.options?.[0]};if(o.type==="select-multiple")return{...r,type:"select-multiple",options:o.options,optional:o.optional,currentValue:Array.isArray(i)?i:[]};if(o.type==="tag"){const a=["h1","h2","h3","h4","h5","h6","div","p","span","li","ul","ol","section","article","aside","nav","header","footer","main","figure","figcaption","blockquote","pre","code","table","thead","tbody","tr","th","td"],l=o.options||a;return{...r,type:"tag",options:l,defaultValue:o.defaultValue||"div",currentValue:i!==void 0?i:o.defaultValue||"div"}}return{...r,type:"checkbox",options:o.options,optional:o.optional,currentValue:Array.isArray(i)?i:[]}})}function jh(n){const e=document.documentElement,o={edit:"--zcode-color-edit",add:"--zcode-color-add",reorder:"--zcode-color-reorder",delete:"--zcode-color-delete"}[n]||"--zcode-color-edit";return getComputedStyle(e).getPropertyValue(o).trim()||"#3b82f6"}function Kt(n,e){const t=jh(e);n.classList.remove("zcode-outline-active-edit","zcode-outline-active-add","zcode-outline-active-reorder","zcode-outline-active-delete"),n.classList.add(`zcode-outline-active-${e}`),n.style.outlineColor=t,n.style.outlineStyle="solid"}function Jt(n){n.style.outline="",n.style.outlineOffset="",n.classList.remove("zcode-outline-active-edit","zcode-outline-active-add","zcode-outline-active-reorder","zcode-outline-active-delete")}function rc(n,e){const t=jh(e);n.style.outline=`2px dashed ${t}`,n.style.outlineOffset="2px"}function mn(n){n.style.outline="",n.style.outlineOffset=""}function wN(n,e){const t=s.ref(null),o=s.ref(-1),r=s.ref(""),i=s.ref([]);function a(u){const f=u.part_id,p=n.parts,h=[...p.common,...p.individual];let m=null;for(const g of h){const y=g.parts.find(b=>b.id===f);if(y){m=y;break}}return m?Fh(m,u):[]}function l(u,f){if(r.value===u){d();return}const p=u.split(".");let h=-1;if(p[0]==="page"&&p.length>=2&&(h=parseInt(p[1])),r.value&&e.value){const m=e.value.querySelector(`[data-zcode-path="${r.value}"]`);m&&Jt(m)}t.value=f,o.value=h,r.value=u,i.value=a(f),s.nextTick(()=>{if(e.value&&r.value===u){const m=e.value.querySelector(`[data-zcode-path="${u}"]`);m&&(Kt(m,"edit"),rr(m))}})}function c(u){if(t.value&&r.value){const f=dn(r.value,n);f&&(u.optional&&(u.currentValue===""||u.currentValue===null)?f[u.fieldName]=void 0:f[u.fieldName]=u.currentValue)}}function d(){if(r.value&&e.value){const u=e.value.querySelector(`[data-zcode-path="${r.value}"]`);u&&Jt(u)}t.value=null,r.value="",i.value=[]}return{editingComponent:t,editingComponentIndex:o,editingComponentPath:r,editingAvailableFields:i,handleEditClick:l,saveFieldEdit:c,closeEditPanel:d}}function SN(n,e,t,o){const r=s.ref(null),i=s.ref(null),a=s.ref(null),l=s.ref(o?.categoryOrder==="individual"?"individual":o?.categoryOrder==="special"?"special":"common"),c=s.ref("all"),d=s.ref(null),u=s.ref(!1);function f(O){if(O.includes(".slots.")){const D=O.split(".");let P=-1;for(let q=D.length-1;q>=0;q--)if(D[q]==="slots"){P=q;break}if(P!==-1&&P+1<D.length)return D.slice(0,P+2).join(".")}return O}const p=s.computed(()=>{const O=n.parts,D=l.value==="common"?O.common:l.value==="individual"?O.individual:O.special;if(r.value&&r.value.includes(".slots.")){const q=[...O.common,...O.individual,...O.special],W=f(r.value);return g(W,q,D)}return[...new Set(D.map(q=>q.type))]});function h(O,D){const P=O.split(".");let q=-1;for(let Z=P.length-1;Z>=0;Z--)if(P[Z]==="slots"){q=Z;break}if(q===-1)return null;const W=P.slice(0,q).join("."),R=P[q+1],K=dn(W,n);if(!K)return null;const X=K.part_id;let te=null;for(const Z of D)if(Z.parts.some(Y=>Y.id===X)){te=Z;break}if(!te)return null;const G=(te.parts.find(Z=>Z.id===X)||te.parts[0])?.slots?.[R];if(G){const Z=G.allowedParts;if(Z&&Array.isArray(Z))return Z}return null}const m=s.computed(()=>{const O=n.parts,D=l.value==="common"?O.common:l.value==="individual"?O.individual:O.special,P=p.value;let q=D.filter(X=>P.includes(X.type));c.value&&c.value!=="all"&&c.value!=="selected"&&(q=q.filter(X=>X.type===c.value));const W=[...O.common,...O.individual],R=r.value&&r.value.includes(".slots.")?h(f(r.value),W):null,K=new Map;return q.forEach(X=>{K.has(X.type)||K.set(X.type,{type:X,parts:[]});const te=K.get(X.type);R!==null?R.length>0&&X.parts.forEach(oe=>{R.includes(oe.id)&&te.parts.push(oe)}):X.parts.forEach(oe=>{oe.slotOnly||te.parts.push(oe)})}),Array.from(K.values()).map(X=>({type:X.type.type,description:X.type.description,typeData:X.type,parts:X.parts}))});function g(O,D,P){const q=O.split(".");let W=-1;for(let Y=q.length-1;Y>=0;Y--)if(q[Y]==="slots"){W=Y;break}if(W===-1)return[...new Set(P.map(Y=>Y.type))];const R=q.slice(0,W).join("."),K=q[W+1],X=dn(R,n);if(!X)return[...new Set(P.map(Y=>Y.type))];const te=X.part_id;let oe=null,G=null;for(const Y of D){const ee=Y.parts.find(le=>le.id===te);if(ee){oe=Y,G=ee;break}}if(!oe||!G)return[...new Set(P.map(Y=>Y.type))];const Z=G?.slots?.[K];if(Z){const Y=Z.allowedParts;if(Y&&Array.isArray(Y)){const ee=new Set;D.forEach(ge=>{ge.parts.forEach(Ne=>{Y.includes(Ne.id)&&ee.add(ge.type)})});let le=Array.from(ee);return le=le.filter(ge=>P.some(Ne=>Ne.type===ge)),le}}return[...new Set(P.map(Y=>Y.type))]}function y(O,D=!1){if(r.value===O){B();return}if(r.value&&e.value){const le=e.value.querySelector(`[data-zcode-path="${r.value}"]`);le&&Jt(le);const ge=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);ge&&Jt(ge)}r.value=O,c.value="all",l.value="common",i.value=null,a.value=null;const P=dn(O,n);P&&P.part_id?d.value=P:d.value=null;const q=n.parts,W=q.common,R=q.individual,K=q.special;let X=[],te=[];if(O.includes(".slots.")){const le=[...W,...R,...K],ge=f(O);X=g(ge,le,W),te=g(ge,le,R)}else X=[...new Set(W.map(le=>le.type))],te=[...new Set(R.map(le=>le.type))];const oe=X.length>0,G=te.length>0,Z=K.length>0,Y=o?.categoryOrder;let ee;Y==="special"&&Z?ee="special":Y==="individual"&&G?ee="individual":Y==="common"&&oe||oe?ee="common":G?ee="individual":Z?ee="special":ee="common",l.value=ee,s.nextTick(()=>{if(e.value&&r.value===O){const le=e.value.querySelector(`[data-zcode-path="${O}"]`);if(le)Kt(le,"add"),rr(le);else{const ge=f(O);if(ge!==O){const Ne=e.value.querySelector(`[data-zcode-slot-path="${ge}"]`);Ne&&(Kt(Ne,"add"),rr(Ne))}}}})}function b(O){l.value=O,c.value="all",i.value=null,a.value=null,u.value=!1}function z(O){if(c.value=O,O==="selected"&&d.value&&d.value.part_id){const D=n.parts,P=[...D.common,...D.individual,...D.special];for(const q of P){const W=q.parts.find(R=>R.id===d.value.part_id);if(W){i.value=q,a.value=W;break}}}else O!=="selected"&&(i.value=null,a.value=null);u.value=!1}function w(O,D){const P=A(O,D);return t(P,"")}function T(){return d.value?t(d.value,""):""}function A(O,D){const P=k(O,!1,new Set,D.id);return P.id="preview",P}function M(O,D){if(a.value?.id===D.id){i.value=null,a.value=null;return}i.value=O,a.value=D,c.value==="selected"&&(c.value="all"),u.value=!1}function k(O,D=!1,P=new Set,q){const W=q?O.parts.find(G=>G.id===q)||O.parts[0]:D&&a.value?a.value:O.parts[0];if(!W)throw new Error(`Part not found for type: ${O.type}`);const R=`${O.id}:${W.id}`;if(P.has(R)){const G=Hn(W.body),Z={};return G.forEach(Y=>{Y.optional?Z[Y.fieldName]=void 0:Y.type==="text"?Z[Y.fieldName]=Y.defaultValue:Y.type==="radio"?Z[Y.fieldName]=Y.options?.[0]:Y.type==="checkbox"?Z[Y.fieldName]=[]:Y.type==="boolean"?Z[Y.fieldName]=!0:Y.type==="rich"?Z[Y.fieldName]=Y.defaultValue?`<p>${Y.defaultValue}</p>`:"<p></p>":Y.type==="image"&&(Z[Y.fieldName]=Y.defaultValue||"")}),{id:Un(),part_id:W.id,...Z}}P.add(R);const K=Hn(W.body),X={};K.forEach(G=>{G.optional?X[G.fieldName]=void 0:G.type==="text"?X[G.fieldName]=G.defaultValue:G.type==="radio"?X[G.fieldName]=G.options?.[0]:G.type==="checkbox"?X[G.fieldName]=[]:G.type==="boolean"?X[G.fieldName]=!0:G.type==="rich"?X[G.fieldName]=G.defaultValue?`<p>${G.defaultValue}</p>`:"<p></p>":G.type==="image"&&(X[G.fieldName]=G.defaultValue||"")});const te={id:Un(),part_id:W.id,...X},oe=W.slots;if(oe){const G={};Object.entries(oe).forEach(([Z,Y])=>{const ee=Y.allowedParts;if(ee&&ee.length===1){const le=ee[0],ge=n.parts,Ne=[...ge.common,...ge.individual,...ge.special];let Re=null,C=null;for(const L of Ne){const V=L.parts.find(S=>S.id===le);if(V){Re=L,C=V;break}}if(Re&&C){const L=k(Re,!1,P,C.id);G[Z]=[L]}else G[Z]=[]}else G[Z]=[]}),Object.keys(G).length>0&&(te.slots=G)}return te}function E(O){return k(O,!0)}function x(O){if(!i.value||!a.value||!r.value){console.error("Missing required values:",{addSelectedType:i.value,addSelectedPart:a.value,addTargetPath:r.value});return}let D;if(c.value==="selected"&&d.value){if(D=JSON.parse(JSON.stringify(d.value)),D.id=Un(),D.slots){const W=R=>{R.forEach(K=>{K.id=Un(),K.slots&&Object.values(K.slots).forEach(X=>{Array.isArray(X)?W(X):X&&typeof X=="object"&&X.children&&W(X.children||[])})})};Object.values(D.slots).forEach(R=>{Array.isArray(R)?W(R):R&&typeof R=="object"&&R.children&&W(R.children||[])})}}else D=E(i.value);const P=r.value,q=P.split(".");if(q[0]==="page"&&q.length===2){const W=parseInt(q[1]);O==="before"?(n.page.splice(W,0,D),u.value&&(r.value=`page.${W+1}`)):n.page.splice(W+1,0,D)}else if(q.includes("slots")){const W=f(P),R=W.split(".");let K=-1;for(let ee=R.length-1;ee>=0;ee--)if(R[ee]==="slots"){K=ee;break}if(K===-1||K>=R.length-1){console.error("Invalid slot path:",W);return}const X=R.slice(0,K).join("."),te=R[K+1],oe=P!==W?parseInt(q[q.length-1]):-1,G=dn(X,n);if(!G){console.error("Parent component not found:",X);return}G.slots||(G.slots={});const Z=G.slots[te];let Y=[];if(Array.isArray(Z)?Y=Z:Z&&typeof Z=="object"&&Z.children?(Y=Z.children||[],Z.children||(Z.children=[])):(G.slots[te]=[],Y=G.slots[te]),oe===-1)Y.push(D);else if(O==="before"){if(Y.splice(oe,0,D),u.value){const ee=f(P);if(P!==ee){const le=[...q];le[le.length-1]=String(oe+1),r.value=le.join(".")}else{const ge=[...ee.split(".")];ge.push("0"),r.value=ge.join(".")}}}else Y.splice(oe+1,0,D);Array.isArray(G.slots[te])||(G.slots[te].children=Y)}if(d.value||c.value==="selected"&&(c.value="all"),!u.value)B();else if(O==="before"&&e.value&&r.value){const W=e.value.querySelector(`[data-zcode-path="${P}"]`);W&&Jt(W),s.nextTick(()=>{if(e.value&&r.value){const R=e.value.querySelector(`[data-zcode-path="${r.value}"]`);R&&Kt(R,"add")}})}}function B(){if(r.value&&e.value){const O=e.value.querySelector(`[data-zcode-path="${r.value}"]`);O&&Jt(O);const D=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);D&&Jt(D)}r.value=null,i.value=null,a.value=null,d.value=null,l.value="common",c.value="all",u.value=!1}const $=s.computed(()=>n.parts.special.length>0);return{addTargetPath:r,addSelectedType:i,addSelectedPart:a,clickedComponent:d,addPartCategory:l,addTypeTab:c,keepAdding:u,availablePartTypes:p,groupedPartsByType:m,hasSpecialParts:$,handleAddClick:y,handleCategoryTabClick:b,handleTypeTabClick:z,selectPart:M,getPartPreviewHtml:w,getClickedComponentPreviewHtml:T,confirmAddPart:x,cancelAdd:B}}function CN(n,e,t,o){const r=s.ref(null),i=s.ref("");function a(f,p){if(i.value===f){u();return}if(i.value&&e.value){const h=e.value.querySelector(`[data-zcode-path="${i.value}"]`);h&&Jt(h)}r.value=p,i.value=f,o(()=>{if(e.value&&i.value===f){const h=e.value.querySelector(`[data-zcode-path="${f}"]`);h&&(Kt(h,"delete"),rr(h))}})}function l(){if(!i.value)return;const f=i.value,p=f.split(".");let h=null,m=null;if(p.length===2&&p[0]==="page"){const g=parseInt(p[1]);!isNaN(g)&&g>=0&&g<n.page.length&&(n.page.splice(g,1),n.page.length===0&&o(()=>{t("add")}))}else if(p.length>2&&p[0]==="page"){const g=parseInt(p[1]);if(isNaN(g)||g<0||g>=n.page.length){console.error("Invalid top-level index:",g),u();return}let y=n.page[g];const b=p.slice(2);b.length>=3&&b[0]==="slots"&&(m=b[1],h=`page.${g}`);for(let w=0;w<b.length-1;w++){if(!y||typeof y!="object"){console.error("Invalid path:",f),u();return}y=y[b[w]]}const z=b[b.length-1];if(y&&typeof y=="object")if(Array.isArray(y)){const w=parseInt(z);!isNaN(w)&&w>=0&&w<y.length?y.splice(w,1):console.error("Invalid array index:",z)}else z in y?delete y[z]:console.error("Field not found:",f);else console.error("Invalid current object:",f)}h&&m&&o(()=>{c(h,m)}),u()}function c(f,p){const h=dn(f,n);if(!h)return;const m=h.slots;if(!m||!Array.isArray(m[p]))return;const g=m[p];if(g.length===0){const y=h.part_id,b=n.parts,z=[...b.common,...b.individual];let w=null,T=null;for(const M of z){const k=M.parts.find(E=>E.id===y);if(k){w=M,T=k;break}}if(!w||!T)return;const A=T?.slots?.[p];if(A){const M=A.allowedParts;if(M&&M.length===1){const k=M[0];let E=null,x=null;for(const B of z){const $=B.parts.find(O=>O.id===k);if($){E=B,x=$;break}}if(E&&x){const B=d(E,x.id);g.push(B)}}}}}function d(f,p){const h=p&&f.parts.find(z=>z.id===p)||f.parts[0];if(!h)throw new Error(`Part not found for type: ${f.type}`);const m=Hn(h.body),g={};m.forEach(z=>{z.optional?g[z.fieldName]=void 0:z.type==="text"?g[z.fieldName]=z.defaultValue:z.type==="radio"?g[z.fieldName]=z.options?.[0]:z.type==="checkbox"?g[z.fieldName]=[]:z.type==="boolean"?g[z.fieldName]=!0:z.type==="rich"?g[z.fieldName]=z.defaultValue?`<p>${z.defaultValue}</p>`:"<p></p>":z.type==="image"&&(g[z.fieldName]=z.defaultValue||"")});const y={id:Un(),part_id:h.id,...g},b=h.slots;if(b){const z={};Object.entries(b).forEach(([w,T])=>{const A=T.allowedParts;if(A&&A.length===1){const M=A[0],k=n.parts,E=[...k.common,...k.individual];let x=null,B=null;for(const $ of E){const O=$.parts.find(D=>D.id===M);if(O){x=$,B=O;break}}if(x&&B){const $=d(x,B.id);z[w]=[$]}else z[w]=[]}else z[w]=[]}),Object.keys(z).length>0&&(y.slots=z)}return y}function u(){if(i.value&&e.value){const f=e.value.querySelector(`[data-zcode-path="${i.value}"]`);f&&Jt(f)}r.value=null,i.value=""}return{deleteConfirmComponent:r,deleteConfirmPath:i,handleDeleteClick:a,confirmDelete:l,cancelDelete:u}}function NN(n,e){const t=s.ref("");function o(l,c){if(!l||!c)return!1;const d=l.split("."),u=c.split(".");if(d.length!==u.length||l===c)return!1;if(d.includes("slots")&&u.includes("slots")){let f=-1,p=-1;for(let b=d.length-1;b>=0;b--)if(d[b]==="slots"){f=b;break}for(let b=u.length-1;b>=0;b--)if(u[b]==="slots"){p=b;break}if(f===-1||p===-1)return!1;const h=d.slice(0,f).join("."),m=u.slice(0,p).join(".");if(h!==m)return!1;const g=d[f+1],y=u[p+1];return g===y}if(d.length>2){const f=d.slice(0,-1).join("."),p=u.slice(0,-1).join(".");if(f!==p)return!1}return!0}function r(l){if(!l)return;if(!t.value){const d=Wd(l);if(d&&e.value){const u=e.value.querySelector(`[data-zcode-path="${d}"]`);u&&mn(u)}if(t.value=l,e.value){const u=e.value.querySelector(`[data-zcode-path="${l}"]`);u&&(Kt(u,"reorder"),rr(u))}return}if(t.value===l){i();return}if(!o(t.value,l)){alert("この要素とは並べ替えできません。同じ階層の要素を選択してください。"),i();return}a(t.value,l)||alert("並べ替えに失敗しました。同じ階層の要素を選択してください。"),i()}function i(){if(t.value&&e.value){const l=e.value.querySelector(`[data-zcode-path="${t.value}"]`);l&&Jt(l)}t.value=""}function a(l,c){const d=l.split("."),u=c.split(".");if(d.length===2&&u.length===2&&d[0]==="page"&&u[0]==="page"){const f=parseInt(d[1]),p=parseInt(u[1]);if(!isNaN(f)&&!isNaN(p)&&f!==p){const h=[...n.page],[m]=h.splice(f,1);return h.splice(p,0,m),n.page=h,!0}return!1}else if(d.includes("slots")&&u.includes("slots")){let f=-1,p=-1;for(let k=d.length-1;k>=0;k--)if(d[k]==="slots"){f=k;break}for(let k=u.length-1;k>=0;k--)if(u[k]==="slots"){p=k;break}if(f===-1||p===-1)return!1;const h=d.slice(0,f).join("."),m=u.slice(0,p).join(".");if(h!==m)return!1;const g=d[f+1],y=u[p+1];if(g!==y)return!1;const b=parseInt(d[d.length-1]),z=parseInt(u[u.length-1]);if(isNaN(b)||isNaN(z)||b===z)return!1;const w=dn(h,n);if(!w||!w.slots||!w.slots[g])return!1;const T=w.slots[g];let A=[];if(Array.isArray(T))A=T;else if(T&&typeof T=="object"&&T.children)A=T.children||[];else return!1;const[M]=A.splice(b,1);return A.splice(z,0,M),!Array.isArray(T)&&typeof T=="object"&&T.children&&(T.children=A),!0}else if(d.length>2&&u.length>2){const f=d.slice(0,-1).join("."),p=u.slice(0,-1).join(".");if(f===p){const h=parseInt(d[d.length-1]),m=parseInt(u[u.length-1]);if(!isNaN(h)&&!isNaN(m)&&h!==m){const g=parseInt(d[1]);let y=n.page[g];for(let b=2;b<d.length-1;b++)y=y[d[b]];if(Array.isArray(y)){const[b]=y.splice(h,1);return y.splice(m,0,b),!0}}}}return!1}return{reorderSourcePath:t,handleReorderClick:r,canReorderWith:o,cancelReorder:i}}function vN(n,e,t,o,r,i,a,l,c){const d=s.computed(()=>o.value?Wd(o.value):null),u=s.computed(()=>{if(!d.value)return!1;const p=dn(d.value,n);return p!=null});function f(){if(!d.value)return;const p=d.value;if(!e.value||!e.value.querySelector(`[data-zcode-path="${p}"]`))return;const m=dn(p,n);if(m){if(o.value&&e.value){const g=e.value.querySelector(`[data-zcode-path="${o.value}"]`);g&&mn(g)}switch(t.value){case"edit":r(p,m);break;case"add":i(p,!0);break;case"reorder":if(c.value){const g=e.value.querySelector(`[data-zcode-path="${c.value}"]`);g&&Jt(g),c.value=""}a(p);break;case"delete":l(p,m);break}}}return{parentPath:d,canSelectParent:u,selectParentElement:f}}function TN(n,e,t,o,r,i,a,l,c,d,u,f,p,h){const m=new Map;function g(){if(!e.value)return;y();const b=e.value.querySelectorAll("[data-zcode-id]"),z=k=>{const E=k.target;if(!E)return;const x=E.closest("[data-zcode-add-slot]");if(!x)return;const B=x.closest("[data-zcode-slot-path]"),$=B?.getAttribute("data-zcode-slot-path");if(!$)return;k.preventDefault(),k.stopPropagation(),k.stopImmediatePropagation();const O=()=>{const D=e.value?.querySelector(`[data-zcode-slot-path="${$}"]`);D&&(mn(D),Kt(D,"add"))};if(B&&mn(B),t.value!=="add"){p("add"),s.nextTick(()=>{c($),s.nextTick(()=>{O()})});return}O(),s.nextTick(()=>{c($),s.nextTick(()=>{O()})})};let w=null;const T=k=>o.value===k||r.value===k||i.value===k||a.value===k,A=k=>{const x=k.target;if(!x)return;const B=x.closest("[data-zcode-slot-path]");if(!B){if(w){const O=w.getAttribute("data-zcode-slot-path")||"";(!O||!T(O))&&mn(w),w=null}return}if(w===B)return;if(w){const O=w.getAttribute("data-zcode-slot-path")||"";(!O||!T(O))&&mn(w)}w=B;const $=B.getAttribute("data-zcode-slot-path")||"";$&&!T($)&&rc(B,t.value)},M=k=>{const E=k,x=E.target;if(!x)return;const B=E.relatedTarget,$=x.closest("[data-zcode-slot-path]");if(!$||B&&$.contains(B))return;const O=$.getAttribute("data-zcode-slot-path")||"";(!O||!T(O))&&mn($),w===$&&(w=null)};e.value.addEventListener("click",z,!0),e.value.addEventListener("mouseover",A,!0),e.value.addEventListener("mouseout",M,!0),m.set(e.value,[{type:"click",listener:z,options:!0},{type:"mouseover",listener:A,options:!0},{type:"mouseout",listener:M,options:!0}]),b.forEach(k=>{const E=k,x=E.getAttribute("data-zcode-path");if(!x)return;const B=P=>{const q=P.target,R=q?.closest("[data-zcode-path]")?.getAttribute("data-zcode-path");if(R&&R!==x)return;q?.closest("a[href]")&&(h.value||P.preventDefault()),h.value||(P.stopPropagation(),P.stopImmediatePropagation());const X=dn(x,n);if(X)switch(mn(E),t.value){case"edit":l(x,X);break;case"add":c(x);break;case"reorder":if(i.value){const te=i.value.split("."),oe=x.split(".");if(te.length!==oe.length&&te.indexOf("rows")!==-1){const Z=oe.indexOf("cells");if(Z!==-1){let Y=-1;for(let ee=Z-1;ee>=0;ee--)if(oe[ee]==="slots"){Y=ee;break}if(Y!==-1){const ee=oe.slice(0,Y).join(".");if(ee&&f(i.value,ee)){d(ee);return}}}}}d(x);break;case"delete":u(x,X);break}},$=P=>{if(o.value===P||r.value===P||i.value===P||a.value===P)return!0;if(P.includes(".slots.")){const W=P.split(".");let R=-1;for(let K=W.length-1;K>=0;K--)if(W[K]==="slots"){R=K;break}if(R!==-1&&R+1<W.length){const K=W.slice(0,R+2).join(".");return r.value===K||o.value===K||i.value===K||a.value===K}}return!1},O=()=>{$(x)||(t.value==="reorder"&&i.value?f(i.value,x)&&rc(E,t.value):rc(E,t.value)),t.value==="reorder"?E.style.cursor=i.value&&f(i.value,x)?"move":i.value?"not-allowed":"move":E.style.cursor="pointer"},D=()=>{$(x)||mn(E),E.style.cursor=""};E.addEventListener("click",B,!0),E.addEventListener("mouseenter",O),E.addEventListener("mouseleave",D),m.set(E,[{type:"click",listener:B,options:!0},{type:"mouseenter",listener:O},{type:"mouseleave",listener:D}])}),s.nextTick(()=>{s.nextTick(()=>{if(t.value==="edit"&&o.value&&e.value){const k=e.value.querySelector(`[data-zcode-path="${o.value}"]`);k&&Kt(k,"edit")}if(t.value==="add"&&r.value&&e.value){const k=e.value.querySelector(`[data-zcode-path="${r.value}"]`);if(k)Kt(k,"add");else{const E=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);E&&Kt(E,"add")}}if(t.value==="reorder"&&i.value&&e.value){const k=e.value.querySelector(`[data-zcode-path="${i.value}"]`);k&&Kt(k,"reorder")}if(t.value==="delete"&&a.value&&e.value){const k=e.value.querySelector(`[data-zcode-path="${a.value}"]`);k&&Kt(k,"delete")}})})}function y(){m.forEach((b,z)=>{b.forEach(({type:w,listener:T,options:A})=>{z.removeEventListener(w,T,A)})}),m.clear()}return{setupClickHandlers:g,cleanupEventListeners:y}}function zN(n,e,t,o,r,i,a,l,c,d,u,f,p){function h(m){n.value&&n.value.querySelectorAll("[data-zcode-path], [data-zcode-slot-path]").forEach(y=>{Jt(y),mn(y)}),e.value==="edit"&&o.value?(l.value=null,o.value=""):e.value==="add"&&r.value?(r.value=null,c.value=null,d.value=null,u.value="common",f.value=null):e.value==="reorder"&&i.value?i.value="":e.value==="delete"&&a.value&&p(),t(m)}return{switchMode:h}}function MN(n,e,t){const o=s.ref(!1),r=s.ref({x:0,y:0});function i(p){!e.value||!n.value||!p.target.closest("[data-zcode-path]")||(p.preventDefault(),p.stopPropagation(),r.value={x:p.clientX,y:p.clientY},o.value=!0)}function a(p){t(p),o.value=!1}function l(){o.value=!1}function c(p){p.target.closest(".zcode-context-menu")||l()}function d(p){p.target.closest(".zcode-context-menu")||l()}function u(){!n.value||!e.value||(n.value.addEventListener("contextmenu",i),document.addEventListener("click",c),document.addEventListener("contextmenu",d))}function f(){n.value&&(n.value.removeEventListener("contextmenu",i),document.removeEventListener("click",c),document.removeEventListener("contextmenu",d))}return{isVisible:o,position:r,handleModeSelect:a,closeMenu:l,setupContextMenu:u,cleanupContextMenu:f}}function AN(n){const e=n;if(!e||!e.page||!Array.isArray(e.page))return!1;for(const t of e.page)if(!t.id||!t.part_id)return!1;return!0}function ic(n,e){const t=[],o=(r,i)=>{Object.keys(r).forEach(a=>{a.includes("image")&&r[a]===n&&t.push({path:i,component:r,fieldName:a})}),r.slots&&Object.entries(r.slots).forEach(([a,l])=>{Array.isArray(l)&&l.forEach((c,d)=>{o(c,`${i}.slots.${a}.${d}`)})})};return e.forEach((r,i)=>{o(r,`page.${i}`)}),t}const IN={key:0,class:"zcode-save-banner zcode-save-banner--error",role:"alert"},_N={class:"zcode-save-banner-text"},ON=["aria-label"],DN={key:1,class:"zcode-save-controls-fixed"},PN={class:"zcode-save-confirm-dialog"},RN={class:"zcode-save-confirm-dialog-header"},LN={class:"zcode-save-confirm-dialog-title"},$N={class:"zcode-save-confirm-dialog-body"},VN={class:"zcode-save-confirm-dialog-footer"},_s=s.defineComponent({__name:"ZeroCodeCMS",props:{locale:{type:String},page:{type:String},cssCommon:{type:String},cssIndividual:{type:String},cssSpecial:{type:String},partsCommon:{type:String},partsIndividual:{type:String},partsSpecial:{type:String},imagesCommon:{type:String},imagesIndividual:{type:String},imagesSpecial:{type:String},config:{type:String},endpoints:{type:String},backendData:{type:String}},setup(n,{expose:e}){const{t}=Vt(),o=n,r=s.ref("manage"),i=s.ref(!1),l=(ce=>{if(!ce)return{};try{return JSON.parse(ce)}catch(ue){return console.warn("[ZeroCodeCMS] Failed to parse config:",ue),{}}})(o.config),c=(ce,ue,xe)=>{const We=Kd();return We[ce]!==void 0?We[ce]:xe!==void 0?xe:ue},d=s.ref(c("devRightPadding",!1,l.cms?.devRightPadding)),u=s.ref(c("enableContextMenu",!1,l.cms?.enableContextMenu)),f=s.ref(c("showSaveConfirm",!0,l.cms?.showSaveConfirm)),p=s.computed(()=>d.value),h=s.ref(!1),{cmsData:m,loadDataFromProps:g,getData:y,setData:b}=Bh(o),{fullPageHtml:z,renderComponentToHtml:w}=pi(m,!0);function T(ce){if(ce!=="css")return ce?y(ce):y()}const A=s.ref(null),M=s.ref(null),k=s.computed(()=>M.value?.previewArea||null),{currentMode:E,switchMode:x,allowDynamicContentInteraction:B}=EN(),$=c("allowDynamicContentInteraction",!1,l.cms?.allowDynamicContentInteraction),O=s.ref($);B.value=$;let D=!1;s.watch(r,(ce,ue)=>{ce==="preview"?(D=O.value,O.value=!0,B.value=!0,s.nextTick(()=>{H()})):ue==="preview"&&(O.value=D,B.value=D,s.nextTick(()=>{H()})),Dn("view-mode-changed",{mode:ce,previousMode:ue})});const{editingComponent:P,editingComponentPath:q,editingAvailableFields:W,handleEditClick:R,saveFieldEdit:K,closeEditPanel:X}=wN(m,k),te=s.ref({}),oe=s.ref([]),G=s.ref({visible:!1,message:""});function Z(ce){if(ce?.fieldName&&te.value[ce.fieldName]){const ue={...te.value};delete ue[ce.fieldName],te.value=ue}K(ce)}const{addTargetPath:Y,addSelectedType:ee,addSelectedPart:le,clickedComponent:ge,addPartCategory:Ne,addTypeTab:Re,keepAdding:C,availablePartTypes:L,groupedPartsByType:V,hasSpecialParts:S,handleAddClick:N,handleCategoryTabClick:F,handleTypeTabClick:ne,selectPart:me,getPartPreviewHtml:De,getClickedComponentPreviewHtml:Te,confirmAddPart:v,cancelAdd:I}=SN(m,k,w,l),{reorderSourcePath:J,handleReorderClick:he,canReorderWith:Ae,cancelReorder:ye}=NN(m,k),{deleteConfirmComponent:U,deleteConfirmPath:Q,handleDeleteClick:ve,confirmDelete:Le,cancelDelete:dt}=CN(m,k,x,s.nextTick),{switchMode:Tt}=zN(k,E,x,q,Y,J,Q,P,ee,le,Ne,Re,dt),Lt=s.computed(()=>E.value==="edit"&&q.value?q.value:E.value==="add"&&Y.value?Y.value:E.value==="reorder"&&J.value?J.value:E.value==="delete"&&Q.value?Q.value:null),{canSelectParent:$t,selectParentElement:Xt}=vN(m,k,E,Lt,R,N,he,ve,J),j=s.computed(()=>!!(P.value||Y.value||J.value||U.value)),H=()=>{if(k.value){const ce=k.value.getRootNode();if(ce instanceof ShadowRoot){let We=0;const Ze=()=>{We++;const zt=ce;if(typeof zt.__zcmsSetAllowDynamicContentInteraction=="function"){zt.__zcmsSetAllowDynamicContentInteraction(O.value);return}We<30&&setTimeout(Ze,50)};Ze()}}},{setupClickHandlers:ie,cleanupEventListeners:de}=TN(m,k,E,q,Y,J,Q,R,N,he,ve,Ae,Tt,O),{isVisible:Oe,position:Ye,handleModeSelect:gn,closeMenu:Kr,setupContextMenu:On,cleanupContextMenu:Jr}=MN(k,u,Tt);function Dn(ce,ue){const xe=yn();if(xe){const Ze=new CustomEvent(ce,{detail:ue,bubbles:!0,composed:!0});xe.dispatchEvent(Ze);return}const We=new CustomEvent(ce,{detail:ue,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(We)}function Qe(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function yn(){if(A.value){const ue=A.value.getRootNode();if(ue instanceof ShadowRoot&&ue.host)return ue.host;const xe=A.value.closest?.("zcode-cms")||A.value.closest?.("zcode-editor");if(xe)return xe}const ce=s.getCurrentInstance();if(ce){const ue=ce.vnode.el;if(ue instanceof HTMLElement){const xe=ue.getRootNode();if(xe instanceof ShadowRoot&&xe.host)return xe.host;const We=ue.closest?.("zcode-cms")||ue.closest?.("zcode-editor");return We||null}if(ue instanceof Node){const xe=ue.getRootNode();if(xe instanceof ShadowRoot&&xe.host)return xe.host}}return null}function $s(ce){return typeof ce=="object"&&ce!==null}function Vs(ce){return Array.isArray(ce)?ce.filter(ue=>$s(ue)).map(ue=>({path:typeof ue.path=="string"?ue.path:void 0,field:typeof ue.field=="string"?ue.field:void 0,message:typeof ue.message=="string"?ue.message:void 0,code:typeof ue.code=="string"?ue.code:void 0})):[]}function Jo(ce){if(!ce){te.value={};return}const ue={};for(const xe of oe.value){const We=typeof xe?.path=="string"?xe.path:null,Ze=typeof xe?.field=="string"?xe.field:null,zt=typeof xe?.message=="string"?xe.message:null;!Ze||!zt||We&&We!==ce||(ue[Ze]=zt)}te.value=ue}const Bs=(ce,ue)=>{ue==="common"?m.images.common.push(ce):ue==="individual"?m.images.individual.push(ce):m.images.special.push(ce)},Fs=ce=>{ic(ce,m.page).forEach(Ze=>{Object.keys(Ze.component).forEach(zt=>{zt.includes("image")&&Ze.component[zt]===ce&&(Ze.component[zt]="")})});const xe=m.images.common.findIndex(Ze=>Ze.id===ce);xe!==-1&&m.images.common.splice(xe,1);const We=m.images.individual.findIndex(Ze=>Ze.id===ce);We!==-1&&m.images.individual.splice(We,1)};function js(ce){const ue=ce.detail;if(!$s(ue))return;const xe=ue;if(xe.ok===!0){G.value.visible=!1,G.value.message="",oe.value=[],te.value={};return}if(xe.ok!==!1)return;const We=Vs(xe.errors);oe.value=We;const Ze=We.length,zt=typeof We[0]?.message=="string"&&We[0].message?We[0].message:null;G.value.visible=!0,G.value.requestId=typeof xe.requestId=="string"?xe.requestId:void 0,G.value.target=typeof xe.target=="string"?xe.target:void 0,G.value.message=zt?t("editor.saveFailedWithMessage",{count:Ze,message:zt}):t("editor.saveFailedWithCount",{count:Ze}),Jo(q.value||null)}s.onMounted(()=>{g(),s.nextTick(()=>{ie(),u.value&&On(),H(),Dn("zcode-dom-updated",{})});const ce=yn();ce&&ce.addEventListener("save-result",js)}),s.onUnmounted(()=>{de(),Jr();const ce=yn();ce&&ce.removeEventListener("save-result",js)}),s.watch(()=>q.value,ce=>{Jo(ce||null)}),s.watch([()=>o.page,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial],()=>{g()}),s.watch(m,()=>{s.nextTick(()=>{ie(),Dn("zcode-dom-updated",{})})},{deep:!0}),s.watch([r,k],([ce,ue])=>{ce==="manage"&&ue?s.nextTick(()=>{ie(),u.value&&On(),H(),Dn("zcode-dom-updated",{})}):Jr()}),s.watch(E,()=>{s.nextTick(()=>{Dn("zcode-dom-updated",{})})}),s.watch(d,ce=>{hi({devRightPadding:ce})}),s.watch(O,ce=>{r.value==="manage"&&hi({allowDynamicContentInteraction:ce}),B.value=ce,s.nextTick(()=>{ie(),H(),Dn("zcode-dom-updated",{})})}),s.watch(u,ce=>{hi({enableContextMenu:ce}),ce?s.nextTick(()=>{On()}):Jr()}),s.watch(f,ce=>{hi({showSaveConfirm:ce})});function Yt(){if(!f.value){bn();return}h.value=!0}function bn(){const ce=Qe();Dn("save-request",{requestId:ce,source:"cms",targets:["page","images-common","images-individual"],timestamp:Date.now()})}function Hs(){h.value=!1,bn()}function Xr(){h.value=!1}return e({getData:T,setData:b,validateData:AN,cmsData:m,currentMode:E,switchMode:Tt,allowDynamicContentInteraction:O,devRightPadding:d,devRightPaddingValue:p,settingsPanelOpen:i}),(ce,ue)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"containerRef",ref:A,class:s.normalizeClass(["zcode-cms-container",{"zcode-dev-padding":d.value&&j.value}])},[s.createVNode(qd,{"current-mode":s.unref(E),"view-mode":r.value,"allow-dynamic-content-interaction":O.value,onSwitchMode:s.unref(Tt),onSwitchViewMode:ue[0]||(ue[0]=xe=>r.value=xe),onOpenSettings:ue[1]||(ue[1]=xe=>i.value=!0)},null,8,["current-mode","view-mode","allow-dynamic-content-interaction","onSwitchMode"]),G.value.visible?(s.openBlock(),s.createElementBlock("div",IN,[s.createElementVNode("div",_N,s.toDisplayString(G.value.message),1),s.createElementVNode("button",{class:"zcode-save-banner-close","aria-label":ce.$t("common.close"),onClick:ue[2]||(ue[2]=xe=>G.value.visible=!1)}," × ",8,ON)])):s.createCommentVNode("",!0),r.value==="manage"?(s.openBlock(),s.createElementBlock("div",DN,[s.createElementVNode("button",{class:"zcode-save-btn",onClick:Yt},[s.createVNode(s.unref(yc),{size:16}),s.createElementVNode("span",null,s.toDisplayString(ce.$t("common.save")),1)])])):s.createCommentVNode("",!0),r.value==="preview"?(s.openBlock(),s.createBlock(ka,{key:2,"cms-data":s.unref(m),"allow-dynamic-content-interaction":!0},null,8,["cms-data"])):s.createCommentVNode("",!0),r.value==="manage"?(s.openBlock(),s.createElementBlock(s.Fragment,{key:3},[s.createVNode(Ec,{ref_key:"previewAreaRef",ref:M,"cms-data":s.unref(m),"full-page-html":s.unref(z),"on-add-click":s.unref(N),"allow-dynamic-content-interaction":O.value},null,8,["cms-data","full-page-html","on-add-click","allow-dynamic-content-interaction"]),s.createVNode(Vh,{"editing-component":s.unref(P),"editing-available-fields":s.unref(W),"field-errors":te.value,"current-mode":s.unref(E),"can-select-parent":s.unref($t),"images-common":s.unref(m).images.common,"images-individual":s.unref(m).images.individual,"images-special":s.unref(m).images.special,onClose:s.unref(X),onSelectParent:s.unref(Xt),onSaveField:Z,onAddImage:Bs,onDeleteImage:Fs},null,8,["editing-component","editing-available-fields","field-errors","current-mode","can-select-parent","images-common","images-individual","images-special","onClose","onSelectParent"]),s.createVNode(SC,{"delete-confirm-component":s.unref(U),"current-mode":s.unref(E),"can-select-parent":s.unref($t),onConfirm:s.unref(Le),onCancel:s.unref(dt),onSelectParent:s.unref(Xt)},null,8,["delete-confirm-component","current-mode","can-select-parent","onConfirm","onCancel","onSelectParent"]),s.createVNode(IC,{"reorder-source-path":s.unref(J),"current-mode":s.unref(E),"can-select-parent":s.unref($t),onCancel:s.unref(ye),onSelectParent:s.unref(Xt)},null,8,["reorder-source-path","current-mode","can-select-parent","onCancel","onSelectParent"]),s.createVNode(gN,{"add-target-path":s.unref(Y),"add-part-category":s.unref(Ne),"add-type-tab":s.unref(Re),"add-selected-part":s.unref(le),"add-selected-type":s.unref(ee),"has-special-parts":s.unref(S),"clicked-component":s.unref(ge),"available-part-types":s.unref(L),config:s.unref(l),"grouped-parts-by-type":s.unref(V),"can-select-parent":s.unref($t),"get-part-preview-html":s.unref(De),"get-clicked-component-preview-html":s.unref(Te),"keep-adding":s.unref(C),onCancel:s.unref(I),onSelectParent:s.unref(Xt),onCategoryTabClick:s.unref(F),onTypeTabClick:s.unref(ne),onSelectPart:s.unref(me),onConfirmAdd:s.unref(v),onUpdateKeepAdding:ue[3]||(ue[3]=xe=>C.value=xe)},null,8,["add-target-path","add-part-category","add-type-tab","add-selected-part","add-selected-type","has-special-parts","clicked-component","available-part-types","config","grouped-parts-by-type","can-select-parent","get-part-preview-html","get-clicked-component-preview-html","keep-adding","onCancel","onSelectParent","onCategoryTabClick","onTypeTabClick","onSelectPart","onConfirmAdd"])],64)):s.createCommentVNode("",!0),s.createVNode(Yd,{"is-open":i.value,"view-mode":r.value,mode:"toolbar","allow-dynamic-content-interaction":O.value,"dev-right-padding":p.value,"enable-context-menu":u.value,"show-save-confirm":f.value,onClose:ue[4]||(ue[4]=xe=>i.value=!1),onToggleDynamicContent:ue[5]||(ue[5]=xe=>O.value=xe),onToggleDevPadding:ue[6]||(ue[6]=xe=>d.value=xe),onToggleContextMenu:ue[7]||(ue[7]=xe=>u.value=xe),onToggleSaveConfirm:ue[8]||(ue[8]=xe=>f.value=xe)},null,8,["is-open","view-mode","allow-dynamic-content-interaction","dev-right-padding","enable-context-menu","show-save-confirm"]),s.createVNode(yN,{"is-visible":s.unref(Oe),position:s.unref(Ye),"current-mode":s.unref(E),onSelectMode:s.unref(gn),onClose:s.unref(Kr)},null,8,["is-visible","position","current-mode","onSelectMode","onClose"]),h.value?(s.openBlock(),s.createElementBlock("div",{key:4,class:"zcode-save-confirm-dialog-overlay",onClick:s.withModifiers(Xr,["self"])},[s.createElementVNode("div",PN,[s.createElementVNode("div",RN,[s.createElementVNode("div",LN,s.toDisplayString(ce.$t("saveConfirm.title")),1)]),s.createElementVNode("div",$N,[s.createElementVNode("p",null,s.toDisplayString(ce.$t("saveConfirm.simpleMessage")),1)]),s.createElementVNode("div",VN,[s.createElementVNode("button",{class:"zcode-btn-secondary",onClick:Xr},s.toDisplayString(ce.$t("common.cancel")),1),s.createElementVNode("button",{class:"zcode-btn-primary",onClick:Hs},s.toDisplayString(ce.$t("saveConfirm.saveButton")),1)])])])):s.createCommentVNode("",!0)],2))}}),Hh=":root{--zcode-color-edit: #3b82f6;--zcode-color-add: #10b981;--zcode-color-reorder: #f59e0b;--zcode-color-delete: #ef4444;--zcode-color-edit-hover: #2563eb;--zcode-color-edit-bg: #eff6ff;--zcode-color-edit-bg-active: #dbeafe;--zcode-color-edit-border-hover: #93c5fd;--zcode-color-add-hover: #059669;--zcode-color-add-bg: #ecfdf5;--zcode-color-add-bg-active: #d1fae5;--zcode-color-add-border-hover: #6ee7b7;--zcode-color-reorder-bg: #fffbeb;--zcode-color-reorder-bg-active: #fef3c7;--zcode-color-reorder-border-hover: #fcd34d;--zcode-color-delete-hover: #dc2626;--zcode-color-delete-bg: #fef2f2;--zcode-color-delete-bg-active: #fee2e2;--zcode-color-delete-border-hover: #fca5a5}[class*=zcode-]{box-sizing:border-box}[class*=zcode-]:before,[class*=zcode-]:after{box-sizing:border-box}.zcode-empty-state{text-align:center;padding:60px 20px;color:#666}.zcode-empty-state-btn{margin-top:20px;padding:10px 20px;font-size:16px;background:#42b983;color:#fff;border:none;border-radius:4px;cursor:pointer;transition:background .2s}.zcode-empty-state-btn:hover{background:#359268}.zcode-edit-panel,.zcode-add-panel,.zcode-reorder-panel,.zcode-delete-panel{position:fixed;top:0;right:0;width:375px;height:100vh;background:#fff;box-shadow:-2px 0 8px #0000001a;overflow:hidden;display:flex;flex-direction:column;z-index:1002}.zcode-edit-panel-header,.zcode-add-panel-header,.zcode-reorder-panel-header,.zcode-delete-panel-header{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-shrink:0}.zcode-panel-header-title{margin:0;font-size:14px;font-weight:600;color:#1f2937}.zcode-edit-panel-header .zcode-panel-header-title{color:var(--zcode-color-edit)}.zcode-add-panel-header .zcode-panel-header-title{color:var(--zcode-color-add)}.zcode-reorder-panel-header .zcode-panel-header-title{color:var(--zcode-color-reorder)}.zcode-delete-panel-header .zcode-panel-header-title{color:var(--zcode-color-delete)}.zcode-close-btn{background:none;border:none;cursor:pointer;color:#6b7280;padding:4px 8px;line-height:1;display:flex;align-items:center;justify-content:center}.zcode-close-btn:hover{color:#1f2937}.zcode-edit-fields{padding:16px;font-size:14px;color:#6b7280;overflow-y:auto;flex:1}.zcode-add-panel-content{overflow-y:auto;flex:1}.zcode-edit-fields-text{margin:8px 0}.zcode-component-developer{border:1px dashed #ccc;padding:10px}.zcode-error-message{padding:20px;background:#fff3cd;border:1px solid #ffc107;border-radius:4px;color:#856404}.zcode-for-item{margin-bottom:10px}.zcode-field-editor{padding:16px;overflow-y:auto}.zcode-field-item-title{margin:0 0 15px;color:#2c3e50;font-size:16px;border-bottom:1px solid #eee;padding-bottom:8px}.zcode-field-editor-label{display:block;margin-bottom:8px;font-weight:500;color:#555}.zcode-text-editor{margin-bottom:20px}.zcode-text-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;transition:border-color .2s;box-sizing:border-box}.zcode-text-input:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-field-error{border-color:#ef4444!important;background-color:#fef2f2}.zcode-field-error-message{margin-top:6px;font-size:12px;color:#ef4444;line-height:1.4}.zcode-field-counter{margin-top:6px;font-size:12px;color:#6b7280;text-align:right}.zcode-text-input:disabled,.zcode-textarea:disabled{opacity:.7;cursor:not-allowed}.zcode-text-input[readonly],.zcode-textarea[readonly]{background-color:#f3f4f6;cursor:default}.zcode-radio-editor{margin-top:12px;margin-bottom:12px}.zcode-radio-group{display:flex;flex-direction:column;gap:6px}.zcode-radio-item{display:flex;align-items:center;gap:6px;cursor:pointer;margin-bottom:0;font-weight:400;color:inherit}.zcode-radio-item input[type=radio]{margin:0;cursor:pointer}.zcode-radio-item input[type=radio]:focus{outline:2px solid var(--zcode-color-edit);outline-offset:2px}.zcode-radio-item-label{font-size:14px;color:#4b5563}.zcode-checkbox-editor{margin-top:12px;margin-bottom:12px}.zcode-checkbox-item{display:flex;align-items:center;gap:6px;cursor:pointer;margin-bottom:0;font-weight:400;color:inherit}.zcode-checkbox-item input[type=checkbox]{margin:0;cursor:pointer}.zcode-checkbox-item input[type=checkbox]:focus{outline:2px solid var(--zcode-color-edit);outline-offset:2px}.zcode-checkbox-item-label{font-size:14px;color:#4b5563}.zcode-edit-actions{display:flex;gap:10px;margin-top:20px}.zcode-save-btn{flex:1;background:var(--zcode-color-edit);color:#fff;border:none;padding:10px 16px;border-radius:4px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s}.zcode-save-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-cancel-btn{flex:1;background:#f8f9fa;color:#6c757d;border:1px solid #dee2e6;padding:10px 16px;border-radius:4px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s}.zcode-cancel-btn:hover{background:#e9ecef}[data-zcode-id],[data-zcode-slot-path]{transition:outline .2s;cursor:pointer;position:relative}[data-zcode-id].zcode-outline-active-edit,[data-zcode-id].zcode-outline-active-add,[data-zcode-id].zcode-outline-active-reorder,[data-zcode-id].zcode-outline-active-delete,[data-zcode-slot-path].zcode-outline-active-edit,[data-zcode-slot-path].zcode-outline-active-add,[data-zcode-slot-path].zcode-outline-active-reorder,[data-zcode-slot-path].zcode-outline-active-delete{outline-style:solid;animation:zcode-outline-pulse-edit 1.5s ease-in-out infinite}[data-zcode-id].zcode-outline-active-edit{animation-name:zcode-outline-pulse-edit}[data-zcode-id].zcode-outline-active-add{animation-name:zcode-outline-pulse-add}[data-zcode-id].zcode-outline-active-reorder{animation-name:zcode-outline-pulse-reorder}[data-zcode-id].zcode-outline-active-delete{animation-name:zcode-outline-pulse-delete}[data-zcode-slot-path].zcode-outline-active-edit{animation-name:zcode-outline-pulse-edit}[data-zcode-slot-path].zcode-outline-active-add{animation-name:zcode-outline-pulse-add}[data-zcode-slot-path].zcode-outline-active-reorder{animation-name:zcode-outline-pulse-reorder}[data-zcode-slot-path].zcode-outline-active-delete{animation-name:zcode-outline-pulse-delete}@keyframes zcode-outline-pulse-edit{0%{outline-width:4px;outline-offset:2px;outline-color:#3cd7f6}25%{outline-width:4px;outline-offset:2px;outline-color:#3c83f6}50%{outline-width:4px;outline-offset:2px;outline-color:#493cf6}75%{outline-width:4px;outline-offset:2px;outline-color:#3c83f6}to{outline-width:4px;outline-offset:2px;outline-color:#3cd7f6}}@keyframes zcode-outline-pulse-add{0%{outline-width:4px;outline-offset:2px;outline-color:#0fb82b}25%{outline-width:4px;outline-offset:2px;outline-color:#0fb880}50%{outline-width:4px;outline-offset:2px;outline-color:#0f9cb8}75%{outline-width:4px;outline-offset:2px;outline-color:#0fb880}to{outline-width:4px;outline-offset:2px;outline-color:#0fb82b}}@keyframes zcode-outline-pulse-reorder{0%{outline-width:4px;outline-offset:2px;outline-color:#f5800a}25%{outline-width:4px;outline-offset:2px;outline-color:#f59f0a}50%{outline-width:4px;outline-offset:2px;outline-color:#f5be0a}75%{outline-width:4px;outline-offset:2px;outline-color:#f59f0a}to{outline-width:4px;outline-offset:2px;outline-color:#f5800a}}@keyframes zcode-outline-pulse-delete{0%{outline-width:4px;outline-offset:2px;outline-color:#ef437c}25%{outline-width:4px;outline-offset:2px;outline-color:#ef4343}50%{outline-width:4px;outline-offset:2px;outline-color:#ef7c43}75%{outline-width:4px;outline-offset:2px;outline-color:#ef4343}to{outline-width:4px;outline-offset:2px;outline-color:#ef437c}}.zcode-view-mode-toggle{display:flex;gap:8px}.zcode-view-mode-btn{display:flex;align-items:center;gap:6px;padding:8px 16px;border:1px solid #e5e7eb;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s;font-size:14px;font-weight:500}.zcode-dev-header{display:flex;align-items:center;justify-content:flex-start;padding:8px 16px;background:#f9fafb;border-bottom:1px solid #e5e7eb}.zcode-toolbar{position:sticky;top:0;display:flex;align-items:center;gap:8px;width:fit-content;background:#fffc;margin-bottom:10px;padding:8px 16px;border-radius:8px;box-shadow:0 2px 8px #0000001a;z-index:1001}.zcode-save-banner{position:sticky;top:54px;display:flex;align-items:flex-start;justify-content:space-between;gap:12px;width:min(720px,calc(100% - 32px));margin:0 0 10px;padding:10px 12px;border-radius:10px;border:1px solid transparent;z-index:1001;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}.zcode-save-banner--error{border-color:#fecaca;background:#fef2f2e6;color:#991b1b}.zcode-save-banner-text{font-size:13px;line-height:1.4;word-break:break-word}.zcode-save-banner-close{flex:0 0 auto;width:28px;height:28px;border-radius:8px;border:1px solid rgba(0,0,0,.06);background:#fffc;color:inherit;cursor:pointer}.zcode-save-banner-close:hover{background:#fff}.zcode-toolbar-separator{width:1px;height:24px;background-color:#e5e7eb;margin:0 4px}.zcode-dynamic-content-toggle-label{display:flex;align-items:center;gap:6px;padding:4px 8px;border-radius:4px;cursor:pointer;font-size:14px;color:#374151;-webkit-user-select:none;user-select:none}.zcode-dynamic-content-toggle-label:hover{background-color:#f3f4f6}.zcode-dynamic-content-toggle-checkbox{margin:0;cursor:pointer}.zcode-dev-container .zcode-cms-container .zcode-toolbar{display:none}.zcode-template-tabs{display:inline-flex;gap:6px;margin-right:8px}.zcode-template-tab{padding:6px 10px;border:1px solid #d1d5db;border-radius:6px;background:#fff;font-size:12px;color:#374151;cursor:pointer}.zcode-template-tab.active{background:#111827;border-color:#111827;color:#fff;font-weight:600}.zcode-css-inline-note{flex-shrink:0;margin:0 0 12px;padding:10px 12px;border:1px solid #fde68a;background:#fffbeb;border-radius:8px;color:#92400e;font-size:12px;line-height:1.6}.zcode-part-editor-preview-tab{border:1px solid #e5e7eb;border-radius:8px;background:#fff;padding:16px;min-height:240px;cursor:pointer}.zcode-part-editor-preview-hint{margin-top:10px;font-size:12px;color:#6b7280}.zcode-part-editor-side-tabs{display:flex;gap:0;padding:8px 12px 0;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-part-editor-side-tab{padding:8px 12px;font-size:13px;color:#6b7280;background:transparent;border:none;border-bottom:2px solid transparent;cursor:pointer;margin-bottom:-1px}.zcode-part-editor-side-tab:hover{color:#374151}.zcode-part-editor-side-tab.active{color:#1f2937;font-weight:600;border-bottom-color:#3b82f6}.zcode-edit-panel-preview-heading{font-size:14px;font-weight:600;color:#1f2937;margin-bottom:4px}.zcode-part-editor-pane-body .zcode-edit-panel-preview-desc{margin-bottom:12px;font-size:12px;color:#6b7280;line-height:1.5}.zcode-edit-panel-preview-empty{padding:24px 12px;text-align:center;font-size:13px;color:#6b7280;background:#f9fafb;border-radius:6px;border:1px dashed #e5e7eb}.zcode-edit-panel-preview-wrap{display:flex;flex-direction:column;min-height:0;overflow:hidden}.zcode-edit-panel-preview{position:static;top:auto;right:auto;width:auto;height:auto;max-height:none;box-shadow:none;z-index:auto;display:flex;flex-direction:column;background:transparent;overflow:visible}.zcode-edit-panel-preview .zcode-field-editor{padding:0 4px}.zcode-part-editor-pane{border:1px solid #e5e7eb;border-radius:8px;background:#fff;overflow:hidden;display:flex;flex-direction:column;min-height:0;min-width:0;flex:1}.zcode-part-editor-pane-header{padding:10px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;align-items:center;justify-content:space-between;gap:10px}.zcode-part-editor-pane-header-actions{display:flex;align-items:center;gap:8px;min-width:0}.zcode-css-warning-compact{display:flex;align-items:center;gap:6px;padding:6px 10px;background:#fffbeb;border:1px solid #fde68a;border-radius:6px;font-size:12px;color:#92400e}.zcode-css-warning-compact-icon{flex-shrink:0;color:#f59e0b}.zcode-css-warning-compact-text{white-space:nowrap;font-weight:500}.zcode-part-editor-pane-body{flex:1;min-height:0;overflow:hidden;padding:12px;display:flex;flex-direction:column}.zcode-part-editor-slots-toggle{width:100%;border:1px solid #e5e7eb;border-radius:8px;background:#f9fafb;padding:10px 12px;display:flex;align-items:center;justify-content:space-between;cursor:pointer;font-size:13px;font-weight:600;color:#374151}.zcode-part-editor-slots-toggle:hover{background:#f3f4f6}.zcode-part-editor-slots-toggle-icon{display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;border-radius:999px;border:1px solid #d1d5db;background:#fff;color:#6b7280;font-size:16px;font-weight:400}.zcode-part-editor-slots-toggle-icon.open{transform:rotate(45deg)}.zcode-part-editor-slots-body{margin-top:10px}.zcode-part-editor-topbar{margin-bottom:16px}.zcode-part-editor-topfields{display:grid;grid-template-columns:1fr 1fr;gap:12px}.zcode-part-editor-slots-top{margin-top:12px}.zcode-save-controls-fixed{position:fixed;bottom:20px;left:20px;display:flex;align-items:center;gap:8px;padding:12px 20px;background:#fffc;border-radius:8px;box-shadow:0 4px 12px #00000026;z-index:1000}.zcode-save-btn{display:flex;align-items:center;gap:6px;padding:8px 16px;border:1px solid var(--zcode-color-edit);border-radius:6px;background:var(--zcode-color-edit);color:#fff;font-size:14px;cursor:pointer;transition:all .2s}.zcode-save-btn:hover{background:var(--zcode-color-edit-hover);border-color:var(--zcode-color-edit-hover)}.zcode-mode-btn{padding:8px 16px;border:2px solid #ddd;border-radius:6px;background:#fff;cursor:pointer;font-weight:500;transition:all .2s;font-size:14px;display:flex;align-items:center;gap:6px}.zcode-mode-btn:hover{background:#f3f4f6}.zcode-mode-edit:hover{color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg);border-color:var(--zcode-color-edit-border-hover)}.zcode-mode-reorder:hover{color:var(--zcode-color-reorder);background:var(--zcode-color-reorder-bg);border-color:var(--zcode-color-reorder-border-hover)}.zcode-mode-add:hover{color:var(--zcode-color-add);background:var(--zcode-color-add-bg);border-color:var(--zcode-color-add-border-hover)}.zcode-mode-delete:hover{color:var(--zcode-color-delete);background:var(--zcode-color-delete-bg);border-color:var(--zcode-color-delete-border-hover)}.zcode-mode-btn.active{border-color:currentColor;font-weight:600}.zcode-mode-edit.active{color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg-active);border-color:var(--zcode-color-edit)}.zcode-mode-reorder.active{color:var(--zcode-color-reorder);background:var(--zcode-color-reorder-bg-active);border-color:var(--zcode-color-reorder)}.zcode-mode-add.active{color:var(--zcode-color-add);background:var(--zcode-color-add-bg-active);border-color:var(--zcode-color-add)}.zcode-mode-delete.active{color:var(--zcode-color-delete);background:var(--zcode-color-delete-bg-active);border-color:var(--zcode-color-delete)}.zcode-view-mode-btn{padding:8px 16px;border:2px solid #ddd;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s;font-size:14px;font-weight:500;display:flex;align-items:center;gap:6px}.zcode-view-mode-btn:hover{background:#f9fafb;border-color:#d1d5db;color:#374151}.zcode-view-mode-btn.active{background:#3b82f6;color:#fff;border-color:#3b82f6}.zcode-view-mode-btn.active:hover{background:#2563eb;border-color:#2563eb}.zcode-settings-btn{display:flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:2px solid #ddd;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s}.zcode-settings-btn:hover{background:#f9fafb;border-color:#d1d5db;color:#374151}.zcode-settings-panel-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000}.zcode-settings-panel{background:#fff;border-radius:8px;box-shadow:0 10px 25px #0003;width:90%;max-width:500px;max-height:80vh;overflow-y:auto}.zcode-settings-panel-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:1px solid #e5e7eb;gap:12px}.zcode-settings-panel-header-title{margin:0;font-size:18px;font-weight:600;color:#111827;flex:1}.zcode-settings-panel-header-actions{display:flex;align-items:center;gap:12px}.zcode-language-select{padding:6px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;color:#374151;cursor:pointer;transition:border-color .2s}.zcode-language-select:hover{border-color:#9ca3af}.zcode-language-select:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61a}.zcode-settings-panel-content{padding:20px}.zcode-setting-item{margin-bottom:24px}.zcode-setting-item:last-child{margin-bottom:0}.zcode-setting-label{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:500;color:#374151;cursor:pointer;-webkit-user-select:none;user-select:none}.zcode-setting-checkbox{width:18px;height:18px;cursor:pointer}.zcode-info-btn{display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;margin-left:auto;background:none;border:none;color:#6b7280;cursor:pointer;border-radius:4px;transition:color .2s}.zcode-info-btn:hover{color:#374151}.zcode-setting-description{margin:8px 0 0 26px;font-size:13px;color:#6b7280;line-height:1.5}.zcode-setting-info{margin:0;padding:12px;background:#f3f4f6;border-radius:6px;font-size:13px}.zcode-delete-panel-content{padding:16px;flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:16px}.zcode-delete-warning{display:flex;align-items:flex-start;gap:12px;padding:12px;background:var(--zcode-color-delete-bg);border:1px solid var(--zcode-color-delete-border-hover);border-radius:6px;color:var(--zcode-color-delete)}.zcode-delete-warning svg{flex-shrink:0;margin-top:2px}.zcode-delete-warning p{margin:0;font-size:14px;font-weight:500;line-height:1.5}.zcode-delete-actions{display:flex;gap:8px;margin-top:16px}.zcode-btn-danger{flex:1;padding:10px;background:var(--zcode-color-delete);color:#fff;border:none;border-radius:6px;cursor:pointer;font-weight:600;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-btn-danger:hover{background:var(--zcode-color-delete-hover)}.zcode-btn-cancel{flex:1;padding:10px;background:#e5e7eb;color:#374151;border:none;border-radius:6px;cursor:pointer;font-weight:500;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-btn-cancel:hover{background:#d1d5db}.zcode-parent-selector{padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-parent-select-btn{width:100%;padding:8px 12px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-parent-select-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-reorder-panel-content{padding:16px;flex:1;overflow-y:auto}.zcode-reorder-panel-content-text{margin:8px 0;color:#374151}.zcode-reorder-source{font-family:monospace;font-size:12px;color:#1f2937}.zcode-field-item{margin-bottom:20px}.zcode-field-item-title{margin:0 0 8px;font-size:14px;color:#374151;font-weight:600}.zcode-group-tabs{display:flex;gap:4px;padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;flex-shrink:0;-webkit-overflow-scrolling:touch}.zcode-group-tab{padding:6px 12px;font-size:13px;font-weight:500;color:#6b7280;background:#fff;border:1px solid #d1d5db;border-radius:4px;cursor:pointer;transition:all .2s;display:flex;align-items:center;gap:4px}.zcode-group-tab:hover{background:#f3f4f6;border-color:#9ca3af;color:#374151}.zcode-group-tab.active{background:var(--zcode-color-edit);border-color:var(--zcode-color-edit);color:#fff}.zcode-group-tab.active:hover{background:var(--zcode-color-edit-hover);border-color:var(--zcode-color-edit-hover)}@media(max-width:768px){.zcode-edit-panel,.zcode-add-panel,.zcode-reorder-panel,.zcode-delete-panel{width:100%;height:auto;position:fixed;inset:auto 0 0;border-radius:12px 12px 0 0;max-height:60vh;box-shadow:0 -4px 12px #00000026;z-index:1002;animation:zcode-slide-in-up .3s ease-out}.zcode-edit-panel-preview{position:static;inset:auto;width:auto;height:auto;max-height:none;box-shadow:none;z-index:auto;border-radius:0;animation:none}@keyframes zcode-slide-in-up{0%{transform:translateY(100%)}to{transform:translateY(0)}}.zcode-insert-position{width:100%;right:0}.zcode-edit-actions{flex-direction:column;gap:12px}.zcode-edit-actions-btn{padding:10px 16px;font-size:14px}.zcode-toolbar{top:0;left:10px;right:10px;flex-wrap:nowrap;padding:6px 8px;gap:4px;overflow-x:auto;-webkit-overflow-scrolling:touch}.zcode-toolbar-btn{width:32px;height:32px;padding:0}.zcode-toolbar-btn-text{display:none}.zcode-view-mode-btn,.zcode-mode-btn{width:32px;height:32px;padding:0;justify-content:center}.zcode-view-mode-btn span,.zcode-mode-btn span{display:none}.zcode-settings-btn{width:36px;height:36px}.zcode-delete-dialog-content{width:95%;padding:16px}.zcode-save-controls-fixed{bottom:20px;left:20px;padding:0;background:transparent;box-shadow:none}.zcode-save-btn{width:48px;height:48px;padding:0;border-radius:50%;box-shadow:0 4px 12px #00000040;display:flex;align-items:center;justify-content:center;gap:0}.zcode-save-btn span{display:none}.zcode-save-btn svg{width:20px;height:20px}.zcode-edit-panel-header,.zcode-add-panel-header,.zcode-reorder-panel-header,.zcode-delete-panel-header{padding:10px 12px}.zcode-edit-fields{padding:12px}.zcode-field-item{margin-bottom:20px}.zcode-text-input,.zcode-textarea,.zcode-select,select{font-size:16px;padding:8px 12px}.zcode-textarea{min-height:100px}.zcode-btn,.zcode-btn-primary,.zcode-btn-danger,.zcode-btn-cancel{padding:10px}.zcode-group-tab,.zcode-image-select-btn,.zcode-image-clear-btn,.zcode-parent-select-btn{padding:8px 12px}}.zcode-part-category-tabs{display:flex;gap:4px;padding:8px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-shrink:0}.zcode-category-tab{padding:6px 12px;border:1px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-size:13px;font-weight:500;color:#6b7280;transition:all .2s}.zcode-category-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-category-tab.active{background:var(--zcode-color-add);color:#fff;border-color:var(--zcode-color-add)}.zcode-type-tabs{display:flex;gap:4px;padding:8px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;flex-shrink:0;-webkit-overflow-scrolling:touch}.zcode-type-tab{padding:6px 12px;border:1px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-size:12px;font-weight:500;color:#6b7280;transition:all .2s;white-space:nowrap}.zcode-type-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-type-tab.active{background:var(--zcode-color-add);color:#fff;border-color:var(--zcode-color-add)}.zcode-part-list{flex:1;overflow-y:auto;padding:12px}.zcode-part-type-section{margin-bottom:12px;padding-bottom:8px;border-bottom:1px solid #e5e7eb}.zcode-part-type-section:last-child{border-bottom:none;margin-bottom:0}.zcode-type-section-title{font-size:14px;font-weight:600;color:#1f2937;margin:0 0 6px}.zcode-type-section-description{font-size:12px;color:#6b7280;margin:0 0 8px;line-height:1.5}.zcode-module-buttons{display:grid;grid-template-columns:1fr;gap:6px}.zcode-empty-parts{text-align:center;padding:40px 20px;color:#9ca3af}.zcode-empty-parts-text{margin:0;font-size:14px}.zcode-module-preview{border:2px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;transition:all .2s;overflow:hidden;display:flex;flex-direction:column}.zcode-module-preview:hover{border-color:#9ca3af;box-shadow:0 4px 6px #0000001a}.zcode-module-preview.active{border-color:var(--zcode-color-add);box-shadow:0 0 0 3px #10b9811a}.zcode-module-preview-label{padding:6px 10px;background:#f9fafb;border-bottom:1px solid #e5e7eb;font-size:11px;font-weight:600;color:#374151;text-align:center}.zcode-module-preview.active .zcode-module-preview-label{background:var(--zcode-color-add);color:#fff}.zcode-module-preview-header{display:flex;align-items:center;justify-content:space-between;padding:0;background:#f9fafb;border-bottom:1px solid #e5e7eb}.zcode-module-preview-header .zcode-module-preview-label{flex:1;padding:4px 8px;background:transparent;border-bottom:none;text-align:left}.zcode-module-preview-icon-btn{border:none;background:transparent;padding:0 6px 0 0;cursor:pointer;color:#6b7280;display:flex;align-items:center;justify-content:center}.zcode-module-preview-icon-btn:hover{color:#111827}.zcode-module-preview.active .zcode-module-preview-header{background:var(--zcode-color-add)}.zcode-module-preview.active .zcode-module-preview-header .zcode-module-preview-label{color:#fff}.zcode-module-preview.active .zcode-module-preview-icon-btn{color:#ecfeff}.zcode-module-preview-content{padding:0;flex:1;overflow:hidden;overflow-y:hidden}.zcode-module-preview-content *{max-width:100%}.zcode-copy-notice{display:flex;align-items:center;gap:8px;padding:8px 12px;background:#f0f9ff;border:1px solid #bae6fd;border-radius:4px;margin-bottom:12px}.zcode-copy-notice-icon{flex-shrink:0;color:#0ea5e9}.zcode-copy-notice-text{margin:0;font-size:13px;color:#075985}.zcode-insert-position{padding:12px 20px;border-top:1px solid #e5e7eb;background:#fff}.zcode-insert-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;gap:16px}.zcode-insert-position-title{margin:0;font-size:14px;font-weight:600;color:#374151;flex-shrink:0}.zcode-keep-adding-label-position{margin-top:0;flex-shrink:0;white-space:nowrap}.zcode-keep-adding-label{display:flex;align-items:center;gap:6px;font-size:14px;cursor:pointer;-webkit-user-select:none;user-select:none}.zcode-keep-adding-checkbox{width:16px;height:16px;cursor:pointer}.zcode-insert-buttons{display:flex;gap:8px}.zcode-insert-btn{flex:1;padding:12px 16px;border:2px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-size:14px;font-weight:600;color:#374151;transition:all .2s}.zcode-insert-btn:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-insert-before{border-color:var(--zcode-color-add);color:var(--zcode-color-add)}.zcode-insert-before:hover{background:var(--zcode-color-add-bg);border-color:var(--zcode-color-add-hover)}.zcode-insert-after{border-color:var(--zcode-color-add);color:var(--zcode-color-add)}.zcode-insert-after:hover{background:var(--zcode-color-add-bg);border-color:var(--zcode-color-add-hover)}.zcode-empty-slot{padding:20px;text-align:center;border:2px dashed #d1d5db;border-radius:8px;background:#f9fafb}.zcode-add-slot-btn{padding:8px 16px;background:var(--zcode-color-add);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s}.zcode-add-slot-btn:hover{background:var(--zcode-color-add-hover)}.zcode-add-btn{padding:10px 20px;font-size:16px;background:var(--zcode-color-add);color:#fff;border:none;border-radius:6px;cursor:pointer;transition:background .2s;font-weight:500}.zcode-add-btn:hover{background:var(--zcode-color-add-hover)}@media(max-width:768px){.zcode-part-category-tabs,.zcode-type-tabs{padding:8px 12px}.zcode-part-list,.zcode-part-item{padding:12px}}.zcode-rich-text-editor{border:1px solid #d1d5db;border-radius:6px;overflow:hidden;background:#fff}.zcode-rich-text-toolbar{display:flex;align-items:center;gap:4px;padding:8px;border-bottom:1px solid #d1d5db;background:#f9fafb;flex-wrap:wrap}.zcode-toolbar-btn{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid #d1d5db;border-radius:4px;background:#fff;cursor:pointer;font-size:14px;transition:all .2s;padding:0}.zcode-toolbar-btn:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-toolbar-btn.is-active{background:var(--zcode-color-edit);color:#fff;border-color:var(--zcode-color-edit)}.zcode-toolbar-divider{width:1px;height:24px;background:#d1d5db;margin:0 4px}.zcode-rich-text-editor-content{min-height:200px;max-height:400px;overflow-y:auto;padding:12px}.zcode-tiptap-editor{outline:none;white-space:pre-wrap}.zcode-tiptap-editor p.is-editor-empty:first-child:before{content:attr(data-placeholder);float:left;color:#9ca3af;pointer-events:none;height:0}.zcode-tiptap-editor p{margin:.5em 0}.zcode-tiptap-editor ul,.zcode-tiptap-editor ol{padding-left:1.5em;margin:.5em 0}.zcode-tiptap-editor ul{list-style-type:disc}.zcode-tiptap-editor ol{list-style-type:decimal}.zcode-rich-text-editor-content ul{list-style-type:disc}.zcode-rich-text-editor-content ol{list-style-type:decimal}.zcode-rich-text-editor-content ul,.zcode-rich-text-editor-content ol{padding-left:1.5em;margin:.5em 0}.zcode-tiptap-editor a.zcode-link{color:var(--zcode-color-edit);text-decoration:underline}.zcode-tiptap-editor strong{font-weight:600}.zcode-tiptap-editor em{font-style:italic}.zcode-tiptap-editor s{text-decoration:line-through}.zcode-image-editor{margin-bottom:16px}.zcode-image-editor-input{width:100%;margin-bottom:8px}.zcode-image-editor-buttons{display:flex;gap:8px;margin-bottom:12px}.zcode-image-select-btn{flex:1;padding:8px 16px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s;white-space:nowrap;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-image-select-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-image-clear-btn{flex:1;padding:8px 12px;background:#ef4444;color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s;white-space:nowrap;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-image-clear-btn:hover{background:#dc2626}.zcode-image-preview{margin-top:12px;border:1px solid #d1d5db;border-radius:6px;padding:8px;background:#f9fafb;display:flex;justify-content:center;align-items:center}.zcode-image-preview-img{max-width:100%;max-height:200px;object-fit:contain;border-radius:4px}.zcode-image-modal{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000;padding:20px}.zcode-image-modal-content{background:#fff;border-radius:12px;box-shadow:0 4px 16px #0003;max-width:800px;width:90%;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}.zcode-image-modal-content[data-edit-mode]{max-width:500px;width:100%;border-radius:8px;box-shadow:0 10px 40px #0003}.zcode-image-modal-header{display:flex;justify-content:space-between;align-items:center;padding:20px 24px;border-bottom:1px solid #e5e7eb}.zcode-image-modal-header-title{margin:0;font-size:20px;font-weight:600;color:#1f2937}.zcode-image-current{padding:16px 24px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-image-current-title{margin:0 0 12px;font-size:14px;font-weight:600;color:#6b7280}.zcode-image-current-item{display:flex;align-items:center;gap:12px}.zcode-image-current-item-img{width:60px;height:60px;object-fit:cover;border-radius:6px;border:1px solid #d1d5db}.zcode-image-current-name{font-size:14px;color:#374151;font-weight:500}.zcode-image-tabs{display:flex;border-bottom:1px solid #e5e7eb;padding:0 24px}.zcode-image-tab{padding:12px 20px;background:none;border:none;border-bottom:2px solid transparent;cursor:pointer;font-size:14px;font-weight:500;color:#6b7280;transition:all .2s}.zcode-image-tab:hover{color:#1f2937;background:#f9fafb}.zcode-image-tab.active{color:var(--zcode-color-edit);border-bottom-color:var(--zcode-color-edit)}.zcode-image-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:16px;padding:24px;overflow-y:auto;flex:1}.zcode-image-name{padding:8px;font-size:12px;color:#374151;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.zcode-image-add{padding:16px 24px;border-top:1px solid #e5e7eb;background:#f9fafb}.zcode-image-add-btn{width:100%;padding:10px 16px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-weight:500;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:8px}.zcode-image-add-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-image-modal-actions{display:flex;gap:8px;padding:16px 24px;border-top:1px solid #e5e7eb;background:#fff}.zcode-image-modal-actions-btn{flex:1}.zcode-dev-container{width:100%;min-height:100vh;display:flex;flex-direction:column;position:relative}.zcode-cms-container.zcode-dev-padding{padding-right:375px}@media(max-width:768px){.zcode-cms-container.zcode-dev-padding{padding-right:0;padding-bottom:60vh}.zcode-dev-header{flex-direction:column;align-items:stretch;padding:0;gap:8px;background:none;border-bottom:none;box-shadow:none}.zcode-dev-tab{border-bottom:1px solid #e5e7eb}}.zcode-dev-container>zcode-cms{display:block}.zcode-loading-message{padding:40px;text-align:center;color:#6b7280}.zcode-loading-message-text{margin:8px 0;font-size:14px}.zcode-dev-tabs{display:flex;gap:8px;padding:0;flex-shrink:0;width:100%;box-sizing:border-box;background:#f9fafb;justify-content:space-between}.zcode-dev-tab{padding:10px 20px;border:1px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-weight:500;font-size:14px;transition:background .15s ease,border-color .15s ease,color .15s ease,box-shadow .15s ease;display:flex;align-items:center;gap:6px;color:#6b7280;flex:1 1 0;justify-content:center;text-align:center}.zcode-dev-settings-btn{flex:0 0 auto;padding:6px;min-width:32px;justify-content:center;border-radius:4px;font-size:12px}.zcode-dev-tab:hover{background:#f3f4f6;border-color:#9ca3af;box-shadow:0 1px 3px #0f172a14}.zcode-dev-tab.active{background:var(--zcode-color-edit);color:#fff;border-color:var(--zcode-color-edit);font-weight:600;box-shadow:0 2px 6px #2563eb40}@media(max-width:768px){.zcode-dev-tabs{display:grid;grid-template-columns:repeat(2,1fr);gap:6px;background:transparent}.zcode-dev-tab{width:auto;flex:none;justify-content:flex-start;text-align:left;padding:10px 12px;font-size:13px}.zcode-dev-tab.zcode-dev-settings-btn{display:none}}.zcode-dev-settings-btn-fixed{display:none}@media(max-width:768px){.zcode-dev-settings-btn-fixed{position:fixed;bottom:20px;right:20px;width:48px;height:48px;padding:0;border:2px solid #d1d5db;border-radius:50%;background:#fff;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 12px #00000040;z-index:1000;transition:all .2s ease}.zcode-dev-settings-btn-fixed:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-dev-settings-btn-fixed svg{width:20px;height:20px}}.zcode-parts-manager{width:100%;background:#fff}.zcode-parts-manager-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center}.zcode-parts-manager-header-title{margin:0;font-size:18px;color:#1f2937}.zcode-parts-category-tabs,.zcode-images-category-tabs{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-parts-add-wrapper,.zcode-images-add-wrapper{display:flex;align-items:center;flex-shrink:0}.zcode-parts-category-tab-group,.zcode-images-category-tab-group{display:flex;gap:4px}.zcode-parts-manager-content{display:flex;flex-direction:column}.zcode-parts-list-header{padding:16px;border-bottom:1px solid #e5e7eb;display:flex;justify-content:space-between;align-items:center;background:#fff}.zcode-parts-list-header-title{margin:0;font-size:14px;font-weight:600;color:#1f2937}.zcode-parts-items{padding:16px}.zcode-part-item{padding:16px;border:1px solid #e5e7eb;border-radius:8px;cursor:pointer;transition:all .2s;background:#fff;height:100%;display:flex;flex-direction:column;position:relative}.zcode-part-item:hover{border-color:#d1d5db;box-shadow:0 2px 8px #0000001a}.zcode-part-item.zcode-reorder-source{border-color:var(--zcode-color-reorder);background:#f59e0b05;box-shadow:0 0 0 1px #f59e0b1a}.zcode-reorder-source-indicator{position:absolute;top:-10px;right:10px;background:var(--zcode-color-reorder);color:#fff;padding:2px 8px;border-radius:4px;font-size:11px;font-weight:600;z-index:10}.zcode-part-item-add{border:2px dashed #d1d5db;background:#f9fafb;display:flex;align-items:center;justify-content:center;min-height:120px;cursor:pointer}.zcode-part-item-add:hover{border-color:var(--zcode-color-add);background:var(--zcode-color-add-bg);transform:translateY(-2px)}.zcode-part-item-add-content{display:flex;flex-direction:column;align-items:center;gap:8px;color:#6b7280;font-size:14px;font-weight:500}.zcode-part-item-add:hover .zcode-part-item-add-content{color:var(--zcode-color-add)}.zcode-part-item-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.zcode-part-item-actions{display:flex;gap:4px;align-items:center}.zcode-action-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-action-btn:hover{background:#e5e7eb;color:#374151}.zcode-action-btn.active{background:var(--zcode-color-reorder);color:#fff}.zcode-action-btn.zcode-delete-btn:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-part-duplicate-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-part-duplicate-btn:hover{background:var(--zcode-color-add-bg);color:var(--zcode-color-add)}.zcode-part-type{font-weight:600;font-size:14px;color:#1f2937}.zcode-part-actions{display:flex;gap:4px}.zcode-part-edit-btn,.zcode-part-delete-btn,.zcode-module-delete-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-part-edit-btn:hover{background:var(--zcode-color-edit-bg);color:var(--zcode-color-edit)}.zcode-part-delete-btn:hover,.zcode-module-delete-btn:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-part-description{font-size:13px;color:#6b7280;margin-bottom:4px}.zcode-description-empty{color:#9ca3af;font-style:italic}.zcode-part-modules{font-size:12px;color:#9ca3af}.zcode-part-type-group{margin-bottom:24px}.zcode-part-type-title{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:16px;font-weight:600;color:#1f2937;margin:0 0 12px;padding-bottom:8px;border-bottom:2px solid #e5e7eb}.zcode-part-type-actions{display:flex;align-items:center;gap:4px}.zcode-part-type-edit-btn{padding:4px 8px;border:1px solid #e5e7eb;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;transition:all .2s}.zcode-part-type-edit-btn:hover{background:var(--zcode-color-edit-bg);border-color:var(--zcode-color-edit-border-hover);color:var(--zcode-color-edit)}.zcode-part-type-items{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px}.zcode-part-preview{margin-top:12px;padding:8px;border:1px solid #e5e7eb;border-radius:6px;background:#f9fafb;max-height:150px;overflow:hidden;flex:1;min-height:0}.zcode-part-preview-content{font-size:11px;line-height:1.4;pointer-events:none;transform:scale(.75);transform-origin:top left;width:133.33%}.zcode-required{color:#ef4444;margin-left:2px}.zcode-part-modal{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000;padding:20px}.zcode-part-modal-content{background:#fff;border-radius:8px;box-shadow:0 10px 40px #0003;width:100%;max-width:95vw;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}.zcode-part-editor{display:flex;flex-direction:column;overflow:hidden;height:100%}.zcode-part-editor-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.zcode-part-editor-header-title{margin:0;font-size:16px;color:#1f2937}.zcode-part-editor-form{flex:1;overflow-y:auto;padding:24px}.zcode-part-editor-main{display:grid;grid-template-columns:1fr 1fr;gap:24px;align-items:stretch;min-height:0}.zcode-part-editor-main .zcode-part-editor-pane--side{position:sticky;top:0;align-self:start;max-height:calc(100vh - 120px)}.zcode-part-editor-pane--side .zcode-part-editor-pane-body{overflow-y:auto}.zcode-part-editor-fields{display:flex;flex-direction:column;gap:16px}.zcode-part-editor-preview{border:1px solid #e5e7eb;border-radius:8px;padding:16px;background:#f9fafb;position:sticky;top:0;max-height:calc(90vh - 200px);display:flex;flex-direction:column}.zcode-part-editor-preview-title{margin:0 0 12px;font-size:14px;font-weight:600;color:#1f2937}.zcode-preview-module-selector{margin-bottom:12px}.zcode-select-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;cursor:pointer}.zcode-select-input:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-editing-preview-content{flex:1;overflow-y:auto;padding:12px;background:#fff;border-radius:6px;min-height:200px;transform:scale(.9);transform-origin:top left;width:111.11%}.zcode-preview-empty{flex:1;display:flex;align-items:center;justify-content:center;color:#9ca3af;font-size:14px}.zcode-preview-modal{position:fixed;inset:0;background:#000c;display:flex;align-items:center;justify-content:center;z-index:3000;padding:20px}.zcode-preview-modal-content{background:#fff;border-radius:8px;width:90%;max-width:1200px;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}.zcode-preview-modal-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.zcode-preview-modal-header-title{margin:0;font-size:16px;color:#1f2937}.zcode-preview-modal-body{padding:24px;overflow-y:auto;flex:1}.zcode-help-modal-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:10000;padding:20px}.zcode-help-modal{background:#fff;border-radius:8px;width:90%;max-width:800px;max-height:80vh;overflow:auto;box-shadow:0 20px 25px -5px #0000001a}.zcode-help-modal-header{display:flex;justify-content:space-between;align-items:center;padding:20px 24px;border-bottom:1px solid #e5e7eb;background:#f9fafb;position:sticky;top:0;z-index:1}.zcode-help-modal-header-title{margin:0;font-size:18px;font-weight:600;color:#1f2937;display:flex;align-items:center;gap:8px}.zcode-css-warning-modal-title-icon{color:#f59e0b;flex-shrink:0}.zcode-help-modal-body{padding:24px}.zcode-help-table{width:100%;border-collapse:collapse;margin-bottom:24px}.zcode-help-table-cell{padding:14px 16px;text-align:left;border-bottom:1px solid #e5e7eb;border-right:1px solid #e5e7eb;vertical-align:top}.zcode-help-table-cell:last-child{border-right:none}.zcode-help-table-header{background:#f9fafb;font-weight:600;color:#374151;font-size:13px;text-transform:uppercase;letter-spacing:.5px}.zcode-help-table-data{font-size:14px;color:#4b5563;line-height:1.6}.zcode-help-table-data:first-child{width:35%}.zcode-help-table-data:nth-child(2){width:30%}.zcode-help-table-data:nth-child(3){width:35%}.zcode-help-table-code{background:#f3f4f6;padding:3px 8px;border-radius:4px;font-size:13px;color:#dc2626;font-family:Courier New,Courier,monospace;white-space:nowrap;border:1px solid #e5e7eb}.zcode-help-table-row:hover{background:#fafafa}.zcode-help-section{background:#f9fafb;padding:12px 16px;border-radius:6px;border:1px solid #e5e7eb;margin-bottom:16px}.zcode-help-section:last-child{margin-bottom:0}.zcode-help-section-title{margin:0 0 8px;color:#374151;font-size:14px;font-weight:600}.zcode-help-section-list{margin:0;padding-left:0;list-style-position:inside}.zcode-help-section-item{margin-bottom:6px;color:#6b7280;font-size:13px;line-height:1.6}.zcode-help-section-item:last-child{margin-bottom:0}.zcode-help-section-code{background:#f3f4f6;padding:2px 6px;border-radius:3px;font-size:12px;color:#dc2626;font-family:Courier New,Courier,monospace;border:1px solid #e5e7eb}.zcode-slots-config{display:flex;flex-direction:column;gap:16px}.zcode-slots-config-in-pane{padding:12px 0;overflow-y:auto;min-height:0}.zcode-slot-config-item{border:1px solid #e5e7eb;border-radius:6px;padding:12px;background:#f9fafb}.zcode-slot-config-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;padding-bottom:8px;border-bottom:1px solid #e5e7eb}.zcode-slot-config-header-title{font-size:14px;color:#1f2937}.zcode-slot-config-body{display:flex;flex-direction:column;gap:8px}.zcode-slot-config-body-label{font-size:12px;font-weight:600;color:#6b7280;margin-bottom:4px}.zcode-checkbox-group{display:flex;flex-direction:column;gap:6px}.zcode-checkbox-item{display:flex;align-items:center;gap:6px;cursor:pointer}.zcode-checkbox-item:hover{background-color:transparent}.zcode-checkbox{width:16px;height:16px;cursor:pointer;accent-color:var(--zcode-color-edit);flex-shrink:0}.zcode-checkbox-item span{font-size:13px;color:#374151;-webkit-user-select:none;user-select:none}.zcode-module-slots-config{margin-top:16px;padding-top:16px;border-top:1px solid #e5e7eb}.zcode-slot-add-section{margin-top:16px;padding:12px;border:1px dashed #d1d5db;border-radius:6px;background:#f9fafb}.zcode-slot-add-section-label{display:block;font-size:13px;font-weight:600;color:#374151;margin-bottom:8px}.zcode-slot-add-controls{display:flex;gap:8px;align-items:center}.zcode-select-input{flex:1;padding:8px 12px;border:1px solid #d1d5db;border-radius:4px;background:#fff;font-size:14px;color:#1f2937;cursor:pointer;transition:border-color .2s}.zcode-select-input:hover{border-color:#9ca3af}.zcode-select-input:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-select{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;color:#1f2937;cursor:pointer;transition:border-color .2s}.zcode-select:hover{border-color:#9ca3af}.zcode-select:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-select[multiple]{padding:4px;cursor:default}.zcode-select-option{padding:6px 8px;border-radius:4px;margin:2px 0}.zcode-select-option:checked{background:var(--zcode-color-edit-bg);color:var(--zcode-color-edit)}.zcode-tag-editor{display:flex;flex-direction:column;gap:8px}.zcode-tag-preview{font-size:12px;color:#6b7280;padding:4px 8px;background-color:#f3f4f6;border-radius:4px;font-family:Courier New,monospace}.zcode-tag-preview code{background-color:transparent;padding:0;color:#374151;font-weight:600}.zcode-slot-add-empty{margin-top:16px;padding:12px;text-align:center;color:#6b7280;font-size:13px;font-style:italic}.zcode-module-slots-config-label{font-size:13px;font-weight:600;color:#374151;margin-bottom:8px;display:block}.zcode-form-hint{font-size:12px;color:#6b7280;margin-top:4px;margin-bottom:12px;font-style:italic}.zcode-btn-small{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s;font-size:12px}.zcode-btn-small:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-module-item.active{border-color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg)}.zcode-module-delete-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-module-delete-btn:hover:not(:disabled){background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-module-delete-btn:disabled{opacity:.4;cursor:not-allowed}.zcode-module-actions{display:flex;gap:4px;align-items:center}.zcode-module-duplicate-btn,.zcode-module-copy-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-module-duplicate-btn:hover:not(:disabled),.zcode-module-copy-btn:hover:not(:disabled){background:var(--zcode-color-add-bg);color:var(--zcode-color-add)}.zcode-module-copy-btn:disabled{opacity:.4;cursor:not-allowed}.zcode-form-field{margin-bottom:16px}.zcode-form-field-label{display:block;font-size:14px;font-weight:500;color:#374151;margin-bottom:6px}.zcode-form-field-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px}.zcode-form-field-header>.zcode-form-field-label:first-child{margin-bottom:0}.zcode-form-field-actions{display:flex;align-items:center;gap:8px}.zcode-help-btn{display:flex;align-items:center;justify-content:center;padding:4px;background:transparent;border:none;color:#6b7280;cursor:pointer;border-radius:4px;transition:all .2s}.zcode-help-btn:hover{color:#374151;background:transparent}.zcode-checkbox-label{display:flex;align-items:center;gap:6px;cursor:pointer;-webkit-user-select:none;user-select:none;margin-bottom:0}.zcode-checkbox-label-inline{margin-bottom:0}.zcode-checkbox-input{width:16px;height:16px;cursor:pointer;margin:0}.zcode-checkbox-label span{font-size:13px;color:#6b7280;font-weight:400}.zcode-text-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;transition:border-color .2s}.zcode-text-input:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-monaco-editor{width:100%;flex:1;min-height:0;display:flex;flex-direction:column}.zcode-monaco-editor .monaco-editor-wrapper{flex:1;min-height:0;display:flex;flex-direction:column}.zcode-monaco-editor .monaco-editor-container{border:1px solid #d1d5db;border-radius:4px;flex:1;min-height:0;max-height:none!important}.zcode-textarea{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;font-family:monospace;resize:vertical;transition:border-color .2s}.zcode-textarea:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-modules-list{margin-bottom:12px}.zcode-module-item{padding:12px;border:1px solid #e5e7eb;border-radius:6px;margin-bottom:12px;background:#f9fafb;cursor:pointer;transition:all .2s}.zcode-module-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.zcode-module-title{font-weight:600;font-size:14px;color:#1f2937}.zcode-module-body{display:flex;flex-direction:column;gap:8px}.zcode-module-body-label{font-size:12px;font-weight:500;color:#6b7280}.zcode-part-editor-actions{display:flex;gap:8px;padding:16px 24px;border-top:1px solid #e5e7eb;background:#fff;flex-shrink:0}.zcode-part-editor-actions-btn{flex:1}.zcode-part-editor-actions-btn-primary,.zcode-btn-primary{padding:10px 20px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-weight:600;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-parts-new-btn{padding:7px 12px;font-size:13px;border-radius:4px;white-space:nowrap;flex-shrink:0}.zcode-images-add-btn{padding:7px 12px;font-size:13px;border-radius:4px}.zcode-btn-primary:hover{background:var(--zcode-color-edit-hover)}.zcode-btn-secondary{padding:8px 16px;background:#f3f4f6;color:#374151;border:1px solid #d1d5db;border-radius:6px;cursor:pointer;font-weight:500;font-size:14px;transition:all .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-btn-secondary:hover{background:#e5e7eb;border-color:#9ca3af}.zcode-page-css-panel{width:100%;background:#fff;display:flex;flex-direction:column;height:100%;flex:1;min-height:0}.zcode-warning-banner{padding:16px;background:#fff3cd;border-bottom:1px solid #ffc107;display:flex;gap:12px}.zcode-warning-icon{font-size:20px;flex-shrink:0}.zcode-warning-content{flex:1}.zcode-warning-title{margin:0 0 8px;font-size:14px;font-weight:700;color:#856404}.zcode-warning-list{margin:0;padding-left:20px;font-size:13px;color:#856404;line-height:1.6}.zcode-warning-list li{margin-bottom:4px}.zcode-warning-list strong{font-weight:700}.zcode-warning-inline{padding:12px;background:#fff3cd;border:1px solid #ffc107;border-radius:6px;margin-bottom:16px;display:flex;gap:12px}.zcode-warning-inline .zcode-warning-icon{font-size:18px;flex-shrink:0}.zcode-warning-inline .zcode-warning-content{flex:1}.zcode-warning-inline .zcode-warning-title{margin:0 0 8px;font-size:13px;font-weight:700;color:#856404}.zcode-warning-inline .zcode-warning-text{font-size:12px;color:#856404;line-height:1.6}.zcode-warning-inline .zcode-warning-text ul{margin:0;padding-left:20px}.zcode-warning-inline .zcode-warning-text li{margin-bottom:4px}.zcode-css-warning-modal{max-width:500px}.zcode-css-warning-modal-footer{display:flex;flex-direction:column;justify-content:center;align-items:center;padding:16px 24px;border-top:1px solid #e5e7eb;background:#f9fafb}.zcode-css-warning-modal .zcode-warning-content{padding:0}.zcode-css-warning-modal .zcode-warning-list{margin:0;padding-left:20px;font-size:14px;color:#856404;line-height:1.8;list-style-type:disc;list-style-position:outside}.zcode-css-warning-modal .zcode-warning-list li{margin-bottom:8px;list-style-type:disc}.zcode-css-warning-modal .zcode-warning-list strong{font-weight:700;color:#92400e}.zcode-page-css-content{display:flex;flex:1;overflow:hidden}.zcode-page-css-parts-selector{width:280px;border-right:1px solid #e5e7eb;display:flex;flex-direction:column;overflow:hidden;background:#f9fafb}.zcode-search-box{padding:12px;border-bottom:1px solid #e5e7eb;background:#fff}.zcode-search-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff}.zcode-search-input:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-parts-list{flex:1;overflow-y:auto;padding:12px}.zcode-parts-section{margin-bottom:24px}.zcode-parts-section:last-child{margin-bottom:0}.zcode-parts-section-title{margin:0 0 8px;padding:8px 12px;font-size:12px;font-weight:700;color:#6b7280;text-transform:uppercase;letter-spacing:.05em;background:#fff;border-radius:4px}.zcode-part-item{padding:12px;border:1px solid #e5e7eb;border-radius:6px;cursor:pointer;transition:all .2s;background:#fff;margin-bottom:8px}.zcode-part-item:hover{border-color:#d1d5db;box-shadow:0 2px 4px #0000000d}.zcode-part-item-selected{border-color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg);box-shadow:0 0 0 2px #3b82f633}.zcode-part-item-title{font-size:14px;font-weight:600;color:#1f2937;margin-bottom:4px}.zcode-part-item-id{font-size:12px;color:#6b7280;font-family:monospace}.zcode-page-css-preview{flex:1;border-right:1px solid #e5e7eb;display:flex;flex-direction:column;overflow:hidden;background:#f9fafb}.zcode-preview-container{flex:1;overflow:auto;padding:24px}.zcode-preview-content{max-width:800px;margin:0 auto;background:#fff;padding:24px;border-radius:8px;box-shadow:0 2px 8px #0000001a}.zcode-preview-content [data-zcode-highlight=true]{outline:3px solid var(--zcode-color-edit);outline-offset:4px;background:var(--zcode-color-edit-bg)}.zcode-page-css-editor{width:100%;display:flex;flex-direction:column;overflow:hidden;background:#fff;flex:1;min-height:0}.zcode-page-css-editor .zcode-form-field{flex:1;display:flex;flex-direction:column;padding:16px;overflow:hidden}.zcode-page-css-editor .zcode-form-field label{margin-bottom:8px;font-size:14px;font-weight:600;color:#1f2937}.zcode-page-css-editor .monaco-editor-wrapper{flex:1;min-height:0}.zcode-page-css-editor .monaco-editor-container{height:100%;min-height:320px;max-height:none}.zcode-page-css-actions{padding:16px;border-top:1px solid #e5e7eb;display:flex;gap:8px;justify-content:flex-end;flex-shrink:0}.zcode-page-css-actions .zcode-btn-primary,.zcode-page-css-actions .zcode-btn-secondary{flex:1}.zcode-images-manager{width:100%;background:#fff}.zcode-images-manager-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center}.zcode-images-manager-header-title{margin:0;font-size:18px;color:#1f2937}.zcode-images-manager-content{display:flex;flex-direction:column}.zcode-images-grid{padding:16px;display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:16px;align-content:start}.zcode-image-item{position:relative;border:2px solid #e5e7eb;border-radius:8px;cursor:pointer;background:#f9fafb;display:flex;flex-direction:column;overflow:hidden}.zcode-image-item>img{width:100%;height:150px;object-fit:cover;display:block;flex-shrink:0}.zcode-image-item:hover{border-color:#d1d5db;box-shadow:0 2px 8px #0000001a}.zcode-image-item.zcode-reorder-source{border-color:var(--zcode-color-reorder);background:#f59e0b05;box-shadow:0 0 0 1px #f59e0b1a}.zcode-image-item.selected{border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f633}.zcode-image-item-clickable{cursor:pointer}.zcode-image-item-img{width:100%;height:150px;object-fit:cover;display:block}.zcode-image-item-overlay{position:absolute;inset:0;pointer-events:none}.zcode-image-item-actions{position:absolute;top:8px;right:8px;display:flex;gap:4px;opacity:0;pointer-events:auto}.zcode-image-item:hover .zcode-image-item-actions{opacity:1}.zcode-image-edit-btn,.zcode-image-delete-btn{padding:8px;border:none;border-radius:4px;background:#ffffffe6;color:#374151;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-image-edit-btn:hover{background:#fff;color:var(--zcode-color-edit)}.zcode-image-delete-btn:hover{background:#fff;color:var(--zcode-color-delete)}.zcode-image-item-name{padding:8px;font-size:12px;color:#374151;text-align:center;background:#fff;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:break-all;overflow-wrap:break-word;max-width:100%}.zcode-image-editor-panel{position:static;width:auto;height:auto;background:transparent;box-shadow:none;display:block;z-index:auto}.zcode-image-editor-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.zcode-image-editor-header-title{margin:0;font-size:16px;color:#1f2937}.zcode-image-editor-form{flex:1;overflow-y:auto;padding:16px}.zcode-image-preview-large{margin-bottom:16px;border:1px solid #e5e7eb;border-radius:6px;padding:8px;background:#f9fafb;display:flex;justify-content:center;align-items:center}.zcode-image-preview-large-img{max-width:100%;max-height:200px;object-fit:contain;border-radius:4px}.zcode-image-editor-actions{display:flex;gap:8px;margin-top:16px;padding-top:16px;border-top:1px solid #e5e7eb}.zcode-image-editor-actions-btn{flex:1}@media(max-width:768px){.zcode-part-type-items{grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:12px}.zcode-part-modal{padding:10px}.zcode-part-modal-content{max-width:100%;max-height:95vh}.zcode-part-editor-main,.zcode-part-editor-topfields{grid-template-columns:1fr}.zcode-part-editor-preview{position:relative;max-height:400px}.zcode-images-grid{grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:12px}}.zcode-data-viewer{border-top:1px solid #e5e7eb;background:#fff;display:flex;flex-direction:column;min-height:200px;flex-shrink:0;height:100%;overflow:hidden}.zcode-data-viewer-header{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;padding:8px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-data-viewer-content-tabs{display:flex;gap:4px}.zcode-data-viewer-content-tab{padding:6px 12px;font-size:13px;border:1px solid #d1d5db;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;font-weight:500;transition:all .2s}.zcode-data-viewer-content-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-data-viewer-content-tab.active{background:var(--zcode-color-edit);color:#fff;border-color:var(--zcode-color-edit)}.zcode-data-viewer-tabs{display:flex;gap:4px;align-items:center}.zcode-data-viewer-tab{padding:6px 12px;font-size:13px;border:1px solid #d1d5db;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;font-weight:500;transition:all .2s}.zcode-data-viewer-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-data-viewer-tab.active{background:var(--zcode-color-add);color:#fff;border-color:var(--zcode-color-add)}.zcode-data-viewer-error{padding:12px 16px;background:#fee;color:#c33;border-bottom:1px solid #e5e7eb;font-size:13px}.zcode-data-viewer-content{flex:1;overflow:auto;position:relative}.zcode-data-viewer-display-wrapper{position:relative;width:100%;height:100%}.zcode-data-viewer-display{margin:0;padding:16px;font-family:Monaco,Menlo,Ubuntu Mono,monospace;font-size:13px;line-height:1.6;color:#f9fafb;background:#111827;white-space:pre;overflow-x:auto;border-top:1px solid #374151}.zcode-data-viewer-copy-btn{position:absolute;top:12px;right:12px;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid rgba(255,255,255,.2);border-radius:4px;background:#111827cc;color:#f9fafb;cursor:pointer;transition:all .2s;z-index:10}.zcode-data-viewer-copy-btn:hover{background:#111827f2;border-color:#ffffff4d;color:#fff}.zcode-data-viewer-copy-btn:active{transform:scale(.95)}.zcode-input-readonly,.zcode-textarea-readonly{display:none}.zcode-dev-container .zcode-input-readonly,.zcode-dev-container .zcode-textarea-readonly{display:block;background-color:#f3f4f6;color:#6b7280;border-color:#d1d5db;cursor:default;pointer-events:none}.zcode-context-menu{position:fixed;background:#fff;border:1px solid #e5e7eb;border-radius:6px;box-shadow:0 4px 12px #00000026;padding:4px;z-index:10000;min-width:160px}.zcode-context-menu-item{display:flex;align-items:center;gap:8px;width:100%;padding:8px 12px;border:none;background:transparent;text-align:left;cursor:pointer;border-radius:4px;font-size:14px;color:#374151;transition:background .2s}.zcode-context-menu-item:hover{background:#f3f4f6}.zcode-context-menu-item.active{background:var(--zcode-color-edit-bg);color:var(--zcode-color-edit);font-weight:500}.zcode-context-menu-divider{height:1px;background:#e5e7eb;margin:4px 0}.zcode-save-confirm-dialog-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:10000}.zcode-save-confirm-dialog{background:#fff;border-radius:8px;box-shadow:0 10px 25px #0003;max-width:500px;width:90%;max-height:80vh;display:flex;flex-direction:column}.zcode-save-confirm-dialog-header{padding:16px 20px;border-bottom:1px solid #e5e7eb}.zcode-save-confirm-dialog-title{font-size:18px;font-weight:600;color:#111827}.zcode-save-confirm-dialog-body{padding:20px;flex:1;overflow-y:auto}.zcode-save-confirm-dialog-body p{margin:0 0 12px;font-size:14px;color:#374151}.zcode-save-confirm-targets{list-style:none;padding:0;margin:12px 0}.zcode-save-confirm-targets li{padding:8px 12px;background:#f9fafb;border-radius:4px;margin-bottom:8px;font-size:14px;color:#374151}.zcode-save-confirm-targets li:last-child{margin-bottom:0}.zcode-save-confirm-dialog-footer{padding:16px 20px;border-top:1px solid #e5e7eb;display:flex;justify-content:flex-end;gap:12px}.zcode-btn-secondary{padding:8px 16px;background:#fff;border:1px solid #d1d5db;border-radius:6px;font-size:14px;cursor:pointer;color:#374151;transition:background-color .2s,border-color .2s}.zcode-btn-secondary:hover{background:#f9fafb;border-color:#9ca3af}.zcode-btn-primary{padding:8px 16px;background:#3b82f6;border:none;border-radius:6px;font-size:14px;cursor:pointer;color:#fff;transition:background-color .2s}.zcode-btn-primary:hover{background:#2563eb}@media(max-width:768px){.zcode-save-confirm-dialog{width:95%;max-height:90vh}.zcode-save-confirm-dialog-header{padding:12px 16px}.zcode-save-confirm-dialog-body{padding:16px}.zcode-save-confirm-dialog-footer{padding:12px 16px;flex-direction:column-reverse}.zcode-btn-secondary,.zcode-btn-primary{width:100%}.zcode-text-input,.zcode-textarea,.zcode-select,select{font-size:16px}}",BN={common:{close:"閉じる",save:"保存",cancel:"キャンセル",delete:"削除",edit:"編集",add:"追加",reorder:"並べ替え",preview:"プレビュー",settings:"設定",manage:"管理",view:"表示",confirm:"確定",clear:"クリア",select:"選択",replace:"差し替え",copy:"コピー",copied:"コピーしました"},toolbar:{editMode:"編集",addMode:"追加",reorderMode:"並べ替え",deleteMode:"削除",viewMode:"表示",settings:"設定"},settings:{title:"設定",language:{label:"言語",ja:"日本語",en:"English"},enableDynamicContent:"ページの動作を有効にする",enableDynamicContentDescription:"アコーディオン、タブ、モーダル、リンクなどの動的コンテンツの動作を有効にします。",devRightPadding:"編集パネル分の余白をつける",devRightPaddingDescription:"編集パネル表示時にコンテンツの右側に余白を追加します。",enableContextMenu:"右クリックメニューを有効にする",enableContextMenuDescription:"コンテンツ上で右クリックすると、編集・追加・並べ替え・削除のモードを切り替えるメニューが表示されます。",showSaveConfirm:"保存時の確認ダイアログを表示する",showSaveConfirmDescription:"保存ボタンをクリックした際に、保存対象を確認するダイアログを表示します。",previewModeInfo:"表示モードでは動的コンテンツ(アコーディオン、タブ、モーダル、リンクなど)は常に有効です。",noSettings:"設定項目はありません。"},emptyState:{message:"パーツを追加してください",addPart:"+ パーツを追加"},addPanel:{title:"追加",selectParent:"親要素を選択",category:{common:"共通",individual:"個別",selected:"選択したパーツ"},typeAll:"all",activeParts:"active parts",activePartsDescription:"プレビューエリアでクリックしたパーツを、現在のデータを含む状態で追加できます。",clickPartInPreview:"プレビューエリアでパーツをクリックしてください",noPartsAvailable:"利用可能なパーツがありません",addBefore:"前に追加",addAfter:"後に追加",continueAdding:"パーツ追加を続ける"},editPanel:{title:"編集中",editing:"編集中: {type}",id:"ID: {id}",selectImage:"画像を選択",replaceImage:"差し替え",clearImage:"クリア",clearImageTitle:"画像をクリア",noFields:"編集可能なフィールドがありません"},deletePanel:{title:"削除確認",confirmMessage:"このパーツを削除しますか?",selectParent:"親要素を選択"},reorderPanel:{title:"並べ替え: 移動元を選択中",instruction:"移動先の要素をクリックしてください",source:"移動元: {path}",selectParent:"親要素を選択"},saveConfirm:{title:"保存の確認",message:"以下のデータを保存しますか?",simpleMessage:"保存しますか?",targets:{page:"ページデータ","parts-common":"パーツ(共通)","parts-individual":"パーツ(個別)","parts-special":"パーツ(特別)","parts-common-css":"CSS(共通)","parts-individual-css":"CSS(個別)","parts-special-css":"CSS(特別)","images-common":"画像(共通)","images-individual":"画像(個別)","images-special":"画像(特別)"},saveButton:"保存する"},partsManager:{createType:"タイプ追加",editType:"タイプ編集",typeName:"タイプ名",typeDescription:"説明",typeNamePlaceholder:"例: hero, features",typeDescriptionPlaceholder:"タイプの説明",editPart:"パーツ編集: {title}",partTitle:"タイトル",partDescription:"説明",partDescriptionPlaceholder:"パーツの説明",deletePartConfirm:`パーツ {number} を削除しますか?
|
|
463
|
+
(タイプには他のパーツが残ります)`,deleteTypeConfirm:"このタイプを削除しますか?",deleteTypeWithUsagesConfirm:"タイプ「{type}」は{count}箇所で使用されています。削除しますか?",deleteSlotConfirm:"スロット「{slotName}」を削除しますか?",selectImage:"画像選択",addPart:"パーツを追加",editTypeButton:"タイプ全体を編集",reorderType:"タイプを並べ替え",deleteTypeButton:"このタイプを削除(全パーツ含む)",editPartButton:"パーツを編集",reorderPart:"並べ替え",deletePartButton:"削除",source:"移動元",noDescription:"説明なし",partNumber:"パーツ {current} / {total}",allowedParts:"許可されるパーツ",searchParts:"パーツを検索...",addSlot:"スロットを追加",selectSlot:"スロットを選択...",defaultSlot:"デフォルトスロット",codeEdit:"コード編集",cssEditInfo:"CSS編集について",templateSuggestions:"予測変換",preview:"プレビュー:",cssEditWarning:"CSS編集について",cssEditWarningMessageCommon:"ここで編集したCSSは、すべてのページに適用される想定です。既存のCSSファイル(common.cssなど)がある場合、それらを上書きする可能性があります。",cssEditWarningMessageIndividual:"ここで編集したCSSは、ページタイプごとに適用される想定です。既存のCSSファイル(page.cssなど)がある場合、それらを上書きする可能性があります。",cssEditWarningMessageSpecial:"ここで編集したCSSは、動的ページごとに適用される想定です。既存のCSSファイル(shop111.cssなど)がある場合、それらを上書きする可能性があります。",understood:"了解しました",dontShowAgain:"次回から表示しない",templateHelp:{textField:"テキストフィールド",richText:"リッチテキスト",textarea:"複数行テキスト",image:"画像選択",radio:"ラジオボタン",checkbox:"チェックボックス",selectSingle:"セレクトボックス(単一選択)",selectMultiple:"セレクトボックス(複数選択)",conditional:"条件分岐(表示/非表示)",tag:"タグ選択",slot:"スロット(子要素挿入)",note:"補足",suggestionNote:"予測変換を有効にすると、<code>$</code>、<code>(</code>、<code>z</code>を入力時に自動補完が表示されます",fieldNameNote:"フィールド名は英数字とアンダースコアが使用できます",defaultValueNote:"デフォルト値は省略可能です(空文字になります)"},validationError:"エラー:",dangerousTagWarning:"<{tag}> タグが含まれています。",dangerousAttrWarning:"{attr} 属性が含まれています。",slotSettings:"スロット設定",slot:"スロット",templateHelpButton:"テンプレート記法のヘルプ",clickToEnlarge:"クリックで拡大",displayPreview:"表示プレビュー",editPanelPreview:"編集パネルプレビュー",editPanelPreviewNoFields:"編集可能なフィールドはありません",editPanelPreviewDesc:"ページ編集時に表示される編集パネルの項目一覧です。"},imagesManager:{addImage:"画像追加",editImage:"画像編集",imageId:"画像ID",imageName:"画像名",altText:"Alt属性",deleteImageConfirm:"この画像を削除しますか?",deleteImageWithUsagesConfirm:"この画像は{count}箇所で使用されています。削除しますか?",deleteImageFromModalConfirm:"この画像を削除しますか?",addImageFailed:"画像の追加に失敗しました",selectImage:"画像を選択",currentlySelected:"現在選択中",select:"選択"},dataViewer:{page:"ページ",parts:"パーツ",images:"画像",common:"共通",individual:"個別",special:"特別",json:"JSON",html:"HTML",categoryInfo:{title:"カテゴリの役割について",common:{title:"共通",description:"サイト全体で共有されるパーツ・画像を想定しています。すべてのページで使用できる想定です。"},individual:{title:"個別",description:"ページタイプごとに共有されるパーツ・画像を想定しています。同じページタイプのすべてのページで使用できる想定です。"},special:{title:"特別",description:"動的ページ(例:店舗ごと、商品ごと)や特定の条件で使用されるパーツ・画像を想定しています。ルートモデルバインディングなどで動的に生成されるページで使用できる想定です。"}}},contextMenu:{edit:"編集",add:"追加",reorder:"並べ替え",delete:"削除",close:"閉じる"},editor:{pageManagement:"ページ管理",partsManagement:"パーツ管理",imagesManagement:"画像管理",dataViewer:"データビューアー",loading:"データを読み込み中..."}},FN={common:{close:"Close",save:"Save",cancel:"Cancel",delete:"Delete",edit:"Edit",add:"Add",reorder:"Reorder",preview:"Preview",settings:"Settings",manage:"Manage",view:"View",confirm:"Confirm",clear:"Clear",select:"Select",replace:"Replace",copy:"Copy",copied:"Copied"},toolbar:{editMode:"Edit",addMode:"Add",reorderMode:"Reorder",deleteMode:"Delete",viewMode:"View",settings:"Settings"},settings:{title:"Settings",language:{label:"Language",ja:"Japanese",en:"English"},enableDynamicContent:"Enable page interactions",enableDynamicContentDescription:"Enables interactions for dynamic content such as accordions, tabs, modals, and links.",devRightPadding:"Add padding for edit panel",devRightPaddingDescription:"Adds right padding to content when the edit panel is displayed.",enableContextMenu:"Enable right-click menu",enableContextMenuDescription:"Right-clicking on content displays a menu to switch between edit, add, reorder, and delete modes.",showSaveConfirm:"Show save confirmation dialog",showSaveConfirmDescription:"Displays a dialog to confirm save targets when clicking the save button.",previewModeInfo:"Dynamic content (accordions, tabs, modals, links, etc.) is always enabled in preview mode.",noSettings:"No settings available."},emptyState:{message:"Please add a part",addPart:"+ Add Part"},addPanel:{title:"Add",selectParent:"Select parent element",category:{common:"Common",individual:"Individual",selected:"Selected part"},typeAll:"all",activeParts:"active parts",activePartsDescription:"You can add the part clicked in the preview area with its current data included.",clickPartInPreview:"Please click a part in the preview area",noPartsAvailable:"No parts available",addBefore:"Add before",addAfter:"Add after",continueAdding:"Continue adding parts"},editPanel:{title:"Editing",editing:"Editing: {type}",id:"ID: {id}",selectImage:"Select image",replaceImage:"Replace",clearImage:"Clear",clearImageTitle:"Clear image",noFields:"No editable fields available"},deletePanel:{title:"Delete confirmation",confirmMessage:"Do you want to delete this part?",selectParent:"Select parent element"},reorderPanel:{title:"Reorder: Source selected",instruction:"Click the destination element",source:"Source: {path}",selectParent:"Select parent element"},saveConfirm:{title:"Save confirmation",message:"Do you want to save the following data?",simpleMessage:"Do you want to save?",targets:{page:"Page data","parts-common":"Parts (Common)","parts-individual":"Parts (Individual)","parts-special":"Parts (Special)","images-common":"Images (Common)","images-individual":"Images (Individual)","images-special":"Images (Special)","parts-common-css":"CSS (Common)","parts-individual-css":"CSS (Individual)","parts-special-css":"CSS (Special)"},saveButton:"Save"},partsManager:{createType:"Create new type",editType:"Edit type",typeName:"Type name",typeDescription:"Description",typeNamePlaceholder:"Example: hero, features",typeDescriptionPlaceholder:"Type description",editPart:"Edit part: {title}",partTitle:"Title",partDescription:"Description",partDescriptionPlaceholder:"Part description",deletePartConfirm:`Do you want to delete part {number}?
|
|
464
|
+
(Other parts in the type will remain)`,deleteTypeConfirm:"Do you want to delete this type?",deleteTypeWithUsagesConfirm:'Type "{type}" is used in {count} places. Do you want to delete it?',deleteSlotConfirm:'Do you want to delete slot "{slotName}"?',selectImage:"Select image",addPart:"Add part",editTypeButton:"Edit type",reorderType:"Reorder type",deleteTypeButton:"Delete this type (all parts included)",editPartButton:"Edit part",reorderPart:"Reorder",deletePartButton:"Delete",source:"Source",noDescription:"No description",partNumber:"Part {current} / {total}",allowedParts:"Allowed parts",searchParts:"Search parts...",addSlot:"Add slot",selectSlot:"Select slot...",defaultSlot:"Default slot",codeEdit:"Code editor",cssEditInfo:"About CSS editing",templateSuggestions:"Template suggestions",preview:"Preview:",cssEditWarning:"About CSS editing",cssEditWarningMessageCommon:"CSS edited here is intended to apply to all pages. If existing CSS files (e.g., common.css) exist, they may be overwritten.",cssEditWarningMessageIndividual:"CSS edited here is intended to apply per page type. If existing CSS files (e.g., page.css) exist, they may be overwritten.",cssEditWarningMessageSpecial:"CSS edited here is intended to apply per dynamic page. If existing CSS files (e.g., shop111.css) exist, they may be overwritten.",dontShowAgain:"Don't show again",templateHelp:{textField:"Text field",richText:"Rich text",textarea:"Multi-line text",image:"Image selection",radio:"Radio button",checkbox:"Checkbox",selectSingle:"Select box (single)",selectMultiple:"Select box (multiple)",conditional:"Conditional (show/hide)",tag:"Tag selection",slot:"Slot (child insertion)",note:"Note",suggestionNote:"When template suggestions are enabled, autocomplete will appear when typing <code>$</code>, <code>(</code>, or <code>z</code>",fieldNameNote:"Field names can use alphanumeric characters and underscores",defaultValueNote:"Default values are optional (will be empty string if omitted)"},validationError:"Error:",dangerousTagWarning:"<{tag}> tag is included.",dangerousAttrWarning:"{attr} attribute is included.",slotSettings:"Slot settings",slot:"Slot",templateHelpTitle:"Template Syntax Help",clickToEnlarge:"Click to enlarge",displayPreview:"Display preview",editPanelPreview:"Edit panel preview",editPanelPreviewNoFields:"No editable fields",editPanelPreviewDesc:"List of fields shown in the edit panel when editing a page.",understood:"Understood",syntax:"Syntax",description:"Description",example:"Example",templateHelpButton:"Template syntax help"},imagesManager:{addImage:"Add image",editImage:"Edit image",imageId:"Image ID",imageName:"Image name",altText:"Alt attribute",deleteImageConfirm:"Do you want to delete this image?",deleteImageWithUsagesConfirm:"This image is used in {count} places. Do you want to delete it?",deleteImageFromModalConfirm:"Do you want to delete this image?",addImageFailed:"Failed to add image",selectImage:"Select image",currentlySelected:"Currently selected",select:"Select"},dataViewer:{page:"Page",parts:"Parts",images:"Images",common:"Common",individual:"Individual",special:"Special",json:"JSON",html:"HTML",categoryInfo:{title:"About Category Roles",common:{title:"Common",description:"Intended for parts and images shared across the entire site. Assumed to be usable on all pages."},individual:{title:"Individual",description:"Intended for parts and images shared per page type. Assumed to be usable on all pages of the same page type."},special:{title:"Special",description:"Intended for parts and images used for dynamic pages (e.g., per store, per product) or under specific conditions. Assumed to be usable on pages dynamically generated with route model binding, etc."}}},contextMenu:{edit:"Edit",add:"Add",reorder:"Reorder",delete:"Delete",close:"Close"},editor:{pageManagement:"Page Management",partsManagement:"Parts Management",imagesManagement:"Images Management",dataViewer:"Data Viewer",loading:"Loading data...",saveFailed:"Save failed",saveFailedWithCount:"Save failed ({count} items)",saveFailedWithMessage:"Save failed ({count} items): {message}",noSaveTargets:"No save targets"}};function jN(n="ja"){return py({locale:n,fallbackLocale:"ja",messages:{ja:BN,en:FN},globalInjection:!0})}const Uh={UNDEFINED_PROPERTIES:"Cannot read properties of undefined",APP_REFERENCE:"app"};function Wh(){if(typeof window>"u")return;const n=window;n.__zcodeI18nErrorHandlerSetup||(window.addEventListener("unhandledrejection",e=>{if(e.reason&&typeof e.reason=="object"&&"message"in e.reason){const t=String(e.reason.message);if(t.includes(Uh.UNDEFINED_PROPERTIES)&&t.includes(Uh.APP_REFERENCE)){e.preventDefault();return}}}),n.__zcodeI18nErrorHandlerSetup=!0)}function HN(){if(typeof window>"u")return;const n=window;n.__VUE_I18N_FULL_INSTALL__=!1,n.__INTLIFY_PROD_DEVTOOLS__=!1,n.__VUE_I18N_PROD_DEVTOOLS__=!1}function Os(n,e="ja"){const t=eb(null);if(t)return t;const o=n.getAttribute("locale");return o==="ja"||o==="en"?o:e}function Ds(n,e){HN();const t=jN(e);try{n.use(t)}catch(o){console.warn("[ZeroCode] Failed to setup i18n:",o)}}Wh();class UN extends HTMLElement{app=null;componentInstance=null;_shadowRoot=null;constructor(){super()}connectedCallback(){if(this.app)return;this.getAttribute("use-shadow-dom")!=="false"?(this.setupShadowDOM(),window.addEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this))):(this.setupLightDOM(),window.addEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this)))}setupLightDOM(){const e=this.getAttribute("page")||"[]",t=this.getAttribute("css-common"),o=this.getAttribute("css-individual"),r=this.getAttribute("css-special"),i=this.getAttribute("parts-common")||"[]",a=this.getAttribute("parts-individual")||"[]",l=this.getAttribute("parts-special")||"[]",c=this.getAttribute("images-common")||"[]",d=this.getAttribute("images-individual")||"[]",u=this.getAttribute("images-special")||"[]",f=Array.from(this.querySelectorAll('[slot="script"]'));f.length>0&&(this.__savedScriptSlots=f.map(h=>({src:h.src,type:h.type,async:h.async,defer:h.defer,integrity:h.integrity,crossOrigin:h.crossOrigin})));const p=Os(this);this.app=s.createApp(_s,{locale:p,page:e,cssCommon:t,cssIndividual:o,cssSpecial:r,partsCommon:i,partsIndividual:a,partsSpecial:l,imagesCommon:c,imagesIndividual:d,imagesSpecial:u,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||""}),Ds(this.app,p),this.componentInstance=this.app.mount(this),this.injectLightDOMCSS()}setupShadowDOM(){const e=this.shadowRoot,t=!!e;e?(this._shadowRoot=e,this.clearScripts()):(this._shadowRoot=this.attachShadow({mode:"open"}),this.injectCSS());const o=this.getAttribute("page")||"[]",r=this.getAttribute("css-common"),i=this.getAttribute("css-individual"),a=this.getAttribute("css-special"),l=this.getAttribute("parts-common")||"[]",c=this.getAttribute("parts-individual")||"[]",d=this.getAttribute("parts-special")||"[]",u=this.getAttribute("images-common")||"[]",f=this.getAttribute("images-individual")||"[]",p=this.getAttribute("images-special")||"[]",h=Os(this);this.app=s.createApp(_s,{locale:h,page:o,cssCommon:r,cssIndividual:i,cssSpecial:a,partsCommon:l,partsIndividual:c,partsSpecial:d,imagesCommon:u,imagesIndividual:f,imagesSpecial:p,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||""}),Ds(this.app,h),this.componentInstance=this.app.mount(this._shadowRoot),requestAnimationFrame(()=>{requestAnimationFrame(()=>{setTimeout(()=>{this.injectScript(t)},100)})})}injectCSS(){if(!this._shadowRoot)return;const e=document.createElement("style");e.textContent=Hh,this._shadowRoot.appendChild(e),this.querySelectorAll('[slot="css"]').forEach(o=>{const r=o.cloneNode(!0);r.removeAttribute("slot"),this._shadowRoot.appendChild(r),o.remove()})}injectLightDOMCSS(){this.querySelectorAll('[slot="css"]').forEach(t=>{const o=t.cloneNode(!0);o.removeAttribute("slot"),document.head.appendChild(o)})}clearScripts(){if(!this._shadowRoot)return;this._shadowRoot.querySelectorAll("script").forEach(t=>{t.remove()})}injectScript(e=!1){if(!this._shadowRoot)return;const t=this.querySelectorAll('[slot="script"]'),o=Array.from(t),r=[],i=[];o.forEach(c=>{const d=c;if(!d.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}d.src.includes("jquery")||d.src.includes("code.jquery.com")?r.push(d):i.push(d)});const a=c=>{let d=c.src;if(e)try{const f=new URL(c.src,window.location.href);f.searchParams.set("_t",Date.now().toString()),d=f.toString()}catch{d=c.src+(c.src.includes("?")?"&":"?")+"_t="+Date.now()}const u=document.createElement("script");return u.src=d,c.type&&(u.type=c.type),c.async&&(u.async=!0),c.defer&&(u.defer=!0),c.integrity&&(u.integrity=c.integrity),c.crossOrigin&&(u.crossOrigin=c.crossOrigin),u.onerror=f=>{console.error(`Failed to load script: ${c.src}`,f)},u},l=()=>{o.forEach(c=>{c.remove()})};if(r.length>0){let c=0;const d=r.length;r.forEach(u=>{const f=a(u);f.onload=()=>{c++,c===d&&(_o(this._shadowRoot,e),setTimeout(()=>{i.forEach(p=>{this._shadowRoot.appendChild(a(p))}),l()},50))},this._shadowRoot.appendChild(f)})}else _o(this._shadowRoot,e),i.forEach(c=>{this._shadowRoot.appendChild(a(c))}),l()}injectLightDOMScripts(){let e=[];if(this.__savedScriptSlots&&this.__savedScriptSlots.length>0)e=this.__savedScriptSlots.map(i=>{const a=document.createElement("script");return a.src=i.src,i.type&&(a.type=i.type),i.async&&(a.async=!0),i.defer&&(a.defer=!0),i.integrity&&(a.integrity=i.integrity),i.crossOrigin&&(a.crossOrigin=i.crossOrigin),a});else{const i=this.querySelectorAll('[slot="script"]');e=Array.from(i)}const t=[],o=[];e.forEach(i=>{const a=i;if(!a.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}a.src.includes("jquery")||a.src.includes("code.jquery.com")?t.push(a):o.push(a)});const r=i=>{const a=document.createElement("script");return a.src=i.src,i.type&&(a.type=i.type),i.async&&(a.async=!0),i.defer&&(a.defer=!0),i.integrity&&(a.integrity=i.integrity),i.crossOrigin&&(a.crossOrigin=i.crossOrigin),a.onerror=l=>{console.error(`Failed to load script: ${i.src}`,l)},a};if(t.length>0){let i=0;const a=t.length;t.forEach(l=>{const c=r(l);c.onload=()=>{i++,i===a&&requestAnimationFrame(()=>{o.forEach(d=>{document.body.appendChild(r(d))})})},document.body.appendChild(c)})}else o.forEach(i=>{document.body.appendChild(r(i))})}getData(e){return this.componentInstance&&this.componentInstance.getData?this.componentInstance.getData(e):null}setData(e,t){return this.componentInstance&&this.componentInstance.setData?this.componentInstance.setData(e,t):!1}get allowDynamicContentInteraction(){if(this.componentInstance){const e=this.componentInstance.allowDynamicContentInteraction;if(e!==void 0)return e&&typeof e=="object"&&"value"in e?e.value:e}return!0}set allowDynamicContentInteraction(e){if(this.componentInstance){const t=this.componentInstance.allowDynamicContentInteraction;t!==void 0&&(t&&typeof t=="object"&&"value"in t?t.value=e:this.componentInstance.allowDynamicContentInteraction=e)}}disconnectedCallback(){if(this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot){if(this._shadowRoot.__zecEventListeners){const e=this._shadowRoot.__zecEventListeners,t=this._shadowRoot;e.forEach(o=>{o.forEach(r=>{t.removeEventListener(r.eventName,r.handler,!0)})}),e.clear()}if(window.__zecShadowRoots){const e=window.__zecShadowRoots,t=this._shadowRoot;for(const[o,r]of e.entries())r===t&&e.delete(o)}}this._shadowRoot=null,window.removeEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this)),window.removeEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this))}handleDOMUpdated(){if(!this._shadowRoot||this.getAttribute("use-shadow-dom")!=="true")return;this._shadowRoot.__zecJQueryExtended&&delete this._shadowRoot.__zecJQueryExtended;const e=this._shadowRoot.querySelector("script[data-zec-shadow-extension]");e&&e.remove(),_o(this._shadowRoot,!0)}handleLightDOMUpdated(){this.getAttribute("use-shadow-dom")!=="true"&&(this.__lightDOMScriptsLoaded||(this.injectLightDOMScripts(),this.__lightDOMScriptsLoaded=!0))}static get observedAttributes(){return["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data","use-shadow-dom"]}attributeChangedCallback(e,t,o){if(t!==o){if(e==="use-shadow-dom"){this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot&&(this._shadowRoot.innerHTML="",this._shadowRoot=null),this.connectedCallback();return}this.app&&(this.app.unmount(),this.app=null,this.componentInstance=null,this.connectedCallback())}}}customElements.get("zcode-cms")||customElements.define("zcode-cms",UN);function WN(n){const{t:e}=Vt(),t=s.ref("common"),o=s.ref(null),r=s.ref(null),i=s.ref(null),a=s.ref(null),l=s.ref(!1),c=s.ref(null),d=s.ref(null),{renderComponentToHtml:u}=pi(n,!1),f=s.computed(()=>{const C=n.parts;return t.value==="common"?C.common:t.value==="individual"?C.individual:C.special}),p=s.computed(()=>{const C=f.value,L=new Map;return C.forEach(V=>{L.has(V.type)||L.set(V.type,[]),V.parts.forEach((S,N)=>{L.get(V.type).push({type:V,partIndex:N})})}),Array.from(L.entries()).map(([V,S])=>({type:V,parts:S.map(N=>({...N.type,_partIndex:N.partIndex,_displayPart:N.type.parts[N.partIndex]}))}))});function h(){const C=n.parts;return t.value==="common"?C.common:t.value==="individual"?C.individual:C.special}function m(C){return f.value.find(L=>L.type===C)||null}function g(C){return i.value&&i.value.partIndex===C&&i.value.part.slots||null}function y(C,L,V){if(i.value&&i.value.partIndex===C){const S=i.value.part;return S.slots||(S.slots={}),V(S.slots),!0}return!1}function b(C){const L={};return C.forEach(V=>{if(V.optional)L[V.fieldName]=void 0;else switch(V.type){case"text":L[V.fieldName]=V.defaultValue||"";break;case"radio":L[V.fieldName]=V.options?.[0]||"";break;case"checkbox":L[V.fieldName]=[];break;case"boolean":L[V.fieldName]=!0;break;case"rich":L[V.fieldName]=V.defaultValue?`<p>${V.defaultValue}</p>`:"<p></p>";break;case"image":L[V.fieldName]=V.defaultValue||"";break}}),L}function z(C){o.value=C,r.value=null,l.value=!1}function w(){r.value=s.reactive({id:Un(),type:"",description:"",parts:[{id:Un(),title:"part_1",description:"",body:"<div>{$content:コンテンツを入力}</div>"}]}),a.value="type",l.value=!0,o.value=null}function T(C){r.value=s.reactive(JSON.parse(JSON.stringify(C))),a.value="type",l.value=!1,o.value=C}function A(C,L){const V=C.parts[L];if(!V)return;const S=JSON.parse(JSON.stringify(V));S.slots||(S.slots={}),i.value={type:s.reactive(JSON.parse(JSON.stringify(C))),partIndex:L,part:s.reactive(S)},a.value="part"}async function M(C){const L=m(C.type);if(!L)return;const V=s.reactive(JSON.parse(JSON.stringify(L))),S={id:Un(),title:`part_${V.parts.length+1}`,description:"",body:"<div>{$content:コンテンツを入力}</div>"};V.parts.push(S);const N=V.parts.length-1;await s.nextTick(),i.value={type:V,partIndex:N,part:s.reactive(JSON.parse(JSON.stringify(S))),isNewPart:!0},a.value="part"}async function k(){if(!r.value)return;const C=Re(r.value);if(!C.valid){alert(e("partsManager.validationError")+`
|
|
469
465
|
`+C.errors.join(`
|
|
470
|
-
`));return}const
|
|
466
|
+
`));return}const L=JSON.parse(JSON.stringify(s.toRaw(r.value))),V=h();if(l.value)V.push(L);else{const S=V.findIndex(N=>N.id===r.value.id);S!==-1&&(V[S]=L)}await s.nextTick(),f.value,p.value,r.value=null,a.value=null,l.value=!1}function E(C){const L=[],V=C.toLowerCase(),S=["script","iframe","object","embed"],N=["onclick","onerror","onload","onmouseover","onfocus","onblur"];return S.forEach(F=>{V.includes(`<${F}`)&&L.push(e("partsManager.dangerousTagWarning",{tag:F}))}),N.forEach(F=>{V.includes(`${F}=`)&&L.push(e("partsManager.dangerousAttrWarning",{attr:F}))}),{hasWarning:L.length>0,messages:L}}async function x(){if(!i.value)return;const C=i.value.part.body||"",L=E(C);if(L.hasWarning&&!confirm(`テンプレートにセキュリティ上注意が必要な記述が含まれています。
|
|
471
467
|
|
|
472
|
-
${
|
|
468
|
+
${L.messages.join(`
|
|
473
469
|
`)}
|
|
474
470
|
|
|
475
|
-
このまま保存しますか?`))return;const
|
|
476
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
471
|
+
このまま保存しますか?`))return;const V=h(),S=V.findIndex(ne=>ne.id===i.value.type.id);if(S===-1)return;const N=V[S],F=JSON.parse(JSON.stringify(s.toRaw(i.value.part)));i.value.isNewPart?N.parts.push(F):N.parts[i.value.partIndex]=F,await s.nextTick(),f.value,p.value,i.value=null,a.value=null}function B(C){const L=f.value.find(V=>V.id===C.id);if(L){if(C._partIndex!==void 0&&C._partIndex!==null)if(L.parts.length>1)L.parts.splice(C._partIndex,1);else{const V=f.value.findIndex(S=>S.id===C.id);V!==-1&&f.value.splice(V,1)}else{const V=f.value.findIndex(S=>S.id===C.id);V!==-1&&f.value.splice(V,1)}o.value=null,r.value=null}}function $(C){const L=[],V=(S,N)=>{const F=S.part_id,ne=n.parts,me=[...ne.common,...ne.individual];for(const De of me)if(De.parts.find(v=>v.id===F)&&De.type===C){L.push({path:N,component:S});break}S.slots&&Object.entries(S.slots).forEach(([De,Te])=>{Array.isArray(Te)&&Te.forEach((v,I)=>{V(v,`${N}.slots.${De}.${I}`)})})};return n.page.forEach((S,N)=>{V(S,`page.${N}`)}),L}function O(C,L){const V=Hn(L.body),S=b(V),N={id:"preview",part_id:L.id,...S},F=new Set;F.add(`${C.id}:${L.id}`);const ne=L.slots;if(ne){const me={};Object.entries(ne).forEach(([De,Te])=>{const v=Te.allowedParts;if(v&&v.length>0){const I=v[v.length-1],J=n.parts,he=[...J.common,...J.individual];let Ae=null,ye=null;for(const U of he){const Q=U.parts.find(ve=>ve.id===I);if(Q){Ae=U,ye=Q;break}}if(Ae&&ye){const U=D(Ae,ye.id,F);me[De]=[U]}else me[De]=[]}else me[De]=[]}),Object.keys(me).length>0&&(N.slots=me)}return N}function D(C,L,V=new Set){const S=L&&C.parts.find(Te=>Te.id===L)||C.parts[0];if(!S)throw new Error(`Part not found for type: ${C.type}`);const N=`${C.id}:${S.id}`;if(V.has(N)){const Te=Hn(S.body),v=b(Te);return{id:"preview",part_id:S.id,...v}}V.add(N);const F=Hn(S.body),ne=b(F),me={id:"preview",part_id:S.id,...ne},De=S.slots;if(De){const Te={};Object.entries(De).forEach(([v,I])=>{const J=I.allowedParts;if(J&&J.length>0){const he=J[J.length-1],Ae=n.parts,ye=[...Ae.common,...Ae.individual];let U=null,Q=null;for(const ve of ye){const Le=ve.parts.find(dt=>dt.id===he);if(Le){U=ve,Q=Le;break}}if(U&&Q){const ve=D(U,Q.id,V);Te[v]=[ve]}else Te[v]=[]}else Te[v]=[]}),Object.keys(Te).length>0&&(me.slots=Te)}return me}function P(C,L){if(!L)return"";const V=O(C,L);return fi(L.body,V,"",S=>{const N=n.parts,F=[...N.common,...N.individual,...N.special];for(const ne of F){const me=ne.parts.find(De=>De.id===S);if(me)return me}return null},(S,N)=>u(S,N),!1,n.images.common,n.images.individual,n.images.special)}function q(C){const L=[];try{const N=new DOMParser().parseFromString(`<template>${C}</template>`,"text/html").querySelector("template");if(!N)return L;N.content.querySelectorAll("[z-slot]").forEach(ne=>{const me=ne.getAttribute("z-slot")||"default";L.includes(me)||L.push(me)})}catch(V){console.error("Failed to parse template:",V)}return L}function W(C){if(i.value&&i.value.partIndex===C){const L=i.value.part.body,V=q(L),S=Object.keys(i.value.part.slots||{});return V.filter(N=>!S.includes(N))}return[]}function R(C,L){let V=L||null;if(!V&&(V=prompt("スロット名を入力してください:"),!V?.trim()))return;y(C,V.trim(),N=>{if(N[V.trim()]){alert("このスロット名は既に存在します");return}N[V.trim()]={}})||alert("パーツが見つかりません")}function K(C,L){g(C)?.[L]&&confirm(`スロット「${L}」を削除しますか?`)&&y(C,L,S=>{delete S[L]})}function X(C,L,V){y(C,L,N=>{N[L]&&(N[L].allowedParts=V)})||console.warn(`Failed to update allowed parts for slot ${L}`)}function te(C,L){if(!c.value){c.value={type:C.type,partIndex:L};return}if(c.value.type===C.type&&c.value.partIndex===L){Z();return}const V=c.value,S={type:C.type,partIndex:L};if(!oe(V,S)){alert("同じタイプ内のパーツのみ並べ替えできます"),Z();return}G(V,S),Z()}function oe(C,L){return!(C.type!==L.type||C.partIndex===L.partIndex)}function G(C,L){const V=h(),S=V.findIndex(me=>me.type===C.type);if(S===-1)return;const F=V[S].parts,[ne]=F.splice(C.partIndex,1);F.splice(L.partIndex,0,ne)}function Z(){c.value=null}function Y(C){const L=h(),V=$(C);if(V.length>0){if(!confirm(`タイプ「${C}」は${V.length}箇所で使用されています。削除しますか?`))return}else if(!confirm(`タイプ「${C}」を削除しますか?`))return;for(let S=L.length-1;S>=0;S--)L[S].type===C&&L.splice(S,1)}function ee(C,L){if(C===L)return;const V=h(),S=new Map,N=[];V.forEach(Te=>{S.has(Te.type)||(S.set(Te.type,[]),N.push(Te.type)),S.get(Te.type).push(Te)});const F=N.map(Te=>({type:Te,types:S.get(Te)})),ne=F.findIndex(Te=>Te.type===C),me=F.findIndex(Te=>Te.type===L);if(ne===-1||me===-1)return;const[De]=F.splice(ne,1);F.splice(me,0,De),V.splice(0,V.length),F.forEach(Te=>{Te.types.forEach(v=>V.push(v))})}function le(C){if(!d.value){d.value=C;return}if(d.value===C){d.value=null;return}ee(d.value,C),d.value=null}function ge(){r.value=null,a.value=null,l.value=!1}function Ne(){i.value=null,a.value=null}function Re(C){const L=[];if(!C.type||C.type.trim()==="")L.push("タイプ名は必須です");else if(l.value){const V=n.parts;[...V.common,...V.individual].some(F=>F.type===C.type.trim())&&L.push(`タイプ「${C.type}」は既に存在します`)}return!C.parts||C.parts.length===0?L.push("最低1つのパーツが必要です"):C.parts.forEach((V,S)=>{(!V.title||V.title.trim()==="")&&L.push(`パーツ ${S+1} のタイトルは必須です`),(!V.body||V.body.trim()==="")&&L.push(`パーツ ${S+1} のテンプレートは必須です`)}),{valid:L.length===0,errors:L}}return{reorderSourcePart:c,handleReorderClick:te,canReorderParts:oe,cancelReorder:Z,activeCategory:t,selectedType:o,editingType:r,editingPart:i,editingLevel:a,isCreatingNew:l,currentTypes:f,groupedPartsByType:p,selectType:z,startCreating:w,startEditingType:T,startEditingPart:A,addPartToType:M,saveType:k,savePart:x,deletePart:B,checkTypeUsage:$,cancelEditingType:ge,cancelEditingPart:Ne,getPartPreviewHtml:P,createTempComponentFromType:O,validateType:Re,addPartSlot:R,removePartSlot:K,updatePartSlotAllowedParts:X,getAvailableSlotsForPart:W,extractSlotsFromTemplate:q,reorderSourceType:d,startReorderType:le,deletePartType:Y}}function qh(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,o=Array(e);t<e;t++)o[t]=n[t];return o}function qN(n){if(Array.isArray(n))return n}function GN(n,e,t){return(e=ev(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function KN(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var o,r,i,a,l=[],c=!0,d=!1;try{if(i=(t=t.call(n)).next,e!==0)for(;!(c=(o=i.call(t)).done)&&(l.push(o.value),l.length!==e);c=!0);}catch(u){d=!0,r=u}finally{try{if(!c&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(d)throw r}}return l}}function JN(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
472
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gh(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,o)}return t}function Kh(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Gh(Object(t),!0).forEach(function(o){GN(n,o,t[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Gh(Object(t)).forEach(function(o){Object.defineProperty(n,o,Object.getOwnPropertyDescriptor(t,o))})}return n}function XN(n,e){if(n==null)return{};var t,o,r=YN(n,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);for(o=0;o<i.length;o++)t=i[o],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(r[t]=n[t])}return r}function YN(n,e){if(n==null)return{};var t={};for(var o in n)if({}.hasOwnProperty.call(n,o)){if(e.indexOf(o)!==-1)continue;t[o]=n[o]}return t}function QN(n,e){return qN(n)||KN(n,e)||tv(n,e)||JN()}function ZN(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var o=t.call(n,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function ev(n){var e=ZN(n,"string");return typeof e=="symbol"?e:e+""}function tv(n,e){if(n){if(typeof n=="string")return qh(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?qh(n,e):void 0}}function nv(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jh(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,o)}return t}function Xh(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Jh(Object(t),!0).forEach(function(o){nv(n,o,t[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Jh(Object(t)).forEach(function(o){Object.defineProperty(n,o,Object.getOwnPropertyDescriptor(t,o))})}return n}function ov(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return function(o){return e.reduceRight(function(r,i){return i(r)},o)}}function Ur(n){return function e(){for(var t=this,o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return r.length>=n.length?n.apply(this,r):function(){for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return e.apply(t,[].concat(r,l))}}}function Ps(n){return{}.toString.call(n).includes("Object")}function rv(n){return!Object.keys(n).length}function Wr(n){return typeof n=="function"}function iv(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function sv(n,e){return Ps(e)||lo("changeType"),Object.keys(e).some(function(t){return!iv(n,t)})&&lo("changeField"),e}function av(n){Wr(n)||lo("selectorType")}function lv(n){Wr(n)||Ps(n)||lo("handlerType"),Ps(n)&&Object.values(n).some(function(e){return!Wr(e)})&&lo("handlersType")}function cv(n){n||lo("initialIsRequired"),Ps(n)||lo("initialType"),rv(n)&&lo("initialContent")}function dv(n,e){throw new Error(n[e]||n.default)}var uv={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},lo=Ur(dv)(uv),Rs={changes:sv,selector:av,handler:lv,initial:cv};function fv(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Rs.initial(n),Rs.handler(e);var t={current:n},o=Ur(mv)(t,e),r=Ur(hv)(t),i=Ur(Rs.changes)(n),a=Ur(pv)(t);function l(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(u){return u};return Rs.selector(d),d(t.current)}function c(d){ov(o,r,i,a)(d)}return[l,c]}function pv(n,e){return Wr(e)?e(n.current):e}function hv(n,e){return n.current=Xh(Xh({},n.current),e),e}function mv(n,e,t){return Wr(e)?e(n.current):Object.keys(t).forEach(function(o){var r;return(r=e[o])===null||r===void 0?void 0:r.call(e,n.current[o])}),t}var gv={create:fv},yv={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function bv(n){return function e(){for(var t=this,o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return r.length>=n.length?n.apply(this,r):function(){for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return e.apply(t,[].concat(r,l))}}}function xv(n){return{}.toString.call(n).includes("Object")}function kv(n){return n||Qh("configIsRequired"),xv(n)||Qh("configType"),n.urls?(Ev(),{paths:{vs:n.urls.monacoBase}}):n}function Ev(){console.warn(Yh.deprecation)}function wv(n,e){throw new Error(n[e]||n.default)}var Yh={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
477
473
|
You are using deprecated way of configuration.
|
|
478
474
|
|
|
479
475
|
Instead of using
|
|
@@ -482,9 +478,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
482
478
|
monaco.config({ paths: { vs: '...' } })
|
|
483
479
|
|
|
484
480
|
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
485
|
-
`},Im=IT(PT)(Mm),LT={config:DT},$T=function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return function(r){return n.reduceRight(function(i,s){return s(i)},r)}};function Om(t,e){return Object.keys(e).forEach(function(n){e[n]instanceof Object&&t[n]&&Object.assign(e[n],Om(t[n],e[n]))}),zm(zm({},t),e)}var VT={type:"cancelation",msg:"operation is manually canceled"};function Nc(t){var e=!1,n=new Promise(function(o,r){t.then(function(i){return e?r(VT):o(i)}),t.catch(r)});return n.cancel=function(){return e=!0},n}var BT=["monaco"],FT=AT.create({config:MT,isInitialized:!1,resolve:null,reject:null,monaco:null}),Dm=fT(FT,2),ti=Dm[0],Js=Dm[1];function jT(t){var e=LT.config(t),n=e.monaco,o=dT(e,BT);Js(function(r){return{config:Om(r.config,o),monaco:n}})}function UT(){var t=ti(function(e){var n=e.monaco,o=e.isInitialized,r=e.resolve;return{monaco:n,isInitialized:o,resolve:r}});if(!t.isInitialized){if(Js({isInitialized:!0}),t.monaco)return t.resolve(t.monaco),Nc(Cc);if(window.monaco&&window.monaco.editor)return Rm(window.monaco),t.resolve(window.monaco),Nc(Cc);$T(HT,GT)(qT)}return Nc(Cc)}function HT(t){return document.body.appendChild(t)}function WT(t){var e=document.createElement("script");return t&&(e.src=t),e}function GT(t){var e=ti(function(o){var r=o.config,i=o.reject;return{config:r,reject:i}}),n=WT("".concat(e.config.paths.vs,"/loader.js"));return n.onload=function(){return t()},n.onerror=e.reject,n}function qT(){var t=ti(function(n){var o=n.config,r=n.resolve,i=n.reject;return{config:o,resolve:r,reject:i}}),e=window.require;e.config(t.config),e(["vs/editor/editor.main"],function(n){var o=n.m||n;Rm(o),t.resolve(o)},function(n){t.reject(n)})}function Rm(t){ti().monaco||Js({monaco:t})}function KT(){return ti(function(t){var e=t.monaco;return e})}var Cc=new Promise(function(t,e){return Js({resolve:t,reject:e})}),JT={config:jT,init:UT,__getMonacoInstance:KT};const XT={class:"monaco-editor-wrapper"},YT={key:0,class:"monaco-editor-error"},Pm=((t,e)=>{const n=t.__vccOpts||t;for(const[o,r]of e)n[o]=r;return n})(a.defineComponent({__name:"MonacoEditor",props:{modelValue:{type:String},language:{type:String},theme:{type:String},readOnly:{type:Boolean},minimap:{type:Boolean},height:{type:String},autoHeight:{type:Boolean},maxHeight:{type:Number},enableSuggestions:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,o=e,r=a.ref(null),i=a.ref(null);let s=null,l=null,c=!1,d=[];function u(){const p=r.value;if(!p)return;const h=p.getRootNode();if(!(h instanceof ShadowRoot))return;const m=h;Array.from(document.head.querySelectorAll('style, link[rel="stylesheet"]')).filter(x=>{if(x.tagName==="LINK"){const w=x.href||"";return w.includes("monaco")||w.includes("/vs/")||w.includes("vs/")}const v=x.textContent||"";return v.includes(".monaco-editor")||v.includes(".monaco-editor-background")}).forEach(x=>{if(x.tagName==="LINK"){const w=x.href;if(!!m.querySelector(`link[rel="stylesheet"][href="${w}"]`))return}else{const w=x.getAttribute("data-name")||"";if(w&&!!m.querySelector(`style[data-name="${w}"]`))return}const v=x.cloneNode(!0);v.setAttribute("data-zcode-monaco-style","true"),m.appendChild(v),d.push(v)})}function f(){if(!(!s||!r.value||!l)&&n.autoHeight!==!1)try{const p=s.getOption(l.editor.EditorOption.lineHeight)||19;let b=(s.getModel()?.getLineCount()||1)*p+20;n.maxHeight!==void 0&&(b=Math.min(b,n.maxHeight)),r.value.style.height=`${b}px`,s.layout()}catch{r.value.style.height="200px"}}return a.onMounted(async()=>{if(r.value)try{l=await JT.init(),u(),l.languages.registerCompletionItemProvider("html",{provideCompletionItems:(h,m)=>{const b=h.getWordUntilPosition(m),g={startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:b.startColumn,endColumn:b.endColumn},x=h.getValueInRange({startLineNumber:m.lineNumber,startColumn:Math.max(1,m.column-10),endLineNumber:m.lineNumber,endColumn:m.column}),v=[];return(x.endsWith("$")||x.endsWith("{$"))&&v.push({label:"{$field:default}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストフィールド: {$変数名:デフォルト値}",detail:"テンプレート記法 - テキスト",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:textarea}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:textarea}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストエリアフィールド: {$変数名:デフォルト値:textarea}",detail:"テンプレート記法 - テキストエリア",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:rich}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:rich}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"リッチテキストフィールド: {$変数名:デフォルト値:rich}",detail:"テンプレート記法 - リッチテキスト",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:image}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:image}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"画像フィールド: {$変数名:デフォルト値:image}",detail:"テンプレート記法 - 画像",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}}),(x.endsWith("(")||x.endsWith("$("))&&v.push({label:"($field:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"ラジオボタン: ($フィールド名:選択肢1|選択肢2)",detail:"テンプレート記法 - ラジオボタン",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"チェックボックス: ($フィールド名:選択肢1,選択肢2)",detail:"テンプレート記法 - チェックボックス",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field@:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(単一選択): ($フィールド名@:選択肢1|選択肢2)",detail:"テンプレート記法 - セレクトボックス",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field@:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(複数選択): ($フィールド名@:選択肢1,選択肢2)",detail:"テンプレート記法 - セレクトボックス(複数)",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}}),(x.endsWith("z-")||x.endsWith(" z-"))&&v.push({label:'z-if="show_xxx"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-if="show_${1:field}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"条件分岐: z-if属性(フィールドがtrueの場合に表示)",detail:"テンプレート記法 - 条件分岐",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-2,endColumn:m.column}},{label:'z-slot="slotName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-slot="${1:slotName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"スロット: z-slot属性(子コンポーネントを挿入する位置)",detail:"テンプレート記法 - スロット",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-2,endColumn:m.column}}),v.length===0&&v.push({label:"{$field:default}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストフィールド: {$変数名:デフォルト値}",detail:"テンプレート記法 - テキスト",range:g},{label:"{$field:default:rich}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:rich}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"リッチテキストフィールド: {$変数名:デフォルト値:rich}",detail:"テンプレート記法 - リッチテキスト",range:g},{label:"{$field:default:image}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:image}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"画像フィールド: {$変数名:デフォルト値:image}",detail:"テンプレート記法 - 画像",range:g},{label:"($field:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"ラジオボタン: ($フィールド名:選択肢1|選択肢2)",detail:"テンプレート記法 - ラジオボタン",range:g},{label:"($field:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"チェックボックス: ($フィールド名:選択肢1,選択肢2)",detail:"テンプレート記法 - チェックボックス",range:g},{label:"($field@:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(単一選択): ($フィールド名@:選択肢1|選択肢2)",detail:"テンプレート記法 - セレクトボックス",range:g},{label:"($field@:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(複数選択): ($フィールド名@:選択肢1,選択肢2)",detail:"テンプレート記法 - セレクトボックス(複数)",range:g},{label:'z-if="show_xxx"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-if="show_${1:field}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"条件分岐: z-if属性(フィールドがtrueの場合に表示)",detail:"テンプレート記法 - 条件分岐",range:g},{label:'z-tag="$tagName:h1|h2|h3"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-tag="$${1:tagName}:${2:h1|h2|h3}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"タグ名を動的に変更(選択肢を指定可能)",detail:"テンプレート記法 - タグ名の動的変更",range:g},{label:'z-empty="$fieldName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-empty="$${1:fieldName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"オプショナルフィールドが空の場合、親要素を削除",detail:"テンプレート記法 - 条件分岐(空の場合削除)",range:g},{label:'z-slot="slotName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-slot="${1:slotName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"スロット: z-slot属性(子コンポーネントを挿入する位置)",detail:"テンプレート記法 - スロット",range:g}),{suggestions:v}},triggerCharacters:["$","(","z"]});const p=n.enableSuggestions!==!1;s=l.editor.create(r.value,{value:n.modelValue||"",language:n.language||"html",theme:n.theme||"vs-dark",readOnly:n.readOnly||!1,minimap:{enabled:n.minimap===!0},automaticLayout:!0,fontSize:14,tabSize:2,wordWrap:"off",scrollBeyondLastLine:!1,formatOnPaste:!0,formatOnType:!0,lineNumbers:"on",folding:!0,suggestOnTriggerCharacters:p,quickSuggestions:p?{other:!0,comments:!1,strings:!0}:!1,acceptSuggestionOnCommitCharacter:p,acceptSuggestionOnEnter:p?"on":"off",suggestSelection:"first",mouseWheelScrollSensitivity:1,fastScrollSensitivity:5,scrollbar:{alwaysConsumeMouseWheel:!1}}),s.onDidChangeModelContent(()=>{if(!c){const h=s.getValue();o("update:modelValue",h),f()}}),f()}catch(p){i.value=`Monaco Editorの読み込みに失敗しました: ${p}`,console.error("Monaco Editor error:",p)}}),a.watch(()=>n.modelValue,async p=>{s&&s.getValue()!==p&&(c=!0,await a.nextTick(),s.setValue(p||""),c=!1,f())}),a.watch(()=>n.enableSuggestions,p=>{if(s&&l){const h=p!==!1;s.updateOptions({suggestOnTriggerCharacters:h,quickSuggestions:h?{other:!0,comments:!1,strings:!0}:!1,acceptSuggestionOnCommitCharacter:h,acceptSuggestionOnEnter:h?"on":"off"})}}),a.onUnmounted(()=>{s&&(s.dispose(),s=null),d.forEach(p=>p.remove()),d=[]}),(p,h)=>(a.openBlock(),a.createElementBlock("div",XT,[a.createElementVNode("div",{ref_key:"editorContainer",ref:r,class:"monaco-editor-container"},null,512),i.value?(a.openBlock(),a.createElementBlock("div",YT,a.toDisplayString(i.value),1)):a.createCommentVNode("",!0)]))}}),[["styles",[".monaco-editor-wrapper{width:100%}.monaco-editor-container{width:100%;min-height:100px;max-height:400px;border:1px solid #d1d5db;border-radius:4px;overflow:hidden}.monaco-editor-error{padding:8px;background:#fee;color:#c33;border-radius:4px;margin-top:8px;font-size:12px}"]]]),QT={class:"zcode-parts-manager"},ZT={class:"zcode-parts-category-tabs"},ez={class:"zcode-parts-category-tab-group"},tz=["onClick"],nz=["title"],oz={class:"zcode-parts-manager-content"},rz={class:"zcode-parts-items"},iz={class:"zcode-part-type-title",role:"heading","aria-level":"5"},sz={class:"zcode-part-type-actions"},az=["title","onClick"],lz=["title","onClick"],cz=["title","onClick"],dz={class:"zcode-part-type-items"},uz=["onClick"],fz={key:0,class:"zcode-reorder-source-indicator"},pz={class:"zcode-part-item-header"},hz={class:"zcode-part-type"},mz={class:"zcode-part-item-actions"},gz=["title","onClick"],bz=["title","onClick"],yz=["title","onClick"],xz={class:"zcode-part-item-content"},Ez={class:"zcode-part-modules"},kz={key:0,class:"zcode-part-preview"},wz=["innerHTML"],Sz=["onClick"],Nz={class:"zcode-part-item-add-content"},Cz={class:"zcode-part-editor-header"},vz={class:"zcode-part-editor-header-title",role:"heading","aria-level":"4"},Tz=["aria-label"],zz={class:"zcode-part-editor-form"},_z={class:"zcode-form-field"},Az=["placeholder"],Mz={class:"zcode-form-field"},Iz=["placeholder"],Oz={class:"zcode-part-editor-actions"},Dz={class:"zcode-part-editor-header"},Rz={class:"zcode-part-editor-header-title",role:"heading","aria-level":"4"},Pz=["aria-label"],Lz={class:"zcode-part-editor-form"},$z={class:"zcode-part-editor-topbar"},Vz={class:"zcode-part-editor-topfields"},Bz={class:"zcode-form-field"},Fz={class:"zcode-form-field"},jz=["placeholder"],Uz={class:"zcode-part-editor-main"},Hz={class:"zcode-part-editor-pane zcode-part-editor-pane--code"},Wz={class:"zcode-part-editor-pane-header"},Gz=["aria-label"],qz=["aria-selected"],Kz=["aria-selected"],Jz={class:"zcode-part-editor-pane-header-actions"},Xz={key:0,class:"zcode-css-warning-compact"},Yz={class:"zcode-css-warning-compact-text"},Qz=["title"],Zz={key:1,class:"zcode-checkbox-label zcode-checkbox-label-inline"},e_=["title"],t_={class:"zcode-part-editor-pane-body"},n_={class:"zcode-part-editor-pane zcode-part-editor-pane--side"},o_={class:"zcode-part-editor-pane-body"},r_=["innerHTML"],i_={class:"zcode-part-editor-preview-hint"},s_={key:0,class:"zcode-part-editor-slots-bottom"},a_={class:"zcode-slots-config"},l_={class:"zcode-slot-config-header"},c_={class:"zcode-slot-config-title"},d_=["onClick"],u_={class:"zcode-slot-config-body"},f_={class:"zcode-checkbox-group"},p_=["onUpdate:modelValue","placeholder"],h_=["checked","onChange"],m_={key:0,class:"zcode-slot-add-section"},g_={class:"zcode-slot-add-controls"},b_={value:""},y_=["value"],x_=["disabled"],E_={class:"zcode-part-editor-actions"},k_={class:"zcode-preview-modal-header"},w_={class:"zcode-preview-modal-header-title",role:"heading","aria-level":"4"},S_=["innerHTML"],N_={class:"zcode-help-modal-header"},C_={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},v_=["aria-label"],T_={class:"zcode-help-modal-body"},z_={class:"zcode-warning-content"},__={class:"zcode-warning-text"},A_={class:"zcode-warning-list"},M_={class:"zcode-css-warning-modal-footer"},I_={class:"zcode-checkbox-label",style:{"margin-bottom":"12px"}},O_={class:"zcode-help-modal-header"},D_={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},R_=["aria-label"],P_={class:"zcode-help-modal-body"},L_={class:"zcode-help-section"},$_={class:"zcode-help-section-title",role:"heading","aria-level":"4"},V_={class:"zcode-help-section-item"},B_={class:"zcode-help-section"},F_={class:"zcode-help-section-title",role:"heading","aria-level":"4"},j_={class:"zcode-help-section-item"},U_={class:"zcode-help-section"},H_={class:"zcode-help-section-title",role:"heading","aria-level":"4"},W_={class:"zcode-help-section-item"},G_={class:"zcode-help-modal-header"},q_={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},K_=["aria-label"],J_={class:"zcode-help-modal-body"},X_={class:"zcode-help-table"},Y_={class:"zcode-help-section"},Q_={class:"zcode-help-section-title",role:"heading","aria-level":"4"},Z_={role:"list",class:"zcode-help-section-list"},eA=["innerHTML"],tA={role:"listitem",class:"zcode-help-section-item"},nA={role:"listitem",class:"zcode-help-section-item"},oA=a.defineComponent({__name:"PartsManagerPanel",props:{cmsData:{type:Object},config:{type:Object}},setup(t,{expose:e}){const{t:n}=rn(),o=t,r=a.ref(!1),i=a.ref(m1("enableTemplateSuggestions",!1)),s=a.ref(!1),l=a.ref(!1),c=a.ref(!1),d=a.ref(g1()),u=a.ref("html"),f=a.ref(""),p=a.ref(""),h={common:"zcode-css-style-parts-manager-preview-common",individual:"zcode-css-style-parts-manager-preview-individual",special:"zcode-css-style-parts-manager-preview-special"},m=new Map,b=a.computed(()=>D.value==="common"?o.cmsData.css?.common??"":D.value==="individual"?o.cmsData.css?.individual??"":o.cmsData.css?.special??"");function g($){["common","individual","special"].forEach(re=>{const ae=$[re];if(!ae||!ae.trim()){const Fe=m.get(re);Fe&&(Fe.remove(),m.delete(re));return}let ke=m.get(re);ke||(ke=document.createElement("style"),ke.id=h[re],ke.setAttribute("data-zcode-css","true"),ke.setAttribute("data-zcode-css-parts-preview","true"),ke.setAttribute("data-zcode-css-category",re),ke.parentNode||document.head.appendChild(ke),m.set(re,ke)),ke.textContent=ae})}function x(){m.forEach($=>{$.remove()}),m.clear()}function v(){s.value=!0}function w(){s.value=!1}function T(){(D.value==="common"||D.value==="individual"||D.value==="special")&&(l.value=!0)}function M(){l.value=!1,b1(d.value)}a.watch(i,$=>{Ba({enableTemplateSuggestions:$})});const A=a.computed(()=>o.config?.categoryOrder||"common"),y=a.computed(()=>{const $=[],F=o.cmsData.parts.special.length>0;return A.value==="individual"?($.push("individual","common"),F&&$.push("special")):A.value==="special"?(F&&$.push("special"),$.push("common","individual")):($.push("common","individual"),F&&$.push("special")),$}),{reorderSourcePart:E,handleReorderClick:S,activeCategory:D,editingType:W,editingPart:z,editingLevel:P,isCreatingNew:V,groupedPartsByType:j,startCreating:L,startEditingType:H,startEditingPart:Q,addPartToType:G,saveType:se,savePart:Z,deletePart:X,checkTypeUsage:J,cancelEditingType:K,cancelEditingPart:Y,getPartPreviewHtml:ce,addPartSlot:Ee,removePartSlot:_e,updatePartSlotAllowedParts:Le,getAvailableSlotsForPart:C,extractSlotsFromTemplate:N,reorderSourceType:O,startReorderType:k,deletePartType:U}=iT(o.cmsData);o.config?.categoryOrder==="individual"&&(D.value="individual");const te=a.computed(()=>(P?.value??P)==="part"&&!!z.value);a.watch(()=>te.value,$=>{if(!$){x();return}a.nextTick(()=>{const F=b.value;p.value=F,f.value=F,g({common:o.cmsData.css?.common,individual:o.cmsData.css?.individual,special:o.cmsData.css?.special})})},{immediate:!0}),a.watch(()=>D.value,()=>{te.value&&a.nextTick(()=>{const $=b.value;p.value=$,f.value=$})}),a.watch([()=>f.value,()=>te.value,()=>D.value],([$,F,re])=>{F&&a.nextTick(()=>{const ae={common:o.cmsData.css?.common,individual:o.cmsData.css?.individual,special:o.cmsData.css?.special};re==="common"?ae.common=$??"":re==="individual"?ae.individual=$??"":ae.special=$??"",g(ae)})});async function me(){await Z(),!z.value&&o.cmsData.css&&(D.value==="common"?o.cmsData.css.common=f.value:D.value==="individual"?o.cmsData.css.individual=f.value:o.cmsData.css.special=f.value,p.value=f.value)}function ve(){f.value=p.value,x(),r.value=!1,Y()}a.onBeforeUnmount(()=>{x()}),a.watch(()=>z.value,$=>{$&&(u.value="html")}),a.watch(()=>u.value,$=>{$==="css"&&te.value&&(D.value==="common"||D.value==="individual"||D.value==="special")&&!d.value&&a.nextTick(()=>{T()})}),e({activeCategory:D});async function Ve(){await se()}const Ce=a.computed(()=>z.value?C(z.value.partIndex):[]),_=a.computed(()=>{if(!z.value)return!1;const $=z.value.part.body,F=$?N($).length>0:!1,re=z.value.part.slots&&Object.keys(z.value.part.slots).length>0;return F||re}),I=a.ref(""),q=()=>{!I.value||!z.value||(Ee(z.value.partIndex,I.value),I.value="")};a.watch(()=>z.value?.part.body,()=>{I.value=""});const fe=a.computed(()=>{const $=[],F=o.cmsData.parts;return[...F.common,...F.individual,...F.special||[]].forEach(ae=>{ae.parts.forEach(ke=>{$.push({id:ke.id,title:ke.title,typeName:ae.type,description:ke.description})})}),$.sort((ae,ke)=>ae.typeName!==ke.typeName?ae.typeName.localeCompare(ke.typeName):ae.title.localeCompare(ke.title))}),Ae=a.ref({}),Te=$=>{const F=Ae.value[$]||"";if(!F)return fe.value;const re=F.toLowerCase();return fe.value.filter(ae=>ae.title.toLowerCase().includes(re)||ae.typeName.toLowerCase().includes(re))},we=$=>{if(!z.value)return[];const F=z.value.part.slots?.[$];return F?F.allowedParts||[]:[]},B=($,F,re)=>{if(!z.value)return;const ae=re.target.checked,Fe=z.value.part.slots?.[$]?.allowedParts||[];let st;ae?st=[...Fe,F]:st=Fe.filter(xn=>xn!==F),Le(z.value.partIndex,$,st)};function ee($,F){const re=["zcode-part-item"];return E.value&&E.value.type===$.type&&E.value.partIndex===F&&re.push("zcode-reorder-source"),re.join(" ")}function Me($){const F=$._partIndex,re=F!=null,ae=re&&F!==void 0?F+1:0,ke=$.parts.length;if(re&&ke>1){if(!confirm(n("partsManager.deletePartConfirm",{number:ae})))return}else{const Fe=J($.type);if(Fe.length>0){if(!confirm(n("partsManager.deleteTypeWithUsagesConfirm",{type:$.type,count:Fe.length})))return}else if(!confirm(n("partsManager.deleteTypeConfirm")))return}X($)}return($,F)=>(a.openBlock(),a.createElementBlock("div",QT,[a.createElementVNode("div",ZT,[a.createElementVNode("div",ez,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(y.value,re=>(a.openBlock(),a.createElementBlock("button",{key:re,class:a.normalizeClass([{active:a.unref(D)===re},"zcode-category-tab"]),onClick:ae=>D.value=re},a.toDisplayString(re==="common"?$.$t("dataViewer.common"):re==="individual"?$.$t("dataViewer.individual"):$.$t("dataViewer.special")),11,tz))),128)),a.createElementVNode("button",{class:"zcode-help-btn",title:$.$t("dataViewer.categoryInfo.title"),onClick:F[0]||(F[0]=re=>c.value=!0)},[a.createVNode(a.unref(Vn),{size:14})],8,nz)]),a.createElementVNode("button",{class:"zcode-btn-primary zcode-parts-new-btn",onClick:F[1]||(F[1]=(...re)=>a.unref(L)&&a.unref(L)(...re))},[a.createVNode(a.unref(uo),{size:14}),a.createElementVNode("span",null,a.toDisplayString($.$t("partsManager.createType")),1)])]),a.createElementVNode("div",oz,[a.createElementVNode("div",rz,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(j),re=>(a.openBlock(),a.createElementBlock("div",{key:re.type,class:"zcode-part-type-group"},[a.createElementVNode("div",iz,[a.createTextVNode(a.toDisplayString(re.type)+" ",1),a.createElementVNode("div",sz,[re.parts.length>0?(a.openBlock(),a.createElementBlock("button",{key:0,class:"zcode-part-type-edit-btn",title:$.$t("partsManager.editTypeButton"),onClick:a.withModifiers(ae=>a.unref(H)(re.parts[0]),["stop"])},[a.createVNode(a.unref(oa),{size:14})],8,az)):a.createCommentVNode("",!0),a.createElementVNode("button",{class:a.normalizeClass(["zcode-action-btn",{active:a.unref(O)===re.type}]),title:$.$t("partsManager.reorderType"),onClick:a.withModifiers(ae=>a.unref(k)(re.type),["stop"])},[a.createVNode(a.unref(ir),{size:14})],10,lz),a.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:$.$t("partsManager.deleteTypeButton"),onClick:a.withModifiers(ae=>a.unref(U)(re.type),["stop"])},[a.createVNode(a.unref(Bn),{size:14})],8,cz)])]),a.createElementVNode("div",dz,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(re.parts,(ae,ke)=>(a.openBlock(),a.createElementBlock("div",{key:`${re.type}-${ke}`,class:a.normalizeClass(ee(ae,ae._partIndex??0)),onClick:Fe=>a.unref(Q)(ae,ae._partIndex??0)},[a.unref(E)&&a.unref(E).type===ae.type&&a.unref(E).partIndex===(ae._partIndex??0)?(a.openBlock(),a.createElementBlock("div",fz,a.toDisplayString($.$t("partsManager.source")),1)):a.createCommentVNode("",!0),a.createElementVNode("div",pz,[a.createElementVNode("span",hz,a.toDisplayString(ae._displayPart?.title||ae.type),1),a.createElementVNode("div",mz,[a.createElementVNode("button",{class:"zcode-action-btn",title:$.$t("partsManager.editPartButton"),onClick:a.withModifiers(Fe=>a.unref(Q)(ae,ae._partIndex??0),["stop"])},[a.createVNode(a.unref(oa),{size:14})],8,gz),a.createElementVNode("button",{class:a.normalizeClass(["zcode-action-btn",{active:a.unref(E)?.type===ae.type&&a.unref(E)?.partIndex===(ae._partIndex??0)}]),title:$.$t("partsManager.reorderPart"),onClick:a.withModifiers(Fe=>a.unref(S)(ae,ae._partIndex??0),["stop"])},[a.createVNode(a.unref(ir),{size:14})],10,bz),a.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:$.$t("partsManager.deletePartButton"),onClick:a.withModifiers(Fe=>Me({...ae,_partIndex:ae._partIndex??0}),["stop"])},[a.createVNode(a.unref(Bn),{size:14})],8,yz)])]),a.createElementVNode("div",xz,[a.createElementVNode("div",{class:a.normalizeClass(["zcode-part-description",{"zcode-description-empty":!ae._displayPart?.description&&!ae.description}])},a.toDisplayString(ae._displayPart?.description||ae.description||$.$t("partsManager.noDescription")),3),a.createElementVNode("div",Ez,a.toDisplayString($.$t("partsManager.partNumber",{current:(ae._partIndex??0)+1,total:ae.parts.length})),1),ae._displayPart?(a.openBlock(),a.createElementBlock("div",kz,[a.createElementVNode("div",{class:"zcode-part-preview-content",innerHTML:a.unref(ce)(ae,ae._displayPart)},null,8,wz)])):a.createCommentVNode("",!0)])],10,uz))),128)),re.parts.length>0?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-part-item zcode-part-item-add",onClick:a.withModifiers(ae=>a.unref(G)(re.parts[0]),["stop"])},[a.createElementVNode("div",Nz,[a.createVNode(a.unref(uo),{size:20}),a.createElementVNode("span",null,a.toDisplayString($.$t("partsManager.addPart")),1)])],8,Sz)):a.createCommentVNode("",!0)])]))),128))]),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.unref(W)&&(a.unref(P)==="type"||a.unref(V))?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-part-modal",onClick:F[7]||(F[7]=a.withModifiers((...re)=>a.unref(K)&&a.unref(K)(...re),["self"]))},[a.createElementVNode("div",{class:"zcode-part-modal-content",onClick:F[6]||(F[6]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",Cz,[a.createElementVNode("div",vz,a.toDisplayString(a.unref(V)?$.$t("partsManager.createType"):$.$t("partsManager.editType")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":$.$t("common.close"),onClick:F[2]||(F[2]=(...re)=>a.unref(K)&&a.unref(K)(...re))},[a.createVNode(a.unref(Qe),{size:18})],8,Tz)]),a.createElementVNode("div",zz,[a.createElementVNode("div",_z,[a.createElementVNode("label",null,[a.createTextVNode(a.toDisplayString($.$t("partsManager.typeName"))+" ",1),F[27]||(F[27]=a.createElementVNode("span",{class:"zcode-required"},"*",-1))]),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":F[3]||(F[3]=re=>a.unref(W).type=re),type:"text",placeholder:$.$t("partsManager.typeNamePlaceholder"),class:"zcode-text-input",required:""},null,8,Az),[[a.vModelText,a.unref(W).type]])]),a.createElementVNode("div",Mz,[a.createElementVNode("label",null,a.toDisplayString($.$t("partsManager.typeDescription")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":F[4]||(F[4]=re=>a.unref(W).description=re),type:"text",placeholder:$.$t("partsManager.typeDescriptionPlaceholder"),class:"zcode-text-input"},null,8,Iz),[[a.vModelText,a.unref(W).description]])])]),a.createElementVNode("div",Oz,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-part-editor-actions-btn zcode-part-editor-actions-btn-primary",onClick:Ve},[a.createVNode(a.unref(sr),{size:16}),a.createElementVNode("span",null,a.toDisplayString($.$t("common.confirm")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel zcode-part-editor-actions-btn",onClick:F[5]||(F[5]=(...re)=>a.unref(K)&&a.unref(K)(...re))},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString($.$t("common.cancel")),1)])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.unref(z)&&a.unref(P)==="part"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-part-modal",onClick:a.withModifiers(ve,["self"])},[a.createElementVNode("div",{class:"zcode-part-modal-content",onClick:F[17]||(F[17]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",Dz,[a.createElementVNode("div",Rz,a.toDisplayString($.$t("partsManager.editPart",{title:a.unref(z).part.title})),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":$.$t("common.close"),onClick:ve},[a.createVNode(a.unref(Qe),{size:18})],8,Pz)]),a.createElementVNode("div",Lz,[a.createElementVNode("div",$z,[a.createElementVNode("div",Vz,[a.createElementVNode("div",Bz,[a.createElementVNode("label",null,[a.createTextVNode(a.toDisplayString($.$t("partsManager.partTitle"))+" ",1),F[28]||(F[28]=a.createElementVNode("span",{class:"zcode-required"},"*",-1))]),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":F[8]||(F[8]=re=>a.unref(z).part.title=re),type:"text",class:"zcode-text-input",required:""},null,512),[[a.vModelText,a.unref(z).part.title]])]),a.createElementVNode("div",Fz,[a.createElementVNode("label",null,a.toDisplayString($.$t("partsManager.partDescription")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":F[9]||(F[9]=re=>a.unref(z).part.description=re),type:"text",class:"zcode-text-input",placeholder:$.$t("partsManager.partDescriptionPlaceholder")},null,8,jz),[[a.vModelText,a.unref(z).part.description]])])])]),a.createElementVNode("div",Uz,[a.createElementVNode("div",Hz,[a.createElementVNode("div",Wz,[a.createElementVNode("div",{class:"zcode-template-tabs",role:"tablist","aria-label":$.$t("partsManager.codeEdit")},[a.createElementVNode("button",{type:"button",class:a.normalizeClass(["zcode-template-tab",{active:u.value==="html"}]),role:"tab","aria-selected":u.value==="html",onClick:F[10]||(F[10]=re=>u.value="html")}," HTML ",10,qz),a.createElementVNode("button",{type:"button",class:a.normalizeClass(["zcode-template-tab",{active:u.value==="css"}]),role:"tab","aria-selected":u.value==="css",onClick:F[11]||(F[11]=re=>u.value="css")}," CSS ",10,Kz)],8,Gz),a.createElementVNode("div",Jz,[u.value==="css"?(a.openBlock(),a.createElementBlock("div",Xz,[a.createVNode(a.unref(na),{size:14,class:"zcode-css-warning-compact-icon"}),a.createElementVNode("span",Yz,a.toDisplayString($.$t("partsManager.cssEditInfo")),1),a.createElementVNode("button",{class:"zcode-help-btn",type:"button",title:$.$t("partsManager.cssEditWarning"),onClick:T},[a.createVNode(a.unref(Vn),{size:14})],8,Qz)])):a.createCommentVNode("",!0),u.value==="html"?(a.openBlock(),a.createElementBlock("label",Zz,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":F[12]||(F[12]=re=>i.value=re),type:"checkbox",class:"zcode-checkbox-input"},null,512),[[a.vModelCheckbox,i.value]]),a.createElementVNode("span",null,a.toDisplayString($.$t("partsManager.templateSuggestions")),1)])):a.createCommentVNode("",!0),u.value==="html"?(a.openBlock(),a.createElementBlock("button",{key:2,class:"zcode-help-btn",type:"button",title:$.$t("partsManager.templateHelpButton"),onClick:v},[a.createVNode(a.unref(Vn),{size:16})],8,e_)):a.createCommentVNode("",!0)])]),a.createElementVNode("div",t_,[u.value==="html"?(a.openBlock(),a.createBlock(Pm,{key:0,modelValue:a.unref(z).part.body,"onUpdate:modelValue":F[13]||(F[13]=re=>a.unref(z).part.body=re),language:"html",theme:"vs-dark",minimap:!1,"auto-height":!1,"enable-suggestions":i.value,class:"zcode-monaco-editor"},null,8,["modelValue","enable-suggestions"])):(a.openBlock(),a.createBlock(Pm,{key:1,modelValue:f.value,"onUpdate:modelValue":F[14]||(F[14]=re=>f.value=re),language:"css",theme:"vs-dark",minimap:!1,"auto-height":!1,"enable-suggestions":!0,class:"zcode-monaco-editor"},null,8,["modelValue"]))])]),a.createElementVNode("div",n_,[a.createElementVNode("div",o_,[a.createElementVNode("div",{class:"zcode-part-editor-preview-tab",onClick:F[15]||(F[15]=re=>r.value=!0),innerHTML:a.unref(ce)(a.unref(z).type,a.unref(z).part)},null,8,r_),a.createElementVNode("div",i_,a.toDisplayString($.$t("partsManager.clickToEnlarge")),1)])])]),_.value?(a.openBlock(),a.createElementBlock("div",s_,[a.createElementVNode("div",a_,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(z).part.slots||{},(re,ae)=>(a.openBlock(),a.createElementBlock("div",{key:`part-${a.unref(z).partIndex}-${ae}`,class:"zcode-slot-config-item"},[a.createElementVNode("div",l_,[a.createElementVNode("div",c_,a.toDisplayString($.$t("partsManager.slot"))+": "+a.toDisplayString(ae),1),a.createElementVNode("button",{class:"zcode-btn-small",onClick:ke=>a.unref(_e)(a.unref(z).partIndex,ae)},[a.createVNode(a.unref(Bn),{size:12})],8,d_)]),a.createElementVNode("div",u_,[a.createElementVNode("label",null,a.toDisplayString($.$t("partsManager.allowedParts")),1),a.createElementVNode("div",f_,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":ke=>Ae.value[ae]=ke,type:"text",placeholder:$.$t("partsManager.searchParts"),class:"zcode-text-input",style:{"margin-bottom":"8px"}},null,8,p_),[[a.vModelText,Ae.value[ae]]]),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(Te(ae),ke=>(a.openBlock(),a.createElementBlock("label",{key:`allowed-${ae}-${ke.typeName}-${ke.id}`,class:"zcode-checkbox-item"},[a.createElementVNode("input",{type:"checkbox",checked:we(ae).includes(ke.id),class:"zcode-checkbox",onChange:Fe=>B(ae,ke.id,Fe)},null,40,h_),a.createElementVNode("span",null,a.toDisplayString(ke.title)+" ("+a.toDisplayString(ke.typeName)+")",1)]))),128))])])]))),128)),Ce.value.length>0?(a.openBlock(),a.createElementBlock("div",m_,[a.createElementVNode("label",null,a.toDisplayString($.$t("partsManager.addSlot")),1),a.createElementVNode("div",g_,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":F[16]||(F[16]=re=>I.value=re),class:"zcode-select-input"},[a.createElementVNode("option",b_,a.toDisplayString($.$t("partsManager.selectSlot")),1),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(Ce.value,re=>(a.openBlock(),a.createElementBlock("option",{key:re,value:re},a.toDisplayString(re==="default"?$.$t("partsManager.defaultSlot"):re),9,y_))),128))],512),[[a.vModelSelect,I.value]]),a.createElementVNode("button",{disabled:!I.value,class:"zcode-btn-secondary",onClick:q},[a.createVNode(a.unref(uo),{size:16}),a.createElementVNode("span",null,a.toDisplayString($.$t("common.add")),1)],8,x_)])])):a.createCommentVNode("",!0)])])):a.createCommentVNode("",!0)]),a.createElementVNode("div",E_,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-part-editor-actions-btn zcode-part-editor-actions-btn-primary",onClick:me},[a.createVNode(a.unref(sr),{size:16}),a.createElementVNode("span",null,a.toDisplayString($.$t("common.confirm")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel zcode-part-editor-actions-btn",onClick:ve},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString($.$t("common.cancel")),1)])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[r.value&&a.unref(z)?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-preview-modal",onClick:F[20]||(F[20]=re=>r.value=!1)},[a.createElementVNode("div",{class:"zcode-preview-modal-content",onClick:F[19]||(F[19]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",k_,[a.createElementVNode("div",w_,a.toDisplayString($.$t("partsManager.preview"))+" "+a.toDisplayString(a.unref(z).part.title),1),a.createElementVNode("button",{class:"zcode-close-btn",onClick:F[18]||(F[18]=re=>r.value=!1)},[a.createVNode(a.unref(Qe),{size:18})])]),a.createElementVNode("div",{class:"zcode-preview-modal-body",innerHTML:a.unref(ce)(a.unref(z).type,a.unref(z).part)},null,8,S_)])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[l.value&&(a.unref(D)==="common"||a.unref(D)==="individual"||a.unref(D)==="special")?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:a.withModifiers(M,["self"])},[a.createElementVNode("div",{class:"zcode-help-modal zcode-css-warning-modal",onClick:F[22]||(F[22]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",N_,[a.createElementVNode("div",C_,[a.createVNode(a.unref(Vc),{size:20,class:"zcode-css-warning-modal-title-icon"}),a.createElementVNode("span",null,a.toDisplayString($.$t("partsManager.cssEditWarning")),1)]),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":$.$t("common.close"),onClick:M},[a.createVNode(a.unref(Qe),{size:20})],8,v_)]),a.createElementVNode("div",T_,[a.createElementVNode("div",z_,[a.createElementVNode("div",__,[a.createElementVNode("ul",A_,[a.createElementVNode("li",null,[a.unref(D)==="common"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createTextVNode(a.toDisplayString($.$t("partsManager.cssEditWarningMessageCommon")),1)],64)):a.unref(D)==="individual"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createTextVNode(a.toDisplayString($.$t("partsManager.cssEditWarningMessageIndividual")),1)],64)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:2},[a.createTextVNode(a.toDisplayString($.$t("partsManager.cssEditWarningMessageSpecial")),1)],64))])])])])]),a.createElementVNode("div",M_,[a.createElementVNode("label",I_,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":F[21]||(F[21]=re=>d.value=re),type:"checkbox",class:"zcode-checkbox-input"},null,512),[[a.vModelCheckbox,d.value]]),a.createElementVNode("span",null,a.toDisplayString($.$t("partsManager.dontShowAgain")),1)]),a.createElementVNode("button",{class:"zcode-btn-primary",onClick:M},a.toDisplayString($.$t("partsManager.understood")),1)])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[c.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:F[25]||(F[25]=a.withModifiers(re=>c.value=!1,["self"]))},[a.createElementVNode("div",{class:"zcode-help-modal",onClick:F[24]||(F[24]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",O_,[a.createElementVNode("div",D_,[a.createVNode(a.unref(na),{size:20,class:"zcode-css-warning-modal-title-icon"}),a.createElementVNode("span",null,a.toDisplayString($.$t("dataViewer.categoryInfo.title")),1)]),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":$.$t("common.close"),onClick:F[23]||(F[23]=re=>c.value=!1)},[a.createVNode(a.unref(Qe),{size:18})],8,R_)]),a.createElementVNode("div",P_,[a.createElementVNode("div",L_,[a.createElementVNode("div",$_,a.toDisplayString($.$t("dataViewer.categoryInfo.common.title")),1),a.createElementVNode("div",V_,a.toDisplayString($.$t("dataViewer.categoryInfo.common.description")),1)]),a.createElementVNode("div",B_,[a.createElementVNode("div",F_,a.toDisplayString($.$t("dataViewer.categoryInfo.individual.title")),1),a.createElementVNode("div",j_,a.toDisplayString($.$t("dataViewer.categoryInfo.individual.description")),1)]),a.createElementVNode("div",U_,[a.createElementVNode("div",H_,a.toDisplayString($.$t("dataViewer.categoryInfo.special.title")),1),a.createElementVNode("div",W_,a.toDisplayString($.$t("dataViewer.categoryInfo.special.description")),1)])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[s.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:w},[a.createElementVNode("div",{class:"zcode-help-modal",onClick:F[26]||(F[26]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",G_,[a.createElementVNode("div",q_,a.toDisplayString($.$t("partsManager.templateHelpTitle")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":$.$t("common.close"),onClick:w},[a.createVNode(a.unref(Qe),{size:20})],8,K_)]),a.createElementVNode("div",J_,[a.createElementVNode("table",X_,[a.createElementVNode("thead",null,[a.createElementVNode("tr",null,[a.createElementVNode("th",null,a.toDisplayString($.$t("partsManager.syntax")),1),a.createElementVNode("th",null,a.toDisplayString($.$t("partsManager.description")),1),a.createElementVNode("th",null,a.toDisplayString($.$t("partsManager.example")),1)])]),a.createElementVNode("tbody",null,[a.createElementVNode("tr",null,[F[29]||(F[29]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default}")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.textField")),1),F[30]||(F[30]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$title:タイトル}")],-1))]),a.createElementVNode("tr",null,[F[31]||(F[31]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default:rich}")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.richText")),1),F[32]||(F[32]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$content:本文:rich}")],-1))]),a.createElementVNode("tr",null,[F[33]||(F[33]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default:textarea}")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.textarea")),1),F[34]||(F[34]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$description:説明:textarea}")],-1))]),a.createElementVNode("tr",null,[F[35]||(F[35]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default:image}")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.image")),1),F[36]||(F[36]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$hero:default.jpg:image}")],-1))]),a.createElementVNode("tr",null,[F[37]||(F[37]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field:option1|option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.radio")),1),F[38]||(F[38]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($color:red|blue|green)")],-1))]),a.createElementVNode("tr",null,[F[39]||(F[39]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field:option1,option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.checkbox")),1),F[40]||(F[40]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($features:fast,secure)")],-1))]),a.createElementVNode("tr",null,[F[41]||(F[41]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field@:option1|option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.selectSingle")),1),F[42]||(F[42]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($size@:S|M|L)")],-1))]),a.createElementVNode("tr",null,[F[43]||(F[43]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field@:option1,option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.selectMultiple")),1),F[44]||(F[44]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($tags@:tag1,tag2,tag3)")],-1))]),a.createElementVNode("tr",null,[F[45]||(F[45]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'z-if="show_field"')],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.conditional")),1),F[46]||(F[46]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'<div z-if="show_content">...</div>')],-1))]),a.createElementVNode("tr",null,[F[47]||(F[47]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'z-slot="name"')],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.slot")),1),F[48]||(F[48]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'<div z-slot="content"></div>')],-1))])])]),a.createElementVNode("div",Y_,[a.createElementVNode("div",Q_,a.toDisplayString($.$t("partsManager.templateHelp.note")),1),a.createElementVNode("div",Z_,[a.createElementVNode("div",{role:"listitem",class:"zcode-help-section-item",innerHTML:$.$t("partsManager.templateHelp.suggestionNote")},null,8,eA),a.createElementVNode("div",tA,a.toDisplayString($.$t("partsManager.templateHelp.fieldNameNote")),1),a.createElementVNode("div",nA,a.toDisplayString($.$t("partsManager.templateHelp.defaultValueNote")),1)])])])])])):a.createCommentVNode("",!0)]))])]))}});function rA(t){const e=a.ref("common"),n=a.ref(null),o=a.ref(null),r=a.ref(!1),i=a.ref(null),s=a.computed(()=>e.value==="common"?t.images.common:e.value==="individual"?t.images.individual:t.images.special);function l(x){n.value=x,o.value=null,r.value=!1}function c(x){return new Promise((v,w)=>{const T=new FileReader;T.onload=M=>{const A=M.target?.result,y={id:`img-${Date.now()}`,name:x.name,url:A,mimeType:x.type,needsUpload:!0};e.value==="common"?t.images.common.push(y):e.value==="individual"?t.images.individual.push(y):t.images.special.push(y),v(y)},T.onerror=w,T.readAsDataURL(x)})}function d(x){Sc(x,t.page).forEach(A=>{Object.keys(A.component).forEach(y=>{y.includes("image")&&A.component[y]===x&&(A.component[y]="")})});const w=t.images.common.findIndex(A=>A.id===x);w!==-1&&t.images.common.splice(w,1);const T=t.images.individual.findIndex(A=>A.id===x);T!==-1&&t.images.individual.splice(T,1);const M=t.images.special.findIndex(A=>A.id===x);M!==-1&&t.images.special.splice(M,1),n.value?.id===x&&(n.value=null)}function u(x){o.value={...x},r.value=!1,n.value=x}function f(){if(!o.value)return;let x;e.value==="common"?x=t.images.common:e.value==="individual"?x=t.images.individual:x=t.images.special;const v=x.findIndex(w=>w.id===o.value.id);v!==-1&&(x[v]=o.value),o.value=null,r.value=!1}function p(){o.value=null,r.value=!1}function h(x){return Sc(x,t.page)}function m(x){if(!i.value){i.value=x;return}if(i.value===x){g();return}b(i.value,x),g()}function b(x,v){let w;e.value==="common"?w=t.images.common:e.value==="individual"?w=t.images.individual:w=t.images.special;const T=w.findIndex(y=>y.id===x),M=w.findIndex(y=>y.id===v);if(T===-1||M===-1)return;const[A]=w.splice(T,1);w.splice(M,0,A)}function g(){i.value=null}return{reorderSourceImage:i,handleReorderClick:m,cancelReorder:g,activeCategory:e,selectedImage:n,editingImage:o,isCreatingNew:r,currentImages:s,selectImage:l,addImage:c,deleteImage:d,startEditing:u,saveImage:f,cancelEditing:p,checkImageUsage:h}}const iA={class:"zcode-images-manager"},sA={class:"zcode-images-category-tabs"},aA={class:"zcode-images-category-tab-group"},lA=["onClick"],cA=["title"],dA={class:"zcode-images-add-wrapper"},uA={class:"zcode-images-manager-content"},fA={class:"zcode-images-grid"},pA=["onClick"],hA={key:0,class:"zcode-reorder-source-indicator"},mA=["src","alt"],gA={class:"zcode-image-item-overlay"},bA={class:"zcode-image-item-actions"},yA=["title","onClick"],xA=["title","onClick"],EA={class:"zcode-image-item-name"},kA={class:"zcode-image-editor-header"},wA={class:"zcode-image-editor-header-title",role:"heading","aria-level":"4"},SA=["aria-label"],NA={class:"zcode-image-editor-form"},CA={class:"zcode-image-preview-large"},vA=["src","alt"],TA={class:"zcode-form-field"},zA={class:"zcode-form-field"},_A={class:"zcode-image-editor-actions"},AA={class:"zcode-help-modal-header"},MA={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},IA=["aria-label"],OA={class:"zcode-help-modal-body"},DA={class:"zcode-help-section"},RA={class:"zcode-help-section-title",role:"heading","aria-level":"4"},PA={class:"zcode-help-section-item"},LA={class:"zcode-help-section"},$A={class:"zcode-help-section-title",role:"heading","aria-level":"4"},VA={class:"zcode-help-section-item"},BA={class:"zcode-help-section"},FA={class:"zcode-help-section-title",role:"heading","aria-level":"4"},jA={class:"zcode-help-section-item"},UA=a.defineComponent({__name:"ImagesManagerPanel",props:{cmsData:{type:Object},config:{type:Object}},setup(t,{expose:e}){const{t:n}=rn(),o=t,r=a.ref(null),i=a.ref(!1),s=a.computed(()=>o.config?.categoryOrder||"common"),l=a.computed(()=>{const A=[],y=o.cmsData.images.special.length>0;return s.value==="individual"?(A.push("individual","common"),y&&A.push("special")):s.value==="special"?(y&&A.push("special"),A.push("common","individual")):(A.push("common","individual"),y&&A.push("special")),A}),{reorderSourceImage:c,handleReorderClick:d,activeCategory:u,editingImage:f,currentImages:p,addImage:h,deleteImage:m,startEditing:b,saveImage:g,cancelEditing:x,checkImageUsage:v}=rA(o.cmsData);o.config?.categoryOrder==="individual"?u.value="individual":o.config?.categoryOrder==="special"&&(u.value="special"),e({activeCategory:u});async function w(A){const y=A.target,E=y.files?.[0];if(E)try{await h(E),y&&(y.value="")}catch(S){console.error("画像追加エラー:",S),alert(n("imagesManager.addImageFailed"))}}function T(A){const y=["zcode-image-item"];return c.value===A.id&&y.push("zcode-reorder-source"),y.join(" ")}function M(A){const y=v(A.id);if(y.length>0){if(!confirm(n("imagesManager.deleteImageWithUsagesConfirm",{count:y.length})))return}else if(!confirm(n("imagesManager.deleteImageConfirm")))return;m(A.id)}return(A,y)=>(a.openBlock(),a.createElementBlock("div",iA,[a.createElementVNode("div",sA,[a.createElementVNode("div",aA,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(l.value,E=>(a.openBlock(),a.createElementBlock("button",{key:E,class:a.normalizeClass([{active:a.unref(u)===E},"zcode-category-tab"]),onClick:S=>u.value=E},a.toDisplayString(E==="common"?A.$t("dataViewer.common"):E==="individual"?A.$t("dataViewer.individual"):A.$t("dataViewer.special")),11,lA))),128)),a.createElementVNode("button",{class:"zcode-help-btn",title:A.$t("dataViewer.categoryInfo.title"),onClick:y[0]||(y[0]=E=>i.value=!0)},[a.createVNode(a.unref(Vn),{size:14})],8,cA)]),a.createElementVNode("div",dA,[a.createElementVNode("input",{ref_key:"fileInput",ref:r,type:"file",accept:"image/*",style:{display:"none"},onChange:w},null,544),a.createElementVNode("button",{class:"zcode-btn-primary zcode-images-add-btn",onClick:y[1]||(y[1]=E=>r.value?.click())},[a.createVNode(a.unref(uo),{size:14}),a.createElementVNode("span",null,a.toDisplayString(A.$t("imagesManager.addImage")),1)])])]),a.createElementVNode("div",uA,[a.createElementVNode("div",fA,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(p),E=>(a.openBlock(),a.createElementBlock("div",{key:E.id,class:a.normalizeClass(T(E)),onClick:S=>a.unref(b)(E)},[a.unref(c)===E.id?(a.openBlock(),a.createElementBlock("div",hA,a.toDisplayString(A.$t("partsManager.source")),1)):a.createCommentVNode("",!0),a.createElementVNode("img",{src:E.url,alt:E.name},null,8,mA),a.createElementVNode("div",gA,[a.createElementVNode("div",bA,[a.createElementVNode("button",{class:a.normalizeClass(["zcode-action-btn",{active:a.unref(c)===E.id}]),title:A.$t("partsManager.reorderPart"),onClick:a.withModifiers(S=>a.unref(d)(E.id),["stop"])},[a.createVNode(a.unref(ir),{size:16})],10,yA),a.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:A.$t("partsManager.deletePartButton"),onClick:a.withModifiers(S=>M(E),["stop"])},[a.createVNode(a.unref(Bn),{size:16})],8,xA)])]),a.createElementVNode("div",EA,a.toDisplayString(E.name),1)],10,pA))),128))])]),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.unref(f)?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-image-modal",onClick:y[8]||(y[8]=a.withModifiers((...E)=>a.unref(x)&&a.unref(x)(...E),["self"]))},[a.createElementVNode("div",{class:"zcode-image-modal-content","data-edit-mode":"",onClick:y[7]||(y[7]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",kA,[a.createElementVNode("div",wA,a.toDisplayString(A.$t("imagesManager.editImage")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":A.$t("common.close"),onClick:y[2]||(y[2]=(...E)=>a.unref(x)&&a.unref(x)(...E))},[a.createVNode(a.unref(Qe),{size:18})],8,SA)]),a.createElementVNode("div",NA,[a.createElementVNode("div",CA,[a.createElementVNode("img",{src:a.unref(f).url,alt:a.unref(f).name,class:"zcode-image-preview-large-img"},null,8,vA)]),a.createElementVNode("div",TA,[a.createElementVNode("label",null,a.toDisplayString(A.$t("imagesManager.imageId")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":y[3]||(y[3]=E=>a.unref(f).id=E),type:"text",class:"zcode-text-input",disabled:""},null,512),[[a.vModelText,a.unref(f).id]])]),a.createElementVNode("div",zA,[a.createElementVNode("label",null,a.toDisplayString(A.$t("imagesManager.imageName")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":y[4]||(y[4]=E=>a.unref(f).name=E),type:"text",class:"zcode-text-input"},null,512),[[a.vModelText,a.unref(f).name]])]),a.createElementVNode("div",_A,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-image-editor-actions-btn",onClick:y[5]||(y[5]=(...E)=>a.unref(g)&&a.unref(g)(...E))},[a.createVNode(a.unref(sr),{size:16}),a.createElementVNode("span",null,a.toDisplayString(A.$t("common.confirm")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel zcode-image-editor-actions-btn",onClick:y[6]||(y[6]=(...E)=>a.unref(x)&&a.unref(x)(...E))},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(A.$t("common.cancel")),1)])])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[i.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:y[11]||(y[11]=a.withModifiers(E=>i.value=!1,["self"]))},[a.createElementVNode("div",{class:"zcode-help-modal",onClick:y[10]||(y[10]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",AA,[a.createElementVNode("div",MA,[a.createVNode(a.unref(na),{size:20,class:"zcode-css-warning-modal-title-icon"}),a.createElementVNode("span",null,a.toDisplayString(A.$t("dataViewer.categoryInfo.title")),1)]),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":A.$t("common.close"),onClick:y[9]||(y[9]=E=>i.value=!1)},[a.createVNode(a.unref(Qe),{size:18})],8,IA)]),a.createElementVNode("div",OA,[a.createElementVNode("div",DA,[a.createElementVNode("div",RA,a.toDisplayString(A.$t("dataViewer.categoryInfo.common.title")),1),a.createElementVNode("div",PA,a.toDisplayString(A.$t("dataViewer.categoryInfo.common.description")),1)]),a.createElementVNode("div",LA,[a.createElementVNode("div",$A,a.toDisplayString(A.$t("dataViewer.categoryInfo.individual.title")),1),a.createElementVNode("div",VA,a.toDisplayString(A.$t("dataViewer.categoryInfo.individual.description")),1)]),a.createElementVNode("div",BA,[a.createElementVNode("div",FA,a.toDisplayString(A.$t("dataViewer.categoryInfo.special.title")),1),a.createElementVNode("div",jA,a.toDisplayString(A.$t("dataViewer.categoryInfo.special.description")),1)])])])])):a.createCommentVNode("",!0)]))]))}}),HA={class:"zcode-data-viewer"},WA={class:"zcode-data-viewer-header"},GA={class:"zcode-data-viewer-content-tabs"},qA={class:"zcode-data-viewer-tabs"},KA=["onClick"],JA={class:"zcode-data-viewer-content"},XA={class:"zcode-data-viewer-display-wrapper"},YA={class:"zcode-data-viewer-display"},QA=["title"],ZA=a.defineComponent({__name:"DataViewer",props:{cmsData:{type:Object},config:{type:Object}},setup(t,{expose:e}){const n=t,o=a.ref("page"),r=a.ref("json"),i=a.ref(!1),s=a.computed(()=>n.config?.categoryOrder||"common"),l=a.computed(()=>{const v=[],w=o.value==="parts"?n.cmsData.parts.special.length>0:n.cmsData.images.special.length>0;return s.value==="individual"?(v.push("individual","common"),w&&v.push("special")):s.value==="special"?(w&&v.push("special"),v.push("common","individual")):(v.push("common","individual"),w&&v.push("special")),v}),c=a.ref(n.config?.categoryOrder==="individual"?"individual":n.config?.categoryOrder==="special"?"special":"common"),{fullPageHtml:d}=fi(n.cmsData,!1),u=a.computed(()=>{switch(o.value){case"page":return n.cmsData.page;case"parts":return c.value==="common"?n.cmsData.parts.common:c.value==="individual"?n.cmsData.parts.individual:n.cmsData.parts.special;case"images":return c.value==="common"?n.cmsData.images.common:c.value==="individual"?n.cmsData.images.individual:n.cmsData.images.special;default:return null}}),f=a.ref("");let p="";function h(){try{const v=u.value,w=JSON.stringify(v,null,2);if(w===p)return;f.value=w,p=w}catch{f.value=String(u.value),p=f.value}}function m(v){let w=v.replace(/\\\\/g,"\0").replace(/\\u([0-9a-fA-F]{4})/g,(T,M)=>String.fromCharCode(parseInt(M,16))).replace(/\\n/g,`
|
|
486
|
-
`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\\//g,"/").replace(/\u0000/g,"\\");return w=w.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&"),w}function
|
|
481
|
+
`},Qh=bv(wv)(Yh),Sv={config:kv},Cv=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return function(r){return t.reduceRight(function(i,a){return a(i)},r)}};function Zh(n,e){return Object.keys(e).forEach(function(t){e[t]instanceof Object&&n[t]&&Object.assign(e[t],Zh(n[t],e[t]))}),Kh(Kh({},n),e)}var Nv={type:"cancelation",msg:"operation is manually canceled"};function sc(n){var e=!1,t=new Promise(function(o,r){n.then(function(i){return e?r(Nv):o(i)}),n.catch(r)});return t.cancel=function(){return e=!0},t}var vv=["monaco"],Tv=gv.create({config:yv,isInitialized:!1,resolve:null,reject:null,monaco:null}),em=QN(Tv,2),qr=em[0],Ls=em[1];function zv(n){var e=Sv.config(n),t=e.monaco,o=XN(e,vv);Ls(function(r){return{config:Zh(r.config,o),monaco:t}})}function Mv(){var n=qr(function(e){var t=e.monaco,o=e.isInitialized,r=e.resolve;return{monaco:t,isInitialized:o,resolve:r}});if(!n.isInitialized){if(Ls({isInitialized:!0}),n.monaco)return n.resolve(n.monaco),sc(ac);if(window.monaco&&window.monaco.editor)return tm(window.monaco),n.resolve(window.monaco),sc(ac);Cv(Av,_v)(Ov)}return sc(ac)}function Av(n){return document.body.appendChild(n)}function Iv(n){var e=document.createElement("script");return n&&(e.src=n),e}function _v(n){var e=qr(function(o){var r=o.config,i=o.reject;return{config:r,reject:i}}),t=Iv("".concat(e.config.paths.vs,"/loader.js"));return t.onload=function(){return n()},t.onerror=e.reject,t}function Ov(){var n=qr(function(t){var o=t.config,r=t.resolve,i=t.reject;return{config:o,resolve:r,reject:i}}),e=window.require;e.config(n.config),e(["vs/editor/editor.main"],function(t){var o=t.m||t;tm(o),n.resolve(o)},function(t){n.reject(t)})}function tm(n){qr().monaco||Ls({monaco:n})}function Dv(){return qr(function(n){var e=n.monaco;return e})}var ac=new Promise(function(n,e){return Ls({resolve:n,reject:e})}),Pv={config:zv,init:Mv,__getMonacoInstance:Dv};const Rv={class:"monaco-editor-wrapper"},Lv={key:0,class:"monaco-editor-error"},nm=((n,e)=>{const t=n.__vccOpts||n;for(const[o,r]of e)t[o]=r;return t})(s.defineComponent({__name:"MonacoEditor",props:{modelValue:{type:String},language:{type:String},theme:{type:String},readOnly:{type:Boolean},minimap:{type:Boolean},height:{type:String},autoHeight:{type:Boolean},maxHeight:{type:Number},enableSuggestions:{type:Boolean}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,o=e,r=s.ref(null),i=s.ref(null);let a=null,l=null,c=!1,d=[];function u(){const p=r.value;if(!p)return;const h=p.getRootNode();if(!(h instanceof ShadowRoot))return;const m=h;Array.from(document.head.querySelectorAll('style, link[rel="stylesheet"]')).filter(b=>{if(b.tagName==="LINK"){const w=b.href||"";return w.includes("monaco")||w.includes("/vs/")||w.includes("vs/")}const z=b.textContent||"";return z.includes(".monaco-editor")||z.includes(".monaco-editor-background")}).forEach(b=>{if(b.tagName==="LINK"){const w=b.href;if(!!m.querySelector(`link[rel="stylesheet"][href="${w}"]`))return}else{const w=b.getAttribute("data-name")||"";if(w&&!!m.querySelector(`style[data-name="${w}"]`))return}const z=b.cloneNode(!0);z.setAttribute("data-zcode-monaco-style","true"),m.appendChild(z),d.push(z)})}function f(){if(!(!a||!r.value||!l)&&t.autoHeight!==!1)try{const p=a.getOption(l.editor.EditorOption.lineHeight)||19;let g=(a.getModel()?.getLineCount()||1)*p+20;t.maxHeight!==void 0&&(g=Math.min(g,t.maxHeight)),r.value.style.height=`${g}px`,a.layout()}catch{r.value.style.height="200px"}}return s.onMounted(async()=>{if(r.value)try{l=await Pv.init(),u(),l.languages.registerCompletionItemProvider("html",{provideCompletionItems:(h,m)=>{const g=h.getWordUntilPosition(m),y={startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:g.startColumn,endColumn:g.endColumn},b=h.getValueInRange({startLineNumber:m.lineNumber,startColumn:Math.max(1,m.column-10),endLineNumber:m.lineNumber,endColumn:m.column}),z=[];return(b.endsWith("$")||b.endsWith("{$"))&&z.push({label:"{$field:default}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストフィールド: {$変数名:デフォルト値}",detail:"テンプレート記法 - テキスト",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(b.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:textarea}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:textarea}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストエリアフィールド: {$変数名:デフォルト値:textarea}",detail:"テンプレート記法 - テキストエリア",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(b.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:rich}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:rich}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"リッチテキストフィールド: {$変数名:デフォルト値:rich}",detail:"テンプレート記法 - リッチテキスト",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(b.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:image}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:image}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"画像フィールド: {$変数名:デフォルト値:image}",detail:"テンプレート記法 - 画像",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(b.endsWith("{$")?2:1),endColumn:m.column}}),(b.endsWith("(")||b.endsWith("$("))&&z.push({label:"($field:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"ラジオボタン: ($フィールド名:選択肢1|選択肢2)",detail:"テンプレート記法 - ラジオボタン",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(b.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"チェックボックス: ($フィールド名:選択肢1,選択肢2)",detail:"テンプレート記法 - チェックボックス",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(b.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field@:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(単一選択): ($フィールド名@:選択肢1|選択肢2)",detail:"テンプレート記法 - セレクトボックス",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(b.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field@:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(複数選択): ($フィールド名@:選択肢1,選択肢2)",detail:"テンプレート記法 - セレクトボックス(複数)",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(b.endsWith("$(")?2:1),endColumn:m.column}}),(b.endsWith("z-")||b.endsWith(" z-"))&&z.push({label:'z-if="show_xxx"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-if="show_${1:field}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"条件分岐: z-if属性(フィールドがtrueの場合に表示)",detail:"テンプレート記法 - 条件分岐",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-2,endColumn:m.column}},{label:'z-slot="slotName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-slot="${1:slotName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"スロット: z-slot属性(子コンポーネントを挿入する位置)",detail:"テンプレート記法 - スロット",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-2,endColumn:m.column}}),z.length===0&&z.push({label:"{$field:default}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストフィールド: {$変数名:デフォルト値}",detail:"テンプレート記法 - テキスト",range:y},{label:"{$field:default:rich}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:rich}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"リッチテキストフィールド: {$変数名:デフォルト値:rich}",detail:"テンプレート記法 - リッチテキスト",range:y},{label:"{$field:default:image}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:image}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"画像フィールド: {$変数名:デフォルト値:image}",detail:"テンプレート記法 - 画像",range:y},{label:"($field:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"ラジオボタン: ($フィールド名:選択肢1|選択肢2)",detail:"テンプレート記法 - ラジオボタン",range:y},{label:"($field:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"チェックボックス: ($フィールド名:選択肢1,選択肢2)",detail:"テンプレート記法 - チェックボックス",range:y},{label:"($field@:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(単一選択): ($フィールド名@:選択肢1|選択肢2)",detail:"テンプレート記法 - セレクトボックス",range:y},{label:"($field@:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(複数選択): ($フィールド名@:選択肢1,選択肢2)",detail:"テンプレート記法 - セレクトボックス(複数)",range:y},{label:'z-if="show_xxx"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-if="show_${1:field}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"条件分岐: z-if属性(フィールドがtrueの場合に表示)",detail:"テンプレート記法 - 条件分岐",range:y},{label:'z-tag="$tagName:h1|h2|h3"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-tag="$${1:tagName}:${2:h1|h2|h3}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"タグ名を動的に変更(選択肢を指定可能)",detail:"テンプレート記法 - タグ名の動的変更",range:y},{label:'z-empty="$fieldName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-empty="$${1:fieldName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"オプショナルフィールドが空の場合、親要素を削除",detail:"テンプレート記法 - 条件分岐(空の場合削除)",range:y},{label:'z-slot="slotName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-slot="${1:slotName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"スロット: z-slot属性(子コンポーネントを挿入する位置)",detail:"テンプレート記法 - スロット",range:y}),{suggestions:z}},triggerCharacters:["$","(","z"]});const p=t.enableSuggestions!==!1;a=l.editor.create(r.value,{value:t.modelValue||"",language:t.language||"html",theme:t.theme||"vs-dark",readOnly:t.readOnly||!1,minimap:{enabled:t.minimap===!0},automaticLayout:!0,fontSize:14,tabSize:2,wordWrap:"off",scrollBeyondLastLine:!1,formatOnPaste:!0,formatOnType:!0,lineNumbers:"on",folding:!0,suggestOnTriggerCharacters:p,quickSuggestions:p?{other:!0,comments:!1,strings:!0}:!1,acceptSuggestionOnCommitCharacter:p,acceptSuggestionOnEnter:p?"on":"off",suggestSelection:"first",mouseWheelScrollSensitivity:1,fastScrollSensitivity:5,scrollbar:{alwaysConsumeMouseWheel:!1}}),a.onDidChangeModelContent(()=>{if(!c){const h=a.getValue();o("update:modelValue",h),f()}}),f()}catch(p){i.value=`Monaco Editorの読み込みに失敗しました: ${p}`,console.error("Monaco Editor error:",p)}}),s.watch(()=>t.modelValue,async p=>{a&&a.getValue()!==p&&(c=!0,await s.nextTick(),a.setValue(p||""),c=!1,f())}),s.watch(()=>t.enableSuggestions,p=>{if(a&&l){const h=p!==!1;a.updateOptions({suggestOnTriggerCharacters:h,quickSuggestions:h?{other:!0,comments:!1,strings:!0}:!1,acceptSuggestionOnCommitCharacter:h,acceptSuggestionOnEnter:h?"on":"off"})}}),s.onUnmounted(()=>{a&&(a.dispose(),a=null),d.forEach(p=>p.remove()),d=[]}),(p,h)=>(s.openBlock(),s.createElementBlock("div",Rv,[s.createElementVNode("div",{ref_key:"editorContainer",ref:r,class:"monaco-editor-container"},null,512),i.value?(s.openBlock(),s.createElementBlock("div",Lv,s.toDisplayString(i.value),1)):s.createCommentVNode("",!0)]))}}),[["styles",[".monaco-editor-wrapper{width:100%}.monaco-editor-container{width:100%;min-height:100px;max-height:400px;border:1px solid #d1d5db;border-radius:4px;overflow:hidden}.monaco-editor-error{padding:8px;background:#fee;color:#c33;border-radius:4px;margin-top:8px;font-size:12px}"]]]),$v={class:"zcode-parts-manager"},Vv={class:"zcode-parts-category-tabs"},Bv={class:"zcode-parts-category-tab-group"},Fv=["onClick"],jv=["title"],Hv={class:"zcode-parts-add-wrapper"},Uv={class:"zcode-parts-manager-content"},Wv={class:"zcode-parts-items"},qv={class:"zcode-part-type-title",role:"heading","aria-level":"5"},Gv={class:"zcode-part-type-actions"},Kv=["title","onClick"],Jv=["title","onClick"],Xv=["title","onClick"],Yv={class:"zcode-part-type-items"},Qv=["onClick"],Zv={key:0,class:"zcode-reorder-source-indicator"},eT={class:"zcode-part-item-header"},tT={class:"zcode-part-type"},nT={class:"zcode-part-item-actions"},oT=["title","onClick"],rT=["title","onClick"],iT=["title","onClick"],sT={class:"zcode-part-item-content"},aT={class:"zcode-part-modules"},lT={key:0,class:"zcode-part-preview"},cT=["innerHTML"],dT=["onClick"],uT={class:"zcode-part-item-add-content"},fT={class:"zcode-part-editor-header"},pT={class:"zcode-part-editor-header-title",role:"heading","aria-level":"4"},hT=["aria-label"],mT={class:"zcode-part-editor-form"},gT={class:"zcode-form-field"},yT=["placeholder"],bT={class:"zcode-form-field"},xT=["placeholder"],kT={class:"zcode-part-editor-actions"},ET={class:"zcode-part-editor-header"},wT={class:"zcode-part-editor-header-title",role:"heading","aria-level":"4"},ST=["aria-label"],CT={class:"zcode-part-editor-form"},NT={class:"zcode-part-editor-topbar"},vT={class:"zcode-part-editor-topfields"},TT={class:"zcode-form-field"},zT={class:"zcode-form-field"},MT=["placeholder"],AT={class:"zcode-part-editor-main"},IT={class:"zcode-part-editor-pane zcode-part-editor-pane--code"},_T={class:"zcode-part-editor-pane-header"},OT=["aria-label"],DT=["aria-selected"],PT=["aria-selected"],RT=["aria-selected"],LT={class:"zcode-part-editor-pane-header-actions"},$T={key:0,class:"zcode-css-warning-compact"},VT={class:"zcode-css-warning-compact-text"},BT=["title"],FT={key:1,class:"zcode-checkbox-label zcode-checkbox-label-inline"},jT=["title"],HT={class:"zcode-part-editor-pane-body"},UT={key:0,class:"zcode-slots-config zcode-slots-config-in-pane"},WT={class:"zcode-slot-config-header"},qT={class:"zcode-slot-config-title"},GT=["onClick"],KT={class:"zcode-slot-config-body"},JT={class:"zcode-checkbox-group"},XT=["onUpdate:modelValue","placeholder"],YT=["checked","onChange"],QT={key:0,class:"zcode-slot-add-section"},ZT={class:"zcode-slot-add-controls"},ez={value:""},tz=["value"],nz=["disabled"],oz={class:"zcode-part-editor-pane zcode-part-editor-pane--side"},rz=["aria-label"],iz=["aria-selected"],sz=["aria-selected"],az={class:"zcode-part-editor-pane-body"},lz=["innerHTML"],cz={class:"zcode-part-editor-preview-hint"},dz={class:"zcode-edit-panel-preview-heading"},uz={class:"zcode-edit-panel-preview-desc"},fz={class:"zcode-edit-panel-preview-wrap"},pz={key:1,class:"zcode-edit-panel-preview-empty"},hz={class:"zcode-part-editor-actions"},mz={class:"zcode-preview-modal-header"},gz={class:"zcode-preview-modal-header-title",role:"heading","aria-level":"4"},yz=["innerHTML"],bz={class:"zcode-help-modal-header"},xz={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},kz=["aria-label"],Ez={class:"zcode-help-modal-body"},wz={class:"zcode-warning-content"},Sz={class:"zcode-warning-text"},Cz={class:"zcode-warning-list"},Nz={class:"zcode-css-warning-modal-footer"},vz={class:"zcode-checkbox-label",style:{"margin-bottom":"12px"}},Tz={class:"zcode-help-modal-header"},zz={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},Mz=["aria-label"],Az={class:"zcode-help-modal-body"},Iz={class:"zcode-help-section"},_z={class:"zcode-help-section-title",role:"heading","aria-level":"4"},Oz={class:"zcode-help-section-item"},Dz={class:"zcode-help-section"},Pz={class:"zcode-help-section-title",role:"heading","aria-level":"4"},Rz={class:"zcode-help-section-item"},Lz={class:"zcode-help-section"},$z={class:"zcode-help-section-title",role:"heading","aria-level":"4"},Vz={class:"zcode-help-section-item"},Bz={class:"zcode-help-modal-header"},Fz={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},jz=["aria-label"],Hz={class:"zcode-help-modal-body"},Uz={class:"zcode-help-table"},Wz={class:"zcode-help-section"},qz={class:"zcode-help-section-title",role:"heading","aria-level":"4"},Gz={role:"list",class:"zcode-help-section-list"},Kz=["innerHTML"],Jz={role:"listitem",class:"zcode-help-section-item"},Xz={role:"listitem",class:"zcode-help-section-item"},Yz=s.defineComponent({__name:"PartsManagerPanel",props:{cmsData:{type:Object},config:{type:Object}},setup(n,{expose:e}){const{t}=Vt(),o=n,r=s.ref(!1),i=s.ref(nb("enableTemplateSuggestions",!1)),a=s.ref(!1),l=s.ref(!1),c=s.ref(!1),d=s.ref(ob()),u=s.ref("html"),f=s.ref("preview"),p=s.ref(""),h=s.ref(""),m={common:"zcode-css-style-parts-manager-preview-common",individual:"zcode-css-style-parts-manager-preview-individual",special:"zcode-css-style-parts-manager-preview-special"},g=new Map,y=s.computed(()=>$.value==="common"?o.cmsData.css?.common??"":$.value==="individual"?o.cmsData.css?.individual??"":o.cmsData.css?.special??"");function b(j){["common","individual","special"].forEach(ie=>{const de=j[ie];if(!de||!de.trim()){const Ye=g.get(ie);Ye&&(Ye.remove(),g.delete(ie));return}let Oe=g.get(ie);Oe||(Oe=document.createElement("style"),Oe.id=m[ie],Oe.setAttribute("data-zcode-css","true"),Oe.setAttribute("data-zcode-css-parts-preview","true"),Oe.setAttribute("data-zcode-css-category",ie),Oe.parentNode||document.head.appendChild(Oe),g.set(ie,Oe)),Oe.textContent=de})}function z(){g.forEach(j=>{j.remove()}),g.clear()}function w(){a.value=!0}function T(){a.value=!1}function A(){($.value==="common"||$.value==="individual"||$.value==="special")&&(l.value=!0)}function M(){l.value=!1,rb(d.value)}s.watch(i,j=>{wa({enableTemplateSuggestions:j})});const k=s.computed(()=>o.config?.categoryOrder||"common"),E=s.computed(()=>{const j=[],H=o.cmsData.parts.special.length>0;return k.value==="individual"?(j.push("individual","common"),H&&j.push("special")):k.value==="special"?(H&&j.push("special"),j.push("common","individual")):(j.push("common","individual"),H&&j.push("special")),j}),{reorderSourcePart:x,handleReorderClick:B,activeCategory:$,editingType:O,editingPart:D,editingLevel:P,isCreatingNew:q,groupedPartsByType:W,startCreating:R,startEditingType:K,startEditingPart:X,addPartToType:te,saveType:oe,savePart:G,deletePart:Z,checkTypeUsage:Y,cancelEditingType:ee,cancelEditingPart:le,getPartPreviewHtml:ge,createTempComponentFromType:Ne,addPartSlot:Re,removePartSlot:C,updatePartSlotAllowedParts:L,getAvailableSlotsForPart:V,extractSlotsFromTemplate:S,reorderSourceType:N,startReorderType:F,deletePartType:ne}=WN(o.cmsData),me=s.ref(null);s.watch(()=>D.value,j=>{if(!j){me.value=null;return}const H=Ne(j.type,j.part);me.value=s.reactive({...H,type:j.type.type})},{deep:!0});const De=s.computed(()=>{const j=D.value,H=me.value;return!j||!H?[]:Fh(j.part,H)});function Te(j){const H=me.value;H&&(H[j.fieldName]=j.currentValue)}o.config?.categoryOrder==="individual"&&($.value="individual");const v=s.computed(()=>(P?.value??P)==="part"&&!!D.value);s.watch(()=>v.value,j=>{if(!j){z();return}s.nextTick(()=>{const H=y.value;h.value=H,p.value=H,b({common:o.cmsData.css?.common,individual:o.cmsData.css?.individual,special:o.cmsData.css?.special})})},{immediate:!0}),s.watch(()=>$.value,()=>{v.value&&s.nextTick(()=>{const j=y.value;h.value=j,p.value=j})}),s.watch([()=>p.value,()=>v.value,()=>$.value],([j,H,ie])=>{H&&s.nextTick(()=>{const de={common:o.cmsData.css?.common,individual:o.cmsData.css?.individual,special:o.cmsData.css?.special};ie==="common"?de.common=j??"":ie==="individual"?de.individual=j??"":de.special=j??"",b(de)})});async function I(){await G(),!D.value&&o.cmsData.css&&($.value==="common"?o.cmsData.css.common=p.value:$.value==="individual"?o.cmsData.css.individual=p.value:o.cmsData.css.special=p.value,h.value=p.value)}function J(){p.value=h.value,z(),r.value=!1,le()}s.onBeforeUnmount(()=>{z()}),s.watch(()=>D.value,j=>{j&&(u.value="html")}),s.watch(()=>u.value,j=>{j==="css"&&v.value&&($.value==="common"||$.value==="individual"||$.value==="special")&&!d.value&&s.nextTick(()=>{A()})}),e({activeCategory:$});async function he(){await oe()}const Ae=s.computed(()=>D.value?V(D.value.partIndex):[]),ye=s.computed(()=>{if(!D.value)return!1;const j=D.value.part.body,H=j?S(j).length>0:!1,ie=D.value.part.slots&&Object.keys(D.value.part.slots).length>0;return H||ie});s.watch([()=>ye.value,()=>u.value],([j,H])=>{!j&&H==="slots"&&(u.value="html")});const U=s.ref(""),Q=()=>{!U.value||!D.value||(Re(D.value.partIndex,U.value),U.value="")};s.watch(()=>D.value?.part.body,()=>{U.value=""});const ve=s.computed(()=>{const j=[],H=o.cmsData.parts;return[...H.common,...H.individual,...H.special||[]].forEach(de=>{de.parts.forEach(Oe=>{j.push({id:Oe.id,title:Oe.title,typeName:de.type,description:Oe.description})})}),j.sort((de,Oe)=>de.typeName!==Oe.typeName?de.typeName.localeCompare(Oe.typeName):de.title.localeCompare(Oe.title))}),Le=s.ref({}),dt=j=>{const H=Le.value[j]||"";if(!H)return ve.value;const ie=H.toLowerCase();return ve.value.filter(de=>de.title.toLowerCase().includes(ie)||de.typeName.toLowerCase().includes(ie))},Tt=j=>{if(!D.value)return[];const H=D.value.part.slots?.[j];return H?H.allowedParts||[]:[]},Lt=(j,H,ie)=>{if(!D.value)return;const de=ie.target.checked,Ye=D.value.part.slots?.[j]?.allowedParts||[];let gn;de?gn=[...Ye,H]:gn=Ye.filter(Kr=>Kr!==H),L(D.value.partIndex,j,gn)};function $t(j,H){const ie=["zcode-part-item"];return x.value&&x.value.type===j.type&&x.value.partIndex===H&&ie.push("zcode-reorder-source"),ie.join(" ")}function Xt(j){const H=j._partIndex,ie=H!=null,de=ie&&H!==void 0?H+1:0,Oe=j.parts.length;if(ie&&Oe>1){if(!confirm(t("partsManager.deletePartConfirm",{number:de})))return}else{const Ye=Y(j.type);if(Ye.length>0){if(!confirm(t("partsManager.deleteTypeWithUsagesConfirm",{type:j.type,count:Ye.length})))return}else if(!confirm(t("partsManager.deleteTypeConfirm")))return}Z(j)}return(j,H)=>(s.openBlock(),s.createElementBlock("div",$v,[s.createElementVNode("div",Vv,[s.createElementVNode("div",Bv,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(E.value,ie=>(s.openBlock(),s.createElementBlock("button",{key:ie,class:s.normalizeClass([{active:s.unref($)===ie},"zcode-category-tab"]),onClick:de=>$.value=ie},s.toDisplayString(ie==="common"?j.$t("dataViewer.common"):ie==="individual"?j.$t("dataViewer.individual"):j.$t("dataViewer.special")),11,Fv))),128)),s.createElementVNode("button",{class:"zcode-help-btn",title:j.$t("dataViewer.categoryInfo.title"),onClick:H[0]||(H[0]=ie=>c.value=!0)},[s.createVNode(s.unref(Rn),{size:14})],8,jv)]),s.createElementVNode("div",Hv,[s.createElementVNode("button",{class:"zcode-btn-primary zcode-parts-new-btn",onClick:H[1]||(H[1]=(...ie)=>s.unref(R)&&s.unref(R)(...ie))},[s.createVNode(s.unref(co),{size:14}),s.createElementVNode("span",null,s.toDisplayString(j.$t("partsManager.createType")),1)])])]),s.createElementVNode("div",Uv,[s.createElementVNode("div",Wv,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(W),ie=>(s.openBlock(),s.createElementBlock("div",{key:ie.type,class:"zcode-part-type-group"},[s.createElementVNode("div",qv,[s.createTextVNode(s.toDisplayString(ie.type)+" ",1),s.createElementVNode("div",Gv,[ie.parts.length>0?(s.openBlock(),s.createElementBlock("button",{key:0,class:"zcode-part-type-edit-btn",title:j.$t("partsManager.editTypeButton"),onClick:s.withModifiers(de=>s.unref(K)(ie.parts[0]),["stop"])},[s.createVNode(s.unref(Ws),{size:14})],8,Kv)):s.createCommentVNode("",!0),s.createElementVNode("button",{class:s.normalizeClass(["zcode-action-btn",{active:s.unref(N)===ie.type}]),title:j.$t("partsManager.reorderType"),onClick:s.withModifiers(de=>s.unref(F)(ie.type),["stop"])},[s.createVNode(s.unref(Zo),{size:14})],10,Jv),s.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:j.$t("partsManager.deleteTypeButton"),onClick:s.withModifiers(de=>s.unref(ne)(ie.type),["stop"])},[s.createVNode(s.unref(Ln),{size:14})],8,Xv)])]),s.createElementVNode("div",Yv,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(ie.parts,(de,Oe)=>(s.openBlock(),s.createElementBlock("div",{key:`${ie.type}-${Oe}`,class:s.normalizeClass($t(de,de._partIndex??0)),onClick:Ye=>s.unref(X)(de,de._partIndex??0)},[s.unref(x)&&s.unref(x).type===de.type&&s.unref(x).partIndex===(de._partIndex??0)?(s.openBlock(),s.createElementBlock("div",Zv,s.toDisplayString(j.$t("partsManager.source")),1)):s.createCommentVNode("",!0),s.createElementVNode("div",eT,[s.createElementVNode("span",tT,s.toDisplayString(de._displayPart?.title||de.type),1),s.createElementVNode("div",nT,[s.createElementVNode("button",{class:"zcode-action-btn",title:j.$t("partsManager.editPartButton"),onClick:s.withModifiers(Ye=>s.unref(X)(de,de._partIndex??0),["stop"])},[s.createVNode(s.unref(Ws),{size:14})],8,oT),s.createElementVNode("button",{class:s.normalizeClass(["zcode-action-btn",{active:s.unref(x)?.type===de.type&&s.unref(x)?.partIndex===(de._partIndex??0)}]),title:j.$t("partsManager.reorderPart"),onClick:s.withModifiers(Ye=>s.unref(B)(de,de._partIndex??0),["stop"])},[s.createVNode(s.unref(Zo),{size:14})],10,rT),s.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:j.$t("partsManager.deletePartButton"),onClick:s.withModifiers(Ye=>Xt({...de,_partIndex:de._partIndex??0}),["stop"])},[s.createVNode(s.unref(Ln),{size:14})],8,iT)])]),s.createElementVNode("div",sT,[s.createElementVNode("div",{class:s.normalizeClass(["zcode-part-description",{"zcode-description-empty":!de._displayPart?.description&&!de.description}])},s.toDisplayString(de._displayPart?.description||de.description||j.$t("partsManager.noDescription")),3),s.createElementVNode("div",aT,s.toDisplayString(j.$t("partsManager.partNumber",{current:(de._partIndex??0)+1,total:de.parts.length})),1),de._displayPart?(s.openBlock(),s.createElementBlock("div",lT,[s.createElementVNode("div",{class:"zcode-part-preview-content",innerHTML:s.unref(ge)(de,de._displayPart)},null,8,cT)])):s.createCommentVNode("",!0)])],10,Qv))),128)),ie.parts.length>0?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-part-item zcode-part-item-add",onClick:s.withModifiers(de=>s.unref(te)(ie.parts[0]),["stop"])},[s.createElementVNode("div",uT,[s.createVNode(s.unref(co),{size:20}),s.createElementVNode("span",null,s.toDisplayString(j.$t("partsManager.addPart")),1)])],8,dT)):s.createCommentVNode("",!0)])]))),128))]),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[s.unref(O)&&(s.unref(P)==="type"||s.unref(q))?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-part-modal",onClick:H[7]||(H[7]=s.withModifiers((...ie)=>s.unref(ee)&&s.unref(ee)(...ie),["self"]))},[s.createElementVNode("div",{class:"zcode-part-modal-content",onClick:H[6]||(H[6]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",fT,[s.createElementVNode("div",pT,s.toDisplayString(s.unref(q)?j.$t("partsManager.createType"):j.$t("partsManager.editType")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":j.$t("common.close"),onClick:H[2]||(H[2]=(...ie)=>s.unref(ee)&&s.unref(ee)(...ie))},[s.createVNode(s.unref(Xe),{size:18})],8,hT)]),s.createElementVNode("div",mT,[s.createElementVNode("div",gT,[s.createElementVNode("label",null,[s.createTextVNode(s.toDisplayString(j.$t("partsManager.typeName"))+" ",1),H[30]||(H[30]=s.createElementVNode("span",{class:"zcode-required"},"*",-1))]),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":H[3]||(H[3]=ie=>s.unref(O).type=ie),type:"text",placeholder:j.$t("partsManager.typeNamePlaceholder"),class:"zcode-text-input",required:""},null,8,yT),[[s.vModelText,s.unref(O).type]])]),s.createElementVNode("div",bT,[s.createElementVNode("label",null,s.toDisplayString(j.$t("partsManager.typeDescription")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":H[4]||(H[4]=ie=>s.unref(O).description=ie),type:"text",placeholder:j.$t("partsManager.typeDescriptionPlaceholder"),class:"zcode-text-input"},null,8,xT),[[s.vModelText,s.unref(O).description]])])]),s.createElementVNode("div",kT,[s.createElementVNode("button",{class:"zcode-btn-primary zcode-part-editor-actions-btn zcode-part-editor-actions-btn-primary",onClick:he},[s.createVNode(s.unref(er),{size:16}),s.createElementVNode("span",null,s.toDisplayString(j.$t("common.confirm")),1)]),s.createElementVNode("button",{class:"zcode-btn-cancel zcode-part-editor-actions-btn",onClick:H[5]||(H[5]=(...ie)=>s.unref(ee)&&s.unref(ee)(...ie))},[s.createVNode(s.unref(Xe),{size:16}),s.createElementVNode("span",null,s.toDisplayString(j.$t("common.cancel")),1)])])])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[s.unref(D)&&s.unref(P)==="part"?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-part-modal",onClick:s.withModifiers(J,["self"])},[s.createElementVNode("div",{class:"zcode-part-modal-content",onClick:H[20]||(H[20]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",ET,[s.createElementVNode("div",wT,s.toDisplayString(j.$t("partsManager.editPart",{title:s.unref(D).part.title})),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":j.$t("common.close"),onClick:J},[s.createVNode(s.unref(Xe),{size:18})],8,ST)]),s.createElementVNode("div",CT,[s.createElementVNode("div",NT,[s.createElementVNode("div",vT,[s.createElementVNode("div",TT,[s.createElementVNode("label",null,[s.createTextVNode(s.toDisplayString(j.$t("partsManager.partTitle"))+" ",1),H[31]||(H[31]=s.createElementVNode("span",{class:"zcode-required"},"*",-1))]),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":H[8]||(H[8]=ie=>s.unref(D).part.title=ie),type:"text",class:"zcode-text-input",required:""},null,512),[[s.vModelText,s.unref(D).part.title]])]),s.createElementVNode("div",zT,[s.createElementVNode("label",null,s.toDisplayString(j.$t("partsManager.partDescription")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":H[9]||(H[9]=ie=>s.unref(D).part.description=ie),type:"text",class:"zcode-text-input",placeholder:j.$t("partsManager.partDescriptionPlaceholder")},null,8,MT),[[s.vModelText,s.unref(D).part.description]])])])]),s.createElementVNode("div",AT,[s.createElementVNode("div",IT,[s.createElementVNode("div",_T,[s.createElementVNode("div",{class:"zcode-template-tabs",role:"tablist","aria-label":j.$t("partsManager.codeEdit")},[s.createElementVNode("button",{type:"button",class:s.normalizeClass(["zcode-template-tab",{active:u.value==="html"}]),role:"tab","aria-selected":u.value==="html",onClick:H[10]||(H[10]=ie=>u.value="html")}," HTML ",10,DT),s.createElementVNode("button",{type:"button",class:s.normalizeClass(["zcode-template-tab",{active:u.value==="css"}]),role:"tab","aria-selected":u.value==="css",onClick:H[11]||(H[11]=ie=>u.value="css")}," CSS ",10,PT),ye.value?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:s.normalizeClass(["zcode-template-tab",{active:u.value==="slots"}]),role:"tab","aria-selected":u.value==="slots",onClick:H[12]||(H[12]=ie=>u.value="slots")},s.toDisplayString(j.$t("partsManager.slotSettings")),11,RT)):s.createCommentVNode("",!0)],8,OT),s.createElementVNode("div",LT,[u.value==="css"?(s.openBlock(),s.createElementBlock("div",$T,[s.createVNode(s.unref(Us),{size:14,class:"zcode-css-warning-compact-icon"}),s.createElementVNode("span",VT,s.toDisplayString(j.$t("partsManager.cssEditInfo")),1),s.createElementVNode("button",{class:"zcode-help-btn",type:"button",title:j.$t("partsManager.cssEditWarning"),onClick:A},[s.createVNode(s.unref(Rn),{size:14})],8,BT)])):s.createCommentVNode("",!0),u.value==="html"?(s.openBlock(),s.createElementBlock("label",FT,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":H[13]||(H[13]=ie=>i.value=ie),type:"checkbox",class:"zcode-checkbox-input"},null,512),[[s.vModelCheckbox,i.value]]),s.createElementVNode("span",null,s.toDisplayString(j.$t("partsManager.templateSuggestions")),1)])):s.createCommentVNode("",!0),u.value==="html"?(s.openBlock(),s.createElementBlock("button",{key:2,class:"zcode-help-btn",type:"button",title:j.$t("partsManager.templateHelpButton"),onClick:w},[s.createVNode(s.unref(Rn),{size:16})],8,jT)):s.createCommentVNode("",!0)])]),s.createElementVNode("div",HT,[u.value==="slots"?(s.openBlock(),s.createElementBlock("div",UT,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(D).part.slots||{},(ie,de)=>(s.openBlock(),s.createElementBlock("div",{key:`part-${s.unref(D).partIndex}-${de}`,class:"zcode-slot-config-item"},[s.createElementVNode("div",WT,[s.createElementVNode("div",qT,s.toDisplayString(j.$t("partsManager.slot"))+": "+s.toDisplayString(de),1),s.createElementVNode("button",{class:"zcode-btn-small",onClick:Oe=>s.unref(C)(s.unref(D).partIndex,de)},[s.createVNode(s.unref(Ln),{size:12})],8,GT)]),s.createElementVNode("div",KT,[s.createElementVNode("label",null,s.toDisplayString(j.$t("partsManager.allowedParts")),1),s.createElementVNode("div",JT,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":Oe=>Le.value[de]=Oe,type:"text",placeholder:j.$t("partsManager.searchParts"),class:"zcode-text-input",style:{"margin-bottom":"8px"}},null,8,XT),[[s.vModelText,Le.value[de]]]),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(dt(de),Oe=>(s.openBlock(),s.createElementBlock("label",{key:`allowed-${de}-${Oe.typeName}-${Oe.id}`,class:"zcode-checkbox-item"},[s.createElementVNode("input",{type:"checkbox",checked:Tt(de).includes(Oe.id),class:"zcode-checkbox",onChange:Ye=>Lt(de,Oe.id,Ye)},null,40,YT),s.createElementVNode("span",null,s.toDisplayString(Oe.title)+" ("+s.toDisplayString(Oe.typeName)+")",1)]))),128))])])]))),128)),Ae.value.length>0?(s.openBlock(),s.createElementBlock("div",QT,[s.createElementVNode("label",null,s.toDisplayString(j.$t("partsManager.addSlot")),1),s.createElementVNode("div",ZT,[s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":H[14]||(H[14]=ie=>U.value=ie),class:"zcode-select-input"},[s.createElementVNode("option",ez,s.toDisplayString(j.$t("partsManager.selectSlot")),1),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(Ae.value,ie=>(s.openBlock(),s.createElementBlock("option",{key:ie,value:ie},s.toDisplayString(ie==="default"?j.$t("partsManager.defaultSlot"):ie),9,tz))),128))],512),[[s.vModelSelect,U.value]]),s.createElementVNode("button",{disabled:!U.value,class:"zcode-btn-secondary",onClick:Q},[s.createVNode(s.unref(co),{size:16}),s.createElementVNode("span",null,s.toDisplayString(j.$t("common.add")),1)],8,nz)])])):s.createCommentVNode("",!0)])):u.value==="html"?(s.openBlock(),s.createBlock(nm,{key:1,modelValue:s.unref(D).part.body,"onUpdate:modelValue":H[15]||(H[15]=ie=>s.unref(D).part.body=ie),language:"html",theme:"vs-dark",minimap:!1,"auto-height":!1,"enable-suggestions":i.value,class:"zcode-monaco-editor"},null,8,["modelValue","enable-suggestions"])):(s.openBlock(),s.createBlock(nm,{key:2,modelValue:p.value,"onUpdate:modelValue":H[16]||(H[16]=ie=>p.value=ie),language:"css",theme:"vs-dark",minimap:!1,"auto-height":!1,"enable-suggestions":!0,class:"zcode-monaco-editor"},null,8,["modelValue"]))])]),s.createElementVNode("div",oz,[s.createElementVNode("div",{class:"zcode-part-editor-side-tabs",role:"tablist","aria-label":j.$t("partsManager.preview")},[s.createElementVNode("button",{type:"button",class:s.normalizeClass(["zcode-part-editor-side-tab",{active:f.value==="preview"}]),role:"tab","aria-selected":f.value==="preview",onClick:H[17]||(H[17]=ie=>f.value="preview")},s.toDisplayString(j.$t("partsManager.displayPreview")),11,iz),s.createElementVNode("button",{type:"button",class:s.normalizeClass(["zcode-part-editor-side-tab",{active:f.value==="editPanel"}]),role:"tab","aria-selected":f.value==="editPanel",onClick:H[18]||(H[18]=ie=>f.value="editPanel")},s.toDisplayString(j.$t("partsManager.editPanelPreview")),11,sz)],8,rz),s.createElementVNode("div",az,[f.value==="preview"?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createElementVNode("div",{class:"zcode-part-editor-preview-tab",onClick:H[19]||(H[19]=ie=>r.value=!0),innerHTML:s.unref(ge)(s.unref(D).type,s.unref(D).part)},null,8,lz),s.createElementVNode("div",cz,s.toDisplayString(j.$t("partsManager.clickToEnlarge")),1)],64)):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createElementVNode("div",dz,s.toDisplayString(j.$t("partsManager.editPanelPreview")),1),s.createElementVNode("div",uz,s.toDisplayString(j.$t("partsManager.editPanelPreviewDesc")),1),s.createElementVNode("div",fz,[me.value?(s.openBlock(),s.createBlock(Vh,{key:0,"editing-component":me.value,"editing-available-fields":De.value,"current-mode":"edit","can-select-parent":!1,"images-common":n.cmsData.images?.common??[],"images-individual":n.cmsData.images?.individual??[],"images-special":n.cmsData.images?.special??[],"preview-mode":!0,onSaveField:Te,onClose:()=>{},onAddImage:()=>{},onDeleteImage:()=>{}},null,8,["editing-component","editing-available-fields","images-common","images-individual","images-special"])):(s.openBlock(),s.createElementBlock("div",pz,s.toDisplayString(j.$t("partsManager.editPanelPreviewNoFields")),1))])],64))])])])]),s.createElementVNode("div",hz,[s.createElementVNode("button",{class:"zcode-btn-primary zcode-part-editor-actions-btn zcode-part-editor-actions-btn-primary",onClick:I},[s.createVNode(s.unref(er),{size:16}),s.createElementVNode("span",null,s.toDisplayString(j.$t("common.confirm")),1)]),s.createElementVNode("button",{class:"zcode-btn-cancel zcode-part-editor-actions-btn",onClick:J},[s.createVNode(s.unref(Xe),{size:16}),s.createElementVNode("span",null,s.toDisplayString(j.$t("common.cancel")),1)])])])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[r.value&&s.unref(D)?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-preview-modal",onClick:H[23]||(H[23]=ie=>r.value=!1)},[s.createElementVNode("div",{class:"zcode-preview-modal-content",onClick:H[22]||(H[22]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",mz,[s.createElementVNode("div",gz,s.toDisplayString(j.$t("partsManager.preview"))+" "+s.toDisplayString(s.unref(D).part.title),1),s.createElementVNode("button",{class:"zcode-close-btn",onClick:H[21]||(H[21]=ie=>r.value=!1)},[s.createVNode(s.unref(Xe),{size:18})])]),s.createElementVNode("div",{class:"zcode-preview-modal-body",innerHTML:s.unref(ge)(s.unref(D).type,s.unref(D).part)},null,8,yz)])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[l.value&&(s.unref($)==="common"||s.unref($)==="individual"||s.unref($)==="special")?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:s.withModifiers(M,["self"])},[s.createElementVNode("div",{class:"zcode-help-modal zcode-css-warning-modal",onClick:H[25]||(H[25]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",bz,[s.createElementVNode("div",xz,[s.createVNode(s.unref(xc),{size:20,class:"zcode-css-warning-modal-title-icon"}),s.createElementVNode("span",null,s.toDisplayString(j.$t("partsManager.cssEditWarning")),1)]),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":j.$t("common.close"),onClick:M},[s.createVNode(s.unref(Xe),{size:20})],8,kz)]),s.createElementVNode("div",Ez,[s.createElementVNode("div",wz,[s.createElementVNode("div",Sz,[s.createElementVNode("ul",Cz,[s.createElementVNode("li",null,[s.unref($)==="common"?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createTextVNode(s.toDisplayString(j.$t("partsManager.cssEditWarningMessageCommon")),1)],64)):s.unref($)==="individual"?(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createTextVNode(s.toDisplayString(j.$t("partsManager.cssEditWarningMessageIndividual")),1)],64)):(s.openBlock(),s.createElementBlock(s.Fragment,{key:2},[s.createTextVNode(s.toDisplayString(j.$t("partsManager.cssEditWarningMessageSpecial")),1)],64))])])])])]),s.createElementVNode("div",Nz,[s.createElementVNode("label",vz,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":H[24]||(H[24]=ie=>d.value=ie),type:"checkbox",class:"zcode-checkbox-input"},null,512),[[s.vModelCheckbox,d.value]]),s.createElementVNode("span",null,s.toDisplayString(j.$t("partsManager.dontShowAgain")),1)]),s.createElementVNode("button",{class:"zcode-btn-primary",onClick:M},s.toDisplayString(j.$t("partsManager.understood")),1)])])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[c.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:H[28]||(H[28]=s.withModifiers(ie=>c.value=!1,["self"]))},[s.createElementVNode("div",{class:"zcode-help-modal",onClick:H[27]||(H[27]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",Tz,[s.createElementVNode("div",zz,[s.createVNode(s.unref(Us),{size:20,class:"zcode-css-warning-modal-title-icon"}),s.createElementVNode("span",null,s.toDisplayString(j.$t("dataViewer.categoryInfo.title")),1)]),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":j.$t("common.close"),onClick:H[26]||(H[26]=ie=>c.value=!1)},[s.createVNode(s.unref(Xe),{size:18})],8,Mz)]),s.createElementVNode("div",Az,[s.createElementVNode("div",Iz,[s.createElementVNode("div",_z,s.toDisplayString(j.$t("dataViewer.categoryInfo.common.title")),1),s.createElementVNode("div",Oz,s.toDisplayString(j.$t("dataViewer.categoryInfo.common.description")),1)]),s.createElementVNode("div",Dz,[s.createElementVNode("div",Pz,s.toDisplayString(j.$t("dataViewer.categoryInfo.individual.title")),1),s.createElementVNode("div",Rz,s.toDisplayString(j.$t("dataViewer.categoryInfo.individual.description")),1)]),s.createElementVNode("div",Lz,[s.createElementVNode("div",$z,s.toDisplayString(j.$t("dataViewer.categoryInfo.special.title")),1),s.createElementVNode("div",Vz,s.toDisplayString(j.$t("dataViewer.categoryInfo.special.description")),1)])])])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[a.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:T},[s.createElementVNode("div",{class:"zcode-help-modal",onClick:H[29]||(H[29]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",Bz,[s.createElementVNode("div",Fz,s.toDisplayString(j.$t("partsManager.templateHelpTitle")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":j.$t("common.close"),onClick:T},[s.createVNode(s.unref(Xe),{size:20})],8,jz)]),s.createElementVNode("div",Hz,[s.createElementVNode("table",Uz,[s.createElementVNode("thead",null,[s.createElementVNode("tr",null,[s.createElementVNode("th",null,s.toDisplayString(j.$t("partsManager.syntax")),1),s.createElementVNode("th",null,s.toDisplayString(j.$t("partsManager.description")),1),s.createElementVNode("th",null,s.toDisplayString(j.$t("partsManager.example")),1)])]),s.createElementVNode("tbody",null,[s.createElementVNode("tr",null,[H[32]||(H[32]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$field:default}")],-1)),s.createElementVNode("td",null,s.toDisplayString(j.$t("partsManager.templateHelp.textField")),1),H[33]||(H[33]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$title:タイトル}")],-1))]),s.createElementVNode("tr",null,[H[34]||(H[34]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$field:default:rich}")],-1)),s.createElementVNode("td",null,s.toDisplayString(j.$t("partsManager.templateHelp.richText")),1),H[35]||(H[35]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$content:本文:rich}")],-1))]),s.createElementVNode("tr",null,[H[36]||(H[36]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$field:default:textarea}")],-1)),s.createElementVNode("td",null,s.toDisplayString(j.$t("partsManager.templateHelp.textarea")),1),H[37]||(H[37]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$description:説明:textarea}")],-1))]),s.createElementVNode("tr",null,[H[38]||(H[38]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$field:default:image}")],-1)),s.createElementVNode("td",null,s.toDisplayString(j.$t("partsManager.templateHelp.image")),1),H[39]||(H[39]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$hero:default.jpg:image}")],-1))]),s.createElementVNode("tr",null,[H[40]||(H[40]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($field:option1|option2)")],-1)),s.createElementVNode("td",null,s.toDisplayString(j.$t("partsManager.templateHelp.radio")),1),H[41]||(H[41]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($color:red|blue|green)")],-1))]),s.createElementVNode("tr",null,[H[42]||(H[42]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($field:option1,option2)")],-1)),s.createElementVNode("td",null,s.toDisplayString(j.$t("partsManager.templateHelp.checkbox")),1),H[43]||(H[43]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($features:fast,secure)")],-1))]),s.createElementVNode("tr",null,[H[44]||(H[44]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($field@:option1|option2)")],-1)),s.createElementVNode("td",null,s.toDisplayString(j.$t("partsManager.templateHelp.selectSingle")),1),H[45]||(H[45]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($size@:S|M|L)")],-1))]),s.createElementVNode("tr",null,[H[46]||(H[46]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($field@:option1,option2)")],-1)),s.createElementVNode("td",null,s.toDisplayString(j.$t("partsManager.templateHelp.selectMultiple")),1),H[47]||(H[47]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($tags@:tag1,tag2,tag3)")],-1))]),s.createElementVNode("tr",null,[H[48]||(H[48]=s.createElementVNode("td",null,[s.createElementVNode("code",null,'z-if="show_field"')],-1)),s.createElementVNode("td",null,s.toDisplayString(j.$t("partsManager.templateHelp.conditional")),1),H[49]||(H[49]=s.createElementVNode("td",null,[s.createElementVNode("code",null,'<div z-if="show_content">...</div>')],-1))]),s.createElementVNode("tr",null,[H[50]||(H[50]=s.createElementVNode("td",null,[s.createElementVNode("code",null,'z-slot="name"')],-1)),s.createElementVNode("td",null,s.toDisplayString(j.$t("partsManager.templateHelp.slot")),1),H[51]||(H[51]=s.createElementVNode("td",null,[s.createElementVNode("code",null,'<div z-slot="content"></div>')],-1))])])]),s.createElementVNode("div",Wz,[s.createElementVNode("div",qz,s.toDisplayString(j.$t("partsManager.templateHelp.note")),1),s.createElementVNode("div",Gz,[s.createElementVNode("div",{role:"listitem",class:"zcode-help-section-item",innerHTML:j.$t("partsManager.templateHelp.suggestionNote")},null,8,Kz),s.createElementVNode("div",Jz,s.toDisplayString(j.$t("partsManager.templateHelp.fieldNameNote")),1),s.createElementVNode("div",Xz,s.toDisplayString(j.$t("partsManager.templateHelp.defaultValueNote")),1)])])])])])):s.createCommentVNode("",!0)]))])]))}});function Qz(n){const e=s.ref("common"),t=s.ref(null),o=s.ref(null),r=s.ref(!1),i=s.ref(null),a=s.computed(()=>e.value==="common"?n.images.common:e.value==="individual"?n.images.individual:n.images.special);function l(b){t.value=b,o.value=null,r.value=!1}function c(b){return new Promise((z,w)=>{const T=new FileReader;T.onload=A=>{const M=A.target?.result,k={id:`img-${Date.now()}`,name:b.name,url:M,mimeType:b.type,needsUpload:!0};e.value==="common"?n.images.common.push(k):e.value==="individual"?n.images.individual.push(k):n.images.special.push(k),z(k)},T.onerror=w,T.readAsDataURL(b)})}function d(b){ic(b,n.page).forEach(M=>{Object.keys(M.component).forEach(k=>{k.includes("image")&&M.component[k]===b&&(M.component[k]="")})});const w=n.images.common.findIndex(M=>M.id===b);w!==-1&&n.images.common.splice(w,1);const T=n.images.individual.findIndex(M=>M.id===b);T!==-1&&n.images.individual.splice(T,1);const A=n.images.special.findIndex(M=>M.id===b);A!==-1&&n.images.special.splice(A,1),t.value?.id===b&&(t.value=null)}function u(b){o.value={...b},r.value=!1,t.value=b}function f(){if(!o.value)return;let b;e.value==="common"?b=n.images.common:e.value==="individual"?b=n.images.individual:b=n.images.special;const z=b.findIndex(w=>w.id===o.value.id);z!==-1&&(b[z]=o.value),o.value=null,r.value=!1}function p(){o.value=null,r.value=!1}function h(b){return ic(b,n.page)}function m(b){if(!i.value){i.value=b;return}if(i.value===b){y();return}g(i.value,b),y()}function g(b,z){let w;e.value==="common"?w=n.images.common:e.value==="individual"?w=n.images.individual:w=n.images.special;const T=w.findIndex(k=>k.id===b),A=w.findIndex(k=>k.id===z);if(T===-1||A===-1)return;const[M]=w.splice(T,1);w.splice(A,0,M)}function y(){i.value=null}return{reorderSourceImage:i,handleReorderClick:m,cancelReorder:y,activeCategory:e,selectedImage:t,editingImage:o,isCreatingNew:r,currentImages:a,selectImage:l,addImage:c,deleteImage:d,startEditing:u,saveImage:f,cancelEditing:p,checkImageUsage:h}}const Zz={class:"zcode-images-manager"},eM={class:"zcode-images-category-tabs"},tM={class:"zcode-images-category-tab-group"},nM=["onClick"],oM=["title"],rM={class:"zcode-images-add-wrapper"},iM={class:"zcode-images-manager-content"},sM={class:"zcode-images-grid"},aM=["onClick"],lM={key:0,class:"zcode-reorder-source-indicator"},cM=["src","alt"],dM={class:"zcode-image-item-overlay"},uM={class:"zcode-image-item-actions"},fM=["title","onClick"],pM=["title","onClick"],hM={class:"zcode-image-item-name"},mM={class:"zcode-image-editor-header"},gM={class:"zcode-image-editor-header-title",role:"heading","aria-level":"4"},yM=["aria-label"],bM={class:"zcode-image-editor-form"},xM={class:"zcode-image-preview-large"},kM=["src","alt"],EM={class:"zcode-form-field"},wM={class:"zcode-form-field"},SM={class:"zcode-image-editor-actions"},CM={class:"zcode-help-modal-header"},NM={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},vM=["aria-label"],TM={class:"zcode-help-modal-body"},zM={class:"zcode-help-section"},MM={class:"zcode-help-section-title",role:"heading","aria-level":"4"},AM={class:"zcode-help-section-item"},IM={class:"zcode-help-section"},_M={class:"zcode-help-section-title",role:"heading","aria-level":"4"},OM={class:"zcode-help-section-item"},DM={class:"zcode-help-section"},PM={class:"zcode-help-section-title",role:"heading","aria-level":"4"},RM={class:"zcode-help-section-item"},LM=s.defineComponent({__name:"ImagesManagerPanel",props:{cmsData:{type:Object},config:{type:Object}},setup(n,{expose:e}){const{t}=Vt(),o=n,r=s.ref(null),i=s.ref(!1),a=s.computed(()=>o.config?.categoryOrder||"common"),l=s.computed(()=>{const M=[],k=o.cmsData.images.special.length>0;return a.value==="individual"?(M.push("individual","common"),k&&M.push("special")):a.value==="special"?(k&&M.push("special"),M.push("common","individual")):(M.push("common","individual"),k&&M.push("special")),M}),{reorderSourceImage:c,handleReorderClick:d,activeCategory:u,editingImage:f,currentImages:p,addImage:h,deleteImage:m,startEditing:g,saveImage:y,cancelEditing:b,checkImageUsage:z}=Qz(o.cmsData);o.config?.categoryOrder==="individual"?u.value="individual":o.config?.categoryOrder==="special"&&(u.value="special"),e({activeCategory:u});async function w(M){const k=M.target,E=k.files?.[0];if(E)try{await h(E),k&&(k.value="")}catch(x){console.error("画像追加エラー:",x),alert(t("imagesManager.addImageFailed"))}}function T(M){const k=["zcode-image-item"];return c.value===M.id&&k.push("zcode-reorder-source"),k.join(" ")}function A(M){const k=z(M.id);if(k.length>0){if(!confirm(t("imagesManager.deleteImageWithUsagesConfirm",{count:k.length})))return}else if(!confirm(t("imagesManager.deleteImageConfirm")))return;m(M.id)}return(M,k)=>(s.openBlock(),s.createElementBlock("div",Zz,[s.createElementVNode("div",eM,[s.createElementVNode("div",tM,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(l.value,E=>(s.openBlock(),s.createElementBlock("button",{key:E,class:s.normalizeClass([{active:s.unref(u)===E},"zcode-category-tab"]),onClick:x=>u.value=E},s.toDisplayString(E==="common"?M.$t("dataViewer.common"):E==="individual"?M.$t("dataViewer.individual"):M.$t("dataViewer.special")),11,nM))),128)),s.createElementVNode("button",{class:"zcode-help-btn",title:M.$t("dataViewer.categoryInfo.title"),onClick:k[0]||(k[0]=E=>i.value=!0)},[s.createVNode(s.unref(Rn),{size:14})],8,oM)]),s.createElementVNode("div",rM,[s.createElementVNode("input",{ref_key:"fileInput",ref:r,type:"file",accept:"image/*",style:{display:"none"},onChange:w},null,544),s.createElementVNode("button",{class:"zcode-btn-primary zcode-images-add-btn",onClick:k[1]||(k[1]=E=>r.value?.click())},[s.createVNode(s.unref(co),{size:14}),s.createElementVNode("span",null,s.toDisplayString(M.$t("imagesManager.addImage")),1)])])]),s.createElementVNode("div",iM,[s.createElementVNode("div",sM,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(p),E=>(s.openBlock(),s.createElementBlock("div",{key:E.id,class:s.normalizeClass(T(E)),onClick:x=>s.unref(g)(E)},[s.unref(c)===E.id?(s.openBlock(),s.createElementBlock("div",lM,s.toDisplayString(M.$t("partsManager.source")),1)):s.createCommentVNode("",!0),s.createElementVNode("img",{src:E.url,alt:E.name},null,8,cM),s.createElementVNode("div",dM,[s.createElementVNode("div",uM,[s.createElementVNode("button",{class:s.normalizeClass(["zcode-action-btn",{active:s.unref(c)===E.id}]),title:M.$t("partsManager.reorderPart"),onClick:s.withModifiers(x=>s.unref(d)(E.id),["stop"])},[s.createVNode(s.unref(Zo),{size:16})],10,fM),s.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:M.$t("partsManager.deletePartButton"),onClick:s.withModifiers(x=>A(E),["stop"])},[s.createVNode(s.unref(Ln),{size:16})],8,pM)])]),s.createElementVNode("div",hM,s.toDisplayString(E.name),1)],10,aM))),128))])]),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[s.unref(f)?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-image-modal",onClick:k[8]||(k[8]=s.withModifiers((...E)=>s.unref(b)&&s.unref(b)(...E),["self"]))},[s.createElementVNode("div",{class:"zcode-image-modal-content","data-edit-mode":"",onClick:k[7]||(k[7]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",mM,[s.createElementVNode("div",gM,s.toDisplayString(M.$t("imagesManager.editImage")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":M.$t("common.close"),onClick:k[2]||(k[2]=(...E)=>s.unref(b)&&s.unref(b)(...E))},[s.createVNode(s.unref(Xe),{size:18})],8,yM)]),s.createElementVNode("div",bM,[s.createElementVNode("div",xM,[s.createElementVNode("img",{src:s.unref(f).url,alt:s.unref(f).name,class:"zcode-image-preview-large-img"},null,8,kM)]),s.createElementVNode("div",EM,[s.createElementVNode("label",null,s.toDisplayString(M.$t("imagesManager.imageId")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":k[3]||(k[3]=E=>s.unref(f).id=E),type:"text",class:"zcode-text-input",disabled:""},null,512),[[s.vModelText,s.unref(f).id]])]),s.createElementVNode("div",wM,[s.createElementVNode("label",null,s.toDisplayString(M.$t("imagesManager.imageName")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":k[4]||(k[4]=E=>s.unref(f).name=E),type:"text",class:"zcode-text-input"},null,512),[[s.vModelText,s.unref(f).name]])]),s.createElementVNode("div",SM,[s.createElementVNode("button",{class:"zcode-btn-primary zcode-image-editor-actions-btn",onClick:k[5]||(k[5]=(...E)=>s.unref(y)&&s.unref(y)(...E))},[s.createVNode(s.unref(er),{size:16}),s.createElementVNode("span",null,s.toDisplayString(M.$t("common.confirm")),1)]),s.createElementVNode("button",{class:"zcode-btn-cancel zcode-image-editor-actions-btn",onClick:k[6]||(k[6]=(...E)=>s.unref(b)&&s.unref(b)(...E))},[s.createVNode(s.unref(Xe),{size:16}),s.createElementVNode("span",null,s.toDisplayString(M.$t("common.cancel")),1)])])])])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[i.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:k[11]||(k[11]=s.withModifiers(E=>i.value=!1,["self"]))},[s.createElementVNode("div",{class:"zcode-help-modal",onClick:k[10]||(k[10]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",CM,[s.createElementVNode("div",NM,[s.createVNode(s.unref(Us),{size:20,class:"zcode-css-warning-modal-title-icon"}),s.createElementVNode("span",null,s.toDisplayString(M.$t("dataViewer.categoryInfo.title")),1)]),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":M.$t("common.close"),onClick:k[9]||(k[9]=E=>i.value=!1)},[s.createVNode(s.unref(Xe),{size:18})],8,vM)]),s.createElementVNode("div",TM,[s.createElementVNode("div",zM,[s.createElementVNode("div",MM,s.toDisplayString(M.$t("dataViewer.categoryInfo.common.title")),1),s.createElementVNode("div",AM,s.toDisplayString(M.$t("dataViewer.categoryInfo.common.description")),1)]),s.createElementVNode("div",IM,[s.createElementVNode("div",_M,s.toDisplayString(M.$t("dataViewer.categoryInfo.individual.title")),1),s.createElementVNode("div",OM,s.toDisplayString(M.$t("dataViewer.categoryInfo.individual.description")),1)]),s.createElementVNode("div",DM,[s.createElementVNode("div",PM,s.toDisplayString(M.$t("dataViewer.categoryInfo.special.title")),1),s.createElementVNode("div",RM,s.toDisplayString(M.$t("dataViewer.categoryInfo.special.description")),1)])])])])):s.createCommentVNode("",!0)]))]))}}),$M={class:"zcode-data-viewer"},VM={class:"zcode-data-viewer-header"},BM={class:"zcode-data-viewer-content-tabs"},FM={class:"zcode-data-viewer-tabs"},jM=["onClick"],HM={class:"zcode-data-viewer-content"},UM={class:"zcode-data-viewer-display-wrapper"},WM={class:"zcode-data-viewer-display"},qM=["title"],GM=s.defineComponent({__name:"DataViewer",props:{cmsData:{type:Object},config:{type:Object}},setup(n,{expose:e}){const t=n,o=s.ref("page"),r=s.ref("json"),i=s.ref(!1),a=s.computed(()=>t.config?.categoryOrder||"common"),l=s.computed(()=>{const z=[],w=o.value==="parts"?t.cmsData.parts.special.length>0:t.cmsData.images.special.length>0;return a.value==="individual"?(z.push("individual","common"),w&&z.push("special")):a.value==="special"?(w&&z.push("special"),z.push("common","individual")):(z.push("common","individual"),w&&z.push("special")),z}),c=s.ref(t.config?.categoryOrder==="individual"?"individual":t.config?.categoryOrder==="special"?"special":"common"),{fullPageHtml:d}=pi(t.cmsData,!1),u=s.computed(()=>{switch(o.value){case"page":return t.cmsData.page;case"parts":return c.value==="common"?t.cmsData.parts.common:c.value==="individual"?t.cmsData.parts.individual:t.cmsData.parts.special;case"images":return c.value==="common"?t.cmsData.images.common:c.value==="individual"?t.cmsData.images.individual:t.cmsData.images.special;default:return null}}),f=s.ref("");let p="";function h(){try{const z=u.value,w=JSON.stringify(z,null,2);if(w===p)return;f.value=w,p=w}catch{f.value=String(u.value),p=f.value}}function m(z){let w=z.replace(/\\\\/g,"\0").replace(/\\u([0-9a-fA-F]{4})/g,(T,A)=>String.fromCharCode(parseInt(A,16))).replace(/\\n/g,`
|
|
482
|
+
`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\\//g,"/").replace(/\u0000/g,"\\");return w=w.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&"),w}function g(z){if(!z)return"";const T=z.replace(/>\s+</g,"><").replace(/></g,`>
|
|
487
483
|
<`).split(`
|
|
488
|
-
`),
|
|
489
|
-
`)}const g=a.computed(()=>o.value==="page"&&r.value==="html"?b(d.value):m(f.value));a.watch(u,()=>{h()},{deep:!0,immediate:!1}),a.watch(()=>n.cmsData,()=>{h()},{deep:!0}),a.watch(()=>{switch(o.value){case"page":return n.cmsData.page;case"parts":return c.value==="common"?n.cmsData.parts.common:n.cmsData.parts.individual;case"images":return c.value==="common"?n.cmsData.images.common:n.cmsData.images.individual;default:return null}},()=>{h()},{deep:!0}),a.watch(c,()=>{h()}),a.watch(o,()=>{c.value=n.config?.categoryOrder==="individual"?"individual":"common",h()});const x=async()=>{const v=g.value;try{await navigator.clipboard.writeText(v),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch(w){console.error("コピーに失敗しました:",w);const T=document.createElement("textarea");T.value=v,T.style.position="fixed",T.style.opacity="0",document.body.appendChild(T),T.select();try{document.execCommand("copy"),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch(M){console.error("コピーに失敗しました:",M)}document.body.removeChild(T)}};return h(),e({internalActiveTab:o,activeCategory:c}),(v,w)=>(a.openBlock(),a.createElementBlock("div",HA,[a.createElementVNode("div",WA,[a.createElementVNode("div",GA,[a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="page"},"zcode-data-viewer-content-tab"]),onClick:w[0]||(w[0]=T=>o.value="page")},a.toDisplayString(v.$t("dataViewer.page")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="parts"},"zcode-data-viewer-content-tab"]),onClick:w[1]||(w[1]=T=>o.value="parts")},a.toDisplayString(v.$t("dataViewer.parts")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="images"},"zcode-data-viewer-content-tab"]),onClick:w[2]||(w[2]=T=>o.value="images")},a.toDisplayString(v.$t("dataViewer.images")),3)]),a.createElementVNode("div",qA,[o.value==="page"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createElementVNode("button",{class:a.normalizeClass([{active:r.value==="json"},"zcode-data-viewer-tab"]),onClick:w[3]||(w[3]=T=>r.value="json")},a.toDisplayString(v.$t("dataViewer.json")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:r.value==="html"},"zcode-data-viewer-tab"]),onClick:w[4]||(w[4]=T=>r.value="html")},a.toDisplayString(v.$t("dataViewer.html")),3)],64)):(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:1},a.renderList(l.value,T=>(a.openBlock(),a.createElementBlock("button",{key:T,class:a.normalizeClass([{active:c.value===T},"zcode-data-viewer-tab"]),onClick:M=>c.value=T},a.toDisplayString(T==="common"?v.$t("dataViewer.common"):T==="individual"?v.$t("dataViewer.individual"):v.$t("dataViewer.special")),11,KA))),128))])]),a.createElementVNode("div",JA,[a.createElementVNode("div",XA,[a.createElementVNode("pre",YA,a.toDisplayString(g.value),1),a.createElementVNode("button",{class:"zcode-data-viewer-copy-btn",title:i.value?v.$t("common.copied"):v.$t("common.copy"),onClick:x},[i.value?(a.openBlock(),a.createBlock(a.unref(sr),{key:0,size:18})):(a.openBlock(),a.createBlock(a.unref(Xm),{key:1,size:18}))],8,QA)])])]))}}),eM={class:"zcode-dev-container"},tM={class:"zcode-dev-header"},nM={class:"zcode-dev-tabs"},oM=["title"],rM={key:1,class:"zcode-loading-message"},iM={class:"zcode-loading-message-text"},sM={key:3,class:"zcode-loading-message"},aM={class:"zcode-loading-message-text"},lM={key:3,class:"zcode-save-controls-fixed"},cM={class:"zcode-save-confirm-dialog"},dM={class:"zcode-save-confirm-dialog-header"},uM={class:"zcode-save-confirm-dialog-title"},fM={class:"zcode-save-confirm-dialog-body"},pM={class:"zcode-save-confirm-targets"},hM={class:"zcode-save-confirm-dialog-footer"},vc=a.defineComponent({__name:"ZeroCodeEditor",props:{locale:{type:String},page:{type:String},cssCommon:{type:String},cssIndividual:{type:String},cssSpecial:{type:String},partsCommon:{type:String},partsIndividual:{type:String},partsSpecial:{type:String},imagesCommon:{type:String},imagesIndividual:{type:String},imagesSpecial:{type:String},config:{type:String},endpoints:{type:String},backendData:{type:String},enablePartsManager:{type:Boolean},enableImagesManager:{type:Boolean}},setup(t,{expose:e}){const{t:n}=rn(),o=t,r=a.computed(()=>o.enablePartsManager!==!1),i=a.computed(()=>o.enableImagesManager!==!1),s=a.ref("manage"),l=a.ref("edit"),c=a.ref(null),d=a.ref(null),u=a.ref(null),f=a.ref(null),p=a.ref(!1),h=a.ref(!1),m=a.ref([]),g=(N=>{if(!N)return{};try{return JSON.parse(N)}catch(O){return console.warn("[ZeroCodeEditor] Failed to parse config:",O),{}}})(o.config);function x(N){return typeof N=="object"&&N!==null}function v(N){return N==="common"||N==="individual"||N==="special"}function w(N){return N==="page"||N==="parts"||N==="images"}function T(N){if(x(N)&&"value"in N)return N.value}function M(N,O){if(x(N))return N[O]}function A(N){const O=M(N,"activeCategory");if(v(O))return O;const k=T(O);return v(k)?k:void 0}function y(N){const O=M(N,"internalActiveTab");if(w(O))return O;const k=T(O);return w(k)?k:void 0}function E(){const N=c.value;return!x(N)||!("cmsData"in N)||!("currentMode"in N)||!("switchMode"in N)||!("allowDynamicContentInteraction"in N)||!("settingsPanelOpen"in N)||!("setData"in N)?null:N}const S=(N,O,k)=>{const U=Mu();return U[N]!==void 0?U[N]:k!==void 0?k:O},D=a.ref(S("showDataViewer",!1,g.dev?.showDataViewer)),W=a.ref(S("showSaveConfirm",!0,g.dev?.showSaveConfirm)),{cmsData:z,loadDataFromProps:P}=km(o),V=a.computed(()=>{const N=s.value==="manage"?E():null;return N?N.cmsData:z}),j=a.computed(()=>E()?.currentMode?.value??"edit"),L=N=>{c.value?.switchMode&&c.value.switchMode(N)};function H(N){l.value=N,(N==="parts"||N==="images"||N==="data")&&(s.value="manage")}function Q(){const N=E();N&&(N.settingsPanelOpen.value=!0)}const G=a.computed(()=>{if(s.value==="preview")return!0;const N=E();return N?N.allowDynamicContentInteraction.value:h1("allowDynamicContentInteraction",!1)});function se(N){const O=V.value;if(!N)return O;const k=N.split(".");let U=O;for(const te of k)if(!x(U)||(U=U[te],U===void 0))return;return U}function Z(N,O){const k=E();return k?k.setData(N,O):!1}a.onMounted(()=>{P()}),a.watch([()=>o.page,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial],()=>{P()}),a.watch(D,N=>{Ba({showDataViewer:N})}),a.watch(W,N=>{Ba({showSaveConfirm:N})}),a.watch(s,(N,O)=>{J("view-mode-changed",{mode:N,previousMode:O})});function X(N){W.value=N}function J(N,O){const k=document.querySelector("zcode-editor");if(k){const te=new CustomEvent(N,{detail:O,bubbles:!0,composed:!0});k.dispatchEvent(te);return}const U=new CustomEvent(N,{detail:O,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(U)}function K(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Y(){if(!V.value)return[];let N;if(l.value==="edit")N="page";else if(l.value==="parts")if(!d.value)console.warn('[ZeroCode] partsManagerRefが設定されていません。デフォルトで"common"を使用します。'),N="parts-common";else{const k=A(d.value);k==null?(console.warn('[ZeroCode] parts activeCategoryが取得できません。デフォルトで"common"を使用します。'),N="parts-common"):k==="common"?N="parts-common":k==="individual"?N="parts-individual":N="parts-special"}else if(l.value==="images")if(!u.value)console.warn('[ZeroCode] imagesManagerRefが設定されていません。デフォルトで"common"を使用します。'),N="images-common";else{const k=A(u.value);k==null?(console.warn('[ZeroCode] images activeCategoryが取得できません。デフォルトで"common"を使用します。'),N="images-common"):k==="common"?N="images-common":k==="individual"?N="images-individual":N="images-special"}else if(l.value==="data")if(!f.value)console.warn('[ZeroCode] dataViewerRefが設定されていません。デフォルトで"page"を使用します。'),N="page";else{const k=y(f.value),U=A(f.value);if(k==null)console.warn('[ZeroCode] dataViewer internalActiveTabが取得できません。デフォルトで"page"を使用します。'),N="page";else if(k==="page")N="page";else if(k==="parts")U==null?(console.warn('[ZeroCode] dataViewer parts activeCategoryが取得できません。デフォルトで"common"を使用します。'),N="parts-common"):U==="common"?N="parts-common":U==="individual"?N="parts-individual":N="parts-special";else if(k==="images")U==null?(console.warn('[ZeroCode] dataViewer images activeCategoryが取得できません。デフォルトで"common"を使用します。'),N="images-common"):U==="common"?N="images-common":U==="individual"?N="images-individual":N="images-special";else return console.warn(`[ZeroCode] dataViewer 不明なinternalActiveTab: ${k}`),[]}else return[];let O;return N==="page"?O=["page","images-common","images-individual"]:N==="parts-common"?O=[N,"parts-common-css"]:N==="parts-individual"?O=[N,"parts-individual-css"]:N==="parts-special"?O=[N,"parts-special-css"]:O=[N],O}function ce(){if(!W.value){Ee();return}const N=Y();if(N.length===0){console.warn(`[ZeroCode] ${n("editor.noSaveTargets")}`);return}m.value=N,h.value=!0}function Ee(){const N=Y();if(N.length===0){console.warn(`[ZeroCode] ${n("editor.noSaveTargets")}`);return}J("save-request",{requestId:K(),source:"editor",targets:N,timestamp:Date.now()})}function _e(){h.value=!1,Ee()}function Le(){h.value=!1,m.value=[]}function C(N){const{t:O}=rn();return{page:O("saveConfirm.targets.page"),"parts-common":O("saveConfirm.targets.parts-common"),"parts-individual":O("saveConfirm.targets.parts-individual"),"parts-special":O("saveConfirm.targets.parts-special"),"images-common":O("saveConfirm.targets.images-common"),"images-individual":O("saveConfirm.targets.images-individual"),"images-special":O("saveConfirm.targets.images-special"),"parts-common-css":O("saveConfirm.targets.parts-common-css"),"parts-individual-css":O("saveConfirm.targets.parts-individual-css"),"parts-special-css":O("saveConfirm.targets.parts-special-css")}[N]||N}return e({getData:se,setData:Z,allowDynamicContentInteraction:G}),(N,O)=>(a.openBlock(),a.createElementBlock("div",eM,[a.createElementVNode("div",tM,[a.createElementVNode("div",nM,[a.createElementVNode("button",{class:a.normalizeClass([{active:l.value==="edit"},"zcode-dev-tab"]),onClick:O[0]||(O[0]=k=>H("edit"))},[a.createVNode(a.unref(oa),{size:16}),a.createElementVNode("span",null,a.toDisplayString(N.$t("editor.pageManagement")),1)],2),r.value?(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass([{active:l.value==="parts"},"zcode-dev-tab"]),onClick:O[1]||(O[1]=k=>H("parts"))},[a.createVNode(a.unref(og),{size:16}),a.createElementVNode("span",null,a.toDisplayString(N.$t("editor.partsManagement")),1)],2)):a.createCommentVNode("",!0),i.value?(a.openBlock(),a.createElementBlock("button",{key:1,class:a.normalizeClass([{active:l.value==="images"},"zcode-dev-tab"]),onClick:O[2]||(O[2]=k=>H("images"))},[a.createVNode(a.unref(Rc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(N.$t("editor.imagesManagement")),1)],2)):a.createCommentVNode("",!0),a.createElementVNode("button",{class:a.normalizeClass([{active:l.value==="data"},"zcode-dev-tab"]),onClick:O[3]||(O[3]=k=>H("data"))},[a.createVNode(a.unref(Ym),{size:16}),a.createElementVNode("span",null,a.toDisplayString(N.$t("editor.dataViewer")),1)],2),a.createElementVNode("button",{class:"zcode-dev-tab zcode-dev-settings-btn",title:N.$t("toolbar.settings"),onClick:O[4]||(O[4]=k=>p.value=!0)},[a.createVNode(a.unref($c),{size:16})],8,oM)])]),l.value==="edit"?(a.openBlock(),a.createBlock(rd,{key:0,"current-mode":j.value,"view-mode":s.value,"allow-dynamic-content-interaction":G.value,onSwitchMode:L,onSwitchViewMode:O[5]||(O[5]=k=>s.value=k),onOpenSettings:Q},null,8,["current-mode","view-mode","allow-dynamic-content-interaction"])):a.createCommentVNode("",!0),s.value==="preview"&&V.value?(a.openBlock(),a.createBlock(ma,{key:1,"cms-data":V.value,"allow-dynamic-content-interaction":G.value},null,8,["cms-data","allow-dynamic-content-interaction"])):a.createCommentVNode("",!0),s.value==="manage"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:2},[a.withDirectives(a.createVNode(Hs,{ref_key:"cmsRef",ref:c,locale:o.locale,page:o.page,"css-common":o.cssCommon,"css-individual":o.cssIndividual,"css-special":o.cssSpecial,"parts-common":o.partsCommon,"parts-individual":o.partsIndividual,"parts-special":o.partsSpecial,"images-common":o.imagesCommon,"images-individual":o.imagesIndividual,"images-special":o.imagesSpecial,config:o.config,endpoints:o.endpoints,"backend-data":o.backendData},null,8,["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data"]),[[a.vShow,l.value==="edit"]]),r.value&&l.value==="parts"&&V.value?(a.openBlock(),a.createBlock(oA,{key:0,ref_key:"partsManagerRef",ref:d,"cms-data":V.value,config:a.unref(g)},null,8,["cms-data","config"])):a.createCommentVNode("",!0),r.value&&l.value==="parts"&&!V.value?(a.openBlock(),a.createElementBlock("div",rM,[a.createElementVNode("div",iM,a.toDisplayString(N.$t("editor.loading")),1)])):a.createCommentVNode("",!0),i.value&&l.value==="images"&&V.value?(a.openBlock(),a.createBlock(UA,{key:2,ref_key:"imagesManagerRef",ref:u,"cms-data":V.value,config:a.unref(g)},null,8,["cms-data","config"])):a.createCommentVNode("",!0),i.value&&l.value==="images"&&!V.value?(a.openBlock(),a.createElementBlock("div",sM,[a.createElementVNode("div",aM,a.toDisplayString(N.$t("editor.loading")),1)])):a.createCommentVNode("",!0),a.withDirectives(a.createVNode(ZA,{ref_key:"dataViewerRef",ref:f,"cms-data":V.value,config:a.unref(g)},null,8,["cms-data","config"]),[[a.vShow,l.value==="data"&&V.value]])],64)):a.createCommentVNode("",!0),a.withDirectives(a.createVNode(Ou,{"is-open":p.value,"view-mode":s.value,mode:"dev-tabs","show-save-confirm":W.value,onClose:O[6]||(O[6]=k=>p.value=!1),onToggleSaveConfirm:X},null,8,["is-open","view-mode","show-save-confirm"]),[[a.vShow,p.value]]),s.value==="manage"?(a.openBlock(),a.createElementBlock("div",lM,[a.createElementVNode("button",{class:"zcode-save-btn",onClick:ce},[a.createVNode(a.unref(Lc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(N.$t("common.save")),1)])])):a.createCommentVNode("",!0),h.value?(a.openBlock(),a.createElementBlock("div",{key:4,class:"zcode-save-confirm-dialog-overlay",onClick:a.withModifiers(Le,["self"])},[a.createElementVNode("div",cM,[a.createElementVNode("div",dM,[a.createElementVNode("div",uM,a.toDisplayString(N.$t("saveConfirm.title")),1)]),a.createElementVNode("div",fM,[a.createElementVNode("p",null,a.toDisplayString(N.$t("saveConfirm.message")),1),a.createElementVNode("ul",pM,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(m.value,k=>(a.openBlock(),a.createElementBlock("li",{key:k},a.toDisplayString(C(k)),1))),128))])]),a.createElementVNode("div",hM,[a.createElementVNode("button",{class:"zcode-btn-secondary",onClick:Le},a.toDisplayString(N.$t("common.cancel")),1),a.createElementVNode("button",{class:"zcode-btn-primary",onClick:_e},a.toDisplayString(N.$t("saveConfirm.saveButton")),1)])])])):a.createCommentVNode("",!0)]))}});Cm();class mM extends HTMLElement{app=null;componentInstance=null;_shadowRoot=null;constructor(){super()}connectedCallback(){if(this.app)return;this.getAttribute("use-shadow-dom")!=="false"?(this.setupShadowDOM(),window.addEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this))):(this.setupLightDOM(),window.addEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this)))}setupLightDOM(){const e=this.getAttribute("page")||"[]",n=this.getAttribute("css-common"),o=this.getAttribute("css-individual"),r=this.getAttribute("css-special"),i=this.getAttribute("parts-common")||"[]",s=this.getAttribute("parts-individual")||"[]",l=this.getAttribute("parts-special")||"[]",c=this.getAttribute("images-common")||"[]",d=this.getAttribute("images-individual")||"[]",u=this.getAttribute("images-special")||"[]",f=Ws(this);this.app=a.createApp(vc,{locale:f,page:e,cssCommon:n,cssIndividual:o,cssSpecial:r,partsCommon:i,partsIndividual:s,partsSpecial:l,imagesCommon:c,imagesIndividual:d,imagesSpecial:u,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||"",enablePartsManager:this.getAttribute("enable-parts-manager")!=="false",enableImagesManager:this.getAttribute("enable-images-manager")!=="false"}),Gs(this.app,f),this.componentInstance=this.app.mount(this),this.injectLightDOMCSS()}setupShadowDOM(){const e=this.shadowRoot,n=!!e;e?(this._shadowRoot=e,this.clearScripts()):(this._shadowRoot=this.attachShadow({mode:"open"}),this.injectCSS());const o=this.getAttribute("page")||"[]",r=this.getAttribute("css-common"),i=this.getAttribute("css-individual"),s=this.getAttribute("css-special"),l=this.getAttribute("parts-common")||"[]",c=this.getAttribute("parts-individual")||"[]",d=this.getAttribute("parts-special")||"[]",u=this.getAttribute("images-common")||"[]",f=this.getAttribute("images-individual")||"[]",p=this.getAttribute("images-special")||"[]",h=Ws(this);this.app=a.createApp(vc,{locale:h,page:o,cssCommon:r,cssIndividual:i,cssSpecial:s,partsCommon:l,partsIndividual:c,partsSpecial:d,imagesCommon:u,imagesIndividual:f,imagesSpecial:p,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||"",enablePartsManager:this.getAttribute("enable-parts-manager")!=="false",enableImagesManager:this.getAttribute("enable-images-manager")!=="false"}),Gs(this.app,h),this.componentInstance=this.app.mount(this._shadowRoot),requestAnimationFrame(()=>{requestAnimationFrame(()=>{setTimeout(()=>{this.injectScript(n)},100)})})}injectCSS(){if(!this._shadowRoot)return;const e=document.createElement("style");e.textContent=Sm,this._shadowRoot.appendChild(e),this.querySelectorAll('[slot="css"]').forEach(o=>{const r=o.cloneNode(!0);r.removeAttribute("slot"),this._shadowRoot.appendChild(r),o.remove()})}injectLightDOMCSS(){this.querySelectorAll('[slot="css"]').forEach(n=>{const o=n.cloneNode(!0);o.removeAttribute("slot"),document.head.appendChild(o)})}clearScripts(){if(!this._shadowRoot)return;this._shadowRoot.querySelectorAll("script").forEach(n=>{n.remove()})}injectScript(e=!1){if(!this._shadowRoot)return;const n=this.querySelectorAll('[slot="script"]'),o=Array.from(n),r=[],i=[];o.forEach(c=>{const d=c;if(!d.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}d.src.includes("jquery")||d.src.includes("code.jquery.com")?r.push(d):i.push(d)});const s=c=>{let d=c.src;if(e)try{const f=new URL(c.src,window.location.href);f.searchParams.set("_t",Date.now().toString()),d=f.toString()}catch{d=c.src+(c.src.includes("?")?"&":"?")+"_t="+Date.now()}const u=document.createElement("script");return u.src=d,c.type&&(u.type=c.type),c.async&&(u.async=!0),c.defer&&(u.defer=!0),c.integrity&&(u.integrity=c.integrity),c.crossOrigin&&(u.crossOrigin=c.crossOrigin),u.onerror=f=>{console.error(`Failed to load script: ${c.src}`,f)},u},l=()=>{o.forEach(c=>{c.remove()})};if(r.length>0){let c=0;const d=r.length;r.forEach(u=>{const f=s(u);f.onload=()=>{c++,c===d&&(Mo(this._shadowRoot,e),requestAnimationFrame(()=>{i.forEach(p=>{this._shadowRoot.appendChild(s(p))}),l()}))},this._shadowRoot.appendChild(f)})}else Mo(this._shadowRoot,e),i.forEach(c=>{this._shadowRoot.appendChild(s(c))}),l()}injectLightDOMScripts(){const e=this.querySelectorAll('[slot="script"]'),n=[],o=[];e.forEach(i=>{const s=i;if(!s.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}s.src.includes("jquery")||s.src.includes("code.jquery.com")?n.push(s):o.push(s)});const r=i=>{const s=document.createElement("script");return s.src=i.src,i.type&&(s.type=i.type),i.async&&(s.async=!0),i.defer&&(s.defer=!0),i.integrity&&(s.integrity=i.integrity),i.crossOrigin&&(s.crossOrigin=i.crossOrigin),s.onerror=l=>{console.error(`Failed to load script: ${i.src}`,l)},s};if(n.length>0){let i=0;const s=n.length;n.forEach(l=>{const c=r(l);c.onload=()=>{i++,i===s&&requestAnimationFrame(()=>{o.forEach(d=>{document.body.appendChild(r(d))})})},document.body.appendChild(c)})}else o.forEach(i=>{document.body.appendChild(r(i))})}getData(e){return this.componentInstance&&this.componentInstance.getData?this.componentInstance.getData(e):null}setData(e,n){return this.componentInstance&&this.componentInstance.setData?this.componentInstance.setData(e,n):!1}get allowDynamicContentInteraction(){if(this.componentInstance){const e=this.componentInstance.allowDynamicContentInteraction;if(e!==void 0)return e&&typeof e=="object"&&"value"in e?e.value:e}return!0}set allowDynamicContentInteraction(e){if(this.componentInstance){const n=this.componentInstance.allowDynamicContentInteraction;n!==void 0&&(n&&typeof n=="object"&&"value"in n?n.value=e:this.componentInstance.allowDynamicContentInteraction=e)}}disconnectedCallback(){if(this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot){if(this._shadowRoot.__zecEventListeners){const e=this._shadowRoot.__zecEventListeners,n=this._shadowRoot;e.forEach(o=>{o.forEach(r=>{n.removeEventListener(r.eventName,r.handler,!0)})}),e.clear()}if(window.__zecShadowRoots){const e=window.__zecShadowRoots,n=this._shadowRoot;for(const[o,r]of e.entries())r===n&&e.delete(o)}}this._shadowRoot=null,window.removeEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this)),window.removeEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this))}handleDOMUpdated(){if(!this._shadowRoot||this.getAttribute("use-shadow-dom")!=="true")return;this._shadowRoot.__zecJQueryExtended&&delete this._shadowRoot.__zecJQueryExtended;const e=this._shadowRoot.querySelector("script[data-zec-shadow-extension]");e&&e.remove(),Mo(this._shadowRoot,!0)}handleLightDOMUpdated(){this.getAttribute("use-shadow-dom")!=="true"&&(this.__lightDOMScriptsLoaded||(this.injectLightDOMScripts(),this.__lightDOMScriptsLoaded=!0))}static get observedAttributes(){return["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data","enable-parts-manager","enable-images-manager","use-shadow-dom"]}attributeChangedCallback(e,n,o){if(n!==o){if(e==="use-shadow-dom"){this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot&&(this._shadowRoot.innerHTML="",this._shadowRoot=null),this.connectedCallback();return}this.app&&(this.app.unmount(),this.app=null,this.componentInstance=null,this.connectedCallback())}}}customElements.get("zcode-editor")||customElements.define("zcode-editor",mM);class ni extends Error{constructor(e,n,o){super(o),this.code=e,this.path=n,this.name="RenderError"}}function gM(t,e={}){const{enableEditorAttributes:n=!1}=e,o=t.backendData;if(!t)throw new ni("PARSE_ERROR","","データが提供されていません");const r=t.parts||{common:[],individual:[],special:[]},i=t.images||{common:[],individual:[],special:[]},s=t.page||[];function l(d){return ha(d,r)}function c(d,u="",f=new Set){if(f.has(u))throw new ni("CIRCULAR_REFERENCE",u,`循環参照が検出されました: ${u}`);f.add(u);const p=d.part_id,h=l(p);if(!h)throw new ni("PART_NOT_FOUND",u,`パーツが見つかりません: ${p}`);const m=ui(h.body,d,u,l,(b,g)=>c(b,g,f),n,i.common,i.individual,i.special,o);return n?td(m,{"data-zcode-id":d.id,"data-zcode-path":u,"data-zcode-part":p}):m}return s.map((d,u)=>{try{return c(d,`page.${u}`)}catch(f){if(f instanceof ni)return`<div class="zcode-error-message" data-error-code="${f.code}">${f.message}</div>`;throw f}}).join("")}en.RenderError=ni,en.ZeroCodeCMS=Hs,en.ZeroCodeEditor=vc,en.ZeroCodePreview=ma,en.renderToHtml=gM,Object.defineProperty(en,Symbol.toStringTag,{value:"Module"})}));
|
|
490
|
-
//# sourceMappingURL=zerocode.umd.js.map
|
|
484
|
+
`),A=[];let M=0;for(const k of T){const E=k.trim();if(!E)continue;const x=/^<\/[^>]+>/.test(E),B=/\/>$/.test(E)||/^<!/.test(E),$=/^<[^/!][^>]*>$/.test(E)&&!B;x&&(M=Math.max(M-1,0)),A.push(" ".repeat(M)+E),$&&M++}return A.join(`
|
|
485
|
+
`)}const y=s.computed(()=>o.value==="page"&&r.value==="html"?g(d.value):m(f.value));s.watch(u,()=>{h()},{deep:!0,immediate:!1}),s.watch(()=>t.cmsData,()=>{h()},{deep:!0}),s.watch(()=>{switch(o.value){case"page":return t.cmsData.page;case"parts":return c.value==="common"?t.cmsData.parts.common:t.cmsData.parts.individual;case"images":return c.value==="common"?t.cmsData.images.common:t.cmsData.images.individual;default:return null}},()=>{h()},{deep:!0}),s.watch(c,()=>{h()}),s.watch(o,()=>{c.value=t.config?.categoryOrder==="individual"?"individual":"common",h()});const b=async()=>{const z=y.value;try{await navigator.clipboard.writeText(z),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch(w){console.error("コピーに失敗しました:",w);const T=document.createElement("textarea");T.value=z,T.style.position="fixed",T.style.opacity="0",document.body.appendChild(T),T.select();try{document.execCommand("copy"),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch(A){console.error("コピーに失敗しました:",A)}document.body.removeChild(T)}};return h(),e({internalActiveTab:o,activeCategory:c}),(z,w)=>(s.openBlock(),s.createElementBlock("div",$M,[s.createElementVNode("div",VM,[s.createElementVNode("div",BM,[s.createElementVNode("button",{class:s.normalizeClass([{active:o.value==="page"},"zcode-data-viewer-content-tab"]),onClick:w[0]||(w[0]=T=>o.value="page")},s.toDisplayString(z.$t("dataViewer.page")),3),s.createElementVNode("button",{class:s.normalizeClass([{active:o.value==="parts"},"zcode-data-viewer-content-tab"]),onClick:w[1]||(w[1]=T=>o.value="parts")},s.toDisplayString(z.$t("dataViewer.parts")),3),s.createElementVNode("button",{class:s.normalizeClass([{active:o.value==="images"},"zcode-data-viewer-content-tab"]),onClick:w[2]||(w[2]=T=>o.value="images")},s.toDisplayString(z.$t("dataViewer.images")),3)]),s.createElementVNode("div",FM,[o.value==="page"?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createElementVNode("button",{class:s.normalizeClass([{active:r.value==="json"},"zcode-data-viewer-tab"]),onClick:w[3]||(w[3]=T=>r.value="json")},s.toDisplayString(z.$t("dataViewer.json")),3),s.createElementVNode("button",{class:s.normalizeClass([{active:r.value==="html"},"zcode-data-viewer-tab"]),onClick:w[4]||(w[4]=T=>r.value="html")},s.toDisplayString(z.$t("dataViewer.html")),3)],64)):(s.openBlock(!0),s.createElementBlock(s.Fragment,{key:1},s.renderList(l.value,T=>(s.openBlock(),s.createElementBlock("button",{key:T,class:s.normalizeClass([{active:c.value===T},"zcode-data-viewer-tab"]),onClick:A=>c.value=T},s.toDisplayString(T==="common"?z.$t("dataViewer.common"):T==="individual"?z.$t("dataViewer.individual"):z.$t("dataViewer.special")),11,jM))),128))])]),s.createElementVNode("div",HM,[s.createElementVNode("div",UM,[s.createElementVNode("pre",WM,s.toDisplayString(y.value),1),s.createElementVNode("button",{class:"zcode-data-viewer-copy-btn",title:i.value?z.$t("common.copied"):z.$t("common.copy"),onClick:b},[i.value?(s.openBlock(),s.createBlock(s.unref(er),{key:0,size:18})):(s.openBlock(),s.createBlock(s.unref(gm),{key:1,size:18}))],8,qM)])])]))}}),KM={class:"zcode-dev-container"},JM={class:"zcode-dev-header"},XM={class:"zcode-dev-tabs"},YM=["title"],QM={key:3,class:"zcode-loading-message"},ZM={class:"zcode-loading-message-text"},eA={key:5,class:"zcode-loading-message"},tA={class:"zcode-loading-message-text"},nA={key:6,class:"zcode-save-controls-fixed"},oA={class:"zcode-save-confirm-dialog"},rA={class:"zcode-save-confirm-dialog-header"},iA={class:"zcode-save-confirm-dialog-title"},sA={class:"zcode-save-confirm-dialog-body"},aA={class:"zcode-save-confirm-targets"},lA={class:"zcode-save-confirm-dialog-footer"},lc=s.defineComponent({__name:"ZeroCodeEditor",props:{locale:{type:String},page:{type:String},cssCommon:{type:String},cssIndividual:{type:String},cssSpecial:{type:String},partsCommon:{type:String},partsIndividual:{type:String},partsSpecial:{type:String},imagesCommon:{type:String},imagesIndividual:{type:String},imagesSpecial:{type:String},config:{type:String},endpoints:{type:String},backendData:{type:String},enablePartsManager:{type:Boolean},enableImagesManager:{type:Boolean}},setup(n,{expose:e}){const{t}=Vt(),o=n,r=s.computed(()=>o.enablePartsManager!==!1),i=s.computed(()=>o.enableImagesManager!==!1),a=s.ref("manage"),l=s.ref("edit"),c=s.ref(null),d=s.ref(null),u=s.ref(null),f=s.ref(null),p=s.ref(!1),h=s.ref(!1),m=s.ref([]),y=(N=>{if(!N)return{};try{return JSON.parse(N)}catch(F){return console.warn("[ZeroCodeEditor] Failed to parse config:",F),{}}})(o.config);function b(N){return typeof N=="object"&&N!==null}function z(N){return N==="common"||N==="individual"||N==="special"}function w(N){return N==="page"||N==="parts"||N==="images"}function T(N){if(b(N)&&"value"in N)return N.value}function A(N){const F=T(N);if(typeof F=="boolean")return F;if(typeof N=="boolean")return N}function M(N){const F=T(N);if(typeof F=="string")return F;if(typeof N=="string")return N}function k(N,F){return b(N)&&"value"in N?(N.value=F,!0):!1}function E(N,F){if(b(N))return N[F]}function x(N){const F=E(N,"activeCategory");if(z(F))return F;const ne=T(F);return z(ne)?ne:void 0}function B(N){const F=E(N,"internalActiveTab");if(w(F))return F;const ne=T(F);return w(ne)?ne:void 0}function $(){const N=c.value;return!b(N)||!("cmsData"in N)||!("currentMode"in N)||!("switchMode"in N)||!("allowDynamicContentInteraction"in N)||!("settingsPanelOpen"in N)||!("setData"in N)?null:N}const O=(N,F,ne)=>{const me=Jd();return me[N]!==void 0?me[N]:ne!==void 0?ne:F},D=s.ref(O("showDataViewer",!1,y.dev?.showDataViewer)),P=s.ref(O("showSaveConfirm",!0,y.dev?.showSaveConfirm)),{cmsData:q,loadDataFromProps:W}=Bh(o),R=s.computed(()=>{const N=$();return N?N.cmsData:q}),K=s.computed(()=>{const N=$();return(N?M(N.currentMode):void 0)??"edit"}),X=N=>{c.value?.switchMode&&c.value.switchMode(N)};function te(N){l.value=N,(N==="parts"||N==="images"||N==="data")&&(a.value="manage")}function oe(){const N=$();N&&!k(N.settingsPanelOpen,!0)&&(N.settingsPanelOpen=!0)}const G=s.computed(()=>{if(a.value==="preview")return!0;const N=$();if(N){const F=A(N.allowDynamicContentInteraction);if(F!==void 0)return F}return tb("allowDynamicContentInteraction",!1)});function Z(N){const F=R.value;if(!N)return F;const ne=N.split(".");let me=F;for(const De of ne)if(!b(me)||(me=me[De],me===void 0))return;return me}function Y(N,F){const ne=$();return ne?ne.setData(N,F):!1}s.onMounted(()=>{W()}),s.watch([()=>o.page,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial],()=>{W()}),s.watch(D,N=>{wa({showDataViewer:N})}),s.watch(P,N=>{wa({showSaveConfirm:N})}),s.watch(a,(N,F)=>{le("view-mode-changed",{mode:N,previousMode:F})});function ee(N){P.value=N}function le(N,F){const ne=document.querySelector("zcode-editor");if(ne){const De=new CustomEvent(N,{detail:F,bubbles:!0,composed:!0});ne.dispatchEvent(De);return}const me=new CustomEvent(N,{detail:F,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(me)}function ge(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Ne(){if(!R.value)return[];let N;if(l.value==="edit")N="page";else if(l.value==="parts")if(!d.value)console.warn('[ZeroCode] partsManagerRefが設定されていません。デフォルトで"common"を使用します。'),N="parts-common";else{const ne=x(d.value);ne==null?(console.warn('[ZeroCode] parts activeCategoryが取得できません。デフォルトで"common"を使用します。'),N="parts-common"):ne==="common"?N="parts-common":ne==="individual"?N="parts-individual":N="parts-special"}else if(l.value==="images")if(!u.value)console.warn('[ZeroCode] imagesManagerRefが設定されていません。デフォルトで"common"を使用します。'),N="images-common";else{const ne=x(u.value);ne==null?(console.warn('[ZeroCode] images activeCategoryが取得できません。デフォルトで"common"を使用します。'),N="images-common"):ne==="common"?N="images-common":ne==="individual"?N="images-individual":N="images-special"}else if(l.value==="data")if(!f.value)console.warn('[ZeroCode] dataViewerRefが設定されていません。デフォルトで"page"を使用します。'),N="page";else{const ne=B(f.value),me=x(f.value);if(ne==null)console.warn('[ZeroCode] dataViewer internalActiveTabが取得できません。デフォルトで"page"を使用します。'),N="page";else if(ne==="page")N="page";else if(ne==="parts")me==null?(console.warn('[ZeroCode] dataViewer parts activeCategoryが取得できません。デフォルトで"common"を使用します。'),N="parts-common"):me==="common"?N="parts-common":me==="individual"?N="parts-individual":N="parts-special";else if(ne==="images")me==null?(console.warn('[ZeroCode] dataViewer images activeCategoryが取得できません。デフォルトで"common"を使用します。'),N="images-common"):me==="common"?N="images-common":me==="individual"?N="images-individual":N="images-special";else return console.warn(`[ZeroCode] dataViewer 不明なinternalActiveTab: ${ne}`),[]}else return[];let F;return N==="page"?F=["page","images-common","images-individual"]:N==="parts-common"?F=[N,"parts-common-css"]:N==="parts-individual"?F=[N,"parts-individual-css"]:N==="parts-special"?F=[N,"parts-special-css"]:F=[N],F}function Re(){if(!P.value){C();return}const N=Ne();if(N.length===0){console.warn(`[ZeroCode] ${t("editor.noSaveTargets")}`);return}m.value=N,h.value=!0}function C(){const N=Ne();if(N.length===0){console.warn(`[ZeroCode] ${t("editor.noSaveTargets")}`);return}le("save-request",{requestId:ge(),source:"editor",targets:N,timestamp:Date.now()})}function L(){h.value=!1,C()}function V(){h.value=!1,m.value=[]}function S(N){const{t:F}=Vt();return{page:F("saveConfirm.targets.page"),"parts-common":F("saveConfirm.targets.parts-common"),"parts-individual":F("saveConfirm.targets.parts-individual"),"parts-special":F("saveConfirm.targets.parts-special"),"images-common":F("saveConfirm.targets.images-common"),"images-individual":F("saveConfirm.targets.images-individual"),"images-special":F("saveConfirm.targets.images-special"),"parts-common-css":F("saveConfirm.targets.parts-common-css"),"parts-individual-css":F("saveConfirm.targets.parts-individual-css"),"parts-special-css":F("saveConfirm.targets.parts-special-css")}[N]||N}return e({getData:Z,setData:Y,allowDynamicContentInteraction:G}),(N,F)=>(s.openBlock(),s.createElementBlock("div",KM,[s.createElementVNode("div",JM,[s.createElementVNode("div",XM,[s.createElementVNode("button",{class:s.normalizeClass([{active:l.value==="edit"},"zcode-dev-tab"]),onClick:F[0]||(F[0]=ne=>te("edit"))},[s.createVNode(s.unref(Ws),{size:16}),s.createElementVNode("span",null,s.toDisplayString(N.$t("editor.pageManagement")),1)],2),r.value?(s.openBlock(),s.createElementBlock("button",{key:0,class:s.normalizeClass([{active:l.value==="parts"},"zcode-dev-tab"]),onClick:F[1]||(F[1]=ne=>te("parts"))},[s.createVNode(s.unref(Sm),{size:16}),s.createElementVNode("span",null,s.toDisplayString(N.$t("editor.partsManagement")),1)],2)):s.createCommentVNode("",!0),i.value?(s.openBlock(),s.createElementBlock("button",{key:1,class:s.normalizeClass([{active:l.value==="images"},"zcode-dev-tab"]),onClick:F[2]||(F[2]=ne=>te("images"))},[s.createVNode(s.unref(mc),{size:16}),s.createElementVNode("span",null,s.toDisplayString(N.$t("editor.imagesManagement")),1)],2)):s.createCommentVNode("",!0),s.createElementVNode("button",{class:s.normalizeClass([{active:l.value==="data"},"zcode-dev-tab"]),onClick:F[3]||(F[3]=ne=>te("data"))},[s.createVNode(s.unref(ym),{size:16}),s.createElementVNode("span",null,s.toDisplayString(N.$t("editor.dataViewer")),1)],2),s.createElementVNode("button",{class:"zcode-dev-tab zcode-dev-settings-btn",title:N.$t("toolbar.settings"),onClick:F[4]||(F[4]=ne=>p.value=!0)},[s.createVNode(s.unref(bc),{size:16})],8,YM)])]),l.value==="edit"?(s.openBlock(),s.createBlock(qd,{key:0,"current-mode":K.value,"view-mode":a.value,"allow-dynamic-content-interaction":G.value,onSwitchMode:X,onSwitchViewMode:F[5]||(F[5]=ne=>a.value=ne),onOpenSettings:oe},null,8,["current-mode","view-mode","allow-dynamic-content-interaction"])):s.createCommentVNode("",!0),a.value==="preview"&&R.value?(s.openBlock(),s.createBlock(ka,{key:1,"cms-data":R.value,"allow-dynamic-content-interaction":G.value},null,8,["cms-data","allow-dynamic-content-interaction"])):s.createCommentVNode("",!0),s.withDirectives(s.createVNode(_s,{ref_key:"cmsRef",ref:c,locale:o.locale,page:o.page,"css-common":o.cssCommon,"css-individual":o.cssIndividual,"css-special":o.cssSpecial,"parts-common":o.partsCommon,"parts-individual":o.partsIndividual,"parts-special":o.partsSpecial,"images-common":o.imagesCommon,"images-individual":o.imagesIndividual,"images-special":o.imagesSpecial,config:o.config,endpoints:o.endpoints,"backend-data":o.backendData},null,8,["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data"]),[[s.vShow,a.value==="manage"&&l.value==="edit"]]),a.value==="manage"&&r.value&&l.value==="parts"&&R.value?(s.openBlock(),s.createBlock(Yz,{key:2,ref_key:"partsManagerRef",ref:d,"cms-data":R.value,config:s.unref(y)},null,8,["cms-data","config"])):s.createCommentVNode("",!0),a.value==="manage"&&r.value&&l.value==="parts"&&!R.value?(s.openBlock(),s.createElementBlock("div",QM,[s.createElementVNode("div",ZM,s.toDisplayString(N.$t("editor.loading")),1)])):s.createCommentVNode("",!0),a.value==="manage"&&i.value&&l.value==="images"&&R.value?(s.openBlock(),s.createBlock(LM,{key:4,ref_key:"imagesManagerRef",ref:u,"cms-data":R.value,config:s.unref(y)},null,8,["cms-data","config"])):s.createCommentVNode("",!0),a.value==="manage"&&i.value&&l.value==="images"&&!R.value?(s.openBlock(),s.createElementBlock("div",eA,[s.createElementVNode("div",tA,s.toDisplayString(N.$t("editor.loading")),1)])):s.createCommentVNode("",!0),s.withDirectives(s.createVNode(GM,{ref_key:"dataViewerRef",ref:f,"cms-data":R.value,config:s.unref(y)},null,8,["cms-data","config"]),[[s.vShow,a.value==="manage"&&l.value==="data"&&R.value]]),s.withDirectives(s.createVNode(Yd,{"is-open":p.value,"view-mode":a.value,mode:"dev-tabs","show-save-confirm":P.value,onClose:F[6]||(F[6]=ne=>p.value=!1),onToggleSaveConfirm:ee},null,8,["is-open","view-mode","show-save-confirm"]),[[s.vShow,p.value]]),a.value==="manage"?(s.openBlock(),s.createElementBlock("div",nA,[s.createElementVNode("button",{class:"zcode-save-btn",onClick:Re},[s.createVNode(s.unref(yc),{size:16}),s.createElementVNode("span",null,s.toDisplayString(N.$t("common.save")),1)])])):s.createCommentVNode("",!0),h.value?(s.openBlock(),s.createElementBlock("div",{key:7,class:"zcode-save-confirm-dialog-overlay",onClick:s.withModifiers(V,["self"])},[s.createElementVNode("div",oA,[s.createElementVNode("div",rA,[s.createElementVNode("div",iA,s.toDisplayString(N.$t("saveConfirm.title")),1)]),s.createElementVNode("div",sA,[s.createElementVNode("p",null,s.toDisplayString(N.$t("saveConfirm.message")),1),s.createElementVNode("ul",aA,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(m.value,ne=>(s.openBlock(),s.createElementBlock("li",{key:ne},s.toDisplayString(S(ne)),1))),128))])]),s.createElementVNode("div",lA,[s.createElementVNode("button",{class:"zcode-btn-secondary",onClick:V},s.toDisplayString(N.$t("common.cancel")),1),s.createElementVNode("button",{class:"zcode-btn-primary",onClick:L},s.toDisplayString(N.$t("saveConfirm.saveButton")),1)])])])):s.createCommentVNode("",!0)]))}});Wh();class cA extends HTMLElement{app=null;componentInstance=null;_shadowRoot=null;constructor(){super()}connectedCallback(){if(this.app)return;this.getAttribute("use-shadow-dom")!=="false"?(this.setupShadowDOM(),window.addEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this))):(this.setupLightDOM(),window.addEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this)))}setupLightDOM(){const e=this.getAttribute("page")||"[]",t=this.getAttribute("css-common"),o=this.getAttribute("css-individual"),r=this.getAttribute("css-special"),i=this.getAttribute("parts-common")||"[]",a=this.getAttribute("parts-individual")||"[]",l=this.getAttribute("parts-special")||"[]",c=this.getAttribute("images-common")||"[]",d=this.getAttribute("images-individual")||"[]",u=this.getAttribute("images-special")||"[]",f=Os(this);this.app=s.createApp(lc,{locale:f,page:e,cssCommon:t,cssIndividual:o,cssSpecial:r,partsCommon:i,partsIndividual:a,partsSpecial:l,imagesCommon:c,imagesIndividual:d,imagesSpecial:u,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||"",enablePartsManager:this.getAttribute("enable-parts-manager")!=="false",enableImagesManager:this.getAttribute("enable-images-manager")!=="false"}),Ds(this.app,f),this.componentInstance=this.app.mount(this),this.injectLightDOMCSS()}setupShadowDOM(){const e=this.shadowRoot,t=!!e;e?(this._shadowRoot=e,this.clearScripts()):(this._shadowRoot=this.attachShadow({mode:"open"}),this.injectCSS());const o=this.getAttribute("page")||"[]",r=this.getAttribute("css-common"),i=this.getAttribute("css-individual"),a=this.getAttribute("css-special"),l=this.getAttribute("parts-common")||"[]",c=this.getAttribute("parts-individual")||"[]",d=this.getAttribute("parts-special")||"[]",u=this.getAttribute("images-common")||"[]",f=this.getAttribute("images-individual")||"[]",p=this.getAttribute("images-special")||"[]",h=Os(this);this.app=s.createApp(lc,{locale:h,page:o,cssCommon:r,cssIndividual:i,cssSpecial:a,partsCommon:l,partsIndividual:c,partsSpecial:d,imagesCommon:u,imagesIndividual:f,imagesSpecial:p,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||"",enablePartsManager:this.getAttribute("enable-parts-manager")!=="false",enableImagesManager:this.getAttribute("enable-images-manager")!=="false"}),Ds(this.app,h),this.componentInstance=this.app.mount(this._shadowRoot),requestAnimationFrame(()=>{requestAnimationFrame(()=>{setTimeout(()=>{this.injectScript(t)},100)})})}injectCSS(){if(!this._shadowRoot)return;const e=document.createElement("style");e.textContent=Hh,this._shadowRoot.appendChild(e),this.querySelectorAll('[slot="css"]').forEach(o=>{const r=o.cloneNode(!0);r.removeAttribute("slot"),this._shadowRoot.appendChild(r),o.remove()})}injectLightDOMCSS(){this.querySelectorAll('[slot="css"]').forEach(t=>{const o=t.cloneNode(!0);o.removeAttribute("slot"),document.head.appendChild(o)})}clearScripts(){if(!this._shadowRoot)return;this._shadowRoot.querySelectorAll("script").forEach(t=>{t.remove()})}injectScript(e=!1){if(!this._shadowRoot)return;const t=this.querySelectorAll('[slot="script"]'),o=Array.from(t),r=[],i=[];o.forEach(c=>{const d=c;if(!d.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}d.src.includes("jquery")||d.src.includes("code.jquery.com")?r.push(d):i.push(d)});const a=c=>{let d=c.src;if(e)try{const f=new URL(c.src,window.location.href);f.searchParams.set("_t",Date.now().toString()),d=f.toString()}catch{d=c.src+(c.src.includes("?")?"&":"?")+"_t="+Date.now()}const u=document.createElement("script");return u.src=d,c.type&&(u.type=c.type),c.async&&(u.async=!0),c.defer&&(u.defer=!0),c.integrity&&(u.integrity=c.integrity),c.crossOrigin&&(u.crossOrigin=c.crossOrigin),u.onerror=f=>{console.error(`Failed to load script: ${c.src}`,f)},u},l=()=>{o.forEach(c=>{c.remove()})};if(r.length>0){let c=0;const d=r.length;r.forEach(u=>{const f=a(u);f.onload=()=>{c++,c===d&&(_o(this._shadowRoot,e),requestAnimationFrame(()=>{i.forEach(p=>{this._shadowRoot.appendChild(a(p))}),l()}))},this._shadowRoot.appendChild(f)})}else _o(this._shadowRoot,e),i.forEach(c=>{this._shadowRoot.appendChild(a(c))}),l()}injectLightDOMScripts(){const e=this.querySelectorAll('[slot="script"]'),t=[],o=[];e.forEach(i=>{const a=i;if(!a.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}a.src.includes("jquery")||a.src.includes("code.jquery.com")?t.push(a):o.push(a)});const r=i=>{const a=document.createElement("script");return a.src=i.src,i.type&&(a.type=i.type),i.async&&(a.async=!0),i.defer&&(a.defer=!0),i.integrity&&(a.integrity=i.integrity),i.crossOrigin&&(a.crossOrigin=i.crossOrigin),a.onerror=l=>{console.error(`Failed to load script: ${i.src}`,l)},a};if(t.length>0){let i=0;const a=t.length;t.forEach(l=>{const c=r(l);c.onload=()=>{i++,i===a&&requestAnimationFrame(()=>{o.forEach(d=>{document.body.appendChild(r(d))})})},document.body.appendChild(c)})}else o.forEach(i=>{document.body.appendChild(r(i))})}getData(e){return this.componentInstance&&this.componentInstance.getData?this.componentInstance.getData(e):null}setData(e,t){return this.componentInstance&&this.componentInstance.setData?this.componentInstance.setData(e,t):!1}get allowDynamicContentInteraction(){if(this.componentInstance){const e=this.componentInstance.allowDynamicContentInteraction;if(e!==void 0)return e&&typeof e=="object"&&"value"in e?e.value:e}return!0}set allowDynamicContentInteraction(e){if(this.componentInstance){const t=this.componentInstance.allowDynamicContentInteraction;t!==void 0&&(t&&typeof t=="object"&&"value"in t?t.value=e:this.componentInstance.allowDynamicContentInteraction=e)}}disconnectedCallback(){if(this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot){if(this._shadowRoot.__zecEventListeners){const e=this._shadowRoot.__zecEventListeners,t=this._shadowRoot;e.forEach(o=>{o.forEach(r=>{t.removeEventListener(r.eventName,r.handler,!0)})}),e.clear()}if(window.__zecShadowRoots){const e=window.__zecShadowRoots,t=this._shadowRoot;for(const[o,r]of e.entries())r===t&&e.delete(o)}}this._shadowRoot=null,window.removeEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this)),window.removeEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this))}handleDOMUpdated(){if(!this._shadowRoot||this.getAttribute("use-shadow-dom")!=="true")return;this._shadowRoot.__zecJQueryExtended&&delete this._shadowRoot.__zecJQueryExtended;const e=this._shadowRoot.querySelector("script[data-zec-shadow-extension]");e&&e.remove(),_o(this._shadowRoot,!0)}handleLightDOMUpdated(){this.getAttribute("use-shadow-dom")!=="true"&&(this.__lightDOMScriptsLoaded||(this.injectLightDOMScripts(),this.__lightDOMScriptsLoaded=!0))}static get observedAttributes(){return["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data","enable-parts-manager","enable-images-manager","use-shadow-dom"]}attributeChangedCallback(e,t,o){if(t!==o){if(e==="use-shadow-dom"){this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot&&(this._shadowRoot.innerHTML="",this._shadowRoot=null),this.connectedCallback();return}this.app&&(this.app.unmount(),this.app=null,this.componentInstance=null,this.connectedCallback())}}}customElements.get("zcode-editor")||customElements.define("zcode-editor",cA);class Gr extends Error{constructor(e,t,o){super(o),this.code=e,this.path=t,this.name="RenderError"}}function dA(n,e={}){const{enableEditorAttributes:t=!1}=e,o=n.backendData;if(!n)throw new Gr("PARSE_ERROR","","データが提供されていません");const r=n.parts||{common:[],individual:[],special:[]},i=n.images||{common:[],individual:[],special:[]},a=n.page||[];function l(d){return xa(d,r)}function c(d,u="",f=new Set){if(f.has(u))throw new Gr("CIRCULAR_REFERENCE",u,`循環参照が検出されました: ${u}`);f.add(u);const p=d.part_id,h=l(p);if(!h)throw new Gr("PART_NOT_FOUND",u,`パーツが見つかりません: ${p}`);const m=fi(h.body,d,u,l,(g,y)=>c(g,y,f),t,i.common,i.individual,i.special,o);return t?Hd(m,{"data-zcode-id":d.id,"data-zcode-path":u,"data-zcode-part":p}):m}return a.map((d,u)=>{try{return c(d,`page.${u}`)}catch(f){if(f instanceof Gr)return`<div class="zcode-error-message" data-error-code="${f.code}">${f.message}</div>`;throw f}}).join("")}Qt.RenderError=Gr,Qt.ZeroCodeCMS=_s,Qt.ZeroCodeEditor=lc,Qt.ZeroCodePreview=ka,Qt.renderToHtml=dA,Object.defineProperty(Qt,Symbol.toStringTag,{value:"Module"})}));
|