=0)$=n.activeElement;else{var E=i.tabbableGroups[0],Q=E&&E.firstTabbableNode;$=Q||c("fallbackFocus")}if(!$)throw new Error("Your focus-trap needs to have at least one focusable element");return $},d=function(){if(i.containerGroups=i.containers.map(function($){var E=Dge($,o.tabbableOptions),Q=Qge($,o.tabbableOptions),X=E.length>0?E[0]:void 0,Y=E.length>0?E[E.length-1]:void 0,B=Q.find(function(ye){return hu(ye)}),ee=Q.slice().reverse().find(function(ye){return hu(ye)}),te=!!E.find(function(ye){return ac(ye)>0});return{container:$,tabbableNodes:E,focusableNodes:Q,posTabIndexesFound:te,firstTabbableNode:X,lastTabbableNode:Y,firstDomTabbableNode:B,lastDomTabbableNode:ee,nextTabbableNode:function(ye){var ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,pe=E.indexOf(ye);return pe<0?ve?Q.slice(Q.indexOf(ye)+1).find(function(de){return hu(de)}):Q.slice(0,Q.indexOf(ye)).reverse().find(function(de){return hu(de)}):E[pe+(ve?1:-1)]}}}),i.tabbableGroups=i.containerGroups.filter(function($){return $.tabbableNodes.length>0}),i.tabbableGroups.length<=0&&!c("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(i.containerGroups.find(function($){return $.posTabIndexesFound})&&i.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},f=function($){var E=$.activeElement;if(E)return E.shadowRoot&&E.shadowRoot.activeElement!==null?f(E.shadowRoot):E},h=function($){if($!==!1&&$!==f(document)){if(!$||!$.focus){h(u());return}$.focus({preventScroll:!!o.preventScroll}),i.mostRecentlyFocusedNode=$,Fge($)&&$.select()}},p=function($){var E=c("setReturnFocus",$);return E||(E===!1?!1:$)},m=function($){var E=$.target,Q=$.event,X=$.isBackward,Y=X===void 0?!1:X;E=E||Gm(Q),d();var B=null;if(i.tabbableGroups.length>0){var ee=l(E,Q),te=ee>=0?i.containerGroups[ee]:void 0;if(ee<0)Y?B=i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode:B=i.tabbableGroups[0].firstTabbableNode;else if(Y){var ye=zA(i.tabbableGroups,function(Ee){var ne=Ee.firstTabbableNode;return E===ne});if(ye<0&&(te.container===E||_w(E,o.tabbableOptions)&&!hu(E,o.tabbableOptions)&&!te.nextTabbableNode(E,!1))&&(ye=ee),ye>=0){var ve=ye===0?i.tabbableGroups.length-1:ye-1,pe=i.tabbableGroups[ve];B=ac(E)>=0?pe.lastTabbableNode:pe.lastDomTabbableNode}else wh(Q)||(B=te.nextTabbableNode(E,!1))}else{var de=zA(i.tabbableGroups,function(Ee){var ne=Ee.lastTabbableNode;return E===ne});if(de<0&&(te.container===E||_w(E,o.tabbableOptions)&&!hu(E,o.tabbableOptions)&&!te.nextTabbableNode(E))&&(de=ee),de>=0){var V=de===i.tabbableGroups.length-1?0:de+1,ue=i.tabbableGroups[V];B=ac(E)>=0?ue.firstTabbableNode:ue.firstDomTabbableNode}else wh(Q)||(B=te.nextTabbableNode(E))}}else B=c("fallbackFocus");return B},O=function($){var E=Gm($);if(!(l(E,$)>=0)){if(Pf(o.clickOutsideDeactivates,$)){s.deactivate({returnFocus:o.returnFocusOnDeactivate});return}Pf(o.allowOutsideClick,$)||$.preventDefault()}},g=function($){var E=Gm($),Q=l(E,$)>=0;if(Q||E instanceof Document)Q&&(i.mostRecentlyFocusedNode=E);else{$.stopImmediatePropagation();var X,Y=!0;if(i.mostRecentlyFocusedNode)if(ac(i.mostRecentlyFocusedNode)>0){var B=l(i.mostRecentlyFocusedNode),ee=i.containerGroups[B].tabbableNodes;if(ee.length>0){var te=ee.findIndex(function(ye){return ye===i.mostRecentlyFocusedNode});te>=0&&(o.isKeyForward(i.recentNavEvent)?te+1=0&&(X=ee[te-1],Y=!1))}}else i.containerGroups.some(function(ye){return ye.tabbableNodes.some(function(ve){return ac(ve)>0})})||(Y=!1);else Y=!1;Y&&(X=m({target:i.mostRecentlyFocusedNode,isBackward:o.isKeyBackward(i.recentNavEvent)})),h(X||i.mostRecentlyFocusedNode||u())}i.recentNavEvent=void 0},b=function($){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;i.recentNavEvent=$;var Q=m({event:$,isBackward:E});Q&&(wh($)&&$.preventDefault(),h(Q))},v=function($){(o.isKeyForward($)||o.isKeyBackward($))&&b($,o.isKeyBackward($))},y=function($){qge($)&&Pf(o.escapeDeactivates,$)!==!1&&($.preventDefault(),s.deactivate())},w=function($){var E=Gm($);l(E,$)>=0||Pf(o.clickOutsideDeactivates,$)||Pf(o.allowOutsideClick,$)||($.preventDefault(),$.stopImmediatePropagation())},S=function(){if(i.active)return QA.activateTrap(r,s),i.delayInitialFocusTimer=o.delayInitialFocus?BA(function(){h(u())}):h(u()),n.addEventListener("focusin",g,!0),n.addEventListener("mousedown",O,{capture:!0,passive:!1}),n.addEventListener("touchstart",O,{capture:!0,passive:!1}),n.addEventListener("click",w,{capture:!0,passive:!1}),n.addEventListener("keydown",v,{capture:!0,passive:!1}),n.addEventListener("keydown",y),s},_=function(){if(i.active)return n.removeEventListener("focusin",g,!0),n.removeEventListener("mousedown",O,!0),n.removeEventListener("touchstart",O,!0),n.removeEventListener("click",w,!0),n.removeEventListener("keydown",v,!0),n.removeEventListener("keydown",y),s},T=function($){var E=$.some(function(Q){var X=Array.from(Q.removedNodes);return X.some(function(Y){return Y===i.mostRecentlyFocusedNode})});E&&h(u())},A=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(T):void 0,C=function(){A&&(A.disconnect(),i.active&&!i.paused&&i.containers.map(function($){A.observe($,{subtree:!0,childList:!0})}))};return s={get active(){return i.active},get paused(){return i.paused},activate:function($){if(i.active)return this;var E=a($,"onActivate"),Q=a($,"onPostActivate"),X=a($,"checkCanFocusTrap");X||d(),i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=n.activeElement,E==null||E();var Y=function(){X&&d(),S(),C(),Q==null||Q()};return X?(X(i.containers.concat()).then(Y,Y),this):(Y(),this)},deactivate:function($){if(!i.active)return this;var E=DA({onDeactivate:o.onDeactivate,onPostDeactivate:o.onPostDeactivate,checkCanReturnFocus:o.checkCanReturnFocus},$);clearTimeout(i.delayInitialFocusTimer),i.delayInitialFocusTimer=void 0,_(),i.active=!1,i.paused=!1,C(),QA.deactivateTrap(r,s);var Q=a(E,"onDeactivate"),X=a(E,"onPostDeactivate"),Y=a(E,"checkCanReturnFocus"),B=a(E,"returnFocus","returnFocusOnDeactivate");Q==null||Q();var ee=function(){BA(function(){B&&h(p(i.nodeFocusedBeforeActivation)),X==null||X()})};return B&&Y?(Y(p(i.nodeFocusedBeforeActivation)).then(ee,ee),this):(ee(),this)},pause:function($){if(i.paused||!i.active)return this;var E=a($,"onPause"),Q=a($,"onPostPause");return i.paused=!0,E==null||E(),_(),C(),Q==null||Q(),this},unpause:function($){if(!i.paused||!i.active)return this;var E=a($,"onUnpause"),Q=a($,"onPostUnpause");return i.paused=!1,E==null||E(),d(),S(),C(),Q==null||Q(),this},updateContainerElements:function($){var E=[].concat($).filter(Boolean);return i.containers=E.map(function(Q){return typeof Q=="string"?n.querySelector(Q):Q}),i.active&&d(),C(),this}},s.updateContainerElements(e),s};function Xge(e,t={}){let n;const{immediate:r,...o}=t,i=ge(!1),s=ge(!1),a=f=>n&&n.activate(f),l=f=>n&&n.deactivate(f),c=()=>{n&&(n.pause(),s.value=!0)},u=()=>{n&&(n.unpause(),s.value=!1)},d=q(()=>{const f=jo(e);return(Array.isArray(f)?f:[f]).map(h=>{const p=jo(h);return typeof p=="string"?p:ea(p)}).filter($de)});return We(d,f=>{f.length&&(n=OD(f,{...o,onActivate(){i.value=!0,t.onActivate&&t.onActivate()},onDeactivate(){i.value=!1,t.onDeactivate&&t.onDeactivate()}}),r&&a())},{flush:"post"}),Xd(()=>l()),{hasFocus:i,isPaused:s,activate:a,deactivate:l,pause:c,unpause:u}}const yD=Symbol(),jA=20,pu=20,WA=1,Oy=Qe({inheritAttrs:!1,__name:"UiPopover",props:{fullWidth:{type:Boolean},modelValue:{type:Boolean,default:void 0},initialFocus:{type:Function,default:void 0},fixed:{type:Boolean},position:{default:"bottom"},alignment:{default:"left"},offset:{default:6},maxHeight:{default:void 0},noScroll:{type:Boolean},disableClickOutside:{type:Boolean,default:!1},disableClickOutsideOnTargetClick:{type:Boolean},zIndexClass:{default:"z-50"},displayArrow:{type:Boolean,default:!1},target:{default:void 0}},emits:["update:modelValue","close"],setup(e,{emit:t}){const{theme:n}=qe(Vp),r=e,o=t,i=ge(),s=r.modelValue!==void 0?q({get:()=>r.modelValue,set:Y=>o("update:modelValue",Y||!1)}):ge(!1),{prevent:a,reset:l}=qe(yD,{prevent:()=>{},reset:()=>{}}),{hasFocus:c,deactivate:u}=Xge(i,{immediate:!!r.initialFocus,initialFocus:()=>(r.initialFocus?r.initialFocus():void 0)||!1,allowOutsideClick:!0});We(s,Y=>{!Y&&c.value&&u()});const d=ge(),f=()=>{if(!r.target){d.value=void 0;return}d.value=r.target.getBoundingClientRect()},h=ge(),p=()=>{var Y;if(!i.value){h.value=void 0;return}h.value=(Y=i.value)==null?void 0:Y.getBoundingClientRect()},m=q(()=>h.value!==void 0),O=()=>{f(),p()};typeof process<"u"&&Hp(window,"resize",O);const g=ge(!0);We(s,Y=>{Y?(a(),g.value=!0,setTimeout(()=>{O(),g.value=!1})):(setTimeout(()=>{l()}),g.value=!1)});const b=()=>{p()},{width:v,height:y}=jde(i),w=r.displayArrow?6:0,S=q(()=>{if(!d.value)return{};if(!h.value)return{opacity:"0"};const Y=r.position==="left"?d.value.left-v.value-r.offset-w:r.position==="right"?d.value.right+r.offset+w:r.alignment==="left"?d.value.left:r.alignment==="center"?d.value.left+d.value.width/2-v.value/2:void 0,B=r.position==="right"||r.position==="left"?void 0:r.alignment==="right"?document.documentElement.clientWidth-d.value.right:void 0,ee=r.position==="bottom"?d.value.bottom+r.offset+w+(r.fixed?0:document.documentElement.scrollTop):void 0,te=r.position==="right"||r.position==="left"?document.documentElement.clientHeight-(r.fixed?0:document.documentElement.scrollTop)-d.value.bottom-y.value/2+d.value.height/2:r.position==="top"?document.documentElement.clientHeight-(r.fixed?0:document.documentElement.scrollTop)-d.value.top+r.offset+w:void 0,ye=r.fullWidth?d.value.width:void 0,ve=r.position==="bottom"?Math.min(r.maxHeight||1/0,document.documentElement.scrollHeight-(ee||0)-jA):Math.min(r.maxHeight||1/0,document.documentElement.clientHeight-(te||0)-jA),pe=pu+(B!==void 0?B:Y!==void 0?Y:pu);return{left:Y,right:B,top:ee,bottom:te,width:ye,maxHeight:ve,horizontalPadding:pe}}),_=q(()=>{if(!S.value)return{};const{left:Y,right:B,top:ee,bottom:te}=S.value;return{left:Y!==void 0?`${Y}px`:void 0,right:B!==void 0?`${B}px`:void 0,top:ee!==void 0?`${ee}px`:void 0,bottom:te!==void 0?`${te}px`:void 0,filter:n.value.boxShadow["2dp"].map(Fae).join(" ")}}),T=q(()=>{if(!S.value)return{};const{width:Y,maxHeight:B,horizontalPadding:ee}=S.value;return{width:Y!==void 0?`${Y}px`:void 0,maxHeight:B!==void 0?`${B}px`:void 0,maxWidth:`calc(100vw - ${ee}px)`}}),A=q(()=>{if(!d.value||!_.value)return{};if(!h.value)return{opacity:"0"};const Y=r.alignment==="left"&&(r.position=="top"||r.position=="bottom")?Math.floor((d.value.width-pu)/2):r.alignment==="center"&&(r.position=="top"||r.position=="bottom")?Math.floor((v.value-pu)/2):void 0,B=r.position==="left"?0:r.alignment==="right"&&(r.position==="top"||r.position==="bottom")?Math.floor((d.value.width-pu)/2):void 0,ee=r.position==="bottom"?-WA:r.position==="left"||r.position==="right"?Math.floor((y.value-pu)/2):void 0,te=r.position==="top"?-w/2+WA:void 0;return{left:Y!==void 0?`${Y}px`:void 0,right:B!==void 0?`${B}px`:void 0,top:ee!==void 0?`${ee}px`:void 0,bottom:te!==void 0?`${te}px`:void 0}}),C=q(()=>{if(!r.displayArrow)return"";switch(r.position){case"top":return"before:border-t-surface before:bottom-[-3px] before:border-x-[10px] before:border-t-[6px] before:border-x-transparent before:h-[6px]";case"bottom":return"before:border-b-surface before:top-[-5px] before:border-x-[10px] before:border-b-[6px] before:border-x-transparent before:h-[6px]";case"left":return"before:border-l-surface before:right-[-5px] before:border-y-[10px] before:border-l-[6px] before:border-y-transparent before:w-[6px]";case"right":return"before:border-r-surface before:left-[-5px] before:border-y-[10px] before:border-r-[6px] before:border-y-transparent before:w-[6px]"}return""}),$=()=>{s.value=!s.value},E=Y=>{var B;const ee=Y.target?Y.target:null;r.disableClickOutside||!s.value||r.disableClickOutsideOnTargetClick&&(B=r.target)!=null&&B.contains(ee)||Q()},Q=()=>{o("close"),setTimeout(()=>{s.value=!1})};Dde("Escape",()=>{Q()});const X=q(()=>{if(r.position==="top"){if(r.fullWidth)return"origin-bottom";if(r.alignment==="right")return"origin-bottom-right";if(r.alignment==="left")return"origin-bottom-left"}if(r.position==="bottom"){if(r.fullWidth)return"origin-top";if(r.alignment==="right")return"origin-top-right";if(r.alignment==="left")return"origin-top-left"}return""});return(Y,B)=>(W(),oe(wt,null,[Ve(Y.$slots,"activator",Kr(Jr({toggle:$}))),(W(),Me(iU,{to:"body"},[Oe("div",{class:it(m.value?"":"fixed")},[De(rd,{"enter-active-class":"transition-all duration-100 ease-out","leave-active-class":"transition-all duration-75 ease-in","enter-from-class":"opacity-0 scale-95","leave-to-class":"opacity-0 scale-95",onAfterLeave:b},{default:Ne(()=>[U(s)?(W(),oe("div",Ce({key:0},{...Y.$attrs,...Y.$qa("uipopover")},{class:[Y.zIndexClass,Y.fixed||g.value?"fixed":"absolute",Y.displayArrow?" before:absolute":""],style:_.value}),[bl((W(),oe("div",{ref_key:"containerRef",ref:i,style:ro(T.value),class:it([[g.value?"!scale-100":"",X.value,Y.noScroll?"":"overflow-y-auto"],"flex flex-col overflow-hidden rounded bg-surface"])},[Ve(Y.$slots,"default",Kr(Jr({close:Q})))],6)),[[U(uD),E]]),Y.displayArrow?(W(),oe("div",{key:0,class:it(["absolute -z-10 size-[20px] before:absolute",C.value]),style:ro(A.value)},null,6)):xe("",!0)],16)):xe("",!0)]),_:3})],2)]))],64))}}),Hge={key:1,class:"ml-1 inline-block align-top"},Yge={class:"flex h-5 items-center justify-center"},Gge={key:0,class:"flex gap-x-1"},Kge={key:1,class:"mt-2"},nm=Qe({__name:"UiField",props:{hideError:{type:Boolean},hideLabel:{type:Boolean},label:{},required:{type:Boolean},description:{},v$:{},modelValue:{type:[String,Number,Boolean]},focused:{type:Boolean},inline:{type:Boolean},disabled:{type:Boolean},fieldClass:{},labelClass:{},skeleton:{type:Boolean},showCounter:{type:Boolean},count:{},counterLimit:{}},setup(e){const t=e,n=l2(),r=q(()=>!!t.label||!!n.label),o=q(()=>!!t.description||!!n.description),i=q(()=>r.value&&!t.hideLabel),s=q(()=>o.value),a=qe(mi),l=q(()=>t.focused&&!!t.modelValue),c=q(()=>t.v$?t.v$.$anyDirty:null),u=q(()=>t.v$?t.v$.$silentErrors:null),d=q(()=>!(c.value===tge||!u.value||u.value.length===0)),f=q(()=>d.value?pge(U(u.value[0].$message)).field:null),h=ge();return(p,m)=>p.skeleton?(W(),oe("div",{key:1,class:it([!i.value&&s.value?"pt-[22px]":"",i.value&&!s.value?"pt-6":"",i.value&&s.value?"pt-[46px]":"",p.inline?"sm:pt-0":"",p.showCounter?"pb-[22px]":""])},[Ve(p.$slots,"default",Kr(Jr({error:d.value})))],2)):(W(),Me(U(Oy),{key:0,"model-value":!!(p.$slots.tooltip&&l.value),alignment:"right",position:"top",target:h.value},{activator:Ne(()=>[Oe("div",Ce({ref_key:"root",ref:h,class:["flex min-w-0 flex-col gap-x-4 gap-y-1",[p.inline?"justify-between sm:flex-row":"",p.fieldClass]]},{...p.$attrs,...p.$qa("uifield"),...p.$qa("label",p.label),...p.$qa("disabled",!!p.disabled)}),[r.value||o.value?(W(),oe("div",{key:0,class:it(["flex flex-col gap-y-1",[p.inline?"sm:w-56 sm:pt-2 ":""]])},[r.value?(W(),oe("div",Ce({key:0,class:p.hideLabel?"sr-only":""},p.$qa("label")),[Oe("label",{class:it([[p.labelClass,U(_r)(U(a).field.labelFontWeight),t.disabled?"text-text-disabled":"text-text"],"break-words typography-label"])},[Ve(p.$slots,"label",{},()=>[Dn(rt(p.label),1)])],2),p.required&&U(a).field.showRequiredIndicator?(W(),oe("span",Ce({key:0},p.$qa("required"),{class:"not-sr-only ml-1 text-14 text-text-critical"}),"*",16)):xe("",!0),p.$slots.labelHelper?(W(),oe("span",Hge,[Oe("div",Yge,[Ve(p.$slots,"labelHelper")])])):xe("",!0)],16)):xe("",!0),o.value?(W(),oe("div",Ce({key:"description"},p.$qa("description"),{class:"break-words text-12 text-text-helper"}),[Ve(p.$slots,"description",{},()=>[Dn(rt(p.description),1)])],16)):xe("",!0)],2)):xe("",!0),Oe("div",{class:it(p.inline?"grow":"")},[Ve(p.$slots,"default",Kr(Jr({error:d.value}))),d.value&&!p.hideError||p.showCounter?(W(),oe("div",Gge,[d.value&&!p.hideError?(W(),oe("div",Ce({key:"error"},p.$qa("error"),{class:"inline-flex grow pt-1 text-12 text-text-critical"}),[De(U(Ude),{class:"mr-1 size-4 shrink-0 text-icon-critical"}),Dn(rt(f.value),1)],16)):xe("",!0),p.showCounter?(W(),oe("div",Ce({key:1},p.$qa("counter"),{class:["shrink-0 grow pt-1 text-right text-12",p.count>p.counterLimit?"text-text-critical":"text-text-placeholder"]}),rt(`${p.count} / ${p.counterLimit}`),17)):xe("",!0)])):xe("",!0),p.$slots.bottom?(W(),oe("div",Kge,[Ve(p.$slots,"bottom")])):xe("",!0)],2)],16)]),default:Ne(()=>[Ve(p.$slots,"tooltip")]),_:3},8,["model-value","target"]))}}),Jge=["tabindex","required","disabled","autocomplete","type","min","max","maxlength","placeholder"],ebe=Qe({__name:"UiInput",props:er({error:{type:Boolean,default:!1},leftIcon:{default:void 0},rightIcon:{default:void 0},type:{default:"text"},required:{type:Boolean,default:!1},placeholder:{default:void 0},maxlength:{default:void 0},min:{default:void 0},max:{default:void 0},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},autocomplete:{default:void 0},tabindex:{default:void 0},skeleton:{type:Boolean,default:!1}},{modelValue:{required:!0},modelModifiers:{}}),emits:er(["change","clear","focus","blur","keydown","keypress"],["update:modelValue"]),setup(e,{expose:t,emit:n}){const r=Wi(e,"modelValue"),o=e,i=n,s=qe(mi),a=q(()=>o.error?["border-border-critical","focus:border-border-critical-subtle"]:o.disabled?["border-border-disabled"]:s.value.field.border?["border-border","focus:border-border-subtle"]:["border-transparent"]),l=q(()=>o.error?["bg-surface-critical-subtle"]:o.disabled?["bg-surface-disabled"]:[s.value.field.backgroundColor==="subtle"?"bg-surface-subtle":"bg-surface"]),c=l2(),u=ge(!1),d=q(()=>!!(o.leftIcon||c.left)),f=q(()=>!!(o.rightIcon||c.right||o.clearable)),h=ge(),p=()=>{var y;return(y=h.value)==null?void 0:y.focus()};t({inputElement:h,focusInput:p,blurInput:()=>{var y;return(y=h.value)==null?void 0:y.blur()},showDatePicker:()=>{var y;if(o.type==="date")try{(y=h.value)==null||y.showPicker()}catch{}else throw new Error("showDatePicker is only available for type date")}});const m=()=>{r.value="",i("clear"),p()},O=y=>{o.disabled||(i("focus",y),u.value=!0)},g=y=>{i("blur",y),u.value=!1},b=y=>i("change",y.target.value),v=y=>{o.type==="number"&&y.target.blur()};return(y,w)=>y.skeleton?(W(),Me(U(ks),{key:0,class:"h-[36px] rounded"})):(W(),oe("div",Ce({key:1},y.$qa("uiinput"),{class:["relative flex rounded border",[l.value,a.value,u.value?"ring-2 ring-focused":"",U(s).field.shadow?"shadow-2dp":""]]}),[d.value?(W(),oe("div",{key:0,class:"flex items-center",onClick:p},[Ve(y.$slots,"left",Kr(Jr({error:y.error})),()=>[y.leftIcon?(W(),Me(Ii(y.leftIcon),{key:0,class:"ml-3 size-5 text-icon","aria-hidden":"true"})):xe("",!0)],!0)])):xe("",!0),bl(Oe("input",{onWheel:v,ref_key:"inputElement",ref:h,"onUpdate:modelValue":w[0]||(w[0]=S=>r.value=S),tabindex:y.tabindex,required:y.required,disabled:y.disabled,autocomplete:y.autocomplete,type:y.type,min:y.min,max:y.max,maxlength:y.maxlength,placeholder:y.placeholder,class:it(["block w-full truncate border-none bg-transparent px-3 py-[7px] text-14 !ring-transparent placeholder:font-normal placeholder:text-text-placeholder",[y.disabled?"text-text-disabled":"text-text-on-input",U(_r)(U(s).field.inputFontWeight)]]),onChange:b,onKeydown:w[1]||(w[1]=S=>y.$emit("keydown",S)),onKeypress:w[2]||(w[2]=S=>y.$emit("keypress",S)),onFocus:w[3]||(w[3]=S=>O(S)),onBlur:w[4]||(w[4]=S=>g(S))},null,42,Jge),[[zZ,r.value]]),f.value?(W(),oe("div",{key:1,class:"flex items-center",onClick:p},[Ve(y.$slots,"right",Kr(Jr({error:y.error})),()=>[y.clearable?bl((W(),Me(U(X2),{key:0,class:"pointer-events-auto mr-3 size-5 cursor-pointer text-icon hover:text-icon",onClick:m},null,512)),[[B1,r.value]]):y.rightIcon?(W(),Me(Ii(y.rightIcon),{key:1,class:it(["mr-3 size-5 text-icon",{"cursor-pointer":y.type==="date"}]),"aria-hidden":"true"},null,8,["class"])):xe("",!0)],!0)])):xe("",!0)],16))}}),_E=ay(ebe,[["__scopeId","data-v-084e9d2c"]]);function tbe(){var e=window.navigator.userAgent,t=e.indexOf("MSIE ");if(t>0)return parseInt(e.substring(t+5,e.indexOf(".",t)),10);var n=e.indexOf("Trident/");if(n>0){var r=e.indexOf("rv:");return parseInt(e.substring(r+3,e.indexOf(".",r)),10)}var o=e.indexOf("Edge/");return o>0?parseInt(e.substring(o+5,e.indexOf(".",o)),10):-1}let nb;function I_(){I_.init||(I_.init=!0,nb=tbe()!==-1)}var yy={name:"ResizeObserver",props:{emitOnMount:{type:Boolean,default:!1},ignoreWidth:{type:Boolean,default:!1},ignoreHeight:{type:Boolean,default:!1}},emits:["notify"],mounted(){I_(),wr(()=>{this._w=this.$el.offsetWidth,this._h=this.$el.offsetHeight,this.emitOnMount&&this.emitSize()});const e=document.createElement("object");this._resizeObject=e,e.setAttribute("aria-hidden","true"),e.setAttribute("tabindex",-1),e.onload=this.addResizeHandlers,e.type="text/html",nb&&this.$el.appendChild(e),e.data="about:blank",nb||this.$el.appendChild(e)},beforeUnmount(){this.removeResizeHandlers()},methods:{compareAndNotify(){(!this.ignoreWidth&&this._w!==this.$el.offsetWidth||!this.ignoreHeight&&this._h!==this.$el.offsetHeight)&&(this._w=this.$el.offsetWidth,this._h=this.$el.offsetHeight,this.emitSize())},emitSize(){this.$emit("notify",{width:this._w,height:this._h})},addResizeHandlers(){this._resizeObject.contentDocument.defaultView.addEventListener("resize",this.compareAndNotify),this.compareAndNotify()},removeResizeHandlers(){this._resizeObject&&this._resizeObject.onload&&(!nb&&this._resizeObject.contentDocument&&this._resizeObject.contentDocument.defaultView.removeEventListener("resize",this.compareAndNotify),this.$el.removeChild(this._resizeObject),this._resizeObject.onload=null,this._resizeObject=null)}}};const nbe=tU();Jq("data-v-b329ee4c");const rbe={class:"resize-observer",tabindex:"-1"};eU();const obe=nbe((e,t,n,r,o,i)=>(W(),Me("div",rbe)));yy.render=obe;yy.__scopeId="data-v-b329ee4c";yy.__file="src/components/ResizeObserver.vue";function rb(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?rb=function(t){return typeof t}:rb=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rb(e)}function ibe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sbe(e,t){for(var n=0;n e.length)&&(t=e.length);for(var n=0,r=new Array(t);n 2&&arguments[2]!==void 0?arguments[2]:{},r,o,i,s=function(a){for(var l=arguments.length,c=new Array(l>1?l-1:0),u=1;u 1){var l=s.find(function(u){return u.isIntersecting});l&&(a=l)}if(r.callback){var c=a.isIntersecting&&a.intersectionRatio>=r.threshold;if(c===r.oldResult)return;r.oldResult=c,r.callback(c,a)}},this.options.intersection),wr(function(){r.observer&&r.observer.observe(r.el)})}}},{key:"destroyObserver",value:function(){this.observer&&(this.observer.disconnect(),this.observer=null),this.callback&&this.callback._clear&&(this.callback._clear(),this.callback=null)}},{key:"threshold",get:function(){return this.options.intersection&&typeof this.options.intersection.threshold=="number"?this.options.intersection.threshold:0}}]),e}();function wD(e,t,n){var r=t.value;if(r)if(typeof IntersectionObserver>"u")console.warn("[vue-observe-visibility] IntersectionObserver API is not available in your browser. Please install this polyfill: https://github.com/w3c/IntersectionObserver/tree/master/polyfill");else{var o=new pbe(e,r,n);e._vue_visibilityState=o}}function mbe(e,t,n){var r=t.value,o=t.oldValue;if(!vD(r,o)){var i=e._vue_visibilityState;if(!r){SD(e);return}i?i.createObserver(r,n):wD(e,{value:r},n)}}function SD(e){var t=e._vue_visibilityState;t&&(t.destroyObserver(),delete e._vue_visibilityState)}var gbe={beforeMount:wD,updated:mbe,unmounted:SD},bbe={itemsLimit:1e3},Obe=/(auto|scroll)/;function _D(e,t){return e.parentNode===null?t:_D(e.parentNode,t.concat([e]))}var kw=function(e,t){return getComputedStyle(e,null).getPropertyValue(t)},ybe=function(e){return kw(e,"overflow")+kw(e,"overflow-y")+kw(e,"overflow-x")},vbe=function(e){return Obe.test(ybe(e))};function qA(e){if(e instanceof HTMLElement||e instanceof SVGElement){for(var t=_D(e.parentNode,[]),n=0;n {this.$_prerender=!1,this.updateVisibleItems(!0),this.ready=!0})},activated(){const e=this.$_lastUpdateScrollPosition;typeof e=="number"&&this.$nextTick(()=>{this.scrollToPosition(e)})},beforeUnmount(){this.removeListeners()},methods:{addView(e,t,n,r,o){const i=PO({id:kbe++,index:t,used:!0,key:r,type:o}),s=ps({item:n,position:0,nr:i});return e.push(s),s},unuseView(e,t=!1){const n=this.$_unusedViews,r=e.nr.type;let o=n.get(r);o||(o=[],n.set(r,o)),o.push(e),t||(e.nr.used=!1,e.position=-9999)},handleResize(){this.$emit("resize"),this.ready&&this.updateVisibleItems(!1)},handleScroll(e){if(!this.$_scrollDirty){if(this.$_scrollDirty=!0,this.$_updateTimeout)return;const t=()=>requestAnimationFrame(()=>{this.$_scrollDirty=!1;const{continuous:n}=this.updateVisibleItems(!1,!0);n||(clearTimeout(this.$_refreshTimout),this.$_refreshTimout=setTimeout(this.handleScroll,this.updateInterval+100))});t(),this.updateInterval&&(this.$_updateTimeout=setTimeout(()=>{this.$_updateTimeout=0,this.$_scrollDirty&&t()},this.updateInterval))}},handleVisibilityChange(e,t){this.ready&&(e||t.boundingClientRect.width!==0||t.boundingClientRect.height!==0?(this.$emit("visible"),requestAnimationFrame(()=>{this.updateVisibleItems(!1)})):this.$emit("hidden"))},updateVisibleItems(e,t=!1){const n=this.itemSize,r=this.gridItems||1,o=this.itemSecondarySize||n,i=this.$_computedMinItemSize,s=this.typeField,a=this.simpleArray?null:this.keyField,l=this.items,c=l.length,u=this.sizes,d=this.$_views,f=this.$_unusedViews,h=this.pool,p=this.itemIndexByKey;let m,O,g,b,v;if(!c)m=O=b=v=g=0;else if(this.$_prerender)m=b=0,O=v=Math.min(this.prerender,l.length),g=null;else{const C=this.getScroll();if(t){let Q=C.start-this.$_lastUpdateScrollPosition;if(Q<0&&(Q=-Q),n===null&&QC.start&&(Y=B),B=~~((X+Y)/2);while(B!==ee);for(B<0&&(B=0),m=B,g=u[c-1].accumulator,O=B;O c&&(O=c)),b=m;b c&&(O=c),b<0&&(b=0),v>c&&(v=c),g=Math.ceil(c/r)*n}}O-m>bbe.itemsLimit&&this.itemsLimitError(),this.totalSize=g;let y;const w=m<=this.$_endIndex&&O>=this.$_startIndex;if(w)for(let C=0,$=h.length;C<$;C++)y=h[C],y.nr.used&&(e&&(y.nr.index=p[y.item[a]]),(y.nr.index==null||y.nr.index =O)&&this.unuseView(y));const S=w?null:new Map;let _,T,A;for(let C=m;C =E.length)&&(y=this.addView(h,C,_,$,T),this.unuseView(y,!0),E=f.get(T)),y=E[A],S.set(T,A+1)),d.delete(y.nr.key),y.nr.used=!0,y.nr.index=C,y.nr.key=$,y.nr.type=T,d.set($,y),Q=!0;else if(!y.nr.used&&(y.nr.used=!0,Q=!0,E)){const X=E.indexOf(y);X!==-1&&E.splice(X,1)}y.item=_,Q&&(C===l.length-1&&this.$emit("scroll-end"),C===0&&this.$emit("scroll-start")),n===null?(y.position=u[C-1].accumulator,y.offset=0):(y.position=Math.floor(C/r)*n,y.offset=C%r*o)}return this.$_startIndex=m,this.$_endIndex=O,this.emitUpdate&&this.$emit("update",m,O,b,v),clearTimeout(this.$_sortTimer),this.$_sortTimer=setTimeout(this.sortViews,this.updateInterval+300),{continuous:w}},getListenerTarget(){let e=qA(this.$el);return window.document&&(e===window.document.documentElement||e===window.document.body)&&(e=window),e},getScroll(){const{$el:e,direction:t}=this,n=t==="vertical";let r;if(this.pageMode){const o=e.getBoundingClientRect(),i=n?o.height:o.width;let s=-(n?o.top:o.left),a=n?window.innerHeight:window.innerWidth;s<0&&(a+=s,s=0),s+a>i&&(a=i-s),r={start:s,end:s+a}}else n?r={start:e.scrollTop,end:e.scrollTop+e.clientHeight}:r={start:e.scrollLeft,end:e.scrollLeft+e.clientWidth};return r},applyPageMode(){this.pageMode?this.addListeners():this.removeListeners()},addListeners(){this.listenerTarget=this.getListenerTarget(),this.listenerTarget.addEventListener("scroll",this.handleScroll,D_?{passive:!0}:!1),this.listenerTarget.addEventListener("resize",this.handleResize)},removeListeners(){this.listenerTarget&&(this.listenerTarget.removeEventListener("scroll",this.handleScroll),this.listenerTarget.removeEventListener("resize",this.handleResize),this.listenerTarget=null)},scrollToItem(e){let t;const n=this.gridItems||1;this.itemSize===null?t=e>0?this.sizes[e-1].accumulator:0:t=Math.floor(e/n)*this.itemSize,this.scrollToPosition(t)},scrollToPosition(e){const t=this.direction==="vertical"?{scroll:"scrollTop",start:"top"}:{scroll:"scrollLeft",start:"left"};let n,r,o;if(this.pageMode){const i=qA(this.$el),s=i.tagName==="HTML"?0:i[t.scroll],a=i.getBoundingClientRect(),l=this.$el.getBoundingClientRect()[t.start]-a[t.start];n=i,r=t.scroll,o=e+s+l}else n=this.$el,r=t.scroll,o=e;n[r]=o},itemsLimitError(){throw setTimeout(()=>{console.log("It seems the scroller element isn't scrolling, so it tries to render all the items at once.","Scroller:",this.$el),console.log("Make sure the scroller has a fixed height (or width) and 'overflow-y' (or 'overflow-x') set to 'auto' so it can scroll correctly and only render the items visible in the scroll viewport.")}),new Error("Rendered items limit reached")},sortViews(){this.pool.sort((e,t)=>e.nr.index-t.nr.index)}}};const xbe={key:0,ref:"before",class:"vue-recycle-scroller__slot"},Ebe={key:1,ref:"after",class:"vue-recycle-scroller__slot"};function Tbe(e,t,n,r,o,i){const s=Bh("ResizeObserver"),a=SU("observe-visibility");return bl((W(),oe("div",{class:it(["vue-recycle-scroller",{ready:o.ready,"page-mode":n.pageMode,[`direction-${e.direction}`]:!0}]),onScrollPassive:t[0]||(t[0]=(...l)=>i.handleScroll&&i.handleScroll(...l))},[e.$slots.before?(W(),oe("div",xbe,[Ve(e.$slots,"before")],512)):xe("v-if",!0),(W(),Me(Ii(n.listTag),{ref:"wrapper",style:ro({[e.direction==="vertical"?"minHeight":"minWidth"]:o.totalSize+"px"}),class:it(["vue-recycle-scroller__item-wrapper",n.listClass])},{default:Ne(()=>[(W(!0),oe(wt,null,si(o.pool,l=>(W(),Me(Ii(n.itemTag),Ce({key:l.nr.id,style:o.ready?{transform:`translate${e.direction==="vertical"?"Y":"X"}(${l.position}px) translate${e.direction==="vertical"?"X":"Y"}(${l.offset}px)`,width:n.gridItems?`${e.direction==="vertical"&&n.itemSecondarySize||n.itemSize}px`:void 0,height:n.gridItems?`${e.direction==="horizontal"&&n.itemSecondarySize||n.itemSize}px`:void 0}:null,class:["vue-recycle-scroller__item-view",[n.itemClass,{hover:!n.skipHover&&o.hoverKey===l.nr.key}]]},_U(n.skipHover?{}:{mouseenter:()=>{o.hoverKey=l.nr.key},mouseleave:()=>{o.hoverKey=null}})),{default:Ne(()=>[Ve(e.$slots,"default",{item:l.item,index:l.nr.index,active:l.nr.used})]),_:2},1040,["style","class"]))),128)),Ve(e.$slots,"empty")]),_:3},8,["style","class"])),e.$slots.after?(W(),oe("div",Ebe,[Ve(e.$slots,"after")],512)):xe("v-if",!0),De(s,{onNotify:i.handleResize},null,8,["onNotify"])],34)),[[a,i.handleVisibilityChange]])}kE.render=Tbe;kE.__file="src/components/RecycleScroller.vue";const Cbe=Qe({__name:"UiThemeProviderInternal",props:{clean:{type:Boolean},theme:{},overrides:{}},setup(e){const t=e,n=q(()=>tN(t.clean?o.value:t.overrides||{})),r=q(()=>n.value.reduce((i,{name:s,value:a})=>({...i,[s]:a}),{})),o=q(()=>i_(t.theme,t.overrides||{}));return Ft(mi,o),(i,s)=>(W(),oe("div",{style:ro(r.value)},[Ve(i.$slots,"default")],4))}}),Pbe=Qe({__name:"UiThemeProvider",props:{clean:{type:Boolean},overrides:{}},setup(e){const t=e,{buildCleanTheme:n}=qe(Vp),r=qe(mi),o=q(()=>t.clean?n():r.value);return(i,s)=>(W(),Me(Cbe,{theme:o.value,overrides:i.overrides,clean:i.clean},{default:Ne(()=>[Ve(i.$slots,"default")]),_:3},8,["theme","overrides","clean"]))}}),Abe={key:0,class:"px-2 pt-2"},$be=["tabindex","onKeydown"],Mbe={key:0,class:"bg-surface-neutral-subtle px-4 py-2 text-12 font-semibold uppercase"},Rbe={key:1},Ibe={key:0},Lbe={class:"p-2"},Nbe=Qe({__name:"UiOptionList",props:{clearable:{type:Boolean,default:!1},searchable:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},modelValue:{type:[Number,Boolean,Array,String,null],default:null},options:{},recycle:{type:Boolean,default:!1},recycleBuffer:{default:50},itemSize:{default:36},grouped:{type:Boolean,default:!1},emptyText:{default:void 0},loading:{type:Boolean,default:!1},arrowsNavigation:{type:Boolean,default:!1},twoLines:{type:Boolean,default:!1}},emits:["update:modelValue","close","search-change","selected"],setup(e,{expose:t,emit:n}){const r=e,{t:o}=Vd(),i=n,s=ge([]),a=ge(""),l=q(()=>r.grouped?r.options:[{title:void 0,options:r.options}]),c=q(()=>(a.value?l.value.map(E=>({...E,options:E.options.filter(Q=>{var X;return(X=Q.label)==null?void 0:X.toLocaleLowerCase().includes(a.value.toLocaleLowerCase())})})):l.value).filter(E=>E.options.length>0)),u=q(()=>c.value.flatMap(E=>E.options)),d=q(()=>u.value.filter(E=>!E.disabled)),f=(E,Q)=>{if(Q&&i("selected",E),r.multiple){const X=Q?[...r.modelValue||[],E]:(r.modelValue||[]).filter(Y=>Y!==E);i("update:modelValue",X)}else Q?i("update:modelValue",E):i("update:modelValue",r.clearable?null:E)};Ft("toggle",f),Ft("value",q(()=>r.modelValue===!1||typeof r.modelValue=="number"?r.modelValue:r.modelValue||(r.multiple?[]:null))),Ft("multiple",q(()=>r.multiple)),Ft("arrowsNavigation",q(()=>r.arrowsNavigation)),Ft("twoLines",q(()=>r.twoLines));const h=ge(null),p=ge(),m=q(()=>{var E;return(E=h.value)==null?void 0:E.inputElement}),O=q(()=>{var E;return r.searchable?(E=h.value)==null?void 0:E.inputElement:p.value}),g=()=>{var E;return(E=h.value)==null?void 0:E.focusInput()},b=()=>$(),v=ge(),y=q(()=>{if(v.value!==void 0)return d.value[v.value]}),w=q(()=>{if(y.value!==void 0)return y.value.value}),S=q(()=>{if(y.value===void 0)return;const E=u.value.findIndex(Q=>Q===y.value);return E>-1?E:void 0});Ft("focusedItemValue",w),We(a,()=>{v.value=void 0});const _=()=>{if(r.recycle||S.value===void 0||!s.value)return;const E=s.value[S.value];E&&E.scrollIntoView()},T=()=>{r.arrowsNavigation&&(v.value=v.value!==void 0?v.value===d.value.length-1?void 0:v.value+1:0,_())},A=()=>{r.arrowsNavigation&&(v.value=v.value!==void 0?v.value===0?void 0:v.value-1:d.value.length-1,_())},C=E=>r.multiple?r.modelValue instanceof Array&&r.modelValue.includes(E)||!1:r.modelValue===E,$=()=>{r.arrowsNavigation&&w.value!==void 0&&f(w.value,!C(w.value))};return t({inputElement:m,initialFocusElement:O,focusInput:g,focusNextItem:T,focusPreviousItem:A,selectFocusedItem:b}),(E,Q)=>(W(),oe("div",Ce(E.$qa("uioptionlist"),{class:"flex flex-col overflow-hidden"}),[E.searchable?(W(),oe("div",Abe,[De(U(Pbe),{overrides:{field:{shadow:!1,border:!0}}},{default:Ne(()=>[De(U(_E),{ref_key:"searchInput",ref:h,modelValue:a.value,"onUpdate:modelValue":[Q[0]||(Q[0]=X=>a.value=X),Q[2]||(Q[2]=X=>E.$emit("search-change",X))],"left-icon":U(SL),placeholder:U(o)("ui.components.uiOptionList.search.placeholder"),maxlength:"200",onKeydown:[Er(xr(A,["prevent"]),["up"]),Er(xr(T,["prevent"]),["down"])],onKeypress:Q[1]||(Q[1]=Er(xr(X=>$(),["prevent"]),["enter"]))},null,8,["modelValue","left-icon","placeholder","onKeydown"])]),_:1})])):xe("",!0),Oe("div",{ref_key:"itemsContainer",ref:p,class:"grow overflow-y-auto focus:outline-none",tabindex:E.arrowsNavigation&&!E.searchable?0:-1,onKeydown:[Er(xr(A,["prevent"]),["up"]),Er(xr(T,["prevent"]),["down"])],onKeypress:[Q[3]||(Q[3]=Er(xr(X=>$(),["prevent"]),["enter"])),Q[4]||(Q[4]=Er(xr(X=>$(),["prevent"]),["space"]))]},[(W(!0),oe(wt,null,si(c.value,(X,Y)=>(W(),oe("div",{key:Y},[X.title?(W(),oe("div",Mbe,rt(X.title),1)):xe("",!0),Oe("div",Ce({ref_for:!0},E.$qa("results"),{class:"p-2"}),[E.loading?(W(),Me(U(Xp),{key:0,class:"mx-auto",color:"default"})):X.options.length===0?(W(),oe("div",Rbe,rt(E.emptyText||U(o)("ui.components.uiOptionList.emptyPlaceholderText")),1)):E.recycle?(W(),Me(U(kE),{key:2,items:X.options,buffer:E.recycleBuffer,"item-size":E.multiple?E.itemSize+1:E.itemSize,"page-mode":"","key-field":"value"},{default:Ne(({item:B,index:ee})=>[Oe("div",{class:it(ee>0&&E.multiple?"mt-px":"")},[Ve(E.$slots,"default",Ce({ref_for:!0},{item:B,index:ee}),()=>[De(U(UA),{ref_for:!0,ref_key:"items",ref:s,item:B},null,8,["item"])])],2)]),_:2},1032,["items","buffer","item-size"])):(W(),oe("ul",{key:3,class:it(["flex flex-col rounded",E.multiple?"gap-y-px":""])},[(W(!0),oe(wt,null,si(X.options,(B,ee)=>(W(),oe("li",{key:`${typeof B.value}__${B.value}`},[Ve(E.$slots,"default",Ce({ref_for:!0},{item:B,index:ee}),()=>[De(U(UA),{ref_for:!0,ref_key:"items",ref:s,item:B},null,8,["item"])])]))),128))],2))],16)]))),128)),c.value.length===0?(W(),oe("div",Ibe,[Oe("div",Lbe,rt(E.emptyText||U(o)("ui.components.uiOptionList.emptyPlaceholderText")),1)])):xe("",!0)],40,$be)],16))}}),Dbe=["disabled","required","checked",".indeterminate"],kD=Qe({__name:"UiInputCheckbox",props:er({required:{type:Boolean},disabled:{type:Boolean},error:{type:Boolean},indeterminate:{type:Boolean}},{modelValue:{type:Boolean,required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Wi(e,"modelValue"),n=o=>{t.value=o.target.checked},r=o=>o.currentTarget.blur();return(o,i)=>(W(),oe("input",Ce(o.$qa("uiinputcheckbox"),{disabled:o.disabled,required:o.required,checked:t.value,type:"checkbox",class:[o.disabled?"pointer-events-none bg-surface-disabled border-border-disabled text-text-disabled":o.error?"bg-surface-critical-subtle border-border-critical":"border-border hover:border-border-hover","size-[18px] cursor-pointer rounded border-2 text-interactive ring-interactive focus:ring-offset-1"],".indeterminate":o.indeterminate,onChange:n,onMouseup:r}),null,48,Dbe))}}),Qbe=["tabindex","onKeypress"],Bbe={key:0,class:"flex size-5 shrink-0 items-center justify-center"},zbe=["title"],UA=Qe({__name:"UiOptionListItem",props:{item:{}},setup(e,{expose:t}){const n=e,r=ge();t({scrollIntoView:()=>{r.value&&r.value.scrollIntoView({block:"nearest",behavior:"smooth"})}});const o=qe("value",q(()=>[])),i=qe("toggle",()=>{}),s=qe("multiple",q(()=>!1)),a=qe("arrowsNavigation",q(()=>!1)),l=qe("twoLines",q(()=>!1)),c=qe("focusedItemValue",q(()=>{})),u=q(()=>n.item.value),d=q(()=>n.item.label),f=q(()=>n.item.disabled!==void 0&&n.item.disabled),h=q(()=>s.value?o.value instanceof Array&&o.value.includes(u.value):o.value===u.value),p=()=>{f.value||i(u.value,!h.value)},m=q(()=>c.value===u.value),O=g=>g.currentTarget.blur();return(g,b)=>(W(),oe("div",Ce({ref_key:"container",ref:r},{...g.$qa("uioptionlistitem"),...g.$qa("value",g.item.value),...g.$qa("disabled",!!f.value)},{tabindex:U(a)?-1:0,class:["flex gap-x-2 rounded px-2 py-[7px] ring-inset ring-focused transition-colors duration-75 focus:outline-none focus:ring",[m.value?"ring":"",h.value?"bg-surface-active":"hover:bg-surface-hover",f.value?"pointer-events-none text-text-disabled":"cursor-pointer"]],onKeypress:Er(xr(p,["prevent"]),["space","enter"]),onClick:p,onMouseup:O}),[U(s)?(W(),oe("div",Bbe,[De(U(kD),{"model-value":h.value,tabindex:"-1",disabled:f.value,class:it(f.value?"text-text-disabled":"")},null,8,["model-value","disabled","class"])])):xe("",!0),Oe("div",Ce(g.$qa("label",g.item.label),{class:U(l)?"line-clamp-2":"truncate",title:d.value}),rt(d.value),17,zbe)],16,Qbe))}}),jbe=["disabled"],Wbe=Qe({__name:"UiTag",props:{label:{},disabled:{type:Boolean},removable:{type:Boolean},skeleton:{type:Boolean},textColor:{},backgroundColor:{}},emits:["remove"],setup(e){const t=e,n=qe(mi),r=q(()=>t.textColor&&!t.removable&&!t.disabled?{color:t.textColor}:void 0),o=q(()=>t.backgroundColor&&!t.removable&&!t.disabled?{background:t.backgroundColor}:void 0),i=s=>s.currentTarget.blur();return(s,a)=>s.skeleton?(W(),Me(U(ks),Ce({key:1},s.$qa("uitag"),{class:["inline-flex w-24 rounded",[U(n).tag.pill?"rounded-full":"rounded",U(n).tag.small?"h-5":"h-6"]]}),null,16,["class"])):(W(),oe("div",Ce({key:0},s.$qa("uitag"),{class:["inline-flex min-w-0 items-center align-top",[s.disabled&&s.removable?"bg-surface-neutral-disabled":"bg-surface-neutral",U(n).tag.pill?"rounded-full":"rounded",U(n).tag.small?"h-5":"h-6"]],style:o.value}),[Oe("div",{class:it(["max-w-full truncate px-2",[s.disabled&&s.removable?"text-text-disabled":"text-text-on-tag",s.removable?"pr-1":"",U(n).tag.small?"text-13":"text-14"]]),style:ro(r.value)},[Ve(s.$slots,"default",{},()=>[Dn(rt(s.label),1)])],6),s.removable?(W(),oe("button",Ce({key:0},s.$qa("remove"),{disabled:s.disabled,class:[[U(n).tag.small?"size-5":"size-6",U(n).tag.pill?"rounded-full":"rounded",s.disabled?"pointer-events-none":"hover:bg-surface-neutral-hover focus:bg-surface-neutral-pressed active:bg-surface-neutral-pressed"],"flex items-center justify-center focus:outline-none focus:ring-2 focus:ring-focused"],onClick:a[0]||(a[0]=l=>s.$emit("remove")),onMouseup:i}),[De(U(X2),{class:it([s.disabled?"text-icon-disabled":"text-icon",U(n).tag.small?"size-[14px]":"size-5"])},null,8,["class"])],16,jbe)):xe("",!0)],16))}}),Fbe={class:"flex h-5 items-center"},qbe={class:"ml-3"},Ube={key:1,class:"relative flex items-start py-1"},ZA=Qe({__name:"UiFieldCheckboxGroupOption",props:{value:{},label:{},error:{type:Boolean},required:{type:Boolean},disabled:{type:Boolean},skeleton:{type:Boolean}},setup(e){const t=e,n=qe("checkboxGroup"),r=q(()=>((n==null?void 0:n.value.value)||[]).includes(t.value)),o=i=>{n==null||n.updateValue(t.value,i)};return(i,s)=>i.skeleton?(W(),oe("div",Ube,[De(U(ks),{class:"size-5 shrink-0 rounded"}),De(U(ks),{class:"ml-3 h-5 w-full"})])):(W(),oe("label",Ce({key:0},{...i.$qa("uifieldcheckboxgroupoption"),...i.$qa("value",i.value)},{class:"relative flex items-start py-1"}),[Oe("div",Fbe,[De(U(kD),{disabled:i.disabled,error:i.error&&i.required,"model-value":r.value,"onUpdate:modelValue":o},null,8,["disabled","error","model-value"])]),Oe("div",qbe,[Oe("div",{class:it(["text-14",i.disabled?"text-text-disabled":"text-text"])},[Ve(i.$slots,"default",{},()=>[Dn(rt(i.label),1)])],2)])],16))}}),Zbe={key:0,class:"flex flex-col gap-y-1"},Vbe={key:0,class:"mt-1"},Xbe={key:1,class:"flex flex-col gap-y-1"},_Le=Qe({__name:"UiFieldCheckboxGroup",props:er({required:{type:Boolean},disabled:{type:Boolean},label:{},description:{},v$:{},options:{},hideError:{type:Boolean},hideLabel:{type:Boolean},limit:{},fieldClass:{},labelClass:{},skeleton:{type:Boolean},skeletonOptions:{},inline:{type:Boolean}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const{t}=Vd(),n=Wi(e,"modelValue"),r=e,o=ge(!1),i=q(()=>{var a;return!r.limit||o.value?r.options:(a=r.options)==null?void 0:a.slice(0,r.limit)}),s=(a,l)=>{const c=l?[...n.value||[],a]:(n.value||[]).filter(u=>u!==a);n.value=c};return Ft("checkboxGroup",{value:q(()=>n.value),updateValue:s}),(a,l)=>(W(),Me(U(nm),Ce(a.$qa("uifieldcheckboxgroup"),{required:a.required,label:a.label,description:a.description,v$:a.v$,"hide-label":a.hideLabel,"hide-error":a.hideError,"label-class":a.labelClass,"field-class":a.fieldClass,skeleton:a.skeleton,inline:a.inline}),{default:Ne(({error:c})=>[a.skeleton?(W(),oe("div",Xbe,[(W(!0),oe(wt,null,si(a.skeletonOptions!==void 0?a.skeletonOptions:4,u=>(W(),Me(ZA,{key:u,skeleton:""}))),128))])):(W(),oe("div",Zbe,[Ve(a.$slots,"default",Kr(Jr({error:c})),()=>[a.options?(W(),oe(wt,{key:0},[(W(!0),oe(wt,null,si(i.value,u=>(W(),Me(ZA,{key:u.value,label:u.label,value:u.value,disabled:a.disabled,error:c,required:u.required},null,8,["label","value","disabled","error","required"]))),128)),a.limit?(W(),oe("div",Vbe,[De(U(ei),{variant:"text",icon:o.value?U(wL):U(V2),onClick:l[0]||(l[0]=u=>o.value=!o.value)},{default:Ne(()=>[Dn(rt(o.value?U(t)("ui.components.uiFieldCheckboxGroup.showLess"):U(t)("ui.components.uiFieldCheckboxGroup.showAll")),1)]),_:1},8,["icon"])])):xe("",!0)],64)):xe("",!0)])]))]),_:3},16,["required","label","description","v$","hide-label","hide-error","label-class","field-class","skeleton","inline"]))}});class Pt{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,n,r){[t,n]=md(this,t,n);let o=[];return this.decompose(0,t,o,2),r.length&&r.decompose(0,r.length,o,3),this.decompose(n,this.length,o,1),ds.from(o,this.length-(n-t)+r.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,n=this.length){[t,n]=md(this,t,n);let r=[];return this.decompose(t,n,r,0),ds.from(r,n-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let n=this.scanIdentical(t,1),r=this.length-this.scanIdentical(t,-1),o=new Sh(this),i=new Sh(t);for(let s=n,a=n;;){if(o.next(s),i.next(s),s=0,o.lineBreak!=i.lineBreak||o.done!=i.done||o.value!=i.value)return!1;if(a+=o.value.length,o.done||a>=r)return!0}}iter(t=1){return new Sh(this,t)}iterRange(t,n=this.length){return new xD(this,t,n)}iterLines(t,n){let r;if(t==null)r=this.iter();else{n==null&&(n=this.lines+1);let o=this.line(t).from;r=this.iterRange(o,Math.max(o,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new ED(r)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?Pt.empty:t.length<=32?new An(t):ds.from(An.split(t,[]))}}class An extends Pt{constructor(t,n=Hbe(t)){super(),this.text=t,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(t,n,r,o){for(let i=0;;i++){let s=this.text[i],a=o+s.length;if((n?r:a)>=t)return new Ybe(o,a,r,s);o=a+1,r++}}decompose(t,n,r,o){let i=t<=0&&n>=this.length?this:new An(VA(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(o&1){let s=r.pop(),a=ob(i.text,s.text.slice(),0,i.length);if(a.length<=32)r.push(new An(a,s.length+i.length));else{let l=a.length>>1;r.push(new An(a.slice(0,l)),new An(a.slice(l)))}}else r.push(i)}replace(t,n,r){if(!(r instanceof An))return super.replace(t,n,r);[t,n]=md(this,t,n);let o=ob(this.text,ob(r.text,VA(this.text,0,t)),n),i=this.length+r.length-(n-t);return o.length<=32?new An(o,i):ds.from(An.split(o,[]),i)}sliceString(t,n=this.length,r=` `){[t,n]=md(this,t,n);let o="";for(let i=0,s=0;i<=n&&s t&&s&&(o+=r),t i&&(o+=a.slice(Math.max(0,t-i),n-i)),i=l+1}return o}flatten(t){for(let n of this.text)t.push(n)}scanIdentical(){return 0}static split(t,n){let r=[],o=-1;for(let i of t)r.push(i),o+=i.length+1,r.length==32&&(n.push(new An(r,o)),r=[],o=-1);return o>-1&&n.push(new An(r,o)),n}}class ds extends Pt{constructor(t,n){super(),this.children=t,this.length=n,this.lines=0;for(let r of t)this.lines+=r.lines}lineInner(t,n,r,o){for(let i=0;;i++){let s=this.children[i],a=o+s.length,l=r+s.lines-1;if((n?l:a)>=t)return s.lineInner(t,n,r,o);o=a+1,r=l+1}}decompose(t,n,r,o){for(let i=0,s=0;s<=n&&i =s){let c=o&((s<=t?1:0)|(l>=n?2:0));s>=t&&l<=n&&!c?r.push(a):a.decompose(t-s,n-s,r,c)}s=l+1}}replace(t,n,r){if([t,n]=md(this,t,n),r.lines =i&&n<=a){let l=s.replace(t-i,n-i,r),c=this.lines-s.lines+l.lines;if(l.lines >4&&l.lines>c>>6){let u=this.children.slice();return u[o]=l,new ds(u,this.length-(n-t)+r.length)}return super.replace(i,a,l)}i=a+1}return super.replace(t,n,r)}sliceString(t,n=this.length,r=` `){[t,n]=md(this,t,n);let o="";for(let i=0,s=0;i t&&i&&(o+=r),t s&&(o+=a.sliceString(t-s,n-s,r)),s=l+1}return o}flatten(t){for(let n of this.children)n.flatten(t)}scanIdentical(t,n){if(!(t instanceof ds))return 0;let r=0,[o,i,s,a]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;o+=n,i+=n){if(o==s||i==a)return r;let l=this.children[o],c=t.children[i];if(l!=c)return r+l.scanIdentical(c,n);r+=l.length+1}}static from(t,n=t.reduce((r,o)=>r+o.length+1,-1)){let r=0;for(let h of t)r+=h.lines;if(r<32){let h=[];for(let p of t)p.flatten(h);return new An(h,n)}let o=Math.max(32,r>>5),i=o<<1,s=o>>1,a=[],l=0,c=-1,u=[];function d(h){let p;if(h.lines>i&&h instanceof ds)for(let m of h.children)d(m);else h.lines>s&&(l>s||!l)?(f(),a.push(h)):h instanceof An&&l&&(p=u[u.length-1])instanceof An&&h.lines+p.lines<=32?(l+=h.lines,c+=h.length+1,u[u.length-1]=new An(p.text.concat(h.text),p.length+1+h.length)):(l+h.lines>o&&f(),l+=h.lines,c+=h.length+1,u.push(h))}function f(){l!=0&&(a.push(u.length==1?u[0]:ds.from(u,c)),c=-1,l=u.length=0)}for(let h of t)d(h);return f(),a.length==1?a[0]:new ds(a,n)}}Pt.empty=new An([""],0);function Hbe(e){let t=-1;for(let n of e)t+=n.length+1;return t}function ob(e,t,n=0,r=1e9){for(let o=0,i=0,s=!0;i =n&&(l>r&&(a=a.slice(0,r-o)),o 0?1:(t instanceof An?t.text.length:t.children.length)<<1]}nextInner(t,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,o=this.nodes[r],i=this.offsets[r],s=i>>1,a=o instanceof An?o.text.length:o.children.length;if(s==(n>0?a:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[r]+=n,t==0)return this.lineBreak=!0,this.value=` `,this;t--}else if(o instanceof An){let l=o.text[s+(n<0?-1:0)];if(this.offsets[r]+=n,l.length>Math.max(0,t))return this.value=t==0?l:n>0?l.slice(t):l.slice(0,l.length-t),this;t-=l.length}else{let l=o.children[s+(n<0?-1:0)];t>l.length?(t-=l.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof An?l.text.length:l.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class xD{constructor(t,n,r){this.value="",this.done=!1,this.cursor=new Sh(t,n>r?-1:1),this.pos=n>r?t.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(t,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;t>r&&(t=r),r-=t;let{value:o}=this.cursor.next(t);return this.pos+=(o.length+t)*n,this.value=o.length<=r?o:n<0?o.slice(o.length-r):o.slice(0,r),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class ED{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:n,lineBreak:r,value:o}=this.inner.next(t);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=o,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Pt.prototype[Symbol.iterator]=function(){return this.iter()},Sh.prototype[Symbol.iterator]=xD.prototype[Symbol.iterator]=ED.prototype[Symbol.iterator]=function(){return this});class Ybe{constructor(t,n,r,o){this.from=t,this.to=n,this.number=r,this.text=o}get length(){return this.to-this.from}}function md(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}let Uu="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=1;e e)return Uu[t-1]<=e;return!1}function XA(e){return e>=127462&&e<=127487}const HA=8205;function vr(e,t,n=!0,r=!0){return(n?TD:Kbe)(e,t,r)}function TD(e,t,n){if(t==e.length)return t;t&&CD(e.charCodeAt(t))&&PD(e.charCodeAt(t-1))&&t--;let r=gr(e,t);for(t+=Jo(r);t =0&&XA(gr(e,s));)i++,s-=2;if(i%2==0)break;t+=2}else break}return t}function Kbe(e,t,n){for(;t>0;){let r=TD(e,t-2,n);if(r =56320&&e<57344}function PD(e){return e>=55296&&e<56320}function gr(e,t){let n=e.charCodeAt(t);if(!PD(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return CD(r)?(n-55296<<10)+(r-56320)+65536:n}function xE(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function Jo(e){return e<65536?1:2}const Q_=/\r\n?|\n/;var Hr=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Hr||(Hr={}));class Ss{constructor(t){this.sections=t}get length(){let t=0;for(let n=0;n t)return i+(t-o);i+=a}else{if(r!=Hr.Simple&&c>=t&&(r==Hr.TrackDel&&o t||r==Hr.TrackBefore&&o t))return null;if(c>t||c==t&&n<0&&!a)return t==o||n<0?i:i+l;i+=l}o=c}if(t>o)throw new RangeError(`Position ${t} is out of range for changeset of length ${o}`);return i}touchesRange(t,n=t){for(let r=0,o=0;r =0&&o<=n&&a>=t)return o n?"cover":!0;o=a}return!1}toString(){let t="";for(let n=0;n =0?":"+o:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ss(t)}static create(t){return new Ss(t)}}class Fn extends Ss{constructor(t,n){super(t),this.inserted=n}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return B_(this,(n,r,o,i,s)=>t=t.replace(o,o+(r-n),s),!1),t}mapDesc(t,n=!1){return z_(this,t,n,!0)}invert(t){let n=this.sections.slice(),r=[];for(let o=0,i=0;o =0){n[o]=a,n[o+1]=s;let l=o>>1;for(;r.length 0&&al(r,n,i.text),i.forward(u),a+=u}let c=t[s++];for(;a >1].toJSON()))}return t}static of(t,n,r){let o=[],i=[],s=0,a=null;function l(u=!1){if(!u&&!o.length)return;s f||d<0||f>n)throw new RangeError(`Invalid change range ${d} to ${f} (in doc of length ${n})`);let p=h?typeof h=="string"?Pt.of(h.split(r||Q_)):h:Pt.empty,m=p.length;if(d==f&&m==0)return;d s&&Tr(o,d-s,-1),Tr(o,f-d,m),al(i,o,p),s=f}}return c(t),l(!a),a}static empty(t){return new Fn(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let o=0;oa&&typeof s!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length =0&&n<=0&&n==e[o+1]?e[o]+=t:t==0&&e[o]==0?e[o+1]+=n:r?(e[o]+=t,e[o+1]+=n):e.push(t,n)}function al(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r >1])),!(n||s==e.sections.length||e.sections[s+1]<0);)a=e.sections[s++],l=e.sections[s++];t(o,c,i,u,d),o=c,i=u}}}function z_(e,t,n,r=!1){let o=[],i=r?[]:null,s=new rp(e),a=new rp(t);for(let l=-1;;)if(s.ins==-1&&a.ins==-1){let c=Math.min(s.len,a.len);Tr(o,c,-1),s.forward(c),a.forward(c)}else if(a.ins>=0&&(s.ins<0||l==s.i||s.off==0&&(a.len =0&&l =0){let c=0,u=s.len;for(;u;)if(a.ins==-1){let d=Math.min(u,a.len);c+=d,u-=d,a.forward(d)}else if(a.ins==0&&a.lenl||s.ins>=0&&s.len>l)&&(a||r.length>c),i.forward2(l),s.forward(l)}}}}class rp{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i >1;return n>=t.length?Pt.empty:t[n]}textBit(t){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!t?Pt.empty:n[r].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class pc{constructor(t,n,r){this.from=t,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}get goalColumn(){let t=this.flags>>6;return t==16777215?void 0:t}map(t,n=-1){let r,o;return this.empty?r=o=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),o=t.mapPos(this.to,-1)),r==this.from&&o==this.to?this:new pc(r,o,this.flags)}extend(t,n=t){if(t<=this.anchor&&n>=this.anchor)return be.range(t,n);let r=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return be.range(this.anchor,r)}eq(t,n=!1){return this.anchor==t.anchor&&this.head==t.head&&(!n||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return be.range(t.anchor,t.head)}static create(t,n,r){return new pc(t,n,r)}}class be{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:be.create(this.ranges.map(r=>r.map(t,n)),this.mainIndex)}eq(t,n=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let r=0;r t.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new be(t.ranges.map(n=>pc.fromJSON(n)),t.main)}static single(t,n=t){return new be([be.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,o=0;o t?8:0)|i)}static normalized(t,n=0){let r=t[n];t.sort((o,i)=>o.from-i.from),n=t.indexOf(r);for(let o=1;o i.head?be.range(l,a):be.range(a,l))}}return new be(t,n)}}function $D(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let EE=0;class Pe{constructor(t,n,r,o,i){this.combine=t,this.compareInput=n,this.compare=r,this.isStatic=o,this.id=EE++,this.default=t([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(t={}){return new Pe(t.combine||(n=>n),t.compareInput||((n,r)=>n===r),t.compare||(t.combine?(n,r)=>n===r:TE),!!t.static,t.enables)}of(t){return new ib([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new ib(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new ib(t,this,2,n)}from(t,n){return n||(n=r=>r),this.compute([t],r=>n(r.field(t)))}}function TE(e,t){return e==t||e.length==t.length&&e.every((n,r)=>n===t[r])}class ib{constructor(t,n,r,o){this.dependencies=t,this.facet=n,this.type=r,this.value=o,this.id=EE++}dynamicSlot(t){var n;let r=this.value,o=this.facet.compareInput,i=this.id,s=t[i]>>1,a=this.type==2,l=!1,c=!1,u=[];for(let d of this.dependencies)d=="doc"?l=!0:d=="selection"?c=!0:((n=t[d.id])!==null&&n!==void 0?n:1)&1||u.push(t[d.id]);return{create(d){return d.values[s]=r(d),1},update(d,f){if(l&&f.docChanged||c&&(f.docChanged||f.selection)||j_(d,u)){let h=r(d);if(a?!YA(h,d.values[s],o):!o(h,d.values[s]))return d.values[s]=h,1}return 0},reconfigure:(d,f)=>{let h,p=f.config.address[i];if(p!=null){let m=v0(f,p);if(this.dependencies.every(O=>O instanceof Pe?f.facet(O)===d.facet(O):O instanceof dr?f.field(O,!1)==d.field(O,!1):!0)||(a?YA(h=r(d),m,o):o(h=r(d),m)))return d.values[s]=m,0}else h=r(d);return d.values[s]=h,1}}}}function YA(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r e[l.id]),o=n.map(l=>l.type),i=r.filter(l=>!(l&1)),s=e[t.id]>>1;function a(l){let c=[];for(let u=0;u r===o),t);return t.provide&&(n.provides=t.provide(n)),n}create(t){let n=t.facet(GA).find(r=>r.field==this);return((n==null?void 0:n.create)||this.createF)(t)}slot(t){let n=t[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,o)=>{let i=r.values[n],s=this.updateF(i,o);return this.compareF(i,s)?0:(r.values[n]=s,1)},reconfigure:(r,o)=>o.config.address[this.id]!=null?(r.values[n]=o.field(this),0):(r.values[n]=this.create(r),1)}}init(t){return[this,GA.of({field:this,create:t})]}get extension(){return this}}const lc={lowest:4,low:3,default:2,high:1,highest:0};function Af(e){return t=>new MD(t,e)}const Gc={highest:Af(lc.highest),high:Af(lc.high),default:Af(lc.default),low:Af(lc.low),lowest:Af(lc.lowest)};class MD{constructor(t,n){this.inner=t,this.prec=n}}class rm{of(t){return new W_(this,t)}reconfigure(t){return rm.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class W_{constructor(t,n){this.compartment=t,this.inner=n}}class y0{constructor(t,n,r,o,i,s){for(this.base=t,this.compartments=n,this.dynamicSlots=r,this.address=o,this.staticValues=i,this.facets=s,this.statusTemplate=[];this.statusTemplate.length >1]}static resolve(t,n,r){let o=[],i=Object.create(null),s=new Map;for(let f of e0e(t,n,s))f instanceof dr?o.push(f):(i[f.facet.id]||(i[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],c=[];for(let f of o)a[f.id]=c.length<<1,c.push(h=>f.slot(h));let u=r==null?void 0:r.config.facets;for(let f in i){let h=i[f],p=h[0].facet,m=u&&u[f]||[];if(h.every(O=>O.type==0))if(a[p.id]=l.length<<1|1,TE(m,h))l.push(r.facet(p));else{let O=p.combine(h.map(g=>g.value));l.push(r&&p.compare(O,r.facet(p))?r.facet(p):O)}else{for(let O of h)O.type==0?(a[O.id]=l.length<<1|1,l.push(O.value)):(a[O.id]=c.length<<1,c.push(g=>O.dynamicSlot(g)));a[p.id]=c.length<<1,c.push(O=>Jbe(O,p,h))}}let d=c.map(f=>f(a));return new y0(t,s,d,a,l,i)}}function e0e(e,t,n){let r=[[],[],[],[],[]],o=new Map;function i(s,a){let l=o.get(s);if(l!=null){if(l<=a)return;let c=r[l].indexOf(s);c>-1&&r[l].splice(c,1),s instanceof W_&&n.delete(s.compartment)}if(o.set(s,a),Array.isArray(s))for(let c of s)i(c,a);else if(s instanceof W_){if(n.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=t.get(s.compartment)||s.inner;n.set(s.compartment,c),i(c,a)}else if(s instanceof MD)i(s.inner,s.prec);else if(s instanceof dr)r[a].push(s),s.provides&&i(s.provides,a);else if(s instanceof ib)r[a].push(s),s.facet.extensions&&i(s.facet.extensions,lc.default);else{let c=s.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(c,a)}}return i(e,lc.default),r.reduce((s,a)=>s.concat(a))}function _h(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;e.status[n]=4;let o=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|o}function v0(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const RD=Pe.define(),F_=Pe.define({combine:e=>e.some(t=>t),static:!0}),ID=Pe.define({combine:e=>e.length?e[0]:void 0,static:!0}),LD=Pe.define(),ND=Pe.define(),DD=Pe.define(),QD=Pe.define({combine:e=>e.length?e[0]:!1});class Ta{constructor(t,n){this.type=t,this.value=n}static define(){return new t0e}}class t0e{of(t){return new Ta(this,t)}}class n0e{constructor(t){this.map=t}of(t){return new ft(this,t)}}class ft{constructor(t,n){this.type=t,this.value=n}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new ft(this.type,n)}is(t){return this.type==t}static define(t={}){return new n0e(t.map||(n=>n))}static mapEffects(t,n){if(!t.length)return t;let r=[];for(let o of t){let i=o.map(n);i&&r.push(i)}return r}}ft.reconfigure=ft.define();ft.appendConfig=ft.define();class Yn{constructor(t,n,r,o,i,s){this.startState=t,this.changes=n,this.selection=r,this.effects=o,this.annotations=i,this.scrollIntoView=s,this._doc=null,this._state=null,r&&$D(r,n.newLength),i.some(a=>a.type==Yn.time)||(this.annotations=i.concat(Yn.time.of(Date.now())))}static create(t,n,r,o,i,s){return new Yn(t,n,r,o,i,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let n of this.annotations)if(n.type==t)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(Yn.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}Yn.time=Ta.define();Yn.userEvent=Ta.define();Yn.addToHistory=Ta.define();Yn.remote=Ta.define();function r0e(e,t){let n=[];for(let r=0,o=0;;){let i,s;if(r =e[r]))i=e[r++],s=e[r++];else if(o =0;o--){let i=r[o](e);i instanceof Yn?e=i:Array.isArray(i)&&i.length==1&&i[0]instanceof Yn?e=i[0]:e=zD(t,Zu(i),!1)}return e}function i0e(e){let t=e.startState,n=t.facet(DD),r=e;for(let o=n.length-1;o>=0;o--){let i=n[o](e);i&&Object.keys(i).length&&(r=BD(r,q_(t,i,e.changes.newLength),!0))}return r==e?e:Yn.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}const s0e=[];function Zu(e){return e==null?s0e:Array.isArray(e)?e:[e]}var wn=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(wn||(wn={}));const a0e=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let U_;try{U_=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function l0e(e){if(U_)return U_.test(e);for(let t=0;t ""&&(n.toUpperCase()!=n.toLowerCase()||a0e.test(n)))return!0}return!1}function c0e(e){return t=>{if(!/\S/.test(t))return wn.Space;if(l0e(t))return wn.Word;for(let n=0;n -1)return wn.Word;return wn.Other}}class bt{constructor(t,n,r,o,i,s){this.config=t,this.doc=n,this.selection=r,this.values=o,this.status=t.statusTemplate.slice(),this.computeSlot=i,s&&(s._state=this);for(let a=0;a o.set(c,l)),n=null),o.set(a.value.compartment,a.value.extension)):a.is(ft.reconfigure)?(n=null,r=a.value):a.is(ft.appendConfig)&&(n=null,r=Zu(r).concat(a.value));let i;n?i=t.startState.values.slice():(n=y0.resolve(r,o,this),i=new bt(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(a,l)=>l.reconfigure(a,this),null).values);let s=t.startState.facet(F_)?t.newSelection:t.newSelection.asSingle();new bt(n,t.newDoc,s,i,(a,l)=>l.update(a,t),t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:t},range:be.cursor(n.from+t.length)}))}changeByRange(t){let n=this.selection,r=t(n.ranges[0]),o=this.changes(r.changes),i=[r.range],s=Zu(r.effects);for(let a=1;a s.spec.fromJSON(a,l)))}}return bt.create({doc:t.doc,selection:be.fromJSON(t.selection),extensions:n.extensions?o.concat([n.extensions]):o})}static create(t={}){let n=y0.resolve(t.extensions||[],new Map),r=t.doc instanceof Pt?t.doc:Pt.of((t.doc||"").split(n.staticFacet(bt.lineSeparator)||Q_)),o=t.selection?t.selection instanceof be?t.selection:be.single(t.selection.anchor,t.selection.head):be.single(0);return $D(o,r.length),n.staticFacet(F_)||(o=o.asSingle()),new bt(n,r,o,n.dynamicSlots.map(()=>null),(i,s)=>s.create(i),null)}get tabSize(){return this.facet(bt.tabSize)}get lineBreak(){return this.facet(bt.lineSeparator)||` `}get readOnly(){return this.facet(QD)}phrase(t,...n){for(let r of this.facet(bt.phrases))if(Object.prototype.hasOwnProperty.call(r,t)){t=r[t];break}return n.length&&(t=t.replace(/\$(\$|\d*)/g,(r,o)=>{if(o=="$")return"$";let i=+(o||1);return!i||i>n.length?r:n[i-1]})),t}languageDataAt(t,n,r=-1){let o=[];for(let i of this.facet(RD))for(let s of i(this,n,r))Object.prototype.hasOwnProperty.call(s,t)&&o.push(s[t]);return o}charCategorizer(t){return c0e(this.languageDataAt("wordChars",t).join(""))}wordAt(t){let{text:n,from:r,length:o}=this.doc.lineAt(t),i=this.charCategorizer(t),s=t-r,a=t-r;for(;s>0;){let l=vr(n,s,!1);if(i(n.slice(l,s))!=wn.Word)break;s=l}for(;a e.length?e[0]:4});bt.lineSeparator=ID;bt.readOnly=QD;bt.phrases=Pe.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(o=>e[o]==t[o])}});bt.languageData=RD;bt.changeFilter=LD;bt.transactionFilter=ND;bt.transactionExtender=DD;rm.reconfigure=ft.define();function Ms(e,t,n={}){let r={};for(let o of e)for(let i of Object.keys(o)){let s=o[i],a=r[i];if(a===void 0)r[i]=s;else if(!(a===s||s===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](a,s);else throw new Error("Config merge conflict for field "+i)}for(let o in t)r[o]===void 0&&(r[o]=t[o]);return r}class vl{eq(t){return this==t}range(t,n=t){return Z_.create(t,n,this)}}vl.prototype.startSide=vl.prototype.endSide=0;vl.prototype.point=!1;vl.prototype.mapMode=Hr.TrackDel;let Z_=class jD{constructor(t,n,r){this.from=t,this.to=n,this.value=r}static create(t,n,r){return new jD(t,n,r)}};function V_(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class CE{constructor(t,n,r,o){this.from=t,this.to=n,this.value=r,this.maxPoint=o}get length(){return this.to[this.to.length-1]}findIndex(t,n,r,o=0){let i=r?this.to:this.from;for(let s=o,a=i.length;;){if(s==a)return s;let l=s+a>>1,c=i[l]-t||(r?this.value[l].endSide:this.value[l].startSide)-n;if(l==s)return c>=0?s:a;c>=0?a=l:s=l+1}}between(t,n,r,o){for(let i=this.findIndex(n,-1e9,!0),s=this.findIndex(r,1e9,!1,i);i h||f==h&&c.startSide>0&&c.endSide<=0)continue;(h-f||c.endSide-c.startSide)<0||(s<0&&(s=f),c.point&&(a=Math.max(a,h-f)),r.push(c),o.push(f-s),i.push(h-s))}return{mapped:r.length?new CE(o,i,r,a):null,pos:s}}}class Tt{constructor(t,n,r,o){this.chunkPos=t,this.chunk=n,this.nextLayer=r,this.maxPoint=o}static create(t,n,r,o){return new Tt(t,n,r,o)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let n of this.chunk)t+=n.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:n=[],sort:r=!1,filterFrom:o=0,filterTo:i=this.length}=t,s=t.filter;if(n.length==0&&!s)return this;if(r&&(n=n.slice().sort(V_)),this.isEmpty)return n.length?Tt.of(n):this;let a=new WD(this,null,-1).goto(0),l=0,c=[],u=new wl;for(;a.value||l=0){let d=n[l++];u.addInner(d.from,d.to,d.value)||c.push(d)}else a.rangeIndex==1&&a.chunkIndex this.chunkEnd(a.chunkIndex)||i a.to||i =i&&t<=i+s.length&&s.between(i,t-i,n-i,r)===!1)return}this.nextLayer.between(t,n,r)}}iter(t=0){return op.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return op.from(t).goto(n)}static compare(t,n,r,o,i=-1){let s=t.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=i),a=n.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=i),l=KA(s,a,r),c=new $f(s,l,i),u=new $f(a,l,i);r.iterGaps((d,f,h)=>JA(c,d,u,f,h,o)),r.empty&&r.length==0&&JA(c,0,u,0,0,o)}static eq(t,n,r=0,o){o==null&&(o=999999999);let i=t.filter(u=>!u.isEmpty&&n.indexOf(u)<0),s=n.filter(u=>!u.isEmpty&&t.indexOf(u)<0);if(i.length!=s.length)return!1;if(!i.length)return!0;let a=KA(i,s),l=new $f(i,a,0).goto(r),c=new $f(s,a,0).goto(r);for(;;){if(l.to!=c.to||!X_(l.active,c.active)||l.point&&(!c.point||!l.point.eq(c.point)))return!1;if(l.to>o)return!0;l.next(),c.next()}}static spans(t,n,r,o,i=-1){let s=new $f(t,null,i).goto(n),a=n,l=s.openStart;for(;;){let c=Math.min(s.to,r);if(s.point){let u=s.activeForPoint(s.to),d=s.pointFrom a&&(o.span(a,c,s.active,l),l=s.openEnd(c));if(s.to>r)return l+(s.point&&s.to>r?1:0);a=s.to,s.next()}}static of(t,n=!1){let r=new wl;for(let o of t instanceof Z_?[t]:n?u0e(t):t)r.add(o.from,o.to,o.value);return r.finish()}static join(t){if(!t.length)return Tt.empty;let n=t[t.length-1];for(let r=t.length-2;r>=0;r--)for(let o=t[r];o!=Tt.empty;o=o.nextLayer)n=new Tt(o.chunkPos,o.chunk,n,Math.max(o.maxPoint,n.maxPoint));return n}}Tt.empty=new Tt([],[],null,-1);function u0e(e){if(e.length>1)for(let t=e[0],n=1;n 0)return e.slice().sort(V_);t=r}return e}Tt.empty.nextLayer=Tt.empty;class wl{finishChunk(t){this.chunks.push(new CE(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,n,r){this.addInner(t,n,r)||(this.nextLayer||(this.nextLayer=new wl)).add(t,n,r)}addInner(t,n,r){let o=t-this.lastTo||r.startSide-this.last.endSide;if(o<=0&&(t-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return o<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=t,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-t)),!0)}addChunk(t,n){if((t-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(t);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+t,this.lastTo=n.to[r]+t,!0}finish(){return this.finishInner(Tt.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=Tt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function KA(e,t,n){let r=new Map;for(let i of e)for(let s=0;s =this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex =r&&o.push(new WD(s,n,r,i));return o.length==1?o[0]:new op(o)}get startSide(){return this.value?this.value.startSide:0}goto(t,n=-1e9){for(let r of this.heap)r.goto(t,n);for(let r=this.heap.length>>1;r>=0;r--)xw(this.heap,r);return this.next(),this}forward(t,n){for(let r of this.heap)r.forward(t,n);for(let r=this.heap.length>>1;r>=0;r--)xw(this.heap,r);(this.to-t||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),xw(this.heap,0)}}}function xw(e,t){for(let n=e[t];;){let r=(t<<1)+1;if(r>=e.length)break;let o=e[r];if(r+1 =0&&(o=e[r+1],r++),n.compare(o)<0)break;e[r]=n,e[t]=o,t=r}}class $f{constructor(t,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=op.from(t,n,r)}goto(t,n=-1e9){return this.cursor.goto(t,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=n,this.openStart=-1,this.next(),this}forward(t,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(t,n)}removeActive(t){Km(this.active,t),Km(this.activeTo,t),Km(this.activeRank,t),this.minActive=e$(this.active,this.activeTo)}addActive(t){let n=0,{value:r,to:o,rank:i}=this.cursor;for(;n 0;)n++;Jm(this.active,n,r),Jm(this.activeTo,n,o),Jm(this.activeRank,n,i),t&&Jm(t,n,this.cursor.from),this.minActive=e$(this.active,this.activeTo)}next(){let t=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let o=this.minActive;if(o>-1&&(this.activeTo[o]-this.cursor.from||this.active[o].endSide-this.cursor.startSide)<0){if(this.activeTo[o]>t){this.to=this.activeTo[o],this.endSide=this.active[o].endSide;break}this.removeActive(o),r&&Km(r,o)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from =0&&r[o] =0&&!(this.activeRank[r] t||this.activeTo[r]==t&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(t){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>t;r--)n++;return n}}function JA(e,t,n,r,o,i){e.goto(t),n.goto(r);let s=r+o,a=r,l=r-t;for(;;){let c=e.to+l-n.to||e.endSide-n.endSide,u=c<0?e.to+l:n.to,d=Math.min(u,s);if(e.point||n.point?e.point&&n.point&&(e.point==n.point||e.point.eq(n.point))&&X_(e.activeForPoint(e.to),n.activeForPoint(n.to))||i.comparePoint(a,d,e.point,n.point):d>a&&!X_(e.active,n.active)&&i.compareRange(a,d,e.active,n.active),u>s)break;a=u,c<=0&&e.next(),c>=0&&n.next()}}function X_(e,t){if(e.length!=t.length)return!1;for(let n=0;n =t;r--)e[r+1]=e[r];e[t]=n}function e$(e,t){let n=-1,r=1e9;for(let o=0;o =t)return o;if(o==e.length)break;i+=e.charCodeAt(o)==9?n-i%n:1,o=vr(e,o)}return r===!0?-1:e.length}const Y_="ͼ",t$=typeof Symbol>"u"?"__"+Y_:Symbol.for(Y_),G_=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),n$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Sl{constructor(t,n){this.rules=[];let{finish:r}=n||{};function o(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function i(s,a,l,c){let u=[],d=/^@(\w+)\b/.exec(s[0]),f=d&&d[1]=="keyframes";if(d&&a==null)return l.push(s[0]+";");for(let h in a){let p=a[h];if(/&/.test(h))i(h.split(/,\s*/).map(m=>s.map(O=>m.replace(/&/,O))).reduce((m,O)=>m.concat(O)),p,l);else if(p&&typeof p=="object"){if(!d)throw new RangeError("The value of a property ("+h+") should be a primitive value.");i(o(h),p,u,f)}else p!=null&&u.push(h.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(u.length||f)&&l.push((r&&!d&&!c?s.map(r):s).join(", ")+" {"+u.join(" ")+"}")}for(let s in t)i(o(s),t[s],this.rules)}getRules(){return this.rules.join(` `)}static newName(){let t=n$[t$]||1;return n$[t$]=t+1,Y_+t.toString(36)}static mount(t,n,r){let o=t[G_],i=r&&r.nonce;o?i&&o.setNonce(i):o=new d0e(t,i),o.mount(Array.isArray(n)?n:[n],t)}}let r$=new Map;class d0e{constructor(t,n){let r=t.ownerDocument||t,o=r.defaultView;if(!t.head&&t.adoptedStyleSheets&&o.CSSStyleSheet){let i=r$.get(r);if(i)return t[G_]=i;this.sheet=new o.CSSStyleSheet,r$.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[G_]=this}mount(t,n){let r=this.sheet,o=0,i=0;for(let s=0;s -1&&(this.modules.splice(l,1),i--,l=-1),l==-1){if(this.modules.splice(i++,0,a),r)for(let c=0;c ",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},f0e=typeof navigator<"u"&&/Mac/.test(navigator.platform),h0e=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var br=0;br<10;br++)_l[48+br]=_l[96+br]=String(br);for(var br=1;br<=24;br++)_l[br+111]="F"+br;for(var br=65;br<=90;br++)_l[br]=String.fromCharCode(br+32),ip[br]=String.fromCharCode(br);for(var Ew in _l)ip.hasOwnProperty(Ew)||(ip[Ew]=_l[Ew]);function p0e(e){var t=f0e&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||h0e&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?ip:_l)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function sp(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function K_(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function m0e(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function sb(e,t){if(!t.anchorNode)return!1;try{return K_(e,t.anchorNode)}catch{return!1}}function gd(e){return e.nodeType==3?Dc(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function kh(e,t,n,r){return n?o$(e,t,n,r,-1)||o$(e,t,n,r,1):!1}function Nc(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function w0(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function o$(e,t,n,r,o){for(;;){if(e==n&&t==r)return!0;if(t==(o<0?0:ha(e))){if(e.nodeName=="DIV")return!1;let i=e.parentNode;if(!i||i.nodeType!=1)return!1;t=Nc(e)+(o<0?0:1),e=i}else if(e.nodeType==1){if(e=e.childNodes[t+(o<0?-1:0)],e.nodeType==1&&e.contentEditable=="false")return!1;t=o<0?ha(e):0}else return!1}}function ha(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function om(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function g0e(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function FD(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function b0e(e,t,n,r,o,i,s,a){let l=e.ownerDocument,c=l.defaultView||window;for(let u=e,d=!1;u&&!d;)if(u.nodeType==1){let f,h=u==l.body,p=1,m=1;if(h)f=g0e(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(d=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let b=u.getBoundingClientRect();({scaleX:p,scaleY:m}=FD(u,b)),f={left:b.left,right:b.left+u.clientWidth*p,top:b.top,bottom:b.top+u.clientHeight*m}}let O=0,g=0;if(o=="nearest")t.top 0&&t.bottom>f.bottom+g&&(g=t.bottom-f.bottom+g+s)):t.bottom>f.bottom&&(g=t.bottom-f.bottom+s,n<0&&t.top-g 0&&t.right>f.right+O&&(O=t.right-f.right+O+i)):t.right>f.right&&(O=t.right-f.right+i,n<0&&t.left o.clientHeight&&(r=o),!n&&o.scrollWidth>o.clientWidth&&(n=o),o=o.assignedSlot||o.parentNode;else if(o.nodeType==11)o=o.host;else break;return{x:n,y:r}}class y0e{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:n,focusNode:r}=t;this.set(n,Math.min(t.anchorOffset,n?ha(n):0),r,Math.min(t.focusOffset,r?ha(r):0))}set(t,n,r,o){this.anchorNode=t,this.anchorOffset=n,this.focusNode=r,this.focusOffset=o}}let mu=null;function qD(e){if(e.setActive)return e.setActive();if(mu)return e.focus(mu);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(mu==null?{get preventScroll(){return mu={preventScroll:!0},!0}}:void 0),!mu){mu=!1;for(let n=0;n Math.max(1,e.scrollHeight-e.clientHeight-4)}function VD(e,t){for(let n=e,r=t;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=ha(n)}else if(n.parentNode&&!w0(n))r=Nc(n),n=n.parentNode;else return null}}function XD(e,t){for(let n=e,r=t;;){if(n.nodeType==3&&r n)return d.domBoundsAround(t,n,c);if(f>=t&&o==-1&&(o=l,i=c),c>n&&d.dom.parentNode==this.dom){s=l,a=u;break}u=f,c=f+d.breakAfter}return{from:i,to:a<0?r+this.length:a,startDOM:(o?this.children[o-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:s =0?this.children[s].dom:null}}markDirty(t=!1){this.flags|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let n=this.parent;n;n=n.parent){if(t&&(n.flags|=2),n.flags&1)return;n.flags|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.flags&7&&this.markParentsDirty(!0))}setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this)}get rootView(){for(let t=this;;){let n=t.parent;if(!n)return t;t=n}}replaceChildren(t,n,r=PE){this.markDirty();for(let o=t;o this.pos||t==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}}function YD(e,t,n,r,o,i,s,a,l){let{children:c}=e,u=c.length?c[t]:null,d=i.length?i[i.length-1]:null,f=d?d.breakAfter:s;if(!(t==r&&u&&!s&&!f&&i.length<2&&u.merge(n,o,i.length?d:null,n==0,a,l))){if(r 0&&(!s&&i.length&&u.merge(n,u.length,i[0],!1,a,0)?u.breakAfter=i.shift().breakAfter:(n 2);var Re={mac:c$||/Mac/.test(fo.platform),windows:/Win/.test(fo.platform),linux:/Linux|X11/.test(fo.platform),ie:vy,ie_version:KD?J_.documentMode||6:tk?+tk[1]:ek?+ek[1]:0,gecko:a$,gecko_version:a$?+(/Firefox\/(\d+)/.exec(fo.userAgent)||[0,0])[1]:0,chrome:!!Tw,chrome_version:Tw?+Tw[1]:0,ios:c$,android:/Android\b/.test(fo.userAgent),webkit:l$,safari:JD,webkit_version:l$?+(/\bAppleWebKit\/(\d+)/.exec(fo.userAgent)||[0,0])[1]:0,tabSize:J_.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const S0e=256;class Bi extends Gt{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,n){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(n&&n.node==this.dom&&(n.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){t.nodeType==3&&this.createDOM(t)}merge(t,n,r){return this.flags&8||r&&(!(r instanceof Bi)||this.length-(n-t)+r.length>S0e||r.flags&8)?!1:(this.text=this.text.slice(0,t)+(r?r.text:"")+this.text.slice(n),this.markDirty(),!0)}split(t){let n=new Bi(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(t,n){return t==this.dom?n:n?this.text.length:0}domAtPos(t){return new $r(this.dom,t)}domBoundsAround(t,n,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,n){return _0e(this.dom,t,n)}}class pa extends Gt{constructor(t,n=[],r=0){super(),this.mark=t,this.children=n,this.length=r;for(let o of n)o.setParent(this)}setAttrs(t){if(UD(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)t.setAttribute(n,this.mark.attrs[n]);return t}canReuseDOM(t){return super.canReuseDOM(t)&&!((this.flags|t.flags)&8)}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}sync(t,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,n)}merge(t,n,r,o,i,s){return r&&(!(r instanceof pa&&r.mark.eq(this.mark))||t&&i<=0||n t&&n.push(r =t&&(o=i),r=l,i++}let s=this.length-t;return this.length=t,o>-1&&(this.children.length=o,this.markDirty()),new pa(this.mark,n,s)}domAtPos(t){return e9(this,t)}coordsAt(t,n){return n9(this,t,n)}}function _0e(e,t,n){let r=e.nodeValue.length;t>r&&(t=r);let o=t,i=t,s=0;t==0&&n<0||t==r&&n>=0?Re.chrome||Re.gecko||(t?(o--,s=1):i =0)?0:a.length-1];return Re.safari&&!s&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),s?om(l,s<0):l||null}class ll extends Gt{static create(t,n,r){return new ll(t,n,r)}constructor(t,n,r){super(),this.widget=t,this.length=n,this.side=r,this.prevWidget=null}split(t){let n=ll.create(this.widget,this.length-t,this.side);return this.length-=t,n}sync(t){(!this.dom||!this.widget.updateDOM(this.dom,t))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(t,n,r,o,i,s){return r&&(!(r instanceof ll)||!this.widget.compare(r.widget)||t>0&&i<=0||n 0)?$r.before(this.dom):$r.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,n){let r=this.widget.coordsAt(this.dom,t,n);if(r)return r;let o=this.dom.getClientRects(),i=null;if(!o.length)return null;let s=this.side?this.side<0:t>0;for(let a=s?o.length-1:0;i=o[a],!(t>0?a==0:a==o.length-1||i.top 0?$r.before(this.dom):$r.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Pt.empty}get isHidden(){return!0}}Bi.prototype.children=ll.prototype.children=bd.prototype.children=PE;function e9(e,t){let n=e.dom,{children:r}=e,o=0;for(let i=0;o i&&t0;i--){let s=r[i-1];if(s.dom.parentNode==n)return s.domAtPos(s.length)}for(let i=o;i 0&&t instanceof pa&&o.length&&(r=o[o.length-1])instanceof pa&&r.mark.eq(t.mark)?t9(r,t.children[0],n-1):(o.push(t),t.setParent(e)),e.length+=t.length}function n9(e,t,n){let r=null,o=-1,i=null,s=-1;function a(c,u){for(let d=0,f=0;d =u&&(h.children.length?a(h,u-f):(!i||i.isHidden&&n>0)&&(p>u||f==p&&h.getSide()>0)?(i=h,s=u-f):(f-1?1:0)!=o.length-(n&&o.indexOf(n)>-1?1:0))return!1;for(let i of r)if(i!=n&&(o.indexOf(i)==-1||e[i]!==t[i]))return!1;return!0}function rk(e,t,n){let r=!1;if(t)for(let o in t)n&&o in n||(r=!0,o=="style"?e.style.cssText="":e.removeAttribute(o));if(n)for(let o in n)t&&t[o]==n[o]||(r=!0,o=="style"?e.style.cssText=n[o]:e.setAttribute(o,n[o]));return r}function x0e(e){let t=Object.create(null);for(let n=0;n 0?3e8:-4e8:n>0?1e8:-1e8,new kl(t,n,n,r,t.widget||null,!1)}static replace(t){let n=!!t.block,r,o;if(t.isBlockGap)r=-5e8,o=4e8;else{let{start:i,end:s}=r9(t,n);r=(i?n?-3e8:-1:5e8)-1,o=(s?n?2e8:1:-6e8)+1}return new kl(t,r,o,n,t.widget||null,!0)}static line(t){return new sm(t)}static set(t,n=!1){return Tt.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Ze.none=Tt.empty;class im extends Ze{constructor(t){let{start:n,end:r}=r9(t);super(n?-1:5e8,r?1:-6e8,null,t),this.tagName=t.tagName||"span",this.class=t.class||"",this.attrs=t.attributes||null}eq(t){var n,r;return this==t||t instanceof im&&this.tagName==t.tagName&&(this.class||((n=this.attrs)===null||n===void 0?void 0:n.class))==(t.class||((r=t.attrs)===null||r===void 0?void 0:r.class))&&S0(this.attrs,t.attrs,"class")}range(t,n=t){if(t>=n)throw new RangeError("Mark decorations may not be empty");return super.range(t,n)}}im.prototype.point=!1;class sm extends Ze{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof sm&&this.spec.class==t.spec.class&&S0(this.spec.attributes,t.spec.attributes)}range(t,n=t){if(n!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,n)}}sm.prototype.mapMode=Hr.TrackBefore;sm.prototype.point=!0;class kl extends Ze{constructor(t,n,r,o,i,s){super(n,r,i,t),this.block=o,this.isReplace=s,this.mapMode=o?n<=0?Hr.TrackBefore:Hr.TrackAfter:Hr.TrackDel}get type(){return this.startSide!=this.endSide?to.WidgetRange:this.startSide<=0?to.WidgetBefore:to.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof kl&&E0e(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,n=t){if(this.isReplace&&(t>n||t==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,n)}}kl.prototype.point=!0;function r9(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n==null&&(n=e.inclusive),r==null&&(r=e.inclusive),{start:n??t,end:r??t}}function E0e(e,t){return e==t||!!(e&&t&&e.compare(t))}function ok(e,t,n,r=0){let o=n.length-1;o>=0&&n[o]+r>=e?n[o]=Math.max(n[o],t):n.push(e,t)}class Nn extends Gt{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(t,n,r,o,i,s){if(r){if(!(r instanceof Nn))return!1;this.dom||r.transferDOM(this)}return o&&this.setDeco(r?r.attrs:null),GD(this,t,n,r?r.children.slice():[],i,s),!0}split(t){let n=new Nn;if(n.breakAfter=this.breakAfter,this.length==0)return n;let{i:r,off:o}=this.childPos(t);o&&(n.append(this.children[r].split(o),0),this.children[r].merge(o,this.children[r].length,null,!1,0,0),r++);for(let i=r;i 0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=t,n}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){S0(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,n){t9(this,t,n)}addLineDeco(t){let n=t.spec.attributes,r=t.spec.class;n&&(this.attrs=nk(n,this.attrs||{})),r&&(this.attrs=nk({class:r},this.attrs||{}))}domAtPos(t){return e9(this,t)}reuseDOM(t){t.nodeName=="DIV"&&(this.setDOM(t),this.flags|=6)}sync(t,n){var r;this.dom?this.flags&4&&(UD(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(rk(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t,n);let o=this.dom.lastChild;for(;o&&Gt.get(o)instanceof pa;)o=o.lastChild;if(!o||!this.length||o.nodeName!="BR"&&((r=Gt.get(o))===null||r===void 0?void 0:r.isEditable)==!1&&(!Re.ios||!this.children.some(i=>i instanceof Bi))){let i=document.createElement("BR");i.cmIgnore=!0,this.dom.appendChild(i)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let t=0,n;for(let r of this.children){if(!(r instanceof Bi)||/[^ -~]/.test(r.text))return null;let o=gd(r.dom);if(o.length!=1)return null;t+=o[0].width,n=o[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:n}:null}coordsAt(t,n){let r=n9(this,t,n);if(!this.children.length&&r&&this.parent){let{heightOracle:o}=this.parent.view.viewState,i=r.bottom-r.top;if(Math.abs(i-o.lineHeight)<2&&o.textHeight=n){if(i instanceof Nn)return i;if(s>n)break}o=s+i.breakAfter}return null}}class ia extends Gt{constructor(t,n,r){super(),this.widget=t,this.length=n,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(t,n,r,o,i,s){return r&&(!(r instanceof ia)||!this.widget.compare(r.widget)||t>0&&i<=0||n 0}}class ik extends Ca{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class xh{constructor(t,n,r,o){this.doc=t,this.pos=n,this.end=r,this.disallowBlockEffectsFor=o,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=t.iter(),this.skip=n}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let t=this.content[this.content.length-1];return!(t.breakAfter||t instanceof ia&&t.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Nn),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(eg(new bd(-1),t),t.length),this.pendingBuffer=0)}addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(t&&this.content.length&&this.content[this.content.length-1]instanceof ia)&&this.getLine()}buildText(t,n,r){for(;t>0;){if(this.textOff==this.text.length){let{value:i,lineBreak:s,done:a}=this.cursor.next(this.skip);if(this.skip=0,a)throw new Error("Ran out of text content when drawing inline views");if(s){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,t--;continue}else this.text=i,this.textOff=0}let o=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(n.slice(n.length-r)),this.getLine().append(eg(new Bi(this.text.slice(this.textOff,this.textOff+o)),n),r),this.atCursorPos=!0,this.textOff+=o,t-=o,r=0}}span(t,n,r,o){this.buildText(n-t,r,o),this.pos=n,this.openStart<0&&(this.openStart=o)}point(t,n,r,o,i,s){if(this.disallowBlockEffectsFor[s]&&r instanceof kl){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let a=n-t;if(r instanceof kl)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ia(r.widget||Od.block,a,r));else{let l=ll.create(r.widget||Od.inline,a,a?0:r.startSide),c=this.atCursorPos&&!l.isEditable&&i<=o.length&&(t 0),u=!l.isEditable&&(t o.length||r.startSide<=0),d=this.getLine();this.pendingBuffer==2&&!c&&!l.isEditable&&(this.pendingBuffer=0),this.flushBuffer(o),c&&(d.append(eg(new bd(1),o),i),i=o.length+Math.max(0,i-o.length)),d.append(eg(l,o),i),this.atCursorPos=u,this.pendingBuffer=u?t