@fewangsit/wangsvue-gsts 1.0.0-alpha.8 → 1.0.0-alpha.9
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.
|
@@ -31,6 +31,13 @@ export interface DialogConfirmProps {
|
|
|
31
31
|
* The severity will determine the dialog icons and color scheme.
|
|
32
32
|
*/
|
|
33
33
|
severity: ConfirmDialogSeverity;
|
|
34
|
+
/**
|
|
35
|
+
* The severity of the confirm button.
|
|
36
|
+
* The severity will determine the confirm button color scheme in case button severity is different from header/dialog severity.
|
|
37
|
+
*
|
|
38
|
+
* @default undefined - to fallback to props.severity
|
|
39
|
+
*/
|
|
40
|
+
confirmButtonSeverity?: ConfirmDialogSeverity;
|
|
34
41
|
/**
|
|
35
42
|
* The boolean modelValue to show dialog.
|
|
36
43
|
*/
|
package/package.json
CHANGED
package/wangsvue-gsts.es.js
CHANGED
|
@@ -92251,6 +92251,7 @@ const bce = ["id", "data-item-dragable", "draggable", "onDragenter", "onDragstar
|
|
|
92251
92251
|
props: {
|
|
92252
92252
|
header: {},
|
|
92253
92253
|
severity: {},
|
|
92254
|
+
confirmButtonSeverity: {},
|
|
92254
92255
|
visible: { type: Boolean },
|
|
92255
92256
|
closeAfterConfirm: { type: Boolean, default: !0 },
|
|
92256
92257
|
closeLabel: { default: void 0 },
|
|
@@ -92364,7 +92365,7 @@ const bce = ["id", "data-item-dragable", "draggable", "onDragenter", "onDragstar
|
|
|
92364
92365
|
}), null, 16, ["label"])) : be("", !0),
|
|
92365
92366
|
f.actionable ? Qt((O(), re(rn, I({ key: 1 }, (G = P(r)) == null ? void 0 : G.confirmbutton, {
|
|
92366
92367
|
label: f.confirmLabel ?? P(s).defaultConfirmLabel,
|
|
92367
|
-
severity: f.severity,
|
|
92368
|
+
severity: f.confirmButtonSeverity ?? f.severity,
|
|
92368
92369
|
onClick: u
|
|
92369
92370
|
}), null, 16, ["label", "severity"])), [
|
|
92370
92371
|
[h]
|
package/wangsvue-gsts.system.js
CHANGED
|
@@ -326,7 +326,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
326
326
|
`).concat(i,`
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
|
-
`)}this.styleElement.innerHTML=n}},destroyStyle:function(){this.styleElement&&(document.head.removeChild(this.styleElement),this.styleElement=null)}},computed:{attributeSelector:function(){return ui()}},components:{ToastMessage:P7,Portal:Hs}};function id(t){"@babel/helpers - typeof";return id=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},id(t)}function U7(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function V7(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?U7(Object(n),!0).forEach(function(r){Mre(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):U7(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Mre(t,e,n){return e=Lre(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Lre(t){var e=Pre(t,"string");return id(e)=="symbol"?e:String(e)}function Pre(t,e){if(id(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(id(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Fre(t,e,n,r,i,a){var s=Kt("ToastMessage"),o=Kt("Portal");return x(),re(o,null,{default:Ie(function(){return[le("div",R({ref:"container",class:t.cx("root"),style:t.sx("root",!0,{position:t.position})},t.ptmi("root")),[ye(oy,R({name:"p-toast-message",tag:"div",onEnter:a.onEnter,onLeave:a.onLeave},V7(V7({},t.ptm("message")),t.ptm("transition"))),{default:Ie(function(){return[(x(!0),F(ot,null,en(i.messages,function(l){return x(),re(s,{key:l.id,message:l,templates:t.$slots,closeIcon:t.closeIcon,infoIcon:t.infoIcon,warnIcon:t.warnIcon,errorIcon:t.errorIcon,successIcon:t.successIcon,closeButtonProps:t.closeButtonProps,onClose:e[0]||(e[0]=function(c){return a.remove(c)}),pt:t.pt},null,8,["message","templates","closeIcon","infoIcon","warnIcon","errorIcon","successIcon","closeButtonProps","pt"])}),128))]}),_:1},16,["onEnter","onLeave"])],16)]}),_:1})}B7.render=Fre;const Bre=bt("Toast",Ct({__name:"Toast",props:{group:{default:"default-toast"},position:{default:"bottom-right"},autoZIndex:{type:Boolean},baseZIndex:{default:9980},breakpoints:{},message:{},icon:{},pt:{},ptOptions:{},unstyled:{type:Boolean}},emits:["close","lifeEnd"],setup(t){const e=t;kn(()=>{nn.on("toast:add",i)}),m2(()=>{window.toastGroups&&window.toastGroups.includes(e.group)?r.value=!1:(window.toastGroups=[e.group,...window.toastGroups??[]],r.value=!0)}),Z1(()=>{var a;window.toastGroups=(a=window.toastGroups)==null?void 0:a.filter(s=>s!==e.group),nn.off("toast:add",i)});const n=mt(),r=mt(!1),i=a=>{a.group===e.group&&(n.value=a),a.error&&console.error(a.error)};return(a,s)=>r.value?(x(),re(L(B7),R({key:0},a.$props,{"data-group":a.$props.group,onClose:s[0]||(s[0]=o=>a.$emit("close",o)),onLifeEnd:s[1]||(s[1]=o=>a.$emit("lifeEnd",o))}),$i({icon:Ie(()=>{var o,l,c;return[(o=n.value)!=null&&o.icon?(x(),re(Ft,{key:0,class:lt(["w-5 h-5 text-inherit",(l=n.value)==null?void 0:l.iconClass]),icon:(c=n.value)==null?void 0:c.icon},null,8,["class","icon"])):ve("",!0)]}),_:2},[a.$slots.container?{name:"container",fn:Ie(({message:o,closeCallback:l})=>[Fe(a.$slots,"container",{closeCallback:l,message:o})]),key:"0"}:void 0,a.$slots.message?{name:"message",fn:Ie(({message:o})=>[Fe(a.$slots,"message",{message:o})]),key:"1"}:void 0]),1040,["data-group"])):ve("",!0)}})),ad="tableConfigs",Ure=()=>"user-"+(JSON.parse(localStorage.getItem("user")??"{}")._id??"unknown"),G7=async()=>{let t=null;return new Promise(e=>{const n=indexedDB.open(Ure(),1);n.onupgradeneeded=r=>{t=r.target.result,t.createObjectStore(ad)},n.onsuccess=r=>{t=r.target.result,e(t)}})},Vre=async()=>{const n=(await G7()).transaction(ad,"readonly").objectStore(ad);return new Promise(r=>{let i,a;n.getAllKeys().onsuccess=s=>{i=s.target.result},n.getAll().onsuccess=s=>{a=s.target.result;const o={};i.forEach((l,c)=>{o[l]=a[c]}),r(o)}})},kv=_r({}),$7=async()=>{const t=async(e,n)=>{kv[e]=n,(await G7()).transaction(ad,"readwrite").objectStore(ad).put(n,e)};return Object.assign(kv,await Vre()),{config:kv,setConfig:t}};async function Gre(t,e){const{config:n}=await $7(),r=n[t];return r?r.map(i=>{const a=e.find(s=>s.field===i.field);if(!(!a||a.visible===!1))return{...a,...i}}).filter(i=>!!i):e}const $re=["id","data-item-dragable","draggable","onDragenter","onDragstart"],zre=Ct({__name:"CustomColumn",props:{tableId:{},defaultColumns:{},visibleColumns:{},maxColumn:{},type:{default:"menu"}},emits:["update:visibleColumns"],setup(t,{expose:e,emit:n}){const r=t,i=n;kn(async()=>{c.value=await Gre(r.tableId,m1.cloneDeep(r.defaultColumns)),C()});const{locale:a}=br("CustomColumn"),s=an("preset",{}).menu,o=an("preset",{}).customcolumn,l=We(()=>r.maxColumn?T.value.length>=r.maxColumn:!1),c=Ze([]),u=mt(),f=Ze(),p=We(()=>"column-visibility-menu-"+r.tableId),h=We({get:()=>r.visibleColumns,set:G=>{i("update:visibleColumns",G.filter(he=>he.visible!=!1))}}),g=G=>{if(f.value&&"toggle"in f.value){const he=G.currentTarget??G.target,Se=he.tagName.toLowerCase()==="th"?he:he.parentElement,pe={...G,currentTarget:Se};f.value.toggle(pe),Mn(()=>{const we=document.getElementById(p.value);if(we){const ie=window.innerWidth,Le=document.getElementById(`column-visibility-toggle-${r.tableId}`);if(Le){const{right:oe,width:$e}=Le.getBoundingClientRect();we.style.right=`${ie-(oe+$e/2)}px`,we.style.left="auto"}}})}},_=(G,he,Se)=>{const{dataTransfer:pe}=G;u.value=he,pe&&(pe.dropEffect="move",pe.effectAllowed="move",pe.setData("field",he.field),pe.setData("index",Se.toString()))},v=async()=>{u.value=void 0,S(),await A()},S=()=>{h.value=[...c.value]},T=We(()=>[...c.value].filter(G=>G.visible!==!1)),C=()=>{if(r.maxColumn&&T.value.length>r.maxColumn){let G=0;c.value=c.value.map(he=>{const Se=r.maxColumn!==void 0&&G<r.maxColumn,pe=he.checkedByDefault!==!1&&r.maxColumn===void 0||he.checkedByDefault!==!1&&Se;return pe&&G++,{...he,visible:pe}})}h.value=[...T.value]},E=G=>{const he=G.target.querySelector("label");he&&he.click()},y=()=>{const G=m1.cloneDeep(r.defaultColumns);if(r.maxColumn&&G.length>r.maxColumn){let he=0;c.value=G.map(Se=>{const pe=r.maxColumn!==void 0&&he<r.maxColumn,we=Se.checkedByDefault!==!1&&r.maxColumn===void 0||Se.checkedByDefault!==!1&&pe;return we&&he++,{...Se,visible:we}})}else c.value=G;h.value=[...T.value],A()},A=async()=>{const G=c.value.map(Se=>({field:Se.field,width:Se.width??"max-content",visible:Se.visible!==!1,fixed:!!Se.fixed})),{setConfig:he}=await $7();await he(r.tableId,G)},w=(G,he)=>{G==null||G.setAttribute("data-wv-section","custom-column-menu"),G==null||G.removeAttribute("style"),he==null||he.append(G??document.createElement("ul"))},I=G=>G.dragable!==!1&&z(G),N=()=>document.getElementById(p.value),z=G=>{if(!l.value)return!0;const he=h.value.findIndex(Se=>Se.field===G.field)>0;return l.value&&he},V=(G,he)=>{var Se,pe;if(G.preventDefault(),I(he)){const we=G.target,ie=we.tagName==="LI"?we:we.closest("li");if(ie==null||ie.classList.add("bg-primary-50"),(Se=ie==null?void 0:ie.nextElementSibling)==null||Se.classList.remove("bg-primary-50"),(pe=ie==null?void 0:ie.previousElementSibling)==null||pe.classList.remove("bg-primary-50"),!ie||!u.value)return;const Le=c.value.findIndex($e=>{var Ye;return $e.field===((Ye=u.value)==null?void 0:Ye.field)}),oe=c.value.findIndex($e=>$e.field===ie.id);Le!==-1&&oe!==-1&&([c.value[Le],c.value[oe]]=[c.value[oe],c.value[Le]])}};return e({toggleMenu:g,resetToDefault:y}),(G,he)=>{var Se,pe,we;return x(),F(ot,null,[r.type==="menu"?(x(),re(L(u3),{key:0,id:p.value,ref_key:"visibilityMenu",ref:f,"data-table-id":G.tableId,pt:{root:{class:[...(Se=L(s))==null?void 0:Se.root.class,"shadow-panel"]},start:{class:[...(pe=L(s))==null?void 0:pe.start.class,(we=L(o))==null?void 0:we.menustart.class]}},onFocus:he[0]||(he[0]=ie=>w(G.$refs.columnList,N())),onHide:A,"append-to":"body","auto-z-index":"","data-wv-name":"column-visibility","data-wv-section":"menu",popup:""},{start:Ie(()=>[ye(ln,{label:L(a).resetDefaultText,onClick:y,"data-wv-section":"button-reset-default",text:""},null,8,["label"])]),item:Ie(()=>[]),end:Ie(()=>[]),_:1},8,["id","data-table-id","pt"])):ve("",!0),qt(le("ul",{ref:"columnList",class:lt([{"grid grid-rows-4 grid-flow-col-dense w-max gap-x-4":G.type==="flat"}]),"data-wv-section":"custom-column-flat-list"},[(x(!0),F(ot,null,en(c.value,(ie,Le)=>{var oe;return x(),F(ot,{key:ie.field},[ie.reorderable!==!1?(x(),F("li",R({key:0,id:ie.field,ref_for:!0},L(o).menuitem({props:r,context:{dragable:I(ie)}}),{"data-item-dragable":I(ie),draggable:I(ie),onClick:E,onDragend:v,onDragenter:On($e=>V($e,ie),["prevent"]),onDragleave:he[3]||(he[3]=On(()=>{},["prevent"])),onDragover:he[4]||(he[4]=On(()=>{},["prevent"])),onDragstart:$e=>_($e,ie,Le),onMouseenter:he[5]||(he[5]=$e=>$e.target.classList.add("bg-primary-50")),onMouseleave:he[6]||(he[6]=$e=>$e.target.classList.remove("bg-primary-50")),"data-wv-section":"custom-column-menu-item"}),[ye(Ft,R({onClick:he[1]||(he[1]=On(()=>{},["stop"])),ref_for:!0},(oe=L(o))==null?void 0:oe.dragicon({context:{dragable:I(ie)}}),{icon:"dragable-menu"}),null,16),ye(Bl,{"aria-label":ie.header,disabled:ie.fixed,label:ie.header,"model-value":ie.visible!==!1,selectable:z(ie),onClick:he[2]||(he[2]=On(()=>{},["stop"])),"onUpdate:modelValue":$e=>{ie.visible=!!$e,C(),A()},class:"!w-full"},null,8,["aria-label","disabled","label","model-value","selectable","onUpdate:modelValue"])],16,$re)):ve("",!0)],64)}),128))],2),[[li,G.type==="flat"]])],64)}}}),z7=bt("DialogConfirm",Ct({__name:"DialogConfirm",props:{header:{},severity:{},visible:{type:Boolean},closeAfterConfirm:{type:Boolean,default:!0},closeLabel:{default:void 0},actionable:{type:Boolean,default:!0},confirmLabel:{},headerIcon:{},list:{default:void 0},listLabel:{default:void 0},message:{},showIcon:{type:Boolean,default:!0},showCloseButton:{type:Boolean,default:!0},contentClass:{}},emits:["close","confirm","hide","update:visible"],setup(t,{emit:e}){const n=an("preset",{}).dialog,r=an("preset",{}).dialogconfirm,i=t,a=e,{locale:s}=br("DialogConfirm"),o=Ze(),l=We(()=>i.closeLabel?i.closeLabel:i.actionable?s.actionableCloseButtonLabel:s.nonActionableCloseButtonLabel),c=()=>{a("update:visible",!1),a("close")},u=()=>{a("confirm"),i.closeAfterConfirm&&a("update:visible",!1)};return(f,p)=>{var g,_,v,S,T,C,E,y,A,w,I,N,z;const h=ar("focus");return x(),re(L(H0),{ref_key:"dialogConfirm",ref:o,closable:!1,draggable:!1,header:f.header,pt:{root:{class:[...(g=L(n))==null?void 0:g.root({state:{}}).class,...(_=L(r))==null?void 0:_.root.class],"data-wv-section":(v=L(r))==null?void 0:v.root["data-wv-section"](f.$attrs["data-wv-section"]),"data-wv-name":(S=L(r))==null?void 0:S.root["data-wv-name"](f.$attrs["data-wv-name"])},header:{...(T=L(r))==null?void 0:T.header,class:[...(C=L(n))==null?void 0:C.header.class,(E=L(r))==null?void 0:E.header.class]},content:{...(y=L(r))==null?void 0:y.content,class:[...(A=L(n))==null?void 0:A.content({state:{},instance:{}}).class,(w=L(r))==null?void 0:w.content.class,i.contentClass]},footer:{...(I=L(r))==null?void 0:I.footer,class:[...(N=L(n))==null?void 0:N.footer.class,(z=L(r))==null?void 0:z.footer.class]}},visible:i.visible,onHide:p[0]||(p[0]=V=>a("hide")),"onUpdate:visible":p[1]||(p[1]=V=>a("update:visible",!!V)),"close-on-escape":"",modal:""},{header:Ie(()=>{var V,G;return[f.showIcon?(x(),re(Ft,R({key:0,icon:f.headerIcon},(V=L(r))==null?void 0:V.headericon({props:i}),{severity:f.severity,"aria-label":"Header Icon"}),null,16,["icon","severity"])):ve("",!0),le("h3",Gt(bn((G=L(r))==null?void 0:G.headertitle(f.severity))),ze(f.header),17)]}),default:Ie(()=>{var V;return[f.list?(x(),F("ul",Gt(R({key:0},(V=L(r))==null?void 0:V.list)),[(x(!0),F(ot,null,en(f.list,(G,he)=>(x(),F("li",{key:he},ze(f.listLabel&&typeof G!="string"?L(ss)(G,f.listLabel):G),1))),128))],16)):ve("",!0),Fe(f.$slots,"body",{items:f.list},()=>{var G;return[le("p",Gt(bn((G=L(r))==null?void 0:G.bodymessage)),ze(f.message??L(s).defaultConfirmMessage),17)]})]}),footer:Ie(()=>[Fe(f.$slots,"footer",{},()=>{var V,G;return[f.showCloseButton?(x(),re(ln,R({key:0},(V=L(r))==null?void 0:V.cancelbutton,{label:l.value,onClick:c,severity:"secondary",text:""}),null,16,["label"])):ve("",!0),f.actionable?qt((x(),re(ln,R({key:1},(G=L(r))==null?void 0:G.confirmbutton,{label:f.confirmLabel??L(s).defaultConfirmLabel,severity:f.severity,onClick:u}),null,16,["label","severity"])),[[h]]):ve("",!0)]})]),_:3},8,["header","pt","visible"])}}})),Hre=Ct({__name:"MultiRow",props:{attributes:{}},setup(t){const e=t,n=an("preset",{}).datatable;return(r,i)=>{var a;return x(),F("div",Gt(bn((a=L(n))==null?void 0:a.multirowcontainer({props:e}))),[(x(!0),F(ot,null,en(r.attributes,(s,o)=>{var l;return x(),F("span",R({key:o,ref_for:!0},(l=L(n))==null?void 0:l.multirow({context:{firstIndex:o===0}}),{class:s.class}),[s.bodyComponent?(x(),re(on(s.bodyComponent.component),R({key:0,modelValue:s.bodyComponent.model,"onUpdate:modelValue":c=>s.bodyComponent.model=c,ref_for:!0},s.bodyComponent.props,{class:s.class,disabled:s.bodyComponent.disabled},gl(s.bodyComponent.events?s.bodyComponent.events:{}),{onClick:i[0]||(i[0]=On(()=>{},["stop"]))}),null,16,["modelValue","onUpdate:modelValue","class","disabled"])):(x(),F(ot,{key:1},[cn(ze(s.value),1)],64))],16)}),128))],16)}}}),Yre=["id"],Wre=["onClick"],Kre={class:"flex"},qre=["id"],Qre=["id","draggable","onClick","onDblclick","onDragenter","onDragstart"],jre=["onClick"],Xre=["colspan"],Zre=["colspan"],Jre=["colspan"],eie=["colspan"],tie=["colspan"],nie=["contenteditable","onBlur","onKeypress"],rie={key:1},iie=bt("DataTable",Ct({__name:"DataTable",props:Jr({treeTable:{type:Boolean},childTableProps:{},tableName:{default:"datatable"},tableTitle:{default:void 0},columns:{},useOption:{type:Boolean,default:!0},data:{},dataKey:{default:"_id"},disableKey:{default:"isDefault"},includeCheckDisabledRows:{type:Boolean},highlightKey:{},disableAllRows:{type:Boolean},search:{},tag:{},defaultQueryParams:{},fetchFunction:{},rows:{},isSelectedAll:{type:Boolean},filters:{},lazy:{type:Boolean,default:!0},loading:{type:Boolean},selectionType:{default:"checkbox"},useSelection:{type:Boolean},selectedData:{},expandedRows:{},usePaginator:{type:Boolean},options:{default:()=>[]},singleSelect:{type:Boolean},customColumn:{type:Boolean,default:!0},scrollHeight:{},rowHeight:{default:"fixed"},reorderable:{type:Boolean},globalFilterFields:{},totalDisabledRows:{},excelToastErrorMessage:{},emptyTableMessage:{},singleSelection:{}},{singleSelection:{},singleSelectionModifiers:{}}),emits:Jr(["toggleOption","selectData","rowSelect","page","sort","update:selectedData","update:singleSelection","cellEdited","input","rowReorder"],["update:singleSelection"]),setup(t,{emit:e}){const n=t,r=e,i=r1(t,"singleSelection"),{defaultProps:a}=br("DataTable"),s=We(()=>as(n,a)),o=an("preset",{}).datatable,l=[10,25,50,100],c=hh(),{setLoading:u}=K5(),f=`${window.location.pathname.replace("/","").split("/").join("-")}-${n.tableName}`,p=Ze(n.data??[]),h=mt(n.data??[]),g=Ze({}),_=Ze(n.columns),v=Ze(),S=Ze(),T=Ze(),C=mt([]),E=mt(),y=mt(0),A=mt(!1),w=mt(!1),I=mt(0),N=mt(0),z=mt(!1),V=mt(),G=mt(0),he=Ze(),Se=Ze(),pe=Ze([]),we=mt({}),ie=mt(),Le=mt(),oe=mt(),$e=mt(1),Ye=mt(10),B=mt(0),Z=Ze({}),J=We(()=>{var q,Re;return(q=n.childTableProps)!=null&&q.columns?(Re=n.childTableProps)==null?void 0:Re.columns.filter(k=>{var U;return!k.parentColumnsFields||((U=k.parentColumnsFields)==null?void 0:U.some(H=>_.value.some(K=>K.field===H)))}):_.value}),te=We(()=>({...n.defaultQueryParams,search:n.lazy?ie.value:n.search,page:n.usePaginator?$e.value:void 0,limit:n.usePaginator?Ye.value:void 0,sortOrder:oe.value,sortBy:Le.value,...n.lazy?we.value:n.filters})),de=We(()=>{var Re;const q=(Re=p.value)==null?void 0:Re.filter(k=>{var U;return((U=k.children)==null?void 0:U.length)||k.hasChildren});return(q==null?void 0:q.length)&&q.every(k=>g.value[k[n.dataKey]]>0)}),ee=We(()=>{var K,X,ne,Oe,_e;if(n.disableAllRows||!((K=W())!=null&&K.length)||n.selectionType!=="checkbox"||((X=ae.value)==null?void 0:X.length)===p.value.length)return!1;const q=(ne=C.value)==null?void 0:ne.length,Re=((Oe=xt(W()))==null?void 0:Oe.map(ke=>ke[n.dataKey]))??[],k=((_e=C.value)==null?void 0:_e.map(ke=>ke[n.dataKey]))??[],U=k.length?ane(Re,k):!1,H=q>0&&q===(B.value??0)-(ae.value.length??0);return U||H}),ae=We(()=>Qt(n.data??W()??[])),j=q=>Object.keys(g.value).includes(q),se=q=>ae.value.includes(q),Ge=q=>!!C.value.find(Re=>Re[n.dataKey]===q),W=q=>(p.value??[]).filter(Re=>!Re.childRowHeader&&!Re.childRow),yt=async(q,Re,k)=>{var H,K;if(j(q[n.dataKey])===k)return;const U=k??!j(q[n.dataKey]);if(!w.value)if(!U)p.value.splice(Re+1,g.value[q[n.dataKey]]),delete g.value[q[n.dataKey]];else{g.value[q[n.dataKey]]=1;let{children:X}=q;if((H=n.childTableProps)!=null&&H.fetchFunction&&q.hasChildren)try{p.value.splice(Re+1,0,{childRow:!0,loadingRow:!0}),w.value=!0;const ne=await((K=n.childTableProps)==null?void 0:K.fetchFunction(q));X=ne==null?void 0:ne.data}catch(ne){console.error("🚀 ~ toggleRowExpand ~ error:",ne)}finally{p.value.splice(Re+1,1),w.value=!1}if(Re>=0&&(X!=null&&X.length)){const ne=X.flatMap(Oe=>[{childRowHeader:!0,header:Oe.groupHeader},...(Oe.groupItems??[]).map(ke=>({childRow:!0,...ke}))]);g.value[q[n.dataKey]]=ne.length,p.value.splice(Re+1,0,...ne)}else p.value.splice(Re+1,0,{childRow:!0,noDataRow:!0})}},fe=q=>{n.includeCheckDisabledRows?C.value=q?W():W().filter(Re=>se(Re[n.dataKey])):C.value=q?xt(W()):[]},Ke=(q,Re,k)=>{if(!Re.childRow&&!Re.childRowHeader&&!se(Re[n.dataKey])&&n.selectionType!=="none"){const U=Ge(Re[n.dataKey]);r("rowSelect",{originalEvent:q,data:Re,index:k}),n.selectionType==="checkbox"?U?C.value=C.value.filter(H=>H[n.dataKey]!=Re[n.dataKey]):C.value=[...C.value,Re]:i.value=U?void 0:Re}},Qe=async()=>{var Re;const q=!de.value;if(!w.value){let k=0;for(const U of p.value)((Re=U.children)!=null&&Re.length||U.hasChildren)&&await yt(U,k,q),k++}},He=async(q,Re)=>{const k=q.target,U=k.tagName.toLowerCase()==="button"?k:k.parentElement;r("toggleOption",Re);const H={...q,currentTarget:q.currentTarget??q.target};tn(),await Mn(()=>{var K;U!=null&&U.classList.contains("option-button-active")?tn():((K=Se.value)==null||K.toggle(H),tn(),U==null||U.classList.add("option-button-active"))})},wt=async(q,Re,k)=>{var H,K,X,ne;if(!k.preset)return;const U=()=>Re[k.field]=!Re[k.field];if(k.preset.type==="checkbox"?(K=(H=k.preset).onCheck)==null||K.call(H,q,Re,U):k.preset.type==="toggle"&&((ne=(X=k.preset).onToggle)==null||ne.call(X,q,Re,U)),"confirmDialogProps"in k.preset){const{showWhen:Oe}=dt(k.preset,Re[k.field],Re)??{};typeof Oe=="function"?Z.value[Re[n.dataKey]]=await Oe(Re):Z.value[Re[n.dataKey]]=!Oe||Oe==="active"&&q||Oe==="inactive"&&!q}},pt=q=>q.draggable!==!1&&!q.childRow&&!q.childRowHeader&&n.reorderable&&!oe.value,Bt=(q,Re,k)=>{if(Re.childRow||Re.childRowHeader)return;g.value={};const{dataTransfer:U}=q;V.value=Re,E.value={item:Re,fromIndex:k},U&&(U.dropEffect="move",U.effectAllowed="move",U.setData("id",Re._id),U.setData("index",k.toString()))},tt=(q,Re)=>{var k,U;if(q.preventDefault(),pt(Re)){const H=q.target,K=H.tagName==="TR"?H:H.closest("tr");if(K==null||K.classList.add("bg-primary-50"),(k=K==null?void 0:K.nextElementSibling)==null||k.classList.remove("bg-primary-50"),(U=K==null?void 0:K.previousElementSibling)==null||U.classList.remove("bg-primary-50"),!K||!V.value)return;const X=pe.value.findIndex(Oe=>{var _e;return Oe._id===((_e=V.value)==null?void 0:_e._id)}),ne=pe.value.findIndex(Oe=>Oe._id===K.id);X!==-1&&ne!==-1&&(E.value&&(E.value.toIndex=ne),[pe.value[X],pe.value[ne]]=[pe.value[ne],pe.value[X]],Xt())}},Ut=()=>{E.value&&r("rowReorder",E.value),V.value=void 0,z.value=!1,E.value=void 0},Xt=()=>{p.value=[...pe.value]},tn=()=>{const q=document.querySelectorAll(".option-button-active");q==null||q.forEach(Re=>{Re.classList.remove("option-button-active")})},pn=()=>{Le.value=void 0,oe.value=void 0},Sn=()=>{$e.value=1},ut=()=>{Ye.value=n.rows??10,$e.value=1},ht=()=>{ut(),pn()},Ee=async()=>{N.value++,ht(),await Ot()},me=async q=>{Ye.value=q.rows,$e.value=q.page+1,await Ot(),Object.keys(g.value).forEach(Re=>{const k=p.value.findIndex(U=>U[n.dataKey]==Re);k>=0&&yt(p.value[k],k,!0)})},Ue=(q,Re)=>{q!==Le.value&&(oe.value=void 0),Le.value=q,oe.value?oe.value==-1?(oe.value=void 0,Le.value=void 0):oe.value=-1:oe.value=1,r("sort",{sortOrder:oe.value,sortField:Le.value,originalEvent:Re,rows:Ye.value}),Sn(),n.lazy&&n.fetchFunction?Ot():nt()},nt=()=>{const q=[...p.value??[]],Re=new Map;if(!oe.value){p.value=h.value??[];return}for(const U of q)Re.set(U,it.resolveFieldData(U,Le.value));const k=new Intl.Collator(void 0,{numeric:!0}).compare;q.sort((U,H)=>{const K=Re.get(U),X=Re.get(H);return it.sort(K,X,oe.value,k,-1)}),p.value=q},Ot=async()=>{var q;try{A.value=!0;const Re=await((q=n.fetchFunction)==null?void 0:q.call(n,te.value)),{data:k=[],totalRecords:U=0}=(Re==null?void 0:Re.data)??{};ra(U),p.value=k,pe.value=[...p.value],B.value=U}catch(Re){console.error("🚀 ~ reFetch ~ error:",Re)}finally{A.value=!1,g.value={},Mn(wi)}},Ne=async q=>{var U;const Re=m1.cloneDeep(te.value);delete Re.page,delete Re.limit;const{data:k}=await((U=n.fetchFunction)==null?void 0:U.call(n,Re))??{};if(!k&&q)throw new Error;return k??{data:[],totalRecords:0}},Xe=async q=>{if(n.tableName===q.tableName)try{A.value=!0;const{data:Re,totalRecords:k=0}=n.lazy?await Ne():{totalRecords:(n.data??[]).length,data:n.data},U=Qt(Re);C.value=n.includeCheckDisabledRows?Re??[]:xt(Re,U),ra(k)}finally{A.value=!1}},At=(q,Re)=>o==null?void 0:o.headercell({props:n,context:{sortOrder:oe.value,customColumn:Re,sorted:Le.value&&Le.value===(q==null?void 0:q.field),sortable:q==null?void 0:q.sortable}}),Ht=q=>{(!q.tableName||q.tableName===n.tableName)&&Mn(()=>{I.value++,Ot()})},xt=(q,Re)=>(q??[]).filter(k=>!(Re??ae.value).includes(k[n.dataKey])),Qt=(q=[])=>n.disableAllRows?q.map(Re=>Re[n.dataKey]):q.filter(Re=>Re[n.disableKey]).map(Re=>Re[n.dataKey]),vn=async({tableName:q,multiTableNames:Re,fileName:k,additionalTexts:U})=>{if(q!==n.tableName&&!(Re!=null&&Re.includes(n.tableName)))return;const K=_.value.filter(Oe=>Oe.visible!==!1).filter(Oe=>!Oe.excluded),X=K.map(Oe=>Oe.header??Oe.exportHeader??"-"),ne=()=>k.trim().replace(/[^a-zA-Z0-9\s]/g,"-").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/-+$/,"");try{if(nn.off("data-table:download",oi),q===n.tableName){u(!0,"Mengunduh data");const{data:Oe}=n.fetchFunction?await Ne(!0):{data:n.data},_e=(Oe??[]).map(ke=>{const Be={};return K.forEach(Ve=>{const{field:gt,exportField:Rt,dateFormatOptions:Mt}=Ve,vt=Rt??gt,Nt=ss(ke,vt),Jt=Nt===void 0||Nt===""?"-":Nt;if(Ve.includeTruthyProperties){const Fn=Jt??{},Yn=Object.keys(Fn).map(sr=>{if(Fn[sr])return sr}).filter(Boolean);Be[vt]=Yn.join(",")}else if(Array.isArray(Jt)){let Fn=Jt;Ve.arrayValueField&&(Fn=Jt.map(Yn=>Ve.arrayValueField?ss(Yn,Ve.arrayValueField):Yn)),Be[vt]=Fn.join(Fn.length>1?",":"")}else Mt?Be[vt]=j2(new Date(Jt),Mt):Ve.booleanValue?Be[vt]=Jt?"Ya":"Tidak":Be[vt]=Jt}),Be});if(Re!=null&&Re.length){nn.emit("button-download:multi-tables",{table:{headers:X,data:_e,tableName:q,tableTitle:n.tableTitle}});return}await M5({tables:[{headers:X,data:_e,tableName:q,tableTitle:n.tableTitle}],fileName:ne(),additionalTexts:U})}}catch(Oe){console.error(Oe),c.removeAllGroups(),c.add({message:n.excelToastErrorMessage??"Data gagal diunduh.",error:Oe,group:"download"})}finally{u(!1),nn.on("data-table:download",oi)}};kn(async()=>{var q;n.fetchFunction&&(await Ot(),ge()),(q=n.selectedData)!=null&&q.length&&(C.value=n.selectedData),Hn(),v.value&&(v.value.onscroll=wi,new ResizeObserver(wi).observe(S.value))}),Oc(()=>{Sr()}),Lt(()=>n.columns,()=>{n.customColumn||(_.value=n.columns),y.value++}),Lt(()=>n.data,q=>{p.value=q??[],h.value=q??[]}),Lt(C,q=>{r("selectData",q),r("update:selectedData",q),nn.emit("data-table:update-selected-data",{tableName:n.tableName,data:q})},{deep:!0});const Hn=()=>{nn.on("data-table:apply-filter",jn),nn.on("search-table",si),nn.on("data-table:clear-selected-data",Nr),nn.on("data-table:select-all-record",rr),nn.on("data-table:download",oi),nn.on("data-table:import-excel-to-json",Te)},Sr=()=>{nn.off("data-table:update",Ht),nn.off("data-table:apply-filter",jn),nn.off("search-table",si),nn.off("data-table:clear-selected-data",Nr),nn.off("data-table:select-all-record",rr),nn.off("data-table:download",oi),nn.off("data-table:import-excel-to-json",Te)},jn=q=>{q.tableName===n.tableName&&(we.value=q.filter,Ee())},si=q=>{q.tableName===n.tableName&&(ie.value=q.search,Ee())},rr=q=>{q.tableName===n.tableName&&Xe(q)},Nr=q=>{q.tableName===n.tableName&&(C.value=[])},oi=q=>{var Re;(q.tableName===n.tableName||(Re=q.multiTableNames)!=null&&Re.includes(n.tableName))&&vn(q)},hr=q=>{q.code.includes("Digit")||q.code.includes("Numpad")||["ArrowLeft","ArrowRight","Backspace","Delete"].includes(q.code)||q.preventDefault()},wi=()=>{var q,Re,k,U;G.value=(((q=v.value)==null?void 0:q.scrollWidth)??0)-(((Re=v.value)==null?void 0:Re.offsetWidth)??0)-(((k=v.value)==null?void 0:k.scrollLeft)??0)-(((U=T.value)==null?void 0:U.offsetWidth)??0)},ra=q=>{var U;const Re=n.includeCheckDisabledRows?0:(ae.value.length||n.totalDisabledRows)??0,k={total:((n.lazy?q:(U=n.data)==null?void 0:U.length)??0)-Re,tableName:n.tableName};nn.emit("data-table:update-total-record",k)},ge=()=>{nn.on("data-table:update",Ht)},Te=q=>{q.tableName===n.tableName&&(p.value=q.data,pe.value=[...p.value],B.value=q.data.length)},dt=(q,Re,k)=>typeof(q==null?void 0:q.confirmDialogProps)=="function"?q==null?void 0:q.confirmDialogProps(Re,k):q==null?void 0:q.confirmDialogProps;return(q,Re)=>{var k,U,H,K,X,ne,Oe;return x(),F("div",Gt(bn((k=L(o))==null?void 0:k.root)),[le("div",R((U=L(o))==null?void 0:U.tablewrapper,{ref_key:"tableWrapper",ref:v}),[le("div",Gt(bn((H=L(o))==null?void 0:H.scrollheightwrapper({props:n}))),[(x(),F("table",R({id:L(f)},(K=L(o))==null?void 0:K.table,{key:N.value,ref_key:"tableElement",ref:S}),[le("thead",Gt(bn(L(o).thead)),[le("tr",Gt(bn(L(o).headerrow)),[q.reorderable&&!oe.value?(x(),F("th",R({key:0},L(o).headercellreorderable,{class:At().class}),null,16)):ve("",!0),q.selectionType==="checkbox"?(x(),F("th",R({key:1},L(o).headercellcheckbox,{class:At().class}),[ye(Bl,R((X=L(o))==null?void 0:X.headercheckbox({context:{isSelectedAll:ee.value}}),{"model-value":ee.value,"onUpdate:modelValue":Re[0]||(Re[0]=_e=>fe(!!_e)),binary:""}),null,16,["model-value"])],16)):ve("",!0),q.treeTable?(x(),F("th",R({key:2},L(o).headertoggler,{class:At().class}),[ye(ln,R({onClick:Qe},L(o).headertogglerbutton({context:{isExpandedAll:de.value}}),{icon:"arrow-down",text:""}),null,16)],16)):ve("",!0),(x(!0),F(ot,null,en(_.value,_e=>(x(),F("th",R({key:_e.field,class:[_e.headerClass,_e.class],ref_for:!0},At(_e),{onClick:ke=>_e.sortable?Ue(_e.field,ke):null}),[le("span",R({ref_for:!0},L(o).headercellcontent),[le("span",Kre,[cn(ze(_e.header)+" ",1),_e.info?(x(),re(Ft,{key:0,info:_e.info,class:"w-[10px] h-[10px]",icon:"info"},null,8,["info"])):ve("",!0)]),_e.sortable?(x(),re(Ft,{key:0,icon:!Le.value||Le.value!=_e.field?"arrow-up-down":oe.value==1?"sort-asc":"sort-desc",class:"text-base"},null,8,["icon"])):ve("",!0)],16)],16,Wre))),128)),n.customColumn||n.useOption?(x(),F("th",R({key:3},At(void 0,n.customColumn),{id:`column-visibility-toggle-${L(f)}`,style:`right: ${G.value}px`,onClick:Re[1]||(Re[1]=(..._e)=>{var ke,Be;return((ke=he.value)==null?void 0:ke.toggleMenu)&&((Be=he.value)==null?void 0:Be.toggleMenu(..._e))})}),[n.customColumn?(x(),re(Ft,R({key:0},L(o).columnvisibilityicon,{icon:"ellipsis-h","tooltip-pos":"left"}),null,16)):ve("",!0)],16,qre)):ve("",!0)],16)],16),A.value||n.loading?ve("",!0):(x(),F("tbody",Gt(R({key:0},(ne=L(o))==null?void 0:ne.tbody)),[(x(!0),F(ot,null,en(p.value,(_e,ke)=>{var Be,Ve,gt,Rt,Mt,vt,Nt,Jt,Fn,Yn,sr;return x(),F("tr",R({key:ke,id:_e._id,draggable:pt(_e),ref_for:!0},(Be=L(o))==null?void 0:Be.bodyrow({context:{highlighted:_e[q.highlightKey??""],selected:Ge(_e[q.dataKey]),disabled:se(_e[q.dataKey]),draggable:pt(_e),dragging:z.value},props:n}),{onClick:ct=>Ke(ct,_e,ke),onDblclick:ct=>q.treeTable?yt(_e,ke):null,onDrag:Re[11]||(Re[11]=ct=>z.value=!0),onDragenter:On(ct=>tt(ct,_e),["prevent"]),onDragleave:Re[12]||(Re[12]=On(()=>{},["prevent"])),onDragover:Re[13]||(Re[13]=On(()=>{},["prevent"])),onDragstart:ct=>Bt(ct,_e,ke),onDrop:Ut}),[q.reorderable&&!oe.value?(x(),F("td",R({key:0,ref_for:!0},(Ve=L(o))==null?void 0:Ve.bodycell),[!_e.childRow&&!_e.childRowHeader?(x(),re(Ft,{key:0,class:"draggableicon",icon:"dragable-menu"})):ve("",!0)],16)):ve("",!0),q.selectionType==="checkbox"?(x(),F("td",R({key:1,ref_for:!0},(gt=L(o))==null?void 0:gt.bodycell,{onClick:Re[3]||(Re[3]=On(()=>{},["stop"]))}),[!_e.childRow&&!_e.childRowHeader?(x(),re(Bl,R({key:0,ref_for:!0},(Rt=L(o))==null?void 0:Rt.rowcheckbox,{modelValue:C.value,"onUpdate:modelValue":Re[2]||(Re[2]=ct=>C.value=ct),binary:!1,disabled:se(_e[q.dataKey]),value:_e}),null,16,["modelValue","disabled","value"])):ve("",!0)],16)):ve("",!0),q.treeTable?(x(),F("td",R({key:2,ref_for:!0},(Mt=L(o))==null?void 0:Mt.bodycell,{onClick:ct=>{(_e.childRow||_e.childRowHeader)&&ct.stopPropagation()}}),[(vt=_e.children)!=null&&vt.length||_e.hasChildren?(x(),re(ln,R({key:0,onClick:On(ct=>yt(_e,ke),["stop"]),ref_for:!0},L(o).rowtogglerbutton({context:{isRowExpanded:j(_e[q.dataKey])}}),{icon:"arrow-down",text:""}),null,16,["onClick"])):ve("",!0)],16,jre)):ve("",!0),(()=>{var ct;return _e.childRowHeader&&((ct=n.childTableProps)==null?void 0:ct.useColumnsHeader)})()?(x(!0),F(ot,{key:3},en(J.value,ct=>{var Vi,ia;return x(),F("td",{key:ct.header,class:lt([(Vi=L(o))==null?void 0:Vi.bodycell.class,"font-semibold text-xs"]),colspan:ct.colspan??((ia=ct.parentColumnsFields)==null?void 0:ia.length),onClick:Re[4]||(Re[4]=On(()=>{},["stop"]))},ze(ct.header),11,Xre)}),128)):_e.childRowHeader?(x(),F("td",R({key:4,ref_for:!0},L(o).childrowheader,{class:(Nt=L(o))==null?void 0:Nt.bodycell.class,colspan:n.columns.length+1,onClick:Re[5]||(Re[5]=On(()=>{},["stop"]))}),ze(_e.header),17,Zre)):_e.loadingRow?(x(),F("td",{key:5,class:lt((Jt=L(o))==null?void 0:Jt.bodycell.class),colspan:n.columns.length+1,onClick:Re[6]||(Re[6]=On(()=>{},["stop"]))},[le("div",R({ref_for:!0},L(o).loadingtablewrapper),[ye(F0,R({animation:"loading-table",ref_for:!0},L(o).loadingtablelottie),null,16)],16)],10,Jre)):_e.noDataRow?(x(),F("td",{key:6,class:lt((Fn=L(o))==null?void 0:Fn.bodycell.class),colspan:n.columns.length+1,onClick:Re[7]||(Re[7]=On(()=>{},["stop"]))},[le("div",R({ref_for:!0},L(o).nodatalottiewrapper),[ye(F0,R({animation:"no-data",ref_for:!0},L(o).nodatalottie),null,16),s.value.emptyTableMessage?(x(),F("span",R({key:0,ref_for:!0},L(o).nodatamessage),ze(s.value.emptyTableMessage),17)):ve("",!0)],16)],10,eie)):(x(),F(ot,{key:7},[(x(!0),F(ot,null,en(_e.childRow?J.value:_.value,ct=>{var Vi,ia,ga,_a,Oi,io,tl,Cs,As,ao,nl,Y1,so,xs,rl,dr,W1,oo;return x(),F("td",R({key:ct.field,class:[{"!py-0":ct.editable,"!px-0":((Vi=ct.preset)==null?void 0:Vi.type)==="multirow"},typeof ct.bodyClass=="function"?ct.bodyClass(_e):ct.bodyClass,ct.class],colspan:ct.colspan??((ia=ct.parentColumnsFields)==null?void 0:ia.length),ref_for:!0},(ga=L(o))==null?void 0:ga.bodycell),[((_a=ct.preset)==null?void 0:_a.type)==="toggle"||((Oi=ct.preset)==null?void 0:Oi.type)==="checkbox"?(x(),F(ot,{key:0},[((io=ct.preset)==null?void 0:io.type)==="toggle"?(x(),re(vC,{key:0,modelValue:_e[ct.field],"onUpdate:modelValue":[Wn=>_e[ct.field]=Wn,Wn=>wt(Wn,_e,ct)],disabled:se(_e[q.dataKey])||(typeof((tl=ct.preset)==null?void 0:tl.disabled)=="function"?(Cs=ct.preset)==null?void 0:Cs.disabled(_e):(As=ct.preset)==null?void 0:As.disabled),"input-id":_e[q.dataKey],onClick:Re[8]||(Re[8]=On(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue","disabled","input-id"])):ve("",!0),((ao=ct.preset)==null?void 0:ao.type)==="checkbox"?(x(),re(Bl,{key:1,modelValue:_e[ct.field],"onUpdate:modelValue":[Wn=>_e[ct.field]=Wn,Wn=>wt(!!Wn,_e,ct)],disabled:se(_e[q.dataKey])||(typeof((nl=ct.preset)==null?void 0:nl.disabled)=="function"?(Y1=ct.preset)==null?void 0:Y1.disabled(_e):(so=ct.preset)==null?void 0:so.disabled),"input-id":_e[q.dataKey],value:_e[ct.field],onClick:Re[9]||(Re[9]=On(()=>{},["stop"])),binary:""},null,8,["modelValue","onUpdate:modelValue","disabled","input-id","value"])):ve("",!0),(xs=ct.preset)!=null&&xs.confirmDialogProps?(x(),re(z7,R({key:2,list:[_e],visible:!!Z.value[_e[q.dataKey]],onClose:()=>{var zr,gr,Hr;const Wn=()=>_e[ct.field]=!_e[ct.field];((zr=dt(ct.preset,_e[ct.field],_e))==null?void 0:zr.actionable)==!1&&"onConfirm"in ct.preset?(Hr=(gr=ct.preset).onConfirm)==null||Hr.call(gr,_e[ct.field],_e,Wn):Wn()},onConfirm:Wn=>{var zr,gr;return(gr=(zr=ct.preset)==null?void 0:zr.onConfirm)==null?void 0:gr.call(zr,_e[ct.field],_e,()=>_e[ct.field]=!_e[ct.field])},"onUpdate:visible":Wn=>Z.value[_e[q.dataKey]]=Wn,actionable:"",ref_for:!0},dt(ct.preset,_e[ct.field],_e)),null,16,["list","visible","onClose","onConfirm","onUpdate:visible"])):ve("",!0)],64)):((rl=ct.preset)==null?void 0:rl.type)==="multirow"?(x(),re(Hre,{key:1,attributes:((W1=(dr=ct.preset)==null?void 0:dr.fieldAttributes)==null?void 0:W1.call(dr,_e))??[]},null,8,["attributes"])):ct.editable?(x(),F("span",R({key:2,ref_for:!0},L(o).celleditableelement,{contenteditable:ct.editable,onBlur:Wn=>{q.$emit("cellEdited",{item:_e,field:ct.field,index:ke,value:Wn.target.innerText})},onKeypress:Wn=>{ct.numberInputOnly&&hr(Wn)}}),ze(L(ss)(_e,ct.field)||"-"),17,nie)):ct.bodyComponent||ct.bodyClass||ct.bodyTemplate?(x(),F(ot,{key:3},[ct.bodyComponent?(x(),re(on(ct.bodyComponent(_e,ke).component),R({key:0,modelValue:ct.bodyComponent(_e,ke).model,"onUpdate:modelValue":Wn=>ct.bodyComponent(_e,ke).model=Wn,disabled:ct.bodyComponent(_e,ke).disabled,ref_for:!0},ct.bodyComponent(_e,ke).props,gl(ct.bodyComponent(_e,ke).events?ct.bodyComponent(_e,ke).events:{}),{onChange:Wn=>{var zr,gr;return(gr=(zr=ct.bodyComponent(_e,ke)).onChange)==null?void 0:gr.call(zr,_e)},onClick:Re[10]||(Re[10]=On(()=>{},["stop"])),"onUpdate:modelValue":Wn=>{var zr,gr;return(gr=(zr=ct.bodyComponent(_e,ke)).onChange)==null?void 0:gr.call(zr,_e)}}),null,16,["modelValue","onUpdate:modelValue","disabled","onChange"])):(x(),F("span",rie,[ct.bodyTemplate?(x(),F(ot,{key:0},[cn(ze(((oo=ct.bodyTemplate)==null?void 0:oo.call(ct,_e,ke))||"-"),1)],64)):(x(),F(ot,{key:1},[cn(ze(L(ss)(_e,ct.field)||"-"),1)],64))]))],64)):ct.dateFormatOptions?(x(),F(ot,{key:4},[cn(ze(L(j2)(new Date(L(ss)(_e,ct.field)),ct.dateFormatOptions)),1)],64)):(x(),F(ot,{key:5},[cn(ze(L(ss)(_e,ct.field)??"-"),1)],64))],16,tie)}),128)),(()=>{var ct;return(q.useOption||he.value)&&!_e.childRow||_e.childRow&&((ct=q.childTableProps)==null?void 0:ct.useOption)})()?(x(),F("td",R({key:0,ref_for:!0,ref_key:"rowSingleActionCell",ref:T},(Yn=L(o))==null?void 0:Yn.rowsingleactioncell({props:n,context:{selected:Ge(_e[q.dataKey]),highlighted:_e[q.highlightKey??""]}}),{class:L(o).bodycell.class,style:`right: ${G.value}px`}),[q.useOption||(sr=q.childTableProps)!=null&&sr.useOption?(x(),F("div",R({key:0,ref_for:!0},L(o).singleactionwrapper),[ye(ln,R({id:"button-action-"+_e[n.dataKey],ref_for:!0},L(o).singleactionbutton({props:n}),{disabled:q.disableAllRows,onClick:On(ct=>He(ct,_e),["stop"]),icon:"ellipsis-h",outlined:"",size:"small","tooltip-pos":"left",type:"button"}),null,16,["id","disabled","onClick"])],16)):ve("",!0)],16)):ve("",!0)],64))],16,Qre)}),128))],16))],16,Yre))],16),!(A.value||n.loading)&&!((Oe=p.value)!=null&&Oe.length)?(x(),F("div",Gt(R({key:0},L(o).nodatalottiewrapper)),[ye(F0,R({animation:"no-data"},L(o).nodatalottie),null,16),s.value.emptyTableMessage?(x(),F("span",Gt(R({key:0},L(o).nodatamessage)),ze(s.value.emptyTableMessage),17)):ve("",!0)],16)):ve("",!0),A.value||n.loading?(x(),F("div",Gt(R({key:1},L(o).loadingtablewrapper)),[ye(F0,R({animation:"loading-table"},L(o).loadingtablelottie),null,16)],16)):ve("",!0)],16),q.usePaginator?qt((x(),re(L(L7),R({key:N.value,rows:Ye.value,"onUpdate:rows":Re[14]||(Re[14]=_e=>Ye.value=_e)},L(o).paginator({context:{totalRecords:B.value}}),{"rows-per-page-options":l,"total-records":B.value,onPage:me}),{firstpagelinkicon:Ie(()=>[ye(Ft,{icon:"round-keyboard-double-arrow-left"})]),lastpagelinkicon:Ie(()=>[ye(Ft,{icon:"round-keyboard-double-arrow-right"})]),prevpagelinkicon:Ie(()=>[ye(Ft,{icon:"round-keyboard-arrow-left"})]),nextpagelinkicon:Ie(()=>[ye(Ft,{icon:"round-keyboard-arrow-right"})]),_:1},16,["rows","total-records"])),[[li,!(A.value||n.loading)]]):ve("",!0),ye(d3,{id:"single-action-menu",ref_key:"optionMenu",ref:Se,model:q.options,onFocus:L(ine),"append-to":"body","auto-z-index":"",popup:""},null,8,["model","onFocus"]),n.customColumn?(x(),re(zre,{key:y.value,ref_key:"customColumn",ref:he,"visible-columns":_.value,"onUpdate:visibleColumns":Re[15]||(Re[15]=_e=>_.value=_e),"default-columns":q.columns.filter(_e=>_e.visible!==!1),"table-id":L(f)},null,8,["visible-columns","default-columns","table-id"])):ve("",!0),ye(Bre,{group:"download"})],16)}}})),Ei=Ct({__name:"ValidatorMessage",props:{message:{}},setup(t){const e=an("preset",{}).validatormessage;return(n,r)=>{var i;return qt((x(),F("small",R((i=L(e))==null?void 0:i.root,{role:"alert"}),ze(n.message),17)),[[li,n.message]])}}}),H7=bt("Form",Ct({__name:"Form",props:{buttonsTemplate:{},disableSubmit:{type:Boolean},cancelBtnLabel:{default:"Batal"},clearBtnLabel:{default:"Bersihkan Field"},columnPerRow:{},hideFooter:{type:Boolean},hideStayCheckbox:{type:Boolean},invalid:{type:Boolean},resetAfterSubmit:{type:Boolean,default:!0},saveBtnLabel:{default:"Simpan"},submitBtnLabel:{default:"Simpan"},stayCheckboxLabel:{default:"Tetap di halaman ini"},validatorMessage:{default:"Please input all required field!"},validateOnSave:{type:Boolean,default:!1},cancelBtnSeverity:{default:"secondary"},saveBtnSeverity:{default:"success"},submitBtnSeverity:{default:"success"}},emits:["cancel","clear","save","submit"],setup(t,{expose:e,emit:n}){const r=t,i=n;kn(()=>{if(y.value){const Se=r.columnPerRow??1;y.value.style.gridTemplateColumns=`repeat(${Se}, minmax(0, 1fr))`,w()}});const a=an("preset",{}).form,{handleSubmit:s,values:o,resetForm:l,errors:c,resetField:u,setValues:f,setFieldValue:p,setErrors:h}=r3(),g=mt(!1),_=Ze(),v=mt(!1),S=mt(!1),T=mt(0),C=Ze(),E=mt(!1),y=Ze(null),A=Ze(null);wc("isSubmitting",E);const w=()=>{var Se;if(C.value){const pe=(Se=C.value)==null?void 0:Se.offsetHeight;A.value&&(A.value.style.height=`calc(100% + ${pe+20}px)`)}},I=()=>{E.value=!0,S.value||(v.value=!0)},N=()=>{E.value=!0,r.validateOnSave?(S.value||(v.value=!0),z()):V()},z=s(Se=>{const pe=he(Se),we={stayAfterSubmit:g.value,formValues:pe};r.invalid||(i("submit",we),v.value=!1,r.resetAfterSubmit&&(T.value+=1,l())),E.value=!1},()=>{E.value=!1}),V=()=>{const Se=he(o),pe={stayAfterSubmit:g.value,formValues:Se};i("save",pe),E.value=!1},G=()=>{l(),T.value++,i("clear"),v.value=!1},he=Se=>{const pe=Se,we=Object.keys(pe);for(const ie of we)typeof pe[ie]=="string"&&(pe[ie]=pe[ie].trim());return pe};return e({stayAfterSubmit:g,submit:z,onSubmitClicked:I,showValidator:v,formElement:_,clearField:G,resetField:u,errors:c,setOuterFieldsWrapperHeight:w,setValues:f,setFieldValue:p,setErrors:h}),(Se,pe)=>{var we,ie,Le,oe,$e,Ye,B,Z,J,te,de,ee,ae,j,se;return x(),F("form",R({ref_key:"formElement",ref:_},(we=L(a))==null?void 0:we.root({props:r}),{onInput:pe[2]||(pe[2]=Ge=>v.value=!1),onSubmit:pe[3]||(pe[3]=On((...Ge)=>L(z)&&L(z)(...Ge),["prevent"]))}),[le("div",{ref_key:"outerFieldsWrapper",ref:A},[le("div",R({ref_key:"fieldsWrapper",ref:y},(ie=L(a))==null?void 0:ie["fields-wrapper"]),[Fe(Se.$slots,"fields",{key:T.value,formValues:L(o)})],16)],512),Se.hideFooter?ve("",!0):(x(),F("div",R({key:0,ref_key:"footer",ref:C},(Le=L(a))==null?void 0:Le.footer),[Se.hideStayCheckbox?ve("",!0):(x(),F("div",Gt(R({key:0},(oe=L(a))==null?void 0:oe.staycheckbox)),[ye(Bl,{modelValue:g.value,"onUpdate:modelValue":pe[0]||(pe[0]=Ge=>g.value=Ge),label:Se.stayCheckboxLabel},null,8,["modelValue","label"])],16)),le("div",Gt(bn(($e=L(a))==null?void 0:$e["action-buttons"])),[le("div",Gt(bn((Ye=L(a))==null?void 0:Ye["button-wrapper"])),[(B=r.buttonsTemplate)!=null&&B.includes("cancel")?(x(),re(ln,R({key:0},(Z=L(a))==null?void 0:Z["cancel-button"],{label:Se.cancelBtnLabel,severity:Se.cancelBtnSeverity,onClick:pe[1]||(pe[1]=Ge=>Se.$emit("cancel")),"data-test":"cancel-button",text:"",type:"button"}),null,16,["label","severity"])):ve("",!0),(J=r.buttonsTemplate)!=null&&J.includes("clear")?(x(),re(ln,R({key:1},(te=L(a))==null?void 0:te["clear-button"],{label:Se.clearBtnLabel,onClick:G,text:"",type:"button"}),null,16,["label"])):ve("",!0),(de=r.buttonsTemplate)!=null&&de.includes("save")?(x(),re(ln,R({key:2},(ee=L(a))==null?void 0:ee["save-button"],{label:Se.saveBtnLabel,severity:Se.saveBtnSeverity,onClick:N,outlined:"",type:"button"}),null,16,["label","severity"])):ve("",!0),(ae=r.buttonsTemplate)!=null&&ae.includes("submit")?(x(),re(ln,R({key:3},(j=L(a))==null?void 0:j["submit-button"],{disabled:Se.disableSubmit,label:Se.submitBtnLabel,severity:Se.submitBtnSeverity,onClick:I,type:"submit"}),null,16,["disabled","label","severity"])):ve("",!0)],16),qt(ye(Ei,R((se=L(a))==null?void 0:se["validator-message"],{message:Se.validatorMessage}),null,16,["message"]),[[li,v.value||r.invalid]])],16)],16))],16)}}})),aie=bt("DialogForm",Ct({__name:"DialogForm",props:{buttonsTemplate:{},header:{},visible:{type:Boolean},asideRightWidth:{default:260},class:{},cancelBtnLabel:{},clearBtnLabel:{},closable:{type:Boolean,default:!0},closeOnSubmit:{type:Boolean,default:!0},contentClass:{},dateHeader:{},headerIcon:{},invalid:{type:Boolean},resetAfterSubmit:{type:Boolean,default:!0},severity:{},showStayCheckbox:{type:Boolean,default:void 0},stayCheckboxLabel:{},submitBtnLabel:{},validatorMessage:{},validationFunction:{},width:{default:"small"},disableSubmit:{type:Boolean},columnPerRow:{default:1},hideFooter:{type:Boolean},hideStayCheckbox:{type:Boolean},saveBtnLabel:{},validateOnSave:{type:Boolean},cancelBtnSeverity:{},saveBtnSeverity:{},submitBtnSeverity:{}},emits:["clear","close","hide","show","submit","update:visible"],setup(t,{expose:e,emit:n}){const r=t,i=n,a=zp(),{locale:s}=br("DialogForm"),o=an("preset",{}).dialog,l=an("preset",{}).dialogform,c=Ze(),u=Ze(),f=mt(0),p=mt(!1),h=mt(!1),g=Ze({stayAfterSubmit:!1,formValues:{}}),_=We(()=>{const y=a["aside-right"]&&h.value?r.asideRightWidth:0;return`calc(${{small:400,medium:500,large:572,"semi-xlarge":600,xlarge:800}[r.width]}px + ${y}px)`}),v=()=>{i("update:visible",!1),i("close")},S=()=>{c.value&&!r.invalid&&!r.validatorMessage&&(c.value.onSubmitClicked(),c.value.submit())},T=()=>{c.value&&c.value.clearField(),i("clear")},C=async y=>{r.validationFunction&&await r.validationFunction(y.formValues),!r.invalid&&!r.validatorMessage&&(g.value=y,a.confirm?p.value=!0:E())},E=async y=>{const{stayAfterSubmit:A}=g.value;if(!A&&r.closeOnSubmit&&i("update:visible",!1),a.confirm)try{await(y==null?void 0:y(g.value))}catch(w){console.error(w)}else i("submit",g.value);r.resetAfterSubmit&&T()};return e({form:c,clearField:T,setValues:y=>{var A;(A=c.value)==null||A.setValues(y)},setFieldValue:(y,A,w)=>{var I;(I=c.value)==null||I.setFieldValue(y,A,w)},setErrors:y=>{var A;(A=c.value)==null||A.setErrors(y)}}),(y,A)=>{var w,I,N,z;return x(),re(L(H0),R({ref_key:"dialogForm",ref:u},(w=L(l))==null?void 0:w.root,{class:r.class,closable:y.closable,draggable:!1,header:y.header,pt:{root:{class:[...(I=L(o))==null?void 0:I.root({state:{}}).class,...(N=L(l))==null?void 0:N.root.class],style:(z=L(l))==null?void 0:z.root.style(_.value)}},visible:y.visible,onHide:A[3]||(A[3]=V=>i("hide")),onShow:A[4]||(A[4]=V=>i("show")),"onUpdate:visible":A[5]||(A[5]=V=>i("update:visible",!!V)),modal:""}),{container:Ie(()=>{var V,G,he,Se,pe,we,ie,Le;return[le("div",Gt(bn((V=L(l))==null?void 0:V.container(h.value))),[le("section",R((G=L(l))==null?void 0:G.mainsection,{id:"main"}),[le("div",Gt(bn((he=L(l))==null?void 0:he.header)),[Fe(y.$slots,"header",{},()=>{var oe,$e,Ye,B;return[y.headerIcon?(x(),re(Ft,R({key:0},(oe=L(l))==null?void 0:oe.headericon,{icon:y.headerIcon,severity:y.severity,"aria-label":"Header Icon"}),null,16,["icon","severity"])):ve("",!0),le("h3",Gt(bn(($e=L(l))==null?void 0:$e.headertitle)),ze(y.header),17),y.$slots["aside-right"]?(x(),re(ln,R({key:1},(Ye=L(l))==null?void 0:Ye.expandasidebutton,{label:h.value?L(s).asideRightExpandedButtonLabel:L(s).asideRightCollapsedButtonLabel,onClick:A[0]||(A[0]=Z=>h.value=!h.value),text:""}),null,16,["label"])):ve("",!0),y.closable?(x(),re(ln,R({key:2,onClick:v},(B=L(l))==null?void 0:B.closedialog,{icon:"close","icon-class":"w-[22px] h-[22px]",rounded:"",severity:"secondary",text:""}),null,16)):ve("",!0)]})],16),ye(H7,R((Se=L(l))==null?void 0:Se.form,{ref_key:"form",ref:c,"buttons-template":y.buttonsTemplate,"column-per-row":y.columnPerRow,"reset-after-submit":y.resetAfterSubmit,onSubmit:C,"hide-footer":""}),{fields:Ie(({formValues:oe})=>[Fe(y.$slots,"fields",{key:f.value,formValues:oe})]),_:3},16,["buttons-template","column-per-row","reset-after-submit"]),Fe(y.$slots,"confirm",{hide:()=>p.value=!1,submit:E,visible:p.value}),le("div",Gt(bn((pe=L(l))==null?void 0:pe.footer)),[y.showStayCheckbox?(x(),re(Bl,{key:0,label:y.stayCheckboxLabel??L(s).stayCheckboxLabel,"model-value":(we=c.value)==null?void 0:we.stayAfterSubmit,"onUpdate:modelValue":A[1]||(A[1]=oe=>c.value&&(c.value.stayAfterSubmit=oe))},null,8,["label","model-value"])):ve("",!0),qt(ye(Ei,{format:!1,message:y.validatorMessage},null,8,["message"]),[[li,y.invalid&&y.validatorMessage]]),r.buttonsTemplate.length?(x(),F("div",Gt(R({key:1},(ie=L(l))==null?void 0:ie.footerbutton)),[Fe(y.$slots,"actionButtons",{submit:S},()=>{var oe,$e,Ye,B,Z,J;return[(oe=r.buttonsTemplate)!=null&&oe.includes("cancel")?(x(),re(ln,R({key:0},($e=L(l))==null?void 0:$e.cancelbtn,{label:y.cancelBtnLabel??L(s).cancelBtnLabel,onClick:A[2]||(A[2]=te=>(i("close"),i("update:visible",!1))),severity:"dark",text:""}),null,16,["label"])):ve("",!0),(Ye=r.buttonsTemplate)!=null&&Ye.includes("clear")?(x(),re(ln,R({key:1},(B=L(l))==null?void 0:B.clearfield,{label:y.clearBtnLabel??L(s).clearBtnLabel,onClick:T,class:"whitespace-nowrap",text:""}),null,16,["label"])):ve("",!0),(Z=r.buttonsTemplate)!=null&&Z.includes("submit")?(x(),re(ln,R({key:2},(J=L(l))==null?void 0:J.savesubmitbutton,{label:y.submitBtnLabel??L(s).submitBtnLabel,severity:r.severity==="primary"?void 0:r.severity??"success",onClick:S}),null,16,["label","severity"])):ve("",!0)]})],16)):ve("",!0)],16)],16),y.$slots["aside-right"]?(x(),F("aside",Gt(R({key:0},(Le=L(l))==null?void 0:Le.asidesection(h.value,y.asideRightWidth))),[Fe(y.$slots,"aside-right")],16)):ve("",!0)],16)]}),_:3},16,["class","closable","header","pt","visible"])}}})),da=Ct({__name:"FieldWrapper",props:{label:{},mandatory:{type:Boolean},showOptionalText:{type:Boolean,default:void 0},showAsterisk:{type:Boolean,default:void 0},info:{},labelClass:{},tooltipPos:{}},setup(t){const e=t,{defaultProps:n,locale:r}=br("FieldWrapper"),i=We(()=>as(e,n)),a=an("preset",{}).fieldwrapper;return(s,o)=>s.$attrs["use-field-wrapper"]!=!1?(x(),F("div",Gt(R({key:0},L(a).root)),[s.label?(x(),F("label",Gt(R({key:0},L(a).label({props:e}))),[cn(ze(s.label)+" ",1),s.mandatory&&i.value.showAsterisk?(x(),F("span",Gt(R({key:0},L(a).arterisksign)),ze(L(r).labelRequired),17)):ve("",!0),s.info?(x(),re(Ft,R({key:1,info:s.info,"tooltip-pos":i.value.tooltipPos},L(a).info,{icon:"info"}),null,16,["info","tooltip-pos"])):ve("",!0),s.mandatory==!1&&i.value.showOptionalText?(x(),F("span",Gt(R({key:2},L(a).optionaltext)),ze(L(r).labelOptional),17)):ve("",!0)],16)):ve("",!0),Fe(s.$slots,"default")],16)):Fe(s.$slots,"default",{key:1})}});var sie={root:"p-inputgroup"},oie=$n.extend({name:"inputgroup",classes:sie}),lie={name:"BaseInputGroup",extends:Cn,style:oie,provide:function(){return{$parentInstance:this}}},Y7={name:"InputGroup",extends:lie,inheritAttrs:!1};function cie(t,e,n,r,i,a){return x(),F("div",R({class:t.cx("root")},t.ptmi("root")),[Fe(t.$slots,"default")],16)}Y7.render=cie;const ko=Ct({__name:"InputGroup",props:{pt:{},ptOptions:{},ring:{},unstyled:{type:Boolean},invalid:{type:Boolean},disabled:{type:Boolean}},setup(t){const e=an("preset",{}).inputgroup,n=r=>{const i=r.target;if(i){const a=i.querySelector("input");a==null||a.focus()}};return(r,i)=>r.$attrs["use-input-group"]!=!1?(x(),re(L(Y7),R({key:0},L(e).root({props:{...r.$props,class:r.$attrs.class}}),{onClick:n}),{default:Ie(()=>[Fe(r.$slots,"default")]),_:3},16)):Fe(r.$slots,"default",{key:1})}});var uie={root:"p-inputgroup-addon"},die=$n.extend({name:"inputgroupaddon",classes:uie}),fie={name:"BaseInputGroupAddon",extends:Cn,style:die,provide:function(){return{$parentInstance:this}}},$l={name:"InputGroupAddon",extends:fie,inheritAttrs:!1};function pie(t,e,n,r,i,a){return x(),F("div",R({class:t.cx("root")},t.ptmi("root")),[Fe(t.$slots,"default")],16)}$l.render=pie;const Mv=bt("Dropdown",Ct({__name:"Dropdown",props:{modelValue:{type:[String,Number,Boolean,Object],default:void 0},initialValue:{type:[String,Number,Boolean,Object]},label:{},options:{},optionLabel:{},optionValue:{},valueType:{default:"plain"},badgeValueProps:{},inputBorder:{},dataKey:{},useValidator:{type:Boolean},mandatory:{type:Boolean},showOptionalText:{type:Boolean,default:void 0},validatorMessage:{},formatValidatorMessage:{type:Boolean,default:!0},invalid:{type:Boolean},fieldName:{},placeholder:{},loading:{type:Boolean},fieldInfo:{},disabled:{type:Boolean},filter:{type:Boolean,default:!0},filterPlaceholder:{}},emits:["update:modelValue","show"],setup(t,{expose:e,emit:n}){const r=t,i=n;kn(()=>{_()});const{locale:a}=br("Dropdown"),s=an("preset",{}).dropdown,o=an("preset",{}).inputgroupaddon,l=Ze(),c=mt(!1),u=We(()=>r.invalid||!!f.errorMessage),f=_r({value:r.initialValue?r.initialValue:r.modelValue}),p=We(()=>{var E;return a.emptySelectionErrorMessage.replace("{label}",r.label).replace("{formattedLabel}",(E=gh(r.label))==null?void 0:E.toLowerCase())}),h=We(()=>P5(r.options)),g=We(()=>{var E;return r.loading?a.loadingPlaceholder:r.placeholder??((E=a.inputPlaceholder)==null?void 0:E.replace("{label}",r.label??"").replace("{lowercaseLabel}",(r.label??"").toLowerCase()))}),_=()=>{r.useValidator&&(Object.assign(f,pi(r.fieldName??"dropdown",E=>!(E!=null&&E!=="")&&r.mandatory?typeof r.validatorMessage=="object"&&"empty"in r.validatorMessage?r.validatorMessage.empty:r.validatorMessage??p.value:Mn(v))),r.initialValue&&(f.value=r.initialValue),r.invalid&&f.validate())},v=()=>r.validatorMessage&&r.invalid?r.validatorMessage:!0,S=E=>{const{value:y}=E;i("update:modelValue",y)},T=()=>{if(r.optionValue){const E=h.value.find(y=>{if(typeof y!="string")return r.dataKey?f.value[r.dataKey]===y[r.optionValue??""][r.dataKey]:m1.isEqual(m1.cloneDeep(y[r.optionValue??""]),m1.cloneDeep(f.value))});if(E&&typeof E!="string")return E[r.optionLabel??""]}else if(f.value&&typeof f.value=="object"&&r.optionLabel&&r.optionLabel in f.value)return f.value[r.optionLabel];return f.value},C=()=>{l.value&&l.value.show()};return Lt(()=>r.initialValue,E=>{f.value=E},{once:!0}),Lt(()=>r.modelValue,E=>{f.value=E}),e({showOverlay:C}),(E,y)=>(x(),re(da,{info:E.fieldInfo,label:r.label,mandatory:r.mandatory,"show-optional-text":E.showOptionalText},{default:Ie(()=>[ye(ko,{class:lt([{"grid grid-cols-[max-content,1fr,max-content]":E.$slots["addon-left"]&&E.$slots["addon-right"],"grid grid-cols-[1fr,max-content]":!E.$slots["addon-left"]&&E.$slots["addon-right"],"grid grid-cols-[max-content,1fr]":E.$slots["addon-left"]&&!E.$slots["addon-right"]}]),disabled:r.disabled,invalid:u.value,ring:E.inputBorder},{default:Ie(()=>{var A,w;return[E.$slots["addon-left"]?(x(),re(L($l),{key:0,disabled:r.disabled},{default:Ie(()=>[Fe(E.$slots,"addon-left")]),_:3},8,["disabled"])):ve("",!0),ye(L(No),R({ref_key:"dropdown",ref:l},r,{modelValue:f.value,"onUpdate:modelValue":y[0]||(y[0]=I=>f.value=I),"aria-describedby":r.label+"error","filter-placeholder":r.filterPlaceholder||L(a).filterPlaceholder,invalid:u.value,options:h.value,placeholder:g.value,pt:{wrapper:(A=L(s))==null?void 0:A.wrapper({props:r})},"virtual-scroller-options":((w=h.value)==null?void 0:w.length)>10?{itemSize:32}:void 0,onChange:S,onHide:y[1]||(y[1]=I=>c.value=!1),onShow:y[2]||(y[2]=I=>(E.$emit("show"),c.value=!0))}),$i({dropdownicon:Ie(()=>[ye(Ft,Gt(bn(L(s).dropdownicon({state:{isShowOverlay:c.value}}))),null,16)]),loadingicon:Ie(()=>[ye(Ft,Gt(bn(L(s).loadingicon)),null,16)]),filtericon:Ie(()=>[ye(Ft,Gt(bn(L(s).filtericon)),null,16)]),_:2},[E.loading?{name:"value",fn:Ie(({placeholder:I})=>[le("span",Gt(bn(L(s).loadingplaceholder)),ze(I),17)]),key:"0"}:{name:"value",fn:Ie(I=>[I.value!==void 0?Fe(E.$slots,"value",{key:0,originalValue:I.value,value:T()},()=>[E.valueType==="badge"?(x(),re(Fl,R({key:0},E.badgeValueProps,{label:T()}),null,16,["label"])):(x(),F(ot,{key:1},[cn(ze(T()),1)],64))]):(x(),F(ot,{key:1},[cn(ze(I.placeholder),1)],64))]),key:"1"},E.$slots.option?{name:"option",fn:Ie(({option:I})=>[Fe(E.$slots,"option",{option:I})]),key:"2"}:void 0]),1040,["modelValue","aria-describedby","filter-placeholder","invalid","options","placeholder","pt","virtual-scroller-options"]),E.$slots["addon-right"]?(x(),re(L($l),{key:1,pt:{root:L(o).root({props:{class:[{"!text-general-200":r.disabled}]}})}},{default:Ie(()=>[Fe(E.$slots,"addon-right")]),_:3},8,["pt"])):ve("",!0)]}),_:3},8,["class","disabled","invalid","ring"]),ye(Ei,{id:r.label+"error",message:f.errorMessage},null,8,["id","message"])]),_:3},8,["info","label","mandatory","show-optional-text"]))}}));function Mi(t){this.content=t}Mi.prototype={constructor:Mi,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),a=r.content.slice();return i==-1?a.push(n||t,e):(a[i+1]=e,n&&(a[i]=n)),new Mi(a)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Mi(n)},addToStart:function(t,e){return new Mi([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Mi(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),a=r.find(t);return i.splice(a==-1?i.length:a,0,e,n),new Mi(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Mi.from(t),t.size?new Mi(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Mi.from(t),t.size?new Mi(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Mi.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},Mi.from=function(t){if(t instanceof Mi)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Mi(e)};function W7(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),a=e.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let s=0;i.text[s]==a.text[s];s++)n++;return n}if(i.content.size||a.content.size){let s=W7(i.content,a.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function K7(t,e,n,r){for(let i=t.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let s=t.child(--i),o=e.child(--a),l=s.nodeSize;if(s==o){n-=l,r-=l;continue}if(!s.sameMarkup(o))return{a:n,b:r};if(s.isText&&s.text!=o.text){let c=0,u=Math.min(s.text.length,o.text.length);for(;c<u&&s.text[s.text.length-c-1]==o.text[o.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||o.content.size){let c=K7(s.content,o.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class St{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,a){for(let s=0,o=0;o<n;s++){let l=this.content[s],c=o+l.nodeSize;if(c>e&&r(l,i+o,a||null,s)!==!1&&l.content.size){let u=o+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,i+u)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let a="",s=!0;return this.nodesBetween(e,n,(o,l)=>{let c=o.isText?o.text.slice(Math.max(e,l)-l,n-l):o.isLeaf?i?typeof i=="function"?i(o):i:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&r&&(s?s=!1:a+=r),a+=c},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<e.content.length;a++)i.push(e.content[a]);return new St(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let a=0,s=0;s<n;a++){let o=this.content[a],l=s+o.nodeSize;l>e&&((s<e||l>n)&&(o.isText?o=o.cut(Math.max(0,e-s),Math.min(o.text.length,n-s)):o=o.cut(Math.max(0,e-s-1),Math.min(o.content.size,n-s-1))),r.push(o),i+=o.nodeSize),s=l}return new St(r,i)}cutByIndex(e,n){return e==n?St.empty:e==0&&n==this.content.length?this:new St(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new St(i,a)}addToStart(e){return new St([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new St(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return W7(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return K7(this,e,n,r)}findIndex(e,n=-1){if(e==0)return g3(0,e);if(e==this.size)return g3(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let a=this.child(r),s=i+a.nodeSize;if(s>=e)return s==e||n>0?g3(r+1,s):g3(r,i);i=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return St.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new St(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return St.empty;let n,r=0;for(let i=0;i<e.length;i++){let a=e[i];r+=a.nodeSize,i&&a.isText&&e[i-1].sameMarkup(a)?(n||(n=e.slice(0,i)),n[n.length-1]=a.withText(n[n.length-1].text+a.text)):n&&n.push(a)}return new St(n||e,r)}static from(e){if(!e)return St.empty;if(e instanceof St)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new St([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}St.empty=new St([],0);const Lv={index:0,offset:0};function g3(t,e){return Lv.index=t,Lv.offset=e,Lv}function _3(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!_3(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!_3(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Er=class ry{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let a=e[i];if(this.eq(a))return e;if(this.type.excludes(a.type))n||(n=e.slice(0,i));else{if(a.type.excludes(this.type))return e;!r&&a.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(a)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&_3(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ry.none;if(e instanceof ry)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};Er.none=[];class v3 extends Error{}class $t{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Q7(this.content,e+this.openStart,n);return r&&new $t(r,this.openStart,this.openEnd)}removeBetween(e,n){return new $t(q7(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return $t.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new $t(St.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)r++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)i++;return new $t(e,r,i)}}$t.empty=new $t(St.empty,0,0);function q7(t,e,n){let{index:r,offset:i}=t.findIndex(e),a=t.maybeChild(r),{index:s,offset:o}=t.findIndex(n);if(i==e||a.isText){if(o!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,a.copy(q7(a.content,e-i-1,n-i-1)))}function Q7(t,e,n,r){let{index:i,offset:a}=t.findIndex(e),s=t.maybeChild(i);if(a==e||s.isText)return t.cut(0,e).append(n).append(t.cut(e));let o=Q7(s.content,e-a-1,n);return o&&t.replaceChild(i,s.copy(o))}function mie(t,e,n){if(n.openStart>t.depth)throw new v3("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new v3("Inconsistent open depths");return j7(t,e,n,0)}function j7(t,e,n,r){let i=t.index(r),a=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=j7(t,e,n,r+1);return a.copy(a.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,o=s.content;return Hl(s,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:s,end:o}=hie(n,t);return Hl(a,Z7(t,s,o,e,r))}else return Hl(a,b3(t,e,r))}function X7(t,e){if(!e.type.compatibleContent(t.type))throw new v3("Cannot join "+e.type.name+" onto "+t.type.name)}function Pv(t,e,n){let r=t.node(n);return X7(r,e.node(n)),r}function zl(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function sd(t,e,n,r){let i=(e||t).node(n),a=0,s=e?e.index(n):i.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(zl(t.nodeAfter,r),a++));for(let o=a;o<s;o++)zl(i.child(o),r);e&&e.depth==n&&e.textOffset&&zl(e.nodeBefore,r)}function Hl(t,e){return t.type.checkContent(e),t.copy(e)}function Z7(t,e,n,r,i){let a=t.depth>i&&Pv(t,e,i+1),s=r.depth>i&&Pv(n,r,i+1),o=[];return sd(null,t,i,o),a&&s&&e.index(i)==n.index(i)?(X7(a,s),zl(Hl(a,Z7(t,e,n,r,i+1)),o)):(a&&zl(Hl(a,b3(t,e,i+1)),o),sd(e,n,i,o),s&&zl(Hl(s,b3(n,r,i+1)),o)),sd(r,null,i,o),new St(o)}function b3(t,e,n){let r=[];if(sd(null,t,n,r),t.depth>n){let i=Pv(t,e,n+1);zl(Hl(i,b3(t,e,n+1)),r)}return sd(e,null,n,r),new St(r)}function hie(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)i=e.node(a).copy(St.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class od{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let a=0;a<e;a++)i+=r.child(a).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Er.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let o=r;r=i,i=o}let a=r.marks;for(var s=0;s<a.length;s++)a[s].type.spec.inclusive===!1&&(!i||!a[s].isInSet(i.marks))&&(a=a[s--].removeFromSet(a));return a}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var a=0;a<r.length;a++)r[a].type.spec.inclusive===!1&&(!i||!r[a].isInSet(i.marks))&&(r=r[a--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new E3(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,a=n;for(let s=e;;){let{index:o,offset:l}=s.content.findIndex(a),c=a-l;if(r.push(s,o,i+l),!c||(s=s.child(o),s.isText))break;a=c-1,i+=l+1}return new od(n,r,a)}static resolveCached(e,n){let r=J7.get(e);if(r)for(let a=0;a<r.elts.length;a++){let s=r.elts[a];if(s.pos==n)return s}else J7.set(e,r=new gie);let i=r.elts[r.i]=od.resolve(e,n);return r.i=(r.i+1)%_ie,i}}class gie{constructor(){this.elts=[],this.i=0}}const _ie=12,J7=new WeakMap;class E3{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const vie=Object.create(null);let Yl=class iy{constructor(e,n,r,i=Er.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||St.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&_3(this.attrs,n||e.defaultAttrs||vie)&&Er.sameSet(this.marks,r||Er.none)}copy(e=null){return e==this.content?this:new iy(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new iy(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return $t.empty;let i=this.resolve(e),a=this.resolve(n),s=r?0:i.sharedDepth(n),o=i.start(s),c=i.node(s).content.cut(i.pos-o,a.pos-o);return new $t(c,i.depth-s,a.depth-s)}replace(e,n,r){return mie(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return od.resolveCached(this,e)}resolveNoCache(e){return od.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,a=>(r.isInSet(a.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),eO(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=St.empty,i=0,a=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,a),o=s&&s.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let l=i;l<a;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let a=this.contentMatchAt(e).matchType(r),s=a&&a.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Er.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Er.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=St.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,i,r);return a.type.checkAttrs(a.attrs),a}};Yl.prototype.text=void 0;class S3 extends Yl{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):eO(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new S3(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new S3(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function eO(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Wl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new bie(e,n);if(r.next==null)return Wl.empty;let i=tO(r);r.next&&r.err("Unexpected trailing text");let a=xie(Aie(i));return wie(a,r),a}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let a=n;i&&a<r;a++)i=i.matchType(e.child(a).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function a(s,o){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return St.from(o.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:f}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let p=a(f,o.concat(u));if(p)return p}}return null}return a(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),a=i.match;if(a.matchType(e)){let s=[];for(let o=i;o.type;o=o.via)s.push(o.type);return s.reverse()}for(let s=0;s<a.next.length;s++){let{type:o,next:l}=a.next[s];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!i.type||l.validEnd)&&(r.push({match:o.contentMatch,type:o,via:i}),n[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let a=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)a+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return a}).join(`
|
|
329
|
+
`)}this.styleElement.innerHTML=n}},destroyStyle:function(){this.styleElement&&(document.head.removeChild(this.styleElement),this.styleElement=null)}},computed:{attributeSelector:function(){return ui()}},components:{ToastMessage:P7,Portal:Hs}};function id(t){"@babel/helpers - typeof";return id=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},id(t)}function U7(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function V7(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?U7(Object(n),!0).forEach(function(r){Mre(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):U7(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Mre(t,e,n){return e=Lre(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Lre(t){var e=Pre(t,"string");return id(e)=="symbol"?e:String(e)}function Pre(t,e){if(id(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(id(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Fre(t,e,n,r,i,a){var s=Kt("ToastMessage"),o=Kt("Portal");return x(),re(o,null,{default:Ie(function(){return[le("div",R({ref:"container",class:t.cx("root"),style:t.sx("root",!0,{position:t.position})},t.ptmi("root")),[ye(oy,R({name:"p-toast-message",tag:"div",onEnter:a.onEnter,onLeave:a.onLeave},V7(V7({},t.ptm("message")),t.ptm("transition"))),{default:Ie(function(){return[(x(!0),F(ot,null,en(i.messages,function(l){return x(),re(s,{key:l.id,message:l,templates:t.$slots,closeIcon:t.closeIcon,infoIcon:t.infoIcon,warnIcon:t.warnIcon,errorIcon:t.errorIcon,successIcon:t.successIcon,closeButtonProps:t.closeButtonProps,onClose:e[0]||(e[0]=function(c){return a.remove(c)}),pt:t.pt},null,8,["message","templates","closeIcon","infoIcon","warnIcon","errorIcon","successIcon","closeButtonProps","pt"])}),128))]}),_:1},16,["onEnter","onLeave"])],16)]}),_:1})}B7.render=Fre;const Bre=bt("Toast",Ct({__name:"Toast",props:{group:{default:"default-toast"},position:{default:"bottom-right"},autoZIndex:{type:Boolean},baseZIndex:{default:9980},breakpoints:{},message:{},icon:{},pt:{},ptOptions:{},unstyled:{type:Boolean}},emits:["close","lifeEnd"],setup(t){const e=t;kn(()=>{nn.on("toast:add",i)}),m2(()=>{window.toastGroups&&window.toastGroups.includes(e.group)?r.value=!1:(window.toastGroups=[e.group,...window.toastGroups??[]],r.value=!0)}),Z1(()=>{var a;window.toastGroups=(a=window.toastGroups)==null?void 0:a.filter(s=>s!==e.group),nn.off("toast:add",i)});const n=mt(),r=mt(!1),i=a=>{a.group===e.group&&(n.value=a),a.error&&console.error(a.error)};return(a,s)=>r.value?(x(),re(L(B7),R({key:0},a.$props,{"data-group":a.$props.group,onClose:s[0]||(s[0]=o=>a.$emit("close",o)),onLifeEnd:s[1]||(s[1]=o=>a.$emit("lifeEnd",o))}),$i({icon:Ie(()=>{var o,l,c;return[(o=n.value)!=null&&o.icon?(x(),re(Ft,{key:0,class:lt(["w-5 h-5 text-inherit",(l=n.value)==null?void 0:l.iconClass]),icon:(c=n.value)==null?void 0:c.icon},null,8,["class","icon"])):ve("",!0)]}),_:2},[a.$slots.container?{name:"container",fn:Ie(({message:o,closeCallback:l})=>[Fe(a.$slots,"container",{closeCallback:l,message:o})]),key:"0"}:void 0,a.$slots.message?{name:"message",fn:Ie(({message:o})=>[Fe(a.$slots,"message",{message:o})]),key:"1"}:void 0]),1040,["data-group"])):ve("",!0)}})),ad="tableConfigs",Ure=()=>"user-"+(JSON.parse(localStorage.getItem("user")??"{}")._id??"unknown"),G7=async()=>{let t=null;return new Promise(e=>{const n=indexedDB.open(Ure(),1);n.onupgradeneeded=r=>{t=r.target.result,t.createObjectStore(ad)},n.onsuccess=r=>{t=r.target.result,e(t)}})},Vre=async()=>{const n=(await G7()).transaction(ad,"readonly").objectStore(ad);return new Promise(r=>{let i,a;n.getAllKeys().onsuccess=s=>{i=s.target.result},n.getAll().onsuccess=s=>{a=s.target.result;const o={};i.forEach((l,c)=>{o[l]=a[c]}),r(o)}})},kv=_r({}),$7=async()=>{const t=async(e,n)=>{kv[e]=n,(await G7()).transaction(ad,"readwrite").objectStore(ad).put(n,e)};return Object.assign(kv,await Vre()),{config:kv,setConfig:t}};async function Gre(t,e){const{config:n}=await $7(),r=n[t];return r?r.map(i=>{const a=e.find(s=>s.field===i.field);if(!(!a||a.visible===!1))return{...a,...i}}).filter(i=>!!i):e}const $re=["id","data-item-dragable","draggable","onDragenter","onDragstart"],zre=Ct({__name:"CustomColumn",props:{tableId:{},defaultColumns:{},visibleColumns:{},maxColumn:{},type:{default:"menu"}},emits:["update:visibleColumns"],setup(t,{expose:e,emit:n}){const r=t,i=n;kn(async()=>{c.value=await Gre(r.tableId,m1.cloneDeep(r.defaultColumns)),C()});const{locale:a}=br("CustomColumn"),s=an("preset",{}).menu,o=an("preset",{}).customcolumn,l=We(()=>r.maxColumn?T.value.length>=r.maxColumn:!1),c=Ze([]),u=mt(),f=Ze(),p=We(()=>"column-visibility-menu-"+r.tableId),h=We({get:()=>r.visibleColumns,set:G=>{i("update:visibleColumns",G.filter(he=>he.visible!=!1))}}),g=G=>{if(f.value&&"toggle"in f.value){const he=G.currentTarget??G.target,Se=he.tagName.toLowerCase()==="th"?he:he.parentElement,pe={...G,currentTarget:Se};f.value.toggle(pe),Mn(()=>{const we=document.getElementById(p.value);if(we){const ie=window.innerWidth,Le=document.getElementById(`column-visibility-toggle-${r.tableId}`);if(Le){const{right:oe,width:$e}=Le.getBoundingClientRect();we.style.right=`${ie-(oe+$e/2)}px`,we.style.left="auto"}}})}},_=(G,he,Se)=>{const{dataTransfer:pe}=G;u.value=he,pe&&(pe.dropEffect="move",pe.effectAllowed="move",pe.setData("field",he.field),pe.setData("index",Se.toString()))},v=async()=>{u.value=void 0,S(),await A()},S=()=>{h.value=[...c.value]},T=We(()=>[...c.value].filter(G=>G.visible!==!1)),C=()=>{if(r.maxColumn&&T.value.length>r.maxColumn){let G=0;c.value=c.value.map(he=>{const Se=r.maxColumn!==void 0&&G<r.maxColumn,pe=he.checkedByDefault!==!1&&r.maxColumn===void 0||he.checkedByDefault!==!1&&Se;return pe&&G++,{...he,visible:pe}})}h.value=[...T.value]},E=G=>{const he=G.target.querySelector("label");he&&he.click()},y=()=>{const G=m1.cloneDeep(r.defaultColumns);if(r.maxColumn&&G.length>r.maxColumn){let he=0;c.value=G.map(Se=>{const pe=r.maxColumn!==void 0&&he<r.maxColumn,we=Se.checkedByDefault!==!1&&r.maxColumn===void 0||Se.checkedByDefault!==!1&&pe;return we&&he++,{...Se,visible:we}})}else c.value=G;h.value=[...T.value],A()},A=async()=>{const G=c.value.map(Se=>({field:Se.field,width:Se.width??"max-content",visible:Se.visible!==!1,fixed:!!Se.fixed})),{setConfig:he}=await $7();await he(r.tableId,G)},w=(G,he)=>{G==null||G.setAttribute("data-wv-section","custom-column-menu"),G==null||G.removeAttribute("style"),he==null||he.append(G??document.createElement("ul"))},I=G=>G.dragable!==!1&&z(G),N=()=>document.getElementById(p.value),z=G=>{if(!l.value)return!0;const he=h.value.findIndex(Se=>Se.field===G.field)>0;return l.value&&he},V=(G,he)=>{var Se,pe;if(G.preventDefault(),I(he)){const we=G.target,ie=we.tagName==="LI"?we:we.closest("li");if(ie==null||ie.classList.add("bg-primary-50"),(Se=ie==null?void 0:ie.nextElementSibling)==null||Se.classList.remove("bg-primary-50"),(pe=ie==null?void 0:ie.previousElementSibling)==null||pe.classList.remove("bg-primary-50"),!ie||!u.value)return;const Le=c.value.findIndex($e=>{var Ye;return $e.field===((Ye=u.value)==null?void 0:Ye.field)}),oe=c.value.findIndex($e=>$e.field===ie.id);Le!==-1&&oe!==-1&&([c.value[Le],c.value[oe]]=[c.value[oe],c.value[Le]])}};return e({toggleMenu:g,resetToDefault:y}),(G,he)=>{var Se,pe,we;return x(),F(ot,null,[r.type==="menu"?(x(),re(L(u3),{key:0,id:p.value,ref_key:"visibilityMenu",ref:f,"data-table-id":G.tableId,pt:{root:{class:[...(Se=L(s))==null?void 0:Se.root.class,"shadow-panel"]},start:{class:[...(pe=L(s))==null?void 0:pe.start.class,(we=L(o))==null?void 0:we.menustart.class]}},onFocus:he[0]||(he[0]=ie=>w(G.$refs.columnList,N())),onHide:A,"append-to":"body","auto-z-index":"","data-wv-name":"column-visibility","data-wv-section":"menu",popup:""},{start:Ie(()=>[ye(ln,{label:L(a).resetDefaultText,onClick:y,"data-wv-section":"button-reset-default",text:""},null,8,["label"])]),item:Ie(()=>[]),end:Ie(()=>[]),_:1},8,["id","data-table-id","pt"])):ve("",!0),qt(le("ul",{ref:"columnList",class:lt([{"grid grid-rows-4 grid-flow-col-dense w-max gap-x-4":G.type==="flat"}]),"data-wv-section":"custom-column-flat-list"},[(x(!0),F(ot,null,en(c.value,(ie,Le)=>{var oe;return x(),F(ot,{key:ie.field},[ie.reorderable!==!1?(x(),F("li",R({key:0,id:ie.field,ref_for:!0},L(o).menuitem({props:r,context:{dragable:I(ie)}}),{"data-item-dragable":I(ie),draggable:I(ie),onClick:E,onDragend:v,onDragenter:On($e=>V($e,ie),["prevent"]),onDragleave:he[3]||(he[3]=On(()=>{},["prevent"])),onDragover:he[4]||(he[4]=On(()=>{},["prevent"])),onDragstart:$e=>_($e,ie,Le),onMouseenter:he[5]||(he[5]=$e=>$e.target.classList.add("bg-primary-50")),onMouseleave:he[6]||(he[6]=$e=>$e.target.classList.remove("bg-primary-50")),"data-wv-section":"custom-column-menu-item"}),[ye(Ft,R({onClick:he[1]||(he[1]=On(()=>{},["stop"])),ref_for:!0},(oe=L(o))==null?void 0:oe.dragicon({context:{dragable:I(ie)}}),{icon:"dragable-menu"}),null,16),ye(Bl,{"aria-label":ie.header,disabled:ie.fixed,label:ie.header,"model-value":ie.visible!==!1,selectable:z(ie),onClick:he[2]||(he[2]=On(()=>{},["stop"])),"onUpdate:modelValue":$e=>{ie.visible=!!$e,C(),A()},class:"!w-full"},null,8,["aria-label","disabled","label","model-value","selectable","onUpdate:modelValue"])],16,$re)):ve("",!0)],64)}),128))],2),[[li,G.type==="flat"]])],64)}}}),z7=bt("DialogConfirm",Ct({__name:"DialogConfirm",props:{header:{},severity:{},confirmButtonSeverity:{},visible:{type:Boolean},closeAfterConfirm:{type:Boolean,default:!0},closeLabel:{default:void 0},actionable:{type:Boolean,default:!0},confirmLabel:{},headerIcon:{},list:{default:void 0},listLabel:{default:void 0},message:{},showIcon:{type:Boolean,default:!0},showCloseButton:{type:Boolean,default:!0},contentClass:{}},emits:["close","confirm","hide","update:visible"],setup(t,{emit:e}){const n=an("preset",{}).dialog,r=an("preset",{}).dialogconfirm,i=t,a=e,{locale:s}=br("DialogConfirm"),o=Ze(),l=We(()=>i.closeLabel?i.closeLabel:i.actionable?s.actionableCloseButtonLabel:s.nonActionableCloseButtonLabel),c=()=>{a("update:visible",!1),a("close")},u=()=>{a("confirm"),i.closeAfterConfirm&&a("update:visible",!1)};return(f,p)=>{var g,_,v,S,T,C,E,y,A,w,I,N,z;const h=ar("focus");return x(),re(L(H0),{ref_key:"dialogConfirm",ref:o,closable:!1,draggable:!1,header:f.header,pt:{root:{class:[...(g=L(n))==null?void 0:g.root({state:{}}).class,...(_=L(r))==null?void 0:_.root.class],"data-wv-section":(v=L(r))==null?void 0:v.root["data-wv-section"](f.$attrs["data-wv-section"]),"data-wv-name":(S=L(r))==null?void 0:S.root["data-wv-name"](f.$attrs["data-wv-name"])},header:{...(T=L(r))==null?void 0:T.header,class:[...(C=L(n))==null?void 0:C.header.class,(E=L(r))==null?void 0:E.header.class]},content:{...(y=L(r))==null?void 0:y.content,class:[...(A=L(n))==null?void 0:A.content({state:{},instance:{}}).class,(w=L(r))==null?void 0:w.content.class,i.contentClass]},footer:{...(I=L(r))==null?void 0:I.footer,class:[...(N=L(n))==null?void 0:N.footer.class,(z=L(r))==null?void 0:z.footer.class]}},visible:i.visible,onHide:p[0]||(p[0]=V=>a("hide")),"onUpdate:visible":p[1]||(p[1]=V=>a("update:visible",!!V)),"close-on-escape":"",modal:""},{header:Ie(()=>{var V,G;return[f.showIcon?(x(),re(Ft,R({key:0,icon:f.headerIcon},(V=L(r))==null?void 0:V.headericon({props:i}),{severity:f.severity,"aria-label":"Header Icon"}),null,16,["icon","severity"])):ve("",!0),le("h3",Gt(bn((G=L(r))==null?void 0:G.headertitle(f.severity))),ze(f.header),17)]}),default:Ie(()=>{var V;return[f.list?(x(),F("ul",Gt(R({key:0},(V=L(r))==null?void 0:V.list)),[(x(!0),F(ot,null,en(f.list,(G,he)=>(x(),F("li",{key:he},ze(f.listLabel&&typeof G!="string"?L(ss)(G,f.listLabel):G),1))),128))],16)):ve("",!0),Fe(f.$slots,"body",{items:f.list},()=>{var G;return[le("p",Gt(bn((G=L(r))==null?void 0:G.bodymessage)),ze(f.message??L(s).defaultConfirmMessage),17)]})]}),footer:Ie(()=>[Fe(f.$slots,"footer",{},()=>{var V,G;return[f.showCloseButton?(x(),re(ln,R({key:0},(V=L(r))==null?void 0:V.cancelbutton,{label:l.value,onClick:c,severity:"secondary",text:""}),null,16,["label"])):ve("",!0),f.actionable?qt((x(),re(ln,R({key:1},(G=L(r))==null?void 0:G.confirmbutton,{label:f.confirmLabel??L(s).defaultConfirmLabel,severity:f.confirmButtonSeverity??f.severity,onClick:u}),null,16,["label","severity"])),[[h]]):ve("",!0)]})]),_:3},8,["header","pt","visible"])}}})),Hre=Ct({__name:"MultiRow",props:{attributes:{}},setup(t){const e=t,n=an("preset",{}).datatable;return(r,i)=>{var a;return x(),F("div",Gt(bn((a=L(n))==null?void 0:a.multirowcontainer({props:e}))),[(x(!0),F(ot,null,en(r.attributes,(s,o)=>{var l;return x(),F("span",R({key:o,ref_for:!0},(l=L(n))==null?void 0:l.multirow({context:{firstIndex:o===0}}),{class:s.class}),[s.bodyComponent?(x(),re(on(s.bodyComponent.component),R({key:0,modelValue:s.bodyComponent.model,"onUpdate:modelValue":c=>s.bodyComponent.model=c,ref_for:!0},s.bodyComponent.props,{class:s.class,disabled:s.bodyComponent.disabled},gl(s.bodyComponent.events?s.bodyComponent.events:{}),{onClick:i[0]||(i[0]=On(()=>{},["stop"]))}),null,16,["modelValue","onUpdate:modelValue","class","disabled"])):(x(),F(ot,{key:1},[cn(ze(s.value),1)],64))],16)}),128))],16)}}}),Yre=["id"],Wre=["onClick"],Kre={class:"flex"},qre=["id"],Qre=["id","draggable","onClick","onDblclick","onDragenter","onDragstart"],jre=["onClick"],Xre=["colspan"],Zre=["colspan"],Jre=["colspan"],eie=["colspan"],tie=["colspan"],nie=["contenteditable","onBlur","onKeypress"],rie={key:1},iie=bt("DataTable",Ct({__name:"DataTable",props:Jr({treeTable:{type:Boolean},childTableProps:{},tableName:{default:"datatable"},tableTitle:{default:void 0},columns:{},useOption:{type:Boolean,default:!0},data:{},dataKey:{default:"_id"},disableKey:{default:"isDefault"},includeCheckDisabledRows:{type:Boolean},highlightKey:{},disableAllRows:{type:Boolean},search:{},tag:{},defaultQueryParams:{},fetchFunction:{},rows:{},isSelectedAll:{type:Boolean},filters:{},lazy:{type:Boolean,default:!0},loading:{type:Boolean},selectionType:{default:"checkbox"},useSelection:{type:Boolean},selectedData:{},expandedRows:{},usePaginator:{type:Boolean},options:{default:()=>[]},singleSelect:{type:Boolean},customColumn:{type:Boolean,default:!0},scrollHeight:{},rowHeight:{default:"fixed"},reorderable:{type:Boolean},globalFilterFields:{},totalDisabledRows:{},excelToastErrorMessage:{},emptyTableMessage:{},singleSelection:{}},{singleSelection:{},singleSelectionModifiers:{}}),emits:Jr(["toggleOption","selectData","rowSelect","page","sort","update:selectedData","update:singleSelection","cellEdited","input","rowReorder"],["update:singleSelection"]),setup(t,{emit:e}){const n=t,r=e,i=r1(t,"singleSelection"),{defaultProps:a}=br("DataTable"),s=We(()=>as(n,a)),o=an("preset",{}).datatable,l=[10,25,50,100],c=hh(),{setLoading:u}=K5(),f=`${window.location.pathname.replace("/","").split("/").join("-")}-${n.tableName}`,p=Ze(n.data??[]),h=mt(n.data??[]),g=Ze({}),_=Ze(n.columns),v=Ze(),S=Ze(),T=Ze(),C=mt([]),E=mt(),y=mt(0),A=mt(!1),w=mt(!1),I=mt(0),N=mt(0),z=mt(!1),V=mt(),G=mt(0),he=Ze(),Se=Ze(),pe=Ze([]),we=mt({}),ie=mt(),Le=mt(),oe=mt(),$e=mt(1),Ye=mt(10),B=mt(0),Z=Ze({}),J=We(()=>{var q,Re;return(q=n.childTableProps)!=null&&q.columns?(Re=n.childTableProps)==null?void 0:Re.columns.filter(k=>{var U;return!k.parentColumnsFields||((U=k.parentColumnsFields)==null?void 0:U.some(H=>_.value.some(K=>K.field===H)))}):_.value}),te=We(()=>({...n.defaultQueryParams,search:n.lazy?ie.value:n.search,page:n.usePaginator?$e.value:void 0,limit:n.usePaginator?Ye.value:void 0,sortOrder:oe.value,sortBy:Le.value,...n.lazy?we.value:n.filters})),de=We(()=>{var Re;const q=(Re=p.value)==null?void 0:Re.filter(k=>{var U;return((U=k.children)==null?void 0:U.length)||k.hasChildren});return(q==null?void 0:q.length)&&q.every(k=>g.value[k[n.dataKey]]>0)}),ee=We(()=>{var K,X,ne,Oe,_e;if(n.disableAllRows||!((K=W())!=null&&K.length)||n.selectionType!=="checkbox"||((X=ae.value)==null?void 0:X.length)===p.value.length)return!1;const q=(ne=C.value)==null?void 0:ne.length,Re=((Oe=xt(W()))==null?void 0:Oe.map(ke=>ke[n.dataKey]))??[],k=((_e=C.value)==null?void 0:_e.map(ke=>ke[n.dataKey]))??[],U=k.length?ane(Re,k):!1,H=q>0&&q===(B.value??0)-(ae.value.length??0);return U||H}),ae=We(()=>Qt(n.data??W()??[])),j=q=>Object.keys(g.value).includes(q),se=q=>ae.value.includes(q),Ge=q=>!!C.value.find(Re=>Re[n.dataKey]===q),W=q=>(p.value??[]).filter(Re=>!Re.childRowHeader&&!Re.childRow),yt=async(q,Re,k)=>{var H,K;if(j(q[n.dataKey])===k)return;const U=k??!j(q[n.dataKey]);if(!w.value)if(!U)p.value.splice(Re+1,g.value[q[n.dataKey]]),delete g.value[q[n.dataKey]];else{g.value[q[n.dataKey]]=1;let{children:X}=q;if((H=n.childTableProps)!=null&&H.fetchFunction&&q.hasChildren)try{p.value.splice(Re+1,0,{childRow:!0,loadingRow:!0}),w.value=!0;const ne=await((K=n.childTableProps)==null?void 0:K.fetchFunction(q));X=ne==null?void 0:ne.data}catch(ne){console.error("🚀 ~ toggleRowExpand ~ error:",ne)}finally{p.value.splice(Re+1,1),w.value=!1}if(Re>=0&&(X!=null&&X.length)){const ne=X.flatMap(Oe=>[{childRowHeader:!0,header:Oe.groupHeader},...(Oe.groupItems??[]).map(ke=>({childRow:!0,...ke}))]);g.value[q[n.dataKey]]=ne.length,p.value.splice(Re+1,0,...ne)}else p.value.splice(Re+1,0,{childRow:!0,noDataRow:!0})}},fe=q=>{n.includeCheckDisabledRows?C.value=q?W():W().filter(Re=>se(Re[n.dataKey])):C.value=q?xt(W()):[]},Ke=(q,Re,k)=>{if(!Re.childRow&&!Re.childRowHeader&&!se(Re[n.dataKey])&&n.selectionType!=="none"){const U=Ge(Re[n.dataKey]);r("rowSelect",{originalEvent:q,data:Re,index:k}),n.selectionType==="checkbox"?U?C.value=C.value.filter(H=>H[n.dataKey]!=Re[n.dataKey]):C.value=[...C.value,Re]:i.value=U?void 0:Re}},Qe=async()=>{var Re;const q=!de.value;if(!w.value){let k=0;for(const U of p.value)((Re=U.children)!=null&&Re.length||U.hasChildren)&&await yt(U,k,q),k++}},He=async(q,Re)=>{const k=q.target,U=k.tagName.toLowerCase()==="button"?k:k.parentElement;r("toggleOption",Re);const H={...q,currentTarget:q.currentTarget??q.target};tn(),await Mn(()=>{var K;U!=null&&U.classList.contains("option-button-active")?tn():((K=Se.value)==null||K.toggle(H),tn(),U==null||U.classList.add("option-button-active"))})},wt=async(q,Re,k)=>{var H,K,X,ne;if(!k.preset)return;const U=()=>Re[k.field]=!Re[k.field];if(k.preset.type==="checkbox"?(K=(H=k.preset).onCheck)==null||K.call(H,q,Re,U):k.preset.type==="toggle"&&((ne=(X=k.preset).onToggle)==null||ne.call(X,q,Re,U)),"confirmDialogProps"in k.preset){const{showWhen:Oe}=dt(k.preset,Re[k.field],Re)??{};typeof Oe=="function"?Z.value[Re[n.dataKey]]=await Oe(Re):Z.value[Re[n.dataKey]]=!Oe||Oe==="active"&&q||Oe==="inactive"&&!q}},pt=q=>q.draggable!==!1&&!q.childRow&&!q.childRowHeader&&n.reorderable&&!oe.value,Bt=(q,Re,k)=>{if(Re.childRow||Re.childRowHeader)return;g.value={};const{dataTransfer:U}=q;V.value=Re,E.value={item:Re,fromIndex:k},U&&(U.dropEffect="move",U.effectAllowed="move",U.setData("id",Re._id),U.setData("index",k.toString()))},tt=(q,Re)=>{var k,U;if(q.preventDefault(),pt(Re)){const H=q.target,K=H.tagName==="TR"?H:H.closest("tr");if(K==null||K.classList.add("bg-primary-50"),(k=K==null?void 0:K.nextElementSibling)==null||k.classList.remove("bg-primary-50"),(U=K==null?void 0:K.previousElementSibling)==null||U.classList.remove("bg-primary-50"),!K||!V.value)return;const X=pe.value.findIndex(Oe=>{var _e;return Oe._id===((_e=V.value)==null?void 0:_e._id)}),ne=pe.value.findIndex(Oe=>Oe._id===K.id);X!==-1&&ne!==-1&&(E.value&&(E.value.toIndex=ne),[pe.value[X],pe.value[ne]]=[pe.value[ne],pe.value[X]],Xt())}},Ut=()=>{E.value&&r("rowReorder",E.value),V.value=void 0,z.value=!1,E.value=void 0},Xt=()=>{p.value=[...pe.value]},tn=()=>{const q=document.querySelectorAll(".option-button-active");q==null||q.forEach(Re=>{Re.classList.remove("option-button-active")})},pn=()=>{Le.value=void 0,oe.value=void 0},Sn=()=>{$e.value=1},ut=()=>{Ye.value=n.rows??10,$e.value=1},ht=()=>{ut(),pn()},Ee=async()=>{N.value++,ht(),await Ot()},me=async q=>{Ye.value=q.rows,$e.value=q.page+1,await Ot(),Object.keys(g.value).forEach(Re=>{const k=p.value.findIndex(U=>U[n.dataKey]==Re);k>=0&&yt(p.value[k],k,!0)})},Ue=(q,Re)=>{q!==Le.value&&(oe.value=void 0),Le.value=q,oe.value?oe.value==-1?(oe.value=void 0,Le.value=void 0):oe.value=-1:oe.value=1,r("sort",{sortOrder:oe.value,sortField:Le.value,originalEvent:Re,rows:Ye.value}),Sn(),n.lazy&&n.fetchFunction?Ot():nt()},nt=()=>{const q=[...p.value??[]],Re=new Map;if(!oe.value){p.value=h.value??[];return}for(const U of q)Re.set(U,it.resolveFieldData(U,Le.value));const k=new Intl.Collator(void 0,{numeric:!0}).compare;q.sort((U,H)=>{const K=Re.get(U),X=Re.get(H);return it.sort(K,X,oe.value,k,-1)}),p.value=q},Ot=async()=>{var q;try{A.value=!0;const Re=await((q=n.fetchFunction)==null?void 0:q.call(n,te.value)),{data:k=[],totalRecords:U=0}=(Re==null?void 0:Re.data)??{};ra(U),p.value=k,pe.value=[...p.value],B.value=U}catch(Re){console.error("🚀 ~ reFetch ~ error:",Re)}finally{A.value=!1,g.value={},Mn(wi)}},Ne=async q=>{var U;const Re=m1.cloneDeep(te.value);delete Re.page,delete Re.limit;const{data:k}=await((U=n.fetchFunction)==null?void 0:U.call(n,Re))??{};if(!k&&q)throw new Error;return k??{data:[],totalRecords:0}},Xe=async q=>{if(n.tableName===q.tableName)try{A.value=!0;const{data:Re,totalRecords:k=0}=n.lazy?await Ne():{totalRecords:(n.data??[]).length,data:n.data},U=Qt(Re);C.value=n.includeCheckDisabledRows?Re??[]:xt(Re,U),ra(k)}finally{A.value=!1}},At=(q,Re)=>o==null?void 0:o.headercell({props:n,context:{sortOrder:oe.value,customColumn:Re,sorted:Le.value&&Le.value===(q==null?void 0:q.field),sortable:q==null?void 0:q.sortable}}),Ht=q=>{(!q.tableName||q.tableName===n.tableName)&&Mn(()=>{I.value++,Ot()})},xt=(q,Re)=>(q??[]).filter(k=>!(Re??ae.value).includes(k[n.dataKey])),Qt=(q=[])=>n.disableAllRows?q.map(Re=>Re[n.dataKey]):q.filter(Re=>Re[n.disableKey]).map(Re=>Re[n.dataKey]),vn=async({tableName:q,multiTableNames:Re,fileName:k,additionalTexts:U})=>{if(q!==n.tableName&&!(Re!=null&&Re.includes(n.tableName)))return;const K=_.value.filter(Oe=>Oe.visible!==!1).filter(Oe=>!Oe.excluded),X=K.map(Oe=>Oe.header??Oe.exportHeader??"-"),ne=()=>k.trim().replace(/[^a-zA-Z0-9\s]/g,"-").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/-+$/,"");try{if(nn.off("data-table:download",oi),q===n.tableName){u(!0,"Mengunduh data");const{data:Oe}=n.fetchFunction?await Ne(!0):{data:n.data},_e=(Oe??[]).map(ke=>{const Be={};return K.forEach(Ve=>{const{field:gt,exportField:Rt,dateFormatOptions:Mt}=Ve,vt=Rt??gt,Nt=ss(ke,vt),Jt=Nt===void 0||Nt===""?"-":Nt;if(Ve.includeTruthyProperties){const Fn=Jt??{},Yn=Object.keys(Fn).map(sr=>{if(Fn[sr])return sr}).filter(Boolean);Be[vt]=Yn.join(",")}else if(Array.isArray(Jt)){let Fn=Jt;Ve.arrayValueField&&(Fn=Jt.map(Yn=>Ve.arrayValueField?ss(Yn,Ve.arrayValueField):Yn)),Be[vt]=Fn.join(Fn.length>1?",":"")}else Mt?Be[vt]=j2(new Date(Jt),Mt):Ve.booleanValue?Be[vt]=Jt?"Ya":"Tidak":Be[vt]=Jt}),Be});if(Re!=null&&Re.length){nn.emit("button-download:multi-tables",{table:{headers:X,data:_e,tableName:q,tableTitle:n.tableTitle}});return}await M5({tables:[{headers:X,data:_e,tableName:q,tableTitle:n.tableTitle}],fileName:ne(),additionalTexts:U})}}catch(Oe){console.error(Oe),c.removeAllGroups(),c.add({message:n.excelToastErrorMessage??"Data gagal diunduh.",error:Oe,group:"download"})}finally{u(!1),nn.on("data-table:download",oi)}};kn(async()=>{var q;n.fetchFunction&&(await Ot(),ge()),(q=n.selectedData)!=null&&q.length&&(C.value=n.selectedData),Hn(),v.value&&(v.value.onscroll=wi,new ResizeObserver(wi).observe(S.value))}),Oc(()=>{Sr()}),Lt(()=>n.columns,()=>{n.customColumn||(_.value=n.columns),y.value++}),Lt(()=>n.data,q=>{p.value=q??[],h.value=q??[]}),Lt(C,q=>{r("selectData",q),r("update:selectedData",q),nn.emit("data-table:update-selected-data",{tableName:n.tableName,data:q})},{deep:!0});const Hn=()=>{nn.on("data-table:apply-filter",jn),nn.on("search-table",si),nn.on("data-table:clear-selected-data",Nr),nn.on("data-table:select-all-record",rr),nn.on("data-table:download",oi),nn.on("data-table:import-excel-to-json",Te)},Sr=()=>{nn.off("data-table:update",Ht),nn.off("data-table:apply-filter",jn),nn.off("search-table",si),nn.off("data-table:clear-selected-data",Nr),nn.off("data-table:select-all-record",rr),nn.off("data-table:download",oi),nn.off("data-table:import-excel-to-json",Te)},jn=q=>{q.tableName===n.tableName&&(we.value=q.filter,Ee())},si=q=>{q.tableName===n.tableName&&(ie.value=q.search,Ee())},rr=q=>{q.tableName===n.tableName&&Xe(q)},Nr=q=>{q.tableName===n.tableName&&(C.value=[])},oi=q=>{var Re;(q.tableName===n.tableName||(Re=q.multiTableNames)!=null&&Re.includes(n.tableName))&&vn(q)},hr=q=>{q.code.includes("Digit")||q.code.includes("Numpad")||["ArrowLeft","ArrowRight","Backspace","Delete"].includes(q.code)||q.preventDefault()},wi=()=>{var q,Re,k,U;G.value=(((q=v.value)==null?void 0:q.scrollWidth)??0)-(((Re=v.value)==null?void 0:Re.offsetWidth)??0)-(((k=v.value)==null?void 0:k.scrollLeft)??0)-(((U=T.value)==null?void 0:U.offsetWidth)??0)},ra=q=>{var U;const Re=n.includeCheckDisabledRows?0:(ae.value.length||n.totalDisabledRows)??0,k={total:((n.lazy?q:(U=n.data)==null?void 0:U.length)??0)-Re,tableName:n.tableName};nn.emit("data-table:update-total-record",k)},ge=()=>{nn.on("data-table:update",Ht)},Te=q=>{q.tableName===n.tableName&&(p.value=q.data,pe.value=[...p.value],B.value=q.data.length)},dt=(q,Re,k)=>typeof(q==null?void 0:q.confirmDialogProps)=="function"?q==null?void 0:q.confirmDialogProps(Re,k):q==null?void 0:q.confirmDialogProps;return(q,Re)=>{var k,U,H,K,X,ne,Oe;return x(),F("div",Gt(bn((k=L(o))==null?void 0:k.root)),[le("div",R((U=L(o))==null?void 0:U.tablewrapper,{ref_key:"tableWrapper",ref:v}),[le("div",Gt(bn((H=L(o))==null?void 0:H.scrollheightwrapper({props:n}))),[(x(),F("table",R({id:L(f)},(K=L(o))==null?void 0:K.table,{key:N.value,ref_key:"tableElement",ref:S}),[le("thead",Gt(bn(L(o).thead)),[le("tr",Gt(bn(L(o).headerrow)),[q.reorderable&&!oe.value?(x(),F("th",R({key:0},L(o).headercellreorderable,{class:At().class}),null,16)):ve("",!0),q.selectionType==="checkbox"?(x(),F("th",R({key:1},L(o).headercellcheckbox,{class:At().class}),[ye(Bl,R((X=L(o))==null?void 0:X.headercheckbox({context:{isSelectedAll:ee.value}}),{"model-value":ee.value,"onUpdate:modelValue":Re[0]||(Re[0]=_e=>fe(!!_e)),binary:""}),null,16,["model-value"])],16)):ve("",!0),q.treeTable?(x(),F("th",R({key:2},L(o).headertoggler,{class:At().class}),[ye(ln,R({onClick:Qe},L(o).headertogglerbutton({context:{isExpandedAll:de.value}}),{icon:"arrow-down",text:""}),null,16)],16)):ve("",!0),(x(!0),F(ot,null,en(_.value,_e=>(x(),F("th",R({key:_e.field,class:[_e.headerClass,_e.class],ref_for:!0},At(_e),{onClick:ke=>_e.sortable?Ue(_e.field,ke):null}),[le("span",R({ref_for:!0},L(o).headercellcontent),[le("span",Kre,[cn(ze(_e.header)+" ",1),_e.info?(x(),re(Ft,{key:0,info:_e.info,class:"w-[10px] h-[10px]",icon:"info"},null,8,["info"])):ve("",!0)]),_e.sortable?(x(),re(Ft,{key:0,icon:!Le.value||Le.value!=_e.field?"arrow-up-down":oe.value==1?"sort-asc":"sort-desc",class:"text-base"},null,8,["icon"])):ve("",!0)],16)],16,Wre))),128)),n.customColumn||n.useOption?(x(),F("th",R({key:3},At(void 0,n.customColumn),{id:`column-visibility-toggle-${L(f)}`,style:`right: ${G.value}px`,onClick:Re[1]||(Re[1]=(..._e)=>{var ke,Be;return((ke=he.value)==null?void 0:ke.toggleMenu)&&((Be=he.value)==null?void 0:Be.toggleMenu(..._e))})}),[n.customColumn?(x(),re(Ft,R({key:0},L(o).columnvisibilityicon,{icon:"ellipsis-h","tooltip-pos":"left"}),null,16)):ve("",!0)],16,qre)):ve("",!0)],16)],16),A.value||n.loading?ve("",!0):(x(),F("tbody",Gt(R({key:0},(ne=L(o))==null?void 0:ne.tbody)),[(x(!0),F(ot,null,en(p.value,(_e,ke)=>{var Be,Ve,gt,Rt,Mt,vt,Nt,Jt,Fn,Yn,sr;return x(),F("tr",R({key:ke,id:_e._id,draggable:pt(_e),ref_for:!0},(Be=L(o))==null?void 0:Be.bodyrow({context:{highlighted:_e[q.highlightKey??""],selected:Ge(_e[q.dataKey]),disabled:se(_e[q.dataKey]),draggable:pt(_e),dragging:z.value},props:n}),{onClick:ct=>Ke(ct,_e,ke),onDblclick:ct=>q.treeTable?yt(_e,ke):null,onDrag:Re[11]||(Re[11]=ct=>z.value=!0),onDragenter:On(ct=>tt(ct,_e),["prevent"]),onDragleave:Re[12]||(Re[12]=On(()=>{},["prevent"])),onDragover:Re[13]||(Re[13]=On(()=>{},["prevent"])),onDragstart:ct=>Bt(ct,_e,ke),onDrop:Ut}),[q.reorderable&&!oe.value?(x(),F("td",R({key:0,ref_for:!0},(Ve=L(o))==null?void 0:Ve.bodycell),[!_e.childRow&&!_e.childRowHeader?(x(),re(Ft,{key:0,class:"draggableicon",icon:"dragable-menu"})):ve("",!0)],16)):ve("",!0),q.selectionType==="checkbox"?(x(),F("td",R({key:1,ref_for:!0},(gt=L(o))==null?void 0:gt.bodycell,{onClick:Re[3]||(Re[3]=On(()=>{},["stop"]))}),[!_e.childRow&&!_e.childRowHeader?(x(),re(Bl,R({key:0,ref_for:!0},(Rt=L(o))==null?void 0:Rt.rowcheckbox,{modelValue:C.value,"onUpdate:modelValue":Re[2]||(Re[2]=ct=>C.value=ct),binary:!1,disabled:se(_e[q.dataKey]),value:_e}),null,16,["modelValue","disabled","value"])):ve("",!0)],16)):ve("",!0),q.treeTable?(x(),F("td",R({key:2,ref_for:!0},(Mt=L(o))==null?void 0:Mt.bodycell,{onClick:ct=>{(_e.childRow||_e.childRowHeader)&&ct.stopPropagation()}}),[(vt=_e.children)!=null&&vt.length||_e.hasChildren?(x(),re(ln,R({key:0,onClick:On(ct=>yt(_e,ke),["stop"]),ref_for:!0},L(o).rowtogglerbutton({context:{isRowExpanded:j(_e[q.dataKey])}}),{icon:"arrow-down",text:""}),null,16,["onClick"])):ve("",!0)],16,jre)):ve("",!0),(()=>{var ct;return _e.childRowHeader&&((ct=n.childTableProps)==null?void 0:ct.useColumnsHeader)})()?(x(!0),F(ot,{key:3},en(J.value,ct=>{var Vi,ia;return x(),F("td",{key:ct.header,class:lt([(Vi=L(o))==null?void 0:Vi.bodycell.class,"font-semibold text-xs"]),colspan:ct.colspan??((ia=ct.parentColumnsFields)==null?void 0:ia.length),onClick:Re[4]||(Re[4]=On(()=>{},["stop"]))},ze(ct.header),11,Xre)}),128)):_e.childRowHeader?(x(),F("td",R({key:4,ref_for:!0},L(o).childrowheader,{class:(Nt=L(o))==null?void 0:Nt.bodycell.class,colspan:n.columns.length+1,onClick:Re[5]||(Re[5]=On(()=>{},["stop"]))}),ze(_e.header),17,Zre)):_e.loadingRow?(x(),F("td",{key:5,class:lt((Jt=L(o))==null?void 0:Jt.bodycell.class),colspan:n.columns.length+1,onClick:Re[6]||(Re[6]=On(()=>{},["stop"]))},[le("div",R({ref_for:!0},L(o).loadingtablewrapper),[ye(F0,R({animation:"loading-table",ref_for:!0},L(o).loadingtablelottie),null,16)],16)],10,Jre)):_e.noDataRow?(x(),F("td",{key:6,class:lt((Fn=L(o))==null?void 0:Fn.bodycell.class),colspan:n.columns.length+1,onClick:Re[7]||(Re[7]=On(()=>{},["stop"]))},[le("div",R({ref_for:!0},L(o).nodatalottiewrapper),[ye(F0,R({animation:"no-data",ref_for:!0},L(o).nodatalottie),null,16),s.value.emptyTableMessage?(x(),F("span",R({key:0,ref_for:!0},L(o).nodatamessage),ze(s.value.emptyTableMessage),17)):ve("",!0)],16)],10,eie)):(x(),F(ot,{key:7},[(x(!0),F(ot,null,en(_e.childRow?J.value:_.value,ct=>{var Vi,ia,ga,_a,Oi,io,tl,Cs,As,ao,nl,Y1,so,xs,rl,dr,W1,oo;return x(),F("td",R({key:ct.field,class:[{"!py-0":ct.editable,"!px-0":((Vi=ct.preset)==null?void 0:Vi.type)==="multirow"},typeof ct.bodyClass=="function"?ct.bodyClass(_e):ct.bodyClass,ct.class],colspan:ct.colspan??((ia=ct.parentColumnsFields)==null?void 0:ia.length),ref_for:!0},(ga=L(o))==null?void 0:ga.bodycell),[((_a=ct.preset)==null?void 0:_a.type)==="toggle"||((Oi=ct.preset)==null?void 0:Oi.type)==="checkbox"?(x(),F(ot,{key:0},[((io=ct.preset)==null?void 0:io.type)==="toggle"?(x(),re(vC,{key:0,modelValue:_e[ct.field],"onUpdate:modelValue":[Wn=>_e[ct.field]=Wn,Wn=>wt(Wn,_e,ct)],disabled:se(_e[q.dataKey])||(typeof((tl=ct.preset)==null?void 0:tl.disabled)=="function"?(Cs=ct.preset)==null?void 0:Cs.disabled(_e):(As=ct.preset)==null?void 0:As.disabled),"input-id":_e[q.dataKey],onClick:Re[8]||(Re[8]=On(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue","disabled","input-id"])):ve("",!0),((ao=ct.preset)==null?void 0:ao.type)==="checkbox"?(x(),re(Bl,{key:1,modelValue:_e[ct.field],"onUpdate:modelValue":[Wn=>_e[ct.field]=Wn,Wn=>wt(!!Wn,_e,ct)],disabled:se(_e[q.dataKey])||(typeof((nl=ct.preset)==null?void 0:nl.disabled)=="function"?(Y1=ct.preset)==null?void 0:Y1.disabled(_e):(so=ct.preset)==null?void 0:so.disabled),"input-id":_e[q.dataKey],value:_e[ct.field],onClick:Re[9]||(Re[9]=On(()=>{},["stop"])),binary:""},null,8,["modelValue","onUpdate:modelValue","disabled","input-id","value"])):ve("",!0),(xs=ct.preset)!=null&&xs.confirmDialogProps?(x(),re(z7,R({key:2,list:[_e],visible:!!Z.value[_e[q.dataKey]],onClose:()=>{var zr,gr,Hr;const Wn=()=>_e[ct.field]=!_e[ct.field];((zr=dt(ct.preset,_e[ct.field],_e))==null?void 0:zr.actionable)==!1&&"onConfirm"in ct.preset?(Hr=(gr=ct.preset).onConfirm)==null||Hr.call(gr,_e[ct.field],_e,Wn):Wn()},onConfirm:Wn=>{var zr,gr;return(gr=(zr=ct.preset)==null?void 0:zr.onConfirm)==null?void 0:gr.call(zr,_e[ct.field],_e,()=>_e[ct.field]=!_e[ct.field])},"onUpdate:visible":Wn=>Z.value[_e[q.dataKey]]=Wn,actionable:"",ref_for:!0},dt(ct.preset,_e[ct.field],_e)),null,16,["list","visible","onClose","onConfirm","onUpdate:visible"])):ve("",!0)],64)):((rl=ct.preset)==null?void 0:rl.type)==="multirow"?(x(),re(Hre,{key:1,attributes:((W1=(dr=ct.preset)==null?void 0:dr.fieldAttributes)==null?void 0:W1.call(dr,_e))??[]},null,8,["attributes"])):ct.editable?(x(),F("span",R({key:2,ref_for:!0},L(o).celleditableelement,{contenteditable:ct.editable,onBlur:Wn=>{q.$emit("cellEdited",{item:_e,field:ct.field,index:ke,value:Wn.target.innerText})},onKeypress:Wn=>{ct.numberInputOnly&&hr(Wn)}}),ze(L(ss)(_e,ct.field)||"-"),17,nie)):ct.bodyComponent||ct.bodyClass||ct.bodyTemplate?(x(),F(ot,{key:3},[ct.bodyComponent?(x(),re(on(ct.bodyComponent(_e,ke).component),R({key:0,modelValue:ct.bodyComponent(_e,ke).model,"onUpdate:modelValue":Wn=>ct.bodyComponent(_e,ke).model=Wn,disabled:ct.bodyComponent(_e,ke).disabled,ref_for:!0},ct.bodyComponent(_e,ke).props,gl(ct.bodyComponent(_e,ke).events?ct.bodyComponent(_e,ke).events:{}),{onChange:Wn=>{var zr,gr;return(gr=(zr=ct.bodyComponent(_e,ke)).onChange)==null?void 0:gr.call(zr,_e)},onClick:Re[10]||(Re[10]=On(()=>{},["stop"])),"onUpdate:modelValue":Wn=>{var zr,gr;return(gr=(zr=ct.bodyComponent(_e,ke)).onChange)==null?void 0:gr.call(zr,_e)}}),null,16,["modelValue","onUpdate:modelValue","disabled","onChange"])):(x(),F("span",rie,[ct.bodyTemplate?(x(),F(ot,{key:0},[cn(ze(((oo=ct.bodyTemplate)==null?void 0:oo.call(ct,_e,ke))||"-"),1)],64)):(x(),F(ot,{key:1},[cn(ze(L(ss)(_e,ct.field)||"-"),1)],64))]))],64)):ct.dateFormatOptions?(x(),F(ot,{key:4},[cn(ze(L(j2)(new Date(L(ss)(_e,ct.field)),ct.dateFormatOptions)),1)],64)):(x(),F(ot,{key:5},[cn(ze(L(ss)(_e,ct.field)??"-"),1)],64))],16,tie)}),128)),(()=>{var ct;return(q.useOption||he.value)&&!_e.childRow||_e.childRow&&((ct=q.childTableProps)==null?void 0:ct.useOption)})()?(x(),F("td",R({key:0,ref_for:!0,ref_key:"rowSingleActionCell",ref:T},(Yn=L(o))==null?void 0:Yn.rowsingleactioncell({props:n,context:{selected:Ge(_e[q.dataKey]),highlighted:_e[q.highlightKey??""]}}),{class:L(o).bodycell.class,style:`right: ${G.value}px`}),[q.useOption||(sr=q.childTableProps)!=null&&sr.useOption?(x(),F("div",R({key:0,ref_for:!0},L(o).singleactionwrapper),[ye(ln,R({id:"button-action-"+_e[n.dataKey],ref_for:!0},L(o).singleactionbutton({props:n}),{disabled:q.disableAllRows,onClick:On(ct=>He(ct,_e),["stop"]),icon:"ellipsis-h",outlined:"",size:"small","tooltip-pos":"left",type:"button"}),null,16,["id","disabled","onClick"])],16)):ve("",!0)],16)):ve("",!0)],64))],16,Qre)}),128))],16))],16,Yre))],16),!(A.value||n.loading)&&!((Oe=p.value)!=null&&Oe.length)?(x(),F("div",Gt(R({key:0},L(o).nodatalottiewrapper)),[ye(F0,R({animation:"no-data"},L(o).nodatalottie),null,16),s.value.emptyTableMessage?(x(),F("span",Gt(R({key:0},L(o).nodatamessage)),ze(s.value.emptyTableMessage),17)):ve("",!0)],16)):ve("",!0),A.value||n.loading?(x(),F("div",Gt(R({key:1},L(o).loadingtablewrapper)),[ye(F0,R({animation:"loading-table"},L(o).loadingtablelottie),null,16)],16)):ve("",!0)],16),q.usePaginator?qt((x(),re(L(L7),R({key:N.value,rows:Ye.value,"onUpdate:rows":Re[14]||(Re[14]=_e=>Ye.value=_e)},L(o).paginator({context:{totalRecords:B.value}}),{"rows-per-page-options":l,"total-records":B.value,onPage:me}),{firstpagelinkicon:Ie(()=>[ye(Ft,{icon:"round-keyboard-double-arrow-left"})]),lastpagelinkicon:Ie(()=>[ye(Ft,{icon:"round-keyboard-double-arrow-right"})]),prevpagelinkicon:Ie(()=>[ye(Ft,{icon:"round-keyboard-arrow-left"})]),nextpagelinkicon:Ie(()=>[ye(Ft,{icon:"round-keyboard-arrow-right"})]),_:1},16,["rows","total-records"])),[[li,!(A.value||n.loading)]]):ve("",!0),ye(d3,{id:"single-action-menu",ref_key:"optionMenu",ref:Se,model:q.options,onFocus:L(ine),"append-to":"body","auto-z-index":"",popup:""},null,8,["model","onFocus"]),n.customColumn?(x(),re(zre,{key:y.value,ref_key:"customColumn",ref:he,"visible-columns":_.value,"onUpdate:visibleColumns":Re[15]||(Re[15]=_e=>_.value=_e),"default-columns":q.columns.filter(_e=>_e.visible!==!1),"table-id":L(f)},null,8,["visible-columns","default-columns","table-id"])):ve("",!0),ye(Bre,{group:"download"})],16)}}})),Ei=Ct({__name:"ValidatorMessage",props:{message:{}},setup(t){const e=an("preset",{}).validatormessage;return(n,r)=>{var i;return qt((x(),F("small",R((i=L(e))==null?void 0:i.root,{role:"alert"}),ze(n.message),17)),[[li,n.message]])}}}),H7=bt("Form",Ct({__name:"Form",props:{buttonsTemplate:{},disableSubmit:{type:Boolean},cancelBtnLabel:{default:"Batal"},clearBtnLabel:{default:"Bersihkan Field"},columnPerRow:{},hideFooter:{type:Boolean},hideStayCheckbox:{type:Boolean},invalid:{type:Boolean},resetAfterSubmit:{type:Boolean,default:!0},saveBtnLabel:{default:"Simpan"},submitBtnLabel:{default:"Simpan"},stayCheckboxLabel:{default:"Tetap di halaman ini"},validatorMessage:{default:"Please input all required field!"},validateOnSave:{type:Boolean,default:!1},cancelBtnSeverity:{default:"secondary"},saveBtnSeverity:{default:"success"},submitBtnSeverity:{default:"success"}},emits:["cancel","clear","save","submit"],setup(t,{expose:e,emit:n}){const r=t,i=n;kn(()=>{if(y.value){const Se=r.columnPerRow??1;y.value.style.gridTemplateColumns=`repeat(${Se}, minmax(0, 1fr))`,w()}});const a=an("preset",{}).form,{handleSubmit:s,values:o,resetForm:l,errors:c,resetField:u,setValues:f,setFieldValue:p,setErrors:h}=r3(),g=mt(!1),_=Ze(),v=mt(!1),S=mt(!1),T=mt(0),C=Ze(),E=mt(!1),y=Ze(null),A=Ze(null);wc("isSubmitting",E);const w=()=>{var Se;if(C.value){const pe=(Se=C.value)==null?void 0:Se.offsetHeight;A.value&&(A.value.style.height=`calc(100% + ${pe+20}px)`)}},I=()=>{E.value=!0,S.value||(v.value=!0)},N=()=>{E.value=!0,r.validateOnSave?(S.value||(v.value=!0),z()):V()},z=s(Se=>{const pe=he(Se),we={stayAfterSubmit:g.value,formValues:pe};r.invalid||(i("submit",we),v.value=!1,r.resetAfterSubmit&&(T.value+=1,l())),E.value=!1},()=>{E.value=!1}),V=()=>{const Se=he(o),pe={stayAfterSubmit:g.value,formValues:Se};i("save",pe),E.value=!1},G=()=>{l(),T.value++,i("clear"),v.value=!1},he=Se=>{const pe=Se,we=Object.keys(pe);for(const ie of we)typeof pe[ie]=="string"&&(pe[ie]=pe[ie].trim());return pe};return e({stayAfterSubmit:g,submit:z,onSubmitClicked:I,showValidator:v,formElement:_,clearField:G,resetField:u,errors:c,setOuterFieldsWrapperHeight:w,setValues:f,setFieldValue:p,setErrors:h}),(Se,pe)=>{var we,ie,Le,oe,$e,Ye,B,Z,J,te,de,ee,ae,j,se;return x(),F("form",R({ref_key:"formElement",ref:_},(we=L(a))==null?void 0:we.root({props:r}),{onInput:pe[2]||(pe[2]=Ge=>v.value=!1),onSubmit:pe[3]||(pe[3]=On((...Ge)=>L(z)&&L(z)(...Ge),["prevent"]))}),[le("div",{ref_key:"outerFieldsWrapper",ref:A},[le("div",R({ref_key:"fieldsWrapper",ref:y},(ie=L(a))==null?void 0:ie["fields-wrapper"]),[Fe(Se.$slots,"fields",{key:T.value,formValues:L(o)})],16)],512),Se.hideFooter?ve("",!0):(x(),F("div",R({key:0,ref_key:"footer",ref:C},(Le=L(a))==null?void 0:Le.footer),[Se.hideStayCheckbox?ve("",!0):(x(),F("div",Gt(R({key:0},(oe=L(a))==null?void 0:oe.staycheckbox)),[ye(Bl,{modelValue:g.value,"onUpdate:modelValue":pe[0]||(pe[0]=Ge=>g.value=Ge),label:Se.stayCheckboxLabel},null,8,["modelValue","label"])],16)),le("div",Gt(bn(($e=L(a))==null?void 0:$e["action-buttons"])),[le("div",Gt(bn((Ye=L(a))==null?void 0:Ye["button-wrapper"])),[(B=r.buttonsTemplate)!=null&&B.includes("cancel")?(x(),re(ln,R({key:0},(Z=L(a))==null?void 0:Z["cancel-button"],{label:Se.cancelBtnLabel,severity:Se.cancelBtnSeverity,onClick:pe[1]||(pe[1]=Ge=>Se.$emit("cancel")),"data-test":"cancel-button",text:"",type:"button"}),null,16,["label","severity"])):ve("",!0),(J=r.buttonsTemplate)!=null&&J.includes("clear")?(x(),re(ln,R({key:1},(te=L(a))==null?void 0:te["clear-button"],{label:Se.clearBtnLabel,onClick:G,text:"",type:"button"}),null,16,["label"])):ve("",!0),(de=r.buttonsTemplate)!=null&&de.includes("save")?(x(),re(ln,R({key:2},(ee=L(a))==null?void 0:ee["save-button"],{label:Se.saveBtnLabel,severity:Se.saveBtnSeverity,onClick:N,outlined:"",type:"button"}),null,16,["label","severity"])):ve("",!0),(ae=r.buttonsTemplate)!=null&&ae.includes("submit")?(x(),re(ln,R({key:3},(j=L(a))==null?void 0:j["submit-button"],{disabled:Se.disableSubmit,label:Se.submitBtnLabel,severity:Se.submitBtnSeverity,onClick:I,type:"submit"}),null,16,["disabled","label","severity"])):ve("",!0)],16),qt(ye(Ei,R((se=L(a))==null?void 0:se["validator-message"],{message:Se.validatorMessage}),null,16,["message"]),[[li,v.value||r.invalid]])],16)],16))],16)}}})),aie=bt("DialogForm",Ct({__name:"DialogForm",props:{buttonsTemplate:{},header:{},visible:{type:Boolean},asideRightWidth:{default:260},class:{},cancelBtnLabel:{},clearBtnLabel:{},closable:{type:Boolean,default:!0},closeOnSubmit:{type:Boolean,default:!0},contentClass:{},dateHeader:{},headerIcon:{},invalid:{type:Boolean},resetAfterSubmit:{type:Boolean,default:!0},severity:{},showStayCheckbox:{type:Boolean,default:void 0},stayCheckboxLabel:{},submitBtnLabel:{},validatorMessage:{},validationFunction:{},width:{default:"small"},disableSubmit:{type:Boolean},columnPerRow:{default:1},hideFooter:{type:Boolean},hideStayCheckbox:{type:Boolean},saveBtnLabel:{},validateOnSave:{type:Boolean},cancelBtnSeverity:{},saveBtnSeverity:{},submitBtnSeverity:{}},emits:["clear","close","hide","show","submit","update:visible"],setup(t,{expose:e,emit:n}){const r=t,i=n,a=zp(),{locale:s}=br("DialogForm"),o=an("preset",{}).dialog,l=an("preset",{}).dialogform,c=Ze(),u=Ze(),f=mt(0),p=mt(!1),h=mt(!1),g=Ze({stayAfterSubmit:!1,formValues:{}}),_=We(()=>{const y=a["aside-right"]&&h.value?r.asideRightWidth:0;return`calc(${{small:400,medium:500,large:572,"semi-xlarge":600,xlarge:800}[r.width]}px + ${y}px)`}),v=()=>{i("update:visible",!1),i("close")},S=()=>{c.value&&!r.invalid&&!r.validatorMessage&&(c.value.onSubmitClicked(),c.value.submit())},T=()=>{c.value&&c.value.clearField(),i("clear")},C=async y=>{r.validationFunction&&await r.validationFunction(y.formValues),!r.invalid&&!r.validatorMessage&&(g.value=y,a.confirm?p.value=!0:E())},E=async y=>{const{stayAfterSubmit:A}=g.value;if(!A&&r.closeOnSubmit&&i("update:visible",!1),a.confirm)try{await(y==null?void 0:y(g.value))}catch(w){console.error(w)}else i("submit",g.value);r.resetAfterSubmit&&T()};return e({form:c,clearField:T,setValues:y=>{var A;(A=c.value)==null||A.setValues(y)},setFieldValue:(y,A,w)=>{var I;(I=c.value)==null||I.setFieldValue(y,A,w)},setErrors:y=>{var A;(A=c.value)==null||A.setErrors(y)}}),(y,A)=>{var w,I,N,z;return x(),re(L(H0),R({ref_key:"dialogForm",ref:u},(w=L(l))==null?void 0:w.root,{class:r.class,closable:y.closable,draggable:!1,header:y.header,pt:{root:{class:[...(I=L(o))==null?void 0:I.root({state:{}}).class,...(N=L(l))==null?void 0:N.root.class],style:(z=L(l))==null?void 0:z.root.style(_.value)}},visible:y.visible,onHide:A[3]||(A[3]=V=>i("hide")),onShow:A[4]||(A[4]=V=>i("show")),"onUpdate:visible":A[5]||(A[5]=V=>i("update:visible",!!V)),modal:""}),{container:Ie(()=>{var V,G,he,Se,pe,we,ie,Le;return[le("div",Gt(bn((V=L(l))==null?void 0:V.container(h.value))),[le("section",R((G=L(l))==null?void 0:G.mainsection,{id:"main"}),[le("div",Gt(bn((he=L(l))==null?void 0:he.header)),[Fe(y.$slots,"header",{},()=>{var oe,$e,Ye,B;return[y.headerIcon?(x(),re(Ft,R({key:0},(oe=L(l))==null?void 0:oe.headericon,{icon:y.headerIcon,severity:y.severity,"aria-label":"Header Icon"}),null,16,["icon","severity"])):ve("",!0),le("h3",Gt(bn(($e=L(l))==null?void 0:$e.headertitle)),ze(y.header),17),y.$slots["aside-right"]?(x(),re(ln,R({key:1},(Ye=L(l))==null?void 0:Ye.expandasidebutton,{label:h.value?L(s).asideRightExpandedButtonLabel:L(s).asideRightCollapsedButtonLabel,onClick:A[0]||(A[0]=Z=>h.value=!h.value),text:""}),null,16,["label"])):ve("",!0),y.closable?(x(),re(ln,R({key:2,onClick:v},(B=L(l))==null?void 0:B.closedialog,{icon:"close","icon-class":"w-[22px] h-[22px]",rounded:"",severity:"secondary",text:""}),null,16)):ve("",!0)]})],16),ye(H7,R((Se=L(l))==null?void 0:Se.form,{ref_key:"form",ref:c,"buttons-template":y.buttonsTemplate,"column-per-row":y.columnPerRow,"reset-after-submit":y.resetAfterSubmit,onSubmit:C,"hide-footer":""}),{fields:Ie(({formValues:oe})=>[Fe(y.$slots,"fields",{key:f.value,formValues:oe})]),_:3},16,["buttons-template","column-per-row","reset-after-submit"]),Fe(y.$slots,"confirm",{hide:()=>p.value=!1,submit:E,visible:p.value}),le("div",Gt(bn((pe=L(l))==null?void 0:pe.footer)),[y.showStayCheckbox?(x(),re(Bl,{key:0,label:y.stayCheckboxLabel??L(s).stayCheckboxLabel,"model-value":(we=c.value)==null?void 0:we.stayAfterSubmit,"onUpdate:modelValue":A[1]||(A[1]=oe=>c.value&&(c.value.stayAfterSubmit=oe))},null,8,["label","model-value"])):ve("",!0),qt(ye(Ei,{format:!1,message:y.validatorMessage},null,8,["message"]),[[li,y.invalid&&y.validatorMessage]]),r.buttonsTemplate.length?(x(),F("div",Gt(R({key:1},(ie=L(l))==null?void 0:ie.footerbutton)),[Fe(y.$slots,"actionButtons",{submit:S},()=>{var oe,$e,Ye,B,Z,J;return[(oe=r.buttonsTemplate)!=null&&oe.includes("cancel")?(x(),re(ln,R({key:0},($e=L(l))==null?void 0:$e.cancelbtn,{label:y.cancelBtnLabel??L(s).cancelBtnLabel,onClick:A[2]||(A[2]=te=>(i("close"),i("update:visible",!1))),severity:"dark",text:""}),null,16,["label"])):ve("",!0),(Ye=r.buttonsTemplate)!=null&&Ye.includes("clear")?(x(),re(ln,R({key:1},(B=L(l))==null?void 0:B.clearfield,{label:y.clearBtnLabel??L(s).clearBtnLabel,onClick:T,class:"whitespace-nowrap",text:""}),null,16,["label"])):ve("",!0),(Z=r.buttonsTemplate)!=null&&Z.includes("submit")?(x(),re(ln,R({key:2},(J=L(l))==null?void 0:J.savesubmitbutton,{label:y.submitBtnLabel??L(s).submitBtnLabel,severity:r.severity==="primary"?void 0:r.severity??"success",onClick:S}),null,16,["label","severity"])):ve("",!0)]})],16)):ve("",!0)],16)],16),y.$slots["aside-right"]?(x(),F("aside",Gt(R({key:0},(Le=L(l))==null?void 0:Le.asidesection(h.value,y.asideRightWidth))),[Fe(y.$slots,"aside-right")],16)):ve("",!0)],16)]}),_:3},16,["class","closable","header","pt","visible"])}}})),da=Ct({__name:"FieldWrapper",props:{label:{},mandatory:{type:Boolean},showOptionalText:{type:Boolean,default:void 0},showAsterisk:{type:Boolean,default:void 0},info:{},labelClass:{},tooltipPos:{}},setup(t){const e=t,{defaultProps:n,locale:r}=br("FieldWrapper"),i=We(()=>as(e,n)),a=an("preset",{}).fieldwrapper;return(s,o)=>s.$attrs["use-field-wrapper"]!=!1?(x(),F("div",Gt(R({key:0},L(a).root)),[s.label?(x(),F("label",Gt(R({key:0},L(a).label({props:e}))),[cn(ze(s.label)+" ",1),s.mandatory&&i.value.showAsterisk?(x(),F("span",Gt(R({key:0},L(a).arterisksign)),ze(L(r).labelRequired),17)):ve("",!0),s.info?(x(),re(Ft,R({key:1,info:s.info,"tooltip-pos":i.value.tooltipPos},L(a).info,{icon:"info"}),null,16,["info","tooltip-pos"])):ve("",!0),s.mandatory==!1&&i.value.showOptionalText?(x(),F("span",Gt(R({key:2},L(a).optionaltext)),ze(L(r).labelOptional),17)):ve("",!0)],16)):ve("",!0),Fe(s.$slots,"default")],16)):Fe(s.$slots,"default",{key:1})}});var sie={root:"p-inputgroup"},oie=$n.extend({name:"inputgroup",classes:sie}),lie={name:"BaseInputGroup",extends:Cn,style:oie,provide:function(){return{$parentInstance:this}}},Y7={name:"InputGroup",extends:lie,inheritAttrs:!1};function cie(t,e,n,r,i,a){return x(),F("div",R({class:t.cx("root")},t.ptmi("root")),[Fe(t.$slots,"default")],16)}Y7.render=cie;const ko=Ct({__name:"InputGroup",props:{pt:{},ptOptions:{},ring:{},unstyled:{type:Boolean},invalid:{type:Boolean},disabled:{type:Boolean}},setup(t){const e=an("preset",{}).inputgroup,n=r=>{const i=r.target;if(i){const a=i.querySelector("input");a==null||a.focus()}};return(r,i)=>r.$attrs["use-input-group"]!=!1?(x(),re(L(Y7),R({key:0},L(e).root({props:{...r.$props,class:r.$attrs.class}}),{onClick:n}),{default:Ie(()=>[Fe(r.$slots,"default")]),_:3},16)):Fe(r.$slots,"default",{key:1})}});var uie={root:"p-inputgroup-addon"},die=$n.extend({name:"inputgroupaddon",classes:uie}),fie={name:"BaseInputGroupAddon",extends:Cn,style:die,provide:function(){return{$parentInstance:this}}},$l={name:"InputGroupAddon",extends:fie,inheritAttrs:!1};function pie(t,e,n,r,i,a){return x(),F("div",R({class:t.cx("root")},t.ptmi("root")),[Fe(t.$slots,"default")],16)}$l.render=pie;const Mv=bt("Dropdown",Ct({__name:"Dropdown",props:{modelValue:{type:[String,Number,Boolean,Object],default:void 0},initialValue:{type:[String,Number,Boolean,Object]},label:{},options:{},optionLabel:{},optionValue:{},valueType:{default:"plain"},badgeValueProps:{},inputBorder:{},dataKey:{},useValidator:{type:Boolean},mandatory:{type:Boolean},showOptionalText:{type:Boolean,default:void 0},validatorMessage:{},formatValidatorMessage:{type:Boolean,default:!0},invalid:{type:Boolean},fieldName:{},placeholder:{},loading:{type:Boolean},fieldInfo:{},disabled:{type:Boolean},filter:{type:Boolean,default:!0},filterPlaceholder:{}},emits:["update:modelValue","show"],setup(t,{expose:e,emit:n}){const r=t,i=n;kn(()=>{_()});const{locale:a}=br("Dropdown"),s=an("preset",{}).dropdown,o=an("preset",{}).inputgroupaddon,l=Ze(),c=mt(!1),u=We(()=>r.invalid||!!f.errorMessage),f=_r({value:r.initialValue?r.initialValue:r.modelValue}),p=We(()=>{var E;return a.emptySelectionErrorMessage.replace("{label}",r.label).replace("{formattedLabel}",(E=gh(r.label))==null?void 0:E.toLowerCase())}),h=We(()=>P5(r.options)),g=We(()=>{var E;return r.loading?a.loadingPlaceholder:r.placeholder??((E=a.inputPlaceholder)==null?void 0:E.replace("{label}",r.label??"").replace("{lowercaseLabel}",(r.label??"").toLowerCase()))}),_=()=>{r.useValidator&&(Object.assign(f,pi(r.fieldName??"dropdown",E=>!(E!=null&&E!=="")&&r.mandatory?typeof r.validatorMessage=="object"&&"empty"in r.validatorMessage?r.validatorMessage.empty:r.validatorMessage??p.value:Mn(v))),r.initialValue&&(f.value=r.initialValue),r.invalid&&f.validate())},v=()=>r.validatorMessage&&r.invalid?r.validatorMessage:!0,S=E=>{const{value:y}=E;i("update:modelValue",y)},T=()=>{if(r.optionValue){const E=h.value.find(y=>{if(typeof y!="string")return r.dataKey?f.value[r.dataKey]===y[r.optionValue??""][r.dataKey]:m1.isEqual(m1.cloneDeep(y[r.optionValue??""]),m1.cloneDeep(f.value))});if(E&&typeof E!="string")return E[r.optionLabel??""]}else if(f.value&&typeof f.value=="object"&&r.optionLabel&&r.optionLabel in f.value)return f.value[r.optionLabel];return f.value},C=()=>{l.value&&l.value.show()};return Lt(()=>r.initialValue,E=>{f.value=E},{once:!0}),Lt(()=>r.modelValue,E=>{f.value=E}),e({showOverlay:C}),(E,y)=>(x(),re(da,{info:E.fieldInfo,label:r.label,mandatory:r.mandatory,"show-optional-text":E.showOptionalText},{default:Ie(()=>[ye(ko,{class:lt([{"grid grid-cols-[max-content,1fr,max-content]":E.$slots["addon-left"]&&E.$slots["addon-right"],"grid grid-cols-[1fr,max-content]":!E.$slots["addon-left"]&&E.$slots["addon-right"],"grid grid-cols-[max-content,1fr]":E.$slots["addon-left"]&&!E.$slots["addon-right"]}]),disabled:r.disabled,invalid:u.value,ring:E.inputBorder},{default:Ie(()=>{var A,w;return[E.$slots["addon-left"]?(x(),re(L($l),{key:0,disabled:r.disabled},{default:Ie(()=>[Fe(E.$slots,"addon-left")]),_:3},8,["disabled"])):ve("",!0),ye(L(No),R({ref_key:"dropdown",ref:l},r,{modelValue:f.value,"onUpdate:modelValue":y[0]||(y[0]=I=>f.value=I),"aria-describedby":r.label+"error","filter-placeholder":r.filterPlaceholder||L(a).filterPlaceholder,invalid:u.value,options:h.value,placeholder:g.value,pt:{wrapper:(A=L(s))==null?void 0:A.wrapper({props:r})},"virtual-scroller-options":((w=h.value)==null?void 0:w.length)>10?{itemSize:32}:void 0,onChange:S,onHide:y[1]||(y[1]=I=>c.value=!1),onShow:y[2]||(y[2]=I=>(E.$emit("show"),c.value=!0))}),$i({dropdownicon:Ie(()=>[ye(Ft,Gt(bn(L(s).dropdownicon({state:{isShowOverlay:c.value}}))),null,16)]),loadingicon:Ie(()=>[ye(Ft,Gt(bn(L(s).loadingicon)),null,16)]),filtericon:Ie(()=>[ye(Ft,Gt(bn(L(s).filtericon)),null,16)]),_:2},[E.loading?{name:"value",fn:Ie(({placeholder:I})=>[le("span",Gt(bn(L(s).loadingplaceholder)),ze(I),17)]),key:"0"}:{name:"value",fn:Ie(I=>[I.value!==void 0?Fe(E.$slots,"value",{key:0,originalValue:I.value,value:T()},()=>[E.valueType==="badge"?(x(),re(Fl,R({key:0},E.badgeValueProps,{label:T()}),null,16,["label"])):(x(),F(ot,{key:1},[cn(ze(T()),1)],64))]):(x(),F(ot,{key:1},[cn(ze(I.placeholder),1)],64))]),key:"1"},E.$slots.option?{name:"option",fn:Ie(({option:I})=>[Fe(E.$slots,"option",{option:I})]),key:"2"}:void 0]),1040,["modelValue","aria-describedby","filter-placeholder","invalid","options","placeholder","pt","virtual-scroller-options"]),E.$slots["addon-right"]?(x(),re(L($l),{key:1,pt:{root:L(o).root({props:{class:[{"!text-general-200":r.disabled}]}})}},{default:Ie(()=>[Fe(E.$slots,"addon-right")]),_:3},8,["pt"])):ve("",!0)]}),_:3},8,["class","disabled","invalid","ring"]),ye(Ei,{id:r.label+"error",message:f.errorMessage},null,8,["id","message"])]),_:3},8,["info","label","mandatory","show-optional-text"]))}}));function Mi(t){this.content=t}Mi.prototype={constructor:Mi,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),a=r.content.slice();return i==-1?a.push(n||t,e):(a[i+1]=e,n&&(a[i]=n)),new Mi(a)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Mi(n)},addToStart:function(t,e){return new Mi([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Mi(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),a=r.find(t);return i.splice(a==-1?i.length:a,0,e,n),new Mi(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Mi.from(t),t.size?new Mi(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Mi.from(t),t.size?new Mi(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Mi.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},Mi.from=function(t){if(t instanceof Mi)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Mi(e)};function W7(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),a=e.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let s=0;i.text[s]==a.text[s];s++)n++;return n}if(i.content.size||a.content.size){let s=W7(i.content,a.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function K7(t,e,n,r){for(let i=t.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let s=t.child(--i),o=e.child(--a),l=s.nodeSize;if(s==o){n-=l,r-=l;continue}if(!s.sameMarkup(o))return{a:n,b:r};if(s.isText&&s.text!=o.text){let c=0,u=Math.min(s.text.length,o.text.length);for(;c<u&&s.text[s.text.length-c-1]==o.text[o.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||o.content.size){let c=K7(s.content,o.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class St{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,a){for(let s=0,o=0;o<n;s++){let l=this.content[s],c=o+l.nodeSize;if(c>e&&r(l,i+o,a||null,s)!==!1&&l.content.size){let u=o+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,i+u)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let a="",s=!0;return this.nodesBetween(e,n,(o,l)=>{let c=o.isText?o.text.slice(Math.max(e,l)-l,n-l):o.isLeaf?i?typeof i=="function"?i(o):i:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&r&&(s?s=!1:a+=r),a+=c},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<e.content.length;a++)i.push(e.content[a]);return new St(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let a=0,s=0;s<n;a++){let o=this.content[a],l=s+o.nodeSize;l>e&&((s<e||l>n)&&(o.isText?o=o.cut(Math.max(0,e-s),Math.min(o.text.length,n-s)):o=o.cut(Math.max(0,e-s-1),Math.min(o.content.size,n-s-1))),r.push(o),i+=o.nodeSize),s=l}return new St(r,i)}cutByIndex(e,n){return e==n?St.empty:e==0&&n==this.content.length?this:new St(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new St(i,a)}addToStart(e){return new St([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new St(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return W7(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return K7(this,e,n,r)}findIndex(e,n=-1){if(e==0)return g3(0,e);if(e==this.size)return g3(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let a=this.child(r),s=i+a.nodeSize;if(s>=e)return s==e||n>0?g3(r+1,s):g3(r,i);i=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return St.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new St(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return St.empty;let n,r=0;for(let i=0;i<e.length;i++){let a=e[i];r+=a.nodeSize,i&&a.isText&&e[i-1].sameMarkup(a)?(n||(n=e.slice(0,i)),n[n.length-1]=a.withText(n[n.length-1].text+a.text)):n&&n.push(a)}return new St(n||e,r)}static from(e){if(!e)return St.empty;if(e instanceof St)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new St([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}St.empty=new St([],0);const Lv={index:0,offset:0};function g3(t,e){return Lv.index=t,Lv.offset=e,Lv}function _3(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!_3(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!_3(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Er=class ry{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let a=e[i];if(this.eq(a))return e;if(this.type.excludes(a.type))n||(n=e.slice(0,i));else{if(a.type.excludes(this.type))return e;!r&&a.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(a)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&_3(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ry.none;if(e instanceof ry)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};Er.none=[];class v3 extends Error{}class $t{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Q7(this.content,e+this.openStart,n);return r&&new $t(r,this.openStart,this.openEnd)}removeBetween(e,n){return new $t(q7(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return $t.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new $t(St.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)r++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)i++;return new $t(e,r,i)}}$t.empty=new $t(St.empty,0,0);function q7(t,e,n){let{index:r,offset:i}=t.findIndex(e),a=t.maybeChild(r),{index:s,offset:o}=t.findIndex(n);if(i==e||a.isText){if(o!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,a.copy(q7(a.content,e-i-1,n-i-1)))}function Q7(t,e,n,r){let{index:i,offset:a}=t.findIndex(e),s=t.maybeChild(i);if(a==e||s.isText)return t.cut(0,e).append(n).append(t.cut(e));let o=Q7(s.content,e-a-1,n);return o&&t.replaceChild(i,s.copy(o))}function mie(t,e,n){if(n.openStart>t.depth)throw new v3("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new v3("Inconsistent open depths");return j7(t,e,n,0)}function j7(t,e,n,r){let i=t.index(r),a=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=j7(t,e,n,r+1);return a.copy(a.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,o=s.content;return Hl(s,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:s,end:o}=hie(n,t);return Hl(a,Z7(t,s,o,e,r))}else return Hl(a,b3(t,e,r))}function X7(t,e){if(!e.type.compatibleContent(t.type))throw new v3("Cannot join "+e.type.name+" onto "+t.type.name)}function Pv(t,e,n){let r=t.node(n);return X7(r,e.node(n)),r}function zl(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function sd(t,e,n,r){let i=(e||t).node(n),a=0,s=e?e.index(n):i.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(zl(t.nodeAfter,r),a++));for(let o=a;o<s;o++)zl(i.child(o),r);e&&e.depth==n&&e.textOffset&&zl(e.nodeBefore,r)}function Hl(t,e){return t.type.checkContent(e),t.copy(e)}function Z7(t,e,n,r,i){let a=t.depth>i&&Pv(t,e,i+1),s=r.depth>i&&Pv(n,r,i+1),o=[];return sd(null,t,i,o),a&&s&&e.index(i)==n.index(i)?(X7(a,s),zl(Hl(a,Z7(t,e,n,r,i+1)),o)):(a&&zl(Hl(a,b3(t,e,i+1)),o),sd(e,n,i,o),s&&zl(Hl(s,b3(n,r,i+1)),o)),sd(r,null,i,o),new St(o)}function b3(t,e,n){let r=[];if(sd(null,t,n,r),t.depth>n){let i=Pv(t,e,n+1);zl(Hl(i,b3(t,e,n+1)),r)}return sd(e,null,n,r),new St(r)}function hie(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)i=e.node(a).copy(St.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class od{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let a=0;a<e;a++)i+=r.child(a).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Er.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let o=r;r=i,i=o}let a=r.marks;for(var s=0;s<a.length;s++)a[s].type.spec.inclusive===!1&&(!i||!a[s].isInSet(i.marks))&&(a=a[s--].removeFromSet(a));return a}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var a=0;a<r.length;a++)r[a].type.spec.inclusive===!1&&(!i||!r[a].isInSet(i.marks))&&(r=r[a--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new E3(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,a=n;for(let s=e;;){let{index:o,offset:l}=s.content.findIndex(a),c=a-l;if(r.push(s,o,i+l),!c||(s=s.child(o),s.isText))break;a=c-1,i+=l+1}return new od(n,r,a)}static resolveCached(e,n){let r=J7.get(e);if(r)for(let a=0;a<r.elts.length;a++){let s=r.elts[a];if(s.pos==n)return s}else J7.set(e,r=new gie);let i=r.elts[r.i]=od.resolve(e,n);return r.i=(r.i+1)%_ie,i}}class gie{constructor(){this.elts=[],this.i=0}}const _ie=12,J7=new WeakMap;class E3{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const vie=Object.create(null);let Yl=class iy{constructor(e,n,r,i=Er.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||St.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&_3(this.attrs,n||e.defaultAttrs||vie)&&Er.sameSet(this.marks,r||Er.none)}copy(e=null){return e==this.content?this:new iy(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new iy(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return $t.empty;let i=this.resolve(e),a=this.resolve(n),s=r?0:i.sharedDepth(n),o=i.start(s),c=i.node(s).content.cut(i.pos-o,a.pos-o);return new $t(c,i.depth-s,a.depth-s)}replace(e,n,r){return mie(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return od.resolveCached(this,e)}resolveNoCache(e){return od.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,a=>(r.isInSet(a.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),eO(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=St.empty,i=0,a=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,a),o=s&&s.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let l=i;l<a;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let a=this.contentMatchAt(e).matchType(r),s=a&&a.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Er.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Er.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=St.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,i,r);return a.type.checkAttrs(a.attrs),a}};Yl.prototype.text=void 0;class S3 extends Yl{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):eO(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new S3(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new S3(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function eO(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Wl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new bie(e,n);if(r.next==null)return Wl.empty;let i=tO(r);r.next&&r.err("Unexpected trailing text");let a=xie(Aie(i));return wie(a,r),a}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let a=n;i&&a<r;a++)i=i.matchType(e.child(a).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function a(s,o){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return St.from(o.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:f}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let p=a(f,o.concat(u));if(p)return p}}return null}return a(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),a=i.match;if(a.matchType(e)){let s=[];for(let o=i;o.type;o=o.via)s.push(o.type);return s.reverse()}for(let s=0;s<a.next.length;s++){let{type:o,next:l}=a.next[s];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!i.type||l.validEnd)&&(r.push({match:o.contentMatch,type:o,via:i}),n[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let a=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)a+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return a}).join(`
|
|
330
330
|
`)}}Wl.empty=new Wl(!0);class bie{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function tO(t){let e=[];do e.push(Eie(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Eie(t){let e=[];do e.push(Sie(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Sie(t){let e=Cie(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=yie(t,e);else break;return e}function nO(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function yie(t,e){let n=nO(t),r=n;return t.eat(",")&&(t.next!="}"?r=nO(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Tie(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let a in n){let s=n[a];s.isInGroup(e)&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function Cie(t){if(t.eat("(")){let e=tO(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=Tie(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Aie(t){let e=[[]];return i(a(t,0),n()),e;function n(){return e.push([])-1}function r(s,o,l){let c={term:l,to:o};return e[s].push(c),c}function i(s,o){s.forEach(l=>l.to=o)}function a(s,o){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(a(c,o)),[]);if(s.type=="seq")for(let l=0;;l++){let c=a(s.exprs[l],o);if(l==s.exprs.length-1)return c;i(c,o=n())}else if(s.type=="star"){let l=n();return r(o,l),i(a(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return i(a(s.expr,o),l),i(a(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(o)].concat(a(s.expr,o));if(s.type=="range"){let l=o;for(let c=0;c<s.min;c++){let u=n();i(a(s.expr,l),u),l=u}if(s.max==-1)i(a(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let u=n();r(l,u),i(a(s.expr,l),u),l=u}return[r(l)]}else{if(s.type=="name")return[r(o,void 0,s.value)];throw new Error("Unknown expr type")}}}}function rO(t,e){return e-t}function iO(t,e){let n=[];return r(e),n.sort(rO);function r(i){let a=t[i];if(a.length==1&&!a[0].term)return r(a[0].to);n.push(i);for(let s=0;s<a.length;s++){let{term:o,to:l}=a[s];!o&&n.indexOf(l)==-1&&r(l)}}}function xie(t){let e=Object.create(null);return n(iO(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:o,to:l})=>{if(!o)return;let c;for(let u=0;u<i.length;u++)i[u][0]==o&&(c=i[u][1]);iO(t,l).forEach(u=>{c||i.push([o,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let a=e[r.join(",")]=new Wl(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let o=i[s][1].sort(rO);a.next.push({type:i[s][0],next:e[o.join(",")]||n(o)})}return a}}function wie(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],a=!i.validEnd,s=[];for(let o=0;o<i.next.length;o++){let{type:l,next:c}=i.next[o];s.push(l.name),a&&!(l.isText||l.hasRequiredAttrs())&&(a=!1),r.indexOf(c)==-1&&r.push(c)}a&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function aO(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function sO(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let a=t[r];if(a.hasDefault)i=a.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function oO(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let a=t[i];a.validate&&a.validate(e[i])}}function lO(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new Rie(t,r,e[r]);return n}let cO=class pM{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=lO(e,r.attrs),this.defaultAttrs=aO(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Wl.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:sO(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Yl(this,this.computeAttrs(e),St.from(n),Er.setFrom(r))}createChecked(e=null,n,r){return n=St.from(n),this.checkContent(n),new Yl(this,this.computeAttrs(e),n,Er.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=St.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let i=this.contentMatch.matchFragment(n),a=i&&i.fillBefore(St.empty,!0);return a?new Yl(this,e,n.append(a),Er.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){oO(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Er.none:e}static compile(e,n){let r=Object.create(null);e.forEach((a,s)=>r[a]=new pM(a,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let a in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Oie(t,e,n){let r=n.split("|");return i=>{let a=i===null?"null":typeof i;if(r.indexOf(a)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${a}`)}}class Rie{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Oie(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class y3{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=lO(e,i.attrs),this.excluded=null;let a=aO(this.attrs);this.instance=a?new Er(this,a):null}create(e=null){return!e&&this.instance?this.instance:new Er(this,sO(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((a,s)=>r[a]=new y3(a,i++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){oO(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class uO{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Mi.from(e.nodes),n.marks=Mi.from(e.marks||{}),this.nodes=cO.compile(this.spec.nodes,this),this.marks=y3.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let a=this.nodes[i],s=a.spec.content||"",o=a.spec.marks;if(a.contentMatch=r[s]||(r[s]=Wl.parse(s,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=o=="_"?null:o?dO(this,o.split(" ")):o==""||!a.inlineContent?[]:null}for(let i in this.marks){let a=this.marks[i],s=a.spec.excludes;a.excluded=s==null?[a]:s==""?[]:dO(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof cO){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new S3(r,r.defaultAttrs,e,Er.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return Yl.fromJSON(this,e)}markFromJSON(e){return Er.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function dO(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t.marks[i],s=a;if(a)n.push(a);else for(let o in t.marks){let l=t.marks[o];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function Iie(t){return t.tag!=null}function Nie(t){return t.style!=null}class Mo{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(Iie(i))this.tags.push(i);else if(Nie(i)){let a=/[^=]*/.exec(i.style)[0];r.indexOf(a)<0&&r.push(a),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let a=e.nodes[i.node];return a.contentMatch.matchType(a)})}parse(e,n={}){let r=new hO(this,n,!1);return r.addAll(e,Er.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new hO(this,n,!0);return r.addAll(e,Er.none,n.from,n.to),$t.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let a=this.tags[i];if(Mie(e,a.tag)&&(a.namespace===void 0||e.namespaceURI==a.namespace)&&(!a.context||n.matchesContext(a.context))){if(a.getAttrs){let s=a.getAttrs(e);if(s===!1)continue;a.attrs=s||void 0}return a}}}matchStyle(e,n,r,i){for(let a=i?this.styles.indexOf(i)+1:0;a<this.styles.length;a++){let s=this.styles[a],o=s.style;if(!(o.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||o.length>e.length&&(o.charCodeAt(e.length)!=61||o.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let a=i.priority==null?50:i.priority,s=0;for(;s<n.length;s++){let o=n[s];if((o.priority==null?50:o.priority)<a)break}n.splice(s,0,i)}for(let i in e.marks){let a=e.marks[i].spec.parseDOM;a&&a.forEach(s=>{r(s=gO(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let a=e.nodes[i].spec.parseDOM;a&&a.forEach(s=>{r(s=gO(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Mo(e,Mo.schemaRules(e)))}}const fO={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Die={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},pO={ol:!0,ul:!0},ld=1,Fv=2,T3=4;function mO(t,e,n){return e!=null?(e?ld:0)|(e==="full"?Fv:0):t&&t.whitespace=="pre"?ld|Fv:n&-5}class C3{constructor(e,n,r,i,a,s){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=Er.none,this.match=a||(s&T3?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(St.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ld)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let a=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-i[0].length))}}let n=St.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(St.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!fO.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class hO{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,a,s=mO(null,n.preserveWhitespace,0)|(r?T3:0);i?a=new C3(i.type,i.attrs,Er.none,!0,n.topMatch||i.type.contentMatch,s):r?a=new C3(null,null,Er.none,!0,null,s):a=new C3(e.schema.topNodeType,null,Er.none,!0,null,s),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,a=i.options&Fv?"full":this.localPreserveWS||(i.options&ld)>0;if(a==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(a)a!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
|
|
331
331
|
`);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let s=i.content[i.content.length-1],o=e.previousSibling;(!s||o&&o.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),n),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,a=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),o;pO.hasOwnProperty(s)&&this.parser.normalizeLists&&kie(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,r));e:if(l?l.ignore:Die.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(fO.hasOwnProperty(s))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),c=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let f=l&&l.skip?n:this.readStyles(e,n);f&&this.addAll(e,f),c&&this.sync(a),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?o:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
332
332
|
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let a=this.parser.matchedStyles[i],s=r.getPropertyValue(a);if(s)for(let o=void 0;;){let l=this.parser.matchStyle(a,s,this,o);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)o=l;else break}}return n}addElementByRule(e,n,r,i){let a,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r)||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(a=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let o=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}a&&this.sync(o)&&this.open--}addAll(e,n,r,i){let a=r||0;for(let s=r?e.childNodes[r]:e.firstChild,o=i==null?null:e.childNodes[i];s!=o;s=s.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(s,n);this.findAtPoint(e,a)}findPlace(e,n){let r,i;for(let a=this.open;a>=0;a--){let s=this.nodes[a],o=s.findWrapping(e);if(o&&(!r||r.length>o.length)&&(r=o,i=s,!o.length)||s.solid)break}if(!r)return null;this.sync(i);for(let a=0;a<r.length;a++)n=this.enterInner(r[a],null,n,!1);return n}insertNode(e,n){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let r=this.findPlace(e,n);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let a=Er.none;for(let s of r.concat(e.marks))(i.type?i.type.allowsMarkType(s.type):_O(s.type,e.type))&&(a=s.addToSet(a));return i.content.push(e.mark(a)),!0}return!1}enter(e,n,r,i){let a=this.findPlace(e.create(n),r);return a&&(a=this.enterInner(e,n,r,!0,i)),a}enterInner(e,n,r,i=!1,a){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let o=mO(e,a,s.options);s.options&T3&&s.content.length==0&&(o|=T3);let l=Er.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):_O(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new C3(e,n,l,i,null,o)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=ld)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),a=-(r?r.depth+1:0)+(i?0:1),s=(o,l)=>{for(;o>=0;o--){let c=n[o];if(c==""){if(o==n.length-1||o==0)continue;for(;l>=a;l--)if(s(o-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:r&&l>=a?r.node(l-a).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function kie(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&pO.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function Mie(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function gO(t){let e={};for(let n in t)e[n]=t[n];return e}function _O(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let a=[],s=o=>{a.push(o);for(let l=0;l<o.edgeCount;l++){let{type:c,next:u}=o.edge(l);if(c==e||a.indexOf(u)<0&&s(u))return!0}};if(s(i.contentMatch))return!0}}class Kl{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Bv(n).createDocumentFragment());let i=r,a=[];return e.forEach(s=>{if(a.length||s.marks.length){let o=0,l=0;for(;o<a.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(a[o][0])||c.type.spec.spanning===!1)break;o++,l++}for(;o<a.length;)i=a.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],u=this.serializeMark(c,s.isInline,n);u&&(a.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=A3(Bv(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let a=this.serializeMark(e.marks[i],e.isInline,n);a&&((a.contentDOM||a.dom).appendChild(r),r=a.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&A3(Bv(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return A3(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Kl(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=vO(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return vO(e.marks)}}function vO(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Bv(t){return t.document||window.document}const bO=new WeakMap;function Lie(t){let e=bO.get(t);return e===void 0&&bO.set(t,e=Pie(t)),e}function Pie(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function A3(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],a;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(a=Lie(r))&&a.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let o,l=n?t.createElementNS(n,i):t.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let f in c)if(c[f]!=null){let p=f.indexOf(" ");p>0?l.setAttributeNS(f.slice(0,p),f.slice(p+1),c[f]):l.setAttribute(f,c[f])}}for(let f=u;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:g}=A3(t,p,n,r);if(l.appendChild(h),g){if(o)throw new RangeError("Multiple content holes");o=g}}}return{dom:l,contentDOM:o}}const EO=65535,SO=Math.pow(2,16);function Fie(t,e){return t+e*SO}function yO(t){return t&EO}function Bie(t){return(t-(t&EO))/SO}const TO=1,CO=2,x3=4,AO=8;class Uv{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&AO)>0}get deletedBefore(){return(this.delInfo&(TO|x3))>0}get deletedAfter(){return(this.delInfo&(CO|x3))>0}get deletedAcross(){return(this.delInfo&x3)>0}}class Wa{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Wa.empty)return Wa.empty}recover(e){let n=0,r=yO(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+Bie(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,a=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[o+a],u=this.ranges[o+s],f=l+c;if(e<=f){let p=c?e==l?-1:e==f?1:n:n,h=l+i+(p<0?0:u);if(r)return h;let g=e==(n<0?l:f)?null:Fie(o/3,e-l),_=e==l?CO:e==f?TO:x3;return(n<0?e!=l:e!=f)&&(_|=AO),new Uv(h,_,g)}i+=u-c}return r?e+i:new Uv(e+i,0,null)}touches(e,n){let r=0,i=yO(n),a=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[o+a],u=l+c;if(e<=u&&o==i*3)return!0;r+=this.ranges[o+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,a=0;i<this.ranges.length;i+=3){let s=this.ranges[i],o=s-(this.inverted?a:0),l=s+(this.inverted?0:a),c=this.ranges[i+n],u=this.ranges[i+r];e(o,o+c,l,l+u),a+=u-c}}invert(){return new Wa(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Wa.empty:new Wa(e<0?[0,-e,0]:[0,0,e])}}Wa.empty=new Wa([]);class Jc{constructor(e=[],n,r=0,i=e.length){this.maps=e,this.mirror=n,this.from=r,this.to=i}slice(e=0,n=this.maps.length){return new Jc(this.maps,this.mirror,e,n)}copy(){return new Jc(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,n){this.to=this.maps.push(e),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(e){for(let n=0,r=this.maps.length;n<e.maps.length;n++){let i=e.getMirror(n);this.appendMap(e.maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this.maps.length+e.maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e.maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Jc;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let a=this.from;a<this.to;a++){let s=this.maps[a],o=s.mapResult(e,n);if(o.recover!=null){let l=this.getMirror(a);if(l!=null&&l>a&&l<this.to){a=l,e=this.maps[l].recover(o.recover);continue}}i|=o.delInfo,e=o.pos}return r?e:new Uv(e,i,null)}}const Vv=Object.create(null);class ea{getMap(){return Wa.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Vv[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Vv)throw new RangeError("Duplicate use of step JSON ID "+e);return Vv[e]=n,n.prototype.jsonID=e,n}}class ri{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new ri(e,null)}static fail(e){return new ri(null,e)}static fromReplace(e,n,r,i){try{return ri.ok(e.replace(n,r,i))}catch(a){if(a instanceof v3)return ri.fail(a.message);throw a}}}function Gv(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let a=t.child(i);a.content.size&&(a=a.copy(Gv(a.content,e,a))),a.isInline&&(a=e(a,n,i)),r.push(a)}return St.fromArray(r)}class Lo extends ea{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),a=new $t(Gv(n.content,(s,o)=>!s.isAtom||!o.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return ri.fromReplace(e,this.from,this.to,a)}invert(){return new fs(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Lo(n.pos,r.pos,this.mark)}merge(e){return e instanceof Lo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Lo(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Lo(n.from,n.to,e.markFromJSON(n.mark))}}ea.jsonID("addMark",Lo);class fs extends ea{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new $t(Gv(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return ri.fromReplace(e,this.from,this.to,r)}invert(){return new Lo(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new fs(n.pos,r.pos,this.mark)}merge(e){return e instanceof fs&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new fs(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new fs(n.from,n.to,e.markFromJSON(n.mark))}}ea.jsonID("removeMark",fs);class Po extends ea{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ri.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return ri.fromReplace(e,this.pos,this.pos+1,new $t(St.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Po(this.pos,n.marks[i]);return new Po(this.pos,this.mark)}}return new eu(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Po(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Po(n.pos,e.markFromJSON(n.mark))}}ea.jsonID("addNodeMark",Po);class eu extends ea{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ri.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return ri.fromReplace(e,this.pos,this.pos+1,new $t(St.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Po(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new eu(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new eu(n.pos,e.markFromJSON(n.mark))}}ea.jsonID("removeNodeMark",eu);class Si extends ea{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&$v(e,this.from,this.to)?ri.fail("Structure replace would overwrite content"):ri.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Wa([this.from,this.to-this.from,this.slice.size])}invert(e){return new Si(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Si(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Si)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?$t.empty:new $t(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Si(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?$t.empty:new $t(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Si(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Si(n.from,n.to,$t.fromJSON(e,n.slice),!!n.structure)}}ea.jsonID("replace",Si);class yi extends ea{constructor(e,n,r,i,a,s,o=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=a,this.insert=s,this.structure=o}apply(e){if(this.structure&&($v(e,this.from,this.gapFrom)||$v(e,this.gapTo,this.to)))return ri.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return ri.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?ri.fromReplace(e,this.from,this.to,r):ri.fail("Content does not fit in gap")}getMap(){return new Wa([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new yi(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new yi(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new yi(n.from,n.to,n.gapFrom,n.gapTo,$t.fromJSON(e,n.slice),n.insert,!!n.structure)}}ea.jsonID("replaceAround",yi);function $v(t,e,n){let r=t.resolve(e),i=n-e,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let s=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function Uie(t,e,n,r){let i=[],a=[],s,o;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let f=l.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let p=Math.max(c,e),h=Math.min(c+l.nodeSize,n),g=r.addToSet(f);for(let _=0;_<f.length;_++)f[_].isInSet(g)||(s&&s.to==p&&s.mark.eq(f[_])?s.to=h:i.push(s=new fs(p,h,f[_])));o&&o.to==p?o.to=h:a.push(o=new Lo(p,h,r))}}),i.forEach(l=>t.step(l)),a.forEach(l=>t.step(l))}function Vie(t,e,n,r){let i=[],a=0;t.doc.nodesBetween(e,n,(s,o)=>{if(!s.isInline)return;a++;let l=null;if(r instanceof y3){let c=s.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(o+s.nodeSize,n);for(let u=0;u<l.length;u++){let f=l[u],p;for(let h=0;h<i.length;h++){let g=i[h];g.step==a-1&&f.eq(i[h].style)&&(p=g)}p?(p.to=c,p.step=a):i.push({style:f,from:Math.max(o,e),to:c,step:a})}}}),i.forEach(s=>t.step(new fs(s.from,s.to,s.style)))}function zv(t,e,n,r=n.contentMatch,i=!0){let a=t.doc.nodeAt(e),s=[],o=e+1;for(let l=0;l<a.childCount;l++){let c=a.child(l),u=o+c.nodeSize,f=r.matchType(c.type);if(!f)s.push(new Si(o,u,$t.empty));else{r=f;for(let p=0;p<c.marks.length;p++)n.allowsMarkType(c.marks[p].type)||t.step(new fs(o,u,c.marks[p]));if(i&&c.isText&&n.whitespace!="pre"){let p,h=/\r?\n|\r/g,g;for(;p=h.exec(c.text);)g||(g=new $t(St.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new Si(o+p.index,o+p.index+p[0].length,g))}}o=u}if(!r.validEnd){let l=r.fillBefore(St.empty,!0);t.replace(o,o,new $t(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function Gie(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function tu(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let i=t.$from.node(r),a=t.$from.index(r),s=t.$to.indexAfter(r);if(r<t.depth&&i.canReplace(a,s,n))return r;if(r==0||i.type.spec.isolating||!Gie(i,a,s))break}return null}function $ie(t,e,n){let{$from:r,$to:i,depth:a}=e,s=r.before(a+1),o=i.after(a+1),l=s,c=o,u=St.empty,f=0;for(let g=a,_=!1;g>n;g--)_||r.index(g)>0?(_=!0,u=St.from(r.node(g).copy(u)),f++):l--;let p=St.empty,h=0;for(let g=a,_=!1;g>n;g--)_||i.after(g+1)<i.end(g)?(_=!0,p=St.from(i.node(g).copy(p)),h++):c++;t.step(new yi(l,c,s,o,new $t(u.append(p),f,h),u.size-f,!0))}function Hv(t,e,n=null,r=t){let i=zie(t,e),a=i&&Hie(r,e);return a?i.map(xO).concat({type:e,attrs:n}).concat(a.map(xO)):null}function xO(t){return{type:t,attrs:null}}function zie(t,e){let{parent:n,startIndex:r,endIndex:i}=t,a=n.contentMatchAt(r).findWrapping(e);if(!a)return null;let s=a.length?a[0]:e;return n.canReplaceWith(r,i,s)?a:null}function Hie(t,e){let{parent:n,startIndex:r,endIndex:i}=t,a=n.child(r),s=e.contentMatch.findWrapping(a.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:s}function Yie(t,e,n){let r=St.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let o=n[s].type.contentMatch.matchFragment(r);if(!o||!o.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=St.from(n[s].type.create(n[s].attrs,r))}let i=e.start,a=e.end;t.step(new yi(i,a,i,a,new $t(r,0,0),n.length,!0))}function Wie(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=t.steps.length;t.doc.nodesBetween(e,n,(s,o)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,l)&&Kie(t.doc,t.mapping.slice(a).map(o),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",g=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!g?c=!1:!h&&g&&(c=!0)}c===!1&&OO(t,s,o,a),zv(t,t.mapping.slice(a).map(o,1),r,void 0,c===null);let u=t.mapping.slice(a),f=u.map(o,1),p=u.map(o+s.nodeSize,1);return t.step(new yi(f,p,f+1,p-1,new $t(St.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&wO(t,s,o,a),!1}})}function wO(t,e,n,r){e.forEach((i,a)=>{if(i.isText){let s,o=/\r?\n|\r/g;for(;s=o.exec(i.text);){let l=t.mapping.slice(r).map(n+1+a+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function OO(t,e,n,r){e.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+a);t.replaceWith(s,s+1,e.type.schema.text(`
|