@opengis/richtext 0.0.25 → 0.0.26

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/dist/richtext.js CHANGED
@@ -26465,14 +26465,17 @@ const kL = { class: "relative" }, CL = {
26465
26465
  setup(t) {
26466
26466
  const e = t, n = O(!1), r = O(!1), o = O({}), s = O({
26467
26467
  src: "",
26468
+ file: "",
26468
26469
  alt: "",
26469
- title: ""
26470
- }), i = $(() => [
26470
+ title: "",
26471
+ width: "",
26472
+ height: ""
26473
+ }), i = $(() => s.value.src || s.value.file || ""), l = $(() => [
26471
26474
  {
26472
26475
  name: "src",
26473
26476
  label: "URL зображення",
26474
26477
  type: "text",
26475
- required: !0,
26478
+ required: !1,
26476
26479
  placeholder: "https://example.com/image.png"
26477
26480
  },
26478
26481
  {
@@ -26510,15 +26513,18 @@ const kL = { class: "relative" }, CL = {
26510
26513
  required: !1,
26511
26514
  placeholder: "Заголовок зображення"
26512
26515
  }
26513
- ]), l = () => {
26516
+ ]), a = () => {
26514
26517
  s.value = {
26515
26518
  src: "",
26519
+ file: "",
26516
26520
  alt: "",
26517
- title: ""
26521
+ title: "",
26522
+ width: "",
26523
+ height: ""
26518
26524
  }, r.value = !1, n.value = !0;
26519
- }, a = () => {
26525
+ }, c = () => {
26520
26526
  n.value = !1, r.value = !1;
26521
- }, c = async () => {
26527
+ }, u = async () => {
26522
26528
  if (await o.value.validate()) {
26523
26529
  Qe({
26524
26530
  type: "warning",
@@ -26527,11 +26533,11 @@ const kL = { class: "relative" }, CL = {
26527
26533
  });
26528
26534
  return;
26529
26535
  }
26530
- if (!s.value.src) {
26536
+ if (!s.value.src && !s.value.file) {
26531
26537
  Qe({
26532
26538
  type: "warning",
26533
26539
  title: "Попередження",
26534
- message: "Будь ласка, введіть URL зображення"
26540
+ message: "Будь ласка, введіть URL зображення або виберіть файл"
26535
26541
  });
26536
26542
  return;
26537
26543
  }
@@ -26541,39 +26547,39 @@ const kL = { class: "relative" }, CL = {
26541
26547
  title: s.value.title || "",
26542
26548
  width: s.value.width || "",
26543
26549
  height: s.value.height || ""
26544
- }).run(), a();
26545
- }, u = async () => {
26546
- await c();
26547
- }, d = () => {
26548
- a();
26550
+ }).run(), c();
26551
+ }, d = async () => {
26552
+ await u();
26553
+ }, f = () => {
26554
+ c();
26549
26555
  };
26550
- return we(() => s.value.src, () => {
26556
+ return we(() => [s.value.src, s.value.file], () => {
26551
26557
  r.value = !1;
26552
- }), (f, p) => (b(), k("div", kL, [
26558
+ }), (p, h) => (b(), k("div", kL, [
26553
26559
  m("button", {
26554
- onClick: l,
26560
+ onClick: a,
26555
26561
  class: H([
26556
26562
  "h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",
26557
26563
  t.editor?.isActive("image") ? "bg-gray-200 text-gray-900" : ""
26558
26564
  ]),
26559
26565
  title: "Додати зображення"
26560
- }, [...p[4] || (p[4] = [
26566
+ }, [...h[4] || (h[4] = [
26561
26567
  dt('<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"></rect><circle cx="9" cy="9" r="2"></circle><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"></path></svg><span class="sr-only">Додати зображення</span>', 2)
26562
26568
  ])], 2),
26563
26569
  ie(lm, {
26564
26570
  modelValue: n.value,
26565
- "onUpdate:modelValue": p[3] || (p[3] = (h) => n.value = h),
26571
+ "onUpdate:modelValue": h[3] || (h[3] = (g) => n.value = g),
26566
26572
  title: "Додати зображення"
26567
26573
  }, {
26568
26574
  footer: Ne(() => [
26569
26575
  m("div", { class: "flex justify-end gap-x-2 p-[20px]" }, [
26570
26576
  m("button", {
26571
- onClick: d,
26577
+ onClick: f,
26572
26578
  type: "button",
26573
26579
  class: "px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500"
26574
26580
  }, " Скасувати "),
26575
26581
  m("button", {
26576
- onClick: u,
26582
+ onClick: d,
26577
26583
  type: "button",
26578
26584
  class: "px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500"
26579
26585
  }, " Додати зображення ")
@@ -26582,19 +26588,19 @@ const kL = { class: "relative" }, CL = {
26582
26588
  default: Ne(() => [
26583
26589
  ie(le(lo), {
26584
26590
  modelValue: s.value,
26585
- "onUpdate:modelValue": p[0] || (p[0] = (h) => s.value = h),
26586
- schema: i.value,
26591
+ "onUpdate:modelValue": h[0] || (h[0] = (g) => s.value = g),
26592
+ schema: l.value,
26587
26593
  form: o.value,
26588
- "onUpdate:form": p[1] || (p[1] = (h) => o.value = h)
26594
+ "onUpdate:form": h[1] || (h[1] = (g) => o.value = g)
26589
26595
  }, null, 8, ["modelValue", "schema", "form"]),
26590
- s.value.src ? (b(), k("div", CL, [
26591
- p[5] || (p[5] = m("p", { class: "text-sm text-gray-600 mb-2" }, "Попередній перегляд:", -1)),
26596
+ i.value ? (b(), k("div", CL, [
26597
+ h[5] || (h[5] = m("p", { class: "text-sm text-gray-600 mb-2" }, "Попередній перегляд:", -1)),
26592
26598
  Oe(m("img", {
26593
- src: s.value.src,
26599
+ src: i.value,
26594
26600
  alt: s.value.alt || "Попередній перегляд зображення",
26595
26601
  title: s.value.title,
26596
26602
  class: "max-w-full h-auto max-h-32 rounded border",
26597
- onError: p[2] || (p[2] = (h) => r.value = !0)
26603
+ onError: h[2] || (h[2] = (g) => r.value = !0)
26598
26604
  }, null, 40, EL), [
26599
26605
  [ss, !r.value]
26600
26606
  ]),
@@ -117,7 +117,7 @@ ${y}
117
117
  2. Cannot start or end with "-"
118
118
  3. "-" cannot repeat`);Ve.customSchemes.push([n,e])}function Ux(){Ve.scanner=Dx(Ve.customSchemes);for(let n=0;n<Ve.tokenQueue.length;n++)Ve.tokenQueue[n][1]({scanner:Ve.scanner});Ve.parser=Px(Ve.scanner.tokens);for(let n=0;n<Ve.pluginQueue.length;n++)Ve.pluginQueue[n][1]({scanner:Ve.scanner,parser:Ve.parser});return Ve.initialized=!0,Ve}function Sa(n){return Ve.initialized||Ux(),$x(Ve.parser.start,n,cp(Ve.scanner.start,n))}Sa.scan=cp;function gp(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 r=new va(t),o=Sa(n),s=[];for(let l=0;l<o.length;l++){const a=o[l];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}var Na="[\0-   ᠎ -\u2029  ]",Wx=new RegExp(Na),Kx=new RegExp(`${Na}$`),qx=new RegExp(Na,"g");function Gx(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function Jx(n){return new Oe({key:new $e("autolink"),appendTransaction:(e,t,r)=>{const o=e.some(d=>d.docChanged)&&!t.doc.eq(r.doc),s=e.some(d=>d.getMeta("preventAutolink"));if(!o||s)return;const{tr:l}=r,a=tf(t.doc,[...e]);if(ff(a).forEach(({newRange:d})=>{const u=Ib(r.doc,d,h=>h.isTextblock);let f,p;if(u.length>1)f=u[0],p=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(d.from,d.to," "," ");if(!Kx.test(h))return;f=u[0],p=r.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&p){const h=p.split(Wx).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=Sa(m).map(b=>b.toObject(n.defaultProtocol));if(!Gx(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:g+b.start+1,to:g+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>n.validate(b.value)).filter(b=>n.shouldAutoLink(b.value)).forEach(b=>{zi(b.from,b.to,r.doc).some(k=>k.mark.type===n.type)||l.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!l.steps.length)return l}})}function Yx(n){return new Oe({key:new $e("handleClickLink"),props:{handleClick:(e,t,r)=>{var o,s;if(r.button!==0||!e.editable)return!1;let l=null;if(r.target instanceof HTMLAnchorElement)l=r.target;else{let u=r.target;const f=[];for(;u.nodeName!=="DIV";)f.push(u),u=u.parentNode;l=f.find(p=>p.nodeName==="A")}if(!l)return!1;const a=uf(e.state,n.type.name),c=(o=l?.href)!=null?o:a.href,d=(s=l?.target)!=null?s:a.target;return n.enableClickSelection&&n.editor.commands.extendMarkRange(n.type.name),l&&c?(window.open(c,d),!0):!1}}})}function Xx(n){return new Oe({key:new $e("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:o}=e,{selection:s}=o,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(d=>{a+=d.textContent});const c=gp(a,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===a);return!a||!c?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}function hr(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&t.push(o)}),!n||n.replace(qx,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var yp=Ht.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"){mp(n);return}mp(n.scheme,n.optionalSlashes)})},onDestroy(){jx()},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)=>!!hr(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},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=>!!hr(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=>!!hr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",xe(this.options.HTMLAttributes,n),0]:["a",xe(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!hr(r,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:r=>!!hr(r,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[$n({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,o=gp(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:l=>!!hr(l,t),protocols:t,defaultProtocol:r}));o.length&&o.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.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(Jx({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!hr(o,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(Yx({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(Xx({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),Zx=Object.defineProperty,Qx=(n,e)=>{for(var t in e)Zx(n,t,{get:e[t],enumerable:!0})},ew="listItem",bp="textStyle",kp=/^\s*([-+*])\s$/,xp=Ue.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",xe(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ew,this.editor.getAttributes(bp)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Or({find:kp,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Or({find:kp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(bp),editor:this.editor})),[n]}}),wp=Ue.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",xe(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),tw={};Qx(tw,{findListItemPos:()=>_o,getNextListDepth:()=>Ma,handleBackspace:()=>Ta,handleDelete:()=>Aa,hasListBefore:()=>Ep,hasListItemAfter:()=>nw,hasListItemBefore:()=>Cp,listItemHasSubList:()=>vp,nextListIsDeeper:()=>_p,nextListIsHigher:()=>Sp});var _o=(n,e)=>{const{$from:t}=e.selection,r=He(n,e.schema);let o=null,s=t.depth,l=t.pos,a=null;for(;s>0&&a===null;)o=t.node(s),o.type===r?a=s:(s-=1,l-=1);return a===null?null:{$pos:e.doc.resolve(l),depth:a}},Ma=(n,e)=>{const t=_o(n,e);if(!t)return!1;const[,r]=Ub(e,n,t.$pos.pos+4);return r},Ep=(n,e,t)=>{const{$anchor:r}=n.selection,o=Math.max(0,r.pos-2),s=n.doc.resolve(o).node();return!(!s||!t.includes(s.type.name))},Cp=(n,e)=>{var t;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-2);return!(o.index()===0||((t=o.nodeBefore)==null?void 0:t.type.name)!==n)},vp=(n,e,t)=>{if(!t)return!1;const r=He(n,e.schema);let o=!1;return t.descendants(s=>{s.type===r&&(o=!0)}),o},Ta=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Pn(n.state,e)&&Ep(n.state,e,t)){const{$anchor:a}=n.state.selection,c=n.state.doc.resolve(a.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:a.start()-1,to:a.end()+1},f.end()).joinForward().run()}if(!Pn(n.state,e)||!Gb(n.state))return!1;const r=_o(e,n.state);if(!r)return!1;const s=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),l=vp(e,n.state,s);return Cp(e,n.state)&&!l?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},_p=(n,e)=>{const t=Ma(n,e),r=_o(n,e);return!r||!t?!1:t>r.depth},Sp=(n,e)=>{const t=Ma(n,e),r=_o(n,e);return!r||!t?!1:t<r.depth},Aa=(n,e)=>{if(!Pn(n.state,e)||!qb(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:o}=t;return!t.empty&&r.sameParent(o)?!1:_p(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():Sp(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},nw=(n,e)=>{var t;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-r.parentOffset-2);return!(o.index()===o.parent.childCount-1||((t=o.nodeAfter)==null?void 0:t.type.name)!==n)},Np=Ee.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&&Aa(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&&Aa(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Ta(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Ta(n,t,r)&&(e=!0)}),e}}}}),rw="listItem",Mp="textStyle",Tp=/^(\d+)\.\s$/,Ap=Ue.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",xe(this.options.HTMLAttributes,t),0]:["ol",xe(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(rw,this.editor.getAttributes(Mp)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Or({find:Tp,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=Or({find:Tp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Mp)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),ow=/^\s*(\[([( |x])?\])\s$/,sw=Ue.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",xe(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},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:r})=>{const o=document.createElement("li"),s=document.createElement("label"),l=document.createElement("span"),a=document.createElement("input"),c=document.createElement("div"),d=u=>{var f,p;a.ariaLabel=((p=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:p.call(f,u,a.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return d(n),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=u.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const h=t();if(typeof h!="number")return!1;const m=p.doc.nodeAt(h);return p.setNodeMarkup(h,void 0,{...m?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,f])=>{o.setAttribute(u,f)}),o.dataset.checked=n.attrs.checked,a.checked=n.attrs.checked,s.append(a,l),o.append(s,c),Object.entries(e).forEach(([u,f])=>{o.setAttribute(u,f)}),{dom:o,contentDOM:c,update:u=>u.type!==this.type?!1:(o.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,d(u),!0)}}},addInputRules(){return[Or({find:ow,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),lw=Ue.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",xe(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ee.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(xp.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(wp.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Np.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Ap.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(sw.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(lw.configure(this.options.taskList)),n}});var Bp=Ue.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",xe(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),iw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,aw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,cw=Ht.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",xe(this.options.HTMLAttributes,n),0]},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[ur({find:iw,type:this.type})]},addPasteRules(){return[$n({find:aw,type:this.type})]}}),dw=Ue.create({name:"text",group:"inline"}),uw=Ht.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",xe(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function fw(n={}){return new Oe({view(e){return new pw(e,n)}})}class pw{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let s=l=>{this[o](l)};return e.dom.addEventListener(o,s),{name:o,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,o=this.editorView.dom,s=o.getBoundingClientRect(),l=s.width/o.offsetWidth,a=s.height/o.offsetHeight;if(t){let f=e.nodeBefore,p=e.nodeAfter;if(f||p){let h=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(h){let m=h.getBoundingClientRect(),g=f?m.bottom:m.top;f&&p&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*a;r={left:m.left,right:m.right,top:g-y,bottom:g+y}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*l;r={left:f.left-p,right:f.left+p,top:f.top,bottom:f.bottom}}let c=this.editorView.dom.offsetParent;this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,u;if(!c||c==document.body&&getComputedStyle(c).position=="static")d=-pageXOffset,u=-pageYOffset;else{let f=c.getBoundingClientRect(),p=f.width/c.offsetWidth,h=f.height/c.offsetHeight;d=f.left-c.scrollLeft*p,u=f.top-c.scrollTop*h}this.element.style.left=(r.left-d)/l+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/l+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),o=r&&r.type.spec.disableDropCursor,s=typeof o=="function"?o(this.editorView,t,e):o;if(t&&!s){let l=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=ld(this.editorView.state.doc,l,this.editorView.dragging.slice);a!=null&&(l=a)}this.setCursor(l),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Fe extends le{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return Fe.valid(r)?new Fe(r):le.near(r)}content(){return q.empty}eq(e){return e instanceof Fe&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Fe(e.resolve(t.pos))}getBookmark(){return new Ba(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!hw(e)||!mw(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let o=t.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&Fe.valid(e))return e;let o=e.pos,s=null;for(let l=e.depth;;l--){let a=e.node(l);if(t>0?e.indexAfter(l)<a.childCount:e.index(l)>0){s=a.child(t>0?e.indexAfter(l):e.index(l)-1);break}else if(l==0)return null;o+=t;let c=e.doc.resolve(o);if(Fe.valid(c))return c}for(;;){let l=t>0?s.firstChild:s.lastChild;if(!l){if(s.isAtom&&!s.isText&&!ne.isSelectable(s)){e=e.doc.resolve(o+s.nodeSize*t),r=!1;continue e}break}s=l,o+=t;let a=e.doc.resolve(o);if(Fe.valid(a))return a}return null}}}Fe.prototype.visible=!1,Fe.findFrom=Fe.findGapCursorFrom,le.jsonID("gapcursor",Fe);class Ba{constructor(e){this.pos=e}map(e){return new Ba(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Fe.valid(t)?new Fe(t):le.near(t)}}function hw(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function mw(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function gw(){return new Oe({props:{decorations:xw,createSelectionBetween(n,e,t){return e.pos==t.pos&&Fe.valid(t)?new Fe(t):null},handleClick:bw,handleKeyDown:yw,handleDOMEvents:{beforeinput:kw}}})}const yw=Vi({ArrowLeft:hl("horiz",-1),ArrowRight:hl("horiz",1),ArrowUp:hl("vert",-1),ArrowDown:hl("vert",1)});function hl(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,s){let l=r.selection,a=e>0?l.$to:l.$from,c=l.empty;if(l instanceof oe){if(!s.endOfTextblock(t)||a.depth==0)return!1;c=!1,a=r.doc.resolve(e>0?a.after():a.before())}let d=Fe.findGapCursorFrom(a,e,c);return d?(o&&o(r.tr.setSelection(new Fe(d))),!0):!1}}function bw(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!Fe.valid(r))return!1;let o=n.posAtCoords({left:t.clientX,top:t.clientY});return o&&o.inside>-1&&ne.isSelectable(n.state.doc.nodeAt(o.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Fe(r))),!0)}function kw(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof Fe))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let o=I.empty;for(let l=r.length-1;l>=0;l--)o=I.from(r[l].createAndFill(null,o));let s=n.state.tr.replace(t.pos,t.pos,new q(o,0,0));return s.setSelection(oe.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function xw(n){if(!(n.selection instanceof Fe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Me.create(n.doc,[Ye.widget(n.selection.head,e,{key:"gapcursor"})])}var ml=200,Xe=function(){};Xe.prototype.append=function(e){return e.length?(e=Xe.from(e),!this.length&&e||e.length<ml&&this.leafAppend(e)||this.length<ml&&e.leafPrepend(this)||this.appendInner(e)):this},Xe.prototype.prepend=function(e){return e.length?Xe.from(e).append(this):this},Xe.prototype.appendInner=function(e){return new ww(this,e)},Xe.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Xe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Xe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Xe.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)},Xe.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(s,l){return o.push(e(s,l))},t,r),o},Xe.from=function(e){return e instanceof Xe?e:e&&e.length?new Vp(e):Xe.empty};var Vp=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,s){return o==0&&s==this.length?this:new e(this.values.slice(o,s))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,s,l,a){for(var c=s;c<l;c++)if(o(this.values[c],a+c)===!1)return!1},e.prototype.forEachInvertedInner=function(o,s,l,a){for(var c=s-1;c>=l;c--)if(o(this.values[c],a+c)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=ml)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=ml)return new e(o.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Xe);Xe.empty=new Vp([]);var ww=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,s,l){var a=this.left.length;if(o<a&&this.left.forEachInner(r,o,Math.min(s,a),l)===!1||s>a&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,s)-a,l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,s,l){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(s,a)-a,l+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(o,a),s,l)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var s=this.left.length;return o<=s?this.left.slice(r,o):r>=s?this.right.slice(r-s,o-s):this.left.slice(r,s).append(this.right.slice(0,o-s))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Xe);const Ew=500;class Ut{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,s;t&&(o=this.remapping(r,this.items.length),s=o.maps.length);let l=e.tr,a,c,d=[],u=[];return this.items.forEach((f,p)=>{if(!f.step){o||(o=this.remapping(r,p+1),s=o.maps.length),s--,u.push(f);return}if(o){u.push(new en(f.map));let h=f.step.map(o.slice(s)),m;h&&l.maybeStep(h).doc&&(m=l.mapping.maps[l.mapping.maps.length-1],d.push(new en(m,void 0,void 0,d.length+u.length))),s--,m&&o.appendMap(m,s)}else l.maybeStep(f.step);if(f.selection)return a=o?f.selection.map(o.slice(s)):f.selection,c=new Ut(this.items.slice(0,r).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:l,selection:a}}addTransform(e,t,r,o){let s=[],l=this.eventCount,a=this.items,c=!o&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let f=e.steps[u].invert(e.docs[u]),p=new en(e.mapping.maps[u],f,t),h;(h=c&&c.merge(p))&&(p=h,u?s.pop():a=a.slice(0,a.length-1)),s.push(p),t&&(l++,t=void 0),o||(c=p)}let d=l-r.depth;return d>vw&&(a=Cw(a,d),l-=d),new Ut(a.append(s),l)}remapping(e,t){let r=new Xr;return this.items.forEach((o,s)=>{let l=o.mirrorOffset!=null&&s-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,l)},e,t),r}addMaps(e){return this.eventCount==0?this:new Ut(this.items.append(e.map(t=>new en(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-t),s=e.mapping,l=e.steps.length,a=this.eventCount;this.items.forEach(p=>{p.selection&&a--},o);let c=t;this.items.forEach(p=>{let h=s.getMirror(--c);if(h==null)return;l=Math.min(l,h);let m=s.maps[h];if(p.step){let g=e.steps[h].invert(e.docs[h]),y=p.selection&&p.selection.map(s.slice(c+1,h));y&&a++,r.push(new en(m,g,y))}else r.push(new en(m))},o);let d=[];for(let p=t;p<l;p++)d.push(new en(s.maps[p]));let u=this.items.slice(0,o).append(d).append(r),f=new Ut(u,a);return f.emptyItemCount()>Ew&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,o=[],s=0;return this.items.forEach((l,a)=>{if(a>=e)o.push(l),l.selection&&s++;else if(l.step){let c=l.step.map(t.slice(r)),d=c&&c.getMap();if(r--,d&&t.appendMap(d,r),c){let u=l.selection&&l.selection.map(t.slice(r));u&&s++;let f=new en(d.invert(),c,u),p,h=o.length-1;(p=o.length&&o[h].merge(f))?o[h]=p:o.push(f)}}else l.map&&r--},this.items.length,0),new Ut(Xe.from(o.reverse()),s)}}Ut.empty=new Ut(Xe.empty,0);function Cw(n,e){let t;return n.forEach((r,o)=>{if(r.selection&&e--==0)return t=o,!1}),n.slice(t)}class en{constructor(e,t,r,o){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new en(t.getMap().invert(),t,this.selection)}}}class Wn{constructor(e,t,r,o,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=o,this.prevComposition=s}}const vw=20;function _w(n,e,t,r){let o=t.getMeta(mr),s;if(o)return o.historyState;t.getMeta(Mw)&&(n=new Wn(n.done,n.undone,null,0,-1));let l=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(l&&l.getMeta(mr))return l.getMeta(mr).redo?new Wn(n.done.addTransform(t,void 0,r,gl(e)),n.undone,Lp(t.mapping.maps),n.prevTime,n.prevComposition):new Wn(n.done,n.undone.addTransform(t,void 0,r,gl(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),c=n.prevTime==0||!l&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Sw(t,n.prevRanges)),d=l?Va(n.prevRanges,t.mapping):Lp(t.mapping.maps);return new Wn(n.done.addTransform(t,c?e.selection.getBookmark():void 0,r,gl(e)),Ut.empty,d,t.time,a??n.prevComposition)}else return(s=t.getMeta("rebased"))?new Wn(n.done.rebased(t,s),n.undone.rebased(t,s),Va(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Wn(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Va(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Sw(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,o)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&o>=e[s]&&(t=!0)}),t}function Lp(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,o,s,l)=>e.push(s,l));return e}function Va(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let o=e.map(n[r],1),s=e.map(n[r+1],-1);o<=s&&t.push(o,s)}return t}function Nw(n,e,t){let r=gl(e),o=mr.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,r);if(!s)return null;let l=s.selection.resolve(s.transform.doc),a=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),o,r),c=new Wn(t?a:s.remaining,t?s.remaining:a,null,0,-1);return s.transform.setSelection(l).setMeta(mr,{redo:t,historyState:c})}let La=!1,Op=null;function gl(n){let e=n.plugins;if(Op!=e){La=!1,Op=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){La=!0;break}}return La}const mr=new $e("history"),Mw=new $e("closeHistory");function Tw(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Oe({key:mr,state:{init(){return new Wn(Ut.empty,Ut.empty,null,0,-1)},apply(e,t,r){return _w(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,o=r=="historyUndo"?Dp:r=="historyRedo"?Rp:null;return o?(t.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function Ip(n,e){return(t,r)=>{let o=mr.getState(t);if(!o||(n?o.undone:o.done).eventCount==0)return!1;if(r){let s=Nw(o,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const Dp=Ip(!1,!0),Rp=Ip(!0,!0);Ee.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new Oe({key:new $e("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const o=this.options.limit;if(o==null||o===0){n=!0;return}const s=this.storage.characters({node:r.doc});if(s>o){const l=s-o,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(a,c);return n=!0,d}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:t.doc}),s=this.storage.characters({node:e.doc});if(s<=r||o>r&&s>r&&s<=o)return!0;if(o>r&&s>r&&s>o||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,c=s-r,d=a-c,u=a;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>r)}})]}});var Aw=Ee.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[fw(this.options)]}});Ee.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Oe({key:new $e("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:o}=e,s=[];if(!t||!r)return Me.create(n,[]);let l=0;this.options.mode==="deepest"&&n.descendants((c,d)=>{if(c.isText)return;if(!(o>=d&&o<=d+c.nodeSize-1))return!1;l+=1});let a=0;return n.descendants((c,d)=>{if(c.isText||!(o>=d&&o<=d+c.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&l-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(Ye.node(d,d+c.nodeSize,{class:this.options.className}))}),Me.create(n,s)}}})]}});var Bw=Ee.create({name:"gapCursor",addProseMirrorPlugins(){return[gw()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=ke(te(n,"allowGapCursor",t)))!=null?e:null}}});Ee.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Oe({key:new $e("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!t)return null;const s=this.editor.isEmpty;return n.descendants((l,a)=>{const c=r>=a&&r<=a+l.nodeSize,d=!l.isLeaf&&Cs(l);if((c||!this.options.showOnlyCurrent)&&d){const u=[this.options.emptyNodeClass];s&&u.push(this.options.emptyEditorClass);const f=Ye.node(a,a+l.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:a,hasAnchor:c}):this.options.placeholder});o.push(f)}return this.options.includeChildren}),Me.create(n,o)}}})]}}),Ee.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new Oe({key:new $e("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||mf(t.selection)||n.view.dragging?null:Me.create(t.doc,[Ye.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Fp({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var Vw=Ee.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:[]}},addProseMirrorPlugins(){const n=new $e(this.name),e=Object.entries(this.editor.schema.nodes).map(([,t])=>t).filter(t=>(this.options.notAfter||[]).concat(this.options.node).includes(t.name));return[new Oe({key:n,appendTransaction:(t,r,o)=>{const{doc:s,tr:l,schema:a}=o,c=n.getState(o),d=s.content.size,u=a.nodes[this.options.node];if(c)return l.insert(d,u.create())},state:{init:(t,r)=>{const o=r.tr.doc.lastChild;return!Fp({node:o,types:e})},apply:(t,r)=>{if(!t.docChanged)return r;const o=t.doc.lastChild;return!Fp({node:o,types:e})}}})]}}),Lw=Ee.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Dp(n,e),redo:()=>({state:n,dispatch:e})=>Rp(n,e)}},addProseMirrorPlugins(){return[Tw(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Ow=Ee.create({name:"starterKit",addExtensions(){var n,e,t,r;const o=[];return this.options.bold!==!1&&o.push(px.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(ax.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(xp.configure(this.options.bulletList)),this.options.code!==!1&&o.push(gx.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(kx.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(xx.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(Aw.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(Bw.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(wx.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(ep.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(Lw.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(Ex.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(Nx.configure(this.options.italic)),this.options.listItem!==!1&&o.push(wp.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(Np.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&o.push(yp.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(Ap.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(Bp.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(cw.configure(this.options.strike)),this.options.text!==!1&&o.push(dw.configure(this.options.text)),this.options.underline!==!1&&o.push(uw.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&o.push(Vw.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),Iw=Ow,Dw=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Rw=Ue.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",xe(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[Mf({find:Dw,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),Fw=Ee.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{style:`text-align: ${n.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).every(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:n=>({editor:e,commands:t})=>this.options.alignments.includes(n)?e.isActive({textAlign:n})?t.unsetTextAlign():t.setTextAlign(n):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});const Pw=async n=>{try{const e=new FormData;return e.append("unique","true"),e.append("file",n),(await(await fetch("/file/upload/uploads?id=&form=&table=",{method:"POST",body:e})).json())?.result}catch(e){console.error(e)}},$w=async(n,e)=>{const t=e.clipboardData?.items;if(t){const r=e.clipboardData?.getData("text/html"),o=e.clipboardData?.getData("text/plain");if(r){const{state:s,dispatch:l}=n,{tr:a}=s,c=wr.fromSchema(n.state.schema),d=new DOMParser().parseFromString(r,"text/html").body,u=c.parse(d),f=a.replaceSelectionWith(u);return l(f),e.preventDefault(),!0}if(o){const{state:s,dispatch:l}=n,{tr:a}=s,c=a.insertText(o,s.selection.from,s.selection.to);return l(c),e.preventDefault(),!0}for(let s=0;s<t.length;s++){const l=t[s];if(l.type.startsWith("image/")){const a=l.getAsFile();if(a){const c=await Pw(a),{schema:d}=n.state,u=d.nodes.image.create({src:c?.file_path}),f=n.state.tr.replaceSelectionWith(u);return n.dispatch(f),e.preventDefault(),!0}}}}return!1},zw={1:"font-weight:700; font-size:30px;",2:"font-weight:700; font-size:26px;",3:"font-weight:700; font-size:22px;",4:"font-weight:700; font-size:18px;",5:"font-weight:500; font-size:16px;",6:"font-weight:400; font-size:14px;"},Hw=ep.extend({addOptions(){return{...this.parent?.(),levels:[1,2,3,4,5,6]}}}).extend({addAttributes(){return{...this.parent?.(),level:{default:1,renderHTML:n=>{const e=n.level||1;return{class:`heading-level-${e}`,style:zw[e-1]}}}}}}),jw=Bp.configure({HTMLAttributes:{style:"min-height: 1rem;"}}),Uw=Yi.extend({addAttributes(){return{...this.parent?.(),fontFamily:{default:null,parseHTML:n=>n.style.fontFamily?.replace(/['"]/g,""),renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),Ww=Yi.extend({addAttributes(){return{...this.parent?.(),fontSize:{default:null,parseHTML:n=>n.style.fontSize?.replace(/['"]/g,""),renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}},addCommands(){return{setFontSize:n=>({chain:e})=>e().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),Kw=Ue.create({name:"iframe",group:"block",inline:!1,atom:!0,selectable:!0,addAttributes(){return{src:{default:null},width:{default:"100%"},height:{default:"280"},frameborder:{default:"0"},allow:{default:null},allowfullscreen:{default:null},referrerpolicy:{default:null},loading:{default:null},class:{default:null},title:{default:null},style:{default:null}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:n}){return["iframe",n]}});function Pp(n){let e=!1;const t=$1({content:n.modelValue,extensions:[Iw.configure({history:{depth:100,newGroupDelay:500},code:{HTMLAttributes:{class:"editor-code"}},codeBlock:{HTMLAttributes:{class:"editor-codeblock"}},paragraph:!1,heading:!1,link:!1}),lx,sx,G1,Uw,Ww,jw,Hw,ox,Rw,Fw.configure({types:["heading","paragraph"]}),yp.configure({HTMLAttributes:{class:"editor-link"},openOnClick:!1,autolink:!0}),tx.configure({table:{HTMLAttributes:{class:"editor-content"},resizable:!0}}),Kw],editorProps:{handlePaste:$w,handleKeyDown:(s,l)=>{if(l.key==="Tab"){const a=s.state,{selection:c}=a,{$anchor:d}=c;let u=!1;for(let f=d.depth;f>0;f--){const p=d.node(f);if(p&&(p.type.name==="bulletList"||p.type.name==="orderedList")){u=!0;break}}return u?!1:(l.preventDefault(),!0)}return!1}}}),r=i.computed(()=>t.value||null);return i.watch(t,s=>{s&&t.value.on("update",l=>{if(!e){e=!0;const a=l.editor.getHTML();n.modelValue,setTimeout(()=>{e=!1},10)}})}),{editor:t,editorInstance:r,focusEditor:()=>{t.value&&!t.value.isFocused&&t.value.commands.focus()}}}function $p(n,e){const t=i.ref(!1),r=i.ref(""),o=i.ref(null);return{isHtmlMode:t,htmlContent:r,htmlTextarea:o,toggleHtmlMode:a=>{t.value=a,a?(n.value&&(r.value=n.value.getHTML()),i.nextTick(()=>{o.value&&(o.value.focus(),setTimeout(()=>{o.value.formatCode()},100))})):n.value&&r.value&&n.value.commands.setContent(r.value,!0)},onHtmlInput:a=>{r.value=a,e&&e("update:modelValue",a)}}}function zp(){const n=i.ref(!1);return{isFullscreen:n,toggleFullscreen:()=>{n.value=!n.value}}}const Le=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t},qw={props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function Gw(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Blockquote",onClick:e[0]||(e[0]=(...l)=>s.toggleBlockquote&&s.toggleBlockquote(...l)),class:i.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none",{"bg-gray-100 text-gray-900":t.editor?.isActive("blockquote")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[i.createElementVNode("path",{"fill-rule":"evenodd",d:"M6 6a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3H5a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2H6Zm9 0a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3h-1a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3Z"})],-1)])],2)}const Jw=Le(qw,[["render",Gw]]),Yw={props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function Xw(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Bullet List",onClick:e[0]||(e[0]=(...l)=>s.toggleBulletList&&s.toggleBulletList(...l)),class:i.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("bulletList")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 8h10M9 12h10M9 16h10M4.99 8H5m-.02 4h.01m0 4H5"})],-1)])],2)}const Zw=Le(Yw,[["render",Xw]]),Qw={props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function eE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Ordered List",onClick:e[0]||(e[0]=(...l)=>s.toggleOrderedList&&s.toggleOrderedList(...l)),class:i.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("orderedList")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6h8m-8 6h8m-8 6h8M4 16a2 2 0 1 1 3.321 1.5L4 20h5M4 5l2-1v6m-2 0h4"})],-1)])],2)}const tE=Le(Qw,[["render",eE]]),nE={props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function rE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Code Block",onClick:e[0]||(e[0]=(...l)=>s.toggleCodeBlock&&s.toggleCodeBlock(...l)),class:i.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("codeBlock")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8 8-4 4 4 4m8 0 4-4-4-4m-2-3-4 14"})],-1)])],2)}const oE=Le(nE,[["render",rE]]),sE={props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.commands.toggleBold()}}};function lE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Bold Text",onClick:e[0]||(e[0]=(...l)=>s.toggleBold&&s.toggleBold(...l)),class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("bold")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 5h4.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0-7H6m2 7h6.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0 0H6"})],-1),i.createElementVNode("span",{class:"sr-only"},"Bold",-1)])],2)}const iE=Le(sE,[["render",lE]]),aE={props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function cE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Italic Text",onClick:e[0]||(e[0]=(...l)=>s.toggleItalic&&s.toggleItalic(...l)),class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("italic")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8.874 19 6.143-14M6 19h6.33m-.66-14H18"})],-1),i.createElementVNode("span",{class:"sr-only"},"Italic",-1)])],2)}const dE=Le(aE,[["render",cE]]),uE={__name:"vs-editor-underline",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor&&e.editor.chain().focus().toggleUnderline().run()};return(r,o)=>(i.openBlock(),i.createElementBlock("button",{title:"Underline",onClick:t,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[n.editor?.isActive("underline")?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...o[0]||(o[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M6 4v6a6 6 0 0 0 12 0V4"}),i.createElementVNode("line",{x1:"4",x2:"20",y1:"20",y2:"20"})],-1)])],2))}},fE={__name:"vs-editor-strike",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor&&e.editor.chain().focus().toggleStrike().run()};return(r,o)=>(i.openBlock(),i.createElementBlock("button",{title:"Strikethrough",onClick:t,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[n.editor?.isActive("strike")?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...o[0]||(o[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-strikethrough"},[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),i.createElementVNode("path",{d:"M5 12l14 0"}),i.createElementVNode("path",{d:"M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5"})],-1)])],2))}},pE={props:{visible:{type:Boolean,default:()=>!1},modelValue:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},size:{type:String,default:()=>""},closeClickBack:{type:Boolean,default:()=>!1}},emits:["update:visible","update:modelValue","onClose","confirm","cancel"],inheritAttrs:!1,name:"vs-dialog",mounted(){window.addEventListener("keydown",this.checkKey)},unmounted(){window.removeEventListener("keydown",this.checkKey)},computed:{hasSlot(){return!!this.$slots?.footer},checkSize(){return this.size==="small"?"md:w-5/12 w-9/12":this.size==="medium"?"md:w-6/12 w-9/12":"lg:w-7/12 w-11/12"}},methods:{checkKey({key:n}){n==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("update:modelValue",!1),this.$emit("onClose")},handleConfirm(){this.$emit("confirm"),this.handleClose()},handleCancel(){this.$emit("cancel"),this.handleClose()},closeByClickBack(n,e){e&&n.target.classList.contains("vs-dialog-overlay")&&this.handleClose()}}},hE={key:0,class:"vsTailwind ui-dialog__wrapper"},mE={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},gE={class:"font-medium text-gray-800 dark:text-[#ffffff]"},yE={class:"ui-dialog__content p-4"},bE={key:0,class:"flex justify-end gap-x-2"};function kE(n,e,t,r,o,s){return i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[t.visible||t.modelValue?(i.openBlock(),i.createElementBlock("div",hE,[i.createElementVNode("div",{onMousedown:e[1]||(e[1]=l=>s.closeByClickBack(l,t.closeClickBack)),class:"vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 z-[100001] bg-black bg-opacity-50"},[i.createVNode(i.Transition,{name:"content",appear:""},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["ui-dialog__modal opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",[s.checkSize]])},[i.createElementVNode("div",mE,[i.createElementVNode("h3",gE,i.toDisplayString(t.title),1),i.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:e[0]||(e[0]=(...l)=>s.handleClose&&s.handleClose(...l))},[...e[2]||(e[2]=[i.createElementVNode("span",{class:"sr-only"},"Close",-1),i.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",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"},[i.createElementVNode("path",{d:"M18 6 6 18"}),i.createElementVNode("path",{d:"m6 6 12 12"})],-1)])])]),i.createElementVNode("div",yE,[i.renderSlot(n.$slots,"default",{},void 0,!0)]),s.hasSlot?(i.openBlock(),i.createElementBlock("div",bE,[i.renderSlot(n.$slots,"footer",{handleClose:s.handleClose,handleConfirm:s.handleConfirm,handleCancel:s.handleCancel},void 0,!0)])):i.createCommentVNode("",!0)],2)]),_:3})],32)])):i.createCommentVNode("",!0)])}const Hp=Le(pE,[["render",kE],["__scopeId","data-v-6d0970a6"]]),xE={},wE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function EE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",wE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),i.createElementVNode("path",{d:"M6 6l12 12"},null,-1)])])}const CE=Le(xE,[["render",EE]]),vE={},_E={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",class:"icon icon-tabler icons-tabler-outline icon-tabler-search"};function SE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",_E,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),i.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)])])}const NE=Le(vE,[["render",SE]]),ME={},TE={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",class:"icon icon-tabler icons-tabler-outline icon-tabler-mail"};function AE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",TE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"},null,-1),i.createElementVNode("path",{d:"M3 7l9 6l9 -6"},null,-1)])])}const BE=Le(ME,[["render",AE]]),VE=i.defineComponent({components:{IconClose:CE,IconSearch:NE,IconEmail:BE},inheritAttrs:!1,props:{icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},modelValue:{type:String,default:()=>""},placeholder:{type:String,default:()=>""},iconPosition:{type:String,default:()=>"right"},type:{type:String,default:()=>"text"},style:{type:Object,default:()=>null},size:{type:String,default:()=>"md"},attrs:{type:Object,default:()=>{}}},emits:["onInput","update:modelValue","blur","focus"],computed:{checkSize(){if((this.style?.size||this.size)==="xs")return"h-[32px] text-sm";if((this.style?.size||this.size)==="md")return"h-[38px] text-sm";this.style?.size||this.size},value:{get(){return this.modelValue},set(n){this.$emit("update:modelValue",n.trim())}},clearIconStyle(){return[{"right-8":this.icon&&this.iconPosition==="right","right-3":!this.icon||this.iconPosition!=="right","pointer-events-none":this.disabled}]},iconStylePosition(){return[{"left-3":this.icon&&this.iconPosition==="left","right-3":this.icon&&this.iconPosition==="right"}]},inputStyle(){return[{"!pr-8":this.clearable&&!this.icon,"!pr-7":this.clearable,"!pr-16":this.clearable&&this.icon&&this.iconPosition==="right","!pl-8":this.icon&&this.iconPosition==="left","!pr-[50px]":this.clearable&&this.value&&this.icon&&this.iconPosition==="right","!cursor-not-allowed bg-slate-100":this.disabled,"bg-white":!this.disabled}]}},methods:{handleInput(){this.$emit("onInput",this.modelValue)},handleBlur(){this.$emit("blur")},handleFocus(){this.$emit("focus")},clearInput(){this.$emit("update:modelValue",""),this.$emit("onInput","")},async inputFocus(){const{vsText:n}=await this.$refs;await n.focus()}}}),LE={class:"vs-form-text relative bg-white rounded-lg"},OE={key:2,class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},IE=["disabled","type","placeholder"];function DE(n,e,t,r,o,s){const l=i.resolveComponent("IconClose"),a=i.resolveComponent("IconSearch"),c=i.resolveComponent("IconEmail");return i.openBlock(),i.createElementBlock("div",LE,[n.clearable&&n.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:e[0]||(e[0]=(...d)=>n.clearInput&&n.clearInput(...d))},[i.createVNode(l,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500 transition-all"})])):i.createCommentVNode("",!0),n.icon&&n.icon==="search"?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["absolute bottom-2/4 translate-y-2/4 cursor-pointer",n.iconStylePosition])},[i.createVNode(a,{width:"15px",height:"15px",class:"stroke-gray-500 transition-all"})],2)):n.icon&&n.icon==="email"?(i.openBlock(),i.createElementBlock("div",OE,[i.createVNode(c,{width:"16",height:"16",class:"stroke-gray-500 transition-all"})])):(i.openBlock(),i.createElementBlock("i",{key:3,class:i.normalizeClass(["absolute bottom-2/4 translate-y-2/4 text-gray-500 cursor-pointer",["ti "+n.icon,n.iconStylePosition]])},null,2)),n.clearable&&n.value?(i.openBlock(),i.createElementBlock("div",{key:4,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:e[1]||(e[1]=(...d)=>n.clearInput&&n.clearInput(...d))},[i.createVNode(l,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500 transition-all"})])):i.createCommentVNode("",!0),i.withDirectives(i.createElementVNode("input",i.mergeProps({ref:"vsText",disabled:n.disabled,type:n.type,onInput:e[2]||(e[2]=(...d)=>n.handleInput&&n.handleInput(...d)),placeholder:n.placeholder,"onUpdate:modelValue":e[3]||(e[3]=d=>n.value=d)},n.style?.attrs||n.attrs||{},{onFocus:e[4]||(e[4]=(...d)=>n.handleFocus&&n.handleFocus(...d)),onBlur:e[5]||(e[5]=(...d)=>n.handleBlur&&n.handleBlur(...d)),class:[[n.inputStyle,n.checkSize],"py-2 px-3 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg text-sm text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"]}),null,16,IE),[[i.vModelDynamic,n.value]])])}const jp=Le(VE,[["render",DE],["__scopeId","data-v-749b581f"]]);function Oa(){const n=i.ref("en");return{t:t=>({en:{type_tag:"Type Tag",heading_1:"Heading 1",heading_2:"Heading 2",heading_3:"Heading 3",paragraph:"Paragraph",createTable:"Create Table",addColumn:"Add Column",addRow:"Add Row",deleteColumn:"Delete Column",deleteRow:"Delete Row",deleteTable:"Delete Table",mergeCells:"Merge Cells",splitCells:"Split Cells",linkTitle:"Enter Link"},uk:{type_tag:"Тип тегу",heading_1:"Заголовок 1",heading_2:"Заголовок 2",heading_3:"Заголовок 3",paragraph:"Параграф",createTable:"Створити Таблицю",addColumn:"Додати Колону",addRow:"Додати Рядок",deleteColumn:"Вилучити Колону",deleteRow:"Вилучити Рядок",deleteTable:"Вилучити Таблицю",mergeCells:"Об'єднати Клітинки",splitCells:"Розділити Клітинки",linkTitle:"Введіть Посилання"}})[n.value]?.[t]||t,locale:n}}const RE={class:"flex flex-col gap-3 p-[20px]"},FE={class:"relative flex items-center gap-2"},PE={class:"flex-1"},$E={key:0,class:"flex items-center gap-2 flex-shrink-0"},zE={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},HE=Object.assign({inheritAttrs:!1},{__name:"vs-editor-link",props:{editor:Object},setup(n){const{t:e}=Oa(),t=n,r=i.ref(!1),o=i.ref(""),s=i.ref(!1),l=()=>{if(!t.editor)return;t.editor.chain().focus().extendMarkRange("link").run();const f=t.editor.getAttributes("link");f.href?(s.value=!0,o.value=f.href):(s.value=!1,o.value=""),r.value=!0},a=()=>{r.value=!1,o.value="",s.value=!1},c=()=>{if(!t.editor||!o.value.trim())return;let f=o.value.trim();f.match(/^https?:\/\//i)||(f="https://"+f),t.editor.chain().focus().setLink({href:f}).run(),a()},d=()=>{t.editor&&(t.editor.chain().focus().unsetLink().run(),a())},u=()=>{if(!o.value)return;let f=o.value.trim();f.match(/^https?:\/\//i)||(f="https://"+f),window.open(f,"_blank","noopener,noreferrer")};return(f,p)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("button",{title:"Link",onClick:l,class:i.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none",{"bg-gray-100 text-gray-900":n.editor?.isActive("link")}])},[...p[2]||(p[2]=[i.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13.213 9.787a3.391 3.391 0 0 0-4.795 0l-3.425 3.426a3.39 3.39 0 0 0 4.795 4.794l.321-.304m-.321-4.49a3.39 3.39 0 0 0 4.795 0l3.424-3.426a3.39 3.39 0 0 0-4.794-4.795l-1.028.961"})],-1)])],2),i.createVNode(Hp,{title:s.value?i.unref(e)("editLink")||"Edit Link":i.unref(e)("linkTitle")||"Add Link",visible:r.value,"onUpdate:visible":p[1]||(p[1]=h=>r.value=h),size:"small"},{footer:i.withCtx(()=>[i.createElementVNode("div",zE,[i.createElementVNode("button",{style:{border:"1px solid #000"},onClick:a,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"},i.toDisplayString(i.unref(e)("cancel")||"Cancel"),1),i.createElementVNode("button",{onClick:c,class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"},i.toDisplayString(s.value?i.unref(e)("update")||"Update":i.unref(e)("create")||"Create"),1)])]),default:i.withCtx(()=>[i.createElementVNode("div",RE,[i.createElementVNode("div",FE,[i.createElementVNode("div",PE,[i.createVNode(jp,{modelValue:o.value,"onUpdate:modelValue":p[0]||(p[0]=h=>o.value=h),placeholder:i.unref(e)("linkUrl")||"Enter URL",class:"w-full"},null,8,["modelValue","placeholder"])]),s.value?(i.openBlock(),i.createElementBlock("div",$E,[i.createElementVNode("button",{onClick:u,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none transition-colors",title:"Open link"},[...p[3]||(p[3]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-4M14 4h6m0 0v6m0-6L10 14"})],-1)])]),i.createElementVNode("button",{onClick:d,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-red-600 hover:bg-red-50 focus:outline-none transition-colors",title:"Remove link"},[...p[4]||(p[4]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1)])])])):i.createCommentVNode("",!0)])])]),_:1},8,["title","visible"])],64))}}),So=async(n,e,t,r=10)=>{if(!e||!t)return;await i.nextTick();const o=await t?.getBoundingClientRect(),s=await e?.getBoundingClientRect();if(!s||!o)return;const l=await parseInt(e?.getBoundingClientRect()?.height),a=await parseInt(e?.getBoundingClientRect()?.width),c=await parseInt(t?.getBoundingClientRect()?.height),d=await parseInt(t?.getBoundingClientRect()?.width),u=await window.innerHeight,f=await window.innerWidth;let p=0,h=0;const m=s.bottom+r+c;switch(n){case"top":s.top-o.height-r<0?p=s.top-o.height+r+c+l:p=s.top-o.height-r,f>d+s.right+30?h=s.left-o.width/2+s.width/2:h=f-30-d;break;case"bottom":u>m?p=s.bottom+r:p=s.bottom-r-c-l,h=s.left-o.width/2+s.width/2;break;case"left":p=s.top-o.height/2+s.height/2,s.left-o.width-r>0?h=s.left-o.width-r:h=10;break;case"right":p=s.top-o.height/2+s.height/2,f-a>d?h=s.right+r:h=f-30-d;break;case"top-right":s.top-o.height-r<0?p=s.top-o.height+r+c+l:p=s.top-o.height-r,f-a>d?h=s.right+r:h=f-30-d;break;case"top-left":s.top-o.height-r<0?p=s.top-o.height+r+c+l:p=s.top-o.height-r,s.left-o.width-r>0?h=s.left-o.width-r:h=10;break;case"top-start":s.top-o.height-r<0?p=s.top-o.height+r+c+l:p=s.top-o.height-r,s.left>0?h=s.left:h=10;break;case"bottom-right":u>m?p=s.bottom+r:p=s.bottom-r-c-l,f-a>d?h=s.left:h=f-30-d;break;case"bottom-left":u>m?p=s.bottom+r:p=s.bottom-r-c-l,s.left>0?h=s.right-d:h=10;break;case"bottom-start":u>m?p=s.bottom+r:p=s.bottom-r-c-l,s.left>0?h=s.left:h=10;break}p+c>u?p=u-c-r:p<0&&(p=r),h+d>f?h=f-d-r:h<0&&(h=r),t instanceof HTMLElement&&(t.style.top=`${p}px`,t.style.left=`${h}px`,t.style.position="fixed")},jE={class:"text-center"},UE={class:"py-2 px-4 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},Kn=Object.assign({inheritAttrs:!1},{__name:"vs-popover",props:{isOpen:{type:Boolean,default:()=>!1},placement:{type:String,default:"top"},gap:{type:Number,default:8},width:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},trigger:{type:String,default:"click"},teleport:{type:String,default:"body"}},emits:["isvisible"],setup(n,{expose:e,emit:t}){const r=n,o=t,s=i.ref(!1),l=i.ref([]),a=i.ref(null),c=i.ref(null),d=i.ref(null);i.watch(s,w=>{w?(u(),window.addEventListener("resize",()=>So(r.placement,c.value,d.value)),So(r.placement,c.value,d.value)):window.removeEventListener("resize",()=>So(r.placement,c.value,d.value)),o("isvisible",w)}),i.onMounted(()=>{window.addEventListener("click",y),window.addEventListener("popstate",b),window.addEventListener("scroll",k,!0),u()}),i.onBeforeUnmount(()=>{window.removeEventListener("click",y),window.removeEventListener("popstate",b),f()});const u=()=>{let w=a.value;for(;w&&w!==document.body;)(w.scrollHeight>w.clientHeight||w.scrollWidth>w.clientWidth)&&(w.addEventListener("scroll",g),l.value.push(w)),w=w.parentElement;document.body&&(document.body.addEventListener("scroll",g),l.value.push(document.body))},f=()=>{l.value.forEach(w=>{w.removeEventListener("scroll",g)}),l.value=[]},p=()=>{s.value=!0,So(r.placement,c.value,d.value)},h=()=>{s.value=!1},m=async()=>{await So(r.placement,c.value,d.value),s.value=!s.value},g=()=>{s.value=!1},y=w=>{if(!w){s.value=!1;return}c.value?.contains(w.target)||d.value?.contains(w.target)||(s.value=!1)},b=()=>{s.value&&(s.value=!1)},k=w=>{s.value&&d.value&&!d.value.contains(w.target)&&(s.value=!1)};return e({togglePopover:m}),(w,x)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"popover",ref:a,class:"vs-popover inline-block"},[i.createElementVNode("div",jE,[n.trigger==="click"?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"popoverRef",ref:c,onClick:m,class:i.normalizeClass({"pointer-events-none":n.disabled})},[i.renderSlot(w.$slots,"reference",{},()=>[x[0]||(x[0]=i.createElementVNode("button",null,"Click me!",-1))])],2)):i.createCommentVNode("",!0),n.trigger==="hover"?(i.openBlock(),i.createElementBlock("div",{key:1,ref_key:"popoverRef",ref:c,onMouseover:p,onMouseleave:h,class:i.normalizeClass({"pointer-events-none":n.disabled})},[i.renderSlot(w.$slots,"reference",{},()=>[x[1]||(x[1]=i.createElementVNode("button",null,"Click me!",-1))])],34)):i.createCommentVNode("",!0),(i.openBlock(),i.createBlock(i.Teleport,{to:n.teleport},[i.createVNode(i.Transition,{name:"fade"},{default:i.withCtx(()=>[i.withDirectives(i.createElementVNode("div",{class:i.normalizeClass(["vsTailwind vs-popover__content",n.placement]),ref_key:"contentPop",ref:d,style:i.normalizeStyle({width:n.width?n.width+"px":"fit-content",zIndex:100001})},[i.createElementVNode("div",UE,[i.renderSlot(w.$slots,"default",{},()=>[x[2]||(x[2]=i.createElementVNode("span",null,"Popover content",-1))])])],6),[[i.vShow,s.value]])]),_:3})],8,["to"]))])],512))}}),WE={class:"flex flex-col gap-[2px] p-[2px]"},KE=["onClick"],qE={__name:"vs-editor-table",props:{editor:Object},setup(n){const{t:e}=Oa(),t=n,r=i.ref(!1),o=i.ref("popover"),s=()=>{t.editor&&(t.editor.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),o.value.togglePopover())},l=()=>{t.editor&&(t.editor.chain().focus().addColumnAfter().run(),o.value.togglePopover())},a=()=>{t.editor&&(t.editor.chain().focus().addRowAfter().run(),o.value.togglePopover())},c=()=>{t.editor&&(t.editor.chain().focus().deleteColumn().run(),o.value.togglePopover())},d=()=>{t.editor&&(t.editor.chain().focus().deleteRow().run(),o.value.togglePopover())},u=()=>{t.editor&&(t.editor.chain().focus().deleteTable().run(),o.value.togglePopover())},f=()=>{t.editor&&(t.editor.chain().focus().mergeCells().run(),o.value.togglePopover())},p=()=>{t.editor&&(t.editor.chain().focus().splitCell().run(),o.value.togglePopover())},h=i.computed(()=>[{text:e("createTable"),function:s},{text:e("addColumn"),function:l},{text:e("addRow"),function:a},{text:e("deleteColumn"),function:c},{text:e("deleteRow"),function:d},{text:e("deleteTable"),function:u},{text:e("mergeCells"),function:f},{text:e("splitCells"),function:p}]);return(m,g)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:o,placement:"bottom",onIsvisible:g[0]||(g[0]=y=>r.value=y)},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Table",class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[r.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...g[1]||(g[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-table"},[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),i.createElementVNode("path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"}),i.createElementVNode("path",{d:"M3 10h18"}),i.createElementVNode("path",{d:"M10 3v18"})],-1)])],2)]),default:i.withCtx(()=>[i.createElementVNode("div",WE,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.value,(y,b)=>(i.openBlock(),i.createElementBlock("button",{key:b,onClick:y?.function,class:"px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded"},i.toDisplayString(y.text),9,KE))),128))])]),_:1},512))}},GE={},JE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-center"};function YE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",JE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 6l16 0"},null,-1),i.createElementVNode("path",{d:"M8 12l8 0"},null,-1),i.createElementVNode("path",{d:"M6 18l12 0"},null,-1)])])}const XE=Le(GE,[["render",YE]]),ZE={},QE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-right"};function e2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",QE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 6l16 0"},null,-1),i.createElementVNode("path",{d:"M10 12l10 0"},null,-1),i.createElementVNode("path",{d:"M6 18l14 0"},null,-1)])])}const t2=Le(ZE,[["render",e2]]),n2={},r2={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-left"};function o2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",r2,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 6l16 0"},null,-1),i.createElementVNode("path",{d:"M4 12l10 0"},null,-1),i.createElementVNode("path",{d:"M4 18l14 0"},null,-1)])])}const s2=Le(n2,[["render",o2]]),l2={},i2={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-justify"};function a2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",i2,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 6h16"},null,-1),i.createElementVNode("path",{d:"M4 12h16"},null,-1),i.createElementVNode("path",{d:"M4 18h16"},null,-1)])])}const Up={left:s2,center:XE,right:t2,justify:Le(l2,[["render",a2]])},c2={class:"flex gap-[4px] p-1"},d2=["title","onClick"],u2={__name:"vs-editor-align",props:{editor:Object},setup(n){const e=n,t=i.ref(!1),r=i.ref("popover"),o=i.ref("left"),s=i.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"left"})||e.editor.isActive("heading",{textAlign:"left"}):!1),l=i.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"right"})||e.editor.isActive("heading",{textAlign:"right"}):!1),a=i.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"center"})||e.editor.isActive("heading",{textAlign:"center"}):!1),c=i.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"justify"})||e.editor.isActive("heading",{textAlign:"justify"}):!1),d=i.computed(()=>s.value||l.value||a.value||c.value),u=()=>{l.value?o.value="right":a.value?o.value="center":c.value?o.value="justify":o.value="left"};i.watch([s,l,a,c],()=>{u()},{immediate:!0}),i.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",u),e.editor.on("update",u))}),i.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",u),e.editor.off("update",u))});const f=h=>{e.editor&&(e.editor.chain().focus().setTextAlign(h).run(),o.value=h)},p=i.ref([{id:"left",isActive:s},{id:"center",isActive:a},{id:"right",isActive:l},{id:"justify",isActive:c}]);return(h,m)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:r,placement:"bottom",onIsvisible:m[0]||(m[0]=g=>t.value=g)},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Text Align",class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[d.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(Up)[o.value]),{height:"16",width:"16"}))],2)]),default:i.withCtx(()=>[i.createElementVNode("div",c2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(p.value,g=>(i.openBlock(),i.createElementBlock("button",{title:"Text align "+g?.id,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":g?.isActive}]),key:g?.id,onClick:y=>f(g?.id)},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(Up)[g?.id]),{height:"16",width:"16"}))],10,d2))),128))])]),_:1},512))}},f2={class:"flex flex-col gap-[2px] p-[2px]"},p2=["onClick"],h2={__name:"vs-editor-type-tag",props:{editor:Object},setup(n){const{t:e}=Oa(),t=n,r=i.ref(!1),o=i.ref("popover"),s=()=>{t.editor&&(t.editor?.chain().focus().setParagraph().run(),o.value.togglePopover())},l=c=>{t.editor&&(t.editor?.chain().focus().toggleHeading({level:c}).run(),o.value.togglePopover())},a=i.computed(()=>[{text:e("richtext.heading1"),id:1,style:"font-[700] text-[30px]"},{text:e("richtext.heading2"),id:2,style:"font-[700] text-[26px]"},{text:e("richtext.heading3"),id:3,style:"font-[700] text-[22px]"},{text:e("richtext.heading4"),id:4,style:"font-[700] text-[18px]"},{text:e("richtext.heading5"),id:5,style:"font-[500] text-[16px]"},{text:e("richtext.heading6"),id:6,style:"font-[400] text-[14px]"}]);return(c,d)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:o,placement:"bottom",onIsvisible:d[0]||(d[0]=u=>r.value=u)},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Type Tag",class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[r.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...d[1]||(d[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-text-size"},[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),i.createElementVNode("path",{d:"M3 7v-2h13v2"}),i.createElementVNode("path",{d:"M10 5v14"}),i.createElementVNode("path",{d:"M12 19h-4"}),i.createElementVNode("path",{d:"M15 13v-1h6v1"}),i.createElementVNode("path",{d:"M18 12v7"}),i.createElementVNode("path",{d:"M17 19h2"})],-1)])],2)]),default:i.withCtx(()=>[i.createElementVNode("div",f2,[i.createElementVNode("button",{onClick:s,class:i.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded",[n.editor?.isActive("paragraph")?"bg-gray-100":""]])},i.toDisplayString(i.unref(e)("richtext.paragraph")),3),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,(u,f)=>(i.openBlock(),i.createElementBlock("button",{key:f,onClick:p=>l(u?.id),class:i.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded leading-[100%]",[u?.style,n.editor?.isActive("heading",{level:u?.id})?"bg-gray-100":""]])},i.toDisplayString(i.unref(e)(`richtext.heading${u?.id}`)),11,p2))),128))])]),_:1},512))}},m2={},g2={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function y2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",g2,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)])])}const No=Le(m2,[["render",y2]]),b2={components:{VsText:jp},inheritAttrs:!1,events:["update:modelValue"],props:{modelValue:{type:String},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},isTextInputShown:{type:Boolean,default:()=>!0}},computed:{value:{get(){return this.modelValue},set(n){this.$emit("update:modelValue",n)}}}},k2={class:"flex items-center w-full max-w-[182px]"},x2=["disabled"];function w2(n,e,t,r,o,s){const l=i.resolveComponent("vs-text");return i.openBlock(),i.createElementBlock("div",k2,[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=a=>s.value=a),type:"color",class:i.normalizeClass(["w-[38px] h-[38px] min-h-[38px] min-w-[38px] py-[2px] px-[3px] -ml-1 dark:bg-neutral-800 border dark:border-neutral-700 border-stone-200 rounded-lg",t.disabled?"cursor-not-allowed":"cursor-pointer"]),disabled:t.disabled},null,10,x2),[[i.vModelText,s.value]]),t.isTextInputShown?(i.openBlock(),i.createBlock(l,{key:0,modelValue:s.value,"onUpdate:modelValue":e[1]||(e[1]=a=>s.value=a),class:"ml-2 w-full",disabled:t.disabled,clearable:t.clearable},null,8,["modelValue","disabled","clearable"])):i.createCommentVNode("",!0)])}const Wp=Le(b2,[["render",w2]]),E2={class:"flex gap-[4px] mb-[8px]"},C2={class:"grid grid-rows-3 grid-cols-7"},v2={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},_2=["onClick","title"],S2={__name:"vs-editor-color",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref("#000000"),o=i.computed(()=>e.editor&&e.editor.getAttributes("textStyle").color||"#000000"),s=i.computed(()=>o.value!=="#000000"),l=()=>{e.editor&&(r.value=o.value)};i.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",l),e.editor.on("update",l),l())}),i.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",l),e.editor.off("update",l))});const a=i.ref(["#172B4D","#0747A6","#008DA6","#006644","#FF991F","#BF2600","#403294","#97A0AF","#4C9AFF","#00B8D9","#36B37E","#FFC400","#FF5630","#6554C0","#FFFFFF","#B3D4FF","#B3F5FF","#ABF5D1","#FFF0B3","#FFBDAD","#EAE6FF"]),c=f=>{e.editor&&(e.editor.chain().focus().setColor(f).run(),r.value=f,t.value&&t.value.togglePopover())},d=()=>{c(r.value)},u=f=>({"#172B4D":"Default","#0747A6":"Bright blue","#008DA6":"Bright blue-green","#006644":"Bright green","#FF991F":"Bright orange","#BF2600":"Bright red","#403294":"Bright purple","#97A0AF":"Gray","#4C9AFF":"Blue","#00B8D9":"Blue-green","#36B37E":"Green","#FFC400":"Yellow","#FF5630":"Red","#6554C0":"Purple","#FFFFFF":"White","#B3D4FF":"Bright blue","#B3F5FF":"Bright blue-green","#ABF5D1":"Bright green","#FFF0B3":"Bright yellow","#FFBDAD":"Bright red","#EAE6FF":"Bright purple"})[f]||f;return(f,p)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom"},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Text Color",class:i.normalizeClass(["flex flex-col h-[30px] min-w-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-100":s.value}])},[p[1]||(p[1]=i.createElementVNode("span",{class:"leading-none"},"A",-1)),i.createElementVNode("span",{class:"block h-1 w-5",style:i.normalizeStyle({backgroundColor:r.value})},null,4)],2)]),default:i.withCtx(()=>[i.createElementVNode("div",null,[i.createElementVNode("div",E2,[i.createVNode(Wp,{modelValue:r.value,"onUpdate:modelValue":p[0]||(p[0]=h=>r.value=h)},null,8,["modelValue"]),i.createElementVNode("button",{onClick:d,class:"h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"},[i.createVNode(No,{class:"h-[24px] w-[24px] text-white"})])]),i.createElementVNode("div",C2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,h=>(i.openBlock(),i.createElementBlock("div",{key:h,class:"h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"},[i.createElementVNode("div",v2,[i.createElementVNode("button",{class:"flex items-center justify-center w-full h-full",style:i.normalizeStyle({backgroundColor:h}),onClick:m=>c(h),title:u(h)},[r.value===h?(i.openBlock(),i.createBlock(No,{key:0,class:"h-5 w-5 text-gray-500"})):i.createCommentVNode("",!0)],12,_2)])]))),128))])])]),_:1},512))}},N2={class:"flex gap-[4px] mb-[8px]"},M2={class:"grid grid-rows-3 grid-cols-7"},T2={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},A2=["onClick","title"],B2=["onClick","title"],V2={__name:"vs-editor-background-color",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref("transparent"),o=i.computed(()=>e.editor&&e.editor.getAttributes("textStyle").backgroundColor||"transparent"),s=i.computed(()=>o.value!=="transparent"&&o.value!==""),l=()=>{e.editor&&(r.value=o.value)};i.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",l),e.editor.on("update",l),l())}),i.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",l),e.editor.off("update",l))});const a=i.ref(["#172B4D","#0747A6","#008DA6","#006644","#FF991F","#BF2600","#403294","#97A0AF","#4C9AFF","#00B8D9","#36B37E","#FFC400","#FF5630","#6554C0","#FFFFFF","#B3D4FF","#B3F5FF","#ABF5D1","#FFF0B3","#FFBDAD","#EAE6FF"]),c=f=>{e.editor&&(e.editor.chain().focus().setBackgroundColor(f).run(),r.value=f,t.value&&t.value.togglePopover())},d=()=>{c(r.value)},u=f=>({"#172B4D":"Default","#0747A6":"Bright blue","#008DA6":"Bright blue-green","#006644":"Bright green","#FF991F":"Bright orange","#BF2600":"Bright red","#403294":"Bright purple","#97A0AF":"Gray","#4C9AFF":"Blue","#00B8D9":"Blue-green","#36B37E":"Green","#FFC400":"Yellow","#FF5630":"Red","#6554C0":"Purple",transparent:"Transparent","#B3D4FF":"Bright blue","#B3F5FF":"Bright blue-green","#ABF5D1":"Bright green","#FFF0B3":"Bright yellow","#FFBDAD":"Bright red","#EAE6FF":"Bright purple"})[f]||f;return(f,p)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom"},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Background Color",class:i.normalizeClass(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-100":s.value}])},[p[2]||(p[2]=i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z"}),i.createElementVNode("path",{d:"m5 2 5 5"}),i.createElementVNode("path",{d:"M2 13h15"}),i.createElementVNode("path",{d:"M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z"})],-1)),i.createElementVNode("span",{class:"block h-1 w-5",style:i.normalizeStyle({backgroundColor:r.value})},null,4)],2)]),default:i.withCtx(()=>[i.createElementVNode("div",null,[i.createElementVNode("div",N2,[i.createVNode(Wp,{modelValue:r.value,"onUpdate:modelValue":p[0]||(p[0]=h=>r.value=h)},null,8,["modelValue"]),i.createElementVNode("button",{onClick:d,class:"h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"},[i.createVNode(No,{class:"h-[24px] w-[24px] text-white"})])]),i.createElementVNode("div",M2,[i.createElementVNode("button",{onClick:p[1]||(p[1]=h=>c("transparent")),class:"col-span-7 flex items-center justify-center gap-2 bg-gray-100 rounded-md py-1 mb-2 hover:bg-gray-200"},[...p[3]||(p[3]=[i.createElementVNode("svg",{fill:"#000000",width:"16",height:"16",viewBox:"0 0 52 52","data-name":"Layer 1",xmlns:"http://www.w3.org/2000/svg"},[i.createElementVNode("g",{id:"SVGRepo_bgCarrier","stroke-width":"0"}),i.createElementVNode("g",{id:"SVGRepo_tracerCarrier","stroke-linecap":"round","stroke-linejoin":"round"}),i.createElementVNode("g",{id:"SVGRepo_iconCarrier"},[i.createElementVNode("path",{d:"M48.5,5.6,46.4,3.5a1.67,1.67,0,0,0-2.4.3L32.59,15.21c-.77-1.3-1.51-2.61-2.21-4a36.5,36.5,0,0,1-3.15-8.36c-.13-.53-.39-.91-1-.89s-.86.4-1,.93c-.06.26-.11.51-.17.76A48.3,48.3,0,0,1,21,13.7,97.47,97.47,0,0,1,14.13,25a16,16,0,0,0-3,11.12c0,.14,0,.29.06.43L3.8,44a1.87,1.87,0,0,0-.3,2.4l2.1,2.1A1.67,1.67,0,0,0,8,48.2L48.2,8A1.67,1.67,0,0,0,48.5,5.6Z"}),i.createElementVNode("path",{d:"M38.42,23.79l-22,22.31A14.47,14.47,0,0,0,26.22,50a15.48,15.48,0,0,0,7-1.44c4.94-2.51,8.11-6.4,8.94-12A15.22,15.22,0,0,0,39,24.66C38.87,24.44,38.58,24,38.42,23.79Z"})])],-1),i.createElementVNode("p",null,"no color",-1)])]),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,h=>(i.openBlock(),i.createElementBlock("div",{key:h,class:"h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"},[i.createElementVNode("div",T2,[h!=="transparent"?(i.openBlock(),i.createElementBlock("button",{key:0,class:"flex items-center justify-center w-full h-full",style:i.normalizeStyle({backgroundColor:h}),onClick:m=>c(h),title:u(h)},[r.value===h?(i.openBlock(),i.createBlock(No,{key:0,class:"h-5 w-5 text-gray-500"})):i.createCommentVNode("",!0)],12,A2)):i.createCommentVNode("",!0),h==="transparent"?(i.openBlock(),i.createElementBlock("button",{key:1,class:"flex items-center justify-center w-full h-full",onClick:m=>c(h),title:u(h)},[r.value===h?(i.openBlock(),i.createBlock(No,{key:0,class:"h-5 w-5 text-gray-500"})):i.createCommentVNode("",!0)],8,B2)):i.createCommentVNode("",!0)])]))),128))])])]),_:1},512))}},L2={__name:"vs-editor-highlight",props:{editor:Object},setup(n){const e=n,t=i.computed(()=>e.editor?.isActive("highlight")),r=()=>{e.editor&&e.editor.chain().focus().toggleHighlight().run()};return(o,s)=>(i.openBlock(),i.createElementBlock("button",{title:"Highlight",onClick:r,class:i.normalizeClass(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-200":t.value}])},[...s[0]||(s[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"m9 11-6 6v3h9l3-3"}),i.createElementVNode("path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4"})],-1)])],2))}},O2={class:"truncate"},I2={class:"w-[200px]"},D2={class:"max-h-[200px] overflow-y-auto"},R2=["onClick"],F2={__name:"vs-editor-font-family",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref(!1),o=i.ref([{label:"Arial",value:"Arial, sans-serif"},{label:"Helvetica",value:"Helvetica, sans-serif"},{label:"Times New Roman",value:"Times New Roman, serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Verdana",value:"Verdana, sans-serif"},{label:"Courier New",value:"Courier New, monospace"},{label:"Comic Sans MS",value:"Comic Sans MS, cursive"},{label:"Impact",value:"Impact, sans-serif"},{label:"Trebuchet MS",value:"Trebuchet MS, sans-serif"},{label:"Palatino",value:"Palatino, serif"}]),s=i.computed(()=>{if(!e.editor)return"Arial, sans-serif";for(const d of o.value)if(e.editor.isActive("textStyle",{fontFamily:d.value}))return d.value;return"Arial, sans-serif"}),l=i.computed(()=>o.value.find(u=>u.value===s.value)?.label||"Arial"),a=d=>e.editor?e.editor.isActive("textStyle",{fontFamily:d}):!1,c=d=>{e.editor&&(e.editor.chain().focus().setFontFamily(d).run(),t.value&&t.value.togglePopover())};return(d,u)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom",onIsvisible:u[0]||(u[0]=f=>r.value=f)},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Font Family",class:i.normalizeClass(["h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm",[r.value?"bg-gray-100 text-gray-900":"text-gray-700"]]),style:i.normalizeStyle({fontFamily:s.value})},[i.createElementVNode("span",O2,i.toDisplayString(l.value),1),u[1]||(u[1]=i.createElementVNode("svg",{class:"ml-1 text-gray-400",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1))],6)]),default:i.withCtx(()=>[i.createElementVNode("div",I2,[i.createElementVNode("ul",D2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,f=>(i.openBlock(),i.createElementBlock("li",{key:f.value,class:i.normalizeClass(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm",{"bg-gray-100":a(f.value)}]),style:i.normalizeStyle({fontFamily:f.value}),onClick:p=>c(f.value)},i.toDisplayString(f.label),15,R2))),128))])])]),_:1},512))}},P2={class:"w-[120px]"},$2={class:"max-h-[200px] overflow-y-auto"},z2=["onClick"],H2={__name:"vs-editor-font-size",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref("14px"),o=i.computed(()=>e.editor&&e.editor.getAttributes("textStyle").fontSize||"14px"),s=i.computed(()=>o.value!=="14px"),l=()=>{e.editor&&(r.value=o.value)};i.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",l),e.editor.on("update",l),l())}),i.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",l),e.editor.off("update",l))});const a=i.ref([{label:"8px",value:"8px"},{label:"9px",value:"9px"},{label:"10px",value:"10px"},{label:"11px",value:"11px"},{label:"12px",value:"12px"},{label:"14px",value:"14px"},{label:"16px",value:"16px"},{label:"18px",value:"18px"},{label:"20px",value:"20px"},{label:"24px",value:"24px"},{label:"28px",value:"28px"},{label:"32px",value:"32px"},{label:"36px",value:"36px"},{label:"48px",value:"48px"},{label:"72px",value:"72px"}]),c=d=>{e.editor&&(e.editor.chain().focus().setFontSize(d).run(),r.value=d,t.value&&t.value.togglePopover())};return(d,u)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom"},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Font Size",class:i.normalizeClass(["h-[30px] px-2 min-w-[30px] rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700 space-x-1",{"bg-gray-100 text-gray-900":s.value}])},[...u[0]||(u[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-alarge-small-icon lucide-a-large-small"},[i.createElementVNode("path",{d:"m15 16 2.536-7.328a1.02 1.02 1 0 1 1.928 0L22 16"}),i.createElementVNode("path",{d:"M15.697 14h5.606"}),i.createElementVNode("path",{d:"m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16"}),i.createElementVNode("path",{d:"M3.304 13h6.392"})],-1),i.createElementVNode("svg",{class:"ml-1 text-gray-400",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1)])],2)]),default:i.withCtx(()=>[i.createElementVNode("div",P2,[i.createElementVNode("ul",$2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,f=>(i.openBlock(),i.createElementBlock("li",{key:f.value,class:"px-3 py-2 hover:bg-gray-100 cursor-pointer",onClick:p=>c(f.value)},i.toDisplayString(f.label),9,z2))),128))])])]),_:1},512))}},j2={props:{editor:Object},methods:{toggleSuperscript(){this.editor&&this.editor.commands.toggleSuperscript()}}};function U2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Superscript",onClick:e[0]||(e[0]=(...l)=>s.toggleSuperscript&&s.toggleSuperscript(...l)),class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("superscript")}])},[...e[1]||(e[1]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-superscript-icon lucide-superscript"><path d="m4 19 8-8"></path><path d="m12 19-8-8"></path><path d="M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06"></path></svg><span class="sr-only">Superscript</span>',2)])],2)}const W2=Le(j2,[["render",U2]]),K2={props:{editor:Object},methods:{toggleSubscript(){this.editor&&this.editor.commands.toggleSubscript()}}};function q2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Subscript",onClick:e[0]||(e[0]=(...l)=>s.toggleSubscript&&s.toggleSubscript(...l)),class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("subscript")}])},[...e[1]||(e[1]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-subscript-icon lucide-subscript"><path d="m4 5 8 8"></path><path d="m12 5-8 8"></path><path d="M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07"></path></svg><span class="sr-only">Subscript</span>',2)])],2)}const G2=Le(K2,[["render",q2]]),J2={title:"Heading",class:"h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700"},Y2={class:"truncate"},X2={class:"max-h-[200px] overflow-y-auto"},Z2=["onClick"],Q2=Le({__name:"vs-editor-heading",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref([{label:"Heading 1",value:1},{label:"Heading 2",value:2},{label:"Heading 3",value:3},{label:"Heading 4",value:4},{label:"Heading 5",value:5},{label:"Heading 6",value:6}]),o=i.computed(()=>{if(!e.editor)return"Paragraph";for(let c=1;c<=6;c++)if(e.editor.isActive("heading",{level:c}))return`H ${c}`;return"P"}),s=c=>({1:"font-weight:700; font-size:30px;",2:"font-weight:700; font-size:26px;",3:"font-weight:700; font-size:22px;",4:"font-weight:700; font-size:18px;",5:"font-weight:500; font-size:16px;",6:"font-weight:400; font-size:14px;"})[c]||"",l=c=>{e.editor&&(e.editor.chain().focus().setHeading({level:c}).run(),t.value&&t.value.togglePopover())},a=()=>{e.editor&&(e.editor.chain().focus().setParagraph().run(),t.value&&t.value.togglePopover())};return(c,d)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom"},{reference:i.withCtx(()=>[i.createElementVNode("button",J2,[i.createElementVNode("span",Y2,i.toDisplayString(o.value),1),d[0]||(d[0]=i.createElementVNode("svg",{class:"ml-1 text-gray-400",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1))])]),default:i.withCtx(()=>[i.createElementVNode("div",null,[i.createElementVNode("ul",X2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,u=>(i.openBlock(),i.createElementBlock("li",{key:u.value,class:i.normalizeClass(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm",`heading-level-${u.value}`]),style:i.normalizeStyle(s(u.value)),onClick:f=>l(u.value)},i.toDisplayString(u.label),15,Z2))),128)),i.createElementVNode("li",{class:"px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm border-t border-gray-200 mt-1 pt-2",onClick:a}," Paragraph ")])])]),_:1},512))}},[["__scopeId","data-v-ef7c378e"]]),eC={props:{editor:Object},methods:{clearFormatting(){this.editor&&this.editor.commands.unsetAllMarks()}}};function tC(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Clear Formatting",onClick:e[0]||(e[0]=(...l)=>s.clearFormatting&&s.clearFormatting(...l)),class:"h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100"},[...e[1]||(e[1]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-remove-formatting-icon lucide-remove-formatting"><path d="M4 7V4h16v3"></path><path d="M5 20h6"></path><path d="M13 4 8 20"></path><path d="m15 15 5 5"></path><path d="m20 15-5 5"></path></svg><span class="sr-only">Clear Formatting</span>',2)])])}const nC=Le(eC,[["render",tC]]),Mo=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t};i.defineComponent({props:{modelValue:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1}},data(){return{}},mounted(){this.modelValue||this.$emit("update:modelValue",!1)},computed:{modelState:{get(){return this.modelValue},set(n){this.$emit("update:modelValue",n)}},labelCursorClasses(){return[{"cursor-not-allowed":this.disabled},{"cursor-pointer":!this.disabled}]}},methods:{handleEnterDown(n){const{keyCode:e}=n;e===13&&(this.modelState=!this.modelState)},addKeyHandler(){window.addEventListener("keydown",this.handleEnterDown)},removeKeyHandler(){window.removeEventListener("keydown",this.handleEnterDown)}}});const rC={key:0,class:"vsTailwind ui-dialog__wrapper text-gray-800"},oC={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},sC={class:"font-medium text-gray-800 dark:text-[#ffffff]"},lC={class:"ui-dialog__content p-4"},iC={key:0,class:"flex justify-end gap-x-2"},aC={key:1,class:"flex justify-end items-center gap-x-2 py-3 px-4 border-t border-gray-200 dark:border-neutral-700"},cC=i.defineComponent({__name:"vs-modal",props:{title:{default:""},template:{},visible:{type:Boolean,default:!1},size:{default:"small"},closeClickBack:{type:Boolean,default:!1},content:{},buttonText:{},contentProps:{},teleport:{default:"body"}},emits:["update:visible","close","done"],setup(n,{emit:e}){const t=n,r=e,o=i.computed(()=>t.size==="small"?"md:w-5/12 w-9/12":t.size==="medium"?"md:w-6/12 w-9/12":"lg:w-7/12 w-11/12"),s=i.useAttrs();function l(){r("done")}function a(){r("update:visible",!1),r("close")}function c(u){u.key==="Escape"&&a()}function d(u,f){f&&u.target.classList.contains("vs-dialog-overlay")&&a()}return i.onMounted(()=>{window.addEventListener("keydown",c)}),i.onUnmounted(()=>{window.removeEventListener("keydown",c)}),(u,f)=>(i.openBlock(),i.createBlock(i.Teleport,{to:u.teleport},[u.visible?(i.openBlock(),i.createElementBlock("div",rC,[i.createElementVNode("div",{onMousedown:f[0]||(f[0]=p=>d(p,u.closeClickBack)),class:i.normalizeClass(["vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 bg-black bg-opacity-50",[i.unref(s).class]])},[i.createVNode(i.Transition,{name:"content",appear:""},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["ui-dialog__modal opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",o.value])},[i.createElementVNode("div",oC,[i.createElementVNode("h3",sC,i.toDisplayString(u.title),1),i.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:a},[...f[1]||(f[1]=[i.createElementVNode("span",{class:"sr-only"},"Close",-1),i.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",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"},[i.createElementVNode("path",{d:"M18 6 6 18"}),i.createElementVNode("path",{d:"m6 6 12 12"})],-1)])])]),i.createElementVNode("div",lC,[i.renderSlot(u.$slots,"default",{},void 0,!0)]),u.$slots.footer?(i.openBlock(),i.createElementBlock("div",iC,[i.renderSlot(u.$slots,"footer",{handleClose:a},void 0,!0)])):i.createCommentVNode("",!0),u.buttonText?(i.openBlock(),i.createElementBlock("div",aC,[i.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-2xs hover:bg-gray-50 focus:outline-hidden focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:a}," Close "),i.createElementVNode("button",{type:"button",onClick:l,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 focus:outline-hidden focus:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none"},i.toDisplayString(u.buttonText),1)])):i.createCommentVNode("",!0)],2)]),_:3})],34)])):i.createCommentVNode("",!0)],8,["to"]))}}),Ia=Mo(cC,[["__scopeId","data-v-a6807cab"]]),dC={},uC={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-6 text-green-600"};function fC(n,e){return i.openBlock(),i.createElementBlock("svg",uC,[...e[0]||(e[0]=[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)])])}const pC=Mo(dC,[["render",fC]]),hC={},mC={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"orange",class:"size-6 text-orange-600"};function gC(n,e){return i.openBlock(),i.createElementBlock("svg",mC,[...e[0]||(e[0]=[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)])])}const yC=Mo(hC,[["render",gC]]),bC={},kC={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-6 text-blue-600"};function xC(n,e){return i.openBlock(),i.createElementBlock("svg",kC,[...e[0]||(e[0]=[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"},null,-1)])])}const wC=Mo(bC,[["render",xC]]),EC={},CC={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"red",class:"size-6 text-red-600"};function vC(n,e){return i.openBlock(),i.createElementBlock("svg",CC,[...e[0]||(e[0]=[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"},null,-1)])])}const _C=Mo(EC,[["render",vC]]),SC={class:"rounded-md border border-gray-300 bg-white p-4 shadow-sm"},NC={class:"flex items-start gap-4 opacity-100 scale-5 transition-all duration-300"},MC={class:"flex-1"},TC={class:"font-medium text-gray-900"},AC={class:"mt-0.5 text-sm text-gray-700"},BC=i.defineComponent({__name:"vs-notify",props:{type:{},title:{},message:{}},setup(n){const e={success:pC,warning:yC,error:_C,info:wC};return(t,r)=>(i.openBlock(),i.createElementBlock("div",SC,[i.createElementVNode("div",NC,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(e[t.type]))),i.createElementVNode("div",MC,[i.createElementVNode("strong",TC,i.toDisplayString(t.title),1),i.createElementVNode("p",AC,i.toDisplayString(t.message),1)]),r[0]||(r[0]=i.createElementVNode("button",{class:"m-3 rounded-full p-1.5 text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-700",type:"button","aria-label":"Dismiss notify"},[i.createElementVNode("span",{class:"sr-only"},"Dismiss popup"),i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-5"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})])],-1))])]))}});i.reactive({visible:!0});const VC=n=>{const{template:e="",title:t="",content:r,contentProps:o={},size:s="medium"}=n||{},l=document.querySelector("body");if(!l)return console.error('Modal root element with id "#modal" not found!'),{close:()=>{}};const a=document.createElement("div");l.appendChild(a);const c={title:t,template:e,visible:!0,size:s,closeClickBack:!0,onClose:u},d=i.createApp({render(){return i.h(Ia,c,{default:()=>[r?i.h(r,o):i.h("p",e)]})}});function u(){d.unmount(),a.remove()}return d.mount(a),{close:u}},yl={top:"top-4 left-1/2 transform -translate-x-1/2","left-bottom":"bottom-4 left-4 transform","right-bottom":"bottom-4 right-4 transform",bottom:"bottom-4 left-1/2 transform -translate-x-1/2"},Pe=n=>{const{type:e="info",title:t,message:r,position:o="right-bottom"}=n||{};let s=document.querySelector("#notify-root");s||(s=document.createElement("div"),s.id="notify-root",s.className=`fixed z-[2000] flex flex-col gap-3 ${yl[o]} p-6 max-w-md mx-auto font-sans antialiased`,document.body.appendChild(s)),s.className.includes(yl[o])||(Object.values(yl).forEach(c=>{s.classList.remove(...c.split(" "))}),s.classList.add(...yl[o].split(" ")));const l=document.createElement("div");s.appendChild(l);const a=i.createApp({render(){return i.h(BC,{type:e,title:t,message:r,onClose:()=>{a.unmount(),l.remove()}})}});a.mount(l),l.querySelector("button")?.addEventListener("click",()=>{l.classList.add("opacity-0","scale-95","transition-all","duration-300"),setTimeout(()=>{a.unmount(),l.remove()},350)}),setTimeout(()=>{l.classList.add("opacity-0","scale-95","transition-all","duration-300"),setTimeout(()=>{a.unmount(),l.remove()},350)},3500)},LC={class:"w-full relative"},OC={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},IC={class:"opacity-100"},DC={key:0,class:"text-red-500 text-[14px]"},RC={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},FC=i.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(n){const e=i.ref("uk"),t=r=>{r.detail.key==="locale"&&(e.value=r.detail.newValue)};return i.onMounted(()=>{e.value=localStorage.locale,window.addEventListener("storage",t)}),i.onUnmounted(()=>{window.removeEventListener("resize",t)}),(r,o)=>(i.openBlock(),i.createElementBlock("div",LC,[r.ua||r.label?(i.openBlock(),i.createElementBlock("div",OC,[i.createElementVNode("span",IC,i.toDisplayString(r.item[e.value]||r.ua||r.label),1),r.item?.rules?.includes("required")?(i.openBlock(),i.createElementBlock("span",DC,"*")):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),i.renderSlot(r.$slots,"default",i.mergeProps(r.$attrs,{class:{"opacity-60":r.item.disabled}})),r.error?(i.openBlock(),i.createElementBlock("span",RC,i.toDisplayString(r.error),1)):i.createCommentVNode("",!0)]))}}),PC={class:"w-full relative flex flex-row items-center gap-2"},$C={key:0,class:"text-red-500 text-[14px]"},zC={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},HC=i.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{default:()=>({container:12,label:3})}},setup(n){const e=n,t=i.computed(()=>e.columns??{container:12,label:3}),r=i.computed(()=>{const{container:a,label:c}=t.value;return!a||a<=0?0:Math.min(Math.max(c??0,0),a)/a}),o=i.computed(()=>e.item?.type==="html"||r.value<=0?!1:!!(e.ua||e.label)),s=i.computed(()=>{if(!o.value)return{};const a=`${r.value*100}%`;return{flexBasis:a,maxWidth:a}}),l=i.computed(()=>{const{container:a,label:c}=t.value;if(!a||a<=0)return{};if(e.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!o.value)return{flexBasis:"100%",maxWidth:"100%"};const d=Math.max(a-Math.max(c??0,0),0)/a;if(!d)return{};const u=`${d*100}%`;return{flexBasis:u,maxWidth:u}});return(a,c)=>(i.openBlock(),i.createElementBlock("div",PC,[o.value?(i.openBlock(),i.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0",style:i.normalizeStyle(s.value)},[i.createTextVNode(i.toDisplayString(a.ua||a.label)+" ",1),a.item?.rules?.includes("required")&&(a.ua||a.label)?(i.openBlock(),i.createElementBlock("span",$C,"*")):i.createCommentVNode("",!0)],4)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:"flex-1 min-w-0",style:i.normalizeStyle(l.value)},[i.renderSlot(a.$slots,"default",i.normalizeProps(i.guardReactiveProps(a.$attrs)))],4),a.error?(i.openBlock(),i.createElementBlock("span",zC,i.toDisplayString(a.error),1)):i.createCommentVNode("",!0)]))}}),jC={class:"w-full relative"},UC={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},WC=i.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",jC,[i.renderSlot(e.$slots,"default",i.normalizeProps(i.guardReactiveProps(e.$attrs))),e.error?(i.openBlock(),i.createElementBlock("span",UC,i.toDisplayString(e.error),1)):i.createCommentVNode("",!0)]))}}),KC={class:"flex-1 min-w-0"},qC={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},GC={class:"truncate"},JC={key:0,class:"text-red-500 text-[14px]"},YC={key:1,class:"text-xs text-slate-500 dark:text-slate-400"},XC={key:0,class:"mt-1 text-xs text-red-500"},ZC=i.defineComponent({__name:"vs-layout-settings",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(n){const e=n,t=i.ref("uk");i.computed(()=>(e.item??{})?.[t.value]??e.ua??e.label??"");const r=i.computed(()=>e.item?.description??""),o=i.computed(()=>Array.isArray(e.item?.rules)&&e.item.rules.includes("required")),s=i.computed(()=>(typeof e.error=="string"?e.error:"")??""),l=a=>{a.key==="locale"&&(t.value=a.newValue??"uk")};return i.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(t.value=localStorage.locale)}catch{}window.addEventListener("storage",l)}),i.onUnmounted(()=>{window.removeEventListener("storage",l)}),(a,c)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["w-full relative",{"opacity-60":a.item?.disabled}])},[i.createElementVNode("div",{class:i.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(a.item.type)?"flex flex-col":""]])},[i.createElementVNode("div",KC,[a.ua||a.label?(i.openBlock(),i.createElementBlock("p",qC,[i.createElementVNode("span",GC,i.toDisplayString(a.item[t.value]||a.ua||a.label),1),o.value?(i.openBlock(),i.createElementBlock("span",JC,"*")):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("p",YC,i.toDisplayString(r.value),1)):i.createCommentVNode("",!0)]),i.createElementVNode("div",{class:i.normalizeClass(["w-full",["select","native-select"].includes(a.item.type)?"md:w-[30%]":"md:w-auto"])},[i.renderSlot(a.$slots,"default",i.normalizeProps(i.guardReactiveProps(a.$attrs)))],2)],2),s.value?(i.openBlock(),i.createElementBlock("p",XC,i.toDisplayString(s.value),1)):i.createCommentVNode("",!0)],2))}}),QC={default:FC,horizontal:HC,inline:WC,settings:ZC};function vt(n){return{inputClass:i.computed(()=>{const e=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${n?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return n?.size==="sm"?`${e}h-[32px]`:`${e}h-[38px]`})}}const ev=["placeholder","disabled"],tv=i.defineComponent({__name:"vs-input-password",props:i.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=vt(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled),s=i.computed(()=>e.placeholder??"");return(l,a)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{type:"password","onUpdate:modelValue":a[0]||(a[0]=c=>r.value=c),placeholder:s.value,disabled:o.value,class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,ev)),[[i.vModelText,r.value]])}}),nv=["placeholder","disabled"],bl=i.defineComponent({__name:"vs-input-text",props:i.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=vt(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled),s=i.computed(()=>e.placeholder??"");return(l,a)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{type:"text","onUpdate:modelValue":a[0]||(a[0]=c=>r.value=c),placeholder:s.value,disabled:o.value,class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,nv)),[[i.vModelText,r.value]])}}),rv=["placeholder","disabled","min","max"],ov=i.defineComponent({__name:"vs-input-number",props:i.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=vt(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled);return(s,l)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":l[0]||(l[0]=a=>r.value=a),placeholder:s.placeholder,disabled:o.value,class:i.normalizeClass(["py-1.5 px-3 block w-full bg-white",[i.unref(t)]]),style:{border:"1px solid #CFD9E0"},min:s.min,max:s.max},null,10,rv)),[[i.vModelText,r.value]])}}),ge=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t},sv={},lv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function iv(n,e){return i.openBlock(),i.createElementBlock("svg",lv,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const av=ge(sv,[["render",iv]]),cv={class:"flex items-center gap-[4px]"},dv=["value","id","disabled"],uv=["for"],fv={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},pv=i.defineComponent({__name:"vs-checkbox-default",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},id:{},modelValue:{default:""},info:{},error:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=e,r=n,o=i.computed({get:()=>r.modelValue,set:l=>t("update:modelValue",l)}),s=i.computed(()=>!!r.disabled);return(l,a)=>(i.openBlock(),i.createElementBlock("div",cv,[i.withDirectives(i.createElementVNode("input",{type:"checkbox",value:l.value,"onUpdate:modelValue":a[0]||(a[0]=c=>o.value=c),class:i.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":s.value}]),id:l.id,disabled:s.value},null,10,dv),[[i.vModelCheckbox,o.value]]),i.createElementVNode("label",{for:l.id,class:i.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":s.value}])},[i.createElementVNode("div",{class:i.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[o.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",l.error?"border-red-600":""]])},[i.createVNode(av,{height:"12",width:"12"})],2),i.createElementVNode("span",fv,[i.renderSlot(l.$slots,"default",{},()=>[i.createTextVNode(i.toDisplayString(l.label),1)])])],10,uv)]))}}),hv=["name","value","disabled"],mv={class:"flex items-center gap-[6px] text-[14px]"},gv={key:0,class:"text-[16px]"},yv=["src"],bv=i.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{default:""},modelValue:{default:""},disabled:{type:Boolean},id:{},icon:{},imgUrl:{},style:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=i.computed({get:()=>t.modelValue,set:a=>{r("update:modelValue",a)}}),s=i.computed(()=>Array.isArray(o.value)?o.value.includes(t.value):o.value===!0||o.value===t.value),l=i.computed(()=>t.style?.size==="xs"?"p-1.5 text-xs":t.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(a,c)=>(i.openBlock(),i.createElementBlock("label",{class:i.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[l.value,s.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[i.withDirectives(i.createElementVNode("input",{type:"checkbox",class:"hidden",name:a.id,value:a.value,"onUpdate:modelValue":c[0]||(c[0]=d=>o.value=d),disabled:a.disabled},null,8,hv),[[i.vModelCheckbox,o.value]]),i.createElementVNode("span",mv,[a.icon||a.imgUrl?(i.openBlock(),i.createElementBlock("span",gv,[a.icon?(i.openBlock(),i.createElementBlock("i",{key:0,class:i.normalizeClass(a.icon)},null,2)):i.createCommentVNode("",!0),a.imgUrl?(i.openBlock(),i.createElementBlock("img",{key:1,src:a.imgUrl,width:"16",height:"16",alt:"icon"},null,8,yv)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"default",{},()=>[i.createTextVNode(i.toDisplayString(a.label),1)])])],2))}}),kv={class:"flex items-center"},Da=i.defineComponent({__name:"vs-input-checkbox-item",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},view:{default:"default"},modelValue:{type:[Boolean,Array],default:!1},icon:{},imgUrl:{},slots:{},option:{},style:{},error:{default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=`radio-${Math.floor(Math.random()*1e4)}`,s=i.computed({get:()=>Array.isArray(t.modelValue)?Array.isArray(t.modelValue)&&t.modelValue.includes(t.value):t.modelValue,set:a=>{if(Array.isArray(t.modelValue)){let c=[...t.modelValue];a?c.includes(t.value)||c.push(t.value):c=c.filter(d=>d!==t.value),r("update:modelValue",c)}else r("update:modelValue",a)}}),l=i.ref(`vs-checkbox-${t.view||"default"}`);return(a,c)=>(i.openBlock(),i.createElementBlock("div",kv,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(l.value==="vs-checkbox-buttons"?i.unref(bv):i.unref(pv)),{value:a.value,label:a.label,info:a.option?.info,disabled:a.disabled,modelValue:s.value,"onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),id:o,icon:a.icon,imgUrl:a.imgUrl,style:i.normalizeStyle(a.style),error:a.error},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(a.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),xv={},wv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function Ev(n,e){return i.openBlock(),i.createElementBlock("svg",wv,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const Cv=ge(xv,[["render",Ev]]),vv={},_v={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function Sv(n,e){return i.openBlock(),i.createElementBlock("svg",_v,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),i.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const Nv=ge(vv,[["render",Sv]]),Mv={},Tv={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"};function Av(n,e){return i.openBlock(),i.createElementBlock("svg",Tv,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M12 9h.01"},null,-1),i.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),i.createElementVNode("path",{d:"M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z"},null,-1)]))}const Bv=ge(Mv,[["render",Av]]),Vv={key:0,class:"flex items-start gap-x-1"},Lv={key:0,class:"text-red-500 text-[14px]"},Ov=["title"],Iv=["disabled"],Kp=i.defineComponent({__name:"vs-input-switcher",props:i.mergeModels({rules:{default:()=>[]},view:{default:"checkbox"},label:{default:""},i:{default:""},text:{default:""},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue");return(r,o)=>e.view==="checkbox"?(i.openBlock(),i.createElementBlock("div",Vv,[i.createVNode(Da,{modelValue:t.value,"onUpdate:modelValue":o[0]||(o[0]=s=>t.value=s),label:r.text,error:r.error||""},null,8,["modelValue","label","error"]),r.rules?.includes("required")?(i.openBlock(),i.createElementBlock("span",Lv,"*")):i.createCommentVNode("",!0),r.i?(i.openBlock(),i.createElementBlock("button",{key:1,class:"cursor-pointer",title:r.i,onClick:o[1]||(o[1]=i.withModifiers(()=>{},["prevent"]))},[i.createVNode(i.unref(Bv),{class:"text-gray-500 w-[14px] h-[14px]"})],8,Ov)):i.createCommentVNode("",!0)])):(i.openBlock(),i.createElementBlock("button",{key:1,type:"button",class:i.normalizeClass(["inline-flex h-5 w-9 shrink-0 px-[2px] cursor-pointer items-center rounded-full shadow-sm disabled:cursor-not-allowed disabled:opacity-50",[t.value?`bg-${r.style?.primaryColor||"blue"}-500`:"bg-stone-200",r.customClass]]),disabled:r.disabled,onClick:o[2]||(o[2]=s=>t.value=!t.value)},[i.createElementVNode("span",{"data-state":"checked",class:i.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[t.value?"translate-x-4":"translate-x-0"]])},null,2)],10,Iv))}}),Dv=["id","innerHTML"],qp=i.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",{id:e.name,class:i.normalizeClass(["text-gray-900",e.customClass]),innerHTML:e.html?e.html:e.text},null,10,Dv))}}),Rv=["placeholder","disabled","name"],Fv=i.defineComponent({__name:"vs-input-mask",props:i.mergeModels({name:{},mask:{default:""},unmask:{type:Boolean,default:!1},placeholder:{default:"_"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=vt(e.style),r=i.useModel(n,"modelValue"),o=i.ref(null);let s=null;return i.onMounted(async()=>{if(o.value){const{default:l}=await Promise.resolve().then(()=>dO);s=l(o.value,{mask:e.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),s.on("accept",()=>{r.value=e.unmask?s.unmaskedValue:s.value}),s.on("complete",()=>{r.value=e.unmask?s.unmaskedValue:s.value}),s.value=r.value??""}}),i.onBeforeUnmount(()=>{s?.destroy()}),i.watch(()=>e.mask,l=>{s&&s.updateOptions({mask:l,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),i.watch(r,l=>{s&&s.unmaskedValue!==l&&(s.value=l||"")}),(l,a)=>(i.openBlock(),i.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:o,placeholder:l.placeholder,disabled:l.disabled,name:l.name,class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,Rv))}}),Pv={class:"relative w-full bg-white rounded-lg"},$v=["placeholder","disabled"],zv=i.defineComponent({__name:"vs-input-email",props:i.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=vt(e.style),r=i.useModel(n,"modelValue");return(o,s)=>(i.openBlock(),i.createElementBlock("div",Pv,[s[1]||(s[1]=i.createStaticVNode('<div class="absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="stroke-gray-500 transition-all"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"></path><path d="M3 7l9 6l9 -6"></path></svg></div>',1)),i.withDirectives(i.createElementVNode("input",{type:"email","onUpdate:modelValue":s[0]||(s[0]=l=>r.value=l),placeholder:o.placeholder,disabled:o.disabled,class:i.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,$v),[[i.vModelText,r.value]])]))}}),Hv=["value","disabled"],jv={class:"text-[13px] text-gray-700"},Uv=i.defineComponent({__name:"vs-input-radio-default",props:i.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.computed(()=>!!e.disabled);return(o,s)=>(i.openBlock(),i.createElementBlock("label",{class:i.normalizeClass(["flex items-center gap-0",[e.customClass,r.value?"cursor-not-allowed opacity-60":""]])},[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=l=>t.value=l),type:"radio",value:e.value,disabled:r.value,class:"hidden"},null,8,Hv),[[i.vModelRadio,t.value]]),i.createElementVNode("span",{class:i.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${e.style?.primaryColor||"blue"}-500`,r.value?"opacity-50 cursor-not-allowed":""]])},[t.value==e.value?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${e.style?.primaryColor||"blue"}-500`]])},null,2)):i.createCommentVNode("",!0)],2),i.createElementVNode("span",jv,i.toDisplayString(e.text),1)],2))}}),Wv=["value","disabled"],Kv={class:"text-[13px] text-gray-700"},qv=i.defineComponent({__name:"vs-input-radio-buttons",props:i.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.computed(()=>!!e.disabled);return(o,s)=>(i.openBlock(),i.createElementBlock("label",{class:i.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[t.value==e.value?`ring-2 ring-ring ring-${e.style?.primaryColor||"blue"}-500`:"",e.customClass,r.value?"cursor-not-allowed opacity-60":""]])},[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=l=>t.value=l),type:"radio",value:e.value,disabled:r.value,class:"hidden"},null,8,Wv),[[i.vModelRadio,t.value]]),i.createElementVNode("span",Kv,i.toDisplayString(e.text),1)],2))}}),Gv={"vs-input-radio-default":Uv,"vs-input-radio-buttons":qv},Gp=i.defineComponent({__name:"vs-input-radio",props:i.mergeModels({options:{},position:{default:"vertical"},view:{default:"default"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.computed(()=>Gv[`vs-input-radio-${e.view}`]);return(o,s)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass([o.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.options,l=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(r.value),i.mergeProps({key:l?.id,text:l.text,value:l.id.toString(),checked:t.value===l.id,modelValue:t.value,"onUpdate:modelValue":s[0]||(s[0]=a=>t.value=a)},{ref_for:!0},o.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),Jv={key:1,class:"w-full flex flex-col gap-4"},Yv={key:0,class:"text-sm font-medium text-muted-foreground my-2"},Xv="Без категорії",Zv=i.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},group:{default:void 0},values:{default:()=>[]},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=i.ref([]),s=i.reactive({}),l=h=>h?.value||h?.id||h?.text||h,a=h=>h.text||String(h),c=h=>`lg:col-span-${h||12}`,d=i.computed(()=>[t.position==="vertical"?"flex flex-col":"",t.colSpan?"grid":"flex justify-start"]),u=h=>h==null||h===""?null:typeof h=="string"||typeof h=="number"?h:String(h),f=i.computed(()=>{if(!t.group)return[];const h=new Map;o.value.forEach(k=>{const w=k[t.group],x=u(w);h.has(x)||h.set(x,[]),h.get(x)?.push(k)});const m=[];t.values?.length&&t.values.forEach(k=>{const w=u(k);m.push(w)});const g=new Set,y=k=>{const w=h.get(k)||[];if(!w.length)return null;const x=k===null?"group-null":`group-${String(k)}`,E=k===null?Xv:String(k);return g.add(k),{key:x,label:E,options:w}},b=[];return m.forEach(k=>{const w=y(k);w&&b.push(w)}),h.forEach((k,w)=>{if(g.has(w))return;const x=y(w);x&&b.push(x)}),b}),p=async()=>{try{const h=await fetch(`/api/suggest/${t.data}`).then(m=>m.json());o.value=h?.data||h}catch(h){console.error(h)}};return i.watch(()=>t.modelValue,h=>{if(typeof h=="boolean"&&o.value.length===1){const m=l(o.value[0]);s[m]=h}else if(Array.isArray(h)){const m=new Set(h);o.value.forEach(g=>{if(!g.disabled){const y=l(g);s[y]=m.has(y)}})}},{immediate:!0}),i.watch(s,()=>{if(!o.value.length){r("update:modelValue",null);return}const h=Object.entries(s).filter(([,m])=>m).map(([m])=>m);r("update:modelValue",h.length===0?[]:h)},{deep:!0}),i.onMounted(()=>{if(t.data)p().then(()=>{if(typeof t.modelValue=="boolean"&&o.value.length===1){const h=l(o.value[0]);s[h]=t.modelValue}else if(Array.isArray(t.modelValue)){const h=new Set(t.modelValue);o.value.forEach(m=>{if(!m.disabled){const g=l(m);s[g]=h.has(g)}})}});else if(o.value=t.options,typeof t.modelValue=="boolean"&&o.value.length===1){const h=l(o.value[0]);s[h]=t.modelValue}else if(Array.isArray(t.modelValue)){const h=new Set(t.modelValue);o.value.forEach(m=>{if(!m.disabled){const g=l(m);s[g]=h.has(g)}})}}),(h,m)=>t.group?(i.openBlock(),i.createElementBlock("div",Jv,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(f.value,g=>(i.openBlock(),i.createElementBlock("div",{key:g.key,class:"flex flex-col gap-2"},[g.label?(i.openBlock(),i.createElementBlock("span",Yv,i.toDisplayString(g.label),1)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["p-0 w-full gap-[12px]",d.value])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(g.options,y=>(i.openBlock(),i.createBlock(Da,{modelValue:s[l(y)],"onUpdate:modelValue":b=>s[l(y)]=b,value:l(y),class:i.normalizeClass(c(h.colSpan)),disabled:t.disabled||y.disabled,label:a(y),key:`${g.key}-${l(y)}`,icon:y?.icon,imgUrl:y?.imgUrl,option:y,view:h.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["p-0 w-full gap-[10px]",d.value])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,g=>(i.openBlock(),i.createBlock(Da,{modelValue:s[l(g)],"onUpdate:modelValue":y=>s[l(g)]=y,value:l(g),class:i.normalizeClass(c(h.colSpan)),disabled:t.disabled||g.disabled,label:a(g),key:l(g),icon:g?.icon,imgUrl:g?.imgUrl,option:g,view:h.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),Qv=ge(Zv,[["__scopeId","data-v-8e66207e"]]),e_=["type","placeholder","disabled"],t_=i.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},mode:{default:"date"}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n;function r(u){return u?t.mode==="datetime"?(u.includes("T")?u:null)||u+(u.includes(" ")?"":"T00:00"):u?.split(" ")[0]:null}const{inputClass:o}=vt(t.style),s=e,l=i.computed({get:()=>r(t.modelValue),set:u=>s("update:modelValue",u)}),a=i.computed(()=>t.mode==="datetime"?"datetime-local":t.mode),c=i.computed(()=>!!t.disabled),d=i.computed(()=>t.placeholder??"");return(u,f)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{type:a.value,"onUpdate:modelValue":f[0]||(f[0]=p=>l.value=p),placeholder:d.value,disabled:c.value,ref:"date",class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[u.modelValue?"":"text-opacity-50",i.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,e_)),[[i.vModelDynamic,l.value]])}}),Jp=async(n,e,t,r)=>{try{const o=new FormData;return o.append("unique","true"),o.append("file",n),(await fetch(`/file/upload/uploads?id=${e||""}&form=${t||""}&table=${r||""}`,{method:"POST",body:o}).then(s=>s.json()))?.result}catch(o){return Pe({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",o),null}},n_=async n=>{try{return await fetch(`file/delete${n}`),!0}catch(e){return console.error(e),!1}},Yp=async n=>{try{const e=await fetch(`file/download/files/uploads${n}`),t=await e.arrayBuffer(),r=e.headers["content-type"],o=new TextDecoder("utf-8").decode(t),s=new Blob([o],{type:r}),l=document.createElement("a");l.setAttribute("download",n),l.href=window.URL.createObjectURL(s),l.click()}catch(e){console.error(e.message)}},r_={},o_={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"};function s_(n,e){return i.openBlock(),i.createElementBlock("svg",o_,e[0]||(e[0]=[i.createElementVNode("path",{d:"M5 12h14"},null,-1),i.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const To=ge(r_,[["render",s_]]),l_={},i_={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-text",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function a_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",i_,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><line x1="9" y1="9" x2="10" y2="9"></line><line x1="9" y1="13" x2="15" y2="13"></line><line x1="9" y1="17" x2="15" y2="17"></line>',6)]))}const c_=ge(l_,[["render",a_]]),d_={},u_={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-table",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function f_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",u_,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),i.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),i.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const p_=ge(d_,[["render",f_]]),h_={},m_={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"};function g_(n,e){return i.openBlock(),i.createElementBlock("svg",m_,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M9 9l1 0"></path><path d="M9 13l6 0"></path><path d="M9 17l6 0"></path>',6)]))}const Xp=ge(h_,[["render",g_]]),y_={},b_={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-zip",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function k_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",b_,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 20.735a2 2 0 0 1 -1 -1.735v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-1"></path><path d="M11 17a2 2 0 0 1 2 2v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a2 2 0 0 1 2 -2z"></path><line x1="11" y1="5" x2="10" y2="5"></line><line x1="13" y1="7" x2="12" y2="7"></line><line x1="11" y1="9" x2="10" y2="9"></line><line x1="13" y1="11" x2="12" y2="11"></line><line x1="11" y1="13" x2="10" y2="13"></line><line x1="13" y1="15" x2="12" y2="15"></line>',9)]))}const x_=ge(y_,[["render",k_]]),w_={},E_={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-code",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function C_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",E_,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M10 13l-1 2l1 2"></path><path d="M14 13l1 2l-1 2"></path>',5)]))}const v_=ge(w_,[["render",C_]]),__=n=>{if(!n)return"";const e=n?.split(".");return e[e.length-1]},S_=n=>{const e=__(n),t={imageFormat:["tiff","jpg","jpeg","png","svg","ico","webp"],sheetsFormat:["xls","csv","xlsx"],archivesFormat:["zip","rar"],textsFormat:["json","geojson","txt","yml","yaml","shp"],documentsFormat:["pdf"]};return t.imageFormat.includes(e)?"img":t.sheetsFormat.includes(e)?p_:t.textsFormat.includes(e)?v_:t.documentsFormat.includes(e)?c_:t.archivesFormat.includes(e)?x_:Xp},N_={},M_={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",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function T_(n,e){return i.openBlock(),i.createElementBlock("svg",M_,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const kl=ge(N_,[["render",T_]]),A_={},B_={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",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function V_(n,e){return i.openBlock(),i.createElementBlock("svg",B_,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),i.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),i.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Zp=ge(A_,[["render",V_]]),L_=["title"],O_={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},I_=i.defineComponent({__name:"vs-input-file-list-item",props:i.mergeModels({format:{},multiple:{type:Boolean},max_size:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(n){const e=i.useModel(n,"value"),t=i.useModel(n,"item"),r=n;return(o,s)=>(i.openBlock(),i.createElementBlock("div",{title:t.value,class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(S_)(t.value)),{src:t.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:s[0]||(s[0]=l=>i.unref(Yp)(t.value))},null,8,["src"])),i.createElementVNode("div",O_,[i.createElementVNode("button",{type:"button",onClick:s[1]||(s[1]=l=>{i.unref(n_)(t.value),e.value=r.multiple?e.value?.filter(a=>a!==t.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[i.createVNode(kl,{class:"w-4 h-4"})]),i.createElementVNode("button",{type:"button",onClick:s[2]||(s[2]=l=>i.unref(Yp)(t.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[i.createVNode(Zp,{class:"w-4 h-4"})])])],8,L_))}}),Qp=ge(I_,[["__scopeId","data-v-286cdbc0"]]),D_={class:"flex items-center gap-x-2"},R_=["multiple","disabled"],F_={key:1,class:"flex items-center flex-wrap gap-2"},P_={key:1,class:"loader"},$_={key:1,class:"loader"},z_=i.defineComponent({__name:"vs-input-file",props:i.mergeModels({format:{},multiple:{type:Boolean},max_size:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{},modelModifiers:{}}),emits:i.mergeModels(["change"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=i.useModel(n,"modelValue"),o=e,s=i.ref(null),l=i.ref(!1),a=u=>Array.isArray(r.value)&&r.value[u]||"",c=u=>{if(t.max_size&&u.size>t.max_size*1024*1024){const f=(u.size/1048576).toFixed(2);return Pe({type:"error",title:"Помилка!",message:`Файл "${u.name}" занадто великий. Максимальний розмір: ${t.max_size} МБ, розмір файлу: ${f} МБ`,position:"right-bottom"}),!1}return!0},d=async u=>{const{files:f}=u.target;if(!f||f.length===0)return;const p=Array.from(f);if(t.max_size&&p.filter(h=>!c(h)).length>0){s.value&&(s.value.value="");return}l.value=!0;try{if(t.multiple){const h=Array.from(f).map(async g=>t.format&&!g.name.endsWith(t.format)?null:await Jp(g,"1","form","table")),m=(await Promise.all(h)).filter(g=>g!==null).map(g=>g?.file_path).filter(Boolean);r.value=[...r.value||[],...m],o("change",r.value)}else{const h=f[0];if(t.format&&!h.name.endsWith(t.format))return;const m=await Jp(h,"1","form","table");r.value=m?.file_path,o("change",r.value||"")}}finally{l.value=!1,s.value&&(s.value.value="")}};return(u,f)=>(i.openBlock(),i.createElementBlock("div",D_,[i.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:s,type:"file",multiple:u.multiple,onChange:d,disabled:l.value||u.disabled},null,40,R_),!u.multiple&&r.value?(i.openBlock(),i.createBlock(Qp,{key:0,item:r.value,"onUpdate:item":f[0]||(f[0]=p=>r.value=p),value:r.value,"onUpdate:value":f[1]||(f[1]=p=>r.value=p)},null,8,["item","value"])):u.multiple?(i.openBlock(),i.createElementBlock("div",F_,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,(p,h)=>(i.openBlock(),i.createBlock(Qp,{multiple:u.multiple,key:h,value:r.value,"onUpdate:value":f[2]||(f[2]=m=>r.value=m),item:a(h)},null,8,["multiple","value","item"]))),128)),i.createElementVNode("div",{onClick:f[3]||(f[3]=p=>!u.disabled&&!l.value&&s.value?.click()),class:i.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",u.disabled||l.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[l.value?(i.openBlock(),i.createElementBlock("div",P_)):(i.openBlock(),i.createBlock(To,{key:0,class:"w-6 h-6"}))],2)])):i.createCommentVNode("",!0),u.multiple?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",{key:2,onClick:f[4]||(f[4]=p=>s.value?.click()),class:i.normalizeClass([u.disabled||l.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center cursor-pointer hover:border-blue-500 transition-all duration-300 hover:bg-blue-50"])},[l.value?(i.openBlock(),i.createElementBlock("div",$_)):(i.openBlock(),i.createBlock(To,{key:0,class:"w-6 h-6"}))],2))]))}}),H_=ge(z_,[["__scopeId","data-v-e613a523"]]),j_={class:"max-w-[55vw]"},U_={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},W_={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},K_={class:"px-[5px]"},q_={class:""},xl=i.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(n){const e=n,t=i.computed(()=>{try{return new Date(e.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function r(o){if(o<1024)return`${o} B`;const s=o/1024;return s<1024?`${s.toFixed(2)} KB`:`${(s/1024).toFixed(2)} MB`}return(o,s)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[s[1]||(s[1]=i.createStaticVNode('<div class="flex items-center justify-center h-[30px] w-[30px]"><svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-file"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path></svg></div>',1)),i.createElementVNode("div",j_,[i.createElementVNode("p",U_,i.toDisplayString(o.item?.uploaded_name),1),i.createElementVNode("p",W_,[i.createElementVNode("span",null,i.toDisplayString(o.item?.username),1),i.withDirectives(i.createElementVNode("span",K_,"|",512),[[i.vShow,o.item?.username]]),i.createElementVNode("span",null,i.toDisplayString(t.value),1),s[0]||(s[0]=i.createElementVNode("span",{class:"px-[5px]"},"|",-1)),i.createElementVNode("span",q_,i.toDisplayString(r(o.item?.size)),1)])])],64))}}),G_={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},J_={key:0,class:"flex w-full gap-x-3 items-center"},Y_={key:1,class:"flex gap-x-3 w-full items-center"},X_={key:2,class:"flex gap-x-3 w-full items-center"},Z_=["href"],Q_={key:3,class:"flex gap-x-3 w-full items-center"},eS={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},tS={class:"p-0.5 sm:p-1 inline-flex items-center gap-0.5 bg-white rounded-lg dark:bg-neutral-800 dark:border-neutral-700"},nS={class:"inline-block"},rS={class:"inline-block"},oS=i.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(n,{emit:e}){const t=n,r=e;function o(u){return["pdf","json"].includes(u.ext)}function s(u){return["ppt","pptx","doc","docx","xls","xlsx"].includes(u.ext)}function l(u){const f=document.createElement("a");f.setAttribute("download",u?.uploaded_name),f.href=u?.file_path,f.click()}async function a(){try{await fetch(`${t.prefix}/widget/file/${t.item.entity_id}/${t.item.file_id}`),r("update")}catch(u){console.error(u)}}function c(){r("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:a,updateListOnConfirm:!0})}function d(u){(t.item.ext==="jpg"||t.item.ext==="png")&&r("openLightbox",{item:t.item,index:u})}return(u,f)=>(i.openBlock(),i.createElementBlock("div",G_,[u.item.ext==="jpg"||u.item.ext==="png"?(i.openBlock(),i.createElementBlock("div",J_,[i.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:f[0]||(f[0]=p=>d(u.index))},[i.createVNode(xl,{item:u.item},null,8,["item"])])])):o(u.item)?(i.openBlock(),i.createElementBlock("div",Y_,[i.createVNode(xl,{item:u.item},null,8,["item"])])):s(u.item)?(i.openBlock(),i.createElementBlock("div",X_,[i.createElementVNode("a",{href:`/api/file-preview?id=${u.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[i.createVNode(xl,{item:u.item},null,8,["item"])],8,Z_)])):(i.openBlock(),i.createElementBlock("div",Q_,[i.createVNode(xl,{item:u.item},null,8,["item"])])),i.createElementVNode("div",eS,[i.createElementVNode("div",tS,[i.createElementVNode("div",nS,[i.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:f[1]||(f[1]=p=>l(u.item))},[i.createVNode(Zp,{height:"14",width:"14"})])]),f[3]||(f[3]=i.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),i.createElementVNode("div",rS,[i.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:f[2]||(f[2]=p=>c())},[i.createVNode(kl,{height:"14",width:"14"})])])])])]))}}),sS={},lS={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",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function iS(n,e){return i.openBlock(),i.createElementBlock("svg",lS,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),i.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),i.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const aS=ge(sS,[["render",iS]]),cS={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},dS={class:"flex w-full mb-[12px] items-center gap-x-2"},uS={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},fS={class1:"ml-auto"},pS={class:"py-1.5 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg bg-gray-100 cursor-pointer hover:bg-gray-200 text-gray-800 shadow-2xs hover:bg-gray-50 focus:outline-hidden focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},hS={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},mS={class:"relative"},gS={key:1,class:"space-y-3 max-h-[300px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},yS={key:0},bS=i.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update"],setup(n,{emit:e}){const t=n,r=i.inject("form"),o=i.computed(()=>r.value.formId),s=i.ref(!1),l=i.ref(0),a=e,c=i.ref(!1),d=i.ref({}),u=i.ref([]),f=i.ref(""),p=i.computed(()=>Array.isArray(u.value)?u.value.filter(w=>w.ext==="jpg"||w.ext==="png").map(w=>w?.file_path):[]),h=i.computed(()=>f.value===""?u.value:u.value.filter(w=>w?.uploaded_name?.includes(f.value))),m=w=>{const x=p.value.findIndex(E=>E===w.item.file_path);x!==-1&&(s.value=!0,l.value=x)},g=async()=>{try{const w=await fetch(`${t.prefix}/widget/file/${o.value}`).then(x=>x.json());u.value=w?.rows}catch(w){console.error(w)}},y=async w=>{await Promise.all(Array.from(w.target.files).map(async x=>{const E=new FormData;E.append("file",x);try{const M=`${t.prefix}/widget/file/${o.value}`,C=await fetch(M,{method:"POST",body:E});return C.ok?(a("update","file-list"),x):(Pe({type:C.status>=400&&C.status<500?"warning":"error",title:"Error",message:`Error code: ${C.status}`}),null)}catch(M){return Pe({type:"error",title:"Error",message:M.message||"Unknown error"}),console.error(M),null}})),await g()},b=w=>{const x={...w};return w.cancel||(x.cancel=()=>{c.value=!1}),w.updateListOnConfirm&&(x.confirm=async()=>{await w.confirm(),c.value=!1,g()}),x},k=w=>{d.value=b(w),c.value=!0};return i.watch(o,w=>{w&&g()}),i.onMounted(()=>{o.value&&g()}),(w,x)=>{const E=i.resolveComponent("Lightbox"),M=i.resolveComponent("MessageBox");return i.openBlock(),i.createElementBlock("div",cS,[i.createElementVNode("div",dS,[i.createElementVNode("h2",uS," Файлів: "+i.toDisplayString(u.value?.length),1),i.createElementVNode("div",fS,[i.createElementVNode("label",null,[i.createElementVNode("input",{type:"file",class:"hidden",onChange:x[0]||(x[0]=C=>y(C))},null,32),i.createElementVNode("div",pS,[i.createVNode(aS,{height:"16",width:"16"})])])])]),u.value?.length>4?(i.openBlock(),i.createElementBlock("div",hS,[i.createElementVNode("div",null,[i.createElementVNode("div",mS,[x[8]||(x[8]=i.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[i.createElementVNode("svg",{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400",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"},[i.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),i.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),i.withDirectives(i.createElementVNode("input",{type:"text","onUpdate:modelValue":x[1]||(x[1]=C=>f.value=C),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[i.vModelText,f.value,void 0,{trim:!0}]])])])])):i.createCommentVNode("",!0),u.value?.length?(i.openBlock(),i.createElementBlock("div",gS,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.value,(C,A)=>(i.openBlock(),i.createBlock(oS,{key:A,prefix:w.prefix,item:C,index:A,onUpdate:x[2]||(x[2]=z=>w.$emit("update","file-list")),onOpenModal:x[3]||(x[3]=z=>k(z)),onOpenLightbox:x[4]||(x[4]=z=>m(z))},null,8,["prefix","item","index"]))),128)),h.value.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",yS,x[9]||(x[9]=[i.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):i.createCommentVNode("",!0),i.createVNode(E,{modelValue:s.value,"onUpdate:modelValue":x[5]||(x[5]=C=>s.value=C),startIndex:l.value,"onUpdate:index":x[6]||(x[6]=C=>l.value=C),images:p.value},null,8,["modelValue","startIndex","images"]),i.createVNode(M,i.mergeProps({modelValue:c.value,"onUpdate:modelValue":x[7]||(x[7]=C=>c.value=C),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),kS={class:"flex items-center justify-between"},xS={class:"text-[16px] text-gray-900 font-medium"},wS={class:"grid gap-3"},ES=i.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(n){const e=n,t=i.ref(e.isOpen);return i.watch(()=>e.isOpen,r=>{t.value=r}),(r,o)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",kS,[i.createElementVNode("p",xS,i.toDisplayString(n.title),1),i.createVNode(Kp,{modelValue:t.value,"onUpdate:modelValue":o[0]||(o[0]=s=>t.value=s),style:i.normalizeStyle(n.style)},null,8,["modelValue","style"])]),i.createVNode(i.Transition,{name:"slide-fade"},{default:i.withCtx(()=>[i.withDirectives(i.createElementVNode("div",wS,[i.renderSlot(r.$slots,"default",{},void 0,!0)],512),[[i.vShow,t.value]])]),_:3})]))}}),CS=ge(ES,[["__scopeId","data-v-90320b87"]]),vS={class:"text-[16px] text-gray-900 font-medium"},_S={class:"grid gap-3"},SS=i.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(n){const e=n,t=i.ref(e.isOpen);return i.watch(()=>e.isOpen,r=>{t.value=r}),(r,o)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("button",{type:"button",onClick:o[0]||(o[0]=s=>t.value=!t.value),class:"flex items-center gap-2"},[i.createVNode(i.unref(Cv),{class:i.normalizeClass(["h-4 w-4 duration-300",[t.value?"-rotate-180":""]])},null,8,["class"]),i.createElementVNode("span",vS,i.toDisplayString(n.title),1)]),i.createVNode(i.Transition,{name:"slide-fade"},{default:i.withCtx(()=>[i.withDirectives(i.createElementVNode("div",_S,[i.renderSlot(r.$slots,"default",{},void 0,!0)],512),[[i.vShow,t.value]])]),_:3})]))}}),NS=ge(SS,[["__scopeId","data-v-590eff11"]]),MS={class:"flex items-center justify-between"},TS=i.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",MS,[i.createElementVNode("p",null,i.toDisplayString(n.title),1)]),i.renderSlot(e.$slots,"default")]))}}),AS={switcher:CS,accordion:NS,default:TS},Ot={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},BS=(n,e)=>String(n)===String(e),VS=(n,e)=>String(n)!==String(e),LS=(n,e)=>n>e,OS=(n,e)=>n>=e,IS=(n,e)=>n<e,DS=(n,e)=>n<=e,RS=(n,e)=>Array.isArray(e)&&e.length===2?n>=e[0]&&n<=e[1]:!1,FS=(n,e)=>String(n).startsWith(String(e)),PS=(n,e)=>String(n).endsWith(String(e)),$S=(n,e)=>String(n).includes(String(e)),zS=(n,e)=>Array.isArray(e)?e.includes(n):!1,HS=(n,e)=>Array.isArray(e)?!e.includes(n):!0,eh=(n,e)=>{if(!e)return!0;switch(e?.[1]){case Ot.Equal:return BS(n,e?.[2]);case Ot.Inequal:return VS(n,e?.[2]);case Ot.Higer:return LS(n,e?.[2]);case Ot.HigerOrEqual:return OS(n,e?.[2]);case Ot.Lower:return IS(n,e?.[2]);case Ot.LowerOrEqual:return DS(n,e?.[2]);case Ot.Between:return RS(n,e?.[2]);case Ot.StartWith:return FS(n,e?.[2]);case Ot.EndWith:return PS(n,e?.[2]);case Ot.Contain:return $S(n,e?.[2]);case Ot.In:return zS(n,e?.[2]);case Ot.NotIn:return HS(n,e?.[2]);default:return!0}},jS=i.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},name:{type:String,default:""},schema:{type:Array,default:()=>[]}},setup(n){const e=n,t=i.inject("values",i.ref({})),r=i.inject("form"),o=i.computed(()=>e.schema?.filter(a=>{const c=a?.conditions;if(!c)return!0;const d=Array.isArray(c)?c[0]:c,u=e.name?t.value?.[e.name]?.[d]??t.value?.[d]:t.value?.[d];return eh(u,c)})),s=i.computed(()=>AS[e.view]),l=i.computed(()=>{if(t.value||(t.value={}),!e.name)return t.value;const a=t.value[e.name];if(a)return a;const c={};return t.value={...t.value,[e.name]:c},c});return(a,c)=>n.schema?.length?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(s.value),{key:0,title:n.title,style:i.normalizeStyle(n.style)},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,d=>(i.openBlock(),i.createBlock(rh,i.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:l.value[d.name],"onUpdate:modelValue":u=>l.value[d.name]=u,style:n.style,error:i.unref(r)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):i.createCommentVNode("",!0)}}),US=["aria-expanded","data-focus"],WS={key:0,class:"flex flex-wrap items-center gap-1 overflow-y-auto min-w-0 flex-1"},KS={class:"flex items-center min-w-0"},qS=["title"],GS=["innerHTML"],JS=["onClick"],YS={class:"flex-1 min-w-[2px]"},XS=["placeholder"],ZS=["title"],QS=["innerHTML"],eN={key:2,class:"flex-1 min-w-[2px]"},tN=["placeholder"],nN={class:"flex items-center shrink-0"},rN=["disabled"],oN=["disabled","title"],sN=["aria-disabled","onClick"],lN=["innerHTML"],iN={key:1,class:"px-3 py-2 text-center text-gray-500"},aN=["disabled"],th=i.defineComponent({__name:"vs-input-select",props:{multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},mode:{},defaultValue:{},search:{type:Boolean,default:!0},placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{default:""},options:{default:()=>[]},api:{default:null},maxHeight:{default:400},parent:{},set:{},slot:{},add:{},teleport:{default:"body"},auto:{default:0},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{}},emits:["change","update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=i.computed(()=>t.multiple),s=i.computed(()=>t.disabled);vt(t.style);const l=i.computed({get:()=>t.modelValue,set:T=>r("update:modelValue",T)});!l.value&&t.defaultValue&&(l.value=t.defaultValue);const a=i.ref(null),c=i.ref(null),d=i.ref(null),u=i.ref(null),f=i.ref(!1),p=i.ref(!1),h=i.ref(null),m=i.ref([]),g=i.ref(-1),y=i.ref([]),b=i.ref(""),k=i.ref(null),w=i.ref("bottom"),x=i.ref({}),E=i.ref([]),M=i.computed(()=>{if(!E.value.length)return[];const T=m.value,R=new Map(T.map(j=>[j.id?.toString(),j]));return E.value.map(j=>R.get(j?.toString())).filter(j=>!!j)}),C=i.computed(()=>t.placeholder||"Select..."),A=i.computed(()=>U(h.value));i.computed(()=>o.value?!E.value.length&&b.value==="":!A.value&&b.value==="");const z=i.computed(()=>s.value?!1:o.value?E.value.length>0:!!l.value),G=T=>o.value?E.value.some(R=>R?.toString()===T?.toString()):l.value?.toString()===T?.toString(),V=i.computed(()=>{let T=m.value??[];if(!t.data&&b.value.trim()!==""){const R=b.value.toLowerCase();T=T.filter(j=>{const ae=U(j).toLowerCase(),_e=j.text?.toLowerCase?.()||"";return ae.includes(R)||_e.includes(R)})}if(o.value&&E.value.length){const R=new Set(E.value.map(j=>j?.toString()));T=T.filter(j=>!R.has(j.id?.toString()))}return T}),O=i.inject("values"),Y=/\{\{\s*([^}]+?)\s*\}\}/g,Q=T=>(T?String(T):"").replace(/<[^>]*>/g,"").trim(),P=i.computed(()=>t.slot??t?.optionTemplate??""),K=T=>{if(!T)return"";const R=P.value;return R?R.replace(Y,(j,ae)=>{const _e=ae.trim(),Ze=T[_e];return Ze!=null?String(Ze):""}):T.text??""},U=T=>{if(!T)return"";if(!P.value)return T.text??"";const R=K(T);return Q(R)||T.text||""},re=T=>{t.set&&O?.value&&Object.entries(t.set).forEach(([R,j])=>{if(!R)return;const ae=T?T[j]:null;O.value[R]=ae??null})},se=i.computed(()=>t.parent?O?.value?.[t.parent]?.toString()??null:null),ve=async T=>{if(!t.data){let R=t.options??[];if(T?.trim()){const j=T.toLowerCase();R=R.filter(ae=>{const _e=U(ae).toLowerCase(),Ze=ae.text?.toLowerCase?.()||"";return _e.includes(j)||Ze.includes(j)})}return R}try{const R=t.host??"",j=t.prefix??"api",ae=t.api??`/${j}/suggest/${t.data}`,_e=`${R}${ae}`,Ze=new URLSearchParams;return Ze.set("json","1"),T&&Ze.set("key",T),se.value!==void 0&&se.value!==null&&se.value!==""&&Ze.set("parent",se.value),(await fetch(`${_e}?${Ze.toString()}`).then(Nt=>Nt.json()))?.data??[]}catch{return[]}},pt=async()=>{t.data?m.value=await ve(b.value):m.value=t.options?[...t.options]:[]},St=async T=>{if(T==null)return null;const R=m.value?.find(j=>j?.id?.toString()===String(T));if(R)return R;if(t.data)try{const j=t.host??"",ae=t.prefix??"api",_e=t.api??`/${ae}/suggest/${t.data}`,Ze=`${j}${_e}`,Nt=new URLSearchParams;return Nt.set("json","1"),Nt.set("val",String(T)),se.value!==void 0&&se.value!==null&&se.value!==""&&Nt.set("parent",se.value),((await fetch(`${Ze}?${Nt.toString()}`).then(Wr=>Wr.json()))?.data??[])?.[0]??null}catch{return null}return null},Ft=async T=>{const R=new Set(m.value.map(ae=>ae.id?.toString())),j=T.filter(ae=>!R.has(ae?.toString()));j.length&&await j.reduce(async(ae,_e)=>{await ae;const Ze=await St(_e);Ze&&m.value.push(Ze)},Promise.resolve())},Ke=async()=>{s.value||(f.value=!0,await pt(),await i.nextTick(()=>{$t(),k.value?.focus(),V.value.length?g.value=0:g.value=-1}))},ht=()=>{f.value=!1,g.value=-1},En=async T=>{s.value||(f.value?ht():await Ke())},Cn=async()=>{f.value?k.value?.focus():await Ke()},vn=()=>{o.value?(E.value=[],l.value=[],r("change",[])):(h.value=null,l.value=null,r("change",null)),re(null),b.value="",i.nextTick(()=>k.value?.focus())},xr=T=>{o.value&&(E.value=E.value.filter(R=>R?.toString()!==T?.toString()),l.value=[...E.value],r("change",l.value),i.nextTick(()=>k.value?.focus()))},mt=T=>{o.value?(G(T.id)||(E.value=[...E.value,T.id],l.value=[...E.value],r("change",l.value)),b.value="",i.nextTick(()=>{k.value?.focus(),g.value=Math.min(g.value,V.value.length-1)}),re(null)):(h.value=T,l.value=T.id,r("change",l.value),b.value="",ht(),re(T))},Pt=T=>{G(T.id)||mt(T)},cn=(T,R)=>{if(!T||!R)return;const j=T.offsetTop,ae=j+T.offsetHeight,_e=R.scrollTop,Ze=_e+R.clientHeight;let Nt=R.scrollTop;j<_e?Nt=j-80:ae>Ze&&(Nt=ae-R.clientHeight+4);const Wr=R;Wr.scrollTop=Nt},qe=T=>{let R=T.parentElement;for(;R;){if(R.classList.contains("ui-dialog__content"))return R;const j=window.getComputedStyle(R),ae=j.overflow+j.overflowY+j.overflowX;if(ae.includes("auto")||ae.includes("scroll")||R===document.body||R===document.documentElement)return R;R=R.parentElement}return document.body},$t=()=>{if(!c.value)return;const T=c.value.getBoundingClientRect(),R=window.innerHeight||document.documentElement.clientHeight,j=window.innerWidth||document.documentElement.clientWidth,ae=8,_e=8,Ze=t.maxHeight||300,Nt=R-T.bottom-_e-ae,Wr=T.top-_e-ae,Dl=Nt>=Wr,bc=Math.max(j-ae*2,0);let{width:jo}=T;bc>0&&jo>bc&&(jo=bc);let{left:Uo}=T;Uo+jo+ae>j&&(Uo=j-jo-ae),Uo=Math.max(Uo,ae);const uO=Math.min(Ze,Math.max(Dl?Nt:Wr,50));w.value=Dl?"bottom":"top",x.value={position:"fixed",left:`${Uo}px`,width:`${jo}px`,minWidth:"300px",maxHeight:`${uO}px`,transform:Dl?"none":"translateY(-100%)",top:Dl?`${T.bottom+_e}px`:`${T.top-_e}px`}},qt=async T=>{s.value||!f.value&&(T.key==="ArrowDown"||T.key==="ArrowUp")&&(T.preventDefault(),await Ke())},dn=T=>{if(!f.value)return;const{key:R}=T;if(R==="ArrowDown")T.preventDefault(),g.value+1<V.value.length&&(g.value+=1,cn(y.value[g.value],d.value));else if(R==="ArrowUp")T.preventDefault(),g.value>0&&(g.value-=1,cn(y.value[g.value],d.value));else if(R==="Enter"){T.preventDefault();const j=V.value[g.value];j&&mt(j),k.value?.blur()}else R==="Escape"?(T.preventDefault(),ht()):R==="Backspace"?o.value&&b.value===""&&E.value.length&&(E.value=E.value.slice(0,-1),l.value=[...E.value],r("change",l.value)):R==="Home"?(g.value=0,cn(y.value[0],d.value)):R==="End"?(g.value=V.value.length-1,cn(y.value[g.value],d.value)):R==="Tab"&&ht()},Xn=()=>{s.value||(p.value=!0)},_=()=>{p.value=!1,b.value=""},S=T=>{T.key==="Escape"&&f.value&&ht()},D=T=>{const R=T.target;a.value?.contains(R)||u.value?.contains(R)||ht()},X=T=>{f.value&&d.value&&!d.value.contains(T.target)&&$t()},we=()=>{f.value&&$t()},Be=()=>{f.value&&$t()};i.watch(()=>t.options,T=>{T?.length&&(m.value=[...T],pe())},{immediate:!0});async function pe(){if(o.value)Array.isArray(l.value)?E.value=[...l.value]:(E.value=l.value==null?[]:[l.value],l.value=[...E.value]),t.data&&E.value.length&&(await Ft(E.value),await i.nextTick());else{if(Array.isArray(l.value)){const T=l.value[0]??null;l.value=T??null}l.value!=null&&(h.value=await St(l.value)),re(h.value??null)}}i.watch(l,()=>{pe()}),i.onMounted(async()=>{addEventListener("keydown",S),addEventListener("scroll",X,!0),addEventListener("resize",we),document.addEventListener("click",D,!0),c.value&&qe(c.value).addEventListener("scroll",Be,!0),t.options?.length&&!t.data?m.value=[...t.options]:t.data&&(m.value=await ve("")),await pe(),fe.value=!1}),i.onUnmounted(()=>{removeEventListener("keydown",S),removeEventListener("scroll",X,!0),removeEventListener("resize",we),document.removeEventListener("click",D,!0),c.value&&qe(c.value).removeEventListener("scroll",Be,!0)});const B=i.ref(!1),F=i.ref({}),he=i.ref([]),v=i.ref(null);async function N(){if(!t.add?.token||v?.value.validate())return;const T=t.add.api??`/api/table/${t.add.token}`,{id:R}=await fetch(T,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F.value)}).then(j=>j.json());if(!t.options?.length&&t.data){const{data:j}=await fetch(`${t.api??`/api/suggest/${t.data}`}?val=${R}`).then(ae=>ae.json());h.value=j[0],m.value.push(j[0]),l.value=R}B.value=!1,Pe({title:"Success!",message:"Object created."})}async function H(){if(!t.add)return null;const T=await fetch(`/api/template/form/${t.add.form}`).then(R=>R.json());return he.value=T.schema,B.value=!0,null}function W(T,R=200){let j;return(...ae)=>{j&&clearTimeout(j),j=window.setTimeout(()=>T(...ae),R)}}const Z=W(async T=>{m.value=await ve(T)},200);i.watch(b,T=>{t.data&&Z(T.trim())}),i.watch(()=>t.options,T=>{!t.data&&T?.length&&(m.value=[...T],pe())},{immediate:!0}),i.watch(()=>t.parent??t.parentValue,()=>{t.data&&pt()});const fe=i.ref(!0);return i.watch(se,async()=>{if(t.data&&(fe.value||(o.value?(E.value=[],l.value=[],r("change",[])):(h.value=null,l.value=null,r("change",null))),await pt(),t.auto===1&&se.value&&m.value.length>0)){const T=m.value[0];T&&mt(T)}}),(T,R)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(i.unref(Ia),{visible:B.value,"onUpdate:visible":R[1]||(R[1]=j=>B.value=j),title:"Додати",buttonText:"Додати",onDone:N,teleport:T.teleport},{default:i.withCtx(()=>[i.createVNode(Rr,{schema:he.value,modelValue:F.value,"onUpdate:modelValue":R[0]||(R[0]=j=>F.value=j),ref_key:"addForm",ref:v},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),i.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:a,onClick:R[5]||(R[5]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",{class:i.normalizeClass(["relative w-full font-sans",t.customClass])},[R[10]||(R[10]=i.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),R[11]||(R[11]=i.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),i.createElementVNode("div",{class:i.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",f.value||p.value?"border-blue-500 ring-1 ring-blue-500":"",s.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":f.value,"aria-haspopup":"listbox",onKeydown:qt,onClick:Cn,"data-focus":f.value||p.value?"true":"false"},[i.createElementVNode("div",{class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full",ref_key:"triggerRef",ref:c},[o.value?(i.openBlock(),i.createElementBlock("div",WS,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(M.value,j=>(i.openBlock(),i.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border max-w-full",key:j.id},[i.createElementVNode("div",KS,[j?.color?(i.openBlock(),i.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:i.normalizeStyle({backgroundColor:j?.color})},null,4)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:"truncate text-gray-900 overflow-hidden max-w-[200px] px-0.5 py-[2px] pl-1.5",title:U(j)},[P.value?(i.openBlock(),i.createElementBlock("span",{key:0,innerHTML:K(j)},null,8,GS)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(j.text),1)],64))],8,qS)]),i.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b] flex-shrink-0",onClick:i.withModifiers(ae=>xr(j.id),["stop"])},R[6]||(R[6]=[i.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[i.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,JS)]))),128)),i.createElementVNode("div",YS,[!s.value&&T.search?i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:0,ref_key:"inputRef",ref:k,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:E.value.length?" ":C.value,"onUpdate:modelValue":R[2]||(R[2]=j=>b.value=j),onFocus:Xn,onBlur:_,onKeydown:dn},null,40,XS)),[[i.vModelText,b.value]]):i.createCommentVNode("",!0)])])):!o.value&&!p.value&&A.value&&b.value===""?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["truncate text-gray-900"]),title:A.value},[h.value?.color?(i.openBlock(),i.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block mr-1 mt-1 absolute",style:i.normalizeStyle({backgroundColor:h.value?.color})},null,4)):i.createCommentVNode("",!0),P.value?(i.openBlock(),i.createElementBlock("span",{key:1,class:i.normalizeClass({"pl-5":h.value?.color}),innerHTML:K(h.value)},null,10,QS)):(i.openBlock(),i.createElementBlock("span",{key:2,class:i.normalizeClass({"pl-5":h.value?.color})},i.toDisplayString(h.value?.text),3))],8,ZS)):i.createCommentVNode("",!0),o.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",eN,[!s.value&&T.search?i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:0,ref_key:"inputRef",ref:k,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:A.value?" ":C.value,"onUpdate:modelValue":R[3]||(R[3]=j=>b.value=j),onFocus:Xn,onBlur:_,onKeydown:dn},null,40,tN)),[[i.vModelText,b.value]]):i.createCommentVNode("",!0)]))],512),i.createElementVNode("div",nN,[z.value?(i.openBlock(),i.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:s.value,onClick:i.withModifiers(vn,["stop"])},R[7]||(R[7]=[i.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[i.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,rN)):i.createCommentVNode("",!0),R[9]||(R[9]=i.createElementVNode("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),i.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:s.value,onClick:R[4]||(R[4]=i.withModifiers(j=>En(),["stop"])),title:f.value?"Закрити список":"Відкрити список"},R[8]||(R[8]=[i.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[i.createElementVNode("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})],-1)]),8,oN)])],42,US),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[f.value?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:i.normalizeClass(["fixed z-[3000] rounded bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.1),0_4px_11px_rgba(0,0,0,0.1)]"]),style:i.normalizeStyle(x.value),role:"listbox"},[i.createElementVNode("div",{class:"overflow-y-auto py-1",style:i.normalizeStyle({maxHeight:x.value.maxHeight||"300px"}),ref_key:"listRef",ref:d},[V.value.length?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList(V.value,(j,ae)=>(i.openBlock(),i.createElementBlock("div",{key:j.id,ref_for:!0,ref:_e=>y.value[ae]=_e,class:i.normalizeClass(["flex px-3 py-2 cursor-default select-none text-gray-900 ",G(j.id)?"bg-blue-500 text-white":"bg-white hover:bg-blue-100",g.value===ae&&!G(j.id)?"bg-blue-100":""]),"aria-disabled":G(j.id)?"true":"false",role:"option",tabindex:"-1",onClick:_e=>Pt(j)},[j?.color?(i.openBlock(),i.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block mr-1 mt-1.5",style:i.normalizeStyle({backgroundColor:j?.color})},null,4)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["leading-[19px]",g.value===j.id?"text-white":"",(g.value,"")])},[P.value?(i.openBlock(),i.createElementBlock("span",{key:0,innerHTML:K(j)},null,8,lN)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(j.text),1)],64))],2)],10,sN))),128)):(i.openBlock(),i.createElementBlock("div",iN," No options "))],4)],4)):i.createCommentVNode("",!0)]))],2),t.add?(i.openBlock(),i.createElementBlock("button",{key:0,onClick:H,class:"bg-white hover:bg-gray-100 text-sm text-gray-900 py-[10px] px-3 border border-stone-200 rounded-md h-[38px] flex items-center gap-2",disabled:s.value,type:"button"},[i.createVNode(To,{width:"16",height:"16"}),R[12]||(R[12]=i.createElementVNode("span",null,"Додати",-1))],8,aN)):i.createCommentVNode("",!0)],512)],64))}}),cN=["placeholder","disabled"],dN=i.defineComponent({__name:"vs-input-textarea",props:i.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=vt(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled),s=i.computed(()=>e.placeholder??"");return(l,a)=>i.withDirectives((i.openBlock(),i.createElementBlock("textarea",{"onUpdate:modelValue":a[0]||(a[0]=c=>r.value=c),placeholder:s.value,disabled:o.value,row:"2",class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[i.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,cN)),[[i.vModelText,r.value]])}}),uN={},fN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"};function pN(n,e){return i.openBlock(),i.createElementBlock("svg",fN,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),i.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const hN=ge(uN,[["render",pN]]),mN={},gN={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function yN(n,e){return i.openBlock(),i.createElementBlock("svg",gN,e[0]||(e[0]=[i.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),i.createElementVNode("path",{d:"M7 20V4"},null,-1),i.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),i.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const bN=ge(mN,[["render",yN]]),kN={},xN={xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function wN(n,e){return i.openBlock(),i.createElementBlock("svg",xN,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),i.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),i.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const EN=ge(kN,[["render",wN]]),CN={},vN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function _N(n,e){return i.openBlock(),i.createElementBlock("svg",vN,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),i.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),i.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const SN=ge(CN,[["render",_N]]),NN={},MN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function TN(n,e){return i.openBlock(),i.createElementBlock("svg",MN,e[0]||(e[0]=[i.createStaticVNode('<circle cx="9" cy="12" r="1"></circle><circle cx="9" cy="5" r="1"></circle><circle cx="9" cy="19" r="1"></circle><circle cx="15" cy="12" r="1"></circle><circle cx="15" cy="5" r="1"></circle><circle cx="15" cy="19" r="1"></circle>',6)]))}const nh=ge(NN,[["render",TN]]),AN={},BN={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function VN(n,e){return i.openBlock(),i.createElementBlock("svg",BN,e[0]||(e[0]=[i.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)]))}const LN=ge(AN,[["render",VN]]),ON={},IN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function DN(n,e){return i.openBlock(),i.createElementBlock("svg",IN,e[0]||(e[0]=[i.createElementVNode("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"},null,-1)]))}const RN=ge(ON,[["render",DN]]),FN={class:"vs-datatable border rounded-xl w-full flex-grow"},PN={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},$N={class:"relative w-full"},zN={class:"table-wrapper flex gap-2"},HN={class:"vs-popover inline-block text-slate-700"},jN={class:"text-center"},UN={class:""},WN={class:"py-1 px-0 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},KN={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},qN={class:"text-sm items-center text-gray-800 flex gap-1"},GN={class:"w-full overflow-x-auto"},JN={class:"w-full table-auto caption-bottom text-sm"},YN={class:"[&_tr]:border-b"},XN={class:"border-b data-[state=selected]:bg-muted bg-slate-50/50 dark:bg-slate-700/50 hover:bg-slate-50/80 dark:hover:bg-slate-700/80 transition-colors"},ZN={class:"h-10 px-2 align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] w-12 text-center"},QN={key:0,colspan:"100%",class:"text-center"},eM={class:"w-full"},tM={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},nM=["onDragstart","onDragover","onDrop"],rM={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},oM={class:"flex items-center justify-center"},sM={key:0,class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},lM={key:0},iM=["src"],aM={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},cM=["innerHTML"],dM={key:2,class:"line-clamp-2 rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},uM={key:3,class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},fM={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},pM={class:"flex items-center justify-center gap-2"},hM=["onClick"],mM=["onClick"],gM={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},yM=i.defineComponent({__name:"vs-input-datatable",props:i.mergeModels({colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.ref({}),o=i.ref(""),s=i.computed(()=>{if(!o.value)return t.value??[];const P=o.value.toLowerCase();return t.value.filter(K=>e.colModel?.some(U=>{const re=K[U.key];return re?Array.isArray(re)?re.join(", ").toLowerCase().includes(P):String(re).toLowerCase().includes(P):!1}))}),l=i.ref(null),a=i.ref(null),c=i.ref(!1),d=i.ref(null),u=i.ref({top:0,left:0}),f=P=>{l.value=P},p=P=>{a.value=P},h=P=>{if(l.value===null||l.value===P){l.value=null,a.value=null;return}const K=[...t.value],[U]=K.splice(l.value,1);K.splice(P,0,U),t.value=K,l.value=null,a.value=null},m=P=>{const K=P.currentTarget.getBoundingClientRect();u.value={top:K.bottom+window.scrollY,left:K.left+window.scrollX},c.value=!c.value},g=()=>{d.value&&d.value.click()},y=P=>{const K=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],U=P.toLowerCase();return K.some(re=>U.endsWith(re))},b=P=>{const K=P.target.files?.[0];if(!K)return;const U=new FileReader;U.onload=re=>{try{const se=re.target?.result;if(typeof se=="string"){const ve=JSON.parse(se);Array.isArray(ve)&&t.value.push(...ve)}}catch(se){console.error("Error parsing file:",se)}},U.readAsText(K)},k=()=>{const P=JSON.stringify(t.value,null,2),K=new Blob([P],{type:"application/json"}),U=URL.createObjectURL(K),re=document.createElement("a");re.href=U,re.download="data.json",re.click(),URL.revokeObjectURL(U)};i.onMounted(async()=>{const P=e.colModel?.filter(K=>K.data);P?.length&&Promise.all(P.map(async K=>{const U=await(await fetch(`/api/suggest/${K.data}`)).json();r.value[K.key]=U.data}))});const w=i.ref(""),x=i.ref(!1);let E="edit",M=0;const C=i.ref({}),A=i.ref({});async function z(){w.value="Додати",x.value=!0,E="add",C.value={}}function G(P,K){const U=K.key||K.name;return r.value[U]&&P[U]?r.value[U].find(re=>re.id.toString()===P[U].toString())?.text??P[U]:P[U]||"-"}async function V(P,K){w.value="Редагувати",x.value=!0,E="edit",M=K,C.value={...P}}function O(){const P=A.value.validate();if(P){Pe({type:"warning",title:"Помилка валідації",message:Object.entries(P).map(([K,U])=>`${K}: ${U}`).join(`
119
119
  `)});return}E==="add"?Array.isArray(t.value)?t.value=[...t.value,C.value]:t.value=[C.value]:t.value=t.value.map((K,U)=>U===M?C.value:K),x.value=!1}function Y(P){t.value=t.value.filter((K,U)=>U!==P)}function Q(){x.value=!1}return(P,K)=>(i.openBlock(),i.createElementBlock("div",FN,[i.createElementVNode("div",PN,[i.createElementVNode("div",$N,[i.createVNode(hN,{width:"14",height:"14",class:"absolute left-3 top-1/2 transform -translate-y-1/2 text-stone-500"}),i.withDirectives(i.createElementVNode("input",{type:"text","onUpdate:modelValue":K[0]||(K[0]=U=>o.value=U),placeholder:"Пошук",class:"py-2 px-3 pl-10 w-full bg-gray-100 h-[36px] rounded-[8px] text-[15px] leading-[18px] focus:border-1 text-stone-800 placeholder:text-[#6B7280] focus:outline-blue-500 focus:outline-2"},null,512),[[i.vModelText,o.value]])]),i.createElementVNode("div",zN,[i.createElementVNode("input",{ref_key:"fileInput",ref:d,onChange:b,class:"hidden",accept:".json",type:"file"},null,544),i.createElementVNode("div",HN,[i.createElementVNode("div",jN,[i.createElementVNode("div",UN,[i.createElementVNode("button",{onClick:m,class:"bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[i.createVNode(bN,{height:"16",width:"16"})])])])])]),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[c.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"text-slate-700 vsTailwind vs-popover__content bottom",style:i.normalizeStyle([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:u.value.top+"px",left:u.value.left+"px"}])},[i.createElementVNode("div",WN,[i.createElementVNode("div",KN,[i.createElementVNode("button",{onClick:g,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[i.createVNode(EN,{class:"text-black",width:"14",height:"14"}),K[4]||(K[4]=i.createTextVNode(" Імпортувати ",-1))]),i.createElementVNode("button",{onClick:k,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[i.createElementVNode("span",qN,[i.createVNode(SN,{class:"text-black",width:"14",height:"14"}),K[5]||(K[5]=i.createTextVNode(" Експортувати ",-1))])])])])],4)):i.createCommentVNode("",!0)])),i.createElementVNode("button",{onClick:z,class:"text-slate-700 bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[i.createVNode(To),K[6]||(K[6]=i.createTextVNode(" Додати ",-1))])]),i.createElementVNode("div",GN,[i.createElementVNode("table",JN,[i.createElementVNode("thead",YN,[i.createElementVNode("tr",XN,[i.createElementVNode("th",ZN,[i.createVNode(nh,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})]),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(P.colModel,U=>(i.openBlock(),i.createElementBlock("th",{key:U.key,class:"h-10 px-2 text-left align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 min-w-[150px]"},i.toDisplayString(U.ua||U.label),1))),128)),K[7]||(K[7]=i.createElementVNode("th",{class:"h-10 px-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 text-center"}," Дії ",-1))])]),i.createElementVNode("tbody",{class:i.normalizeClass({"[&_tr:last-child]:border-0":!a.value})},[s.value.length===0?(i.openBlock(),i.createElementBlock("td",QN,[i.createElementVNode("div",eM,[i.createElementVNode("div",tM,[i.createVNode(LN,{class:"w-48 mx-auto"}),K[8]||(K[8]=i.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[i.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),i.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,(U,re)=>(i.openBlock(),i.createElementBlock("tr",{key:U.id,class:i.normalizeClass(["border-b data-[state=selected]:bg-muted transition-all duration-200 hover:bg-slate-50/60 dark:hover:bg-slate-700/60 cursor-move",{"opacity-50":l.value===re,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":a.value===re}]),draggable:"true",onDragstart:se=>f(re),onDragover:i.withModifiers(se=>p(re),["prevent"]),onDrop:se=>h(re)},[i.createElementVNode("td",rM,[i.createElementVNode("div",oM,[i.createVNode(nh,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(P.colModel,se=>(i.openBlock(),i.createElementBlock("td",{key:se.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[se.type==="file"?(i.openBlock(),i.createElementBlock("div",sM,[y(G(U,se))?(i.openBlock(),i.createElementBlock("div",lM,[i.createElementVNode("img",{src:G(U,se),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,iM)])):(i.openBlock(),i.createElementBlock("div",aM,[i.createVNode(Xp,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):se.type==="tiptap-editor"?(i.openBlock(),i.createElementBlock("div",{key:1,class:"rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors line-clamp-3",innerHTML:G(U,se)},null,8,cM)):se.type==="reference"?(i.openBlock(),i.createElementBlock("div",dM,i.toDisplayString(G(U,se)),1)):(i.openBlock(),i.createElementBlock("div",uM,i.toDisplayString(G(U,se)),1))]))),128)),i.createElementVNode("td",fM,[i.createElementVNode("div",pM,[i.createElementVNode("button",{onClick:se=>V(U,re),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-blue-50 dark:hover:bg-slate-600 hover:border-blue-300 dark:hover:border-slate-500 hover:text-blue-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[i.createVNode(RN,{width:"24",height:"24",class:"w-3 h-3"})],8,hM),i.createElementVNode("button",{onClick:se=>Y(re),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-red-50 dark:hover:bg-slate-600 hover:border-red-300 dark:hover:border-slate-500 hover:text-red-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[i.createVNode(kl,{width:"24",height:"24",class:"w-3 h-3"})],8,mM)])])],42,nM))),128))],2)])]),i.createVNode(i.unref(Ia),{teleport:"#modal",visible:x.value,title:w.value,size:"lg",onClose:Q},{default:i.withCtx(()=>[i.createVNode(Rr,{schema:e.colModel,values:C.value,"onUpdate:values":K[1]||(K[1]=U=>C.value=U),form:A.value,"onUpdate:form":K[2]||(K[2]=U=>A.value=U)},null,8,["schema","values","form"]),i.createElementVNode("div",gM,[i.createElementVNode("button",{type:"button",onClick:K[3]||(K[3]=U=>x.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),i.createElementVNode("button",{onClick:O,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])]),_:1},8,["visible","title"])]))}}),bM={draw:{toolbar:{actions:{title:"Скасувати малювання",text:"Скасувати"},finish:{title:"Завершити малювання",text:"Завершити"},undo:{title:"Видалити останню точку",text:"Видалити останню"},buttons:{polyline:"Намалювати лінію",polygon:"Намалювати полігон",rectangle:"Намалювати прямокутник",circle:"Намалювати коло",marker:"Додати точку",circlemarker:"Додати маркер-коло"}},handlers:{circle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати коло",end:"Відпустіть кнопку миші, щоб завершити"},radius:"Радіус"},circlemarker:{tooltip:{start:"Клацніть на карту, щоб додати маркер-коло"}},marker:{tooltip:{start:"Клацніть на карту, щоб додати точку"}},polygon:{tooltip:{start:"Клацніть, щоб почати малювати полігон",cont:"Клацайте, щоб продовжити малювати полігон",end:"Клацніть першу точку, щоб завершити полігон"}},polyline:{error:"<strong>Помилка:</strong> лінія не може перетинатися сама з собою",tooltip:{start:"Клацніть, щоб почати малювати лінію",cont:"Клацайте, щоб продовжити малювати лінію",end:"Клацніть останню точку, щоб завершити лінію"}},rectangle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати прямокутник",end:"Відпустіть кнопку миші, щоб завершити"}},simpleshape:{tooltip:{end:"Відпустіть кнопку миші, щоб завершити"}}}},edit:{toolbar:{actions:{save:{title:"Зберегти зміни",text:"Зберегти"},cancel:{title:"Скасувати редагування",text:"Скасувати"},clearAll:{title:"Очистити всі шари",text:"Очистити все"}},buttons:{edit:"Редагувати шари",editDisabled:"Немає шарів для редагування",remove:"Видалити шари",removeDisabled:"Немає шарів для видалення"}},handlers:{edit:{tooltip:{text:"Перетягніть маркери, щоб редагувати шари",subtext:"Натисніть 'Скасувати', щоб повернутися"}},remove:{tooltip:{text:"Клацніть на шари, щоб видалити їх"}}}}};function Ao(n){return n?n.type==="Polygon"?{type:"MultiPolygon",coordinates:[n.coordinates]}:n.type==="Feature"?{...n,geometry:Ao(n.geometry)}:n.type==="FeatureCollection"?{...n,features:(n.features||[]).map(e=>Ao(e)).filter(Boolean)}:n:null}function kM(n){return n?n.type==="FeatureCollection"||n.type==="Feature"?Ao(n):n.geom?{type:"Feature",geometry:Ao({type:n.geom.type,coordinates:n.geom.coordinates}),properties:{}}:n.type&&n.coordinates?{type:"Feature",geometry:Ao(n),properties:{}}:null:null}const xM={},wM={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",stroke:"currentColor",fill:"none","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-map-pin"};function EM(n,e){return i.openBlock(),i.createElementBlock("svg",wM,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),i.createElementVNode("path",{d:"M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0z"},null,-1)]))}const CM=ge(xM,[["render",EM]]),vM={},_M={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none","stroke-width":"2",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-line"};function SM(n,e){return i.openBlock(),i.createElementBlock("svg",_M,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),i.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),i.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const NM=ge(vM,[["render",SM]]),MM={},TM={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-polygon"};function AM(n,e){return i.openBlock(),i.createElementBlock("svg",TM,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M6.5 9.5l3.5 -3"></path><path d="M14 5.5l3 1.5"></path><path d="M18.5 10l-2.5 7"></path><path d="M13.5 17.5l-7 -5"></path>',9)]))}const BM=ge(MM,[["render",AM]]),VM={},LM={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-topology-ring-3"};function OM(n,e){return i.openBlock(),i.createElementBlock("svg",LM,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M8 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M6 8v8"></path><path d="M18 16v-8"></path><path d="M8 6h8"></path><path d="M16 18h-8"></path>',9)]))}const IM=ge(VM,[["render",OM]]),DM={},RM={version:"1.1",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg","xmlns:sketch":"http://www.bohemiancoding.com/sketch/ns","xmlns:xlink":"http://www.w3.org/1999/xlink",class:"fullscreen-icon"};function FM(n,e){return i.openBlock(),i.createElementBlock("svg",RM,e[0]||(e[0]=[i.createElementVNode("title",null,null,-1),i.createElementVNode("desc",null,null,-1),i.createElementVNode("defs",null,null,-1),i.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[i.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[i.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[i.createElementVNode("path",{d:"M2,9 L0,9 L0,14 L5,14 L5,12 L2,12 L2,9 L2,9 Z M0,5 L2,5 L2,2 L5,2 L5,0 L0,0 L0,5 L0,5 Z M12,12 L9,12 L9,14 L14,14 L14,9 L12,9 L12,12 L12,12 Z M9,0 L9,2 L12,2 L12,5 L14,5 L14,0 L9,0 L9,0 Z",id:"Shape"})])])],-1)]))}const PM=ge(DM,[["render",FM]]),$M={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},zM={key:0,class:"vs-select__options absolute z-50 mt-1 w-full bg-white border border-gray-300 shadow-lg rounded-lg text-sm"},HM=["onClick"],jM={class:"relative flex-1 min-w-[140px]"},UM=["placeholder"],WM="https://data.softpro.ua/api-user/gis-url-proxy",KM="https://geo.rv.ua/api-user/dzk.api",qM=i.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(n,{emit:e}){const t=n,r=e,o=["here","xy","parcel"],s=i.computed(()=>{const x=t.config?.tools?.filter(E=>o.includes(E));return x&&x.length?x:o}),l=i.computed(()=>t.config?.placeholder?.trim()||"Пошук…"),a=i.ref(s.value[0]??o[0]);i.watch(s,x=>{x.includes(a.value)||(a.value=x[0])});const c=i.ref(""),d=i.ref(!1),u=i.ref(null);i.watch(a,()=>{c.value="",d.value=!1});function f(x){a.value=x}function p(x){if(!d.value)return;const E=u.value;E&&!E.contains(x.target)&&(d.value=!1)}i.onMounted(()=>{window.addEventListener("click",p,!0)}),i.onBeforeUnmount(()=>{window.removeEventListener("click",p,!0)});function h(x){return x==="xy"?"Координати":x==="parcel"?"Кадастр":"Адреси"}function m(x){const E=x.replace(/[,]+/g," ").trim();if(!E)return null;const M=E.split(/\s+/).filter(Boolean);if(M.length<2)return null;const C=M.slice(0,2).map(Number);if(!C.every(Q=>Number.isFinite(Q)))return null;let[A,z]=C,G=A,V=z;const O=Q=>Math.abs(Q)<=90,Y=Q=>Math.abs(Q)<=180;if(!O(G)||!Y(V))if(O(V)&&Y(G))G=z,V=A;else return null;return{lat:G,lng:V}}function g(x){return(x?.items||[]).map((E,M)=>({id:String(E?.id??M),title:E?.title||E?.address?.label||"Знайдений обʼєкт",lat:Number(E?.position?.lat),lng:Number(E?.position?.lng)})).filter(E=>Number.isFinite(E.lat)&&Number.isFinite(E.lng))}function y(x){const E=x?.result||x?.data||x;if(!E)return[];const M=E.geom_centroid;if(!M||!Array.isArray(M.coordinates))return[];const[C,A]=M.coordinates;return!Number.isFinite(A)||!Number.isFinite(C)?[]:[{id:"parcel",title:E.cadnum||E.cad_num||"Земельна ділянка",lat:A,lng:C}]}function b(x){const E=x.replace(/\s+/g,"").split(":");if(E.length!==4)return!1;const M=[10,2,3,4];return E.every((C,A)=>C.length===M[A]&&/^\d+$/.test(C))}function k(x){r("goToCoordinates",[x.lat,x.lng])}async function w(){const x=c.value.trim();if(x){if(a.value==="xy"){const E=m(x);if(!E){Pe({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}k(E),c.value="";return}try{const E=new URL(a.value==="here"?WM:KM);if(a.value==="here")E.searchParams.set("searchtext",x);else{if(!b(x)){Pe({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}E.searchParams.set("cad_num",x)}const M=await fetch(E.toString());if(!M.ok)throw new Error(`HTTP ${M.status}`);const C=await M.json(),A=a.value==="here"?g(C):y(C);if(!A.length)Pe({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const z=A[0];k(z),c.value=""}}catch(E){const M=E?.message||"Помилка пошуку";Pe({type:"error",title:"Пошук",message:M})}}}return(x,E)=>(i.openBlock(),i.createElementBlock("div",$M,[i.createElementVNode("form",{class:"flex gap-2",onSubmit:i.withModifiers(w,["prevent"])},[s.value.length>1?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:"relative search-type w-[140px]"},[i.createElementVNode("button",{type:"button",class:"vstSelect-input transition-all text-left bg-white border border-gray-200 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-100 block w-full py-1.5 px-3 text-sm cursor-pointer flex items-center justify-between gap-2",onClick:E[0]||(E[0]=M=>d.value=!d.value)},[i.createElementVNode("span",null,i.toDisplayString(h(a.value)),1),(i.openBlock(),i.createElementBlock("svg",{class:i.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":d.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},E[2]||(E[2]=[i.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2))]),d.value?(i.openBlock(),i.createElementBlock("div",zM,[i.createElementVNode("ul",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,M=>(i.openBlock(),i.createElementBlock("li",{key:M,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:C=>f(M)},i.toDisplayString(h(M)),9,HM))),128))])])):i.createCommentVNode("",!0)],512)):i.createCommentVNode("",!0),i.createElementVNode("div",jM,[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":E[1]||(E[1]=M=>c.value=M),placeholder:l.value,type:"text",class:"vs-input transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,8,UM),[[i.vModelText,c.value,void 0,{trim:!0}]]),E[3]||(E[3]=i.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5 5a7.5 7.5 0 0 0 11.65 11.65Z"})])],-1))])],32)]))}}),GM=ge(qM,[["__scopeId","data-v-3048520a"]]),JM={class:"bg-white/30 p-1 rounded-md shadow"},YM={class:"flex gap-2"},XM=["onClick","title"],ZM=["src"],QM=i.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(n,{emit:e}){const t=i.ref(Object.keys(n.basemaps)[0]),r=e;function o(s){r("onLayerChange",s),t.value=s}return(s,l)=>(i.openBlock(),i.createElementBlock("div",JM,[i.createElementVNode("div",YM,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.basemaps,(a,c)=>(i.openBlock(),i.createElementBlock("div",{key:c,class:i.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":t.value===c}]),onClick:d=>o(c),title:a.name||c,role:"button",tabindex:"0"},[i.createElementVNode("img",{src:a.preview,alt:"",class:"w-10 h-10 object-cover"},null,8,ZM)],10,XM))),128))])]))}}),eT={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},tT={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},nT={class:"text-sm font-medium"},rT={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},oT={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},sT={class:"flex items-center gap-1"},lT=["disabled"],iT=["disabled"],aT=["disabled"],cT={class:"absolute top-4 right-4 z-[1000]"},dT={class:"flex flex-col gap-[2px]"},uT=["disabled"],fT=["disabled"],pT=["disabled"],hT=["disabled"],mT={class:"flex flex-col gap-2"},gT={key:0,class:"bg-white/95 border border-gray-200 rounded-md shadow-sm px-3 py-2 text-xs text-gray-700 min-w-[200px]"},yT={class:"flex flex-col gap-1"},bT=["checked","disabled","onChange"],kT={class:"text-gray-700 text-xs font-medium"},xT={class:"absolute bottom-0 left-0 right-0 z-[1000] bg-white/95 border-t border-gray-200 text-xs text-gray-700 flex items-center gap-4 pt-1"},wT={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},ET={class:"shrink-0"},CT={class:"font-bold"},vT={class:"flex items-center"},_T={class:"text-xs mr-2"},ST={key:0,class:"text-xs"},NT={key:1,class:"text-xs"},MT=["disabled"],TT=["disabled"],AT=i.defineComponent({__name:"vs-input-map",props:{tools:{},handleZoom:{type:Boolean,default:!0},geomType:{default:()=>[]},prefix:{default:""},layers:{default:()=>[]},api:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=i.getCurrentInstance(),r=n,o=e,s=i.computed(()=>{const v={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!r.tools||!r.tools.length)return v;const N=new Set(r.tools.map(H=>H.toLowerCase()));return{search:N.has("search"),import:N.has("import"),export:N.has("export"),point:N.has("point"),line:N.has("line"),polygon:N.has("polygon"),rectangle:N.has("rectangle")}}),l=i.computed(()=>!!r.disabled),a=i.ref(!1),c=i.ref(null),d=i.ref(null),u=i.ref(!1),f=i.ref(""),p=i.reactive({}),h=i.ref([]),m=i.computed(()=>h.value.map(v=>p[v]).filter(v=>!!v)),g=i.computed(()=>Array.isArray(r.layers)&&r.layers.some(v=>`${v?.service??""}`.toLowerCase()==="vtile"));let y,b,k;function w(){return navigator.platform.toUpperCase().indexOf("MAC")>=0,/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"Використовуйте два пальці для зуму карти.":"Використовуйте Ctrl + прокрутка для зуму карти."}const x=i.ref(null),E=i.ref(null);let M=null;const C=i.ref(null),A=v=>{v.ctrlKey&&v.preventDefault()};function z(v,N){return v?.id?String(v.id):v?.url?`${v.url}-${N}`:`layer-${N}`}function G(v){if(!v)return"";if(/^https?:\/\//i.test(v))return v.replace(/\/+$/,"");const N=v.replace(/^\/+/,"").replace(/\/+$/,"");return N?`/${N}`:""}function V(v){const N=v?.url??"";if(!N||/^https?:\/\//i.test(N))return N;const H=typeof window<"u"&&window.location?.origin?window.location.origin:"";if(N.startsWith("/"))return H?`${H}${N}`:N;const W=G(v?.prefix),Z=G(r.prefix),fe=W||Z,T=N.replace(/^\/+/,""),R=fe?`${fe.replace(/\/$/,"")}/${T}`:`/${T}`;return H?`${H}${R}`:R}function O(v){const N=v?.style??{};return H=>{const W=N.colorAttr,Z=N.colorSet??{},fe=typeof W=="string"?Z?.[H?.[W]]??N.color??"#3388ff":N.color??"#3388ff",T=N.stroke??fe;return{weight:N.width??1,color:T,opacity:N.opacity??1,fill:N.type?N.type!=="polyline":!0,fillColor:fe,fillOpacity:N.opacity??.5}}}function Y(v){const N=v?.colorSet||v?.colors;if(v?.colorAttr&&N){const H=Object.entries(N).flat();return["match",["get",v.colorAttr],...H,v.color??"#94a3b8"]}return v?.color??"#3388ff"}function Q(v,N,H){if(!v)return[];const W=[],Z=Y(v);return v.icon&&W.push({id:`${N}-icon`,type:"symbol",source:N,"source-layer":H,minzoom:v.iconZoom||0,layout:{"icon-image":v.icon,"icon-size":1,"icon-allow-overlap":!0,"icon-ignore-placement":!0}}),v.pointZoom&&W.push({id:`${N}-point`,type:"circle",source:N,"source-layer":H,maxzoom:v.pointZoom,paint:{"circle-stroke-color":v.stroke||"#fff","circle-opacity":v.opacity??1,"circle-color":Z,"circle-stroke-width":v.width??1,"circle-radius":v.radius??5}}),v.type==="polygon"?W.push({id:`${N}-fill`,type:"fill",source:N,"source-layer":H,minzoom:v.pointZoom||0,paint:{"fill-color":Z,"fill-opacity":v.opacity??.5,"fill-outline-color":v.stroke||Z}}):v.type==="line"?W.push({id:`${N}-line`,type:"line",source:N,"source-layer":H,paint:{"line-color":Z,"line-opacity":v.opacity??1,"line-width":v.width??1.5}}):v.icon||W.push({id:`${N}-circle`,type:"circle",source:N,"source-layer":H,paint:{"circle-stroke-color":v.stroke||"#fff","circle-opacity":v.opacity??1,"circle-color":Z,"circle-stroke-width":v.width??1,"circle-radius":v.radius??5}}),W}function P(v,N){const H=v.id||`source-${Math.random().toString(36).slice(2,8)}`,W=v.sourceLayer||v.layer||v.service_layer||v.service_key||v.map_key||v.dataset?.layer||v.id||v.table_name||H,Z=Q(v.style||{},H,W||H);return Z.length?{version:8,glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",sources:{[H]:{type:"vector",tiles:[N],minzoom:v.minzoom??0,maxzoom:v.maxzoom??19}},layers:Z}:null}function K(v){const N=(v?.service??"").toLowerCase(),H=V(v),W=v.sourceLayer||v.layer||v.service_layer||v.service_key||v.map_key||v.dataset?.layer||v.id||v.table_name;if(console.info("[vs-input-map] create overlay layer",{id:v.id,service:N,url:H,sourceLayer:W,hasSourceLayer:!!W}),N==="vtile"){if(L?.vectorGrid?.protobuf&&!L?.maplibreGL)return console.info("[vs-input-map] using Leaflet.vectorGrid"),L.vectorGrid.protobuf(H,{interactive:!0,vectorTileLayerStyles:{default:O(v)}});if(L?.maplibreGL&&window?.maplibregl){console.info("[vs-input-map] using maplibre-gl-leaflet");const Z=P(v,H);return Z?L.maplibreGL({style:Z,interactive:!1,pane:"overlayPane"}):(console.warn("[vs-input-map] maplibre spec is empty",v.id),null)}return null}return N==="tile"||/^https?:\/\//i.test(H)||H.includes("{z}")?L.tileLayer(H,{opacity:v?.style?.opacity??1}):L.tileLayer(H,{opacity:v?.style?.opacity??1})}function U(){y&&h.value.forEach(v=>{const N=p[v];N&&(N.visible?(N.layer||(N.layer=K(N.config)),N.layer&&!y.hasLayer(N.layer)?(console.info("[vs-input-map] add overlay layer to map",N.id),N.layer.addTo(y)):N.layer||console.warn("[vs-input-map] overlay layer is null",N.id)):N.layer&&y.hasLayer(N.layer)&&(console.info("[vs-input-map] remove overlay layer from map",N.id),y.removeLayer(N.layer)))})}function re(v){if(l.value)return;const N=p[v];N&&(N.visible=!N.visible,y&&(console.info("[vs-input-map] toggle overlay",{id:v,nextVisible:N.visible,hasLayerInstance:!!N.layer}),N.visible?(N.layer||(N.layer=K(N.config)),N.layer&&!y.hasLayer(N.layer)&&(console.info("[vs-input-map] add overlay layer to map",N.id),N.layer.addTo(y))):N.layer&&y.hasLayer(N.layer)&&y.removeLayer(N.layer)))}function se(){if(!r.handleZoom)return null;let v;const N=W=>{const Z=W.ctrlKey||W.metaKey,fe=W.shiftKey;if(!Z&&!fe){u.value=!0,f.value=w(),clearTimeout(v),v=window.setTimeout(()=>{u.value=!1},1e3);return}u.value=!1,y.scrollWheelZoom.enable(),setTimeout(()=>{y.scrollWheelZoom.disable()},100)},H=W=>{if(W.touches.length===1){u.value=!0,f.value=w(),clearTimeout(v),v=window.setTimeout(()=>{u.value=!1},3e3);return}u.value=!1};return E.value&&(E.value.addEventListener("wheel",N,{passive:!1}),E.value.addEventListener("touchstart",H,{passive:!0})),y&&y.on("wheel",W=>{const Z=W.originalEvent.ctrlKey||W.originalEvent.metaKey,fe=W.originalEvent.shiftKey;!Z&&!fe&&(W.originalEvent.preventDefault(),W.originalEvent.stopPropagation())}),()=>{E.value&&(E.value.removeEventListener("wheel",N),E.value.removeEventListener("touchstart",H)),y&&y.off("wheel"),clearTimeout(v)}}const ve=i.ref(null),pt=i.ref(6),St=i.ref(0),Ft=i.ref(t?.appContext.config.globalProperties.$settings?.center||[50,30]),Ke=i.ref(null),ht=F();let En;const Cn=i.ref("topo100");function vn(v){return v?v.type==="Polygon"?{type:"MultiPolygon",coordinates:[v.coordinates]}:(v.type,v):null}function xr(){return new Promise((v,N)=>{window.L&&window.L.Draw&&v(0);const H=fe=>{if(Array.from(document.styleSheets).some(R=>R?.href?.includes(fe)))return;const T=document.createElement("link");T.rel="stylesheet",T.href=fe,document.head.appendChild(T)},W=fe=>new Promise((T,R)=>{const j=Array.from(document.scripts).find(_e=>_e.src===fe);if(j){j.addEventListener("load",()=>T()),j.addEventListener("error",_e=>R(_e));return}const ae=document.createElement("script");ae.src=fe,ae.async=!0,ae.onload=()=>T(),ae.onerror=_e=>R(_e),document.body.appendChild(ae)});H("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),H("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css"),g.value&&H("https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.css");let Z=W("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js").then(()=>W("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js"));g.value?Z=Z.then(()=>W("https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.js")).then(()=>(window.maplibregl&&!window.mapboxgl&&(window.mapboxgl=window.maplibregl),W("https://unpkg.com/@maplibre/maplibre-gl-leaflet@0.0.20/leaflet-maplibre-gl.js"))):Z=Z.then(()=>W("https://unpkg.com/leaflet.vectorgrid@1.3.0/dist/Leaflet.VectorGrid.bundled.js").catch(()=>Promise.resolve())),Z.then(()=>v(0)).catch(N)})}function mt(){const v=b.toGeoJSON(),N=[];let H=null;const W=fe=>{if(fe)switch(fe.type){case"Point":H=fe;break;case"Polygon":N.push(fe.coordinates);break;case"MultiPolygon":N.push(...fe.coordinates);break;case"GeometryCollection":(fe.geometries||[]).forEach(W);break}};(v?.features||[]).forEach(fe=>W(fe.geometry));const Z=H||(N.length?{type:"MultiPolygon",coordinates:N}:null);o("update:modelValue",Z?vn(Z):null),St.value=b.getLayers().length}function Pt(v=30){const N=b.getLayers();if(!N.length)return;const H=L.featureGroup(N).getBounds();H&&H.isValid()&&y.fitBounds(H,{padding:[v,v]})}function cn(){l.value||C.value?.click()}const qe=i.ref("");i.watch(s,v=>{qe.value&&!Object.entries(v).filter(([N,H])=>H).map(([N])=>N).includes(qe.value)&&(k?.disable&&k.disable(),qe.value="")}),i.watch(()=>r.layers,v=>{const N=Array.isArray(v)?v:[],H=[],W=new Set;N.forEach((Z,fe)=>{if(!Z)return;const T=z(Z,fe);H.push(T),W.add(T),console.info("[vs-input-map] overlay register",{id:T,service:Z?.service,url:Z?.url});const R=p[T];R?p[T]={...R,config:{...Z,id:T}}:p[T]={id:T,config:{...Z,id:T},visible:Z?.overlay!==!1,layer:null}}),Object.keys(p).forEach(Z=>{if(W.has(Z))return;const fe=p[Z];fe?.layer&&y?.hasLayer&&y.hasLayer(fe.layer)&&y.removeLayer(fe.layer),delete p[Z]}),h.value=H,U()},{immediate:!0,deep:!0}),i.watch(l,v=>{v&&k&&(k.disable(),qe.value=""),b&&b.eachLayer(N=>{v?N.dragging?.disable?.():N.dragging?.enable&&(N.dragging.enable(),N.dragging.enabled?.())})});function $t(v){return v instanceof L.Circle?"Circle":v instanceof L.Rectangle?"Rectangle":v instanceof L.Polygon&&!(v instanceof L.Rectangle)?"Polygon":v instanceof L.Polyline&&!(v instanceof L.Polygon)?"Polyline":v instanceof L.Marker?"Point":"Feature"}function qt(v){if(v instanceof L.Circle){const N=v.getRadius();return Math.PI*(N*N)/1e6}if(v instanceof L.Polygon||v instanceof L.Rectangle)try{const N=v.getLatLngs(),H=Array.isArray(N[0])?N[0]:N,W=L.GeometryUtil?.geodesicArea?L.GeometryUtil.geodesicArea(H):0;return W?W/1e6:0}catch{return null}return null}function dn(v){return v instanceof L.Circle?v.getLatLng():v.getBounds?v.getBounds().getCenter():v.getLatLng?v.getLatLng():y.getCenter()}async function Xn(v,N){if(x.value="",!r.api?.length)return;const[H,W]=r.api;try{const Z=new URL(H);Z.searchParams.set("lat",String(v)),Z.searchParams.set("lon",String(N));const fe=await fetch(Z.toString());if(!fe.ok)throw new Error("Request failed");const T=await fe.json();W&&T[W]!==void 0?x.value=String(T[W]):x.value=JSON.stringify(T)}catch(Z){console.error("[vs-input-map] reverse geocode failed:",Z),x.value=null}}function _(){const v=b.getLayers();if(!v.length){Ke.value=null,St.value=0;return}const N=v[v.length-1],H=$t(N),W=dn(N),Z=qt(N);Ke.value={type:H,center:W,areaKm2:Z,layer:N},St.value=v.length,Xn(W.lat,W.lng)}function S(){if(l.value)return;const v=Ke.value?.layer;v&&(v instanceof L.Circle&&v.getBounds?y.fitBounds(v.getBounds(),{padding:[30,30]}):v.getBounds?y.fitBounds(v.getBounds(),{padding:[30,30]}):v.getLatLng&&y.setView(v.getLatLng(),Math.max(pt.value,14)))}function D(){if(l.value)return;const v=Ke.value?.layer;v&&(b.removeLayer(v),mt(),_())}i.onMounted(async()=>{document.addEventListener("wheel",A,{passive:!1}),await xr(),L.drawLocal=bM;const v=r.handleZoom;y=L.map(E.value,{zoomControl:!1,scrollWheelZoom:!v}).setView(Ft.value,10),setTimeout(()=>{M=se()},100),L.control.zoom({position:"bottomright"}).addTo(y),Cn.value=Object.keys(ht)[0],En=L.tileLayer(ht[Cn.value].url,{maxZoom:19,minZoom:6}).addTo(y),b=new L.FeatureGroup().addTo(y),y.on(L.Draw.Event.CREATED,W=>{if(l.value)return;const{layer:Z}=W;b.clearLayers(),b.addLayer(Z),mt(),Pt(),qe.value=""}),y.on(L.Draw.Event.EDITED,()=>{l.value||(mt(),_(),Pt())}),y.on(L.Draw.Event.DELETED,()=>{l.value||(mt(),_(),Pt())});let N=!1;y.on("mousemove",W=>{N||(y.invalidateSize(),N=!0),ve.value=W.latlng}),y.on("zoomend",()=>{pt.value=y.getZoom()});const H=kM(r.modelValue);if(H){const W=[];L.geoJSON(H).eachLayer(Z=>W.push(Z)),W.length&&b.addLayer(W[0]),mt(),_(),Pt()}U()}),i.onUnmounted(()=>{document.removeEventListener("wheel",A),M&&M(),Object.values(p).forEach(v=>{v?.layer&&(y?.hasLayer?.(v.layer)&&y.removeLayer(v.layer),typeof v.layer.remove=="function"&&v.layer.remove())})});function X(v){if(!l.value&&y){switch(k&&k.disable(),v){case"marker":k=new L.Draw.Marker(y);break;case"polyline":k=new L.Draw.Polyline(y);break;case"polygon":k=new L.Draw.Polygon(y);break;case"rectangle":k=new L.Draw.Rectangle(y);break;default:k=new L.Draw.Rectangle(y);break}k&&(k.enable(),qe.value=v)}}function we(){if(l.value)return;const v=b.toGeoJSON(),N=new Blob([JSON.stringify(v,null,2)],{type:"application/json"}),H=URL.createObjectURL(N),W=document.createElement("a");W.href=H,W.download="data.geojson",W.click(),URL.revokeObjectURL(H)}function Be(v){if(l.value)return;const N=v.target,H=N.files?.[0];if(!H)return;const W=new FileReader;W.onload=()=>{if(typeof W.result=="string")try{const Z=JSON.parse(W.result);b.clearLayers(),Z&&L.geoJSON({type:"Feature",geometry:Z}).eachLayer(fe=>{b.addLayer(fe)}),mt(),_(),Pt()}finally{N.value=""}},W.readAsText(H)}function pe(v){y&&(En&&y.removeLayer(En),En=L.tileLayer(ht[v].url,{maxZoom:19,minZoom:6}).addTo(y),Cn.value=v)}function B(v){const N=L.latLng(v[0],v[1]);y.setView(N,13)}i.watch(()=>r.modelValue,v=>{const N=vn(v);if(v&&N!==v){o("update:modelValue",N);return}b.clearLayers(),N&&L.geoJSON({type:"Feature",geometry:N}).eachLayer(H=>{if(b.addLayer(H),l.value){H.dragging?.disable?.();return}H.dragging?.enable?.(),H.dragging?.enabled?.(),H.on("dragend",W=>{const Z=W.target.getLatLng();o("update:modelValue",{type:"Point",coordinates:[Z.lng,Z.lat]})})}),St.value=b.getLayers().length,_(),Pt()});function F(){return t?.appContext.config.globalProperties.$settings?.basemaps?t?.appContext.config.globalProperties.$settings?.basemaps.map((v,N)=>Object.assign(v,{key:`b${N}`,preview:v.preview||v.url.replace("{z}/{x}/{y}.png","13/4790/2762.png")})).reduce((v,N)=>({...v,[N.key]:N}),{}):{topo100:{url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/voyager/ua/13/4790/2762.png"},orto10:{url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4790/2762.png"},osmb:{url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png",preview:"https://tile.openstreetmap.org.ua/styles/osm-bright/13/4790/2762.png"}}}const he=i.ref(!1);return i.watch(he,()=>{setTimeout(()=>{y.invalidateSize()},50)}),i.watch(a,async v=>{if(!v||!d.value){c.value=null;return}await i.nextTick();const N=d.value.getBoundingClientRect();c.value={top:N.bottom+6,left:N.left}}),i.onUnmounted(()=>{a.value=!1,c.value=null}),(v,N)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:he.value}])},[i.createElementVNode("div",{ref_key:"mapContainer",ref:E,class:"w-full h-full"},null,512),i.createVNode(i.Transition,{name:"zoom-instructions","enter-active-class":"transition-all duration-200 ease-out","leave-active-class":"transition-all duration-500 ease-in","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:i.withCtx(()=>[u.value&&r.handleZoom?(i.openBlock(),i.createElementBlock("div",eT,[i.createElementVNode("div",tT,[i.createElementVNode("p",nT,i.toDisplayString(f.value),1)])])):i.createCommentVNode("",!0)]),_:1}),s.value.search||s.value.import||s.value.export?(i.openBlock(),i.createElementBlock("div",rT,[s.value.search?(i.openBlock(),i.createBlock(GM,{key:0,onGoToCoordinates:B})):i.createCommentVNode("",!0),s.value.import||s.value.export?(i.openBlock(),i.createElementBlock("div",oT,[i.createElementVNode("div",sT,[s.value.import?(i.openBlock(),i.createElementBlock("button",{key:0,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:cn,disabled:l.value}," Import ",8,lT)):i.createCommentVNode("",!0),s.value.export?(i.openBlock(),i.createElementBlock("button",{key:1,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:we,disabled:l.value||St.value===0}," Export ",8,iT)):i.createCommentVNode("",!0)]),i.createElementVNode("input",{ref_key:"importRef",ref:C,type:"file",onChange:Be,accept:".json,.geojson",class:"hidden",disabled:l.value},null,40,aT)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),i.createElementVNode("div",cT,[i.createElementVNode("div",dT,[s.value.point?(i.openBlock(),i.createElementBlock("button",{key:0,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="marker"}]),title:"Point",onClick:N[0]||(N[0]=H=>X("marker")),disabled:l.value},[i.createVNode(CM)],10,uT)):i.createCommentVNode("",!0),s.value.line?(i.openBlock(),i.createElementBlock("button",{key:1,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="polyline"}]),title:"Line",onClick:N[1]||(N[1]=H=>X("polyline")),disabled:l.value},[i.createVNode(NM)],10,fT)):i.createCommentVNode("",!0),s.value.polygon?(i.openBlock(),i.createElementBlock("button",{key:2,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="polygon"}]),title:"Polygon",onClick:N[2]||(N[2]=H=>X("polygon")),disabled:l.value},[i.createVNode(BM)],10,pT)):i.createCommentVNode("",!0),s.value.rectangle?(i.openBlock(),i.createElementBlock("button",{key:3,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="rectangle"}]),title:"Rectangle",onClick:N[3]||(N[3]=H=>X("rectangle")),disabled:l.value},[i.createVNode(IM)],10,hT)):i.createCommentVNode("",!0),i.createElementVNode("button",{class:"vs-btn mt-5",onClick:N[4]||(N[4]=H=>he.value=!he.value),title:"Full Screen"},[i.createVNode(PM,{style:{width:"12px",height:"12px"}})])])]),i.createElementVNode("div",{class:i.normalizeClass(["absolute left-4 z-[1000]",Ke.value?"bottom-8":"bottom-4"])},[i.createElementVNode("div",mT,[i.createVNode(QM,{basemaps:i.unref(ht),onOnLayerChange:pe},null,8,["basemaps"]),m.value.length?(i.openBlock(),i.createElementBlock("div",gT,[N[9]||(N[9]=i.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Layers",-1)),i.createElementVNode("div",yT,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(m.value,H=>(i.openBlock(),i.createElementBlock("label",{key:H.id,class:"flex items-center gap-2 cursor-pointer select-none"},[i.createElementVNode("input",{type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:H.visible,disabled:l.value,onChange:W=>re(H.id)},null,40,bT),i.createElementVNode("span",kT,i.toDisplayString(H.config.title||H.config.name||H.id),1)]))),128))])])):i.createCommentVNode("",!0)])],2),i.createElementVNode("div",xT,[Ke.value?(i.openBlock(),i.createElementBlock("div",wT,[i.createElementVNode("div",{class:"mr-auto flex items-center gap-2 min-w-0 relative",onMouseenter:N[5]||(N[5]=H=>a.value=!0),onMouseleave:N[6]||(N[6]=H=>a.value=!1)},[i.createElementVNode("div",ET,[N[10]||(N[10]=i.createTextVNode(" Type: ",-1)),i.createElementVNode("span",CT,i.toDisplayString(Ke.value.type),1)]),x.value?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"addressEl",ref:d,class:"text-gray-500 text-xs truncate cursor-help",style:{"max-width":"260px"}}," Address: "+i.toDisplayString(x.value),513)):i.createCommentVNode("",!0),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[a.value&&x.value&&c.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"fixed z-[99999] pointer-events-none bg-gray-800 text-white text-xs px-2 py-1 rounded shadow whitespace-nowrap",style:i.normalizeStyle({top:c.value.top+"px",left:c.value.left+"px"})},i.toDisplayString(x.value),5)):i.createCommentVNode("",!0)]))],32),i.createElementVNode("div",vT,[i.createElementVNode("div",_T,[N[11]||(N[11]=i.createTextVNode(" Center: ",-1)),i.createElementVNode("b",null,i.toDisplayString(Ke.value.center.lat.toFixed(5))+", "+i.toDisplayString(Ke.value.center.lng.toFixed(5)),1)]),Ke.value.areaKm2!==null?(i.openBlock(),i.createElementBlock("div",ST,[N[12]||(N[12]=i.createTextVNode(" Area: ",-1)),i.createElementVNode("b",null,i.toDisplayString(Ke.value.areaKm2.toFixed(1))+" km²",1)])):(i.openBlock(),i.createElementBlock("div",NT,N[13]||(N[13]=[i.createTextVNode("Area: ",-1),i.createElementVNode("b",null,"—",-1)]))),i.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Zoom to feature",onClick:N[7]||(N[7]=H=>S()),disabled:l.value},N[14]||(N[14]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="w-3 h-3" data-v-150e767b><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" data-v-150e767b></path><path d="M7 10l6 0" data-v-150e767b></path><path d="M10 7l0 6" data-v-150e767b></path><path d="M21 21l-6 -6" data-v-150e767b></path></svg>',1)]),8,MT),i.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Delete feature",onClick:N[8]||(N[8]=H=>D()),disabled:l.value},[i.createVNode(kl,{class:"w-3 h-3"})],8,TT)])])):i.createCommentVNode("",!0)])],2))}}),BT=ge(AT,[["__scopeId","data-v-150e767b"]]),VT=["data-focus"],LT={class:"flex items-center"},OT={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},IT=["onClick","aria-label"],DT={key:0,class:"absolute text-gray-500 truncate pl-2"},RT={class:"flex-1 min-w-[2px]"},FT=["placeholder"],PT={class:"flex items-center shrink-0"},$T=["disabled"],zT=i.defineComponent({__name:"vs-input-tag",props:i.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"}},{modelValue:{default:[]},modelModifiers:{}}),emits:i.mergeModels(["update:modelValue"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=e;vt(t.style);const o=i.ref(null),s=i.ref(null),l=i.ref(null),a=i.ref(!1),c=i.ref(""),d=i.useModel(n,"modelValue"),u=i.computed(()=>t.placeholder||"Add tag…"),f=i.computed(()=>d.value?.length===0&&c.value===""),p=i.computed(()=>!t.disabled&&d.value?.length>0),h=i.computed(()=>t.disabled),m=async()=>{h.value||await i.nextTick(()=>l.value?.focus())},g=M=>{const C=M.trim();C!==""&&(!d.value||!Array.isArray(d.value)?d.value=[C]:t.unique?d.value.includes(C)||(d.value=[...d.value,C]):d.value=[...d.value,C],c.value="")},y=()=>{const M=c.value;M.trim()!==""&&g(M),c.value=""},b=M=>{const C=d.value.slice();C.splice(M,1),r("update:modelValue",C)},k=()=>{r("update:modelValue",[])},w=()=>{h.value||(a.value=!0)},x=()=>{a.value=!1,!h.value&&y()},E=M=>{const{key:C}=M;C==="Enter"?(M.preventDefault(),y()):C==="Backspace"&&c.value===""&&d.value.length>0&&b(d.value.length-1)};return(M,C)=>(i.openBlock(),i.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:C[1]||(C[1]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",{class:i.normalizeClass(["relative w-full font-sans",t.customClass]),role:"group","aria-label":"Tag input"},[i.createElementVNode("div",{class:i.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",a.value?"border-blue-500 ring-1 ring-blue-500":"",h.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":a.value?"true":"false",onClick:m},[i.createElementVNode("div",{class:"flex flex-1 flex-wrap items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"chipsRef",ref:s},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.value,(A,z)=>(i.openBlock(),i.createElementBlock("div",{key:z,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[i.createElementVNode("div",LT,[i.createElementVNode("div",OT,i.toDisplayString(A),1)]),i.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:i.withModifiers(G=>b(z),["stop"]),"aria-label":`Remove ${A}`},C[2]||(C[2]=[i.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[i.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,IT)]))),128)),f.value?(i.openBlock(),i.createElementBlock("div",DT,i.toDisplayString(u.value),1)):i.createCommentVNode("",!0),i.createElementVNode("div",RT,[h.value?i.createCommentVNode("",!0):i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:0,ref_key:"inputRef",ref:l,class:"pl-2 w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-label":"Add tag","onUpdate:modelValue":C[0]||(C[0]=A=>c.value=A),onFocus:w,onBlur:x,onKeydown:E,placeholder:d.value&&d.value.length?"":void 0},null,40,FT)),[[i.vModelText,c.value]])])],512),i.createElementVNode("div",PT,[p.value?(i.openBlock(),i.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:h.value,onClick:i.withModifiers(k,["stop"])},C[3]||(C[3]=[i.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[i.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,$T)):i.createCommentVNode("",!0)])],10,VT)],2)],512))}}),HT={class:"relative flex gap-1 bg-white w-full"},jT=["disabled","placeholder"],UT=i.defineComponent({__name:"vs-input-slug",props:i.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=i.inject("values"),t=n,r=i.useModel(n,"modelValue");function o(l){const a={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"y",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"kh",ц:"ts",ч:"ch",ш:"sh",щ:"shch",ы:"y",э:"e",ю:"yu",я:"ya",ь:"",ъ:"",є:"ye",і:"i",ї:"yi",ґ:"g"};return l.toLowerCase().split("").map(c=>a[c]||c).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const s=()=>{const l=e?.value?.[t.parent||""]?.toString(),a=o(l);r.value=a.toString()};return(l,a)=>(i.openBlock(),i.createElementBlock("div",HT,[i.withDirectives(i.createElementVNode("input",{ref:"vsText",disabled:l.disabled,placeholder:l.placeholder,"onUpdate:modelValue":a[0]||(a[0]=c=>r.value=c),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,jT),[[i.vModelText,r.value]]),i.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:s}," Gen ")]))}}),WT=ge(UT,[["__scopeId","data-v-b0eba370"]]),KT={class:"relative flex gap-1 bg-white w-full"},qT=["disabled","placeholder"],GT=["disabled"],JT={key:0},YT={key:1},XT=i.defineComponent({__name:"vs-input-codegen",props:i.mergeModels({table:{},code:{},init:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.ref(!1),o=i.computed(()=>e.init!==!1),s=i.computed(()=>!!e.table&&!!e.code),l=()=>{if(!s.value)return"";const d=encodeURIComponent(String(e.table)),u=encodeURIComponent(String(e.code));return`/api/code-gen/${d}/${u}`},a=async()=>{if(!s.value||r.value)return;const d=l();if(d){r.value=!0;try{const u=await(await fetch(d)).text();t.value=u}finally{r.value=!1}}},c=()=>{o.value&&(t.value||a())};return i.onMounted(()=>{c()}),i.watch(()=>[e.table,e.code,e.init],()=>{c()}),(d,u)=>(i.openBlock(),i.createElementBlock("div",KT,[i.withDirectives(i.createElementVNode("input",{disabled:d.disabled,placeholder:d.placeholder,"onUpdate:modelValue":u[0]||(u[0]=f=>t.value=f),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,qT),[[i.vModelText,t.value]]),i.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:r.value||d.disabled||!s.value,onClick:a},[r.value?(i.openBlock(),i.createElementBlock("span",YT,"...")):(i.openBlock(),i.createElementBlock("span",JT,"Gen"))],8,GT)]))}}),ZT=ge(XT,[["__scopeId","data-v-6ee5237d"]]),QT={class:"w-full"},eA={ref:"sortableContainer",class:"flex flex-col gap-1"},tA=["onDragstart","onDrop"],nA={class:"w-1/3"},rA={class:"w-2/3"},oA=["onClick"],sA={key:0,class:"text-[14px] text-gray-700"},lA={class:"mt-2 w-full flex items-center"},iA=["disabled"],aA=i.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=g=>`${g}-${Math.random().toString(36).substring(2,15)}`,r=i.inject("values"),o=n,s=e,l=o.addButtonText??"Додати",a=o.ignore??[],c=i.ref([]),d=i.ref(null);(()=>{const g=o.parent&&r?.value?.[o.parent]||o.modelValue||{};c.value=Object.entries(g).filter(([y])=>!a.includes(y)).map(([y,b])=>({id:t("key-value-"),key:y,value:b}))})();function u(g){d.value=g}function f(g){if(d.value===null||d.value===g)return;const y=c.value.splice(d.value,1)[0];c.value.splice(g,0,y),d.value=null}const p=i.computed(()=>c.value.some(g=>g.key&&!g.value||!g.key&&g.value)),h=()=>{c.value.push({id:t("key-value-"),key:"",value:""})},m=g=>{c.value=c.value.filter(y=>y.id!==g)};return i.watch(c,g=>{const y={};g.forEach(k=>{k.key&&k.value!==void 0&&(y[k.key]=k.value)});const b={};a.length&&a.forEach(k=>{b[k]=o.parent?r?.value?.[o.parent]?.[k]:void 0}),r?.value&&o.parent&&(r.value[o.parent]={...b,...y}),s("update:modelValue",y)},{deep:!0}),(g,y)=>(i.openBlock(),i.createElementBlock("div",QT,[i.createElementVNode("div",eA,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.value,(b,k)=>(i.openBlock(),i.createElementBlock("div",{key:b.id,class:i.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===k}]),draggable:"true",onDragstart:w=>u(k),onDragover:y[0]||(y[0]=i.withModifiers(()=>{},["prevent"])),onDrop:w=>f(k)},[y[1]||(y[1]=i.createStaticVNode('<button class="cursor-move" data-v-a0f7fbfc><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-a0f7fbfc><circle cx="15" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="18" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="18" r="1.5" data-v-a0f7fbfc></circle></svg></button>',1)),i.createElementVNode("div",nA,[i.createVNode(bl,{modelValue:b.key,"onUpdate:modelValue":w=>b.key=w,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),i.createElementVNode("div",rA,[i.createVNode(bl,{modelValue:b.value,"onUpdate:modelValue":w=>b.value=w,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),i.createElementVNode("button",{onClick:w=>m(b.id),class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200"},[i.createVNode(i.unref(Nv),{height:"16",width:"16"})],8,oA)],42,tA))),128))],512),c.value.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",sA," Дані для відображення відсутні ")),i.createElementVNode("div",lA,[i.createElementVNode("button",{type:"button",onClick:h,disabled:p.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[i.createVNode(To,{height:"14",width:"14"}),i.createTextVNode(" "+i.toDisplayString(i.unref(l)),1)],8,iA)])]))}}),cA=ge(aA,[["__scopeId","data-v-a0f7fbfc"]]),dA={class:"flex items-center gap-2 w-full"},uA=["disabled"],fA=["disabled"],pA=i.defineComponent({__name:"vs-input-color",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,{inputClass:r}=vt(t.style),o=e,s=i.computed({get:()=>t.modelValue||"#000000",set:a=>o("update:modelValue",a)}),l=i.computed(()=>!!t.disabled);return(a,c)=>(i.openBlock(),i.createElementBlock("div",dA,[i.withDirectives(i.createElementVNode("input",{type:"color","onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),disabled:l.value,ref:"color",class:i.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[a.modelValue?"":"text-opacity-50",i.unref(r)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,uA),[[i.vModelText,s.value]]),i.withDirectives(i.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":c[1]||(c[1]=d=>s.value=d),disabled:l.value},null,8,fA),[[i.vModelText,s.value]])]))}}),hA={class:"flex items-center gap-2 w-full"},mA=["min","max","step","disabled"],gA=["disabled"],yA=i.defineComponent({__name:"vs-input-range",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},min:{default:0},max:{default:100},step:{default:1}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,{inputClass:r}=vt(t.style),o=e,s=i.computed({get:()=>Number(t.modelValue??t.min),set:a=>o("update:modelValue",Number(a))}),l=i.computed(()=>!!t.disabled);return(a,c)=>(i.openBlock(),i.createElementBlock("div",hA,[i.withDirectives(i.createElementVNode("input",{type:"range","onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),min:a.min,max:a.max,step:a.step,disabled:l.value,ref:"range",class:i.normalizeClass(["w-full cursor-pointer accent-blue-500",[a.modelValue?"":"text-opacity-50",i.unref(r)].join(" ")])},null,10,mA),[[i.vModelText,s.value]]),i.withDirectives(i.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":c[1]||(c[1]=d=>s.value=d),disabled:l.value},null,8,gA),[[i.vModelText,s.value]])]))}}),bA=["type","value","onInput","placeholder","disabled"],kA=i.defineComponent({__name:"vs-input-array",props:i.mergeModels({count:{default:1},limit:{default:n=>n.count??1},inputType:{default:"text"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=vt(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled),s=i.computed(()=>e.placeholder??"");i.watchEffect(()=>{const a=r.value?.length??0;a<e.count&&(r.value=[...r.value??[],...Array(e.count-a)])});function l(a,c){if(o.value)return;const d=a.target.value,u=[...r.value];u[c]=e.inputType==="text"?d:Number(d),r.value=u}return(a,c)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["grid gap-2",`grid-cols-${a.limit}`])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.count,d=>(i.openBlock(),i.createElementBlock("input",{type:a.inputType,value:r.value?.[d-1]??"",onInput:u=>l(u,d-1),placeholder:s.value,disabled:o.value,class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t),{"!border-red-600":a.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,bA))),256))],2))}}),xA={class:"flex items-center gap-2 w-full"},wA={class:"relative flex-1"},EA=["placeholder","disabled","onKeydown"],CA=["disabled"],vA={key:0,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},_A={key:1,class:"animate-spin h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},SA={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50"},NA={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},MA={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},TA=["onClick"],AA={key:0,class:"p-4 text-sm text-gray-500"},BA=i.defineComponent({__name:"vs-input-address",props:i.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},api:{default:""},geom:{default:""},includes:{default:()=>[]}},{modelValue:{default:""},modelModifiers:{}}),emits:i.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=e,{inputClass:o}=vt(t.style),s=i.useModel(n,"modelValue"),l=i.computed({get:()=>s.value,set:b=>{s.value=b}}),a=i.ref(!1),c=i.ref([]),d=i.ref(!1),u=i.computed(()=>t.placeholder??""),f=i.computed(()=>!!t.disabled),p=i.inject("values");function h(){!f.value&&l.value.trim()&&m()}async function m(){const b=(l.value||"").trim();if(!b)return;let k=b;if(t.includes?.length&&p?.value){const x=t.includes.map(E=>p.value?.[E]).filter(Boolean);x.length&&(k=`${x.join(", ")}, ${b}`)}const w=t.api.replace("{{value}}",encodeURIComponent(k));a.value=!0;try{const x=await(await fetch(w)).json();c.value=Array.isArray(x)?x:[],d.value=!0}catch(x){console.error("Address search error:",x)}finally{a.value=!1}}function g(){d.value=!d.value}function y(b){if(!b)return;d.value=!1;const k=parseFloat(b.lat),w={type:"Point",coordinates:[parseFloat(b.lon),k]};t.geom&&p?.value&&(p.value[t.geom]=w),r("update:geom",w)}return(b,k)=>(i.openBlock(),i.createElementBlock("div",xA,[i.createElementVNode("div",wA,[i.withDirectives(i.createElementVNode("input",{type:"text","onUpdate:modelValue":k[0]||(k[0]=w=>l.value=w),placeholder:u.value,disabled:f.value,class:i.normalizeClass(["py-1.5 px-3 block w-full bg-white border rounded-md placeholder:text-gray-400 focus:ring-2 focus:ring-blue-500",[i.unref(o),{"!border-red-600":t.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:i.withKeys(i.withModifiers(h,["prevent"]),["enter"])},null,42,EA),[[i.vModelText,l.value]]),c.value.length?(i.openBlock(),i.createElementBlock("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-blue-600",onClick:g,title:"Show search results"},k[2]||(k[2]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),i.createElementVNode("path",{d:"M12 16v-4"}),i.createElementVNode("path",{d:"M12 8h.01"})],-1)]))):i.createCommentVNode("",!0)]),i.createElementVNode("button",{type:"button",onClick:m,class:"flex items-center justify-center px-2 py-2 border rounded-md bg-white hover:bg-gray-50 text-gray-600 hover:text-blue-600 disabled:opacity-50 h-[38px]",disabled:a.value||!l.value?.trim()},[a.value?(i.openBlock(),i.createElementBlock("svg",_A,k[4]||(k[4]=[i.createElementVNode("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),i.createElementVNode("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"},null,-1)]))):(i.openBlock(),i.createElementBlock("svg",vA,k[3]||(k[3]=[i.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),i.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"},null,-1)])))],8,CA),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[d.value?(i.openBlock(),i.createElementBlock("div",SA,[i.createElementVNode("div",NA,[i.createElementVNode("div",MA,[k[6]||(k[6]=i.createElementVNode("span",null,"Search results",-1)),i.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:k[1]||(k[1]=w=>d.value=!1),title:"Close"},k[5]||(k[5]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)]))]),i.createElementVNode("ul",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.value,(w,x)=>(i.openBlock(),i.createElementBlock("li",{key:x,onClick:E=>y(w),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},i.toDisplayString(w.display_name),9,TA))),128))]),c.value.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",AA," No results found "))])])):i.createCommentVNode("",!0)]))]))}}),VA={VsInputText:bl,VsInputRadio:Gp,"vs-input-text":bl,"vs-input-password":tv,"vs-input-textarea":dN,"vs-input-mask":Fv,"vs-input-number":ov,"vs-input-radio":Gp,"vs-input-select":th,"vs-input-switcher":Kp,"vs-input-static":qp,"vs-input-container":jS,"vs-input-date":t_,"vs-input-checkbox":Qv,"vs-input-file":H_,"vs-input-html":qp,"vs-input-email":zv,"vs-input-datatable":yM,"vs-input-map":BT,"vs-input-file-list":bS,"vs-input-tags":zT,"vs-input-slug":WT,"vs-input-codegen":ZT,"vs-input-key-value":cA,"vs-input-range":yA,"vs-input-color":pA,"vs-input-native-select":th,"vs-input-array":kA,"vs-input-address":BA},LA=i.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(n){const e=n,t=i.inject("values");async function r(){try{if(!e.api)return;const o=e.api.replace("{{value}}",e.value),s=await fetch(o);if(!s.ok){Pe({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const l=await s.json();if(!e.set||!t)return;for(const[a,c]of Object.entries(e.set))t.value[a]=l.result[c]}catch(o){console.error(e.error,o)}}return(o,s)=>(i.openBlock(),i.createElementBlock("button",{onClick:r,class:"vs-button relative inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-blue-500 hover:border-blue-500 hover:bg-blue-500 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 ml-0 md:ml-2 mt-2 md:mt-0 py-[8px] md:w-2/4 whitespace-nowrap w-full"},i.toDisplayString(o.button),1))}}),OA={class:"flex flex-col gap-1 w-full"},IA={key:0,class:"text-sm text-gray-500"},rh=i.defineComponent({__name:"vs-compact-form-layout",props:i.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]},columns:{default:()=>({container:12,label:3})}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.computed(()=>QC[`${e.layout}`]),o=i.computed(()=>VA?.[`vs-input-${e.item.type}`]),s=i.computed(()=>{const a=i.unref(o);if(!a)return new Set;const c=a.props??a.__vccOpts?.props;if(!c)return new Set;const d=Array.isArray(c)?c:Object.keys(c);return new Set(d)}),l=i.computed(()=>{const a=e.item??{},c=s.value;return c.size?Object.fromEntries(Object.entries(a).filter(([d])=>c.has(d))):{}});return(a,c)=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(r.value),{ua:e.item.ua,error:e.error||"",item:a.item,columns:e.columns,label:e.item.label},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["flex w-full",`${e.item.type}-component`])},[i.createElementVNode("div",OA,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(o.value),i.mergeProps(l.value,{modelValue:t.value,"onUpdate:modelValue":c[0]||(c[0]=d=>t.value=d)}),null,16,["modelValue"])),a.item.description&&e.layout!=="settings"?(i.openBlock(),i.createElementBlock("p",IA,i.toDisplayString(a.item.description),1)):i.createCommentVNode("",!0)]),a.item.behavior?.api&&a.item.behavior?.button?(i.openBlock(),i.createBlock(LA,i.mergeProps({key:0},a.item.behavior,{value:t.value}),null,16,["value"])):i.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),DA={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},RA={class:"vs-compact-form-navigation__rail mt-[6px]"},FA=["onClick"],PA=i.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(n,{expose:e}){const t=n,r=i.ref([]),o=i.ref(""),s=i.ref(""),l=i.computed(()=>!!t.enabled),a=i.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),c=i.computed(()=>{const V=t.width;if(V==null)return{};const O=typeof V=="number"?`${V}px`:`${V}`;return{width:O,minWidth:O}});let d=null,u=0,f=0,p=null,h=null,m=null;const g=()=>z(),y=()=>k();i.watch(()=>t.target,async V=>{if(M(),!V){p=null,r.value=[],o.value="";return}p=V,l.value&&(await i.nextTick(),E(V),k())},{immediate:!0}),i.watch(()=>t.scrollContainer,V=>{if(!l.value){h=V??null;return}b(V??null),i.nextTick(()=>k())},{immediate:!0}),i.onMounted(()=>{t.scrollContainer||b(null),k()}),i.onBeforeUnmount(()=>{M(),b(null,!0),p=null,typeof window<"u"&&(u&&window.cancelAnimationFrame(u),f&&window.cancelAnimationFrame(f))});function b(V,O=!1){if(m&&(m(),m=null),O){h=null;return}if(h=V??null,typeof window>"u")return;const Y=V??window,Q=window;Y.addEventListener("scroll",g,{passive:!0}),Q.addEventListener("resize",y),m=()=>{Y.removeEventListener("scroll",g),Q.removeEventListener("resize",y)}}function k(){if(!l.value||!p)return;u&&typeof window<"u"&&window.cancelAnimationFrame(u);const V=()=>{w(),u=0};typeof window>"u"?V():u=window.requestAnimationFrame(V)}function w(){if(!l.value||!p)return;const V=Array.from(p.querySelectorAll("h1, h2")),O=new Set,Y=[];V.forEach((Q,P)=>{const K=Q.textContent?.trim()??"";if(!K)return;let U=(Q.getAttribute("id")??"").trim();U||(U=x(K)||`heading-${P+1}`);let re=U,se=1;for(;O.has(re);)re=`${U}-${se+=1}`;Q.id!==re&&Object.assign(Q,{id:re}),O.add(re),Y.push({id:re,text:K,level:Q.tagName.toLowerCase()==="h1"?1:2})}),r.value=Y,Y.length||(o.value=""),A()}function x(V){return V.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function E(V){!V||!l.value||typeof MutationObserver>"u"||(M(),d=new MutationObserver(()=>k()),d.observe(V,{childList:!0,subtree:!0}))}function M(){d&&(d.disconnect(),d=null)}function C(V){const O=h;if(!O)return typeof window>"u"?V.offsetTop:V.getBoundingClientRect().top+window.scrollY;const Y=V.getBoundingClientRect(),Q=O.getBoundingClientRect();return Y.top-Q.top+O.scrollTop}function A(){if(!l.value||!r.value.length)return;const V=h,O=(V?V.scrollTop:null)||(typeof window<"u"?window.scrollY:0),Y=(V?V.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),Q=O+Y;let P=null;for(let U=0;U<r.value.length;U+=1){const re=r.value[U],se=document.getElementById(re.id);if(se){const ve=C(se);ve+se.offsetHeight>O&&ve<Q&&(P=re.id)}}!P&&s.value&&(P=s.value),P&&(s.value=P);const K=V?V.scrollHeight-V.clientHeight:document.documentElement.scrollHeight-window.innerHeight;O+5>=K&&(P=r.value[r.value.length-1].id),P&&(o.value=P)}function z(){l.value&&(f&&window.cancelAnimationFrame(f),f=window.requestAnimationFrame(()=>{A(),f=0}))}function G(V){if(!l.value)return;const O=document.getElementById(V);if(!O)return;const Y=h,Q=Math.max(0,C(O));Y?Y.scrollTo({top:Q,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:Q,behavior:"smooth"})}return e({refresh:k}),(V,O)=>l.value&&r.value.length?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(a.value),style:i.normalizeStyle(c.value)},[i.createElementVNode("h2",DA,i.toDisplayString(V.title),1),i.createElementVNode("div",RA,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,Y=>(i.openBlock(),i.createElementBlock("div",{key:Y.id,class:i.normalizeClass(["vs-compact-form-navigation__item relative",Y.level===2?"vs-compact-form-navigation__item--nested":"",Y.id===o.value?"vs-compact-form-navigation__item--active":""])},[i.createElementVNode("button",{type:"button",onClick:Q=>G(Y.id),class:i.normalizeClass(["vs-compact-form-navigation__button flex gap-x-3 py-[6px] pr-3 text-sm duration-200 hover:text-gray-800",Y.level===2?"pl-[15px]":"pl-[18px]",Y.id===o.value?"text-gray-800":"text-gray-500"])},[i.createElementVNode("span",null,i.toDisplayString(Y.text),1)],10,FA)],2))),128))])],6)):i.createCommentVNode("",!0)}}),$A=ge(PA,[["__scopeId","data-v-1584a562"]]),oh={required:"Це поле є обов’язковим",email:"Неправильний email"},zA=n=>n?!1:oh.required,HA=n=>n?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)?!1:oh.email:!1,jA=(n,e)=>{const t=e.pattern??e.regexp;return!(typeof t=="string"?new RegExp(t):t).test(n)&&n?e.message:!1},UA=(n,e)=>!1,WA=(n,e)=>{switch(typeof e=="string"?e:e.type){case"required":return zA(n);case"email":return HA(n);case"regexp":return jA(n,e);case"custom":return UA();default:return!1}},KA={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",datalist:"datatable",file:"file",dropzone:"file"};function sh(n){const e=n.toLowerCase();return KA[e]||e}function Ra(n,e=!1){if(Array.isArray(n)){const r=[];return n.forEach(o=>{const s={...o};s.name=(o.name||o.id||o.key||"").toString(),s.type=sh(o.type),s.label=o.label||o.ua,s.rules=o.rules||o.validators,s.type==="email"&&!s.rules&&(s.rules=["email"]),o.data&&(s.api=`/api/suggest/${o.data}`),s.disabled=e||s.disabled,Array.isArray(s.schema)&&(s.schema=Ra(s.schema,s.disabled)),r.push(s)}),r}const t=[];return Object.entries(n).forEach(r=>{const o={name:r[0],...r[1],type:sh(r[1].type),label:r[1].label||r[1].ua,rules:r[1].rules||r[1].validators,disabled:e};o.type==="email"&&!o.rules&&(o.rules=["email"]),r[1].type.includes("list")&&(o.multiple=!0),!o.api&&r[1].data&&(o.api=`/api/suggest/${r[1].data}`),Array.isArray(o.schema)&&(o.schema=Ra(o.schema,o.disabled)),t.push(o)}),t}function qA(n,e,t=!1){const r=i.computed(()=>Ra(e,typeof t=="boolean"?t:t.value)),o=i.ref({});function s(c){const d=c?.conditions;if(!d)return!0;const u=Array.isArray(d)?d[0]:d,f=n?.value?.[u];return eh(f,d)}const l=(c=r.value,d=!0)=>(c.forEach(u=>{if(u.rules){if(!s(u)){delete o.value[u.name];return}let f=!1,p=null;u.rules.forEach(h=>{const m=WA(n.value[u.name],h);m&&(f=!0,!p&&typeof m=="string"&&(p=m))}),f&&p?o.value[u.name]=p:delete o.value[u.name]}u.schema&&l(u.schema,!1)}),d&&Object.values(o.value).some(Boolean)?o.value:null),a=i.computed(()=>r.value?.filter(c=>c.hidden!==!0&&s(c)));return{errors:o,validate:l,reset:()=>{n.value={},o.value={}},visibleSchema:a}}const GA={class:"flex w-full h-full min-h-0 gap-6"},JA={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},Rr=i.defineComponent({__name:"vs-compact-form",props:i.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1},navigation:{type:Boolean,default:!1},navWidth:{default:400},columns:{}},{form:{default:()=>({})},formModifiers:{},values:{default:()=>({})},valuesModifiers:{}}),emits:i.mergeModels(["handle-submit","update:modelValue"],["update:form","update:values"]),setup(n,{expose:e,emit:t}){const r=t,o=n,s=i.useModel(n,"form"),l=i.useModel(n,"values"),{errors:a,validate:c,reset:d,visibleSchema:u}=qA(l,o.schema,i.toRef(o,"disabled")),f=i.ref(null),p=i.ref(null),h=i.computed(()=>o.navigation),m=i.computed(()=>o.navWidth),g=i.computed(()=>o.style?.columns),y=Object.freeze({container:12,label:3}),b=i.computed(()=>o.columns??g.value??y),k=i.computed(()=>o.columns!=null||g.value!=null),w=i.computed(()=>k.value?"horizontal":o.layout),x=A=>A?.columns?"horizontal":w.value,E=A=>A?.columns??b.value,M=()=>{r("update:modelValue",l.value),c(),r("handle-submit",l.value)};e({validate:c,reset:d,errors:a}),i.onMounted(()=>{o.modelValue&&(l.value=o.modelValue),s.value={value:l.value,errors:a.value,reset:d,validate:c,formId:o.formId}});function C(A,z){if(A===z)return!0;if(typeof A!="object"||typeof z!="object"||!A||!z)return!1;const G=Object.keys(A),V=Object.keys(z);return G.length!==V.length?!1:G.every(O=>A[O]===z[O])}return i.provide("form",s),i.provide("values",l),(A,z)=>(i.openBlock(),i.createElementBlock("div",GA,[i.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:p},[i.createElementVNode("form",{ref_key:"formRef",ref:f,onSubmit:i.withModifiers(M,["prevent"]),class:i.normalizeClass(["grid grid-cols-12 p-1",w.value==="default"?"gap-6":"gap-4"])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref(u),(G,V)=>(i.openBlock(),i.createElementBlock("div",{key:G.name,class:i.normalizeClass(x(G)==="horizontal"?"col-span-12":`col-span-${G.col||12}`)},[i.createVNode(rh,{style:i.normalizeStyle(A.style),item:G,layout:x(G),columns:E(G),"model-value":l.value[G.name],"onUpdate:modelValue":O=>{const Y=l.value[G.name];C(Y,O)||(l.value[G.name]=O)},error:i.unref(a)[G.name]},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),x(G)==="settings"&&V+1!==i.unref(u).length?(i.openBlock(),i.createElementBlock("div",JA)):i.createCommentVNode("",!0)],2))),128))],34)],512),i.createVNode($A,{target:f.value,"scroll-container":p.value,enabled:h.value,width:m.value},null,8,["target","scroll-container","enabled","width"])]))}}),YA={class:"relative"},XA={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},ZA={class:"m-[10px] fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 min-h-0 h-fit max-h-[80vh] overflow-hidden opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl lg:w-7/12 w-11/12"},QA={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},eB={class:"font-medium text-gray-800 dark:text-[#ffffff]"},tB={class:"p-4 mim-h-0 h-full overflow-auto"},nB=i.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(n,{emit:e}){const t=n,r=e,o=i.ref(t.schema),s=i.ref(t.defaultValue?JSON.parse(JSON.stringify(t.defaultValue)):{}),l=i.ref({}),a=i.ref(),c=i.ref(t.mode);async function d(){const f=l.value.validate();if(f){Pe({type:"warning",title:"Помилка валідації",message:Object.entries(f).map(([p,h])=>`${p}: ${h}`).join(`
120
- `)});return}if(a.value)try{const p=await fetch(`/api/table/${a.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s.value)});if(p.ok)await p.json(),Pe({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`}),r("save",s.value);else if(p.status===400){const h=await p.json().catch(()=>({}));Pe({type:"warning",title:"Помилка валідації",message:h.message||"Некоректні дані (400)"})}else p.status===500?Pe({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):Pe({type:"error",title:"Помилка",message:`Статус: ${p.status}`})}catch(p){Pe({type:"error",title:"Помилка з’єднання",message:p.message||"Не вдалося виконати запит"})}}function u(){r("close")}return i.onMounted(async()=>{try{if(t.form){const f=await fetch(`/api/template/form/${t.form}`);if(!f.ok){Pe({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const p=await f.json();o.value=p.schema,a.value=p.token}else if(t.token){a.value=t.token;const f=await fetch(`/api/form/${a.value}`);if(!f.ok){Pe({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const p=await f.json();o.value=p.schema,p.data?s.value=p.data:c.value="add"}}catch(f){Pe({type:"error",title:"Error",message:f.message||"Unexpected error"}),console.error(f)}}),(f,p)=>(i.openBlock(),i.createElementBlock("div",YA,[i.createElementVNode("div",XA,[i.createElementVNode("div",ZA,[i.createElementVNode("div",QA,[i.createElementVNode("h3",eB,i.toDisplayString(c.value==="add"?"Додати":"Змінити"),1),i.createElementVNode("button",{onClick:u,type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"},p[2]||(p[2]=[i.createElementVNode("span",{class:"sr-only"},"Close",-1),i.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",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"},[i.createElementVNode("path",{d:"M18 6 6 18"}),i.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),i.createElementVNode("div",tB,[o.value?(i.openBlock(),i.createBlock(Rr,{key:0,schema:o.value,values:s.value,"onUpdate:values":p[0]||(p[0]=h=>s.value=h),form:l.value,"onUpdate:form":p[1]||(p[1]=h=>l.value=h)},null,8,["schema","values","form"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",{class:"vs-form__head mr-5 mb-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},[i.createElementVNode("button",{type:"button",onClick:u,class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),i.createElementVNode("button",{onClick:d,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])])])]))}}),lh=(n={mode:"edit",schema:null})=>new Promise(e=>{const{close:t}=VC({title:n.mode==="add"?"Додати":"Редагувати",template:"",size:"medium",content:nB,contentProps:{...n,onClose:()=>{e(null),t()},onSave:r=>{e(r),t()}}})});Rr.install=function(n){n.component("VForm",Rr),Object.assign(n.config.globalProperties,{$form:lh}),n.provide("form",lh),window.v3plugin||(window.v3plugin={})};const rB={class:"relative"},oB={key:0,class:"mt-4"},sB=["src","alt","title"],lB={key:0,class:"text-sm text-red-500"},iB=Object.assign({inheritAttrs:!1},{__name:"vs-editor-image",props:{editor:{type:Object,required:!0}},setup(n){const e=n,t=i.ref(!1),r=i.ref(!1),o=i.ref({}),s=i.ref({src:"",alt:"",title:""}),l=i.computed(()=>[{name:"src",label:"URL зображення",type:"text",required:!0,placeholder:"https://example.com/image.png"},{name:"file",label:"Файл",type:"file",required:!1,placeholder:"Шлях до файлу зображення"},{name:"width",label:"Ширина",type:"number",required:!1,placeholder:"Ширина зображення"},{name:"height",label:"Висота",type:"number",required:!1,placeholder:"Висота зображення"},{name:"alt",label:"Альтернативний текст",type:"text",required:!1,placeholder:"Опис зображення"},{name:"title",label:"Заголовок (необов'язково)",type:"text",required:!1,placeholder:"Заголовок зображення"}]),a=()=>{s.value={src:"",alt:"",title:""},r.value=!1,t.value=!0},c=()=>{t.value=!1,r.value=!1},d=async()=>{if(await o.value.validate()){Pe({type:"warning",title:"Попередження",message:"Будь ласка, заповніть всі обов'язкові поля"});return}if(!s.value.src){Pe({type:"warning",title:"Попередження",message:"Будь ласка, введіть URL зображення"});return}e.editor&&e.editor.chain().focus().setImage({src:s.value.src||s.value.file,alt:s.value.alt||"",title:s.value.title||"",width:s.value.width||"",height:s.value.height||""}).run(),c()},u=async()=>{await d()},f=()=>{c()};return i.watch(()=>s.value.src,()=>{r.value=!1}),(p,h)=>(i.openBlock(),i.createElementBlock("div",rB,[i.createElementVNode("button",{onClick:a,class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",n.editor?.isActive("image")?"bg-gray-200 text-gray-900":""]),title:"Додати зображення"},[...h[4]||(h[4]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"></rect><circle cx="9" cy="9" r="2"></circle><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"></path></svg><span class="sr-only">Додати зображення</span>',2)])],2),i.createVNode(Hp,{modelValue:t.value,"onUpdate:modelValue":h[3]||(h[3]=m=>t.value=m),title:"Додати зображення"},{footer:i.withCtx(()=>[i.createElementVNode("div",{class:"flex justify-end gap-x-2 p-[20px]"},[i.createElementVNode("button",{onClick:f,type:"button",class:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500"}," Скасувати "),i.createElementVNode("button",{onClick:u,type:"button",class:"px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500"}," Додати зображення ")])]),default:i.withCtx(()=>[i.createVNode(i.unref(Rr),{modelValue:s.value,"onUpdate:modelValue":h[0]||(h[0]=m=>s.value=m),schema:l.value,form:o.value,"onUpdate:form":h[1]||(h[1]=m=>o.value=m)},null,8,["modelValue","schema","form"]),s.value.src?(i.openBlock(),i.createElementBlock("div",oB,[h[5]||(h[5]=i.createElementVNode("p",{class:"text-sm text-gray-600 mb-2"},"Попередній перегляд:",-1)),i.withDirectives(i.createElementVNode("img",{src:s.value.src,alt:s.value.alt||"Попередній перегляд зображення",title:s.value.title,class:"max-w-full h-auto max-h-32 rounded border",onError:h[2]||(h[2]=m=>r.value=!0)},null,40,sB),[[i.vShow,!r.value]]),r.value?(i.openBlock(),i.createElementBlock("p",lB," Не вдалося завантажити попередній перегляд зображення ")):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),_:1},8,["modelValue"])]))}}),aB={class:"flex items-center"},cB=["disabled"],dB=["disabled"],uB=Le(Object.assign({inheritAttrs:!1},{__name:"vs-editor-history",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor?.can().undo()&&e.editor.chain().focus().undo().run()},r=()=>{e.editor?.can().redo()&&e.editor.chain().focus().redo().run()};return(o,s)=>(i.openBlock(),i.createElementBlock("div",aB,[i.createElementVNode("button",{onClick:t,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-l-full hover:text-gray-900 hover:bg-gray-100 border-r border-gray-200",[n.editor?.can().undo()?"text-gray-500":"text-gray-300 cursor-not-allowed"]]),disabled:!n.editor?.can().undo(),title:"Undo (Ctrl+Z)"},[...s[0]||(s[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M3 7v6h6"}),i.createElementVNode("path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"})],-1)])],10,cB),i.createElementVNode("button",{onClick:r,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-r-full hover:text-gray-900 hover:bg-gray-100",[n.editor?.can().redo()?"text-gray-500":"text-gray-300 cursor-not-allowed"]]),disabled:!n.editor?.can().redo(),title:"Redo (Ctrl+Y)"},[...s[1]||(s[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M21 7v6h-6"}),i.createElementVNode("path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3L21 13"})],-1)])],10,dB)]))}}),[["__scopeId","data-v-b5a7cc5a"]]),fB={class:"relative"},pB=Le(Object.assign({inheritAttrs:!1},{__name:"vs-editor-help",props:{editor:Object},setup(n){const e=i.ref(!1),t=i.ref(null),r=()=>{e.value=!e.value},o=()=>{e.value=!1};return(s,l)=>(i.openBlock(),i.createElementBlock("div",fB,[i.createElementVNode("button",{ref_key:"helpButton",ref:t,onClick:r,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 text-gray-500",[e.value?"bg-gray-100 text-gray-900":"text-gray-500"]]),title:"Markdown Shortcuts Help"},[...l[1]||(l[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),i.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),i.createElementVNode("line",{x1:"12",x2:"12.01",y1:"17",y2:"17"})],-1)])],2),e.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[100001]",onClick:o},[i.createElementVNode("div",{class:"bg-white rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] overflow-y-auto",onClick:l[0]||(l[0]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",{class:"p-6"},[i.createElementVNode("div",{class:"flex justify-between items-center mb-4"},[l[3]||(l[3]=i.createElementVNode("h2",{class:"text-xl font-semibold text-gray-900"},"Common Markdown Syntax & Shortcuts",-1)),i.createElementVNode("button",{onClick:o,class:"text-gray-400 hover:text-gray-600 transition-colors"},[...l[2]||(l[2]=[i.createElementVNode("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])]),l[4]||(l[4]=i.createStaticVNode('<div class="space-y-6" data-v-72ce3024><div data-v-72ce3024><h3 class="text-lg font-medium text-gray-800 mb-3" data-v-72ce3024>Markdown Syntax</h3><div class="overflow-x-auto" data-v-72ce3024><table class="w-full border-collapse" data-v-72ce3024><thead data-v-72ce3024><tr class="bg-gray-50" data-v-72ce3024><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Element</th><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Example</th></tr></thead><tbody class="text-sm" data-v-72ce3024><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Bold</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>**bold text**</code> or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>__bold text__</code></td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Italics</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>*italic text*</code> or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>_italic text_</code></td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Strikethrough</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>~strikethrough text~</code></td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Headings</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024># Heading 1</code>, <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>## Heading 2</code>, etc., up to <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>###### Heading 6</code></td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Unordered Lists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use an asterisk (*), dash (-), or plus sign (+) followed by a space. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Ordered Lists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use a number followed by a period and a space (e.g., <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>1. First item</code>). </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Blockquotes</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Start with a greater-than sign (&gt;) followed by a space. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Inline Code</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Surround with backticks (<code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>`</code>). </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Code Blocks</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Enclose with three backticks (<code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>```</code>) before and after the code. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Images</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>![alt text](url)</code> syntax. </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Links</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>[Link Text](url)</code> syntax. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Checklists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Create a list item with <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>- [ ]</code> for an incomplete task or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>- [x]</code> for a completed one. </td></tr></tbody></table></div></div><div data-v-72ce3024><h3 class="text-lg font-medium text-gray-800 mb-3" data-v-72ce3024>Common Editing Shortcuts</h3><div class="overflow-x-auto" data-v-72ce3024><table class="w-full border-collapse" data-v-72ce3024><thead data-v-72ce3024><tr class="bg-gray-50" data-v-72ce3024><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Shortcut</th><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Action</th></tr></thead><tbody class="text-sm" data-v-72ce3024><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+A</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Select all text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+B</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Apply bold formatting</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+C</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Copy selected text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+I</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Apply italic formatting</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+K</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Open the insert link dialog</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+S</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Save the current document</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+V</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Paste copied text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+X</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Cut selected text</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+Y</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Redo the last action</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Alt+Shift+Backspace</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Redo the last action</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+Z</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Undo the last action</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Alt+Backspace</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Undo the last action</td></tr></tbody></table></div></div></div>',1))])])])):i.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-72ce3024"]]),hB={__name:"vs-editor-horizontal-rule",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor&&e.editor.chain().focus().setHorizontalRule().run()};return(r,o)=>(i.openBlock(),i.createElementBlock("button",{title:"Horizontal Rule",onClick:t,class:"flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex"},[...o[0]||(o[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("line",{x1:"3",x2:"21",y1:"12",y2:"12"})],-1)])]))}},mB={__name:"vs-editor-fullscreen",props:{editor:Object},emits:["toggle-fullscreen"],setup(n,{emit:e}){const t=e,r=()=>{t("toggle-fullscreen")};return(o,s)=>(i.openBlock(),i.createElementBlock("button",{title:"Fullscreen",onClick:r,class:"w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100"},[...s[0]||(s[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})],-1)])]))}},gB=["title"],yB={class:"vs-editor-html-mode__text"},ih={bold:iE,italic:dE,color:S2,background_color:V2,highlight:L2,bullet_list:Zw,ordered_list:tE,blockquote:Jw,codeblock:oE,underline:uE,strike:fE,link:HE,table:qE,text_align:u2,type_tag:h2,font_family:F2,font_size:H2,superscript:W2,subscript:G2,heading:Q2,clear_formatting:nC,image:iB,history:uB,help:pB,horizontal_rule:hB,fullscreen:mB,html_mode:Le({__name:"vs-editor-html-mode",props:{editor:{type:Object,required:!0}},emits:["toggle-html-mode"],setup(n,{emit:e}){const t=e,r=i.ref(!1),o=()=>{r.value=!r.value,t("toggle-html-mode",r.value)};return(s,l)=>(i.openBlock(),i.createElementBlock("button",{onClick:o,class:i.normalizeClass([{"is-active":r.value},"vs-editor-html-mode"]),type:"button",title:r.value?"Switch to Rich Text Mode":"Switch to HTML Mode"},[l[0]||(l[0]=i.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("polyline",{points:"16,18 22,12 16,6"}),i.createElementVNode("polyline",{points:"8,6 2,12 8,18"})],-1)),i.createElementVNode("span",yB,i.toDisplayString((r.value,"HTML")),1)],10,gB))}},[["__scopeId","data-v-99a48167"]]),tab:Object.assign({inheritAttrs:!1},{__name:"vs-editor-tab",props:{editor:{type:Object,required:!0}},setup(n){const e=n,t=()=>{e.editor&&(e.editor.isActive("bulletList")||e.editor.isActive("orderedList"))&&e.editor.chain().focus().sinkListItem("listItem").run()};return(r,o)=>(i.openBlock(),i.createElementBlock("button",{title:"Tab (Increase List Indent)",onClick:t,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none"},[...o[0]||(o[0]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-indent-increase"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M20 6l-11 0"></path><path d="M20 12l-7 0"></path><path d="M20 18l-11 0"></path><path d="M4 8l4 4l-4 4"></path></svg>',1)])]))}})},wl={basic:["history","font_family","font_size","bold","italic","underline","strike","text_align","bullet_list","ordered_list","link","image","clear_formatting","help"],default:["history","heading","font_family","font_size","bold","italic","underline","strike","superscript","subscript","color","background_color","highlight","text_align","bullet_list","ordered_list","blockquote","codeblock","table","link","image","horizontal_rule","clear_formatting","fullscreen","help","html_mode"],full:["history","heading","font_family","font_size","bold","italic","underline","strike","color","background_color","highlight","text_align","bullet_list","ordered_list","blockquote","codeblock","table","link","image","horizontal_rule","superscript","subscript","clear_formatting","fullscreen","help","html_mode"]},bB=Le({__name:"monaco-editor",props:{modelValue:{type:String,default:""},height:{type:String,default:"280px"},language:{type:String,default:"html"},theme:{type:String,default:"vs"}},emits:["update:modelValue","change"],setup(n,{expose:e,emit:t}){const r=n,o=t,s=i.ref(null);let l=null,a=null,c=!1,d=null;const u=()=>{const V=document.querySelector("link[data-monaco-editor-css]");if(!V)return!1;try{return V.sheet||V.styleSheet||V.href}catch{return!1}},f=()=>u()?new Promise(V=>setTimeout(V,50)):new Promise((V,O)=>{const Y=document.createElement("link");Y.rel="stylesheet",Y.href="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/editor/editor.main.css",Y.setAttribute("data-monaco-editor-css","true");const Q=()=>{const re=()=>{u()?setTimeout(()=>V(),100):setTimeout(re,50)};re()};Y.addEventListener?(Y.addEventListener("load",Q),Y.addEventListener("error",()=>O(new Error("Failed to load Monaco Editor CSS")))):(Y.onload=Q,Y.onerror=()=>O(new Error("Failed to load Monaco Editor CSS"))),document.head.appendChild(Y);let P=0;const K=20,U=setInterval(()=>{P++,u()?(clearInterval(U),setTimeout(()=>V(),100)):P>=K&&(clearInterval(U),setTimeout(()=>V(),100))},50)}),p=()=>document.querySelector("script[data-monaco-editor-loader]")?Promise.resolve():new Promise((O,Y)=>{const Q=document.createElement("script");Q.src="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/loader.js",Q.setAttribute("data-monaco-editor-loader","true"),Q.onload=()=>O(),Q.onerror=()=>Y(new Error("Failed to load Monaco Editor loader")),document.head.appendChild(Q)}),h=()=>d||(window.monaco&&window.monaco.editor?(a=window.monaco,Promise.resolve(a)):(d=new Promise((V,O)=>{if(c){const Y=setInterval(()=>{window.monaco&&window.monaco.editor&&(clearInterval(Y),a=window.monaco,V(a))},50);return}c=!0,f().then(()=>p()).then(()=>{const Y=setInterval(()=>{window.require&&(clearInterval(Y),window.require.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"}}),window.require(["vs/editor/editor.main"],()=>{a=window.monaco,c=!1,V(a)},Q=>{c=!1,console.error("Failed to load Monaco Editor:",Q),O(Q)}))},50);setTimeout(()=>{clearInterval(Y),c=!1,O(new Error("Monaco Editor loader not found"))},1e4)}).catch(Y=>{c=!1,O(Y)})}),d)),m=V=>{try{const O=document.createElement("div");O.innerHTML=V;const Y=(P,K=0)=>{const U=" ".repeat(K);let re="";if(P.nodeType===Node.TEXT_NODE){const se=P.textContent.trim();return se&&(re+=U+se+`
120
+ `)});return}if(a.value)try{const p=await fetch(`/api/table/${a.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s.value)});if(p.ok)await p.json(),Pe({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`}),r("save",s.value);else if(p.status===400){const h=await p.json().catch(()=>({}));Pe({type:"warning",title:"Помилка валідації",message:h.message||"Некоректні дані (400)"})}else p.status===500?Pe({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):Pe({type:"error",title:"Помилка",message:`Статус: ${p.status}`})}catch(p){Pe({type:"error",title:"Помилка з’єднання",message:p.message||"Не вдалося виконати запит"})}}function u(){r("close")}return i.onMounted(async()=>{try{if(t.form){const f=await fetch(`/api/template/form/${t.form}`);if(!f.ok){Pe({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const p=await f.json();o.value=p.schema,a.value=p.token}else if(t.token){a.value=t.token;const f=await fetch(`/api/form/${a.value}`);if(!f.ok){Pe({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const p=await f.json();o.value=p.schema,p.data?s.value=p.data:c.value="add"}}catch(f){Pe({type:"error",title:"Error",message:f.message||"Unexpected error"}),console.error(f)}}),(f,p)=>(i.openBlock(),i.createElementBlock("div",YA,[i.createElementVNode("div",XA,[i.createElementVNode("div",ZA,[i.createElementVNode("div",QA,[i.createElementVNode("h3",eB,i.toDisplayString(c.value==="add"?"Додати":"Змінити"),1),i.createElementVNode("button",{onClick:u,type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"},p[2]||(p[2]=[i.createElementVNode("span",{class:"sr-only"},"Close",-1),i.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",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"},[i.createElementVNode("path",{d:"M18 6 6 18"}),i.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),i.createElementVNode("div",tB,[o.value?(i.openBlock(),i.createBlock(Rr,{key:0,schema:o.value,values:s.value,"onUpdate:values":p[0]||(p[0]=h=>s.value=h),form:l.value,"onUpdate:form":p[1]||(p[1]=h=>l.value=h)},null,8,["schema","values","form"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",{class:"vs-form__head mr-5 mb-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},[i.createElementVNode("button",{type:"button",onClick:u,class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),i.createElementVNode("button",{onClick:d,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])])])]))}}),lh=(n={mode:"edit",schema:null})=>new Promise(e=>{const{close:t}=VC({title:n.mode==="add"?"Додати":"Редагувати",template:"",size:"medium",content:nB,contentProps:{...n,onClose:()=>{e(null),t()},onSave:r=>{e(r),t()}}})});Rr.install=function(n){n.component("VForm",Rr),Object.assign(n.config.globalProperties,{$form:lh}),n.provide("form",lh),window.v3plugin||(window.v3plugin={})};const rB={class:"relative"},oB={key:0,class:"mt-4"},sB=["src","alt","title"],lB={key:0,class:"text-sm text-red-500"},iB=Object.assign({inheritAttrs:!1},{__name:"vs-editor-image",props:{editor:{type:Object,required:!0}},setup(n){const e=n,t=i.ref(!1),r=i.ref(!1),o=i.ref({}),s=i.ref({src:"",file:"",alt:"",title:"",width:"",height:""}),l=i.computed(()=>s.value.src||s.value.file||""),a=i.computed(()=>[{name:"src",label:"URL зображення",type:"text",required:!1,placeholder:"https://example.com/image.png"},{name:"file",label:"Файл",type:"file",required:!1,placeholder:"Шлях до файлу зображення"},{name:"width",label:"Ширина",type:"number",required:!1,placeholder:"Ширина зображення"},{name:"height",label:"Висота",type:"number",required:!1,placeholder:"Висота зображення"},{name:"alt",label:"Альтернативний текст",type:"text",required:!1,placeholder:"Опис зображення"},{name:"title",label:"Заголовок (необов'язково)",type:"text",required:!1,placeholder:"Заголовок зображення"}]),c=()=>{s.value={src:"",file:"",alt:"",title:"",width:"",height:""},r.value=!1,t.value=!0},d=()=>{t.value=!1,r.value=!1},u=async()=>{if(await o.value.validate()){Pe({type:"warning",title:"Попередження",message:"Будь ласка, заповніть всі обов'язкові поля"});return}if(!s.value.src&&!s.value.file){Pe({type:"warning",title:"Попередження",message:"Будь ласка, введіть URL зображення або виберіть файл"});return}e.editor&&e.editor.chain().focus().setImage({src:s.value.src||s.value.file,alt:s.value.alt||"",title:s.value.title||"",width:s.value.width||"",height:s.value.height||""}).run(),d()},f=async()=>{await u()},p=()=>{d()};return i.watch(()=>[s.value.src,s.value.file],()=>{r.value=!1}),(h,m)=>(i.openBlock(),i.createElementBlock("div",rB,[i.createElementVNode("button",{onClick:c,class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",n.editor?.isActive("image")?"bg-gray-200 text-gray-900":""]),title:"Додати зображення"},[...m[4]||(m[4]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"></rect><circle cx="9" cy="9" r="2"></circle><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"></path></svg><span class="sr-only">Додати зображення</span>',2)])],2),i.createVNode(Hp,{modelValue:t.value,"onUpdate:modelValue":m[3]||(m[3]=g=>t.value=g),title:"Додати зображення"},{footer:i.withCtx(()=>[i.createElementVNode("div",{class:"flex justify-end gap-x-2 p-[20px]"},[i.createElementVNode("button",{onClick:p,type:"button",class:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500"}," Скасувати "),i.createElementVNode("button",{onClick:f,type:"button",class:"px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500"}," Додати зображення ")])]),default:i.withCtx(()=>[i.createVNode(i.unref(Rr),{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=g=>s.value=g),schema:a.value,form:o.value,"onUpdate:form":m[1]||(m[1]=g=>o.value=g)},null,8,["modelValue","schema","form"]),l.value?(i.openBlock(),i.createElementBlock("div",oB,[m[5]||(m[5]=i.createElementVNode("p",{class:"text-sm text-gray-600 mb-2"},"Попередній перегляд:",-1)),i.withDirectives(i.createElementVNode("img",{src:l.value,alt:s.value.alt||"Попередній перегляд зображення",title:s.value.title,class:"max-w-full h-auto max-h-32 rounded border",onError:m[2]||(m[2]=g=>r.value=!0)},null,40,sB),[[i.vShow,!r.value]]),r.value?(i.openBlock(),i.createElementBlock("p",lB," Не вдалося завантажити попередній перегляд зображення ")):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),_:1},8,["modelValue"])]))}}),aB={class:"flex items-center"},cB=["disabled"],dB=["disabled"],uB=Le(Object.assign({inheritAttrs:!1},{__name:"vs-editor-history",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor?.can().undo()&&e.editor.chain().focus().undo().run()},r=()=>{e.editor?.can().redo()&&e.editor.chain().focus().redo().run()};return(o,s)=>(i.openBlock(),i.createElementBlock("div",aB,[i.createElementVNode("button",{onClick:t,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-l-full hover:text-gray-900 hover:bg-gray-100 border-r border-gray-200",[n.editor?.can().undo()?"text-gray-500":"text-gray-300 cursor-not-allowed"]]),disabled:!n.editor?.can().undo(),title:"Undo (Ctrl+Z)"},[...s[0]||(s[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M3 7v6h6"}),i.createElementVNode("path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"})],-1)])],10,cB),i.createElementVNode("button",{onClick:r,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-r-full hover:text-gray-900 hover:bg-gray-100",[n.editor?.can().redo()?"text-gray-500":"text-gray-300 cursor-not-allowed"]]),disabled:!n.editor?.can().redo(),title:"Redo (Ctrl+Y)"},[...s[1]||(s[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M21 7v6h-6"}),i.createElementVNode("path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3L21 13"})],-1)])],10,dB)]))}}),[["__scopeId","data-v-b5a7cc5a"]]),fB={class:"relative"},pB=Le(Object.assign({inheritAttrs:!1},{__name:"vs-editor-help",props:{editor:Object},setup(n){const e=i.ref(!1),t=i.ref(null),r=()=>{e.value=!e.value},o=()=>{e.value=!1};return(s,l)=>(i.openBlock(),i.createElementBlock("div",fB,[i.createElementVNode("button",{ref_key:"helpButton",ref:t,onClick:r,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 text-gray-500",[e.value?"bg-gray-100 text-gray-900":"text-gray-500"]]),title:"Markdown Shortcuts Help"},[...l[1]||(l[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),i.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),i.createElementVNode("line",{x1:"12",x2:"12.01",y1:"17",y2:"17"})],-1)])],2),e.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[100001]",onClick:o},[i.createElementVNode("div",{class:"bg-white rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] overflow-y-auto",onClick:l[0]||(l[0]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",{class:"p-6"},[i.createElementVNode("div",{class:"flex justify-between items-center mb-4"},[l[3]||(l[3]=i.createElementVNode("h2",{class:"text-xl font-semibold text-gray-900"},"Common Markdown Syntax & Shortcuts",-1)),i.createElementVNode("button",{onClick:o,class:"text-gray-400 hover:text-gray-600 transition-colors"},[...l[2]||(l[2]=[i.createElementVNode("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])]),l[4]||(l[4]=i.createStaticVNode('<div class="space-y-6" data-v-72ce3024><div data-v-72ce3024><h3 class="text-lg font-medium text-gray-800 mb-3" data-v-72ce3024>Markdown Syntax</h3><div class="overflow-x-auto" data-v-72ce3024><table class="w-full border-collapse" data-v-72ce3024><thead data-v-72ce3024><tr class="bg-gray-50" data-v-72ce3024><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Element</th><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Example</th></tr></thead><tbody class="text-sm" data-v-72ce3024><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Bold</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>**bold text**</code> or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>__bold text__</code></td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Italics</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>*italic text*</code> or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>_italic text_</code></td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Strikethrough</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>~strikethrough text~</code></td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Headings</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024># Heading 1</code>, <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>## Heading 2</code>, etc., up to <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>###### Heading 6</code></td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Unordered Lists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use an asterisk (*), dash (-), or plus sign (+) followed by a space. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Ordered Lists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use a number followed by a period and a space (e.g., <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>1. First item</code>). </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Blockquotes</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Start with a greater-than sign (&gt;) followed by a space. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Inline Code</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Surround with backticks (<code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>`</code>). </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Code Blocks</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Enclose with three backticks (<code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>```</code>) before and after the code. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Images</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>![alt text](url)</code> syntax. </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Links</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>[Link Text](url)</code> syntax. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Checklists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Create a list item with <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>- [ ]</code> for an incomplete task or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>- [x]</code> for a completed one. </td></tr></tbody></table></div></div><div data-v-72ce3024><h3 class="text-lg font-medium text-gray-800 mb-3" data-v-72ce3024>Common Editing Shortcuts</h3><div class="overflow-x-auto" data-v-72ce3024><table class="w-full border-collapse" data-v-72ce3024><thead data-v-72ce3024><tr class="bg-gray-50" data-v-72ce3024><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Shortcut</th><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Action</th></tr></thead><tbody class="text-sm" data-v-72ce3024><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+A</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Select all text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+B</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Apply bold formatting</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+C</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Copy selected text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+I</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Apply italic formatting</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+K</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Open the insert link dialog</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+S</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Save the current document</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+V</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Paste copied text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+X</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Cut selected text</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+Y</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Redo the last action</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Alt+Shift+Backspace</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Redo the last action</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+Z</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Undo the last action</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Alt+Backspace</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Undo the last action</td></tr></tbody></table></div></div></div>',1))])])])):i.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-72ce3024"]]),hB={__name:"vs-editor-horizontal-rule",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor&&e.editor.chain().focus().setHorizontalRule().run()};return(r,o)=>(i.openBlock(),i.createElementBlock("button",{title:"Horizontal Rule",onClick:t,class:"flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex"},[...o[0]||(o[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("line",{x1:"3",x2:"21",y1:"12",y2:"12"})],-1)])]))}},mB={__name:"vs-editor-fullscreen",props:{editor:Object},emits:["toggle-fullscreen"],setup(n,{emit:e}){const t=e,r=()=>{t("toggle-fullscreen")};return(o,s)=>(i.openBlock(),i.createElementBlock("button",{title:"Fullscreen",onClick:r,class:"w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100"},[...s[0]||(s[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})],-1)])]))}},gB=["title"],yB={class:"vs-editor-html-mode__text"},ih={bold:iE,italic:dE,color:S2,background_color:V2,highlight:L2,bullet_list:Zw,ordered_list:tE,blockquote:Jw,codeblock:oE,underline:uE,strike:fE,link:HE,table:qE,text_align:u2,type_tag:h2,font_family:F2,font_size:H2,superscript:W2,subscript:G2,heading:Q2,clear_formatting:nC,image:iB,history:uB,help:pB,horizontal_rule:hB,fullscreen:mB,html_mode:Le({__name:"vs-editor-html-mode",props:{editor:{type:Object,required:!0}},emits:["toggle-html-mode"],setup(n,{emit:e}){const t=e,r=i.ref(!1),o=()=>{r.value=!r.value,t("toggle-html-mode",r.value)};return(s,l)=>(i.openBlock(),i.createElementBlock("button",{onClick:o,class:i.normalizeClass([{"is-active":r.value},"vs-editor-html-mode"]),type:"button",title:r.value?"Switch to Rich Text Mode":"Switch to HTML Mode"},[l[0]||(l[0]=i.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("polyline",{points:"16,18 22,12 16,6"}),i.createElementVNode("polyline",{points:"8,6 2,12 8,18"})],-1)),i.createElementVNode("span",yB,i.toDisplayString((r.value,"HTML")),1)],10,gB))}},[["__scopeId","data-v-99a48167"]]),tab:Object.assign({inheritAttrs:!1},{__name:"vs-editor-tab",props:{editor:{type:Object,required:!0}},setup(n){const e=n,t=()=>{e.editor&&(e.editor.isActive("bulletList")||e.editor.isActive("orderedList"))&&e.editor.chain().focus().sinkListItem("listItem").run()};return(r,o)=>(i.openBlock(),i.createElementBlock("button",{title:"Tab (Increase List Indent)",onClick:t,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none"},[...o[0]||(o[0]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-indent-increase"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M20 6l-11 0"></path><path d="M20 12l-7 0"></path><path d="M20 18l-11 0"></path><path d="M4 8l4 4l-4 4"></path></svg>',1)])]))}})},wl={basic:["history","font_family","font_size","bold","italic","underline","strike","text_align","bullet_list","ordered_list","link","image","clear_formatting","help"],default:["history","heading","font_family","font_size","bold","italic","underline","strike","superscript","subscript","color","background_color","highlight","text_align","bullet_list","ordered_list","blockquote","codeblock","table","link","image","horizontal_rule","clear_formatting","fullscreen","help","html_mode"],full:["history","heading","font_family","font_size","bold","italic","underline","strike","color","background_color","highlight","text_align","bullet_list","ordered_list","blockquote","codeblock","table","link","image","horizontal_rule","superscript","subscript","clear_formatting","fullscreen","help","html_mode"]},bB=Le({__name:"monaco-editor",props:{modelValue:{type:String,default:""},height:{type:String,default:"280px"},language:{type:String,default:"html"},theme:{type:String,default:"vs"}},emits:["update:modelValue","change"],setup(n,{expose:e,emit:t}){const r=n,o=t,s=i.ref(null);let l=null,a=null,c=!1,d=null;const u=()=>{const V=document.querySelector("link[data-monaco-editor-css]");if(!V)return!1;try{return V.sheet||V.styleSheet||V.href}catch{return!1}},f=()=>u()?new Promise(V=>setTimeout(V,50)):new Promise((V,O)=>{const Y=document.createElement("link");Y.rel="stylesheet",Y.href="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/editor/editor.main.css",Y.setAttribute("data-monaco-editor-css","true");const Q=()=>{const re=()=>{u()?setTimeout(()=>V(),100):setTimeout(re,50)};re()};Y.addEventListener?(Y.addEventListener("load",Q),Y.addEventListener("error",()=>O(new Error("Failed to load Monaco Editor CSS")))):(Y.onload=Q,Y.onerror=()=>O(new Error("Failed to load Monaco Editor CSS"))),document.head.appendChild(Y);let P=0;const K=20,U=setInterval(()=>{P++,u()?(clearInterval(U),setTimeout(()=>V(),100)):P>=K&&(clearInterval(U),setTimeout(()=>V(),100))},50)}),p=()=>document.querySelector("script[data-monaco-editor-loader]")?Promise.resolve():new Promise((O,Y)=>{const Q=document.createElement("script");Q.src="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/loader.js",Q.setAttribute("data-monaco-editor-loader","true"),Q.onload=()=>O(),Q.onerror=()=>Y(new Error("Failed to load Monaco Editor loader")),document.head.appendChild(Q)}),h=()=>d||(window.monaco&&window.monaco.editor?(a=window.monaco,Promise.resolve(a)):(d=new Promise((V,O)=>{if(c){const Y=setInterval(()=>{window.monaco&&window.monaco.editor&&(clearInterval(Y),a=window.monaco,V(a))},50);return}c=!0,f().then(()=>p()).then(()=>{const Y=setInterval(()=>{window.require&&(clearInterval(Y),window.require.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"}}),window.require(["vs/editor/editor.main"],()=>{a=window.monaco,c=!1,V(a)},Q=>{c=!1,console.error("Failed to load Monaco Editor:",Q),O(Q)}))},50);setTimeout(()=>{clearInterval(Y),c=!1,O(new Error("Monaco Editor loader not found"))},1e4)}).catch(Y=>{c=!1,O(Y)})}),d)),m=V=>{try{const O=document.createElement("div");O.innerHTML=V;const Y=(P,K=0)=>{const U=" ".repeat(K);let re="";if(P.nodeType===Node.TEXT_NODE){const se=P.textContent.trim();return se&&(re+=U+se+`
121
121
  `),re}if(P.nodeType===Node.ELEMENT_NODE){const se=P.tagName.toLowerCase(),ve=Array.from(P.attributes).map(Ft=>`${Ft.name}="${Ft.value}"`).join(" "),pt=P.children.length>0;P.textContent.trim()&&!pt?re+=U+`<${se}${ve?" "+ve:""}>${P.textContent}</${se}>
122
122
  `:pt?(re+=U+`<${se}${ve?" "+ve:""}>
123
123
  `,Array.from(P.childNodes).forEach(Ft=>{re+=Y(Ft,K+1)}),re+=U+`</${se}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/richtext",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "type": "module",
5
5
  "author": "Softpro",
6
6
  "main": "dist/richtext.js",