@kvass/widgets 1.8.15 → 1.8.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es2.js CHANGED
@@ -1,23 +1,23 @@
1
- import{G as ka,q as te,r as X,e as B,o as E,X as qt,E as Ee,b as N,c as O,i as qn,d as I,z as Va,A as Ng,a as H,n as Ce,g as P,C as $e,t as se,y as Cr,w as Z,j as he,v as $,m as ne,f as Qe,ai as He,H as Fc,I as Ig,ae as fk,V as Zd,R as Qd,a3 as mk,a4 as gk,P as vk,J as be,K as Ne,F as Ie,l as _t,D as ao,M as Rg,N as Cs,B as ep,O as Pg,a0 as yk,s as ns,S as tp,a1 as kr,a2 as bk,u as Fg,Q as Lg,U as kk,W as wk,Z as np,k as Ba,$ as Vg,a9 as rp,L as Co,h as ip,af as xk,Y as Ek,T as Ck}from"./_plugin-vue_export-helper.js";var Sk=Object.defineProperty,Tk=(t,e,n)=>e in t?Sk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Yt=(t,e,n)=>(Tk(t,typeof e!="symbol"?e+"":e,n),n);function Bg(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=Bg(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function Ok(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=Bg(t))&&(r&&(r+=" "),r+=e);return r}const Oh=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Ah=Ok,Cn=(t,e)=>n=>{var r;if(e?.variants==null)return Ah(t,n?.class,n?.className);const{variants:i,defaultVariants:o}=e,s=Object.keys(i).map(u=>{const c=n?.[u],d=o?.[u];if(c===null)return null;const h=Oh(c)||Oh(d);return i[u][h]}),a=n&&Object.entries(n).reduce((u,c)=>{let[d,h]=c;return h===void 0||(u[d]=h),u},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((u,c)=>{let{class:d,className:h,...p}=c;return Object.entries(p).every(f=>{let[m,g]=f;return Array.isArray(g)?g.includes({...o,...a}[m]):{...o,...a}[m]===g})?[...u,d,h]:u},[]);return Ah(t,s,l,n?.class,n?.className)},$g=/^[a-z0-9]+(-[a-z0-9]+)*$/,Gl=(t,e,n,r="")=>{const i=t.split(":");if(t.slice(0,1)==="@"){if(i.length<2||i.length>3)return null;r=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){const a=i.pop(),l=i.pop(),u={provider:i.length>0?i[0]:r,prefix:l,name:a};return e&&!wa(u)?null:u}const o=i[0],s=o.split("-");if(s.length>1){const a={provider:r,prefix:s.shift(),name:s.join("-")};return e&&!wa(a)?null:a}if(n&&r===""){const a={provider:r,prefix:"",name:o};return e&&!wa(a,n)?null:a}return null},wa=(t,e)=>t?!!((e&&t.prefix===""||t.prefix)&&t.name):!1,jg=Object.freeze({left:0,top:0,width:16,height:16}),$a=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Jl=Object.freeze({...jg,...$a}),Lc=Object.freeze({...Jl,body:"",hidden:!1});function Ak(t,e){const n={};!t.hFlip!=!e.hFlip&&(n.hFlip=!0),!t.vFlip!=!e.vFlip&&(n.vFlip=!0);const r=((t.rotate||0)+(e.rotate||0))%4;return r&&(n.rotate=r),n}function Mh(t,e){const n=Ak(t,e);for(const r in Lc)r in $a?r in t&&!(r in n)&&(n[r]=$a[r]):r in e?n[r]=e[r]:r in t&&(n[r]=t[r]);return n}function Mk(t,e){const n=t.icons,r=t.aliases||Object.create(null),i=Object.create(null);function o(s){if(n[s])return i[s]=[];if(!(s in i)){i[s]=null;const a=r[s]&&r[s].parent,l=a&&o(a);l&&(i[s]=[a].concat(l))}return i[s]}return Object.keys(n).concat(Object.keys(r)).forEach(o),i}function _k(t,e,n){const r=t.icons,i=t.aliases||Object.create(null);let o={};function s(a){o=Mh(r[a]||i[a],o)}return s(e),n.forEach(s),Mh(t,o)}function zg(t,e){const n=[];if(typeof t!="object"||typeof t.icons!="object")return n;t.not_found instanceof Array&&t.not_found.forEach(i=>{e(i,null),n.push(i)});const r=Mk(t);for(const i in r){const o=r[i];o&&(e(i,_k(t,i,o)),n.push(i))}return n}const Dk={provider:"",aliases:{},not_found:{},...jg};function Fu(t,e){for(const n in e)if(n in t&&typeof t[n]!=typeof e[n])return!1;return!0}function Hg(t){if(typeof t!="object"||t===null)return null;const e=t;if(typeof e.prefix!="string"||!t.icons||typeof t.icons!="object"||!Fu(t,Dk))return null;const n=e.icons;for(const i in n){const o=n[i];if(!i||typeof o.body!="string"||!Fu(o,Lc))return null}const r=e.aliases||Object.create(null);for(const i in r){const o=r[i],s=o.parent;if(!i||typeof s!="string"||!n[s]&&!r[s]||!Fu(o,Lc))return null}return e}const _h=Object.create(null);function Nk(t,e){return{provider:t,prefix:e,icons:Object.create(null),missing:new Set}}function Hi(t,e){const n=_h[t]||(_h[t]=Object.create(null));return n[e]||(n[e]=Nk(t,e))}function qg(t,e){return Hg(e)?zg(e,(n,r)=>{r?t.icons[n]=r:t.missing.add(n)}):[]}function Ik(t,e,n){try{if(typeof n.body=="string")return t.icons[e]={...n},!0}catch{}return!1}let rs=!1;function Wg(t){return typeof t=="boolean"&&(rs=t),rs}function Rk(t){const e=typeof t=="string"?Gl(t,!0,rs):t;if(e){const n=Hi(e.provider,e.prefix),r=e.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function Pk(t,e){const n=Gl(t,!0,rs);if(!n)return!1;const r=Hi(n.provider,n.prefix);return e?Ik(r,n.name,e):(r.missing.add(n.name),!0)}function Fk(t,e){if(typeof t!="object")return!1;if(typeof e!="string"&&(e=t.provider||""),rs&&!e&&!t.prefix){let i=!1;return Hg(t)&&(t.prefix="",zg(t,(o,s)=>{Pk(o,s)&&(i=!0)})),i}const n=t.prefix;if(!wa({prefix:n,name:"a"}))return!1;const r=Hi(e,n);return!!qg(r,t)}const Ug=Object.freeze({width:null,height:null}),Kg=Object.freeze({...Ug,...$a}),Lk=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Vk=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Dh(t,e,n){if(e===1)return t;if(n=n||100,typeof t=="number")return Math.ceil(t*e*n)/n;if(typeof t!="string")return t;const r=t.split(Lk);if(r===null||!r.length)return t;const i=[];let o=r.shift(),s=Vk.test(o);for(;;){if(s){const a=parseFloat(o);isNaN(a)?i.push(o):i.push(Math.ceil(a*e*n)/n)}else i.push(o);if(o=r.shift(),o===void 0)return i.join("");s=!s}}function Bk(t,e="defs"){let n="";const r=t.indexOf("<"+e);for(;r>=0;){const i=t.indexOf(">",r),o=t.indexOf("</"+e);if(i===-1||o===-1)break;const s=t.indexOf(">",o);if(s===-1)break;n+=t.slice(i+1,o).trim(),t=t.slice(0,r).trim()+t.slice(s+1)}return{defs:n,content:t}}function $k(t,e){return t?"<defs>"+t+"</defs>"+e:e}function jk(t,e,n){const r=Bk(t);return $k(r.defs,e+r.content+n)}const zk=t=>t==="unset"||t==="undefined"||t==="none";function Hk(t,e){const n={...Jl,...t},r={...Kg,...e},i={left:n.left,top:n.top,width:n.width,height:n.height};let o=n.body;[n,r].forEach(m=>{const g=[],y=m.hFlip,b=m.vFlip;let k=m.rotate;y?b?k+=2:(g.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),g.push("scale(-1 1)"),i.top=i.left=0):b&&(g.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),g.push("scale(1 -1)"),i.top=i.left=0);let v;switch(k<0&&(k-=Math.floor(k/4)*4),k=k%4,k){case 1:v=i.height/2+i.top,g.unshift("rotate(90 "+v.toString()+" "+v.toString()+")");break;case 2:g.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:v=i.width/2+i.left,g.unshift("rotate(-90 "+v.toString()+" "+v.toString()+")");break}k%2===1&&(i.left!==i.top&&(v=i.left,i.left=i.top,i.top=v),i.width!==i.height&&(v=i.width,i.width=i.height,i.height=v)),g.length&&(o=jk(o,'<g transform="'+g.join(" ")+'">',"</g>"))});const s=r.width,a=r.height,l=i.width,u=i.height;let c,d;s===null?(d=a===null?"1em":a==="auto"?u:a,c=Dh(d,l/u)):(c=s==="auto"?l:s,d=a===null?Dh(c,u/l):a==="auto"?u:a);const h={},p=(m,g)=>{zk(g)||(h[m]=g.toString())};p("width",c),p("height",d);const f=[i.left,i.top,l,u];return h.viewBox=f.join(" "),{attributes:h,viewBox:f,body:o}}const qk=/\sid="(\S+)"/g,Wk="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Uk=0;function Kk(t,e=Wk){const n=[];let r;for(;r=qk.exec(t);)n.push(r[1]);if(!n.length)return t;const i="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(o=>{const s=typeof e=="function"?e(o):e+(Uk++).toString(),a=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replace(new RegExp('([#;"])('+a+')([")]|\\.[a-z])',"g"),"$1"+s+i+"$3")}),t=t.replace(new RegExp(i,"g"),""),t}const Vc=Object.create(null);function Gk(t,e){Vc[t]=e}function Bc(t){return Vc[t]||Vc[""]}function op(t){let e;if(typeof t.resources=="string")e=[t.resources];else if(e=t.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:t.path||"/",maxURL:t.maxURL||500,rotate:t.rotate||750,timeout:t.timeout||5e3,random:t.random===!0,index:t.index||0,dataAfterTimeout:t.dataAfterTimeout!==!1}}const sp=Object.create(null),Js=["https://api.simplesvg.com","https://api.unisvg.com"],$c=[];for(;Js.length>0;)Js.length===1||Math.random()>.5?$c.push(Js.shift()):$c.push(Js.pop());sp[""]=op({resources:["https://api.iconify.design"].concat($c)});function Gg(t,e){const n=op(e);return n===null?!1:(sp[t]=n,!0)}function ap(t){return sp[t]}const Jk=()=>{let t;try{if(t=fetch,typeof t=="function")return t}catch{}};let Nh=Jk();function Xk(t,e){const n=ap(t);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let i=0;n.resources.forEach(s=>{i=Math.max(i,s.length)});const o=e+".json?icons=";r=n.maxURL-i-n.path.length-o.length}return r}function Yk(t){return t===404}const Zk=(t,e,n)=>{const r=[],i=Xk(t,e),o="icons";let s={type:o,provider:t,prefix:e,icons:[]},a=0;return n.forEach((l,u)=>{a+=l.length+1,a>=i&&u>0&&(r.push(s),s={type:o,provider:t,prefix:e,icons:[]},a=l.length),s.icons.push(l)}),r.push(s),r};function Qk(t){if(typeof t=="string"){const e=ap(t);if(e)return e.path}return"/"}const ew=(t,e,n)=>{if(!Nh){n("abort",424);return}let r=Qk(e.provider);switch(e.type){case"icons":{const o=e.prefix,s=e.icons.join(","),a=new URLSearchParams({icons:s});r+=o+".json?"+a.toString();break}case"custom":{const o=e.uri;r+=o.slice(0,1)==="/"?o.slice(1):o;break}default:n("abort",400);return}let i=503;Nh(t+r).then(o=>{const s=o.status;if(s!==200){setTimeout(()=>{n(Yk(s)?"abort":"next",s)});return}return i=501,o.json()}).then(o=>{if(typeof o!="object"||o===null){setTimeout(()=>{o===404?n("abort",o):n("next",i)});return}setTimeout(()=>{n("success",o)})}).catch(()=>{n("next",i)})},tw={prepare:Zk,send:ew};function nw(t){const e={loaded:[],missing:[],pending:[]},n=Object.create(null);t.sort((i,o)=>i.provider!==o.provider?i.provider.localeCompare(o.provider):i.prefix!==o.prefix?i.prefix.localeCompare(o.prefix):i.name.localeCompare(o.name));let r={provider:"",prefix:"",name:""};return t.forEach(i=>{if(r.name===i.name&&r.prefix===i.prefix&&r.provider===i.provider)return;r=i;const o=i.provider,s=i.prefix,a=i.name,l=n[o]||(n[o]=Object.create(null)),u=l[s]||(l[s]=Hi(o,s));let c;a in u.icons?c=e.loaded:s===""||u.missing.has(a)?c=e.missing:c=e.pending;const d={provider:o,prefix:s,name:a};c.push(d)}),e}function Jg(t,e){t.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(i=>i.id!==e))})}function rw(t){t.pendingCallbacksFlag||(t.pendingCallbacksFlag=!0,setTimeout(()=>{t.pendingCallbacksFlag=!1;const e=t.loaderCallbacks?t.loaderCallbacks.slice(0):[];if(!e.length)return;let n=!1;const r=t.provider,i=t.prefix;e.forEach(o=>{const s=o.icons,a=s.pending.length;s.pending=s.pending.filter(l=>{if(l.prefix!==i)return!0;const u=l.name;if(t.icons[u])s.loaded.push({provider:r,prefix:i,name:u});else if(t.missing.has(u))s.missing.push({provider:r,prefix:i,name:u});else return n=!0,!0;return!1}),s.pending.length!==a&&(n||Jg([t],o.id),o.callback(s.loaded.slice(0),s.missing.slice(0),s.pending.slice(0),o.abort))})}))}let iw=0;function ow(t,e,n){const r=iw++,i=Jg.bind(null,n,r);if(!e.pending.length)return i;const o={id:r,icons:e,callback:t,abort:i};return n.forEach(s=>{(s.loaderCallbacks||(s.loaderCallbacks=[])).push(o)}),i}function sw(t,e=!0,n=!1){const r=[];return t.forEach(i=>{const o=typeof i=="string"?Gl(i,e,n):i;o&&r.push(o)}),r}var aw={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function lw(t,e,n,r){const i=t.resources.length,o=t.random?Math.floor(Math.random()*i):t.index;let s;if(t.random){let x=t.resources.slice(0);for(s=[];x.length>1;){const T=Math.floor(Math.random()*x.length);s.push(x[T]),x=x.slice(0,T).concat(x.slice(T+1))}s=s.concat(x)}else s=t.resources.slice(o).concat(t.resources.slice(0,o));const a=Date.now();let l="pending",u=0,c,d=null,h=[],p=[];typeof r=="function"&&p.push(r);function f(){d&&(clearTimeout(d),d=null)}function m(){l==="pending"&&(l="aborted"),f(),h.forEach(x=>{x.status==="pending"&&(x.status="aborted")}),h=[]}function g(x,T){T&&(p=[]),typeof x=="function"&&p.push(x)}function y(){return{startTime:a,payload:e,status:l,queriesSent:u,queriesPending:h.length,subscribe:g,abort:m}}function b(){l="failed",p.forEach(x=>{x(void 0,c)})}function k(){h.forEach(x=>{x.status==="pending"&&(x.status="aborted")}),h=[]}function v(x,T,F){const D=T!=="success";switch(h=h.filter(C=>C!==x),l){case"pending":break;case"failed":if(D||!t.dataAfterTimeout)return;break;default:return}if(T==="abort"){c=F,b();return}if(D){c=F,h.length||(s.length?w():b());return}if(f(),k(),!t.random){const C=t.resources.indexOf(x.resource);C!==-1&&C!==t.index&&(t.index=C)}l="completed",p.forEach(C=>{C(F)})}function w(){if(l!=="pending")return;f();const x=s.shift();if(x===void 0){if(h.length){d=setTimeout(()=>{f(),l==="pending"&&(k(),b())},t.timeout);return}b();return}const T={status:"pending",resource:x,callback:(F,D)=>{v(T,F,D)}};h.push(T),u++,d=setTimeout(w,t.rotate),n(x,e,T.callback)}return setTimeout(w),y}function Xg(t){const e={...aw,...t};let n=[];function r(){n=n.filter(s=>s().status==="pending")}function i(s,a,l){const u=lw(e,s,a,(c,d)=>{r(),l&&l(c,d)});return n.push(u),u}function o(s){return n.find(a=>s(a))||null}return{query:i,find:o,setIndex:s=>{e.index=s},getIndex:()=>e.index,cleanup:r}}function Ih(){}const Lu=Object.create(null);function uw(t){if(!Lu[t]){const e=ap(t);if(!e)return;const n=Xg(e),r={config:e,redundancy:n};Lu[t]=r}return Lu[t]}function cw(t,e,n){let r,i;if(typeof t=="string"){const o=Bc(t);if(!o)return n(void 0,424),Ih;i=o.send;const s=uw(t);s&&(r=s.redundancy)}else{const o=op(t);if(o){r=Xg(o);const s=t.resources?t.resources[0]:"",a=Bc(s);a&&(i=a.send)}}return!r||!i?(n(void 0,424),Ih):r.query(e,i,n)().abort}function Rh(){}function dw(t){t.iconsLoaderFlag||(t.iconsLoaderFlag=!0,setTimeout(()=>{t.iconsLoaderFlag=!1,rw(t)}))}function pw(t){const e=[],n=[];return t.forEach(r=>{(r.match($g)?e:n).push(r)}),{valid:e,invalid:n}}function vo(t,e,n){function r(){const i=t.pendingIcons;e.forEach(o=>{i&&i.delete(o),t.icons[o]||t.missing.add(o)})}if(n&&typeof n=="object")try{if(!qg(t,n).length){r();return}}catch(i){console.error(i)}r(),dw(t)}function Ph(t,e){t instanceof Promise?t.then(n=>{e(n)}).catch(()=>{e(null)}):e(t)}function hw(t,e){t.iconsToLoad?t.iconsToLoad=t.iconsToLoad.concat(e).sort():t.iconsToLoad=e,t.iconsQueueFlag||(t.iconsQueueFlag=!0,setTimeout(()=>{t.iconsQueueFlag=!1;const{provider:n,prefix:r}=t,i=t.iconsToLoad;if(delete t.iconsToLoad,!i||!i.length)return;const o=t.loadIcon;if(t.loadIcons&&(i.length>1||!o)){Ph(t.loadIcons(i,r,n),u=>{vo(t,i,u)});return}if(o){i.forEach(u=>{const c=o(u,r,n);Ph(c,d=>{const h=d?{prefix:r,icons:{[u]:d}}:null;vo(t,[u],h)})});return}const{valid:s,invalid:a}=pw(i);if(a.length&&vo(t,a,null),!s.length)return;const l=r.match($g)?Bc(n):null;if(!l){vo(t,s,null);return}l.prepare(n,r,s).forEach(u=>{cw(n,u,c=>{vo(t,u.icons,c)})})}))}const fw=(t,e)=>{const n=sw(t,!0,Wg()),r=nw(n);if(!r.pending.length){let l=!0;return e&&setTimeout(()=>{l&&e(r.loaded,r.missing,r.pending,Rh)}),()=>{l=!1}}const i=Object.create(null),o=[];let s,a;return r.pending.forEach(l=>{const{provider:u,prefix:c}=l;if(c===a&&u===s)return;s=u,a=c,o.push(Hi(u,c));const d=i[u]||(i[u]=Object.create(null));d[c]||(d[c]=[])}),r.pending.forEach(l=>{const{provider:u,prefix:c,name:d}=l,h=Hi(u,c),p=h.pendingIcons||(h.pendingIcons=new Set);p.has(d)||(p.add(d),i[u][c].push(d))}),o.forEach(l=>{const u=i[l.provider][l.prefix];u.length&&hw(l,u)}),e?ow(e,r,o):Rh};function mw(t,e){const n={...t};for(const r in e){const i=e[r],o=typeof i;r in Ug?(i===null||i&&(o==="string"||o==="number"))&&(n[r]=i):o===typeof n[r]&&(n[r]=r==="rotate"?i%4:i)}return n}const gw=/[\s,]+/;function vw(t,e){e.split(gw).forEach(n=>{switch(n.trim()){case"horizontal":t.hFlip=!0;break;case"vertical":t.vFlip=!0;break}})}function yw(t,e=0){const n=t.replace(/^-?[0-9.]*/,"");function r(i){for(;i<0;)i+=4;return i%4}if(n===""){const i=parseInt(t);return isNaN(i)?0:r(i)}else if(n!==t){let i=0;switch(n){case"%":i=25;break;case"deg":i=90}if(i){let o=parseFloat(t.slice(0,t.length-n.length));return isNaN(o)?0:(o=o/i,o%1===0?r(o):0)}}return e}function bw(t,e){let n=t.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in e)n+=" "+r+'="'+e[r]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+t+"</svg>"}function kw(t){return t.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function ww(t){return"data:image/svg+xml,"+kw(t)}function xw(t){return'url("'+ww(t)+'")'}const Fh={...Kg,inline:!1},Ew={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Cw={display:"inline-block"},jc={backgroundColor:"currentColor"},Yg={backgroundColor:"transparent"},Lh={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Vh={webkitMask:jc,mask:jc,background:Yg};for(const t in Vh){const e=Vh[t];for(const n in Lh)e[t+n]=Lh[n]}const xa={};["horizontal","vertical"].forEach(t=>{const e=t.slice(0,1)+"Flip";xa[t+"-flip"]=e,xa[t.slice(0,1)+"-flip"]=e,xa[t+"Flip"]=e});function Bh(t){return t+(t.match(/^[-0-9.]+$/)?"px":"")}const $h=(t,e)=>{const n=mw(Fh,e),r={...Ew},i=e.mode||"svg",o={},s=e.style,a=typeof s=="object"&&!(s instanceof Array)?s:{};for(let m in e){const g=e[m];if(g!==void 0)switch(m){case"icon":case"style":case"onLoad":case"mode":case"ssr":break;case"inline":case"hFlip":case"vFlip":n[m]=g===!0||g==="true"||g===1;break;case"flip":typeof g=="string"&&vw(n,g);break;case"color":o.color=g;break;case"rotate":typeof g=="string"?n[m]=yw(g):typeof g=="number"&&(n[m]=g);break;case"ariaHidden":case"aria-hidden":g!==!0&&g!=="true"&&delete r["aria-hidden"];break;default:{const y=xa[m];y?(g===!0||g==="true"||g===1)&&(n[y]=!0):Fh[m]===void 0&&(r[m]=g)}}}const l=Hk(t,n),u=l.attributes;if(n.inline&&(o.verticalAlign="-0.125em"),i==="svg"){r.style={...o,...a},Object.assign(r,u);let m=0,g=e.id;return typeof g=="string"&&(g=g.replace(/-/g,"_")),r.innerHTML=Kk(l.body,g?()=>g+"ID"+m++:"iconifyVue"),ns("svg",r)}const{body:c,width:d,height:h}=t,p=i==="mask"||(i==="bg"?!1:c.indexOf("currentColor")!==-1),f=bw(c,{...u,width:d+"",height:h+""});return r.style={...o,"--svg":xw(f),width:Bh(u.width),height:Bh(u.height),...Cw,...p?jc:Yg,...a},ns("span",r)};Wg(!0);Gk("",tw);if(typeof document<"u"&&typeof window<"u"){const t=window;if(t.IconifyPreload!==void 0){const e=t.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!Fk(r))&&console.error(n)}catch{console.error(n)}})}if(t.IconifyProviders!==void 0){const e=t.IconifyProviders;if(typeof e=="object"&&e!==null)for(let n in e){const r="IconifyProviders["+n+"] is invalid.";try{const i=e[n];if(typeof i!="object"||!i||i.resources===void 0)continue;Gg(n,i)||console.error(r)}catch{console.error(r)}}}}const Sw={...Jl,body:""},Ze=te({inheritAttrs:!1,data(){return{_name:"",_loadingIcon:null,iconMounted:!1,counter:0}},mounted(){this.iconMounted=!0},unmounted(){this.abortLoading()},methods:{abortLoading(){this._loadingIcon&&(this._loadingIcon.abort(),this._loadingIcon=null)},getIcon(t,e,n){if(typeof t=="object"&&t!==null&&typeof t.body=="string")return this._name="",this.abortLoading(),{data:t};let r;if(typeof t!="string"||(r=Gl(t,!1,!0))===null)return this.abortLoading(),null;let i=Rk(r);if(!i)return(!this._loadingIcon||this._loadingIcon.name!==t)&&(this.abortLoading(),this._name="",i!==null&&(this._loadingIcon={name:t,abort:fw([r],()=>{this.counter++})})),null;if(this.abortLoading(),this._name!==t&&(this._name=t,e&&e(t)),n){i=Object.assign({},i);const s=n(i.body,r.name,r.prefix,r.provider);typeof s=="string"&&(i.body=s)}const o=["iconify"];return r.prefix!==""&&o.push("iconify--"+r.prefix),r.provider!==""&&o.push("iconify--"+r.provider),{data:i,classes:o}}},render(){this.counter;const t=this.$attrs,e=this.iconMounted||t.ssr?this.getIcon(t.icon,t.onLoad,t.customise):null;if(!e)return $h(Sw,t);let n=t;return e.classes&&(n={...t,class:(typeof t.class=="string"?t.class+" ":"")+e.classes.join(" ")}),$h({...Jl,...e.data},n)}});Gg("",{resources:["https://icons.ui.kvass.no"]});function Tw(t){return!t||typeof t!="object"?!1:typeof t.then=="function"&&typeof t.catch=="function"}const Ow=["xxs","xs","sm","default","lg","xl","xxl","3xl","4xl"],Aw=(t,e)=>e==="default"?`var(--k-ui-${t})`:`var(--k-ui-${t}-${e})`,ja=t=>{switch(t){case"start":case"end":return`flex-${t}`;default:return t}},lp=(t,e="spacing")=>t.split(" ").map(n=>typeof n=="number"||typeof n=="string"&&n.match(/^\d+$/)?`${n}rem`:typeof n=="string"&&Ow.includes(n)?Aw(e,n):n).join(" ");function Mw(){var t=new Date().getTime(),e=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var r=Math.random()*16;return t>0?(r=(t+r)%16|0,t=Math.floor(t/16)):(r=(e+r)%16|0,e=Math.floor(e/16)),(n==="x"?r:r&3|8).toString(16)})}const Zg=(t,e)=>Object.fromEntries(Object.entries(e).map(([n,r])=>[`--k-${t}-${n}`,r])),_w=function(t){return Object.prototype.toString.call(t)==="[object Object]"};function Dw(t){return Array.isArray(t)}const Qg=te({__name:"Spinner",props:{size:{default:"medium"}},setup(t){return(e,n)=>(E(),O("span",{class:Ce(`k-spinner k-spinner--size-${e.size}`)},null,2))}}),Nw={class:"k-button__content"},Iw={key:0,class:"k-button__icon k-button__icon--left"},Rw={key:1,class:"k-button__icon k-button__icon--right"},Pw={key:2,class:"k-button__confirm-label"},ze=te({__name:"Button",props:{variant:{default:"secondary"},size:{default:"medium"},loading:{type:Boolean},promise:{},confirm:{type:Boolean},is:{default:"button"},stateTimeout:{default:1e3},confirmLabel:{default:"Are you sure?"},label:{},icon:{},iconLeft:{},iconRight:{}},emits:["idle","loading","success","error","confirm","click"],setup(t,{emit:e}){const n=t,r=e,i={success:"success",confirm:"warning",error:"danger",loading:null,idle:null},o=N(()=>!h.value||u.value==="loading"?n.variant:u.value=="confirm"?"warning":i[u.value]||n.variant),s=N(()=>n.loading||u.value==="loading"),a=X(),l=N(()=>{if(u.value)return["error","success"].includes(u.value)||s.value}),u=X("idle"),c=X(),d=X(),h=N(()=>u.value||s.value),p=N(()=>["error","success"].includes(u.value)),f=N(()=>u.value==="success"?"fa-pro-regular:check":"fa-pro-regular:exclamation-circle");function m(w){if(!w)return;g(),d.value=w,a.value=setTimeout(()=>u.value="loading",100);let x=T=>{g(),n.stateTimeout?(u.value=T,c.value=setTimeout(()=>{g(),r(T)},n.stateTimeout)):r(T)};d.value.then(()=>x("success")).catch(()=>x("error"))}function g(){a.value&&clearTimeout(a.value),c.value&&clearTimeout(c.value),d.value=null,u.value="idle"}Ee(()=>n.promise,w=>{w&&Tw(w)&&m(w)});const y=X(),b=N(()=>u.value==="confirm");function k(w){if(n.confirm&&u.value!=="confirm")return u.value="confirm";g(),r("click",w)}const v=Cn("k-button",{variants:{variant:{primary:"k-button--variant-primary",secondary:"k-button--variant-secondary",tertiary:"k-button--variant-tertiary",danger:"k-button--variant-danger",warning:"k-button--variant-warning",success:"k-button--variant-success"},size:{small:"k-button--size-small",medium:"k-button--size-medium",large:"k-button--size-large"},isLoading:{true:"k-button--loading"},isBusy:{true:"k-button--busy"}}});return(w,x)=>(E(),B(Qe(w.is),ne({type:"button",class:$(v)({variant:o.value,size:w.size,isLoading:s.value,isBusy:l.value}),"aria-busy":l.value,inert:l.value},w.$attrs,{onClick:k,ref_key:"rootElement",ref:y}),{default:Z(()=>[Va(H("span",Nw,[w.icon||w.iconLeft||w.$slots.icon||w.$slots["icon-left"]?(E(),O("span",Iw,[P(w.$slots,"icon-left",{},()=>[P(w.$slots,"icon",{},()=>[he($(Ze),{icon:w.icon||w.iconLeft},null,8,["icon"])])])])):I("",!0),P(w.$slots,"default",{},()=>[$e(se(w.label),1)]),w.iconRight||w.$slots["icon-right"]?(E(),O("span",Rw,[P(w.$slots,"icon-right",{},()=>[he($(Ze),{icon:w.iconRight},null,8,["icon"])])])):I("",!0)],512),[[Ng,!b.value]]),s.value?(E(),B(Qg,{key:0})):I("",!0),p.value?(E(),B($(Ze),{key:1,class:"k-button__state-indicator",icon:f.value},null,8,["icon"])):I("",!0),b.value?(E(),O("span",Pw,se(w.confirmLabel),1)):I("",!0)]),_:3},16,["class","aria-busy","inert"]))}}),Fw={class:"k-alert__content"},Lw={key:0,class:"k-alert__title"},Vw={class:"k-alert__icon"},hL=te({__name:"Alert",props:{variant:{default:"neutral"},icon:{},title:{},content:{},action:{}},emits:["action"],setup(t,{emit:e}){const n=t,r=e,i=Cn("k-alert",{variants:{variant:{success:"k-alert--success",neutral:"k-alert--neutral",info:"k-alert--info",danger:"k-alert--danger",warning:"k-alert--warning",primary:"k-alert--primary"}}}),o={success:"fa-pro-light:circle-check",info:"fa-pro-light:circle-question",warning:"fa-pro-light:exclamation-triangle",danger:"fa-pro-light:exclamation-circle"};return(s,a)=>(E(),O("div",{role:"alert",class:Ce($(i)({...n}))},[H("div",Fw,[s.title||s.$slots.title?(E(),O("div",Lw,[P(s.$slots,"title",{},()=>[H("strong",null,se(s.title),1)])])):I("",!0),P(s.$slots,"default",{},()=>[H("span",null,se(s.content),1)]),s.action?(E(),B(ze,{key:1,label:s.action,size:"small",class:"k-alert__action",onClick:a[0]||(a[0]=l=>r("action",{event:l,name:s.action}))},null,8,["label"])):I("",!0)]),H("div",Vw,[P(s.$slots,"icon",{},()=>[s.icon||o[s.variant]?(E(),B($(Ze),{key:0,icon:s.icon||o[s.variant]},null,8,["icon"])):I("",!0)])])],2))}}),Bw={class:"k-badge__label"},fL=te({__name:"Badge",props:{variant:{default:"neutral"},appearance:{default:"solid"},icon:{},dismissable:{type:Boolean,default:!1},rounded:{type:Boolean,default:!1},label:{}},emits:["dismiss"],setup(t,{emit:e}){const n=t,r=e,i={task:"fa-pro-solid:circle",dot:"fa-pro-solid:circle"},o=Cn("k-badge",{variants:{variant:{neutral:"k-badge--variant-neutral",info:"k-badge--variant-info",warning:"k-badge--variant-warning",success:"k-badge--variant-success",danger:"k-badge--variant-danger",primary:"k-badge--variant-primary"},appearance:{solid:"k-badge--appearance-solid",outline:"k-badge--appearance-outline",filled:"k-badge--appearance-filled",task:"k-badge--appearance-task",dot:"k-badge--appearance-dot"},rounded:{true:"k-badge--rounded",false:""}}}),s=X(!1);function a(){s.value=!0,r("dismiss",n)}return(l,u)=>s.value?I("",!0):(E(),O("span",{key:0,class:Ce($(o)({appearance:l.appearance,variant:l.variant,rounded:l.rounded}))},[P(l.$slots,"icon",{},()=>[l.icon||i[l.appearance]?(E(),B($(Ze),{key:0,icon:l.icon||i[l.appearance],class:"k-badge__icon"},null,8,["icon"])):I("",!0)]),P(l.$slots,"default",{},()=>[H("span",Bw,se(l.label),1)]),l.dismissable?(E(),O("button",{key:0,class:"k-badge__dismiss",onClick:a},[he($(Ze),{icon:"fa-pro-light:times"})])):I("",!0)],2))}});var Ln=(t,e=[])=>({parts:(...n)=>{if($w(e))return Ln(t,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>Ln(t,[...e,...n]),rename:n=>Ln(n,e),keys:()=>e,build:()=>[...new Set(e)].reduce((n,r)=>Object.assign(n,{[r]:{selector:[`&[data-scope="${bi(t)}"][data-part="${bi(r)}"]`,`& [data-scope="${bi(t)}"][data-part="${bi(r)}"]`].join(", "),attrs:{"data-scope":bi(t),"data-part":bi(r)}}}),{})}),bi=t=>t.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),$w=t=>t.length===0,jh=t=>Math.max(0,Math.min(1,t)),Vu=(...t)=>e=>t.reduce((n,r)=>r(n),e),Xs=()=>{},Xl=t=>typeof t=="object"&&t!==null,G=t=>t?"":void 0,jw=t=>t?"true":void 0,zw=1,Hw=9,qw=11,dt=t=>Xl(t)&&t.nodeType===zw&&typeof t.nodeName=="string",up=t=>Xl(t)&&t.nodeType===Hw,Ww=t=>Xl(t)&&t===t.window,ev=t=>dt(t)?t.localName||"":"#document";function Uw(t){return["html","body","#document"].includes(ev(t))}var Kw=t=>Xl(t)&&t.nodeType!==void 0,za=t=>Kw(t)&&t.nodeType===qw&&"host"in t,Gw=t=>dt(t)&&t.localName==="input",Jw=t=>dt(t)?t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0:!1,Xw=/(textarea|select)/;function Yw(t){if(t==null||!dt(t))return!1;try{return Gw(t)&&t.selectionStart!=null||Xw.test(t.localName)||t.isContentEditable||t.getAttribute("contenteditable")==="true"||t.getAttribute("contenteditable")===""}catch{return!1}}function qi(t,e){var n;if(!t||!e||!dt(t)||!dt(e))return!1;const r=(n=e.getRootNode)==null?void 0:n.call(e);if(t===e||t.contains(e))return!0;if(r&&za(r)){let i=e;for(;i;){if(t===i)return!0;i=i.parentNode||i.host}}return!1}function Kt(t){return up(t)?t:Ww(t)?t.document:t?.ownerDocument??document}function Zw(t){return Kt(t).documentElement}function xt(t){var e;return za(t)?xt(t.host):up(t)?t.defaultView??window:dt(t)?((e=t.ownerDocument)==null?void 0:e.defaultView)??window:window}function tv(t){let e=t.activeElement;for(;e!=null&&e.shadowRoot;){const n=e.shadowRoot.activeElement;if(n===e)break;e=n}return e}function Qw(t){if(ev(t)==="html")return t;const e=t.assignedSlot||t.parentNode||za(t)&&t.host||Zw(t);return za(e)?e.host:e}var Bu=new WeakMap;function ex(t){return Bu.has(t)||Bu.set(t,xt(t).getComputedStyle(t)),Bu.get(t)}var nv=()=>typeof document<"u";function tx(){const t=navigator.userAgentData;return t?.platform??navigator.platform}var cp=t=>nv()&&t.test(tx()),nx=t=>nv()&&t.test(navigator.vendor),rv=()=>cp(/^Mac/),rx=()=>ix()&&nx(/apple/i),ix=()=>cp(/mac|iphone|ipad|ipod/i),dp=()=>cp(/iP(hone|ad|od)|iOS/);function ox(t){var e,n,r;return((e=t.composedPath)==null?void 0:e.call(t))??((r=(n=t.nativeEvent)==null?void 0:n.composedPath)==null?void 0:r.call(n))}function ct(t){const e=ox(t);return e?.[0]??t.target}var sx=t=>qi(t.currentTarget,ct(t)),ax=t=>t.button===0,lx=t=>t.button===2||rv()&&t.ctrlKey&&t.button===0,ux=t=>t.ctrlKey||t.altKey||t.metaKey,cx=t=>"touches"in t&&t.touches.length>0,dx={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},zh={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};function iv(t,e={}){const{dir:n="ltr",orientation:r="horizontal"}=e;let i=t.key;return i=dx[i]??i,n==="rtl"&&r==="horizontal"&&i in zh&&(i=zh[i]),i}var px=new Set(["PageUp","PageDown"]),hx=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function fx(t){return t.ctrlKey||t.metaKey?.1:px.has(t.key)||t.shiftKey&&hx.has(t.key)?10:1}function pp(t,e="client"){const n=cx(t)?t.touches[0]||t.changedTouches[0]:t;return{x:n[`${e}X`],y:n[`${e}Y`]}}var De=(t,e,n,r)=>{const i=typeof t=="function"?t():t;return i?.addEventListener(e,n,r),()=>{i?.removeEventListener(e,n,r)}};function ov(t,e){const{type:n="HTMLInputElement",property:r="value"}=e,i=xt(t)[n].prototype;return Object.getOwnPropertyDescriptor(i,r)??{}}function mx(t){if(t.localName==="input")return"HTMLInputElement";if(t.localName==="textarea")return"HTMLTextAreaElement";if(t.localName==="select")return"HTMLSelectElement"}function sv(t,e,n="value"){var r;if(!t)return;const i=mx(t);i&&((r=ov(t,{type:i,property:n}).set)==null||r.call(t,e)),t.setAttribute(n,e)}function hp(t,e){var n;t&&((n=ov(t,{type:"HTMLInputElement",property:"checked"}).set)==null||n.call(t,e),e?t.setAttribute("checked",""):t.removeAttribute("checked"))}function gx(t,e){const{value:n,bubbles:r=!0}=e;if(!t)return;const i=xt(t);t instanceof i.HTMLInputElement&&(sv(t,`${n}`),t.dispatchEvent(new i.Event("input",{bubbles:r})))}function fp(t,e){const{checked:n,bubbles:r=!0}=e;if(!t)return;const i=xt(t);t instanceof i.HTMLInputElement&&(hp(t,n),t.dispatchEvent(new i.Event("click",{bubbles:r})))}function vx(t){return yx(t)?t.form:t.closest("form")}function yx(t){return t.matches("textarea, input, select, button")}function bx(t,e){if(!t)return;const n=vx(t),r=i=>{i.defaultPrevented||e()};return n?.addEventListener("reset",r,{passive:!0}),()=>n?.removeEventListener("reset",r)}function kx(t,e){const n=t?.closest("fieldset");if(!n)return;e(n.disabled);const r=xt(n),i=new r.MutationObserver(()=>e(n.disabled));return i.observe(n,{attributes:!0,attributeFilter:["disabled"]}),()=>i.disconnect()}function Yl(t,e){if(!t)return;const{onFieldsetDisabledChange:n,onFormReset:r}=e,i=[bx(t,r),kx(t,n)];return()=>i.forEach(o=>o?.())}var av=t=>dt(t)&&t.tagName==="IFRAME",wx=t=>!Number.isNaN(parseInt(t.getAttribute("tabindex")||"0",10)),xx=t=>parseInt(t.getAttribute("tabindex")||"0",10)<0,mp="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type",lv=(t,e=!1)=>{if(!t)return[];const n=Array.from(t.querySelectorAll(mp));(e==!0||e=="if-empty"&&n.length===0)&&dt(t)&&dr(t)&&n.unshift(t);const r=n.filter(dr);return r.forEach((i,o)=>{if(av(i)&&i.contentDocument){const s=i.contentDocument.body;r.splice(o,1,...lv(s))}}),r};function dr(t){return!t||t.closest("[inert]")?!1:t.matches(mp)&&Jw(t)}function uv(t,e){if(!t)return[];const n=Array.from(t.querySelectorAll(mp)),r=n.filter(Vr);return r.forEach((i,o)=>{if(av(i)&&i.contentDocument){const s=i.contentDocument.body,a=uv(s);r.splice(o,1,...a)}}),!r.length&&e?n:r}function Vr(t){return t!=null&&t.tabIndex>0?!0:dr(t)&&!xx(t)}function yo(t){return t.tabIndex<0&&(/^(audio|video|details)$/.test(t.localName)||Yw(t))&&!wx(t)?0:t.tabIndex}function cv(t){const e=new Set;function n(r){const i=globalThis.requestAnimationFrame(r);e.add(()=>globalThis.cancelAnimationFrame(i))}return n(()=>n(t)),function(){e.forEach(r=>r())}}function At(t){let e;const n=globalThis.requestAnimationFrame(()=>{e=t()});return()=>{globalThis.cancelAnimationFrame(n),e?.()}}function zc(t){const e=Qw(t);return Uw(e)?Kt(e).body:dt(e)&&Cx(e)?e:zc(e)}var Ex=/auto|scroll|overlay|hidden|clip/;function Cx(t){const e=xt(t),{overflow:n,overflowX:r,overflowY:i,display:o}=e.getComputedStyle(t);return Ex.test(n+i+r)&&!["inline","contents"].includes(o)}function Sx(t,e){const{left:n,top:r,width:i,height:o}=e.getBoundingClientRect(),s={x:t.x-n,y:t.y-r},a={x:jh(s.x/i),y:jh(s.y/o)};function l(u={}){const{dir:c="ltr",orientation:d="horizontal",inverted:h}=u,p=typeof h=="object"?h.x:h,f=typeof h=="object"?h.y:h;return d==="horizontal"?c==="rtl"||p?1-a.x:a.x:f?1-a.y:a.y}return{offset:s,percent:a,getPercentValue:l}}var Di="default",Hc="",Ea=new WeakMap;function Tx(t={}){const{target:e,doc:n}=t,r=n??document,i=r.documentElement;return dp()?(Di==="default"&&(Hc=i.style.webkitUserSelect,i.style.webkitUserSelect="none"),Di="disabled"):e&&(Ea.set(e,e.style.userSelect),e.style.userSelect="none"),()=>Ox({target:e,doc:r})}function Ox(t={}){const{target:e,doc:n}=t,r=(n??document).documentElement;if(dp()){if(Di!=="disabled")return;Di="restoring",setTimeout(()=>{cv(()=>{Di==="restoring"&&(r.style.webkitUserSelect==="none"&&(r.style.webkitUserSelect=Hc||""),Hc="",Di="default")})},300)}else if(e&&Ea.has(e)){const i=Ea.get(e);e.style.userSelect==="none"&&(e.style.userSelect=i??""),e.getAttribute("style")===""&&e.removeAttribute("style"),Ea.delete(e)}}function Ax(t={}){const{defer:e,target:n,...r}=t,i=e?At:s=>s(),o=[];return o.push(i(()=>{const s=typeof n=="function"?n():n;o.push(Tx({...r,target:s}))})),()=>{o.forEach(s=>s?.())}}function Mx(t,e){const{onPointerMove:n,onPointerUp:r}=e,i=[De(t,"pointermove",o=>{const s=pp(o),a=Math.sqrt(s.x**2+s.y**2),l=o.pointerType==="touch"?10:5;if(!(a<l)){if(o.pointerType==="mouse"&&o.button===0){r();return}n({point:s,event:o})}},!1),De(t,"pointerup",r,!1),De(t,"pointercancel",r,!1),De(t,"contextmenu",r,!1),Ax({doc:t})];return()=>{i.forEach(o=>o())}}function dv(t){const{pointerNode:e,keyboardNode:n=e,onPress:r,onPressStart:i,onPressEnd:o,isValidKey:s=b=>b.key==="Enter"}=t;if(!e)return Xs;const a=xt(e),l=Kt(e);let u=Xs,c=Xs,d=Xs;const h=b=>({point:pp(b),event:b});function p(b){i?.(h(b))}function f(b){o?.(h(b))}const m=De(e,"pointerdown",b=>{c();const k=De(a,"pointerup",w=>{const x=ct(w);qi(e,x)?r?.(h(w)):o?.(h(w))},{passive:!r,once:!0}),v=De(a,"pointercancel",f,{passive:!o,once:!0});c=Vu(k,v),l.activeElement===n&&b.pointerType==="mouse"&&b.preventDefault(),p(b)},{passive:!i}),g=De(n,"focus",y);u=Vu(m,g);function y(){const b=x=>{if(!s(x))return;const T=D=>{if(!s(D))return;const C=new a.PointerEvent("pointerup"),_=h(C);r?.(_),o?.(_)};c(),c=De(n,"keyup",T);const F=new a.PointerEvent("pointerdown");p(F)},k=()=>{const x=new a.PointerEvent("pointercancel");f(x)},v=De(n,"keydown",b),w=De(n,"blur",k);d=Vu(v,w)}return()=>{u(),c(),d()}}function gp(t,e){return Array.from(t?.querySelectorAll(e)??[])}var pv=t=>t.id;function _x(t,e,n=pv){return t.find(r=>n(r)===e)}function hv(t,e,n=pv){const r=_x(t,e,n);return r?t.indexOf(r):-1}function Dx(t,e,n=!0){let r=hv(t,e);return r=n?(r+1)%t.length:Math.min(r+1,t.length-1),t[r]}function Nx(t,e,n=!0){let r=hv(t,e);return r===-1?n?t[t.length-1]:null:(r=n?(r-1+t.length)%t.length:Math.max(0,r-1),t[r])}var $u=new WeakMap;function Ix(t,e,n){$u.has(t)||$u.set(t,new Map);const r=$u.get(t),i=r.get(e);if(!i)return r.set(e,n()),()=>{var a;(a=r.get(e))==null||a(),r.delete(e)};const o=n(),s=()=>{o(),i(),r.delete(e)};return r.set(e,s),()=>{r.get(e)===s&&(o(),r.set(e,i))}}function Rx(t,e){return t?Ix(t,"style",()=>{const n=t.style.cssText;return Object.assign(t.style,e),()=>{t.style.cssText=n}}):()=>{}}var vp={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"},Px=1e3/60;function Fx(t,e){const n=t();if(dt(n)&&n.isConnected)return e(n),()=>{};{const r=setInterval(()=>{const i=t();dt(i)&&i.isConnected&&(e(i),clearInterval(r))},Px);return()=>clearInterval(r)}}function Lx(t,e){const n=[];return t?.forEach(r=>{const i=Fx(r,e);n.push(i)}),()=>{n.forEach(r=>r())}}function Vx(t){return t.mozInputSource===0&&t.isTrusted?!0:t.detail===0&&!t.pointerType}function Bx(t){return!(t.metaKey||!rv()&&t.altKey||t.ctrlKey||t.key==="Control"||t.key==="Shift"||t.key==="Meta")}var $x=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function jx(t,e,n){const r=n?ct(n):null,i=xt(r);return t=t||r instanceof i.HTMLInputElement&&!$x.has(r?.type)||r instanceof i.HTMLTextAreaElement||r instanceof i.HTMLElement&&r.isContentEditable,!(t&&e==="keyboard"&&n instanceof i.KeyboardEvent&&!Reflect.has(zx,n.key))}var ci=null,qc=new Set,Lo=new Map,ti=!1,Wc=!1,zx={Tab:!0,Escape:!0};function Zl(t,e){for(let n of qc)n(t,e)}function Ha(t){ti=!0,Bx(t)&&(ci="keyboard",Zl("keyboard",t))}function Bt(t){ci="pointer",(t.type==="mousedown"||t.type==="pointerdown")&&(ti=!0,Zl("pointer",t))}function fv(t){Vx(t)&&(ti=!0,ci="virtual")}function mv(t){const e=ct(t);e===xt(e)||e===Kt(e)||(!ti&&!Wc&&(ci="virtual",Zl("virtual",t)),ti=!1,Wc=!1)}function gv(){ti=!1,Wc=!0}function Hx(t){if(typeof window>"u"||Lo.get(xt(t)))return;const e=xt(t),n=Kt(t);let r=e.HTMLElement.prototype.focus;e.HTMLElement.prototype.focus=function(){ci="virtual",Zl("virtual",null),ti=!0,r.apply(this,arguments)},n.addEventListener("keydown",Ha,!0),n.addEventListener("keyup",Ha,!0),n.addEventListener("click",fv,!0),e.addEventListener("focus",mv,!0),e.addEventListener("blur",gv,!1),typeof e.PointerEvent<"u"?(n.addEventListener("pointerdown",Bt,!0),n.addEventListener("pointermove",Bt,!0),n.addEventListener("pointerup",Bt,!0)):(n.addEventListener("mousedown",Bt,!0),n.addEventListener("mousemove",Bt,!0),n.addEventListener("mouseup",Bt,!0)),e.addEventListener("beforeunload",()=>{qx(t)},{once:!0}),Lo.set(e,{focus:r})}var qx=(t,e)=>{const n=xt(t),r=Kt(t);Lo.has(n)&&(n.HTMLElement.prototype.focus=Lo.get(n).focus,r.removeEventListener("keydown",Ha,!0),r.removeEventListener("keyup",Ha,!0),r.removeEventListener("click",fv,!0),n.removeEventListener("focus",mv,!0),n.removeEventListener("blur",gv,!1),typeof n.PointerEvent<"u"?(r.removeEventListener("pointerdown",Bt,!0),r.removeEventListener("pointermove",Bt,!0),r.removeEventListener("pointerup",Bt,!0)):(r.removeEventListener("mousedown",Bt,!0),r.removeEventListener("mousemove",Bt,!0),r.removeEventListener("mouseup",Bt,!0)),Lo.delete(n))};function is(){return ci==="keyboard"}function yp(t={}){const{isTextInput:e,autoFocus:n,onChange:r,root:i}=t;Hx(i),r?.({isFocusVisible:n||is(),modality:ci});const o=(s,a)=>{jx(!!e,s,a)&&r?.({isFocusVisible:is(),modality:s})};return qc.add(o),()=>{qc.delete(o)}}function Wx(t){return t?Array.isArray(t)?t:[t]:[]}var vv=t=>t[0],yv=t=>t[t.length-1],Ux=(t,e)=>t.indexOf(e)!==-1,Kx=(t,...e)=>t.concat(e),Gx=(t,...e)=>t.filter(n=>!e.includes(n)),Jx=(t,e)=>Ux(t,e)?Gx(t,e):Kx(t,e),Hh=t=>t?.constructor.name==="Array",Xx=(t,e)=>{if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Ss(t[n],e[n]))return!1;return!0},Ss=(t,e)=>{if(Object.is(t,e))return!0;if(t==null&&e!=null||t!=null&&e==null)return!1;if(typeof t?.isEqual=="function"&&typeof e?.isEqual=="function")return t.isEqual(e);if(typeof t=="function"&&typeof e=="function")return t.toString()===e.toString();if(Hh(t)&&Hh(e))return Xx(Array.from(t),Array.from(e));if(typeof t!="object"||typeof e!="object")return!1;const n=Object.keys(e??Object.create(null)),r=n.length;for(let i=0;i<r;i++)if(!Reflect.has(t,n[i]))return!1;for(let i=0;i<r;i++){const o=n[i];if(!Ss(t[o],e[o]))return!1}return!0},qh=(...t)=>(...e)=>{t.forEach(function(n){n?.(...e)})},Yx=t=>Array.isArray(t),bv=t=>typeof t=="string",Ni=t=>typeof t=="function",Zx=Function.prototype.toString;Zx.call(Object);var{floor:Wh,abs:qa,round:kv,min:Qx,max:e1,pow:t1,sign:n1}=Math,So=t=>Number.isNaN(t),bp=t=>So(t)?0:t,r1=(t,e,n)=>t===0?n:e[t-1],i1=(t,e,n)=>t===e.length-1?n:e[t+1],o1=(t,e,n)=>kv((bp(t)-e)/n)*n+e,Ql=(t,e,n)=>Qx(e1(bp(t),e),n),kp=(t,e,n)=>(bp(t)-e)/(n-e),wv=(t,e,n,r)=>Ql(o1(t*(n-e)+e,e,r),e,n),Ys=(t,e)=>{let n=t,r=e.toString(),i=r.indexOf("."),o=i>=0?r.length-i:0;if(o>0){let s=t1(10,o);n=kv(n*s)/s}return n},xv=(t,e,n,r)=>{e=Number(e),n=Number(n);let i=(t-(So(e)?0:e))%r,o=Ys(qa(i)*2>=r?t+n1(i)*(r-qa(i)):t-i,r);return So(e)?!So(n)&&o>n&&(o=e+Wh(Ys((n-e)/r,r))*r):o<e?o=e:!So(n)&&o>n&&(o=e+Wh(Ys((n-e)/r,r))*r),Ys(o,r)},To=(t,e,n)=>t[e]===n?t:[...t.slice(0,e),n,...t.slice(e+1)];function Ev(t,e){const n=r1(t,e.values,e.min),r=i1(t,e.values,e.max);let i=e.values.slice();return function(o){let s=xv(o,n,r,e.step);return i=To(i,t,o),i[t]=s,i}}function s1(t,e){const n=e.values[t]+e.step;return Ev(t,e)(n)}function a1(t,e){const n=e.values[t]-e.step;return Ev(t,e)(n)}var l1=(t,e)=>{let n=t.findIndex(o=>e-o<0);if(n===0)return n;if(n===-1)return t.length-1;let r=t[n-1],i=t[n];return qa(r-e)<qa(i-e)?n-1:n},u1=(t,e,n,r)=>t.map((i,o)=>({min:o===0?e:t[o-1]+r,max:o===t.length-1?n:t[o+1]-r,value:i})),Uc=(t,e)=>{const[n,r]=t,[i,o]=e;return s=>n===r||i===o?i:i+(o-i)/(r-n)*(s-n)};function Cv(t){if(!c1(t)||t===void 0)return t;const e=Reflect.ownKeys(t).filter(r=>typeof r=="string"),n={};for(const r of e){const i=t[r];i!==void 0&&(n[r]=Cv(i))}return n}var c1=t=>t&&typeof t=="object"&&t.constructor===Object;function Kc(...t){t.length===1?t[0]:t[1],t.length!==2||t[0]}function d1(t,e){if(t==null)throw new Error(e)}function p1(t,e,n){let r=[];for(const i of e)t[i]==null&&r.push(i);if(r.length>0)throw new Error(`[zag-js] missing required props: ${r.join(", ")}`)}function eu(){return{and:(...t)=>function(e){return t.every(n=>e.guard(n))},or:(...t)=>function(e){return t.some(n=>e.guard(n))},not:t=>function(e){return!e.guard(t)}}}function h1(t){const e=()=>{var o;return((o=t.getRootNode)==null?void 0:o.call(t))??document},n=()=>Kt(e()),r=()=>n().defaultView??window,i=()=>tv(e());return{...t,getRootNode:e,getDoc:n,getWin:r,getActiveElement:i,isActiveElement:o=>o===i(),getById:o=>e().getElementById(o)}}function f1(t){return new Proxy({},{get(e,n){return n==="style"?r=>t({style:r}).style:t}})}var Wn=()=>t=>Array.from(new Set(t)),m1=Ln("checkbox").parts("root","label","control","indicator"),Zs=m1.build(),Sv=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`checkbox:${t.id}`},Uh=t=>{var e;return((e=t.ids)==null?void 0:e.label)??`checkbox:${t.id}:label`},g1=t=>{var e;return((e=t.ids)==null?void 0:e.control)??`checkbox:${t.id}:control`},Gc=t=>{var e;return((e=t.ids)==null?void 0:e.hiddenInput)??`checkbox:${t.id}:input`},v1=t=>t.getById(Sv(t)),Oo=t=>t.getById(Gc(t));function y1(t,e){const{send:n,context:r,prop:i,computed:o,scope:s}=t,a=i("disabled"),l=i("readOnly"),u=!a&&r.get("focused"),c=!a&&r.get("focusVisible"),d=o("checked"),h=o("indeterminate"),p={"data-active":G(r.get("active")),"data-focus":G(u),"data-focus-visible":G(c),"data-readonly":G(l),"data-hover":G(r.get("hovered")),"data-disabled":G(a),"data-state":h?"indeterminate":d?"checked":"unchecked","data-invalid":i("invalid")};return{checked:d,disabled:a,indeterminate:h,focused:u,checkedState:d,setChecked(f){n({type:"CHECKED.SET",checked:f,isTrusted:!1})},toggleChecked(){n({type:"CHECKED.TOGGLE",checked:d,isTrusted:!1})},getRootProps(){return e.label({...Zs.root.attrs,...p,dir:i("dir"),id:Sv(s),htmlFor:Gc(s),onPointerMove(){a||n({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){a||n({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(f){ct(f)===Oo(s)&&f.stopPropagation()}})},getLabelProps(){return e.element({...Zs.label.attrs,...p,dir:i("dir"),id:Uh(s)})},getControlProps(){return e.element({...Zs.control.attrs,...p,dir:i("dir"),id:g1(s),"aria-hidden":!0})},getIndicatorProps(){return e.element({...Zs.indicator.attrs,...p,dir:i("dir"),hidden:!h&&!d})},getHiddenInputProps(){return e.input({id:Gc(s),type:"checkbox",required:i("required"),defaultChecked:d,disabled:a,"aria-labelledby":Uh(s),"aria-invalid":i("invalid"),name:i("name"),form:i("form"),value:i("value"),style:vp,onFocus(){const f=is();n({type:"CONTEXT.SET",context:{focused:!0,focusVisible:f}})},onBlur(){n({type:"CONTEXT.SET",context:{focused:!1,focusVisible:!1}})},onClick(f){if(l){f.preventDefault();return}const m=f.currentTarget.checked;n({type:"CHECKED.SET",checked:m,isTrusted:!0})}})}}}var{not:Kh}=eu(),b1={props({props:t}){return{value:"on",...t,defaultChecked:!!t.defaultChecked}},initialState(){return"ready"},context({prop:t,bindable:e}){return{checked:e(()=>({defaultValue:t("defaultChecked"),value:t("checked"),onChange(n){var r;(r=t("onCheckedChange"))==null||r({checked:n})}})),fieldsetDisabled:e(()=>({defaultValue:!1})),focusVisible:e(()=>({defaultValue:!1})),active:e(()=>({defaultValue:!1})),focused:e(()=>({defaultValue:!1})),hovered:e(()=>({defaultValue:!1}))}},watch({track:t,context:e,prop:n,action:r}){t([()=>n("disabled")],()=>{r(["removeFocusIfNeeded"])}),t([()=>e.get("checked")],()=>{r(["syncInputElement"])})},effects:["trackFormControlState","trackPressEvent","trackFocusVisible"],on:{"CHECKED.TOGGLE":[{guard:Kh("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:Kh("isTrusted"),actions:["setChecked","dispatchChangeEvent"]},{actions:["setChecked"]}],"CONTEXT.SET":{actions:["setContext"]}},computed:{indeterminate:({context:t})=>Ca(t.get("checked")),checked:({context:t})=>k1(t.get("checked")),disabled:({context:t,prop:e})=>!!e("disabled")||t.get("fieldsetDisabled")},states:{ready:{}},implementations:{guards:{isTrusted:({event:t})=>!!t.isTrusted},effects:{trackPressEvent({context:t,computed:e,scope:n}){if(!e("disabled"))return dv({pointerNode:v1(n),keyboardNode:Oo(n),isValidKey:r=>r.key===" ",onPress:()=>t.set("active",!1),onPressStart:()=>t.set("active",!0),onPressEnd:()=>t.set("active",!1)})},trackFocusVisible({computed:t,scope:e}){var n;if(!t("disabled"))return yp({root:(n=e.getRootNode)==null?void 0:n.call(e)})},trackFormControlState({context:t,scope:e}){return Yl(Oo(e),{onFieldsetDisabledChange(n){t.set("fieldsetDisabled",n)},onFormReset(){t.set("checked",t.initial("checked"))}})}},actions:{setContext({context:t,event:e}){for(const n in e.context)t.set(n,e.context[n])},syncInputElement({context:t,computed:e,scope:n}){const r=Oo(n);r&&(hp(r,e("checked")),r.indeterminate=Ca(t.get("checked")))},removeFocusIfNeeded({context:t,prop:e}){e("disabled")&&t.get("focused")&&(t.set("focused",!1),t.set("focusVisible",!1))},setChecked({context:t,event:e}){t.set("checked",e.checked)},toggleChecked({context:t,computed:e}){const n=Ca(e("checked"))?!0:!e("checked");t.set("checked",n)},dispatchChangeEvent({computed:t,scope:e}){queueMicrotask(()=>{const n=Oo(e);fp(n,{checked:t("checked")})})}}}};function Ca(t){return t==="indeterminate"}function k1(t){return Ca(t)?!1:!!t}Wn()(["defaultChecked","checked","dir","disabled","form","getRootNode","id","ids","invalid","name","onCheckedChange","readOnly","required","value"]);function w1(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()}var Gh={htmlFor:"for",className:"class",onDoubleClick:"onDblclick",onChange:"onInput",onFocus:"onFocusin",onBlur:"onFocusout",defaultValue:"value",defaultChecked:"checked"},x1="viewBox,className,preserveAspectRatio,fillRule,clipPath,clipRule,strokeWidth,strokeLinecap,strokeLinejoin,strokeDasharray,strokeDashoffset,strokeMiterlimit".split(",");function E1(t){return t in Gh?Gh[t]:t.startsWith("on")?`on${w1(t.substr(2))}`:x1.includes(t)?t:t.toLowerCase()}var di=f1(t=>{const e={};for(const n in t){const r=t[n];n==="children"?typeof r=="string"&&(e.innerHTML=r):e[E1(n)]=t[n]}return e});function Jh(t){const e=t().defaultValue??t().value,n=t().isEqual??Ss,r=qt(e),i=N(()=>t().value!==void 0),o=qt(i.value?t().value:r.value);return{initial:e,ref:o,get(){return i.value?t().value:r.value},set(s){var a,l;const u=i.value?t().value:r.value,c=Ni(s)?s(u):s;t().debug&&console.log(`[bindable > ${t().debug}] setValue`,{next:c,prev:u}),i.value||(r.value=c),n(c,u)||(l=(a=t()).onChange)==null||l.call(a,c,u)},invoke(s,a){var l,u;(u=(l=t()).onChange)==null||u.call(l,s,a)},hash(s){var a,l;return((l=(a=t()).hash)==null?void 0:l.call(a,s))??String(s)}}}function C1(t){const e=X(t);return{get(n){return e.value[n]},set(n,r){e.value[n]=r}}}var S1=(t,e)=>{Ee(()=>[...t.map(n=>n())],(n,r)=>{let i=!1;for(let o=0;o<n.length;o++)if(!Ss(r[o],He(n[o]))){i=!0;break}i&&e()})};function pi(t,e={}){var n,r,i;const o=N(()=>{const{id:C,ids:_,getRootNode:L}=He(e);return h1({id:C,ids:_,getRootNode:L})}),s=(...C)=>{t.debug&&console.log(...C)},a=N(()=>{var C;return((C=t.props)==null?void 0:C.call(t,{props:Cv(He(e)),get scope(){return o.value}}))??He(e)}),l=T1(a),u=((n=t.context)==null?void 0:n.call(t,{prop:l,bindable:Jh,get scope(){return o.value},flush:Xh,getContext(){return c},getComputed(){return T}}))??{},c={get(C){var _;return(_=u[C])==null?void 0:_.get()},set(C,_){var L;(L=u[C])==null||L.set(_)},initial(C){var _;return(_=u[C])==null?void 0:_.initial},hash(C){var _,L;const W=(_=u[C])==null?void 0:_.get();return(L=u[C])==null?void 0:L.hash(W)}};let d=new Map,h=null,p={current:null},f={current:{type:"__init__"}};const m=()=>({...f.current,current(){return f.current},previous(){return p.current}}),g=()=>({...F,matches(...C){const _=F.get();return C.includes(_)},hasTag(C){var _,L;const W=F.get();return!!((L=(_=t.states[W])==null?void 0:_.tags)!=null&&L.includes(C))}}),y=C1(((r=t.refs)==null?void 0:r.call(t,{prop:l,context:c}))??{}),b=()=>({state:g(),context:c,event:m(),prop:l,send:D,action:k,guard:v,track:S1,refs:y,computed:T,flush:Xh,get scope(){return o.value},choose:x}),k=C=>{const _=Ni(C)?C(b()):C;if(!_)return;const L=_.map(W=>{var q,K;const J=(K=(q=t.implementations)==null?void 0:q.actions)==null?void 0:K[W];return J||Kc(`[zag-js] No implementation found for action "${JSON.stringify(W)}"`),J});for(const W of L)W?.(b())},v=C=>{var _,L;return Ni(C)?C(b()):(L=(_=t.implementations)==null?void 0:_.guards)==null?void 0:L[C](b())},w=C=>{const _=Ni(C)?C(b()):C;if(!_)return;const L=_.map(q=>{var K,J;const ue=(J=(K=t.implementations)==null?void 0:K.effects)==null?void 0:J[q];return ue||Kc(`[zag-js] No implementation found for effect "${JSON.stringify(q)}"`),ue}),W=[];for(const q of L){const K=q?.(b());K&&W.push(K)}return()=>W.forEach(q=>q?.())},x=C=>Wx(C).find(_=>{let L=!_.guard;return bv(_.guard)?L=!!v(_.guard):Ni(_.guard)&&(L=_.guard(b())),L}),T=C=>{d1(t.computed,"[zag-js] No computed object found on machine");const _=t.computed[C];return _({context:c,event:m(),prop:l,refs:y,get scope(){return o.value},computed:T})},F=Jh(()=>({defaultValue:t.initialState({prop:l}),onChange(C,_){var L,W,q;if(_){const J=d.get(_);J?.(),d.delete(_)}_&&k((L=t.states[_])==null?void 0:L.exit),k(h?.actions);const K=w((W=t.states[C])==null?void 0:W.effects);if(K&&d.set(C,K),_==="__init__"){k(t.entry);const J=w(t.effects);J&&d.set("__init__",J)}k((q=t.states[C])==null?void 0:q.entry)}}));qn(()=>{F.invoke(F.initial,"__init__")}),ao(()=>{const C=d.values();for(const _ of C)_?.();d=new Map,k(t.exit)});const D=C=>{var _,L;p.current=f.current,f.current=C,s("send",C);let W=F.get();const q=((_=t.states[W].on)==null?void 0:_[C.type])??((L=t.on)==null?void 0:L[C.type]),K=x(q);if(!K)return;h=K;const J=K.target??W;s("transition",K),J!==W?F.set(J):k(K.actions)};return(i=t.watch)==null||i.call(t,b()),{state:g(),send:D,context:c,prop:l,get scope(){return o.value},refs:y,computed:T,event:m()}}function T1(t){return function(e){return t.value[e]}}var Xh=t=>{kr().then(()=>{t()})};function Qt(t={}){const{prefix:e}=t,n=Mw();return e?`${e}-${n}`:n}const O1={key:0,class:"k-checkbox__help"},Yh=te({__name:"Checkbox",props:{modelValue:{type:[Boolean,Array]},value:{},label:{},disabled:{type:Boolean},required:{type:Boolean},help:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t;if(n.modelValue instanceof Array&&!n.value)throw new Error("props.value is required if props.modelValue is an array");const r=e,i=()=>{const{modelValue:l,value:u}=n;return l instanceof Array?l.some(c=>Co(c)===Co(u)):!!l};function o(l){const{modelValue:u,value:c}=n;if(!(u instanceof Array))return r("update:modelValue",typeof l=="boolean"?l:void 0);if(!(typeof l!="boolean"||!c))return l?r("update:modelValue",[...u,c]):r("update:modelValue",u.filter(d=>Co(d)!==Co(c)))}const s=pi(b1,{id:Qt(),defaultChecked:i(),onCheckedChange:({checked:l})=>{if(i()!==l)return o(l)},disabled:n.disabled,required:n.required}),a=N(()=>y1(s,di));return Ee(()=>n.modelValue,()=>{const l=i();if(a.value.checked!==l)return a.value.setChecked(l)}),(l,u)=>(E(),O("label",ne({class:"k-checkbox"},a.value.getRootProps()),[H("div",be(Ne(a.value.getControlProps())),[a.value.checked?(E(),B($(Ze),{key:0,icon:"fa-pro-solid:check"})):I("",!0)],16),l.label||l.$slots.help||l.$slots.default?(E(),O("span",be(ne({key:0},a.value.getLabelProps())),[H("span",{class:Ce(["k-checkbox__label",{"k-checkbox__label-required":l.required}])},[P(l.$slots,"default",{},()=>[$e(se(l.label),1)])],2),l.$slots.help||l.help?(E(),O("span",O1,[P(l.$slots,"help",{},()=>[$e(se(l.help),1)])])):I("",!0)],16)):I("",!0),H("input",be(Ne(a.value.getHiddenInputProps())),null,16)],16))}}),wp=Symbol("form-control"),A1={class:"k-formcontrol"},M1=["for"],_1={key:1,class:"k-formcontrol__error"},D1={key:2,class:"k-formcontrol__help"},N1=te({__name:"FormControl",props:{label:{},help:{},error:{},required:{type:Boolean}},emits:["blur","focus"],setup(t,{emit:e}){const n=t,r=e,i=Qt({prefix:"k-formcontrol"}),o=N(()=>`${i}_label`),s=N(()=>`${i}_help`),a={onBlur:()=>r("blur"),onFocus:()=>r("focus")};return yk(wp,N(()=>({...n,id:i,labelId:o.value,helpId:s.value,invalid:!!n.error,required:n.required,events:a}))),(l,u)=>(E(),O("div",A1,[l.$slots.label||l.label?(E(),O("label",{key:0,class:Ce(["k-formcontrol__label",{"k-formcontrol__label-required":l.required}]),for:$(i)},[P(l.$slots,"label",{},()=>[$e(se(l.label),1)])],10,M1)):I("",!0),P(l.$slots,"default",{id:$(i)}),l.$slots.error||l.error?(E(),O("span",_1,[P(l.$slots,"error",{},()=>[$e(se(l.error),1)])])):I("",!0),l.$slots.help||l.help?(E(),O("span",D1,[P(l.$slots,"help",{},()=>[$e(se(l.help),1)])])):I("",!0)]))}}),I1={class:"k-filter-type-dropdown"},R1=te({__name:"Dropdown",props:Fc({label:{},items:{}},{modelValue:{default:""},modelModifiers:{}}),emits:Fc(["disable"],["update:modelValue"]),setup(t,{emit:e}){const n=t,r=Ig(t,"modelValue"),i=N(()=>{var a,l;return`${(r.value?[r.value]:[(l=(a=n.items)==null?void 0:a[0])==null?void 0:l.value]).map(u=>{var c;return(c=n.items.find(d=>d.value===u))==null?void 0:c.label}).join(", ")}`}),o=N(()=>n.items.map(a=>({...a,action:()=>s.value=a.value}))),s=N({get(){return r.value},set(a){r.value=a}});return(a,l)=>(E(),O("div",I1,[he($(N1),{label:a.label},{default:Z(()=>[he($(du),{placement:"bottom-start",label:i.value,modelValue:s.value,"onUpdate:modelValue":l[0]||(l[0]=u=>s.value=u),items:o.value},null,8,["label","modelValue","items"])]),_:1},8,["label"])]))}}),P1=Object.freeze(Object.defineProperty({__proto__:null,default:R1},Symbol.toStringTag,{value:"Module"}));function F1(t,e){let n,r,i;const o=qt(!0),s=()=>{o.value=!0,i()};Ee(t,s,{flush:"sync"});const a=typeof e=="function"?e:e.get,l=typeof e=="function"?void 0:e.set,u=Qd((c,d)=>(r=c,i=d,{get(){return o.value&&(n=a(n),o.value=!1),r(),n},set(h){l?.(h)}}));return Object.isExtensible(u)&&(u.trigger=s),u}function Ts(t){return mk()?(gk(t),!0):!1}const Os=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const L1=t=>t!=null,V1=Object.prototype.toString,Tv=t=>V1.call(t)==="[object Object]",B1=()=>{},Zh=$1();function $1(){var t,e;return Os&&((t=window?.navigator)==null?void 0:t.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((e=window?.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function j1(...t){if(t.length!==1)return fk(...t);const e=t[0];return typeof e=="function"?Zd(Qd(()=>({get:e,set:B1}))):X(e)}function z1(t){let e;function n(){return e||(e=t()),e}return n.reset=async()=>{const r=e;e=void 0,r&&await r},n}function Gr(t){return Array.isArray(t)?t:[t]}function H1(t,e,n={}){const{immediate:r=!0,immediateCallback:i=!1}=n,o=qt(!1);let s=null;function a(){s&&(clearTimeout(s),s=null)}function l(){o.value=!1,a()}function u(...c){i&&t(),a(),o.value=!0,s=setTimeout(()=>{o.value=!1,s=null,t(...c)},He(e))}return r&&(o.value=!0,Os&&u()),Ts(l),{isPending:Zd(o),start:u,stop:l}}function Ov(t,e,n){return Ee(t,e,{...n,immediate:!0})}const Av=Os?window:void 0,Mv=Os?window.navigator:void 0;function _v(t){var e;const n=He(t);return(e=n?.$el)!=null?e:n}function xp(...t){const e=[],n=()=>{e.forEach(a=>a()),e.length=0},r=(a,l,u,c)=>(a.addEventListener(l,u,c),()=>a.removeEventListener(l,u,c)),i=N(()=>{const a=Gr(He(t[0])).filter(l=>l!=null);return a.every(l=>typeof l!="string")?a:void 0}),o=Ov(()=>{var a,l;return[(l=(a=i.value)==null?void 0:a.map(u=>_v(u)))!=null?l:[Av].filter(u=>u!=null),Gr(He(i.value?t[1]:t[0])),Gr($(i.value?t[2]:t[1])),He(i.value?t[3]:t[2])]},([a,l,u,c])=>{if(n(),!(a!=null&&a.length)||!(l!=null&&l.length)||!(u!=null&&u.length))return;const d=Tv(c)?{...c}:c;e.push(...a.flatMap(h=>l.flatMap(p=>u.map(f=>r(h,p,f,d)))))},{flush:"post"}),s=()=>{o(),n()};return Ts(n),s}function q1(){const t=qt(!1),e=tp();return e&&qn(()=>{t.value=!0},e),t}function Ep(t){const e=q1();return N(()=>(e.value,!!t()))}function W1(t,e,n={}){const{window:r=Av,...i}=n;let o;const s=Ep(()=>r&&"MutationObserver"in r),a=()=>{o&&(o.disconnect(),o=void 0)},l=N(()=>{const h=He(t),p=Gr(h).map(_v).filter(L1);return new Set(p)}),u=Ee(()=>l.value,h=>{a(),s.value&&h.size&&(o=new MutationObserver(e),h.forEach(p=>o.observe(p,i)))},{immediate:!0,flush:"post"}),c=()=>o?.takeRecords(),d=()=>{u(),a()};return Ts(d),{isSupported:s,stop:d,takeRecords:c}}function Qh(t,e={}){const{controls:n=!1,navigator:r=Mv}=e,i=Ep(()=>r&&"permissions"in r),o=qt(),s=typeof t=="string"?{name:t}:t,a=qt(),l=()=>{var c,d;a.value=(d=(c=o.value)==null?void 0:c.state)!=null?d:"prompt"};xp(o,"change",l,{passive:!0});const u=z1(async()=>{if(i.value){if(!o.value)try{o.value=await r.permissions.query(s)}catch{o.value=void 0}finally{l()}if(n)return Co(o.value)}});return u(),n?{state:a,isSupported:i,query:u}:a}function U1(t={}){const{navigator:e=Mv,read:n=!1,source:r,copiedDuring:i=1500,legacy:o=!1}=t,s=Ep(()=>e&&"clipboard"in e),a=Qh("clipboard-read"),l=Qh("clipboard-write"),u=N(()=>s.value||o),c=qt(""),d=qt(!1),h=H1(()=>d.value=!1,i,{immediate:!1});async function p(){let b=!(s.value&&y(a.value));if(!b)try{c.value=await e.clipboard.readText()}catch{b=!0}b&&(c.value=g())}u.value&&n&&xp(["copy","cut"],p,{passive:!0});async function f(b=He(r)){if(u.value&&b!=null){let k=!(s.value&&y(l.value));if(!k)try{await e.clipboard.writeText(b)}catch{k=!0}k&&m(b),c.value=b,d.value=!0,h.start()}}function m(b){const k=document.createElement("textarea");k.value=b??"",k.style.position="absolute",k.style.opacity="0",document.body.appendChild(k),k.select(),document.execCommand("copy"),k.remove()}function g(){var b,k,v;return(v=(k=(b=document?.getSelection)==null?void 0:b.call(document))==null?void 0:k.toString())!=null?v:""}function y(b){return b==="granted"||b==="prompt"}return{isSupported:u,text:c,copied:d,copy:f}}function tu(t){const e=tp(),n=F1(()=>null,()=>e.proxy.$el);return vk(n.trigger),qn(n.trigger),n}const K1={class:"k-filter-type-range"},G1={class:"k-filter-type-range__header"},J1={class:"k-filter-type-range__header-label"},X1={class:"k-filter-type-range__value"},Y1={class:"k-filter-type-range__value-display"},Z1=te({__name:"RangeSlider",props:Fc({min:{},max:{},label:{},suffix:{},step:{},type:{}},{modelValue:{default:[0,1e3]},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const e=Ig(t,"modelValue"),n=tu();function r(){return!n.value||!("getRootNode"in n.value)?document:n.value.getRootNode()}const i=t;function o(s){return[s,i.suffix].filter(Boolean).join(" ")}return(s,a)=>(E(),O("div",K1,[H("div",G1,[H("label",J1,[H("span",null,se(s.label),1),he($(Ze),{icon:s.$attrs.icon},null,8,["icon"])]),P(s.$slots,"remove")]),H("div",X1,[he($(lC),ne({modelValue:e.value,"onUpdate:modelValue":a[0]||(a[0]=l=>e.value=l)},i,{"min-steps-between-thumbs":1,"get-root-node":r}),null,16,["modelValue"]),H("div",Y1,[H("span",null,se(o(e.value[0])),1),H("span",null,se(o(e.value[1])),1)])])]))}}),Q1=Object.freeze(Object.defineProperty({__proto__:null,default:Z1},Symbol.toStringTag,{value:"Module"})),ef=Object.assign({"./Dropdown.vue":P1,"./RangeSlider.vue":Q1});for(const t in ef)t.replace(/(\.\/|\.vue)/g,""),ef[t].default;function pr(t){return typeof t=="string"||t instanceof String}function tf(t){var e;return typeof t=="object"&&t!=null&&(t==null||(e=t.constructor)==null?void 0:e.name)==="Object"}function Dv(t,e){return Array.isArray(e)?Dv(t,(n,r)=>e.includes(r)):Object.entries(t).reduce((n,r)=>{let[i,o]=r;return e(o,i)&&(n[i]=o),n},{})}const U={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function eE(t){switch(t){case U.LEFT:return U.FORCE_LEFT;case U.RIGHT:return U.FORCE_RIGHT;default:return t}}function ju(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function Wa(t,e){if(e===t)return!0;const n=Array.isArray(e),r=Array.isArray(t);let i;if(n&&r){if(e.length!=t.length)return!1;for(i=0;i<e.length;i++)if(!Wa(e[i],t[i]))return!1;return!0}if(n!=r)return!1;if(e&&t&&typeof e=="object"&&typeof t=="object"){const o=e instanceof Date,s=t instanceof Date;if(o&&s)return e.getTime()==t.getTime();if(o!=s)return!1;const a=e instanceof RegExp,l=t instanceof RegExp;if(a&&l)return e.toString()==t.toString();if(a!=l)return!1;const u=Object.keys(e);for(i=0;i<u.length;i++)if(!Object.prototype.hasOwnProperty.call(t,u[i]))return!1;for(i=0;i<u.length;i++)if(!Wa(t[u[i]],e[u[i]]))return!1;return!0}else if(e&&t&&typeof e=="function"&&typeof t=="function")return e.toString()===t.toString();return!1}class tE{constructor(e){for(Object.assign(this,e);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?U.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?U.RIGHT:U.LEFT}}function ie(t,e){return new ie.InputMask(t,e)}function Nv(t){if(t==null)throw new Error("mask property should be defined");return t instanceof RegExp?ie.MaskedRegExp:pr(t)?ie.MaskedPattern:t===Date?ie.MaskedDate:t===Number?ie.MaskedNumber:Array.isArray(t)||t===Array?ie.MaskedDynamic:ie.Masked&&t.prototype instanceof ie.Masked?t:ie.Masked&&t instanceof ie.Masked?t.constructor:t instanceof Function?ie.MaskedFunction:(console.warn("Mask not found for mask",t),ie.Masked)}function ss(t){if(!t)throw new Error("Options in not defined");if(ie.Masked){if(t.prototype instanceof ie.Masked)return{mask:t};const{mask:e=void 0,...n}=t instanceof ie.Masked?{mask:t}:tf(t)&&t.mask instanceof ie.Masked?t:{};if(e){const r=e.mask;return{...Dv(e,(i,o)=>!o.startsWith("_")),mask:e.constructor,_mask:r,...n}}}return tf(t)?{...t}:{mask:t}}function $n(t){if(ie.Masked&&t instanceof ie.Masked)return t;const e=ss(t),n=Nv(e.mask);if(!n)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===n&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new n(e)}ie.createMask=$n;class Cp{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return e??this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return e??this.value.length}select(e,n){if(!(e==null||n==null||e===this.selectionStart&&n===this.selectionEnd))try{this._unsafeSelect(e,n)}catch{}}get isActive(){return!1}}ie.MaskElement=Cp;const nf=90,nE=89;class nu extends Cp{constructor(e){super(),this.input=e,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var e,n,r;return(e=(n=(r=this.input).getRootNode)==null?void 0:n.call(r))!=null?e:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){if(this._handlers.redo&&(e.keyCode===nf&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===nE&&e.ctrlKey))return e.preventDefault(),this._handlers.redo(e);if(this._handlers.undo&&e.keyCode===nf&&(e.metaKey||e.ctrlKey))return e.preventDefault(),this._handlers.undo(e);e.isComposing||this._handlers.selectionChange(e)}_onBeforeinput(e){if(e.inputType==="historyUndo"&&this._handlers.undo)return e.preventDefault(),this._handlers.undo(e);if(e.inputType==="historyRedo"&&this._handlers.redo)return e.preventDefault(),this._handlers.redo(e)}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}ie.HTMLMaskElement=nu;class rE extends nu{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,n){this.input.setSelectionRange(e,n)}get value(){return this.input.value}set value(e){this.input.value=e}}ie.HTMLMaskElement=nu;class Iv extends nu{get _unsafeSelectionStart(){const e=this.rootElement,n=e.getSelection&&e.getSelection(),r=n&&n.anchorOffset,i=n&&n.focusOffset;return i==null||r==null||r<i?r:i}get _unsafeSelectionEnd(){const e=this.rootElement,n=e.getSelection&&e.getSelection(),r=n&&n.anchorOffset,i=n&&n.focusOffset;return i==null||r==null||r>i?r:i}_unsafeSelect(e,n){if(!this.rootElement.createRange)return;const r=this.rootElement.createRange();r.setStart(this.input.firstChild||this.input,e),r.setEnd(this.input.lastChild||this.input,n);const i=this.rootElement,o=i.getSelection&&i.getSelection();o&&(o.removeAllRanges(),o.addRange(r))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}ie.HTMLContenteditableMaskElement=Iv;class ru{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(e){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(e),this.states.length>ru.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}ru.MAX_LENGTH=100;class iE{constructor(e,n){this.el=e instanceof Cp?e:e.isContentEditable&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"?new Iv(e):new rE(e),this.masked=$n(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new ru,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(e){var n;return e==null||((n=this.masked)==null?void 0:n.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof ie.Masked)&&this.masked.constructor===Nv(e)){this.masked.updateOptions({mask:e});return}const n=e instanceof ie.Masked?e:$n({mask:e});n.unmaskedValue=this.masked.unmaskedValue,this.masked=n}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(e,n){const r=this._listeners[e];r&&r.forEach(i=>i(n))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){!this.el||!this.el.isActive||(this.el.select(e,e),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(e){const n=this.masked.unmaskedValue,r=this.masked.value,i=this.masked.rawInputValue,o=this.displayValue,s=this.unmaskedValue!==n||this.value!==r||this._rawInputValue!==i;this._unmaskedValue=n,this._value=r,this._rawInputValue=i,this.el.value!==o&&(this.el.value=o),e==="auto"?this.alignCursor():e!=null&&(this.cursorPos=e),s&&this._fireChangeEvents(),!this._historyChanging&&(s||this.history.isEmpty)&&this.history.push({unmaskedValue:n,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:n,...r}=e,i=!this.maskEquals(n),o=this.masked.optionsIsChanged(r);i&&(this.mask=n),o&&this.masked.updateOptions(r),(i||o)&&this.updateControl()}updateCursor(e){e!=null&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,U.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,n){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(n),this}off(e,n){if(!this._listeners[e])return this;if(!n)return delete this._listeners[e],this;const r=this._listeners[e].indexOf(n);return r>=0&&this._listeners[e].splice(r,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const n=new tE({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),r=this.masked.rawInputValue,i=this.masked.splice(n.startChangePos,n.removed.length,n.inserted,n.removeDirection,{input:!0,raw:!0}).offset,o=r===this.masked.rawInputValue?n.removeDirection:U.NONE;let s=this.masked.nearestInputPos(n.startChangePos+i,o);o!==U.NONE&&(s=this.masked.nearestInputPos(s,U.NONE)),this.updateControl(s),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}ie.InputMask=iE;class de{static normalize(e){return Array.isArray(e)?e:[e,new de]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},e)}aggregate(e){return this.inserted+=e.inserted,this.rawInserted+=e.rawInserted,this.tailShift+=e.tailShift,this.skip=this.skip||e.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(e){return this.inserted===e.inserted&&this.tailShift===e.tailShift&&this.rawInserted===e.rawInserted&&this.skip===e.skip}}ie.ChangeDetails=de;class fn{constructor(e,n,r){e===void 0&&(e=""),n===void 0&&(n=0),this.value=e,this.from=n,this.stop=r}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||e!=null&&this.from>=e)return"";const n=this.value[0];return this.value=this.value.slice(1),n}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class it{constructor(e){this._value="",this._update({...it.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,n){n===void 0&&(n={input:!0}),this.reset(),this.append(e,n,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,n){return e}totalInputPositions(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),Math.min(this.displayValue.length,n-e)}extractInput(e,n,r){return e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),this.displayValue.slice(e,n)}extractTail(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),new fn(this.extractInput(e,n),e)}appendTail(e){return pr(e)&&(e=new fn(String(e))),e.appendTo(this)}_appendCharRaw(e,n){return e?(this._value+=e,new de({inserted:e,rawInserted:e})):new de}_appendChar(e,n,r){n===void 0&&(n={});const i=this.state;let o;if([e,o]=this.doPrepareChar(e,n),e&&(o=o.aggregate(this._appendCharRaw(e,n)),!o.rawInserted&&this.autofix==="pad")){const s=this.state;this.state=i;let a=this.pad(n);const l=this._appendCharRaw(e,n);a=a.aggregate(l),l.rawInserted||a.equals(o)?o=a:this.state=s}if(o.inserted){let s,a=this.doValidate(n)!==!1;if(a&&r!=null){const l=this.state;if(this.overwrite===!0){s=r.state;for(let c=0;c<o.rawInserted.length;++c)r.unshift(this.displayValue.length-o.tailShift)}let u=this.appendTail(r);if(a=u.rawInserted.length===r.toString().length,!(a&&u.inserted)&&this.overwrite==="shift"){this.state=l,s=r.state;for(let c=0;c<o.rawInserted.length;++c)r.shift();u=this.appendTail(r),a=u.rawInserted.length===r.toString().length}a&&u.inserted&&(this.state=l)}a||(o=new de,this.state=i,r&&s&&(r.state=s))}return o}_appendPlaceholder(){return new de}_appendEager(){return new de}append(e,n,r){if(!pr(e))throw new Error("value should be string");const i=pr(r)?new fn(String(r)):r;n!=null&&n.tail&&(n._beforeTailState=this.state);let o;[e,o]=this.doPrepare(e,n);for(let s=0;s<e.length;++s){const a=this._appendChar(e[s],n,i);if(!a.rawInserted&&!this.doSkipInvalid(e[s],n,i))break;o.aggregate(a)}return(this.eager===!0||this.eager==="append")&&n!=null&&n.input&&e&&o.aggregate(this._appendEager()),i!=null&&(o.tailShift+=this.appendTail(i).tailShift),o}remove(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),this._value=this.displayValue.slice(0,e)+this.displayValue.slice(n),new de}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const n=this.rawInputValue,r=this.value,i=e();return this.rawInputValue=n,this.value&&this.value!==r&&r.indexOf(this.value)===0&&(this.append(r.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,i}runIsolated(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const n=this.state,r=e(this);return this.state=n,delete this._isolated,r}doSkipInvalid(e,n,r){return!!this.skipInvalid}doPrepare(e,n){return n===void 0&&(n={}),de.normalize(this.prepare?this.prepare(e,this,n):e)}doPrepareChar(e,n){return n===void 0&&(n={}),de.normalize(this.prepareChar?this.prepareChar(e,this,n):e)}doValidate(e){return(!this.validate||this.validate(this.value,this,e))&&(!this.parent||this.parent.doValidate(e))}doCommit(){this.commit&&this.commit(this.value,this)}splice(e,n,r,i,o){r===void 0&&(r=""),i===void 0&&(i=U.NONE),o===void 0&&(o={input:!0});const s=e+n,a=this.extractTail(s),l=this.eager===!0||this.eager==="remove";let u;l&&(i=eE(i),u=this.extractInput(0,s,{raw:!0}));let c=e;const d=new de;if(i!==U.NONE&&(c=this.nearestInputPos(e,n>1&&e!==0&&!l?U.NONE:i),d.tailShift=c-e),d.aggregate(this.remove(c)),l&&i!==U.NONE&&u===this.rawInputValue)if(i===U.FORCE_LEFT){let h;for(;u===this.rawInputValue&&(h=this.displayValue.length);)d.aggregate(new de({tailShift:-1})).aggregate(this.remove(h-1))}else i===U.FORCE_RIGHT&&a.unshift();return d.aggregate(this.append(r,o,a))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!Wa(this,e)}typedValueEquals(e){const n=this.typedValue;return e===n||it.EMPTY_VALUES.includes(e)&&it.EMPTY_VALUES.includes(n)||(this.format?this.format(e,this)===this.format(this.typedValue,this):!1)}pad(e){return new de}}it.DEFAULTS={skipInvalid:!0};it.EMPTY_VALUES=[void 0,null,""];ie.Masked=it;class qr{constructor(e,n){e===void 0&&(e=[]),n===void 0&&(n=0),this.chunks=e,this.from=n}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=pr(e)?new fn(String(e)):e;const n=this.chunks[this.chunks.length-1],r=n&&(n.stop===e.stop||e.stop==null)&&e.from===n.from+n.toString().length;if(e instanceof fn)r?n.extend(e.toString()):this.chunks.push(e);else if(e instanceof qr){if(e.stop==null){let i;for(;e.chunks.length&&e.chunks[0].stop==null;)i=e.chunks.shift(),i.from+=e.from,this.extend(i)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof ie.MaskedPattern))return new fn(this.toString()).appendTo(e);const n=new de;for(let r=0;r<this.chunks.length;++r){const i=this.chunks[r],o=e._mapPosToBlock(e.displayValue.length),s=i.stop;let a;if(s!=null&&(!o||o.index<=s)&&((i instanceof qr||e._stops.indexOf(s)>=0)&&n.aggregate(e._appendPlaceholder(s)),a=i instanceof qr&&e._blocks[s]),a){const l=a.appendTail(i);n.aggregate(l);const u=i.toString().slice(l.rawInserted.length);u&&n.aggregate(e.append(u,{tail:!0}))}else n.aggregate(e.append(i.toString(),{tail:!0}))}return n}get state(){return{chunks:this.chunks.map(e=>e.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:n,...r}=e;Object.assign(this,r),this.chunks=n.map(i=>{const o="chunks"in i?new qr:new fn;return o.state=i,o})}unshift(e){if(!this.chunks.length||e!=null&&this.from>=e)return"";const n=e!=null?e-this.from:e;let r=0;for(;r<this.chunks.length;){const i=this.chunks[r],o=i.unshift(n);if(i.toString()){if(!o)break;++r}else this.chunks.splice(r,1);if(o)return o}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;for(;0<=e;){const n=this.chunks[e],r=n.shift();if(n.toString()){if(!r)break;--e}else this.chunks.splice(e,1);if(r)return r}return""}}class oE{constructor(e,n){this.masked=e,this._log=[];const{offset:r,index:i}=e._mapPosToBlock(n)||(n<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=r,this.index=i,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(e){Object.assign(this,e)}pushState(){this._log.push(this.state)}popState(){const e=this._log.pop();return e&&(this.state=e),e}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(e){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((n=this.block)==null?void 0:n.displayValue.length)||0){var n;if(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(e())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,U.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,U.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,U.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,U.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,U.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,U.NONE),!0})}}class Rv{constructor(e){Object.assign(this,e),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(e,n){return e===void 0&&(e=0),n===void 0&&(n=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(n),this._value||(this._isRawInput=!1),new de}nearestInputPos(e,n){n===void 0&&(n=U.NONE);const r=0,i=this._value.length;switch(n){case U.LEFT:case U.FORCE_LEFT:return r;case U.NONE:case U.RIGHT:case U.FORCE_RIGHT:default:return i}}totalInputPositions(e,n){return e===void 0&&(e=0),n===void 0&&(n=this._value.length),this._isRawInput?n-e:0}extractInput(e,n,r){return e===void 0&&(e=0),n===void 0&&(n=this._value.length),r===void 0&&(r={}),r.raw&&this._isRawInput&&this._value.slice(e,n)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(e,n){if(n===void 0&&(n={}),this.isFilled)return new de;const r=this.eager===!0||this.eager==="append",i=this.char===e&&(this.isUnmasking||n.input||n.raw)&&(!n.raw||!r)&&!n.tail,o=new de({inserted:this.char,rawInserted:i?this.char:""});return this._value=this.char,this._isRawInput=i&&(n.raw||n.input),o}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new de;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new fn("")}appendTail(e){return pr(e)&&(e=new fn(String(e))),e.appendTo(this)}append(e,n,r){const i=this._appendChar(e[0],n);return r!=null&&(i.tailShift+=this.appendTail(r).tailShift),i}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=!!e._rawInputValue}pad(e){return this._appendPlaceholder()}}class Ua{constructor(e){const{parent:n,isOptional:r,placeholderChar:i,displayChar:o,lazy:s,eager:a,...l}=e;this.masked=$n(l),Object.assign(this,{parent:n,isOptional:r,placeholderChar:i,displayChar:o,lazy:s,eager:a})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.value.length),e===0&&n>=1?(this.isFilled=!1,this.masked.remove(e,n)):new de}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(e,n){if(n===void 0&&(n={}),this.isFilled)return new de;const r=this.masked.state;let i=this.masked._appendChar(e,this.currentMaskFlags(n));return i.inserted&&this.doValidate(n)===!1&&(i=new de,this.masked.state=r),!i.inserted&&!this.isOptional&&!this.lazy&&!n.input&&(i.inserted=this.placeholderChar),i.skip=!i.inserted&&!this.isOptional,this.isFilled=!!i.inserted,i}append(e,n,r){return this.masked.append(e,this.currentMaskFlags(n),r)}_appendPlaceholder(){return this.isFilled||this.isOptional?new de:(this.isFilled=!0,new de({inserted:this.placeholderChar}))}_appendEager(){return new de}extractTail(e,n){return this.masked.extractTail(e,n)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,n,r){return e===void 0&&(e=0),n===void 0&&(n=this.value.length),this.masked.extractInput(e,n,r)}nearestInputPos(e,n){n===void 0&&(n=U.NONE);const r=0,i=this.value.length,o=Math.min(Math.max(e,r),i);switch(n){case U.LEFT:case U.FORCE_LEFT:return this.isComplete?o:r;case U.RIGHT:case U.FORCE_RIGHT:return this.isComplete?o:i;case U.NONE:default:return o}}totalInputPositions(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.value.length),this.value.slice(e,n).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var n;return{...e,_beforeTailState:(e==null||(n=e._beforeTailState)==null?void 0:n.masked)||e?._beforeTailState}}pad(e){return new de}}Ua.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class sE extends it{updateOptions(e){super.updateOptions(e)}_update(e){const n=e.mask;n&&(e.validate=r=>r.search(n)>=0),super._update(e)}}ie.MaskedRegExp=sE;class ot extends it{constructor(e){super({...ot.DEFAULTS,...e,definitions:Object.assign({},Ua.DEFAULT_DEFINITIONS,e?.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const n=this.mask;if(!n||!e)return;let r=!1,i=!1;for(let o=0;o<n.length;++o){if(this.blocks){const u=n.slice(o),c=Object.keys(this.blocks).filter(h=>u.indexOf(h)===0);c.sort((h,p)=>p.length-h.length);const d=c[0];if(d){const{expose:h,repeat:p,...f}=ss(this.blocks[d]),m={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...f,repeat:p,parent:this},g=p!=null?new ie.RepeatBlock(m):$n(m);g&&(this._blocks.push(g),h&&(this.exposeBlock=g),this._maskedBlocks[d]||(this._maskedBlocks[d]=[]),this._maskedBlocks[d].push(this._blocks.length-1)),o+=d.length-1;continue}}let s=n[o],a=s in e;if(s===ot.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(s==="{"||s==="}"){r=!r;continue}if(s==="["||s==="]"){i=!i;continue}if(s===ot.ESCAPE_CHAR){if(++o,s=n[o],!s)break;a=!1}const l=a?new Ua({isOptional:i,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...ss(e[s]),parent:this}):new Rv({char:s,eager:this.eager,isUnmasking:r});this._blocks.push(l)}}get state(){return{...super.state,_blocks:this._blocks.map(e=>e.state)}}set state(e){if(!e){this.reset();return}const{_blocks:n,...r}=e;this._blocks.forEach((i,o)=>i.state=n[o]),super.state=r}reset(){super.reset(),this._blocks.forEach(e=>e.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(e=>e.isComplete)}get isFilled(){return this._blocks.every(e=>e.isFilled)}get isFixed(){return this._blocks.every(e=>e.isFixed)}get isOptional(){return this._blocks.every(e=>e.isOptional)}doCommit(){this._blocks.forEach(e=>e.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((e,n)=>e+=n.unmaskedValue,"")}set unmaskedValue(e){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(n),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((e,n)=>e+=n.value,"")}set value(e){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(n),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(n),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce((e,n)=>e+=n.displayValue,"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const n=new de;let r=(e=this._mapPosToBlock(this.displayValue.length))==null?void 0:e.index;if(r==null)return n;this._blocks[r].isFilled&&++r;for(let i=r;i<this._blocks.length;++i){const o=this._blocks[i]._appendEager();if(!o.inserted)break;n.aggregate(o)}return n}_appendCharRaw(e,n){n===void 0&&(n={});const r=this._mapPosToBlock(this.displayValue.length),i=new de;if(!r)return i;for(let s=r.index,a;a=this._blocks[s];++s){var o;const l=a._appendChar(e,{...n,_beforeTailState:(o=n._beforeTailState)==null||(o=o._blocks)==null?void 0:o[s]});if(i.aggregate(l),l.consumed)break}return i}extractTail(e,n){e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length);const r=new qr;return e===n||this._forEachBlocksInRange(e,n,(i,o,s,a)=>{const l=i.extractTail(s,a);l.stop=this._findStopBefore(o),l.from=this._blockStartPos(o),l instanceof qr&&(l.blockIndex=o),r.extend(l)}),r}extractInput(e,n,r){if(e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),r===void 0&&(r={}),e===n)return"";let i="";return this._forEachBlocksInRange(e,n,(o,s,a,l)=>{i+=o.extractInput(a,l,r)}),i}_findStopBefore(e){let n;for(let r=0;r<this._stops.length;++r){const i=this._stops[r];if(i<=e)n=i;else break}return n}_appendPlaceholder(e){const n=new de;if(this.lazy&&e==null)return n;const r=this._mapPosToBlock(this.displayValue.length);if(!r)return n;const i=r.index,o=e??this._blocks.length;return this._blocks.slice(i,o).forEach(s=>{if(!s.lazy||e!=null){var a;n.aggregate(s._appendPlaceholder((a=s._blocks)==null?void 0:a.length))}}),n}_mapPosToBlock(e){let n="";for(let r=0;r<this._blocks.length;++r){const i=this._blocks[r],o=n.length;if(n+=i.displayValue,e<=n.length)return{index:r,offset:e-o}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce((n,r)=>n+=r.displayValue.length,0)}_forEachBlocksInRange(e,n,r){n===void 0&&(n=this.displayValue.length);const i=this._mapPosToBlock(e);if(i){const o=this._mapPosToBlock(n),s=o&&i.index===o.index,a=i.offset,l=o&&s?o.offset:this._blocks[i.index].displayValue.length;if(r(this._blocks[i.index],i.index,a,l),o&&!s){for(let u=i.index+1;u<o.index;++u)r(this._blocks[u],u,0,this._blocks[u].displayValue.length);r(this._blocks[o.index],o.index,0,o.offset)}}}remove(e,n){e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length);const r=super.remove(e,n);return this._forEachBlocksInRange(e,n,(i,o,s,a)=>{r.aggregate(i.remove(s,a))}),r}nearestInputPos(e,n){if(n===void 0&&(n=U.NONE),!this._blocks.length)return 0;const r=new oE(this,e);if(n===U.NONE)return r.pushRightBeforeInput()||(r.popState(),r.pushLeftBeforeInput())?r.pos:this.displayValue.length;if(n===U.LEFT||n===U.FORCE_LEFT){if(n===U.LEFT){if(r.pushRightBeforeFilled(),r.ok&&r.pos===e)return e;r.popState()}if(r.pushLeftBeforeInput(),r.pushLeftBeforeRequired(),r.pushLeftBeforeFilled(),n===U.LEFT){if(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.ok&&r.pos<=e||(r.popState(),r.ok&&r.pos<=e))return r.pos;r.popState()}return r.ok?r.pos:n===U.FORCE_LEFT?0:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:0)}return n===U.RIGHT||n===U.FORCE_RIGHT?(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.pushRightBeforeFilled()?r.pos:n===U.FORCE_RIGHT?this.displayValue.length:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:this.nearestInputPos(e,U.LEFT))):e}totalInputPositions(e,n){e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length);let r=0;return this._forEachBlocksInRange(e,n,(i,o,s,a)=>{r+=i.totalInputPositions(s,a)}),r}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const n=this._maskedBlocks[e];return n?n.map(r=>this._blocks[r]):[]}pad(e){const n=new de;return this._forEachBlocksInRange(0,this.displayValue.length,r=>n.aggregate(r.pad(e))),n}}ot.DEFAULTS={...it.DEFAULTS,lazy:!0,placeholderChar:"_"};ot.STOP_CHAR="`";ot.ESCAPE_CHAR="\\";ot.InputDefinition=Ua;ot.FixedDefinition=Rv;ie.MaskedPattern=ot;class Sa extends ot{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:n=this.to||0,from:r=this.from||0,maxLength:i=this.maxLength||0,autofix:o=this.autofix,...s}=e;this.to=n,this.from=r,this.maxLength=Math.max(String(n).length,i),this.autofix=o;const a=String(this.from).padStart(this.maxLength,"0"),l=String(this.to).padStart(this.maxLength,"0");let u=0;for(;u<l.length&&l[u]===a[u];)++u;s.mask=l.slice(0,u).replace(/0/g,"\\0")+"0".repeat(this.maxLength-u),super._update(s)}get isComplete(){return super.isComplete&&!!this.value}boundaries(e){let n="",r="";const[,i,o]=e.match(/^(\D*)(\d*)(\D*)/)||[];return o&&(n="0".repeat(i.length)+o,r="9".repeat(i.length)+o),n=n.padEnd(this.maxLength,"0"),r=r.padEnd(this.maxLength,"9"),[n,r]}doPrepareChar(e,n){n===void 0&&(n={});let r;return[e,r]=super.doPrepareChar(e.replace(/\D/g,""),n),e||(r.skip=!this.isComplete),[e,r]}_appendCharRaw(e,n){if(n===void 0&&(n={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,n);const r=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0"),[o,s]=this.boundaries(this.value+e);return Number(s)<this.from?super._appendCharRaw(r[this.value.length],n):Number(o)>this.to?!n.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(r[this.value.length],n).aggregate(this._appendCharRaw(e,n)):super._appendCharRaw(i[this.value.length],n):super._appendCharRaw(e,n)}doValidate(e){const n=this.value;if(n.search(/[^0]/)===-1&&n.length<=this._matchFrom)return!0;const[r,i]=this.boundaries(n);return this.from<=Number(i)&&Number(r)<=this.to&&super.doValidate(e)}pad(e){const n=new de;if(this.value.length===this.maxLength)return n;const r=this.value,i=this.maxLength-this.value.length;if(i){this.reset();for(let o=0;o<i;++o)n.aggregate(super._appendCharRaw("0",e));r.split("").forEach(o=>this._appendCharRaw(o))}return n}}ie.MaskedRange=Sa;const aE="d{.}`m{.}`Y";class In extends ot{static extractPatternOptions(e){const{mask:n,pattern:r,...i}=e;return{...i,mask:pr(n)?n:r}}constructor(e){super(In.extractPatternOptions({...In.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:n,pattern:r,blocks:i,...o}={...In.DEFAULTS,...e},s=Object.assign({},In.GET_DEFAULT_BLOCKS());e.min&&(s.Y.from=e.min.getFullYear()),e.max&&(s.Y.to=e.max.getFullYear()),e.min&&e.max&&s.Y.from===s.Y.to&&(s.m.from=e.min.getMonth()+1,s.m.to=e.max.getMonth()+1,s.m.from===s.m.to&&(s.d.from=e.min.getDate(),s.d.to=e.max.getDate())),Object.assign(s,this.blocks,i),super._update({...o,mask:pr(n)?n:r,blocks:s})}doValidate(e){const n=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&n!=null&&(this.min==null||this.min<=n)&&(this.max==null||n<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged(In.extractPatternOptions(e))}}In.GET_DEFAULT_BLOCKS=()=>({d:{mask:Sa,from:1,to:31,maxLength:2},m:{mask:Sa,from:1,to:12,maxLength:2},Y:{mask:Sa,from:1900,to:9999}});In.DEFAULTS={...ot.DEFAULTS,mask:Date,pattern:aE,format:(t,e)=>{if(!t)return"";const n=String(t.getDate()).padStart(2,"0"),r=String(t.getMonth()+1).padStart(2,"0"),i=t.getFullYear();return[n,r,i].join(".")},parse:(t,e)=>{const[n,r,i]=t.split(".").map(Number);return new Date(i,r-1,n)}};ie.MaskedDate=In;class iu extends it{constructor(e){super({...iu.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map(n=>{const{expose:r,...i}=ss(n),o=$n({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...i});return r&&(this.exposeMask=o),o}):[])}_appendCharRaw(e,n){n===void 0&&(n={});const r=this._applyDispatch(e,n);return this.currentMask&&r.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(n))),r}_applyDispatch(e,n,r){e===void 0&&(e=""),n===void 0&&(n={}),r===void 0&&(r="");const i=n.tail&&n._beforeTailState!=null?n._beforeTailState._value:this.value,o=this.rawInputValue,s=n.tail&&n._beforeTailState!=null?n._beforeTailState._rawInputValue:o,a=o.slice(s.length),l=this.currentMask,u=new de,c=l?.state;return this.currentMask=this.doDispatch(e,{...n},r),this.currentMask&&(this.currentMask!==l?(this.currentMask.reset(),s&&(this.currentMask.append(s,{raw:!0}),u.tailShift=this.currentMask.value.length-i.length),a&&(u.tailShift+=this.currentMask.append(a,{raw:!0,tail:!0}).tailShift)):c&&(this.currentMask.state=c)),u}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const n=new de;return e&&n.aggregate(this._applyDispatch("",{},e)),n.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var n,r;return{...e,_beforeTailState:((n=e._beforeTailState)==null?void 0:n.currentMaskRef)===this.currentMask&&((r=e._beforeTailState)==null?void 0:r.currentMask)||e._beforeTailState}}doDispatch(e,n,r){return n===void 0&&(n={}),r===void 0&&(r=""),this.dispatch(e,this,n,r)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,n){n===void 0&&(n={});let[r,i]=super.doPrepare(e,n);if(this.currentMask){let o;[r,o]=super.doPrepare(r,this.currentMaskFlags(n)),i=i.aggregate(o)}return[r,i]}doPrepareChar(e,n){n===void 0&&(n={});let[r,i]=super.doPrepareChar(e,n);if(this.currentMask){let o;[r,o]=super.doPrepareChar(r,this.currentMaskFlags(n)),i=i.aggregate(o)}return[r,i]}reset(){var e;(e=this.currentMask)==null||e.reset(),this.compiledMasks.forEach(n=>n.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask){this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,this._applyDispatch();return}let n=String(e);this.currentMask&&(this.currentMask.typedValue=e,n=this.currentMask.unmaskedValue),this.unmaskedValue=n}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return!!((e=this.currentMask)!=null&&e.isComplete)}get isFilled(){var e;return!!((e=this.currentMask)!=null&&e.isFilled)}remove(e,n){const r=new de;return this.currentMask&&r.aggregate(this.currentMask.remove(e,n)).aggregate(this._applyDispatch()),r}get state(){var e;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(n=>n.state),currentMaskRef:this.currentMask,currentMask:(e=this.currentMask)==null?void 0:e.state}}set state(e){const{compiledMasks:n,currentMaskRef:r,currentMask:i,...o}=e;n&&this.compiledMasks.forEach((s,a)=>s.state=n[a]),r!=null&&(this.currentMask=r,this.currentMask.state=i),super.state=o}extractInput(e,n,r){return this.currentMask?this.currentMask.extractInput(e,n,r):""}extractTail(e,n){return this.currentMask?this.currentMask.extractTail(e,n):super.extractTail(e,n)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(e,n){return this.currentMask?this.currentMask.nearestInputPos(e,n):super.nearestInputPos(e,n)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(e){this._overwrite=e}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(e){this._eager=e}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(e){this._skipInvalid=e}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(e){this._autofix=e}maskEquals(e){return Array.isArray(e)?this.compiledMasks.every((n,r)=>{if(!e[r])return;const{mask:i,...o}=e[r];return Wa(n,o)&&n.maskEquals(i)}):super.maskEquals(e)}typedValueEquals(e){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(e))}}iu.DEFAULTS={...it.DEFAULTS,dispatch:(t,e,n,r)=>{if(!e.compiledMasks.length)return;const i=e.rawInputValue,o=e.compiledMasks.map((s,a)=>{const l=e.currentMask===s,u=l?s.displayValue.length:s.nearestInputPos(s.displayValue.length,U.FORCE_LEFT);return s.rawInputValue!==i?(s.reset(),s.append(i,{raw:!0})):l||s.remove(u),s.append(t,e.currentMaskFlags(n)),s.appendTail(r),{index:a,weight:s.rawInputValue.length,totalInputPositions:s.totalInputPositions(0,Math.max(u,s.nearestInputPos(s.displayValue.length,U.FORCE_LEFT)))}});return o.sort((s,a)=>a.weight-s.weight||a.totalInputPositions-s.totalInputPositions),e.compiledMasks[o[0].index]}};ie.MaskedDynamic=iu;class ou extends ot{constructor(e){super({...ou.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:n,...r}=e;if(n){const i=n.map(a=>a.length),o=Math.min(...i),s=Math.max(...i)-o;r.mask="*".repeat(o),s&&(r.mask+="["+"*".repeat(s)+"]"),this.enum=n}super._update(r)}_appendCharRaw(e,n){n===void 0&&(n={});const r=Math.min(this.nearestInputPos(0,U.FORCE_RIGHT),this.value.length),i=this.enum.filter(o=>this.matchValue(o,this.unmaskedValue+e,r));if(i.length){i.length===1&&this._forEachBlocksInRange(0,this.value.length,(s,a)=>{const l=i[0][a];a>=this.value.length||l===s.value||(s.reset(),s._appendChar(l,n))});const o=super._appendCharRaw(i[0][this.value.length],n);return i.length===1&&i[0].slice(this.unmaskedValue.length).split("").forEach(s=>o.aggregate(super._appendCharRaw(s))),o}return new de({skip:!this.isComplete})}extractTail(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),new fn("",e)}remove(e,n){if(e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),e===n)return new de;const r=Math.min(super.nearestInputPos(0,U.FORCE_RIGHT),this.value.length);let i;for(i=e;i>=0&&!(this.enum.filter(s=>this.matchValue(s,this.value.slice(r,i),r)).length>1);--i);const o=super.remove(i,n);return o.tailShift+=i-e,o}get isComplete(){return this.enum.indexOf(this.value)>=0}}ou.DEFAULTS={...ot.DEFAULTS,matchValue:(t,e,n)=>t.indexOf(e,n)===n};ie.MaskedEnum=ou;class lE extends it{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}ie.MaskedFunction=lE;var Pv;class St extends it{constructor(e){super({...St.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),n="\\d*",r=(this.scale?"("+ju(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+n+r),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(ju).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(ju(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const n=e.split(this.radix);return n[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),n.join(this.radix)}doPrepareChar(e,n){n===void 0&&(n={});const[r,i]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(n.input&&n.raw||!n.input&&!n.raw)?e.replace(this._mapToRadixRegExp,this.radix):e),n);return e&&!r&&(i.skip=!0),r&&!this.allowPositive&&!this.value&&r!=="-"&&i.aggregate(this._appendChar("-")),[r,i]}_separatorsCount(e,n){n===void 0&&(n=!1);let r=0;for(let i=0;i<e;++i)this._value.indexOf(this.thousandsSeparator,i)===i&&(++r,n&&(e+=this.thousandsSeparator.length));return r}_separatorsCountFromSlice(e){return e===void 0&&(e=this._value),this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(e,n,r){return e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),[e,n]=this._adjustRangeWithSeparators(e,n),this._removeThousandsSeparators(super.extractInput(e,n,r))}_appendCharRaw(e,n){n===void 0&&(n={});const r=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,i=this._separatorsCountFromSlice(r);this._value=this._removeThousandsSeparators(this.value);const o=this._value;this._value+=e;const s=this.number;let a=!isNaN(s),l=!1;if(a){let h;this.min!=null&&this.min<0&&this.number<this.min&&(h=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(h=this.max),h!=null&&(this.autofix?(this._value=this.format(h,this).replace(St.UNMASKED_RADIX,this.radix),l||(l=o===this._value&&!n.tail)):a=!1),a&&(a=!!this._value.match(this._numberRegExp))}let u;a?u=new de({inserted:this._value.slice(o.length),rawInserted:l?"":e,skip:l}):(this._value=o,u=new de),this._value=this._insertThousandsSeparators(this._value);const c=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,d=this._separatorsCountFromSlice(c);return u.tailShift+=(d-i)*this.thousandsSeparator.length,u}_findSeparatorAround(e){if(this.thousandsSeparator){const n=e-this.thousandsSeparator.length+1,r=this.value.indexOf(this.thousandsSeparator,n);if(r<=e)return r}return-1}_adjustRangeWithSeparators(e,n){const r=this._findSeparatorAround(e);r>=0&&(e=r);const i=this._findSeparatorAround(n);return i>=0&&(n=i+this.thousandsSeparator.length),[e,n]}remove(e,n){e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),[e,n]=this._adjustRangeWithSeparators(e,n);const r=this.value.slice(0,e),i=this.value.slice(n),o=this._separatorsCount(r.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(r+i));const s=this._separatorsCountFromSlice(r);return new de({tailShift:(s-o)*this.thousandsSeparator.length})}nearestInputPos(e,n){if(!this.thousandsSeparator)return e;switch(n){case U.NONE:case U.LEFT:case U.FORCE_LEFT:{const r=this._findSeparatorAround(e-1);if(r>=0){const i=r+this.thousandsSeparator.length;if(e<i||this.value.length<=i||n===U.FORCE_LEFT)return r}break}case U.RIGHT:case U.FORCE_RIGHT:{const r=this._findSeparatorAround(e);if(r>=0)return r+this.thousandsSeparator.length}}return e}doCommit(){if(this.value){const e=this.number;let n=e;this.min!=null&&(n=Math.max(n,this.min)),this.max!=null&&(n=Math.min(n,this.max)),n!==e&&(this.unmaskedValue=this.format(n,this));let r=this.value;this.normalizeZeros&&(r=this._normalizeZeros(r)),this.padFractionalZeros&&this.scale>0&&(r=this._padFractionalZeros(r)),this._value=r}super.doCommit()}_normalizeZeros(e){const n=this._removeThousandsSeparators(e).split(this.radix);return n[0]=n[0].replace(/^(\D*)(0*)(\d*)/,(r,i,o,s)=>i+s),e.length&&!/\d$/.test(n[0])&&(n[0]=n[0]+"0"),n.length>1&&(n[1]=n[1].replace(/0*$/,""),n[1].length||(n.length=1)),this._insertThousandsSeparators(n.join(this.radix))}_padFractionalZeros(e){if(!e)return e;const n=e.split(this.radix);return n.length<2&&n.push(""),n[1]=n[1].padEnd(this.scale,"0"),n.join(this.radix)}doSkipInvalid(e,n,r){n===void 0&&(n={});const i=this.scale===0&&e!==this.thousandsSeparator&&(e===this.radix||e===St.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,n,r)&&!i}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,St.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(e){this.rawInputValue=this.format(e,this).replace(St.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(e){return(super.typedValueEquals(e)||St.EMPTY_VALUES.includes(e)&&St.EMPTY_VALUES.includes(this.typedValue))&&!(e===0&&this.value==="")}}Pv=St;St.UNMASKED_RADIX=".";St.EMPTY_VALUES=[...it.EMPTY_VALUES,0];St.DEFAULTS={...it.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[Pv.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:t=>t.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})};ie.MaskedNumber=St;const Jc={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function Fv(t,e,n){e===void 0&&(e=Jc.MASKED),n===void 0&&(n=Jc.MASKED);const r=$n(t);return i=>r.runIsolated(o=>(o[e]=i,o[n]))}function uE(t,e,n,r){return Fv(e,n,r)(t)}ie.PIPE_TYPE=Jc;ie.createPipe=Fv;ie.pipe=uE;class cE extends ot{get repeatFrom(){var e;return(e=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?e:0}get repeatTo(){var e;return(e=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?e:1/0}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){var n,r,i;const{repeat:o,...s}=ss(e);this._blockOpts=Object.assign({},this._blockOpts,s);const a=$n(this._blockOpts);this.repeat=(n=(r=o??a.repeat)!=null?r:this.repeat)!=null?n:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((i=this._blocks)==null?void 0:i.length)||0,this.repeatFrom)),blocks:{m:a},eager:a.eager,overwrite:a.overwrite,skipInvalid:a.skipInvalid,lazy:a.lazy,placeholderChar:a.placeholderChar,displayChar:a.displayChar})}_allocateBlock(e){if(e<this._blocks.length)return this._blocks[e];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push($n(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(e,n){n===void 0&&(n={});const r=new de;for(let l=(i=(o=this._mapPosToBlock(this.displayValue.length))==null?void 0:o.index)!=null?i:Math.max(this._blocks.length-1,0),u,c;u=(s=this._blocks[l])!=null?s:c=!c&&this._allocateBlock(l);++l){var i,o,s,a;const d=u._appendChar(e,{...n,_beforeTailState:(a=n._beforeTailState)==null||(a=a._blocks)==null?void 0:a[l]});if(d.skip&&c){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(r.aggregate(d),d.consumed)break}return r}_trimEmptyTail(e,n){var r,i;e===void 0&&(e=0);const o=Math.max(((r=this._mapPosToBlock(e))==null?void 0:r.index)||0,this.repeatFrom,0);let s;n!=null&&(s=(i=this._mapPosToBlock(n))==null?void 0:i.index),s==null&&(s=this._blocks.length-1);let a=0;for(let l=s;o<=l&&!this._blocks[l].unmaskedValue;--l,++a);a&&(this._blocks.splice(s-a+1,a),this.mask=this.mask.slice(a))}reset(){super.reset(),this._trimEmptyTail()}remove(e,n){e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length);const r=super.remove(e,n);return this._trimEmptyTail(e,n),r}totalInputPositions(e,n){return e===void 0&&(e=0),n==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(e,n)}get state(){return super.state}set state(e){this._blocks.length=e._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=e}}ie.RepeatBlock=cE;try{globalThis.IMask=ie}catch{}function dE(t,e){let{emit:n,onAccept:r,onComplete:i,defaultValue:o,defaultUnmaskedValue:s,defaultTypedValue:a}=e===void 0?{}:e;const l=kk(t)?t:X(t),u=X(),c=X(),d=X(""),h=X(""),p=X();let f,m=d.value,g=h.value,y=p.value;function b(){y=p.value=c.value.typedValue,g=h.value=c.value.unmaskedValue,m=d.value=c.value.value}function k(C){b(),n&&(n("accept",d.value,C),n("accept:masked",d.value,C),n("accept:typed",p.value,C),n("accept:unmasked",h.value,C)),r?.(C)}function v(C){n&&(n("complete",c.value.value,C),n("complete:masked",c.value.value,C),n("complete:typed",c.value.typedValue,C),n("complete:unmasked",c.value.unmaskedValue,C)),i?.(C)}const w=()=>{!c.value||h.value===void 0||(g!==h.value&&(c.value.unmaskedValue=h.value,c.value.unmaskedValue!==h.value&&k()),g=void 0)};Ee(h,w);const x=()=>{!c.value||d.value===void 0||(m!==d.value&&(c.value.value=d.value,c.value.value!==d.value&&k()),m=void 0)};Ee(d,x);const T=()=>{!c.value||p.value===void 0||(y!==p.value&&(c.value.typedValue=p.value,c.value.masked.typedValueEquals(p.value)||k()),y=void 0)};Ee(p,T);function F(){f=u.value;const C=l.value;!f||!(C!=null&&C.mask)||(c.value=ie(f,C),o!==void 0&&(d.value=o),s!==void 0&&(h.value=s),a!==void 0&&(p.value=a),w(),x(),T(),b(),c.value.on("accept",k).on("complete",v))}function D(){var C;(C=c.value)==null||C.destroy(),c.value=void 0}return qn(F),wk(D),Ee([u,l],()=>{const C=u.value,_=l.value;(!(_!=null&&_.mask)||C!==f)&&D(),C&&(c.value?c.value.updateOptions(_):F())}),{el:u,mask:Zd(c),masked:d,unmasked:h,typed:p}}const pE={key:0,class:"k-input__prefix"},hE=["id","aria-labelledby","aria-describedby","required","type"],fE={key:1,class:"k-input__suffix"},mE=te({__name:"Input",props:{invalid:{type:Boolean},id:{},modelValue:{},prefix:{},suffix:{},mask:{},align:{default:"left"},type:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=Fg(),r=t,i=e;function o(p){r.mask||i("update:modelValue",p.target.value)}const s=Cn("k-input",{variants:{invalid:{true:"k-input--invalid"},align:{left:"k-input--align-left",right:"k-input--align-right"}}}),a=Lg(wp,N(()=>({id:r.id,invalid:r.invalid,required:!1,events:{onBlur:()=>{},onFocus:()=>{}}}))),l=p=>{var f;(f=a.value.events)==null||f.onFocus(p),n.onFocus&&n.onFocus(p)},u=p=>{var f;(f=a.value.events)==null||f.onBlur(p),n.onBlur&&n.onBlur(p)},{unmasked:c,masked:d,el:h}=dE(r.mask,{defaultValue:String(r.modelValue),onAccept:()=>{var p,f;if((p=r.mask)!=null&&p.pattern)return;const m=((f=r.mask)==null?void 0:f.mask)===Number?parseFloat(c.value):d.value;m!==r.modelValue&&i("update:modelValue",m)}});return qn(()=>{Ee(()=>r.modelValue,p=>{r.mask&&c.value!==String(p)&&(c.value=String(p)),r.mask||(h.value.value=p)},{immediate:!0})}),(p,f)=>(E(),O("div",{class:Ce($(s)({invalid:$(a).invalid,align:p.align}))},[p.$slots.prefix||p.prefix?(E(),O("span",pE,[P(p.$slots,"prefix",{},()=>[$e(se(p.prefix),1)])])):I("",!0),H("input",ne({class:"k-input__input",id:$(a).id,"aria-labelledby":$(a).labelId,"aria-describedby":$(a).helpId,required:$(a).required,onInput:o,onBlur:u,onFocus:l,ref_key:"el",ref:h,type:r.type},{...$(a).events,...p.$attrs}),null,16,hE),p.$slots.suffix||p.suffix?(E(),O("span",fE,[P(p.$slots,"suffix",{},()=>[$e(se(p.suffix),1)])])):I("",!0)],2))}});let gE=class{constructor(t,e){Yt(this,"key"),Yt(this,"goto"),this.key=t,this.goto=e,this.set()}get(){return localStorage.getItem(this.key)||""}set(t=this.get()){const e=this.goto(t);this.get()!==e&&localStorage.setItem(this.key,e)}destroy(){}},vE=class{constructor(t,e){Yt(this,"key"),Yt(this,"goto"),Yt(this,"current"),this.key=t,this.goto=e,this.set()}get(){return this.current||""}set(t=this.get()){this.current=this.goto(t)}destroy(){}};class yE{constructor(e,n){Yt(this,"key"),Yt(this,"goto"),this.key=e,this.goto=n,this.set()}get(){return sessionStorage.getItem(this.key)||""}set(e=this.get()){const n=this.goto(e);this.get()!==n&&sessionStorage.setItem(this.key,n)}destroy(){}}const bE=Object.freeze(Object.defineProperty({__proto__:null,localStorage:gE,none:vE,sessionStorage:yE},Symbol.toStringTag,{value:"Module"})),kE=["data-step"],wE={key:0,class:"k-stepper-breadcrumbs-wrapper"},xE={key:0,class:"k-stepper__breadcrumb-arrow"},EE=["disabled","onClick"],CE={class:"k-stepper__breadcrumb-icon"},SE={class:"k-stepper__breadcrumb-label"},TE={class:"k-stepper__component-wrapper"},OE={key:0,class:"k-stepper__navigation"},mL=te({__name:"Stepper",props:{steps:{},stateHandler:{default:"none"},stateKey:{default:"step"},transitionPreset:{default:"slide"},transitionNext:{},transitionPrev:{},breadcrumbPlacement:{default:"top"},keepAlive:{type:Boolean},hidebreadcrumbs:{type:Boolean,default:!1}},setup(t,{expose:e}){const n=t,r=X(),i=X(),o=X(n.steps[0].id);let s;const a=typeof n.stateHandler=="string"?bE[n.stateHandler]:n.stateHandler;s=new a(n.stateKey,f),ao(()=>s.destroy());const l=N(()=>c(o.value)),u=N(()=>{const k=d(o.value);return{...k?.bind||{},step:k,onNext:h,onPrev:p}});function c(k){const v=d(k),w=n.steps.findIndex(({id:x})=>!v||x===v.id);return{prev:w>0?n.steps[w-1]:null,current:v,next:w<n.steps.length-1?n.steps[w+1]:null}}function d(k){return n.steps.find(v=>v.id===k)}const h=()=>l.value.next&&f(l.value.next.id),p=()=>l.value.prev&&f(l.value.prev.id);function f(k){var v;if(k===o.value)return o.value;const w=n.steps.find(x=>!k||x.id===k);return w!=null&&w.disabled?f((v=c(w.id).prev)==null?void 0:v.id):(o.value=(w||n.steps[0]).id,s&&s.set(o.value),o.value)}const m=ip({next:h,prev:p,goto:f});Ee(o,(k,v)=>i.value=v);const g=()=>{if(!i.value)return"next";const{steps:k}=n;return k.findIndex(v=>v.id===i.value)>k.findIndex(v=>v.id===o.value)?"prev":"next"};function y(){const{transitionNext:k,transitionPreset:v,transitionPrev:w,breadcrumbPlacement:x}=n;if(k||w)return g()==="next"?k:w;if(v==="fade")return`k-stepper-${v}`;const T=["top","bottom"].includes(x)?"h":"v";return`k-stepper-${v}-${T}-${g()}`}const b=()=>{var k;const v=(k=r.value)==null?void 0:k.getBoundingClientRect();if(!v)return;const w=v.top-20;w>0||window.scrollTo({top:w+window.scrollY,behavior:"smooth"})};return e({goto:f,next:h,prev:p,meta:l}),(k,v)=>(E(),O("div",{class:Ce(`k-stepper k-stepper--breadcrumb-placement-${k.breadcrumbPlacement}`),"data-step":o.value},[k.hidebreadcrumbs?I("",!0):(E(),O("div",wE,[P(k.$slots,"before-breadcrumbs",be(Ne({meta:l.value,navigate:m}))),H("div",{class:"k-stepper__breadcrumbs",ref_key:"breadcrumb",ref:r},[(E(!0),O(Ie,null,_t(k.steps,(w,x)=>(E(),O(Ie,null,[x>0?(E(),O("div",xE)):I("",!0),P(k.$slots,"breadcrumb",{step:w,isActive:w.id===o.value,index:x,select:()=>f(w.id)},()=>[H("button",{type:"button",class:Ce(["k-stepper__breadcrumb",{"k-stepper__breadcrumb--default":w.isValid===void 0,"k-stepper__breadcrumb--active":w.id===o.value,"k-stepper__breadcrumb--invalid":w.isValid===!1,"k-stepper__breadcrumb--valid":w.isValid===!0}]),disabled:w.disabled,onClick:T=>f(w.id)},[H("span",CE,[P(k.$slots,"breadcrumb-icon",{step:w},()=>[w.isValid===!0?(E(),B($(Ze),{key:0,icon:"heroicons-solid:check",width:12})):w.isValid===!1?(E(),B($(Ze),{key:1,icon:"heroicons:exclamation-triangle",width:17})):(E(),O(Ie,{key:2},[$e(se(x+1),1)],64))])]),H("span",SE,se(w.label),1)],10,EE)])],64))),256))],512),P(k.$slots,"after-breadcrumbs",be(Ne({meta:l.value,navigate:m})))])),P(k.$slots,"before-content",be(Ne({meta:l.value,navigate:m}))),H("div",TE,[he(ep,{name:y(),mode:"out-in",onAfterEnter:b},{default:Z(()=>[k.keepAlive?(E(),B(xk,{key:0},[(E(),B(Qe(u.value.step.component),ne({key:o.value},u.value),null,16))],1024)):(E(),B(Qe(u.value.step.component),ne({key:o.value},u.value),null,16))]),_:1},8,["name"]),k.$slots.navigation?(E(),O("div",OE,[P(k.$slots,"navigation",be(Ne({meta:l.value,navigate:m})))])):I("",!0)]),P(k.$slots,"after-content",be(Ne({meta:l.value,navigate:m})))],10,kE))}}),AE=["src","alt"],su=te({__name:"Image",props:{src:{},preview:{},alt:{},caption:{},captionVisibility:{default:"hover"},captionTheme:{default:"dark"},size:{default:"cover"},position:{default:"center"},width:{},height:{},aspectRatio:{}},emits:["loaded","error"],setup(t,{emit:e}){const n=t,r=e,i=X(),o=X(!1),s=X(!1),a=X(),l=N(()=>({"--k-image-size":n.size,"--k-image-preview":n.preview||"","--k-image-position":n.position,"--k-image-width":n.width||"initial","--k-image-height":n.height||"initial","--k-image-aspectratio":(n.aspectRatio==="natural"?a.value:n.aspectRatio)||"initial"}));function u(){o.value=!0;const{naturalWidth:d=0,naturalHeight:h=0}=i.value||{};a.value=`${d}/${h}`,r("loaded")}function c(){o.value=!0,s.value=!0,r("error")}return qn(()=>{var d;return((d=i.value)==null?void 0:d.complete)&&u()}),(d,h)=>(E(),O("figure",{class:Ce(["k-image",[`k-image--size-${d.size}`,{"k-image--loaded":o.value,"k-image--loading":!o.value}]]),style:Cr(l.value)},[o.value?I("",!0):(E(),B(Qg,{key:0,size:"small"})),Va(H("img",{src:d.src,alt:d.alt||d.caption,onLoad:u,onError:c,ref_key:"image",ref:i},null,40,AE),[[Ng,!s.value]]),d.$slots.caption||d.caption?(E(),O("figcaption",{key:1,class:Ce(`k-image__caption k-image__caption--visibility-${d.captionVisibility} k-image__caption--theme-${!o.value||s.value?"light":d.captionTheme}`)},[P(d.$slots,"caption",{},()=>[$e(se(d.caption),1)])],2)):I("",!0)],6))}}),ni=te({__name:"Flex",props:{is:{default:"div"},gap:{default:"default"},justify:{},align:{},direction:{default:"row"},nowrap:{type:Boolean}},setup(t){const e=t,n=N(()=>Zg("flex",{justify:ja(e.justify)||"initial",align:ja(e.align)||"initial",wrap:e.nowrap?"nowrap":"wrap",gap:lp(e.gap),direction:e.direction}));return(r,i)=>(E(),B(Qe(r.is),{class:"k-flex",style:Cr(n.value)},{default:Z(()=>[P(r.$slots,"default")]),_:3},8,["style"]))}}),ME={key:0,class:"k-card__thumbnail"},_E={key:0,class:"k-card__title"},DE={key:1,class:"k-card__subtitle"},NE={key:2,class:"k-card__content"},IE=te({inheritAttrs:!1,__name:"Card",props:{is:{default:"div"},title:{},subtitle:{},variant:{default:"default"},appearance:{default:"border"},thumbnail:{},thumbnailOptions:{default:()=>({size:"cover",aspectRatio:"16/9",width:"100%"})}},setup(t){const e=t,n=np(),r=N(()=>e.thumbnail||n.thumbnail),i=N(()=>e.title||e.subtitle||n.header),o=N(()=>n.actions),s=N(()=>n.default);return(a,l)=>(E(),B(Qe(a.is),ne({class:["k-card",`k-card--variant-${a.variant}`,`k-card--appearance-${a.appearance}`,{"k-card--has-thumbnail":r.value},{"k-card--has-header":i.value},{"k-card--has-content":s.value},{"k-card--has-actions":o.value}]},a.$attrs),{default:Z(()=>[r.value?(E(),O("div",ME,[P(a.$slots,"thumbnail",{},()=>[a.thumbnail?(E(),B(su,ne({key:0},a.thumbnailOptions,{src:a.thumbnail}),null,16,["src"])):I("",!0)])])):I("",!0),i.value?(E(),B(ni,{key:1,is:"header",direction:"column",gap:"0rem",class:"k-card__header"},{default:Z(()=>[P(a.$slots,"header",{},()=>[a.title?(E(),O("div",_E,se(a.title),1)):I("",!0),a.subtitle?(E(),O("div",DE,se(a.subtitle),1)):I("",!0)])]),_:3})):I("",!0),s.value?(E(),O("div",NE,[P(a.$slots,"default")])):I("",!0),o.value?(E(),B(ni,{key:3,justify:"center",align:"center",class:"k-card__actions"},{default:Z(()=>[P(a.$slots,"actions")]),_:3})):I("",!0)]),_:3},16,["class"]))}}),gL=te({__name:"Skeleton",props:{variant:{default:"shiny"},aspectRatio:{},width:{},height:{},rounding:{}},setup(t){const e=()=>t.rounding?t.rounding==="full"?"9999px":lp(t.rounding,"rounding"):"initial",n=N(()=>({"--aspect-ratio":!t.aspectRatio||t.width&&t.height?"initial":t.aspectRatio,"--width":t.width||"initial","--height":t.height||"initial","--border-radius":e()}));return(r,i)=>(E(),O("span",{class:Ce(["k-skeleton",`k-skeleton--variant-${r.variant}`]),style:Cr(n.value)},[P(r.$slots,"default")],6))}});function RE(t,e){if(!t){e(void 0);return}e({width:t.offsetWidth,height:t.offsetHeight});const n=t.ownerDocument.defaultView??window,r=new n.ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const[o]=i;let s,a;if("borderBoxSize"in o){const l=o.borderBoxSize,u=Array.isArray(l)?l[0]:l;s=u.inlineSize,a=u.blockSize}else s=t.offsetWidth,a=t.offsetHeight;e({width:s,height:a})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}function PE(t){const{getNodes:e,observeMutation:n=!0,callback:r}=t,i=[];let o=null;function s(){const a=e();o=a[0];const l=a.map((u,c)=>RE(u,d=>{r(d,c)}));i.push(...l)}if(s(),n){const a=FE(o,s);i.push(a)}return()=>{i.forEach(a=>{a?.()})}}function FE(t,e){var n;if(!t||!t.parentElement)return;const r=((n=t.ownerDocument)==null?void 0:n.defaultView)??window,i=new r.MutationObserver(()=>{e()});return i.observe(t.parentElement,{childList:!0}),()=>{i.disconnect()}}var LE=Ln("slider").parts("root","label","thumb","valueText","track","range","control","markerGroup","marker","draggingIndicator"),an=LE.build(),Lv=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`slider:${t.id}`},Vv=(t,e)=>{var n,r;return((r=(n=t.ids)==null?void 0:n.thumb)==null?void 0:r.call(n,e))??`slider:${t.id}:thumb:${e}`},Xc=(t,e)=>{var n,r;return((r=(n=t.ids)==null?void 0:n.hiddenInput)==null?void 0:r.call(n,e))??`slider:${t.id}:input:${e}`},Bv=t=>{var e;return((e=t.ids)==null?void 0:e.control)??`slider:${t.id}:control`},VE=t=>{var e;return((e=t.ids)==null?void 0:e.track)??`slider:${t.id}:track`},BE=t=>{var e;return((e=t.ids)==null?void 0:e.range)??`slider:${t.id}:range`},rf=t=>{var e;return((e=t.ids)==null?void 0:e.label)??`slider:${t.id}:label`},$E=t=>{var e;return((e=t.ids)==null?void 0:e.valueText)??`slider:${t.id}:value-text`},jE=(t,e)=>{var n,r;return((r=(n=t.ids)==null?void 0:n.marker)==null?void 0:r.call(n,e))??`slider:${t.id}:marker:${e}`},zE=t=>t.getById(Lv(t)),HE=(t,e)=>t.getById(Vv(t,e)),$v=(t,e)=>t.getById(Xc(t,e)),jv=t=>t.getById(Bv(t)),zv=t=>gp(jv(t),"[role=slider]"),qE=t=>zv(t)[0],of=(t,e)=>{const{prop:n,scope:r}=t,i=jv(r);if(!i)return;const o=Sx(e,i).getPercentValue({orientation:n("orientation"),dir:n("dir"),inverted:{y:!0}});return wv(o,n("min"),n("max"),n("step"))},WE=(t,e)=>{e.forEach((n,r)=>{const i=$v(t,r);i&&gx(i,{value:n})})};function UE(t){const e=t[0],n=t[t.length-1];return[e,n]}function KE(t){const{prop:e,computed:n}=t,r=n("valuePercent"),[i,o]=UE(r);if(r.length===1){if(e("origin")==="center"){const s=r[0]<50,a=s?`${r[0]}%`:"50%",l=s?"50%":`${100-r[0]}%`;return{start:a,end:l}}return{start:"0%",end:`${100-o}%`}}return{start:`${i}%`,end:`${100-o}%`}}function GE(t){const{computed:e}=t,n=e("isVertical"),r=e("isRtl");return n?{position:"absolute",bottom:"var(--slider-range-start)",top:"var(--slider-range-end)"}:{position:"absolute",[r?"right":"left"]:"var(--slider-range-start)",[r?"left":"right"]:"var(--slider-range-end)"}}function JE(t,e){const{context:n,prop:r}=t,{height:i=0}=n.get("thumbSize")??{},o=Uc([r("min"),r("max")],[-i/2,i/2]);return parseFloat(o(e).toFixed(2))}function XE(t,e){const{computed:n,context:r,prop:i}=t,{width:o=0}=r.get("thumbSize")??{};if(n("isRtl")){const a=Uc([i("max"),i("min")],[-o/2,o/2]);return-1*parseFloat(a(e).toFixed(2))}const s=Uc([i("min"),i("max")],[-o/2,o/2]);return parseFloat(s(e).toFixed(2))}function YE(t,e,n){const{computed:r,prop:i}=t;if(i("thumbAlignment")==="center")return`${e}%`;const o=r("isVertical")?JE(t,n):XE(t,n);return`calc(${e}% - ${o}px)`}function Hv(t,e){const{prop:n}=t,r=kp(e,n("min"),n("max"))*100;return YE(t,r,e)}function qv(t){const{computed:e,prop:n}=t;let r="visible";return n("thumbAlignment")==="contain"&&!e("hasMeasuredThumbSize")&&(r="hidden"),r}function sf(t,e){const{computed:n}=t,r=n("isVertical")?"bottom":"insetInlineStart";return{visibility:qv(t),position:"absolute",transform:"var(--slider-thumb-transform)",[r]:`var(--slider-thumb-offset-${e})`}}function ZE(){return{touchAction:"none",userSelect:"none",WebkitUserSelect:"none",position:"relative"}}function QE(t){const{context:e,computed:n}=t,r=n("isVertical"),i=n("isRtl"),o=KE(t);return{...e.get("value").reduce((s,a,l)=>{const u=Hv(t,a);return{...s,[`--slider-thumb-offset-${l}`]:u}},{}),"--slider-thumb-transform":r?"translateY(50%)":i?"translateX(50%)":"translateX(-50%)","--slider-range-start":o.start,"--slider-range-end":o.end}}function eC(t,e){const{computed:n}=t,r=n("isHorizontal"),i=n("isRtl");return{visibility:qv(t),position:"absolute",pointerEvents:"none",[r?"insetInlineStart":"bottom"]:Hv(t,e),translate:"var(--tx) var(--ty)","--tx":r?i?"50%":"-50%":"0%","--ty":r?"0%":"50%"}}function tC(){return{userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none",position:"relative"}}function nC(t,e){return e.map((n,r)=>Yc(t,n,r))}function hr(t,e){const{context:n,prop:r}=t;return u1(n.get("value"),r("min"),r("max"),r("minStepsBetweenThumbs"))[e]}function Yc(t,e,n){const{prop:r}=t,i=hr(t,n),o=xv(e,r("min"),r("max"),r("step"));return Ql(o,i.min,i.max)}function rC(t,e,n){const{context:r,prop:i}=t,o=e??r.get("focusedIndex"),s=hr(t,o),a=a1(o,{...s,step:n??i("step"),values:r.get("value")});return a[o]=Ql(a[o],s.min,s.max),a}function iC(t,e,n){const{context:r,prop:i}=t,o=e??r.get("focusedIndex"),s=hr(t,o),a=s1(o,{...s,step:n??i("step"),values:r.get("value")});return a[o]=Ql(a[o],s.min,s.max),a}function oC(t,e){const{context:n}=t;return l1(n.get("value"),e)}function Wv(t,e){const{state:n,send:r,context:i,prop:o,computed:s,scope:a}=t,l=o("aria-label"),u=o("aria-labelledby"),c=i.get("value"),d=i.get("focusedIndex"),h=n.matches("focus"),p=n.matches("dragging"),f=s("isDisabled"),m=o("invalid"),g=s("isInteractive"),y=o("orientation")==="horizontal",b=o("orientation")==="vertical";function k(w){return kp(w,o("min"),o("max"))}function v(w){return wv(w,o("min"),o("max"),o("step"))}return{value:c,dragging:p,focused:h,setValue(w){r({type:"SET_VALUE",value:w})},getThumbValue(w){return c[w]},setThumbValue(w,x){r({type:"SET_VALUE",index:w,value:x})},getValuePercent:k,getPercentValue:v,getThumbPercent(w){return k(c[w])},setThumbPercent(w,x){const T=v(x);r({type:"SET_VALUE",index:w,value:T})},getThumbMin(w){return hr(t,w).min},getThumbMax(w){return hr(t,w).max},increment(w){r({type:"INCREMENT",index:w})},decrement(w){r({type:"DECREMENT",index:w})},focus(){g&&r({type:"FOCUS",index:0})},getLabelProps(){return e.label({...an.label.attrs,dir:o("dir"),"data-disabled":G(f),"data-orientation":o("orientation"),"data-invalid":G(m),"data-dragging":G(p),"data-focus":G(h),id:rf(a),htmlFor:Xc(a,0),onClick(w){var x;g&&(w.preventDefault(),(x=qE(a))==null||x.focus())},style:{userSelect:"none",WebkitUserSelect:"none"}})},getRootProps(){return e.element({...an.root.attrs,"data-disabled":G(f),"data-orientation":o("orientation"),"data-dragging":G(p),"data-invalid":G(m),"data-focus":G(h),id:Lv(a),dir:o("dir"),style:QE(t)})},getValueTextProps(){return e.element({...an.valueText.attrs,dir:o("dir"),"data-disabled":G(f),"data-orientation":o("orientation"),"data-invalid":G(m),"data-focus":G(h),id:$E(a)})},getTrackProps(){return e.element({...an.track.attrs,dir:o("dir"),id:VE(a),"data-disabled":G(f),"data-invalid":G(m),"data-dragging":G(p),"data-orientation":o("orientation"),"data-focus":G(h),style:{position:"relative"}})},getThumbProps(w){var x;const{index:T=0,name:F}=w,D=c[T],C=hr(t,T),_=(x=o("getAriaValueText"))==null?void 0:x({value:D,index:T}),L=Array.isArray(l)?l[T]:l,W=Array.isArray(u)?u[T]:u;return e.element({...an.thumb.attrs,dir:o("dir"),"data-index":T,"data-name":F,id:Vv(a,T),"data-disabled":G(f),"data-orientation":o("orientation"),"data-focus":G(h&&d===T),"data-dragging":G(p&&d===T),draggable:!1,"aria-disabled":jw(f),"aria-label":L,"aria-labelledby":W??rf(a),"aria-orientation":o("orientation"),"aria-valuemax":C.max,"aria-valuemin":C.min,"aria-valuenow":c[T],"aria-valuetext":_,role:"slider",tabIndex:f?void 0:0,style:sf(t,T),onPointerDown(q){g&&(r({type:"THUMB_POINTER_DOWN",index:T}),q.stopPropagation())},onBlur(){g&&r({type:"BLUR"})},onFocus(){g&&r({type:"FOCUS",index:T})},onKeyDown(q){if(q.defaultPrevented||!g)return;const K=fx(q)*o("step"),J={ArrowUp(){y||r({type:"ARROW_INC",step:K,src:"ArrowUp"})},ArrowDown(){y||r({type:"ARROW_DEC",step:K,src:"ArrowDown"})},ArrowLeft(){b||r({type:"ARROW_DEC",step:K,src:"ArrowLeft"})},ArrowRight(){b||r({type:"ARROW_INC",step:K,src:"ArrowRight"})},PageUp(){r({type:"ARROW_INC",step:K,src:"PageUp"})},PageDown(){r({type:"ARROW_DEC",step:K,src:"PageDown"})},Home(){r({type:"HOME"})},End(){r({type:"END"})}},ue=iv(q,{dir:o("dir"),orientation:o("orientation")}),ge=J[ue];ge&&(ge(q),q.preventDefault(),q.stopPropagation())}})},getHiddenInputProps(w){const{index:x=0,name:T}=w;return e.input({name:T??(o("name")?o("name")+(c.length>1?"[]":""):void 0),form:o("form"),type:"text",hidden:!0,defaultValue:c[x],id:Xc(a,x)})},getRangeProps(){return e.element({id:BE(a),...an.range.attrs,dir:o("dir"),"data-dragging":G(p),"data-focus":G(h),"data-invalid":G(m),"data-disabled":G(f),"data-orientation":o("orientation"),style:GE(t)})},getControlProps(){return e.element({...an.control.attrs,dir:o("dir"),id:Bv(a),"data-dragging":G(p),"data-disabled":G(f),"data-orientation":o("orientation"),"data-invalid":G(m),"data-focus":G(h),style:ZE(),onPointerDown(w){if(!g||!ax(w)||ux(w))return;const x=pp(w);r({type:"POINTER_DOWN",point:x}),w.preventDefault(),w.stopPropagation()}})},getMarkerGroupProps(){return e.element({...an.markerGroup.attrs,role:"presentation",dir:o("dir"),"aria-hidden":!0,"data-orientation":o("orientation"),style:tC()})},getMarkerProps(w){const x=eC(t,w.value);let T;return w.value<vv(c)?T="under-value":w.value>yv(c)?T="over-value":T="at-value",e.element({...an.marker.attrs,id:jE(a,w.value),role:"presentation",dir:o("dir"),"data-orientation":o("orientation"),"data-value":w.value,"data-disabled":G(f),"data-state":T,style:x})},getDraggingIndicatorProps(w){const{index:x=0}=w,T=x===d&&p;return e.element({...an.draggingIndicator.attrs,role:"presentation",dir:o("dir"),hidden:!T,"data-orientation":o("orientation"),"data-state":T?"open":"closed",style:sf(t,x)})}}}var sC=(t,e)=>t?.width===e?.width&&t?.height===e?.height,Uv={props({props:t}){return{dir:"ltr",thumbAlignment:"contain",min:0,max:100,step:1,defaultValue:[0],origin:"start",orientation:"horizontal",minStepsBetweenThumbs:0,...t}},initialState(){return"idle"},context({prop:t,bindable:e,getContext:n}){return{thumbSize:e(()=>({defaultValue:t("thumbSize")||null})),value:e(()=>({defaultValue:t("defaultValue"),value:t("value"),hash(r){return r.join(",")},onChange(r){var i;(i=t("onValueChange"))==null||i({value:r})}})),focusedIndex:e(()=>({defaultValue:-1,onChange(r){var i;const o=n();(i=t("onFocusChange"))==null||i({focusedIndex:r,value:o.get("value")})}})),fieldsetDisabled:e(()=>({defaultValue:!1}))}},computed:{isHorizontal:({prop:t})=>t("orientation")==="horizontal",isVertical:({prop:t})=>t("orientation")==="vertical",isRtl:({prop:t})=>t("orientation")==="horizontal"&&t("dir")==="rtl",isDisabled:({context:t,prop:e})=>!!e("disabled")||t.get("fieldsetDisabled"),isInteractive:({prop:t,computed:e})=>!(t("readOnly")||e("isDisabled")),hasMeasuredThumbSize:({context:t})=>t.get("thumbSize")!=null,valuePercent({context:t,prop:e}){return t.get("value").map(n=>100*kp(n,e("min"),e("max")))}},watch({track:t,action:e,context:n}){t([()=>n.hash("value")],()=>{e(["syncInputElements","dispatchChangeEvent"])})},effects:["trackFormControlState","trackThumbsSize"],on:{SET_VALUE:[{guard:"hasIndex",actions:["setValueAtIndex"]},{actions:["setValue"]}],INCREMENT:{actions:["incrementThumbAtIndex"]},DECREMENT:{actions:["decrementThumbAtIndex"]}},states:{idle:{on:{POINTER_DOWN:{target:"dragging",actions:["setClosestThumbIndex","setPointerValue","focusActiveThumb"]},FOCUS:{target:"focus",actions:["setFocusedIndex"]},THUMB_POINTER_DOWN:{target:"dragging",actions:["setFocusedIndex","focusActiveThumb"]}}},focus:{entry:["focusActiveThumb"],on:{POINTER_DOWN:{target:"dragging",actions:["setClosestThumbIndex","setPointerValue","focusActiveThumb"]},THUMB_POINTER_DOWN:{target:"dragging",actions:["setFocusedIndex","focusActiveThumb"]},ARROW_DEC:{actions:["decrementThumbAtIndex","invokeOnChangeEnd"]},ARROW_INC:{actions:["incrementThumbAtIndex","invokeOnChangeEnd"]},HOME:{actions:["setFocusedThumbToMin","invokeOnChangeEnd"]},END:{actions:["setFocusedThumbToMax","invokeOnChangeEnd"]},BLUR:{target:"idle",actions:["clearFocusedIndex"]}}},dragging:{entry:["focusActiveThumb"],effects:["trackPointerMove"],on:{POINTER_UP:{target:"focus",actions:["invokeOnChangeEnd"]},POINTER_MOVE:{actions:["setPointerValue"]}}}},implementations:{guards:{hasIndex:({event:t})=>t.index!=null},effects:{trackFormControlState({context:t,scope:e}){return Yl(zE(e),{onFieldsetDisabledChange(n){t.set("fieldsetDisabled",n)},onFormReset(){t.set("value",t.initial("value"))}})},trackPointerMove({scope:t,send:e}){return Mx(t.getDoc(),{onPointerMove(n){e({type:"POINTER_MOVE",point:n.point})},onPointerUp(){e({type:"POINTER_UP"})}})},trackThumbsSize({context:t,scope:e,prop:n}){if(!(n("thumbAlignment")!=="contain"||t.get("thumbSize")))return PE({getNodes:()=>zv(e),observeMutation:!0,callback(r){!r||sC(t.get("thumbSize"),r)||t.set("thumbSize",r)}})}},actions:{dispatchChangeEvent({context:t,scope:e}){WE(e,t.get("value"))},syncInputElements({context:t,scope:e}){t.get("value").forEach((n,r)=>{const i=$v(e,r);sv(i,n.toString())})},invokeOnChangeEnd({prop:t,context:e}){var n;(n=t("onValueChangeEnd"))==null||n({value:e.get("value")})},setClosestThumbIndex(t){const{context:e,event:n}=t,r=of(t,n.point);if(r==null)return;const i=oC(t,r);e.set("focusedIndex",i)},setFocusedIndex({context:t,event:e}){t.set("focusedIndex",e.index)},clearFocusedIndex({context:t}){t.set("focusedIndex",-1)},setPointerValue(t){queueMicrotask(()=>{const{context:e,event:n}=t,r=of(t,n.point);if(r==null)return;const i=e.get("focusedIndex"),o=Yc(t,r,i);e.set("value",s=>To(s,i,o))})},focusActiveThumb({scope:t,context:e}){At(()=>{const n=HE(t,e.get("focusedIndex"));n?.focus({preventScroll:!0})})},decrementThumbAtIndex(t){const{context:e,event:n}=t,r=rC(t,n.index,n.step);e.set("value",r)},incrementThumbAtIndex(t){const{context:e,event:n}=t,r=iC(t,n.index,n.step);e.set("value",r)},setFocusedThumbToMin(t){const{context:e}=t,n=e.get("focusedIndex"),{min:r}=hr(t,n);e.set("value",i=>To(i,n,r))},setFocusedThumbToMax(t){const{context:e}=t,n=e.get("focusedIndex"),{max:r}=hr(t,n);e.set("value",i=>To(i,n,r))},setValueAtIndex(t){const{context:e,event:n}=t,r=Yc(t,n.value,n.index);e.set("value",i=>To(i,n.index,r))},setValue(t){const{context:e,event:n}=t,r=nC(t,n.value);e.set("value",r)}}}};Wn()(["aria-label","aria-labelledby","dir","disabled","form","getAriaValueText","getRootNode","id","ids","invalid","max","min","minStepsBetweenThumbs","name","onFocusChange","onValueChange","onValueChangeEnd","orientation","origin","readOnly","step","thumbAlignment","thumbAlignment","thumbSize","value","defaultValue"]);Wn()(["index","name"]);const aC=["data-value"],lC=te({__name:"RangeSlider",props:{modelValue:{},min:{default:0},max:{default:100},step:{default:1},minStepsBetweenThumbs:{},marker:{},markerFormat:{},format:{type:Function,default:()=>t=>t},getRootNode:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=pi(Uv,{id:Qt(),...n,defaultValue:n.modelValue,onValueChangeEnd:({value:l})=>{const[u,c]=[o.value.getThumbMin(0),o.value.getThumbMax(0)],[d,h]=[o.value.getThumbMin(1),o.value.getThumbMax(1)],p=Math.max(u,Math.min(c,l[0])),f=Math.min(h,Math.max(d,l[1]));n.modelValue[0]===p&&n.modelValue[1]===f||r("update:modelValue",[p,f])}}),o=N(()=>Wv(i,di)),s=l=>{const[u,c]=[o.value.getThumbMin(0),o.value.getThumbMax(0)],[d,h]=[o.value.getThumbMin(1),o.value.getThumbMax(1)],[p,f]=[o.value.getThumbValue(0),o.value.getThumbValue(1)],[m,g]=l;if(m===p&&g===f)return;const y=Math.max(u,Math.min(c,m)),b=Math.min(h,Math.max(d,g));return p===y&&f===b?r("update:modelValue",[y,b]):o.value.setValue([y,b])},a=N(()=>{if(!n.marker)return[];const l=Math.floor(n.max/n.marker)+1;return Array(l).fill(void 0).map((u,c)=>{const d=(n.marker||0)*c;return{value:d,label:n.markerFormat?n.markerFormat(d):n.format(d)}})});return Ee(()=>n.modelValue,s,{deep:!0}),(l,u)=>(E(),O("div",ne(o.value.getRootProps(),{class:"k-rangeslider"}),[H("div",be(Ne(o.value.getControlProps())),[H("div",be(Ne(o.value.getTrackProps())),[H("div",be(Ne(o.value.getRangeProps())),null,16)],16),(E(!0),O(Ie,null,_t(o.value.value,(c,d)=>(E(),O("div",ne({key:d,ref_for:!0},o.value.getThumbProps({index:d})),[H("input",ne({ref_for:!0},o.value.getHiddenInputProps({index:d})),null,16)],16))),128))],16),a.value.length?(E(),O("div",be(ne({key:0},o.value.getMarkerGroupProps())),[(E(!0),O(Ie,null,_t(a.value,c=>(E(),O("span",ne({ref_for:!0},o.value.getMarkerProps({value:c.value}),{"data-value":c.label}),null,16,aC))),256))],16)):I("",!0)],16))}}),uC=["data-value"],vL=te({__name:"Slider",props:{modelValue:{},min:{default:0},max:{default:100},step:{default:1},marker:{},format:{type:Function,default:()=>t=>t},markerFormat:{},markerHighlight:{type:Boolean,default:!1},getRootNode:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=pi(Uv,{id:Qt(),...n,defaultValue:[n.modelValue],onValueChange:({value:l})=>{r("update:modelValue",l[0])}}),o=N(()=>Wv(i,di)),s=l=>o.value.setValue([Math.max(n.min||l,Math.min(n.max||l,l))]),a=N(()=>{const l=c=>n.markerFormat?n.markerFormat(c):n.format(c);if(!n.marker)return[];if(n.marker instanceof Array)return n.marker.map(c=>({value:c,label:l(c)}));const u=Math.floor((n.max-n.min)/n.marker)+1;return Array(u).fill(void 0).map((c,d)=>{const h=n.min+n.marker*d;return{value:h,label:l(h)}})});return Ee(()=>n.modelValue,s,{deep:!0}),(l,u)=>(E(),O("div",ne(o.value.getRootProps(),{class:["k-slider",{"k-slider--marker-highlight":l.markerHighlight}]}),[H("div",be(Ne(o.value.getControlProps())),[H("div",be(Ne(o.value.getTrackProps())),[H("div",be(Ne(o.value.getRangeProps())),null,16)],16),H("div",be(Ne(o.value.getThumbProps({index:0}))),[H("input",be(Ne(o.value.getHiddenInputProps({index:0}))),null,16)],16),H("output",be(Ne(o.value.getValueTextProps())),[P(l.$slots,"value",{value:o.value.value},()=>[$e(se(l.format(o.value.value.at(0))),1)])],16)],16),a.value.length?(E(),O("div",be(ne({key:0},o.value.getMarkerGroupProps())),[(E(!0),O(Ie,null,_t(a.value,c=>(E(),O("span",ne({ref_for:!0},o.value.getMarkerProps({value:c.value}),{"data-value":c.label}),null,16,uC))),256))],16)):I("",!0)],16))}}),Zc=Math.min,Fi=Math.max,Ka=Math.round,Qs=Math.floor,gn=t=>({x:t,y:t}),cC={left:"right",right:"left",bottom:"top",top:"bottom"},dC={start:"end",end:"start"};function Sp(t,e){return typeof t=="function"?t(e):t}function Wi(t){return t.split("-")[0]}function au(t){return t.split("-")[1]}function pC(t){return t==="x"?"y":"x"}function Kv(t){return t==="y"?"height":"width"}function as(t){return["top","bottom"].includes(Wi(t))?"y":"x"}function Gv(t){return pC(as(t))}function hC(t,e,n){n===void 0&&(n=!1);const r=au(t),i=Gv(t),o=Kv(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=Ga(s)),[s,Ga(s)]}function fC(t){const e=Ga(t);return[Qc(t),e,Qc(e)]}function Qc(t){return t.replace(/start|end/g,e=>dC[e])}function mC(t,e,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?o:s;default:return[]}}function gC(t,e,n,r){const i=au(t);let o=mC(Wi(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(Qc)))),o}function Ga(t){return t.replace(/left|right|bottom|top/g,e=>cC[e])}function vC(t){return{top:0,right:0,bottom:0,left:0,...t}}function yC(t){return typeof t!="number"?vC(t):{top:t,right:t,bottom:t,left:t}}function Ja(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function af(t,e,n){let{reference:r,floating:i}=t;const o=as(e),s=Gv(e),a=Kv(s),l=Wi(e),u=o==="y",c=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:c,y:r.y-i.height};break;case"bottom":p={x:c,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(au(e)){case"start":p[s]-=h*(n&&u?-1:1);break;case"end":p[s]+=h*(n&&u?-1:1);break}return p}const bC=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(e));let u=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:c,y:d}=af(u,r,l),h=r,p={},f=0;for(let m=0;m<a.length;m++){const{name:g,fn:y}=a[m],{x:b,y:k,data:v,reset:w}=await y({x:c,y:d,initialPlacement:r,placement:h,strategy:i,middlewareData:p,rects:u,platform:s,elements:{reference:t,floating:e}});c=b??c,d=k??d,p={...p,[g]:{...p[g],...v}},w&&f<=50&&(f++,typeof w=="object"&&(w.placement&&(h=w.placement),w.rects&&(u=w.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):w.rects),{x:c,y:d}=af(u,h,l)),m=-1)}return{x:c,y:d,placement:h,strategy:i,middlewareData:p}};async function kC(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=t,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:h=!1,padding:p=0}=Sp(e,t),f=yC(p),m=a[h?d==="floating"?"reference":"floating":d],g=Ja(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(m)))==null||n?m:m.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:u,rootBoundary:c,strategy:l})),y=d==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,b=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),k=await(o.isElement==null?void 0:o.isElement(b))?await(o.getScale==null?void 0:o.getScale(b))||{x:1,y:1}:{x:1,y:1},v=Ja(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:b,strategy:l}):y);return{top:(g.top-v.top+f.top)/k.y,bottom:(v.bottom-g.bottom+f.bottom)/k.y,left:(g.left-v.left+f.left)/k.x,right:(v.right-g.right+f.right)/k.x}}const wC=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:u}=e,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:m=!0,...g}=Sp(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const y=Wi(i),b=as(a),k=Wi(a)===a,v=await(l.isRTL==null?void 0:l.isRTL(u.floating)),w=h||(k||!m?[Ga(a)]:fC(a)),x=f!=="none";!h&&x&&w.push(...gC(a,m,f,v));const T=[a,...w],F=await kC(e,g),D=[];let C=((r=o.flip)==null?void 0:r.overflows)||[];if(c&&D.push(F[y]),d){const q=hC(i,s,v);D.push(F[q[0]],F[q[1]])}if(C=[...C,{placement:i,overflows:D}],!D.every(q=>q<=0)){var _,L;const q=(((_=o.flip)==null?void 0:_.index)||0)+1,K=T[q];if(K)return{data:{index:q,overflows:C},reset:{placement:K}};let J=(L=C.filter(ue=>ue.overflows[0]<=0).sort((ue,ge)=>ue.overflows[1]-ge.overflows[1])[0])==null?void 0:L.placement;if(!J)switch(p){case"bestFit":{var W;const ue=(W=C.filter(ge=>{if(x){const Te=as(ge.placement);return Te===b||Te==="y"}return!0}).map(ge=>[ge.placement,ge.overflows.filter(Te=>Te>0).reduce((Te,mt)=>Te+mt,0)]).sort((ge,Te)=>ge[1]-Te[1])[0])==null?void 0:W[0];ue&&(J=ue);break}case"initialPlacement":J=a;break}if(i!==J)return{reset:{placement:J}}}return{}}}};async function xC(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=Wi(n),a=au(n),l=as(n)==="y",u=["left","top"].includes(s)?-1:1,c=o&&l?-1:1,d=Sp(e,t);let{mainAxis:h,crossAxis:p,alignmentAxis:f}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof f=="number"&&(p=a==="end"?f*-1:f),l?{x:p*c,y:h*u}:{x:h*u,y:p*c}}const EC=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=e,l=await xC(e,t);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}};function lu(){return typeof window<"u"}function lo(t){return Jv(t)?(t.nodeName||"").toLowerCase():"#document"}function Dt(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Sn(t){var e;return(e=(Jv(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Jv(t){return lu()?t instanceof Node||t instanceof Dt(t).Node:!1}function en(t){return lu()?t instanceof Element||t instanceof Dt(t).Element:!1}function bn(t){return lu()?t instanceof HTMLElement||t instanceof Dt(t).HTMLElement:!1}function lf(t){return!lu()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Dt(t).ShadowRoot}function As(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=tn(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function CC(t){return["table","td","th"].includes(lo(t))}function uu(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Tp(t){const e=Op(),n=en(t)?tn(t):t;return["transform","translate","scale","rotate","perspective"].some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function SC(t){let e=wr(t);for(;bn(e)&&!Ui(e);){if(Tp(e))return e;if(uu(e))return null;e=wr(e)}return null}function Op(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ui(t){return["html","body","#document"].includes(lo(t))}function tn(t){return Dt(t).getComputedStyle(t)}function cu(t){return en(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function wr(t){if(lo(t)==="html")return t;const e=t.assignedSlot||t.parentNode||lf(t)&&t.host||Sn(t);return lf(e)?e.host:e}function Xv(t){const e=wr(t);return Ui(e)?t.ownerDocument?t.ownerDocument.body:t.body:bn(e)&&As(e)?e:Xv(e)}function ls(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=Xv(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=Dt(i);if(o){const a=ed(s);return e.concat(s,s.visualViewport||[],As(i)?i:[],a&&n?ls(a):[])}return e.concat(i,ls(i,[],n))}function ed(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Yv(t){const e=tn(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=bn(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,a=Ka(n)!==o||Ka(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function Ap(t){return en(t)?t:t.contextElement}function Li(t){const e=Ap(t);if(!bn(e))return gn(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=Yv(e);let s=(o?Ka(n.width):n.width)/r,a=(o?Ka(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const TC=gn(0);function Zv(t){const e=Dt(t);return!Op()||!e.visualViewport?TC:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function OC(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Dt(t)?!1:e}function ri(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=Ap(t);let s=gn(1);e&&(r?en(r)&&(s=Li(r)):s=Li(t));const a=OC(o,n,r)?Zv(o):gn(0);let l=(i.left+a.x)/s.x,u=(i.top+a.y)/s.y,c=i.width/s.x,d=i.height/s.y;if(o){const h=Dt(o),p=r&&en(r)?Dt(r):r;let f=h,m=ed(f);for(;m&&r&&p!==f;){const g=Li(m),y=m.getBoundingClientRect(),b=tn(m),k=y.left+(m.clientLeft+parseFloat(b.paddingLeft))*g.x,v=y.top+(m.clientTop+parseFloat(b.paddingTop))*g.y;l*=g.x,u*=g.y,c*=g.x,d*=g.y,l+=k,u+=v,f=Dt(m),m=ed(f)}}return Ja({width:c,height:d,x:l,y:u})}function Mp(t,e){const n=cu(t).scrollLeft;return e?e.left+n:ri(Sn(t)).left+n}function Qv(t,e,n){n===void 0&&(n=!1);const r=t.getBoundingClientRect(),i=r.left+e.scrollLeft-(n?0:Mp(t,r)),o=r.top+e.scrollTop;return{x:i,y:o}}function AC(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const o=i==="fixed",s=Sn(r),a=e?uu(e.floating):!1;if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},u=gn(1);const c=gn(0),d=bn(r);if((d||!d&&!o)&&((lo(r)!=="body"||As(s))&&(l=cu(r)),bn(r))){const p=ri(r);u=Li(r),c.x=p.x+r.clientLeft,c.y=p.y+r.clientTop}const h=s&&!d&&!o?Qv(s,l,!0):gn(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+c.x+h.x,y:n.y*u.y-l.scrollTop*u.y+c.y+h.y}}function MC(t){return Array.from(t.getClientRects())}function _C(t){const e=Sn(t),n=cu(t),r=t.ownerDocument.body,i=Fi(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=Fi(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Mp(t);const a=-n.scrollTop;return tn(r).direction==="rtl"&&(s+=Fi(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function DC(t,e){const n=Dt(t),r=Sn(t),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const u=Op();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a,y:l}}function NC(t,e){const n=ri(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=bn(t)?Li(t):gn(1),s=t.clientWidth*o.x,a=t.clientHeight*o.y,l=i*o.x,u=r*o.y;return{width:s,height:a,x:l,y:u}}function uf(t,e,n){let r;if(e==="viewport")r=DC(t,n);else if(e==="document")r=_C(Sn(t));else if(en(e))r=NC(e,n);else{const i=Zv(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Ja(r)}function ey(t,e){const n=wr(t);return n===e||!en(n)||Ui(n)?!1:tn(n).position==="fixed"||ey(n,e)}function IC(t,e){const n=e.get(t);if(n)return n;let r=ls(t,[],!1).filter(a=>en(a)&&lo(a)!=="body"),i=null;const o=tn(t).position==="fixed";let s=o?wr(t):t;for(;en(s)&&!Ui(s);){const a=tn(s),l=Tp(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&i&&["absolute","fixed"].includes(i.position)||As(s)&&!l&&ey(t,s))?r=r.filter(u=>u!==s):i=a,s=wr(s)}return e.set(t,r),r}function RC(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?uu(e)?[]:IC(e,this._c):[].concat(n),r],s=o[0],a=o.reduce((l,u)=>{const c=uf(e,u,i);return l.top=Fi(c.top,l.top),l.right=Zc(c.right,l.right),l.bottom=Zc(c.bottom,l.bottom),l.left=Fi(c.left,l.left),l},uf(e,s,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function PC(t){const{width:e,height:n}=Yv(t);return{width:e,height:n}}function FC(t,e,n){const r=bn(e),i=Sn(e),o=n==="fixed",s=ri(t,!0,o,e);let a={scrollLeft:0,scrollTop:0};const l=gn(0);if(r||!r&&!o)if((lo(e)!=="body"||As(i))&&(a=cu(e)),r){const h=ri(e,!0,o,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else i&&(l.x=Mp(i));const u=i&&!r&&!o?Qv(i,a):gn(0),c=s.left+a.scrollLeft-l.x-u.x,d=s.top+a.scrollTop-l.y-u.y;return{x:c,y:d,width:s.width,height:s.height}}function zu(t){return tn(t).position==="static"}function cf(t,e){if(!bn(t)||tn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Sn(t)===n&&(n=n.ownerDocument.body),n}function ty(t,e){const n=Dt(t);if(uu(t))return n;if(!bn(t)){let i=wr(t);for(;i&&!Ui(i);){if(en(i)&&!zu(i))return i;i=wr(i)}return n}let r=cf(t,e);for(;r&&CC(r)&&zu(r);)r=cf(r,e);return r&&Ui(r)&&zu(r)&&!Tp(r)?n:r||SC(t)||n}const LC=async function(t){const e=this.getOffsetParent||ty,n=this.getDimensions,r=await n(t.floating);return{reference:FC(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function VC(t){return tn(t).direction==="rtl"}const td={convertOffsetParentRelativeRectToViewportRelativeRect:AC,getDocumentElement:Sn,getClippingRect:RC,getOffsetParent:ty,getElementRects:LC,getClientRects:MC,getDimensions:PC,getScale:Li,isElement:en,isRTL:VC};function ny(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function BC(t,e){let n=null,r;const i=Sn(t);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const u=t.getBoundingClientRect(),{left:c,top:d,width:h,height:p}=u;if(a||e(),!h||!p)return;const f=Qs(d),m=Qs(i.clientWidth-(c+h)),g=Qs(i.clientHeight-(d+p)),y=Qs(c),b={rootMargin:-f+"px "+-m+"px "+-g+"px "+-y+"px",threshold:Fi(0,Zc(1,l))||1};let k=!0;function v(w){const x=w[0].intersectionRatio;if(x!==l){if(!k)return s();x?s(!1,x):r=setTimeout(()=>{s(!1,1e-7)},1e3)}x===1&&!ny(u,t.getBoundingClientRect())&&s(),k=!1}try{n=new IntersectionObserver(v,{...b,root:i.ownerDocument})}catch{n=new IntersectionObserver(v,b)}n.observe(t)}return s(!0),o}function $C(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=Ap(t),c=i||o?[...u?ls(u):[],...ls(e)]:[];c.forEach(y=>{i&&y.addEventListener("scroll",n,{passive:!0}),o&&y.addEventListener("resize",n)});const d=u&&a?BC(u,n):null;let h=-1,p=null;s&&(p=new ResizeObserver(y=>{let[b]=y;b&&b.target===u&&p&&(p.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=p)==null||k.observe(e)})),n()}),u&&!l&&p.observe(u),p.observe(e));let f,m=l?ri(t):null;l&&g();function g(){const y=ri(t);m&&!ny(m,y)&&n(),m=y,f=requestAnimationFrame(g)}return n(),()=>{var y;c.forEach(b=>{i&&b.removeEventListener("scroll",n),o&&b.removeEventListener("resize",n)}),d?.(),(y=p)==null||y.disconnect(),p=null,l&&cancelAnimationFrame(f)}}const jC=EC,zC=wC,HC=(t,e,n)=>{const r=new Map,i={platform:td,...n},o={...i.platform,_c:r};return bC(t,e,{...i,platform:o})};function qC(t){return WC(t)}function Hu(t){return t.assignedSlot?t.assignedSlot:t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}function WC(t){for(let e=t;e;e=Hu(e))if(e instanceof Element&&getComputedStyle(e).display==="none")return null;for(let e=Hu(t);e;e=Hu(e)){if(!(e instanceof Element))continue;const n=getComputedStyle(e);if(n.display!=="contents"&&(n.position!=="static"||n.filter!=="none"||e.tagName==="BODY"))return e}return null}const du=te({inheritAttrs:!1,__name:"Dropdown",props:{items:{},placement:{default:"bottom-start"},teleport:{type:Boolean,default:!1},keepOpen:{type:Boolean,default:!1},theme:{default:"border"},teleportTo:{default:"body"},offset:{default:8},variant:{},size:{},loading:{type:Boolean},promise:{},confirm:{type:Boolean},is:{},stateTimeout:{},confirmLabel:{},label:{},icon:{},iconLeft:{},iconRight:{default:"fa-pro-regular:angle-down"}},setup(t,{expose:e}){const n=t,r=N(()=>{const{items:v,placement:w,teleport:x,keepOpen:T,...F}=n;return F}),i=X(!1),o=tu(),s=X(),a=X(),l=X({top:"",left:"",position:""});let u=()=>{};function c(){!s.value||!a.value||(u=$C(s.value.$el,a.value,()=>{!s.value||!a.value||HC(s.value.$el,a.value,{placement:n.placement,middleware:[jC(n.offset),zC()],platform:{...td,getOffsetParent:v=>td.getOffsetParent(v,qC)}}).then(({x:v,y:w})=>{l.value={top:`${w}px`,left:`${v}px`,position:"absolute"}})}))}ao(u),Rg(()=>{if(i.value)return c();u()});const d=({target:v},w="dom")=>{if(v instanceof Element&&!(!s.value||!a.value)){if(w==="dom")return[s.value.$el,a.value].some(x=>x&&(v===x||x.contains(v)))?void 0:p(!1);if(w==="shadow-dom"){const x=o.value.getRootNode();return v.shadowRoot===x?void 0:p(!1)}}},h=({key:v})=>v==="Escape"&&p(!1),p=(v=!i.value)=>(v?b():k(),i.value=v,!0),f=N(()=>o.value.getRootNode()),m=N(()=>f.value instanceof ShadowRoot);function g(v){d(v,"dom")}function y(v){d(v,"shadow-dom")}function b(){window.addEventListener("keydown",h),m.value?(f.value.addEventListener("click",g),window.addEventListener("click",y)):window.addEventListener("click",g)}function k(){window.removeEventListener("keydown",h),m.value?(f.value.removeEventListener("click",g),window.removeEventListener("click",y)):window.removeEventListener("click",g)}return e({isOpen:i}),(v,w)=>(E(),O(Ie,null,[he(ze,ne({...r.value,...v.$attrs},{onClick:w[0]||(w[0]=()=>p()),ref_key:"trigger",ref:s,class:["k-dropdown-trigger",{"k-dropdown-trigger--open":!!i.value}]}),Cs({_:2},[v.$slots["icon-left"]?{name:"icon-left",fn:Z(()=>[P(v.$slots,"icon-left")]),key:"0"}:void 0,v.$slots.trigger?{name:"default",fn:Z(()=>[P(v.$slots,"trigger")]),key:"1"}:void 0,v.$slots["icon-right"]?{name:"icon-right",fn:Z(()=>[P(v.$slots,"icon-right")]),key:"2"}:void 0]),1040,["class"]),(E(),B(Pg,{to:v.teleportTo,disabled:!v.teleport},[he(ep,{name:"k-dropdown"},{default:Z(()=>[i.value?(E(),O("div",{key:0,class:Ce(`k-dropdown k-dropdown--theme-${v.theme}`),style:Cr(l.value),ref_key:"content",ref:a,onClick:w[1]||(w[1]=()=>!v.keepOpen&&p(!1))},[P(v.$slots,"default",{close:p.bind(null,!1)},()=>[(E(!0),O(Ie,null,_t(v.items,({action:x,icon:T,...F})=>(E(),B(ze,ne({ref_for:!0},F,{variant:"tertiary","icon-right":F.iconRight||T,onClick:()=>x()}),null,16,["icon-right","onClick"]))),256))])],6)):I("",!0)]),_:3})],8,["to","disabled"]))],64))}}),UC={key:0,class:"k-datatable__row"},KC={key:0,class:"k-datatable__cell k-datatable__cell-select"},GC=["data-col-id","onClick"],JC=["innerHTML"],XC={key:1,class:"k-datatable__cell k-datatable__cell-actions"},YC={key:0,class:"k-datatable__cell k-datatable__cell-select"},ZC={key:1,class:"k-datatable__cell k-datatable__cell-actions"},QC={key:0,class:"k-datatable__footer"},yL=te({__name:"DataTable",props:{items:{},selected:{},theme:{default:"default"},header:{type:Boolean,default:!0},sticky:{type:[Boolean,String]},sortBy:{},sortableBy:{default:()=>[]},isDisabled:{type:Function,default:()=>!1},columns:{},labels:{default:()=>({selection:"Valgt",resetSelection:"Tilbakestill valg"})},cellWrapper:{type:Function,default:()=>({component:"div"})},rowWrapper:{type:Function,default:()=>({component:"div"})}},emits:["update:selected","update:sortBy"],setup(t,{emit:e}){const n=t,r=np(),i=e,o=X([-1]),s=N(()=>n.items.filter(f=>!n.isDisabled(f))),a=N(()=>!!n.selected),l=N(()=>!!(Object.keys(n.sortBy||{}).length&&n.sortableBy.length)),u=N(()=>!!r.rowActions),c=N({get:()=>!!(s.value.length&&s.value.every(f=>n.selected&&n.selected.includes(f))),set:f=>i("update:selected",f?[...s.value]:[])}),d=N(()=>[a.value?"2.5rem":!1,...n.columns.filter(({disabled:f})=>!f).map(f=>f.size||"auto"),u.value?"0px":!1].filter(Boolean).join(" "));function h(f){var m;if(!l.value||!n.sortableBy.includes(f))return;let g=((m=n.sortBy)==null?void 0:m[f])||-1;i("update:sortBy",{[f]:g*-1})}function p(f,m){if(!f.isTrusted||!(f.target instanceof HTMLInputElement))return;let g=o.value.slice(-1).pop()||-1,y=[];if(f.shiftKey){let b=g>m,k=g+(b?-1:1);for(;b?k>m:k<m;){let v=n.items[k];!(n.selected||[]).includes(v)&&!n.isDisabled(v)&&y.push(v),b?k--:k++}}f.target.checked?o.value.push(m):g===m&&o.value.pop(),i("update:selected",[...n.selected||[],...y])}return(f,m)=>(E(),O("div",{class:Ce([`k-datatable k-datatable--${f.theme}`,{"k-datatable--sticky":!!f.sticky,"k-datatable--no-header":!f.header}]),style:Cr(`--k-datatable-layout: ${d.value}; --k-datatable-sticky-top: ${typeof f.sticky=="string"?f.sticky:"0"}`)},[f.header?(E(),O("div",UC,[a.value?(E(),O("div",KC,[he(Yh,{class:"k-datatable__checkbox",modelValue:c.value,"onUpdate:modelValue":m[0]||(m[0]=g=>c.value=g),disabled:!f.items.length},null,8,["modelValue","disabled"])])):I("",!0),(E(!0),O(Ie,null,_t(f.columns.filter(({disabled:g})=>!g),g=>(E(),O("div",{class:Ce(["k-datatable__cell",`k-datatable__cell--text-align-${g.align||"start"}`,{"k-datatable__cell-sort":l.value&&f.sortableBy.includes(g.id),"k-datatable__cell-sort--active":g.id in(f.sortBy||{})}]),key:g.id,"data-col-id":g.id,onClick:y=>h(g.id)},[P(f.$slots,`${g.id}-label`,{item:g},()=>[H("span",{innerHTML:g.label},null,8,JC)]),he($(Ze),{class:"k-datatable__cell-sort-icon",icon:(f.sortBy||{})[g.id]<0?"fa-pro-solid:caret-up":"fa-pro-solid:caret-down"},null,8,["icon"])],10,GC))),128)),u.value?(E(),O("div",XC)):I("",!0)])):I("",!0),(E(!0),O(Ie,null,_t(f.items,(g,y)=>(E(),O("div",{class:"k-datatable__row",key:f.sortBy?g?.id||$(Qt)():y},[a.value?(E(),O("div",YC,[he(Yh,{class:"k-datatable__checkbox","model-value":f.selected||[],"onUpdate:modelValue":m[1]||(m[1]=b=>i("update:selected",b)),value:g,onMousedown:m[2]||(m[2]=Ba(()=>{},["prevent"])),onClick:b=>p(b,y),disabled:f.isDisabled(g)},null,8,["model-value","value","onClick","disabled"])])):I("",!0),(E(),B(Qe(f.rowWrapper(g).component),ne({class:"k-datatable__row-wrapper",ref_for:!0},f.rowWrapper(g).bind,Vg(f.rowWrapper(g).listeners)),{default:Z(()=>[(E(!0),O(Ie,null,_t(f.columns.filter(({disabled:b})=>!b),(b,k)=>(E(),B(Qe(f.cellWrapper(g,b).component),ne({ref_for:!0},f.cellWrapper(g,b).bind,{class:`k-datatable__cell k-datatable__cell--text-align-${b.align||"start"}`,key:`col-${b.id}`,"data-cell-id":b.id}),{default:Z(()=>[P(f.$slots,b.id,{item:g,column:b,rowIndex:y,colIndex:k})]),_:2},1040,["class","data-cell-id"]))),128))]),_:2},1040)),f.$slots["row-actions"]?(E(),O("div",ZC,[P(f.$slots,"row-actions",{item:g})])):I("",!0)]))),128)),he(ep,{name:"k-datatable-footer"},{default:Z(()=>{var g,y;return[f.$slots.footer||(g=f.selected)!=null&&g.length?(E(),O("div",QC,[(y=f.selected)!=null&&y.length?(E(),B(du,{key:0,label:`${f.labels.selection} (${f.selected.length})`,teleport:!0},{default:Z(()=>[P(f.$slots,"select-actions"),he(ze,{label:f.labels.resetSelection,"icon-right":"fa-pro-light:times-square",variant:"tertiary",onClick:m[3]||(m[3]=b=>i("update:selected",[]))},null,8,["label"])]),_:3},8,["label"])):I("",!0),P(f.$slots,"footer")])):I("",!0)]}),_:3})],6))}});var nd,Br=new Map,eS=t=>t.getBoundingClientRect();function tS(t,e){const{scope:n="rect",getRect:r=eS,onChange:i}=e,o=nS({scope:n,getRect:r}),s=Br.get(t);return s?(s.callbacks.push(i),i(r(t))):(Br.set(t,{rect:{},callbacks:[i]}),Br.size===1&&(nd=requestAnimationFrame(o))),function(){const a=Br.get(t);if(!a)return;const l=a.callbacks.indexOf(i);l>-1&&a.callbacks.splice(l,1),a.callbacks.length===0&&(Br.delete(t),Br.size===0&&cancelAnimationFrame(nd))}}function nS(t){const{scope:e,getRect:n}=t,r=iS(e);return function i(){const o=[];Br.forEach((s,a)=>{const l=n(a);r(s.rect,l)||(s.rect=l,o.push(s))}),o.forEach(s=>{s.callbacks.forEach(a=>a(s.rect))}),nd=requestAnimationFrame(i)}}var ry=(t,e)=>t.width===e.width&&t.height===e.height,iy=(t,e)=>t.top===e.top&&t.left===e.left,rS=(t,e)=>ry(t,e)&&iy(t,e);function iS(t){return t==="size"?ry:t==="position"?iy:rS}var oS=Ln("radio-group").parts("root","label","item","itemText","itemControl","indicator"),ki=oS.build(),Xa=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`radio-group:${t.id}`},df=t=>{var e;return((e=t.ids)==null?void 0:e.label)??`radio-group:${t.id}:label`},oy=(t,e)=>{var n,r;return((r=(n=t.ids)==null?void 0:n.item)==null?void 0:r.call(n,e))??`radio-group:${t.id}:radio:${e}`},pf=(t,e)=>{var n,r;return((r=(n=t.ids)==null?void 0:n.itemHiddenInput)==null?void 0:r.call(n,e))??`radio-group:${t.id}:radio:input:${e}`},sS=(t,e)=>{var n,r;return((r=(n=t.ids)==null?void 0:n.itemControl)==null?void 0:r.call(n,e))??`radio-group:${t.id}:radio:control:${e}`},aS=(t,e)=>{var n,r;return((r=(n=t.ids)==null?void 0:n.itemLabel)==null?void 0:r.call(n,e))??`radio-group:${t.id}:radio:label:${e}`},sy=t=>{var e;return((e=t.ids)==null?void 0:e.indicator)??`radio-group:${t.id}:indicator`},pu=t=>t.getById(Xa(t)),lS=t=>t.getById(sy(t)),uS=t=>{var e;return(e=pu(t))==null?void 0:e.querySelector("input:not(:disabled)")},cS=t=>{var e;return(e=pu(t))==null?void 0:e.querySelector("input:not(:disabled):checked")},hf=t=>{const e=`input[type=radio][data-ownedby='${CSS.escape(Xa(t))}']:not([disabled])`;return gp(pu(t),e)},dS=(t,e)=>{if(e)return t.getById(oy(t,e))},pS=t=>({left:t?.offsetLeft??0,top:t?.offsetTop??0,width:t?.offsetWidth??0,height:t?.offsetHeight??0}),hS=t=>({width:`${t.width}px`,height:`${t.height}px`,left:`${t.left}px`,top:`${t.top}px`});function fS(t,e){const{context:n,send:r,computed:i,prop:o,scope:s}=t,a=i("isDisabled"),l=o("readOnly");function u(h){return{invalid:!!h.invalid,disabled:!!h.disabled||a,checked:n.get("value")===h.value,focused:n.get("focusedValue")===h.value,hovered:n.get("hoveredValue")===h.value,active:n.get("activeValue")===h.value}}function c(h){const p=u(h);return{"data-focus":G(p.focused),"data-focus-visible":G(p.focused&&n.get("focusVisible")),"data-disabled":G(p.disabled),"data-readonly":G(l),"data-state":p.checked?"checked":"unchecked","data-hover":G(p.hovered),"data-invalid":G(p.invalid),"data-orientation":o("orientation"),"data-ssr":G(n.get("ssr"))}}const d=()=>{const h=cS(s);if(h){h.focus();return}const p=uS(s);p?.focus()};return{focus:d,value:n.get("value"),setValue(h){r({type:"SET_VALUE",value:h,isTrusted:!1})},clearValue(){r({type:"SET_VALUE",value:null,isTrusted:!1})},getRootProps(){return e.element({...ki.root.attrs,role:"radiogroup",id:Xa(s),"aria-labelledby":df(s),"data-orientation":o("orientation"),"data-disabled":G(a),"aria-orientation":o("orientation"),dir:o("dir"),style:{position:"relative"}})},getLabelProps(){return e.element({...ki.label.attrs,dir:o("dir"),"data-orientation":o("orientation"),"data-disabled":G(a),id:df(s),onClick:d})},getItemState:u,getItemProps(h){const p=u(h);return e.label({...ki.item.attrs,dir:o("dir"),id:oy(s,h.value),htmlFor:pf(s,h.value),...c(h),onPointerMove(){p.disabled||p.hovered||r({type:"SET_HOVERED",value:h.value,hovered:!0})},onPointerLeave(){p.disabled||r({type:"SET_HOVERED",value:null})},onPointerDown(f){p.disabled||(p.focused&&f.pointerType==="mouse"&&f.preventDefault(),r({type:"SET_ACTIVE",value:h.value,active:!0}))},onPointerUp(){p.disabled||r({type:"SET_ACTIVE",value:null})}})},getItemTextProps(h){return e.element({...ki.itemText.attrs,dir:o("dir"),id:aS(s,h.value),...c(h)})},getItemControlProps(h){const p=u(h);return e.element({...ki.itemControl.attrs,dir:o("dir"),id:sS(s,h.value),"data-active":G(p.active),"aria-hidden":!0,...c(h)})},getItemHiddenInputProps(h){const p=u(h);return e.input({"data-ownedby":Xa(s),id:pf(s,h.value),type:"radio",name:o("name")||o("id"),form:o("form"),value:h.value,onClick(f){if(l){f.preventDefault();return}f.currentTarget.checked&&r({type:"SET_VALUE",value:h.value,isTrusted:!0})},onBlur(){r({type:"SET_FOCUSED",value:null,focused:!1,focusVisible:!1})},onFocus(){const f=is();r({type:"SET_FOCUSED",value:h.value,focused:!0,focusVisible:f})},onKeyDown(f){f.defaultPrevented||f.key===" "&&r({type:"SET_ACTIVE",value:h.value,active:!0})},onKeyUp(f){f.defaultPrevented||f.key===" "&&r({type:"SET_ACTIVE",value:null})},disabled:p.disabled,defaultChecked:p.checked,style:vp})},getIndicatorProps(){const h=n.get("indicatorRect");return e.element({id:sy(s),...ki.indicator.attrs,dir:o("dir"),hidden:n.get("value")==null,"data-disabled":G(a),"data-orientation":o("orientation"),style:{"--transition-property":"left, top, width, height","--left":h?.left,"--top":h?.top,"--width":h?.width,"--height":h?.height,position:"absolute",willChange:"var(--transition-property)",transitionProperty:"var(--transition-property)",transitionDuration:n.get("canIndicatorTransition")?"var(--transition-duration, 150ms)":"0ms",transitionTimingFunction:"var(--transition-timing-function)",[o("orientation")==="horizontal"?"left":"top"]:o("orientation")==="horizontal"?"var(--left)":"var(--top)"}})}}}var{not:mS}=eu(),gS={props({props:t}){return{orientation:"vertical",...t}},initialState(){return"idle"},context({prop:t,bindable:e}){return{value:e(()=>({defaultValue:t("defaultValue"),value:t("value"),onChange(n){var r;(r=t("onValueChange"))==null||r({value:n})}})),activeValue:e(()=>({defaultValue:null})),focusedValue:e(()=>({defaultValue:null})),hoveredValue:e(()=>({defaultValue:null})),indicatorRect:e(()=>({defaultValue:{}})),canIndicatorTransition:e(()=>({defaultValue:!1})),fieldsetDisabled:e(()=>({defaultValue:!1})),focusVisible:e(()=>({defaultValue:!1})),ssr:e(()=>({defaultValue:!0}))}},refs(){return{indicatorCleanup:null}},computed:{isDisabled:({prop:t,context:e})=>!!t("disabled")||e.get("fieldsetDisabled")},entry:["syncIndicatorRect","syncSsr"],exit:["cleanupObserver"],effects:["trackFormControlState","trackFocusVisible"],watch({track:t,action:e,context:n}){t([()=>n.get("value")],()=>{e(["setIndicatorTransition","syncIndicatorRect","syncInputElements"])})},on:{SET_VALUE:[{guard:mS("isTrusted"),actions:["setValue","dispatchChangeEvent"]},{actions:["setValue"]}],SET_HOVERED:{actions:["setHovered"]},SET_ACTIVE:{actions:["setActive"]},SET_FOCUSED:{actions:["setFocused"]}},states:{idle:{}},implementations:{guards:{isTrusted:({event:t})=>!!t.isTrusted},effects:{trackFormControlState({context:t,scope:e}){return Yl(pu(e),{onFieldsetDisabledChange(n){t.set("fieldsetDisabled",n)},onFormReset(){t.set("value",t.initial("value"))}})},trackFocusVisible({scope:t}){var e;return yp({root:(e=t.getRootNode)==null?void 0:e.call(t)})}},actions:{setValue({context:t,event:e}){t.set("value",e.value)},setHovered({context:t,event:e}){t.set("hoveredValue",e.value)},setActive({context:t,event:e}){t.set("activeValue",e.value)},setFocused({context:t,event:e}){t.set("focusedValue",e.value),t.set("focusVisible",e.focusVisible)},syncInputElements({context:t,scope:e}){hf(e).forEach(n=>{n.checked=n.value===t.get("value")})},setIndicatorTransition({context:t}){t.set("canIndicatorTransition",bv(t.get("value")))},cleanupObserver({refs:t}){var e;(e=t.get("indicatorCleanup"))==null||e()},syncSsr({context:t}){t.set("ssr",!1)},syncIndicatorRect({context:t,scope:e,refs:n}){var r;if((r=n.get("indicatorCleanup"))==null||r(),!lS(e))return;const i=t.get("value"),o=dS(e,i);if(i==null||!o){t.set("indicatorRect",{});return}const s=tS(o,{getRect(a){return pS(a)},onChange(a){t.set("indicatorRect",hS(a)),cv(()=>{t.set("canIndicatorTransition",!1)})}});n.set("indicatorCleanup",s)},dispatchChangeEvent({context:t,scope:e}){hf(e).forEach(n=>{const r=n.value===t.get("value");r!==n.checked&&fp(n,{checked:r})})}}}};Wn()(["dir","disabled","form","getRootNode","id","ids","name","onValueChange","orientation","readOnly","value","defaultValue"]);Wn()(["value","disabled","invalid"]);const vS=["aria-describedby"],bL=te({__name:"RadioGroup",props:{label:{},modelValue:{},items:{},variant:{default:"radio"},direction:{default:"vertical"},disabled:{type:Boolean},getRootNode:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=Lg(wp,N(()=>({label:""}))),r=t,i=e,o=pi(gS,{id:Qt(),name:Qt(),...r,defaultValue:r.modelValue,onValueChange:({value:a})=>i("update:modelValue",a)}),s=N(()=>fS(o,di));return Ee(()=>r.modelValue,a=>s.value.setValue(a)),(a,l)=>(E(),O("div",ne({class:["k-radiogroup",`k-radiogroup--variant-${a.variant} k-radiogroup--direction-${a.direction}`]},s.value.getRootProps(),{"aria-describedby":$(n).helpId}),[a.variant==="radio"&&($(n).label||a.label)?(E(),O("span",be(ne({key:0},s.value.getLabelProps())),se($(n).label||a.label),17)):I("",!0),a.variant==="segment"?(E(),O("div",be(ne({key:1},s.value.getIndicatorProps())),null,16)):I("",!0),(E(!0),O(Ie,null,_t(a.items,u=>(E(),O("label",ne({ref_for:!0},s.value.getItemProps({value:u.id})),[H("span",ne({ref_for:!0},s.value.getItemTextProps({value:u.id})),se(u.label),17),H("input",ne({ref_for:!0},s.value.getItemHiddenInputProps({value:u.id})),null,16),H("div",ne({ref_for:!0},s.value.getItemControlProps({value:u.id})),null,16)],16))),256))],16,vS))}}),kL=te({__name:"Grid",props:{is:{default:"div"},columns:{default:1},align:{},rows:{},gap:{default:"default"},areas:{}},setup(t){const e=t,n=(o,s)=>o?typeof o=="number"||typeof o=="string"&&o.match(/^\d+$/)?`repeat(${o}, 1fr)`:o.match(/^(\d+\s?)+$/)?o.split(" ").map(a=>`${a}fr`).join(" "):o:s,r=o=>{if(o)return Array.isArray(o)?o.map(s=>`"${s}"`).join(`
1
+ import{G as ka,q as Q,r as X,e as $,o as E,X as qt,E as Ee,b as D,c as O,i as qn,d as I,z as Va,A as Ig,a as H,n as Ce,g as P,C as $e,t as se,y as Cr,w as Z,j as he,v as B,m as ne,f as Qe,ai as He,H as Lc,I as Rg,ae as fk,V as Qd,R as ep,a3 as mk,a4 as gk,P as vk,J as be,K as Ne,F as Ie,l as _t,D as ao,M as Pg,N as Cs,B as tp,O as Fg,a0 as yk,s as ns,S as np,a1 as kr,a2 as bk,u as Lg,Q as rp,U as kk,W as wk,Z as ip,k as Ba,$ as Vg,a9 as op,L as Co,h as sp,af as xk,Y as Ek,T as Ck}from"./_plugin-vue_export-helper.js";var Sk=Object.defineProperty,Tk=(t,e,n)=>e in t?Sk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Yt=(t,e,n)=>(Tk(t,typeof e!="symbol"?e+"":e,n),n);function Bg(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=Bg(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function Ok(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=Bg(t))&&(r&&(r+=" "),r+=e);return r}const Ah=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Mh=Ok,rn=(t,e)=>n=>{var r;if(e?.variants==null)return Mh(t,n?.class,n?.className);const{variants:i,defaultVariants:o}=e,s=Object.keys(i).map(u=>{const c=n?.[u],d=o?.[u];if(c===null)return null;const h=Ah(c)||Ah(d);return i[u][h]}),a=n&&Object.entries(n).reduce((u,c)=>{let[d,h]=c;return h===void 0||(u[d]=h),u},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((u,c)=>{let{class:d,className:h,...p}=c;return Object.entries(p).every(f=>{let[m,g]=f;return Array.isArray(g)?g.includes({...o,...a}[m]):{...o,...a}[m]===g})?[...u,d,h]:u},[]);return Mh(t,s,l,n?.class,n?.className)},$g=/^[a-z0-9]+(-[a-z0-9]+)*$/,Gl=(t,e,n,r="")=>{const i=t.split(":");if(t.slice(0,1)==="@"){if(i.length<2||i.length>3)return null;r=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){const a=i.pop(),l=i.pop(),u={provider:i.length>0?i[0]:r,prefix:l,name:a};return e&&!wa(u)?null:u}const o=i[0],s=o.split("-");if(s.length>1){const a={provider:r,prefix:s.shift(),name:s.join("-")};return e&&!wa(a)?null:a}if(n&&r===""){const a={provider:r,prefix:"",name:o};return e&&!wa(a,n)?null:a}return null},wa=(t,e)=>t?!!((e&&t.prefix===""||t.prefix)&&t.name):!1,jg=Object.freeze({left:0,top:0,width:16,height:16}),$a=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Jl=Object.freeze({...jg,...$a}),Vc=Object.freeze({...Jl,body:"",hidden:!1});function Ak(t,e){const n={};!t.hFlip!=!e.hFlip&&(n.hFlip=!0),!t.vFlip!=!e.vFlip&&(n.vFlip=!0);const r=((t.rotate||0)+(e.rotate||0))%4;return r&&(n.rotate=r),n}function _h(t,e){const n=Ak(t,e);for(const r in Vc)r in $a?r in t&&!(r in n)&&(n[r]=$a[r]):r in e?n[r]=e[r]:r in t&&(n[r]=t[r]);return n}function Mk(t,e){const n=t.icons,r=t.aliases||Object.create(null),i=Object.create(null);function o(s){if(n[s])return i[s]=[];if(!(s in i)){i[s]=null;const a=r[s]&&r[s].parent,l=a&&o(a);l&&(i[s]=[a].concat(l))}return i[s]}return Object.keys(n).concat(Object.keys(r)).forEach(o),i}function _k(t,e,n){const r=t.icons,i=t.aliases||Object.create(null);let o={};function s(a){o=_h(r[a]||i[a],o)}return s(e),n.forEach(s),_h(t,o)}function zg(t,e){const n=[];if(typeof t!="object"||typeof t.icons!="object")return n;t.not_found instanceof Array&&t.not_found.forEach(i=>{e(i,null),n.push(i)});const r=Mk(t);for(const i in r){const o=r[i];o&&(e(i,_k(t,i,o)),n.push(i))}return n}const Dk={provider:"",aliases:{},not_found:{},...jg};function Lu(t,e){for(const n in e)if(n in t&&typeof t[n]!=typeof e[n])return!1;return!0}function Hg(t){if(typeof t!="object"||t===null)return null;const e=t;if(typeof e.prefix!="string"||!t.icons||typeof t.icons!="object"||!Lu(t,Dk))return null;const n=e.icons;for(const i in n){const o=n[i];if(!i||typeof o.body!="string"||!Lu(o,Vc))return null}const r=e.aliases||Object.create(null);for(const i in r){const o=r[i],s=o.parent;if(!i||typeof s!="string"||!n[s]&&!r[s]||!Lu(o,Vc))return null}return e}const Dh=Object.create(null);function Nk(t,e){return{provider:t,prefix:e,icons:Object.create(null),missing:new Set}}function Hi(t,e){const n=Dh[t]||(Dh[t]=Object.create(null));return n[e]||(n[e]=Nk(t,e))}function qg(t,e){return Hg(e)?zg(e,(n,r)=>{r?t.icons[n]=r:t.missing.add(n)}):[]}function Ik(t,e,n){try{if(typeof n.body=="string")return t.icons[e]={...n},!0}catch{}return!1}let rs=!1;function Wg(t){return typeof t=="boolean"&&(rs=t),rs}function Rk(t){const e=typeof t=="string"?Gl(t,!0,rs):t;if(e){const n=Hi(e.provider,e.prefix),r=e.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function Pk(t,e){const n=Gl(t,!0,rs);if(!n)return!1;const r=Hi(n.provider,n.prefix);return e?Ik(r,n.name,e):(r.missing.add(n.name),!0)}function Fk(t,e){if(typeof t!="object")return!1;if(typeof e!="string"&&(e=t.provider||""),rs&&!e&&!t.prefix){let i=!1;return Hg(t)&&(t.prefix="",zg(t,(o,s)=>{Pk(o,s)&&(i=!0)})),i}const n=t.prefix;if(!wa({prefix:n,name:"a"}))return!1;const r=Hi(e,n);return!!qg(r,t)}const Ug=Object.freeze({width:null,height:null}),Kg=Object.freeze({...Ug,...$a}),Lk=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Vk=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Nh(t,e,n){if(e===1)return t;if(n=n||100,typeof t=="number")return Math.ceil(t*e*n)/n;if(typeof t!="string")return t;const r=t.split(Lk);if(r===null||!r.length)return t;const i=[];let o=r.shift(),s=Vk.test(o);for(;;){if(s){const a=parseFloat(o);isNaN(a)?i.push(o):i.push(Math.ceil(a*e*n)/n)}else i.push(o);if(o=r.shift(),o===void 0)return i.join("");s=!s}}function Bk(t,e="defs"){let n="";const r=t.indexOf("<"+e);for(;r>=0;){const i=t.indexOf(">",r),o=t.indexOf("</"+e);if(i===-1||o===-1)break;const s=t.indexOf(">",o);if(s===-1)break;n+=t.slice(i+1,o).trim(),t=t.slice(0,r).trim()+t.slice(s+1)}return{defs:n,content:t}}function $k(t,e){return t?"<defs>"+t+"</defs>"+e:e}function jk(t,e,n){const r=Bk(t);return $k(r.defs,e+r.content+n)}const zk=t=>t==="unset"||t==="undefined"||t==="none";function Hk(t,e){const n={...Jl,...t},r={...Kg,...e},i={left:n.left,top:n.top,width:n.width,height:n.height};let o=n.body;[n,r].forEach(m=>{const g=[],y=m.hFlip,b=m.vFlip;let k=m.rotate;y?b?k+=2:(g.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),g.push("scale(-1 1)"),i.top=i.left=0):b&&(g.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),g.push("scale(1 -1)"),i.top=i.left=0);let v;switch(k<0&&(k-=Math.floor(k/4)*4),k=k%4,k){case 1:v=i.height/2+i.top,g.unshift("rotate(90 "+v.toString()+" "+v.toString()+")");break;case 2:g.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:v=i.width/2+i.left,g.unshift("rotate(-90 "+v.toString()+" "+v.toString()+")");break}k%2===1&&(i.left!==i.top&&(v=i.left,i.left=i.top,i.top=v),i.width!==i.height&&(v=i.width,i.width=i.height,i.height=v)),g.length&&(o=jk(o,'<g transform="'+g.join(" ")+'">',"</g>"))});const s=r.width,a=r.height,l=i.width,u=i.height;let c,d;s===null?(d=a===null?"1em":a==="auto"?u:a,c=Nh(d,l/u)):(c=s==="auto"?l:s,d=a===null?Nh(c,u/l):a==="auto"?u:a);const h={},p=(m,g)=>{zk(g)||(h[m]=g.toString())};p("width",c),p("height",d);const f=[i.left,i.top,l,u];return h.viewBox=f.join(" "),{attributes:h,viewBox:f,body:o}}const qk=/\sid="(\S+)"/g,Wk="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Uk=0;function Kk(t,e=Wk){const n=[];let r;for(;r=qk.exec(t);)n.push(r[1]);if(!n.length)return t;const i="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(o=>{const s=typeof e=="function"?e(o):e+(Uk++).toString(),a=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replace(new RegExp('([#;"])('+a+')([")]|\\.[a-z])',"g"),"$1"+s+i+"$3")}),t=t.replace(new RegExp(i,"g"),""),t}const Bc=Object.create(null);function Gk(t,e){Bc[t]=e}function $c(t){return Bc[t]||Bc[""]}function ap(t){let e;if(typeof t.resources=="string")e=[t.resources];else if(e=t.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:t.path||"/",maxURL:t.maxURL||500,rotate:t.rotate||750,timeout:t.timeout||5e3,random:t.random===!0,index:t.index||0,dataAfterTimeout:t.dataAfterTimeout!==!1}}const lp=Object.create(null),Js=["https://api.simplesvg.com","https://api.unisvg.com"],jc=[];for(;Js.length>0;)Js.length===1||Math.random()>.5?jc.push(Js.shift()):jc.push(Js.pop());lp[""]=ap({resources:["https://api.iconify.design"].concat(jc)});function Gg(t,e){const n=ap(e);return n===null?!1:(lp[t]=n,!0)}function up(t){return lp[t]}const Jk=()=>{let t;try{if(t=fetch,typeof t=="function")return t}catch{}};let Ih=Jk();function Xk(t,e){const n=up(t);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let i=0;n.resources.forEach(s=>{i=Math.max(i,s.length)});const o=e+".json?icons=";r=n.maxURL-i-n.path.length-o.length}return r}function Yk(t){return t===404}const Zk=(t,e,n)=>{const r=[],i=Xk(t,e),o="icons";let s={type:o,provider:t,prefix:e,icons:[]},a=0;return n.forEach((l,u)=>{a+=l.length+1,a>=i&&u>0&&(r.push(s),s={type:o,provider:t,prefix:e,icons:[]},a=l.length),s.icons.push(l)}),r.push(s),r};function Qk(t){if(typeof t=="string"){const e=up(t);if(e)return e.path}return"/"}const ew=(t,e,n)=>{if(!Ih){n("abort",424);return}let r=Qk(e.provider);switch(e.type){case"icons":{const o=e.prefix,s=e.icons.join(","),a=new URLSearchParams({icons:s});r+=o+".json?"+a.toString();break}case"custom":{const o=e.uri;r+=o.slice(0,1)==="/"?o.slice(1):o;break}default:n("abort",400);return}let i=503;Ih(t+r).then(o=>{const s=o.status;if(s!==200){setTimeout(()=>{n(Yk(s)?"abort":"next",s)});return}return i=501,o.json()}).then(o=>{if(typeof o!="object"||o===null){setTimeout(()=>{o===404?n("abort",o):n("next",i)});return}setTimeout(()=>{n("success",o)})}).catch(()=>{n("next",i)})},tw={prepare:Zk,send:ew};function nw(t){const e={loaded:[],missing:[],pending:[]},n=Object.create(null);t.sort((i,o)=>i.provider!==o.provider?i.provider.localeCompare(o.provider):i.prefix!==o.prefix?i.prefix.localeCompare(o.prefix):i.name.localeCompare(o.name));let r={provider:"",prefix:"",name:""};return t.forEach(i=>{if(r.name===i.name&&r.prefix===i.prefix&&r.provider===i.provider)return;r=i;const o=i.provider,s=i.prefix,a=i.name,l=n[o]||(n[o]=Object.create(null)),u=l[s]||(l[s]=Hi(o,s));let c;a in u.icons?c=e.loaded:s===""||u.missing.has(a)?c=e.missing:c=e.pending;const d={provider:o,prefix:s,name:a};c.push(d)}),e}function Jg(t,e){t.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(i=>i.id!==e))})}function rw(t){t.pendingCallbacksFlag||(t.pendingCallbacksFlag=!0,setTimeout(()=>{t.pendingCallbacksFlag=!1;const e=t.loaderCallbacks?t.loaderCallbacks.slice(0):[];if(!e.length)return;let n=!1;const r=t.provider,i=t.prefix;e.forEach(o=>{const s=o.icons,a=s.pending.length;s.pending=s.pending.filter(l=>{if(l.prefix!==i)return!0;const u=l.name;if(t.icons[u])s.loaded.push({provider:r,prefix:i,name:u});else if(t.missing.has(u))s.missing.push({provider:r,prefix:i,name:u});else return n=!0,!0;return!1}),s.pending.length!==a&&(n||Jg([t],o.id),o.callback(s.loaded.slice(0),s.missing.slice(0),s.pending.slice(0),o.abort))})}))}let iw=0;function ow(t,e,n){const r=iw++,i=Jg.bind(null,n,r);if(!e.pending.length)return i;const o={id:r,icons:e,callback:t,abort:i};return n.forEach(s=>{(s.loaderCallbacks||(s.loaderCallbacks=[])).push(o)}),i}function sw(t,e=!0,n=!1){const r=[];return t.forEach(i=>{const o=typeof i=="string"?Gl(i,e,n):i;o&&r.push(o)}),r}var aw={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function lw(t,e,n,r){const i=t.resources.length,o=t.random?Math.floor(Math.random()*i):t.index;let s;if(t.random){let x=t.resources.slice(0);for(s=[];x.length>1;){const T=Math.floor(Math.random()*x.length);s.push(x[T]),x=x.slice(0,T).concat(x.slice(T+1))}s=s.concat(x)}else s=t.resources.slice(o).concat(t.resources.slice(0,o));const a=Date.now();let l="pending",u=0,c,d=null,h=[],p=[];typeof r=="function"&&p.push(r);function f(){d&&(clearTimeout(d),d=null)}function m(){l==="pending"&&(l="aborted"),f(),h.forEach(x=>{x.status==="pending"&&(x.status="aborted")}),h=[]}function g(x,T){T&&(p=[]),typeof x=="function"&&p.push(x)}function y(){return{startTime:a,payload:e,status:l,queriesSent:u,queriesPending:h.length,subscribe:g,abort:m}}function b(){l="failed",p.forEach(x=>{x(void 0,c)})}function k(){h.forEach(x=>{x.status==="pending"&&(x.status="aborted")}),h=[]}function v(x,T,F){const N=T!=="success";switch(h=h.filter(C=>C!==x),l){case"pending":break;case"failed":if(N||!t.dataAfterTimeout)return;break;default:return}if(T==="abort"){c=F,b();return}if(N){c=F,h.length||(s.length?w():b());return}if(f(),k(),!t.random){const C=t.resources.indexOf(x.resource);C!==-1&&C!==t.index&&(t.index=C)}l="completed",p.forEach(C=>{C(F)})}function w(){if(l!=="pending")return;f();const x=s.shift();if(x===void 0){if(h.length){d=setTimeout(()=>{f(),l==="pending"&&(k(),b())},t.timeout);return}b();return}const T={status:"pending",resource:x,callback:(F,N)=>{v(T,F,N)}};h.push(T),u++,d=setTimeout(w,t.rotate),n(x,e,T.callback)}return setTimeout(w),y}function Xg(t){const e={...aw,...t};let n=[];function r(){n=n.filter(s=>s().status==="pending")}function i(s,a,l){const u=lw(e,s,a,(c,d)=>{r(),l&&l(c,d)});return n.push(u),u}function o(s){return n.find(a=>s(a))||null}return{query:i,find:o,setIndex:s=>{e.index=s},getIndex:()=>e.index,cleanup:r}}function Rh(){}const Vu=Object.create(null);function uw(t){if(!Vu[t]){const e=up(t);if(!e)return;const n=Xg(e),r={config:e,redundancy:n};Vu[t]=r}return Vu[t]}function cw(t,e,n){let r,i;if(typeof t=="string"){const o=$c(t);if(!o)return n(void 0,424),Rh;i=o.send;const s=uw(t);s&&(r=s.redundancy)}else{const o=ap(t);if(o){r=Xg(o);const s=t.resources?t.resources[0]:"",a=$c(s);a&&(i=a.send)}}return!r||!i?(n(void 0,424),Rh):r.query(e,i,n)().abort}function Ph(){}function dw(t){t.iconsLoaderFlag||(t.iconsLoaderFlag=!0,setTimeout(()=>{t.iconsLoaderFlag=!1,rw(t)}))}function pw(t){const e=[],n=[];return t.forEach(r=>{(r.match($g)?e:n).push(r)}),{valid:e,invalid:n}}function vo(t,e,n){function r(){const i=t.pendingIcons;e.forEach(o=>{i&&i.delete(o),t.icons[o]||t.missing.add(o)})}if(n&&typeof n=="object")try{if(!qg(t,n).length){r();return}}catch(i){console.error(i)}r(),dw(t)}function Fh(t,e){t instanceof Promise?t.then(n=>{e(n)}).catch(()=>{e(null)}):e(t)}function hw(t,e){t.iconsToLoad?t.iconsToLoad=t.iconsToLoad.concat(e).sort():t.iconsToLoad=e,t.iconsQueueFlag||(t.iconsQueueFlag=!0,setTimeout(()=>{t.iconsQueueFlag=!1;const{provider:n,prefix:r}=t,i=t.iconsToLoad;if(delete t.iconsToLoad,!i||!i.length)return;const o=t.loadIcon;if(t.loadIcons&&(i.length>1||!o)){Fh(t.loadIcons(i,r,n),u=>{vo(t,i,u)});return}if(o){i.forEach(u=>{const c=o(u,r,n);Fh(c,d=>{const h=d?{prefix:r,icons:{[u]:d}}:null;vo(t,[u],h)})});return}const{valid:s,invalid:a}=pw(i);if(a.length&&vo(t,a,null),!s.length)return;const l=r.match($g)?$c(n):null;if(!l){vo(t,s,null);return}l.prepare(n,r,s).forEach(u=>{cw(n,u,c=>{vo(t,u.icons,c)})})}))}const fw=(t,e)=>{const n=sw(t,!0,Wg()),r=nw(n);if(!r.pending.length){let l=!0;return e&&setTimeout(()=>{l&&e(r.loaded,r.missing,r.pending,Ph)}),()=>{l=!1}}const i=Object.create(null),o=[];let s,a;return r.pending.forEach(l=>{const{provider:u,prefix:c}=l;if(c===a&&u===s)return;s=u,a=c,o.push(Hi(u,c));const d=i[u]||(i[u]=Object.create(null));d[c]||(d[c]=[])}),r.pending.forEach(l=>{const{provider:u,prefix:c,name:d}=l,h=Hi(u,c),p=h.pendingIcons||(h.pendingIcons=new Set);p.has(d)||(p.add(d),i[u][c].push(d))}),o.forEach(l=>{const u=i[l.provider][l.prefix];u.length&&hw(l,u)}),e?ow(e,r,o):Ph};function mw(t,e){const n={...t};for(const r in e){const i=e[r],o=typeof i;r in Ug?(i===null||i&&(o==="string"||o==="number"))&&(n[r]=i):o===typeof n[r]&&(n[r]=r==="rotate"?i%4:i)}return n}const gw=/[\s,]+/;function vw(t,e){e.split(gw).forEach(n=>{switch(n.trim()){case"horizontal":t.hFlip=!0;break;case"vertical":t.vFlip=!0;break}})}function yw(t,e=0){const n=t.replace(/^-?[0-9.]*/,"");function r(i){for(;i<0;)i+=4;return i%4}if(n===""){const i=parseInt(t);return isNaN(i)?0:r(i)}else if(n!==t){let i=0;switch(n){case"%":i=25;break;case"deg":i=90}if(i){let o=parseFloat(t.slice(0,t.length-n.length));return isNaN(o)?0:(o=o/i,o%1===0?r(o):0)}}return e}function bw(t,e){let n=t.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in e)n+=" "+r+'="'+e[r]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+t+"</svg>"}function kw(t){return t.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function ww(t){return"data:image/svg+xml,"+kw(t)}function xw(t){return'url("'+ww(t)+'")'}const Lh={...Kg,inline:!1},Ew={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Cw={display:"inline-block"},zc={backgroundColor:"currentColor"},Yg={backgroundColor:"transparent"},Vh={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Bh={webkitMask:zc,mask:zc,background:Yg};for(const t in Bh){const e=Bh[t];for(const n in Vh)e[t+n]=Vh[n]}const xa={};["horizontal","vertical"].forEach(t=>{const e=t.slice(0,1)+"Flip";xa[t+"-flip"]=e,xa[t.slice(0,1)+"-flip"]=e,xa[t+"Flip"]=e});function $h(t){return t+(t.match(/^[-0-9.]+$/)?"px":"")}const jh=(t,e)=>{const n=mw(Lh,e),r={...Ew},i=e.mode||"svg",o={},s=e.style,a=typeof s=="object"&&!(s instanceof Array)?s:{};for(let m in e){const g=e[m];if(g!==void 0)switch(m){case"icon":case"style":case"onLoad":case"mode":case"ssr":break;case"inline":case"hFlip":case"vFlip":n[m]=g===!0||g==="true"||g===1;break;case"flip":typeof g=="string"&&vw(n,g);break;case"color":o.color=g;break;case"rotate":typeof g=="string"?n[m]=yw(g):typeof g=="number"&&(n[m]=g);break;case"ariaHidden":case"aria-hidden":g!==!0&&g!=="true"&&delete r["aria-hidden"];break;default:{const y=xa[m];y?(g===!0||g==="true"||g===1)&&(n[y]=!0):Lh[m]===void 0&&(r[m]=g)}}}const l=Hk(t,n),u=l.attributes;if(n.inline&&(o.verticalAlign="-0.125em"),i==="svg"){r.style={...o,...a},Object.assign(r,u);let m=0,g=e.id;return typeof g=="string"&&(g=g.replace(/-/g,"_")),r.innerHTML=Kk(l.body,g?()=>g+"ID"+m++:"iconifyVue"),ns("svg",r)}const{body:c,width:d,height:h}=t,p=i==="mask"||(i==="bg"?!1:c.indexOf("currentColor")!==-1),f=bw(c,{...u,width:d+"",height:h+""});return r.style={...o,"--svg":xw(f),width:$h(u.width),height:$h(u.height),...Cw,...p?zc:Yg,...a},ns("span",r)};Wg(!0);Gk("",tw);if(typeof document<"u"&&typeof window<"u"){const t=window;if(t.IconifyPreload!==void 0){const e=t.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!Fk(r))&&console.error(n)}catch{console.error(n)}})}if(t.IconifyProviders!==void 0){const e=t.IconifyProviders;if(typeof e=="object"&&e!==null)for(let n in e){const r="IconifyProviders["+n+"] is invalid.";try{const i=e[n];if(typeof i!="object"||!i||i.resources===void 0)continue;Gg(n,i)||console.error(r)}catch{console.error(r)}}}}const Sw={...Jl,body:""},Ze=Q({inheritAttrs:!1,data(){return{_name:"",_loadingIcon:null,iconMounted:!1,counter:0}},mounted(){this.iconMounted=!0},unmounted(){this.abortLoading()},methods:{abortLoading(){this._loadingIcon&&(this._loadingIcon.abort(),this._loadingIcon=null)},getIcon(t,e,n){if(typeof t=="object"&&t!==null&&typeof t.body=="string")return this._name="",this.abortLoading(),{data:t};let r;if(typeof t!="string"||(r=Gl(t,!1,!0))===null)return this.abortLoading(),null;let i=Rk(r);if(!i)return(!this._loadingIcon||this._loadingIcon.name!==t)&&(this.abortLoading(),this._name="",i!==null&&(this._loadingIcon={name:t,abort:fw([r],()=>{this.counter++})})),null;if(this.abortLoading(),this._name!==t&&(this._name=t,e&&e(t)),n){i=Object.assign({},i);const s=n(i.body,r.name,r.prefix,r.provider);typeof s=="string"&&(i.body=s)}const o=["iconify"];return r.prefix!==""&&o.push("iconify--"+r.prefix),r.provider!==""&&o.push("iconify--"+r.provider),{data:i,classes:o}}},render(){this.counter;const t=this.$attrs,e=this.iconMounted||t.ssr?this.getIcon(t.icon,t.onLoad,t.customise):null;if(!e)return jh(Sw,t);let n=t;return e.classes&&(n={...t,class:(typeof t.class=="string"?t.class+" ":"")+e.classes.join(" ")}),jh({...Jl,...e.data},n)}});Gg("",{resources:["https://icons.ui.kvass.no"]});function Tw(t){return!t||typeof t!="object"?!1:typeof t.then=="function"&&typeof t.catch=="function"}const Ow=["xxs","xs","sm","default","lg","xl","xxl","3xl","4xl"],Aw=(t,e)=>e==="default"?`var(--k-ui-${t})`:`var(--k-ui-${t}-${e})`,ja=t=>{switch(t){case"start":case"end":return`flex-${t}`;default:return t}},cp=(t,e="spacing")=>t.split(" ").map(n=>typeof n=="number"||typeof n=="string"&&n.match(/^\d+$/)?`${n}rem`:typeof n=="string"&&Ow.includes(n)?Aw(e,n):n).join(" ");function Mw(){var t=new Date().getTime(),e=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var r=Math.random()*16;return t>0?(r=(t+r)%16|0,t=Math.floor(t/16)):(r=(e+r)%16|0,e=Math.floor(e/16)),(n==="x"?r:r&3|8).toString(16)})}const Zg=(t,e)=>Object.fromEntries(Object.entries(e).map(([n,r])=>[`--k-${t}-${n}`,r])),_w=function(t){return Object.prototype.toString.call(t)==="[object Object]"};function Dw(t){return Array.isArray(t)}const Qg=Q({__name:"Spinner",props:{size:{default:"medium"}},setup(t){return(e,n)=>(E(),O("span",{class:Ce(`k-spinner k-spinner--size-${e.size}`)},null,2))}}),Nw={class:"k-button__content"},Iw={key:0,class:"k-button__icon k-button__icon--left"},Rw={key:1,class:"k-button__icon k-button__icon--right"},Pw={key:2,class:"k-button__confirm-label"},ze=Q({__name:"Button",props:{variant:{default:"secondary"},size:{default:"medium"},loading:{type:Boolean},promise:{},confirm:{type:Boolean},is:{default:"button"},stateTimeout:{default:1e3},confirmLabel:{default:"Are you sure?"},label:{},icon:{},iconLeft:{},iconRight:{}},emits:["idle","loading","success","error","confirm","click"],setup(t,{emit:e}){const n=t,r=e,i={success:"success",confirm:"warning",error:"danger",loading:null,idle:null},o=D(()=>!h.value||u.value==="loading"?n.variant:u.value=="confirm"?"warning":i[u.value]||n.variant),s=D(()=>n.loading||u.value==="loading"),a=X(),l=D(()=>{if(u.value)return["error","success"].includes(u.value)||s.value}),u=X("idle"),c=X(),d=X(),h=D(()=>u.value||s.value),p=D(()=>["error","success"].includes(u.value)),f=D(()=>u.value==="success"?"fa-pro-regular:check":"fa-pro-regular:exclamation-circle");function m(w){if(!w)return;g(),d.value=w,a.value=setTimeout(()=>u.value="loading",100);let x=T=>{g(),n.stateTimeout?(u.value=T,c.value=setTimeout(()=>{g(),r(T)},n.stateTimeout)):r(T)};d.value.then(()=>x("success")).catch(()=>x("error"))}function g(){a.value&&clearTimeout(a.value),c.value&&clearTimeout(c.value),d.value=null,u.value="idle"}Ee(()=>n.promise,w=>{w&&Tw(w)&&m(w)});const y=X(),b=D(()=>u.value==="confirm");function k(w){if(n.confirm&&u.value!=="confirm")return u.value="confirm";g(),r("click",w)}const v=rn("k-button",{variants:{variant:{primary:"k-button--variant-primary",secondary:"k-button--variant-secondary",tertiary:"k-button--variant-tertiary",danger:"k-button--variant-danger",warning:"k-button--variant-warning",success:"k-button--variant-success"},size:{small:"k-button--size-small",medium:"k-button--size-medium",large:"k-button--size-large"},isLoading:{true:"k-button--loading"},isBusy:{true:"k-button--busy"}}});return(w,x)=>(E(),$(Qe(w.is),ne({type:"button",class:B(v)({variant:o.value,size:w.size,isLoading:s.value,isBusy:l.value}),"aria-busy":l.value,inert:l.value},w.$attrs,{onClick:k,ref_key:"rootElement",ref:y}),{default:Z(()=>[Va(H("span",Nw,[w.icon||w.iconLeft||w.$slots.icon||w.$slots["icon-left"]?(E(),O("span",Iw,[P(w.$slots,"icon-left",{},()=>[P(w.$slots,"icon",{},()=>[he(B(Ze),{icon:w.icon||w.iconLeft},null,8,["icon"])])])])):I("",!0),P(w.$slots,"default",{},()=>[$e(se(w.label),1)]),w.iconRight||w.$slots["icon-right"]?(E(),O("span",Rw,[P(w.$slots,"icon-right",{},()=>[he(B(Ze),{icon:w.iconRight},null,8,["icon"])])])):I("",!0)],512),[[Ig,!b.value]]),s.value?(E(),$(Qg,{key:0})):I("",!0),p.value?(E(),$(B(Ze),{key:1,class:"k-button__state-indicator",icon:f.value},null,8,["icon"])):I("",!0),b.value?(E(),O("span",Pw,se(w.confirmLabel),1)):I("",!0)]),_:3},16,["class","aria-busy","inert"]))}}),Fw={class:"k-alert__content"},Lw={key:0,class:"k-alert__title"},Vw={class:"k-alert__icon"},fL=Q({__name:"Alert",props:{variant:{default:"neutral"},icon:{},title:{},content:{},action:{}},emits:["action"],setup(t,{emit:e}){const n=t,r=e,i=rn("k-alert",{variants:{variant:{success:"k-alert--success",neutral:"k-alert--neutral",info:"k-alert--info",danger:"k-alert--danger",warning:"k-alert--warning",primary:"k-alert--primary"}}}),o={success:"fa-pro-light:circle-check",info:"fa-pro-light:circle-question",warning:"fa-pro-light:exclamation-triangle",danger:"fa-pro-light:exclamation-circle"};return(s,a)=>(E(),O("div",{role:"alert",class:Ce(B(i)({...n}))},[H("div",Fw,[s.title||s.$slots.title?(E(),O("div",Lw,[P(s.$slots,"title",{},()=>[H("strong",null,se(s.title),1)])])):I("",!0),P(s.$slots,"default",{},()=>[H("span",null,se(s.content),1)]),s.action?(E(),$(ze,{key:1,label:s.action,size:"small",class:"k-alert__action",onClick:a[0]||(a[0]=l=>r("action",{event:l,name:s.action}))},null,8,["label"])):I("",!0)]),H("div",Vw,[P(s.$slots,"icon",{},()=>[s.icon||o[s.variant]?(E(),$(B(Ze),{key:0,icon:s.icon||o[s.variant]},null,8,["icon"])):I("",!0)])])],2))}}),Bw={class:"k-badge__label"},mL=Q({__name:"Badge",props:{variant:{default:"neutral"},appearance:{default:"solid"},icon:{},dismissable:{type:Boolean,default:!1},rounded:{type:Boolean,default:!1},label:{}},emits:["dismiss"],setup(t,{emit:e}){const n=t,r=e,i={task:"fa-pro-solid:circle",dot:"fa-pro-solid:circle"},o=rn("k-badge",{variants:{variant:{neutral:"k-badge--variant-neutral",info:"k-badge--variant-info",warning:"k-badge--variant-warning",success:"k-badge--variant-success",danger:"k-badge--variant-danger",primary:"k-badge--variant-primary"},appearance:{solid:"k-badge--appearance-solid",outline:"k-badge--appearance-outline",filled:"k-badge--appearance-filled",task:"k-badge--appearance-task",dot:"k-badge--appearance-dot"},rounded:{true:"k-badge--rounded",false:""}}}),s=X(!1);function a(){s.value=!0,r("dismiss",n)}return(l,u)=>s.value?I("",!0):(E(),O("span",{key:0,class:Ce(B(o)({appearance:l.appearance,variant:l.variant,rounded:l.rounded}))},[P(l.$slots,"icon",{},()=>[l.icon||i[l.appearance]?(E(),$(B(Ze),{key:0,icon:l.icon||i[l.appearance],class:"k-badge__icon"},null,8,["icon"])):I("",!0)]),P(l.$slots,"default",{},()=>[H("span",Bw,se(l.label),1)]),l.dismissable?(E(),O("button",{key:0,class:"k-badge__dismiss",onClick:a},[he(B(Ze),{icon:"fa-pro-light:times"})])):I("",!0)],2))}});var Ln=(t,e=[])=>({parts:(...n)=>{if($w(e))return Ln(t,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>Ln(t,[...e,...n]),rename:n=>Ln(n,e),keys:()=>e,build:()=>[...new Set(e)].reduce((n,r)=>Object.assign(n,{[r]:{selector:[`&[data-scope="${bi(t)}"][data-part="${bi(r)}"]`,`& [data-scope="${bi(t)}"][data-part="${bi(r)}"]`].join(", "),attrs:{"data-scope":bi(t),"data-part":bi(r)}}}),{})}),bi=t=>t.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),$w=t=>t.length===0,zh=t=>Math.max(0,Math.min(1,t)),Bu=(...t)=>e=>t.reduce((n,r)=>r(n),e),Xs=()=>{},Xl=t=>typeof t=="object"&&t!==null,G=t=>t?"":void 0,jw=t=>t?"true":void 0,zw=1,Hw=9,qw=11,dt=t=>Xl(t)&&t.nodeType===zw&&typeof t.nodeName=="string",dp=t=>Xl(t)&&t.nodeType===Hw,Ww=t=>Xl(t)&&t===t.window,ev=t=>dt(t)?t.localName||"":"#document";function Uw(t){return["html","body","#document"].includes(ev(t))}var Kw=t=>Xl(t)&&t.nodeType!==void 0,za=t=>Kw(t)&&t.nodeType===qw&&"host"in t,Gw=t=>dt(t)&&t.localName==="input",Jw=t=>dt(t)?t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0:!1,Xw=/(textarea|select)/;function Yw(t){if(t==null||!dt(t))return!1;try{return Gw(t)&&t.selectionStart!=null||Xw.test(t.localName)||t.isContentEditable||t.getAttribute("contenteditable")==="true"||t.getAttribute("contenteditable")===""}catch{return!1}}function qi(t,e){var n;if(!t||!e||!dt(t)||!dt(e))return!1;const r=(n=e.getRootNode)==null?void 0:n.call(e);if(t===e||t.contains(e))return!0;if(r&&za(r)){let i=e;for(;i;){if(t===i)return!0;i=i.parentNode||i.host}}return!1}function Kt(t){return dp(t)?t:Ww(t)?t.document:t?.ownerDocument??document}function Zw(t){return Kt(t).documentElement}function xt(t){var e;return za(t)?xt(t.host):dp(t)?t.defaultView??window:dt(t)?((e=t.ownerDocument)==null?void 0:e.defaultView)??window:window}function tv(t){let e=t.activeElement;for(;e!=null&&e.shadowRoot;){const n=e.shadowRoot.activeElement;if(n===e)break;e=n}return e}function Qw(t){if(ev(t)==="html")return t;const e=t.assignedSlot||t.parentNode||za(t)&&t.host||Zw(t);return za(e)?e.host:e}var $u=new WeakMap;function ex(t){return $u.has(t)||$u.set(t,xt(t).getComputedStyle(t)),$u.get(t)}var nv=()=>typeof document<"u";function tx(){const t=navigator.userAgentData;return t?.platform??navigator.platform}var pp=t=>nv()&&t.test(tx()),nx=t=>nv()&&t.test(navigator.vendor),rv=()=>pp(/^Mac/),rx=()=>ix()&&nx(/apple/i),ix=()=>pp(/mac|iphone|ipad|ipod/i),hp=()=>pp(/iP(hone|ad|od)|iOS/);function ox(t){var e,n,r;return((e=t.composedPath)==null?void 0:e.call(t))??((r=(n=t.nativeEvent)==null?void 0:n.composedPath)==null?void 0:r.call(n))}function ct(t){const e=ox(t);return e?.[0]??t.target}var sx=t=>qi(t.currentTarget,ct(t)),ax=t=>t.button===0,lx=t=>t.button===2||rv()&&t.ctrlKey&&t.button===0,ux=t=>t.ctrlKey||t.altKey||t.metaKey,cx=t=>"touches"in t&&t.touches.length>0,dx={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},Hh={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};function iv(t,e={}){const{dir:n="ltr",orientation:r="horizontal"}=e;let i=t.key;return i=dx[i]??i,n==="rtl"&&r==="horizontal"&&i in Hh&&(i=Hh[i]),i}var px=new Set(["PageUp","PageDown"]),hx=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function fx(t){return t.ctrlKey||t.metaKey?.1:px.has(t.key)||t.shiftKey&&hx.has(t.key)?10:1}function fp(t,e="client"){const n=cx(t)?t.touches[0]||t.changedTouches[0]:t;return{x:n[`${e}X`],y:n[`${e}Y`]}}var De=(t,e,n,r)=>{const i=typeof t=="function"?t():t;return i?.addEventListener(e,n,r),()=>{i?.removeEventListener(e,n,r)}};function ov(t,e){const{type:n="HTMLInputElement",property:r="value"}=e,i=xt(t)[n].prototype;return Object.getOwnPropertyDescriptor(i,r)??{}}function mx(t){if(t.localName==="input")return"HTMLInputElement";if(t.localName==="textarea")return"HTMLTextAreaElement";if(t.localName==="select")return"HTMLSelectElement"}function sv(t,e,n="value"){var r;if(!t)return;const i=mx(t);i&&((r=ov(t,{type:i,property:n}).set)==null||r.call(t,e)),t.setAttribute(n,e)}function mp(t,e){var n;t&&((n=ov(t,{type:"HTMLInputElement",property:"checked"}).set)==null||n.call(t,e),e?t.setAttribute("checked",""):t.removeAttribute("checked"))}function gx(t,e){const{value:n,bubbles:r=!0}=e;if(!t)return;const i=xt(t);t instanceof i.HTMLInputElement&&(sv(t,`${n}`),t.dispatchEvent(new i.Event("input",{bubbles:r})))}function gp(t,e){const{checked:n,bubbles:r=!0}=e;if(!t)return;const i=xt(t);t instanceof i.HTMLInputElement&&(mp(t,n),t.dispatchEvent(new i.Event("click",{bubbles:r})))}function vx(t){return yx(t)?t.form:t.closest("form")}function yx(t){return t.matches("textarea, input, select, button")}function bx(t,e){if(!t)return;const n=vx(t),r=i=>{i.defaultPrevented||e()};return n?.addEventListener("reset",r,{passive:!0}),()=>n?.removeEventListener("reset",r)}function kx(t,e){const n=t?.closest("fieldset");if(!n)return;e(n.disabled);const r=xt(n),i=new r.MutationObserver(()=>e(n.disabled));return i.observe(n,{attributes:!0,attributeFilter:["disabled"]}),()=>i.disconnect()}function Yl(t,e){if(!t)return;const{onFieldsetDisabledChange:n,onFormReset:r}=e,i=[bx(t,r),kx(t,n)];return()=>i.forEach(o=>o?.())}var av=t=>dt(t)&&t.tagName==="IFRAME",wx=t=>!Number.isNaN(parseInt(t.getAttribute("tabindex")||"0",10)),xx=t=>parseInt(t.getAttribute("tabindex")||"0",10)<0,vp="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type",lv=(t,e=!1)=>{if(!t)return[];const n=Array.from(t.querySelectorAll(vp));(e==!0||e=="if-empty"&&n.length===0)&&dt(t)&&dr(t)&&n.unshift(t);const r=n.filter(dr);return r.forEach((i,o)=>{if(av(i)&&i.contentDocument){const s=i.contentDocument.body;r.splice(o,1,...lv(s))}}),r};function dr(t){return!t||t.closest("[inert]")?!1:t.matches(vp)&&Jw(t)}function uv(t,e){if(!t)return[];const n=Array.from(t.querySelectorAll(vp)),r=n.filter(Vr);return r.forEach((i,o)=>{if(av(i)&&i.contentDocument){const s=i.contentDocument.body,a=uv(s);r.splice(o,1,...a)}}),!r.length&&e?n:r}function Vr(t){return t!=null&&t.tabIndex>0?!0:dr(t)&&!xx(t)}function yo(t){return t.tabIndex<0&&(/^(audio|video|details)$/.test(t.localName)||Yw(t))&&!wx(t)?0:t.tabIndex}function cv(t){const e=new Set;function n(r){const i=globalThis.requestAnimationFrame(r);e.add(()=>globalThis.cancelAnimationFrame(i))}return n(()=>n(t)),function(){e.forEach(r=>r())}}function At(t){let e;const n=globalThis.requestAnimationFrame(()=>{e=t()});return()=>{globalThis.cancelAnimationFrame(n),e?.()}}function Hc(t){const e=Qw(t);return Uw(e)?Kt(e).body:dt(e)&&Cx(e)?e:Hc(e)}var Ex=/auto|scroll|overlay|hidden|clip/;function Cx(t){const e=xt(t),{overflow:n,overflowX:r,overflowY:i,display:o}=e.getComputedStyle(t);return Ex.test(n+i+r)&&!["inline","contents"].includes(o)}function Sx(t,e){const{left:n,top:r,width:i,height:o}=e.getBoundingClientRect(),s={x:t.x-n,y:t.y-r},a={x:zh(s.x/i),y:zh(s.y/o)};function l(u={}){const{dir:c="ltr",orientation:d="horizontal",inverted:h}=u,p=typeof h=="object"?h.x:h,f=typeof h=="object"?h.y:h;return d==="horizontal"?c==="rtl"||p?1-a.x:a.x:f?1-a.y:a.y}return{offset:s,percent:a,getPercentValue:l}}var Di="default",qc="",Ea=new WeakMap;function Tx(t={}){const{target:e,doc:n}=t,r=n??document,i=r.documentElement;return hp()?(Di==="default"&&(qc=i.style.webkitUserSelect,i.style.webkitUserSelect="none"),Di="disabled"):e&&(Ea.set(e,e.style.userSelect),e.style.userSelect="none"),()=>Ox({target:e,doc:r})}function Ox(t={}){const{target:e,doc:n}=t,r=(n??document).documentElement;if(hp()){if(Di!=="disabled")return;Di="restoring",setTimeout(()=>{cv(()=>{Di==="restoring"&&(r.style.webkitUserSelect==="none"&&(r.style.webkitUserSelect=qc||""),qc="",Di="default")})},300)}else if(e&&Ea.has(e)){const i=Ea.get(e);e.style.userSelect==="none"&&(e.style.userSelect=i??""),e.getAttribute("style")===""&&e.removeAttribute("style"),Ea.delete(e)}}function Ax(t={}){const{defer:e,target:n,...r}=t,i=e?At:s=>s(),o=[];return o.push(i(()=>{const s=typeof n=="function"?n():n;o.push(Tx({...r,target:s}))})),()=>{o.forEach(s=>s?.())}}function Mx(t,e){const{onPointerMove:n,onPointerUp:r}=e,i=[De(t,"pointermove",o=>{const s=fp(o),a=Math.sqrt(s.x**2+s.y**2),l=o.pointerType==="touch"?10:5;if(!(a<l)){if(o.pointerType==="mouse"&&o.button===0){r();return}n({point:s,event:o})}},!1),De(t,"pointerup",r,!1),De(t,"pointercancel",r,!1),De(t,"contextmenu",r,!1),Ax({doc:t})];return()=>{i.forEach(o=>o())}}function dv(t){const{pointerNode:e,keyboardNode:n=e,onPress:r,onPressStart:i,onPressEnd:o,isValidKey:s=b=>b.key==="Enter"}=t;if(!e)return Xs;const a=xt(e),l=Kt(e);let u=Xs,c=Xs,d=Xs;const h=b=>({point:fp(b),event:b});function p(b){i?.(h(b))}function f(b){o?.(h(b))}const m=De(e,"pointerdown",b=>{c();const k=De(a,"pointerup",w=>{const x=ct(w);qi(e,x)?r?.(h(w)):o?.(h(w))},{passive:!r,once:!0}),v=De(a,"pointercancel",f,{passive:!o,once:!0});c=Bu(k,v),l.activeElement===n&&b.pointerType==="mouse"&&b.preventDefault(),p(b)},{passive:!i}),g=De(n,"focus",y);u=Bu(m,g);function y(){const b=x=>{if(!s(x))return;const T=N=>{if(!s(N))return;const C=new a.PointerEvent("pointerup"),_=h(C);r?.(_),o?.(_)};c(),c=De(n,"keyup",T);const F=new a.PointerEvent("pointerdown");p(F)},k=()=>{const x=new a.PointerEvent("pointercancel");f(x)},v=De(n,"keydown",b),w=De(n,"blur",k);d=Bu(v,w)}return()=>{u(),c(),d()}}function yp(t,e){return Array.from(t?.querySelectorAll(e)??[])}var pv=t=>t.id;function _x(t,e,n=pv){return t.find(r=>n(r)===e)}function hv(t,e,n=pv){const r=_x(t,e,n);return r?t.indexOf(r):-1}function Dx(t,e,n=!0){let r=hv(t,e);return r=n?(r+1)%t.length:Math.min(r+1,t.length-1),t[r]}function Nx(t,e,n=!0){let r=hv(t,e);return r===-1?n?t[t.length-1]:null:(r=n?(r-1+t.length)%t.length:Math.max(0,r-1),t[r])}var ju=new WeakMap;function Ix(t,e,n){ju.has(t)||ju.set(t,new Map);const r=ju.get(t),i=r.get(e);if(!i)return r.set(e,n()),()=>{var a;(a=r.get(e))==null||a(),r.delete(e)};const o=n(),s=()=>{o(),i(),r.delete(e)};return r.set(e,s),()=>{r.get(e)===s&&(o(),r.set(e,i))}}function Rx(t,e){return t?Ix(t,"style",()=>{const n=t.style.cssText;return Object.assign(t.style,e),()=>{t.style.cssText=n}}):()=>{}}var bp={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"},Px=1e3/60;function Fx(t,e){const n=t();if(dt(n)&&n.isConnected)return e(n),()=>{};{const r=setInterval(()=>{const i=t();dt(i)&&i.isConnected&&(e(i),clearInterval(r))},Px);return()=>clearInterval(r)}}function Lx(t,e){const n=[];return t?.forEach(r=>{const i=Fx(r,e);n.push(i)}),()=>{n.forEach(r=>r())}}function Vx(t){return t.mozInputSource===0&&t.isTrusted?!0:t.detail===0&&!t.pointerType}function Bx(t){return!(t.metaKey||!rv()&&t.altKey||t.ctrlKey||t.key==="Control"||t.key==="Shift"||t.key==="Meta")}var $x=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function jx(t,e,n){const r=n?ct(n):null,i=xt(r);return t=t||r instanceof i.HTMLInputElement&&!$x.has(r?.type)||r instanceof i.HTMLTextAreaElement||r instanceof i.HTMLElement&&r.isContentEditable,!(t&&e==="keyboard"&&n instanceof i.KeyboardEvent&&!Reflect.has(zx,n.key))}var ci=null,Wc=new Set,Lo=new Map,ti=!1,Uc=!1,zx={Tab:!0,Escape:!0};function Zl(t,e){for(let n of Wc)n(t,e)}function Ha(t){ti=!0,Bx(t)&&(ci="keyboard",Zl("keyboard",t))}function Bt(t){ci="pointer",(t.type==="mousedown"||t.type==="pointerdown")&&(ti=!0,Zl("pointer",t))}function fv(t){Vx(t)&&(ti=!0,ci="virtual")}function mv(t){const e=ct(t);e===xt(e)||e===Kt(e)||(!ti&&!Uc&&(ci="virtual",Zl("virtual",t)),ti=!1,Uc=!1)}function gv(){ti=!1,Uc=!0}function Hx(t){if(typeof window>"u"||Lo.get(xt(t)))return;const e=xt(t),n=Kt(t);let r=e.HTMLElement.prototype.focus;e.HTMLElement.prototype.focus=function(){ci="virtual",Zl("virtual",null),ti=!0,r.apply(this,arguments)},n.addEventListener("keydown",Ha,!0),n.addEventListener("keyup",Ha,!0),n.addEventListener("click",fv,!0),e.addEventListener("focus",mv,!0),e.addEventListener("blur",gv,!1),typeof e.PointerEvent<"u"?(n.addEventListener("pointerdown",Bt,!0),n.addEventListener("pointermove",Bt,!0),n.addEventListener("pointerup",Bt,!0)):(n.addEventListener("mousedown",Bt,!0),n.addEventListener("mousemove",Bt,!0),n.addEventListener("mouseup",Bt,!0)),e.addEventListener("beforeunload",()=>{qx(t)},{once:!0}),Lo.set(e,{focus:r})}var qx=(t,e)=>{const n=xt(t),r=Kt(t);Lo.has(n)&&(n.HTMLElement.prototype.focus=Lo.get(n).focus,r.removeEventListener("keydown",Ha,!0),r.removeEventListener("keyup",Ha,!0),r.removeEventListener("click",fv,!0),n.removeEventListener("focus",mv,!0),n.removeEventListener("blur",gv,!1),typeof n.PointerEvent<"u"?(r.removeEventListener("pointerdown",Bt,!0),r.removeEventListener("pointermove",Bt,!0),r.removeEventListener("pointerup",Bt,!0)):(r.removeEventListener("mousedown",Bt,!0),r.removeEventListener("mousemove",Bt,!0),r.removeEventListener("mouseup",Bt,!0)),Lo.delete(n))};function is(){return ci==="keyboard"}function kp(t={}){const{isTextInput:e,autoFocus:n,onChange:r,root:i}=t;Hx(i),r?.({isFocusVisible:n||is(),modality:ci});const o=(s,a)=>{jx(!!e,s,a)&&r?.({isFocusVisible:is(),modality:s})};return Wc.add(o),()=>{Wc.delete(o)}}function Wx(t){return t?Array.isArray(t)?t:[t]:[]}var vv=t=>t[0],yv=t=>t[t.length-1],Ux=(t,e)=>t.indexOf(e)!==-1,Kx=(t,...e)=>t.concat(e),Gx=(t,...e)=>t.filter(n=>!e.includes(n)),Jx=(t,e)=>Ux(t,e)?Gx(t,e):Kx(t,e),qh=t=>t?.constructor.name==="Array",Xx=(t,e)=>{if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Ss(t[n],e[n]))return!1;return!0},Ss=(t,e)=>{if(Object.is(t,e))return!0;if(t==null&&e!=null||t!=null&&e==null)return!1;if(typeof t?.isEqual=="function"&&typeof e?.isEqual=="function")return t.isEqual(e);if(typeof t=="function"&&typeof e=="function")return t.toString()===e.toString();if(qh(t)&&qh(e))return Xx(Array.from(t),Array.from(e));if(typeof t!="object"||typeof e!="object")return!1;const n=Object.keys(e??Object.create(null)),r=n.length;for(let i=0;i<r;i++)if(!Reflect.has(t,n[i]))return!1;for(let i=0;i<r;i++){const o=n[i];if(!Ss(t[o],e[o]))return!1}return!0},Wh=(...t)=>(...e)=>{t.forEach(function(n){n?.(...e)})},Yx=t=>Array.isArray(t),bv=t=>typeof t=="string",Ni=t=>typeof t=="function",Zx=Function.prototype.toString;Zx.call(Object);var{floor:Uh,abs:qa,round:kv,min:Qx,max:e1,pow:t1,sign:n1}=Math,So=t=>Number.isNaN(t),wp=t=>So(t)?0:t,r1=(t,e,n)=>t===0?n:e[t-1],i1=(t,e,n)=>t===e.length-1?n:e[t+1],o1=(t,e,n)=>kv((wp(t)-e)/n)*n+e,Ql=(t,e,n)=>Qx(e1(wp(t),e),n),xp=(t,e,n)=>(wp(t)-e)/(n-e),wv=(t,e,n,r)=>Ql(o1(t*(n-e)+e,e,r),e,n),Ys=(t,e)=>{let n=t,r=e.toString(),i=r.indexOf("."),o=i>=0?r.length-i:0;if(o>0){let s=t1(10,o);n=kv(n*s)/s}return n},xv=(t,e,n,r)=>{e=Number(e),n=Number(n);let i=(t-(So(e)?0:e))%r,o=Ys(qa(i)*2>=r?t+n1(i)*(r-qa(i)):t-i,r);return So(e)?!So(n)&&o>n&&(o=e+Uh(Ys((n-e)/r,r))*r):o<e?o=e:!So(n)&&o>n&&(o=e+Uh(Ys((n-e)/r,r))*r),Ys(o,r)},To=(t,e,n)=>t[e]===n?t:[...t.slice(0,e),n,...t.slice(e+1)];function Ev(t,e){const n=r1(t,e.values,e.min),r=i1(t,e.values,e.max);let i=e.values.slice();return function(o){let s=xv(o,n,r,e.step);return i=To(i,t,o),i[t]=s,i}}function s1(t,e){const n=e.values[t]+e.step;return Ev(t,e)(n)}function a1(t,e){const n=e.values[t]-e.step;return Ev(t,e)(n)}var l1=(t,e)=>{let n=t.findIndex(o=>e-o<0);if(n===0)return n;if(n===-1)return t.length-1;let r=t[n-1],i=t[n];return qa(r-e)<qa(i-e)?n-1:n},u1=(t,e,n,r)=>t.map((i,o)=>({min:o===0?e:t[o-1]+r,max:o===t.length-1?n:t[o+1]-r,value:i})),Kc=(t,e)=>{const[n,r]=t,[i,o]=e;return s=>n===r||i===o?i:i+(o-i)/(r-n)*(s-n)};function Cv(t){if(!c1(t)||t===void 0)return t;const e=Reflect.ownKeys(t).filter(r=>typeof r=="string"),n={};for(const r of e){const i=t[r];i!==void 0&&(n[r]=Cv(i))}return n}var c1=t=>t&&typeof t=="object"&&t.constructor===Object;function Gc(...t){t.length===1?t[0]:t[1],t.length!==2||t[0]}function d1(t,e){if(t==null)throw new Error(e)}function p1(t,e,n){let r=[];for(const i of e)t[i]==null&&r.push(i);if(r.length>0)throw new Error(`[zag-js] missing required props: ${r.join(", ")}`)}function eu(){return{and:(...t)=>function(e){return t.every(n=>e.guard(n))},or:(...t)=>function(e){return t.some(n=>e.guard(n))},not:t=>function(e){return!e.guard(t)}}}function h1(t){const e=()=>{var o;return((o=t.getRootNode)==null?void 0:o.call(t))??document},n=()=>Kt(e()),r=()=>n().defaultView??window,i=()=>tv(e());return{...t,getRootNode:e,getDoc:n,getWin:r,getActiveElement:i,isActiveElement:o=>o===i(),getById:o=>e().getElementById(o)}}function f1(t){return new Proxy({},{get(e,n){return n==="style"?r=>t({style:r}).style:t}})}var Wn=()=>t=>Array.from(new Set(t)),m1=Ln("checkbox").parts("root","label","control","indicator"),Zs=m1.build(),Sv=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`checkbox:${t.id}`},Kh=t=>{var e;return((e=t.ids)==null?void 0:e.label)??`checkbox:${t.id}:label`},g1=t=>{var e;return((e=t.ids)==null?void 0:e.control)??`checkbox:${t.id}:control`},Jc=t=>{var e;return((e=t.ids)==null?void 0:e.hiddenInput)??`checkbox:${t.id}:input`},v1=t=>t.getById(Sv(t)),Oo=t=>t.getById(Jc(t));function y1(t,e){const{send:n,context:r,prop:i,computed:o,scope:s}=t,a=i("disabled"),l=i("readOnly"),u=!a&&r.get("focused"),c=!a&&r.get("focusVisible"),d=o("checked"),h=o("indeterminate"),p={"data-active":G(r.get("active")),"data-focus":G(u),"data-focus-visible":G(c),"data-readonly":G(l),"data-hover":G(r.get("hovered")),"data-disabled":G(a),"data-state":h?"indeterminate":d?"checked":"unchecked","data-invalid":i("invalid")};return{checked:d,disabled:a,indeterminate:h,focused:u,checkedState:d,setChecked(f){n({type:"CHECKED.SET",checked:f,isTrusted:!1})},toggleChecked(){n({type:"CHECKED.TOGGLE",checked:d,isTrusted:!1})},getRootProps(){return e.label({...Zs.root.attrs,...p,dir:i("dir"),id:Sv(s),htmlFor:Jc(s),onPointerMove(){a||n({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){a||n({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(f){ct(f)===Oo(s)&&f.stopPropagation()}})},getLabelProps(){return e.element({...Zs.label.attrs,...p,dir:i("dir"),id:Kh(s)})},getControlProps(){return e.element({...Zs.control.attrs,...p,dir:i("dir"),id:g1(s),"aria-hidden":!0})},getIndicatorProps(){return e.element({...Zs.indicator.attrs,...p,dir:i("dir"),hidden:!h&&!d})},getHiddenInputProps(){return e.input({id:Jc(s),type:"checkbox",required:i("required"),defaultChecked:d,disabled:a,"aria-labelledby":Kh(s),"aria-invalid":i("invalid"),name:i("name"),form:i("form"),value:i("value"),style:bp,onFocus(){const f=is();n({type:"CONTEXT.SET",context:{focused:!0,focusVisible:f}})},onBlur(){n({type:"CONTEXT.SET",context:{focused:!1,focusVisible:!1}})},onClick(f){if(l){f.preventDefault();return}const m=f.currentTarget.checked;n({type:"CHECKED.SET",checked:m,isTrusted:!0})}})}}}var{not:Gh}=eu(),b1={props({props:t}){return{value:"on",...t,defaultChecked:!!t.defaultChecked}},initialState(){return"ready"},context({prop:t,bindable:e}){return{checked:e(()=>({defaultValue:t("defaultChecked"),value:t("checked"),onChange(n){var r;(r=t("onCheckedChange"))==null||r({checked:n})}})),fieldsetDisabled:e(()=>({defaultValue:!1})),focusVisible:e(()=>({defaultValue:!1})),active:e(()=>({defaultValue:!1})),focused:e(()=>({defaultValue:!1})),hovered:e(()=>({defaultValue:!1}))}},watch({track:t,context:e,prop:n,action:r}){t([()=>n("disabled")],()=>{r(["removeFocusIfNeeded"])}),t([()=>e.get("checked")],()=>{r(["syncInputElement"])})},effects:["trackFormControlState","trackPressEvent","trackFocusVisible"],on:{"CHECKED.TOGGLE":[{guard:Gh("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:Gh("isTrusted"),actions:["setChecked","dispatchChangeEvent"]},{actions:["setChecked"]}],"CONTEXT.SET":{actions:["setContext"]}},computed:{indeterminate:({context:t})=>Ca(t.get("checked")),checked:({context:t})=>k1(t.get("checked")),disabled:({context:t,prop:e})=>!!e("disabled")||t.get("fieldsetDisabled")},states:{ready:{}},implementations:{guards:{isTrusted:({event:t})=>!!t.isTrusted},effects:{trackPressEvent({context:t,computed:e,scope:n}){if(!e("disabled"))return dv({pointerNode:v1(n),keyboardNode:Oo(n),isValidKey:r=>r.key===" ",onPress:()=>t.set("active",!1),onPressStart:()=>t.set("active",!0),onPressEnd:()=>t.set("active",!1)})},trackFocusVisible({computed:t,scope:e}){var n;if(!t("disabled"))return kp({root:(n=e.getRootNode)==null?void 0:n.call(e)})},trackFormControlState({context:t,scope:e}){return Yl(Oo(e),{onFieldsetDisabledChange(n){t.set("fieldsetDisabled",n)},onFormReset(){t.set("checked",t.initial("checked"))}})}},actions:{setContext({context:t,event:e}){for(const n in e.context)t.set(n,e.context[n])},syncInputElement({context:t,computed:e,scope:n}){const r=Oo(n);r&&(mp(r,e("checked")),r.indeterminate=Ca(t.get("checked")))},removeFocusIfNeeded({context:t,prop:e}){e("disabled")&&t.get("focused")&&(t.set("focused",!1),t.set("focusVisible",!1))},setChecked({context:t,event:e}){t.set("checked",e.checked)},toggleChecked({context:t,computed:e}){const n=Ca(e("checked"))?!0:!e("checked");t.set("checked",n)},dispatchChangeEvent({computed:t,scope:e}){queueMicrotask(()=>{const n=Oo(e);gp(n,{checked:t("checked")})})}}}};function Ca(t){return t==="indeterminate"}function k1(t){return Ca(t)?!1:!!t}Wn()(["defaultChecked","checked","dir","disabled","form","getRootNode","id","ids","invalid","name","onCheckedChange","readOnly","required","value"]);function w1(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()}var Jh={htmlFor:"for",className:"class",onDoubleClick:"onDblclick",onChange:"onInput",onFocus:"onFocusin",onBlur:"onFocusout",defaultValue:"value",defaultChecked:"checked"},x1="viewBox,className,preserveAspectRatio,fillRule,clipPath,clipRule,strokeWidth,strokeLinecap,strokeLinejoin,strokeDasharray,strokeDashoffset,strokeMiterlimit".split(",");function E1(t){return t in Jh?Jh[t]:t.startsWith("on")?`on${w1(t.substr(2))}`:x1.includes(t)?t:t.toLowerCase()}var di=f1(t=>{const e={};for(const n in t){const r=t[n];n==="children"?typeof r=="string"&&(e.innerHTML=r):e[E1(n)]=t[n]}return e});function Xh(t){const e=t().defaultValue??t().value,n=t().isEqual??Ss,r=qt(e),i=D(()=>t().value!==void 0),o=qt(i.value?t().value:r.value);return{initial:e,ref:o,get(){return i.value?t().value:r.value},set(s){var a,l;const u=i.value?t().value:r.value,c=Ni(s)?s(u):s;t().debug&&console.log(`[bindable > ${t().debug}] setValue`,{next:c,prev:u}),i.value||(r.value=c),n(c,u)||(l=(a=t()).onChange)==null||l.call(a,c,u)},invoke(s,a){var l,u;(u=(l=t()).onChange)==null||u.call(l,s,a)},hash(s){var a,l;return((l=(a=t()).hash)==null?void 0:l.call(a,s))??String(s)}}}function C1(t){const e=X(t);return{get(n){return e.value[n]},set(n,r){e.value[n]=r}}}var S1=(t,e)=>{Ee(()=>[...t.map(n=>n())],(n,r)=>{let i=!1;for(let o=0;o<n.length;o++)if(!Ss(r[o],He(n[o]))){i=!0;break}i&&e()})};function pi(t,e={}){var n,r,i;const o=D(()=>{const{id:C,ids:_,getRootNode:L}=He(e);return h1({id:C,ids:_,getRootNode:L})}),s=(...C)=>{t.debug&&console.log(...C)},a=D(()=>{var C;return((C=t.props)==null?void 0:C.call(t,{props:Cv(He(e)),get scope(){return o.value}}))??He(e)}),l=T1(a),u=((n=t.context)==null?void 0:n.call(t,{prop:l,bindable:Xh,get scope(){return o.value},flush:Yh,getContext(){return c},getComputed(){return T}}))??{},c={get(C){var _;return(_=u[C])==null?void 0:_.get()},set(C,_){var L;(L=u[C])==null||L.set(_)},initial(C){var _;return(_=u[C])==null?void 0:_.initial},hash(C){var _,L;const W=(_=u[C])==null?void 0:_.get();return(L=u[C])==null?void 0:L.hash(W)}};let d=new Map,h=null,p={current:null},f={current:{type:"__init__"}};const m=()=>({...f.current,current(){return f.current},previous(){return p.current}}),g=()=>({...F,matches(...C){const _=F.get();return C.includes(_)},hasTag(C){var _,L;const W=F.get();return!!((L=(_=t.states[W])==null?void 0:_.tags)!=null&&L.includes(C))}}),y=C1(((r=t.refs)==null?void 0:r.call(t,{prop:l,context:c}))??{}),b=()=>({state:g(),context:c,event:m(),prop:l,send:N,action:k,guard:v,track:S1,refs:y,computed:T,flush:Yh,get scope(){return o.value},choose:x}),k=C=>{const _=Ni(C)?C(b()):C;if(!_)return;const L=_.map(W=>{var q,K;const J=(K=(q=t.implementations)==null?void 0:q.actions)==null?void 0:K[W];return J||Gc(`[zag-js] No implementation found for action "${JSON.stringify(W)}"`),J});for(const W of L)W?.(b())},v=C=>{var _,L;return Ni(C)?C(b()):(L=(_=t.implementations)==null?void 0:_.guards)==null?void 0:L[C](b())},w=C=>{const _=Ni(C)?C(b()):C;if(!_)return;const L=_.map(q=>{var K,J;const ue=(J=(K=t.implementations)==null?void 0:K.effects)==null?void 0:J[q];return ue||Gc(`[zag-js] No implementation found for effect "${JSON.stringify(q)}"`),ue}),W=[];for(const q of L){const K=q?.(b());K&&W.push(K)}return()=>W.forEach(q=>q?.())},x=C=>Wx(C).find(_=>{let L=!_.guard;return bv(_.guard)?L=!!v(_.guard):Ni(_.guard)&&(L=_.guard(b())),L}),T=C=>{d1(t.computed,"[zag-js] No computed object found on machine");const _=t.computed[C];return _({context:c,event:m(),prop:l,refs:y,get scope(){return o.value},computed:T})},F=Xh(()=>({defaultValue:t.initialState({prop:l}),onChange(C,_){var L,W,q;if(_){const J=d.get(_);J?.(),d.delete(_)}_&&k((L=t.states[_])==null?void 0:L.exit),k(h?.actions);const K=w((W=t.states[C])==null?void 0:W.effects);if(K&&d.set(C,K),_==="__init__"){k(t.entry);const J=w(t.effects);J&&d.set("__init__",J)}k((q=t.states[C])==null?void 0:q.entry)}}));qn(()=>{F.invoke(F.initial,"__init__")}),ao(()=>{const C=d.values();for(const _ of C)_?.();d=new Map,k(t.exit)});const N=C=>{var _,L;p.current=f.current,f.current=C,s("send",C);let W=F.get();const q=((_=t.states[W].on)==null?void 0:_[C.type])??((L=t.on)==null?void 0:L[C.type]),K=x(q);if(!K)return;h=K;const J=K.target??W;s("transition",K),J!==W?F.set(J):k(K.actions)};return(i=t.watch)==null||i.call(t,b()),{state:g(),send:N,context:c,prop:l,get scope(){return o.value},refs:y,computed:T,event:m()}}function T1(t){return function(e){return t.value[e]}}var Yh=t=>{kr().then(()=>{t()})};function Qt(t={}){const{prefix:e}=t,n=Mw();return e?`${e}-${n}`:n}const O1={key:0,class:"k-checkbox__help"},Zh=Q({__name:"Checkbox",props:{modelValue:{type:[Boolean,Array]},value:{},label:{},disabled:{type:Boolean},required:{type:Boolean},help:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t;if(n.modelValue instanceof Array&&!n.value)throw new Error("props.value is required if props.modelValue is an array");const r=e,i=()=>{const{modelValue:l,value:u}=n;return l instanceof Array?l.some(c=>Co(c)===Co(u)):!!l};function o(l){const{modelValue:u,value:c}=n;if(!(u instanceof Array))return r("update:modelValue",typeof l=="boolean"?l:void 0);if(!(typeof l!="boolean"||!c))return l?r("update:modelValue",[...u,c]):r("update:modelValue",u.filter(d=>Co(d)!==Co(c)))}const s=pi(b1,{id:Qt(),defaultChecked:i(),onCheckedChange:({checked:l})=>{if(i()!==l)return o(l)},disabled:n.disabled,required:n.required}),a=D(()=>y1(s,di));return Ee(()=>n.modelValue,()=>{const l=i();if(a.value.checked!==l)return a.value.setChecked(l)}),(l,u)=>(E(),O("label",ne({class:"k-checkbox"},a.value.getRootProps()),[H("div",be(Ne(a.value.getControlProps())),[a.value.checked?(E(),$(B(Ze),{key:0,icon:"fa-pro-solid:check"})):I("",!0)],16),l.label||l.$slots.help||l.$slots.default?(E(),O("span",be(ne({key:0},a.value.getLabelProps())),[H("span",{class:Ce(["k-checkbox__label",{"k-checkbox__label-required":l.required}])},[P(l.$slots,"default",{},()=>[$e(se(l.label),1)])],2),l.$slots.help||l.help?(E(),O("span",O1,[P(l.$slots,"help",{},()=>[$e(se(l.help),1)])])):I("",!0)],16)):I("",!0),H("input",be(Ne(a.value.getHiddenInputProps())),null,16)],16))}}),tu=Symbol("form-control"),A1={class:"k-formcontrol"},M1=["for"],_1={key:1,class:"k-formcontrol__error"},D1={key:2,class:"k-formcontrol__help"},N1=Q({__name:"FormControl",props:{label:{},help:{},error:{},required:{type:Boolean}},emits:["blur","focus"],setup(t,{emit:e}){const n=t,r=e,i=Qt({prefix:"k-formcontrol"}),o=D(()=>`${i}_label`),s=D(()=>`${i}_help`),a={onBlur:()=>r("blur"),onFocus:()=>r("focus")};return yk(tu,D(()=>({...n,id:i,labelId:o.value,helpId:s.value,invalid:!!n.error,required:n.required,events:a}))),(l,u)=>(E(),O("div",A1,[l.$slots.label||l.label?(E(),O("label",{key:0,class:Ce(["k-formcontrol__label",{"k-formcontrol__label-required":l.required}]),for:B(i)},[P(l.$slots,"label",{},()=>[$e(se(l.label),1)])],10,M1)):I("",!0),P(l.$slots,"default",{id:B(i)}),l.$slots.error||l.error?(E(),O("span",_1,[P(l.$slots,"error",{},()=>[$e(se(l.error),1)])])):I("",!0),l.$slots.help||l.help?(E(),O("span",D1,[P(l.$slots,"help",{},()=>[$e(se(l.help),1)])])):I("",!0)]))}}),I1={class:"k-filter-type-dropdown"},R1=Q({__name:"Dropdown",props:Lc({label:{},items:{}},{modelValue:{default:""},modelModifiers:{}}),emits:Lc(["disable"],["update:modelValue"]),setup(t,{emit:e}){const n=t,r=Rg(t,"modelValue"),i=D(()=>{var a,l;return`${(r.value?[r.value]:[(l=(a=n.items)==null?void 0:a[0])==null?void 0:l.value]).map(u=>{var c;return(c=n.items.find(d=>d.value===u))==null?void 0:c.label}).join(", ")}`}),o=D(()=>n.items.map(a=>({...a,action:()=>s.value=a.value}))),s=D({get(){return r.value},set(a){r.value=a}});return(a,l)=>(E(),O("div",I1,[he(B(N1),{label:a.label},{default:Z(()=>[he(B(pu),{placement:"bottom-start",label:i.value,modelValue:s.value,"onUpdate:modelValue":l[0]||(l[0]=u=>s.value=u),items:o.value},null,8,["label","modelValue","items"])]),_:1},8,["label"])]))}}),P1=Object.freeze(Object.defineProperty({__proto__:null,default:R1},Symbol.toStringTag,{value:"Module"}));function F1(t,e){let n,r,i;const o=qt(!0),s=()=>{o.value=!0,i()};Ee(t,s,{flush:"sync"});const a=typeof e=="function"?e:e.get,l=typeof e=="function"?void 0:e.set,u=ep((c,d)=>(r=c,i=d,{get(){return o.value&&(n=a(n),o.value=!1),r(),n},set(h){l?.(h)}}));return Object.isExtensible(u)&&(u.trigger=s),u}function Ts(t){return mk()?(gk(t),!0):!1}const Os=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const L1=t=>t!=null,V1=Object.prototype.toString,Tv=t=>V1.call(t)==="[object Object]",B1=()=>{},Qh=$1();function $1(){var t,e;return Os&&((t=window?.navigator)==null?void 0:t.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((e=window?.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function j1(...t){if(t.length!==1)return fk(...t);const e=t[0];return typeof e=="function"?Qd(ep(()=>({get:e,set:B1}))):X(e)}function z1(t){let e;function n(){return e||(e=t()),e}return n.reset=async()=>{const r=e;e=void 0,r&&await r},n}function Gr(t){return Array.isArray(t)?t:[t]}function H1(t,e,n={}){const{immediate:r=!0,immediateCallback:i=!1}=n,o=qt(!1);let s=null;function a(){s&&(clearTimeout(s),s=null)}function l(){o.value=!1,a()}function u(...c){i&&t(),a(),o.value=!0,s=setTimeout(()=>{o.value=!1,s=null,t(...c)},He(e))}return r&&(o.value=!0,Os&&u()),Ts(l),{isPending:Qd(o),start:u,stop:l}}function Ov(t,e,n){return Ee(t,e,{...n,immediate:!0})}const Av=Os?window:void 0,Mv=Os?window.navigator:void 0;function _v(t){var e;const n=He(t);return(e=n?.$el)!=null?e:n}function Ep(...t){const e=[],n=()=>{e.forEach(a=>a()),e.length=0},r=(a,l,u,c)=>(a.addEventListener(l,u,c),()=>a.removeEventListener(l,u,c)),i=D(()=>{const a=Gr(He(t[0])).filter(l=>l!=null);return a.every(l=>typeof l!="string")?a:void 0}),o=Ov(()=>{var a,l;return[(l=(a=i.value)==null?void 0:a.map(u=>_v(u)))!=null?l:[Av].filter(u=>u!=null),Gr(He(i.value?t[1]:t[0])),Gr(B(i.value?t[2]:t[1])),He(i.value?t[3]:t[2])]},([a,l,u,c])=>{if(n(),!(a!=null&&a.length)||!(l!=null&&l.length)||!(u!=null&&u.length))return;const d=Tv(c)?{...c}:c;e.push(...a.flatMap(h=>l.flatMap(p=>u.map(f=>r(h,p,f,d)))))},{flush:"post"}),s=()=>{o(),n()};return Ts(n),s}function q1(){const t=qt(!1),e=np();return e&&qn(()=>{t.value=!0},e),t}function Cp(t){const e=q1();return D(()=>(e.value,!!t()))}function W1(t,e,n={}){const{window:r=Av,...i}=n;let o;const s=Cp(()=>r&&"MutationObserver"in r),a=()=>{o&&(o.disconnect(),o=void 0)},l=D(()=>{const h=He(t),p=Gr(h).map(_v).filter(L1);return new Set(p)}),u=Ee(()=>l.value,h=>{a(),s.value&&h.size&&(o=new MutationObserver(e),h.forEach(p=>o.observe(p,i)))},{immediate:!0,flush:"post"}),c=()=>o?.takeRecords(),d=()=>{u(),a()};return Ts(d),{isSupported:s,stop:d,takeRecords:c}}function ef(t,e={}){const{controls:n=!1,navigator:r=Mv}=e,i=Cp(()=>r&&"permissions"in r),o=qt(),s=typeof t=="string"?{name:t}:t,a=qt(),l=()=>{var c,d;a.value=(d=(c=o.value)==null?void 0:c.state)!=null?d:"prompt"};Ep(o,"change",l,{passive:!0});const u=z1(async()=>{if(i.value){if(!o.value)try{o.value=await r.permissions.query(s)}catch{o.value=void 0}finally{l()}if(n)return Co(o.value)}});return u(),n?{state:a,isSupported:i,query:u}:a}function U1(t={}){const{navigator:e=Mv,read:n=!1,source:r,copiedDuring:i=1500,legacy:o=!1}=t,s=Cp(()=>e&&"clipboard"in e),a=ef("clipboard-read"),l=ef("clipboard-write"),u=D(()=>s.value||o),c=qt(""),d=qt(!1),h=H1(()=>d.value=!1,i,{immediate:!1});async function p(){let b=!(s.value&&y(a.value));if(!b)try{c.value=await e.clipboard.readText()}catch{b=!0}b&&(c.value=g())}u.value&&n&&Ep(["copy","cut"],p,{passive:!0});async function f(b=He(r)){if(u.value&&b!=null){let k=!(s.value&&y(l.value));if(!k)try{await e.clipboard.writeText(b)}catch{k=!0}k&&m(b),c.value=b,d.value=!0,h.start()}}function m(b){const k=document.createElement("textarea");k.value=b??"",k.style.position="absolute",k.style.opacity="0",document.body.appendChild(k),k.select(),document.execCommand("copy"),k.remove()}function g(){var b,k,v;return(v=(k=(b=document?.getSelection)==null?void 0:b.call(document))==null?void 0:k.toString())!=null?v:""}function y(b){return b==="granted"||b==="prompt"}return{isSupported:u,text:c,copied:d,copy:f}}function nu(t){const e=np(),n=F1(()=>null,()=>e.proxy.$el);return vk(n.trigger),qn(n.trigger),n}const K1={class:"k-filter-type-range"},G1={class:"k-filter-type-range__header"},J1={class:"k-filter-type-range__header-label"},X1={class:"k-filter-type-range__value"},Y1={class:"k-filter-type-range__value-display"},Z1=Q({__name:"RangeSlider",props:Lc({min:{},max:{},label:{},suffix:{},step:{},type:{}},{modelValue:{default:[0,1e3]},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const e=Rg(t,"modelValue"),n=nu();function r(){return!n.value||!("getRootNode"in n.value)?document:n.value.getRootNode()}const i=t;function o(s){return[s,i.suffix].filter(Boolean).join(" ")}return(s,a)=>(E(),O("div",K1,[H("div",G1,[H("label",J1,[H("span",null,se(s.label),1),he(B(Ze),{icon:s.$attrs.icon},null,8,["icon"])]),P(s.$slots,"remove")]),H("div",X1,[he(B(uC),ne({modelValue:e.value,"onUpdate:modelValue":a[0]||(a[0]=l=>e.value=l)},i,{"min-steps-between-thumbs":1,"get-root-node":r}),null,16,["modelValue"]),H("div",Y1,[H("span",null,se(o(e.value[0])),1),H("span",null,se(o(e.value[1])),1)])])]))}}),Q1=Object.freeze(Object.defineProperty({__proto__:null,default:Z1},Symbol.toStringTag,{value:"Module"})),tf=Object.assign({"./Dropdown.vue":P1,"./RangeSlider.vue":Q1});for(const t in tf)t.replace(/(\.\/|\.vue)/g,""),tf[t].default;function pr(t){return typeof t=="string"||t instanceof String}function nf(t){var e;return typeof t=="object"&&t!=null&&(t==null||(e=t.constructor)==null?void 0:e.name)==="Object"}function Dv(t,e){return Array.isArray(e)?Dv(t,(n,r)=>e.includes(r)):Object.entries(t).reduce((n,r)=>{let[i,o]=r;return e(o,i)&&(n[i]=o),n},{})}const U={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function eE(t){switch(t){case U.LEFT:return U.FORCE_LEFT;case U.RIGHT:return U.FORCE_RIGHT;default:return t}}function zu(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function Wa(t,e){if(e===t)return!0;const n=Array.isArray(e),r=Array.isArray(t);let i;if(n&&r){if(e.length!=t.length)return!1;for(i=0;i<e.length;i++)if(!Wa(e[i],t[i]))return!1;return!0}if(n!=r)return!1;if(e&&t&&typeof e=="object"&&typeof t=="object"){const o=e instanceof Date,s=t instanceof Date;if(o&&s)return e.getTime()==t.getTime();if(o!=s)return!1;const a=e instanceof RegExp,l=t instanceof RegExp;if(a&&l)return e.toString()==t.toString();if(a!=l)return!1;const u=Object.keys(e);for(i=0;i<u.length;i++)if(!Object.prototype.hasOwnProperty.call(t,u[i]))return!1;for(i=0;i<u.length;i++)if(!Wa(t[u[i]],e[u[i]]))return!1;return!0}else if(e&&t&&typeof e=="function"&&typeof t=="function")return e.toString()===t.toString();return!1}class tE{constructor(e){for(Object.assign(this,e);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?U.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?U.RIGHT:U.LEFT}}function ie(t,e){return new ie.InputMask(t,e)}function Nv(t){if(t==null)throw new Error("mask property should be defined");return t instanceof RegExp?ie.MaskedRegExp:pr(t)?ie.MaskedPattern:t===Date?ie.MaskedDate:t===Number?ie.MaskedNumber:Array.isArray(t)||t===Array?ie.MaskedDynamic:ie.Masked&&t.prototype instanceof ie.Masked?t:ie.Masked&&t instanceof ie.Masked?t.constructor:t instanceof Function?ie.MaskedFunction:(console.warn("Mask not found for mask",t),ie.Masked)}function ss(t){if(!t)throw new Error("Options in not defined");if(ie.Masked){if(t.prototype instanceof ie.Masked)return{mask:t};const{mask:e=void 0,...n}=t instanceof ie.Masked?{mask:t}:nf(t)&&t.mask instanceof ie.Masked?t:{};if(e){const r=e.mask;return{...Dv(e,(i,o)=>!o.startsWith("_")),mask:e.constructor,_mask:r,...n}}}return nf(t)?{...t}:{mask:t}}function $n(t){if(ie.Masked&&t instanceof ie.Masked)return t;const e=ss(t),n=Nv(e.mask);if(!n)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===n&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new n(e)}ie.createMask=$n;class Sp{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return e??this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return e??this.value.length}select(e,n){if(!(e==null||n==null||e===this.selectionStart&&n===this.selectionEnd))try{this._unsafeSelect(e,n)}catch{}}get isActive(){return!1}}ie.MaskElement=Sp;const rf=90,nE=89;class ru extends Sp{constructor(e){super(),this.input=e,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var e,n,r;return(e=(n=(r=this.input).getRootNode)==null?void 0:n.call(r))!=null?e:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){if(this._handlers.redo&&(e.keyCode===rf&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===nE&&e.ctrlKey))return e.preventDefault(),this._handlers.redo(e);if(this._handlers.undo&&e.keyCode===rf&&(e.metaKey||e.ctrlKey))return e.preventDefault(),this._handlers.undo(e);e.isComposing||this._handlers.selectionChange(e)}_onBeforeinput(e){if(e.inputType==="historyUndo"&&this._handlers.undo)return e.preventDefault(),this._handlers.undo(e);if(e.inputType==="historyRedo"&&this._handlers.redo)return e.preventDefault(),this._handlers.redo(e)}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}ie.HTMLMaskElement=ru;class rE extends ru{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,n){this.input.setSelectionRange(e,n)}get value(){return this.input.value}set value(e){this.input.value=e}}ie.HTMLMaskElement=ru;class Iv extends ru{get _unsafeSelectionStart(){const e=this.rootElement,n=e.getSelection&&e.getSelection(),r=n&&n.anchorOffset,i=n&&n.focusOffset;return i==null||r==null||r<i?r:i}get _unsafeSelectionEnd(){const e=this.rootElement,n=e.getSelection&&e.getSelection(),r=n&&n.anchorOffset,i=n&&n.focusOffset;return i==null||r==null||r>i?r:i}_unsafeSelect(e,n){if(!this.rootElement.createRange)return;const r=this.rootElement.createRange();r.setStart(this.input.firstChild||this.input,e),r.setEnd(this.input.lastChild||this.input,n);const i=this.rootElement,o=i.getSelection&&i.getSelection();o&&(o.removeAllRanges(),o.addRange(r))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}ie.HTMLContenteditableMaskElement=Iv;class iu{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(e){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(e),this.states.length>iu.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}iu.MAX_LENGTH=100;class iE{constructor(e,n){this.el=e instanceof Sp?e:e.isContentEditable&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"?new Iv(e):new rE(e),this.masked=$n(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new iu,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(e){var n;return e==null||((n=this.masked)==null?void 0:n.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof ie.Masked)&&this.masked.constructor===Nv(e)){this.masked.updateOptions({mask:e});return}const n=e instanceof ie.Masked?e:$n({mask:e});n.unmaskedValue=this.masked.unmaskedValue,this.masked=n}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(e,n){const r=this._listeners[e];r&&r.forEach(i=>i(n))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){!this.el||!this.el.isActive||(this.el.select(e,e),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(e){const n=this.masked.unmaskedValue,r=this.masked.value,i=this.masked.rawInputValue,o=this.displayValue,s=this.unmaskedValue!==n||this.value!==r||this._rawInputValue!==i;this._unmaskedValue=n,this._value=r,this._rawInputValue=i,this.el.value!==o&&(this.el.value=o),e==="auto"?this.alignCursor():e!=null&&(this.cursorPos=e),s&&this._fireChangeEvents(),!this._historyChanging&&(s||this.history.isEmpty)&&this.history.push({unmaskedValue:n,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:n,...r}=e,i=!this.maskEquals(n),o=this.masked.optionsIsChanged(r);i&&(this.mask=n),o&&this.masked.updateOptions(r),(i||o)&&this.updateControl()}updateCursor(e){e!=null&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,U.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,n){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(n),this}off(e,n){if(!this._listeners[e])return this;if(!n)return delete this._listeners[e],this;const r=this._listeners[e].indexOf(n);return r>=0&&this._listeners[e].splice(r,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const n=new tE({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),r=this.masked.rawInputValue,i=this.masked.splice(n.startChangePos,n.removed.length,n.inserted,n.removeDirection,{input:!0,raw:!0}).offset,o=r===this.masked.rawInputValue?n.removeDirection:U.NONE;let s=this.masked.nearestInputPos(n.startChangePos+i,o);o!==U.NONE&&(s=this.masked.nearestInputPos(s,U.NONE)),this.updateControl(s),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}ie.InputMask=iE;class de{static normalize(e){return Array.isArray(e)?e:[e,new de]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},e)}aggregate(e){return this.inserted+=e.inserted,this.rawInserted+=e.rawInserted,this.tailShift+=e.tailShift,this.skip=this.skip||e.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(e){return this.inserted===e.inserted&&this.tailShift===e.tailShift&&this.rawInserted===e.rawInserted&&this.skip===e.skip}}ie.ChangeDetails=de;class mn{constructor(e,n,r){e===void 0&&(e=""),n===void 0&&(n=0),this.value=e,this.from=n,this.stop=r}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||e!=null&&this.from>=e)return"";const n=this.value[0];return this.value=this.value.slice(1),n}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class it{constructor(e){this._value="",this._update({...it.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,n){n===void 0&&(n={input:!0}),this.reset(),this.append(e,n,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,n){return e}totalInputPositions(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),Math.min(this.displayValue.length,n-e)}extractInput(e,n,r){return e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),this.displayValue.slice(e,n)}extractTail(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),new mn(this.extractInput(e,n),e)}appendTail(e){return pr(e)&&(e=new mn(String(e))),e.appendTo(this)}_appendCharRaw(e,n){return e?(this._value+=e,new de({inserted:e,rawInserted:e})):new de}_appendChar(e,n,r){n===void 0&&(n={});const i=this.state;let o;if([e,o]=this.doPrepareChar(e,n),e&&(o=o.aggregate(this._appendCharRaw(e,n)),!o.rawInserted&&this.autofix==="pad")){const s=this.state;this.state=i;let a=this.pad(n);const l=this._appendCharRaw(e,n);a=a.aggregate(l),l.rawInserted||a.equals(o)?o=a:this.state=s}if(o.inserted){let s,a=this.doValidate(n)!==!1;if(a&&r!=null){const l=this.state;if(this.overwrite===!0){s=r.state;for(let c=0;c<o.rawInserted.length;++c)r.unshift(this.displayValue.length-o.tailShift)}let u=this.appendTail(r);if(a=u.rawInserted.length===r.toString().length,!(a&&u.inserted)&&this.overwrite==="shift"){this.state=l,s=r.state;for(let c=0;c<o.rawInserted.length;++c)r.shift();u=this.appendTail(r),a=u.rawInserted.length===r.toString().length}a&&u.inserted&&(this.state=l)}a||(o=new de,this.state=i,r&&s&&(r.state=s))}return o}_appendPlaceholder(){return new de}_appendEager(){return new de}append(e,n,r){if(!pr(e))throw new Error("value should be string");const i=pr(r)?new mn(String(r)):r;n!=null&&n.tail&&(n._beforeTailState=this.state);let o;[e,o]=this.doPrepare(e,n);for(let s=0;s<e.length;++s){const a=this._appendChar(e[s],n,i);if(!a.rawInserted&&!this.doSkipInvalid(e[s],n,i))break;o.aggregate(a)}return(this.eager===!0||this.eager==="append")&&n!=null&&n.input&&e&&o.aggregate(this._appendEager()),i!=null&&(o.tailShift+=this.appendTail(i).tailShift),o}remove(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),this._value=this.displayValue.slice(0,e)+this.displayValue.slice(n),new de}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const n=this.rawInputValue,r=this.value,i=e();return this.rawInputValue=n,this.value&&this.value!==r&&r.indexOf(this.value)===0&&(this.append(r.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,i}runIsolated(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const n=this.state,r=e(this);return this.state=n,delete this._isolated,r}doSkipInvalid(e,n,r){return!!this.skipInvalid}doPrepare(e,n){return n===void 0&&(n={}),de.normalize(this.prepare?this.prepare(e,this,n):e)}doPrepareChar(e,n){return n===void 0&&(n={}),de.normalize(this.prepareChar?this.prepareChar(e,this,n):e)}doValidate(e){return(!this.validate||this.validate(this.value,this,e))&&(!this.parent||this.parent.doValidate(e))}doCommit(){this.commit&&this.commit(this.value,this)}splice(e,n,r,i,o){r===void 0&&(r=""),i===void 0&&(i=U.NONE),o===void 0&&(o={input:!0});const s=e+n,a=this.extractTail(s),l=this.eager===!0||this.eager==="remove";let u;l&&(i=eE(i),u=this.extractInput(0,s,{raw:!0}));let c=e;const d=new de;if(i!==U.NONE&&(c=this.nearestInputPos(e,n>1&&e!==0&&!l?U.NONE:i),d.tailShift=c-e),d.aggregate(this.remove(c)),l&&i!==U.NONE&&u===this.rawInputValue)if(i===U.FORCE_LEFT){let h;for(;u===this.rawInputValue&&(h=this.displayValue.length);)d.aggregate(new de({tailShift:-1})).aggregate(this.remove(h-1))}else i===U.FORCE_RIGHT&&a.unshift();return d.aggregate(this.append(r,o,a))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!Wa(this,e)}typedValueEquals(e){const n=this.typedValue;return e===n||it.EMPTY_VALUES.includes(e)&&it.EMPTY_VALUES.includes(n)||(this.format?this.format(e,this)===this.format(this.typedValue,this):!1)}pad(e){return new de}}it.DEFAULTS={skipInvalid:!0};it.EMPTY_VALUES=[void 0,null,""];ie.Masked=it;class qr{constructor(e,n){e===void 0&&(e=[]),n===void 0&&(n=0),this.chunks=e,this.from=n}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=pr(e)?new mn(String(e)):e;const n=this.chunks[this.chunks.length-1],r=n&&(n.stop===e.stop||e.stop==null)&&e.from===n.from+n.toString().length;if(e instanceof mn)r?n.extend(e.toString()):this.chunks.push(e);else if(e instanceof qr){if(e.stop==null){let i;for(;e.chunks.length&&e.chunks[0].stop==null;)i=e.chunks.shift(),i.from+=e.from,this.extend(i)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof ie.MaskedPattern))return new mn(this.toString()).appendTo(e);const n=new de;for(let r=0;r<this.chunks.length;++r){const i=this.chunks[r],o=e._mapPosToBlock(e.displayValue.length),s=i.stop;let a;if(s!=null&&(!o||o.index<=s)&&((i instanceof qr||e._stops.indexOf(s)>=0)&&n.aggregate(e._appendPlaceholder(s)),a=i instanceof qr&&e._blocks[s]),a){const l=a.appendTail(i);n.aggregate(l);const u=i.toString().slice(l.rawInserted.length);u&&n.aggregate(e.append(u,{tail:!0}))}else n.aggregate(e.append(i.toString(),{tail:!0}))}return n}get state(){return{chunks:this.chunks.map(e=>e.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:n,...r}=e;Object.assign(this,r),this.chunks=n.map(i=>{const o="chunks"in i?new qr:new mn;return o.state=i,o})}unshift(e){if(!this.chunks.length||e!=null&&this.from>=e)return"";const n=e!=null?e-this.from:e;let r=0;for(;r<this.chunks.length;){const i=this.chunks[r],o=i.unshift(n);if(i.toString()){if(!o)break;++r}else this.chunks.splice(r,1);if(o)return o}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;for(;0<=e;){const n=this.chunks[e],r=n.shift();if(n.toString()){if(!r)break;--e}else this.chunks.splice(e,1);if(r)return r}return""}}class oE{constructor(e,n){this.masked=e,this._log=[];const{offset:r,index:i}=e._mapPosToBlock(n)||(n<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=r,this.index=i,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(e){Object.assign(this,e)}pushState(){this._log.push(this.state)}popState(){const e=this._log.pop();return e&&(this.state=e),e}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(e){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((n=this.block)==null?void 0:n.displayValue.length)||0){var n;if(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(e())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,U.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,U.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,U.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,U.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,U.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,U.NONE),!0})}}class Rv{constructor(e){Object.assign(this,e),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(e,n){return e===void 0&&(e=0),n===void 0&&(n=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(n),this._value||(this._isRawInput=!1),new de}nearestInputPos(e,n){n===void 0&&(n=U.NONE);const r=0,i=this._value.length;switch(n){case U.LEFT:case U.FORCE_LEFT:return r;case U.NONE:case U.RIGHT:case U.FORCE_RIGHT:default:return i}}totalInputPositions(e,n){return e===void 0&&(e=0),n===void 0&&(n=this._value.length),this._isRawInput?n-e:0}extractInput(e,n,r){return e===void 0&&(e=0),n===void 0&&(n=this._value.length),r===void 0&&(r={}),r.raw&&this._isRawInput&&this._value.slice(e,n)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(e,n){if(n===void 0&&(n={}),this.isFilled)return new de;const r=this.eager===!0||this.eager==="append",i=this.char===e&&(this.isUnmasking||n.input||n.raw)&&(!n.raw||!r)&&!n.tail,o=new de({inserted:this.char,rawInserted:i?this.char:""});return this._value=this.char,this._isRawInput=i&&(n.raw||n.input),o}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new de;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new mn("")}appendTail(e){return pr(e)&&(e=new mn(String(e))),e.appendTo(this)}append(e,n,r){const i=this._appendChar(e[0],n);return r!=null&&(i.tailShift+=this.appendTail(r).tailShift),i}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=!!e._rawInputValue}pad(e){return this._appendPlaceholder()}}class Ua{constructor(e){const{parent:n,isOptional:r,placeholderChar:i,displayChar:o,lazy:s,eager:a,...l}=e;this.masked=$n(l),Object.assign(this,{parent:n,isOptional:r,placeholderChar:i,displayChar:o,lazy:s,eager:a})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.value.length),e===0&&n>=1?(this.isFilled=!1,this.masked.remove(e,n)):new de}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(e,n){if(n===void 0&&(n={}),this.isFilled)return new de;const r=this.masked.state;let i=this.masked._appendChar(e,this.currentMaskFlags(n));return i.inserted&&this.doValidate(n)===!1&&(i=new de,this.masked.state=r),!i.inserted&&!this.isOptional&&!this.lazy&&!n.input&&(i.inserted=this.placeholderChar),i.skip=!i.inserted&&!this.isOptional,this.isFilled=!!i.inserted,i}append(e,n,r){return this.masked.append(e,this.currentMaskFlags(n),r)}_appendPlaceholder(){return this.isFilled||this.isOptional?new de:(this.isFilled=!0,new de({inserted:this.placeholderChar}))}_appendEager(){return new de}extractTail(e,n){return this.masked.extractTail(e,n)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,n,r){return e===void 0&&(e=0),n===void 0&&(n=this.value.length),this.masked.extractInput(e,n,r)}nearestInputPos(e,n){n===void 0&&(n=U.NONE);const r=0,i=this.value.length,o=Math.min(Math.max(e,r),i);switch(n){case U.LEFT:case U.FORCE_LEFT:return this.isComplete?o:r;case U.RIGHT:case U.FORCE_RIGHT:return this.isComplete?o:i;case U.NONE:default:return o}}totalInputPositions(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.value.length),this.value.slice(e,n).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var n;return{...e,_beforeTailState:(e==null||(n=e._beforeTailState)==null?void 0:n.masked)||e?._beforeTailState}}pad(e){return new de}}Ua.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class sE extends it{updateOptions(e){super.updateOptions(e)}_update(e){const n=e.mask;n&&(e.validate=r=>r.search(n)>=0),super._update(e)}}ie.MaskedRegExp=sE;class ot extends it{constructor(e){super({...ot.DEFAULTS,...e,definitions:Object.assign({},Ua.DEFAULT_DEFINITIONS,e?.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const n=this.mask;if(!n||!e)return;let r=!1,i=!1;for(let o=0;o<n.length;++o){if(this.blocks){const u=n.slice(o),c=Object.keys(this.blocks).filter(h=>u.indexOf(h)===0);c.sort((h,p)=>p.length-h.length);const d=c[0];if(d){const{expose:h,repeat:p,...f}=ss(this.blocks[d]),m={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...f,repeat:p,parent:this},g=p!=null?new ie.RepeatBlock(m):$n(m);g&&(this._blocks.push(g),h&&(this.exposeBlock=g),this._maskedBlocks[d]||(this._maskedBlocks[d]=[]),this._maskedBlocks[d].push(this._blocks.length-1)),o+=d.length-1;continue}}let s=n[o],a=s in e;if(s===ot.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(s==="{"||s==="}"){r=!r;continue}if(s==="["||s==="]"){i=!i;continue}if(s===ot.ESCAPE_CHAR){if(++o,s=n[o],!s)break;a=!1}const l=a?new Ua({isOptional:i,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...ss(e[s]),parent:this}):new Rv({char:s,eager:this.eager,isUnmasking:r});this._blocks.push(l)}}get state(){return{...super.state,_blocks:this._blocks.map(e=>e.state)}}set state(e){if(!e){this.reset();return}const{_blocks:n,...r}=e;this._blocks.forEach((i,o)=>i.state=n[o]),super.state=r}reset(){super.reset(),this._blocks.forEach(e=>e.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(e=>e.isComplete)}get isFilled(){return this._blocks.every(e=>e.isFilled)}get isFixed(){return this._blocks.every(e=>e.isFixed)}get isOptional(){return this._blocks.every(e=>e.isOptional)}doCommit(){this._blocks.forEach(e=>e.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((e,n)=>e+=n.unmaskedValue,"")}set unmaskedValue(e){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(n),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((e,n)=>e+=n.value,"")}set value(e){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(n),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(n),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce((e,n)=>e+=n.displayValue,"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const n=new de;let r=(e=this._mapPosToBlock(this.displayValue.length))==null?void 0:e.index;if(r==null)return n;this._blocks[r].isFilled&&++r;for(let i=r;i<this._blocks.length;++i){const o=this._blocks[i]._appendEager();if(!o.inserted)break;n.aggregate(o)}return n}_appendCharRaw(e,n){n===void 0&&(n={});const r=this._mapPosToBlock(this.displayValue.length),i=new de;if(!r)return i;for(let s=r.index,a;a=this._blocks[s];++s){var o;const l=a._appendChar(e,{...n,_beforeTailState:(o=n._beforeTailState)==null||(o=o._blocks)==null?void 0:o[s]});if(i.aggregate(l),l.consumed)break}return i}extractTail(e,n){e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length);const r=new qr;return e===n||this._forEachBlocksInRange(e,n,(i,o,s,a)=>{const l=i.extractTail(s,a);l.stop=this._findStopBefore(o),l.from=this._blockStartPos(o),l instanceof qr&&(l.blockIndex=o),r.extend(l)}),r}extractInput(e,n,r){if(e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),r===void 0&&(r={}),e===n)return"";let i="";return this._forEachBlocksInRange(e,n,(o,s,a,l)=>{i+=o.extractInput(a,l,r)}),i}_findStopBefore(e){let n;for(let r=0;r<this._stops.length;++r){const i=this._stops[r];if(i<=e)n=i;else break}return n}_appendPlaceholder(e){const n=new de;if(this.lazy&&e==null)return n;const r=this._mapPosToBlock(this.displayValue.length);if(!r)return n;const i=r.index,o=e??this._blocks.length;return this._blocks.slice(i,o).forEach(s=>{if(!s.lazy||e!=null){var a;n.aggregate(s._appendPlaceholder((a=s._blocks)==null?void 0:a.length))}}),n}_mapPosToBlock(e){let n="";for(let r=0;r<this._blocks.length;++r){const i=this._blocks[r],o=n.length;if(n+=i.displayValue,e<=n.length)return{index:r,offset:e-o}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce((n,r)=>n+=r.displayValue.length,0)}_forEachBlocksInRange(e,n,r){n===void 0&&(n=this.displayValue.length);const i=this._mapPosToBlock(e);if(i){const o=this._mapPosToBlock(n),s=o&&i.index===o.index,a=i.offset,l=o&&s?o.offset:this._blocks[i.index].displayValue.length;if(r(this._blocks[i.index],i.index,a,l),o&&!s){for(let u=i.index+1;u<o.index;++u)r(this._blocks[u],u,0,this._blocks[u].displayValue.length);r(this._blocks[o.index],o.index,0,o.offset)}}}remove(e,n){e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length);const r=super.remove(e,n);return this._forEachBlocksInRange(e,n,(i,o,s,a)=>{r.aggregate(i.remove(s,a))}),r}nearestInputPos(e,n){if(n===void 0&&(n=U.NONE),!this._blocks.length)return 0;const r=new oE(this,e);if(n===U.NONE)return r.pushRightBeforeInput()||(r.popState(),r.pushLeftBeforeInput())?r.pos:this.displayValue.length;if(n===U.LEFT||n===U.FORCE_LEFT){if(n===U.LEFT){if(r.pushRightBeforeFilled(),r.ok&&r.pos===e)return e;r.popState()}if(r.pushLeftBeforeInput(),r.pushLeftBeforeRequired(),r.pushLeftBeforeFilled(),n===U.LEFT){if(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.ok&&r.pos<=e||(r.popState(),r.ok&&r.pos<=e))return r.pos;r.popState()}return r.ok?r.pos:n===U.FORCE_LEFT?0:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:0)}return n===U.RIGHT||n===U.FORCE_RIGHT?(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.pushRightBeforeFilled()?r.pos:n===U.FORCE_RIGHT?this.displayValue.length:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:this.nearestInputPos(e,U.LEFT))):e}totalInputPositions(e,n){e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length);let r=0;return this._forEachBlocksInRange(e,n,(i,o,s,a)=>{r+=i.totalInputPositions(s,a)}),r}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const n=this._maskedBlocks[e];return n?n.map(r=>this._blocks[r]):[]}pad(e){const n=new de;return this._forEachBlocksInRange(0,this.displayValue.length,r=>n.aggregate(r.pad(e))),n}}ot.DEFAULTS={...it.DEFAULTS,lazy:!0,placeholderChar:"_"};ot.STOP_CHAR="`";ot.ESCAPE_CHAR="\\";ot.InputDefinition=Ua;ot.FixedDefinition=Rv;ie.MaskedPattern=ot;class Sa extends ot{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:n=this.to||0,from:r=this.from||0,maxLength:i=this.maxLength||0,autofix:o=this.autofix,...s}=e;this.to=n,this.from=r,this.maxLength=Math.max(String(n).length,i),this.autofix=o;const a=String(this.from).padStart(this.maxLength,"0"),l=String(this.to).padStart(this.maxLength,"0");let u=0;for(;u<l.length&&l[u]===a[u];)++u;s.mask=l.slice(0,u).replace(/0/g,"\\0")+"0".repeat(this.maxLength-u),super._update(s)}get isComplete(){return super.isComplete&&!!this.value}boundaries(e){let n="",r="";const[,i,o]=e.match(/^(\D*)(\d*)(\D*)/)||[];return o&&(n="0".repeat(i.length)+o,r="9".repeat(i.length)+o),n=n.padEnd(this.maxLength,"0"),r=r.padEnd(this.maxLength,"9"),[n,r]}doPrepareChar(e,n){n===void 0&&(n={});let r;return[e,r]=super.doPrepareChar(e.replace(/\D/g,""),n),e||(r.skip=!this.isComplete),[e,r]}_appendCharRaw(e,n){if(n===void 0&&(n={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,n);const r=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0"),[o,s]=this.boundaries(this.value+e);return Number(s)<this.from?super._appendCharRaw(r[this.value.length],n):Number(o)>this.to?!n.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(r[this.value.length],n).aggregate(this._appendCharRaw(e,n)):super._appendCharRaw(i[this.value.length],n):super._appendCharRaw(e,n)}doValidate(e){const n=this.value;if(n.search(/[^0]/)===-1&&n.length<=this._matchFrom)return!0;const[r,i]=this.boundaries(n);return this.from<=Number(i)&&Number(r)<=this.to&&super.doValidate(e)}pad(e){const n=new de;if(this.value.length===this.maxLength)return n;const r=this.value,i=this.maxLength-this.value.length;if(i){this.reset();for(let o=0;o<i;++o)n.aggregate(super._appendCharRaw("0",e));r.split("").forEach(o=>this._appendCharRaw(o))}return n}}ie.MaskedRange=Sa;const aE="d{.}`m{.}`Y";class In extends ot{static extractPatternOptions(e){const{mask:n,pattern:r,...i}=e;return{...i,mask:pr(n)?n:r}}constructor(e){super(In.extractPatternOptions({...In.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:n,pattern:r,blocks:i,...o}={...In.DEFAULTS,...e},s=Object.assign({},In.GET_DEFAULT_BLOCKS());e.min&&(s.Y.from=e.min.getFullYear()),e.max&&(s.Y.to=e.max.getFullYear()),e.min&&e.max&&s.Y.from===s.Y.to&&(s.m.from=e.min.getMonth()+1,s.m.to=e.max.getMonth()+1,s.m.from===s.m.to&&(s.d.from=e.min.getDate(),s.d.to=e.max.getDate())),Object.assign(s,this.blocks,i),super._update({...o,mask:pr(n)?n:r,blocks:s})}doValidate(e){const n=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&n!=null&&(this.min==null||this.min<=n)&&(this.max==null||n<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged(In.extractPatternOptions(e))}}In.GET_DEFAULT_BLOCKS=()=>({d:{mask:Sa,from:1,to:31,maxLength:2},m:{mask:Sa,from:1,to:12,maxLength:2},Y:{mask:Sa,from:1900,to:9999}});In.DEFAULTS={...ot.DEFAULTS,mask:Date,pattern:aE,format:(t,e)=>{if(!t)return"";const n=String(t.getDate()).padStart(2,"0"),r=String(t.getMonth()+1).padStart(2,"0"),i=t.getFullYear();return[n,r,i].join(".")},parse:(t,e)=>{const[n,r,i]=t.split(".").map(Number);return new Date(i,r-1,n)}};ie.MaskedDate=In;class ou extends it{constructor(e){super({...ou.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map(n=>{const{expose:r,...i}=ss(n),o=$n({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...i});return r&&(this.exposeMask=o),o}):[])}_appendCharRaw(e,n){n===void 0&&(n={});const r=this._applyDispatch(e,n);return this.currentMask&&r.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(n))),r}_applyDispatch(e,n,r){e===void 0&&(e=""),n===void 0&&(n={}),r===void 0&&(r="");const i=n.tail&&n._beforeTailState!=null?n._beforeTailState._value:this.value,o=this.rawInputValue,s=n.tail&&n._beforeTailState!=null?n._beforeTailState._rawInputValue:o,a=o.slice(s.length),l=this.currentMask,u=new de,c=l?.state;return this.currentMask=this.doDispatch(e,{...n},r),this.currentMask&&(this.currentMask!==l?(this.currentMask.reset(),s&&(this.currentMask.append(s,{raw:!0}),u.tailShift=this.currentMask.value.length-i.length),a&&(u.tailShift+=this.currentMask.append(a,{raw:!0,tail:!0}).tailShift)):c&&(this.currentMask.state=c)),u}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const n=new de;return e&&n.aggregate(this._applyDispatch("",{},e)),n.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var n,r;return{...e,_beforeTailState:((n=e._beforeTailState)==null?void 0:n.currentMaskRef)===this.currentMask&&((r=e._beforeTailState)==null?void 0:r.currentMask)||e._beforeTailState}}doDispatch(e,n,r){return n===void 0&&(n={}),r===void 0&&(r=""),this.dispatch(e,this,n,r)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,n){n===void 0&&(n={});let[r,i]=super.doPrepare(e,n);if(this.currentMask){let o;[r,o]=super.doPrepare(r,this.currentMaskFlags(n)),i=i.aggregate(o)}return[r,i]}doPrepareChar(e,n){n===void 0&&(n={});let[r,i]=super.doPrepareChar(e,n);if(this.currentMask){let o;[r,o]=super.doPrepareChar(r,this.currentMaskFlags(n)),i=i.aggregate(o)}return[r,i]}reset(){var e;(e=this.currentMask)==null||e.reset(),this.compiledMasks.forEach(n=>n.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask){this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,this._applyDispatch();return}let n=String(e);this.currentMask&&(this.currentMask.typedValue=e,n=this.currentMask.unmaskedValue),this.unmaskedValue=n}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return!!((e=this.currentMask)!=null&&e.isComplete)}get isFilled(){var e;return!!((e=this.currentMask)!=null&&e.isFilled)}remove(e,n){const r=new de;return this.currentMask&&r.aggregate(this.currentMask.remove(e,n)).aggregate(this._applyDispatch()),r}get state(){var e;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(n=>n.state),currentMaskRef:this.currentMask,currentMask:(e=this.currentMask)==null?void 0:e.state}}set state(e){const{compiledMasks:n,currentMaskRef:r,currentMask:i,...o}=e;n&&this.compiledMasks.forEach((s,a)=>s.state=n[a]),r!=null&&(this.currentMask=r,this.currentMask.state=i),super.state=o}extractInput(e,n,r){return this.currentMask?this.currentMask.extractInput(e,n,r):""}extractTail(e,n){return this.currentMask?this.currentMask.extractTail(e,n):super.extractTail(e,n)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(e,n){return this.currentMask?this.currentMask.nearestInputPos(e,n):super.nearestInputPos(e,n)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(e){this._overwrite=e}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(e){this._eager=e}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(e){this._skipInvalid=e}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(e){this._autofix=e}maskEquals(e){return Array.isArray(e)?this.compiledMasks.every((n,r)=>{if(!e[r])return;const{mask:i,...o}=e[r];return Wa(n,o)&&n.maskEquals(i)}):super.maskEquals(e)}typedValueEquals(e){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(e))}}ou.DEFAULTS={...it.DEFAULTS,dispatch:(t,e,n,r)=>{if(!e.compiledMasks.length)return;const i=e.rawInputValue,o=e.compiledMasks.map((s,a)=>{const l=e.currentMask===s,u=l?s.displayValue.length:s.nearestInputPos(s.displayValue.length,U.FORCE_LEFT);return s.rawInputValue!==i?(s.reset(),s.append(i,{raw:!0})):l||s.remove(u),s.append(t,e.currentMaskFlags(n)),s.appendTail(r),{index:a,weight:s.rawInputValue.length,totalInputPositions:s.totalInputPositions(0,Math.max(u,s.nearestInputPos(s.displayValue.length,U.FORCE_LEFT)))}});return o.sort((s,a)=>a.weight-s.weight||a.totalInputPositions-s.totalInputPositions),e.compiledMasks[o[0].index]}};ie.MaskedDynamic=ou;class su extends ot{constructor(e){super({...su.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:n,...r}=e;if(n){const i=n.map(a=>a.length),o=Math.min(...i),s=Math.max(...i)-o;r.mask="*".repeat(o),s&&(r.mask+="["+"*".repeat(s)+"]"),this.enum=n}super._update(r)}_appendCharRaw(e,n){n===void 0&&(n={});const r=Math.min(this.nearestInputPos(0,U.FORCE_RIGHT),this.value.length),i=this.enum.filter(o=>this.matchValue(o,this.unmaskedValue+e,r));if(i.length){i.length===1&&this._forEachBlocksInRange(0,this.value.length,(s,a)=>{const l=i[0][a];a>=this.value.length||l===s.value||(s.reset(),s._appendChar(l,n))});const o=super._appendCharRaw(i[0][this.value.length],n);return i.length===1&&i[0].slice(this.unmaskedValue.length).split("").forEach(s=>o.aggregate(super._appendCharRaw(s))),o}return new de({skip:!this.isComplete})}extractTail(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),new mn("",e)}remove(e,n){if(e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),e===n)return new de;const r=Math.min(super.nearestInputPos(0,U.FORCE_RIGHT),this.value.length);let i;for(i=e;i>=0&&!(this.enum.filter(s=>this.matchValue(s,this.value.slice(r,i),r)).length>1);--i);const o=super.remove(i,n);return o.tailShift+=i-e,o}get isComplete(){return this.enum.indexOf(this.value)>=0}}su.DEFAULTS={...ot.DEFAULTS,matchValue:(t,e,n)=>t.indexOf(e,n)===n};ie.MaskedEnum=su;class lE extends it{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}ie.MaskedFunction=lE;var Pv;class St extends it{constructor(e){super({...St.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),n="\\d*",r=(this.scale?"("+zu(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+n+r),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(zu).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(zu(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const n=e.split(this.radix);return n[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),n.join(this.radix)}doPrepareChar(e,n){n===void 0&&(n={});const[r,i]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(n.input&&n.raw||!n.input&&!n.raw)?e.replace(this._mapToRadixRegExp,this.radix):e),n);return e&&!r&&(i.skip=!0),r&&!this.allowPositive&&!this.value&&r!=="-"&&i.aggregate(this._appendChar("-")),[r,i]}_separatorsCount(e,n){n===void 0&&(n=!1);let r=0;for(let i=0;i<e;++i)this._value.indexOf(this.thousandsSeparator,i)===i&&(++r,n&&(e+=this.thousandsSeparator.length));return r}_separatorsCountFromSlice(e){return e===void 0&&(e=this._value),this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(e,n,r){return e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),[e,n]=this._adjustRangeWithSeparators(e,n),this._removeThousandsSeparators(super.extractInput(e,n,r))}_appendCharRaw(e,n){n===void 0&&(n={});const r=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,i=this._separatorsCountFromSlice(r);this._value=this._removeThousandsSeparators(this.value);const o=this._value;this._value+=e;const s=this.number;let a=!isNaN(s),l=!1;if(a){let h;this.min!=null&&this.min<0&&this.number<this.min&&(h=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(h=this.max),h!=null&&(this.autofix?(this._value=this.format(h,this).replace(St.UNMASKED_RADIX,this.radix),l||(l=o===this._value&&!n.tail)):a=!1),a&&(a=!!this._value.match(this._numberRegExp))}let u;a?u=new de({inserted:this._value.slice(o.length),rawInserted:l?"":e,skip:l}):(this._value=o,u=new de),this._value=this._insertThousandsSeparators(this._value);const c=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,d=this._separatorsCountFromSlice(c);return u.tailShift+=(d-i)*this.thousandsSeparator.length,u}_findSeparatorAround(e){if(this.thousandsSeparator){const n=e-this.thousandsSeparator.length+1,r=this.value.indexOf(this.thousandsSeparator,n);if(r<=e)return r}return-1}_adjustRangeWithSeparators(e,n){const r=this._findSeparatorAround(e);r>=0&&(e=r);const i=this._findSeparatorAround(n);return i>=0&&(n=i+this.thousandsSeparator.length),[e,n]}remove(e,n){e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),[e,n]=this._adjustRangeWithSeparators(e,n);const r=this.value.slice(0,e),i=this.value.slice(n),o=this._separatorsCount(r.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(r+i));const s=this._separatorsCountFromSlice(r);return new de({tailShift:(s-o)*this.thousandsSeparator.length})}nearestInputPos(e,n){if(!this.thousandsSeparator)return e;switch(n){case U.NONE:case U.LEFT:case U.FORCE_LEFT:{const r=this._findSeparatorAround(e-1);if(r>=0){const i=r+this.thousandsSeparator.length;if(e<i||this.value.length<=i||n===U.FORCE_LEFT)return r}break}case U.RIGHT:case U.FORCE_RIGHT:{const r=this._findSeparatorAround(e);if(r>=0)return r+this.thousandsSeparator.length}}return e}doCommit(){if(this.value){const e=this.number;let n=e;this.min!=null&&(n=Math.max(n,this.min)),this.max!=null&&(n=Math.min(n,this.max)),n!==e&&(this.unmaskedValue=this.format(n,this));let r=this.value;this.normalizeZeros&&(r=this._normalizeZeros(r)),this.padFractionalZeros&&this.scale>0&&(r=this._padFractionalZeros(r)),this._value=r}super.doCommit()}_normalizeZeros(e){const n=this._removeThousandsSeparators(e).split(this.radix);return n[0]=n[0].replace(/^(\D*)(0*)(\d*)/,(r,i,o,s)=>i+s),e.length&&!/\d$/.test(n[0])&&(n[0]=n[0]+"0"),n.length>1&&(n[1]=n[1].replace(/0*$/,""),n[1].length||(n.length=1)),this._insertThousandsSeparators(n.join(this.radix))}_padFractionalZeros(e){if(!e)return e;const n=e.split(this.radix);return n.length<2&&n.push(""),n[1]=n[1].padEnd(this.scale,"0"),n.join(this.radix)}doSkipInvalid(e,n,r){n===void 0&&(n={});const i=this.scale===0&&e!==this.thousandsSeparator&&(e===this.radix||e===St.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,n,r)&&!i}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,St.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(e){this.rawInputValue=this.format(e,this).replace(St.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(e){return(super.typedValueEquals(e)||St.EMPTY_VALUES.includes(e)&&St.EMPTY_VALUES.includes(this.typedValue))&&!(e===0&&this.value==="")}}Pv=St;St.UNMASKED_RADIX=".";St.EMPTY_VALUES=[...it.EMPTY_VALUES,0];St.DEFAULTS={...it.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[Pv.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:t=>t.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})};ie.MaskedNumber=St;const Xc={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function Fv(t,e,n){e===void 0&&(e=Xc.MASKED),n===void 0&&(n=Xc.MASKED);const r=$n(t);return i=>r.runIsolated(o=>(o[e]=i,o[n]))}function uE(t,e,n,r){return Fv(e,n,r)(t)}ie.PIPE_TYPE=Xc;ie.createPipe=Fv;ie.pipe=uE;class cE extends ot{get repeatFrom(){var e;return(e=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?e:0}get repeatTo(){var e;return(e=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?e:1/0}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){var n,r,i;const{repeat:o,...s}=ss(e);this._blockOpts=Object.assign({},this._blockOpts,s);const a=$n(this._blockOpts);this.repeat=(n=(r=o??a.repeat)!=null?r:this.repeat)!=null?n:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((i=this._blocks)==null?void 0:i.length)||0,this.repeatFrom)),blocks:{m:a},eager:a.eager,overwrite:a.overwrite,skipInvalid:a.skipInvalid,lazy:a.lazy,placeholderChar:a.placeholderChar,displayChar:a.displayChar})}_allocateBlock(e){if(e<this._blocks.length)return this._blocks[e];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push($n(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(e,n){n===void 0&&(n={});const r=new de;for(let l=(i=(o=this._mapPosToBlock(this.displayValue.length))==null?void 0:o.index)!=null?i:Math.max(this._blocks.length-1,0),u,c;u=(s=this._blocks[l])!=null?s:c=!c&&this._allocateBlock(l);++l){var i,o,s,a;const d=u._appendChar(e,{...n,_beforeTailState:(a=n._beforeTailState)==null||(a=a._blocks)==null?void 0:a[l]});if(d.skip&&c){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(r.aggregate(d),d.consumed)break}return r}_trimEmptyTail(e,n){var r,i;e===void 0&&(e=0);const o=Math.max(((r=this._mapPosToBlock(e))==null?void 0:r.index)||0,this.repeatFrom,0);let s;n!=null&&(s=(i=this._mapPosToBlock(n))==null?void 0:i.index),s==null&&(s=this._blocks.length-1);let a=0;for(let l=s;o<=l&&!this._blocks[l].unmaskedValue;--l,++a);a&&(this._blocks.splice(s-a+1,a),this.mask=this.mask.slice(a))}reset(){super.reset(),this._trimEmptyTail()}remove(e,n){e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length);const r=super.remove(e,n);return this._trimEmptyTail(e,n),r}totalInputPositions(e,n){return e===void 0&&(e=0),n==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(e,n)}get state(){return super.state}set state(e){this._blocks.length=e._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=e}}ie.RepeatBlock=cE;try{globalThis.IMask=ie}catch{}function dE(t,e){let{emit:n,onAccept:r,onComplete:i,defaultValue:o,defaultUnmaskedValue:s,defaultTypedValue:a}=e===void 0?{}:e;const l=kk(t)?t:X(t),u=X(),c=X(),d=X(""),h=X(""),p=X();let f,m=d.value,g=h.value,y=p.value;function b(){y=p.value=c.value.typedValue,g=h.value=c.value.unmaskedValue,m=d.value=c.value.value}function k(C){b(),n&&(n("accept",d.value,C),n("accept:masked",d.value,C),n("accept:typed",p.value,C),n("accept:unmasked",h.value,C)),r?.(C)}function v(C){n&&(n("complete",c.value.value,C),n("complete:masked",c.value.value,C),n("complete:typed",c.value.typedValue,C),n("complete:unmasked",c.value.unmaskedValue,C)),i?.(C)}const w=()=>{!c.value||h.value===void 0||(g!==h.value&&(c.value.unmaskedValue=h.value,c.value.unmaskedValue!==h.value&&k()),g=void 0)};Ee(h,w);const x=()=>{!c.value||d.value===void 0||(m!==d.value&&(c.value.value=d.value,c.value.value!==d.value&&k()),m=void 0)};Ee(d,x);const T=()=>{!c.value||p.value===void 0||(y!==p.value&&(c.value.typedValue=p.value,c.value.masked.typedValueEquals(p.value)||k()),y=void 0)};Ee(p,T);function F(){f=u.value;const C=l.value;!f||!(C!=null&&C.mask)||(c.value=ie(f,C),o!==void 0&&(d.value=o),s!==void 0&&(h.value=s),a!==void 0&&(p.value=a),w(),x(),T(),b(),c.value.on("accept",k).on("complete",v))}function N(){var C;(C=c.value)==null||C.destroy(),c.value=void 0}return qn(F),wk(N),Ee([u,l],()=>{const C=u.value,_=l.value;(!(_!=null&&_.mask)||C!==f)&&N(),C&&(c.value?c.value.updateOptions(_):F())}),{el:u,mask:Qd(c),masked:d,unmasked:h,typed:p}}const pE={key:0,class:"k-input__prefix"},hE=["id","aria-labelledby","aria-describedby","required","type"],fE={key:1,class:"k-input__suffix"},mE=Q({__name:"Input",props:{invalid:{type:Boolean},id:{},modelValue:{},prefix:{},suffix:{},mask:{},align:{default:"left"},type:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=Lg(),r=t,i=e;function o(p){r.mask||i("update:modelValue",p.target.value)}const s=rn("k-input",{variants:{invalid:{true:"k-input--invalid"},align:{left:"k-input--align-left",right:"k-input--align-right"}}}),a=rp(tu,D(()=>({id:r.id,invalid:r.invalid,required:!1,events:{onBlur:()=>{},onFocus:()=>{}}}))),l=p=>{var f;(f=a.value.events)==null||f.onFocus(p),n.onFocus&&n.onFocus(p)},u=p=>{var f;(f=a.value.events)==null||f.onBlur(p),n.onBlur&&n.onBlur(p)},{unmasked:c,masked:d,el:h}=dE(r.mask,{defaultValue:String(r.modelValue),onAccept:()=>{var p,f;if((p=r.mask)!=null&&p.pattern)return;const m=((f=r.mask)==null?void 0:f.mask)===Number?parseFloat(c.value):d.value;m!==r.modelValue&&i("update:modelValue",m)}});return qn(()=>{Ee(()=>r.modelValue,p=>{r.mask&&c.value!==String(p)&&(c.value=String(p)),r.mask||(h.value.value=p)},{immediate:!0})}),(p,f)=>(E(),O("div",{class:Ce(B(s)({invalid:B(a).invalid,align:p.align}))},[p.$slots.prefix||p.prefix?(E(),O("span",pE,[P(p.$slots,"prefix",{},()=>[$e(se(p.prefix),1)])])):I("",!0),H("input",ne({class:"k-input__input",id:B(a).id,"aria-labelledby":B(a).labelId,"aria-describedby":B(a).helpId,required:B(a).required,onInput:o,onBlur:u,onFocus:l,ref_key:"el",ref:h,type:r.type},{...B(a).events,...p.$attrs}),null,16,hE),p.$slots.suffix||p.suffix?(E(),O("span",fE,[P(p.$slots,"suffix",{},()=>[$e(se(p.suffix),1)])])):I("",!0)],2))}}),gE=["id","value","aria-labelledby","aria-describedby"],gL=Q({__name:"TextArea",props:{invalid:{type:Boolean},id:{},modelValue:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e;function i(a){r("update:modelValue",a.target.value)}const o=rn("k-textarea",{variants:{invalid:{true:"k-textarea--invalid"}}}),s=rp(tu,D(()=>({id:n.id,invalid:n.invalid})));return(a,l)=>(E(),O("textarea",ne({class:B(o)({invalid:B(s).invalid}),id:B(s).id,value:a.modelValue,"aria-labelledby":B(s).labelId,"aria-describedby":B(s).helpId,onInput:i},a.$attrs),null,16,gE))}});let vE=class{constructor(t,e){Yt(this,"key"),Yt(this,"goto"),this.key=t,this.goto=e,this.set()}get(){return localStorage.getItem(this.key)||""}set(t=this.get()){const e=this.goto(t);this.get()!==e&&localStorage.setItem(this.key,e)}destroy(){}},yE=class{constructor(t,e){Yt(this,"key"),Yt(this,"goto"),Yt(this,"current"),this.key=t,this.goto=e,this.set()}get(){return this.current||""}set(t=this.get()){this.current=this.goto(t)}destroy(){}};class bE{constructor(e,n){Yt(this,"key"),Yt(this,"goto"),this.key=e,this.goto=n,this.set()}get(){return sessionStorage.getItem(this.key)||""}set(e=this.get()){const n=this.goto(e);this.get()!==n&&sessionStorage.setItem(this.key,n)}destroy(){}}const kE=Object.freeze(Object.defineProperty({__proto__:null,localStorage:vE,none:yE,sessionStorage:bE},Symbol.toStringTag,{value:"Module"})),wE=["data-step"],xE={key:0,class:"k-stepper-breadcrumbs-wrapper"},EE={key:0,class:"k-stepper__breadcrumb-arrow"},CE=["disabled","onClick"],SE={class:"k-stepper__breadcrumb-icon"},TE={class:"k-stepper__breadcrumb-label"},OE={class:"k-stepper__component-wrapper"},AE={key:0,class:"k-stepper__navigation"},vL=Q({__name:"Stepper",props:{steps:{},stateHandler:{default:"none"},stateKey:{default:"step"},transitionPreset:{default:"slide"},transitionNext:{},transitionPrev:{},breadcrumbPlacement:{default:"top"},keepAlive:{type:Boolean},hidebreadcrumbs:{type:Boolean,default:!1}},setup(t,{expose:e}){const n=t,r=X(),i=X(),o=X(n.steps[0].id);let s;const a=typeof n.stateHandler=="string"?kE[n.stateHandler]:n.stateHandler;s=new a(n.stateKey,f),ao(()=>s.destroy());const l=D(()=>c(o.value)),u=D(()=>{const k=d(o.value);return{...k?.bind||{},step:k,onNext:h,onPrev:p}});function c(k){const v=d(k),w=n.steps.findIndex(({id:x})=>!v||x===v.id);return{prev:w>0?n.steps[w-1]:null,current:v,next:w<n.steps.length-1?n.steps[w+1]:null}}function d(k){return n.steps.find(v=>v.id===k)}const h=()=>l.value.next&&f(l.value.next.id),p=()=>l.value.prev&&f(l.value.prev.id);function f(k){var v;if(k===o.value)return o.value;const w=n.steps.find(x=>!k||x.id===k);return w!=null&&w.disabled?f((v=c(w.id).prev)==null?void 0:v.id):(o.value=(w||n.steps[0]).id,s&&s.set(o.value),o.value)}const m=sp({next:h,prev:p,goto:f});Ee(o,(k,v)=>i.value=v);const g=()=>{if(!i.value)return"next";const{steps:k}=n;return k.findIndex(v=>v.id===i.value)>k.findIndex(v=>v.id===o.value)?"prev":"next"};function y(){const{transitionNext:k,transitionPreset:v,transitionPrev:w,breadcrumbPlacement:x}=n;if(k||w)return g()==="next"?k:w;if(v==="fade")return`k-stepper-${v}`;const T=["top","bottom"].includes(x)?"h":"v";return`k-stepper-${v}-${T}-${g()}`}const b=()=>{var k;const v=(k=r.value)==null?void 0:k.getBoundingClientRect();if(!v)return;const w=v.top-20;w>0||window.scrollTo({top:w+window.scrollY,behavior:"smooth"})};return e({goto:f,next:h,prev:p,meta:l}),(k,v)=>(E(),O("div",{class:Ce(`k-stepper k-stepper--breadcrumb-placement-${k.breadcrumbPlacement}`),"data-step":o.value},[k.hidebreadcrumbs?I("",!0):(E(),O("div",xE,[P(k.$slots,"before-breadcrumbs",be(Ne({meta:l.value,navigate:m}))),H("div",{class:"k-stepper__breadcrumbs",ref_key:"breadcrumb",ref:r},[(E(!0),O(Ie,null,_t(k.steps,(w,x)=>(E(),O(Ie,null,[x>0?(E(),O("div",EE)):I("",!0),P(k.$slots,"breadcrumb",{step:w,isActive:w.id===o.value,index:x,select:()=>f(w.id)},()=>[H("button",{type:"button",class:Ce(["k-stepper__breadcrumb",{"k-stepper__breadcrumb--default":w.isValid===void 0,"k-stepper__breadcrumb--active":w.id===o.value,"k-stepper__breadcrumb--invalid":w.isValid===!1,"k-stepper__breadcrumb--valid":w.isValid===!0}]),disabled:w.disabled,onClick:T=>f(w.id)},[H("span",SE,[P(k.$slots,"breadcrumb-icon",{step:w},()=>[w.isValid===!0?(E(),$(B(Ze),{key:0,icon:"heroicons-solid:check",width:12})):w.isValid===!1?(E(),$(B(Ze),{key:1,icon:"heroicons:exclamation-triangle",width:17})):(E(),O(Ie,{key:2},[$e(se(x+1),1)],64))])]),H("span",TE,se(w.label),1)],10,CE)])],64))),256))],512),P(k.$slots,"after-breadcrumbs",be(Ne({meta:l.value,navigate:m})))])),P(k.$slots,"before-content",be(Ne({meta:l.value,navigate:m}))),H("div",OE,[he(tp,{name:y(),mode:"out-in",onAfterEnter:b},{default:Z(()=>[k.keepAlive?(E(),$(xk,{key:0},[(E(),$(Qe(u.value.step.component),ne({key:o.value},u.value),null,16))],1024)):(E(),$(Qe(u.value.step.component),ne({key:o.value},u.value),null,16))]),_:1},8,["name"]),k.$slots.navigation?(E(),O("div",AE,[P(k.$slots,"navigation",be(Ne({meta:l.value,navigate:m})))])):I("",!0)]),P(k.$slots,"after-content",be(Ne({meta:l.value,navigate:m})))],10,wE))}}),ME=["src","alt"],au=Q({__name:"Image",props:{src:{},preview:{},alt:{},caption:{},captionVisibility:{default:"hover"},captionTheme:{default:"dark"},size:{default:"cover"},position:{default:"center"},width:{},height:{},aspectRatio:{}},emits:["loaded","error"],setup(t,{emit:e}){const n=t,r=e,i=X(),o=X(!1),s=X(!1),a=X(),l=D(()=>({"--k-image-size":n.size,"--k-image-preview":n.preview||"","--k-image-position":n.position,"--k-image-width":n.width||"initial","--k-image-height":n.height||"initial","--k-image-aspectratio":(n.aspectRatio==="natural"?a.value:n.aspectRatio)||"initial"}));function u(){o.value=!0;const{naturalWidth:d=0,naturalHeight:h=0}=i.value||{};a.value=`${d}/${h}`,r("loaded")}function c(){o.value=!0,s.value=!0,r("error")}return qn(()=>{var d;return((d=i.value)==null?void 0:d.complete)&&u()}),(d,h)=>(E(),O("figure",{class:Ce(["k-image",[`k-image--size-${d.size}`,{"k-image--loaded":o.value,"k-image--loading":!o.value}]]),style:Cr(l.value)},[o.value?I("",!0):(E(),$(Qg,{key:0,size:"small"})),Va(H("img",{src:d.src,alt:d.alt||d.caption,onLoad:u,onError:c,ref_key:"image",ref:i},null,40,ME),[[Ig,!s.value]]),d.$slots.caption||d.caption?(E(),O("figcaption",{key:1,class:Ce(`k-image__caption k-image__caption--visibility-${d.captionVisibility} k-image__caption--theme-${!o.value||s.value?"light":d.captionTheme}`)},[P(d.$slots,"caption",{},()=>[$e(se(d.caption),1)])],2)):I("",!0)],6))}}),ni=Q({__name:"Flex",props:{is:{default:"div"},gap:{default:"default"},justify:{},align:{},direction:{default:"row"},nowrap:{type:Boolean}},setup(t){const e=t,n=D(()=>Zg("flex",{justify:ja(e.justify)||"initial",align:ja(e.align)||"initial",wrap:e.nowrap?"nowrap":"wrap",gap:cp(e.gap),direction:e.direction}));return(r,i)=>(E(),$(Qe(r.is),{class:"k-flex",style:Cr(n.value)},{default:Z(()=>[P(r.$slots,"default")]),_:3},8,["style"]))}}),_E={key:0,class:"k-card__thumbnail"},DE={key:0,class:"k-card__title"},NE={key:1,class:"k-card__subtitle"},IE={key:2,class:"k-card__content"},RE=Q({inheritAttrs:!1,__name:"Card",props:{is:{default:"div"},title:{},subtitle:{},variant:{default:"default"},appearance:{default:"border"},thumbnail:{},thumbnailOptions:{default:()=>({size:"cover",aspectRatio:"16/9",width:"100%"})}},setup(t){const e=t,n=ip(),r=D(()=>e.thumbnail||n.thumbnail),i=D(()=>e.title||e.subtitle||n.header),o=D(()=>n.actions),s=D(()=>n.default);return(a,l)=>(E(),$(Qe(a.is),ne({class:["k-card",`k-card--variant-${a.variant}`,`k-card--appearance-${a.appearance}`,{"k-card--has-thumbnail":r.value},{"k-card--has-header":i.value},{"k-card--has-content":s.value},{"k-card--has-actions":o.value}]},a.$attrs),{default:Z(()=>[r.value?(E(),O("div",_E,[P(a.$slots,"thumbnail",{},()=>[a.thumbnail?(E(),$(au,ne({key:0},a.thumbnailOptions,{src:a.thumbnail}),null,16,["src"])):I("",!0)])])):I("",!0),i.value?(E(),$(ni,{key:1,is:"header",direction:"column",gap:"0rem",class:"k-card__header"},{default:Z(()=>[P(a.$slots,"header",{},()=>[a.title?(E(),O("div",DE,se(a.title),1)):I("",!0),a.subtitle?(E(),O("div",NE,se(a.subtitle),1)):I("",!0)])]),_:3})):I("",!0),s.value?(E(),O("div",IE,[P(a.$slots,"default")])):I("",!0),o.value?(E(),$(ni,{key:3,justify:"center",align:"center",class:"k-card__actions"},{default:Z(()=>[P(a.$slots,"actions")]),_:3})):I("",!0)]),_:3},16,["class"]))}}),yL=Q({__name:"Skeleton",props:{variant:{default:"shiny"},aspectRatio:{},width:{},height:{},rounding:{}},setup(t){const e=()=>t.rounding?t.rounding==="full"?"9999px":cp(t.rounding,"rounding"):"initial",n=D(()=>({"--aspect-ratio":!t.aspectRatio||t.width&&t.height?"initial":t.aspectRatio,"--width":t.width||"initial","--height":t.height||"initial","--border-radius":e()}));return(r,i)=>(E(),O("span",{class:Ce(["k-skeleton",`k-skeleton--variant-${r.variant}`]),style:Cr(n.value)},[P(r.$slots,"default")],6))}});function PE(t,e){if(!t){e(void 0);return}e({width:t.offsetWidth,height:t.offsetHeight});const n=t.ownerDocument.defaultView??window,r=new n.ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const[o]=i;let s,a;if("borderBoxSize"in o){const l=o.borderBoxSize,u=Array.isArray(l)?l[0]:l;s=u.inlineSize,a=u.blockSize}else s=t.offsetWidth,a=t.offsetHeight;e({width:s,height:a})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}function FE(t){const{getNodes:e,observeMutation:n=!0,callback:r}=t,i=[];let o=null;function s(){const a=e();o=a[0];const l=a.map((u,c)=>PE(u,d=>{r(d,c)}));i.push(...l)}if(s(),n){const a=LE(o,s);i.push(a)}return()=>{i.forEach(a=>{a?.()})}}function LE(t,e){var n;if(!t||!t.parentElement)return;const r=((n=t.ownerDocument)==null?void 0:n.defaultView)??window,i=new r.MutationObserver(()=>{e()});return i.observe(t.parentElement,{childList:!0}),()=>{i.disconnect()}}var VE=Ln("slider").parts("root","label","thumb","valueText","track","range","control","markerGroup","marker","draggingIndicator"),ln=VE.build(),Lv=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`slider:${t.id}`},Vv=(t,e)=>{var n,r;return((r=(n=t.ids)==null?void 0:n.thumb)==null?void 0:r.call(n,e))??`slider:${t.id}:thumb:${e}`},Yc=(t,e)=>{var n,r;return((r=(n=t.ids)==null?void 0:n.hiddenInput)==null?void 0:r.call(n,e))??`slider:${t.id}:input:${e}`},Bv=t=>{var e;return((e=t.ids)==null?void 0:e.control)??`slider:${t.id}:control`},BE=t=>{var e;return((e=t.ids)==null?void 0:e.track)??`slider:${t.id}:track`},$E=t=>{var e;return((e=t.ids)==null?void 0:e.range)??`slider:${t.id}:range`},of=t=>{var e;return((e=t.ids)==null?void 0:e.label)??`slider:${t.id}:label`},jE=t=>{var e;return((e=t.ids)==null?void 0:e.valueText)??`slider:${t.id}:value-text`},zE=(t,e)=>{var n,r;return((r=(n=t.ids)==null?void 0:n.marker)==null?void 0:r.call(n,e))??`slider:${t.id}:marker:${e}`},HE=t=>t.getById(Lv(t)),qE=(t,e)=>t.getById(Vv(t,e)),$v=(t,e)=>t.getById(Yc(t,e)),jv=t=>t.getById(Bv(t)),zv=t=>yp(jv(t),"[role=slider]"),WE=t=>zv(t)[0],sf=(t,e)=>{const{prop:n,scope:r}=t,i=jv(r);if(!i)return;const o=Sx(e,i).getPercentValue({orientation:n("orientation"),dir:n("dir"),inverted:{y:!0}});return wv(o,n("min"),n("max"),n("step"))},UE=(t,e)=>{e.forEach((n,r)=>{const i=$v(t,r);i&&gx(i,{value:n})})};function KE(t){const e=t[0],n=t[t.length-1];return[e,n]}function GE(t){const{prop:e,computed:n}=t,r=n("valuePercent"),[i,o]=KE(r);if(r.length===1){if(e("origin")==="center"){const s=r[0]<50,a=s?`${r[0]}%`:"50%",l=s?"50%":`${100-r[0]}%`;return{start:a,end:l}}return{start:"0%",end:`${100-o}%`}}return{start:`${i}%`,end:`${100-o}%`}}function JE(t){const{computed:e}=t,n=e("isVertical"),r=e("isRtl");return n?{position:"absolute",bottom:"var(--slider-range-start)",top:"var(--slider-range-end)"}:{position:"absolute",[r?"right":"left"]:"var(--slider-range-start)",[r?"left":"right"]:"var(--slider-range-end)"}}function XE(t,e){const{context:n,prop:r}=t,{height:i=0}=n.get("thumbSize")??{},o=Kc([r("min"),r("max")],[-i/2,i/2]);return parseFloat(o(e).toFixed(2))}function YE(t,e){const{computed:n,context:r,prop:i}=t,{width:o=0}=r.get("thumbSize")??{};if(n("isRtl")){const a=Kc([i("max"),i("min")],[-o/2,o/2]);return-1*parseFloat(a(e).toFixed(2))}const s=Kc([i("min"),i("max")],[-o/2,o/2]);return parseFloat(s(e).toFixed(2))}function ZE(t,e,n){const{computed:r,prop:i}=t;if(i("thumbAlignment")==="center")return`${e}%`;const o=r("isVertical")?XE(t,n):YE(t,n);return`calc(${e}% - ${o}px)`}function Hv(t,e){const{prop:n}=t,r=xp(e,n("min"),n("max"))*100;return ZE(t,r,e)}function qv(t){const{computed:e,prop:n}=t;let r="visible";return n("thumbAlignment")==="contain"&&!e("hasMeasuredThumbSize")&&(r="hidden"),r}function af(t,e){const{computed:n}=t,r=n("isVertical")?"bottom":"insetInlineStart";return{visibility:qv(t),position:"absolute",transform:"var(--slider-thumb-transform)",[r]:`var(--slider-thumb-offset-${e})`}}function QE(){return{touchAction:"none",userSelect:"none",WebkitUserSelect:"none",position:"relative"}}function eC(t){const{context:e,computed:n}=t,r=n("isVertical"),i=n("isRtl"),o=GE(t);return{...e.get("value").reduce((s,a,l)=>{const u=Hv(t,a);return{...s,[`--slider-thumb-offset-${l}`]:u}},{}),"--slider-thumb-transform":r?"translateY(50%)":i?"translateX(50%)":"translateX(-50%)","--slider-range-start":o.start,"--slider-range-end":o.end}}function tC(t,e){const{computed:n}=t,r=n("isHorizontal"),i=n("isRtl");return{visibility:qv(t),position:"absolute",pointerEvents:"none",[r?"insetInlineStart":"bottom"]:Hv(t,e),translate:"var(--tx) var(--ty)","--tx":r?i?"50%":"-50%":"0%","--ty":r?"0%":"50%"}}function nC(){return{userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none",position:"relative"}}function rC(t,e){return e.map((n,r)=>Zc(t,n,r))}function hr(t,e){const{context:n,prop:r}=t;return u1(n.get("value"),r("min"),r("max"),r("minStepsBetweenThumbs"))[e]}function Zc(t,e,n){const{prop:r}=t,i=hr(t,n),o=xv(e,r("min"),r("max"),r("step"));return Ql(o,i.min,i.max)}function iC(t,e,n){const{context:r,prop:i}=t,o=e??r.get("focusedIndex"),s=hr(t,o),a=a1(o,{...s,step:n??i("step"),values:r.get("value")});return a[o]=Ql(a[o],s.min,s.max),a}function oC(t,e,n){const{context:r,prop:i}=t,o=e??r.get("focusedIndex"),s=hr(t,o),a=s1(o,{...s,step:n??i("step"),values:r.get("value")});return a[o]=Ql(a[o],s.min,s.max),a}function sC(t,e){const{context:n}=t;return l1(n.get("value"),e)}function Wv(t,e){const{state:n,send:r,context:i,prop:o,computed:s,scope:a}=t,l=o("aria-label"),u=o("aria-labelledby"),c=i.get("value"),d=i.get("focusedIndex"),h=n.matches("focus"),p=n.matches("dragging"),f=s("isDisabled"),m=o("invalid"),g=s("isInteractive"),y=o("orientation")==="horizontal",b=o("orientation")==="vertical";function k(w){return xp(w,o("min"),o("max"))}function v(w){return wv(w,o("min"),o("max"),o("step"))}return{value:c,dragging:p,focused:h,setValue(w){r({type:"SET_VALUE",value:w})},getThumbValue(w){return c[w]},setThumbValue(w,x){r({type:"SET_VALUE",index:w,value:x})},getValuePercent:k,getPercentValue:v,getThumbPercent(w){return k(c[w])},setThumbPercent(w,x){const T=v(x);r({type:"SET_VALUE",index:w,value:T})},getThumbMin(w){return hr(t,w).min},getThumbMax(w){return hr(t,w).max},increment(w){r({type:"INCREMENT",index:w})},decrement(w){r({type:"DECREMENT",index:w})},focus(){g&&r({type:"FOCUS",index:0})},getLabelProps(){return e.label({...ln.label.attrs,dir:o("dir"),"data-disabled":G(f),"data-orientation":o("orientation"),"data-invalid":G(m),"data-dragging":G(p),"data-focus":G(h),id:of(a),htmlFor:Yc(a,0),onClick(w){var x;g&&(w.preventDefault(),(x=WE(a))==null||x.focus())},style:{userSelect:"none",WebkitUserSelect:"none"}})},getRootProps(){return e.element({...ln.root.attrs,"data-disabled":G(f),"data-orientation":o("orientation"),"data-dragging":G(p),"data-invalid":G(m),"data-focus":G(h),id:Lv(a),dir:o("dir"),style:eC(t)})},getValueTextProps(){return e.element({...ln.valueText.attrs,dir:o("dir"),"data-disabled":G(f),"data-orientation":o("orientation"),"data-invalid":G(m),"data-focus":G(h),id:jE(a)})},getTrackProps(){return e.element({...ln.track.attrs,dir:o("dir"),id:BE(a),"data-disabled":G(f),"data-invalid":G(m),"data-dragging":G(p),"data-orientation":o("orientation"),"data-focus":G(h),style:{position:"relative"}})},getThumbProps(w){var x;const{index:T=0,name:F}=w,N=c[T],C=hr(t,T),_=(x=o("getAriaValueText"))==null?void 0:x({value:N,index:T}),L=Array.isArray(l)?l[T]:l,W=Array.isArray(u)?u[T]:u;return e.element({...ln.thumb.attrs,dir:o("dir"),"data-index":T,"data-name":F,id:Vv(a,T),"data-disabled":G(f),"data-orientation":o("orientation"),"data-focus":G(h&&d===T),"data-dragging":G(p&&d===T),draggable:!1,"aria-disabled":jw(f),"aria-label":L,"aria-labelledby":W??of(a),"aria-orientation":o("orientation"),"aria-valuemax":C.max,"aria-valuemin":C.min,"aria-valuenow":c[T],"aria-valuetext":_,role:"slider",tabIndex:f?void 0:0,style:af(t,T),onPointerDown(q){g&&(r({type:"THUMB_POINTER_DOWN",index:T}),q.stopPropagation())},onBlur(){g&&r({type:"BLUR"})},onFocus(){g&&r({type:"FOCUS",index:T})},onKeyDown(q){if(q.defaultPrevented||!g)return;const K=fx(q)*o("step"),J={ArrowUp(){y||r({type:"ARROW_INC",step:K,src:"ArrowUp"})},ArrowDown(){y||r({type:"ARROW_DEC",step:K,src:"ArrowDown"})},ArrowLeft(){b||r({type:"ARROW_DEC",step:K,src:"ArrowLeft"})},ArrowRight(){b||r({type:"ARROW_INC",step:K,src:"ArrowRight"})},PageUp(){r({type:"ARROW_INC",step:K,src:"PageUp"})},PageDown(){r({type:"ARROW_DEC",step:K,src:"PageDown"})},Home(){r({type:"HOME"})},End(){r({type:"END"})}},ue=iv(q,{dir:o("dir"),orientation:o("orientation")}),ge=J[ue];ge&&(ge(q),q.preventDefault(),q.stopPropagation())}})},getHiddenInputProps(w){const{index:x=0,name:T}=w;return e.input({name:T??(o("name")?o("name")+(c.length>1?"[]":""):void 0),form:o("form"),type:"text",hidden:!0,defaultValue:c[x],id:Yc(a,x)})},getRangeProps(){return e.element({id:$E(a),...ln.range.attrs,dir:o("dir"),"data-dragging":G(p),"data-focus":G(h),"data-invalid":G(m),"data-disabled":G(f),"data-orientation":o("orientation"),style:JE(t)})},getControlProps(){return e.element({...ln.control.attrs,dir:o("dir"),id:Bv(a),"data-dragging":G(p),"data-disabled":G(f),"data-orientation":o("orientation"),"data-invalid":G(m),"data-focus":G(h),style:QE(),onPointerDown(w){if(!g||!ax(w)||ux(w))return;const x=fp(w);r({type:"POINTER_DOWN",point:x}),w.preventDefault(),w.stopPropagation()}})},getMarkerGroupProps(){return e.element({...ln.markerGroup.attrs,role:"presentation",dir:o("dir"),"aria-hidden":!0,"data-orientation":o("orientation"),style:nC()})},getMarkerProps(w){const x=tC(t,w.value);let T;return w.value<vv(c)?T="under-value":w.value>yv(c)?T="over-value":T="at-value",e.element({...ln.marker.attrs,id:zE(a,w.value),role:"presentation",dir:o("dir"),"data-orientation":o("orientation"),"data-value":w.value,"data-disabled":G(f),"data-state":T,style:x})},getDraggingIndicatorProps(w){const{index:x=0}=w,T=x===d&&p;return e.element({...ln.draggingIndicator.attrs,role:"presentation",dir:o("dir"),hidden:!T,"data-orientation":o("orientation"),"data-state":T?"open":"closed",style:af(t,x)})}}}var aC=(t,e)=>t?.width===e?.width&&t?.height===e?.height,Uv={props({props:t}){return{dir:"ltr",thumbAlignment:"contain",min:0,max:100,step:1,defaultValue:[0],origin:"start",orientation:"horizontal",minStepsBetweenThumbs:0,...t}},initialState(){return"idle"},context({prop:t,bindable:e,getContext:n}){return{thumbSize:e(()=>({defaultValue:t("thumbSize")||null})),value:e(()=>({defaultValue:t("defaultValue"),value:t("value"),hash(r){return r.join(",")},onChange(r){var i;(i=t("onValueChange"))==null||i({value:r})}})),focusedIndex:e(()=>({defaultValue:-1,onChange(r){var i;const o=n();(i=t("onFocusChange"))==null||i({focusedIndex:r,value:o.get("value")})}})),fieldsetDisabled:e(()=>({defaultValue:!1}))}},computed:{isHorizontal:({prop:t})=>t("orientation")==="horizontal",isVertical:({prop:t})=>t("orientation")==="vertical",isRtl:({prop:t})=>t("orientation")==="horizontal"&&t("dir")==="rtl",isDisabled:({context:t,prop:e})=>!!e("disabled")||t.get("fieldsetDisabled"),isInteractive:({prop:t,computed:e})=>!(t("readOnly")||e("isDisabled")),hasMeasuredThumbSize:({context:t})=>t.get("thumbSize")!=null,valuePercent({context:t,prop:e}){return t.get("value").map(n=>100*xp(n,e("min"),e("max")))}},watch({track:t,action:e,context:n}){t([()=>n.hash("value")],()=>{e(["syncInputElements","dispatchChangeEvent"])})},effects:["trackFormControlState","trackThumbsSize"],on:{SET_VALUE:[{guard:"hasIndex",actions:["setValueAtIndex"]},{actions:["setValue"]}],INCREMENT:{actions:["incrementThumbAtIndex"]},DECREMENT:{actions:["decrementThumbAtIndex"]}},states:{idle:{on:{POINTER_DOWN:{target:"dragging",actions:["setClosestThumbIndex","setPointerValue","focusActiveThumb"]},FOCUS:{target:"focus",actions:["setFocusedIndex"]},THUMB_POINTER_DOWN:{target:"dragging",actions:["setFocusedIndex","focusActiveThumb"]}}},focus:{entry:["focusActiveThumb"],on:{POINTER_DOWN:{target:"dragging",actions:["setClosestThumbIndex","setPointerValue","focusActiveThumb"]},THUMB_POINTER_DOWN:{target:"dragging",actions:["setFocusedIndex","focusActiveThumb"]},ARROW_DEC:{actions:["decrementThumbAtIndex","invokeOnChangeEnd"]},ARROW_INC:{actions:["incrementThumbAtIndex","invokeOnChangeEnd"]},HOME:{actions:["setFocusedThumbToMin","invokeOnChangeEnd"]},END:{actions:["setFocusedThumbToMax","invokeOnChangeEnd"]},BLUR:{target:"idle",actions:["clearFocusedIndex"]}}},dragging:{entry:["focusActiveThumb"],effects:["trackPointerMove"],on:{POINTER_UP:{target:"focus",actions:["invokeOnChangeEnd"]},POINTER_MOVE:{actions:["setPointerValue"]}}}},implementations:{guards:{hasIndex:({event:t})=>t.index!=null},effects:{trackFormControlState({context:t,scope:e}){return Yl(HE(e),{onFieldsetDisabledChange(n){t.set("fieldsetDisabled",n)},onFormReset(){t.set("value",t.initial("value"))}})},trackPointerMove({scope:t,send:e}){return Mx(t.getDoc(),{onPointerMove(n){e({type:"POINTER_MOVE",point:n.point})},onPointerUp(){e({type:"POINTER_UP"})}})},trackThumbsSize({context:t,scope:e,prop:n}){if(!(n("thumbAlignment")!=="contain"||t.get("thumbSize")))return FE({getNodes:()=>zv(e),observeMutation:!0,callback(r){!r||aC(t.get("thumbSize"),r)||t.set("thumbSize",r)}})}},actions:{dispatchChangeEvent({context:t,scope:e}){UE(e,t.get("value"))},syncInputElements({context:t,scope:e}){t.get("value").forEach((n,r)=>{const i=$v(e,r);sv(i,n.toString())})},invokeOnChangeEnd({prop:t,context:e}){var n;(n=t("onValueChangeEnd"))==null||n({value:e.get("value")})},setClosestThumbIndex(t){const{context:e,event:n}=t,r=sf(t,n.point);if(r==null)return;const i=sC(t,r);e.set("focusedIndex",i)},setFocusedIndex({context:t,event:e}){t.set("focusedIndex",e.index)},clearFocusedIndex({context:t}){t.set("focusedIndex",-1)},setPointerValue(t){queueMicrotask(()=>{const{context:e,event:n}=t,r=sf(t,n.point);if(r==null)return;const i=e.get("focusedIndex"),o=Zc(t,r,i);e.set("value",s=>To(s,i,o))})},focusActiveThumb({scope:t,context:e}){At(()=>{const n=qE(t,e.get("focusedIndex"));n?.focus({preventScroll:!0})})},decrementThumbAtIndex(t){const{context:e,event:n}=t,r=iC(t,n.index,n.step);e.set("value",r)},incrementThumbAtIndex(t){const{context:e,event:n}=t,r=oC(t,n.index,n.step);e.set("value",r)},setFocusedThumbToMin(t){const{context:e}=t,n=e.get("focusedIndex"),{min:r}=hr(t,n);e.set("value",i=>To(i,n,r))},setFocusedThumbToMax(t){const{context:e}=t,n=e.get("focusedIndex"),{max:r}=hr(t,n);e.set("value",i=>To(i,n,r))},setValueAtIndex(t){const{context:e,event:n}=t,r=Zc(t,n.value,n.index);e.set("value",i=>To(i,n.index,r))},setValue(t){const{context:e,event:n}=t,r=rC(t,n.value);e.set("value",r)}}}};Wn()(["aria-label","aria-labelledby","dir","disabled","form","getAriaValueText","getRootNode","id","ids","invalid","max","min","minStepsBetweenThumbs","name","onFocusChange","onValueChange","onValueChangeEnd","orientation","origin","readOnly","step","thumbAlignment","thumbAlignment","thumbSize","value","defaultValue"]);Wn()(["index","name"]);const lC=["data-value"],uC=Q({__name:"RangeSlider",props:{modelValue:{},min:{default:0},max:{default:100},step:{default:1},minStepsBetweenThumbs:{},marker:{},markerFormat:{},format:{type:Function,default:()=>t=>t},getRootNode:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=pi(Uv,{id:Qt(),...n,defaultValue:n.modelValue,onValueChangeEnd:({value:l})=>{const[u,c]=[o.value.getThumbMin(0),o.value.getThumbMax(0)],[d,h]=[o.value.getThumbMin(1),o.value.getThumbMax(1)],p=Math.max(u,Math.min(c,l[0])),f=Math.min(h,Math.max(d,l[1]));n.modelValue[0]===p&&n.modelValue[1]===f||r("update:modelValue",[p,f])}}),o=D(()=>Wv(i,di)),s=l=>{const[u,c]=[o.value.getThumbMin(0),o.value.getThumbMax(0)],[d,h]=[o.value.getThumbMin(1),o.value.getThumbMax(1)],[p,f]=[o.value.getThumbValue(0),o.value.getThumbValue(1)],[m,g]=l;if(m===p&&g===f)return;const y=Math.max(u,Math.min(c,m)),b=Math.min(h,Math.max(d,g));return p===y&&f===b?r("update:modelValue",[y,b]):o.value.setValue([y,b])},a=D(()=>{if(!n.marker)return[];const l=Math.floor(n.max/n.marker)+1;return Array(l).fill(void 0).map((u,c)=>{const d=(n.marker||0)*c;return{value:d,label:n.markerFormat?n.markerFormat(d):n.format(d)}})});return Ee(()=>n.modelValue,s,{deep:!0}),(l,u)=>(E(),O("div",ne(o.value.getRootProps(),{class:"k-rangeslider"}),[H("div",be(Ne(o.value.getControlProps())),[H("div",be(Ne(o.value.getTrackProps())),[H("div",be(Ne(o.value.getRangeProps())),null,16)],16),(E(!0),O(Ie,null,_t(o.value.value,(c,d)=>(E(),O("div",ne({key:d,ref_for:!0},o.value.getThumbProps({index:d})),[H("input",ne({ref_for:!0},o.value.getHiddenInputProps({index:d})),null,16)],16))),128))],16),a.value.length?(E(),O("div",be(ne({key:0},o.value.getMarkerGroupProps())),[(E(!0),O(Ie,null,_t(a.value,c=>(E(),O("span",ne({ref_for:!0},o.value.getMarkerProps({value:c.value}),{"data-value":c.label}),null,16,lC))),256))],16)):I("",!0)],16))}}),cC=["data-value"],bL=Q({__name:"Slider",props:{modelValue:{},min:{default:0},max:{default:100},step:{default:1},marker:{},format:{type:Function,default:()=>t=>t},markerFormat:{},markerHighlight:{type:Boolean,default:!1},getRootNode:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=pi(Uv,{id:Qt(),...n,defaultValue:[n.modelValue],onValueChange:({value:l})=>{r("update:modelValue",l[0])}}),o=D(()=>Wv(i,di)),s=l=>o.value.setValue([Math.max(n.min||l,Math.min(n.max||l,l))]),a=D(()=>{const l=c=>n.markerFormat?n.markerFormat(c):n.format(c);if(!n.marker)return[];if(n.marker instanceof Array)return n.marker.map(c=>({value:c,label:l(c)}));const u=Math.floor((n.max-n.min)/n.marker)+1;return Array(u).fill(void 0).map((c,d)=>{const h=n.min+n.marker*d;return{value:h,label:l(h)}})});return Ee(()=>n.modelValue,s,{deep:!0}),(l,u)=>(E(),O("div",ne(o.value.getRootProps(),{class:["k-slider",{"k-slider--marker-highlight":l.markerHighlight}]}),[H("div",be(Ne(o.value.getControlProps())),[H("div",be(Ne(o.value.getTrackProps())),[H("div",be(Ne(o.value.getRangeProps())),null,16)],16),H("div",be(Ne(o.value.getThumbProps({index:0}))),[H("input",be(Ne(o.value.getHiddenInputProps({index:0}))),null,16)],16),H("output",be(Ne(o.value.getValueTextProps())),[P(l.$slots,"value",{value:o.value.value},()=>[$e(se(l.format(o.value.value.at(0))),1)])],16)],16),a.value.length?(E(),O("div",be(ne({key:0},o.value.getMarkerGroupProps())),[(E(!0),O(Ie,null,_t(a.value,c=>(E(),O("span",ne({ref_for:!0},o.value.getMarkerProps({value:c.value}),{"data-value":c.label}),null,16,cC))),256))],16)):I("",!0)],16))}}),Qc=Math.min,Fi=Math.max,Ka=Math.round,Qs=Math.floor,vn=t=>({x:t,y:t}),dC={left:"right",right:"left",bottom:"top",top:"bottom"},pC={start:"end",end:"start"};function Tp(t,e){return typeof t=="function"?t(e):t}function Wi(t){return t.split("-")[0]}function lu(t){return t.split("-")[1]}function hC(t){return t==="x"?"y":"x"}function Kv(t){return t==="y"?"height":"width"}function as(t){return["top","bottom"].includes(Wi(t))?"y":"x"}function Gv(t){return hC(as(t))}function fC(t,e,n){n===void 0&&(n=!1);const r=lu(t),i=Gv(t),o=Kv(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=Ga(s)),[s,Ga(s)]}function mC(t){const e=Ga(t);return[ed(t),e,ed(e)]}function ed(t){return t.replace(/start|end/g,e=>pC[e])}function gC(t,e,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?o:s;default:return[]}}function vC(t,e,n,r){const i=lu(t);let o=gC(Wi(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(ed)))),o}function Ga(t){return t.replace(/left|right|bottom|top/g,e=>dC[e])}function yC(t){return{top:0,right:0,bottom:0,left:0,...t}}function bC(t){return typeof t!="number"?yC(t):{top:t,right:t,bottom:t,left:t}}function Ja(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function lf(t,e,n){let{reference:r,floating:i}=t;const o=as(e),s=Gv(e),a=Kv(s),l=Wi(e),u=o==="y",c=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:c,y:r.y-i.height};break;case"bottom":p={x:c,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(lu(e)){case"start":p[s]-=h*(n&&u?-1:1);break;case"end":p[s]+=h*(n&&u?-1:1);break}return p}const kC=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(e));let u=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:c,y:d}=lf(u,r,l),h=r,p={},f=0;for(let m=0;m<a.length;m++){const{name:g,fn:y}=a[m],{x:b,y:k,data:v,reset:w}=await y({x:c,y:d,initialPlacement:r,placement:h,strategy:i,middlewareData:p,rects:u,platform:s,elements:{reference:t,floating:e}});c=b??c,d=k??d,p={...p,[g]:{...p[g],...v}},w&&f<=50&&(f++,typeof w=="object"&&(w.placement&&(h=w.placement),w.rects&&(u=w.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):w.rects),{x:c,y:d}=lf(u,h,l)),m=-1)}return{x:c,y:d,placement:h,strategy:i,middlewareData:p}};async function wC(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=t,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:h=!1,padding:p=0}=Tp(e,t),f=bC(p),m=a[h?d==="floating"?"reference":"floating":d],g=Ja(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(m)))==null||n?m:m.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:u,rootBoundary:c,strategy:l})),y=d==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,b=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),k=await(o.isElement==null?void 0:o.isElement(b))?await(o.getScale==null?void 0:o.getScale(b))||{x:1,y:1}:{x:1,y:1},v=Ja(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:b,strategy:l}):y);return{top:(g.top-v.top+f.top)/k.y,bottom:(v.bottom-g.bottom+f.bottom)/k.y,left:(g.left-v.left+f.left)/k.x,right:(v.right-g.right+f.right)/k.x}}const xC=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:u}=e,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:m=!0,...g}=Tp(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const y=Wi(i),b=as(a),k=Wi(a)===a,v=await(l.isRTL==null?void 0:l.isRTL(u.floating)),w=h||(k||!m?[Ga(a)]:mC(a)),x=f!=="none";!h&&x&&w.push(...vC(a,m,f,v));const T=[a,...w],F=await wC(e,g),N=[];let C=((r=o.flip)==null?void 0:r.overflows)||[];if(c&&N.push(F[y]),d){const q=fC(i,s,v);N.push(F[q[0]],F[q[1]])}if(C=[...C,{placement:i,overflows:N}],!N.every(q=>q<=0)){var _,L;const q=(((_=o.flip)==null?void 0:_.index)||0)+1,K=T[q];if(K)return{data:{index:q,overflows:C},reset:{placement:K}};let J=(L=C.filter(ue=>ue.overflows[0]<=0).sort((ue,ge)=>ue.overflows[1]-ge.overflows[1])[0])==null?void 0:L.placement;if(!J)switch(p){case"bestFit":{var W;const ue=(W=C.filter(ge=>{if(x){const Te=as(ge.placement);return Te===b||Te==="y"}return!0}).map(ge=>[ge.placement,ge.overflows.filter(Te=>Te>0).reduce((Te,mt)=>Te+mt,0)]).sort((ge,Te)=>ge[1]-Te[1])[0])==null?void 0:W[0];ue&&(J=ue);break}case"initialPlacement":J=a;break}if(i!==J)return{reset:{placement:J}}}return{}}}};async function EC(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=Wi(n),a=lu(n),l=as(n)==="y",u=["left","top"].includes(s)?-1:1,c=o&&l?-1:1,d=Tp(e,t);let{mainAxis:h,crossAxis:p,alignmentAxis:f}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof f=="number"&&(p=a==="end"?f*-1:f),l?{x:p*c,y:h*u}:{x:h*u,y:p*c}}const CC=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=e,l=await EC(e,t);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}};function uu(){return typeof window<"u"}function lo(t){return Jv(t)?(t.nodeName||"").toLowerCase():"#document"}function Dt(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Sn(t){var e;return(e=(Jv(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Jv(t){return uu()?t instanceof Node||t instanceof Dt(t).Node:!1}function en(t){return uu()?t instanceof Element||t instanceof Dt(t).Element:!1}function kn(t){return uu()?t instanceof HTMLElement||t instanceof Dt(t).HTMLElement:!1}function uf(t){return!uu()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Dt(t).ShadowRoot}function As(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=tn(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function SC(t){return["table","td","th"].includes(lo(t))}function cu(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Op(t){const e=Ap(),n=en(t)?tn(t):t;return["transform","translate","scale","rotate","perspective"].some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function TC(t){let e=wr(t);for(;kn(e)&&!Ui(e);){if(Op(e))return e;if(cu(e))return null;e=wr(e)}return null}function Ap(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ui(t){return["html","body","#document"].includes(lo(t))}function tn(t){return Dt(t).getComputedStyle(t)}function du(t){return en(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function wr(t){if(lo(t)==="html")return t;const e=t.assignedSlot||t.parentNode||uf(t)&&t.host||Sn(t);return uf(e)?e.host:e}function Xv(t){const e=wr(t);return Ui(e)?t.ownerDocument?t.ownerDocument.body:t.body:kn(e)&&As(e)?e:Xv(e)}function ls(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=Xv(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=Dt(i);if(o){const a=td(s);return e.concat(s,s.visualViewport||[],As(i)?i:[],a&&n?ls(a):[])}return e.concat(i,ls(i,[],n))}function td(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Yv(t){const e=tn(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=kn(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,a=Ka(n)!==o||Ka(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function Mp(t){return en(t)?t:t.contextElement}function Li(t){const e=Mp(t);if(!kn(e))return vn(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=Yv(e);let s=(o?Ka(n.width):n.width)/r,a=(o?Ka(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const OC=vn(0);function Zv(t){const e=Dt(t);return!Ap()||!e.visualViewport?OC:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function AC(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Dt(t)?!1:e}function ri(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=Mp(t);let s=vn(1);e&&(r?en(r)&&(s=Li(r)):s=Li(t));const a=AC(o,n,r)?Zv(o):vn(0);let l=(i.left+a.x)/s.x,u=(i.top+a.y)/s.y,c=i.width/s.x,d=i.height/s.y;if(o){const h=Dt(o),p=r&&en(r)?Dt(r):r;let f=h,m=td(f);for(;m&&r&&p!==f;){const g=Li(m),y=m.getBoundingClientRect(),b=tn(m),k=y.left+(m.clientLeft+parseFloat(b.paddingLeft))*g.x,v=y.top+(m.clientTop+parseFloat(b.paddingTop))*g.y;l*=g.x,u*=g.y,c*=g.x,d*=g.y,l+=k,u+=v,f=Dt(m),m=td(f)}}return Ja({width:c,height:d,x:l,y:u})}function _p(t,e){const n=du(t).scrollLeft;return e?e.left+n:ri(Sn(t)).left+n}function Qv(t,e,n){n===void 0&&(n=!1);const r=t.getBoundingClientRect(),i=r.left+e.scrollLeft-(n?0:_p(t,r)),o=r.top+e.scrollTop;return{x:i,y:o}}function MC(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const o=i==="fixed",s=Sn(r),a=e?cu(e.floating):!1;if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},u=vn(1);const c=vn(0),d=kn(r);if((d||!d&&!o)&&((lo(r)!=="body"||As(s))&&(l=du(r)),kn(r))){const p=ri(r);u=Li(r),c.x=p.x+r.clientLeft,c.y=p.y+r.clientTop}const h=s&&!d&&!o?Qv(s,l,!0):vn(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+c.x+h.x,y:n.y*u.y-l.scrollTop*u.y+c.y+h.y}}function _C(t){return Array.from(t.getClientRects())}function DC(t){const e=Sn(t),n=du(t),r=t.ownerDocument.body,i=Fi(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=Fi(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+_p(t);const a=-n.scrollTop;return tn(r).direction==="rtl"&&(s+=Fi(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function NC(t,e){const n=Dt(t),r=Sn(t),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const u=Ap();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a,y:l}}function IC(t,e){const n=ri(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=kn(t)?Li(t):vn(1),s=t.clientWidth*o.x,a=t.clientHeight*o.y,l=i*o.x,u=r*o.y;return{width:s,height:a,x:l,y:u}}function cf(t,e,n){let r;if(e==="viewport")r=NC(t,n);else if(e==="document")r=DC(Sn(t));else if(en(e))r=IC(e,n);else{const i=Zv(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Ja(r)}function ey(t,e){const n=wr(t);return n===e||!en(n)||Ui(n)?!1:tn(n).position==="fixed"||ey(n,e)}function RC(t,e){const n=e.get(t);if(n)return n;let r=ls(t,[],!1).filter(a=>en(a)&&lo(a)!=="body"),i=null;const o=tn(t).position==="fixed";let s=o?wr(t):t;for(;en(s)&&!Ui(s);){const a=tn(s),l=Op(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&i&&["absolute","fixed"].includes(i.position)||As(s)&&!l&&ey(t,s))?r=r.filter(u=>u!==s):i=a,s=wr(s)}return e.set(t,r),r}function PC(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?cu(e)?[]:RC(e,this._c):[].concat(n),r],s=o[0],a=o.reduce((l,u)=>{const c=cf(e,u,i);return l.top=Fi(c.top,l.top),l.right=Qc(c.right,l.right),l.bottom=Qc(c.bottom,l.bottom),l.left=Fi(c.left,l.left),l},cf(e,s,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function FC(t){const{width:e,height:n}=Yv(t);return{width:e,height:n}}function LC(t,e,n){const r=kn(e),i=Sn(e),o=n==="fixed",s=ri(t,!0,o,e);let a={scrollLeft:0,scrollTop:0};const l=vn(0);if(r||!r&&!o)if((lo(e)!=="body"||As(i))&&(a=du(e)),r){const h=ri(e,!0,o,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else i&&(l.x=_p(i));const u=i&&!r&&!o?Qv(i,a):vn(0),c=s.left+a.scrollLeft-l.x-u.x,d=s.top+a.scrollTop-l.y-u.y;return{x:c,y:d,width:s.width,height:s.height}}function Hu(t){return tn(t).position==="static"}function df(t,e){if(!kn(t)||tn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Sn(t)===n&&(n=n.ownerDocument.body),n}function ty(t,e){const n=Dt(t);if(cu(t))return n;if(!kn(t)){let i=wr(t);for(;i&&!Ui(i);){if(en(i)&&!Hu(i))return i;i=wr(i)}return n}let r=df(t,e);for(;r&&SC(r)&&Hu(r);)r=df(r,e);return r&&Ui(r)&&Hu(r)&&!Op(r)?n:r||TC(t)||n}const VC=async function(t){const e=this.getOffsetParent||ty,n=this.getDimensions,r=await n(t.floating);return{reference:LC(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function BC(t){return tn(t).direction==="rtl"}const nd={convertOffsetParentRelativeRectToViewportRelativeRect:MC,getDocumentElement:Sn,getClippingRect:PC,getOffsetParent:ty,getElementRects:VC,getClientRects:_C,getDimensions:FC,getScale:Li,isElement:en,isRTL:BC};function ny(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function $C(t,e){let n=null,r;const i=Sn(t);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const u=t.getBoundingClientRect(),{left:c,top:d,width:h,height:p}=u;if(a||e(),!h||!p)return;const f=Qs(d),m=Qs(i.clientWidth-(c+h)),g=Qs(i.clientHeight-(d+p)),y=Qs(c),b={rootMargin:-f+"px "+-m+"px "+-g+"px "+-y+"px",threshold:Fi(0,Qc(1,l))||1};let k=!0;function v(w){const x=w[0].intersectionRatio;if(x!==l){if(!k)return s();x?s(!1,x):r=setTimeout(()=>{s(!1,1e-7)},1e3)}x===1&&!ny(u,t.getBoundingClientRect())&&s(),k=!1}try{n=new IntersectionObserver(v,{...b,root:i.ownerDocument})}catch{n=new IntersectionObserver(v,b)}n.observe(t)}return s(!0),o}function jC(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=Mp(t),c=i||o?[...u?ls(u):[],...ls(e)]:[];c.forEach(y=>{i&&y.addEventListener("scroll",n,{passive:!0}),o&&y.addEventListener("resize",n)});const d=u&&a?$C(u,n):null;let h=-1,p=null;s&&(p=new ResizeObserver(y=>{let[b]=y;b&&b.target===u&&p&&(p.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=p)==null||k.observe(e)})),n()}),u&&!l&&p.observe(u),p.observe(e));let f,m=l?ri(t):null;l&&g();function g(){const y=ri(t);m&&!ny(m,y)&&n(),m=y,f=requestAnimationFrame(g)}return n(),()=>{var y;c.forEach(b=>{i&&b.removeEventListener("scroll",n),o&&b.removeEventListener("resize",n)}),d?.(),(y=p)==null||y.disconnect(),p=null,l&&cancelAnimationFrame(f)}}const zC=CC,HC=xC,qC=(t,e,n)=>{const r=new Map,i={platform:nd,...n},o={...i.platform,_c:r};return kC(t,e,{...i,platform:o})};function WC(t){return UC(t)}function qu(t){return t.assignedSlot?t.assignedSlot:t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}function UC(t){for(let e=t;e;e=qu(e))if(e instanceof Element&&getComputedStyle(e).display==="none")return null;for(let e=qu(t);e;e=qu(e)){if(!(e instanceof Element))continue;const n=getComputedStyle(e);if(n.display!=="contents"&&(n.position!=="static"||n.filter!=="none"||e.tagName==="BODY"))return e}return null}const pu=Q({inheritAttrs:!1,__name:"Dropdown",props:{items:{},placement:{default:"bottom-start"},teleport:{type:Boolean,default:!1},keepOpen:{type:Boolean,default:!1},theme:{default:"border"},teleportTo:{default:"body"},offset:{default:8},variant:{},size:{},loading:{type:Boolean},promise:{},confirm:{type:Boolean},is:{},stateTimeout:{},confirmLabel:{},label:{},icon:{},iconLeft:{},iconRight:{default:"fa-pro-regular:angle-down"}},setup(t,{expose:e}){const n=t,r=D(()=>{const{items:v,placement:w,teleport:x,keepOpen:T,...F}=n;return F}),i=X(!1),o=nu(),s=X(),a=X(),l=X({top:"",left:"",position:""});let u=()=>{};function c(){!s.value||!a.value||(u=jC(s.value.$el,a.value,()=>{!s.value||!a.value||qC(s.value.$el,a.value,{placement:n.placement,middleware:[zC(n.offset),HC()],platform:{...nd,getOffsetParent:v=>nd.getOffsetParent(v,WC)}}).then(({x:v,y:w})=>{l.value={top:`${w}px`,left:`${v}px`,position:"absolute"}})}))}ao(u),Pg(()=>{if(i.value)return c();u()});const d=({target:v},w="dom")=>{if(v instanceof Element&&!(!s.value||!a.value)){if(w==="dom")return[s.value.$el,a.value].some(x=>x&&(v===x||x.contains(v)))?void 0:p(!1);if(w==="shadow-dom"){const x=o.value.getRootNode();return v.shadowRoot===x?void 0:p(!1)}}},h=({key:v})=>v==="Escape"&&p(!1),p=(v=!i.value)=>(v?b():k(),i.value=v,!0),f=D(()=>o.value.getRootNode()),m=D(()=>f.value instanceof ShadowRoot);function g(v){d(v,"dom")}function y(v){d(v,"shadow-dom")}function b(){window.addEventListener("keydown",h),m.value?(f.value.addEventListener("click",g),window.addEventListener("click",y)):window.addEventListener("click",g)}function k(){window.removeEventListener("keydown",h),m.value?(f.value.removeEventListener("click",g),window.removeEventListener("click",y)):window.removeEventListener("click",g)}return e({isOpen:i}),(v,w)=>(E(),O(Ie,null,[he(ze,ne({...r.value,...v.$attrs},{onClick:w[0]||(w[0]=()=>p()),ref_key:"trigger",ref:s,class:["k-dropdown-trigger",{"k-dropdown-trigger--open":!!i.value}]}),Cs({_:2},[v.$slots["icon-left"]?{name:"icon-left",fn:Z(()=>[P(v.$slots,"icon-left")]),key:"0"}:void 0,v.$slots.trigger?{name:"default",fn:Z(()=>[P(v.$slots,"trigger")]),key:"1"}:void 0,v.$slots["icon-right"]?{name:"icon-right",fn:Z(()=>[P(v.$slots,"icon-right")]),key:"2"}:void 0]),1040,["class"]),(E(),$(Fg,{to:v.teleportTo,disabled:!v.teleport},[he(tp,{name:"k-dropdown"},{default:Z(()=>[i.value?(E(),O("div",{key:0,class:Ce(`k-dropdown k-dropdown--theme-${v.theme}`),style:Cr(l.value),ref_key:"content",ref:a,onClick:w[1]||(w[1]=()=>!v.keepOpen&&p(!1))},[P(v.$slots,"default",{close:p.bind(null,!1)},()=>[(E(!0),O(Ie,null,_t(v.items,({action:x,icon:T,...F})=>(E(),$(ze,ne({ref_for:!0},F,{variant:"tertiary","icon-right":F.iconRight||T,onClick:()=>x()}),null,16,["icon-right","onClick"]))),256))])],6)):I("",!0)]),_:3})],8,["to","disabled"]))],64))}}),KC={key:0,class:"k-datatable__row"},GC={key:0,class:"k-datatable__cell k-datatable__cell-select"},JC=["data-col-id","onClick"],XC=["innerHTML"],YC={key:1,class:"k-datatable__cell k-datatable__cell-actions"},ZC={key:0,class:"k-datatable__cell k-datatable__cell-select"},QC={key:1,class:"k-datatable__cell k-datatable__cell-actions"},eS={key:0,class:"k-datatable__footer"},kL=Q({__name:"DataTable",props:{items:{},selected:{},theme:{default:"default"},header:{type:Boolean,default:!0},sticky:{type:[Boolean,String]},sortBy:{},sortableBy:{default:()=>[]},isDisabled:{type:Function,default:()=>!1},columns:{},labels:{default:()=>({selection:"Valgt",resetSelection:"Tilbakestill valg"})},cellWrapper:{type:Function,default:()=>({component:"div"})},rowWrapper:{type:Function,default:()=>({component:"div"})}},emits:["update:selected","update:sortBy"],setup(t,{emit:e}){const n=t,r=ip(),i=e,o=X([-1]),s=D(()=>n.items.filter(f=>!n.isDisabled(f))),a=D(()=>!!n.selected),l=D(()=>!!(Object.keys(n.sortBy||{}).length&&n.sortableBy.length)),u=D(()=>!!r.rowActions),c=D({get:()=>!!(s.value.length&&s.value.every(f=>n.selected&&n.selected.includes(f))),set:f=>i("update:selected",f?[...s.value]:[])}),d=D(()=>[a.value?"2.5rem":!1,...n.columns.filter(({disabled:f})=>!f).map(f=>f.size||"auto"),u.value?"0px":!1].filter(Boolean).join(" "));function h(f){var m;if(!l.value||!n.sortableBy.includes(f))return;let g=((m=n.sortBy)==null?void 0:m[f])||-1;i("update:sortBy",{[f]:g*-1})}function p(f,m){if(!f.isTrusted||!(f.target instanceof HTMLInputElement))return;let g=o.value.slice(-1).pop()||-1,y=[];if(f.shiftKey){let b=g>m,k=g+(b?-1:1);for(;b?k>m:k<m;){let v=n.items[k];!(n.selected||[]).includes(v)&&!n.isDisabled(v)&&y.push(v),b?k--:k++}}f.target.checked?o.value.push(m):g===m&&o.value.pop(),i("update:selected",[...n.selected||[],...y])}return(f,m)=>(E(),O("div",{class:Ce([`k-datatable k-datatable--${f.theme}`,{"k-datatable--sticky":!!f.sticky,"k-datatable--no-header":!f.header}]),style:Cr(`--k-datatable-layout: ${d.value}; --k-datatable-sticky-top: ${typeof f.sticky=="string"?f.sticky:"0"}`)},[f.header?(E(),O("div",KC,[a.value?(E(),O("div",GC,[he(Zh,{class:"k-datatable__checkbox",modelValue:c.value,"onUpdate:modelValue":m[0]||(m[0]=g=>c.value=g),disabled:!f.items.length},null,8,["modelValue","disabled"])])):I("",!0),(E(!0),O(Ie,null,_t(f.columns.filter(({disabled:g})=>!g),g=>(E(),O("div",{class:Ce(["k-datatable__cell",`k-datatable__cell--text-align-${g.align||"start"}`,{"k-datatable__cell-sort":l.value&&f.sortableBy.includes(g.id),"k-datatable__cell-sort--active":g.id in(f.sortBy||{})}]),key:g.id,"data-col-id":g.id,onClick:y=>h(g.id)},[P(f.$slots,`${g.id}-label`,{item:g},()=>[H("span",{innerHTML:g.label},null,8,XC)]),he(B(Ze),{class:"k-datatable__cell-sort-icon",icon:(f.sortBy||{})[g.id]<0?"fa-pro-solid:caret-up":"fa-pro-solid:caret-down"},null,8,["icon"])],10,JC))),128)),u.value?(E(),O("div",YC)):I("",!0)])):I("",!0),(E(!0),O(Ie,null,_t(f.items,(g,y)=>(E(),O("div",{class:"k-datatable__row",key:f.sortBy?g?.id||B(Qt)():y},[a.value?(E(),O("div",ZC,[he(Zh,{class:"k-datatable__checkbox","model-value":f.selected||[],"onUpdate:modelValue":m[1]||(m[1]=b=>i("update:selected",b)),value:g,onMousedown:m[2]||(m[2]=Ba(()=>{},["prevent"])),onClick:b=>p(b,y),disabled:f.isDisabled(g)},null,8,["model-value","value","onClick","disabled"])])):I("",!0),(E(),$(Qe(f.rowWrapper(g).component),ne({class:"k-datatable__row-wrapper",ref_for:!0},f.rowWrapper(g).bind,Vg(f.rowWrapper(g).listeners)),{default:Z(()=>[(E(!0),O(Ie,null,_t(f.columns.filter(({disabled:b})=>!b),(b,k)=>(E(),$(Qe(f.cellWrapper(g,b).component),ne({ref_for:!0},f.cellWrapper(g,b).bind,{class:`k-datatable__cell k-datatable__cell--text-align-${b.align||"start"}`,key:`col-${b.id}`,"data-cell-id":b.id}),{default:Z(()=>[P(f.$slots,b.id,{item:g,column:b,rowIndex:y,colIndex:k})]),_:2},1040,["class","data-cell-id"]))),128))]),_:2},1040)),f.$slots["row-actions"]?(E(),O("div",QC,[P(f.$slots,"row-actions",{item:g})])):I("",!0)]))),128)),he(tp,{name:"k-datatable-footer"},{default:Z(()=>{var g,y;return[f.$slots.footer||(g=f.selected)!=null&&g.length?(E(),O("div",eS,[(y=f.selected)!=null&&y.length?(E(),$(pu,{key:0,label:`${f.labels.selection} (${f.selected.length})`,teleport:!0},{default:Z(()=>[P(f.$slots,"select-actions"),he(ze,{label:f.labels.resetSelection,"icon-right":"fa-pro-light:times-square",variant:"tertiary",onClick:m[3]||(m[3]=b=>i("update:selected",[]))},null,8,["label"])]),_:3},8,["label"])):I("",!0),P(f.$slots,"footer")])):I("",!0)]}),_:3})],6))}});var rd,Br=new Map,tS=t=>t.getBoundingClientRect();function nS(t,e){const{scope:n="rect",getRect:r=tS,onChange:i}=e,o=rS({scope:n,getRect:r}),s=Br.get(t);return s?(s.callbacks.push(i),i(r(t))):(Br.set(t,{rect:{},callbacks:[i]}),Br.size===1&&(rd=requestAnimationFrame(o))),function(){const a=Br.get(t);if(!a)return;const l=a.callbacks.indexOf(i);l>-1&&a.callbacks.splice(l,1),a.callbacks.length===0&&(Br.delete(t),Br.size===0&&cancelAnimationFrame(rd))}}function rS(t){const{scope:e,getRect:n}=t,r=oS(e);return function i(){const o=[];Br.forEach((s,a)=>{const l=n(a);r(s.rect,l)||(s.rect=l,o.push(s))}),o.forEach(s=>{s.callbacks.forEach(a=>a(s.rect))}),rd=requestAnimationFrame(i)}}var ry=(t,e)=>t.width===e.width&&t.height===e.height,iy=(t,e)=>t.top===e.top&&t.left===e.left,iS=(t,e)=>ry(t,e)&&iy(t,e);function oS(t){return t==="size"?ry:t==="position"?iy:iS}var sS=Ln("radio-group").parts("root","label","item","itemText","itemControl","indicator"),ki=sS.build(),Xa=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`radio-group:${t.id}`},pf=t=>{var e;return((e=t.ids)==null?void 0:e.label)??`radio-group:${t.id}:label`},oy=(t,e)=>{var n,r;return((r=(n=t.ids)==null?void 0:n.item)==null?void 0:r.call(n,e))??`radio-group:${t.id}:radio:${e}`},hf=(t,e)=>{var n,r;return((r=(n=t.ids)==null?void 0:n.itemHiddenInput)==null?void 0:r.call(n,e))??`radio-group:${t.id}:radio:input:${e}`},aS=(t,e)=>{var n,r;return((r=(n=t.ids)==null?void 0:n.itemControl)==null?void 0:r.call(n,e))??`radio-group:${t.id}:radio:control:${e}`},lS=(t,e)=>{var n,r;return((r=(n=t.ids)==null?void 0:n.itemLabel)==null?void 0:r.call(n,e))??`radio-group:${t.id}:radio:label:${e}`},sy=t=>{var e;return((e=t.ids)==null?void 0:e.indicator)??`radio-group:${t.id}:indicator`},hu=t=>t.getById(Xa(t)),uS=t=>t.getById(sy(t)),cS=t=>{var e;return(e=hu(t))==null?void 0:e.querySelector("input:not(:disabled)")},dS=t=>{var e;return(e=hu(t))==null?void 0:e.querySelector("input:not(:disabled):checked")},ff=t=>{const e=`input[type=radio][data-ownedby='${CSS.escape(Xa(t))}']:not([disabled])`;return yp(hu(t),e)},pS=(t,e)=>{if(e)return t.getById(oy(t,e))},hS=t=>({left:t?.offsetLeft??0,top:t?.offsetTop??0,width:t?.offsetWidth??0,height:t?.offsetHeight??0}),fS=t=>({width:`${t.width}px`,height:`${t.height}px`,left:`${t.left}px`,top:`${t.top}px`});function mS(t,e){const{context:n,send:r,computed:i,prop:o,scope:s}=t,a=i("isDisabled"),l=o("readOnly");function u(h){return{invalid:!!h.invalid,disabled:!!h.disabled||a,checked:n.get("value")===h.value,focused:n.get("focusedValue")===h.value,hovered:n.get("hoveredValue")===h.value,active:n.get("activeValue")===h.value}}function c(h){const p=u(h);return{"data-focus":G(p.focused),"data-focus-visible":G(p.focused&&n.get("focusVisible")),"data-disabled":G(p.disabled),"data-readonly":G(l),"data-state":p.checked?"checked":"unchecked","data-hover":G(p.hovered),"data-invalid":G(p.invalid),"data-orientation":o("orientation"),"data-ssr":G(n.get("ssr"))}}const d=()=>{const h=dS(s);if(h){h.focus();return}const p=cS(s);p?.focus()};return{focus:d,value:n.get("value"),setValue(h){r({type:"SET_VALUE",value:h,isTrusted:!1})},clearValue(){r({type:"SET_VALUE",value:null,isTrusted:!1})},getRootProps(){return e.element({...ki.root.attrs,role:"radiogroup",id:Xa(s),"aria-labelledby":pf(s),"data-orientation":o("orientation"),"data-disabled":G(a),"aria-orientation":o("orientation"),dir:o("dir"),style:{position:"relative"}})},getLabelProps(){return e.element({...ki.label.attrs,dir:o("dir"),"data-orientation":o("orientation"),"data-disabled":G(a),id:pf(s),onClick:d})},getItemState:u,getItemProps(h){const p=u(h);return e.label({...ki.item.attrs,dir:o("dir"),id:oy(s,h.value),htmlFor:hf(s,h.value),...c(h),onPointerMove(){p.disabled||p.hovered||r({type:"SET_HOVERED",value:h.value,hovered:!0})},onPointerLeave(){p.disabled||r({type:"SET_HOVERED",value:null})},onPointerDown(f){p.disabled||(p.focused&&f.pointerType==="mouse"&&f.preventDefault(),r({type:"SET_ACTIVE",value:h.value,active:!0}))},onPointerUp(){p.disabled||r({type:"SET_ACTIVE",value:null})}})},getItemTextProps(h){return e.element({...ki.itemText.attrs,dir:o("dir"),id:lS(s,h.value),...c(h)})},getItemControlProps(h){const p=u(h);return e.element({...ki.itemControl.attrs,dir:o("dir"),id:aS(s,h.value),"data-active":G(p.active),"aria-hidden":!0,...c(h)})},getItemHiddenInputProps(h){const p=u(h);return e.input({"data-ownedby":Xa(s),id:hf(s,h.value),type:"radio",name:o("name")||o("id"),form:o("form"),value:h.value,onClick(f){if(l){f.preventDefault();return}f.currentTarget.checked&&r({type:"SET_VALUE",value:h.value,isTrusted:!0})},onBlur(){r({type:"SET_FOCUSED",value:null,focused:!1,focusVisible:!1})},onFocus(){const f=is();r({type:"SET_FOCUSED",value:h.value,focused:!0,focusVisible:f})},onKeyDown(f){f.defaultPrevented||f.key===" "&&r({type:"SET_ACTIVE",value:h.value,active:!0})},onKeyUp(f){f.defaultPrevented||f.key===" "&&r({type:"SET_ACTIVE",value:null})},disabled:p.disabled,defaultChecked:p.checked,style:bp})},getIndicatorProps(){const h=n.get("indicatorRect");return e.element({id:sy(s),...ki.indicator.attrs,dir:o("dir"),hidden:n.get("value")==null,"data-disabled":G(a),"data-orientation":o("orientation"),style:{"--transition-property":"left, top, width, height","--left":h?.left,"--top":h?.top,"--width":h?.width,"--height":h?.height,position:"absolute",willChange:"var(--transition-property)",transitionProperty:"var(--transition-property)",transitionDuration:n.get("canIndicatorTransition")?"var(--transition-duration, 150ms)":"0ms",transitionTimingFunction:"var(--transition-timing-function)",[o("orientation")==="horizontal"?"left":"top"]:o("orientation")==="horizontal"?"var(--left)":"var(--top)"}})}}}var{not:gS}=eu(),vS={props({props:t}){return{orientation:"vertical",...t}},initialState(){return"idle"},context({prop:t,bindable:e}){return{value:e(()=>({defaultValue:t("defaultValue"),value:t("value"),onChange(n){var r;(r=t("onValueChange"))==null||r({value:n})}})),activeValue:e(()=>({defaultValue:null})),focusedValue:e(()=>({defaultValue:null})),hoveredValue:e(()=>({defaultValue:null})),indicatorRect:e(()=>({defaultValue:{}})),canIndicatorTransition:e(()=>({defaultValue:!1})),fieldsetDisabled:e(()=>({defaultValue:!1})),focusVisible:e(()=>({defaultValue:!1})),ssr:e(()=>({defaultValue:!0}))}},refs(){return{indicatorCleanup:null}},computed:{isDisabled:({prop:t,context:e})=>!!t("disabled")||e.get("fieldsetDisabled")},entry:["syncIndicatorRect","syncSsr"],exit:["cleanupObserver"],effects:["trackFormControlState","trackFocusVisible"],watch({track:t,action:e,context:n}){t([()=>n.get("value")],()=>{e(["setIndicatorTransition","syncIndicatorRect","syncInputElements"])})},on:{SET_VALUE:[{guard:gS("isTrusted"),actions:["setValue","dispatchChangeEvent"]},{actions:["setValue"]}],SET_HOVERED:{actions:["setHovered"]},SET_ACTIVE:{actions:["setActive"]},SET_FOCUSED:{actions:["setFocused"]}},states:{idle:{}},implementations:{guards:{isTrusted:({event:t})=>!!t.isTrusted},effects:{trackFormControlState({context:t,scope:e}){return Yl(hu(e),{onFieldsetDisabledChange(n){t.set("fieldsetDisabled",n)},onFormReset(){t.set("value",t.initial("value"))}})},trackFocusVisible({scope:t}){var e;return kp({root:(e=t.getRootNode)==null?void 0:e.call(t)})}},actions:{setValue({context:t,event:e}){t.set("value",e.value)},setHovered({context:t,event:e}){t.set("hoveredValue",e.value)},setActive({context:t,event:e}){t.set("activeValue",e.value)},setFocused({context:t,event:e}){t.set("focusedValue",e.value),t.set("focusVisible",e.focusVisible)},syncInputElements({context:t,scope:e}){ff(e).forEach(n=>{n.checked=n.value===t.get("value")})},setIndicatorTransition({context:t}){t.set("canIndicatorTransition",bv(t.get("value")))},cleanupObserver({refs:t}){var e;(e=t.get("indicatorCleanup"))==null||e()},syncSsr({context:t}){t.set("ssr",!1)},syncIndicatorRect({context:t,scope:e,refs:n}){var r;if((r=n.get("indicatorCleanup"))==null||r(),!uS(e))return;const i=t.get("value"),o=pS(e,i);if(i==null||!o){t.set("indicatorRect",{});return}const s=nS(o,{getRect(a){return hS(a)},onChange(a){t.set("indicatorRect",fS(a)),cv(()=>{t.set("canIndicatorTransition",!1)})}});n.set("indicatorCleanup",s)},dispatchChangeEvent({context:t,scope:e}){ff(e).forEach(n=>{const r=n.value===t.get("value");r!==n.checked&&gp(n,{checked:r})})}}}};Wn()(["dir","disabled","form","getRootNode","id","ids","name","onValueChange","orientation","readOnly","value","defaultValue"]);Wn()(["value","disabled","invalid"]);const yS=["aria-describedby"],wL=Q({__name:"RadioGroup",props:{label:{},modelValue:{},items:{},variant:{default:"radio"},direction:{default:"vertical"},disabled:{type:Boolean},getRootNode:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=rp(tu,D(()=>({label:""}))),r=t,i=e,o=pi(vS,{id:Qt(),name:Qt(),...r,defaultValue:r.modelValue,onValueChange:({value:a})=>i("update:modelValue",a)}),s=D(()=>mS(o,di));return Ee(()=>r.modelValue,a=>s.value.setValue(a)),(a,l)=>(E(),O("div",ne({class:["k-radiogroup",`k-radiogroup--variant-${a.variant} k-radiogroup--direction-${a.direction}`]},s.value.getRootProps(),{"aria-describedby":B(n).helpId}),[a.variant==="radio"&&(B(n).label||a.label)?(E(),O("span",be(ne({key:0},s.value.getLabelProps())),se(B(n).label||a.label),17)):I("",!0),a.variant==="segment"?(E(),O("div",be(ne({key:1},s.value.getIndicatorProps())),null,16)):I("",!0),(E(!0),O(Ie,null,_t(a.items,u=>(E(),O("label",ne({ref_for:!0},s.value.getItemProps({value:u.id})),[H("span",ne({ref_for:!0},s.value.getItemTextProps({value:u.id})),se(u.label),17),H("input",ne({ref_for:!0},s.value.getItemHiddenInputProps({value:u.id})),null,16),H("div",ne({ref_for:!0},s.value.getItemControlProps({value:u.id})),null,16)],16))),256))],16,yS))}}),xL=Q({__name:"Grid",props:{is:{default:"div"},columns:{default:1},align:{},rows:{},gap:{default:"default"},areas:{}},setup(t){const e=t,n=(o,s)=>o?typeof o=="number"||typeof o=="string"&&o.match(/^\d+$/)?`repeat(${o}, 1fr)`:o.match(/^(\d+\s?)+$/)?o.split(" ").map(a=>`${a}fr`).join(" "):o:s,r=o=>{if(o)return Array.isArray(o)?o.map(s=>`"${s}"`).join(`
2
2
  `):o.split("|").map(s=>s.trim()).map(s=>`"${s}"`).join(`
3
- `)},i=N(()=>Zg("grid",{columns:n(e.columns,"1fr"),align:ja(e.align)||"initial",rows:n(e.rows,"auto"),gap:lp(e.gap),areas:r(e.areas)||"unset"}));return(o,s)=>(E(),B(Qe(o.is),{class:"k-grid",style:Cr(i.value)},{default:Z(()=>[P(o.$slots,"default")]),_:3},8,["style"]))}});function ay(t){return t?t.flatMap(e=>{const{type:n,children:r}=e;return n===Ie?ay(r):[e]}):[]}const wL=te({props:{area:String,align:String},inheritAttrs:!1,setup({area:t,align:e},{slots:n}){return()=>{if(!n.default)return null;const[r]=ay(n.default());if(!r)return null;const i=ne({style:{"--k-grid-item-area":t,"--k-grid-item-align-self":ja(e)||"initial"}},r.props??{});return bk(r,i)}}}),yS={key:0,class:"k-scroller__indicator"},xL=te({__name:"Scroller",props:{is:{default:"div"},appearance:{default:"default"},treshhold:{default:80}},setup(t){const e=tu(),n=Qt({prefix:"k-scroller-"}),r=t,i=X({top:!1,right:!1,left:!1,bottom:!1}),o=N(()=>Object.entries(i.value).filter(([,a])=>a).map(([a])=>a)),s=a=>{const{scrollWidth:l,scrollHeight:u,clientWidth:c,clientHeight:d,scrollTop:h,scrollLeft:p}=a,f=l-c>=r.treshhold,m=u-d>=r.treshhold;i.value={top:m&&h<=r.treshhold,left:f&&p<=r.treshhold,bottom:m&&h>=u-d-r.treshhold,right:f&&p>=l-c-r.treshhold}};return qn(()=>{const a=e.value;a&&(xp(a,"scroll",()=>s(a)),W1(a,()=>s(a),{childList:!0,subtree:!0}))}),(a,l)=>(E(),B(Qe(a.is),{id:$(n),class:Ce([`k-scroller k-scroller--appearance-${a.appearance}`,...o.value.map(u=>`k-scroller--scrolled-to-${u}`)])},{default:Z(()=>[a.appearance==="indicator"?(E(),O("div",yS,[P(a.$slots,"indicator",{},()=>[he($(Ze),{icon:"fa-pro-thin:arrow-right"})])])):I("",!0),P(a.$slots,"default")]),_:3},8,["id","class"]))}});var wi=new WeakMap,ea=new WeakMap,ta={},qu=0,ly=t=>t&&(t.host||ly(t.parentNode)),bS=(t,e)=>e.map(n=>{if(t.contains(n))return n;const r=ly(n);return r&&t.contains(r)?r:(console.error("[zag-js > ariaHidden] target",n,"in not contained inside",t,". Doing nothing"),null)}).filter(n=>!!n),kS=t=>t.localName==="next-route-announcer"||t.localName==="script"||t.hasAttribute("aria-live")?!0:t.matches("[data-live-announcer]"),wS=(t,e)=>{const{parentNode:n,markerName:r,controlAttribute:i,explicitBooleanValue:o}=e,s=bS(n,Array.isArray(t)?t:[t]);ta[r]||(ta[r]=new WeakMap);const a=ta[r],l=[],u=new Set,c=new Set(s),d=p=>{!p||u.has(p)||(u.add(p),d(p.parentNode))};s.forEach(d);const h=p=>{!p||c.has(p)||Array.prototype.forEach.call(p.children,f=>{if(u.has(f))h(f);else try{if(kS(f))return;const m=f.getAttribute(i),g=o?m==="true":m!==null&&m!=="false",y=(wi.get(f)||0)+1,b=(a.get(f)||0)+1;wi.set(f,y),a.set(f,b),l.push(f),y===1&&g&&ea.set(f,!0),b===1&&f.setAttribute(r,""),g||f.setAttribute(i,o?"true":"")}catch(m){console.error("[zag-js > ariaHidden] cannot operate on ",f,m)}})};return h(n),u.clear(),qu++,()=>{l.forEach(p=>{const f=wi.get(p)-1,m=a.get(p)-1;wi.set(p,f),a.set(p,m),f||(ea.has(p)||p.removeAttribute(i),ea.delete(p)),m||p.removeAttribute(r)}),qu--,qu||(wi=new WeakMap,wi=new WeakMap,ea=new WeakMap,ta={})}},xS=t=>(Array.isArray(t)?t[0]:t).ownerDocument.body,ES=(t,e=xS(t),n="data-aria-hidden")=>{if(e)return wS(t,{parentNode:e,markerName:n,controlAttribute:"aria-hidden",explicitBooleanValue:!0})},CS=t=>{const e=requestAnimationFrame(()=>t());return()=>cancelAnimationFrame(e)};function SS(t,e={}){const{defer:n=!0}=e,r=n?CS:o=>o(),i=[];return i.push(r(()=>{const o=(typeof t=="function"?t():t).filter(Boolean);o.length!==0&&i.push(ES(o))})),()=>{i.forEach(o=>o?.())}}function TS(t){const e={each(n){var r;for(let i=0;i<((r=t.frames)==null?void 0:r.length);i+=1){const o=t.frames[i];o&&n(o)}},addEventListener(n,r,i){return e.each(o=>{try{o.document.addEventListener(n,r,i)}catch{}}),()=>{try{e.removeEventListener(n,r,i)}catch{}}},removeEventListener(n,r,i){e.each(o=>{try{o.document.removeEventListener(n,r,i)}catch{}})}};return e}function OS(t){const e=t.frameElement!=null?t.parent:null;return{addEventListener:(n,r,i)=>{try{e?.addEventListener(n,r,i)}catch{}return()=>{try{e?.removeEventListener(n,r,i)}catch{}}},removeEventListener:(n,r,i)=>{try{e?.removeEventListener(n,r,i)}catch{}}}}var ff="pointerdown.outside",mf="focus.outside";function AS(t){for(const e of t)if(dt(e)&&dr(e))return!0;return!1}var uy=t=>"clientY"in t;function MS(t,e){if(!uy(e)||!t)return!1;const n=t.getBoundingClientRect();return n.width===0||n.height===0?!1:n.top<=e.clientY&&e.clientY<=n.top+n.height&&n.left<=e.clientX&&e.clientX<=n.left+n.width}function _S(t,e){return t.y<=e.y&&e.y<=t.y+t.height&&t.x<=e.x&&e.x<=t.x+t.width}function gf(t,e){if(!e||!uy(t))return!1;const n=e.scrollHeight>e.clientHeight,r=n&&t.clientX>e.offsetLeft+e.clientWidth,i=e.scrollWidth>e.clientWidth,o=i&&t.clientY>e.offsetTop+e.clientHeight,s={x:e.offsetLeft,y:e.offsetTop,width:e.clientWidth+(n?16:0),height:e.clientHeight+(i?16:0)},a={x:t.clientX,y:t.clientY};return _S(s,a)?r||o:!1}function DS(t,e){const{exclude:n,onFocusOutside:r,onPointerDownOutside:i,onInteractOutside:o,defer:s}=e;if(!t)return;const a=Kt(t),l=xt(t),u=TS(l),c=OS(l);function d(y){const b=ct(y);if(!dt(b)||!b.isConnected||qi(t,b)||MS(t,y))return!1;const k=a.querySelector(`[aria-controls="${t.id}"]`);if(k){const w=zc(k);if(gf(y,w))return!1}const v=zc(t);return gf(y,v)?!1:!(n!=null&&n(b))}const h=new Set;function p(y){function b(){var k;const v=s?At:x=>x(),w=((k=y.composedPath)==null?void 0:k.call(y))??[y.target];v(()=>{if(!(!t||!d(y))){if(i||o){const x=qh(i,o);t.addEventListener(ff,x,{once:!0})}vf(t,ff,{bubbles:!1,cancelable:!0,detail:{originalEvent:y,contextmenu:lx(y),focusable:AS(w)}})}})}y.pointerType==="touch"?(h.forEach(k=>k()),h.add(De(a,"click",b,{once:!0})),h.add(c.addEventListener("click",b,{once:!0})),h.add(u.addEventListener("click",b,{once:!0}))):b()}const f=new Set,m=setTimeout(()=>{f.add(De(a,"pointerdown",p,!0)),f.add(c.addEventListener("pointerdown",p,!0)),f.add(u.addEventListener("pointerdown",p,!0))},0);function g(y){(s?At:b=>b())(()=>{if(!(!t||!d(y))){if(r||o){const b=qh(r,o);t.addEventListener(mf,b,{once:!0})}vf(t,mf,{bubbles:!1,cancelable:!0,detail:{originalEvent:y,contextmenu:!1,focusable:dr(ct(y))}})}})}return f.add(De(a,"focusin",g,!0)),f.add(c.addEventListener("focusin",g,!0)),f.add(u.addEventListener("focusin",g,!0)),()=>{clearTimeout(m),h.forEach(y=>y()),f.forEach(y=>y())}}function NS(t,e){const{defer:n}=e,r=n?At:o=>o(),i=[];return i.push(r(()=>{const o=typeof t=="function"?t():t;i.push(DS(o,e))})),()=>{i.forEach(o=>o?.())}}function vf(t,e,n){const r=t.ownerDocument.defaultView||window,i=new r.CustomEvent(e,n);return t.dispatchEvent(i)}function IS(t,e){const n=r=>{r.key==="Escape"&&(r.isComposing||e==null||e(r))};return De(Kt(t),"keydown",n,{capture:!0})}var Jt={layers:[],branches:[],count(){return this.layers.length},pointerBlockingLayers(){return this.layers.filter(t=>t.pointerBlocking)},topMostPointerBlockingLayer(){return[...this.pointerBlockingLayers()].slice(-1)[0]},hasPointerBlockingLayer(){return this.pointerBlockingLayers().length>0},isBelowPointerBlockingLayer(t){var e;const n=this.indexOf(t),r=this.topMostPointerBlockingLayer()?this.indexOf((e=this.topMostPointerBlockingLayer())==null?void 0:e.node):-1;return n<r},isTopMost(t){const e=this.layers[this.count()-1];return e?.node===t},getNestedLayers(t){return Array.from(this.layers).slice(this.indexOf(t)+1)},isInNestedLayer(t,e){return this.getNestedLayers(t).some(n=>qi(n.node,e))},isInBranch(t){return Array.from(this.branches).some(e=>qi(e,t))},add(t){const e=this.layers.push(t);t.node.style.setProperty("--layer-index",`${e}`)},addBranch(t){this.branches.push(t)},remove(t){const e=this.indexOf(t);e<0||(e<this.count()-1&&this.getNestedLayers(t).forEach(n=>n.dismiss()),this.layers.splice(e,1),t.style.removeProperty("--layer-index"))},removeBranch(t){const e=this.branches.indexOf(t);e>=0&&this.branches.splice(e,1)},indexOf(t){return this.layers.findIndex(e=>e.node===t)},dismiss(t){var e;(e=this.layers[this.indexOf(t)])==null||e.dismiss()},clear(){this.remove(this.layers[0].node)}},yf;function bf(){Jt.layers.forEach(({node:t})=>{t.style.pointerEvents=Jt.isBelowPointerBlockingLayer(t)?"none":"auto"})}function RS(t){t.style.pointerEvents=""}function PS(t,e){const n=Kt(t),r=[];if(Jt.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(yf=document.body.style.pointerEvents,queueMicrotask(()=>{n.body.style.pointerEvents="none",n.body.setAttribute("data-inert","")})),e){const i=Lx(e,o=>{r.push(Rx(o,{pointerEvents:"auto"}))});r.push(i)}return()=>{Jt.hasPointerBlockingLayer()||(queueMicrotask(()=>{n.body.style.pointerEvents=yf,n.body.removeAttribute("data-inert"),n.body.style.length===0&&n.body.removeAttribute("style")}),r.forEach(i=>i()))}}function FS(t,e){const{warnOnMissingNode:n=!0}=e;if(n&&!t){Kc("[@zag-js/dismissable] node is `null` or `undefined`");return}if(!t)return;const{onDismiss:r,pointerBlocking:i,exclude:o,debug:s}=e,a={dismiss:r,node:t,pointerBlocking:i};Jt.add(a),bf();function l(p){var f,m;const g=ct(p.detail.originalEvent);Jt.isBelowPointerBlockingLayer(t)||Jt.isInBranch(g)||((f=e.onPointerDownOutside)==null||f.call(e,p),(m=e.onInteractOutside)==null||m.call(e,p),!p.defaultPrevented&&(s&&console.log("onPointerDownOutside:",p.detail.originalEvent),r?.()))}function u(p){var f,m;const g=ct(p.detail.originalEvent);Jt.isInBranch(g)||((f=e.onFocusOutside)==null||f.call(e,p),(m=e.onInteractOutside)==null||m.call(e,p),!p.defaultPrevented&&(s&&console.log("onFocusOutside:",p.detail.originalEvent),r?.()))}function c(p){var f;Jt.isTopMost(t)&&((f=e.onEscapeKeyDown)==null||f.call(e,p),!p.defaultPrevented&&r&&(p.preventDefault(),r()))}function d(p){var f;if(!t)return!1;const m=typeof o=="function"?o():o,g=Array.isArray(m)?m:[m],y=(f=e.persistentElements)==null?void 0:f.map(b=>b()).filter(dt);return y&&g.push(...y),g.some(b=>qi(b,p))||Jt.isInNestedLayer(t,p)}const h=[i?PS(t,e.persistentElements):void 0,IS(t,c),NS(t,{exclude:d,onFocusOutside:u,onPointerDownOutside:l,defer:e.defer})];return()=>{Jt.remove(t),bf(),RS(t),h.forEach(p=>p?.())}}function LS(t,e){const{defer:n}=e,r=n?At:o=>o(),i=[];return i.push(r(()=>{const o=Ni(t)?t():t;i.push(FS(o,e))})),()=>{i.forEach(o=>o?.())}}var VS=Object.defineProperty,BS=(t,e,n)=>e in t?VS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Se=(t,e,n)=>BS(t,typeof e!="symbol"?e+"":e,n),kf={activateTrap(t,e){if(t.length>0){const r=t[t.length-1];r!==e&&r.pause()}const n=t.indexOf(e);n===-1||t.splice(n,1),t.push(e)},deactivateTrap(t,e){const n=t.indexOf(e);n!==-1&&t.splice(n,1),t.length>0&&t[t.length-1].unpause()}},$S=[],jS=class{constructor(t,e){Se(this,"trapStack"),Se(this,"config"),Se(this,"doc"),Se(this,"state",{containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0}),Se(this,"listenerCleanups",[]),Se(this,"handleFocus",r=>{const i=ct(r),o=this.findContainerIndex(i,r)>=0;if(o||up(i))o&&(this.state.mostRecentlyFocusedNode=i);else{r.stopImmediatePropagation();let s,a=!0;if(this.state.mostRecentlyFocusedNode)if(yo(this.state.mostRecentlyFocusedNode)>0){const l=this.findContainerIndex(this.state.mostRecentlyFocusedNode),{tabbableNodes:u}=this.state.containerGroups[l];if(u.length>0){const c=u.findIndex(d=>d===this.state.mostRecentlyFocusedNode);c>=0&&(this.config.isKeyForward(this.state.recentNavEvent)?c+1<u.length&&(s=u[c+1],a=!1):c-1>=0&&(s=u[c-1],a=!1))}}else this.state.containerGroups.some(l=>l.tabbableNodes.some(u=>yo(u)>0))||(a=!1);else a=!1;a&&(s=this.findNextNavNode({target:this.state.mostRecentlyFocusedNode,isBackward:this.config.isKeyBackward(this.state.recentNavEvent)})),s?this.tryFocus(s):this.tryFocus(this.state.mostRecentlyFocusedNode||this.getInitialFocusNode())}this.state.recentNavEvent=void 0}),Se(this,"handlePointerDown",r=>{const i=ct(r);if(!(this.findContainerIndex(i,r)>=0)){if(ko(this.config.clickOutsideDeactivates,r)){this.deactivate({returnFocus:this.config.returnFocusOnDeactivate});return}ko(this.config.allowOutsideClick,r)||r.preventDefault()}}),Se(this,"handleClick",r=>{const i=ct(r);this.findContainerIndex(i,r)>=0||ko(this.config.clickOutsideDeactivates,r)||ko(this.config.allowOutsideClick,r)||(r.preventDefault(),r.stopImmediatePropagation())}),Se(this,"handleTabKey",r=>{if(this.config.isKeyForward(r)||this.config.isKeyBackward(r)){this.state.recentNavEvent=r;const i=this.config.isKeyBackward(r),o=this.findNextNavNode({event:r,isBackward:i});if(!o)return;bo(r)&&r.preventDefault(),this.tryFocus(o)}}),Se(this,"handleEscapeKey",r=>{zS(r)&&ko(this.config.escapeDeactivates,r)!==!1&&(r.preventDefault(),this.deactivate())}),Se(this,"_mutationObserver"),Se(this,"setupMutationObserver",()=>{const r=this.doc.defaultView||window;this._mutationObserver=new r.MutationObserver(i=>{i.some(o=>Array.from(o.removedNodes).some(s=>s===this.state.mostRecentlyFocusedNode))&&this.tryFocus(this.getInitialFocusNode())})}),Se(this,"updateObservedNodes",()=>{var r;(r=this._mutationObserver)==null||r.disconnect(),this.state.active&&!this.state.paused&&this.state.containers.map(i=>{var o;(o=this._mutationObserver)==null||o.observe(i,{subtree:!0,childList:!0})})}),Se(this,"getInitialFocusNode",()=>{let r=this.getNodeForOption("initialFocus",{hasFallback:!0});if(r===!1)return!1;if(r===void 0||r&&!dr(r))if(this.findContainerIndex(this.doc.activeElement)>=0)r=this.doc.activeElement;else{const i=this.state.tabbableGroups[0];r=i&&i.firstTabbableNode||this.getNodeForOption("fallbackFocus")}else r===null&&(r=this.getNodeForOption("fallbackFocus"));if(!r)throw new Error("Your focus-trap needs to have at least one focusable element");return r.isConnected||(r=this.getNodeForOption("fallbackFocus")),r}),Se(this,"tryFocus",r=>{if(r!==!1&&r!==tv(this.doc)){if(!r||!r.focus){this.tryFocus(this.getInitialFocusNode());return}r.focus({preventScroll:!!this.config.preventScroll}),this.state.mostRecentlyFocusedNode=r,HS(r)&&r.select()}}),Se(this,"deactivate",r=>{if(!this.state.active)return this;const i={onDeactivate:this.config.onDeactivate,onPostDeactivate:this.config.onPostDeactivate,checkCanReturnFocus:this.config.checkCanReturnFocus,...r};clearTimeout(this.state.delayInitialFocusTimer),this.state.delayInitialFocusTimer=void 0,this.removeListeners(),this.state.active=!1,this.state.paused=!1,this.updateObservedNodes(),kf.deactivateTrap(this.trapStack,this);const o=this.getOption(i,"onDeactivate"),s=this.getOption(i,"onPostDeactivate"),a=this.getOption(i,"checkCanReturnFocus"),l=this.getOption(i,"returnFocus","returnFocusOnDeactivate");o?.();const u=()=>{wf(()=>{if(l){const c=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);this.tryFocus(c)}s?.()})};if(l&&a){const c=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);return a(c).then(u,u),this}return u(),this}),Se(this,"pause",r=>{if(this.state.paused||!this.state.active)return this;const i=this.getOption(r,"onPause"),o=this.getOption(r,"onPostPause");return this.state.paused=!0,i?.(),this.removeListeners(),this.updateObservedNodes(),o?.(),this}),Se(this,"unpause",r=>{if(!this.state.paused||!this.state.active)return this;const i=this.getOption(r,"onUnpause"),o=this.getOption(r,"onPostUnpause");return this.state.paused=!1,i?.(),this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),o?.(),this}),Se(this,"updateContainerElements",r=>(this.state.containers=Array.isArray(r)?r.filter(Boolean):[r].filter(Boolean),this.state.active&&this.updateTabbableNodes(),this.updateObservedNodes(),this)),Se(this,"getReturnFocusNode",r=>{const i=this.getNodeForOption("setReturnFocus",{params:[r]});return i||(i===!1?!1:r)}),Se(this,"getOption",(r,i,o)=>r&&r[i]!==void 0?r[i]:this.config[o||i]),Se(this,"getNodeForOption",(r,{hasFallback:i=!1,params:o=[]}={})=>{let s=this.config[r];if(typeof s=="function"&&(s=s(...o)),s===!0&&(s=void 0),!s){if(s===void 0||s===!1)return s;throw new Error(`\`${r}\` was specified but was not a node, or did not return a node`)}let a=s;if(typeof s=="string"){try{a=this.doc.querySelector(s)}catch(l){throw new Error(`\`${r}\` appears to be an invalid selector; error="${l.message}"`)}if(!a&&!i)throw new Error(`\`${r}\` as selector refers to no known node`)}return a}),Se(this,"findNextNavNode",r=>{const{event:i,isBackward:o=!1}=r,s=r.target||ct(i);this.updateTabbableNodes();let a=null;if(this.state.tabbableGroups.length>0){const l=this.findContainerIndex(s,i),u=l>=0?this.state.containerGroups[l]:void 0;if(l<0)o?a=this.state.tabbableGroups[this.state.tabbableGroups.length-1].lastTabbableNode:a=this.state.tabbableGroups[0].firstTabbableNode;else if(o){let c=this.state.tabbableGroups.findIndex(({firstTabbableNode:d})=>s===d);if(c<0&&(u?.container===s||dr(s)&&!Vr(s)&&!(u!=null&&u.nextTabbableNode(s,!1)))&&(c=l),c>=0){const d=c===0?this.state.tabbableGroups.length-1:c-1,h=this.state.tabbableGroups[d];a=yo(s)>=0?h.lastTabbableNode:h.lastDomTabbableNode}else bo(i)||(a=u?.nextTabbableNode(s,!1))}else{let c=this.state.tabbableGroups.findIndex(({lastTabbableNode:d})=>s===d);if(c<0&&(u?.container===s||dr(s)&&!Vr(s)&&!(u!=null&&u.nextTabbableNode(s)))&&(c=l),c>=0){const d=c===this.state.tabbableGroups.length-1?0:c+1,h=this.state.tabbableGroups[d];a=yo(s)>=0?h.firstTabbableNode:h.firstDomTabbableNode}else bo(i)||(a=u?.nextTabbableNode(s))}}else a=this.getNodeForOption("fallbackFocus");return a}),this.trapStack=e.trapStack||$S;const n={returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward(r){return bo(r)&&!r.shiftKey},isKeyBackward(r){return bo(r)&&r.shiftKey},...e};this.doc=n.document||Kt(Array.isArray(t)?t[0]:t),this.config=n,this.updateContainerElements(t),this.setupMutationObserver()}get active(){return this.state.active}get paused(){return this.state.paused}findContainerIndex(t,e){const n=typeof e?.composedPath=="function"?e.composedPath():void 0;return this.state.containerGroups.findIndex(({container:r,tabbableNodes:i})=>r.contains(t)||n?.includes(r)||i.find(o=>o===t))}updateTabbableNodes(){if(this.state.containerGroups=this.state.containers.map(t=>{const e=uv(t),n=lv(t),r=e.length>0?e[0]:void 0,i=e.length>0?e[e.length-1]:void 0,o=n.find(u=>Vr(u)),s=n.slice().reverse().find(u=>Vr(u)),a=!!e.find(u=>yo(u)>0);function l(u,c=!0){const d=e.indexOf(u);return d<0?c?n.slice(n.indexOf(u)+1).find(h=>Vr(h)):n.slice(0,n.indexOf(u)).reverse().find(h=>Vr(h)):e[d+(c?1:-1)]}return{container:t,tabbableNodes:e,focusableNodes:n,posTabIndexesFound:a,firstTabbableNode:r,lastTabbableNode:i,firstDomTabbableNode:o,lastDomTabbableNode:s,nextTabbableNode:l}}),this.state.tabbableGroups=this.state.containerGroups.filter(t=>t.tabbableNodes.length>0),this.state.tabbableGroups.length<=0&&!this.getNodeForOption("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(this.state.containerGroups.find(t=>t.posTabIndexesFound)&&this.state.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.")}addListeners(){if(this.state.active)return kf.activateTrap(this.trapStack,this),this.state.delayInitialFocusTimer=this.config.delayInitialFocus?wf(()=>{this.tryFocus(this.getInitialFocusNode())}):this.tryFocus(this.getInitialFocusNode()),this.listenerCleanups.push(De(this.doc,"focusin",this.handleFocus,!0),De(this.doc,"mousedown",this.handlePointerDown,{capture:!0,passive:!1}),De(this.doc,"touchstart",this.handlePointerDown,{capture:!0,passive:!1}),De(this.doc,"click",this.handleClick,{capture:!0,passive:!1}),De(this.doc,"keydown",this.handleTabKey,{capture:!0,passive:!1}),De(this.doc,"keydown",this.handleEscapeKey)),this}removeListeners(){if(this.state.active)return this.listenerCleanups.forEach(t=>t()),this.listenerCleanups=[],this}activate(t){if(this.state.active)return this;const e=this.getOption(t,"onActivate"),n=this.getOption(t,"onPostActivate"),r=this.getOption(t,"checkCanFocusTrap");r||this.updateTabbableNodes(),this.state.active=!0,this.state.paused=!1,this.state.nodeFocusedBeforeActivation=this.doc.activeElement||null,e?.();const i=()=>{r&&this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),n?.()};return r?(r(this.state.containers.concat()).then(i,i),this):(i(),this)}},bo=t=>t.key==="Tab",ko=(t,...e)=>typeof t=="function"?t(...e):t,zS=t=>!t.isComposing&&t.key==="Escape",wf=t=>setTimeout(t,0),HS=t=>t.localName==="input"&&"select"in t&&typeof t.select=="function";function qS(t,e={}){let n;const r=At(()=>{const i=typeof t=="function"?t():t;if(i){n=new jS(i,{escapeDeactivates:!1,allowOutsideClick:!0,preventScroll:!0,returnFocusOnDeactivate:!0,delayInitialFocus:!1,fallbackFocus:i,...e,document:Kt(i)});try{n.activate()}catch{}}});return function(){n?.deactivate(),r()}}var Wu="data-scroll-lock";function xf(t,e){if(!t)return;const n=Object.keys(e).reduce((r,i)=>(r[i]=t.style.getPropertyValue(i),r),{});return Object.assign(t.style,e),()=>{Object.assign(t.style,n)}}function WS(t,e,n){if(!t)return;const r=t.style.getPropertyValue(e);return t.style.setProperty(e,n),()=>{r?t.style.setProperty(e,r):t.style.removeProperty(e)}}function US(t){const e=t.getBoundingClientRect().left;return Math.round(e)+t.scrollLeft?"paddingLeft":"paddingRight"}function KS(t){const e=t??document,n=e.defaultView??window,{documentElement:r,body:i}=e;if(i.hasAttribute(Wu))return;i.setAttribute(Wu,"");const o=n.innerWidth-r.clientWidth,s=()=>WS(r,"--scrollbar-width",`${o}px`),a=US(r),l=()=>xf(i,{overflow:"hidden",[a]:`${o}px`}),u=()=>{const{scrollX:d,scrollY:h,visualViewport:p}=n,f=p?.offsetLeft??0,m=p?.offsetTop??0,g=xf(i,{position:"fixed",overflow:"hidden",top:`${-(h-Math.floor(m))}px`,left:`${-(d-Math.floor(f))}px`,right:"0",[a]:`${o}px`});return()=>{g?.(),n.scrollTo({left:d,top:h,behavior:"instant"})}},c=[s(),dp()?u():l()];return()=>{c.forEach(d=>d?.()),i.removeAttribute(Wu)}}var GS=Ln("dialog").parts("trigger","backdrop","positioner","content","title","description","closeTrigger"),Rr=GS.build(),cy=t=>{var e;return((e=t.ids)==null?void 0:e.positioner)??`dialog:${t.id}:positioner`},dy=t=>{var e;return((e=t.ids)==null?void 0:e.backdrop)??`dialog:${t.id}:backdrop`},rd=t=>{var e;return((e=t.ids)==null?void 0:e.content)??`dialog:${t.id}:content`},py=t=>{var e;return((e=t.ids)==null?void 0:e.trigger)??`dialog:${t.id}:trigger`},id=t=>{var e;return((e=t.ids)==null?void 0:e.title)??`dialog:${t.id}:title`},od=t=>{var e;return((e=t.ids)==null?void 0:e.description)??`dialog:${t.id}:description`},hy=t=>{var e;return((e=t.ids)==null?void 0:e.closeTrigger)??`dialog:${t.id}:close`},na=t=>t.getById(rd(t)),JS=t=>t.getById(cy(t)),XS=t=>t.getById(dy(t)),YS=t=>t.getById(py(t)),ZS=t=>t.getById(id(t)),QS=t=>t.getById(od(t)),eT=t=>t.getById(hy(t));function tT(t,e){const{state:n,send:r,context:i,prop:o,scope:s}=t,a=o("aria-label"),l=n.matches("open");return{open:l,setOpen(u){u!==l&&r({type:u?"OPEN":"CLOSE"})},getTriggerProps(){return e.button({...Rr.trigger.attrs,dir:o("dir"),id:py(s),"aria-haspopup":"dialog",type:"button","aria-expanded":l,"data-state":l?"open":"closed","aria-controls":rd(s),onClick(u){u.defaultPrevented||r({type:"TOGGLE"})}})},getBackdropProps(){return e.element({...Rr.backdrop.attrs,dir:o("dir"),hidden:!l,id:dy(s),"data-state":l?"open":"closed"})},getPositionerProps(){return e.element({...Rr.positioner.attrs,dir:o("dir"),id:cy(s),style:{pointerEvents:l?void 0:"none"}})},getContentProps(){const u=i.get("rendered");return e.element({...Rr.content.attrs,dir:o("dir"),role:o("role"),hidden:!l,id:rd(s),tabIndex:-1,"data-state":l?"open":"closed","aria-modal":!0,"aria-label":a||void 0,"aria-labelledby":a||!u.title?void 0:id(s),"aria-describedby":u.description?od(s):void 0})},getTitleProps(){return e.element({...Rr.title.attrs,dir:o("dir"),id:id(s)})},getDescriptionProps(){return e.element({...Rr.description.attrs,dir:o("dir"),id:od(s)})},getCloseTriggerProps(){return e.button({...Rr.closeTrigger.attrs,dir:o("dir"),id:hy(s),type:"button",onClick(u){u.defaultPrevented||(u.stopPropagation(),r({type:"CLOSE"}))}})}}}var nT={props({props:t,scope:e}){const n=t.role==="alertdialog";return{role:"dialog",modal:!0,trapFocus:!0,preventScroll:!0,closeOnInteractOutside:!n,closeOnEscape:!0,restoreFocus:!0,initialFocusEl:n?()=>eT(e):void 0,...t}},initialState({prop:t}){return t("open")||t("defaultOpen")?"open":"closed"},context({bindable:t}){return{rendered:t(()=>({defaultValue:{title:!0,description:!0}}))}},watch({track:t,action:e,prop:n}){t([()=>n("open")],()=>{e(["toggleVisibility"])})},states:{open:{entry:["checkRenderedElements","syncZIndex"],effects:["trackDismissableElement","trapFocus","preventScroll","hideContentBelow"],on:{"CONTROLLED.CLOSE":{target:"closed"},CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}]}},closed:{on:{"CONTROLLED.OPEN":{target:"open"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}]}}},implementations:{guards:{isOpenControlled:({prop:t})=>t("open")!=null},effects:{trackDismissableElement({scope:t,send:e,prop:n}){return LS(()=>na(t),{defer:!0,pointerBlocking:n("modal"),exclude:[YS(t)],onInteractOutside(r){var i;(i=n("onInteractOutside"))==null||i(r),n("closeOnInteractOutside")||r.preventDefault()},persistentElements:n("persistentElements"),onFocusOutside:n("onFocusOutside"),onPointerDownOutside:n("onPointerDownOutside"),onEscapeKeyDown(r){var i;(i=n("onEscapeKeyDown"))==null||i(r),n("closeOnEscape")||r.preventDefault()},onDismiss(){e({type:"CLOSE",src:"interact-outside"})}})},preventScroll({scope:t,prop:e}){if(e("preventScroll"))return KS(t.getDoc())},trapFocus({scope:t,prop:e}){return!e("trapFocus")||!e("modal")?void 0:qS(()=>na(t),{preventScroll:!0,returnFocusOnDeactivate:!!e("restoreFocus"),initialFocus:e("initialFocusEl"),setReturnFocus:n=>{var r;return((r=e("finalFocusEl"))==null?void 0:r())??n}})},hideContentBelow({scope:t,prop:e}){return e("modal")?SS(()=>[na(t)],{defer:!0}):void 0}},actions:{checkRenderedElements({context:t,scope:e}){At(()=>{t.set("rendered",{title:!!ZS(e),description:!!QS(e)})})},syncZIndex({scope:t}){At(()=>{const e=na(t);if(!e)return;const n=ex(e);[JS(t),XS(t)].forEach(r=>{r?.style.setProperty("--z-index",n.zIndex)})})},invokeOnClose({prop:t}){var e;(e=t("onOpenChange"))==null||e({open:!1})},invokeOnOpen({prop:t}){var e;(e=t("onOpenChange"))==null||e({open:!0})},toggleVisibility({prop:t,send:e,event:n}){e({type:t("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:n})}}}};Wn()(["aria-label","closeOnEscape","closeOnInteractOutside","dir","finalFocusEl","getRootNode","getRootNode","id","id","ids","initialFocusEl","modal","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenChange","onPointerDownOutside","defaultOpen","open","persistentElements","preventScroll","restoreFocus","role","trapFocus"]);const rT=["data-id"],iT=["data-id"],oT=["data-id"],sT=te({__name:"Dialog",props:{title:{},subtitle:{},role:{default:"dialog"},closeOnEsc:{type:Boolean,default:!0},closeOnOutsideClick:{type:Boolean,default:!0},alignment:{default:"top"},triggerLabel:{},showCloseTrigger:{type:Boolean,default:!0},dialogId:{},teleport:{type:Boolean,default:!0},disabled:{type:Boolean},variant:{},thumbnail:{},thumbnailOptions:{}},emits:["open","close","clickoutside"],setup(t,{expose:e,emit:n}){const r=t,i=n,o=tu(),s=pi(nT,{id:Qt({prefix:"dialog"}),closeOnEscape:r.closeOnEsc,modal:!0,closeOnInteractOutside:r.closeOnOutsideClick,onOpenChange(){if(!a.value.open)return i("open");i("close")},onPointerDownOutside(){i("clickoutside")},getRootNode:()=>{var u;return r.teleport?document:(u=o.value)==null?void 0:u.getRootNode()},...r}),a=N(()=>tT(s,di)),l=u=>r.dialogId?`${r.dialogId}-${u}`:"";return e({open:()=>{a.value.setOpen(!0)},close:()=>{a.value.setOpen(!1)}}),(u,c)=>(E(),O("div",{class:"k-dialog","data-id":u.dialogId},[P(u.$slots,"trigger",{triggerProps:a.value.getTriggerProps()},()=>[u.triggerLabel?(E(),B(ze,ne({key:0,class:"k-dialog__trigger",variant:"secondary"},a.value.getTriggerProps(),{disabled:u.disabled}),{default:Z(()=>[$e(se(u.triggerLabel),1)]),_:1},16,["disabled"])):I("",!0)]),(E(),B(Pg,{to:"body",disabled:!u.teleport},[a.value.open?(E(),O(Ie,{key:0},[H("div",ne({class:"k-dialog__backdrop"},a.value.getBackdropProps(),{"data-id":l("backdrop")}),null,16,iT),H("div",ne({class:`k-dialog__container k-dialog--align-${u.alignment}`},a.value.getPositionerProps(),{"data-id":l("container")}),[he(IE,ne({class:"k-dialog__card",variant:u.variant,appearance:"shadow"},a.value.getContentProps(),{"data-id":l("dialog"),thumbnail:u.thumbnail,thumbnailOptions:u.thumbnailOptions}),Cs({_:2},[u.$slots.header||u.$slots.title||u.$slots.subtitle||u.title||u.subtitle||u.showCloseTrigger?{name:"header",fn:Z(()=>[P(u.$slots,"header",{titleProps:a.value.getTitleProps(),descriptionProps:a.value.getDescriptionProps(),closeTriggerProps:a.value.getCloseTriggerProps()},()=>[P(u.$slots,"title",{titleProps:a.value.getTitleProps()},()=>[u.title?(E(),O("div",ne({key:0,class:"k-dialog__title k-card__title"},a.value.getTitleProps()),se(u.title),17)):I("",!0)]),P(u.$slots,"subtitle",{descriptionProps:a.value.getDescriptionProps()},()=>[u.subtitle?(E(),O("div",ne({key:0,class:"k-dialog__subtitle k-card__subtitle"},a.value.getDescriptionProps()),se(u.subtitle),17)):I("",!0)]),u.showCloseTrigger?(E(),B(ze,ne({key:0,class:"k-dialog__close-trigger",variant:"tertiary",icon:"fa-pro-light:times",size:"small"},a.value.getCloseTriggerProps()),null,16)):I("",!0)])]),key:"0"}:void 0,u.$slots.default?{name:"default",fn:Z(()=>[P(u.$slots,"default",{descriptionProps:a.value.getDescriptionProps()})]),key:"1"}:void 0,u.$slots.actions?{name:"actions",fn:Z(()=>[P(u.$slots,"actions",{close:()=>a.value.setOpen(!1)})]),key:"2"}:void 0]),1040,["variant","data-id","thumbnail","thumbnailOptions"])],16,oT)],64)):I("",!0)],8,["disabled"]))],8,rT))}});function hu(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function fu(){this._types=Object.create(null),this._extensions=Object.create(null);for(let t=0;t<arguments.length;t++)this.define(arguments[t]);this.define=this.define.bind(this),this.getType=this.getType.bind(this),this.getExtension=this.getExtension.bind(this)}fu.prototype.define=function(t,e){for(let n in t){let r=t[n].map(function(i){return i.toLowerCase()});n=n.toLowerCase();for(let i=0;i<r.length;i++){const o=r[i];if(o[0]!=="*"){if(!e&&o in this._types)throw new Error('Attempt to change mapping for "'+o+'" extension from "'+this._types[o]+'" to "'+n+'". Pass `force=true` to allow this, otherwise remove "'+o+'" from the list of extensions for "'+n+'".');this._types[o]=n}}if(e||!this._extensions[n]){const i=r[0];this._extensions[n]=i[0]!=="*"?i:i.substr(1)}}};fu.prototype.getType=function(t){t=String(t);let e=t.replace(/^.*[/\\]/,"").toLowerCase(),n=e.replace(/^.*\./,"").toLowerCase(),r=e.length<t.length;return(n.length<e.length-1||!r)&&this._types[n]||null};fu.prototype.getExtension=function(t){return t=/^\s*([^;\s]*)/.test(t)&&RegExp.$1,t&&this._extensions[t.toLowerCase()]||null};var aT=fu,lT={"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["es","ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avif":["avif"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]};let uT=aT;var cT=new uT(lT);const _p=hu(cT);function Dp(t){let e=["Bytes","KB","MB","GB","TB"];if(t==0)return"0 Byte";let n=Math.floor(Math.log(t)/Math.log(1024));return n>e.length&&(n=e.length),Math.round(t/Math.pow(1024,n))+" "+e[n]}function Ef(t){return JSON.parse(JSON.stringify(t))}function Np(t,e,n={fromDirectory:!1}){const{fromDirectory:r}=n;return e==="directory"&&(r||!t.type)?!0:!t.type&&!e?!1:e?(Array.isArray(e)?e:e.split(",")).map(i=>i.trim()).some(i=>i.startsWith(".")?_p.getType(i.substring(1))===t.type:i.includes("*")?t.type.startsWith(i.replace("*","")):t.type===i):!0}const Cf={counter:0,total:0,progress:0,bytes:0,result:[]};class fy{constructor(e){Yt(this,"queue"),Yt(this,"upload"),Yt(this,"uploadOptions"),Yt(this,"accept"),this.queue=ip(Ef(Cf)),this.upload=e.upload,this.uploadOptions=e.uploadOptions,this.accept=e.accept,this.reset=this.reset.bind(this),this.run=this.run.bind(this)}reset(){this.queue=Object.assign(this.queue,Ef(Cf))}async run(e){e=Array.from(e).filter(o=>Np(o,this.accept,this.uploadOptions)),this.queue.total=e.length,this.queue.counter=0,this.queue.bytes=e.reduce((o,s)=>o+=s?.size||0,0);let n=e.map(()=>0);const r=await Promise.all(e.map((o,s)=>this.upload(o,a=>{n[s]=a,this.queue.progress=n.reduce((l,u)=>l+=u,0)/n.length},this.uploadOptions).then(a=>(this.queue.counter++,a))));if(!r||!r.length)return;let i=r.flat();return this.reset(),i}}const Sf={"image/*":["jpeg","png","gif"]};function dT(t){return t?(Array.isArray(t)?t:t.split(",")).map(e=>e.trim()).map(e=>e.startsWith(".")?e.substring(1):e in Sf?Sf[e]:_p.getExtension(e)).flat():[]}function sd(t){let e=(n,r)=>{const i=document.createElement("a");i.href=n,i.setAttribute("style","display: none"),r&&(i.target=r),t.name&&(i.download=t.name.includes(".")?t.name:[t.name,_p.getExtension(t.type)].join(".")),document.body.appendChild(i),i.click(),document.body.removeChild(i)};return fetch(t.url,{headers:{"Cache-Control":"no-cache"}}).then(n=>n.blob()).then(n=>{const r=URL.createObjectURL(n);return e(r)}).catch(n=>e(t.url,"_blank"))}const pT={class:"k-media-thumbnail-actions"},my=te({__name:"ThumbnailActions",props:{value:{},disabled:{type:Boolean}},emits:["delete"],setup(t,{emit:e}){const n=t,r=N(()=>n.value.type.startsWith("image/")?{component:"button",bind:{onClick:()=>{sd(n.value)}}}:{component:"a",bind:{href:n.value.url,download:n.value.name,target:"_blank"}});return(i,o)=>(E(),O("div",pT,[i.disabled?I("",!0):(E(),B(ze,{key:0,class:"k-media-thumbnail-actions__delete",icon:"fa-pro-solid:trash",variant:"danger",onClick:o[0]||(o[0]=Ba(s=>i.$emit("delete"),["stop"]))})),he(ze,ne({variant:"primary",is:r.value.component,class:"k-media-thumbnail-actions__download"},r.value.bind,{icon:"fa-pro-solid:arrow-alt-circle-down"}),null,16,["is"])]))}}),hT=te({__name:"Thumbnail",props:{value:{},size:{default:"4rem"},disabled:{type:Boolean}},setup(t){const e=t,n=Fg(),r=N(()=>n["data-draggable"]),i=N(()=>{let s={};for(const a in n){if(a==="data-draggable")return;s[a]=n[a]}return s}),o=N(()=>({width:e.size,height:e.size}));return(s,a)=>(E(),O("div",ne({class:"k-media-thumbnail"},r.value,{class:{"k-media-thumbnail--selected":s.value.selected}}),[(E(),B(Qe(s.value.typeConfig.components.Thumbnail),ne({class:[{"k-media-thumbnail__item--selected":s.value.selected},"k-media-thumbnail__item"],value:s.value},i.value,{style:o.value}),null,16,["class","value","style"])),he(my,{value:s.value,disabled:s.disabled,onDelete:a[0]||(a[0]=l=>s.$emit("delete",s.value))},null,8,["value","disabled"])],16))}}),fT={key:0,class:"k-media-type-selector"},mT={class:"k-media-type-selector__info"},gT=te({__name:"TypeSelector",props:{value:{},upload:{type:Function},labels:{}},emits:["add","cancel","success","openFileWindow"],setup(t,{emit:e}){const n=t,r=e,i=X(null),o=X(),s=X(!0),a=X(!1),l=X(),u=X();Ee(a,g=>{var y,b;return g?(y=l.value)==null?void 0:y.open():(b=l.value)==null?void 0:b.close()},{immediate:!0});const c=N(()=>n.value.length===1&&n.value[0].name==="Image");function d(){s.value&&(o.value=u.value.prepareData().then(g=>{r("add",g)}))}function h(g){if(g.name==="Image")return r("openFileWindow");a.value=!0,i.value=g}function p(){a.value=!1,r("cancel")}function f(){a.value=!1,r("success")}function m(g){const y=n.labels[g];return!y||typeof y=="string"?g:y.createLabel||g}return(g,y)=>c.value?I("",!0):(E(),O("div",fT,[H("span",mT,se(g.labels.selectMessage),1),he(du,{teleport:!0,label:g.labels.select,iconRight:"fa6-solid:plus",theme:"shadow",placement:"bottom-end"},{default:Z(()=>[(E(!0),O(Ie,null,_t(g.value,b=>(E(),B(Qe(b.components.CreateTrigger),{key:b.name,label:m(b.name.toLowerCase()),onClick:k=>h(b)},null,8,["label","onClick"]))),128))]),_:1},8,["label"]),he(sT,{dialogId:"k-media-type-selector",ref_key:"dialog",ref:l,title:"",teleport:!0,"close-on-outside-click":!1,"show-close-trigger":!1,"close-on-esc":!0,onClose:p},{default:Z(()=>[i.value?(E(),B(Qe(i.value.components.Create),ne({key:0,isValid:s.value,"onUpdate:isValid":y[0]||(y[0]=b=>s.value=b),upload:g.upload,labels:g.labels,name:i.value.name,ref_key:"creator",ref:u},g.$attrs),null,16,["isValid","upload","labels","name"])):I("",!0)]),footer:Z(()=>[he(ze,{label:g.labels.cancel,type:"button",onClick:p},null,8,["label"]),he(ze,{variant:"primary",disabled:!s.value,promise:o.value,label:g.labels.save,stateTimeout:1e3,onClick:d,onSuccess:f},null,8,["disabled","promise","label"])]),_:1},512)]))}}),vT=te({__name:"Description",props:{modelValue:{},placeholder:{}},emits:["update:modelValue"],setup(t,{emit:e}){return(n,r)=>(E(),B(mE,{class:"k-media-description",type:"text",placeholder:n.placeholder,modelValue:n.modelValue||"","onUpdate:modelValue":r[0]||(r[0]=i=>n.$emit("update:modelValue",i))},null,8,["placeholder","modelValue"]))}}),yT={class:"k-media-uploader"},bT={class:"k-media-uploader__bar"},kT={class:"k-media-uploader__meta"},wT={key:0},xT={key:1},ET=te({__name:"Uploader",props:{value:{},bytes:{},current:{default:1},total:{default:1}},setup(t){const e=t,n=N(()=>e.total>1),r=N(()=>Dp(e.bytes)),i=N(()=>Math.floor(e.value));return(o,s)=>(E(),O("div",yT,[H("div",null,se(i.value)+" %",1),H("div",bT,[H("div",{class:"k-media-uploader__bar-value",style:Cr({width:o.value+"%"})},null,4)]),H("div",kT,[n.value?(E(),O("div",wT,se(o.current)+" / "+se(o.total),1)):I("",!0),o.bytes?(E(),O("div",xT,"("+se(r.value)+")",1)):I("",!0)])]))}}),CT=["innerHTML"],ST=te({__name:"SlotHandler",props:{value:{}},setup(t){const e=t,n=N(()=>typeof e.value=="string"?e.value:void 0),r=N(()=>typeof e.value=="string"?"div":e.value);return(i,o)=>(E(),B(Qe(r.value),be(Ne(i.$attrs)),{default:Z(()=>[n.value?(E(),O("span",{key:0,innerHTML:n.value},null,8,CT)):I("",!0)]),_:1},16))}}),TT={class:"k-media-droparea__instruction"},OT=["type","accept","required","disabled","multiple"],AT=te({__name:"DropArea",props:{value:{},multiple:{type:Boolean},upload:{},uploadOptions:{},type:{},accept:{},selected:{default:null},dropMessage:{},disabled:{type:Boolean},required:{type:Boolean}},emits:["input","select","remove"],setup(t,{emit:e}){const n=t,r=e,i=X(!1),o=X(!0),s=X(),a=N(()=>!!(!n.required||n.value)),l=N(()=>n.disabled),u=N(()=>!l.value&&!d.total),{run:c,queue:d}=new fy(n);function h(k){return c(k).then(v=>{!v||!v.length||(r("input",n.multiple?[...n.value||[],...v]:v[0]),(!n.selected||!n.multiple)&&kr(()=>r("select")))})}function p(k){l.value||(h(k.target.files||[]),s.value&&(s.value.value=""))}function f(k){var v;if(l.value||!s.value)return;if(k.preventDefault(),!o.value)return g();g();const w=(v=k.dataTransfer)==null?void 0:v.files;w!=null&&w.length&&(s.value.files=w,s.value.dispatchEvent(new InputEvent("input")),h(w))}function m(k){l.value||k.dataTransfer&&(o.value=Array.from(k.dataTransfer.items).every(v=>Np(v,n.accept))&&n.multiple?!0:k.dataTransfer.items.length===1,i.value=!0,k.preventDefault())}function g(){o.value=!0,i.value=!1}const y=Cn("k-media-droparea",{variants:{active:{true:"k-media-droparea--active"},invalid:{true:"k-media-droparea--invalid"},selected:{true:"k-media-droparea--selected"},disabled:{true:"k-media-droparea--disabled"}}}),b=()=>{var k;return(k=s.value)==null?void 0:k.click()};return(k,v)=>(E(),O(Ie,null,[H("div",{class:Ce($(y)({active:i.value,invalid:!o.value,selected:!!k.selected,disabled:l.value})),onDrop:f,onDragover:m,onDragleave:g},[P(k.$slots,"preview"),H("div",TT,[u.value?(E(),O("input",{key:0,type:k.type,accept:Array.isArray(k.accept)?k.accept.join(","):k.accept,required:a.value,ref_key:"input",ref:s,onChange:p,disabled:!u.value,multiple:k.multiple,class:"k-media-droparea__input"},null,40,OT)):I("",!0),o.value?(E(),O(Ie,{key:1},[P(k.$slots,"drop-message",{},()=>[he(ST,{value:k.dropMessage},null,8,["value"])]),P(k.$slots,"default",{openFileWindow:b})],64)):(E(),B($(Ze),{key:2,icon:"fa-pro-light:ban",style:{"font-size":"2rem"}})),P(k.$slots,"custom-message")]),!k.multiple&&k.selected?(E(),B(my,{key:0,value:k.selected,disabled:l.value,onDelete:v[0]||(v[0]=w=>k.$emit("remove",k.selected))},null,8,["value","disabled"])):I("",!0)],34),$(d).total?(E(),B(ET,{key:0,value:$(d).progress,bytes:$(d).bytes,current:$(d).counter,total:$(d).total},null,8,["value","bytes","current","total"])):I("",!0)],64))}}),MT=te({__name:"CreateTrigger",props:{label:{}},setup(t){return(e,n)=>(E(),B(ze,{type:"button",label:e.label,iconRight:"fa6-solid:image",size:"small",variant:"tertiary"},null,8,["label"]))}}),_T=te({__name:"Thumbnail",props:{value:{}},setup(t){const e=t;return(n,r)=>(E(),B(su,{class:"k-media-image__thumbnail",src:e.value.url,onClick:r[0]||(r[0]=i=>n.$emit("click"))},null,8,["src"]))}}),DT=te({__name:"Preview",props:{value:{},size:{}},setup(t){const e=t;return(n,r)=>(E(),B(su,{src:e.value.url,class:"k-media-image-preview",size:n.size,width:"100%",height:"100%"},null,8,["src","size"]))}}),NT={name:"Image",condition:t=>/^image\/.+/i.test(t.type),components:{CreateTrigger:ka(MT),Thumbnail:ka(_T),Preview:ka(DT)}},IT={Image:NT};/**!
3
+ `)},i=D(()=>Zg("grid",{columns:n(e.columns,"1fr"),align:ja(e.align)||"initial",rows:n(e.rows,"auto"),gap:cp(e.gap),areas:r(e.areas)||"unset"}));return(o,s)=>(E(),$(Qe(o.is),{class:"k-grid",style:Cr(i.value)},{default:Z(()=>[P(o.$slots,"default")]),_:3},8,["style"]))}});function ay(t){return t?t.flatMap(e=>{const{type:n,children:r}=e;return n===Ie?ay(r):[e]}):[]}const EL=Q({props:{area:String,align:String},inheritAttrs:!1,setup({area:t,align:e},{slots:n}){return()=>{if(!n.default)return null;const[r]=ay(n.default());if(!r)return null;const i=ne({style:{"--k-grid-item-area":t,"--k-grid-item-align-self":ja(e)||"initial"}},r.props??{});return bk(r,i)}}}),bS={key:0,class:"k-scroller__indicator"},CL=Q({__name:"Scroller",props:{is:{default:"div"},appearance:{default:"default"},treshhold:{default:80}},setup(t){const e=nu(),n=Qt({prefix:"k-scroller-"}),r=t,i=X({top:!1,right:!1,left:!1,bottom:!1}),o=D(()=>Object.entries(i.value).filter(([,a])=>a).map(([a])=>a)),s=a=>{const{scrollWidth:l,scrollHeight:u,clientWidth:c,clientHeight:d,scrollTop:h,scrollLeft:p}=a,f=l-c>=r.treshhold,m=u-d>=r.treshhold;i.value={top:m&&h<=r.treshhold,left:f&&p<=r.treshhold,bottom:m&&h>=u-d-r.treshhold,right:f&&p>=l-c-r.treshhold}};return qn(()=>{const a=e.value;a&&(Ep(a,"scroll",()=>s(a)),W1(a,()=>s(a),{childList:!0,subtree:!0}))}),(a,l)=>(E(),$(Qe(a.is),{id:B(n),class:Ce([`k-scroller k-scroller--appearance-${a.appearance}`,...o.value.map(u=>`k-scroller--scrolled-to-${u}`)])},{default:Z(()=>[a.appearance==="indicator"?(E(),O("div",bS,[P(a.$slots,"indicator",{},()=>[he(B(Ze),{icon:"fa-pro-thin:arrow-right"})])])):I("",!0),P(a.$slots,"default")]),_:3},8,["id","class"]))}});var wi=new WeakMap,ea=new WeakMap,ta={},Wu=0,ly=t=>t&&(t.host||ly(t.parentNode)),kS=(t,e)=>e.map(n=>{if(t.contains(n))return n;const r=ly(n);return r&&t.contains(r)?r:(console.error("[zag-js > ariaHidden] target",n,"in not contained inside",t,". Doing nothing"),null)}).filter(n=>!!n),wS=t=>t.localName==="next-route-announcer"||t.localName==="script"||t.hasAttribute("aria-live")?!0:t.matches("[data-live-announcer]"),xS=(t,e)=>{const{parentNode:n,markerName:r,controlAttribute:i,explicitBooleanValue:o}=e,s=kS(n,Array.isArray(t)?t:[t]);ta[r]||(ta[r]=new WeakMap);const a=ta[r],l=[],u=new Set,c=new Set(s),d=p=>{!p||u.has(p)||(u.add(p),d(p.parentNode))};s.forEach(d);const h=p=>{!p||c.has(p)||Array.prototype.forEach.call(p.children,f=>{if(u.has(f))h(f);else try{if(wS(f))return;const m=f.getAttribute(i),g=o?m==="true":m!==null&&m!=="false",y=(wi.get(f)||0)+1,b=(a.get(f)||0)+1;wi.set(f,y),a.set(f,b),l.push(f),y===1&&g&&ea.set(f,!0),b===1&&f.setAttribute(r,""),g||f.setAttribute(i,o?"true":"")}catch(m){console.error("[zag-js > ariaHidden] cannot operate on ",f,m)}})};return h(n),u.clear(),Wu++,()=>{l.forEach(p=>{const f=wi.get(p)-1,m=a.get(p)-1;wi.set(p,f),a.set(p,m),f||(ea.has(p)||p.removeAttribute(i),ea.delete(p)),m||p.removeAttribute(r)}),Wu--,Wu||(wi=new WeakMap,wi=new WeakMap,ea=new WeakMap,ta={})}},ES=t=>(Array.isArray(t)?t[0]:t).ownerDocument.body,CS=(t,e=ES(t),n="data-aria-hidden")=>{if(e)return xS(t,{parentNode:e,markerName:n,controlAttribute:"aria-hidden",explicitBooleanValue:!0})},SS=t=>{const e=requestAnimationFrame(()=>t());return()=>cancelAnimationFrame(e)};function TS(t,e={}){const{defer:n=!0}=e,r=n?SS:o=>o(),i=[];return i.push(r(()=>{const o=(typeof t=="function"?t():t).filter(Boolean);o.length!==0&&i.push(CS(o))})),()=>{i.forEach(o=>o?.())}}function OS(t){const e={each(n){var r;for(let i=0;i<((r=t.frames)==null?void 0:r.length);i+=1){const o=t.frames[i];o&&n(o)}},addEventListener(n,r,i){return e.each(o=>{try{o.document.addEventListener(n,r,i)}catch{}}),()=>{try{e.removeEventListener(n,r,i)}catch{}}},removeEventListener(n,r,i){e.each(o=>{try{o.document.removeEventListener(n,r,i)}catch{}})}};return e}function AS(t){const e=t.frameElement!=null?t.parent:null;return{addEventListener:(n,r,i)=>{try{e?.addEventListener(n,r,i)}catch{}return()=>{try{e?.removeEventListener(n,r,i)}catch{}}},removeEventListener:(n,r,i)=>{try{e?.removeEventListener(n,r,i)}catch{}}}}var mf="pointerdown.outside",gf="focus.outside";function MS(t){for(const e of t)if(dt(e)&&dr(e))return!0;return!1}var uy=t=>"clientY"in t;function _S(t,e){if(!uy(e)||!t)return!1;const n=t.getBoundingClientRect();return n.width===0||n.height===0?!1:n.top<=e.clientY&&e.clientY<=n.top+n.height&&n.left<=e.clientX&&e.clientX<=n.left+n.width}function DS(t,e){return t.y<=e.y&&e.y<=t.y+t.height&&t.x<=e.x&&e.x<=t.x+t.width}function vf(t,e){if(!e||!uy(t))return!1;const n=e.scrollHeight>e.clientHeight,r=n&&t.clientX>e.offsetLeft+e.clientWidth,i=e.scrollWidth>e.clientWidth,o=i&&t.clientY>e.offsetTop+e.clientHeight,s={x:e.offsetLeft,y:e.offsetTop,width:e.clientWidth+(n?16:0),height:e.clientHeight+(i?16:0)},a={x:t.clientX,y:t.clientY};return DS(s,a)?r||o:!1}function NS(t,e){const{exclude:n,onFocusOutside:r,onPointerDownOutside:i,onInteractOutside:o,defer:s}=e;if(!t)return;const a=Kt(t),l=xt(t),u=OS(l),c=AS(l);function d(y){const b=ct(y);if(!dt(b)||!b.isConnected||qi(t,b)||_S(t,y))return!1;const k=a.querySelector(`[aria-controls="${t.id}"]`);if(k){const w=Hc(k);if(vf(y,w))return!1}const v=Hc(t);return vf(y,v)?!1:!(n!=null&&n(b))}const h=new Set;function p(y){function b(){var k;const v=s?At:x=>x(),w=((k=y.composedPath)==null?void 0:k.call(y))??[y.target];v(()=>{if(!(!t||!d(y))){if(i||o){const x=Wh(i,o);t.addEventListener(mf,x,{once:!0})}yf(t,mf,{bubbles:!1,cancelable:!0,detail:{originalEvent:y,contextmenu:lx(y),focusable:MS(w)}})}})}y.pointerType==="touch"?(h.forEach(k=>k()),h.add(De(a,"click",b,{once:!0})),h.add(c.addEventListener("click",b,{once:!0})),h.add(u.addEventListener("click",b,{once:!0}))):b()}const f=new Set,m=setTimeout(()=>{f.add(De(a,"pointerdown",p,!0)),f.add(c.addEventListener("pointerdown",p,!0)),f.add(u.addEventListener("pointerdown",p,!0))},0);function g(y){(s?At:b=>b())(()=>{if(!(!t||!d(y))){if(r||o){const b=Wh(r,o);t.addEventListener(gf,b,{once:!0})}yf(t,gf,{bubbles:!1,cancelable:!0,detail:{originalEvent:y,contextmenu:!1,focusable:dr(ct(y))}})}})}return f.add(De(a,"focusin",g,!0)),f.add(c.addEventListener("focusin",g,!0)),f.add(u.addEventListener("focusin",g,!0)),()=>{clearTimeout(m),h.forEach(y=>y()),f.forEach(y=>y())}}function IS(t,e){const{defer:n}=e,r=n?At:o=>o(),i=[];return i.push(r(()=>{const o=typeof t=="function"?t():t;i.push(NS(o,e))})),()=>{i.forEach(o=>o?.())}}function yf(t,e,n){const r=t.ownerDocument.defaultView||window,i=new r.CustomEvent(e,n);return t.dispatchEvent(i)}function RS(t,e){const n=r=>{r.key==="Escape"&&(r.isComposing||e==null||e(r))};return De(Kt(t),"keydown",n,{capture:!0})}var Jt={layers:[],branches:[],count(){return this.layers.length},pointerBlockingLayers(){return this.layers.filter(t=>t.pointerBlocking)},topMostPointerBlockingLayer(){return[...this.pointerBlockingLayers()].slice(-1)[0]},hasPointerBlockingLayer(){return this.pointerBlockingLayers().length>0},isBelowPointerBlockingLayer(t){var e;const n=this.indexOf(t),r=this.topMostPointerBlockingLayer()?this.indexOf((e=this.topMostPointerBlockingLayer())==null?void 0:e.node):-1;return n<r},isTopMost(t){const e=this.layers[this.count()-1];return e?.node===t},getNestedLayers(t){return Array.from(this.layers).slice(this.indexOf(t)+1)},isInNestedLayer(t,e){return this.getNestedLayers(t).some(n=>qi(n.node,e))},isInBranch(t){return Array.from(this.branches).some(e=>qi(e,t))},add(t){const e=this.layers.push(t);t.node.style.setProperty("--layer-index",`${e}`)},addBranch(t){this.branches.push(t)},remove(t){const e=this.indexOf(t);e<0||(e<this.count()-1&&this.getNestedLayers(t).forEach(n=>n.dismiss()),this.layers.splice(e,1),t.style.removeProperty("--layer-index"))},removeBranch(t){const e=this.branches.indexOf(t);e>=0&&this.branches.splice(e,1)},indexOf(t){return this.layers.findIndex(e=>e.node===t)},dismiss(t){var e;(e=this.layers[this.indexOf(t)])==null||e.dismiss()},clear(){this.remove(this.layers[0].node)}},bf;function kf(){Jt.layers.forEach(({node:t})=>{t.style.pointerEvents=Jt.isBelowPointerBlockingLayer(t)?"none":"auto"})}function PS(t){t.style.pointerEvents=""}function FS(t,e){const n=Kt(t),r=[];if(Jt.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(bf=document.body.style.pointerEvents,queueMicrotask(()=>{n.body.style.pointerEvents="none",n.body.setAttribute("data-inert","")})),e){const i=Lx(e,o=>{r.push(Rx(o,{pointerEvents:"auto"}))});r.push(i)}return()=>{Jt.hasPointerBlockingLayer()||(queueMicrotask(()=>{n.body.style.pointerEvents=bf,n.body.removeAttribute("data-inert"),n.body.style.length===0&&n.body.removeAttribute("style")}),r.forEach(i=>i()))}}function LS(t,e){const{warnOnMissingNode:n=!0}=e;if(n&&!t){Gc("[@zag-js/dismissable] node is `null` or `undefined`");return}if(!t)return;const{onDismiss:r,pointerBlocking:i,exclude:o,debug:s}=e,a={dismiss:r,node:t,pointerBlocking:i};Jt.add(a),kf();function l(p){var f,m;const g=ct(p.detail.originalEvent);Jt.isBelowPointerBlockingLayer(t)||Jt.isInBranch(g)||((f=e.onPointerDownOutside)==null||f.call(e,p),(m=e.onInteractOutside)==null||m.call(e,p),!p.defaultPrevented&&(s&&console.log("onPointerDownOutside:",p.detail.originalEvent),r?.()))}function u(p){var f,m;const g=ct(p.detail.originalEvent);Jt.isInBranch(g)||((f=e.onFocusOutside)==null||f.call(e,p),(m=e.onInteractOutside)==null||m.call(e,p),!p.defaultPrevented&&(s&&console.log("onFocusOutside:",p.detail.originalEvent),r?.()))}function c(p){var f;Jt.isTopMost(t)&&((f=e.onEscapeKeyDown)==null||f.call(e,p),!p.defaultPrevented&&r&&(p.preventDefault(),r()))}function d(p){var f;if(!t)return!1;const m=typeof o=="function"?o():o,g=Array.isArray(m)?m:[m],y=(f=e.persistentElements)==null?void 0:f.map(b=>b()).filter(dt);return y&&g.push(...y),g.some(b=>qi(b,p))||Jt.isInNestedLayer(t,p)}const h=[i?FS(t,e.persistentElements):void 0,RS(t,c),IS(t,{exclude:d,onFocusOutside:u,onPointerDownOutside:l,defer:e.defer})];return()=>{Jt.remove(t),kf(),PS(t),h.forEach(p=>p?.())}}function VS(t,e){const{defer:n}=e,r=n?At:o=>o(),i=[];return i.push(r(()=>{const o=Ni(t)?t():t;i.push(LS(o,e))})),()=>{i.forEach(o=>o?.())}}var BS=Object.defineProperty,$S=(t,e,n)=>e in t?BS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Se=(t,e,n)=>$S(t,typeof e!="symbol"?e+"":e,n),wf={activateTrap(t,e){if(t.length>0){const r=t[t.length-1];r!==e&&r.pause()}const n=t.indexOf(e);n===-1||t.splice(n,1),t.push(e)},deactivateTrap(t,e){const n=t.indexOf(e);n!==-1&&t.splice(n,1),t.length>0&&t[t.length-1].unpause()}},jS=[],zS=class{constructor(t,e){Se(this,"trapStack"),Se(this,"config"),Se(this,"doc"),Se(this,"state",{containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0}),Se(this,"listenerCleanups",[]),Se(this,"handleFocus",r=>{const i=ct(r),o=this.findContainerIndex(i,r)>=0;if(o||dp(i))o&&(this.state.mostRecentlyFocusedNode=i);else{r.stopImmediatePropagation();let s,a=!0;if(this.state.mostRecentlyFocusedNode)if(yo(this.state.mostRecentlyFocusedNode)>0){const l=this.findContainerIndex(this.state.mostRecentlyFocusedNode),{tabbableNodes:u}=this.state.containerGroups[l];if(u.length>0){const c=u.findIndex(d=>d===this.state.mostRecentlyFocusedNode);c>=0&&(this.config.isKeyForward(this.state.recentNavEvent)?c+1<u.length&&(s=u[c+1],a=!1):c-1>=0&&(s=u[c-1],a=!1))}}else this.state.containerGroups.some(l=>l.tabbableNodes.some(u=>yo(u)>0))||(a=!1);else a=!1;a&&(s=this.findNextNavNode({target:this.state.mostRecentlyFocusedNode,isBackward:this.config.isKeyBackward(this.state.recentNavEvent)})),s?this.tryFocus(s):this.tryFocus(this.state.mostRecentlyFocusedNode||this.getInitialFocusNode())}this.state.recentNavEvent=void 0}),Se(this,"handlePointerDown",r=>{const i=ct(r);if(!(this.findContainerIndex(i,r)>=0)){if(ko(this.config.clickOutsideDeactivates,r)){this.deactivate({returnFocus:this.config.returnFocusOnDeactivate});return}ko(this.config.allowOutsideClick,r)||r.preventDefault()}}),Se(this,"handleClick",r=>{const i=ct(r);this.findContainerIndex(i,r)>=0||ko(this.config.clickOutsideDeactivates,r)||ko(this.config.allowOutsideClick,r)||(r.preventDefault(),r.stopImmediatePropagation())}),Se(this,"handleTabKey",r=>{if(this.config.isKeyForward(r)||this.config.isKeyBackward(r)){this.state.recentNavEvent=r;const i=this.config.isKeyBackward(r),o=this.findNextNavNode({event:r,isBackward:i});if(!o)return;bo(r)&&r.preventDefault(),this.tryFocus(o)}}),Se(this,"handleEscapeKey",r=>{HS(r)&&ko(this.config.escapeDeactivates,r)!==!1&&(r.preventDefault(),this.deactivate())}),Se(this,"_mutationObserver"),Se(this,"setupMutationObserver",()=>{const r=this.doc.defaultView||window;this._mutationObserver=new r.MutationObserver(i=>{i.some(o=>Array.from(o.removedNodes).some(s=>s===this.state.mostRecentlyFocusedNode))&&this.tryFocus(this.getInitialFocusNode())})}),Se(this,"updateObservedNodes",()=>{var r;(r=this._mutationObserver)==null||r.disconnect(),this.state.active&&!this.state.paused&&this.state.containers.map(i=>{var o;(o=this._mutationObserver)==null||o.observe(i,{subtree:!0,childList:!0})})}),Se(this,"getInitialFocusNode",()=>{let r=this.getNodeForOption("initialFocus",{hasFallback:!0});if(r===!1)return!1;if(r===void 0||r&&!dr(r))if(this.findContainerIndex(this.doc.activeElement)>=0)r=this.doc.activeElement;else{const i=this.state.tabbableGroups[0];r=i&&i.firstTabbableNode||this.getNodeForOption("fallbackFocus")}else r===null&&(r=this.getNodeForOption("fallbackFocus"));if(!r)throw new Error("Your focus-trap needs to have at least one focusable element");return r.isConnected||(r=this.getNodeForOption("fallbackFocus")),r}),Se(this,"tryFocus",r=>{if(r!==!1&&r!==tv(this.doc)){if(!r||!r.focus){this.tryFocus(this.getInitialFocusNode());return}r.focus({preventScroll:!!this.config.preventScroll}),this.state.mostRecentlyFocusedNode=r,qS(r)&&r.select()}}),Se(this,"deactivate",r=>{if(!this.state.active)return this;const i={onDeactivate:this.config.onDeactivate,onPostDeactivate:this.config.onPostDeactivate,checkCanReturnFocus:this.config.checkCanReturnFocus,...r};clearTimeout(this.state.delayInitialFocusTimer),this.state.delayInitialFocusTimer=void 0,this.removeListeners(),this.state.active=!1,this.state.paused=!1,this.updateObservedNodes(),wf.deactivateTrap(this.trapStack,this);const o=this.getOption(i,"onDeactivate"),s=this.getOption(i,"onPostDeactivate"),a=this.getOption(i,"checkCanReturnFocus"),l=this.getOption(i,"returnFocus","returnFocusOnDeactivate");o?.();const u=()=>{xf(()=>{if(l){const c=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);this.tryFocus(c)}s?.()})};if(l&&a){const c=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);return a(c).then(u,u),this}return u(),this}),Se(this,"pause",r=>{if(this.state.paused||!this.state.active)return this;const i=this.getOption(r,"onPause"),o=this.getOption(r,"onPostPause");return this.state.paused=!0,i?.(),this.removeListeners(),this.updateObservedNodes(),o?.(),this}),Se(this,"unpause",r=>{if(!this.state.paused||!this.state.active)return this;const i=this.getOption(r,"onUnpause"),o=this.getOption(r,"onPostUnpause");return this.state.paused=!1,i?.(),this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),o?.(),this}),Se(this,"updateContainerElements",r=>(this.state.containers=Array.isArray(r)?r.filter(Boolean):[r].filter(Boolean),this.state.active&&this.updateTabbableNodes(),this.updateObservedNodes(),this)),Se(this,"getReturnFocusNode",r=>{const i=this.getNodeForOption("setReturnFocus",{params:[r]});return i||(i===!1?!1:r)}),Se(this,"getOption",(r,i,o)=>r&&r[i]!==void 0?r[i]:this.config[o||i]),Se(this,"getNodeForOption",(r,{hasFallback:i=!1,params:o=[]}={})=>{let s=this.config[r];if(typeof s=="function"&&(s=s(...o)),s===!0&&(s=void 0),!s){if(s===void 0||s===!1)return s;throw new Error(`\`${r}\` was specified but was not a node, or did not return a node`)}let a=s;if(typeof s=="string"){try{a=this.doc.querySelector(s)}catch(l){throw new Error(`\`${r}\` appears to be an invalid selector; error="${l.message}"`)}if(!a&&!i)throw new Error(`\`${r}\` as selector refers to no known node`)}return a}),Se(this,"findNextNavNode",r=>{const{event:i,isBackward:o=!1}=r,s=r.target||ct(i);this.updateTabbableNodes();let a=null;if(this.state.tabbableGroups.length>0){const l=this.findContainerIndex(s,i),u=l>=0?this.state.containerGroups[l]:void 0;if(l<0)o?a=this.state.tabbableGroups[this.state.tabbableGroups.length-1].lastTabbableNode:a=this.state.tabbableGroups[0].firstTabbableNode;else if(o){let c=this.state.tabbableGroups.findIndex(({firstTabbableNode:d})=>s===d);if(c<0&&(u?.container===s||dr(s)&&!Vr(s)&&!(u!=null&&u.nextTabbableNode(s,!1)))&&(c=l),c>=0){const d=c===0?this.state.tabbableGroups.length-1:c-1,h=this.state.tabbableGroups[d];a=yo(s)>=0?h.lastTabbableNode:h.lastDomTabbableNode}else bo(i)||(a=u?.nextTabbableNode(s,!1))}else{let c=this.state.tabbableGroups.findIndex(({lastTabbableNode:d})=>s===d);if(c<0&&(u?.container===s||dr(s)&&!Vr(s)&&!(u!=null&&u.nextTabbableNode(s)))&&(c=l),c>=0){const d=c===this.state.tabbableGroups.length-1?0:c+1,h=this.state.tabbableGroups[d];a=yo(s)>=0?h.firstTabbableNode:h.firstDomTabbableNode}else bo(i)||(a=u?.nextTabbableNode(s))}}else a=this.getNodeForOption("fallbackFocus");return a}),this.trapStack=e.trapStack||jS;const n={returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward(r){return bo(r)&&!r.shiftKey},isKeyBackward(r){return bo(r)&&r.shiftKey},...e};this.doc=n.document||Kt(Array.isArray(t)?t[0]:t),this.config=n,this.updateContainerElements(t),this.setupMutationObserver()}get active(){return this.state.active}get paused(){return this.state.paused}findContainerIndex(t,e){const n=typeof e?.composedPath=="function"?e.composedPath():void 0;return this.state.containerGroups.findIndex(({container:r,tabbableNodes:i})=>r.contains(t)||n?.includes(r)||i.find(o=>o===t))}updateTabbableNodes(){if(this.state.containerGroups=this.state.containers.map(t=>{const e=uv(t),n=lv(t),r=e.length>0?e[0]:void 0,i=e.length>0?e[e.length-1]:void 0,o=n.find(u=>Vr(u)),s=n.slice().reverse().find(u=>Vr(u)),a=!!e.find(u=>yo(u)>0);function l(u,c=!0){const d=e.indexOf(u);return d<0?c?n.slice(n.indexOf(u)+1).find(h=>Vr(h)):n.slice(0,n.indexOf(u)).reverse().find(h=>Vr(h)):e[d+(c?1:-1)]}return{container:t,tabbableNodes:e,focusableNodes:n,posTabIndexesFound:a,firstTabbableNode:r,lastTabbableNode:i,firstDomTabbableNode:o,lastDomTabbableNode:s,nextTabbableNode:l}}),this.state.tabbableGroups=this.state.containerGroups.filter(t=>t.tabbableNodes.length>0),this.state.tabbableGroups.length<=0&&!this.getNodeForOption("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(this.state.containerGroups.find(t=>t.posTabIndexesFound)&&this.state.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.")}addListeners(){if(this.state.active)return wf.activateTrap(this.trapStack,this),this.state.delayInitialFocusTimer=this.config.delayInitialFocus?xf(()=>{this.tryFocus(this.getInitialFocusNode())}):this.tryFocus(this.getInitialFocusNode()),this.listenerCleanups.push(De(this.doc,"focusin",this.handleFocus,!0),De(this.doc,"mousedown",this.handlePointerDown,{capture:!0,passive:!1}),De(this.doc,"touchstart",this.handlePointerDown,{capture:!0,passive:!1}),De(this.doc,"click",this.handleClick,{capture:!0,passive:!1}),De(this.doc,"keydown",this.handleTabKey,{capture:!0,passive:!1}),De(this.doc,"keydown",this.handleEscapeKey)),this}removeListeners(){if(this.state.active)return this.listenerCleanups.forEach(t=>t()),this.listenerCleanups=[],this}activate(t){if(this.state.active)return this;const e=this.getOption(t,"onActivate"),n=this.getOption(t,"onPostActivate"),r=this.getOption(t,"checkCanFocusTrap");r||this.updateTabbableNodes(),this.state.active=!0,this.state.paused=!1,this.state.nodeFocusedBeforeActivation=this.doc.activeElement||null,e?.();const i=()=>{r&&this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),n?.()};return r?(r(this.state.containers.concat()).then(i,i),this):(i(),this)}},bo=t=>t.key==="Tab",ko=(t,...e)=>typeof t=="function"?t(...e):t,HS=t=>!t.isComposing&&t.key==="Escape",xf=t=>setTimeout(t,0),qS=t=>t.localName==="input"&&"select"in t&&typeof t.select=="function";function WS(t,e={}){let n;const r=At(()=>{const i=typeof t=="function"?t():t;if(i){n=new zS(i,{escapeDeactivates:!1,allowOutsideClick:!0,preventScroll:!0,returnFocusOnDeactivate:!0,delayInitialFocus:!1,fallbackFocus:i,...e,document:Kt(i)});try{n.activate()}catch{}}});return function(){n?.deactivate(),r()}}var Uu="data-scroll-lock";function Ef(t,e){if(!t)return;const n=Object.keys(e).reduce((r,i)=>(r[i]=t.style.getPropertyValue(i),r),{});return Object.assign(t.style,e),()=>{Object.assign(t.style,n)}}function US(t,e,n){if(!t)return;const r=t.style.getPropertyValue(e);return t.style.setProperty(e,n),()=>{r?t.style.setProperty(e,r):t.style.removeProperty(e)}}function KS(t){const e=t.getBoundingClientRect().left;return Math.round(e)+t.scrollLeft?"paddingLeft":"paddingRight"}function GS(t){const e=t??document,n=e.defaultView??window,{documentElement:r,body:i}=e;if(i.hasAttribute(Uu))return;i.setAttribute(Uu,"");const o=n.innerWidth-r.clientWidth,s=()=>US(r,"--scrollbar-width",`${o}px`),a=KS(r),l=()=>Ef(i,{overflow:"hidden",[a]:`${o}px`}),u=()=>{const{scrollX:d,scrollY:h,visualViewport:p}=n,f=p?.offsetLeft??0,m=p?.offsetTop??0,g=Ef(i,{position:"fixed",overflow:"hidden",top:`${-(h-Math.floor(m))}px`,left:`${-(d-Math.floor(f))}px`,right:"0",[a]:`${o}px`});return()=>{g?.(),n.scrollTo({left:d,top:h,behavior:"instant"})}},c=[s(),hp()?u():l()];return()=>{c.forEach(d=>d?.()),i.removeAttribute(Uu)}}var JS=Ln("dialog").parts("trigger","backdrop","positioner","content","title","description","closeTrigger"),Rr=JS.build(),cy=t=>{var e;return((e=t.ids)==null?void 0:e.positioner)??`dialog:${t.id}:positioner`},dy=t=>{var e;return((e=t.ids)==null?void 0:e.backdrop)??`dialog:${t.id}:backdrop`},id=t=>{var e;return((e=t.ids)==null?void 0:e.content)??`dialog:${t.id}:content`},py=t=>{var e;return((e=t.ids)==null?void 0:e.trigger)??`dialog:${t.id}:trigger`},od=t=>{var e;return((e=t.ids)==null?void 0:e.title)??`dialog:${t.id}:title`},sd=t=>{var e;return((e=t.ids)==null?void 0:e.description)??`dialog:${t.id}:description`},hy=t=>{var e;return((e=t.ids)==null?void 0:e.closeTrigger)??`dialog:${t.id}:close`},na=t=>t.getById(id(t)),XS=t=>t.getById(cy(t)),YS=t=>t.getById(dy(t)),ZS=t=>t.getById(py(t)),QS=t=>t.getById(od(t)),eT=t=>t.getById(sd(t)),tT=t=>t.getById(hy(t));function nT(t,e){const{state:n,send:r,context:i,prop:o,scope:s}=t,a=o("aria-label"),l=n.matches("open");return{open:l,setOpen(u){u!==l&&r({type:u?"OPEN":"CLOSE"})},getTriggerProps(){return e.button({...Rr.trigger.attrs,dir:o("dir"),id:py(s),"aria-haspopup":"dialog",type:"button","aria-expanded":l,"data-state":l?"open":"closed","aria-controls":id(s),onClick(u){u.defaultPrevented||r({type:"TOGGLE"})}})},getBackdropProps(){return e.element({...Rr.backdrop.attrs,dir:o("dir"),hidden:!l,id:dy(s),"data-state":l?"open":"closed"})},getPositionerProps(){return e.element({...Rr.positioner.attrs,dir:o("dir"),id:cy(s),style:{pointerEvents:l?void 0:"none"}})},getContentProps(){const u=i.get("rendered");return e.element({...Rr.content.attrs,dir:o("dir"),role:o("role"),hidden:!l,id:id(s),tabIndex:-1,"data-state":l?"open":"closed","aria-modal":!0,"aria-label":a||void 0,"aria-labelledby":a||!u.title?void 0:od(s),"aria-describedby":u.description?sd(s):void 0})},getTitleProps(){return e.element({...Rr.title.attrs,dir:o("dir"),id:od(s)})},getDescriptionProps(){return e.element({...Rr.description.attrs,dir:o("dir"),id:sd(s)})},getCloseTriggerProps(){return e.button({...Rr.closeTrigger.attrs,dir:o("dir"),id:hy(s),type:"button",onClick(u){u.defaultPrevented||(u.stopPropagation(),r({type:"CLOSE"}))}})}}}var rT={props({props:t,scope:e}){const n=t.role==="alertdialog";return{role:"dialog",modal:!0,trapFocus:!0,preventScroll:!0,closeOnInteractOutside:!n,closeOnEscape:!0,restoreFocus:!0,initialFocusEl:n?()=>tT(e):void 0,...t}},initialState({prop:t}){return t("open")||t("defaultOpen")?"open":"closed"},context({bindable:t}){return{rendered:t(()=>({defaultValue:{title:!0,description:!0}}))}},watch({track:t,action:e,prop:n}){t([()=>n("open")],()=>{e(["toggleVisibility"])})},states:{open:{entry:["checkRenderedElements","syncZIndex"],effects:["trackDismissableElement","trapFocus","preventScroll","hideContentBelow"],on:{"CONTROLLED.CLOSE":{target:"closed"},CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}]}},closed:{on:{"CONTROLLED.OPEN":{target:"open"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}]}}},implementations:{guards:{isOpenControlled:({prop:t})=>t("open")!=null},effects:{trackDismissableElement({scope:t,send:e,prop:n}){return VS(()=>na(t),{defer:!0,pointerBlocking:n("modal"),exclude:[ZS(t)],onInteractOutside(r){var i;(i=n("onInteractOutside"))==null||i(r),n("closeOnInteractOutside")||r.preventDefault()},persistentElements:n("persistentElements"),onFocusOutside:n("onFocusOutside"),onPointerDownOutside:n("onPointerDownOutside"),onEscapeKeyDown(r){var i;(i=n("onEscapeKeyDown"))==null||i(r),n("closeOnEscape")||r.preventDefault()},onDismiss(){e({type:"CLOSE",src:"interact-outside"})}})},preventScroll({scope:t,prop:e}){if(e("preventScroll"))return GS(t.getDoc())},trapFocus({scope:t,prop:e}){return!e("trapFocus")||!e("modal")?void 0:WS(()=>na(t),{preventScroll:!0,returnFocusOnDeactivate:!!e("restoreFocus"),initialFocus:e("initialFocusEl"),setReturnFocus:n=>{var r;return((r=e("finalFocusEl"))==null?void 0:r())??n}})},hideContentBelow({scope:t,prop:e}){return e("modal")?TS(()=>[na(t)],{defer:!0}):void 0}},actions:{checkRenderedElements({context:t,scope:e}){At(()=>{t.set("rendered",{title:!!QS(e),description:!!eT(e)})})},syncZIndex({scope:t}){At(()=>{const e=na(t);if(!e)return;const n=ex(e);[XS(t),YS(t)].forEach(r=>{r?.style.setProperty("--z-index",n.zIndex)})})},invokeOnClose({prop:t}){var e;(e=t("onOpenChange"))==null||e({open:!1})},invokeOnOpen({prop:t}){var e;(e=t("onOpenChange"))==null||e({open:!0})},toggleVisibility({prop:t,send:e,event:n}){e({type:t("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:n})}}}};Wn()(["aria-label","closeOnEscape","closeOnInteractOutside","dir","finalFocusEl","getRootNode","getRootNode","id","id","ids","initialFocusEl","modal","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenChange","onPointerDownOutside","defaultOpen","open","persistentElements","preventScroll","restoreFocus","role","trapFocus"]);const iT=["data-id"],oT=["data-id"],sT=["data-id"],aT=Q({__name:"Dialog",props:{title:{},subtitle:{},role:{default:"dialog"},closeOnEsc:{type:Boolean,default:!0},closeOnOutsideClick:{type:Boolean,default:!0},alignment:{default:"top"},triggerLabel:{},showCloseTrigger:{type:Boolean,default:!0},dialogId:{},teleport:{type:Boolean,default:!0},disabled:{type:Boolean},variant:{},thumbnail:{},thumbnailOptions:{}},emits:["open","close","clickoutside"],setup(t,{expose:e,emit:n}){const r=t,i=n,o=nu(),s=pi(rT,{id:Qt({prefix:"dialog"}),closeOnEscape:r.closeOnEsc,modal:!0,closeOnInteractOutside:r.closeOnOutsideClick,onOpenChange(){if(!a.value.open)return i("open");i("close")},onPointerDownOutside(){i("clickoutside")},getRootNode:()=>{var u;return r.teleport?document:(u=o.value)==null?void 0:u.getRootNode()},...r}),a=D(()=>nT(s,di)),l=u=>r.dialogId?`${r.dialogId}-${u}`:"";return e({open:()=>{a.value.setOpen(!0)},close:()=>{a.value.setOpen(!1)}}),(u,c)=>(E(),O("div",{class:"k-dialog","data-id":u.dialogId},[P(u.$slots,"trigger",{triggerProps:a.value.getTriggerProps()},()=>[u.triggerLabel?(E(),$(ze,ne({key:0,class:"k-dialog__trigger",variant:"secondary"},a.value.getTriggerProps(),{disabled:u.disabled}),{default:Z(()=>[$e(se(u.triggerLabel),1)]),_:1},16,["disabled"])):I("",!0)]),(E(),$(Fg,{to:"body",disabled:!u.teleport},[a.value.open?(E(),O(Ie,{key:0},[H("div",ne({class:"k-dialog__backdrop"},a.value.getBackdropProps(),{"data-id":l("backdrop")}),null,16,oT),H("div",ne({class:`k-dialog__container k-dialog--align-${u.alignment}`},a.value.getPositionerProps(),{"data-id":l("container")}),[he(RE,ne({class:"k-dialog__card",variant:u.variant,appearance:"shadow"},a.value.getContentProps(),{"data-id":l("dialog"),thumbnail:u.thumbnail,thumbnailOptions:u.thumbnailOptions}),Cs({_:2},[u.$slots.header||u.$slots.title||u.$slots.subtitle||u.title||u.subtitle||u.showCloseTrigger?{name:"header",fn:Z(()=>[P(u.$slots,"header",{titleProps:a.value.getTitleProps(),descriptionProps:a.value.getDescriptionProps(),closeTriggerProps:a.value.getCloseTriggerProps()},()=>[P(u.$slots,"title",{titleProps:a.value.getTitleProps()},()=>[u.title?(E(),O("div",ne({key:0,class:"k-dialog__title k-card__title"},a.value.getTitleProps()),se(u.title),17)):I("",!0)]),P(u.$slots,"subtitle",{descriptionProps:a.value.getDescriptionProps()},()=>[u.subtitle?(E(),O("div",ne({key:0,class:"k-dialog__subtitle k-card__subtitle"},a.value.getDescriptionProps()),se(u.subtitle),17)):I("",!0)]),u.showCloseTrigger?(E(),$(ze,ne({key:0,class:"k-dialog__close-trigger",variant:"tertiary",icon:"fa-pro-light:times",size:"small"},a.value.getCloseTriggerProps()),null,16)):I("",!0)])]),key:"0"}:void 0,u.$slots.default?{name:"default",fn:Z(()=>[P(u.$slots,"default",{descriptionProps:a.value.getDescriptionProps()})]),key:"1"}:void 0,u.$slots.actions?{name:"actions",fn:Z(()=>[P(u.$slots,"actions",{close:()=>a.value.setOpen(!1)})]),key:"2"}:void 0]),1040,["variant","data-id","thumbnail","thumbnailOptions"])],16,sT)],64)):I("",!0)],8,["disabled"]))],8,iT))}});function fu(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function mu(){this._types=Object.create(null),this._extensions=Object.create(null);for(let t=0;t<arguments.length;t++)this.define(arguments[t]);this.define=this.define.bind(this),this.getType=this.getType.bind(this),this.getExtension=this.getExtension.bind(this)}mu.prototype.define=function(t,e){for(let n in t){let r=t[n].map(function(i){return i.toLowerCase()});n=n.toLowerCase();for(let i=0;i<r.length;i++){const o=r[i];if(o[0]!=="*"){if(!e&&o in this._types)throw new Error('Attempt to change mapping for "'+o+'" extension from "'+this._types[o]+'" to "'+n+'". Pass `force=true` to allow this, otherwise remove "'+o+'" from the list of extensions for "'+n+'".');this._types[o]=n}}if(e||!this._extensions[n]){const i=r[0];this._extensions[n]=i[0]!=="*"?i:i.substr(1)}}};mu.prototype.getType=function(t){t=String(t);let e=t.replace(/^.*[/\\]/,"").toLowerCase(),n=e.replace(/^.*\./,"").toLowerCase(),r=e.length<t.length;return(n.length<e.length-1||!r)&&this._types[n]||null};mu.prototype.getExtension=function(t){return t=/^\s*([^;\s]*)/.test(t)&&RegExp.$1,t&&this._extensions[t.toLowerCase()]||null};var lT=mu,uT={"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["es","ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avif":["avif"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]};let cT=lT;var dT=new cT(uT);const Dp=fu(dT);function Np(t){let e=["Bytes","KB","MB","GB","TB"];if(t==0)return"0 Byte";let n=Math.floor(Math.log(t)/Math.log(1024));return n>e.length&&(n=e.length),Math.round(t/Math.pow(1024,n))+" "+e[n]}function Cf(t){return JSON.parse(JSON.stringify(t))}function Ip(t,e,n={fromDirectory:!1}){const{fromDirectory:r}=n;return e==="directory"&&(r||!t.type)?!0:!t.type&&!e?!1:e?(Array.isArray(e)?e:e.split(",")).map(i=>i.trim()).some(i=>i.startsWith(".")?Dp.getType(i.substring(1))===t.type:i.includes("*")?t.type.startsWith(i.replace("*","")):t.type===i):!0}const Sf={counter:0,total:0,progress:0,bytes:0,result:[]};class fy{constructor(e){Yt(this,"queue"),Yt(this,"upload"),Yt(this,"uploadOptions"),Yt(this,"accept"),this.queue=sp(Cf(Sf)),this.upload=e.upload,this.uploadOptions=e.uploadOptions,this.accept=e.accept,this.reset=this.reset.bind(this),this.run=this.run.bind(this)}reset(){this.queue=Object.assign(this.queue,Cf(Sf))}async run(e){e=Array.from(e).filter(o=>Ip(o,this.accept,this.uploadOptions)),this.queue.total=e.length,this.queue.counter=0,this.queue.bytes=e.reduce((o,s)=>o+=s?.size||0,0);let n=e.map(()=>0);const r=await Promise.all(e.map((o,s)=>this.upload(o,a=>{n[s]=a,this.queue.progress=n.reduce((l,u)=>l+=u,0)/n.length},this.uploadOptions).then(a=>(this.queue.counter++,a))));if(!r||!r.length)return;let i=r.flat();return this.reset(),i}}const Tf={"image/*":["jpeg","png","gif"]};function pT(t){return t?(Array.isArray(t)?t:t.split(",")).map(e=>e.trim()).map(e=>e.startsWith(".")?e.substring(1):e in Tf?Tf[e]:Dp.getExtension(e)).flat():[]}function ad(t){let e=(n,r)=>{const i=document.createElement("a");i.href=n,i.setAttribute("style","display: none"),r&&(i.target=r),t.name&&(i.download=t.name.includes(".")?t.name:[t.name,Dp.getExtension(t.type)].join(".")),document.body.appendChild(i),i.click(),document.body.removeChild(i)};return fetch(t.url,{headers:{"Cache-Control":"no-cache"}}).then(n=>n.blob()).then(n=>{const r=URL.createObjectURL(n);return e(r)}).catch(n=>e(t.url,"_blank"))}const hT={class:"k-media-thumbnail-actions"},my=Q({__name:"ThumbnailActions",props:{value:{},disabled:{type:Boolean}},emits:["delete"],setup(t,{emit:e}){const n=t,r=D(()=>n.value.type.startsWith("image/")?{component:"button",bind:{onClick:()=>{ad(n.value)}}}:{component:"a",bind:{href:n.value.url,download:n.value.name,target:"_blank"}});return(i,o)=>(E(),O("div",hT,[i.disabled?I("",!0):(E(),$(ze,{key:0,class:"k-media-thumbnail-actions__delete",icon:"fa-pro-solid:trash",variant:"danger",onClick:o[0]||(o[0]=Ba(s=>i.$emit("delete"),["stop"]))})),he(ze,ne({variant:"primary",is:r.value.component,class:"k-media-thumbnail-actions__download"},r.value.bind,{icon:"fa-pro-solid:arrow-alt-circle-down"}),null,16,["is"])]))}}),fT=Q({__name:"Thumbnail",props:{value:{},size:{default:"4rem"},disabled:{type:Boolean}},setup(t){const e=t,n=Lg(),r=D(()=>n["data-draggable"]),i=D(()=>{let s={};for(const a in n){if(a==="data-draggable")return;s[a]=n[a]}return s}),o=D(()=>({width:e.size,height:e.size}));return(s,a)=>(E(),O("div",ne({class:"k-media-thumbnail"},r.value,{class:{"k-media-thumbnail--selected":s.value.selected}}),[(E(),$(Qe(s.value.typeConfig.components.Thumbnail),ne({class:[{"k-media-thumbnail__item--selected":s.value.selected},"k-media-thumbnail__item"],value:s.value},i.value,{style:o.value}),null,16,["class","value","style"])),he(my,{value:s.value,disabled:s.disabled,onDelete:a[0]||(a[0]=l=>s.$emit("delete",s.value))},null,8,["value","disabled"])],16))}}),mT={key:0,class:"k-media-type-selector"},gT={class:"k-media-type-selector__info"},vT=Q({__name:"TypeSelector",props:{value:{},upload:{type:Function},labels:{}},emits:["add","cancel","success","openFileWindow"],setup(t,{emit:e}){const n=t,r=e,i=X(null),o=X(),s=X(!0),a=X(!1),l=X(),u=X();Ee(a,g=>{var y,b;return g?(y=l.value)==null?void 0:y.open():(b=l.value)==null?void 0:b.close()},{immediate:!0});const c=D(()=>n.value.length===1&&n.value[0].name==="Image");function d(){s.value&&(o.value=u.value.prepareData().then(g=>{r("add",g)}))}function h(g){if(g.name==="Image")return r("openFileWindow");a.value=!0,i.value=g}function p(){a.value=!1,r("cancel")}function f(){a.value=!1,r("success")}function m(g){const y=n.labels[g];return!y||typeof y=="string"?g:y.createLabel||g}return(g,y)=>c.value?I("",!0):(E(),O("div",mT,[H("span",gT,se(g.labels.selectMessage),1),he(pu,{teleport:!0,label:g.labels.select,iconRight:"fa6-solid:plus",theme:"shadow",placement:"bottom-end"},{default:Z(()=>[(E(!0),O(Ie,null,_t(g.value,b=>(E(),$(Qe(b.components.CreateTrigger),{key:b.name,label:m(b.name.toLowerCase()),onClick:k=>h(b)},null,8,["label","onClick"]))),128))]),_:1},8,["label"]),he(aT,{dialogId:"k-media-type-selector",ref_key:"dialog",ref:l,title:"",teleport:!0,"close-on-outside-click":!1,"show-close-trigger":!1,"close-on-esc":!0,onClose:p},{default:Z(()=>[i.value?(E(),$(Qe(i.value.components.Create),ne({key:0,isValid:s.value,"onUpdate:isValid":y[0]||(y[0]=b=>s.value=b),upload:g.upload,labels:g.labels,name:i.value.name,ref_key:"creator",ref:u},g.$attrs),null,16,["isValid","upload","labels","name"])):I("",!0)]),footer:Z(()=>[he(ze,{label:g.labels.cancel,type:"button",onClick:p},null,8,["label"]),he(ze,{variant:"primary",disabled:!s.value,promise:o.value,label:g.labels.save,stateTimeout:1e3,onClick:d,onSuccess:f},null,8,["disabled","promise","label"])]),_:1},512)]))}}),yT=Q({__name:"Description",props:{modelValue:{},placeholder:{}},emits:["update:modelValue"],setup(t,{emit:e}){return(n,r)=>(E(),$(mE,{class:"k-media-description",type:"text",placeholder:n.placeholder,modelValue:n.modelValue||"","onUpdate:modelValue":r[0]||(r[0]=i=>n.$emit("update:modelValue",i))},null,8,["placeholder","modelValue"]))}}),bT={class:"k-media-uploader"},kT={class:"k-media-uploader__bar"},wT={class:"k-media-uploader__meta"},xT={key:0},ET={key:1},CT=Q({__name:"Uploader",props:{value:{},bytes:{},current:{default:1},total:{default:1}},setup(t){const e=t,n=D(()=>e.total>1),r=D(()=>Np(e.bytes)),i=D(()=>Math.floor(e.value));return(o,s)=>(E(),O("div",bT,[H("div",null,se(i.value)+" %",1),H("div",kT,[H("div",{class:"k-media-uploader__bar-value",style:Cr({width:o.value+"%"})},null,4)]),H("div",wT,[n.value?(E(),O("div",xT,se(o.current)+" / "+se(o.total),1)):I("",!0),o.bytes?(E(),O("div",ET,"("+se(r.value)+")",1)):I("",!0)])]))}}),ST=["innerHTML"],TT=Q({__name:"SlotHandler",props:{value:{}},setup(t){const e=t,n=D(()=>typeof e.value=="string"?e.value:void 0),r=D(()=>typeof e.value=="string"?"div":e.value);return(i,o)=>(E(),$(Qe(r.value),be(Ne(i.$attrs)),{default:Z(()=>[n.value?(E(),O("span",{key:0,innerHTML:n.value},null,8,ST)):I("",!0)]),_:1},16))}}),OT={class:"k-media-droparea__instruction"},AT=["type","accept","required","disabled","multiple"],MT=Q({__name:"DropArea",props:{value:{},multiple:{type:Boolean},upload:{},uploadOptions:{},type:{},accept:{},selected:{default:null},dropMessage:{},disabled:{type:Boolean},required:{type:Boolean}},emits:["input","select","remove"],setup(t,{emit:e}){const n=t,r=e,i=X(!1),o=X(!0),s=X(),a=D(()=>!!(!n.required||n.value)),l=D(()=>n.disabled),u=D(()=>!l.value&&!d.total),{run:c,queue:d}=new fy(n);function h(k){return c(k).then(v=>{!v||!v.length||(r("input",n.multiple?[...n.value||[],...v]:v[0]),(!n.selected||!n.multiple)&&kr(()=>r("select")))})}function p(k){l.value||(h(k.target.files||[]),s.value&&(s.value.value=""))}function f(k){var v;if(l.value||!s.value)return;if(k.preventDefault(),!o.value)return g();g();const w=(v=k.dataTransfer)==null?void 0:v.files;w!=null&&w.length&&(s.value.files=w,s.value.dispatchEvent(new InputEvent("input")),h(w))}function m(k){l.value||k.dataTransfer&&(o.value=Array.from(k.dataTransfer.items).every(v=>Ip(v,n.accept))&&n.multiple?!0:k.dataTransfer.items.length===1,i.value=!0,k.preventDefault())}function g(){o.value=!0,i.value=!1}const y=rn("k-media-droparea",{variants:{active:{true:"k-media-droparea--active"},invalid:{true:"k-media-droparea--invalid"},selected:{true:"k-media-droparea--selected"},disabled:{true:"k-media-droparea--disabled"}}}),b=()=>{var k;return(k=s.value)==null?void 0:k.click()};return(k,v)=>(E(),O(Ie,null,[H("div",{class:Ce(B(y)({active:i.value,invalid:!o.value,selected:!!k.selected,disabled:l.value})),onDrop:f,onDragover:m,onDragleave:g},[P(k.$slots,"preview"),H("div",OT,[u.value?(E(),O("input",{key:0,type:k.type,accept:Array.isArray(k.accept)?k.accept.join(","):k.accept,required:a.value,ref_key:"input",ref:s,onChange:p,disabled:!u.value,multiple:k.multiple,class:"k-media-droparea__input"},null,40,AT)):I("",!0),o.value?(E(),O(Ie,{key:1},[P(k.$slots,"drop-message",{},()=>[he(TT,{value:k.dropMessage},null,8,["value"])]),P(k.$slots,"default",{openFileWindow:b})],64)):(E(),$(B(Ze),{key:2,icon:"fa-pro-light:ban",style:{"font-size":"2rem"}})),P(k.$slots,"custom-message")]),!k.multiple&&k.selected?(E(),$(my,{key:0,value:k.selected,disabled:l.value,onDelete:v[0]||(v[0]=w=>k.$emit("remove",k.selected))},null,8,["value","disabled"])):I("",!0)],34),B(d).total?(E(),$(CT,{key:0,value:B(d).progress,bytes:B(d).bytes,current:B(d).counter,total:B(d).total},null,8,["value","bytes","current","total"])):I("",!0)],64))}}),_T=Q({__name:"CreateTrigger",props:{label:{}},setup(t){return(e,n)=>(E(),$(ze,{type:"button",label:e.label,iconRight:"fa6-solid:image",size:"small",variant:"tertiary"},null,8,["label"]))}}),DT=Q({__name:"Thumbnail",props:{value:{}},setup(t){const e=t;return(n,r)=>(E(),$(au,{class:"k-media-image__thumbnail",src:e.value.url,onClick:r[0]||(r[0]=i=>n.$emit("click"))},null,8,["src"]))}}),NT=Q({__name:"Preview",props:{value:{},size:{}},setup(t){const e=t;return(n,r)=>(E(),$(au,{src:e.value.url,class:"k-media-image-preview",size:n.size,width:"100%",height:"100%"},null,8,["src","size"]))}}),IT={name:"Image",condition:t=>/^image\/.+/i.test(t.type),components:{CreateTrigger:ka(_T),Thumbnail:ka(DT),Preview:ka(NT)}},RT={Image:IT};/**!
4
4
  * Sortable 1.14.0
5
5
  * @author RubaXa <trash@rubaxa.org>
6
6
  * @author owenm <owen23355@gmail.com>
7
7
  * @license MIT
8
- */function Tf(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function kn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Tf(Object(n),!0).forEach(function(r){RT(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Tf(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ta(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ta=function(e){return typeof e}:Ta=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ta(t)}function RT(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function jn(){return jn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},jn.apply(this,arguments)}function PT(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function FT(t,e){if(t==null)return{};var n=PT(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}var LT="1.14.0";function Vn(t){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(t)}var Un=Vn(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Ms=Vn(/Edge/i),Of=Vn(/firefox/i),Vo=Vn(/safari/i)&&!Vn(/chrome/i)&&!Vn(/android/i),gy=Vn(/iP(ad|od|hone)/i),VT=Vn(/chrome/i)&&Vn(/android/i),vy={capture:!1,passive:!1};function ve(t,e,n){t.addEventListener(e,n,!Un&&vy)}function me(t,e,n){t.removeEventListener(e,n,!Un&&vy)}function Ya(t,e){if(e){if(e[0]===">"&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch{return!1}return!1}}function BT(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function pn(t,e,n,r){if(t){n=n||document;do{if(e!=null&&(e[0]===">"?t.parentNode===n&&Ya(t,e):Ya(t,e))||r&&t===n)return t;if(t===n)break}while(t=BT(t))}return null}var Af=/\s+/g;function Et(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var r=(" "+t.className+" ").replace(Af," ").replace(" "+e+" "," ");t.className=(r+(n?" "+e:"")).replace(Af," ")}}function Q(t,e,n){var r=t&&t.style;if(r){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),e===void 0?n:n[e];!(e in r)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),r[e]=n+(typeof n=="string"?"":"px")}}function Vi(t,e){var n="";if(typeof t=="string")n=t;else do{var r=Q(t,"transform");r&&r!=="none"&&(n=r+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function yy(t,e,n){if(t){var r=t.getElementsByTagName(e),i=0,o=r.length;if(n)for(;i<o;i++)n(r[i],i);return r}return[]}function vn(){var t=document.scrollingElement;return t||document.documentElement}function Be(t,e,n,r,i){if(!(!t.getBoundingClientRect&&t!==window)){var o,s,a,l,u,c,d;if(t!==window&&t.parentNode&&t!==vn()?(o=t.getBoundingClientRect(),s=o.top,a=o.left,l=o.bottom,u=o.right,c=o.height,d=o.width):(s=0,a=0,l=window.innerHeight,u=window.innerWidth,c=window.innerHeight,d=window.innerWidth),(e||n)&&t!==window&&(i=i||t.parentNode,!Un))do if(i&&i.getBoundingClientRect&&(Q(i,"transform")!=="none"||n&&Q(i,"position")!=="static")){var h=i.getBoundingClientRect();s-=h.top+parseInt(Q(i,"border-top-width")),a-=h.left+parseInt(Q(i,"border-left-width")),l=s+o.height,u=a+o.width;break}while(i=i.parentNode);if(r&&t!==window){var p=Vi(i||t),f=p&&p.a,m=p&&p.d;p&&(s/=m,a/=f,d/=f,c/=m,l=s+c,u=a+d)}return{top:s,left:a,bottom:l,right:u,width:d,height:c}}}function Mf(t,e,n){for(var r=sr(t,!0),i=Be(t)[e];r;){var o=Be(r)[n],s=void 0;if(s=i>=o,!s)return r;if(r===vn())break;r=sr(r,!1)}return!1}function Ki(t,e,n,r){for(var i=0,o=0,s=t.children;o<s.length;){if(s[o].style.display!=="none"&&s[o]!==ee.ghost&&(r||s[o]!==ee.dragged)&&pn(s[o],n.draggable,t,!1)){if(i===e)return s[o];i++}o++}return null}function Ip(t,e){for(var n=t.lastElementChild;n&&(n===ee.ghost||Q(n,"display")==="none"||e&&!Ya(n,e));)n=n.previousElementSibling;return n||null}function Lt(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)t.nodeName.toUpperCase()!=="TEMPLATE"&&t!==ee.clone&&(!e||Ya(t,e))&&n++;return n}function _f(t){var e=0,n=0,r=vn();if(t)do{var i=Vi(t),o=i.a,s=i.d;e+=t.scrollLeft*o,n+=t.scrollTop*s}while(t!==r&&(t=t.parentNode));return[e,n]}function $T(t,e){for(var n in t)if(t.hasOwnProperty(n)){for(var r in e)if(e.hasOwnProperty(r)&&e[r]===t[n][r])return Number(n)}return-1}function sr(t,e){if(!t||!t.getBoundingClientRect)return vn();var n=t,r=!1;do if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=Q(n);if(n.clientWidth<n.scrollWidth&&(i.overflowX=="auto"||i.overflowX=="scroll")||n.clientHeight<n.scrollHeight&&(i.overflowY=="auto"||i.overflowY=="scroll")){if(!n.getBoundingClientRect||n===document.body)return vn();if(r||e)return n;r=!0}}while(n=n.parentNode);return vn()}function jT(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function Uu(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}var Bo;function by(t,e){return function(){if(!Bo){var n=arguments,r=this;n.length===1?t.call(r,n[0]):t.apply(r,n),Bo=setTimeout(function(){Bo=void 0},e)}}}function zT(){clearTimeout(Bo),Bo=void 0}function ky(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function wy(t){var e=window.Polymer,n=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):n?n(t).clone(!0)[0]:t.cloneNode(!0)}var Tt="Sortable"+new Date().getTime();function HT(){var t=[],e;return{captureAnimationState:function(){if(t=[],!!this.options.animation){var n=[].slice.call(this.el.children);n.forEach(function(r){if(!(Q(r,"display")==="none"||r===ee.ghost)){t.push({target:r,rect:Be(r)});var i=kn({},t[t.length-1].rect);if(r.thisAnimationDuration){var o=Vi(r,!0);o&&(i.top-=o.f,i.left-=o.e)}r.fromRect=i}})}},addAnimationState:function(n){t.push(n)},removeAnimationState:function(n){t.splice($T(t,{target:n}),1)},animateAll:function(n){var r=this;if(!this.options.animation){clearTimeout(e),typeof n=="function"&&n();return}var i=!1,o=0;t.forEach(function(s){var a=0,l=s.target,u=l.fromRect,c=Be(l),d=l.prevFromRect,h=l.prevToRect,p=s.rect,f=Vi(l,!0);f&&(c.top-=f.f,c.left-=f.e),l.toRect=c,l.thisAnimationDuration&&Uu(d,c)&&!Uu(u,c)&&(p.top-c.top)/(p.left-c.left)===(u.top-c.top)/(u.left-c.left)&&(a=WT(p,d,h,r.options)),Uu(c,u)||(l.prevFromRect=u,l.prevToRect=c,a||(a=r.options.animation),r.animate(l,p,c,a)),a&&(i=!0,o=Math.max(o,a),clearTimeout(l.animationResetTimer),l.animationResetTimer=setTimeout(function(){l.animationTime=0,l.prevFromRect=null,l.fromRect=null,l.prevToRect=null,l.thisAnimationDuration=null},a),l.thisAnimationDuration=a)}),clearTimeout(e),i?e=setTimeout(function(){typeof n=="function"&&n()},o):typeof n=="function"&&n(),t=[]},animate:function(n,r,i,o){if(o){Q(n,"transition",""),Q(n,"transform","");var s=Vi(this.el),a=s&&s.a,l=s&&s.d,u=(r.left-i.left)/(a||1),c=(r.top-i.top)/(l||1);n.animatingX=!!u,n.animatingY=!!c,Q(n,"transform","translate3d("+u+"px,"+c+"px,0)"),this.forRepaintDummy=qT(n),Q(n,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),Q(n,"transform","translate3d(0,0,0)"),typeof n.animated=="number"&&clearTimeout(n.animated),n.animated=setTimeout(function(){Q(n,"transition",""),Q(n,"transform",""),n.animated=!1,n.animatingX=!1,n.animatingY=!1},o)}}}}function qT(t){return t.offsetWidth}function WT(t,e,n,r){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-n.top,2)+Math.pow(e.left-n.left,2))*r.animation}var xi=[],Ku={initializeByDefault:!0},_s={mount:function(t){for(var e in Ku)Ku.hasOwnProperty(e)&&!(e in t)&&(t[e]=Ku[e]);xi.forEach(function(n){if(n.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}),xi.push(t)},pluginEvent:function(t,e,n){var r=this;this.eventCanceled=!1,n.cancel=function(){r.eventCanceled=!0};var i=t+"Global";xi.forEach(function(o){e[o.pluginName]&&(e[o.pluginName][i]&&e[o.pluginName][i](kn({sortable:e},n)),e.options[o.pluginName]&&e[o.pluginName][t]&&e[o.pluginName][t](kn({sortable:e},n)))})},initializePlugins:function(t,e,n,r){xi.forEach(function(s){var a=s.pluginName;if(!(!t.options[a]&&!s.initializeByDefault)){var l=new s(t,e,t.options);l.sortable=t,l.options=t.options,t[a]=l,jn(n,l.defaults)}});for(var i in t.options)if(t.options.hasOwnProperty(i)){var o=this.modifyOption(t,i,t.options[i]);typeof o<"u"&&(t.options[i]=o)}},getEventProperties:function(t,e){var n={};return xi.forEach(function(r){typeof r.eventProperties=="function"&&jn(n,r.eventProperties.call(e[r.pluginName],t))}),n},modifyOption:function(t,e,n){var r;return xi.forEach(function(i){t[i.pluginName]&&i.optionListeners&&typeof i.optionListeners[e]=="function"&&(r=i.optionListeners[e].call(t[i.pluginName],n))}),r}};function UT(t){var e=t.sortable,n=t.rootEl,r=t.name,i=t.targetEl,o=t.cloneEl,s=t.toEl,a=t.fromEl,l=t.oldIndex,u=t.newIndex,c=t.oldDraggableIndex,d=t.newDraggableIndex,h=t.originalEvent,p=t.putSortable,f=t.extraEventProperties;if(e=e||n&&n[Tt],!!e){var m,g=e.options,y="on"+r.charAt(0).toUpperCase()+r.substr(1);window.CustomEvent&&!Un&&!Ms?m=new CustomEvent(r,{bubbles:!0,cancelable:!0}):(m=document.createEvent("Event"),m.initEvent(r,!0,!0)),m.to=s||n,m.from=a||n,m.item=i||n,m.clone=o,m.oldIndex=l,m.newIndex=u,m.oldDraggableIndex=c,m.newDraggableIndex=d,m.originalEvent=h,m.pullMode=p?p.lastPutMode:void 0;var b=kn(kn({},f),_s.getEventProperties(r,e));for(var k in b)m[k]=b[k];n&&n.dispatchEvent(m),g[y]&&g[y].call(e,m)}}var KT=["evt"],gt=function(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.evt,i=FT(n,KT);_s.pluginEvent.bind(ee)(t,e,kn({dragEl:R,parentEl:Ae,ghostEl:ae,rootEl:xe,nextEl:$r,lastDownEl:Oa,cloneEl:Me,cloneHidden:rr,dragStarted:Ao,putSortable:Ge,activeSortable:ee.active,originalEvent:r,oldIndex:Ii,oldDraggableIndex:$o,newIndex:Ct,newDraggableIndex:Qn,hideGhostForTarget:Sy,unhideGhostForTarget:Ty,cloneNowHidden:function(){rr=!0},cloneNowShown:function(){rr=!1},dispatchSortableEvent:function(o){ut({sortable:e,name:o,originalEvent:r})}},i))};function ut(t){UT(kn({putSortable:Ge,cloneEl:Me,targetEl:R,rootEl:xe,oldIndex:Ii,oldDraggableIndex:$o,newIndex:Ct,newDraggableIndex:Qn},t))}var R,Ae,ae,xe,$r,Oa,Me,rr,Ii,Ct,$o,Qn,ra,Ge,Ti=!1,Za=!1,Qa=[],Pr,Gt,Gu,Ju,Df,Nf,Ao,Ei,jo,zo=!1,ia=!1,Aa,tt,Xu=[],ad=!1,el=[],mu=typeof document<"u",oa=gy,If=Ms||Un?"cssFloat":"float",GT=mu&&!VT&&!gy&&"draggable"in document.createElement("div"),xy=function(){if(mu){if(Un)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),Ey=function(t,e){var n=Q(t),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=Ki(t,0,e),o=Ki(t,1,e),s=i&&Q(i),a=o&&Q(o),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Be(i).width,u=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Be(o).width;if(n.display==="flex")return n.flexDirection==="column"||n.flexDirection==="column-reverse"?"vertical":"horizontal";if(n.display==="grid")return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&s.float&&s.float!=="none"){var c=s.float==="left"?"left":"right";return o&&(a.clear==="both"||a.clear===c)?"vertical":"horizontal"}return i&&(s.display==="block"||s.display==="flex"||s.display==="table"||s.display==="grid"||l>=r&&n[If]==="none"||o&&n[If]==="none"&&l+u>r)?"vertical":"horizontal"},JT=function(t,e,n){var r=n?t.left:t.top,i=n?t.right:t.bottom,o=n?t.width:t.height,s=n?e.left:e.top,a=n?e.right:e.bottom,l=n?e.width:e.height;return r===s||i===a||r+o/2===s+l/2},XT=function(t,e){var n;return Qa.some(function(r){var i=r[Tt].options.emptyInsertThreshold;if(!(!i||Ip(r))){var o=Be(r),s=t>=o.left-i&&t<=o.right+i,a=e>=o.top-i&&e<=o.bottom+i;if(s&&a)return n=r}}),n},Cy=function(t){function e(i,o){return function(s,a,l,u){var c=s.options.group.name&&a.options.group.name&&s.options.group.name===a.options.group.name;if(i==null&&(o||c))return!0;if(i==null||i===!1)return!1;if(o&&i==="clone")return i;if(typeof i=="function")return e(i(s,a,l,u),o)(s,a,l,u);var d=(o?s:a).options.group.name;return i===!0||typeof i=="string"&&i===d||i.join&&i.indexOf(d)>-1}}var n={},r=t.group;(!r||Ta(r)!="object")&&(r={name:r}),n.name=r.name,n.checkPull=e(r.pull,!0),n.checkPut=e(r.put),n.revertClone=r.revertClone,t.group=n},Sy=function(){!xy&&ae&&Q(ae,"display","none")},Ty=function(){!xy&&ae&&Q(ae,"display","")};mu&&document.addEventListener("click",function(t){if(Za)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Za=!1,!1},!0);var Fr=function(t){if(R){t=t.touches?t.touches[0]:t;var e=XT(t.clientX,t.clientY);if(e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[Tt]._onDragOver(n)}}},YT=function(t){R&&R.parentNode[Tt]._isOutsideThisEl(t.target)};function ee(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=jn({},e),t[Tt]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Ey(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(o,s){o.setData("Text",s.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:ee.supportPointer!==!1&&"PointerEvent"in window&&!Vo,emptyInsertThreshold:5};_s.initializePlugins(this,t,n);for(var r in n)!(r in e)&&(e[r]=n[r]);Cy(e);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=e.forceFallback?!1:GT,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?ve(t,"pointerdown",this._onTapStart):(ve(t,"mousedown",this._onTapStart),ve(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(ve(t,"dragover",this),ve(t,"dragenter",this)),Qa.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),jn(this,HT())}ee.prototype={constructor:ee,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(Ei=null)},_getDirection:function(t,e){return typeof this.options.direction=="function"?this.options.direction.call(this,t,e,R):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,r=this.options,i=r.preventOnFilter,o=t.type,s=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,a=(s||t).target,l=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,u=r.filter;if(oO(n),!R&&!(/mousedown|pointerdown/.test(o)&&t.button!==0||r.disabled)&&!l.isContentEditable&&!(!this.nativeDraggable&&Vo&&a&&a.tagName.toUpperCase()==="SELECT")&&(a=pn(a,r.draggable,n,!1),!(a&&a.animated)&&Oa!==a)){if(Ii=Lt(a),$o=Lt(a,r.draggable),typeof u=="function"){if(u.call(this,t,a,this)){ut({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),gt("filter",e,{evt:t}),i&&t.cancelable&&t.preventDefault();return}}else if(u&&(u=u.split(",").some(function(c){if(c=pn(l,c.trim(),n,!1),c)return ut({sortable:e,rootEl:c,name:"filter",targetEl:a,fromEl:n,toEl:n}),gt("filter",e,{evt:t}),!0}),u)){i&&t.cancelable&&t.preventDefault();return}r.handle&&!pn(l,r.handle,n,!1)||this._prepareDragStart(t,s,a)}}},_prepareDragStart:function(t,e,n){var r=this,i=r.el,o=r.options,s=i.ownerDocument,a;if(n&&!R&&n.parentNode===i){var l=Be(n);if(xe=i,R=n,Ae=R.parentNode,$r=R.nextSibling,Oa=n,ra=o.group,ee.dragged=R,Pr={target:R,clientX:(e||t).clientX,clientY:(e||t).clientY},Df=Pr.clientX-l.left,Nf=Pr.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,R.style["will-change"]="all",a=function(){if(gt("delayEnded",r,{evt:t}),ee.eventCanceled){r._onDrop();return}r._disableDelayedDragEvents(),!Of&&r.nativeDraggable&&(R.draggable=!0),r._triggerDragStart(t,e),ut({sortable:r,name:"choose",originalEvent:t}),Et(R,o.chosenClass,!0)},o.ignore.split(",").forEach(function(u){yy(R,u.trim(),Yu)}),ve(s,"dragover",Fr),ve(s,"mousemove",Fr),ve(s,"touchmove",Fr),ve(s,"mouseup",r._onDrop),ve(s,"touchend",r._onDrop),ve(s,"touchcancel",r._onDrop),Of&&this.nativeDraggable&&(this.options.touchStartThreshold=4,R.draggable=!0),gt("delayStart",this,{evt:t}),o.delay&&(!o.delayOnTouchOnly||e)&&(!this.nativeDraggable||!(Ms||Un))){if(ee.eventCanceled){this._onDrop();return}ve(s,"mouseup",r._disableDelayedDrag),ve(s,"touchend",r._disableDelayedDrag),ve(s,"touchcancel",r._disableDelayedDrag),ve(s,"mousemove",r._delayedDragTouchMoveHandler),ve(s,"touchmove",r._delayedDragTouchMoveHandler),o.supportPointer&&ve(s,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(a,o.delay)}else a()}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){R&&Yu(R),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;me(t,"mouseup",this._disableDelayedDrag),me(t,"touchend",this._disableDelayedDrag),me(t,"touchcancel",this._disableDelayedDrag),me(t,"mousemove",this._delayedDragTouchMoveHandler),me(t,"touchmove",this._delayedDragTouchMoveHandler),me(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||t.pointerType=="touch"&&t,!this.nativeDraggable||e?this.options.supportPointer?ve(document,"pointermove",this._onTouchMove):e?ve(document,"touchmove",this._onTouchMove):ve(document,"mousemove",this._onTouchMove):(ve(R,"dragend",this),ve(xe,"dragstart",this._onDragStart));try{document.selection?Ma(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,e){if(Ti=!1,xe&&R){gt("dragStarted",this,{evt:e}),this.nativeDraggable&&ve(document,"dragover",YT);var n=this.options;!t&&Et(R,n.dragClass,!1),Et(R,n.ghostClass,!0),ee.active=this,t&&this._appendGhost(),ut({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(Gt){this._lastX=Gt.clientX,this._lastY=Gt.clientY,Sy();for(var t=document.elementFromPoint(Gt.clientX,Gt.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Gt.clientX,Gt.clientY),t!==e);)e=t;if(R.parentNode[Tt]._isOutsideThisEl(t),e)do{if(e[Tt]){var n=void 0;if(n=e[Tt]._onDragOver({clientX:Gt.clientX,clientY:Gt.clientY,target:t,rootEl:e}),n&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);Ty()}},_onTouchMove:function(t){if(Pr){var e=this.options,n=e.fallbackTolerance,r=e.fallbackOffset,i=t.touches?t.touches[0]:t,o=ae&&Vi(ae,!0),s=ae&&o&&o.a,a=ae&&o&&o.d,l=oa&&tt&&_f(tt),u=(i.clientX-Pr.clientX+r.x)/(s||1)+(l?l[0]-Xu[0]:0)/(s||1),c=(i.clientY-Pr.clientY+r.y)/(a||1)+(l?l[1]-Xu[1]:0)/(a||1);if(!ee.active&&!Ti){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(t,!0)}if(ae){o?(o.e+=u-(Gu||0),o.f+=c-(Ju||0)):o={a:1,b:0,c:0,d:1,e:u,f:c};var d="matrix(".concat(o.a,",").concat(o.b,",").concat(o.c,",").concat(o.d,",").concat(o.e,",").concat(o.f,")");Q(ae,"webkitTransform",d),Q(ae,"mozTransform",d),Q(ae,"msTransform",d),Q(ae,"transform",d),Gu=u,Ju=c,Gt=i}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!ae){var t=this.options.fallbackOnBody?document.body:xe,e=Be(R,!0,oa,!0,t),n=this.options;if(oa){for(tt=t;Q(tt,"position")==="static"&&Q(tt,"transform")==="none"&&tt!==document;)tt=tt.parentNode;tt!==document.body&&tt!==document.documentElement?(tt===document&&(tt=vn()),e.top+=tt.scrollTop,e.left+=tt.scrollLeft):tt=vn(),Xu=_f(tt)}ae=R.cloneNode(!0),Et(ae,n.ghostClass,!1),Et(ae,n.fallbackClass,!0),Et(ae,n.dragClass,!0),Q(ae,"transition",""),Q(ae,"transform",""),Q(ae,"box-sizing","border-box"),Q(ae,"margin",0),Q(ae,"top",e.top),Q(ae,"left",e.left),Q(ae,"width",e.width),Q(ae,"height",e.height),Q(ae,"opacity","0.8"),Q(ae,"position",oa?"absolute":"fixed"),Q(ae,"zIndex","100000"),Q(ae,"pointerEvents","none"),ee.ghost=ae,t.appendChild(ae),Q(ae,"transform-origin",Df/parseInt(ae.style.width)*100+"% "+Nf/parseInt(ae.style.height)*100+"%")}},_onDragStart:function(t,e){var n=this,r=t.dataTransfer,i=n.options;if(gt("dragStart",this,{evt:t}),ee.eventCanceled){this._onDrop();return}gt("setupClone",this),ee.eventCanceled||(Me=wy(R),Me.draggable=!1,Me.style["will-change"]="",this._hideClone(),Et(Me,this.options.chosenClass,!1),ee.clone=Me),n.cloneId=Ma(function(){gt("clone",n),!ee.eventCanceled&&(n.options.removeCloneOnHide||xe.insertBefore(Me,R),n._hideClone(),ut({sortable:n,name:"clone"}))}),!e&&Et(R,i.dragClass,!0),e?(Za=!0,n._loopId=setInterval(n._emulateDragOver,50)):(me(document,"mouseup",n._onDrop),me(document,"touchend",n._onDrop),me(document,"touchcancel",n._onDrop),r&&(r.effectAllowed="move",i.setData&&i.setData.call(n,r,R)),ve(document,"drop",n),Q(R,"transform","translateZ(0)")),Ti=!0,n._dragStartId=Ma(n._dragStarted.bind(n,e,t)),ve(document,"selectstart",n),Ao=!0,Vo&&Q(document.body,"user-select","none")},_onDragOver:function(t){var e=this.el,n=t.target,r,i,o,s=this.options,a=s.group,l=ee.active,u=ra===a,c=s.sort,d=Ge||l,h,p=this,f=!1;if(ad)return;function m(ue,ge){gt(ue,p,kn({evt:t,isOwner:u,axis:h?"vertical":"horizontal",revert:o,dragRect:r,targetRect:i,canSort:c,fromSortable:d,target:n,completed:y,onMove:function(Te,mt){return sa(xe,e,R,r,Te,Be(Te),t,mt)},changed:b},ge))}function g(){m("dragOverAnimationCapture"),p.captureAnimationState(),p!==d&&d.captureAnimationState()}function y(ue){return m("dragOverCompleted",{insertion:ue}),ue&&(u?l._hideClone():l._showClone(p),p!==d&&(Et(R,Ge?Ge.options.ghostClass:l.options.ghostClass,!1),Et(R,s.ghostClass,!0)),Ge!==p&&p!==ee.active?Ge=p:p===ee.active&&Ge&&(Ge=null),d===p&&(p._ignoreWhileAnimating=n),p.animateAll(function(){m("dragOverAnimationComplete"),p._ignoreWhileAnimating=null}),p!==d&&(d.animateAll(),d._ignoreWhileAnimating=null)),(n===R&&!R.animated||n===e&&!n.animated)&&(Ei=null),!s.dragoverBubble&&!t.rootEl&&n!==document&&(R.parentNode[Tt]._isOutsideThisEl(t.target),!ue&&Fr(t)),!s.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function b(){Ct=Lt(R),Qn=Lt(R,s.draggable),ut({sortable:p,name:"change",toEl:e,newIndex:Ct,newDraggableIndex:Qn,originalEvent:t})}if(t.preventDefault!==void 0&&t.cancelable&&t.preventDefault(),n=pn(n,s.draggable,e,!0),m("dragOver"),ee.eventCanceled)return f;if(R.contains(t.target)||n.animated&&n.animatingX&&n.animatingY||p._ignoreWhileAnimating===n)return y(!1);if(Za=!1,l&&!s.disabled&&(u?c||(o=Ae!==xe):Ge===this||(this.lastPutMode=ra.checkPull(this,l,R,t))&&a.checkPut(this,l,R,t))){if(h=this._getDirection(t,n)==="vertical",r=Be(R),m("dragOverValid"),ee.eventCanceled)return f;if(o)return Ae=xe,g(),this._hideClone(),m("revert"),ee.eventCanceled||($r?xe.insertBefore(R,$r):xe.appendChild(R)),y(!0);var k=Ip(e,s.draggable);if(!k||tO(t,h,this)&&!k.animated){if(k===R)return y(!1);if(k&&e===t.target&&(n=k),n&&(i=Be(n)),sa(xe,e,R,r,n,i,t,!!n)!==!1)return g(),e.appendChild(R),Ae=e,b(),y(!0)}else if(k&&eO(t,h,this)){var v=Ki(e,0,s,!0);if(v===R)return y(!1);if(n=v,i=Be(n),sa(xe,e,R,r,n,i,t,!1)!==!1)return g(),e.insertBefore(R,v),Ae=e,b(),y(!0)}else if(n.parentNode===e){i=Be(n);var w=0,x,T=R.parentNode!==e,F=!JT(R.animated&&R.toRect||r,n.animated&&n.toRect||i,h),D=h?"top":"left",C=Mf(n,"top","top")||Mf(R,"top","top"),_=C?C.scrollTop:void 0;Ei!==n&&(x=i[D],zo=!1,ia=!F&&s.invertSwap||T),w=nO(t,n,i,h,F?1:s.swapThreshold,s.invertedSwapThreshold==null?s.swapThreshold:s.invertedSwapThreshold,ia,Ei===n);var L;if(w!==0){var W=Lt(R);do W-=w,L=Ae.children[W];while(L&&(Q(L,"display")==="none"||L===ae))}if(w===0||L===n)return y(!1);Ei=n,jo=w;var q=n.nextElementSibling,K=!1;K=w===1;var J=sa(xe,e,R,r,n,i,t,K);if(J!==!1)return(J===1||J===-1)&&(K=J===1),ad=!0,setTimeout(QT,30),g(),K&&!q?e.appendChild(R):n.parentNode.insertBefore(R,K?q:n),C&&ky(C,0,_-C.scrollTop),Ae=R.parentNode,x!==void 0&&!ia&&(Aa=Math.abs(x-Be(n)[D])),b(),y(!0)}if(e.contains(R))return y(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){me(document,"mousemove",this._onTouchMove),me(document,"touchmove",this._onTouchMove),me(document,"pointermove",this._onTouchMove),me(document,"dragover",Fr),me(document,"mousemove",Fr),me(document,"touchmove",Fr)},_offUpEvents:function(){var t=this.el.ownerDocument;me(t,"mouseup",this._onDrop),me(t,"touchend",this._onDrop),me(t,"pointerup",this._onDrop),me(t,"touchcancel",this._onDrop),me(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;if(Ct=Lt(R),Qn=Lt(R,n.draggable),gt("drop",this,{evt:t}),Ae=R&&R.parentNode,Ct=Lt(R),Qn=Lt(R,n.draggable),ee.eventCanceled){this._nulling();return}Ti=!1,ia=!1,zo=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),ld(this.cloneId),ld(this._dragStartId),this.nativeDraggable&&(me(document,"drop",this),me(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Vo&&Q(document.body,"user-select",""),Q(R,"transform",""),t&&(Ao&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),ae&&ae.parentNode&&ae.parentNode.removeChild(ae),(xe===Ae||Ge&&Ge.lastPutMode!=="clone")&&Me&&Me.parentNode&&Me.parentNode.removeChild(Me),R&&(this.nativeDraggable&&me(R,"dragend",this),Yu(R),R.style["will-change"]="",Ao&&!Ti&&Et(R,Ge?Ge.options.ghostClass:this.options.ghostClass,!1),Et(R,this.options.chosenClass,!1),ut({sortable:this,name:"unchoose",toEl:Ae,newIndex:null,newDraggableIndex:null,originalEvent:t}),xe!==Ae?(Ct>=0&&(ut({rootEl:Ae,name:"add",toEl:Ae,fromEl:xe,originalEvent:t}),ut({sortable:this,name:"remove",toEl:Ae,originalEvent:t}),ut({rootEl:Ae,name:"sort",toEl:Ae,fromEl:xe,originalEvent:t}),ut({sortable:this,name:"sort",toEl:Ae,originalEvent:t})),Ge&&Ge.save()):Ct!==Ii&&Ct>=0&&(ut({sortable:this,name:"update",toEl:Ae,originalEvent:t}),ut({sortable:this,name:"sort",toEl:Ae,originalEvent:t})),ee.active&&((Ct==null||Ct===-1)&&(Ct=Ii,Qn=$o),ut({sortable:this,name:"end",toEl:Ae,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){gt("nulling",this),xe=R=Ae=ae=$r=Me=Oa=rr=Pr=Gt=Ao=Ct=Qn=Ii=$o=Ei=jo=Ge=ra=ee.dragged=ee.ghost=ee.clone=ee.active=null,el.forEach(function(t){t.checked=!0}),el.length=Gu=Ju=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":R&&(this._onDragOver(t),ZT(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],e,n=this.el.children,r=0,i=n.length,o=this.options;r<i;r++)e=n[r],pn(e,o.draggable,this.el,!1)&&t.push(e.getAttribute(o.dataIdAttr)||iO(e));return t},sort:function(t,e){var n={},r=this.el;this.toArray().forEach(function(i,o){var s=r.children[o];pn(s,this.options.draggable,r,!1)&&(n[i]=s)},this),e&&this.captureAnimationState(),t.forEach(function(i){n[i]&&(r.removeChild(n[i]),r.appendChild(n[i]))}),e&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return pn(t,e||this.options.draggable,this.el,!1)},option:function(t,e){var n=this.options;if(e===void 0)return n[t];var r=_s.modifyOption(this,t,e);typeof r<"u"?n[t]=r:n[t]=e,t==="group"&&Cy(n)},destroy:function(){gt("destroy",this);var t=this.el;t[Tt]=null,me(t,"mousedown",this._onTapStart),me(t,"touchstart",this._onTapStart),me(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(me(t,"dragover",this),me(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(e){e.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),Qa.splice(Qa.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!rr){if(gt("hideClone",this),ee.eventCanceled)return;Q(Me,"display","none"),this.options.removeCloneOnHide&&Me.parentNode&&Me.parentNode.removeChild(Me),rr=!0}},_showClone:function(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(rr){if(gt("showClone",this),ee.eventCanceled)return;R.parentNode==xe&&!this.options.group.revertClone?xe.insertBefore(Me,R):$r?xe.insertBefore(Me,$r):xe.appendChild(Me),this.options.group.revertClone&&this.animate(R,Me),Q(Me,"display",""),rr=!1}}};function ZT(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}function sa(t,e,n,r,i,o,s,a){var l,u=t[Tt],c=u.options.onMove,d;return window.CustomEvent&&!Un&&!Ms?l=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(l=document.createEvent("Event"),l.initEvent("move",!0,!0)),l.to=e,l.from=t,l.dragged=n,l.draggedRect=r,l.related=i||e,l.relatedRect=o||Be(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),c&&(d=c.call(u,l,s)),d}function Yu(t){t.draggable=!1}function QT(){ad=!1}function eO(t,e,n){var r=Be(Ki(n.el,0,n.options,!0)),i=10;return e?t.clientX<r.left-i||t.clientY<r.top&&t.clientX<r.right:t.clientY<r.top-i||t.clientY<r.bottom&&t.clientX<r.left}function tO(t,e,n){var r=Be(Ip(n.el,n.options.draggable)),i=10;return e?t.clientX>r.right+i||t.clientX<=r.right&&t.clientY>r.bottom&&t.clientX>=r.left:t.clientX>r.right&&t.clientY>r.top||t.clientX<=r.right&&t.clientY>r.bottom+i}function nO(t,e,n,r,i,o,s,a){var l=r?t.clientY:t.clientX,u=r?n.height:n.width,c=r?n.top:n.left,d=r?n.bottom:n.right,h=!1;if(!s){if(a&&Aa<u*i){if(!zo&&(jo===1?l>c+u*o/2:l<d-u*o/2)&&(zo=!0),zo)h=!0;else if(jo===1?l<c+Aa:l>d-Aa)return-jo}else if(l>c+u*(1-i)/2&&l<d-u*(1-i)/2)return rO(e)}return h=h||s,h&&(l<c+u*o/2||l>d-u*o/2)?l>c+u/2?1:-1:0}function rO(t){return Lt(R)<Lt(t)?1:-1}function iO(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,r=0;n--;)r+=e.charCodeAt(n);return r.toString(36)}function oO(t){el.length=0;for(var e=t.getElementsByTagName("input"),n=e.length;n--;){var r=e[n];r.checked&&el.push(r)}}function Ma(t){return setTimeout(t,0)}function ld(t){return clearTimeout(t)}mu&&ve(document,"touchmove",function(t){(ee.active||Ti)&&t.cancelable&&t.preventDefault()});ee.utils={on:ve,off:me,css:Q,find:yy,is:function(t,e){return!!pn(t,e,t,!1)},extend:jT,throttle:by,closest:pn,toggleClass:Et,clone:wy,index:Lt,nextTick:Ma,cancelNextTick:ld,detectDirection:Ey,getChild:Ki};ee.get=function(t){return t[Tt]};ee.mount=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e[0].constructor===Array&&(e=e[0]),e.forEach(function(r){if(!r.prototype||!r.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(r));r.utils&&(ee.utils=kn(kn({},ee.utils),r.utils)),_s.mount(r)})};ee.create=function(t,e){return new ee(t,e)};ee.version=LT;var Re=[],Mo,ud,cd=!1,Zu,Qu,tl,_o;function sO(){function t(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var e in this)e.charAt(0)==="_"&&typeof this[e]=="function"&&(this[e]=this[e].bind(this))}return t.prototype={dragStarted:function(e){var n=e.originalEvent;this.sortable.nativeDraggable?ve(document,"dragover",this._handleAutoScroll):this.options.supportPointer?ve(document,"pointermove",this._handleFallbackAutoScroll):n.touches?ve(document,"touchmove",this._handleFallbackAutoScroll):ve(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var n=e.originalEvent;!this.options.dragOverBubble&&!n.rootEl&&this._handleAutoScroll(n)},drop:function(){this.sortable.nativeDraggable?me(document,"dragover",this._handleAutoScroll):(me(document,"pointermove",this._handleFallbackAutoScroll),me(document,"touchmove",this._handleFallbackAutoScroll),me(document,"mousemove",this._handleFallbackAutoScroll)),Rf(),_a(),zT()},nulling:function(){tl=ud=Mo=cd=_o=Zu=Qu=null,Re.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,n){var r=this,i=(e.touches?e.touches[0]:e).clientX,o=(e.touches?e.touches[0]:e).clientY,s=document.elementFromPoint(i,o);if(tl=e,n||this.options.forceAutoScrollFallback||Ms||Un||Vo){ec(e,this.options,s,n);var a=sr(s,!0);cd&&(!_o||i!==Zu||o!==Qu)&&(_o&&Rf(),_o=setInterval(function(){var l=sr(document.elementFromPoint(i,o),!0);l!==a&&(a=l,_a()),ec(e,r.options,l,n)},10),Zu=i,Qu=o)}else{if(!this.options.bubbleScroll||sr(s,!0)===vn()){_a();return}ec(e,this.options,sr(s,!1),!1)}}},jn(t,{pluginName:"scroll",initializeByDefault:!0})}function _a(){Re.forEach(function(t){clearInterval(t.pid)}),Re=[]}function Rf(){clearInterval(_o)}var ec=by(function(t,e,n,r){if(e.scroll){var i=(t.touches?t.touches[0]:t).clientX,o=(t.touches?t.touches[0]:t).clientY,s=e.scrollSensitivity,a=e.scrollSpeed,l=vn(),u=!1,c;ud!==n&&(ud=n,_a(),Mo=e.scroll,c=e.scrollFn,Mo===!0&&(Mo=sr(n,!0)));var d=0,h=Mo;do{var p=h,f=Be(p),m=f.top,g=f.bottom,y=f.left,b=f.right,k=f.width,v=f.height,w=void 0,x=void 0,T=p.scrollWidth,F=p.scrollHeight,D=Q(p),C=p.scrollLeft,_=p.scrollTop;p===l?(w=k<T&&(D.overflowX==="auto"||D.overflowX==="scroll"||D.overflowX==="visible"),x=v<F&&(D.overflowY==="auto"||D.overflowY==="scroll"||D.overflowY==="visible")):(w=k<T&&(D.overflowX==="auto"||D.overflowX==="scroll"),x=v<F&&(D.overflowY==="auto"||D.overflowY==="scroll"));var L=w&&(Math.abs(b-i)<=s&&C+k<T)-(Math.abs(y-i)<=s&&!!C),W=x&&(Math.abs(g-o)<=s&&_+v<F)-(Math.abs(m-o)<=s&&!!_);if(!Re[d])for(var q=0;q<=d;q++)Re[q]||(Re[q]={});(Re[d].vx!=L||Re[d].vy!=W||Re[d].el!==p)&&(Re[d].el=p,Re[d].vx=L,Re[d].vy=W,clearInterval(Re[d].pid),(L!=0||W!=0)&&(u=!0,Re[d].pid=setInterval(function(){r&&this.layer===0&&ee.active._onTouchMove(tl);var K=Re[this.layer].vy?Re[this.layer].vy*a:0,J=Re[this.layer].vx?Re[this.layer].vx*a:0;typeof c=="function"&&c.call(ee.dragged.parentNode[Tt],J,K,t,tl,Re[this.layer].el)!=="continue"||ky(Re[this.layer].el,J,K)}.bind({layer:d}),24))),d++}while(e.bubbleScroll&&h!==l&&(h=sr(h,!1)));cd=u}},30),Oy=function(t){var e=t.originalEvent,n=t.putSortable,r=t.dragEl,i=t.activeSortable,o=t.dispatchSortableEvent,s=t.hideGhostForTarget,a=t.unhideGhostForTarget;if(e){var l=n||i;s();var u=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,c=document.elementFromPoint(u.clientX,u.clientY);a(),l&&!l.el.contains(c)&&(o("spill"),this.onSpill({dragEl:r,putSortable:n}))}};function Rp(){}Rp.prototype={startIndex:null,dragStart:function(t){var e=t.oldDraggableIndex;this.startIndex=e},onSpill:function(t){var e=t.dragEl,n=t.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var r=Ki(this.sortable.el,this.startIndex,this.options);r?this.sortable.el.insertBefore(e,r):this.sortable.el.appendChild(e),this.sortable.animateAll(),n&&n.animateAll()},drop:Oy};jn(Rp,{pluginName:"revertOnSpill"});function Pp(){}Pp.prototype={onSpill:function(t){var e=t.dragEl,n=t.putSortable,r=n||this.sortable;r.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),r.animateAll()},drop:Oy};jn(Pp,{pluginName:"removeOnSpill"});ee.mount(new sO);ee.mount(Pp,Rp);function tc(t){t.parentElement!==null&&t.parentElement.removeChild(t)}function Pf(t,e,n){const r=n===0?t.children[0]:t.children[n-1].nextSibling;t.insertBefore(e,r)}function aO(){return typeof window<"u"?window.console:global.console}const lO=aO();function uO(t){const e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}const cO=/-(\w)/g,dO=uO(t=>t.replace(cO,(e,n)=>n.toUpperCase())),Ay=["Start","Add","Remove","Update","End"],My=["Choose","Unchoose","Sort","Filter","Clone"],_y=["Move"],pO=[_y,Ay,My].flatMap(t=>t).map(t=>`on${t}`),dd={manage:_y,manageAndEmit:Ay,emit:My};function hO(t){return pO.indexOf(t)!==-1}const fO=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"];function mO(t){return fO.includes(t)}function gO(t){return["transition-group","TransitionGroup"].includes(t)}function Dy(t){return["id","class","role","style"].includes(t)||t.startsWith("data-")||t.startsWith("aria-")||t.startsWith("on")}function Ny(t){return t.reduce((e,[n,r])=>(e[n]=r,e),{})}function vO({$attrs:t,componentData:e={}}){return{...Ny(Object.entries(t).filter(([n,r])=>Dy(n))),...e}}function yO({$attrs:t,callBackBuilder:e}){const n=Ny(Iy(t));Object.entries(e).forEach(([i,o])=>{dd[i].forEach(s=>{n[`on${s}`]=o(s)})});const r=`[data-draggable]${n.draggable||""}`;return{...n,draggable:r}}function Iy(t){return Object.entries(t).filter(([e,n])=>!Dy(e)).map(([e,n])=>[dO(e),n]).filter(([e,n])=>!hO(e))}const Ff=({el:t})=>t,bO=(t,e)=>t.__draggable_context=e,Lf=t=>t.__draggable_context;class kO{constructor({nodes:{header:e,default:n,footer:r},root:i,realList:o}){this.defaultNodes=n,this.children=[...e,...n,...r],this.externalComponent=i.externalComponent,this.rootTransition=i.transition,this.tag=i.tag,this.realList=o}get _isRootComponent(){return this.externalComponent||this.rootTransition}render(e,n){const{tag:r,children:i,_isRootComponent:o}=this;return e(r,n,o?{default:()=>i}:i)}updated(){const{defaultNodes:e,realList:n}=this;e.forEach((r,i)=>{bO(Ff(r),{element:n[i],index:i})})}getUnderlyingVm(e){return Lf(e)}getVmIndexFromDomIndex(e,n){const{defaultNodes:r}=this,{length:i}=r,o=n.children,s=o.item(e);if(s===null)return i;const a=Lf(s);if(a)return a.index;if(i===0)return 0;const l=Ff(r[0]),u=[...o].findIndex(c=>c===l);return e<u?0:i}}function wO(t,e){const n=t[e];return n?n():[]}function xO({$slots:t,realList:e,getKey:n}){const r=e||[],[i,o]=["header","footer"].map(l=>wO(t,l)),{item:s}=t;if(!s)throw new Error("draggable element must have an item slot");const a=r.flatMap((l,u)=>s({element:l,index:u}).map(c=>(c.key=n(l),c.props={...c.props||{},"data-draggable":!0},c)));if(a.length!==r.length)throw new Error("Item slot must have only one child");return{header:i,footer:o,default:a}}function EO(t){const e=gO(t),n=!mO(t)&&!e;return{transition:e,externalComponent:n,tag:n?Ek(t):e?Ck:t}}function CO({$slots:t,tag:e,realList:n,getKey:r}){const i=xO({$slots:t,realList:n,getKey:r}),o=EO(e);return new kO({nodes:i,root:o,realList:n})}function Ry(t,e){kr(()=>this.$emit(t.toLowerCase(),e))}function Py(t){return(e,n)=>{if(this.realList!==null)return this[`onDrag${t}`](e,n)}}function SO(t){const e=Py.call(this,t);return(n,r)=>{e.call(this,n,r),Ry.call(this,t,n)}}let nc=null;const TO={list:{type:Array,required:!1,default:null},modelValue:{type:Array,required:!1,default:null},itemKey:{type:[String,Function],required:!0},clone:{type:Function,default:t=>t},tag:{type:String,default:"div"},move:{type:Function,default:null},componentData:{type:Object,required:!1,default:null}},OO=["update:modelValue","change",...[...dd.manageAndEmit,...dd.emit].map(t=>t.toLowerCase())],Fy=te({name:"draggable",inheritAttrs:!1,props:TO,emits:OO,data(){return{error:!1}},render(){try{this.error=!1;const{$slots:t,$attrs:e,tag:n,componentData:r,realList:i,getKey:o}=this,s=CO({$slots:t,tag:n,realList:i,getKey:o});this.componentStructure=s;const a=vO({$attrs:e,componentData:r});return s.render(ns,a)}catch(t){return this.error=!0,ns("pre",{style:{color:"red"}},t.stack)}},created(){this.list!==null&&this.modelValue!==null&&lO.error("modelValue and list props are mutually exclusive! Please set one or another.")},mounted(){if(this.error)return;const{$attrs:t,$el:e,componentStructure:n}=this;n.updated();const r=yO({$attrs:t,callBackBuilder:{manageAndEmit:o=>SO.call(this,o),emit:o=>Ry.bind(this,o),manage:o=>Py.call(this,o)}}),i=e.nodeType===1?e:e.parentElement;this._sortable=new ee(i,r),this.targetDomElement=i,i.__draggable_component__=this},updated(){this.componentStructure.updated()},beforeUnmount(){this._sortable!==void 0&&this._sortable.destroy()},computed:{realList(){const{list:t}=this;return t||this.modelValue},getKey(){const{itemKey:t}=this;return typeof t=="function"?t:e=>e[t]}},watch:{$attrs:{handler(t){const{_sortable:e}=this;e&&Iy(t).forEach(([n,r])=>{e.option(n,r)})},deep:!0}},methods:{getUnderlyingVm(t){return this.componentStructure.getUnderlyingVm(t)||null},getUnderlyingPotencialDraggableComponent(t){return t.__draggable_component__},emitChanges(t){kr(()=>this.$emit("change",t))},alterList(t){if(this.list){t(this.list);return}const e=[...this.modelValue];t(e),this.$emit("update:modelValue",e)},spliceList(){const t=e=>e.splice(...arguments);this.alterList(t)},updatePosition(t,e){const n=r=>r.splice(e,0,r.splice(t,1)[0]);this.alterList(n)},getRelatedContextFromMoveEvent({to:t,related:e}){const n=this.getUnderlyingPotencialDraggableComponent(t);if(!n)return{component:n};const r=n.realList,i={list:r,component:n};return t!==e&&r?{...n.getUnderlyingVm(e)||{},...i}:i},getVmIndexFromDomIndex(t){return this.componentStructure.getVmIndexFromDomIndex(t,this.targetDomElement)},onDragStart(t){this.context=this.getUnderlyingVm(t.item),t.item._underlying_vm_=this.clone(this.context.element),nc=t.item},onDragAdd(t){const e=t.item._underlying_vm_;if(e===void 0)return;tc(t.item);const n=this.getVmIndexFromDomIndex(t.newIndex);this.spliceList(n,0,e);const r={element:e,newIndex:n};this.emitChanges({added:r})},onDragRemove(t){if(Pf(this.$el,t.item,t.oldIndex),t.pullMode==="clone"){tc(t.clone);return}const{index:e,element:n}=this.context;this.spliceList(e,1);const r={element:n,oldIndex:e};this.emitChanges({removed:r})},onDragUpdate(t){tc(t.item),Pf(t.from,t.item,t.oldIndex);const e=this.context.index,n=this.getVmIndexFromDomIndex(t.newIndex);this.updatePosition(e,n);const r={element:this.context.element,oldIndex:e,newIndex:n};this.emitChanges({moved:r})},computeFutureIndex(t,e){if(!t.element)return 0;const n=[...e.to.children].filter(o=>o.style.display!=="none"),r=n.indexOf(e.related),i=t.component.getVmIndexFromDomIndex(r);return n.indexOf(nc)!==-1||!e.willInsertAfter?i:i+1},onDragMove(t,e){const{move:n,realList:r}=this;if(!n||!r)return!0;const i=this.getRelatedContextFromMoveEvent(t),o=this.computeFutureIndex(i,t),s={...this.context,futureIndex:o},a={...t,relatedContext:i,draggedContext:s};return n(a,e)},onDragEnd(){nc=null}}}),AO={key:0,class:"k-media__label-wrapper"},MO={key:1,class:"k-media__sublabel"},EL=te({__name:"Media",props:{modelValue:{},types:{default:()=>["Image"]},label:{},sublabel:{},multiple:{type:Boolean},sortable:{type:Boolean,default:!0},upload:{type:Function,default:()=>(t,e,n)=>(console.warn("[@kvass-ui/media]: You need to setup the upload function before using this component!"),e(50),new Promise((r,i)=>{let o=new FileReader;o.onloadend=function(){r({url:o.result,type:t.type})},o.readAsDataURL(t)}))},size:{default:"cover"},placement:{default:"outside"},uploadOptions:{default:()=>({})},description:{type:Boolean,default:!0},dropMessage:{default:"Drag an image here or <b>browse</b> to upload."},type:{default:"file"},accept:{default:"image/*"},labels:{default:()=>({cancel:"Cancel",save:"Save",selectMessage:"Select a type from the menu",select:"Select",descriptionPlaceholder:"Add caption...",image:{createLabel:"Image"}})},required:{type:Boolean},disabled:{type:Boolean},thumbnailSize:{default:"4rem"}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=X(null),o=N(()=>i.value?n.modelValue instanceof Array?n.modelValue.find(p=>{var f;return p.url===((f=i.value)==null?void 0:f.url)}):n.modelValue:null),s=N({get(){return n.modelValue?(n.modelValue instanceof Array?n.modelValue:[n.modelValue]).map(p=>{var f;return{...p,selected:((f=i.value)==null?void 0:f.url)===p.url,typeConfig:a.value.find(m=>m.condition(p))}}):[]},set(p){n.multiple&&r("update:modelValue",p.map(f=>{let{selected:m,typeConfig:g,...y}=f;return y}))}}),a=N(()=>n.types.map(p=>typeof p=="string"?IT[p]:p).filter(Boolean));Ee(()=>n.modelValue,(p,f)=>{(!i.value||!s.value.find(m=>{var g;return m.url===((g=i.value)==null?void 0:g.url)}))&&l()},{immediate:!0});function l(p){return!n.modelValue||n.multiple&&!n.modelValue.length?i.value=null:p?i.value=p:i.value=s.value[0]}function u(p){var f;let{selected:m,typeConfig:g,...y}=p;r("update:modelValue",n.multiple?(n.modelValue||[]).filter(b=>b.url!==y.url):null),((f=i?.value)==null?void 0:f.url)===p.url&&kr(()=>{l()})}function c(p){r("update:modelValue",n.multiple?[...n.modelValue||[],p]:p),kr(()=>l(s.value.find(f=>f.url===p.url)))}function d(p){r("update:modelValue",p)}const h=Cn("k-media",{variants:{placement:{outside:"k-media--placement-outside",inside:"k-media--placement-inside"}}});return(p,f)=>(E(),O("div",{class:Ce($(h)({placement:p.placement}))},[p.label||p.sublabel||p.$slots.sublabel||p.$slots.label?(E(),O("div",AO,[p.label||p.$slots.label?(E(),O("label",{key:0,class:Ce(["k-media__label",{"k-media__label-required":p.required}])},[P(p.$slots,"label",{},()=>[$e(se(p.label),1)])],2)):I("",!0),p.sublabel||p.$slots.sublabel?(E(),O("span",MO,[P(p.$slots,"sublabel",{},()=>[$e(se(p.sublabel),1)])])):I("",!0)])):I("",!0),he(AT,{type:p.type,accept:p.accept,ref:"input",value:p.modelValue,multiple:p.multiple,required:p.required,onSelect:l,onRemove:u,onInput:d,selected:i.value,disabled:p.disabled,"upload-options":p.uploadOptions,upload:p.upload,dropMessage:p.dropMessage},Cs({default:Z(({openFileWindow:m})=>[he(gT,{onOpenFileWindow:m,ref:"typeSelector",value:a.value,onAdd:c,labels:p.labels,upload:p.upload},null,8,["onOpenFileWindow","value","labels","upload"])]),"drop-message":Z(()=>[P(p.$slots,"drop-message")]),"custom-message":Z(()=>[P(p.$slots,"custom-message")]),_:2},[i.value?{name:"preview",fn:Z(()=>[p.description&&o.value?(E(),B(vT,{key:0,modelValue:o.value.description,"onUpdate:modelValue":f[0]||(f[0]=m=>o.value.description=m),disabled:p.disabled,placeholder:p.labels.descriptionPlaceholder},null,8,["modelValue","disabled","placeholder"])):I("",!0),(E(),B(Qe(i.value.typeConfig.components.Preview),{value:i.value,size:p.size},null,8,["value","size"]))]),key:"0"}:void 0]),1032,["type","accept","value","multiple","required","selected","disabled","upload-options","upload","dropMessage"]),P(p.$slots,"bottom"),p.multiple?(E(),B($(Fy),{key:1,modelValue:s.value,"onUpdate:modelValue":f[1]||(f[1]=m=>s.value=m),sort:p.sortable&&!p.disabled,class:"k-media__thumbnails","item-key":"url",animation:200,onEnd:f[2]||(f[2]=(m,g)=>{i.value=s.value[m.newIndex]})},{item:Z(({element:m,index:g})=>[(E(),B(hT,{onKeydown:rp(y=>i.value=m,["enter"]),tabindex:"0",size:p.thumbnailSize,key:m.url,value:m,disabled:p.disabled,onClick:y=>i.value=m,onDelete:y=>u(m)},null,8,["onKeydown","size","value","disabled","onClick","onDelete"]))]),_:1},8,["modelValue","sort"])):I("",!0)],2))}});var _O=Ln("switch").parts("root","label","control","thumb"),aa=_O.build(),Ly=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`switch:${t.id}`},Vf=t=>{var e;return((e=t.ids)==null?void 0:e.label)??`switch:${t.id}:label`},DO=t=>{var e;return((e=t.ids)==null?void 0:e.thumb)??`switch:${t.id}:thumb`},NO=t=>{var e;return((e=t.ids)==null?void 0:e.control)??`switch:${t.id}:control`},pd=t=>{var e;return((e=t.ids)==null?void 0:e.hiddenInput)??`switch:${t.id}:input`},IO=t=>t.getById(Ly(t)),Do=t=>t.getById(pd(t));function RO(t,e){const{context:n,send:r,prop:i,scope:o}=t,s=i("disabled"),a=i("readOnly"),l=!!n.get("checked"),u=!s&&n.get("focused"),c=!s&&n.get("focusVisible"),d={"data-active":G(n.get("active")),"data-focus":G(u),"data-focus-visible":G(c),"data-readonly":G(a),"data-hover":G(n.get("hovered")),"data-disabled":G(s),"data-state":l?"checked":"unchecked","data-invalid":G(i("invalid"))};return{checked:l,disabled:s,focused:u,setChecked(h){r({type:"CHECKED.SET",checked:h,isTrusted:!1})},toggleChecked(){r({type:"CHECKED.TOGGLE",checked:l,isTrusted:!1})},getRootProps(){return e.label({...aa.root.attrs,...d,dir:i("dir"),id:Ly(o),htmlFor:pd(o),onPointerMove(){s||r({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){s||r({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(h){s||ct(h)===Do(o)&&h.stopPropagation()}})},getLabelProps(){return e.element({...aa.label.attrs,...d,dir:i("dir"),id:Vf(o)})},getThumbProps(){return e.element({...aa.thumb.attrs,...d,dir:i("dir"),id:DO(o),"aria-hidden":!0})},getControlProps(){return e.element({...aa.control.attrs,...d,dir:i("dir"),id:NO(o),"aria-hidden":!0})},getHiddenInputProps(){return e.input({id:pd(o),type:"checkbox",required:i("required"),defaultChecked:l,disabled:s,"aria-labelledby":Vf(o),"aria-invalid":i("invalid"),name:i("name"),form:i("form"),value:i("value"),style:vp,onFocus(){const h=is();r({type:"CONTEXT.SET",context:{focused:!0,focusVisible:h}})},onBlur(){r({type:"CONTEXT.SET",context:{focused:!1,focusVisible:!1}})},onClick(h){if(a){h.preventDefault();return}const p=h.currentTarget.checked;r({type:"CHECKED.SET",checked:p,isTrusted:!0})}})}}}var{not:Bf}=eu(),PO={props({props:t}){return{defaultChecked:!1,label:"switch",value:"on",...t}},initialState(){return"ready"},context({prop:t,bindable:e}){return{checked:e(()=>({defaultValue:t("defaultChecked"),value:t("checked"),onChange(n){var r;(r=t("onCheckedChange"))==null||r({checked:n})}})),fieldsetDisabled:e(()=>({defaultValue:!1})),focusVisible:e(()=>({defaultValue:!1})),active:e(()=>({defaultValue:!1})),focused:e(()=>({defaultValue:!1})),hovered:e(()=>({defaultValue:!1}))}},computed:{isDisabled:({context:t,prop:e})=>e("disabled")||t.get("fieldsetDisabled")},watch({track:t,prop:e,context:n,action:r}){t([()=>e("disabled")],()=>{r(["removeFocusIfNeeded"])}),t([()=>n.get("checked")],()=>{r(["syncInputElement"])})},effects:["trackFormControlState","trackPressEvent","trackFocusVisible"],on:{"CHECKED.TOGGLE":[{guard:Bf("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:Bf("isTrusted"),actions:["setChecked","dispatchChangeEvent"]},{actions:["setChecked"]}],"CONTEXT.SET":{actions:["setContext"]}},states:{ready:{}},implementations:{guards:{isTrusted:({event:t})=>!!t.isTrusted},effects:{trackPressEvent({computed:t,scope:e,context:n}){if(!t("isDisabled"))return dv({pointerNode:IO(e),keyboardNode:Do(e),isValidKey:r=>r.key===" ",onPress:()=>n.set("active",!1),onPressStart:()=>n.set("active",!0),onPressEnd:()=>n.set("active",!1)})},trackFocusVisible({computed:t,scope:e}){if(!t("isDisabled"))return yp({root:e.getRootNode()})},trackFormControlState({context:t,send:e,scope:n}){return Yl(Do(n),{onFieldsetDisabledChange(r){t.set("fieldsetDisabled",r)},onFormReset(){const r=t.initial("checked");e({type:"CHECKED.SET",checked:!!r,src:"form-reset"})}})}},actions:{setContext({context:t,event:e}){for(const n in e.context)t.set(n,e.context[n])},syncInputElement({context:t,scope:e}){const n=Do(e);n&&hp(n,!!t.get("checked"))},removeFocusIfNeeded({context:t,prop:e}){e("disabled")&&t.set("focused",!1)},setChecked({context:t,event:e}){t.set("checked",e.checked)},toggleChecked({context:t}){t.set("checked",!t.get("checked"))},dispatchChangeEvent({context:t,scope:e}){const n=Do(e);fp(n,{checked:t.get("checked")})}}}};Wn()(["checked","defaultChecked","dir","disabled","form","getRootNode","id","ids","invalid","label","name","onCheckedChange","readOnly","required","value"]);const FO={class:"k-switch__label"},CL=te({__name:"Switch",props:{modelValue:{type:Boolean},disabled:{type:Boolean},getRootNode:{type:Function},labels:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=pi(PO,{id:Qt(),...n,defaultChecked:n.modelValue,onCheckedChange:({checked:s})=>r("update:modelValue",s)}),o=N(()=>RO(i,di));return Ee(()=>n.modelValue,()=>{if(o.value.checked!==n.modelValue)return o.value.setChecked(n.modelValue)}),(s,a)=>(E(),O("label",ne({class:"k-switch"},o.value.getRootProps()),[H("input",be(Ne(o.value.getHiddenInputProps())),null,16),H("span",be(Ne(o.value.getControlProps())),[H("span",be(Ne(o.value.getThumbProps())),null,16)],16),s.labels||s.$slots.default?(E(),O("span",be(ne({key:0},o.value.getLabelProps())),[H("span",FO,[P(s.$slots,"default",{checked:o.value.checked},()=>[$e(se(o.value.checked?s.labels.on:s.labels.off),1)])])],16)):I("",!0)],16))}}),SL=te({__name:"LazyLoad",props:{wrapperTag:{default:"div"},threshold:{default:0},observerRoot:{default:null}},emits:["intersect"],setup(t,{emit:e}){const n=t,r=e,i=X(!1);function o(u){const c=u[0];c.isIntersecting&&(i.value=!0,kr(()=>{r("intersect",c),l()}))}const s=X(),a=X();qn(()=>{s.value=new IntersectionObserver(o,{root:n.observerRoot,threshold:n.threshold}),s.value.observe(a.value)}),ao(()=>{l()});function l(){s.value&&s.value.disconnect()}return(u,c)=>(E(),B(Qe(u.wrapperTag),{ref_key:"rootRef",ref:a,class:"k-lazyload"},{default:Z(()=>[i.value?P(u.$slots,"default",{key:0}):P(u.$slots,"placeholder",{key:1})]),_:3},512))}}),LO={class:"k-file-uploader__bar"},VO={class:"k-file-uploader__meta"},BO={key:0},$O={key:1},jO=te({__name:"Uploader",props:{value:{},bytes:{},current:{default:1},total:{default:1}},setup(t){const e=t,n=N(()=>e.total>1),r=N(()=>Dp(e.bytes)),i=N(()=>Math.floor(e.value));return(o,s)=>(E(),B(ni,{class:"k-file-uploader",align:"center",justify:"space-between",gap:"0rem"},{default:Z(()=>[H("div",null,se(i.value)+" %",1),H("div",LO,[H("div",{class:"k-file-uploader__bar-value",style:Cr({width:o.value+"%"})},null,4)]),H("div",VO,[n.value?(E(),O("div",BO,se(o.current)+" / "+se(o.total),1)):I("",!0),o.bytes?(E(),O("div",$O,"("+se(r.value)+")",1)):I("",!0)])]),_:1}))}}),zO=["innerHTML"],HO=te({__name:"SlotHandler",props:{value:{}},setup(t){const e=t,n=N(()=>typeof e.value=="string"?e.value:void 0),r=N(()=>typeof e.value=="string"?"div":e.value);return(i,o)=>(E(),B(Qe(r.value),be(Ne(i.$attrs)),{default:Z(()=>[n.value?(E(),O("span",{key:0,innerHTML:n.value},null,8,zO)):I("",!0)]),_:1},16))}}),qO={class:"k-file-droparea__instruction"},WO=["accept","required","disabled","multiple"],UO=te({__name:"DropArea",props:{value:{},multiple:{type:Boolean},upload:{},uploadOptions:{},accept:{},dropMessage:{},disabled:{type:Boolean},required:{type:Boolean},rename:{type:Boolean},labels:{}},emits:["input"],setup(t,{emit:e}){const n=t,r=e,i=X(!1),o=X(!0),s=X(),a=N(()=>!!(!n.required||n.value)),l=N(()=>n.disabled),u=N(()=>!l.value&&!h.total),c=N(()=>dT(n.accept)),{run:d,queue:h}=new fy(n);function p(k){return d(k).then(v=>{!v||!v.length||r("input",n.multiple?[...n.value||[],...v]:v[0])})}async function f(k){if(l.value)return;let v=k.target.files||[];n.uploadOptions.preTransform&&(v=await n.uploadOptions.preTransform(k)),p(v),s.value&&(s.value.value="")}async function m(k){var v;if(l.value||!s.value)return;if(k.preventDefault(),!o.value)return y();y();let w=(v=k.dataTransfer)==null?void 0:v.files;w!=null&&w.length&&(n.uploadOptions.preTransform&&(w=await n.uploadOptions.preTransform(k)),w!=null&&w.length&&(s.value.files=k.dataTransfer.files,s.value.dispatchEvent(new InputEvent("input")),p(w)))}function g(k){if(l.value||!k.dataTransfer)return;const v=Array.from(k.dataTransfer.items).every(x=>Np(x,n.accept)),w=n.multiple?!0:k.dataTransfer.items.length===1;o.value=v&&w,i.value=!0,k.preventDefault()}function y(){o.value=!0,i.value=!1}const b=Cn("k-file-droparea",{variants:{active:{true:"k-file-droparea--active"},invalid:{true:"k-file-droparea--invalid"},disabled:{true:"k-file-droparea--disabled"}}});return(k,v)=>(E(),O(Ie,null,[H("div",{class:Ce($(b)({active:i.value,invalid:!o.value,disabled:l.value})),onDrop:m,onDragover:g,onDragleave:y},[P(k.$slots,"preview"),H("div",qO,[u.value?(E(),O("input",{key:0,type:"file",accept:Array.isArray(k.accept)?k.accept.join(","):k.accept,required:a.value,ref_key:"input",ref:s,onChange:f,disabled:!u.value,multiple:k.multiple,class:"k-file-droparea__input"},null,40,WO)):I("",!0),o.value?P(k.$slots,"drop-message",{key:1,extensions:c.value},()=>[he(HO,{value:k.dropMessage,extensions:c.value},null,8,["value","extensions"])]):(E(),B($(Ze),{key:2,icon:"fa-pro-light:ban",style:{"font-size":"2rem"}})),P(k.$slots,"custom-message")])],34),$(h).total?(E(),B(jO,{key:0,value:$(h).progress,bytes:$(h).bytes,current:$(h).counter,total:$(h).total},null,8,["value","bytes","current","total"])):I("",!0)],64))}}),KO=Os?window:void 0;function GO(t){var e;const n=He(t);return(e=n?.$el)!=null?e:n}function JO(...t){const e=[],n=()=>{e.forEach(a=>a()),e.length=0},r=(a,l,u,c)=>(a.addEventListener(l,u,c),()=>a.removeEventListener(l,u,c)),i=N(()=>{const a=Gr(He(t[0])).filter(l=>l!=null);return a.every(l=>typeof l!="string")?a:void 0}),o=Ov(()=>{var a,l;return[(l=(a=i.value)==null?void 0:a.map(u=>GO(u)))!=null?l:[KO].filter(u=>u!=null),Gr(He(i.value?t[1]:t[0])),Gr($(i.value?t[2]:t[1])),He(i.value?t[3]:t[2])]},([a,l,u,c])=>{if(n(),!(a!=null&&a.length)||!(l!=null&&l.length)||!(u!=null&&u.length))return;const d=Tv(c)?{...c}:c;e.push(...a.flatMap(h=>l.flatMap(p=>u.map(f=>r(h,p,f,d)))))},{flush:"post"}),s=()=>{o(),n()};return Ts(n),s}const XO=te({name:"UseClipboard",props:["source","read","navigator","copiedDuring","legacy"],setup(t,{slots:e}){const n=ip(U1(t));return()=>{var r;return(r=e.default)==null?void 0:r.call(e,n)}}});function rc(t){return typeof Window<"u"&&t instanceof Window?t.document.documentElement:typeof Document<"u"&&t instanceof Document?t.documentElement:t}function Vy(t){const e=window.getComputedStyle(t);if(e.overflowX==="scroll"||e.overflowY==="scroll"||e.overflowX==="auto"&&t.clientWidth<t.scrollWidth||e.overflowY==="auto"&&t.clientHeight<t.scrollHeight)return!0;{const n=t.parentNode;return!n||n.tagName==="BODY"?!1:Vy(n)}}function YO(t){const e=t||window.event,n=e.target;return Vy(n)?!1:e.touches.length>1?!0:(e.preventDefault&&e.preventDefault(),!1)}const ic=new WeakMap;function ZO(t,e=!1){const n=qt(e);let r=null,i="";Ee(j1(t),a=>{const l=rc(He(a));if(l){const u=l;if(ic.get(u)||ic.set(u,u.style.overflow),u.style.overflow!=="hidden"&&(i=u.style.overflow),u.style.overflow==="hidden")return n.value=!0;if(n.value)return u.style.overflow="hidden"}},{immediate:!0});const o=()=>{const a=rc(He(t));!a||n.value||(Zh&&(r=JO(a,"touchmove",l=>{YO(l)},{passive:!1})),a.style.overflow="hidden",n.value=!0)},s=()=>{const a=rc(He(t));!a||!n.value||(Zh&&r?.(),a.style.overflow=i,ic.delete(a),n.value=!1)};return Ts(s),N({get(){return n.value},set(a){a?o():s()}})}function QO(){let t=!1;const e=qt(!1);return(n,r)=>{if(e.value=r.value,t)return;t=!0;const i=ZO(n,r.value);Ee(e,o=>i.value=o)}}QO();var eA=Ln("toggle-group").parts("root","item"),$f=eA.build(),nl=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`toggle-group:${t.id}`},tA=(t,e)=>{var n,r;return((r=(n=t.ids)==null?void 0:n.item)==null?void 0:r.call(n,e))??`toggle-group:${t.id}:${e}`},By=t=>t.getById(nl(t)),gu=t=>{const e=`[data-ownedby='${CSS.escape(nl(t))}']:not([data-disabled])`;return gp(By(t),e)},jf=t=>vv(gu(t)),nA=t=>yv(gu(t)),rA=(t,e,n)=>Dx(gu(t),e,n),iA=(t,e,n)=>Nx(gu(t),e,n);function oA(t,e){const{context:n,send:r,prop:i,scope:o}=t,s=n.get("value"),a=i("disabled"),l=!i("multiple"),u=i("rovingFocus"),c=i("orientation")==="horizontal";function d(h){const p=tA(o,h.value);return{id:p,disabled:!!(h.disabled||a),pressed:!!s.includes(h.value),focused:n.get("focusedId")===p}}return{value:s,setValue(h){r({type:"VALUE.SET",value:h})},getRootProps(){return e.element({...$f.root.attrs,id:nl(o),dir:i("dir"),role:l?"radiogroup":"group",tabIndex:n.get("isTabbingBackward")?-1:0,"data-disabled":G(a),"data-orientation":i("orientation"),"data-focus":G(n.get("focusedId")!=null),style:{outline:"none"},onMouseDown(){a||r({type:"ROOT.MOUSE_DOWN"})},onFocus(h){a||h.currentTarget===ct(h)&&(n.get("isClickFocus")||n.get("isTabbingBackward")||r({type:"ROOT.FOCUS"}))},onBlur(){a||r({type:"ROOT.BLUR"})}})},getItemState:d,getItemProps(h){const p=d(h),f=p.focused?0:-1;return e.button({...$f.item.attrs,id:p.id,type:"button","data-ownedby":nl(o),"data-focus":G(p.focused),disabled:p.disabled,tabIndex:u?f:void 0,role:l?"radio":void 0,"aria-checked":l?p.pressed:void 0,"aria-pressed":l?void 0:p.pressed,"data-disabled":G(p.disabled),"data-orientation":i("orientation"),dir:i("dir"),"data-state":p.pressed?"on":"off",onFocus(){p.disabled||r({type:"TOGGLE.FOCUS",id:p.id})},onClick(m){p.disabled||(r({type:"TOGGLE.CLICK",id:p.id,value:h.value}),rx()&&m.currentTarget.focus({preventScroll:!0}))},onKeyDown(m){if(m.defaultPrevented||!sx(m)||p.disabled)return;const g={Tab(y){const b=y.shiftKey;r({type:"TOGGLE.SHIFT_TAB",isShiftTab:b})},ArrowLeft(){!u||!c||r({type:"TOGGLE.FOCUS_PREV"})},ArrowRight(){!u||!c||r({type:"TOGGLE.FOCUS_NEXT"})},ArrowUp(){!u||c||r({type:"TOGGLE.FOCUS_PREV"})},ArrowDown(){!u||c||r({type:"TOGGLE.FOCUS_NEXT"})},Home(){u&&r({type:"TOGGLE.FOCUS_FIRST"})},End(){u&&r({type:"TOGGLE.FOCUS_LAST"})}}[iv(m)];g&&(g(m),m.key!=="Tab"&&m.preventDefault())}})}}}var{not:zf,and:sA}=eu(),aA={props({props:t}){return{defaultValue:[],orientation:"horizontal",rovingFocus:!0,loopFocus:!0,...t}},initialState(){return"idle"},context({prop:t,bindable:e}){return{value:e(()=>({defaultValue:t("defaultValue"),value:t("value"),onChange(n){var r;(r=t("onValueChange"))==null||r({value:n})}})),focusedId:e(()=>({defaultValue:null})),isTabbingBackward:e(()=>({defaultValue:!1})),isClickFocus:e(()=>({defaultValue:!1})),isWithinToolbar:e(()=>({defaultValue:!1}))}},computed:{currentLoopFocus:({context:t,prop:e})=>e("loopFocus")&&!t.get("isWithinToolbar")},entry:["checkIfWithinToolbar"],on:{"VALUE.SET":{actions:["setValue"]},"TOGGLE.CLICK":{actions:["setValue"]},"ROOT.MOUSE_DOWN":{actions:["setClickFocus"]}},states:{idle:{on:{"ROOT.FOCUS":{target:"focused",guard:zf(sA("isClickFocus","isTabbingBackward")),actions:["focusFirstToggle","clearClickFocus"]},"TOGGLE.FOCUS":{target:"focused",actions:["setFocusedId"]}}},focused:{on:{"ROOT.BLUR":{target:"idle",actions:["clearIsTabbingBackward","clearFocusedId"]},"TOGGLE.FOCUS":{actions:["setFocusedId"]},"TOGGLE.FOCUS_NEXT":{actions:["focusNextToggle"]},"TOGGLE.FOCUS_PREV":{actions:["focusPrevToggle"]},"TOGGLE.FOCUS_FIRST":{actions:["focusFirstToggle"]},"TOGGLE.FOCUS_LAST":{actions:["focusLastToggle"]},"TOGGLE.SHIFT_TAB":[{guard:zf("isFirstToggleFocused"),target:"idle",actions:["setIsTabbingBackward"]},{actions:["setIsTabbingBackward"]}]}}},implementations:{guards:{isClickFocus:({context:t})=>t.get("isClickFocus"),isTabbingBackward:({context:t})=>t.get("isTabbingBackward"),isFirstToggleFocused:({context:t,scope:e})=>{var n;return t.get("focusedId")===((n=jf(e))==null?void 0:n.id)}},actions:{setIsTabbingBackward({context:t}){t.set("isTabbingBackward",!0)},clearIsTabbingBackward({context:t}){t.set("isTabbingBackward",!1)},setClickFocus({context:t}){t.set("isClickFocus",!0)},clearClickFocus({context:t}){t.set("isClickFocus",!1)},checkIfWithinToolbar({context:t,scope:e}){var n;const r=(n=By(e))==null?void 0:n.closest("[role=toolbar]");t.set("isWithinToolbar",!!r)},setFocusedId({context:t,event:e}){t.set("focusedId",e.id)},clearFocusedId({context:t}){t.set("focusedId",null)},setValue({context:t,event:e,prop:n}){p1(e,["value"]);let r=t.get("value");Yx(e.value)?r=e.value:n("multiple")?r=Jx(r,e.value):r=Ss(r,[e.value])?[]:[e.value],t.set("value",r)},focusNextToggle({context:t,scope:e,prop:n}){At(()=>{var r;const i=t.get("focusedId");i&&((r=rA(e,i,n("loopFocus")))==null||r.focus({preventScroll:!0}))})},focusPrevToggle({context:t,scope:e,prop:n}){At(()=>{var r;const i=t.get("focusedId");i&&((r=iA(e,i,n("loopFocus")))==null||r.focus({preventScroll:!0}))})},focusFirstToggle({scope:t}){At(()=>{var e;(e=jf(t))==null||e.focus({preventScroll:!0})})},focusLastToggle({scope:t}){At(()=>{var e;(e=nA(t))==null||e.focus({preventScroll:!0})})}}}};Wn()(["dir","disabled","getRootNode","id","ids","loopFocus","multiple","onValueChange","orientation","rovingFocus","value","defaultValue"]);Wn()(["value","disabled"]);const $y=te({__name:"ButtonGroup",props:{modelValue:{},items:{},dropdownItems:{},direction:{default:"horizontal"},multiple:{type:Boolean},disabled:{type:Boolean},getRootNode:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=pi(aA,{id:Qt(),...n,orientation:n.direction,defaultValue:n.modelValue,onValueChange:({value:a})=>{r("update:modelValue",a)},rovingFocus:!0,loopFocus:!0}),o=N(()=>oA(i,di)),s=X();return Ee(()=>{var a;return(a=s.value)==null?void 0:a.isOpen},a=>{a||!o.value.value.includes("dropdown")||o.value.setValue(o.value.value.filter(l=>l!=="dropdown"))}),Ee(()=>n.modelValue,a=>{o.value.setValue([...a])},{deep:!1}),(a,l)=>(E(),O("div",ne({class:["k-buttongroup",`k-buttongroup--direction-${a.direction}`]},o.value.getRootProps()),[P(a.$slots,"default",{getItemProps:o.value.getItemProps},()=>[a.items?(E(!0),O(Ie,{key:0},_t(a.items,({id:u,...c})=>(E(),B(ze,ne({class:"k-buttongroup__item",variant:"tertiary",ref_for:!0},{...c,...o.value.getItemProps({value:u})}),null,16))),256)):I("",!0)]),a.dropdownItems||a.$slots.dropdown?(E(),B(du,ne({key:0,ref_key:"dropdown",ref:s,keepOpen:!0,items:a.dropdownItems},o.value.getItemProps({value:"dropdown"})),{default:Z(({close:u})=>[P(a.$slots,"dropdown",{close:u,getItemProps:o.value.getItemProps})]),_:3},16,["items"])):I("",!0)],16))}}),lA=["href"],uA={class:"k-file-thumbnail__info"},cA=["value","disabled"],dA={class:"k-file-thumbnail__info-footer"},pA={key:0,class:"k-file-thumbnail__size"},hA=te({__name:"Thumbnail",props:{value:{},disabled:{type:Boolean},rename:{type:Boolean},sortable:{type:Boolean},icons:{},labels:{}},emits:["rename","delete"],setup(t,{emit:e}){const n=[{pattern:/text.*/,icon:"fa-pro-solid:file-alt"},{pattern:/image.*/,icon:"fa-pro-solid:file-image"},{pattern:/pdf/,icon:"fa-pro-solid:file-pdf"},{pattern:/word/,icon:"fa-pro-solid:file-word"},{pattern:/excel/,icon:"fa-pro-solid:file-excel"},{pattern:/powerpoint/,icon:"fa-pro-solid:file-powerpoint"},{pattern:/octet-stream|zip/,icon:"fa-pro-solid:file-archive"}],r=t,i=N(()=>{let p=[...n,...r.icons].find(f=>r.value.type.match(f.pattern));return p?.icon||"fa-pro-solid:file"}),o=N(()=>r.disabled?"a":"div"),s=N(()=>r.disabled?{click:p=>{p.preventDefault(),sd(r.value)}}:{}),a=N(()=>r.disabled?{title:r.disabled?"Download":null}:{});function l(){r.disabled||sd(r.value)}const u=X(),c=X([]),d=X();function h(){var p;(p=u.value)==null||p.blur()}return(p,f)=>(E(),B(Qe(o.value),ne({class:["k-file-thumbnail",{"k-file-thumbnail--clickable":p.disabled}]},a.value,Vg(s.value)),{default:Z(()=>[he(ni,{class:"k-file-thumbnail__preview",gap:"0rem",justify:"center",align:"center"},{default:Z(()=>[P(p.$slots,"icon",{},()=>[p.value.type.includes("image")?(E(),O("a",{key:0,href:p.value.url,target:"_blank"},[he(su,{class:"k-file-thumbnail__preview-image",src:p.value.url,alt:p.value.name,size:"contain",aspectRatio:"1/1"},null,8,["src","alt"])],8,lA)):(E(),B($(Ze),{key:1,icon:i.value,class:"k-file-thumbnail__preview-icon"},null,8,["icon"]))])]),_:3}),H("div",uA,[H("input",{type:"text",ref_key:"input",ref:u,class:"k-file-thumbnail__name",value:p.value.name,onKeypress:rp(h,["enter"]),disabled:p.disabled||!p.rename,onInput:f[0]||(f[0]=m=>p.$emit("rename",m.target.value))},null,40,cA),H("div",dA,[p.value.size?(E(),O("span",pA,se($(Dp)(p.value.size)),1)):I("",!0)])]),he($y,{modelValue:c.value,"onUpdate:modelValue":f[2]||(f[2]=m=>{c.value=m.filter(g=>g!=="download")}),disabled:p.disabled},{default:Z(({getItemProps:m})=>[p.value.url?(E(),B(ze,ne({key:0,is:"a",href:p.value.url,class:"k-file-thumbnail__download",onClick:Ba(l,["prevent"]),icon:"fa-pro-light:arrow-down-to-line",variant:"tertiary"},m({value:"download"})),null,16,["href"])):I("",!0)]),dropdown:Z(({close:m})=>[p.value.url?(E(),B(ze,{key:0,is:"a",href:p.value.url,class:"k-file-thumbnail__download",onClick:Ba(l,["prevent"]),iconRight:"fa-pro-light:arrow-down-to-line",label:p.labels.download,variant:"tertiary"},null,8,["href","label"])):I("",!0),he($(XO),null,{default:Z(({copy:g,copied:y})=>[p.value.url?(E(),B(ze,{key:0,class:"k-file-thumbnail__copy",iconRight:"fa-pro-light:copy",label:p.labels.copy,variant:"tertiary",promise:d.value,onClick:()=>{d.value=g(p.value.url)}},null,8,["label","promise","onClick"])):I("",!0)]),_:1}),p.disabled?I("",!0):(E(),B(ze,{key:1,variant:"danger",label:p.labels.delete,class:"k-file-thumbnail__delete",iconRight:"fa-pro-light:times",onClick:f[1]||(f[1]=g=>p.$emit("delete"))},null,8,["label"]))]),_:1},8,["modelValue","disabled"]),p.sortable?(E(),B($(Ze),{key:0,icon:"fa-pro-solid:arrows-alt-v",class:"k-file-thumbnail__handle"})):I("",!0)]),_:3},16,["class"]))}}),fA={key:0,class:"k-file__label-wrapper"},mA={key:1,class:"k-file__sublabel"},TL=te({__name:"File",props:{modelValue:{},label:{},sublabel:{},multiple:{type:Boolean},sortable:{type:Boolean,default:!0},upload:{type:Function,default:()=>(t,e,n)=>(console.warn("[@kvass-ui/file]: You need to setup the upload function before using this component!"),e(50),new Promise((r,i)=>{let o=new FileReader;o.onloadend=function(){r({url:o.result,type:t.type})},o.readAsDataURL(t)}))},uploadOptions:{},dropMessage:{default:"Drag a file here or <b>browse</b> to upload."},rename:{type:Boolean,default:!0},accept:{},serialize:{type:Function,default:t=>t},required:{type:Boolean},disabled:{type:Boolean},icons:{default:()=>[]},labels:{default:()=>({delete:"Delete",download:"Download",copy:"Copy link"})}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e;function i(u){r("update:modelValue",u)}function o(u){r("update:modelValue",n.multiple?(n.modelValue||[]).filter(c=>c!==u):null)}const s=N(()=>n.multiple||!n.modelValue),a=N({get(){return n.modelValue?n.modelValue instanceof Array?n.modelValue:[n.modelValue]:[]},set(u){n.multiple&&i(u)}}),l=Cn("k-file",{variants:{}});return(u,c)=>(E(),O("div",{class:Ce($(l)({}))},[u.label||u.sublabel||u.$slots.sublabel||u.$slots.label?(E(),O("div",fA,[u.label||u.$slots.label?(E(),O("label",{key:0,class:Ce(["k-file__label",{"k-file__label-required":u.required}])},[P(u.$slots,"label",{},()=>[$e(se(u.label),1)])],2)):I("",!0),u.sublabel||u.$slots.sublabel?(E(),O("span",mA,[P(u.$slots,"sublabel",{},()=>[$e(se(u.sublabel),1)])])):I("",!0)])):I("",!0),he(ni,{direction:"column"},{default:Z(()=>[a.value.length?(E(),B($(Fy),{key:0,modelValue:a.value,"onUpdate:modelValue":c[0]||(c[0]=d=>a.value=d),disabled:!u.multiple||!u.sortable,animation:200,class:"k-file__thumbnails","item-key":"url",handle:".k-file-thumbnail__handle"},{item:Z(({element:d,index:h})=>[(E(),B(hA,{key:d.url,disabled:u.disabled,sortable:!u.disabled&&u.sortable&&u.multiple&&a.value.length>1,rename:u.rename===!0,value:u.serialize(d),onRename:p=>d.name=p,onDelete:p=>o(d),icons:u.icons,labels:u.labels},Cs({_:2},[_t(u.$slots,(p,f)=>({name:f,fn:Z(()=>[P(u.$slots,f,{item:d})])}))]),1032,["disabled","sortable","rename","value","onRename","onDelete","icons","labels"]))]),_:3},8,["modelValue","disabled"])):I("",!0),s.value?(E(),B(UO,{key:1,accept:u.accept,ref:"input",value:u.modelValue,multiple:u.multiple,required:u.required,onInput:i,disabled:u.disabled,"upload-options":u.uploadOptions,upload:u.upload,dropMessage:u.dropMessage,rename:u.rename,labels:u.labels},{"drop-message":Z(({extensions:d})=>[P(u.$slots,"drop-message",{extensions:d})]),"custom-message":Z(()=>[P(u.$slots,"custom-message")]),_:3},8,["accept","value","multiple","required","disabled","upload-options","upload","dropMessage","rename","labels"])):I("",!0)]),_:3})],2))}}),jy=new Set,yt=new WeakMap,Gi=new WeakMap,ii=new WeakMap,hd=new WeakMap,gA=new WeakMap,Ji=new WeakMap,rl=new WeakMap,No=new WeakSet;let xr,Fp=0,Lp=0;const Rn="__aa_tgt",us="__aa_del",il="__aa_new",vA=t=>{const e=EA(t);e&&e.forEach(n=>CA(n))},yA=t=>{t.forEach(e=>{e.target===xr&&kA(),yt.has(e.target)&&hi(e.target)})};function bA(t){const e=hd.get(t);e?.disconnect();let n=yt.get(t),r=0;const i=5;n||(n=Xi(t),yt.set(t,n));const{offsetWidth:o,offsetHeight:s}=xr,a=[n.top-i,o-(n.left+i+n.width),s-(n.top+i+n.height),n.left-i].map(u=>`${-1*Math.floor(u)}px`).join(" "),l=new IntersectionObserver(()=>{++r>1&&hi(t)},{root:xr,threshold:1,rootMargin:a});l.observe(t),hd.set(t,l)}function hi(t){clearTimeout(rl.get(t));const e=vu(t),n=cs(e)?500:e.duration;rl.set(t,setTimeout(async()=>{const r=ii.get(t);try{await r?.finished,yt.set(t,Xi(t)),bA(t)}catch{}},n))}function kA(){clearTimeout(rl.get(xr)),rl.set(xr,setTimeout(()=>{jy.forEach(t=>Wy(t,e=>zy(()=>hi(e))))},100))}function wA(t){setTimeout(()=>{gA.set(t,setInterval(()=>zy(hi.bind(null,t)),2e3))},Math.round(2e3*Math.random()))}function zy(t){typeof requestIdleCallback=="function"?requestIdleCallback(()=>t()):requestAnimationFrame(()=>t())}let fd,Ho;const xA=typeof window<"u"&&"ResizeObserver"in window;xA&&(xr=document.documentElement,fd=new MutationObserver(vA),Ho=new ResizeObserver(yA),window.addEventListener("scroll",()=>{Lp=window.scrollY,Fp=window.scrollX}),Ho.observe(xr));function EA(t){return t.reduce((e,n)=>[...e,...Array.from(n.addedNodes),...Array.from(n.removedNodes)],[]).every(e=>e.nodeName==="#comment")?!1:t.reduce((e,n)=>{if(e===!1)return!1;if(n.target instanceof Element){if(oc(n.target),!e.has(n.target)){e.add(n.target);for(let r=0;r<n.target.children.length;r++){const i=n.target.children.item(r);if(i){if(us in i)return!1;oc(n.target,i),e.add(i)}}}if(n.removedNodes.length)for(let r=0;r<n.removedNodes.length;r++){const i=n.removedNodes[r];if(us in i)return!1;i instanceof Element&&(e.add(i),oc(n.target,i),Gi.set(i,[n.previousSibling,n.nextSibling]))}}return e},new Set)}function oc(t,e){!e&&!(Rn in t)?Object.defineProperty(t,Rn,{value:t}):e&&!(Rn in e)&&Object.defineProperty(e,Rn,{value:t})}function CA(t){var e;const n=t.isConnected,r=yt.has(t);n&&Gi.has(t)&&Gi.delete(t),ii.has(t)&&((e=ii.get(t))===null||e===void 0||e.cancel()),il in t?Hf(t):r&&n?TA(t):r&&!n?OA(t):Hf(t)}function ln(t){return Number(t.replace(/[^0-9.\-]/g,""))}function SA(t){let e=t.parentElement;for(;e;){if(e.scrollLeft||e.scrollTop)return{x:e.scrollLeft,y:e.scrollTop};e=e.parentElement}return{x:0,y:0}}function Xi(t){const e=t.getBoundingClientRect(),{x:n,y:r}=SA(t);return{top:e.top+r,left:e.left+n,width:e.width,height:e.height}}function Hy(t,e,n){let r=e.width,i=e.height,o=n.width,s=n.height;const a=getComputedStyle(t);if(a.getPropertyValue("box-sizing")==="content-box"){const l=ln(a.paddingTop)+ln(a.paddingBottom)+ln(a.borderTopWidth)+ln(a.borderBottomWidth),u=ln(a.paddingLeft)+ln(a.paddingRight)+ln(a.borderRightWidth)+ln(a.borderLeftWidth);r-=u,o-=u,i-=l,s-=l}return[r,o,i,s].map(Math.round)}function vu(t){return Rn in t&&Ji.has(t[Rn])?Ji.get(t[Rn]):{duration:250,easing:"ease-in-out"}}function qy(t){if(Rn in t)return t[Rn]}function Vp(t){const e=qy(t);return e?No.has(e):!1}function Wy(t,...e){e.forEach(n=>n(t,Ji.has(t)));for(let n=0;n<t.children.length;n++){const r=t.children.item(n);r&&e.forEach(i=>i(r,Ji.has(r)))}}function Bp(t){return Array.isArray(t)?t:[t]}function cs(t){return typeof t=="function"}function TA(t){const e=yt.get(t),n=Xi(t);if(!Vp(t))return yt.set(t,n);let r;if(!e)return;const i=vu(t);if(typeof i!="function"){const o=e.left-n.left,s=e.top-n.top,[a,l,u,c]=Hy(t,e,n),d={transform:`translate(${o}px, ${s}px)`},h={transform:"translate(0, 0)"};a!==l&&(d.width=`${a}px`,h.width=`${l}px`),u!==c&&(d.height=`${u}px`,h.height=`${c}px`),r=t.animate([d,h],{duration:i.duration,easing:i.easing})}else{const[o]=Bp(i(t,"remain",e,n));r=new Animation(o),r.play()}ii.set(t,r),yt.set(t,n),r.addEventListener("finish",hi.bind(null,t))}function Hf(t){il in t&&delete t[il];const e=Xi(t);yt.set(t,e);const n=vu(t);if(!Vp(t))return;let r;if(typeof n!="function")r=t.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:n.duration*1.5,easing:"ease-in"});else{const[i]=Bp(n(t,"add",e));r=new Animation(i),r.play()}ii.set(t,r),r.addEventListener("finish",hi.bind(null,t))}function qf(t,e){var n;t.remove(),yt.delete(t),Gi.delete(t),ii.delete(t),(n=hd.get(t))===null||n===void 0||n.disconnect(),setTimeout(()=>{if(us in t&&delete t[us],Object.defineProperty(t,il,{value:!0,configurable:!0}),e&&t instanceof HTMLElement)for(const r in e)t.style[r]=""},0)}function OA(t){var e;if(!Gi.has(t)||!yt.has(t))return;const[n,r]=Gi.get(t);Object.defineProperty(t,us,{value:!0,configurable:!0});const i=window.scrollX,o=window.scrollY;if(r&&r.parentNode&&r.parentNode instanceof Element?r.parentNode.insertBefore(t,r):n&&n.parentNode?n.parentNode.appendChild(t):(e=qy(t))===null||e===void 0||e.appendChild(t),!Vp(t))return qf(t);const[s,a,l,u]=MA(t),c=vu(t),d=yt.get(t);(i!==Fp||o!==Lp)&&AA(t,i,o,c);let h,p={position:"absolute",top:`${s}px`,left:`${a}px`,width:`${l}px`,height:`${u}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!cs(c))Object.assign(t.style,p),h=t.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:c.duration,easing:"ease-out"});else{const[f,m]=Bp(c(t,"remove",d));m?.styleReset!==!1&&(p=m?.styleReset||p,Object.assign(t.style,p)),h=new Animation(f),h.play()}ii.set(t,h),h.addEventListener("finish",qf.bind(null,t,p))}function AA(t,e,n,r){const i=Fp-e,o=Lp-n,s=document.documentElement.style.scrollBehavior;if(getComputedStyle(xr).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+i,window.scrollY+o),!t.parentElement)return;const a=t.parentElement;let l=a.clientHeight,u=a.clientWidth;const c=performance.now();function d(){requestAnimationFrame(()=>{if(!cs(r)){const h=l-a.clientHeight,p=u-a.clientWidth;c+r.duration>performance.now()?(window.scrollTo({left:window.scrollX-p,top:window.scrollY-h}),l=a.clientHeight,u=a.clientWidth,d()):document.documentElement.style.scrollBehavior=s}})}d()}function MA(t){const e=yt.get(t),[n,,r]=Hy(t,e,Xi(t));let i=t.parentElement;for(;i&&(getComputedStyle(i).position==="static"||i instanceof HTMLBodyElement);)i=i.parentElement;i||(i=document.body);const o=getComputedStyle(i),s=yt.get(i)||Xi(i),a=Math.round(e.top-s.top)-ln(o.borderTopWidth),l=Math.round(e.left-s.left)-ln(o.borderLeftWidth);return[a,l,n,r]}function _A(t,e={}){return fd&&Ho&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!cs(e)&&!e.disrespectUserMotionPreference||(No.add(t),getComputedStyle(t).position==="static"&&Object.assign(t.style,{position:"relative"}),Wy(t,hi,wA,n=>Ho?.observe(n)),cs(e)?Ji.set(t,e):Ji.set(t,{duration:250,easing:"ease-in-out",...e}),fd.observe(t,{childList:!0}),jy.add(t))),Object.freeze({parent:t,enable:()=>{No.add(t)},disable:()=>{No.delete(t)},isEnabled:()=>No.has(t)})}const Wf={mounted:(t,e)=>{_A(t,e.value||{})},getSSRProps:()=>({})},DA=["disabled"],NA={key:0,class:"k-expandable__title"},IA={key:1,class:"k-expandable__subtitle"},RA={key:2,class:"k-expandable__actions"},OL=te({__name:"Expandable",props:{title:{},subtitle:{},disabled:{type:Boolean,default:!1},expandable:{type:Boolean,default:!0},expanded:{type:Boolean,default:!1},variant:{default:"border"},gap:{default:"1rem"}},setup(t){const e=t,n=np(),r=N(()=>n.actions),i=N(()=>n.footer),o=N(()=>n.default),s=X(e.expanded),a=()=>{!e.expandable||!o.value||(s.value=!s.value)},l=Cn("k-expandable",{variants:{disabled:{true:"k-expandable--disabled"},expandable:{true:"k-expandable--expandable"},expanded:{true:"k-expandable--expanded",false:"k-expandable--collapsed"},variant:{shadow:"k-expandable--variant-shadow",flat:"k-expandable--variant-flat",border:"k-expandable--variant-border"}}});return(u,c)=>Va((E(),O("fieldset",{disabled:u.disabled,class:Ce($(l)({disabled:u.disabled,expandable:u.expandable,expanded:s.value,variant:u.variant}))},[he(ze,{class:Ce(["k-expandable__header",{"k-expandable__header--open":s.value}]),is:"legend",tabindex:"0",onKeydown:rp(a,["enter"]),onClick:a,variant:"tertiary"},Cs({default:Z(()=>[u.$slots.title||u.title?(E(),O("span",NA,[P(u.$slots,"title",{},()=>[$e(se(u.title),1)])])):I("",!0),u.$slots.subtitle||u.subtitle?(E(),O("span",IA,[P(u.$slots,"subtitle",{},()=>[$e(se(u.subtitle),1)])])):I("",!0),r.value?(E(),O("span",RA,[P(u.$slots,"actions")])):I("",!0)]),_:2},[u.expandable?{name:"icon-left",fn:Z(()=>[he($(Ze),{class:"k-expandable__icon",icon:s.value?"fa-pro-regular:angle-up":"fa-pro-regular:angle-down"},null,8,["icon"])]),key:"0"}:void 0]),1032,["class"]),s.value&&o.value?(E(),O(Ie,{key:0},[Va((E(),B(ni,{class:"k-expandable__content",direction:"column",gap:u.gap},{default:Z(()=>[P(u.$slots,"default")]),_:3},8,["gap"])),[[$(Wf)]]),i.value?(E(),B(ni,{key:0,justify:"center",align:"center",class:"k-expandable__footer"},{default:Z(()=>[P(u.$slots,"footer")]),_:3})):I("",!0)],64)):I("",!0)],10,DA)),[[$(Wf)]])}});function Je(t){this.content=t}Je.prototype={constructor:Je,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),o=r.content.slice();return i==-1?o.push(n||t,e):(o[i+1]=e,n&&(o[i]=n)),new Je(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Je(n)},addToStart:function(t,e){return new Je([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Je(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),o=r.find(t);return i.splice(o==-1?i.length:o,0,e,n),new Je(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Je.from(t),t.size?new Je(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Je.from(t),t.size?new Je(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Je.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Je.from=function(t){if(t instanceof Je)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Je(e)};function Uy(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)n++;return n}if(i.content.size||o.content.size){let s=Uy(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function Ky(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),a=e.child(--o),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let u=0,c=Math.min(s.text.length,a.text.length);for(;u<c&&s.text[s.text.length-u-1]==a.text[a.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let u=Ky(s.content,a.content,n-1,r-1);if(u)return u}n-=l,r-=l}}class A{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,o){for(let s=0,a=0;a<n;s++){let l=this.content[s],u=a+l.nodeSize;if(u>e&&r(l,i+a,o||null,s)!==!1&&l.content.size){let c=a+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,i+c)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let u=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=u},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new A(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let o=0,s=0;s<n;o++){let a=this.content[o],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),i+=a.nodeSize),s=l}return new A(r,i)}cutByIndex(e,n){return e==n?A.empty:e==0&&n==this.content.length?this:new A(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new A(i,o)}addToStart(e){return new A([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new A(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return Uy(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Ky(this,e,n,r)}findIndex(e,n=-1){if(e==0)return la(0,e);if(e==this.size)return la(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),s=i+o.nodeSize;if(s>=e)return s==e||n>0?la(r+1,s):la(r,i);i=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return A.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new A(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return A.empty;let n,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(n||(n=e.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new A(n||e,r)}static from(e){if(!e)return A.empty;if(e instanceof A)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new A([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}A.empty=new A([],0);const sc={index:0,offset:0};function la(t,e){return sc.index=t,sc.offset=e,sc}function ol(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!ol(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!ol(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let ke=class md{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ol(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return md.none;if(e instanceof md)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};ke.none=[];class sl extends Error{}class V{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Jy(this.content,e+this.openStart,n);return r&&new V(r,this.openStart,this.openEnd)}removeBetween(e,n){return new V(Gy(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return V.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new V(A.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new V(e,r,i)}}V.empty=new V(A.empty,0,0);function Gy(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(i==e||o.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(Gy(o.content,e-i-1,n-i-1)))}function Jy(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),s=t.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=Jy(s.content,e-o-1,n);return a&&t.replaceChild(i,s.copy(a))}function PA(t,e,n){if(n.openStart>t.depth)throw new sl("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new sl("Inconsistent open depths");return Xy(t,e,n,0)}function Xy(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=Xy(t,e,n,r+1);return o.copy(o.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,a=s.content;return Xr(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=FA(n,t);return Xr(o,Zy(t,s,a,e,r))}else return Xr(o,al(t,e,r))}function Yy(t,e){if(!e.type.compatibleContent(t.type))throw new sl("Cannot join "+e.type.name+" onto "+t.type.name)}function gd(t,e,n){let r=t.node(n);return Yy(r,e.node(n)),r}function Jr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function qo(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Jr(t.nodeAfter,r),o++));for(let a=o;a<s;a++)Jr(i.child(a),r);e&&e.depth==n&&e.textOffset&&Jr(e.nodeBefore,r)}function Xr(t,e){return t.type.checkContent(e),t.copy(e)}function Zy(t,e,n,r,i){let o=t.depth>i&&gd(t,e,i+1),s=r.depth>i&&gd(n,r,i+1),a=[];return qo(null,t,i,a),o&&s&&e.index(i)==n.index(i)?(Yy(o,s),Jr(Xr(o,Zy(t,e,n,r,i+1)),a)):(o&&Jr(Xr(o,al(t,e,i+1)),a),qo(e,n,i,a),s&&Jr(Xr(s,al(n,r,i+1)),a)),qo(r,null,i,a),new A(a)}function al(t,e,n){let r=[];if(qo(null,t,n,r),t.depth>n){let i=gd(t,e,n+1);Jr(Xr(i,al(t,e,n+1)),r)}return qo(e,null,n,r),new A(r)}function FA(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)r=e.node(i).copy(A.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class ds{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return ke.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new ll(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(o),u=o-l;if(r.push(s,a,i+l),!u||(s=s.child(a),s.isText))break;o=u-1,i+=l+1}return new ds(n,r,o)}static resolveCached(e,n){let r=Uf.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==n)return s}else Uf.set(e,r=new LA);let i=r.elts[r.i]=ds.resolve(e,n);return r.i=(r.i+1)%VA,i}}class LA{constructor(){this.elts=[],this.i=0}}const VA=12,Uf=new WeakMap;class ll{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const BA=Object.create(null);let fr=class vd{constructor(e,n,r,i=ke.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||A.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&ol(this.attrs,n||e.defaultAttrs||BA)&&ke.sameSet(this.marks,r||ke.none)}copy(e=null){return e==this.content?this:new vd(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new vd(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return V.empty;let i=this.resolve(e),o=this.resolve(n),s=r?0:i.sharedDepth(n),a=i.start(s),l=i.node(s).content.cut(i.pos-a,o.pos-a);return new V(l,i.depth-s,o.depth-s)}replace(e,n,r){return PA(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return ds.resolveCached(this,e)}resolveNoCache(e){return ds.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Qy(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=A.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<o;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ke.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ke.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=A.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};fr.prototype.text=void 0;class ul extends fr{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Qy(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ul(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ul(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Qy(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class oi{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new $A(e,n);if(r.next==null)return oi.empty;let i=eb(r);r.next&&r.err("Unexpected trailing text");let o=KA(UA(i));return GA(o,r),o}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let o=n;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function o(s,a){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return A.from(a.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:c,next:d}=s.next[u];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let h=o(d,a.concat(c));if(h)return h}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:l}=o.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
9
- `)}}oi.empty=new oi(!0);class $A{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function eb(t){let e=[];do e.push(jA(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function jA(t){let e=[];do e.push(zA(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function zA(t){let e=WA(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=HA(t,e);else break;return e}function Kf(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function HA(t,e){let n=Kf(t),r=n;return t.eat(",")&&(t.next!="}"?r=Kf(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function qA(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let s=n[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function WA(t){if(t.eat("(")){let e=eb(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=qA(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function UA(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,l){let u={term:l,to:a};return e[s].push(u),u}function i(s,a){s.forEach(l=>l.to=a)}function o(s,a){if(s.type=="choice")return s.exprs.reduce((l,u)=>l.concat(o(u,a)),[]);if(s.type=="seq")for(let l=0;;l++){let u=o(s.exprs[l],a);if(l==s.exprs.length-1)return u;i(u,a=n())}else if(s.type=="star"){let l=n();return r(a,l),i(o(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return i(o(s.expr,a),l),i(o(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(o(s.expr,a));if(s.type=="range"){let l=a;for(let u=0;u<s.min;u++){let c=n();i(o(s.expr,l),c),l=c}if(s.max==-1)i(o(s.expr,l),l);else for(let u=s.min;u<s.max;u++){let c=n();r(l,c),i(o(s.expr,l),c),l=c}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function tb(t,e){return e-t}function Gf(t,e){let n=[];return r(e),n.sort(tb);function r(i){let o=t[i];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(i);for(let s=0;s<o.length;s++){let{term:a,to:l}=o[s];!a&&n.indexOf(l)==-1&&r(l)}}}function KA(t){let e=Object.create(null);return n(Gf(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:a,to:l})=>{if(!a)return;let u;for(let c=0;c<i.length;c++)i[c][0]==a&&(u=i[c][1]);Gf(t,l).forEach(c=>{u||i.push([a,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let o=e[r.join(",")]=new oi(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let a=i[s][1].sort(tb);o.next.push({type:i[s][0],next:e[a.join(",")]||n(a)})}return o}}function GA(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],o=!i.validEnd,s=[];for(let a=0;a<i.next.length;a++){let{type:l,next:u}=i.next[a];s.push(l.name),o&&!(l.isText||l.hasRequiredAttrs())&&(o=!1),r.indexOf(u)==-1&&r.push(u)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function nb(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function rb(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let o=t[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function ib(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let o=t[i];o.validate&&o.validate(e[i])}}function ob(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new XA(t,r,e[r]);return n}let Jf=class sb{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=ob(e,r.attrs),this.defaultAttrs=nb(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==oi.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:rb(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new fr(this,this.computeAttrs(e),A.from(n),ke.setFrom(r))}createChecked(e=null,n,r){return n=A.from(n),this.checkContent(n),new fr(this,this.computeAttrs(e),n,ke.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=A.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(A.empty,!0);return o?new fr(this,e,n.append(o),ke.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){ib(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:ke.none:e}static compile(e,n){let r=Object.create(null);e.forEach((o,s)=>r[o]=new sb(o,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function JA(t,e,n){let r=n.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${o}`)}}class XA{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?JA(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class yu{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=ob(e,i.attrs),this.excluded=null;let o=nb(this.attrs);this.instance=o?new ke(this,o):null}create(e=null){return!e&&this.instance?this.instance:new ke(this,rb(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new yu(o,i++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){ib(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class ab{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Je.from(e.nodes),n.marks=Je.from(e.marks||{}),this.nodes=Jf.compile(this.spec.nodes,this),this.marks=yu.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=oi.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=a=="_"?null:a?Xf(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:Xf(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Jf){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new ul(r,r.defaultAttrs,e,ke.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return fr.fromJSON(this,e)}markFromJSON(e){return ke.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Xf(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=t.marks[i],s=o;if(o)n.push(o);else for(let a in t.marks){let l=t.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function YA(t){return t.tag!=null}function ZA(t){return t.style!=null}class mr{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(YA(i))this.tags.push(i);else if(ZA(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let r=new Zf(this,n,!1);return r.addAll(e,ke.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Zf(this,n,!0);return r.addAll(e,ke.none,n.from,n.to),V.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(tM(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,n,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<o)break}n.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Qf(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Qf(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new mr(e,mr.schemaRules(e)))}}const lb={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},QA={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ub={ol:!0,ul:!0},ps=1,yd=2,Da=4;function Yf(t,e,n){return e!=null?(e?ps:0)|(e==="full"?yd:0):t&&t.whitespace=="pre"?ps|yd:n&-5}class ua{constructor(e,n,r,i,o,s){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=ke.none,this.match=o||(s&Da?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(A.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ps)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=A.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(A.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!lb.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Zf{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,o,s=Yf(null,n.preserveWhitespace,0)|(r?Da:0);i?o=new ua(i.type,i.attrs,ke.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new ua(null,null,ke.none,!0,null,s):o=new ua(e.schema.topNodeType,null,ke.none,!0,null,s),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,o=i.options&yd?"full":this.localPreserveWS||(i.options&ps)>0;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)o!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
10
- `);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let s=i.content[i.content.length-1],a=e.previousSibling;(!s||a&&a.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),n),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;ub.hasOwnProperty(s)&&this.parser.normalizeLists&&eM(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:QA.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let u,c=this.needsBlock;if(lb.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),u=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),u&&this.sync(o),this.needsBlock=c}else{let u=this.readStyles(e,n);u&&this.addElementByRule(e,l,u,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
11
- `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(o,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(u=>!l.clearMark(u)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,i){let o,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r)||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(o=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}o&&this.sync(a)&&this.open--}addAll(e,n,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];s!=a;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,n);this.findAtPoint(e,o)}findPlace(e,n){let r,i;for(let o=this.open;o>=0;o--){let s=this.nodes[o],a=s.findWrapping(e);if(a&&(!r||r.length>a.length)&&(r=a,i=s,!a.length)||s.solid)break}if(!r)return null;this.sync(i);for(let o=0;o<r.length;o++)n=this.enterInner(r[o],null,n,!1);return n}insertNode(e,n){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let r=this.findPlace(e,n);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=ke.none;for(let s of r.concat(e.marks))(i.type?i.type.allowsMarkType(s.type):em(s.type,e.type))&&(o=s.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let o=this.findPlace(e.create(n),r);return o&&(o=this.enterInner(e,n,r,!0,i)),o}enterInner(e,n,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=Yf(e,o,s.options);s.options&Da&&s.content.length==0&&(a|=Da);let l=ke.none;return r=r.filter(u=>(s.type?s.type.allowsMarkType(u.type):em(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new ua(e,n,l,i,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=ps)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(a,l)=>{for(;a>=0;a--){let u=n[a];if(u==""){if(a==n.length-1||a==0)continue;for(;l>=o;l--)if(s(a-1,l))return!0;return!1}else{let c=l>0||l==0&&i?this.nodes[l].type:r&&l>=o?r.node(l-o).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function eM(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&ub.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function tM(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Qf(t){let e={};for(let n in t)e[n]=t[n];return e}function em(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=a=>{o.push(a);for(let l=0;l<a.edgeCount;l++){let{type:u,next:c}=a.edge(l);if(u==e||o.indexOf(c)<0&&s(c))return!0}};if(s(i.contentMatch))return!0}}class fi{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=ac(n).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let a=0,l=0;for(;a<o.length&&l<s.marks.length;){let u=s.marks[l];if(!this.marks[u.type.name]){l++;continue}if(!u.eq(o[a][0])||u.type.spec.spanning===!1)break;a++,l++}for(;a<o.length;)i=o.pop()[1];for(;l<s.marks.length;){let u=s.marks[l++],c=this.serializeMark(u,s.isInline,n);c&&(o.push([u,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Na(ac(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Na(ac(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Na(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new fi(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=tm(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return tm(e.marks)}}function tm(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ac(t){return t.document||window.document}const nm=new WeakMap;function nM(t){let e=nm.get(t);return e===void 0&&nm.set(t,e=rM(t)),e}function rM(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function Na(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=nM(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),u=e[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let d in u)if(u[d]!=null){let h=d.indexOf(" ");h>0?l.setAttributeNS(d.slice(0,h),d.slice(h+1),u[d]):l.setAttribute(d,u[d])}}for(let d=c;d<e.length;d++){let h=e[d];if(h===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:p,contentDOM:f}=Na(t,h,n,r);if(l.appendChild(p),f){if(a)throw new RangeError("Multiple content holes");a=f}}}return{dom:l,contentDOM:a}}const cb=65535,db=Math.pow(2,16);function iM(t,e){return t+e*db}function rm(t){return t&cb}function oM(t){return(t-(t&cb))/db}const pb=1,hb=2,Ia=4,fb=8;class bd{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&fb)>0}get deletedBefore(){return(this.delInfo&(pb|Ia))>0}get deletedAfter(){return(this.delInfo&(hb|Ia))>0}get deletedAcross(){return(this.delInfo&Ia)>0}}class Ot{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Ot.empty)return Ot.empty}recover(e){let n=0,r=rm(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+oM(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let u=this.ranges[a+o],c=this.ranges[a+s],d=l+u;if(e<=d){let h=u?e==l?-1:e==d?1:n:n,p=l+i+(h<0?0:c);if(r)return p;let f=e==(n<0?l:d)?null:iM(a/3,e-l),m=e==l?hb:e==d?pb:Ia;return(n<0?e!=l:e!=d)&&(m|=fb),new bd(p,m,f)}i+=c-u}return r?e+i:new bd(e+i,0,null)}touches(e,n){let r=0,i=rm(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let u=this.ranges[a+o],c=l+u;if(e<=c&&a==i*3)return!0;r+=this.ranges[a+s]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),u=this.ranges[i+n],c=this.ranges[i+r];e(a,a+u,l,l+c),o+=c-u}}invert(){return new Ot(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ot.empty:new Ot(e<0?[0,-e,0]:[0,0,e])}}Ot.empty=new Ot([]);class Bi{constructor(e=[],n,r=0,i=e.length){this.maps=e,this.mirror=n,this.from=r,this.to=i}slice(e=0,n=this.maps.length){return new Bi(this.maps,this.mirror,e,n)}copy(){return new Bi(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,n){this.to=this.maps.push(e),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(e){for(let n=0,r=this.maps.length;n<e.maps.length;n++){let i=e.getMirror(n);this.appendMap(e.maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this.maps.length+e.maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e.maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Bi;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this.maps[o],a=s.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(o);if(l!=null&&l>o&&l<this.to){o=l,e=this.maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new bd(e,i,null)}}const lc=Object.create(null);class st{getMap(){return Ot.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=lc[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in lc)throw new RangeError("Duplicate use of step JSON ID "+e);return lc[e]=n,n.prototype.jsonID=e,n}}class Fe{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Fe(e,null)}static fail(e){return new Fe(null,e)}static fromReplace(e,n,r,i){try{return Fe.ok(e.replace(n,r,i))}catch(o){if(o instanceof sl)return Fe.fail(o.message);throw o}}}function $p(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy($p(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return A.fromArray(r)}class ar extends st{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new V($p(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return Fe.fromReplace(e,this.from,this.to,o)}invert(){return new mn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ar(n.pos,r.pos,this.mark)}merge(e){return e instanceof ar&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ar(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ar(n.from,n.to,e.markFromJSON(n.mark))}}st.jsonID("addMark",ar);class mn extends st{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new V($p(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Fe.fromReplace(e,this.from,this.to,r)}invert(){return new ar(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new mn(n.pos,r.pos,this.mark)}merge(e){return e instanceof mn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new mn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new mn(n.from,n.to,e.markFromJSON(n.mark))}}st.jsonID("removeMark",mn);class lr extends st{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Fe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Fe.fromReplace(e,this.pos,this.pos+1,new V(A.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new lr(this.pos,n.marks[i]);return new lr(this.pos,this.mark)}}return new Yi(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new lr(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new lr(n.pos,e.markFromJSON(n.mark))}}st.jsonID("addNodeMark",lr);class Yi extends st{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Fe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Fe.fromReplace(e,this.pos,this.pos+1,new V(A.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new lr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Yi(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Yi(n.pos,e.markFromJSON(n.mark))}}st.jsonID("removeNodeMark",Yi);class je extends st{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&kd(e,this.from,this.to)?Fe.fail("Structure replace would overwrite content"):Fe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ot([this.from,this.to-this.from,this.slice.size])}invert(e){return new je(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new je(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(e){if(!(e instanceof je)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?V.empty:new V(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new je(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?V.empty:new V(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new je(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new je(n.from,n.to,V.fromJSON(e,n.slice),!!n.structure)}}st.jsonID("replace",je);class qe extends st{constructor(e,n,r,i,o,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(e){if(this.structure&&(kd(e,this.from,this.gapFrom)||kd(e,this.gapTo,this.to)))return Fe.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Fe.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Fe.fromReplace(e,this.from,this.to,r):Fe.fail("Content does not fit in gap")}getMap(){return new Ot([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new qe(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new qe(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new qe(n.from,n.to,n.gapFrom,n.gapTo,V.fromJSON(e,n.slice),n.insert,!!n.structure)}}st.jsonID("replaceAround",qe);function kd(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function sM(t,e,n,r){let i=[],o=[],s,a;t.doc.nodesBetween(e,n,(l,u,c)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let h=Math.max(u,e),p=Math.min(u+l.nodeSize,n),f=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(f)||(s&&s.to==h&&s.mark.eq(d[m])?s.to=p:i.push(s=new mn(h,p,d[m])));a&&a.to==h?a.to=p:o.push(a=new ar(h,p,r))}}),i.forEach(l=>t.step(l)),o.forEach(l=>t.step(l))}function aM(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;o++;let l=null;if(r instanceof yu){let u=s.marks,c;for(;c=r.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let u=Math.min(a+s.nodeSize,n);for(let c=0;c<l.length;c++){let d=l[c],h;for(let p=0;p<i.length;p++){let f=i[p];f.step==o-1&&d.eq(i[p].style)&&(h=f)}h?(h.to=u,h.step=o):i.push({style:d,from:Math.max(a,e),to:u,step:o})}}}),i.forEach(s=>t.step(new mn(s.from,s.to,s.style)))}function jp(t,e,n,r=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l<o.childCount;l++){let u=o.child(l),c=a+u.nodeSize,d=r.matchType(u.type);if(!d)s.push(new je(a,c,V.empty));else{r=d;for(let h=0;h<u.marks.length;h++)n.allowsMarkType(u.marks[h].type)||t.step(new mn(a,c,u.marks[h]));if(i&&u.isText&&n.whitespace!="pre"){let h,p=/\r?\n|\r/g,f;for(;h=p.exec(u.text);)f||(f=new V(A.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),s.push(new je(a+h.index,a+h.index+h[0].length,f))}}a=c}if(!r.validEnd){let l=r.fillBefore(A.empty,!0);t.replace(a,a,new V(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function lM(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function uo(t){let e=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth;;--n){let r=t.$from.node(n),i=t.$from.index(n),o=t.$to.indexAfter(n);if(n<t.depth&&r.canReplace(i,o,e))return n;if(n==0||r.type.spec.isolating||!lM(r,i,o))break}return null}function uM(t,e,n){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),a=i.after(o+1),l=s,u=a,c=A.empty,d=0;for(let f=o,m=!1;f>n;f--)m||r.index(f)>0?(m=!0,c=A.from(r.node(f).copy(c)),d++):l--;let h=A.empty,p=0;for(let f=o,m=!1;f>n;f--)m||i.after(f+1)<i.end(f)?(m=!0,h=A.from(i.node(f).copy(h)),p++):u++;t.step(new qe(l,u,s,a,new V(c.append(h),d,p),c.size-d,!0))}function zp(t,e,n=null,r=t){let i=cM(t,e),o=i&&dM(r,e);return o?i.map(im).concat({type:e,attrs:n}).concat(o.map(im)):null}function im(t){return{type:t,attrs:null}}function cM(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return n.canReplaceWith(r,i,s)?o:null}function dM(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let l=r;a&&l<i;l++)a=a.matchType(n.child(l).type);return!a||!a.validEnd?null:s}function pM(t,e,n){let r=A.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=A.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new qe(i,o,i,o,new V(r,0,0),n.length,!0))}function hM(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,l)&&fM(t.doc,t.mapping.slice(o).map(a),r)){let u=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",f=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!f?u=!1:!p&&f&&(u=!0)}u===!1&&gb(t,s,a,o),jp(t,t.mapping.slice(o).map(a,1),r,void 0,u===null);let c=t.mapping.slice(o),d=c.map(a,1),h=c.map(a+s.nodeSize,1);return t.step(new qe(d,h,d+1,h-1,new V(A.from(r.create(l,null,s.marks)),0,0),1,!0)),u===!0&&mb(t,s,a,o),!1}})}function mb(t,e,n,r){e.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+o+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function gb(t,e,n,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+o);t.replaceWith(s,s+1,e.type.schema.text(`
12
- `))}})}function fM(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function mM(t,e,n,r,i){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,s);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new qe(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new V(A.from(s),0,0),1,!0))}function $i(t,e,n=1,r){let i=t.resolve(e),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,c=n-2;u>o;u--,c--){let d=i.node(u),h=i.index(u);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(h,d.childCount),f=r&&r[c+1];f&&(p=p.replaceChild(0,f.type.create(f.attrs)));let m=r&&r[c]||d;if(!d.canReplace(h+1,d.childCount)||!m.type.validContent(p))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function gM(t,e,n=1,r){let i=t.doc.resolve(e),o=A.empty,s=A.empty;for(let a=i.depth,l=i.depth-n,u=n-1;a>l;a--,u--){o=A.from(i.node(a).copy(o));let c=r&&r[u];s=A.from(c?c.type.create(c.attrs,s):i.node(a).copy(s))}t.step(new je(e,e,new V(o.append(s),n,n),!0))}function Sr(t,e){let n=t.resolve(e),r=n.index();return vb(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function vM(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),s=o.type==r?t.type.schema.nodes.text:o.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(o.marks))return!1}return n.validEnd}function vb(t,e){return!!(t&&e&&!t.isLeaf&&vM(t,e))}function bu(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let o,s,a=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):n>0?(o=r.node(i+1),a++,s=r.node(i).maybeChild(a)):(o=r.node(i).maybeChild(a-1),s=r.node(i+1)),o&&!o.isTextblock&&vb(o,s)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function yM(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,o=t.doc.resolve(e-n),s=o.node().type;if(i&&s.inlineContent){let c=s.whitespace=="pre",d=!!s.contentMatch.matchType(i);c&&!d?r=!1:!c&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let c=t.doc.resolve(e+n);gb(t,c.node(),c.before(),a)}s.inlineContent&&jp(t,e+n-1,s,o.node().contentMatchAt(o.index()),r==null);let l=t.mapping.slice(a),u=l.map(e-n);if(t.step(new je(u,l.map(e+n,-1),V.empty,!0)),r===!0){let c=t.doc.resolve(u);mb(t,c.node(),c.before(),t.steps.length)}return t}function bM(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,n))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function yb(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let o=0;o<n.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(n.openStart==0&&n.size?2:1);o++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),u=r.node(s),c=!1;if(o==1)c=u.canReplace(l,l,i);else{let d=u.contentMatchAt(l).findWrapping(i.firstChild.type);c=d&&u.canReplaceWith(l,l,d[0])}if(c)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function ku(t,e,n=e,r=V.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return bb(i,o,r)?new je(e,n,r):new kM(i,o,r).fit()}function bb(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class kM{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=A.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=A.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let l=new V(o,s,a);return e>-1?new qe(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new je(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=n.firstChild;if(n.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=uc(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:u}=this.frontier[a],c,d=null;if(n==1&&(s?u.matchType(s.type)||(d=u.fillBefore(A.from(s),!1)):o&&l.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:a,parent:o,inject:d};if(n==2&&s&&(c=u.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:o,wrap:c};if(o&&u.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=uc(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new V(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=uc(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new V(Io(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new V(Io(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let m=0;m<o.length;m++)this.openFrontierNode(o[m]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-e,u=0,c=[],{match:d,type:h}=this.frontier[n];if(i){for(let m=0;m<i.childCount;m++)c.push(i.child(m));d=d.matchFragment(i)}let p=a.size+e-(s.content.size-s.openEnd);for(;u<a.childCount;){let m=a.child(u),g=d.matchType(m.type);if(!g)break;u++,(u>1||l==0||m.content.size)&&(d=g,c.push(kb(m.mark(h.allowedMarks(m.marks)),u==1?l:0,u==a.childCount?p:-1)))}let f=u==a.childCount;f||(p=-1),this.placed=Ro(this.placed,n,A.from(c)),this.frontier[n].match=d,f&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<p;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=f?e==0?V.empty:new V(Io(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new V(Io(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!cc(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=cc(e,n,i,r,o);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:u}=this.frontier[a],c=cc(e,a,u,l,!0);if(!c||c.childCount)continue e}return{depth:n,fit:s,move:o?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Ro(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Ro(this.placed,this.depth,A.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(A.empty,!0);e.childCount&&(this.placed=Ro(this.placed,this.frontier.length,e))}}function Io(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Io(t.firstChild.content,e-1,n)))}function Ro(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Ro(t.lastChild.content,e-1,n)))}function uc(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function kb(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,kb(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(A.empty,!0)))),t.copy(r)}function cc(t,e,n,r,i){let o=t.node(e),s=i?t.indexAfter(e):t.index(e);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!wM(n,o.content,s)?a:null}function wM(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function xM(t){return t.spec.defining||t.spec.definingForContent}function EM(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),o=t.doc.resolve(n);if(bb(i,o,r))return t.step(new je(e,n,r));let s=xb(i,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let a=-(i.depth+1);s.unshift(a);for(let h=i.depth,p=i.pos-1;h>0;h--,p--){let f=i.node(h).type.spec;if(f.defining||f.definingAsContext||f.isolating)break;s.indexOf(h)>-1?a=h:i.before(h)==p&&s.splice(1,0,-h)}let l=s.indexOf(a),u=[],c=r.openStart;for(let h=r.content,p=0;;p++){let f=h.firstChild;if(u.push(f),p==r.openStart)break;h=f.content}for(let h=c-1;h>=0;h--){let p=u[h],f=xM(p.type);if(f&&!p.sameMarkup(i.node(Math.abs(a)-1)))c=h;else if(f||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+c+1)%(r.openStart+1),f=u[p];if(f)for(let m=0;m<s.length;m++){let g=s[(m+l)%s.length],y=!0;g<0&&(y=!1,g=-g);let b=i.node(g-1),k=i.index(g-1);if(b.canReplaceWith(k,k,f.type,f.marks))return t.replace(i.before(g),y?o.after(g):n,new V(wb(r.content,0,r.openStart,p),p,r.openEnd))}}let d=t.steps.length;for(let h=s.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>d));h--){let p=s[h];p<0||(e=i.before(p),n=o.after(p))}}function wb(t,e,n,r,i){if(e<n){let o=t.firstChild;t=t.replaceChild(0,o.copy(wb(o.content,e+1,n,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(t).append(t);t=s.append(o.matchFragment(s).fillBefore(A.empty,!0))}return t}function CM(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=bM(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new V(A.from(r),0,0))}function SM(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=xb(r,i);for(let s=0;s<o.length;s++){let a=o[s],l=s==o.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function xb(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let o=t.start(i);if(o<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&n.push(i)}return n}class ji extends st{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Fe.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Fe.fromReplace(e,this.pos,this.pos+1,new V(A.from(i),0,n.isLeaf?0:1))}getMap(){return Ot.empty}invert(e){return new ji(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ji(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ji(n.pos,n.attr,n.value)}}st.jsonID("attr",ji);class hs extends st{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Fe.ok(r)}getMap(){return Ot.empty}invert(e){return new hs(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new hs(n.attr,n.value)}}st.jsonID("docAttr",hs);let Zi=class extends Error{};Zi=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Zi.prototype=Object.create(Error.prototype);Zi.prototype.constructor=Zi;Zi.prototype.name="TransformError";class Eb{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Bi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Zi(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=V.empty){let i=ku(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new V(A.from(r),0,0))}delete(e,n){return this.replace(e,n,V.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return EM(this,e,n,r),this}replaceRangeWith(e,n,r){return CM(this,e,n,r),this}deleteRange(e,n){return SM(this,e,n),this}lift(e,n){return uM(this,e,n),this}join(e,n=1){return yM(this,e,n),this}wrap(e,n){return pM(this,e,n),this}setBlockType(e,n=e,r,i=null){return hM(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return mM(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new ji(e,n,r)),this}setDocAttribute(e,n){return this.step(new hs(e,n)),this}addNodeMark(e,n){return this.step(new lr(e,n)),this}removeNodeMark(e,n){if(!(n instanceof ke)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new Yi(e,n)),this}split(e,n=1,r){return gM(this,e,n,r),this}addMark(e,n,r){return sM(this,e,n,r),this}removeMark(e,n,r){return aM(this,e,n,r),this}clearIncompatible(e,n,r){return jp(this,e,n,r),this}}const dc=Object.create(null);class le{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new TM(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=V.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:u}=s[a],c=e.mapping.slice(o);e.replaceRange(c.map(l.pos),c.map(u.pos),a?V.empty:n),a==0&&am(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:a}=i[o],l=e.mapping.slice(r),u=l.map(s.pos),c=l.map(a.pos);o?e.deleteRange(u,c):(e.replaceRangeWith(u,c,n),am(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new oe(e):Oi(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=n<0?Oi(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Oi(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new jt(e.node(0))}static atStart(e){return Oi(e,e,0,0,1)||new jt(e)}static atEnd(e){return Oi(e,e,e.content.size,e.childCount,-1)||new jt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=dc[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in dc)throw new RangeError("Duplicate use of selection JSON ID "+e);return dc[e]=n,n.prototype.jsonID=e,n}getBookmark(){return oe.between(this.$anchor,this.$head).getBookmark()}}le.prototype.visible=!0;class TM{constructor(e,n){this.$from=e,this.$to=n}}let om=!1;function sm(t){!om&&!t.parent.inlineContent&&(om=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class oe extends le{constructor(e,n=e){sm(e),sm(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return le.near(r);let i=e.resolve(n.map(this.anchor));return new oe(i.parent.inlineContent?i:r,r)}replace(e,n=V.empty){if(super.replace(e,n),n==V.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof oe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new wu(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new oe(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=le.findFrom(n,r,!0)||le.findFrom(n,-r,!0);if(o)n=o.$head;else return le.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(le.findFrom(e,-r,!0)||le.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new oe(e,n)}}le.jsonID("text",oe);class wu{constructor(e,n){this.anchor=e,this.head=n}map(e){return new wu(e.map(this.anchor),e.map(this.head))}resolve(e){return oe.between(e.resolve(this.anchor),e.resolve(this.head))}}class Y extends le{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),o=e.resolve(i);return r?le.near(o):new Y(o)}content(){return new V(A.from(this.node),0,0)}eq(e){return e instanceof Y&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Hp(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Y(e.resolve(n.anchor))}static create(e,n){return new Y(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Y.prototype.visible=!1;le.jsonID("node",Y);class Hp{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new wu(r,r):new Hp(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Y.isSelectable(r)?new Y(n):le.near(n)}}class jt extends le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=V.empty){if(n==V.empty){e.delete(0,e.doc.content.size);let r=le.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new jt(e)}map(e){return new jt(e)}eq(e){return e instanceof jt}getBookmark(){return OM}}le.jsonID("all",jt);const OM={map(){return this},resolve(t){return new jt(t)}};function Oi(t,e,n,r,i,o=!1){if(e.inlineContent)return oe.create(t,n);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let a=e.child(s);if(a.isAtom){if(!o&&Y.isSelectable(a))return Y.create(t,n-(i<0?a.nodeSize:0))}else{let l=Oi(t,a,n+i,i<0?a.childCount:0,i,o);if(l)return l}n+=a.nodeSize*i}return null}function am(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof je||i instanceof qe))return;let o=t.mapping.maps[r],s;o.forEach((a,l,u,c)=>{s==null&&(s=c)}),t.setSelection(le.near(t.doc.resolve(s),n))}const lm=1,um=2,cm=4;class AM extends Eb{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|lm)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&lm)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=um,this}ensureMarks(e){return ke.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&um)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ke.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(n);o=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,o)),this.selection.empty||this.setSelection(le.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=cm,this}get scrolledIntoView(){return(this.updated&cm)>0}}function dm(t,e){return!e||!t?t:t.bind(e)}class Po{constructor(e,n,r){this.name=e,this.init=dm(n.init,r),this.apply=dm(n.apply,r)}}const MM=[new Po("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Po("selection",{init(t,e){return t.selection||le.atStart(e.doc)},apply(t){return t.selection}}),new Po("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Po("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class pc{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=MM.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Po(r.key,r.spec.state,r))})}}class Ri{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=i?i[s].n:0,u=i?i[s].state:this,c=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,u,r);if(c&&r.filterTransaction(c,s)){if(c.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(c),r=r.applyInner(c),o=!0}i&&(i[s]={state:r,n:n.length})}}if(!o)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Ri(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];n[o.name]=o.apply(e,this[o.name],this,n)}return n}get tr(){return new AM(this)}static create(e){let n=new pc(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Ri(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new pc(this.schema,e.plugins),r=n.fields,i=new Ri(n);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new pc(e.schema,e.plugins),o=new Ri(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=fr.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=le.fromJSON(o.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],u=l.spec.state;if(l.key==s.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){o[s.name]=u.fromJSON.call(l,e,n[a],o);return}}o[s.name]=s.init(e,o)}}),o}}function Cb(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Cb(i,e,{})),n[r]=i}return n}class Ve{constructor(e){this.spec=e,this.props={},e.props&&Cb(e.props,this,this.props),this.key=e.key?e.key.key:Sb("plugin")}getState(e){return e[this.key]}}const hc=Object.create(null);function Sb(t){return t in hc?t+"$"+ ++hc[t]:(hc[t]=0,t+"$")}class at{constructor(e="key"){this.key=Sb(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Xe=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},fs=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let wd=null;const Nn=function(t,e,n){let r=wd||(wd=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},_M=function(){wd=null},si=function(t,e,n,r){return n&&(pm(t,e,n,r,-1)||pm(t,e,n,r,1))},DM=/^(img|br|input|textarea|hr)$/i;function pm(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:$t(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Ds(t)||DM.test(t.nodeName)||t.contentEditable=="false")return!1;e=Xe(t)+(i<0?0:1),t=o}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.contentEditable=="false")return!1;e=i<0?$t(t):0}else return!1}}function $t(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function NM(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=$t(t)}else if(t.parentNode&&!Ds(t))e=Xe(t),t=t.parentNode;else return null}}function IM(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Ds(t))e=Xe(t)+1,t=t.parentNode;else return null}}function RM(t,e,n){for(let r=e==0,i=e==$t(t);r||i;){if(t==n)return!0;let o=Xe(t);if(t=t.parentNode,!t)return!1;r=r&&o==0,i=i&&o==$t(t)}}function Ds(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const xu=function(t){return t.focusNode&&si(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function zr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function PM(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function FM(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min($t(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min($t(r.startContainer),r.startOffset)}}}const wn=typeof navigator<"u"?navigator:null,hm=typeof document<"u"?document:null,Tr=wn&&wn.userAgent||"",xd=/Edge\/(\d+)/.exec(Tr),Tb=/MSIE \d/.exec(Tr),Ed=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Tr),bt=!!(Tb||Ed||xd),gr=Tb?document.documentMode:Ed?+Ed[1]:xd?+xd[1]:0,nn=!bt&&/gecko\/(\d+)/i.test(Tr);nn&&+(/Firefox\/(\d+)/.exec(Tr)||[0,0])[1];const Cd=!bt&&/Chrome\/(\d+)/.exec(Tr),rt=!!Cd,Ob=Cd?+Cd[1]:0,pt=!bt&&!!wn&&/Apple Computer/.test(wn.vendor),Qi=pt&&(/Mobile\/\w+/.test(Tr)||!!wn&&wn.maxTouchPoints>2),Vt=Qi||(wn?/Mac/.test(wn.platform):!1),LM=wn?/Win/.test(wn.platform):!1,Pn=/Android \d/.test(Tr),Ns=!!hm&&"webkitFontSmoothing"in hm.documentElement.style,VM=Ns?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function BM(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function On(t,e){return typeof t=="number"?t:t[e]}function $M(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function fm(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let s=n||t.dom;s;s=fs(s)){if(s.nodeType!=1)continue;let a=s,l=a==o.body,u=l?BM(o):$M(a),c=0,d=0;if(e.top<u.top+On(r,"top")?d=-(u.top-e.top+On(i,"top")):e.bottom>u.bottom-On(r,"bottom")&&(d=e.bottom-e.top>u.bottom-u.top?e.top+On(i,"top")-u.top:e.bottom-u.bottom+On(i,"bottom")),e.left<u.left+On(r,"left")?c=-(u.left-e.left+On(i,"left")):e.right>u.right-On(r,"right")&&(c=e.right-u.right+On(i,"right")),c||d)if(l)o.defaultView.scrollBy(c,d);else{let h=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);let f=a.scrollLeft-h,m=a.scrollTop-p;e={left:e.left-f,top:e.top-m,right:e.right-f,bottom:e.bottom-m}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function jM(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let a=t.root.elementFromPoint(o,s);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:Ab(t.dom)}}function Ab(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=fs(r));return e}function zM({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Mb(n,r==0?0:r-e)}function Mb(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:o}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let Ci=null;function HM(t){if(t.setActive)return t.setActive();if(Ci)return t.focus(Ci);let e=Ab(t);t.focus(Ci==null?{get preventScroll(){return Ci={preventScroll:!0},!0}}:void 0),Ci||(Ci=!1,Mb(e,0))}function _b(t,e){let n,r=2e8,i,o=0,s=e.top,a=e.top,l,u;for(let c=t.firstChild,d=0;c;c=c.nextSibling,d++){let h;if(c.nodeType==1)h=c.getClientRects();else if(c.nodeType==3)h=Nn(c).getClientRects();else continue;for(let p=0;p<h.length;p++){let f=h[p];if(f.top<=s&&f.bottom>=a){s=Math.max(f.bottom,s),a=Math.min(f.top,a);let m=f.left>e.left?f.left-e.left:f.right<e.left?e.left-f.right:0;if(m<r){n=c,r=m,i=m&&n.nodeType==3?{left:f.right<e.left?f.right:f.left,top:e.top}:e,c.nodeType==1&&m&&(o=d+(e.left>=(f.left+f.right)/2?1:0));continue}}else f.top>e.top&&!l&&f.left<=e.left&&f.right>=e.left&&(l=c,u={left:Math.max(f.left,Math.min(f.right,e.left)),top:f.top});!n&&(e.left>=f.right&&e.top>=f.top||e.left>=f.left&&e.top>=f.bottom)&&(o=d+1)}}return!n&&l&&(n=l,i=u,r=0),n&&n.nodeType==3?qM(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:_b(n,i)}function qM(t,e){let n=t.nodeValue.length,r=document.createRange();for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let o=Zn(r,1);if(o.top!=o.bottom&&qp(e,o))return{node:t,offset:i+(e.left>=(o.left+o.right)/2?1:0)}}return{node:t,offset:0}}function qp(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function WM(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function UM(t,e,n){let{node:r,offset:i}=_b(e,n),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,i,o)}function KM(t,e,n,r){let i=-1;for(let o=e,s=!1;o!=t.dom;){let a=t.docView.nearestDesc(o,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&(!s&&l.left>r.left||l.top>r.top?i=a.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),s=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;o=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function Db(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),o=i;;){let s=t.childNodes[o];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let u=a[l];if(qp(e,u))return Db(s,e,u)}}if((o=(o+1)%r)==i)break}return t}function GM(t,e){let n=t.dom.ownerDocument,r,i=0,o=FM(n,e.left,e.top);o&&({node:r,offset:i}=o);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let u=t.dom.getBoundingClientRect();if(!qp(e,u)||(s=Db(t.dom,e,u),!s))return null}if(pt)for(let u=s;r&&u;u=fs(u))u.draggable&&(r=void 0);if(s=WM(s,e),r){if(nn&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let c=r.childNodes[i],d;c.nodeName=="IMG"&&(d=c.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let u;Ns&&i&&r.nodeType==1&&(u=r.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=KM(t,r,i,e))}a==null&&(a=UM(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function mm(t){return t.top<t.bottom||t.left<t.right}function Zn(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(mm(r))return r}return Array.prototype.find.call(n,mm)||t.getBoundingClientRect()}const JM=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Nb(t,e,n){let{node:r,offset:i,atom:o}=t.docView.domFromPos(e,n<0?-1:1),s=Ns||nn;if(r.nodeType==3)if(s&&(JM.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let a=Zn(Nn(r,i,i),n);if(nn&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let l=Zn(Nn(r,i-1,i-1),-1);if(l.top==a.top){let u=Zn(Nn(r,i,i+1),-1);if(u.top!=a.top)return wo(u,u.left<l.left)}}return a}else{let a=i,l=i,u=n<0?1:-1;return n<0&&!i?(l++,u=-1):n>=0&&i==r.nodeValue.length?(a--,u=1):n<0?a--:l++,wo(Zn(Nn(r,a,l),u),u<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==$t(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return fc(a.getBoundingClientRect(),!1)}if(o==null&&i<$t(r)){let a=r.childNodes[i];if(a.nodeType==1)return fc(a.getBoundingClientRect(),!0)}return fc(r.getBoundingClientRect(),n>=0)}if(o==null&&i&&(n<0||i==$t(r))){let a=r.childNodes[i-1],l=a.nodeType==3?Nn(a,$t(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(l)return wo(Zn(l,1),!1)}if(o==null&&i<$t(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let l=a?a.nodeType==3?Nn(a,0,s?0:1):a.nodeType==1?a:null:null;if(l)return wo(Zn(l,-1),!0)}return wo(Zn(r.nodeType==3?Nn(r):r,-n),n>=0)}function wo(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function fc(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Ib(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function XM(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Ib(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let s=Nb(t,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Nn(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;u<l.length;u++){let c=l[u];if(c.bottom>c.top+1&&(n=="up"?s.top-c.top>(c.bottom-s.top)*2:c.bottom-s.bottom>(s.bottom-c.top)*2))return!1}}return!0})}const YM=/[\u0590-\u08ac]/;function ZM(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,a=t.domSelection();return a?!YM.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?o:s:Ib(t,e,()=>{let{focusNode:l,focusOffset:u,anchorNode:c,anchorOffset:d}=t.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:f,focusOffset:m}=t.domSelectionRange(),g=f&&!p.contains(f.nodeType==1?f:f.parentNode)||l==f&&u==m;try{a.collapse(c,d),l&&(l!=c||u!=d)&&a.extend&&a.extend(l,u)}catch{}return h!=null&&(a.caretBidiLevel=h),g}):r.pos==r.start()||r.pos==r.end()}let gm=null,vm=null,ym=!1;function QM(t,e,n){return gm==e&&vm==n?ym:(gm=e,vm=n,ym=n=="up"||n=="down"?XM(t,e,n):ZM(t,e,n))}const zt=0,bm=1,Wr=2,xn=3;class Is{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=zt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let o,s;if(e==this.contentDOM)o=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>Xe(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!n||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)for(let s=0;s<i.children.length;s++){let a=i.children[s];if(a.size){i=a;break}}return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],a=o+s.size;if(a>e||s instanceof Pb){i=e-o;break}o=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof Rb&&o.side>=0;r--);if(n<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&n&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?Xe(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,n):{node:this.contentDOM,offset:o?Xe(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,a=0;;a++){let l=this.children[a],u=s+l.size;if(i==-1&&e<=u){let c=s+l.border;if(e>=c&&n<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,c);e=s;for(let d=a;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=Xe(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(u>n||a==this.children.length-1)){n=u;for(let c=a+1;c<this.children.length;c++){let d=this.children[c];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){o=Xe(d.dom);break}n+=d.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=u}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let o=Math.min(e,n),s=Math.max(e,n);for(let p=0,f=0;p<this.children.length;p++){let m=this.children[p],g=f+m.size;if(o>f&&s<g)return m.setSelection(e-f-m.border,n-f-m.border,r,i);f=g}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),u=r.root.getSelection(),c=r.domSelectionRange(),d=!1;if((nn||pt)&&e==n){let{node:p,offset:f}=a;if(p.nodeType==3){if(d=!!(f&&p.nodeValue[f-1]==`
13
- `),d&&f==p.nodeValue.length)for(let m=p,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=l={node:g.parentNode,offset:Xe(g)+1});break}let y=m.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let m=p.childNodes[f-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(nn&&c.focusNode&&c.focusNode!=l.node&&c.focusNode.nodeType==1){let p=c.focusNode.childNodes[c.focusOffset];p&&p.contentEditable=="false"&&(i=!0)}if(!(i||d&&pt)&&si(a.node,a.offset,c.anchorNode,c.anchorOffset)&&si(l.node,l.offset,c.focusNode,c.focusOffset))return;let h=!1;if((u.extend||e==n)&&!d){u.collapse(a.node,a.offset);try{e!=n&&u.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(e>n){let f=a;a=l,l=f}let p=document.createRange();p.setEnd(l.node,l.offset),p.setStart(a.node,a.offset),u.removeAllRanges(),u.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let a=r+o.border,l=s-o.border;if(e>=a&&n<=l){this.dirty=e==r||n==s?Wr:bm,e==a&&n==l&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=xn:o.markDirty(e-a,n-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Wr:xn}r=s}this.dirty=Wr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Wr:bm;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class Rb extends Is{constructor(e,n,r,i){let o,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==zt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class e_ extends Is{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class ai extends Is{constructor(e,n,r,i,o){super(e,[],r,i),this.mark=n,this.spec=o}static create(e,n,r,i){let o=i.nodeViews[n.type.name],s=o&&o(n,i,r);return(!s||!s.dom)&&(s=fi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ai(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&xn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=xn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=zt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=zt}}slice(e,n,r){let i=ai.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;n<s&&(o=Td(o,n,s,r)),e>0&&(o=Td(o,0,e,r));for(let a=0;a<o.length;a++)o[a].parent=i;return i.children=o,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class vr extends Is{constructor(e,n,r,i,o,s,a,l,u){super(e,[],o,s),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,o,s){let a=o.nodeViews[n.type.name],l,u=a&&a(n,o,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,i),c=u&&u.dom,d=u&&u.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:d}=fi.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let h=c;return c=Vb(c,r,n),u?l=new t_(e,n,r,i,c,d||null,h,u,o,s+1):n.isText?new Eu(e,n,r,i,c,h,o):new vr(e,n,r,i,c,d||null,h,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>A.empty)}return e}matchesNode(e,n,r){return this.dirty==zt&&e.eq(this.node)&&cl(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,o=e.composing?this.localCompositionInfo(e,n):null,s=o&&o.pos>-1?o:null,a=o&&o.pos<0,l=new r_(this,s&&s.node,e);s_(this.node,this.innerDeco,(u,c,d)=>{u.spec.marks?l.syncToMarks(u.spec.marks,r,e):u.type.side>=0&&!d&&l.syncToMarks(c==this.node.childCount?ke.none:this.node.child(c).marks,r,e),l.placeWidget(u,e,i)},(u,c,d,h)=>{l.syncToMarks(u.marks,r,e);let p;l.findNodeMatch(u,c,d,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+u.nodeSize&&(p=l.findIndexWithChild(o.node))>-1&&l.updateNodeAt(u,c,d,p,e)||l.updateNextNode(u,c,d,e,h,i)||l.addNode(u,c,d,e,i),i+=u.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Wr)&&(s&&this.protectLocalComposition(e,s),Fb(this.contentDOM,this.children,e),Qi&&a_(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof oe)||r<n||i>n+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,a=l_(this.node.content,s,r-n,i-n);return a<0?null:{node:o,pos:a,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new e_(this,o,n,i);e.input.compositionNodes.push(s),this.children=Td(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==xn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=zt}updateOuterDeco(e){if(cl(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Lb(this.dom,this.nodeDOM,Sd(this.outerDeco,this.node,n),Sd(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function km(t,e,n,r,i){Vb(r,e,t);let o=new vr(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Eu extends vr{constructor(e,n,r,i,o,s,a){super(e,n,r,i,o,null,s,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==xn||this.dirty!=zt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=zt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=zt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),o=document.createTextNode(i.text);return new Eu(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=xn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Pb extends Is{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==zt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class t_ extends vr{constructor(e,n,r,i,o,s,a,l,u,c){super(e,n,r,i,o,s,a,u,c),this.spec=l}update(e,n,r,i){if(this.dirty==xn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,n,r);return o&&this.updateInner(e,n,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Fb(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],a=s.dom;if(a.parentNode==t){for(;a!=r;)r=wm(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(s instanceof ai){let l=r?r.previousSibling:t.lastChild;Fb(s.contentDOM,s.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=wm(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Wo=function(t){t&&(this.nodeName=t)};Wo.prototype=Object.create(null);const Ur=[new Wo];function Sd(t,e,n){if(t.length==0)return Ur;let r=n?Ur[0]:new Wo,i=[r];for(let o=0;o<t.length;o++){let s=t[o].type.attrs;if(s){s.nodeName&&i.push(r=new Wo(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&i.length==1&&i.push(r=new Wo(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function Lb(t,e,n,r){if(n==Ur&&r==Ur)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],a=n[o];if(o){let l;a&&a.nodeName==s.nodeName&&i!=t&&(l=i.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=Ur[0]),i=l}n_(i,a||Ur[0],s)}return i}function n_(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&t.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&t.classList.add(i[o]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function Vb(t,e,n){return Lb(t,t,Ur,Sd(e,n,t.nodeType!=1))}function cl(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function wm(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class r_{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=i_(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=zt,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let u=this.top.children[l];if(u.matchesMark(e[o])&&!this.isLocked(u.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=ai.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))o=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let u=this.top.children[a];if(u.matchesNode(e,n,r)&&!this.preMatch.matched.has(u)){o=a;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,n,r,i,o){let s=this.top.children[i];return s.dirty==xn&&s.dom==s.contentDOM&&(s.dirty=Wr),s.update(e,n,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,o,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof vr){let u=this.preMatch.matched.get(l);if(u!=null&&u!=o)return!1;let c=l.dom,d,h=this.isLocked(c)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=xn&&cl(n,l.outerDeco));if(!h&&l.update(e,n,r,i))return this.destroyBetween(this.index,a),l.dom!=c&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(l,e,n,r,i,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Wr,d.updateChildren(i,s+1),d.dirty=zt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,o,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!cl(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=vr.create(this.top,n,r,i,o,s);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,i,o){let s=vr.create(this.top,e,n,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new Rb(this.top,e,n,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof ai;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Eu)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((pt||rt)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new Pb(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function i_(t,e){let n=e,r=n.children.length,i=t.childCount,o=new Map,s=[];e:for(;i>0;){let a;for(;;)if(r){let u=n.children[r-1];if(u instanceof ai)n=u,r=u.children.length;else{a=u,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}function o_(t,e){return t.type.side-e.type.side}function s_(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let u=0;u<t.childCount;u++){let c=t.child(u);r(c,i,e.forChild(o,c),u),o+=c.nodeSize}return}let s=0,a=[],l=null;for(let u=0;;){let c,d;for(;s<i.length&&i[s].to==o;){let g=i[s++];g.widget&&(c?(d||(d=[c])).push(g):c=g)}if(c)if(d){d.sort(o_);for(let g=0;g<d.length;g++)n(d[g],u,!!l)}else n(c,u,!!l);let h,p;if(l)p=-1,h=l,l=null;else if(u<t.childCount)p=u,h=t.child(u++);else break;for(let g=0;g<a.length;g++)a[g].to<=o&&a.splice(g--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)a.push(i[s++]);let f=o+h.nodeSize;if(h.isText){let g=f;s<i.length&&i[s].from<g&&(g=i[s].from);for(let y=0;y<a.length;y++)a[y].to<g&&(g=a[y].to);g<f&&(l=h.cut(g-o),h=h.cut(0,g-o),f=g,p=-1)}else for(;s<i.length&&i[s].to<f;)s++;let m=h.isInline&&!h.isLeaf?a.filter(g=>!g.inline):a.slice();r(h,m,e.forChild(o,h),p),o=f}}function a_(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function l_(t,e,n,r){for(let i=0,o=0;i<t.childCount&&o<=r;){let s=t.child(i++),a=o;if(o+=s.nodeSize,!s.isText)continue;let l=s.text;for(;i<t.childCount;){let u=t.child(i++);if(o+=u.nodeSize,!u.isText)break;l+=u.text}if(o>=n){if(o>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let u=a<r?l.lastIndexOf(e,r-a-1):-1;if(u>=0&&u+e.length+a>=n)return a+u;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function Td(t,e,n,r,i){let o=[];for(let s=0,a=0;s<t.length;s++){let l=t[s],u=a,c=a+=l.size;u>=n||c<=e?o.push(l):(u<e&&o.push(l.slice(0,e-u,r)),i&&(o.push(i),i=void 0),c>n&&o.push(l.slice(n-u,l.size,r)))}return o}function Wp(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),o=i&&i.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,u;if(xu(n)){for(l=s;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&Y.isSelectable(d)&&i.parent&&!(d.isInline&&RM(n.focusNode,n.focusOffset,i.dom))){let h=i.posBefore;u=new Y(s==h?a:r.resolve(h))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,h=s;for(let p=0;p<n.rangeCount;p++){let f=n.getRangeAt(p);d=Math.min(d,t.docView.posFromDOM(f.startContainer,f.startOffset,1)),h=Math.max(h,t.docView.posFromDOM(f.endContainer,f.endOffset,-1))}if(d<0)return null;[l,s]=h==t.state.selection.anchor?[h,d]:[d,h],a=r.resolve(s)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let c=r.resolve(l);if(!u){let d=e=="pointer"||t.state.selection.head<a.pos&&!o?1:-1;u=Up(t,c,a,d)}return u}function Bb(t){return t.editable?t.hasFocus():jb(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Bn(t,e=!1){let n=t.state.selection;if($b(t,n),!!Bb(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&rt){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&si(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)c_(t);else{let{anchor:r,head:i}=n,o,s;xm&&!(n instanceof oe)&&(n.$from.parent.inlineContent||(o=Em(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=Em(t,n.to))),t.docView.setSelection(r,i,t,e),xm&&(o&&Cm(o),s&&Cm(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&u_(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const xm=pt||rt&&Ob<63;function Em(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(pt&&i&&i.contentEditable=="false")return mc(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return mc(i);if(o)return mc(o)}}function mc(t){return t.contentEditable="true",pt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Cm(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function u_(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Bb(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function c_(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let r=t.cursorWrapper.dom,i=r.nodeName=="IMG";i?n.setStart(r.parentNode,Xe(r)+1):n.setStart(r,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!i&&!t.state.selection.visible&&bt&&gr<=11&&(r.disabled=!0,r.disabled=!1)}function $b(t,e){if(e instanceof Y){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Sm(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Sm(t)}function Sm(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Up(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||oe.between(e,n,r)}function Tm(t){return t.editable&&!t.hasFocus()?!1:jb(t)}function jb(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function d_(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return si(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Od(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return o&&le.findFrom(o,e)}function er(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Om(t,e,n){let r=t.state.selection;if(r instanceof oe)if(n.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=t.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return er(t,new oe(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Od(t.state,e);return i&&i instanceof Y?er(t,i):!1}else if(!(Vt&&n.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let a=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?Y.isSelectable(o)?er(t,new Y(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):Ns?er(t,new oe(t.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Y&&r.node.isInline)return er(t,new oe(e>0?r.$to:r.$from));{let i=Od(t.state,e);return i?er(t,i):!1}}}function dl(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Uo(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Si(t,e){return e<0?p_(t):h_(t)}function p_(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;for(nn&&n.nodeType==1&&r<dl(n)&&Uo(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Uo(a,-1))i=n,o=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(zb(n))break;{let a=n.previousSibling;for(;a&&Uo(a,-1);)i=n.parentNode,o=Xe(a),a=a.previousSibling;if(a)n=a,r=dl(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?Ad(t,n,r):i&&Ad(t,i,o)}function h_(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=dl(n),o,s;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Uo(a,1))o=n,s=++r;else break}else{if(zb(n))break;{let a=n.nextSibling;for(;a&&Uo(a,1);)o=a.parentNode,s=Xe(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=dl(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}o&&Ad(t,o,s)}function zb(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function f_(t,e){for(;t&&e==t.childNodes.length&&!Ds(t);)e=Xe(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function m_(t,e){for(;t&&!e&&!Ds(t);)e=Xe(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Ad(t,e,n){if(e.nodeType!=3){let o,s;(s=f_(e,n))?(e=s,n=0):(o=m_(e,n))&&(e=o,n=o.nodeValue.length)}let r=t.domSelection();if(!r)return;if(xu(r)){let o=document.createRange();o.setEnd(e,n),o.setStart(e,n),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&Bn(t)},50)}function Am(t,e){let n=t.state.doc.resolve(e);if(!(rt||LM)&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(i.left-r.left)>1)return i.left>r.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Mm(t,e,n){let r=t.state.selection;if(r instanceof oe&&!r.empty||n.indexOf("s")>-1||Vt&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Od(t.state,e);if(s&&s instanceof Y)return er(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,a=r instanceof jt?le.near(s,e):le.findFrom(s,e);return a?er(t,a):!1}return!1}function _m(t,e){if(!(t.state.selection instanceof oe))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let s=t.state.tr;return e<0?s.delete(n.pos-o.nodeSize,n.pos):s.delete(n.pos,n.pos+o.nodeSize),t.dispatch(s),!0}return!1}function Dm(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function g_(t){if(!pt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Dm(t,r,"true"),setTimeout(()=>Dm(t,r,"false"),20)}return!1}function v_(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function y_(t,e){let n=e.keyCode,r=v_(e);if(n==8||Vt&&n==72&&r=="c")return _m(t,-1)||Si(t,-1);if(n==46&&!e.shiftKey||Vt&&n==68&&r=="c")return _m(t,1)||Si(t,1);if(n==13||n==27)return!0;if(n==37||Vt&&n==66&&r=="c"){let i=n==37?Am(t,t.state.selection.from)=="ltr"?-1:1:-1;return Om(t,i,r)||Si(t,i)}else if(n==39||Vt&&n==70&&r=="c"){let i=n==39?Am(t,t.state.selection.from)=="ltr"?1:-1:1;return Om(t,i,r)||Si(t,i)}else{if(n==38||Vt&&n==80&&r=="c")return Mm(t,-1,r)||Si(t,-1);if(n==40||Vt&&n==78&&r=="c")return g_(t)||Mm(t,1,r)||Si(t,1);if(r==(Vt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Kp(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=t.someProp("clipboardSerializer")||fi.fromSchema(t.state.schema),a=Gb(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let u=l.firstChild,c,d=0;for(;u&&u.nodeType==1&&(c=Kb[u.nodeName.toLowerCase()]);){for(let p=c.length-1;p>=0;p--){let f=a.createElement(c[p]);for(;l.firstChild;)f.appendChild(l.firstChild);l.appendChild(f),d++}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${o}${d?` -${d}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
8
+ */function Of(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function wn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Of(Object(n),!0).forEach(function(r){PT(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Of(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ta(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ta=function(e){return typeof e}:Ta=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ta(t)}function PT(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function jn(){return jn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},jn.apply(this,arguments)}function FT(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function LT(t,e){if(t==null)return{};var n=FT(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}var VT="1.14.0";function Vn(t){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(t)}var Un=Vn(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Ms=Vn(/Edge/i),Af=Vn(/firefox/i),Vo=Vn(/safari/i)&&!Vn(/chrome/i)&&!Vn(/android/i),gy=Vn(/iP(ad|od|hone)/i),BT=Vn(/chrome/i)&&Vn(/android/i),vy={capture:!1,passive:!1};function ve(t,e,n){t.addEventListener(e,n,!Un&&vy)}function me(t,e,n){t.removeEventListener(e,n,!Un&&vy)}function Ya(t,e){if(e){if(e[0]===">"&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch{return!1}return!1}}function $T(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function hn(t,e,n,r){if(t){n=n||document;do{if(e!=null&&(e[0]===">"?t.parentNode===n&&Ya(t,e):Ya(t,e))||r&&t===n)return t;if(t===n)break}while(t=$T(t))}return null}var Mf=/\s+/g;function Et(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var r=(" "+t.className+" ").replace(Mf," ").replace(" "+e+" "," ");t.className=(r+(n?" "+e:"")).replace(Mf," ")}}function ee(t,e,n){var r=t&&t.style;if(r){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),e===void 0?n:n[e];!(e in r)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),r[e]=n+(typeof n=="string"?"":"px")}}function Vi(t,e){var n="";if(typeof t=="string")n=t;else do{var r=ee(t,"transform");r&&r!=="none"&&(n=r+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function yy(t,e,n){if(t){var r=t.getElementsByTagName(e),i=0,o=r.length;if(n)for(;i<o;i++)n(r[i],i);return r}return[]}function yn(){var t=document.scrollingElement;return t||document.documentElement}function Be(t,e,n,r,i){if(!(!t.getBoundingClientRect&&t!==window)){var o,s,a,l,u,c,d;if(t!==window&&t.parentNode&&t!==yn()?(o=t.getBoundingClientRect(),s=o.top,a=o.left,l=o.bottom,u=o.right,c=o.height,d=o.width):(s=0,a=0,l=window.innerHeight,u=window.innerWidth,c=window.innerHeight,d=window.innerWidth),(e||n)&&t!==window&&(i=i||t.parentNode,!Un))do if(i&&i.getBoundingClientRect&&(ee(i,"transform")!=="none"||n&&ee(i,"position")!=="static")){var h=i.getBoundingClientRect();s-=h.top+parseInt(ee(i,"border-top-width")),a-=h.left+parseInt(ee(i,"border-left-width")),l=s+o.height,u=a+o.width;break}while(i=i.parentNode);if(r&&t!==window){var p=Vi(i||t),f=p&&p.a,m=p&&p.d;p&&(s/=m,a/=f,d/=f,c/=m,l=s+c,u=a+d)}return{top:s,left:a,bottom:l,right:u,width:d,height:c}}}function _f(t,e,n){for(var r=sr(t,!0),i=Be(t)[e];r;){var o=Be(r)[n],s=void 0;if(s=i>=o,!s)return r;if(r===yn())break;r=sr(r,!1)}return!1}function Ki(t,e,n,r){for(var i=0,o=0,s=t.children;o<s.length;){if(s[o].style.display!=="none"&&s[o]!==te.ghost&&(r||s[o]!==te.dragged)&&hn(s[o],n.draggable,t,!1)){if(i===e)return s[o];i++}o++}return null}function Rp(t,e){for(var n=t.lastElementChild;n&&(n===te.ghost||ee(n,"display")==="none"||e&&!Ya(n,e));)n=n.previousElementSibling;return n||null}function Lt(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)t.nodeName.toUpperCase()!=="TEMPLATE"&&t!==te.clone&&(!e||Ya(t,e))&&n++;return n}function Df(t){var e=0,n=0,r=yn();if(t)do{var i=Vi(t),o=i.a,s=i.d;e+=t.scrollLeft*o,n+=t.scrollTop*s}while(t!==r&&(t=t.parentNode));return[e,n]}function jT(t,e){for(var n in t)if(t.hasOwnProperty(n)){for(var r in e)if(e.hasOwnProperty(r)&&e[r]===t[n][r])return Number(n)}return-1}function sr(t,e){if(!t||!t.getBoundingClientRect)return yn();var n=t,r=!1;do if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=ee(n);if(n.clientWidth<n.scrollWidth&&(i.overflowX=="auto"||i.overflowX=="scroll")||n.clientHeight<n.scrollHeight&&(i.overflowY=="auto"||i.overflowY=="scroll")){if(!n.getBoundingClientRect||n===document.body)return yn();if(r||e)return n;r=!0}}while(n=n.parentNode);return yn()}function zT(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function Ku(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}var Bo;function by(t,e){return function(){if(!Bo){var n=arguments,r=this;n.length===1?t.call(r,n[0]):t.apply(r,n),Bo=setTimeout(function(){Bo=void 0},e)}}}function HT(){clearTimeout(Bo),Bo=void 0}function ky(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function wy(t){var e=window.Polymer,n=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):n?n(t).clone(!0)[0]:t.cloneNode(!0)}var Tt="Sortable"+new Date().getTime();function qT(){var t=[],e;return{captureAnimationState:function(){if(t=[],!!this.options.animation){var n=[].slice.call(this.el.children);n.forEach(function(r){if(!(ee(r,"display")==="none"||r===te.ghost)){t.push({target:r,rect:Be(r)});var i=wn({},t[t.length-1].rect);if(r.thisAnimationDuration){var o=Vi(r,!0);o&&(i.top-=o.f,i.left-=o.e)}r.fromRect=i}})}},addAnimationState:function(n){t.push(n)},removeAnimationState:function(n){t.splice(jT(t,{target:n}),1)},animateAll:function(n){var r=this;if(!this.options.animation){clearTimeout(e),typeof n=="function"&&n();return}var i=!1,o=0;t.forEach(function(s){var a=0,l=s.target,u=l.fromRect,c=Be(l),d=l.prevFromRect,h=l.prevToRect,p=s.rect,f=Vi(l,!0);f&&(c.top-=f.f,c.left-=f.e),l.toRect=c,l.thisAnimationDuration&&Ku(d,c)&&!Ku(u,c)&&(p.top-c.top)/(p.left-c.left)===(u.top-c.top)/(u.left-c.left)&&(a=UT(p,d,h,r.options)),Ku(c,u)||(l.prevFromRect=u,l.prevToRect=c,a||(a=r.options.animation),r.animate(l,p,c,a)),a&&(i=!0,o=Math.max(o,a),clearTimeout(l.animationResetTimer),l.animationResetTimer=setTimeout(function(){l.animationTime=0,l.prevFromRect=null,l.fromRect=null,l.prevToRect=null,l.thisAnimationDuration=null},a),l.thisAnimationDuration=a)}),clearTimeout(e),i?e=setTimeout(function(){typeof n=="function"&&n()},o):typeof n=="function"&&n(),t=[]},animate:function(n,r,i,o){if(o){ee(n,"transition",""),ee(n,"transform","");var s=Vi(this.el),a=s&&s.a,l=s&&s.d,u=(r.left-i.left)/(a||1),c=(r.top-i.top)/(l||1);n.animatingX=!!u,n.animatingY=!!c,ee(n,"transform","translate3d("+u+"px,"+c+"px,0)"),this.forRepaintDummy=WT(n),ee(n,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),ee(n,"transform","translate3d(0,0,0)"),typeof n.animated=="number"&&clearTimeout(n.animated),n.animated=setTimeout(function(){ee(n,"transition",""),ee(n,"transform",""),n.animated=!1,n.animatingX=!1,n.animatingY=!1},o)}}}}function WT(t){return t.offsetWidth}function UT(t,e,n,r){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-n.top,2)+Math.pow(e.left-n.left,2))*r.animation}var xi=[],Gu={initializeByDefault:!0},_s={mount:function(t){for(var e in Gu)Gu.hasOwnProperty(e)&&!(e in t)&&(t[e]=Gu[e]);xi.forEach(function(n){if(n.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}),xi.push(t)},pluginEvent:function(t,e,n){var r=this;this.eventCanceled=!1,n.cancel=function(){r.eventCanceled=!0};var i=t+"Global";xi.forEach(function(o){e[o.pluginName]&&(e[o.pluginName][i]&&e[o.pluginName][i](wn({sortable:e},n)),e.options[o.pluginName]&&e[o.pluginName][t]&&e[o.pluginName][t](wn({sortable:e},n)))})},initializePlugins:function(t,e,n,r){xi.forEach(function(s){var a=s.pluginName;if(!(!t.options[a]&&!s.initializeByDefault)){var l=new s(t,e,t.options);l.sortable=t,l.options=t.options,t[a]=l,jn(n,l.defaults)}});for(var i in t.options)if(t.options.hasOwnProperty(i)){var o=this.modifyOption(t,i,t.options[i]);typeof o<"u"&&(t.options[i]=o)}},getEventProperties:function(t,e){var n={};return xi.forEach(function(r){typeof r.eventProperties=="function"&&jn(n,r.eventProperties.call(e[r.pluginName],t))}),n},modifyOption:function(t,e,n){var r;return xi.forEach(function(i){t[i.pluginName]&&i.optionListeners&&typeof i.optionListeners[e]=="function"&&(r=i.optionListeners[e].call(t[i.pluginName],n))}),r}};function KT(t){var e=t.sortable,n=t.rootEl,r=t.name,i=t.targetEl,o=t.cloneEl,s=t.toEl,a=t.fromEl,l=t.oldIndex,u=t.newIndex,c=t.oldDraggableIndex,d=t.newDraggableIndex,h=t.originalEvent,p=t.putSortable,f=t.extraEventProperties;if(e=e||n&&n[Tt],!!e){var m,g=e.options,y="on"+r.charAt(0).toUpperCase()+r.substr(1);window.CustomEvent&&!Un&&!Ms?m=new CustomEvent(r,{bubbles:!0,cancelable:!0}):(m=document.createEvent("Event"),m.initEvent(r,!0,!0)),m.to=s||n,m.from=a||n,m.item=i||n,m.clone=o,m.oldIndex=l,m.newIndex=u,m.oldDraggableIndex=c,m.newDraggableIndex=d,m.originalEvent=h,m.pullMode=p?p.lastPutMode:void 0;var b=wn(wn({},f),_s.getEventProperties(r,e));for(var k in b)m[k]=b[k];n&&n.dispatchEvent(m),g[y]&&g[y].call(e,m)}}var GT=["evt"],gt=function(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.evt,i=LT(n,GT);_s.pluginEvent.bind(te)(t,e,wn({dragEl:R,parentEl:Ae,ghostEl:ae,rootEl:xe,nextEl:$r,lastDownEl:Oa,cloneEl:Me,cloneHidden:rr,dragStarted:Ao,putSortable:Ge,activeSortable:te.active,originalEvent:r,oldIndex:Ii,oldDraggableIndex:$o,newIndex:Ct,newDraggableIndex:Qn,hideGhostForTarget:Sy,unhideGhostForTarget:Ty,cloneNowHidden:function(){rr=!0},cloneNowShown:function(){rr=!1},dispatchSortableEvent:function(o){ut({sortable:e,name:o,originalEvent:r})}},i))};function ut(t){KT(wn({putSortable:Ge,cloneEl:Me,targetEl:R,rootEl:xe,oldIndex:Ii,oldDraggableIndex:$o,newIndex:Ct,newDraggableIndex:Qn},t))}var R,Ae,ae,xe,$r,Oa,Me,rr,Ii,Ct,$o,Qn,ra,Ge,Ti=!1,Za=!1,Qa=[],Pr,Gt,Ju,Xu,Nf,If,Ao,Ei,jo,zo=!1,ia=!1,Aa,tt,Yu=[],ld=!1,el=[],gu=typeof document<"u",oa=gy,Rf=Ms||Un?"cssFloat":"float",JT=gu&&!BT&&!gy&&"draggable"in document.createElement("div"),xy=function(){if(gu){if(Un)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),Ey=function(t,e){var n=ee(t),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=Ki(t,0,e),o=Ki(t,1,e),s=i&&ee(i),a=o&&ee(o),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Be(i).width,u=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Be(o).width;if(n.display==="flex")return n.flexDirection==="column"||n.flexDirection==="column-reverse"?"vertical":"horizontal";if(n.display==="grid")return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&s.float&&s.float!=="none"){var c=s.float==="left"?"left":"right";return o&&(a.clear==="both"||a.clear===c)?"vertical":"horizontal"}return i&&(s.display==="block"||s.display==="flex"||s.display==="table"||s.display==="grid"||l>=r&&n[Rf]==="none"||o&&n[Rf]==="none"&&l+u>r)?"vertical":"horizontal"},XT=function(t,e,n){var r=n?t.left:t.top,i=n?t.right:t.bottom,o=n?t.width:t.height,s=n?e.left:e.top,a=n?e.right:e.bottom,l=n?e.width:e.height;return r===s||i===a||r+o/2===s+l/2},YT=function(t,e){var n;return Qa.some(function(r){var i=r[Tt].options.emptyInsertThreshold;if(!(!i||Rp(r))){var o=Be(r),s=t>=o.left-i&&t<=o.right+i,a=e>=o.top-i&&e<=o.bottom+i;if(s&&a)return n=r}}),n},Cy=function(t){function e(i,o){return function(s,a,l,u){var c=s.options.group.name&&a.options.group.name&&s.options.group.name===a.options.group.name;if(i==null&&(o||c))return!0;if(i==null||i===!1)return!1;if(o&&i==="clone")return i;if(typeof i=="function")return e(i(s,a,l,u),o)(s,a,l,u);var d=(o?s:a).options.group.name;return i===!0||typeof i=="string"&&i===d||i.join&&i.indexOf(d)>-1}}var n={},r=t.group;(!r||Ta(r)!="object")&&(r={name:r}),n.name=r.name,n.checkPull=e(r.pull,!0),n.checkPut=e(r.put),n.revertClone=r.revertClone,t.group=n},Sy=function(){!xy&&ae&&ee(ae,"display","none")},Ty=function(){!xy&&ae&&ee(ae,"display","")};gu&&document.addEventListener("click",function(t){if(Za)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Za=!1,!1},!0);var Fr=function(t){if(R){t=t.touches?t.touches[0]:t;var e=YT(t.clientX,t.clientY);if(e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[Tt]._onDragOver(n)}}},ZT=function(t){R&&R.parentNode[Tt]._isOutsideThisEl(t.target)};function te(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=jn({},e),t[Tt]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Ey(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(o,s){o.setData("Text",s.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:te.supportPointer!==!1&&"PointerEvent"in window&&!Vo,emptyInsertThreshold:5};_s.initializePlugins(this,t,n);for(var r in n)!(r in e)&&(e[r]=n[r]);Cy(e);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=e.forceFallback?!1:JT,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?ve(t,"pointerdown",this._onTapStart):(ve(t,"mousedown",this._onTapStart),ve(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(ve(t,"dragover",this),ve(t,"dragenter",this)),Qa.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),jn(this,qT())}te.prototype={constructor:te,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(Ei=null)},_getDirection:function(t,e){return typeof this.options.direction=="function"?this.options.direction.call(this,t,e,R):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,r=this.options,i=r.preventOnFilter,o=t.type,s=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,a=(s||t).target,l=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,u=r.filter;if(sO(n),!R&&!(/mousedown|pointerdown/.test(o)&&t.button!==0||r.disabled)&&!l.isContentEditable&&!(!this.nativeDraggable&&Vo&&a&&a.tagName.toUpperCase()==="SELECT")&&(a=hn(a,r.draggable,n,!1),!(a&&a.animated)&&Oa!==a)){if(Ii=Lt(a),$o=Lt(a,r.draggable),typeof u=="function"){if(u.call(this,t,a,this)){ut({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),gt("filter",e,{evt:t}),i&&t.cancelable&&t.preventDefault();return}}else if(u&&(u=u.split(",").some(function(c){if(c=hn(l,c.trim(),n,!1),c)return ut({sortable:e,rootEl:c,name:"filter",targetEl:a,fromEl:n,toEl:n}),gt("filter",e,{evt:t}),!0}),u)){i&&t.cancelable&&t.preventDefault();return}r.handle&&!hn(l,r.handle,n,!1)||this._prepareDragStart(t,s,a)}}},_prepareDragStart:function(t,e,n){var r=this,i=r.el,o=r.options,s=i.ownerDocument,a;if(n&&!R&&n.parentNode===i){var l=Be(n);if(xe=i,R=n,Ae=R.parentNode,$r=R.nextSibling,Oa=n,ra=o.group,te.dragged=R,Pr={target:R,clientX:(e||t).clientX,clientY:(e||t).clientY},Nf=Pr.clientX-l.left,If=Pr.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,R.style["will-change"]="all",a=function(){if(gt("delayEnded",r,{evt:t}),te.eventCanceled){r._onDrop();return}r._disableDelayedDragEvents(),!Af&&r.nativeDraggable&&(R.draggable=!0),r._triggerDragStart(t,e),ut({sortable:r,name:"choose",originalEvent:t}),Et(R,o.chosenClass,!0)},o.ignore.split(",").forEach(function(u){yy(R,u.trim(),Zu)}),ve(s,"dragover",Fr),ve(s,"mousemove",Fr),ve(s,"touchmove",Fr),ve(s,"mouseup",r._onDrop),ve(s,"touchend",r._onDrop),ve(s,"touchcancel",r._onDrop),Af&&this.nativeDraggable&&(this.options.touchStartThreshold=4,R.draggable=!0),gt("delayStart",this,{evt:t}),o.delay&&(!o.delayOnTouchOnly||e)&&(!this.nativeDraggable||!(Ms||Un))){if(te.eventCanceled){this._onDrop();return}ve(s,"mouseup",r._disableDelayedDrag),ve(s,"touchend",r._disableDelayedDrag),ve(s,"touchcancel",r._disableDelayedDrag),ve(s,"mousemove",r._delayedDragTouchMoveHandler),ve(s,"touchmove",r._delayedDragTouchMoveHandler),o.supportPointer&&ve(s,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(a,o.delay)}else a()}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){R&&Zu(R),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;me(t,"mouseup",this._disableDelayedDrag),me(t,"touchend",this._disableDelayedDrag),me(t,"touchcancel",this._disableDelayedDrag),me(t,"mousemove",this._delayedDragTouchMoveHandler),me(t,"touchmove",this._delayedDragTouchMoveHandler),me(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||t.pointerType=="touch"&&t,!this.nativeDraggable||e?this.options.supportPointer?ve(document,"pointermove",this._onTouchMove):e?ve(document,"touchmove",this._onTouchMove):ve(document,"mousemove",this._onTouchMove):(ve(R,"dragend",this),ve(xe,"dragstart",this._onDragStart));try{document.selection?Ma(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,e){if(Ti=!1,xe&&R){gt("dragStarted",this,{evt:e}),this.nativeDraggable&&ve(document,"dragover",ZT);var n=this.options;!t&&Et(R,n.dragClass,!1),Et(R,n.ghostClass,!0),te.active=this,t&&this._appendGhost(),ut({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(Gt){this._lastX=Gt.clientX,this._lastY=Gt.clientY,Sy();for(var t=document.elementFromPoint(Gt.clientX,Gt.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Gt.clientX,Gt.clientY),t!==e);)e=t;if(R.parentNode[Tt]._isOutsideThisEl(t),e)do{if(e[Tt]){var n=void 0;if(n=e[Tt]._onDragOver({clientX:Gt.clientX,clientY:Gt.clientY,target:t,rootEl:e}),n&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);Ty()}},_onTouchMove:function(t){if(Pr){var e=this.options,n=e.fallbackTolerance,r=e.fallbackOffset,i=t.touches?t.touches[0]:t,o=ae&&Vi(ae,!0),s=ae&&o&&o.a,a=ae&&o&&o.d,l=oa&&tt&&Df(tt),u=(i.clientX-Pr.clientX+r.x)/(s||1)+(l?l[0]-Yu[0]:0)/(s||1),c=(i.clientY-Pr.clientY+r.y)/(a||1)+(l?l[1]-Yu[1]:0)/(a||1);if(!te.active&&!Ti){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(t,!0)}if(ae){o?(o.e+=u-(Ju||0),o.f+=c-(Xu||0)):o={a:1,b:0,c:0,d:1,e:u,f:c};var d="matrix(".concat(o.a,",").concat(o.b,",").concat(o.c,",").concat(o.d,",").concat(o.e,",").concat(o.f,")");ee(ae,"webkitTransform",d),ee(ae,"mozTransform",d),ee(ae,"msTransform",d),ee(ae,"transform",d),Ju=u,Xu=c,Gt=i}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!ae){var t=this.options.fallbackOnBody?document.body:xe,e=Be(R,!0,oa,!0,t),n=this.options;if(oa){for(tt=t;ee(tt,"position")==="static"&&ee(tt,"transform")==="none"&&tt!==document;)tt=tt.parentNode;tt!==document.body&&tt!==document.documentElement?(tt===document&&(tt=yn()),e.top+=tt.scrollTop,e.left+=tt.scrollLeft):tt=yn(),Yu=Df(tt)}ae=R.cloneNode(!0),Et(ae,n.ghostClass,!1),Et(ae,n.fallbackClass,!0),Et(ae,n.dragClass,!0),ee(ae,"transition",""),ee(ae,"transform",""),ee(ae,"box-sizing","border-box"),ee(ae,"margin",0),ee(ae,"top",e.top),ee(ae,"left",e.left),ee(ae,"width",e.width),ee(ae,"height",e.height),ee(ae,"opacity","0.8"),ee(ae,"position",oa?"absolute":"fixed"),ee(ae,"zIndex","100000"),ee(ae,"pointerEvents","none"),te.ghost=ae,t.appendChild(ae),ee(ae,"transform-origin",Nf/parseInt(ae.style.width)*100+"% "+If/parseInt(ae.style.height)*100+"%")}},_onDragStart:function(t,e){var n=this,r=t.dataTransfer,i=n.options;if(gt("dragStart",this,{evt:t}),te.eventCanceled){this._onDrop();return}gt("setupClone",this),te.eventCanceled||(Me=wy(R),Me.draggable=!1,Me.style["will-change"]="",this._hideClone(),Et(Me,this.options.chosenClass,!1),te.clone=Me),n.cloneId=Ma(function(){gt("clone",n),!te.eventCanceled&&(n.options.removeCloneOnHide||xe.insertBefore(Me,R),n._hideClone(),ut({sortable:n,name:"clone"}))}),!e&&Et(R,i.dragClass,!0),e?(Za=!0,n._loopId=setInterval(n._emulateDragOver,50)):(me(document,"mouseup",n._onDrop),me(document,"touchend",n._onDrop),me(document,"touchcancel",n._onDrop),r&&(r.effectAllowed="move",i.setData&&i.setData.call(n,r,R)),ve(document,"drop",n),ee(R,"transform","translateZ(0)")),Ti=!0,n._dragStartId=Ma(n._dragStarted.bind(n,e,t)),ve(document,"selectstart",n),Ao=!0,Vo&&ee(document.body,"user-select","none")},_onDragOver:function(t){var e=this.el,n=t.target,r,i,o,s=this.options,a=s.group,l=te.active,u=ra===a,c=s.sort,d=Ge||l,h,p=this,f=!1;if(ld)return;function m(ue,ge){gt(ue,p,wn({evt:t,isOwner:u,axis:h?"vertical":"horizontal",revert:o,dragRect:r,targetRect:i,canSort:c,fromSortable:d,target:n,completed:y,onMove:function(Te,mt){return sa(xe,e,R,r,Te,Be(Te),t,mt)},changed:b},ge))}function g(){m("dragOverAnimationCapture"),p.captureAnimationState(),p!==d&&d.captureAnimationState()}function y(ue){return m("dragOverCompleted",{insertion:ue}),ue&&(u?l._hideClone():l._showClone(p),p!==d&&(Et(R,Ge?Ge.options.ghostClass:l.options.ghostClass,!1),Et(R,s.ghostClass,!0)),Ge!==p&&p!==te.active?Ge=p:p===te.active&&Ge&&(Ge=null),d===p&&(p._ignoreWhileAnimating=n),p.animateAll(function(){m("dragOverAnimationComplete"),p._ignoreWhileAnimating=null}),p!==d&&(d.animateAll(),d._ignoreWhileAnimating=null)),(n===R&&!R.animated||n===e&&!n.animated)&&(Ei=null),!s.dragoverBubble&&!t.rootEl&&n!==document&&(R.parentNode[Tt]._isOutsideThisEl(t.target),!ue&&Fr(t)),!s.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function b(){Ct=Lt(R),Qn=Lt(R,s.draggable),ut({sortable:p,name:"change",toEl:e,newIndex:Ct,newDraggableIndex:Qn,originalEvent:t})}if(t.preventDefault!==void 0&&t.cancelable&&t.preventDefault(),n=hn(n,s.draggable,e,!0),m("dragOver"),te.eventCanceled)return f;if(R.contains(t.target)||n.animated&&n.animatingX&&n.animatingY||p._ignoreWhileAnimating===n)return y(!1);if(Za=!1,l&&!s.disabled&&(u?c||(o=Ae!==xe):Ge===this||(this.lastPutMode=ra.checkPull(this,l,R,t))&&a.checkPut(this,l,R,t))){if(h=this._getDirection(t,n)==="vertical",r=Be(R),m("dragOverValid"),te.eventCanceled)return f;if(o)return Ae=xe,g(),this._hideClone(),m("revert"),te.eventCanceled||($r?xe.insertBefore(R,$r):xe.appendChild(R)),y(!0);var k=Rp(e,s.draggable);if(!k||nO(t,h,this)&&!k.animated){if(k===R)return y(!1);if(k&&e===t.target&&(n=k),n&&(i=Be(n)),sa(xe,e,R,r,n,i,t,!!n)!==!1)return g(),e.appendChild(R),Ae=e,b(),y(!0)}else if(k&&tO(t,h,this)){var v=Ki(e,0,s,!0);if(v===R)return y(!1);if(n=v,i=Be(n),sa(xe,e,R,r,n,i,t,!1)!==!1)return g(),e.insertBefore(R,v),Ae=e,b(),y(!0)}else if(n.parentNode===e){i=Be(n);var w=0,x,T=R.parentNode!==e,F=!XT(R.animated&&R.toRect||r,n.animated&&n.toRect||i,h),N=h?"top":"left",C=_f(n,"top","top")||_f(R,"top","top"),_=C?C.scrollTop:void 0;Ei!==n&&(x=i[N],zo=!1,ia=!F&&s.invertSwap||T),w=rO(t,n,i,h,F?1:s.swapThreshold,s.invertedSwapThreshold==null?s.swapThreshold:s.invertedSwapThreshold,ia,Ei===n);var L;if(w!==0){var W=Lt(R);do W-=w,L=Ae.children[W];while(L&&(ee(L,"display")==="none"||L===ae))}if(w===0||L===n)return y(!1);Ei=n,jo=w;var q=n.nextElementSibling,K=!1;K=w===1;var J=sa(xe,e,R,r,n,i,t,K);if(J!==!1)return(J===1||J===-1)&&(K=J===1),ld=!0,setTimeout(eO,30),g(),K&&!q?e.appendChild(R):n.parentNode.insertBefore(R,K?q:n),C&&ky(C,0,_-C.scrollTop),Ae=R.parentNode,x!==void 0&&!ia&&(Aa=Math.abs(x-Be(n)[N])),b(),y(!0)}if(e.contains(R))return y(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){me(document,"mousemove",this._onTouchMove),me(document,"touchmove",this._onTouchMove),me(document,"pointermove",this._onTouchMove),me(document,"dragover",Fr),me(document,"mousemove",Fr),me(document,"touchmove",Fr)},_offUpEvents:function(){var t=this.el.ownerDocument;me(t,"mouseup",this._onDrop),me(t,"touchend",this._onDrop),me(t,"pointerup",this._onDrop),me(t,"touchcancel",this._onDrop),me(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;if(Ct=Lt(R),Qn=Lt(R,n.draggable),gt("drop",this,{evt:t}),Ae=R&&R.parentNode,Ct=Lt(R),Qn=Lt(R,n.draggable),te.eventCanceled){this._nulling();return}Ti=!1,ia=!1,zo=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),ud(this.cloneId),ud(this._dragStartId),this.nativeDraggable&&(me(document,"drop",this),me(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Vo&&ee(document.body,"user-select",""),ee(R,"transform",""),t&&(Ao&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),ae&&ae.parentNode&&ae.parentNode.removeChild(ae),(xe===Ae||Ge&&Ge.lastPutMode!=="clone")&&Me&&Me.parentNode&&Me.parentNode.removeChild(Me),R&&(this.nativeDraggable&&me(R,"dragend",this),Zu(R),R.style["will-change"]="",Ao&&!Ti&&Et(R,Ge?Ge.options.ghostClass:this.options.ghostClass,!1),Et(R,this.options.chosenClass,!1),ut({sortable:this,name:"unchoose",toEl:Ae,newIndex:null,newDraggableIndex:null,originalEvent:t}),xe!==Ae?(Ct>=0&&(ut({rootEl:Ae,name:"add",toEl:Ae,fromEl:xe,originalEvent:t}),ut({sortable:this,name:"remove",toEl:Ae,originalEvent:t}),ut({rootEl:Ae,name:"sort",toEl:Ae,fromEl:xe,originalEvent:t}),ut({sortable:this,name:"sort",toEl:Ae,originalEvent:t})),Ge&&Ge.save()):Ct!==Ii&&Ct>=0&&(ut({sortable:this,name:"update",toEl:Ae,originalEvent:t}),ut({sortable:this,name:"sort",toEl:Ae,originalEvent:t})),te.active&&((Ct==null||Ct===-1)&&(Ct=Ii,Qn=$o),ut({sortable:this,name:"end",toEl:Ae,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){gt("nulling",this),xe=R=Ae=ae=$r=Me=Oa=rr=Pr=Gt=Ao=Ct=Qn=Ii=$o=Ei=jo=Ge=ra=te.dragged=te.ghost=te.clone=te.active=null,el.forEach(function(t){t.checked=!0}),el.length=Ju=Xu=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":R&&(this._onDragOver(t),QT(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],e,n=this.el.children,r=0,i=n.length,o=this.options;r<i;r++)e=n[r],hn(e,o.draggable,this.el,!1)&&t.push(e.getAttribute(o.dataIdAttr)||oO(e));return t},sort:function(t,e){var n={},r=this.el;this.toArray().forEach(function(i,o){var s=r.children[o];hn(s,this.options.draggable,r,!1)&&(n[i]=s)},this),e&&this.captureAnimationState(),t.forEach(function(i){n[i]&&(r.removeChild(n[i]),r.appendChild(n[i]))}),e&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return hn(t,e||this.options.draggable,this.el,!1)},option:function(t,e){var n=this.options;if(e===void 0)return n[t];var r=_s.modifyOption(this,t,e);typeof r<"u"?n[t]=r:n[t]=e,t==="group"&&Cy(n)},destroy:function(){gt("destroy",this);var t=this.el;t[Tt]=null,me(t,"mousedown",this._onTapStart),me(t,"touchstart",this._onTapStart),me(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(me(t,"dragover",this),me(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(e){e.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),Qa.splice(Qa.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!rr){if(gt("hideClone",this),te.eventCanceled)return;ee(Me,"display","none"),this.options.removeCloneOnHide&&Me.parentNode&&Me.parentNode.removeChild(Me),rr=!0}},_showClone:function(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(rr){if(gt("showClone",this),te.eventCanceled)return;R.parentNode==xe&&!this.options.group.revertClone?xe.insertBefore(Me,R):$r?xe.insertBefore(Me,$r):xe.appendChild(Me),this.options.group.revertClone&&this.animate(R,Me),ee(Me,"display",""),rr=!1}}};function QT(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}function sa(t,e,n,r,i,o,s,a){var l,u=t[Tt],c=u.options.onMove,d;return window.CustomEvent&&!Un&&!Ms?l=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(l=document.createEvent("Event"),l.initEvent("move",!0,!0)),l.to=e,l.from=t,l.dragged=n,l.draggedRect=r,l.related=i||e,l.relatedRect=o||Be(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),c&&(d=c.call(u,l,s)),d}function Zu(t){t.draggable=!1}function eO(){ld=!1}function tO(t,e,n){var r=Be(Ki(n.el,0,n.options,!0)),i=10;return e?t.clientX<r.left-i||t.clientY<r.top&&t.clientX<r.right:t.clientY<r.top-i||t.clientY<r.bottom&&t.clientX<r.left}function nO(t,e,n){var r=Be(Rp(n.el,n.options.draggable)),i=10;return e?t.clientX>r.right+i||t.clientX<=r.right&&t.clientY>r.bottom&&t.clientX>=r.left:t.clientX>r.right&&t.clientY>r.top||t.clientX<=r.right&&t.clientY>r.bottom+i}function rO(t,e,n,r,i,o,s,a){var l=r?t.clientY:t.clientX,u=r?n.height:n.width,c=r?n.top:n.left,d=r?n.bottom:n.right,h=!1;if(!s){if(a&&Aa<u*i){if(!zo&&(jo===1?l>c+u*o/2:l<d-u*o/2)&&(zo=!0),zo)h=!0;else if(jo===1?l<c+Aa:l>d-Aa)return-jo}else if(l>c+u*(1-i)/2&&l<d-u*(1-i)/2)return iO(e)}return h=h||s,h&&(l<c+u*o/2||l>d-u*o/2)?l>c+u/2?1:-1:0}function iO(t){return Lt(R)<Lt(t)?1:-1}function oO(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,r=0;n--;)r+=e.charCodeAt(n);return r.toString(36)}function sO(t){el.length=0;for(var e=t.getElementsByTagName("input"),n=e.length;n--;){var r=e[n];r.checked&&el.push(r)}}function Ma(t){return setTimeout(t,0)}function ud(t){return clearTimeout(t)}gu&&ve(document,"touchmove",function(t){(te.active||Ti)&&t.cancelable&&t.preventDefault()});te.utils={on:ve,off:me,css:ee,find:yy,is:function(t,e){return!!hn(t,e,t,!1)},extend:zT,throttle:by,closest:hn,toggleClass:Et,clone:wy,index:Lt,nextTick:Ma,cancelNextTick:ud,detectDirection:Ey,getChild:Ki};te.get=function(t){return t[Tt]};te.mount=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e[0].constructor===Array&&(e=e[0]),e.forEach(function(r){if(!r.prototype||!r.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(r));r.utils&&(te.utils=wn(wn({},te.utils),r.utils)),_s.mount(r)})};te.create=function(t,e){return new te(t,e)};te.version=VT;var Re=[],Mo,cd,dd=!1,Qu,ec,tl,_o;function aO(){function t(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var e in this)e.charAt(0)==="_"&&typeof this[e]=="function"&&(this[e]=this[e].bind(this))}return t.prototype={dragStarted:function(e){var n=e.originalEvent;this.sortable.nativeDraggable?ve(document,"dragover",this._handleAutoScroll):this.options.supportPointer?ve(document,"pointermove",this._handleFallbackAutoScroll):n.touches?ve(document,"touchmove",this._handleFallbackAutoScroll):ve(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var n=e.originalEvent;!this.options.dragOverBubble&&!n.rootEl&&this._handleAutoScroll(n)},drop:function(){this.sortable.nativeDraggable?me(document,"dragover",this._handleAutoScroll):(me(document,"pointermove",this._handleFallbackAutoScroll),me(document,"touchmove",this._handleFallbackAutoScroll),me(document,"mousemove",this._handleFallbackAutoScroll)),Pf(),_a(),HT()},nulling:function(){tl=cd=Mo=dd=_o=Qu=ec=null,Re.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,n){var r=this,i=(e.touches?e.touches[0]:e).clientX,o=(e.touches?e.touches[0]:e).clientY,s=document.elementFromPoint(i,o);if(tl=e,n||this.options.forceAutoScrollFallback||Ms||Un||Vo){tc(e,this.options,s,n);var a=sr(s,!0);dd&&(!_o||i!==Qu||o!==ec)&&(_o&&Pf(),_o=setInterval(function(){var l=sr(document.elementFromPoint(i,o),!0);l!==a&&(a=l,_a()),tc(e,r.options,l,n)},10),Qu=i,ec=o)}else{if(!this.options.bubbleScroll||sr(s,!0)===yn()){_a();return}tc(e,this.options,sr(s,!1),!1)}}},jn(t,{pluginName:"scroll",initializeByDefault:!0})}function _a(){Re.forEach(function(t){clearInterval(t.pid)}),Re=[]}function Pf(){clearInterval(_o)}var tc=by(function(t,e,n,r){if(e.scroll){var i=(t.touches?t.touches[0]:t).clientX,o=(t.touches?t.touches[0]:t).clientY,s=e.scrollSensitivity,a=e.scrollSpeed,l=yn(),u=!1,c;cd!==n&&(cd=n,_a(),Mo=e.scroll,c=e.scrollFn,Mo===!0&&(Mo=sr(n,!0)));var d=0,h=Mo;do{var p=h,f=Be(p),m=f.top,g=f.bottom,y=f.left,b=f.right,k=f.width,v=f.height,w=void 0,x=void 0,T=p.scrollWidth,F=p.scrollHeight,N=ee(p),C=p.scrollLeft,_=p.scrollTop;p===l?(w=k<T&&(N.overflowX==="auto"||N.overflowX==="scroll"||N.overflowX==="visible"),x=v<F&&(N.overflowY==="auto"||N.overflowY==="scroll"||N.overflowY==="visible")):(w=k<T&&(N.overflowX==="auto"||N.overflowX==="scroll"),x=v<F&&(N.overflowY==="auto"||N.overflowY==="scroll"));var L=w&&(Math.abs(b-i)<=s&&C+k<T)-(Math.abs(y-i)<=s&&!!C),W=x&&(Math.abs(g-o)<=s&&_+v<F)-(Math.abs(m-o)<=s&&!!_);if(!Re[d])for(var q=0;q<=d;q++)Re[q]||(Re[q]={});(Re[d].vx!=L||Re[d].vy!=W||Re[d].el!==p)&&(Re[d].el=p,Re[d].vx=L,Re[d].vy=W,clearInterval(Re[d].pid),(L!=0||W!=0)&&(u=!0,Re[d].pid=setInterval(function(){r&&this.layer===0&&te.active._onTouchMove(tl);var K=Re[this.layer].vy?Re[this.layer].vy*a:0,J=Re[this.layer].vx?Re[this.layer].vx*a:0;typeof c=="function"&&c.call(te.dragged.parentNode[Tt],J,K,t,tl,Re[this.layer].el)!=="continue"||ky(Re[this.layer].el,J,K)}.bind({layer:d}),24))),d++}while(e.bubbleScroll&&h!==l&&(h=sr(h,!1)));dd=u}},30),Oy=function(t){var e=t.originalEvent,n=t.putSortable,r=t.dragEl,i=t.activeSortable,o=t.dispatchSortableEvent,s=t.hideGhostForTarget,a=t.unhideGhostForTarget;if(e){var l=n||i;s();var u=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,c=document.elementFromPoint(u.clientX,u.clientY);a(),l&&!l.el.contains(c)&&(o("spill"),this.onSpill({dragEl:r,putSortable:n}))}};function Pp(){}Pp.prototype={startIndex:null,dragStart:function(t){var e=t.oldDraggableIndex;this.startIndex=e},onSpill:function(t){var e=t.dragEl,n=t.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var r=Ki(this.sortable.el,this.startIndex,this.options);r?this.sortable.el.insertBefore(e,r):this.sortable.el.appendChild(e),this.sortable.animateAll(),n&&n.animateAll()},drop:Oy};jn(Pp,{pluginName:"revertOnSpill"});function Fp(){}Fp.prototype={onSpill:function(t){var e=t.dragEl,n=t.putSortable,r=n||this.sortable;r.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),r.animateAll()},drop:Oy};jn(Fp,{pluginName:"removeOnSpill"});te.mount(new aO);te.mount(Fp,Pp);function nc(t){t.parentElement!==null&&t.parentElement.removeChild(t)}function Ff(t,e,n){const r=n===0?t.children[0]:t.children[n-1].nextSibling;t.insertBefore(e,r)}function lO(){return typeof window<"u"?window.console:global.console}const uO=lO();function cO(t){const e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}const dO=/-(\w)/g,pO=cO(t=>t.replace(dO,(e,n)=>n.toUpperCase())),Ay=["Start","Add","Remove","Update","End"],My=["Choose","Unchoose","Sort","Filter","Clone"],_y=["Move"],hO=[_y,Ay,My].flatMap(t=>t).map(t=>`on${t}`),pd={manage:_y,manageAndEmit:Ay,emit:My};function fO(t){return hO.indexOf(t)!==-1}const mO=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"];function gO(t){return mO.includes(t)}function vO(t){return["transition-group","TransitionGroup"].includes(t)}function Dy(t){return["id","class","role","style"].includes(t)||t.startsWith("data-")||t.startsWith("aria-")||t.startsWith("on")}function Ny(t){return t.reduce((e,[n,r])=>(e[n]=r,e),{})}function yO({$attrs:t,componentData:e={}}){return{...Ny(Object.entries(t).filter(([n,r])=>Dy(n))),...e}}function bO({$attrs:t,callBackBuilder:e}){const n=Ny(Iy(t));Object.entries(e).forEach(([i,o])=>{pd[i].forEach(s=>{n[`on${s}`]=o(s)})});const r=`[data-draggable]${n.draggable||""}`;return{...n,draggable:r}}function Iy(t){return Object.entries(t).filter(([e,n])=>!Dy(e)).map(([e,n])=>[pO(e),n]).filter(([e,n])=>!fO(e))}const Lf=({el:t})=>t,kO=(t,e)=>t.__draggable_context=e,Vf=t=>t.__draggable_context;class wO{constructor({nodes:{header:e,default:n,footer:r},root:i,realList:o}){this.defaultNodes=n,this.children=[...e,...n,...r],this.externalComponent=i.externalComponent,this.rootTransition=i.transition,this.tag=i.tag,this.realList=o}get _isRootComponent(){return this.externalComponent||this.rootTransition}render(e,n){const{tag:r,children:i,_isRootComponent:o}=this;return e(r,n,o?{default:()=>i}:i)}updated(){const{defaultNodes:e,realList:n}=this;e.forEach((r,i)=>{kO(Lf(r),{element:n[i],index:i})})}getUnderlyingVm(e){return Vf(e)}getVmIndexFromDomIndex(e,n){const{defaultNodes:r}=this,{length:i}=r,o=n.children,s=o.item(e);if(s===null)return i;const a=Vf(s);if(a)return a.index;if(i===0)return 0;const l=Lf(r[0]),u=[...o].findIndex(c=>c===l);return e<u?0:i}}function xO(t,e){const n=t[e];return n?n():[]}function EO({$slots:t,realList:e,getKey:n}){const r=e||[],[i,o]=["header","footer"].map(l=>xO(t,l)),{item:s}=t;if(!s)throw new Error("draggable element must have an item slot");const a=r.flatMap((l,u)=>s({element:l,index:u}).map(c=>(c.key=n(l),c.props={...c.props||{},"data-draggable":!0},c)));if(a.length!==r.length)throw new Error("Item slot must have only one child");return{header:i,footer:o,default:a}}function CO(t){const e=vO(t),n=!gO(t)&&!e;return{transition:e,externalComponent:n,tag:n?Ek(t):e?Ck:t}}function SO({$slots:t,tag:e,realList:n,getKey:r}){const i=EO({$slots:t,realList:n,getKey:r}),o=CO(e);return new wO({nodes:i,root:o,realList:n})}function Ry(t,e){kr(()=>this.$emit(t.toLowerCase(),e))}function Py(t){return(e,n)=>{if(this.realList!==null)return this[`onDrag${t}`](e,n)}}function TO(t){const e=Py.call(this,t);return(n,r)=>{e.call(this,n,r),Ry.call(this,t,n)}}let rc=null;const OO={list:{type:Array,required:!1,default:null},modelValue:{type:Array,required:!1,default:null},itemKey:{type:[String,Function],required:!0},clone:{type:Function,default:t=>t},tag:{type:String,default:"div"},move:{type:Function,default:null},componentData:{type:Object,required:!1,default:null}},AO=["update:modelValue","change",...[...pd.manageAndEmit,...pd.emit].map(t=>t.toLowerCase())],Fy=Q({name:"draggable",inheritAttrs:!1,props:OO,emits:AO,data(){return{error:!1}},render(){try{this.error=!1;const{$slots:t,$attrs:e,tag:n,componentData:r,realList:i,getKey:o}=this,s=SO({$slots:t,tag:n,realList:i,getKey:o});this.componentStructure=s;const a=yO({$attrs:e,componentData:r});return s.render(ns,a)}catch(t){return this.error=!0,ns("pre",{style:{color:"red"}},t.stack)}},created(){this.list!==null&&this.modelValue!==null&&uO.error("modelValue and list props are mutually exclusive! Please set one or another.")},mounted(){if(this.error)return;const{$attrs:t,$el:e,componentStructure:n}=this;n.updated();const r=bO({$attrs:t,callBackBuilder:{manageAndEmit:o=>TO.call(this,o),emit:o=>Ry.bind(this,o),manage:o=>Py.call(this,o)}}),i=e.nodeType===1?e:e.parentElement;this._sortable=new te(i,r),this.targetDomElement=i,i.__draggable_component__=this},updated(){this.componentStructure.updated()},beforeUnmount(){this._sortable!==void 0&&this._sortable.destroy()},computed:{realList(){const{list:t}=this;return t||this.modelValue},getKey(){const{itemKey:t}=this;return typeof t=="function"?t:e=>e[t]}},watch:{$attrs:{handler(t){const{_sortable:e}=this;e&&Iy(t).forEach(([n,r])=>{e.option(n,r)})},deep:!0}},methods:{getUnderlyingVm(t){return this.componentStructure.getUnderlyingVm(t)||null},getUnderlyingPotencialDraggableComponent(t){return t.__draggable_component__},emitChanges(t){kr(()=>this.$emit("change",t))},alterList(t){if(this.list){t(this.list);return}const e=[...this.modelValue];t(e),this.$emit("update:modelValue",e)},spliceList(){const t=e=>e.splice(...arguments);this.alterList(t)},updatePosition(t,e){const n=r=>r.splice(e,0,r.splice(t,1)[0]);this.alterList(n)},getRelatedContextFromMoveEvent({to:t,related:e}){const n=this.getUnderlyingPotencialDraggableComponent(t);if(!n)return{component:n};const r=n.realList,i={list:r,component:n};return t!==e&&r?{...n.getUnderlyingVm(e)||{},...i}:i},getVmIndexFromDomIndex(t){return this.componentStructure.getVmIndexFromDomIndex(t,this.targetDomElement)},onDragStart(t){this.context=this.getUnderlyingVm(t.item),t.item._underlying_vm_=this.clone(this.context.element),rc=t.item},onDragAdd(t){const e=t.item._underlying_vm_;if(e===void 0)return;nc(t.item);const n=this.getVmIndexFromDomIndex(t.newIndex);this.spliceList(n,0,e);const r={element:e,newIndex:n};this.emitChanges({added:r})},onDragRemove(t){if(Ff(this.$el,t.item,t.oldIndex),t.pullMode==="clone"){nc(t.clone);return}const{index:e,element:n}=this.context;this.spliceList(e,1);const r={element:n,oldIndex:e};this.emitChanges({removed:r})},onDragUpdate(t){nc(t.item),Ff(t.from,t.item,t.oldIndex);const e=this.context.index,n=this.getVmIndexFromDomIndex(t.newIndex);this.updatePosition(e,n);const r={element:this.context.element,oldIndex:e,newIndex:n};this.emitChanges({moved:r})},computeFutureIndex(t,e){if(!t.element)return 0;const n=[...e.to.children].filter(o=>o.style.display!=="none"),r=n.indexOf(e.related),i=t.component.getVmIndexFromDomIndex(r);return n.indexOf(rc)!==-1||!e.willInsertAfter?i:i+1},onDragMove(t,e){const{move:n,realList:r}=this;if(!n||!r)return!0;const i=this.getRelatedContextFromMoveEvent(t),o=this.computeFutureIndex(i,t),s={...this.context,futureIndex:o},a={...t,relatedContext:i,draggedContext:s};return n(a,e)},onDragEnd(){rc=null}}}),MO={key:0,class:"k-media__label-wrapper"},_O={key:1,class:"k-media__sublabel"},SL=Q({__name:"Media",props:{modelValue:{},types:{default:()=>["Image"]},label:{},sublabel:{},multiple:{type:Boolean},sortable:{type:Boolean,default:!0},upload:{type:Function,default:()=>(t,e,n)=>(console.warn("[@kvass-ui/media]: You need to setup the upload function before using this component!"),e(50),new Promise((r,i)=>{let o=new FileReader;o.onloadend=function(){r({url:o.result,type:t.type})},o.readAsDataURL(t)}))},size:{default:"cover"},placement:{default:"outside"},uploadOptions:{default:()=>({})},description:{type:Boolean,default:!0},dropMessage:{default:"Drag an image here or <b>browse</b> to upload."},type:{default:"file"},accept:{default:"image/*"},labels:{default:()=>({cancel:"Cancel",save:"Save",selectMessage:"Select a type from the menu",select:"Select",descriptionPlaceholder:"Add caption...",image:{createLabel:"Image"}})},required:{type:Boolean},disabled:{type:Boolean},thumbnailSize:{default:"4rem"}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=X(null),o=D(()=>i.value?n.modelValue instanceof Array?n.modelValue.find(p=>{var f;return p.url===((f=i.value)==null?void 0:f.url)}):n.modelValue:null),s=D({get(){return n.modelValue?(n.modelValue instanceof Array?n.modelValue:[n.modelValue]).map(p=>{var f;return{...p,selected:((f=i.value)==null?void 0:f.url)===p.url,typeConfig:a.value.find(m=>m.condition(p))}}):[]},set(p){n.multiple&&r("update:modelValue",p.map(f=>{let{selected:m,typeConfig:g,...y}=f;return y}))}}),a=D(()=>n.types.map(p=>typeof p=="string"?RT[p]:p).filter(Boolean));Ee(()=>n.modelValue,(p,f)=>{(!i.value||!s.value.find(m=>{var g;return m.url===((g=i.value)==null?void 0:g.url)}))&&l()},{immediate:!0});function l(p){return!n.modelValue||n.multiple&&!n.modelValue.length?i.value=null:p?i.value=p:i.value=s.value[0]}function u(p){var f;let{selected:m,typeConfig:g,...y}=p;r("update:modelValue",n.multiple?(n.modelValue||[]).filter(b=>b.url!==y.url):null),((f=i?.value)==null?void 0:f.url)===p.url&&kr(()=>{l()})}function c(p){r("update:modelValue",n.multiple?[...n.modelValue||[],p]:p),kr(()=>l(s.value.find(f=>f.url===p.url)))}function d(p){r("update:modelValue",p)}const h=rn("k-media",{variants:{placement:{outside:"k-media--placement-outside",inside:"k-media--placement-inside"}}});return(p,f)=>(E(),O("div",{class:Ce(B(h)({placement:p.placement}))},[p.label||p.sublabel||p.$slots.sublabel||p.$slots.label?(E(),O("div",MO,[p.label||p.$slots.label?(E(),O("label",{key:0,class:Ce(["k-media__label",{"k-media__label-required":p.required}])},[P(p.$slots,"label",{},()=>[$e(se(p.label),1)])],2)):I("",!0),p.sublabel||p.$slots.sublabel?(E(),O("span",_O,[P(p.$slots,"sublabel",{},()=>[$e(se(p.sublabel),1)])])):I("",!0)])):I("",!0),he(MT,{type:p.type,accept:p.accept,ref:"input",value:p.modelValue,multiple:p.multiple,required:p.required,onSelect:l,onRemove:u,onInput:d,selected:i.value,disabled:p.disabled,"upload-options":p.uploadOptions,upload:p.upload,dropMessage:p.dropMessage},Cs({default:Z(({openFileWindow:m})=>[he(vT,{onOpenFileWindow:m,ref:"typeSelector",value:a.value,onAdd:c,labels:p.labels,upload:p.upload},null,8,["onOpenFileWindow","value","labels","upload"])]),"drop-message":Z(()=>[P(p.$slots,"drop-message")]),"custom-message":Z(()=>[P(p.$slots,"custom-message")]),_:2},[i.value?{name:"preview",fn:Z(()=>[p.description&&o.value?(E(),$(yT,{key:0,modelValue:o.value.description,"onUpdate:modelValue":f[0]||(f[0]=m=>o.value.description=m),disabled:p.disabled,placeholder:p.labels.descriptionPlaceholder},null,8,["modelValue","disabled","placeholder"])):I("",!0),(E(),$(Qe(i.value.typeConfig.components.Preview),{value:i.value,size:p.size},null,8,["value","size"]))]),key:"0"}:void 0]),1032,["type","accept","value","multiple","required","selected","disabled","upload-options","upload","dropMessage"]),P(p.$slots,"bottom"),p.multiple?(E(),$(B(Fy),{key:1,modelValue:s.value,"onUpdate:modelValue":f[1]||(f[1]=m=>s.value=m),sort:p.sortable&&!p.disabled,class:"k-media__thumbnails","item-key":"url",animation:200,onEnd:f[2]||(f[2]=(m,g)=>{i.value=s.value[m.newIndex]})},{item:Z(({element:m,index:g})=>[(E(),$(fT,{onKeydown:op(y=>i.value=m,["enter"]),tabindex:"0",size:p.thumbnailSize,key:m.url,value:m,disabled:p.disabled,onClick:y=>i.value=m,onDelete:y=>u(m)},null,8,["onKeydown","size","value","disabled","onClick","onDelete"]))]),_:1},8,["modelValue","sort"])):I("",!0)],2))}});var DO=Ln("switch").parts("root","label","control","thumb"),aa=DO.build(),Ly=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`switch:${t.id}`},Bf=t=>{var e;return((e=t.ids)==null?void 0:e.label)??`switch:${t.id}:label`},NO=t=>{var e;return((e=t.ids)==null?void 0:e.thumb)??`switch:${t.id}:thumb`},IO=t=>{var e;return((e=t.ids)==null?void 0:e.control)??`switch:${t.id}:control`},hd=t=>{var e;return((e=t.ids)==null?void 0:e.hiddenInput)??`switch:${t.id}:input`},RO=t=>t.getById(Ly(t)),Do=t=>t.getById(hd(t));function PO(t,e){const{context:n,send:r,prop:i,scope:o}=t,s=i("disabled"),a=i("readOnly"),l=!!n.get("checked"),u=!s&&n.get("focused"),c=!s&&n.get("focusVisible"),d={"data-active":G(n.get("active")),"data-focus":G(u),"data-focus-visible":G(c),"data-readonly":G(a),"data-hover":G(n.get("hovered")),"data-disabled":G(s),"data-state":l?"checked":"unchecked","data-invalid":G(i("invalid"))};return{checked:l,disabled:s,focused:u,setChecked(h){r({type:"CHECKED.SET",checked:h,isTrusted:!1})},toggleChecked(){r({type:"CHECKED.TOGGLE",checked:l,isTrusted:!1})},getRootProps(){return e.label({...aa.root.attrs,...d,dir:i("dir"),id:Ly(o),htmlFor:hd(o),onPointerMove(){s||r({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){s||r({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(h){s||ct(h)===Do(o)&&h.stopPropagation()}})},getLabelProps(){return e.element({...aa.label.attrs,...d,dir:i("dir"),id:Bf(o)})},getThumbProps(){return e.element({...aa.thumb.attrs,...d,dir:i("dir"),id:NO(o),"aria-hidden":!0})},getControlProps(){return e.element({...aa.control.attrs,...d,dir:i("dir"),id:IO(o),"aria-hidden":!0})},getHiddenInputProps(){return e.input({id:hd(o),type:"checkbox",required:i("required"),defaultChecked:l,disabled:s,"aria-labelledby":Bf(o),"aria-invalid":i("invalid"),name:i("name"),form:i("form"),value:i("value"),style:bp,onFocus(){const h=is();r({type:"CONTEXT.SET",context:{focused:!0,focusVisible:h}})},onBlur(){r({type:"CONTEXT.SET",context:{focused:!1,focusVisible:!1}})},onClick(h){if(a){h.preventDefault();return}const p=h.currentTarget.checked;r({type:"CHECKED.SET",checked:p,isTrusted:!0})}})}}}var{not:$f}=eu(),FO={props({props:t}){return{defaultChecked:!1,label:"switch",value:"on",...t}},initialState(){return"ready"},context({prop:t,bindable:e}){return{checked:e(()=>({defaultValue:t("defaultChecked"),value:t("checked"),onChange(n){var r;(r=t("onCheckedChange"))==null||r({checked:n})}})),fieldsetDisabled:e(()=>({defaultValue:!1})),focusVisible:e(()=>({defaultValue:!1})),active:e(()=>({defaultValue:!1})),focused:e(()=>({defaultValue:!1})),hovered:e(()=>({defaultValue:!1}))}},computed:{isDisabled:({context:t,prop:e})=>e("disabled")||t.get("fieldsetDisabled")},watch({track:t,prop:e,context:n,action:r}){t([()=>e("disabled")],()=>{r(["removeFocusIfNeeded"])}),t([()=>n.get("checked")],()=>{r(["syncInputElement"])})},effects:["trackFormControlState","trackPressEvent","trackFocusVisible"],on:{"CHECKED.TOGGLE":[{guard:$f("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:$f("isTrusted"),actions:["setChecked","dispatchChangeEvent"]},{actions:["setChecked"]}],"CONTEXT.SET":{actions:["setContext"]}},states:{ready:{}},implementations:{guards:{isTrusted:({event:t})=>!!t.isTrusted},effects:{trackPressEvent({computed:t,scope:e,context:n}){if(!t("isDisabled"))return dv({pointerNode:RO(e),keyboardNode:Do(e),isValidKey:r=>r.key===" ",onPress:()=>n.set("active",!1),onPressStart:()=>n.set("active",!0),onPressEnd:()=>n.set("active",!1)})},trackFocusVisible({computed:t,scope:e}){if(!t("isDisabled"))return kp({root:e.getRootNode()})},trackFormControlState({context:t,send:e,scope:n}){return Yl(Do(n),{onFieldsetDisabledChange(r){t.set("fieldsetDisabled",r)},onFormReset(){const r=t.initial("checked");e({type:"CHECKED.SET",checked:!!r,src:"form-reset"})}})}},actions:{setContext({context:t,event:e}){for(const n in e.context)t.set(n,e.context[n])},syncInputElement({context:t,scope:e}){const n=Do(e);n&&mp(n,!!t.get("checked"))},removeFocusIfNeeded({context:t,prop:e}){e("disabled")&&t.set("focused",!1)},setChecked({context:t,event:e}){t.set("checked",e.checked)},toggleChecked({context:t}){t.set("checked",!t.get("checked"))},dispatchChangeEvent({context:t,scope:e}){const n=Do(e);gp(n,{checked:t.get("checked")})}}}};Wn()(["checked","defaultChecked","dir","disabled","form","getRootNode","id","ids","invalid","label","name","onCheckedChange","readOnly","required","value"]);const LO={class:"k-switch__label"},TL=Q({__name:"Switch",props:{modelValue:{type:Boolean},disabled:{type:Boolean},getRootNode:{type:Function},labels:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=pi(FO,{id:Qt(),...n,defaultChecked:n.modelValue,onCheckedChange:({checked:s})=>r("update:modelValue",s)}),o=D(()=>PO(i,di));return Ee(()=>n.modelValue,()=>{if(o.value.checked!==n.modelValue)return o.value.setChecked(n.modelValue)}),(s,a)=>(E(),O("label",ne({class:"k-switch"},o.value.getRootProps()),[H("input",be(Ne(o.value.getHiddenInputProps())),null,16),H("span",be(Ne(o.value.getControlProps())),[H("span",be(Ne(o.value.getThumbProps())),null,16)],16),s.labels||s.$slots.default?(E(),O("span",be(ne({key:0},o.value.getLabelProps())),[H("span",LO,[P(s.$slots,"default",{checked:o.value.checked},()=>[$e(se(o.value.checked?s.labels.on:s.labels.off),1)])])],16)):I("",!0)],16))}}),OL=Q({__name:"LazyLoad",props:{wrapperTag:{default:"div"},threshold:{default:0},observerRoot:{default:null}},emits:["intersect"],setup(t,{emit:e}){const n=t,r=e,i=X(!1);function o(u){const c=u[0];c.isIntersecting&&(i.value=!0,kr(()=>{r("intersect",c),l()}))}const s=X(),a=X();qn(()=>{s.value=new IntersectionObserver(o,{root:n.observerRoot,threshold:n.threshold}),s.value.observe(a.value)}),ao(()=>{l()});function l(){s.value&&s.value.disconnect()}return(u,c)=>(E(),$(Qe(u.wrapperTag),{ref_key:"rootRef",ref:a,class:"k-lazyload"},{default:Z(()=>[i.value?P(u.$slots,"default",{key:0}):P(u.$slots,"placeholder",{key:1})]),_:3},512))}}),VO={class:"k-file-uploader__bar"},BO={class:"k-file-uploader__meta"},$O={key:0},jO={key:1},zO=Q({__name:"Uploader",props:{value:{},bytes:{},current:{default:1},total:{default:1}},setup(t){const e=t,n=D(()=>e.total>1),r=D(()=>Np(e.bytes)),i=D(()=>Math.floor(e.value));return(o,s)=>(E(),$(ni,{class:"k-file-uploader",align:"center",justify:"space-between",gap:"0rem"},{default:Z(()=>[H("div",null,se(i.value)+" %",1),H("div",VO,[H("div",{class:"k-file-uploader__bar-value",style:Cr({width:o.value+"%"})},null,4)]),H("div",BO,[n.value?(E(),O("div",$O,se(o.current)+" / "+se(o.total),1)):I("",!0),o.bytes?(E(),O("div",jO,"("+se(r.value)+")",1)):I("",!0)])]),_:1}))}}),HO=["innerHTML"],qO=Q({__name:"SlotHandler",props:{value:{}},setup(t){const e=t,n=D(()=>typeof e.value=="string"?e.value:void 0),r=D(()=>typeof e.value=="string"?"div":e.value);return(i,o)=>(E(),$(Qe(r.value),be(Ne(i.$attrs)),{default:Z(()=>[n.value?(E(),O("span",{key:0,innerHTML:n.value},null,8,HO)):I("",!0)]),_:1},16))}}),WO={class:"k-file-droparea__instruction"},UO=["accept","required","disabled","multiple"],KO=Q({__name:"DropArea",props:{value:{},multiple:{type:Boolean},upload:{},uploadOptions:{},accept:{},dropMessage:{},disabled:{type:Boolean},required:{type:Boolean},rename:{type:Boolean},labels:{}},emits:["input"],setup(t,{emit:e}){const n=t,r=e,i=X(!1),o=X(!0),s=X(),a=D(()=>!!(!n.required||n.value)),l=D(()=>n.disabled),u=D(()=>!l.value&&!h.total),c=D(()=>pT(n.accept)),{run:d,queue:h}=new fy(n);function p(k){return d(k).then(v=>{!v||!v.length||r("input",n.multiple?[...n.value||[],...v]:v[0])})}async function f(k){if(l.value)return;let v=k.target.files||[];n.uploadOptions.preTransform&&(v=await n.uploadOptions.preTransform(k)),p(v),s.value&&(s.value.value="")}async function m(k){var v;if(l.value||!s.value)return;if(k.preventDefault(),!o.value)return y();y();let w=(v=k.dataTransfer)==null?void 0:v.files;w!=null&&w.length&&(n.uploadOptions.preTransform&&(w=await n.uploadOptions.preTransform(k)),w!=null&&w.length&&(s.value.files=k.dataTransfer.files,s.value.dispatchEvent(new InputEvent("input")),p(w)))}function g(k){if(l.value||!k.dataTransfer)return;const v=Array.from(k.dataTransfer.items).every(x=>Ip(x,n.accept)),w=n.multiple?!0:k.dataTransfer.items.length===1;o.value=v&&w,i.value=!0,k.preventDefault()}function y(){o.value=!0,i.value=!1}const b=rn("k-file-droparea",{variants:{active:{true:"k-file-droparea--active"},invalid:{true:"k-file-droparea--invalid"},disabled:{true:"k-file-droparea--disabled"}}});return(k,v)=>(E(),O(Ie,null,[H("div",{class:Ce(B(b)({active:i.value,invalid:!o.value,disabled:l.value})),onDrop:m,onDragover:g,onDragleave:y},[P(k.$slots,"preview"),H("div",WO,[u.value?(E(),O("input",{key:0,type:"file",accept:Array.isArray(k.accept)?k.accept.join(","):k.accept,required:a.value,ref_key:"input",ref:s,onChange:f,disabled:!u.value,multiple:k.multiple,class:"k-file-droparea__input"},null,40,UO)):I("",!0),o.value?P(k.$slots,"drop-message",{key:1,extensions:c.value},()=>[he(qO,{value:k.dropMessage,extensions:c.value},null,8,["value","extensions"])]):(E(),$(B(Ze),{key:2,icon:"fa-pro-light:ban",style:{"font-size":"2rem"}})),P(k.$slots,"custom-message")])],34),B(h).total?(E(),$(zO,{key:0,value:B(h).progress,bytes:B(h).bytes,current:B(h).counter,total:B(h).total},null,8,["value","bytes","current","total"])):I("",!0)],64))}}),GO=Os?window:void 0;function JO(t){var e;const n=He(t);return(e=n?.$el)!=null?e:n}function XO(...t){const e=[],n=()=>{e.forEach(a=>a()),e.length=0},r=(a,l,u,c)=>(a.addEventListener(l,u,c),()=>a.removeEventListener(l,u,c)),i=D(()=>{const a=Gr(He(t[0])).filter(l=>l!=null);return a.every(l=>typeof l!="string")?a:void 0}),o=Ov(()=>{var a,l;return[(l=(a=i.value)==null?void 0:a.map(u=>JO(u)))!=null?l:[GO].filter(u=>u!=null),Gr(He(i.value?t[1]:t[0])),Gr(B(i.value?t[2]:t[1])),He(i.value?t[3]:t[2])]},([a,l,u,c])=>{if(n(),!(a!=null&&a.length)||!(l!=null&&l.length)||!(u!=null&&u.length))return;const d=Tv(c)?{...c}:c;e.push(...a.flatMap(h=>l.flatMap(p=>u.map(f=>r(h,p,f,d)))))},{flush:"post"}),s=()=>{o(),n()};return Ts(n),s}const YO=Q({name:"UseClipboard",props:["source","read","navigator","copiedDuring","legacy"],setup(t,{slots:e}){const n=sp(U1(t));return()=>{var r;return(r=e.default)==null?void 0:r.call(e,n)}}});function ic(t){return typeof Window<"u"&&t instanceof Window?t.document.documentElement:typeof Document<"u"&&t instanceof Document?t.documentElement:t}function Vy(t){const e=window.getComputedStyle(t);if(e.overflowX==="scroll"||e.overflowY==="scroll"||e.overflowX==="auto"&&t.clientWidth<t.scrollWidth||e.overflowY==="auto"&&t.clientHeight<t.scrollHeight)return!0;{const n=t.parentNode;return!n||n.tagName==="BODY"?!1:Vy(n)}}function ZO(t){const e=t||window.event,n=e.target;return Vy(n)?!1:e.touches.length>1?!0:(e.preventDefault&&e.preventDefault(),!1)}const oc=new WeakMap;function QO(t,e=!1){const n=qt(e);let r=null,i="";Ee(j1(t),a=>{const l=ic(He(a));if(l){const u=l;if(oc.get(u)||oc.set(u,u.style.overflow),u.style.overflow!=="hidden"&&(i=u.style.overflow),u.style.overflow==="hidden")return n.value=!0;if(n.value)return u.style.overflow="hidden"}},{immediate:!0});const o=()=>{const a=ic(He(t));!a||n.value||(Qh&&(r=XO(a,"touchmove",l=>{ZO(l)},{passive:!1})),a.style.overflow="hidden",n.value=!0)},s=()=>{const a=ic(He(t));!a||!n.value||(Qh&&r?.(),a.style.overflow=i,oc.delete(a),n.value=!1)};return Ts(s),D({get(){return n.value},set(a){a?o():s()}})}function eA(){let t=!1;const e=qt(!1);return(n,r)=>{if(e.value=r.value,t)return;t=!0;const i=QO(n,r.value);Ee(e,o=>i.value=o)}}eA();var tA=Ln("toggle-group").parts("root","item"),jf=tA.build(),nl=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`toggle-group:${t.id}`},nA=(t,e)=>{var n,r;return((r=(n=t.ids)==null?void 0:n.item)==null?void 0:r.call(n,e))??`toggle-group:${t.id}:${e}`},By=t=>t.getById(nl(t)),vu=t=>{const e=`[data-ownedby='${CSS.escape(nl(t))}']:not([data-disabled])`;return yp(By(t),e)},zf=t=>vv(vu(t)),rA=t=>yv(vu(t)),iA=(t,e,n)=>Dx(vu(t),e,n),oA=(t,e,n)=>Nx(vu(t),e,n);function sA(t,e){const{context:n,send:r,prop:i,scope:o}=t,s=n.get("value"),a=i("disabled"),l=!i("multiple"),u=i("rovingFocus"),c=i("orientation")==="horizontal";function d(h){const p=nA(o,h.value);return{id:p,disabled:!!(h.disabled||a),pressed:!!s.includes(h.value),focused:n.get("focusedId")===p}}return{value:s,setValue(h){r({type:"VALUE.SET",value:h})},getRootProps(){return e.element({...jf.root.attrs,id:nl(o),dir:i("dir"),role:l?"radiogroup":"group",tabIndex:n.get("isTabbingBackward")?-1:0,"data-disabled":G(a),"data-orientation":i("orientation"),"data-focus":G(n.get("focusedId")!=null),style:{outline:"none"},onMouseDown(){a||r({type:"ROOT.MOUSE_DOWN"})},onFocus(h){a||h.currentTarget===ct(h)&&(n.get("isClickFocus")||n.get("isTabbingBackward")||r({type:"ROOT.FOCUS"}))},onBlur(){a||r({type:"ROOT.BLUR"})}})},getItemState:d,getItemProps(h){const p=d(h),f=p.focused?0:-1;return e.button({...jf.item.attrs,id:p.id,type:"button","data-ownedby":nl(o),"data-focus":G(p.focused),disabled:p.disabled,tabIndex:u?f:void 0,role:l?"radio":void 0,"aria-checked":l?p.pressed:void 0,"aria-pressed":l?void 0:p.pressed,"data-disabled":G(p.disabled),"data-orientation":i("orientation"),dir:i("dir"),"data-state":p.pressed?"on":"off",onFocus(){p.disabled||r({type:"TOGGLE.FOCUS",id:p.id})},onClick(m){p.disabled||(r({type:"TOGGLE.CLICK",id:p.id,value:h.value}),rx()&&m.currentTarget.focus({preventScroll:!0}))},onKeyDown(m){if(m.defaultPrevented||!sx(m)||p.disabled)return;const g={Tab(y){const b=y.shiftKey;r({type:"TOGGLE.SHIFT_TAB",isShiftTab:b})},ArrowLeft(){!u||!c||r({type:"TOGGLE.FOCUS_PREV"})},ArrowRight(){!u||!c||r({type:"TOGGLE.FOCUS_NEXT"})},ArrowUp(){!u||c||r({type:"TOGGLE.FOCUS_PREV"})},ArrowDown(){!u||c||r({type:"TOGGLE.FOCUS_NEXT"})},Home(){u&&r({type:"TOGGLE.FOCUS_FIRST"})},End(){u&&r({type:"TOGGLE.FOCUS_LAST"})}}[iv(m)];g&&(g(m),m.key!=="Tab"&&m.preventDefault())}})}}}var{not:Hf,and:aA}=eu(),lA={props({props:t}){return{defaultValue:[],orientation:"horizontal",rovingFocus:!0,loopFocus:!0,...t}},initialState(){return"idle"},context({prop:t,bindable:e}){return{value:e(()=>({defaultValue:t("defaultValue"),value:t("value"),onChange(n){var r;(r=t("onValueChange"))==null||r({value:n})}})),focusedId:e(()=>({defaultValue:null})),isTabbingBackward:e(()=>({defaultValue:!1})),isClickFocus:e(()=>({defaultValue:!1})),isWithinToolbar:e(()=>({defaultValue:!1}))}},computed:{currentLoopFocus:({context:t,prop:e})=>e("loopFocus")&&!t.get("isWithinToolbar")},entry:["checkIfWithinToolbar"],on:{"VALUE.SET":{actions:["setValue"]},"TOGGLE.CLICK":{actions:["setValue"]},"ROOT.MOUSE_DOWN":{actions:["setClickFocus"]}},states:{idle:{on:{"ROOT.FOCUS":{target:"focused",guard:Hf(aA("isClickFocus","isTabbingBackward")),actions:["focusFirstToggle","clearClickFocus"]},"TOGGLE.FOCUS":{target:"focused",actions:["setFocusedId"]}}},focused:{on:{"ROOT.BLUR":{target:"idle",actions:["clearIsTabbingBackward","clearFocusedId"]},"TOGGLE.FOCUS":{actions:["setFocusedId"]},"TOGGLE.FOCUS_NEXT":{actions:["focusNextToggle"]},"TOGGLE.FOCUS_PREV":{actions:["focusPrevToggle"]},"TOGGLE.FOCUS_FIRST":{actions:["focusFirstToggle"]},"TOGGLE.FOCUS_LAST":{actions:["focusLastToggle"]},"TOGGLE.SHIFT_TAB":[{guard:Hf("isFirstToggleFocused"),target:"idle",actions:["setIsTabbingBackward"]},{actions:["setIsTabbingBackward"]}]}}},implementations:{guards:{isClickFocus:({context:t})=>t.get("isClickFocus"),isTabbingBackward:({context:t})=>t.get("isTabbingBackward"),isFirstToggleFocused:({context:t,scope:e})=>{var n;return t.get("focusedId")===((n=zf(e))==null?void 0:n.id)}},actions:{setIsTabbingBackward({context:t}){t.set("isTabbingBackward",!0)},clearIsTabbingBackward({context:t}){t.set("isTabbingBackward",!1)},setClickFocus({context:t}){t.set("isClickFocus",!0)},clearClickFocus({context:t}){t.set("isClickFocus",!1)},checkIfWithinToolbar({context:t,scope:e}){var n;const r=(n=By(e))==null?void 0:n.closest("[role=toolbar]");t.set("isWithinToolbar",!!r)},setFocusedId({context:t,event:e}){t.set("focusedId",e.id)},clearFocusedId({context:t}){t.set("focusedId",null)},setValue({context:t,event:e,prop:n}){p1(e,["value"]);let r=t.get("value");Yx(e.value)?r=e.value:n("multiple")?r=Jx(r,e.value):r=Ss(r,[e.value])?[]:[e.value],t.set("value",r)},focusNextToggle({context:t,scope:e,prop:n}){At(()=>{var r;const i=t.get("focusedId");i&&((r=iA(e,i,n("loopFocus")))==null||r.focus({preventScroll:!0}))})},focusPrevToggle({context:t,scope:e,prop:n}){At(()=>{var r;const i=t.get("focusedId");i&&((r=oA(e,i,n("loopFocus")))==null||r.focus({preventScroll:!0}))})},focusFirstToggle({scope:t}){At(()=>{var e;(e=zf(t))==null||e.focus({preventScroll:!0})})},focusLastToggle({scope:t}){At(()=>{var e;(e=rA(t))==null||e.focus({preventScroll:!0})})}}}};Wn()(["dir","disabled","getRootNode","id","ids","loopFocus","multiple","onValueChange","orientation","rovingFocus","value","defaultValue"]);Wn()(["value","disabled"]);const $y=Q({__name:"ButtonGroup",props:{modelValue:{},items:{},dropdownItems:{},direction:{default:"horizontal"},multiple:{type:Boolean},disabled:{type:Boolean},getRootNode:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=pi(lA,{id:Qt(),...n,orientation:n.direction,defaultValue:n.modelValue,onValueChange:({value:a})=>{r("update:modelValue",a)},rovingFocus:!0,loopFocus:!0}),o=D(()=>sA(i,di)),s=X();return Ee(()=>{var a;return(a=s.value)==null?void 0:a.isOpen},a=>{a||!o.value.value.includes("dropdown")||o.value.setValue(o.value.value.filter(l=>l!=="dropdown"))}),Ee(()=>n.modelValue,a=>{o.value.setValue([...a])},{deep:!1}),(a,l)=>(E(),O("div",ne({class:["k-buttongroup",`k-buttongroup--direction-${a.direction}`]},o.value.getRootProps()),[P(a.$slots,"default",{getItemProps:o.value.getItemProps},()=>[a.items?(E(!0),O(Ie,{key:0},_t(a.items,({id:u,...c})=>(E(),$(ze,ne({class:"k-buttongroup__item",variant:"tertiary",ref_for:!0},{...c,...o.value.getItemProps({value:u})}),null,16))),256)):I("",!0)]),a.dropdownItems||a.$slots.dropdown?(E(),$(pu,ne({key:0,ref_key:"dropdown",ref:s,keepOpen:!0,items:a.dropdownItems},o.value.getItemProps({value:"dropdown"})),{default:Z(({close:u})=>[P(a.$slots,"dropdown",{close:u,getItemProps:o.value.getItemProps})]),_:3},16,["items"])):I("",!0)],16))}}),uA=["href"],cA={class:"k-file-thumbnail__info"},dA=["value","disabled"],pA={class:"k-file-thumbnail__info-footer"},hA={key:0,class:"k-file-thumbnail__size"},fA=Q({__name:"Thumbnail",props:{value:{},disabled:{type:Boolean},rename:{type:Boolean},sortable:{type:Boolean},icons:{},labels:{}},emits:["rename","delete"],setup(t,{emit:e}){const n=[{pattern:/text.*/,icon:"fa-pro-solid:file-alt"},{pattern:/image.*/,icon:"fa-pro-solid:file-image"},{pattern:/pdf/,icon:"fa-pro-solid:file-pdf"},{pattern:/word/,icon:"fa-pro-solid:file-word"},{pattern:/excel/,icon:"fa-pro-solid:file-excel"},{pattern:/powerpoint/,icon:"fa-pro-solid:file-powerpoint"},{pattern:/octet-stream|zip/,icon:"fa-pro-solid:file-archive"}],r=t,i=D(()=>{let p=[...n,...r.icons].find(f=>r.value.type.match(f.pattern));return p?.icon||"fa-pro-solid:file"}),o=D(()=>r.disabled?"a":"div"),s=D(()=>r.disabled?{click:p=>{p.preventDefault(),ad(r.value)}}:{}),a=D(()=>r.disabled?{title:r.disabled?"Download":null}:{});function l(){r.disabled||ad(r.value)}const u=X(),c=X([]),d=X();function h(){var p;(p=u.value)==null||p.blur()}return(p,f)=>(E(),$(Qe(o.value),ne({class:["k-file-thumbnail",{"k-file-thumbnail--clickable":p.disabled}]},a.value,Vg(s.value)),{default:Z(()=>[he(ni,{class:"k-file-thumbnail__preview",gap:"0rem",justify:"center",align:"center"},{default:Z(()=>[P(p.$slots,"icon",{},()=>[p.value.type.includes("image")?(E(),O("a",{key:0,href:p.value.url,target:"_blank"},[he(au,{class:"k-file-thumbnail__preview-image",src:p.value.url,alt:p.value.name,size:"contain",aspectRatio:"1/1"},null,8,["src","alt"])],8,uA)):(E(),$(B(Ze),{key:1,icon:i.value,class:"k-file-thumbnail__preview-icon"},null,8,["icon"]))])]),_:3}),H("div",cA,[H("input",{type:"text",ref_key:"input",ref:u,class:"k-file-thumbnail__name",value:p.value.name,onKeypress:op(h,["enter"]),disabled:p.disabled||!p.rename,onInput:f[0]||(f[0]=m=>p.$emit("rename",m.target.value))},null,40,dA),H("div",pA,[p.value.size?(E(),O("span",hA,se(B(Np)(p.value.size)),1)):I("",!0)])]),he($y,{modelValue:c.value,"onUpdate:modelValue":f[2]||(f[2]=m=>{c.value=m.filter(g=>g!=="download")}),disabled:p.disabled},{default:Z(({getItemProps:m})=>[p.value.url?(E(),$(ze,ne({key:0,is:"a",href:p.value.url,class:"k-file-thumbnail__download",onClick:Ba(l,["prevent"]),icon:"fa-pro-light:arrow-down-to-line",variant:"tertiary"},m({value:"download"})),null,16,["href"])):I("",!0)]),dropdown:Z(({close:m})=>[p.value.url?(E(),$(ze,{key:0,is:"a",href:p.value.url,class:"k-file-thumbnail__download",onClick:Ba(l,["prevent"]),iconRight:"fa-pro-light:arrow-down-to-line",label:p.labels.download,variant:"tertiary"},null,8,["href","label"])):I("",!0),he(B(YO),null,{default:Z(({copy:g,copied:y})=>[p.value.url?(E(),$(ze,{key:0,class:"k-file-thumbnail__copy",iconRight:"fa-pro-light:copy",label:p.labels.copy,variant:"tertiary",promise:d.value,onClick:()=>{d.value=g(p.value.url)}},null,8,["label","promise","onClick"])):I("",!0)]),_:1}),p.disabled?I("",!0):(E(),$(ze,{key:1,variant:"danger",label:p.labels.delete,class:"k-file-thumbnail__delete",iconRight:"fa-pro-light:times",onClick:f[1]||(f[1]=g=>p.$emit("delete"))},null,8,["label"]))]),_:1},8,["modelValue","disabled"]),p.sortable?(E(),$(B(Ze),{key:0,icon:"fa-pro-solid:arrows-alt-v",class:"k-file-thumbnail__handle"})):I("",!0)]),_:3},16,["class"]))}}),mA={key:0,class:"k-file__label-wrapper"},gA={key:1,class:"k-file__sublabel"},AL=Q({__name:"File",props:{modelValue:{},label:{},sublabel:{},multiple:{type:Boolean},sortable:{type:Boolean,default:!0},upload:{type:Function,default:()=>(t,e,n)=>(console.warn("[@kvass-ui/file]: You need to setup the upload function before using this component!"),e(50),new Promise((r,i)=>{let o=new FileReader;o.onloadend=function(){r({url:o.result,type:t.type})},o.readAsDataURL(t)}))},uploadOptions:{},dropMessage:{default:"Drag a file here or <b>browse</b> to upload."},rename:{type:Boolean,default:!0},accept:{},serialize:{type:Function,default:t=>t},required:{type:Boolean},disabled:{type:Boolean},icons:{default:()=>[]},labels:{default:()=>({delete:"Delete",download:"Download",copy:"Copy link"})}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e;function i(u){r("update:modelValue",u)}function o(u){r("update:modelValue",n.multiple?(n.modelValue||[]).filter(c=>c!==u):null)}const s=D(()=>n.multiple||!n.modelValue),a=D({get(){return n.modelValue?n.modelValue instanceof Array?n.modelValue:[n.modelValue]:[]},set(u){n.multiple&&i(u)}}),l=rn("k-file",{variants:{}});return(u,c)=>(E(),O("div",{class:Ce(B(l)({}))},[u.label||u.sublabel||u.$slots.sublabel||u.$slots.label?(E(),O("div",mA,[u.label||u.$slots.label?(E(),O("label",{key:0,class:Ce(["k-file__label",{"k-file__label-required":u.required}])},[P(u.$slots,"label",{},()=>[$e(se(u.label),1)])],2)):I("",!0),u.sublabel||u.$slots.sublabel?(E(),O("span",gA,[P(u.$slots,"sublabel",{},()=>[$e(se(u.sublabel),1)])])):I("",!0)])):I("",!0),he(ni,{direction:"column"},{default:Z(()=>[a.value.length?(E(),$(B(Fy),{key:0,modelValue:a.value,"onUpdate:modelValue":c[0]||(c[0]=d=>a.value=d),disabled:!u.multiple||!u.sortable,animation:200,class:"k-file__thumbnails","item-key":"url",handle:".k-file-thumbnail__handle"},{item:Z(({element:d,index:h})=>[(E(),$(fA,{key:d.url,disabled:u.disabled,sortable:!u.disabled&&u.sortable&&u.multiple&&a.value.length>1,rename:u.rename===!0,value:u.serialize(d),onRename:p=>d.name=p,onDelete:p=>o(d),icons:u.icons,labels:u.labels},Cs({_:2},[_t(u.$slots,(p,f)=>({name:f,fn:Z(()=>[P(u.$slots,f,{item:d})])}))]),1032,["disabled","sortable","rename","value","onRename","onDelete","icons","labels"]))]),_:3},8,["modelValue","disabled"])):I("",!0),s.value?(E(),$(KO,{key:1,accept:u.accept,ref:"input",value:u.modelValue,multiple:u.multiple,required:u.required,onInput:i,disabled:u.disabled,"upload-options":u.uploadOptions,upload:u.upload,dropMessage:u.dropMessage,rename:u.rename,labels:u.labels},{"drop-message":Z(({extensions:d})=>[P(u.$slots,"drop-message",{extensions:d})]),"custom-message":Z(()=>[P(u.$slots,"custom-message")]),_:3},8,["accept","value","multiple","required","disabled","upload-options","upload","dropMessage","rename","labels"])):I("",!0)]),_:3})],2))}}),jy=new Set,yt=new WeakMap,Gi=new WeakMap,ii=new WeakMap,fd=new WeakMap,vA=new WeakMap,Ji=new WeakMap,rl=new WeakMap,No=new WeakSet;let xr,Lp=0,Vp=0;const Rn="__aa_tgt",us="__aa_del",il="__aa_new",yA=t=>{const e=CA(t);e&&e.forEach(n=>SA(n))},bA=t=>{t.forEach(e=>{e.target===xr&&wA(),yt.has(e.target)&&hi(e.target)})};function kA(t){const e=fd.get(t);e?.disconnect();let n=yt.get(t),r=0;const i=5;n||(n=Xi(t),yt.set(t,n));const{offsetWidth:o,offsetHeight:s}=xr,a=[n.top-i,o-(n.left+i+n.width),s-(n.top+i+n.height),n.left-i].map(u=>`${-1*Math.floor(u)}px`).join(" "),l=new IntersectionObserver(()=>{++r>1&&hi(t)},{root:xr,threshold:1,rootMargin:a});l.observe(t),fd.set(t,l)}function hi(t){clearTimeout(rl.get(t));const e=yu(t),n=cs(e)?500:e.duration;rl.set(t,setTimeout(async()=>{const r=ii.get(t);try{await r?.finished,yt.set(t,Xi(t)),kA(t)}catch{}},n))}function wA(){clearTimeout(rl.get(xr)),rl.set(xr,setTimeout(()=>{jy.forEach(t=>Wy(t,e=>zy(()=>hi(e))))},100))}function xA(t){setTimeout(()=>{vA.set(t,setInterval(()=>zy(hi.bind(null,t)),2e3))},Math.round(2e3*Math.random()))}function zy(t){typeof requestIdleCallback=="function"?requestIdleCallback(()=>t()):requestAnimationFrame(()=>t())}let md,Ho;const EA=typeof window<"u"&&"ResizeObserver"in window;EA&&(xr=document.documentElement,md=new MutationObserver(yA),Ho=new ResizeObserver(bA),window.addEventListener("scroll",()=>{Vp=window.scrollY,Lp=window.scrollX}),Ho.observe(xr));function CA(t){return t.reduce((e,n)=>[...e,...Array.from(n.addedNodes),...Array.from(n.removedNodes)],[]).every(e=>e.nodeName==="#comment")?!1:t.reduce((e,n)=>{if(e===!1)return!1;if(n.target instanceof Element){if(sc(n.target),!e.has(n.target)){e.add(n.target);for(let r=0;r<n.target.children.length;r++){const i=n.target.children.item(r);if(i){if(us in i)return!1;sc(n.target,i),e.add(i)}}}if(n.removedNodes.length)for(let r=0;r<n.removedNodes.length;r++){const i=n.removedNodes[r];if(us in i)return!1;i instanceof Element&&(e.add(i),sc(n.target,i),Gi.set(i,[n.previousSibling,n.nextSibling]))}}return e},new Set)}function sc(t,e){!e&&!(Rn in t)?Object.defineProperty(t,Rn,{value:t}):e&&!(Rn in e)&&Object.defineProperty(e,Rn,{value:t})}function SA(t){var e;const n=t.isConnected,r=yt.has(t);n&&Gi.has(t)&&Gi.delete(t),ii.has(t)&&((e=ii.get(t))===null||e===void 0||e.cancel()),il in t?qf(t):r&&n?OA(t):r&&!n?AA(t):qf(t)}function un(t){return Number(t.replace(/[^0-9.\-]/g,""))}function TA(t){let e=t.parentElement;for(;e;){if(e.scrollLeft||e.scrollTop)return{x:e.scrollLeft,y:e.scrollTop};e=e.parentElement}return{x:0,y:0}}function Xi(t){const e=t.getBoundingClientRect(),{x:n,y:r}=TA(t);return{top:e.top+r,left:e.left+n,width:e.width,height:e.height}}function Hy(t,e,n){let r=e.width,i=e.height,o=n.width,s=n.height;const a=getComputedStyle(t);if(a.getPropertyValue("box-sizing")==="content-box"){const l=un(a.paddingTop)+un(a.paddingBottom)+un(a.borderTopWidth)+un(a.borderBottomWidth),u=un(a.paddingLeft)+un(a.paddingRight)+un(a.borderRightWidth)+un(a.borderLeftWidth);r-=u,o-=u,i-=l,s-=l}return[r,o,i,s].map(Math.round)}function yu(t){return Rn in t&&Ji.has(t[Rn])?Ji.get(t[Rn]):{duration:250,easing:"ease-in-out"}}function qy(t){if(Rn in t)return t[Rn]}function Bp(t){const e=qy(t);return e?No.has(e):!1}function Wy(t,...e){e.forEach(n=>n(t,Ji.has(t)));for(let n=0;n<t.children.length;n++){const r=t.children.item(n);r&&e.forEach(i=>i(r,Ji.has(r)))}}function $p(t){return Array.isArray(t)?t:[t]}function cs(t){return typeof t=="function"}function OA(t){const e=yt.get(t),n=Xi(t);if(!Bp(t))return yt.set(t,n);let r;if(!e)return;const i=yu(t);if(typeof i!="function"){const o=e.left-n.left,s=e.top-n.top,[a,l,u,c]=Hy(t,e,n),d={transform:`translate(${o}px, ${s}px)`},h={transform:"translate(0, 0)"};a!==l&&(d.width=`${a}px`,h.width=`${l}px`),u!==c&&(d.height=`${u}px`,h.height=`${c}px`),r=t.animate([d,h],{duration:i.duration,easing:i.easing})}else{const[o]=$p(i(t,"remain",e,n));r=new Animation(o),r.play()}ii.set(t,r),yt.set(t,n),r.addEventListener("finish",hi.bind(null,t))}function qf(t){il in t&&delete t[il];const e=Xi(t);yt.set(t,e);const n=yu(t);if(!Bp(t))return;let r;if(typeof n!="function")r=t.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:n.duration*1.5,easing:"ease-in"});else{const[i]=$p(n(t,"add",e));r=new Animation(i),r.play()}ii.set(t,r),r.addEventListener("finish",hi.bind(null,t))}function Wf(t,e){var n;t.remove(),yt.delete(t),Gi.delete(t),ii.delete(t),(n=fd.get(t))===null||n===void 0||n.disconnect(),setTimeout(()=>{if(us in t&&delete t[us],Object.defineProperty(t,il,{value:!0,configurable:!0}),e&&t instanceof HTMLElement)for(const r in e)t.style[r]=""},0)}function AA(t){var e;if(!Gi.has(t)||!yt.has(t))return;const[n,r]=Gi.get(t);Object.defineProperty(t,us,{value:!0,configurable:!0});const i=window.scrollX,o=window.scrollY;if(r&&r.parentNode&&r.parentNode instanceof Element?r.parentNode.insertBefore(t,r):n&&n.parentNode?n.parentNode.appendChild(t):(e=qy(t))===null||e===void 0||e.appendChild(t),!Bp(t))return Wf(t);const[s,a,l,u]=_A(t),c=yu(t),d=yt.get(t);(i!==Lp||o!==Vp)&&MA(t,i,o,c);let h,p={position:"absolute",top:`${s}px`,left:`${a}px`,width:`${l}px`,height:`${u}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!cs(c))Object.assign(t.style,p),h=t.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:c.duration,easing:"ease-out"});else{const[f,m]=$p(c(t,"remove",d));m?.styleReset!==!1&&(p=m?.styleReset||p,Object.assign(t.style,p)),h=new Animation(f),h.play()}ii.set(t,h),h.addEventListener("finish",Wf.bind(null,t,p))}function MA(t,e,n,r){const i=Lp-e,o=Vp-n,s=document.documentElement.style.scrollBehavior;if(getComputedStyle(xr).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+i,window.scrollY+o),!t.parentElement)return;const a=t.parentElement;let l=a.clientHeight,u=a.clientWidth;const c=performance.now();function d(){requestAnimationFrame(()=>{if(!cs(r)){const h=l-a.clientHeight,p=u-a.clientWidth;c+r.duration>performance.now()?(window.scrollTo({left:window.scrollX-p,top:window.scrollY-h}),l=a.clientHeight,u=a.clientWidth,d()):document.documentElement.style.scrollBehavior=s}})}d()}function _A(t){const e=yt.get(t),[n,,r]=Hy(t,e,Xi(t));let i=t.parentElement;for(;i&&(getComputedStyle(i).position==="static"||i instanceof HTMLBodyElement);)i=i.parentElement;i||(i=document.body);const o=getComputedStyle(i),s=yt.get(i)||Xi(i),a=Math.round(e.top-s.top)-un(o.borderTopWidth),l=Math.round(e.left-s.left)-un(o.borderLeftWidth);return[a,l,n,r]}function DA(t,e={}){return md&&Ho&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!cs(e)&&!e.disrespectUserMotionPreference||(No.add(t),getComputedStyle(t).position==="static"&&Object.assign(t.style,{position:"relative"}),Wy(t,hi,xA,n=>Ho?.observe(n)),cs(e)?Ji.set(t,e):Ji.set(t,{duration:250,easing:"ease-in-out",...e}),md.observe(t,{childList:!0}),jy.add(t))),Object.freeze({parent:t,enable:()=>{No.add(t)},disable:()=>{No.delete(t)},isEnabled:()=>No.has(t)})}const Uf={mounted:(t,e)=>{DA(t,e.value||{})},getSSRProps:()=>({})},NA=["disabled"],IA={key:0,class:"k-expandable__title"},RA={key:1,class:"k-expandable__subtitle"},PA={key:2,class:"k-expandable__actions"},ML=Q({__name:"Expandable",props:{title:{},subtitle:{},disabled:{type:Boolean,default:!1},expandable:{type:Boolean,default:!0},expanded:{type:Boolean,default:!1},variant:{default:"border"},gap:{default:"1rem"}},setup(t){const e=t,n=ip(),r=D(()=>n.actions),i=D(()=>n.footer),o=D(()=>n.default),s=X(e.expanded),a=()=>{!e.expandable||!o.value||(s.value=!s.value)},l=rn("k-expandable",{variants:{disabled:{true:"k-expandable--disabled"},expandable:{true:"k-expandable--expandable"},expanded:{true:"k-expandable--expanded",false:"k-expandable--collapsed"},variant:{shadow:"k-expandable--variant-shadow",flat:"k-expandable--variant-flat",border:"k-expandable--variant-border"}}});return(u,c)=>Va((E(),O("fieldset",{disabled:u.disabled,class:Ce(B(l)({disabled:u.disabled,expandable:u.expandable,expanded:s.value,variant:u.variant}))},[he(ze,{class:Ce(["k-expandable__header",{"k-expandable__header--open":s.value}]),is:"legend",tabindex:"0",onKeydown:op(a,["enter"]),onClick:a,variant:"tertiary"},Cs({default:Z(()=>[u.$slots.title||u.title?(E(),O("span",IA,[P(u.$slots,"title",{},()=>[$e(se(u.title),1)])])):I("",!0),u.$slots.subtitle||u.subtitle?(E(),O("span",RA,[P(u.$slots,"subtitle",{},()=>[$e(se(u.subtitle),1)])])):I("",!0),r.value?(E(),O("span",PA,[P(u.$slots,"actions")])):I("",!0)]),_:2},[u.expandable?{name:"icon-left",fn:Z(()=>[he(B(Ze),{class:"k-expandable__icon",icon:s.value?"fa-pro-regular:angle-up":"fa-pro-regular:angle-down"},null,8,["icon"])]),key:"0"}:void 0]),1032,["class"]),s.value&&o.value?(E(),O(Ie,{key:0},[Va((E(),$(ni,{class:"k-expandable__content",direction:"column",gap:u.gap},{default:Z(()=>[P(u.$slots,"default")]),_:3},8,["gap"])),[[B(Uf)]]),i.value?(E(),$(ni,{key:0,justify:"center",align:"center",class:"k-expandable__footer"},{default:Z(()=>[P(u.$slots,"footer")]),_:3})):I("",!0)],64)):I("",!0)],10,NA)),[[B(Uf)]])}});function Je(t){this.content=t}Je.prototype={constructor:Je,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),o=r.content.slice();return i==-1?o.push(n||t,e):(o[i+1]=e,n&&(o[i]=n)),new Je(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Je(n)},addToStart:function(t,e){return new Je([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Je(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),o=r.find(t);return i.splice(o==-1?i.length:o,0,e,n),new Je(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Je.from(t),t.size?new Je(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Je.from(t),t.size?new Je(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Je.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Je.from=function(t){if(t instanceof Je)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Je(e)};function Uy(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)n++;return n}if(i.content.size||o.content.size){let s=Uy(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function Ky(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),a=e.child(--o),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let u=0,c=Math.min(s.text.length,a.text.length);for(;u<c&&s.text[s.text.length-u-1]==a.text[a.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let u=Ky(s.content,a.content,n-1,r-1);if(u)return u}n-=l,r-=l}}class A{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,o){for(let s=0,a=0;a<n;s++){let l=this.content[s],u=a+l.nodeSize;if(u>e&&r(l,i+a,o||null,s)!==!1&&l.content.size){let c=a+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,i+c)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let u=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=u},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new A(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let o=0,s=0;s<n;o++){let a=this.content[o],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),i+=a.nodeSize),s=l}return new A(r,i)}cutByIndex(e,n){return e==n?A.empty:e==0&&n==this.content.length?this:new A(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new A(i,o)}addToStart(e){return new A([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new A(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return Uy(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Ky(this,e,n,r)}findIndex(e,n=-1){if(e==0)return la(0,e);if(e==this.size)return la(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),s=i+o.nodeSize;if(s>=e)return s==e||n>0?la(r+1,s):la(r,i);i=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return A.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new A(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return A.empty;let n,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(n||(n=e.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new A(n||e,r)}static from(e){if(!e)return A.empty;if(e instanceof A)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new A([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}A.empty=new A([],0);const ac={index:0,offset:0};function la(t,e){return ac.index=t,ac.offset=e,ac}function ol(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!ol(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!ol(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let ke=class gd{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ol(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return gd.none;if(e instanceof gd)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};ke.none=[];class sl extends Error{}class V{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Jy(this.content,e+this.openStart,n);return r&&new V(r,this.openStart,this.openEnd)}removeBetween(e,n){return new V(Gy(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return V.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new V(A.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new V(e,r,i)}}V.empty=new V(A.empty,0,0);function Gy(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(i==e||o.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(Gy(o.content,e-i-1,n-i-1)))}function Jy(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),s=t.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=Jy(s.content,e-o-1,n);return a&&t.replaceChild(i,s.copy(a))}function FA(t,e,n){if(n.openStart>t.depth)throw new sl("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new sl("Inconsistent open depths");return Xy(t,e,n,0)}function Xy(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=Xy(t,e,n,r+1);return o.copy(o.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,a=s.content;return Xr(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=LA(n,t);return Xr(o,Zy(t,s,a,e,r))}else return Xr(o,al(t,e,r))}function Yy(t,e){if(!e.type.compatibleContent(t.type))throw new sl("Cannot join "+e.type.name+" onto "+t.type.name)}function vd(t,e,n){let r=t.node(n);return Yy(r,e.node(n)),r}function Jr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function qo(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Jr(t.nodeAfter,r),o++));for(let a=o;a<s;a++)Jr(i.child(a),r);e&&e.depth==n&&e.textOffset&&Jr(e.nodeBefore,r)}function Xr(t,e){return t.type.checkContent(e),t.copy(e)}function Zy(t,e,n,r,i){let o=t.depth>i&&vd(t,e,i+1),s=r.depth>i&&vd(n,r,i+1),a=[];return qo(null,t,i,a),o&&s&&e.index(i)==n.index(i)?(Yy(o,s),Jr(Xr(o,Zy(t,e,n,r,i+1)),a)):(o&&Jr(Xr(o,al(t,e,i+1)),a),qo(e,n,i,a),s&&Jr(Xr(s,al(n,r,i+1)),a)),qo(r,null,i,a),new A(a)}function al(t,e,n){let r=[];if(qo(null,t,n,r),t.depth>n){let i=vd(t,e,n+1);Jr(Xr(i,al(t,e,n+1)),r)}return qo(e,null,n,r),new A(r)}function LA(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)r=e.node(i).copy(A.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class ds{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return ke.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new ll(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(o),u=o-l;if(r.push(s,a,i+l),!u||(s=s.child(a),s.isText))break;o=u-1,i+=l+1}return new ds(n,r,o)}static resolveCached(e,n){let r=Kf.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==n)return s}else Kf.set(e,r=new VA);let i=r.elts[r.i]=ds.resolve(e,n);return r.i=(r.i+1)%BA,i}}class VA{constructor(){this.elts=[],this.i=0}}const BA=12,Kf=new WeakMap;class ll{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const $A=Object.create(null);let fr=class yd{constructor(e,n,r,i=ke.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||A.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&ol(this.attrs,n||e.defaultAttrs||$A)&&ke.sameSet(this.marks,r||ke.none)}copy(e=null){return e==this.content?this:new yd(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new yd(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return V.empty;let i=this.resolve(e),o=this.resolve(n),s=r?0:i.sharedDepth(n),a=i.start(s),l=i.node(s).content.cut(i.pos-a,o.pos-a);return new V(l,i.depth-s,o.depth-s)}replace(e,n,r){return FA(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return ds.resolveCached(this,e)}resolveNoCache(e){return ds.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Qy(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=A.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<o;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ke.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ke.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=A.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};fr.prototype.text=void 0;class ul extends fr{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Qy(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ul(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ul(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Qy(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class oi{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new jA(e,n);if(r.next==null)return oi.empty;let i=eb(r);r.next&&r.err("Unexpected trailing text");let o=GA(KA(i));return JA(o,r),o}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let o=n;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function o(s,a){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return A.from(a.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:c,next:d}=s.next[u];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let h=o(d,a.concat(c));if(h)return h}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:l}=o.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
9
+ `)}}oi.empty=new oi(!0);class jA{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function eb(t){let e=[];do e.push(zA(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function zA(t){let e=[];do e.push(HA(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function HA(t){let e=UA(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=qA(t,e);else break;return e}function Gf(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function qA(t,e){let n=Gf(t),r=n;return t.eat(",")&&(t.next!="}"?r=Gf(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function WA(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let s=n[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function UA(t){if(t.eat("(")){let e=eb(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=WA(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function KA(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,l){let u={term:l,to:a};return e[s].push(u),u}function i(s,a){s.forEach(l=>l.to=a)}function o(s,a){if(s.type=="choice")return s.exprs.reduce((l,u)=>l.concat(o(u,a)),[]);if(s.type=="seq")for(let l=0;;l++){let u=o(s.exprs[l],a);if(l==s.exprs.length-1)return u;i(u,a=n())}else if(s.type=="star"){let l=n();return r(a,l),i(o(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return i(o(s.expr,a),l),i(o(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(o(s.expr,a));if(s.type=="range"){let l=a;for(let u=0;u<s.min;u++){let c=n();i(o(s.expr,l),c),l=c}if(s.max==-1)i(o(s.expr,l),l);else for(let u=s.min;u<s.max;u++){let c=n();r(l,c),i(o(s.expr,l),c),l=c}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function tb(t,e){return e-t}function Jf(t,e){let n=[];return r(e),n.sort(tb);function r(i){let o=t[i];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(i);for(let s=0;s<o.length;s++){let{term:a,to:l}=o[s];!a&&n.indexOf(l)==-1&&r(l)}}}function GA(t){let e=Object.create(null);return n(Jf(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:a,to:l})=>{if(!a)return;let u;for(let c=0;c<i.length;c++)i[c][0]==a&&(u=i[c][1]);Jf(t,l).forEach(c=>{u||i.push([a,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let o=e[r.join(",")]=new oi(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let a=i[s][1].sort(tb);o.next.push({type:i[s][0],next:e[a.join(",")]||n(a)})}return o}}function JA(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],o=!i.validEnd,s=[];for(let a=0;a<i.next.length;a++){let{type:l,next:u}=i.next[a];s.push(l.name),o&&!(l.isText||l.hasRequiredAttrs())&&(o=!1),r.indexOf(u)==-1&&r.push(u)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function nb(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function rb(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let o=t[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function ib(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let o=t[i];o.validate&&o.validate(e[i])}}function ob(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new YA(t,r,e[r]);return n}let Xf=class sb{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=ob(e,r.attrs),this.defaultAttrs=nb(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==oi.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:rb(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new fr(this,this.computeAttrs(e),A.from(n),ke.setFrom(r))}createChecked(e=null,n,r){return n=A.from(n),this.checkContent(n),new fr(this,this.computeAttrs(e),n,ke.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=A.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(A.empty,!0);return o?new fr(this,e,n.append(o),ke.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){ib(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:ke.none:e}static compile(e,n){let r=Object.create(null);e.forEach((o,s)=>r[o]=new sb(o,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function XA(t,e,n){let r=n.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${o}`)}}class YA{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?XA(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class bu{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=ob(e,i.attrs),this.excluded=null;let o=nb(this.attrs);this.instance=o?new ke(this,o):null}create(e=null){return!e&&this.instance?this.instance:new ke(this,rb(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new bu(o,i++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){ib(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class ab{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Je.from(e.nodes),n.marks=Je.from(e.marks||{}),this.nodes=Xf.compile(this.spec.nodes,this),this.marks=bu.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=oi.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=a=="_"?null:a?Yf(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:Yf(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Xf){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new ul(r,r.defaultAttrs,e,ke.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return fr.fromJSON(this,e)}markFromJSON(e){return ke.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Yf(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=t.marks[i],s=o;if(o)n.push(o);else for(let a in t.marks){let l=t.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function ZA(t){return t.tag!=null}function QA(t){return t.style!=null}class mr{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(ZA(i))this.tags.push(i);else if(QA(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let r=new Qf(this,n,!1);return r.addAll(e,ke.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Qf(this,n,!0);return r.addAll(e,ke.none,n.from,n.to),V.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(nM(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,n,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<o)break}n.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=em(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=em(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new mr(e,mr.schemaRules(e)))}}const lb={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},eM={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ub={ol:!0,ul:!0},ps=1,bd=2,Da=4;function Zf(t,e,n){return e!=null?(e?ps:0)|(e==="full"?bd:0):t&&t.whitespace=="pre"?ps|bd:n&-5}class ua{constructor(e,n,r,i,o,s){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=ke.none,this.match=o||(s&Da?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(A.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ps)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=A.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(A.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!lb.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Qf{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,o,s=Zf(null,n.preserveWhitespace,0)|(r?Da:0);i?o=new ua(i.type,i.attrs,ke.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new ua(null,null,ke.none,!0,null,s):o=new ua(e.schema.topNodeType,null,ke.none,!0,null,s),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,o=i.options&bd?"full":this.localPreserveWS||(i.options&ps)>0;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)o!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
10
+ `);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let s=i.content[i.content.length-1],a=e.previousSibling;(!s||a&&a.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),n),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;ub.hasOwnProperty(s)&&this.parser.normalizeLists&&tM(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:eM.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let u,c=this.needsBlock;if(lb.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),u=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),u&&this.sync(o),this.needsBlock=c}else{let u=this.readStyles(e,n);u&&this.addElementByRule(e,l,u,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
11
+ `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(o,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(u=>!l.clearMark(u)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,i){let o,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r)||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(o=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}o&&this.sync(a)&&this.open--}addAll(e,n,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];s!=a;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,n);this.findAtPoint(e,o)}findPlace(e,n){let r,i;for(let o=this.open;o>=0;o--){let s=this.nodes[o],a=s.findWrapping(e);if(a&&(!r||r.length>a.length)&&(r=a,i=s,!a.length)||s.solid)break}if(!r)return null;this.sync(i);for(let o=0;o<r.length;o++)n=this.enterInner(r[o],null,n,!1);return n}insertNode(e,n){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let r=this.findPlace(e,n);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=ke.none;for(let s of r.concat(e.marks))(i.type?i.type.allowsMarkType(s.type):tm(s.type,e.type))&&(o=s.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let o=this.findPlace(e.create(n),r);return o&&(o=this.enterInner(e,n,r,!0,i)),o}enterInner(e,n,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=Zf(e,o,s.options);s.options&Da&&s.content.length==0&&(a|=Da);let l=ke.none;return r=r.filter(u=>(s.type?s.type.allowsMarkType(u.type):tm(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new ua(e,n,l,i,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=ps)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(a,l)=>{for(;a>=0;a--){let u=n[a];if(u==""){if(a==n.length-1||a==0)continue;for(;l>=o;l--)if(s(a-1,l))return!0;return!1}else{let c=l>0||l==0&&i?this.nodes[l].type:r&&l>=o?r.node(l-o).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function tM(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&ub.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function nM(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function em(t){let e={};for(let n in t)e[n]=t[n];return e}function tm(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=a=>{o.push(a);for(let l=0;l<a.edgeCount;l++){let{type:u,next:c}=a.edge(l);if(u==e||o.indexOf(c)<0&&s(c))return!0}};if(s(i.contentMatch))return!0}}class fi{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=lc(n).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let a=0,l=0;for(;a<o.length&&l<s.marks.length;){let u=s.marks[l];if(!this.marks[u.type.name]){l++;continue}if(!u.eq(o[a][0])||u.type.spec.spanning===!1)break;a++,l++}for(;a<o.length;)i=o.pop()[1];for(;l<s.marks.length;){let u=s.marks[l++],c=this.serializeMark(u,s.isInline,n);c&&(o.push([u,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Na(lc(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Na(lc(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Na(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new fi(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=nm(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return nm(e.marks)}}function nm(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function lc(t){return t.document||window.document}const rm=new WeakMap;function rM(t){let e=rm.get(t);return e===void 0&&rm.set(t,e=iM(t)),e}function iM(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function Na(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=rM(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),u=e[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let d in u)if(u[d]!=null){let h=d.indexOf(" ");h>0?l.setAttributeNS(d.slice(0,h),d.slice(h+1),u[d]):l.setAttribute(d,u[d])}}for(let d=c;d<e.length;d++){let h=e[d];if(h===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:p,contentDOM:f}=Na(t,h,n,r);if(l.appendChild(p),f){if(a)throw new RangeError("Multiple content holes");a=f}}}return{dom:l,contentDOM:a}}const cb=65535,db=Math.pow(2,16);function oM(t,e){return t+e*db}function im(t){return t&cb}function sM(t){return(t-(t&cb))/db}const pb=1,hb=2,Ia=4,fb=8;class kd{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&fb)>0}get deletedBefore(){return(this.delInfo&(pb|Ia))>0}get deletedAfter(){return(this.delInfo&(hb|Ia))>0}get deletedAcross(){return(this.delInfo&Ia)>0}}class Ot{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Ot.empty)return Ot.empty}recover(e){let n=0,r=im(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+sM(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let u=this.ranges[a+o],c=this.ranges[a+s],d=l+u;if(e<=d){let h=u?e==l?-1:e==d?1:n:n,p=l+i+(h<0?0:c);if(r)return p;let f=e==(n<0?l:d)?null:oM(a/3,e-l),m=e==l?hb:e==d?pb:Ia;return(n<0?e!=l:e!=d)&&(m|=fb),new kd(p,m,f)}i+=c-u}return r?e+i:new kd(e+i,0,null)}touches(e,n){let r=0,i=im(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let u=this.ranges[a+o],c=l+u;if(e<=c&&a==i*3)return!0;r+=this.ranges[a+s]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),u=this.ranges[i+n],c=this.ranges[i+r];e(a,a+u,l,l+c),o+=c-u}}invert(){return new Ot(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ot.empty:new Ot(e<0?[0,-e,0]:[0,0,e])}}Ot.empty=new Ot([]);class Bi{constructor(e=[],n,r=0,i=e.length){this.maps=e,this.mirror=n,this.from=r,this.to=i}slice(e=0,n=this.maps.length){return new Bi(this.maps,this.mirror,e,n)}copy(){return new Bi(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,n){this.to=this.maps.push(e),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(e){for(let n=0,r=this.maps.length;n<e.maps.length;n++){let i=e.getMirror(n);this.appendMap(e.maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this.maps.length+e.maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e.maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Bi;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this.maps[o],a=s.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(o);if(l!=null&&l>o&&l<this.to){o=l,e=this.maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new kd(e,i,null)}}const uc=Object.create(null);class st{getMap(){return Ot.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=uc[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in uc)throw new RangeError("Duplicate use of step JSON ID "+e);return uc[e]=n,n.prototype.jsonID=e,n}}class Fe{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Fe(e,null)}static fail(e){return new Fe(null,e)}static fromReplace(e,n,r,i){try{return Fe.ok(e.replace(n,r,i))}catch(o){if(o instanceof sl)return Fe.fail(o.message);throw o}}}function jp(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(jp(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return A.fromArray(r)}class ar extends st{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new V(jp(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return Fe.fromReplace(e,this.from,this.to,o)}invert(){return new gn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ar(n.pos,r.pos,this.mark)}merge(e){return e instanceof ar&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ar(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ar(n.from,n.to,e.markFromJSON(n.mark))}}st.jsonID("addMark",ar);class gn extends st{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new V(jp(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Fe.fromReplace(e,this.from,this.to,r)}invert(){return new ar(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new gn(n.pos,r.pos,this.mark)}merge(e){return e instanceof gn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new gn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new gn(n.from,n.to,e.markFromJSON(n.mark))}}st.jsonID("removeMark",gn);class lr extends st{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Fe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Fe.fromReplace(e,this.pos,this.pos+1,new V(A.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new lr(this.pos,n.marks[i]);return new lr(this.pos,this.mark)}}return new Yi(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new lr(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new lr(n.pos,e.markFromJSON(n.mark))}}st.jsonID("addNodeMark",lr);class Yi extends st{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Fe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Fe.fromReplace(e,this.pos,this.pos+1,new V(A.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new lr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Yi(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Yi(n.pos,e.markFromJSON(n.mark))}}st.jsonID("removeNodeMark",Yi);class je extends st{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&wd(e,this.from,this.to)?Fe.fail("Structure replace would overwrite content"):Fe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ot([this.from,this.to-this.from,this.slice.size])}invert(e){return new je(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new je(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(e){if(!(e instanceof je)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?V.empty:new V(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new je(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?V.empty:new V(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new je(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new je(n.from,n.to,V.fromJSON(e,n.slice),!!n.structure)}}st.jsonID("replace",je);class qe extends st{constructor(e,n,r,i,o,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(e){if(this.structure&&(wd(e,this.from,this.gapFrom)||wd(e,this.gapTo,this.to)))return Fe.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Fe.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Fe.fromReplace(e,this.from,this.to,r):Fe.fail("Content does not fit in gap")}getMap(){return new Ot([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new qe(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new qe(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new qe(n.from,n.to,n.gapFrom,n.gapTo,V.fromJSON(e,n.slice),n.insert,!!n.structure)}}st.jsonID("replaceAround",qe);function wd(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function aM(t,e,n,r){let i=[],o=[],s,a;t.doc.nodesBetween(e,n,(l,u,c)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let h=Math.max(u,e),p=Math.min(u+l.nodeSize,n),f=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(f)||(s&&s.to==h&&s.mark.eq(d[m])?s.to=p:i.push(s=new gn(h,p,d[m])));a&&a.to==h?a.to=p:o.push(a=new ar(h,p,r))}}),i.forEach(l=>t.step(l)),o.forEach(l=>t.step(l))}function lM(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;o++;let l=null;if(r instanceof bu){let u=s.marks,c;for(;c=r.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let u=Math.min(a+s.nodeSize,n);for(let c=0;c<l.length;c++){let d=l[c],h;for(let p=0;p<i.length;p++){let f=i[p];f.step==o-1&&d.eq(i[p].style)&&(h=f)}h?(h.to=u,h.step=o):i.push({style:d,from:Math.max(a,e),to:u,step:o})}}}),i.forEach(s=>t.step(new gn(s.from,s.to,s.style)))}function zp(t,e,n,r=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l<o.childCount;l++){let u=o.child(l),c=a+u.nodeSize,d=r.matchType(u.type);if(!d)s.push(new je(a,c,V.empty));else{r=d;for(let h=0;h<u.marks.length;h++)n.allowsMarkType(u.marks[h].type)||t.step(new gn(a,c,u.marks[h]));if(i&&u.isText&&n.whitespace!="pre"){let h,p=/\r?\n|\r/g,f;for(;h=p.exec(u.text);)f||(f=new V(A.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),s.push(new je(a+h.index,a+h.index+h[0].length,f))}}a=c}if(!r.validEnd){let l=r.fillBefore(A.empty,!0);t.replace(a,a,new V(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function uM(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function uo(t){let e=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth;;--n){let r=t.$from.node(n),i=t.$from.index(n),o=t.$to.indexAfter(n);if(n<t.depth&&r.canReplace(i,o,e))return n;if(n==0||r.type.spec.isolating||!uM(r,i,o))break}return null}function cM(t,e,n){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),a=i.after(o+1),l=s,u=a,c=A.empty,d=0;for(let f=o,m=!1;f>n;f--)m||r.index(f)>0?(m=!0,c=A.from(r.node(f).copy(c)),d++):l--;let h=A.empty,p=0;for(let f=o,m=!1;f>n;f--)m||i.after(f+1)<i.end(f)?(m=!0,h=A.from(i.node(f).copy(h)),p++):u++;t.step(new qe(l,u,s,a,new V(c.append(h),d,p),c.size-d,!0))}function Hp(t,e,n=null,r=t){let i=dM(t,e),o=i&&pM(r,e);return o?i.map(om).concat({type:e,attrs:n}).concat(o.map(om)):null}function om(t){return{type:t,attrs:null}}function dM(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return n.canReplaceWith(r,i,s)?o:null}function pM(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let l=r;a&&l<i;l++)a=a.matchType(n.child(l).type);return!a||!a.validEnd?null:s}function hM(t,e,n){let r=A.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=A.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new qe(i,o,i,o,new V(r,0,0),n.length,!0))}function fM(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,l)&&mM(t.doc,t.mapping.slice(o).map(a),r)){let u=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",f=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!f?u=!1:!p&&f&&(u=!0)}u===!1&&gb(t,s,a,o),zp(t,t.mapping.slice(o).map(a,1),r,void 0,u===null);let c=t.mapping.slice(o),d=c.map(a,1),h=c.map(a+s.nodeSize,1);return t.step(new qe(d,h,d+1,h-1,new V(A.from(r.create(l,null,s.marks)),0,0),1,!0)),u===!0&&mb(t,s,a,o),!1}})}function mb(t,e,n,r){e.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+o+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function gb(t,e,n,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+o);t.replaceWith(s,s+1,e.type.schema.text(`
12
+ `))}})}function mM(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function gM(t,e,n,r,i){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,s);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new qe(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new V(A.from(s),0,0),1,!0))}function $i(t,e,n=1,r){let i=t.resolve(e),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,c=n-2;u>o;u--,c--){let d=i.node(u),h=i.index(u);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(h,d.childCount),f=r&&r[c+1];f&&(p=p.replaceChild(0,f.type.create(f.attrs)));let m=r&&r[c]||d;if(!d.canReplace(h+1,d.childCount)||!m.type.validContent(p))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function vM(t,e,n=1,r){let i=t.doc.resolve(e),o=A.empty,s=A.empty;for(let a=i.depth,l=i.depth-n,u=n-1;a>l;a--,u--){o=A.from(i.node(a).copy(o));let c=r&&r[u];s=A.from(c?c.type.create(c.attrs,s):i.node(a).copy(s))}t.step(new je(e,e,new V(o.append(s),n,n),!0))}function Sr(t,e){let n=t.resolve(e),r=n.index();return vb(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function yM(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),s=o.type==r?t.type.schema.nodes.text:o.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(o.marks))return!1}return n.validEnd}function vb(t,e){return!!(t&&e&&!t.isLeaf&&yM(t,e))}function ku(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let o,s,a=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):n>0?(o=r.node(i+1),a++,s=r.node(i).maybeChild(a)):(o=r.node(i).maybeChild(a-1),s=r.node(i+1)),o&&!o.isTextblock&&vb(o,s)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function bM(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,o=t.doc.resolve(e-n),s=o.node().type;if(i&&s.inlineContent){let c=s.whitespace=="pre",d=!!s.contentMatch.matchType(i);c&&!d?r=!1:!c&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let c=t.doc.resolve(e+n);gb(t,c.node(),c.before(),a)}s.inlineContent&&zp(t,e+n-1,s,o.node().contentMatchAt(o.index()),r==null);let l=t.mapping.slice(a),u=l.map(e-n);if(t.step(new je(u,l.map(e+n,-1),V.empty,!0)),r===!0){let c=t.doc.resolve(u);mb(t,c.node(),c.before(),t.steps.length)}return t}function kM(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,n))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function yb(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let o=0;o<n.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(n.openStart==0&&n.size?2:1);o++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),u=r.node(s),c=!1;if(o==1)c=u.canReplace(l,l,i);else{let d=u.contentMatchAt(l).findWrapping(i.firstChild.type);c=d&&u.canReplaceWith(l,l,d[0])}if(c)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function wu(t,e,n=e,r=V.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return bb(i,o,r)?new je(e,n,r):new wM(i,o,r).fit()}function bb(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class wM{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=A.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=A.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let l=new V(o,s,a);return e>-1?new qe(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new je(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=n.firstChild;if(n.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=cc(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:u}=this.frontier[a],c,d=null;if(n==1&&(s?u.matchType(s.type)||(d=u.fillBefore(A.from(s),!1)):o&&l.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:a,parent:o,inject:d};if(n==2&&s&&(c=u.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:o,wrap:c};if(o&&u.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=cc(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new V(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=cc(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new V(Io(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new V(Io(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let m=0;m<o.length;m++)this.openFrontierNode(o[m]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-e,u=0,c=[],{match:d,type:h}=this.frontier[n];if(i){for(let m=0;m<i.childCount;m++)c.push(i.child(m));d=d.matchFragment(i)}let p=a.size+e-(s.content.size-s.openEnd);for(;u<a.childCount;){let m=a.child(u),g=d.matchType(m.type);if(!g)break;u++,(u>1||l==0||m.content.size)&&(d=g,c.push(kb(m.mark(h.allowedMarks(m.marks)),u==1?l:0,u==a.childCount?p:-1)))}let f=u==a.childCount;f||(p=-1),this.placed=Ro(this.placed,n,A.from(c)),this.frontier[n].match=d,f&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<p;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=f?e==0?V.empty:new V(Io(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new V(Io(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!dc(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=dc(e,n,i,r,o);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:u}=this.frontier[a],c=dc(e,a,u,l,!0);if(!c||c.childCount)continue e}return{depth:n,fit:s,move:o?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Ro(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Ro(this.placed,this.depth,A.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(A.empty,!0);e.childCount&&(this.placed=Ro(this.placed,this.frontier.length,e))}}function Io(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Io(t.firstChild.content,e-1,n)))}function Ro(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Ro(t.lastChild.content,e-1,n)))}function cc(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function kb(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,kb(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(A.empty,!0)))),t.copy(r)}function dc(t,e,n,r,i){let o=t.node(e),s=i?t.indexAfter(e):t.index(e);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!xM(n,o.content,s)?a:null}function xM(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function EM(t){return t.spec.defining||t.spec.definingForContent}function CM(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),o=t.doc.resolve(n);if(bb(i,o,r))return t.step(new je(e,n,r));let s=xb(i,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let a=-(i.depth+1);s.unshift(a);for(let h=i.depth,p=i.pos-1;h>0;h--,p--){let f=i.node(h).type.spec;if(f.defining||f.definingAsContext||f.isolating)break;s.indexOf(h)>-1?a=h:i.before(h)==p&&s.splice(1,0,-h)}let l=s.indexOf(a),u=[],c=r.openStart;for(let h=r.content,p=0;;p++){let f=h.firstChild;if(u.push(f),p==r.openStart)break;h=f.content}for(let h=c-1;h>=0;h--){let p=u[h],f=EM(p.type);if(f&&!p.sameMarkup(i.node(Math.abs(a)-1)))c=h;else if(f||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+c+1)%(r.openStart+1),f=u[p];if(f)for(let m=0;m<s.length;m++){let g=s[(m+l)%s.length],y=!0;g<0&&(y=!1,g=-g);let b=i.node(g-1),k=i.index(g-1);if(b.canReplaceWith(k,k,f.type,f.marks))return t.replace(i.before(g),y?o.after(g):n,new V(wb(r.content,0,r.openStart,p),p,r.openEnd))}}let d=t.steps.length;for(let h=s.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>d));h--){let p=s[h];p<0||(e=i.before(p),n=o.after(p))}}function wb(t,e,n,r,i){if(e<n){let o=t.firstChild;t=t.replaceChild(0,o.copy(wb(o.content,e+1,n,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(t).append(t);t=s.append(o.matchFragment(s).fillBefore(A.empty,!0))}return t}function SM(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=kM(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new V(A.from(r),0,0))}function TM(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=xb(r,i);for(let s=0;s<o.length;s++){let a=o[s],l=s==o.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function xb(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let o=t.start(i);if(o<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&n.push(i)}return n}class ji extends st{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Fe.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Fe.fromReplace(e,this.pos,this.pos+1,new V(A.from(i),0,n.isLeaf?0:1))}getMap(){return Ot.empty}invert(e){return new ji(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ji(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ji(n.pos,n.attr,n.value)}}st.jsonID("attr",ji);class hs extends st{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Fe.ok(r)}getMap(){return Ot.empty}invert(e){return new hs(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new hs(n.attr,n.value)}}st.jsonID("docAttr",hs);let Zi=class extends Error{};Zi=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Zi.prototype=Object.create(Error.prototype);Zi.prototype.constructor=Zi;Zi.prototype.name="TransformError";class Eb{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Bi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Zi(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=V.empty){let i=wu(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new V(A.from(r),0,0))}delete(e,n){return this.replace(e,n,V.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return CM(this,e,n,r),this}replaceRangeWith(e,n,r){return SM(this,e,n,r),this}deleteRange(e,n){return TM(this,e,n),this}lift(e,n){return cM(this,e,n),this}join(e,n=1){return bM(this,e,n),this}wrap(e,n){return hM(this,e,n),this}setBlockType(e,n=e,r,i=null){return fM(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return gM(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new ji(e,n,r)),this}setDocAttribute(e,n){return this.step(new hs(e,n)),this}addNodeMark(e,n){return this.step(new lr(e,n)),this}removeNodeMark(e,n){if(!(n instanceof ke)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new Yi(e,n)),this}split(e,n=1,r){return vM(this,e,n,r),this}addMark(e,n,r){return aM(this,e,n,r),this}removeMark(e,n,r){return lM(this,e,n,r),this}clearIncompatible(e,n,r){return zp(this,e,n,r),this}}const pc=Object.create(null);class le{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new OM(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=V.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:u}=s[a],c=e.mapping.slice(o);e.replaceRange(c.map(l.pos),c.map(u.pos),a?V.empty:n),a==0&&lm(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:a}=i[o],l=e.mapping.slice(r),u=l.map(s.pos),c=l.map(a.pos);o?e.deleteRange(u,c):(e.replaceRangeWith(u,c,n),lm(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new oe(e):Oi(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=n<0?Oi(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Oi(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new jt(e.node(0))}static atStart(e){return Oi(e,e,0,0,1)||new jt(e)}static atEnd(e){return Oi(e,e,e.content.size,e.childCount,-1)||new jt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=pc[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in pc)throw new RangeError("Duplicate use of selection JSON ID "+e);return pc[e]=n,n.prototype.jsonID=e,n}getBookmark(){return oe.between(this.$anchor,this.$head).getBookmark()}}le.prototype.visible=!0;class OM{constructor(e,n){this.$from=e,this.$to=n}}let sm=!1;function am(t){!sm&&!t.parent.inlineContent&&(sm=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class oe extends le{constructor(e,n=e){am(e),am(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return le.near(r);let i=e.resolve(n.map(this.anchor));return new oe(i.parent.inlineContent?i:r,r)}replace(e,n=V.empty){if(super.replace(e,n),n==V.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof oe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new xu(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new oe(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=le.findFrom(n,r,!0)||le.findFrom(n,-r,!0);if(o)n=o.$head;else return le.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(le.findFrom(e,-r,!0)||le.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new oe(e,n)}}le.jsonID("text",oe);class xu{constructor(e,n){this.anchor=e,this.head=n}map(e){return new xu(e.map(this.anchor),e.map(this.head))}resolve(e){return oe.between(e.resolve(this.anchor),e.resolve(this.head))}}class Y extends le{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),o=e.resolve(i);return r?le.near(o):new Y(o)}content(){return new V(A.from(this.node),0,0)}eq(e){return e instanceof Y&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new qp(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Y(e.resolve(n.anchor))}static create(e,n){return new Y(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Y.prototype.visible=!1;le.jsonID("node",Y);class qp{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new xu(r,r):new qp(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Y.isSelectable(r)?new Y(n):le.near(n)}}class jt extends le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=V.empty){if(n==V.empty){e.delete(0,e.doc.content.size);let r=le.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new jt(e)}map(e){return new jt(e)}eq(e){return e instanceof jt}getBookmark(){return AM}}le.jsonID("all",jt);const AM={map(){return this},resolve(t){return new jt(t)}};function Oi(t,e,n,r,i,o=!1){if(e.inlineContent)return oe.create(t,n);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let a=e.child(s);if(a.isAtom){if(!o&&Y.isSelectable(a))return Y.create(t,n-(i<0?a.nodeSize:0))}else{let l=Oi(t,a,n+i,i<0?a.childCount:0,i,o);if(l)return l}n+=a.nodeSize*i}return null}function lm(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof je||i instanceof qe))return;let o=t.mapping.maps[r],s;o.forEach((a,l,u,c)=>{s==null&&(s=c)}),t.setSelection(le.near(t.doc.resolve(s),n))}const um=1,cm=2,dm=4;class MM extends Eb{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|um)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&um)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=cm,this}ensureMarks(e){return ke.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&cm)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ke.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(n);o=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,o)),this.selection.empty||this.setSelection(le.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=dm,this}get scrolledIntoView(){return(this.updated&dm)>0}}function pm(t,e){return!e||!t?t:t.bind(e)}class Po{constructor(e,n,r){this.name=e,this.init=pm(n.init,r),this.apply=pm(n.apply,r)}}const _M=[new Po("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Po("selection",{init(t,e){return t.selection||le.atStart(e.doc)},apply(t){return t.selection}}),new Po("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Po("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class hc{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=_M.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Po(r.key,r.spec.state,r))})}}class Ri{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=i?i[s].n:0,u=i?i[s].state:this,c=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,u,r);if(c&&r.filterTransaction(c,s)){if(c.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(c),r=r.applyInner(c),o=!0}i&&(i[s]={state:r,n:n.length})}}if(!o)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Ri(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];n[o.name]=o.apply(e,this[o.name],this,n)}return n}get tr(){return new MM(this)}static create(e){let n=new hc(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Ri(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new hc(this.schema,e.plugins),r=n.fields,i=new Ri(n);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new hc(e.schema,e.plugins),o=new Ri(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=fr.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=le.fromJSON(o.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],u=l.spec.state;if(l.key==s.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){o[s.name]=u.fromJSON.call(l,e,n[a],o);return}}o[s.name]=s.init(e,o)}}),o}}function Cb(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Cb(i,e,{})),n[r]=i}return n}class Ve{constructor(e){this.spec=e,this.props={},e.props&&Cb(e.props,this,this.props),this.key=e.key?e.key.key:Sb("plugin")}getState(e){return e[this.key]}}const fc=Object.create(null);function Sb(t){return t in fc?t+"$"+ ++fc[t]:(fc[t]=0,t+"$")}class at{constructor(e="key"){this.key=Sb(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Xe=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},fs=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let xd=null;const Nn=function(t,e,n){let r=xd||(xd=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},DM=function(){xd=null},si=function(t,e,n,r){return n&&(hm(t,e,n,r,-1)||hm(t,e,n,r,1))},NM=/^(img|br|input|textarea|hr)$/i;function hm(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:$t(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Ds(t)||NM.test(t.nodeName)||t.contentEditable=="false")return!1;e=Xe(t)+(i<0?0:1),t=o}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.contentEditable=="false")return!1;e=i<0?$t(t):0}else return!1}}function $t(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function IM(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=$t(t)}else if(t.parentNode&&!Ds(t))e=Xe(t),t=t.parentNode;else return null}}function RM(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Ds(t))e=Xe(t)+1,t=t.parentNode;else return null}}function PM(t,e,n){for(let r=e==0,i=e==$t(t);r||i;){if(t==n)return!0;let o=Xe(t);if(t=t.parentNode,!t)return!1;r=r&&o==0,i=i&&o==$t(t)}}function Ds(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Eu=function(t){return t.focusNode&&si(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function zr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function FM(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function LM(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min($t(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min($t(r.startContainer),r.startOffset)}}}const xn=typeof navigator<"u"?navigator:null,fm=typeof document<"u"?document:null,Tr=xn&&xn.userAgent||"",Ed=/Edge\/(\d+)/.exec(Tr),Tb=/MSIE \d/.exec(Tr),Cd=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Tr),bt=!!(Tb||Cd||Ed),gr=Tb?document.documentMode:Cd?+Cd[1]:Ed?+Ed[1]:0,nn=!bt&&/gecko\/(\d+)/i.test(Tr);nn&&+(/Firefox\/(\d+)/.exec(Tr)||[0,0])[1];const Sd=!bt&&/Chrome\/(\d+)/.exec(Tr),rt=!!Sd,Ob=Sd?+Sd[1]:0,pt=!bt&&!!xn&&/Apple Computer/.test(xn.vendor),Qi=pt&&(/Mobile\/\w+/.test(Tr)||!!xn&&xn.maxTouchPoints>2),Vt=Qi||(xn?/Mac/.test(xn.platform):!1),VM=xn?/Win/.test(xn.platform):!1,Pn=/Android \d/.test(Tr),Ns=!!fm&&"webkitFontSmoothing"in fm.documentElement.style,BM=Ns?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function $M(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function On(t,e){return typeof t=="number"?t:t[e]}function jM(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function mm(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let s=n||t.dom;s;s=fs(s)){if(s.nodeType!=1)continue;let a=s,l=a==o.body,u=l?$M(o):jM(a),c=0,d=0;if(e.top<u.top+On(r,"top")?d=-(u.top-e.top+On(i,"top")):e.bottom>u.bottom-On(r,"bottom")&&(d=e.bottom-e.top>u.bottom-u.top?e.top+On(i,"top")-u.top:e.bottom-u.bottom+On(i,"bottom")),e.left<u.left+On(r,"left")?c=-(u.left-e.left+On(i,"left")):e.right>u.right-On(r,"right")&&(c=e.right-u.right+On(i,"right")),c||d)if(l)o.defaultView.scrollBy(c,d);else{let h=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);let f=a.scrollLeft-h,m=a.scrollTop-p;e={left:e.left-f,top:e.top-m,right:e.right-f,bottom:e.bottom-m}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function zM(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let a=t.root.elementFromPoint(o,s);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:Ab(t.dom)}}function Ab(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=fs(r));return e}function HM({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Mb(n,r==0?0:r-e)}function Mb(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:o}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let Ci=null;function qM(t){if(t.setActive)return t.setActive();if(Ci)return t.focus(Ci);let e=Ab(t);t.focus(Ci==null?{get preventScroll(){return Ci={preventScroll:!0},!0}}:void 0),Ci||(Ci=!1,Mb(e,0))}function _b(t,e){let n,r=2e8,i,o=0,s=e.top,a=e.top,l,u;for(let c=t.firstChild,d=0;c;c=c.nextSibling,d++){let h;if(c.nodeType==1)h=c.getClientRects();else if(c.nodeType==3)h=Nn(c).getClientRects();else continue;for(let p=0;p<h.length;p++){let f=h[p];if(f.top<=s&&f.bottom>=a){s=Math.max(f.bottom,s),a=Math.min(f.top,a);let m=f.left>e.left?f.left-e.left:f.right<e.left?e.left-f.right:0;if(m<r){n=c,r=m,i=m&&n.nodeType==3?{left:f.right<e.left?f.right:f.left,top:e.top}:e,c.nodeType==1&&m&&(o=d+(e.left>=(f.left+f.right)/2?1:0));continue}}else f.top>e.top&&!l&&f.left<=e.left&&f.right>=e.left&&(l=c,u={left:Math.max(f.left,Math.min(f.right,e.left)),top:f.top});!n&&(e.left>=f.right&&e.top>=f.top||e.left>=f.left&&e.top>=f.bottom)&&(o=d+1)}}return!n&&l&&(n=l,i=u,r=0),n&&n.nodeType==3?WM(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:_b(n,i)}function WM(t,e){let n=t.nodeValue.length,r=document.createRange();for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let o=Zn(r,1);if(o.top!=o.bottom&&Wp(e,o))return{node:t,offset:i+(e.left>=(o.left+o.right)/2?1:0)}}return{node:t,offset:0}}function Wp(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function UM(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function KM(t,e,n){let{node:r,offset:i}=_b(e,n),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,i,o)}function GM(t,e,n,r){let i=-1;for(let o=e,s=!1;o!=t.dom;){let a=t.docView.nearestDesc(o,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&(!s&&l.left>r.left||l.top>r.top?i=a.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),s=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;o=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function Db(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),o=i;;){let s=t.childNodes[o];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let u=a[l];if(Wp(e,u))return Db(s,e,u)}}if((o=(o+1)%r)==i)break}return t}function JM(t,e){let n=t.dom.ownerDocument,r,i=0,o=LM(n,e.left,e.top);o&&({node:r,offset:i}=o);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let u=t.dom.getBoundingClientRect();if(!Wp(e,u)||(s=Db(t.dom,e,u),!s))return null}if(pt)for(let u=s;r&&u;u=fs(u))u.draggable&&(r=void 0);if(s=UM(s,e),r){if(nn&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let c=r.childNodes[i],d;c.nodeName=="IMG"&&(d=c.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let u;Ns&&i&&r.nodeType==1&&(u=r.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=GM(t,r,i,e))}a==null&&(a=KM(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function gm(t){return t.top<t.bottom||t.left<t.right}function Zn(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(gm(r))return r}return Array.prototype.find.call(n,gm)||t.getBoundingClientRect()}const XM=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Nb(t,e,n){let{node:r,offset:i,atom:o}=t.docView.domFromPos(e,n<0?-1:1),s=Ns||nn;if(r.nodeType==3)if(s&&(XM.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let a=Zn(Nn(r,i,i),n);if(nn&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let l=Zn(Nn(r,i-1,i-1),-1);if(l.top==a.top){let u=Zn(Nn(r,i,i+1),-1);if(u.top!=a.top)return wo(u,u.left<l.left)}}return a}else{let a=i,l=i,u=n<0?1:-1;return n<0&&!i?(l++,u=-1):n>=0&&i==r.nodeValue.length?(a--,u=1):n<0?a--:l++,wo(Zn(Nn(r,a,l),u),u<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==$t(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return mc(a.getBoundingClientRect(),!1)}if(o==null&&i<$t(r)){let a=r.childNodes[i];if(a.nodeType==1)return mc(a.getBoundingClientRect(),!0)}return mc(r.getBoundingClientRect(),n>=0)}if(o==null&&i&&(n<0||i==$t(r))){let a=r.childNodes[i-1],l=a.nodeType==3?Nn(a,$t(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(l)return wo(Zn(l,1),!1)}if(o==null&&i<$t(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let l=a?a.nodeType==3?Nn(a,0,s?0:1):a.nodeType==1?a:null:null;if(l)return wo(Zn(l,-1),!0)}return wo(Zn(r.nodeType==3?Nn(r):r,-n),n>=0)}function wo(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function mc(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Ib(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function YM(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Ib(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let s=Nb(t,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Nn(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;u<l.length;u++){let c=l[u];if(c.bottom>c.top+1&&(n=="up"?s.top-c.top>(c.bottom-s.top)*2:c.bottom-s.bottom>(s.bottom-c.top)*2))return!1}}return!0})}const ZM=/[\u0590-\u08ac]/;function QM(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,a=t.domSelection();return a?!ZM.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?o:s:Ib(t,e,()=>{let{focusNode:l,focusOffset:u,anchorNode:c,anchorOffset:d}=t.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:f,focusOffset:m}=t.domSelectionRange(),g=f&&!p.contains(f.nodeType==1?f:f.parentNode)||l==f&&u==m;try{a.collapse(c,d),l&&(l!=c||u!=d)&&a.extend&&a.extend(l,u)}catch{}return h!=null&&(a.caretBidiLevel=h),g}):r.pos==r.start()||r.pos==r.end()}let vm=null,ym=null,bm=!1;function e_(t,e,n){return vm==e&&ym==n?bm:(vm=e,ym=n,bm=n=="up"||n=="down"?YM(t,e,n):QM(t,e,n))}const zt=0,km=1,Wr=2,En=3;class Is{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=zt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let o,s;if(e==this.contentDOM)o=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>Xe(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!n||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)for(let s=0;s<i.children.length;s++){let a=i.children[s];if(a.size){i=a;break}}return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],a=o+s.size;if(a>e||s instanceof Pb){i=e-o;break}o=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof Rb&&o.side>=0;r--);if(n<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&n&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?Xe(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,n):{node:this.contentDOM,offset:o?Xe(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,a=0;;a++){let l=this.children[a],u=s+l.size;if(i==-1&&e<=u){let c=s+l.border;if(e>=c&&n<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,c);e=s;for(let d=a;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=Xe(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(u>n||a==this.children.length-1)){n=u;for(let c=a+1;c<this.children.length;c++){let d=this.children[c];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){o=Xe(d.dom);break}n+=d.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=u}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let o=Math.min(e,n),s=Math.max(e,n);for(let p=0,f=0;p<this.children.length;p++){let m=this.children[p],g=f+m.size;if(o>f&&s<g)return m.setSelection(e-f-m.border,n-f-m.border,r,i);f=g}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),u=r.root.getSelection(),c=r.domSelectionRange(),d=!1;if((nn||pt)&&e==n){let{node:p,offset:f}=a;if(p.nodeType==3){if(d=!!(f&&p.nodeValue[f-1]==`
13
+ `),d&&f==p.nodeValue.length)for(let m=p,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=l={node:g.parentNode,offset:Xe(g)+1});break}let y=m.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let m=p.childNodes[f-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(nn&&c.focusNode&&c.focusNode!=l.node&&c.focusNode.nodeType==1){let p=c.focusNode.childNodes[c.focusOffset];p&&p.contentEditable=="false"&&(i=!0)}if(!(i||d&&pt)&&si(a.node,a.offset,c.anchorNode,c.anchorOffset)&&si(l.node,l.offset,c.focusNode,c.focusOffset))return;let h=!1;if((u.extend||e==n)&&!d){u.collapse(a.node,a.offset);try{e!=n&&u.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(e>n){let f=a;a=l,l=f}let p=document.createRange();p.setEnd(l.node,l.offset),p.setStart(a.node,a.offset),u.removeAllRanges(),u.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let a=r+o.border,l=s-o.border;if(e>=a&&n<=l){this.dirty=e==r||n==s?Wr:km,e==a&&n==l&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=En:o.markDirty(e-a,n-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Wr:En}r=s}this.dirty=Wr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Wr:km;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class Rb extends Is{constructor(e,n,r,i){let o,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==zt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class t_ extends Is{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class ai extends Is{constructor(e,n,r,i,o){super(e,[],r,i),this.mark=n,this.spec=o}static create(e,n,r,i){let o=i.nodeViews[n.type.name],s=o&&o(n,i,r);return(!s||!s.dom)&&(s=fi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ai(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&En||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=En&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=zt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=zt}}slice(e,n,r){let i=ai.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;n<s&&(o=Od(o,n,s,r)),e>0&&(o=Od(o,0,e,r));for(let a=0;a<o.length;a++)o[a].parent=i;return i.children=o,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class vr extends Is{constructor(e,n,r,i,o,s,a,l,u){super(e,[],o,s),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,o,s){let a=o.nodeViews[n.type.name],l,u=a&&a(n,o,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,i),c=u&&u.dom,d=u&&u.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:d}=fi.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let h=c;return c=Vb(c,r,n),u?l=new n_(e,n,r,i,c,d||null,h,u,o,s+1):n.isText?new Cu(e,n,r,i,c,h,o):new vr(e,n,r,i,c,d||null,h,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>A.empty)}return e}matchesNode(e,n,r){return this.dirty==zt&&e.eq(this.node)&&cl(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,o=e.composing?this.localCompositionInfo(e,n):null,s=o&&o.pos>-1?o:null,a=o&&o.pos<0,l=new i_(this,s&&s.node,e);a_(this.node,this.innerDeco,(u,c,d)=>{u.spec.marks?l.syncToMarks(u.spec.marks,r,e):u.type.side>=0&&!d&&l.syncToMarks(c==this.node.childCount?ke.none:this.node.child(c).marks,r,e),l.placeWidget(u,e,i)},(u,c,d,h)=>{l.syncToMarks(u.marks,r,e);let p;l.findNodeMatch(u,c,d,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+u.nodeSize&&(p=l.findIndexWithChild(o.node))>-1&&l.updateNodeAt(u,c,d,p,e)||l.updateNextNode(u,c,d,e,h,i)||l.addNode(u,c,d,e,i),i+=u.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Wr)&&(s&&this.protectLocalComposition(e,s),Fb(this.contentDOM,this.children,e),Qi&&l_(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof oe)||r<n||i>n+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,a=u_(this.node.content,s,r-n,i-n);return a<0?null:{node:o,pos:a,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new t_(this,o,n,i);e.input.compositionNodes.push(s),this.children=Od(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==En||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=zt}updateOuterDeco(e){if(cl(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Lb(this.dom,this.nodeDOM,Td(this.outerDeco,this.node,n),Td(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function wm(t,e,n,r,i){Vb(r,e,t);let o=new vr(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Cu extends vr{constructor(e,n,r,i,o,s,a){super(e,n,r,i,o,null,s,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==En||this.dirty!=zt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=zt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=zt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),o=document.createTextNode(i.text);return new Cu(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=En)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Pb extends Is{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==zt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class n_ extends vr{constructor(e,n,r,i,o,s,a,l,u,c){super(e,n,r,i,o,s,a,u,c),this.spec=l}update(e,n,r,i){if(this.dirty==En)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,n,r);return o&&this.updateInner(e,n,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Fb(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],a=s.dom;if(a.parentNode==t){for(;a!=r;)r=xm(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(s instanceof ai){let l=r?r.previousSibling:t.lastChild;Fb(s.contentDOM,s.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=xm(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Wo=function(t){t&&(this.nodeName=t)};Wo.prototype=Object.create(null);const Ur=[new Wo];function Td(t,e,n){if(t.length==0)return Ur;let r=n?Ur[0]:new Wo,i=[r];for(let o=0;o<t.length;o++){let s=t[o].type.attrs;if(s){s.nodeName&&i.push(r=new Wo(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&i.length==1&&i.push(r=new Wo(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function Lb(t,e,n,r){if(n==Ur&&r==Ur)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],a=n[o];if(o){let l;a&&a.nodeName==s.nodeName&&i!=t&&(l=i.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=Ur[0]),i=l}r_(i,a||Ur[0],s)}return i}function r_(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&t.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&t.classList.add(i[o]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function Vb(t,e,n){return Lb(t,t,Ur,Td(e,n,t.nodeType!=1))}function cl(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function xm(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class i_{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=o_(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=zt,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let u=this.top.children[l];if(u.matchesMark(e[o])&&!this.isLocked(u.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=ai.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))o=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let u=this.top.children[a];if(u.matchesNode(e,n,r)&&!this.preMatch.matched.has(u)){o=a;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,n,r,i,o){let s=this.top.children[i];return s.dirty==En&&s.dom==s.contentDOM&&(s.dirty=Wr),s.update(e,n,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,o,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof vr){let u=this.preMatch.matched.get(l);if(u!=null&&u!=o)return!1;let c=l.dom,d,h=this.isLocked(c)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=En&&cl(n,l.outerDeco));if(!h&&l.update(e,n,r,i))return this.destroyBetween(this.index,a),l.dom!=c&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(l,e,n,r,i,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Wr,d.updateChildren(i,s+1),d.dirty=zt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,o,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!cl(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=vr.create(this.top,n,r,i,o,s);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,i,o){let s=vr.create(this.top,e,n,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new Rb(this.top,e,n,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof ai;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Cu)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((pt||rt)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new Pb(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function o_(t,e){let n=e,r=n.children.length,i=t.childCount,o=new Map,s=[];e:for(;i>0;){let a;for(;;)if(r){let u=n.children[r-1];if(u instanceof ai)n=u,r=u.children.length;else{a=u,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}function s_(t,e){return t.type.side-e.type.side}function a_(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let u=0;u<t.childCount;u++){let c=t.child(u);r(c,i,e.forChild(o,c),u),o+=c.nodeSize}return}let s=0,a=[],l=null;for(let u=0;;){let c,d;for(;s<i.length&&i[s].to==o;){let g=i[s++];g.widget&&(c?(d||(d=[c])).push(g):c=g)}if(c)if(d){d.sort(s_);for(let g=0;g<d.length;g++)n(d[g],u,!!l)}else n(c,u,!!l);let h,p;if(l)p=-1,h=l,l=null;else if(u<t.childCount)p=u,h=t.child(u++);else break;for(let g=0;g<a.length;g++)a[g].to<=o&&a.splice(g--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)a.push(i[s++]);let f=o+h.nodeSize;if(h.isText){let g=f;s<i.length&&i[s].from<g&&(g=i[s].from);for(let y=0;y<a.length;y++)a[y].to<g&&(g=a[y].to);g<f&&(l=h.cut(g-o),h=h.cut(0,g-o),f=g,p=-1)}else for(;s<i.length&&i[s].to<f;)s++;let m=h.isInline&&!h.isLeaf?a.filter(g=>!g.inline):a.slice();r(h,m,e.forChild(o,h),p),o=f}}function l_(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function u_(t,e,n,r){for(let i=0,o=0;i<t.childCount&&o<=r;){let s=t.child(i++),a=o;if(o+=s.nodeSize,!s.isText)continue;let l=s.text;for(;i<t.childCount;){let u=t.child(i++);if(o+=u.nodeSize,!u.isText)break;l+=u.text}if(o>=n){if(o>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let u=a<r?l.lastIndexOf(e,r-a-1):-1;if(u>=0&&u+e.length+a>=n)return a+u;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function Od(t,e,n,r,i){let o=[];for(let s=0,a=0;s<t.length;s++){let l=t[s],u=a,c=a+=l.size;u>=n||c<=e?o.push(l):(u<e&&o.push(l.slice(0,e-u,r)),i&&(o.push(i),i=void 0),c>n&&o.push(l.slice(n-u,l.size,r)))}return o}function Up(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),o=i&&i.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,u;if(Eu(n)){for(l=s;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&Y.isSelectable(d)&&i.parent&&!(d.isInline&&PM(n.focusNode,n.focusOffset,i.dom))){let h=i.posBefore;u=new Y(s==h?a:r.resolve(h))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,h=s;for(let p=0;p<n.rangeCount;p++){let f=n.getRangeAt(p);d=Math.min(d,t.docView.posFromDOM(f.startContainer,f.startOffset,1)),h=Math.max(h,t.docView.posFromDOM(f.endContainer,f.endOffset,-1))}if(d<0)return null;[l,s]=h==t.state.selection.anchor?[h,d]:[d,h],a=r.resolve(s)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let c=r.resolve(l);if(!u){let d=e=="pointer"||t.state.selection.head<a.pos&&!o?1:-1;u=Kp(t,c,a,d)}return u}function Bb(t){return t.editable?t.hasFocus():jb(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Bn(t,e=!1){let n=t.state.selection;if($b(t,n),!!Bb(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&rt){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&si(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)d_(t);else{let{anchor:r,head:i}=n,o,s;Em&&!(n instanceof oe)&&(n.$from.parent.inlineContent||(o=Cm(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=Cm(t,n.to))),t.docView.setSelection(r,i,t,e),Em&&(o&&Sm(o),s&&Sm(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&c_(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Em=pt||rt&&Ob<63;function Cm(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(pt&&i&&i.contentEditable=="false")return gc(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return gc(i);if(o)return gc(o)}}function gc(t){return t.contentEditable="true",pt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Sm(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function c_(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Bb(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function d_(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let r=t.cursorWrapper.dom,i=r.nodeName=="IMG";i?n.setStart(r.parentNode,Xe(r)+1):n.setStart(r,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!i&&!t.state.selection.visible&&bt&&gr<=11&&(r.disabled=!0,r.disabled=!1)}function $b(t,e){if(e instanceof Y){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Tm(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Tm(t)}function Tm(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Kp(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||oe.between(e,n,r)}function Om(t){return t.editable&&!t.hasFocus()?!1:jb(t)}function jb(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function p_(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return si(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Ad(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return o&&le.findFrom(o,e)}function er(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Am(t,e,n){let r=t.state.selection;if(r instanceof oe)if(n.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=t.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return er(t,new oe(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Ad(t.state,e);return i&&i instanceof Y?er(t,i):!1}else if(!(Vt&&n.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let a=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?Y.isSelectable(o)?er(t,new Y(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):Ns?er(t,new oe(t.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Y&&r.node.isInline)return er(t,new oe(e>0?r.$to:r.$from));{let i=Ad(t.state,e);return i?er(t,i):!1}}}function dl(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Uo(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Si(t,e){return e<0?h_(t):f_(t)}function h_(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;for(nn&&n.nodeType==1&&r<dl(n)&&Uo(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Uo(a,-1))i=n,o=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(zb(n))break;{let a=n.previousSibling;for(;a&&Uo(a,-1);)i=n.parentNode,o=Xe(a),a=a.previousSibling;if(a)n=a,r=dl(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?Md(t,n,r):i&&Md(t,i,o)}function f_(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=dl(n),o,s;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Uo(a,1))o=n,s=++r;else break}else{if(zb(n))break;{let a=n.nextSibling;for(;a&&Uo(a,1);)o=a.parentNode,s=Xe(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=dl(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}o&&Md(t,o,s)}function zb(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function m_(t,e){for(;t&&e==t.childNodes.length&&!Ds(t);)e=Xe(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function g_(t,e){for(;t&&!e&&!Ds(t);)e=Xe(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Md(t,e,n){if(e.nodeType!=3){let o,s;(s=m_(e,n))?(e=s,n=0):(o=g_(e,n))&&(e=o,n=o.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Eu(r)){let o=document.createRange();o.setEnd(e,n),o.setStart(e,n),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&Bn(t)},50)}function Mm(t,e){let n=t.state.doc.resolve(e);if(!(rt||VM)&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(i.left-r.left)>1)return i.left>r.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function _m(t,e,n){let r=t.state.selection;if(r instanceof oe&&!r.empty||n.indexOf("s")>-1||Vt&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Ad(t.state,e);if(s&&s instanceof Y)return er(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,a=r instanceof jt?le.near(s,e):le.findFrom(s,e);return a?er(t,a):!1}return!1}function Dm(t,e){if(!(t.state.selection instanceof oe))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let s=t.state.tr;return e<0?s.delete(n.pos-o.nodeSize,n.pos):s.delete(n.pos,n.pos+o.nodeSize),t.dispatch(s),!0}return!1}function Nm(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function v_(t){if(!pt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Nm(t,r,"true"),setTimeout(()=>Nm(t,r,"false"),20)}return!1}function y_(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function b_(t,e){let n=e.keyCode,r=y_(e);if(n==8||Vt&&n==72&&r=="c")return Dm(t,-1)||Si(t,-1);if(n==46&&!e.shiftKey||Vt&&n==68&&r=="c")return Dm(t,1)||Si(t,1);if(n==13||n==27)return!0;if(n==37||Vt&&n==66&&r=="c"){let i=n==37?Mm(t,t.state.selection.from)=="ltr"?-1:1:-1;return Am(t,i,r)||Si(t,i)}else if(n==39||Vt&&n==70&&r=="c"){let i=n==39?Mm(t,t.state.selection.from)=="ltr"?1:-1:1;return Am(t,i,r)||Si(t,i)}else{if(n==38||Vt&&n==80&&r=="c")return _m(t,-1,r)||Si(t,-1);if(n==40||Vt&&n==78&&r=="c")return v_(t)||_m(t,1,r)||Si(t,1);if(r==(Vt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Gp(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=t.someProp("clipboardSerializer")||fi.fromSchema(t.state.schema),a=Gb(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let u=l.firstChild,c,d=0;for(;u&&u.nodeType==1&&(c=Kb[u.nodeName.toLowerCase()]);){for(let p=c.length-1;p>=0;p--){let f=a.createElement(c[p]);for(;l.firstChild;)f.appendChild(l.firstChild);l.appendChild(f),d++}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${o}${d?` -${d}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
14
14
 
15
15
  `);return{dom:l,text:h,slice:e}}function Hb(t,e,n,r,i){let o=i.parent.type.spec.code,s,a;if(!n&&!e)return null;let l=e&&(r||o||!n);if(l){if(t.someProp("transformPastedText",h=>{e=h(e,o||r,t)}),o)return e?new V(A.from(t.state.schema.text(e.replace(/\r\n?/g,`
16
- `))),0,0):V.empty;let d=t.someProp("clipboardTextParser",h=>h(e,i,r,t));if(d)a=d;else{let h=i.marks(),{schema:p}=t.state,f=fi.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=s.appendChild(document.createElement("p"));m&&g.appendChild(f.serializeNode(p.text(m,h)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=x_(n),Ns&&E_(s);let u=s&&s.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let h=s.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;s=h}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||mr.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||c),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!b_.test(d.parentNode.nodeName)?{ignore:!0}:null}})),c)a=C_(Nm(a,+c[1],+c[2]),c[4]);else if(a=V.maxOpen(k_(a.content,i),!0),a.openStart||a.openEnd){let d=0,h=0;for(let p=a.content.firstChild;d<a.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=a.content.lastChild;h<a.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);a=Nm(a,d,h)}return t.someProp("transformPasted",d=>{a=d(a,t)}),a}const b_=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function k_(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(s=>{if(!o)return;let a=r.findWrapping(s.type),l;if(!a)return o=null;if(l=o.length&&i.length&&Wb(a,i,s,o[o.length-1],0))o[o.length-1]=l;else{o.length&&(o[o.length-1]=Ub(o[o.length-1],i.length));let u=qb(s,a);o.push(u),r=r.matchType(u.type),i=a}}),o)return A.from(o)}return t}function qb(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,A.from(t));return t}function Wb(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let o=Wb(t,e,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(A.from(qb(n,t,i+1))))}}function Ub(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Ub(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(A.empty,!0);return t.copy(n.append(r))}function Md(t,e,n,r,i,o){let s=e<0?t.firstChild:t.lastChild,a=s.content;return t.childCount>1&&(o=0),i<r-1&&(a=Md(a,e,n,r,i+1,o)),i>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(A.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function Nm(t,e,n){return e<t.openStart&&(t=new V(Md(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new V(Md(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Kb={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Im=null;function Gb(){return Im||(Im=document.implementation.createHTMLDocument("title"))}let gc=null;function w_(t){let e=window.trustedTypes;return e?(gc||(gc=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),gc.createHTML(t)):t}function x_(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Gb().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&Kb[r[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"</"+o+">").reverse().join("")),n.innerHTML=w_(t),i)for(let o=0;o<i.length;o++)n=n.querySelector(i[o])||n;return n}function E_(t){let e=t.querySelectorAll(rt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function C_(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:o,openEnd:s}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=A.from(l.create(r[a+1],i)),o++,s++}return new V(i,o,s)}const ht={},ft={},S_={touchstart:!0,touchmove:!0};class T_{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function O_(t){for(let e in ht){let n=ht[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{M_(t,r)&&!Gp(t,r)&&(t.editable||!(r.type in ft))&&n(t,r)},S_[e]?{passive:!0}:void 0)}pt&&t.dom.addEventListener("input",()=>null),_d(t)}function ur(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function A_(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function _d(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Gp(t,r))})}function Gp(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function M_(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function __(t,e){!Gp(t,e)&&ht[e.type]&&(t.editable||!(e.type in ft))&&ht[e.type](t,e)}ft.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Xb(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Pn&&rt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Qi&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,zr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||y_(t,n)?n.preventDefault():ur(t,"key")};ft.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};ft.keypress=(t,e)=>{let n=e;if(Xb(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Vt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof oe)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode);!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i))&&t.dispatch(t.state.tr.insertText(i).scrollIntoView()),n.preventDefault()}};function Cu(t){return{left:t.clientX,top:t.clientY}}function D_(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Jp(t,e,n,r,i){if(r==-1)return!1;let o=t.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(t.someProp(e,a=>s>o.depth?a(t,n,o.nodeAfter,o.before(s),i,!0):a(t,n,o.node(s),o.before(s),i,!1)))return!0;return!1}function zi(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function N_(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Y.isSelectable(r)?(zi(t,new Y(n)),!0):!1}function I_(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Y&&(r=n.node);let o=t.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let a=s>o.depth?o.nodeAfter:o.node(s);if(Y.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(s);break}}return i!=null?(zi(t,Y.create(t.state.doc,i)),!0):!1}function R_(t,e,n,r,i){return Jp(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?I_(t,n):N_(t,n))}function P_(t,e,n,r){return Jp(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function F_(t,e,n,r){return Jp(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||L_(t,n,r)}function L_(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(zi(t,oe.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),a=i.before(o);if(s.inlineContent)zi(t,oe.create(r,a+1,a+1+s.content.size));else if(Y.isSelectable(s))zi(t,Y.create(r,a));else continue;return!0}}function Xp(t){return pl(t)}const Jb=Vt?"metaKey":"ctrlKey";ht.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Xp(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&D_(n,t.input.lastClick)&&!n[Jb]&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o};let s=t.posAtCoords(Cu(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new V_(t,s,n,!!r)):(o=="doubleClick"?P_:F_)(t,s.pos,s.inside,n)?n.preventDefault():ur(t,"pointer"))};class V_{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Jb],this.allowDefault=r.shiftKey;let o,s;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else{let c=e.state.doc.resolve(n.pos);o=c.parent,s=c.depth?c.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:u}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||u instanceof Y&&u.from<=s&&u.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&nn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),ur(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Bn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Cu(e))),this.updateAllowDefault(e),this.allowDefault||!n?ur(this.view,"pointer"):R_(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||pt&&this.mightDrag&&!this.mightDrag.node.isAtom||rt&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(zi(this.view,le.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):ur(this.view,"pointer")}move(e){this.updateAllowDefault(e),ur(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}ht.touchstart=t=>{t.input.lastTouch=Date.now(),Xp(t),ur(t,"pointer")};ht.touchmove=t=>{t.input.lastTouch=Date.now(),ur(t,"pointer")};ht.contextmenu=t=>Xp(t);function Xb(t,e){return t.composing?!0:pt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const B_=Pn?5e3:-1;ft.compositionstart=ft.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof oe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),pl(t,!0),t.markCursor=null;else if(pl(t,!e.selection.empty),nn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let a=t.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}t.input.composing=!0}Yb(t,B_)};ft.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Yb(t,20))};function Yb(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>pl(t),e))}function Zb(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=j_());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function $_(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=NM(e.focusNode,e.focusOffset),r=IM(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function j_(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function pl(t,e=!1){if(!(Pn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Zb(t),e||t.docView&&t.docView.dirty){let n=Wp(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!t.state.selection.empty?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function z_(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const ms=bt&&gr<15||Qi&&VM<604;ht.copy=ft.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=ms?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Kp(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):z_(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function H_(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function q_(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?gs(t,r.value,null,i,e):gs(t,r.textContent,r.innerHTML,i,e)},50)}function gs(t,e,n,r,i){let o=Hb(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,o||V.empty)))return!0;if(!o)return!1;let s=H_(o),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Qb(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}ft.paste=(t,e)=>{let n=e;if(t.composing&&!Pn)return;let r=ms?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&gs(t,Qb(r),r.getData("text/html"),i,n)?n.preventDefault():q_(t,n)};class e0{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const t0=Vt?"altKey":"ctrlKey";ht.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,o=i.empty?null:t.posAtCoords(Cu(n)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof Y?i.to-1:i.to))){if(r&&r.mightDrag)s=Y.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=Y.create(t.state.doc,d.posBefore))}}let a=(s||t.state.selection).content(),{dom:l,text:u,slice:c}=Kp(t,a);(!n.dataTransfer.files.length||!rt||Ob>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ms?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ms||n.dataTransfer.setData("text/plain",u),t.dragging=new e0(c,!n[t0],s)};ht.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};ft.dragover=ft.dragenter=(t,e)=>e.preventDefault();ft.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(Cu(n));if(!i)return;let o=t.state.doc.resolve(i.pos),s=r&&r.slice;s?t.someProp("transformPasted",f=>{s=f(s,t)}):s=Hb(t,Qb(n.dataTransfer),ms?null:n.dataTransfer.getData("text/html"),!1,o);let a=!!(r&&!n[t0]);if(t.someProp("handleDrop",f=>f(t,n,s||V.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?yb(t.state.doc,o.pos,s):o.pos;l==null&&(l=o.pos);let u=t.state.tr;if(a){let{node:f}=r;f?f.replace(u):u.deleteSelection()}let c=u.mapping.map(l),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,h=u.doc;if(d?u.replaceRangeWith(c,c,s.content.firstChild):u.replaceRange(c,c,s),u.doc.eq(h))return;let p=u.doc.resolve(c);if(d&&Y.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new Y(p));else{let f=u.mapping.map(l);u.mapping.maps[u.mapping.maps.length-1].forEach((m,g,y,b)=>f=b),u.setSelection(Up(t,p,u.doc.resolve(f)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))};ht.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Bn(t)},20))};ht.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};ht.beforeinput=(t,e)=>{if(rt&&Pn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:n}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=n||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,zr(8,"Backspace")))))return;let{$cursor:r}=t.state.selection;r&&r.pos>0&&t.dispatch(t.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let t in ft)ht[t]=ft[t];function vs(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class hl{constructor(e,n){this.toDOM=e,this.spec=n||Yr,this.side=this.spec.side||0}map(e,n,r,i){let{pos:o,deleted:s}=e.mapResult(n.from+i,this.side<0?-1:1);return s?null:new Mt(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof hl&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&vs(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class yr{constructor(e,n){this.attrs=e,this.spec=n||Yr}map(e,n,r,i){let o=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new Mt(o,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof yr&&vs(this.attrs,e.attrs)&&vs(this.spec,e.spec)}static is(e){return e.type instanceof yr}destroy(){}}class Yp{constructor(e,n){this.attrs=e,this.spec=n||Yr}map(e,n,r,i){let o=e.mapResult(n.from+i,1);if(o.deleted)return null;let s=e.mapResult(n.to+i,-1);return s.deleted||s.pos<=o.pos?null:new Mt(o.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),o;return i==n.from&&!(o=e.child(r)).isText&&i+o.nodeSize==n.to}eq(e){return this==e||e instanceof Yp&&vs(this.attrs,e.attrs)&&vs(this.spec,e.spec)}destroy(){}}class Mt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Mt(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Mt(e,e,new hl(n,r))}static inline(e,n,r,i){return new Mt(e,n,new yr(r,i))}static node(e,n,r,i){return new Mt(e,n,new Yp(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof yr}get widget(){return this.type instanceof hl}}const Ai=[],Yr={};class Pe{constructor(e,n){this.local=e.length?e:Ai,this.children=n.length?n:Ai}static create(e,n){return n.length?fl(n,e,0,Yr):nt}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,o){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=e&&(!o||o(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,r,i+a,o)}}map(e,n,r){return this==nt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Yr)}mapInner(e,n,r,i,o){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(n,l)?(s||(s=[])).push(l):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?W_(this.children,s||[],e,n,r,i,o):s?new Pe(s.sort(Zr),Ai):nt}add(e,n){return n.length?this==nt?Pe.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,o=0;e.forEach((a,l)=>{let u=l+r,c;if(c=r0(n,a,u)){for(i||(i=this.children.slice());o<i.length&&i[o]<l;)o+=3;i[o]==l?i[o+2]=i[o+2].addInner(a,c,u+1):i.splice(o,0,l,l+a.nodeSize,fl(c,a,u+1,Yr)),o+=3}});let s=n0(o?i0(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new Pe(s.length?this.local.concat(s).sort(Zr):this.local,i||this.children)}remove(e){return e.length==0||this==nt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,a=r[o]+n,l=r[o+1]+n;for(let c=0,d;c<e.length;c++)(d=e[c])&&d.from>a&&d.to<l&&(e[c]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let u=r[o+2].removeInner(s,a+1);u!=nt?r[o+2]=u:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let a=0;a<i.length;a++)i[a].eq(s,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Pe(i,r):nt}forChild(e,n){if(this==nt)return this;if(n.isLeaf)return Pe.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let o=e+1,s=o+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>o&&l.type instanceof yr){let u=Math.max(o,l.from)-o,c=Math.min(s,l.to)-o;u<c&&(i||(i=[])).push(l.copy(u,c))}}if(i){let a=new Pe(i.sort(Zr),Ai);return r?new ir([a,r]):a}return r||nt}eq(e){if(this==e)return!0;if(!(e instanceof Pe)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Zp(this.localsInner(e))}localsInner(e){if(this==nt)return Ai;if(e.inlineContent||!this.local.some(yr.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof yr||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Pe.empty=new Pe([],[]);Pe.removeOverlap=Zp;const nt=Pe.empty;class ir{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Yr));return ir.from(r)}forChild(e,n){if(n.isLeaf)return Pe.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,n);o!=nt&&(o instanceof ir?r=r.concat(o.members):r.push(o))}return ir.from(r)}eq(e){if(!(e instanceof ir)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!n)n=o;else{r&&(n=n.slice(),r=!1);for(let s=0;s<o.length;s++)n.push(o[s])}}return n?Zp(r?n:n.sort(Zr)):Ai}static from(e){switch(e.length){case 0:return nt;case 1:return e[0];default:return new ir(e.every(n=>n instanceof Pe)?e:e.reduce((n,r)=>n.concat(r instanceof Pe?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function W_(t,e,n,r,i,o,s){let a=t.slice();for(let u=0,c=o;u<n.maps.length;u++){let d=0;n.maps[u].forEach((h,p,f,m)=>{let g=m-f-(p-h);for(let y=0;y<a.length;y+=3){let b=a[y+1];if(b<0||h>b+c-d)continue;let k=a[y]+c-d;p>=k?a[y+1]=h<=k?-2:-1:h>=c&&g&&(a[y]+=g,a[y+1]+=g)}d+=g}),c=n.maps[u].map(c,-1)}let l=!1;for(let u=0;u<a.length;u+=3)if(a[u+1]<0){if(a[u+1]==-2){l=!0,a[u+1]=-1;continue}let c=n.map(t[u]+o),d=c-i;if(d<0||d>=r.content.size){l=!0;continue}let h=n.map(t[u+1]+o,-1),p=h-i,{index:f,offset:m}=r.content.findIndex(d),g=r.maybeChild(f);if(g&&m==d&&m+g.nodeSize==p){let y=a[u+2].mapInner(n,g,c+1,t[u]+o+1,s);y!=nt?(a[u]=d,a[u+1]=p,a[u+2]=y):(a[u+1]=-2,l=!0)}else l=!0}if(l){let u=U_(a,t,e,n,i,o,s),c=fl(u,r,0,s);e=c.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,h=0;d<c.children.length;d+=3){let p=c.children[d];for(;h<a.length&&a[h]<p;)h+=3;a.splice(h,0,c.children[d],c.children[d+1],c.children[d+2])}}return new Pe(e.sort(Zr),a)}function n0(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new Mt(i.from+e,i.to+e,i.type))}return n}function U_(t,e,n,r,i,o,s){function a(l,u){for(let c=0;c<l.local.length;c++){let d=l.local[c].map(r,i,u);d?n.push(d):s.onRemove&&s.onRemove(l.local[c].spec)}for(let c=0;c<l.children.length;c+=3)a(l.children[c+2],l.children[c]+u+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+o+1);return n}function r0(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let o=0,s;o<t.length;o++)(s=t[o])&&s.from>n&&s.to<r&&((i||(i=[])).push(s),t[o]=null);return i}function i0(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function fl(t,e,n,r){let i=[],o=!1;e.forEach((a,l)=>{let u=r0(t,a,l+n);if(u){o=!0;let c=fl(u,a,n+l+1,r);c!=nt&&i.push(l,l+a.nodeSize,c)}});let s=n0(o?i0(t):t,-n).sort(Zr);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||i.length?new Pe(s,i):nt}function Zr(t,e){return t.from-e.from||t.to-e.to}function Zp(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==t&&(e=t.slice()),e[i]=o.copy(o.from,r.to),Rm(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,o.from),Rm(e,i,r.copy(o.from,r.to)));break}}}return e}function Rm(t,e,n){for(;e<t.length&&Zr(n,t[e])>0;)e++;t.splice(e,0,n)}function vc(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=nt&&e.push(r)}),t.cursorWrapper&&e.push(Pe.create(t.state.doc,[t.cursorWrapper.deco])),ir.from(e)}const K_={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},G_=bt&&gr<=11;class J_{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class X_{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new J_,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);bt&&gr<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),G_&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,K_)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Tm(this.view)){if(this.suppressingSelectionUpdates)return Bn(this.view);if(bt&&gr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&si(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let o=e.focusNode;o;o=fs(o))n.add(o);for(let o=e.anchorNode;o;o=fs(o))if(n.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Tm(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(e.editable)for(let c=0;c<n.length;c++){let d=this.registerMutation(n[c],l);d&&(o=o<0?d.from:Math.min(d.from,o),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(a=!0))}if(nn&&l.length){let c=l.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,h]=c;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of c){let p=h.parentNode;p&&p.nodeName=="LI"&&(!d||Q_(e,d)!=p)&&h.remove()}}}let u=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&xu(r)&&(u=Wp(e))&&u.eq(le.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Bn(e),this.currentSelection.set(r)):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),Y_(e)),this.handleDOMChange(o,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Bn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;c<e.addedNodes.length;c++){let d=e.addedNodes[c];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(bt&&gr<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:d,nextSibling:h}=e.addedNodes[c];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(o=h)}let s=i&&i.parentNode==e.target?Xe(i)+1:0,a=r.localPosFromDOM(e.target,s,-1),l=o&&o.parentNode==e.target?Xe(o):e.target.childNodes.length,u=r.localPosFromDOM(e.target,l,1);return{from:a,to:u}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Pm=new WeakMap,Fm=!1;function Y_(t){if(!Pm.has(t)&&(Pm.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=nn,Fm)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Fm=!0}}function Lm(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return si(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function Z_(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Lm(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Lm(t,n):null}function Q_(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function eD(t,e,n){let{node:r,fromOffset:i,toOffset:o,from:s,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),u,c=l.anchorNode;if(c&&t.dom.contains(c.nodeType==1?c:c.parentNode)&&(u=[{node:c,offset:l.anchorOffset}],xu(l)||u.push({node:l.focusNode,offset:l.focusOffset})),rt&&t.input.lastKeyCode===8)for(let g=o;g>i;g--){let y=r.childNodes[g-1],b=y.pmViewDesc;if(y.nodeName=="BR"&&!b){o=g;break}if(!b||b.size)break}let d=t.state.doc,h=t.someProp("domParser")||mr.fromSchema(t.state.schema),p=d.resolve(s),f=null,m=h.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:tD,context:p});if(u&&u[0].pos!=null){let g=u[0].pos,y=u[1]&&u[1].pos;y==null&&(y=g),f={anchor:g+s,head:y+s}}return{doc:m,sel:f,from:s,to:a}}function tD(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(pt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||pt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const nD=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function rD(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let D=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,C=Wp(t,D);if(C&&!t.state.selection.eq(C)){if(rt&&Pn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",L=>L(t,zr(13,"Enter"))))return;let _=t.state.tr.setSelection(C);D=="pointer"?_.setMeta("pointer",!0):D=="key"&&_.scrollIntoView(),o&&_.setMeta("composition",o),t.dispatch(_)}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,u=eD(t,e,n),c=t.state.doc,d=c.slice(u.from,u.to),h,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,p="end"):(h=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let f=sD(d.content,u.doc.content,u.from,h,p);if(f&&t.input.domChangeCount++,(Qi&&t.input.lastIOSEnter>Date.now()-225||Pn)&&i.some(D=>D.nodeType==1&&!nD.test(D.nodeName))&&(!f||f.endA>=f.endB)&&t.someProp("handleKeyDown",D=>D(t,zr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!f)if(r&&l instanceof oe&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))f={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let D=Vm(t,t.state.doc,u.sel);if(D&&!D.eq(t.state.selection)){let C=t.state.tr.setSelection(D);o&&C.setMeta("composition",o),t.dispatch(C)}}return}t.state.selection.from<t.state.selection.to&&f.start==f.endB&&t.state.selection instanceof oe&&(f.start>t.state.selection.from&&f.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?f.start=t.state.selection.from:f.endA<t.state.selection.to&&f.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(f.endB+=t.state.selection.to-f.endA,f.endA=t.state.selection.to)),bt&&gr<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>u.from&&u.doc.textBetween(f.start-u.from-1,f.start-u.from+1)=="  "&&(f.start--,f.endA--,f.endB--);let m=u.doc.resolveNoCache(f.start-u.from),g=u.doc.resolveNoCache(f.endB-u.from),y=c.resolve(f.start),b=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=f.endA,k;if((Qi&&t.input.lastIOSEnter>Date.now()-225&&(!b||i.some(D=>D.nodeName=="DIV"||D.nodeName=="P"))||!b&&m.pos<u.doc.content.size&&!m.sameParent(g)&&(k=le.findFrom(u.doc.resolve(m.pos+1),1,!0))&&k.head==g.pos)&&t.someProp("handleKeyDown",D=>D(t,zr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>f.start&&oD(c,f.start,f.endA,m,g)&&t.someProp("handleKeyDown",D=>D(t,zr(8,"Backspace")))){Pn&&rt&&t.domObserver.suppressSelectionUpdates();return}rt&&f.endB==f.start&&(t.input.lastChromeDelete=Date.now()),Pn&&!b&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==f.endA&&(f.endB-=2,g=u.doc.resolveNoCache(f.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(D){return D(t,zr(13,"Enter"))})},20));let v=f.start,w=f.endA,x,T,F;if(b){if(m.pos==g.pos)bt&&gr<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Bn(t),20)),x=t.state.tr.delete(v,w),T=c.resolve(f.start).marksAcross(c.resolve(f.endA));else if(f.endA==f.endB&&(F=iD(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,f.endA-y.start()))))x=t.state.tr,F.type=="add"?x.addMark(v,w,F.mark):x.removeMark(v,w,F.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let D=m.parent.textBetween(m.parentOffset,g.parentOffset);if(t.someProp("handleTextInput",C=>C(t,v,w,D)))return;x=t.state.tr.insertText(D,v,w)}}if(x||(x=t.state.tr.replace(v,w,u.doc.slice(f.start-u.from,f.endB-u.from))),u.sel){let D=Vm(t,x.doc,u.sel);D&&!(rt&&t.composing&&D.empty&&(f.start!=f.endB||t.input.lastChromeDelete<Date.now()-100)&&(D.head==v||D.head==x.mapping.map(w)-1)||bt&&D.empty&&D.head==v)&&x.setSelection(D)}T&&x.ensureMarks(T),o&&x.setMeta("composition",o),t.dispatch(x.scrollIntoView())}function Vm(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Up(t,e.resolve(n.anchor),e.resolve(n.head))}function iD(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,o=r,s,a,l;for(let c=0;c<r.length;c++)i=r[c].removeFromSet(i);for(let c=0;c<n.length;c++)o=n[c].removeFromSet(o);if(i.length==1&&o.length==0)a=i[0],s="add",l=c=>c.mark(a.addToSet(c.marks));else if(i.length==0&&o.length==1)a=o[0],s="remove",l=c=>c.mark(a.removeFromSet(c.marks));else return null;let u=[];for(let c=0;c<e.childCount;c++)u.push(l(e.child(c)));if(A.from(u).eq(t))return{mark:a,type:s}}function oD(t,e,n,r,i){if(n-e<=i.pos-r.pos||yc(r,!0,!1)<i.pos)return!1;let o=t.resolve(e);if(!r.parent.isTextblock){let a=o.nodeAfter;return a!=null&&n==e+a.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=t.resolve(yc(o,!0,!0));return!s.parent.isTextblock||s.pos>n||yc(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function yc(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let o=t.node(r).maybeChild(t.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function sD(t,e,n,r,i){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,o-Math.min(s,a));r-=s+l-o}if(s<o&&t.size<e.size){let l=r<=o&&r>=s?o-r:0;o-=l,o&&o<e.size&&Bm(e.textBetween(o-1,o+1))&&(o+=l?1:-1),a=o+(a-s),s=o}else if(a<o){let l=r<=o&&r>=a?o-r:0;o-=l,o&&o<t.size&&Bm(t.textBetween(o-1,o+1))&&(o+=l?1:-1),s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}function Bm(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class aD{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new T_,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(qm),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=zm(this),jm(this),this.nodeViews=Hm(this),this.docView=km(this.state.doc,$m(this),vc(this),this.dom,this),this.domObserver=new X_(this,(r,i,o,s)=>rD(this,r,i,o,s)),this.domObserver.start(),O_(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&_d(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(qm),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(Zb(this),s=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=Hm(this);uD(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&_d(this),this.editable=zm(this),jm(this);let l=vc(this),u=$m(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=o||!this.docView.matchesNode(e.doc,u,l);(d||!e.selection.eq(i.selection))&&(s=!0);let h=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&jM(this);if(s){this.domObserver.stop();let p=d&&(bt||rt)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&lD(i.selection,e.selection);if(d){let f=rt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=$_(this)),(o||!this.docView.update(e.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=km(e.doc,u,l,this.dom,this)),f&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&d_(this))?Bn(this,p):($b(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():h&&zM(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Y){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&fm(this,n.getBoundingClientRect(),e)}else fm(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-n.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new e0(e.slice,e.move,i<0?void 0:Y.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(i=n?n(a):a))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let a=o[s].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(bt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&HM(this.dom),Bn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return GM(this,e)}coordsAtPos(e,n=1){return Nb(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return QM(this,n||this.state,e)}pasteHTML(e,n){return gs(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return gs(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Kp(this,e)}destroy(){this.docView&&(A_(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],vc(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,_M())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return __(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?pt&&this.root.nodeType===11&&PM(this.dom.ownerDocument)==this.dom&&Z_(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function $m(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Mt.node(0,t.state.doc.content.size,e)]}function jm(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Mt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function zm(t){return!t.someProp("editable",e=>e(t.state)===!1)}function lD(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Hm(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function uD(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function qm(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Er={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ml={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},cD=typeof navigator<"u"&&/Mac/.test(navigator.platform),dD=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ye=0;Ye<10;Ye++)Er[48+Ye]=Er[96+Ye]=String(Ye);for(var Ye=1;Ye<=24;Ye++)Er[Ye+111]="F"+Ye;for(var Ye=65;Ye<=90;Ye++)Er[Ye]=String.fromCharCode(Ye+32),ml[Ye]=String.fromCharCode(Ye);for(var bc in Er)ml.hasOwnProperty(bc)||(ml[bc]=Er[bc]);function pD(t){var e=cD&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||dD&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?ml:Er)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const hD=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function fD(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))hD?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),s&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function mD(t){let e=Object.create(null);for(let n in t)e[fD(n)]=t[n];return e}function kc(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function gD(t){return new Ve({props:{handleKeyDown:o0(t)}})}function o0(t){let e=mD(t);return function(n,r){let i=pD(r),o,s=e[kc(i,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[kc(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(o=Er[r.keyCode])&&o!=i){let a=e[kc(o,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}const vD=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function s0(t,e){let{$cursor:n}=t.selection;return!n||n.parentOffset>0?null:n}const yD=(t,e,n)=>{let r=s0(t);if(!r)return!1;let i=Qp(r);if(!i){let s=r.blockRange(),a=s&&uo(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(c0(t,i,e,-1))return!0;if(r.parent.content.size==0&&(eo(o,"end")||Y.isSelectable(o)))for(let s=r.depth;;s--){let a=ku(t.doc,r.before(s),r.after(s),V.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(eo(o,"end")?le.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):Y.create(l.doc,i.pos-o.nodeSize)),e(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},bD=(t,e,n)=>{let r=s0(t);if(!r)return!1;let i=Qp(r);return i?a0(t,i,e):!1},kD=(t,e,n)=>{let r=l0(t);if(!r)return!1;let i=eh(r);return i?a0(t,i,e):!1};function a0(t,e,n){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let c=i.lastChild;if(!c)return!1;i=c}let s=e.nodeAfter,a=s,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let c=a.firstChild;if(!c)return!1;a=c}let u=ku(t.doc,o,l,V.empty);if(!u||u.from!=o||u instanceof je&&u.slice.size>=l-o)return!1;if(n){let c=t.tr.step(u);c.setSelection(oe.create(c.doc,o)),n(c.scrollIntoView())}return!0}function eo(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const wD=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(r.parentOffset>0)return!1;o=Qp(r)}let s=o&&o.nodeBefore;return!s||!Y.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Y.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function Qp(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function l0(t,e){let{$cursor:n}=t.selection;return!n||n.parentOffset<n.parent.content.size?null:n}const xD=(t,e,n)=>{let r=l0(t);if(!r)return!1;let i=eh(r);if(!i)return!1;let o=i.nodeAfter;if(c0(t,i,e,1))return!0;if(r.parent.content.size==0&&(eo(o,"start")||Y.isSelectable(o))){let s=ku(t.doc,r.before(),r.after(),V.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(eo(o,"start")?le.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):Y.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},ED=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(r.parentOffset<r.parent.content.size)return!1;o=eh(r)}let s=o&&o.nodeAfter;return!s||!Y.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Y.create(t.doc,o.pos)).scrollIntoView()),!0)};function eh(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const CD=(t,e)=>{let n=t.selection,r=n instanceof Y,i;if(r){if(n.node.isTextblock||!Sr(t.doc,n.from))return!1;i=n.from}else if(i=bu(t.doc,n.from,-1),i==null)return!1;if(e){let o=t.tr.join(i);r&&o.setSelection(Y.create(o.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},SD=(t,e)=>{let n=t.selection,r;if(n instanceof Y){if(n.node.isTextblock||!Sr(t.doc,n.to))return!1;r=n.to}else if(r=bu(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},TD=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&uo(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},OD=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
17
- `).scrollIntoView()),!0)};function u0(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const AD=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=u0(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,s.createAndFill());l.setSelection(le.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},MD=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof jt||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=u0(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(s,o.createAndFill());a.setSelection(oe.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},_D=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if($i(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&uo(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},DD=(t,e)=>{let{$from:n,to:r}=t.selection,i,o=n.sharedDepth(r);return o==0?!1:(i=n.before(o),e&&e(t.tr.setSelection(Y.create(t.doc,i))),!0)};function ND(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||Sr(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function c0(t,e,n,r){let i=e.nodeBefore,o=e.nodeAfter,s,a,l=i.type.spec.isolating||o.type.spec.isolating;if(!l&&ND(t,e,n))return!0;let u=!l&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(s=(a=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&a.matchType(s[0]||o.type).validEnd){if(n){let p=e.pos+o.nodeSize,f=A.empty;for(let y=s.length-1;y>=0;y--)f=A.from(s[y].create(null,f));f=A.from(i.copy(f));let m=t.tr.step(new qe(e.pos-1,p,e.pos,p,new V(f,1,0),s.length,!0)),g=m.doc.resolve(p+2*s.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Sr(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let c=o.type.spec.isolating||r>0&&l?null:le.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),h=d&&uo(d);if(h!=null&&h>=e.depth)return n&&n(t.tr.lift(d,h).scrollIntoView()),!0;if(u&&eo(o,"start",!0)&&eo(i,"end")){let p=i,f=[];for(;f.push(p),!p.isTextblock;)p=p.lastChild;let m=o,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(n){let y=A.empty;for(let k=f.length-1;k>=0;k--)y=A.from(f[k].copy(y));let b=t.tr.step(new qe(e.pos-f.length,e.pos+o.nodeSize,e.pos+g,e.pos+o.nodeSize-g,new V(y,f.length,0),0,!0));n(b.scrollIntoView())}return!0}}return!1}function d0(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(e.tr.setSelection(oe.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}const ID=d0(-1),RD=d0(1);function PD(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&zp(s,t,e);return a?(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function Wm(t,e=null){return function(n,r){let i=!1;for(let o=0;o<n.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:a}}=n.selection.ranges[o];n.doc.nodesBetween(s,a,(l,u)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let c=n.doc.resolve(u),d=c.index();i=c.parent.canReplaceWith(d,d+1,t)}})}if(!i)return!1;if(r){let o=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[s];o.setBlockType(a,l,t,e)}r(o.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function FD(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o);if(!s)return!1;let a=r?n.tr:null;return LD(a,s,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function LD(t,e,n,r=null){let i=!1,o=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=s.resolve(e.start-2);o=new ll(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new ll(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=zp(o,n,r,e);return a?(t&&VD(t,e,a,i,n),!0):!1}function VD(t,e,n,r,i){let o=A.empty;for(let c=n.length-1;c>=0;c--)o=A.from(n[c].type.create(n[c].attrs,o));t.step(new qe(e.start-(r?2:0),e.end,e.start,e.end,new V(o,0,0),n.length,!0));let s=0;for(let c=0;c<n.length;c++)n[c].type==i&&(s=c+1);let a=n.length-s,l=e.start+n.length-(r?2:0),u=e.parent;for(let c=e.startIndex,d=e.endIndex,h=!0;c<d;c++,h=!1)!h&&$i(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=u.child(c).nodeSize;return t}function BD(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==t);return o?n?r.node(o.depth-1).type==t?$D(e,n,t,o):jD(e,n,o):!0:!1}}function $D(t,e,n,r){let i=t.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new qe(o-1,s,o,s,new V(A.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ll(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const a=uo(r);if(a==null)return!1;i.lift(r,a);let l=i.mapping.map(o,-1)-1;return Sr(i.doc,l)&&i.join(l),e(i.scrollIntoView()),!0}function jD(t,e,n){let r=t.tr,i=n.parent;for(let p=n.end,f=n.endIndex-1,m=n.startIndex;f>m;f--)p-=i.child(f).nodeSize,r.delete(p-1,p+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==i.childCount,u=o.node(-1),c=o.index(-1);if(!u.canReplace(c+(a?0:1),c+1,s.content.append(l?A.empty:A.from(i))))return!1;let d=o.pos,h=d+s.nodeSize;return r.step(new qe(d-(a?1:0),h+(l?1:0),d+1,h-1,new V((a?A.empty:A.from(i.copy(A.empty))).append(l?A.empty:A.from(i.copy(A.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function zD(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,u=>u.childCount>0&&u.firstChild.type==t);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let a=o.parent,l=a.child(s-1);if(l.type!=t)return!1;if(n){let u=l.lastChild&&l.lastChild.type==a.type,c=A.from(u?t.create():null),d=new V(A.from(t.create(null,A.from(a.type.create(null,c)))),u?3:1,0),h=o.start,p=o.end;n(e.tr.step(new qe(h-(u?3:1),p,h,p,d,1,!0)).scrollIntoView())}return!0}}function Su(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}class Tu{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:o}=r,s=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...u)=>{const c=l(...u)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,a=[],l=!!e,u=e||o.tr,c=()=>(!l&&n&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(u),a.every(h=>h===!0)),d={...Object.fromEntries(Object.entries(r).map(([h,p])=>[h,(...f)=>{const m=this.buildProps(u,n),g=p(...f)(m);return a.push(g),d}])),run:c};return d}createCan(e){const{rawCommands:n,state:r}=this,i=!1,o=e||r.tr,s=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...u)=>l(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,a={tr:e,editor:i,view:s,state:Su({state:o,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,u])=>[l,(...c)=>u(...c)(a)]))}};return a}}class HD{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}once(e,n){const r=(...i)=>{this.off(e,r),n.apply(this,i)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function j(t,e,n){return t.config[e]===void 0&&t.parent?j(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?j(t.parent,e,n):null}):t.config[e]}function Ou(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function p0(t){const e=[],{nodeExtensions:n,markExtensions:r}=Ou(t),i=[...n,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage,extensions:i},l=j(s,"addGlobalAttributes",a);l&&l().forEach(u=>{u.types.forEach(c=>{Object.entries(u.attributes).forEach(([d,h])=>{e.push({type:c,name:d,attribute:{...o,...h}})})})})}),i.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},l=j(s,"addAttributes",a);if(!l)return;const u=l();Object.entries(u).forEach(([c,d])=>{const h={...o,...d};typeof h?.default=="function"&&(h.default=h.default()),h!=null&&h.isRequired&&h?.default===void 0&&delete h.default,e.push({type:s.name,name:c,attribute:h})})}),e}function Ue(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function et(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const s=o?String(o).split(" "):[],a=r[i]?r[i].split(" "):[],l=s.filter(u=>!a.includes(u));r[i]=[...a,...l].join(" ")}else if(i==="style"){const s=o?o.split(";").map(u=>u.trim()).filter(Boolean):[],a=r[i]?r[i].split(";").map(u=>u.trim()).filter(Boolean):[],l=new Map;a.forEach(u=>{const[c,d]=u.split(":").map(h=>h.trim());l.set(c,d)}),s.forEach(u=>{const[c,d]=u.split(":").map(h=>h.trim());l.set(c,d)}),r[i]=Array.from(l.entries()).map(([u,c])=>`${u}: ${c}`).join("; ")}else r[i]=o}),r},{})}function Dd(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>et(n,r),{})}function h0(t){return typeof t=="function"}function pe(t,e=void 0,...n){return h0(t)?e?t.bind(e)(...n):t(...n):t}function qD(t={}){return Object.keys(t).length===0&&t.constructor===Object}function WD(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Um(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((o,s)=>{const a=s.attribute.parseHTML?s.attribute.parseHTML(n):WD(n.getAttribute(s.name));return a==null?o:{...o,[s.name]:a}},{});return{...r,...i}}}}function Km(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&qD(n)?!1:n!=null))}function UD(t,e){var n;const r=p0(t),{nodeExtensions:i,markExtensions:o}=Ou(t),s=(n=i.find(u=>j(u,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(u=>{const c=r.filter(y=>y.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},h=t.reduce((y,b)=>{const k=j(b,"extendNodeSchema",d);return{...y,...k?k(u):{}}},{}),p=Km({...h,content:pe(j(u,"content",d)),marks:pe(j(u,"marks",d)),group:pe(j(u,"group",d)),inline:pe(j(u,"inline",d)),atom:pe(j(u,"atom",d)),selectable:pe(j(u,"selectable",d)),draggable:pe(j(u,"draggable",d)),code:pe(j(u,"code",d)),whitespace:pe(j(u,"whitespace",d)),linebreakReplacement:pe(j(u,"linebreakReplacement",d)),defining:pe(j(u,"defining",d)),isolating:pe(j(u,"isolating",d)),attrs:Object.fromEntries(c.map(y=>{var b;return[y.name,{default:(b=y?.attribute)===null||b===void 0?void 0:b.default}]}))}),f=pe(j(u,"parseHTML",d));f&&(p.parseDOM=f.map(y=>Um(y,c)));const m=j(u,"renderHTML",d);m&&(p.toDOM=y=>m({node:y,HTMLAttributes:Dd(y,c)}));const g=j(u,"renderText",d);return g&&(p.toText=g),[u.name,p]})),l=Object.fromEntries(o.map(u=>{const c=r.filter(g=>g.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},h=t.reduce((g,y)=>{const b=j(y,"extendMarkSchema",d);return{...g,...b?b(u):{}}},{}),p=Km({...h,inclusive:pe(j(u,"inclusive",d)),excludes:pe(j(u,"excludes",d)),group:pe(j(u,"group",d)),spanning:pe(j(u,"spanning",d)),code:pe(j(u,"code",d)),attrs:Object.fromEntries(c.map(g=>{var y;return[g.name,{default:(y=g?.attribute)===null||y===void 0?void 0:y.default}]}))}),f=pe(j(u,"parseHTML",d));f&&(p.parseDOM=f.map(g=>Um(g,c)));const m=j(u,"renderHTML",d);return m&&(p.toDOM=g=>m({mark:g,HTMLAttributes:Dd(g,c)})),[u.name,p]}));return new ab({topNode:s,nodes:a,marks:l})}function wc(t,e){return e.nodes[t]||e.marks[t]||null}function Gm(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function th(t,e){const n=fi.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}const KD=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,a)=>{var l,u;const c=((u=(l=i.type.spec).toText)===null||u===void 0?void 0:u.call(l,{node:i,pos:o,parent:s,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,r-o))}),n};function nh(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Au{constructor(e){this.find=e.find,this.handler=e.handler}}const GD=(t,e)=>{if(nh(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function ca(t){var e;const{editor:n,from:r,to:i,text:o,rules:s,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const u=l.state.doc.resolve(r);if(u.parent.type.spec.code||!((e=u.nodeBefore||u.nodeAfter)===null||e===void 0)&&e.marks.find(h=>h.type.spec.code))return!1;let c=!1;const d=KD(u)+o;return s.forEach(h=>{if(c)return;const p=GD(d,h.find);if(!p)return;const f=l.state.tr,m=Su({state:l.state,transaction:f}),g={from:r-(p[0].length-o.length),to:i},{commands:y,chain:b,can:k}=new Tu({editor:n,state:m});h.handler({state:m,range:g,match:p,commands:y,chain:b,can:k})===null||!f.steps.length||(f.setMeta(a,{transform:f,from:r,to:i,text:o}),l.dispatch(f),c=!0)}),c}function JD(t){const{editor:e,rules:n}=t,r=new Ve({state:{init(){return null},apply(i,o,s){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=th(A.from(u),s.schema);const{from:c}=l,d=c+u.length;ca({editor:e,from:c,to:d,text:u,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,a){return ca({editor:e,from:o,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&ca({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?ca({editor:e,from:s.pos,to:s.pos,text:`
18
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function XD(t){return Object.prototype.toString.call(t).slice(8,-1)}function da(t){return XD(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Mu(t,e){const n={...t};return da(t)&&da(e)&&Object.keys(e).forEach(r=>{da(e[r])&&da(t[r])?n[r]=Mu(t[r],e[r]):n[r]=e[r]}),n}class zn{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=pe(j(this,"addOptions",{name:this.name}))),this.storage=pe(j(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new zn(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Mu(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new zn(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=pe(j(n,"addOptions",{name:n.name})),n.storage=pe(j(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!o.find(a=>a?.type.name===n.name))return!1;const s=o.find(a=>a?.type.name===n.name);return s&&r.removeStoredMark(s),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function YD(t){return typeof t=="number"}class ZD{constructor(e){this.find=e.find,this.handler=e.handler}}const QD=(t,e,n)=>{if(nh(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=t,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function eN(t){const{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:u,can:c}=new Tu({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,i,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;const f=Math.max(r,p),m=Math.min(i,p+h.content.size),g=h.textBetween(f-p,m-p,void 0,"");QD(g,o.find,s).forEach(y=>{if(y.index===void 0)return;const b=f+y.index+1,k=b+y[0].length,v={from:n.tr.mapping.map(b),to:n.tr.mapping.map(k)},w=o.handler({state:n,range:v,match:y,commands:l,chain:u,can:c,pasteEvent:s,dropEvent:a});d.push(w)})}),d.every(h=>h!==null)}let pa=null;const tN=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function nN(t){const{editor:e,rules:n}=t;let r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:c,to:d,rule:h,pasteEvt:p})=>{const f=u.tr,m=Su({state:u,transaction:f});if(!(!eN({editor:e,state:m,from:Math.max(c-1,0),to:d.b-1,rule:h,pasteEvent:p,dropEvent:a})||!f.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,f}};return n.map(u=>new Ve({view(c){const d=p=>{var f;r=!((f=c.dom.parentElement)===null||f===void 0)&&f.contains(p.target)?c.dom.parentElement:null,r&&(pa=e)},h=()=>{pa&&(pa=null)};return window.addEventListener("dragstart",d),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",d),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(c,d)=>{if(o=r===c.dom.parentElement,a=d,!o){const h=pa;h&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(c,d)=>{var h;const p=(h=d.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return s=d,i=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(c,d,h)=>{const p=c[0],f=p.getMeta("uiEvent")==="paste"&&!i,m=p.getMeta("uiEvent")==="drop"&&!o,g=p.getMeta("applyPasteRules"),y=!!g;if(!f&&!m&&!y)return;if(y){let{text:v}=g;typeof v=="string"?v=v:v=th(A.from(v),h.schema);const{from:w}=g,x=w+v.length,T=tN(v);return l({rule:u,state:h,from:w,to:{b:x},pasteEvt:T})}const b=d.doc.content.findDiffStart(h.doc.content),k=d.doc.content.findDiffEnd(h.doc.content);if(!(!YD(b)||!k||b===k.b))return l({rule:u,state:h,from:b,to:k,pasteEvt:s})}}))}function rN(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class Pi{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=Pi.resolve(e),this.schema=UD(this.extensions,n),this.setupExtensions()}static resolve(e){const n=Pi.sort(Pi.flatten(e)),r=rN(n.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},i=j(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((n,r)=>{const i=j(n,"priority")||100,o=j(r,"priority")||100;return i>o?-1:i<o?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:wc(n.name,this.schema)},i=j(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=Pi.sort([...this.extensions].reverse()),r=[],i=[],o=n.map(s=>{const a={name:s.name,options:s.options,storage:s.storage,editor:e,type:wc(s.name,this.schema)},l=[],u=j(s,"addKeyboardShortcuts",a);let c={};if(s.type==="mark"&&j(s,"exitable",a)&&(c.ArrowRight=()=>zn.handleExit({editor:e,mark:s})),u){const m=Object.fromEntries(Object.entries(u()).map(([g,y])=>[g,()=>y({editor:e})]));c={...c,...m}}const d=gD(c);l.push(d);const h=j(s,"addInputRules",a);Gm(s,e.options.enableInputRules)&&h&&r.push(...h());const p=j(s,"addPasteRules",a);Gm(s,e.options.enablePasteRules)&&p&&i.push(...p());const f=j(s,"addProseMirrorPlugins",a);if(f){const m=f();l.push(...m)}return l}).flat();return[JD({editor:e,rules:r}),...nN({editor:e,rules:i}),...o]}get attributes(){return p0(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=Ou(this.extensions);return Object.fromEntries(n.filter(r=>!!j(r,"addNodeView")).map(r=>{const i=this.attributes.filter(l=>l.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:Ue(r.name,this.schema)},s=j(r,"addNodeView",o);if(!s)return[];const a=(l,u,c,d,h)=>{const p=Dd(l,i);return s()({node:l,view:u,getPos:c,decorations:d,innerDecorations:h,editor:e,extension:r,HTMLAttributes:p})};return[r.name,a]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:wc(e.name,this.schema)};e.type==="mark"&&(!((n=pe(j(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=j(e,"onBeforeCreate",r),o=j(e,"onCreate",r),s=j(e,"onUpdate",r),a=j(e,"onSelectionUpdate",r),l=j(e,"onTransaction",r),u=j(e,"onFocus",r),c=j(e,"onBlur",r),d=j(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),u&&this.editor.on("focus",u),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}}class Ke{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=pe(j(this,"addOptions",{name:this.name}))),this.storage=pe(j(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ke(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Mu(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Ke({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=pe(j(n,"addOptions",{name:n.name})),n.storage=pe(j(n,"addStorage",{name:n.name,options:n.options})),n}}function f0(t,e,n){const{from:r,to:i}=e,{blockSeparator:o=`
16
+ `))),0,0):V.empty;let d=t.someProp("clipboardTextParser",h=>h(e,i,r,t));if(d)a=d;else{let h=i.marks(),{schema:p}=t.state,f=fi.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=s.appendChild(document.createElement("p"));m&&g.appendChild(f.serializeNode(p.text(m,h)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=E_(n),Ns&&C_(s);let u=s&&s.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let h=s.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;s=h}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||mr.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||c),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!k_.test(d.parentNode.nodeName)?{ignore:!0}:null}})),c)a=S_(Im(a,+c[1],+c[2]),c[4]);else if(a=V.maxOpen(w_(a.content,i),!0),a.openStart||a.openEnd){let d=0,h=0;for(let p=a.content.firstChild;d<a.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=a.content.lastChild;h<a.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);a=Im(a,d,h)}return t.someProp("transformPasted",d=>{a=d(a,t)}),a}const k_=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function w_(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(s=>{if(!o)return;let a=r.findWrapping(s.type),l;if(!a)return o=null;if(l=o.length&&i.length&&Wb(a,i,s,o[o.length-1],0))o[o.length-1]=l;else{o.length&&(o[o.length-1]=Ub(o[o.length-1],i.length));let u=qb(s,a);o.push(u),r=r.matchType(u.type),i=a}}),o)return A.from(o)}return t}function qb(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,A.from(t));return t}function Wb(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let o=Wb(t,e,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(A.from(qb(n,t,i+1))))}}function Ub(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Ub(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(A.empty,!0);return t.copy(n.append(r))}function _d(t,e,n,r,i,o){let s=e<0?t.firstChild:t.lastChild,a=s.content;return t.childCount>1&&(o=0),i<r-1&&(a=_d(a,e,n,r,i+1,o)),i>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(A.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function Im(t,e,n){return e<t.openStart&&(t=new V(_d(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new V(_d(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Kb={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Rm=null;function Gb(){return Rm||(Rm=document.implementation.createHTMLDocument("title"))}let vc=null;function x_(t){let e=window.trustedTypes;return e?(vc||(vc=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),vc.createHTML(t)):t}function E_(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Gb().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&Kb[r[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"</"+o+">").reverse().join("")),n.innerHTML=x_(t),i)for(let o=0;o<i.length;o++)n=n.querySelector(i[o])||n;return n}function C_(t){let e=t.querySelectorAll(rt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function S_(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:o,openEnd:s}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=A.from(l.create(r[a+1],i)),o++,s++}return new V(i,o,s)}const ht={},ft={},T_={touchstart:!0,touchmove:!0};class O_{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function A_(t){for(let e in ht){let n=ht[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{__(t,r)&&!Jp(t,r)&&(t.editable||!(r.type in ft))&&n(t,r)},T_[e]?{passive:!0}:void 0)}pt&&t.dom.addEventListener("input",()=>null),Dd(t)}function ur(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function M_(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Dd(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Jp(t,r))})}function Jp(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function __(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function D_(t,e){!Jp(t,e)&&ht[e.type]&&(t.editable||!(e.type in ft))&&ht[e.type](t,e)}ft.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Xb(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Pn&&rt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Qi&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,zr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||b_(t,n)?n.preventDefault():ur(t,"key")};ft.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};ft.keypress=(t,e)=>{let n=e;if(Xb(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Vt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof oe)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode);!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i))&&t.dispatch(t.state.tr.insertText(i).scrollIntoView()),n.preventDefault()}};function Su(t){return{left:t.clientX,top:t.clientY}}function N_(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Xp(t,e,n,r,i){if(r==-1)return!1;let o=t.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(t.someProp(e,a=>s>o.depth?a(t,n,o.nodeAfter,o.before(s),i,!0):a(t,n,o.node(s),o.before(s),i,!1)))return!0;return!1}function zi(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function I_(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Y.isSelectable(r)?(zi(t,new Y(n)),!0):!1}function R_(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Y&&(r=n.node);let o=t.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let a=s>o.depth?o.nodeAfter:o.node(s);if(Y.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(s);break}}return i!=null?(zi(t,Y.create(t.state.doc,i)),!0):!1}function P_(t,e,n,r,i){return Xp(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?R_(t,n):I_(t,n))}function F_(t,e,n,r){return Xp(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function L_(t,e,n,r){return Xp(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||V_(t,n,r)}function V_(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(zi(t,oe.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),a=i.before(o);if(s.inlineContent)zi(t,oe.create(r,a+1,a+1+s.content.size));else if(Y.isSelectable(s))zi(t,Y.create(r,a));else continue;return!0}}function Yp(t){return pl(t)}const Jb=Vt?"metaKey":"ctrlKey";ht.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Yp(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&N_(n,t.input.lastClick)&&!n[Jb]&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o};let s=t.posAtCoords(Su(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new B_(t,s,n,!!r)):(o=="doubleClick"?F_:L_)(t,s.pos,s.inside,n)?n.preventDefault():ur(t,"pointer"))};class B_{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Jb],this.allowDefault=r.shiftKey;let o,s;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else{let c=e.state.doc.resolve(n.pos);o=c.parent,s=c.depth?c.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:u}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||u instanceof Y&&u.from<=s&&u.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&nn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),ur(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Bn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Su(e))),this.updateAllowDefault(e),this.allowDefault||!n?ur(this.view,"pointer"):P_(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||pt&&this.mightDrag&&!this.mightDrag.node.isAtom||rt&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(zi(this.view,le.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):ur(this.view,"pointer")}move(e){this.updateAllowDefault(e),ur(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}ht.touchstart=t=>{t.input.lastTouch=Date.now(),Yp(t),ur(t,"pointer")};ht.touchmove=t=>{t.input.lastTouch=Date.now(),ur(t,"pointer")};ht.contextmenu=t=>Yp(t);function Xb(t,e){return t.composing?!0:pt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const $_=Pn?5e3:-1;ft.compositionstart=ft.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof oe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),pl(t,!0),t.markCursor=null;else if(pl(t,!e.selection.empty),nn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let a=t.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}t.input.composing=!0}Yb(t,$_)};ft.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Yb(t,20))};function Yb(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>pl(t),e))}function Zb(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=z_());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function j_(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=IM(e.focusNode,e.focusOffset),r=RM(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function z_(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function pl(t,e=!1){if(!(Pn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Zb(t),e||t.docView&&t.docView.dirty){let n=Up(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!t.state.selection.empty?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function H_(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const ms=bt&&gr<15||Qi&&BM<604;ht.copy=ft.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=ms?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Gp(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):H_(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function q_(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function W_(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?gs(t,r.value,null,i,e):gs(t,r.textContent,r.innerHTML,i,e)},50)}function gs(t,e,n,r,i){let o=Hb(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,o||V.empty)))return!0;if(!o)return!1;let s=q_(o),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Qb(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}ft.paste=(t,e)=>{let n=e;if(t.composing&&!Pn)return;let r=ms?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&gs(t,Qb(r),r.getData("text/html"),i,n)?n.preventDefault():W_(t,n)};class e0{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const t0=Vt?"altKey":"ctrlKey";ht.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,o=i.empty?null:t.posAtCoords(Su(n)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof Y?i.to-1:i.to))){if(r&&r.mightDrag)s=Y.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=Y.create(t.state.doc,d.posBefore))}}let a=(s||t.state.selection).content(),{dom:l,text:u,slice:c}=Gp(t,a);(!n.dataTransfer.files.length||!rt||Ob>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ms?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ms||n.dataTransfer.setData("text/plain",u),t.dragging=new e0(c,!n[t0],s)};ht.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};ft.dragover=ft.dragenter=(t,e)=>e.preventDefault();ft.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(Su(n));if(!i)return;let o=t.state.doc.resolve(i.pos),s=r&&r.slice;s?t.someProp("transformPasted",f=>{s=f(s,t)}):s=Hb(t,Qb(n.dataTransfer),ms?null:n.dataTransfer.getData("text/html"),!1,o);let a=!!(r&&!n[t0]);if(t.someProp("handleDrop",f=>f(t,n,s||V.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?yb(t.state.doc,o.pos,s):o.pos;l==null&&(l=o.pos);let u=t.state.tr;if(a){let{node:f}=r;f?f.replace(u):u.deleteSelection()}let c=u.mapping.map(l),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,h=u.doc;if(d?u.replaceRangeWith(c,c,s.content.firstChild):u.replaceRange(c,c,s),u.doc.eq(h))return;let p=u.doc.resolve(c);if(d&&Y.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new Y(p));else{let f=u.mapping.map(l);u.mapping.maps[u.mapping.maps.length-1].forEach((m,g,y,b)=>f=b),u.setSelection(Kp(t,p,u.doc.resolve(f)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))};ht.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Bn(t)},20))};ht.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};ht.beforeinput=(t,e)=>{if(rt&&Pn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:n}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=n||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,zr(8,"Backspace")))))return;let{$cursor:r}=t.state.selection;r&&r.pos>0&&t.dispatch(t.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let t in ft)ht[t]=ft[t];function vs(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class hl{constructor(e,n){this.toDOM=e,this.spec=n||Yr,this.side=this.spec.side||0}map(e,n,r,i){let{pos:o,deleted:s}=e.mapResult(n.from+i,this.side<0?-1:1);return s?null:new Mt(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof hl&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&vs(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class yr{constructor(e,n){this.attrs=e,this.spec=n||Yr}map(e,n,r,i){let o=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new Mt(o,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof yr&&vs(this.attrs,e.attrs)&&vs(this.spec,e.spec)}static is(e){return e.type instanceof yr}destroy(){}}class Zp{constructor(e,n){this.attrs=e,this.spec=n||Yr}map(e,n,r,i){let o=e.mapResult(n.from+i,1);if(o.deleted)return null;let s=e.mapResult(n.to+i,-1);return s.deleted||s.pos<=o.pos?null:new Mt(o.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),o;return i==n.from&&!(o=e.child(r)).isText&&i+o.nodeSize==n.to}eq(e){return this==e||e instanceof Zp&&vs(this.attrs,e.attrs)&&vs(this.spec,e.spec)}destroy(){}}class Mt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Mt(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Mt(e,e,new hl(n,r))}static inline(e,n,r,i){return new Mt(e,n,new yr(r,i))}static node(e,n,r,i){return new Mt(e,n,new Zp(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof yr}get widget(){return this.type instanceof hl}}const Ai=[],Yr={};class Pe{constructor(e,n){this.local=e.length?e:Ai,this.children=n.length?n:Ai}static create(e,n){return n.length?fl(n,e,0,Yr):nt}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,o){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=e&&(!o||o(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,r,i+a,o)}}map(e,n,r){return this==nt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Yr)}mapInner(e,n,r,i,o){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(n,l)?(s||(s=[])).push(l):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?U_(this.children,s||[],e,n,r,i,o):s?new Pe(s.sort(Zr),Ai):nt}add(e,n){return n.length?this==nt?Pe.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,o=0;e.forEach((a,l)=>{let u=l+r,c;if(c=r0(n,a,u)){for(i||(i=this.children.slice());o<i.length&&i[o]<l;)o+=3;i[o]==l?i[o+2]=i[o+2].addInner(a,c,u+1):i.splice(o,0,l,l+a.nodeSize,fl(c,a,u+1,Yr)),o+=3}});let s=n0(o?i0(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new Pe(s.length?this.local.concat(s).sort(Zr):this.local,i||this.children)}remove(e){return e.length==0||this==nt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,a=r[o]+n,l=r[o+1]+n;for(let c=0,d;c<e.length;c++)(d=e[c])&&d.from>a&&d.to<l&&(e[c]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let u=r[o+2].removeInner(s,a+1);u!=nt?r[o+2]=u:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let a=0;a<i.length;a++)i[a].eq(s,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Pe(i,r):nt}forChild(e,n){if(this==nt)return this;if(n.isLeaf)return Pe.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let o=e+1,s=o+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>o&&l.type instanceof yr){let u=Math.max(o,l.from)-o,c=Math.min(s,l.to)-o;u<c&&(i||(i=[])).push(l.copy(u,c))}}if(i){let a=new Pe(i.sort(Zr),Ai);return r?new ir([a,r]):a}return r||nt}eq(e){if(this==e)return!0;if(!(e instanceof Pe)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Qp(this.localsInner(e))}localsInner(e){if(this==nt)return Ai;if(e.inlineContent||!this.local.some(yr.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof yr||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Pe.empty=new Pe([],[]);Pe.removeOverlap=Qp;const nt=Pe.empty;class ir{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Yr));return ir.from(r)}forChild(e,n){if(n.isLeaf)return Pe.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,n);o!=nt&&(o instanceof ir?r=r.concat(o.members):r.push(o))}return ir.from(r)}eq(e){if(!(e instanceof ir)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!n)n=o;else{r&&(n=n.slice(),r=!1);for(let s=0;s<o.length;s++)n.push(o[s])}}return n?Qp(r?n:n.sort(Zr)):Ai}static from(e){switch(e.length){case 0:return nt;case 1:return e[0];default:return new ir(e.every(n=>n instanceof Pe)?e:e.reduce((n,r)=>n.concat(r instanceof Pe?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function U_(t,e,n,r,i,o,s){let a=t.slice();for(let u=0,c=o;u<n.maps.length;u++){let d=0;n.maps[u].forEach((h,p,f,m)=>{let g=m-f-(p-h);for(let y=0;y<a.length;y+=3){let b=a[y+1];if(b<0||h>b+c-d)continue;let k=a[y]+c-d;p>=k?a[y+1]=h<=k?-2:-1:h>=c&&g&&(a[y]+=g,a[y+1]+=g)}d+=g}),c=n.maps[u].map(c,-1)}let l=!1;for(let u=0;u<a.length;u+=3)if(a[u+1]<0){if(a[u+1]==-2){l=!0,a[u+1]=-1;continue}let c=n.map(t[u]+o),d=c-i;if(d<0||d>=r.content.size){l=!0;continue}let h=n.map(t[u+1]+o,-1),p=h-i,{index:f,offset:m}=r.content.findIndex(d),g=r.maybeChild(f);if(g&&m==d&&m+g.nodeSize==p){let y=a[u+2].mapInner(n,g,c+1,t[u]+o+1,s);y!=nt?(a[u]=d,a[u+1]=p,a[u+2]=y):(a[u+1]=-2,l=!0)}else l=!0}if(l){let u=K_(a,t,e,n,i,o,s),c=fl(u,r,0,s);e=c.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,h=0;d<c.children.length;d+=3){let p=c.children[d];for(;h<a.length&&a[h]<p;)h+=3;a.splice(h,0,c.children[d],c.children[d+1],c.children[d+2])}}return new Pe(e.sort(Zr),a)}function n0(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new Mt(i.from+e,i.to+e,i.type))}return n}function K_(t,e,n,r,i,o,s){function a(l,u){for(let c=0;c<l.local.length;c++){let d=l.local[c].map(r,i,u);d?n.push(d):s.onRemove&&s.onRemove(l.local[c].spec)}for(let c=0;c<l.children.length;c+=3)a(l.children[c+2],l.children[c]+u+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+o+1);return n}function r0(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let o=0,s;o<t.length;o++)(s=t[o])&&s.from>n&&s.to<r&&((i||(i=[])).push(s),t[o]=null);return i}function i0(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function fl(t,e,n,r){let i=[],o=!1;e.forEach((a,l)=>{let u=r0(t,a,l+n);if(u){o=!0;let c=fl(u,a,n+l+1,r);c!=nt&&i.push(l,l+a.nodeSize,c)}});let s=n0(o?i0(t):t,-n).sort(Zr);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||i.length?new Pe(s,i):nt}function Zr(t,e){return t.from-e.from||t.to-e.to}function Qp(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==t&&(e=t.slice()),e[i]=o.copy(o.from,r.to),Pm(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,o.from),Pm(e,i,r.copy(o.from,r.to)));break}}}return e}function Pm(t,e,n){for(;e<t.length&&Zr(n,t[e])>0;)e++;t.splice(e,0,n)}function yc(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=nt&&e.push(r)}),t.cursorWrapper&&e.push(Pe.create(t.state.doc,[t.cursorWrapper.deco])),ir.from(e)}const G_={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},J_=bt&&gr<=11;class X_{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Y_{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new X_,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);bt&&gr<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),J_&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,G_)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Om(this.view)){if(this.suppressingSelectionUpdates)return Bn(this.view);if(bt&&gr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&si(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let o=e.focusNode;o;o=fs(o))n.add(o);for(let o=e.anchorNode;o;o=fs(o))if(n.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Om(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(e.editable)for(let c=0;c<n.length;c++){let d=this.registerMutation(n[c],l);d&&(o=o<0?d.from:Math.min(d.from,o),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(a=!0))}if(nn&&l.length){let c=l.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,h]=c;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of c){let p=h.parentNode;p&&p.nodeName=="LI"&&(!d||eD(e,d)!=p)&&h.remove()}}}let u=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Eu(r)&&(u=Up(e))&&u.eq(le.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Bn(e),this.currentSelection.set(r)):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),Z_(e)),this.handleDOMChange(o,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Bn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;c<e.addedNodes.length;c++){let d=e.addedNodes[c];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(bt&&gr<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:d,nextSibling:h}=e.addedNodes[c];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(o=h)}let s=i&&i.parentNode==e.target?Xe(i)+1:0,a=r.localPosFromDOM(e.target,s,-1),l=o&&o.parentNode==e.target?Xe(o):e.target.childNodes.length,u=r.localPosFromDOM(e.target,l,1);return{from:a,to:u}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Fm=new WeakMap,Lm=!1;function Z_(t){if(!Fm.has(t)&&(Fm.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=nn,Lm)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Lm=!0}}function Vm(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return si(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function Q_(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Vm(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Vm(t,n):null}function eD(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function tD(t,e,n){let{node:r,fromOffset:i,toOffset:o,from:s,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),u,c=l.anchorNode;if(c&&t.dom.contains(c.nodeType==1?c:c.parentNode)&&(u=[{node:c,offset:l.anchorOffset}],Eu(l)||u.push({node:l.focusNode,offset:l.focusOffset})),rt&&t.input.lastKeyCode===8)for(let g=o;g>i;g--){let y=r.childNodes[g-1],b=y.pmViewDesc;if(y.nodeName=="BR"&&!b){o=g;break}if(!b||b.size)break}let d=t.state.doc,h=t.someProp("domParser")||mr.fromSchema(t.state.schema),p=d.resolve(s),f=null,m=h.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:nD,context:p});if(u&&u[0].pos!=null){let g=u[0].pos,y=u[1]&&u[1].pos;y==null&&(y=g),f={anchor:g+s,head:y+s}}return{doc:m,sel:f,from:s,to:a}}function nD(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(pt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||pt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const rD=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function iD(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let N=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,C=Up(t,N);if(C&&!t.state.selection.eq(C)){if(rt&&Pn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",L=>L(t,zr(13,"Enter"))))return;let _=t.state.tr.setSelection(C);N=="pointer"?_.setMeta("pointer",!0):N=="key"&&_.scrollIntoView(),o&&_.setMeta("composition",o),t.dispatch(_)}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,u=tD(t,e,n),c=t.state.doc,d=c.slice(u.from,u.to),h,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,p="end"):(h=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let f=aD(d.content,u.doc.content,u.from,h,p);if(f&&t.input.domChangeCount++,(Qi&&t.input.lastIOSEnter>Date.now()-225||Pn)&&i.some(N=>N.nodeType==1&&!rD.test(N.nodeName))&&(!f||f.endA>=f.endB)&&t.someProp("handleKeyDown",N=>N(t,zr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!f)if(r&&l instanceof oe&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))f={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let N=Bm(t,t.state.doc,u.sel);if(N&&!N.eq(t.state.selection)){let C=t.state.tr.setSelection(N);o&&C.setMeta("composition",o),t.dispatch(C)}}return}t.state.selection.from<t.state.selection.to&&f.start==f.endB&&t.state.selection instanceof oe&&(f.start>t.state.selection.from&&f.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?f.start=t.state.selection.from:f.endA<t.state.selection.to&&f.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(f.endB+=t.state.selection.to-f.endA,f.endA=t.state.selection.to)),bt&&gr<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>u.from&&u.doc.textBetween(f.start-u.from-1,f.start-u.from+1)=="  "&&(f.start--,f.endA--,f.endB--);let m=u.doc.resolveNoCache(f.start-u.from),g=u.doc.resolveNoCache(f.endB-u.from),y=c.resolve(f.start),b=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=f.endA,k;if((Qi&&t.input.lastIOSEnter>Date.now()-225&&(!b||i.some(N=>N.nodeName=="DIV"||N.nodeName=="P"))||!b&&m.pos<u.doc.content.size&&!m.sameParent(g)&&(k=le.findFrom(u.doc.resolve(m.pos+1),1,!0))&&k.head==g.pos)&&t.someProp("handleKeyDown",N=>N(t,zr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>f.start&&sD(c,f.start,f.endA,m,g)&&t.someProp("handleKeyDown",N=>N(t,zr(8,"Backspace")))){Pn&&rt&&t.domObserver.suppressSelectionUpdates();return}rt&&f.endB==f.start&&(t.input.lastChromeDelete=Date.now()),Pn&&!b&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==f.endA&&(f.endB-=2,g=u.doc.resolveNoCache(f.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(N){return N(t,zr(13,"Enter"))})},20));let v=f.start,w=f.endA,x,T,F;if(b){if(m.pos==g.pos)bt&&gr<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Bn(t),20)),x=t.state.tr.delete(v,w),T=c.resolve(f.start).marksAcross(c.resolve(f.endA));else if(f.endA==f.endB&&(F=oD(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,f.endA-y.start()))))x=t.state.tr,F.type=="add"?x.addMark(v,w,F.mark):x.removeMark(v,w,F.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let N=m.parent.textBetween(m.parentOffset,g.parentOffset);if(t.someProp("handleTextInput",C=>C(t,v,w,N)))return;x=t.state.tr.insertText(N,v,w)}}if(x||(x=t.state.tr.replace(v,w,u.doc.slice(f.start-u.from,f.endB-u.from))),u.sel){let N=Bm(t,x.doc,u.sel);N&&!(rt&&t.composing&&N.empty&&(f.start!=f.endB||t.input.lastChromeDelete<Date.now()-100)&&(N.head==v||N.head==x.mapping.map(w)-1)||bt&&N.empty&&N.head==v)&&x.setSelection(N)}T&&x.ensureMarks(T),o&&x.setMeta("composition",o),t.dispatch(x.scrollIntoView())}function Bm(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Kp(t,e.resolve(n.anchor),e.resolve(n.head))}function oD(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,o=r,s,a,l;for(let c=0;c<r.length;c++)i=r[c].removeFromSet(i);for(let c=0;c<n.length;c++)o=n[c].removeFromSet(o);if(i.length==1&&o.length==0)a=i[0],s="add",l=c=>c.mark(a.addToSet(c.marks));else if(i.length==0&&o.length==1)a=o[0],s="remove",l=c=>c.mark(a.removeFromSet(c.marks));else return null;let u=[];for(let c=0;c<e.childCount;c++)u.push(l(e.child(c)));if(A.from(u).eq(t))return{mark:a,type:s}}function sD(t,e,n,r,i){if(n-e<=i.pos-r.pos||bc(r,!0,!1)<i.pos)return!1;let o=t.resolve(e);if(!r.parent.isTextblock){let a=o.nodeAfter;return a!=null&&n==e+a.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=t.resolve(bc(o,!0,!0));return!s.parent.isTextblock||s.pos>n||bc(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function bc(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let o=t.node(r).maybeChild(t.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function aD(t,e,n,r,i){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,o-Math.min(s,a));r-=s+l-o}if(s<o&&t.size<e.size){let l=r<=o&&r>=s?o-r:0;o-=l,o&&o<e.size&&$m(e.textBetween(o-1,o+1))&&(o+=l?1:-1),a=o+(a-s),s=o}else if(a<o){let l=r<=o&&r>=a?o-r:0;o-=l,o&&o<t.size&&$m(t.textBetween(o-1,o+1))&&(o+=l?1:-1),s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}function $m(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class lD{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new O_,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Wm),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Hm(this),zm(this),this.nodeViews=qm(this),this.docView=wm(this.state.doc,jm(this),yc(this),this.dom,this),this.domObserver=new Y_(this,(r,i,o,s)=>iD(this,r,i,o,s)),this.domObserver.start(),A_(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Dd(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Wm),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(Zb(this),s=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=qm(this);cD(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Dd(this),this.editable=Hm(this),zm(this);let l=yc(this),u=jm(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=o||!this.docView.matchesNode(e.doc,u,l);(d||!e.selection.eq(i.selection))&&(s=!0);let h=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&zM(this);if(s){this.domObserver.stop();let p=d&&(bt||rt)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&uD(i.selection,e.selection);if(d){let f=rt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=j_(this)),(o||!this.docView.update(e.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=wm(e.doc,u,l,this.dom,this)),f&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&p_(this))?Bn(this,p):($b(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():h&&HM(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Y){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&mm(this,n.getBoundingClientRect(),e)}else mm(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-n.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new e0(e.slice,e.move,i<0?void 0:Y.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(i=n?n(a):a))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let a=o[s].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(bt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&qM(this.dom),Bn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return JM(this,e)}coordsAtPos(e,n=1){return Nb(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return e_(this,n||this.state,e)}pasteHTML(e,n){return gs(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return gs(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Gp(this,e)}destroy(){this.docView&&(M_(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],yc(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,DM())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return D_(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?pt&&this.root.nodeType===11&&FM(this.dom.ownerDocument)==this.dom&&Q_(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function jm(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Mt.node(0,t.state.doc.content.size,e)]}function zm(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Mt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Hm(t){return!t.someProp("editable",e=>e(t.state)===!1)}function uD(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function qm(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function cD(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function Wm(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Er={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ml={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},dD=typeof navigator<"u"&&/Mac/.test(navigator.platform),pD=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ye=0;Ye<10;Ye++)Er[48+Ye]=Er[96+Ye]=String(Ye);for(var Ye=1;Ye<=24;Ye++)Er[Ye+111]="F"+Ye;for(var Ye=65;Ye<=90;Ye++)Er[Ye]=String.fromCharCode(Ye+32),ml[Ye]=String.fromCharCode(Ye);for(var kc in Er)ml.hasOwnProperty(kc)||(ml[kc]=Er[kc]);function hD(t){var e=dD&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||pD&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?ml:Er)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const fD=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function mD(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))fD?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),s&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function gD(t){let e=Object.create(null);for(let n in t)e[mD(n)]=t[n];return e}function wc(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function vD(t){return new Ve({props:{handleKeyDown:o0(t)}})}function o0(t){let e=gD(t);return function(n,r){let i=hD(r),o,s=e[wc(i,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[wc(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(o=Er[r.keyCode])&&o!=i){let a=e[wc(o,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}const yD=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function s0(t,e){let{$cursor:n}=t.selection;return!n||n.parentOffset>0?null:n}const bD=(t,e,n)=>{let r=s0(t);if(!r)return!1;let i=eh(r);if(!i){let s=r.blockRange(),a=s&&uo(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(c0(t,i,e,-1))return!0;if(r.parent.content.size==0&&(eo(o,"end")||Y.isSelectable(o)))for(let s=r.depth;;s--){let a=wu(t.doc,r.before(s),r.after(s),V.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(eo(o,"end")?le.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):Y.create(l.doc,i.pos-o.nodeSize)),e(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},kD=(t,e,n)=>{let r=s0(t);if(!r)return!1;let i=eh(r);return i?a0(t,i,e):!1},wD=(t,e,n)=>{let r=l0(t);if(!r)return!1;let i=th(r);return i?a0(t,i,e):!1};function a0(t,e,n){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let c=i.lastChild;if(!c)return!1;i=c}let s=e.nodeAfter,a=s,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let c=a.firstChild;if(!c)return!1;a=c}let u=wu(t.doc,o,l,V.empty);if(!u||u.from!=o||u instanceof je&&u.slice.size>=l-o)return!1;if(n){let c=t.tr.step(u);c.setSelection(oe.create(c.doc,o)),n(c.scrollIntoView())}return!0}function eo(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const xD=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(r.parentOffset>0)return!1;o=eh(r)}let s=o&&o.nodeBefore;return!s||!Y.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Y.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function eh(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function l0(t,e){let{$cursor:n}=t.selection;return!n||n.parentOffset<n.parent.content.size?null:n}const ED=(t,e,n)=>{let r=l0(t);if(!r)return!1;let i=th(r);if(!i)return!1;let o=i.nodeAfter;if(c0(t,i,e,1))return!0;if(r.parent.content.size==0&&(eo(o,"start")||Y.isSelectable(o))){let s=wu(t.doc,r.before(),r.after(),V.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(eo(o,"start")?le.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):Y.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},CD=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(r.parentOffset<r.parent.content.size)return!1;o=th(r)}let s=o&&o.nodeAfter;return!s||!Y.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Y.create(t.doc,o.pos)).scrollIntoView()),!0)};function th(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const SD=(t,e)=>{let n=t.selection,r=n instanceof Y,i;if(r){if(n.node.isTextblock||!Sr(t.doc,n.from))return!1;i=n.from}else if(i=ku(t.doc,n.from,-1),i==null)return!1;if(e){let o=t.tr.join(i);r&&o.setSelection(Y.create(o.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},TD=(t,e)=>{let n=t.selection,r;if(n instanceof Y){if(n.node.isTextblock||!Sr(t.doc,n.to))return!1;r=n.to}else if(r=ku(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},OD=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&uo(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},AD=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
17
+ `).scrollIntoView()),!0)};function u0(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const MD=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=u0(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,s.createAndFill());l.setSelection(le.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},_D=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof jt||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=u0(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(s,o.createAndFill());a.setSelection(oe.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},DD=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if($i(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&uo(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},ND=(t,e)=>{let{$from:n,to:r}=t.selection,i,o=n.sharedDepth(r);return o==0?!1:(i=n.before(o),e&&e(t.tr.setSelection(Y.create(t.doc,i))),!0)};function ID(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||Sr(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function c0(t,e,n,r){let i=e.nodeBefore,o=e.nodeAfter,s,a,l=i.type.spec.isolating||o.type.spec.isolating;if(!l&&ID(t,e,n))return!0;let u=!l&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(s=(a=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&a.matchType(s[0]||o.type).validEnd){if(n){let p=e.pos+o.nodeSize,f=A.empty;for(let y=s.length-1;y>=0;y--)f=A.from(s[y].create(null,f));f=A.from(i.copy(f));let m=t.tr.step(new qe(e.pos-1,p,e.pos,p,new V(f,1,0),s.length,!0)),g=m.doc.resolve(p+2*s.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Sr(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let c=o.type.spec.isolating||r>0&&l?null:le.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),h=d&&uo(d);if(h!=null&&h>=e.depth)return n&&n(t.tr.lift(d,h).scrollIntoView()),!0;if(u&&eo(o,"start",!0)&&eo(i,"end")){let p=i,f=[];for(;f.push(p),!p.isTextblock;)p=p.lastChild;let m=o,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(n){let y=A.empty;for(let k=f.length-1;k>=0;k--)y=A.from(f[k].copy(y));let b=t.tr.step(new qe(e.pos-f.length,e.pos+o.nodeSize,e.pos+g,e.pos+o.nodeSize-g,new V(y,f.length,0),0,!0));n(b.scrollIntoView())}return!0}}return!1}function d0(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(e.tr.setSelection(oe.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}const RD=d0(-1),PD=d0(1);function FD(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&Hp(s,t,e);return a?(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function Um(t,e=null){return function(n,r){let i=!1;for(let o=0;o<n.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:a}}=n.selection.ranges[o];n.doc.nodesBetween(s,a,(l,u)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let c=n.doc.resolve(u),d=c.index();i=c.parent.canReplaceWith(d,d+1,t)}})}if(!i)return!1;if(r){let o=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[s];o.setBlockType(a,l,t,e)}r(o.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function LD(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o);if(!s)return!1;let a=r?n.tr:null;return VD(a,s,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function VD(t,e,n,r=null){let i=!1,o=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=s.resolve(e.start-2);o=new ll(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new ll(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=Hp(o,n,r,e);return a?(t&&BD(t,e,a,i,n),!0):!1}function BD(t,e,n,r,i){let o=A.empty;for(let c=n.length-1;c>=0;c--)o=A.from(n[c].type.create(n[c].attrs,o));t.step(new qe(e.start-(r?2:0),e.end,e.start,e.end,new V(o,0,0),n.length,!0));let s=0;for(let c=0;c<n.length;c++)n[c].type==i&&(s=c+1);let a=n.length-s,l=e.start+n.length-(r?2:0),u=e.parent;for(let c=e.startIndex,d=e.endIndex,h=!0;c<d;c++,h=!1)!h&&$i(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=u.child(c).nodeSize;return t}function $D(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==t);return o?n?r.node(o.depth-1).type==t?jD(e,n,t,o):zD(e,n,o):!0:!1}}function jD(t,e,n,r){let i=t.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new qe(o-1,s,o,s,new V(A.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ll(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const a=uo(r);if(a==null)return!1;i.lift(r,a);let l=i.mapping.map(o,-1)-1;return Sr(i.doc,l)&&i.join(l),e(i.scrollIntoView()),!0}function zD(t,e,n){let r=t.tr,i=n.parent;for(let p=n.end,f=n.endIndex-1,m=n.startIndex;f>m;f--)p-=i.child(f).nodeSize,r.delete(p-1,p+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==i.childCount,u=o.node(-1),c=o.index(-1);if(!u.canReplace(c+(a?0:1),c+1,s.content.append(l?A.empty:A.from(i))))return!1;let d=o.pos,h=d+s.nodeSize;return r.step(new qe(d-(a?1:0),h+(l?1:0),d+1,h-1,new V((a?A.empty:A.from(i.copy(A.empty))).append(l?A.empty:A.from(i.copy(A.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function HD(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,u=>u.childCount>0&&u.firstChild.type==t);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let a=o.parent,l=a.child(s-1);if(l.type!=t)return!1;if(n){let u=l.lastChild&&l.lastChild.type==a.type,c=A.from(u?t.create():null),d=new V(A.from(t.create(null,A.from(a.type.create(null,c)))),u?3:1,0),h=o.start,p=o.end;n(e.tr.step(new qe(h-(u?3:1),p,h,p,d,1,!0)).scrollIntoView())}return!0}}function Tu(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}class Ou{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:o}=r,s=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...u)=>{const c=l(...u)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,a=[],l=!!e,u=e||o.tr,c=()=>(!l&&n&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(u),a.every(h=>h===!0)),d={...Object.fromEntries(Object.entries(r).map(([h,p])=>[h,(...f)=>{const m=this.buildProps(u,n),g=p(...f)(m);return a.push(g),d}])),run:c};return d}createCan(e){const{rawCommands:n,state:r}=this,i=!1,o=e||r.tr,s=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...u)=>l(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,a={tr:e,editor:i,view:s,state:Tu({state:o,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,u])=>[l,(...c)=>u(...c)(a)]))}};return a}}class qD{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}once(e,n){const r=(...i)=>{this.off(e,r),n.apply(this,i)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function j(t,e,n){return t.config[e]===void 0&&t.parent?j(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?j(t.parent,e,n):null}):t.config[e]}function Au(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function p0(t){const e=[],{nodeExtensions:n,markExtensions:r}=Au(t),i=[...n,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage,extensions:i},l=j(s,"addGlobalAttributes",a);l&&l().forEach(u=>{u.types.forEach(c=>{Object.entries(u.attributes).forEach(([d,h])=>{e.push({type:c,name:d,attribute:{...o,...h}})})})})}),i.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},l=j(s,"addAttributes",a);if(!l)return;const u=l();Object.entries(u).forEach(([c,d])=>{const h={...o,...d};typeof h?.default=="function"&&(h.default=h.default()),h!=null&&h.isRequired&&h?.default===void 0&&delete h.default,e.push({type:s.name,name:c,attribute:h})})}),e}function Ue(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function et(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const s=o?String(o).split(" "):[],a=r[i]?r[i].split(" "):[],l=s.filter(u=>!a.includes(u));r[i]=[...a,...l].join(" ")}else if(i==="style"){const s=o?o.split(";").map(u=>u.trim()).filter(Boolean):[],a=r[i]?r[i].split(";").map(u=>u.trim()).filter(Boolean):[],l=new Map;a.forEach(u=>{const[c,d]=u.split(":").map(h=>h.trim());l.set(c,d)}),s.forEach(u=>{const[c,d]=u.split(":").map(h=>h.trim());l.set(c,d)}),r[i]=Array.from(l.entries()).map(([u,c])=>`${u}: ${c}`).join("; ")}else r[i]=o}),r},{})}function Nd(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>et(n,r),{})}function h0(t){return typeof t=="function"}function pe(t,e=void 0,...n){return h0(t)?e?t.bind(e)(...n):t(...n):t}function WD(t={}){return Object.keys(t).length===0&&t.constructor===Object}function UD(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Km(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((o,s)=>{const a=s.attribute.parseHTML?s.attribute.parseHTML(n):UD(n.getAttribute(s.name));return a==null?o:{...o,[s.name]:a}},{});return{...r,...i}}}}function Gm(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&WD(n)?!1:n!=null))}function KD(t,e){var n;const r=p0(t),{nodeExtensions:i,markExtensions:o}=Au(t),s=(n=i.find(u=>j(u,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(u=>{const c=r.filter(y=>y.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},h=t.reduce((y,b)=>{const k=j(b,"extendNodeSchema",d);return{...y,...k?k(u):{}}},{}),p=Gm({...h,content:pe(j(u,"content",d)),marks:pe(j(u,"marks",d)),group:pe(j(u,"group",d)),inline:pe(j(u,"inline",d)),atom:pe(j(u,"atom",d)),selectable:pe(j(u,"selectable",d)),draggable:pe(j(u,"draggable",d)),code:pe(j(u,"code",d)),whitespace:pe(j(u,"whitespace",d)),linebreakReplacement:pe(j(u,"linebreakReplacement",d)),defining:pe(j(u,"defining",d)),isolating:pe(j(u,"isolating",d)),attrs:Object.fromEntries(c.map(y=>{var b;return[y.name,{default:(b=y?.attribute)===null||b===void 0?void 0:b.default}]}))}),f=pe(j(u,"parseHTML",d));f&&(p.parseDOM=f.map(y=>Km(y,c)));const m=j(u,"renderHTML",d);m&&(p.toDOM=y=>m({node:y,HTMLAttributes:Nd(y,c)}));const g=j(u,"renderText",d);return g&&(p.toText=g),[u.name,p]})),l=Object.fromEntries(o.map(u=>{const c=r.filter(g=>g.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},h=t.reduce((g,y)=>{const b=j(y,"extendMarkSchema",d);return{...g,...b?b(u):{}}},{}),p=Gm({...h,inclusive:pe(j(u,"inclusive",d)),excludes:pe(j(u,"excludes",d)),group:pe(j(u,"group",d)),spanning:pe(j(u,"spanning",d)),code:pe(j(u,"code",d)),attrs:Object.fromEntries(c.map(g=>{var y;return[g.name,{default:(y=g?.attribute)===null||y===void 0?void 0:y.default}]}))}),f=pe(j(u,"parseHTML",d));f&&(p.parseDOM=f.map(g=>Km(g,c)));const m=j(u,"renderHTML",d);return m&&(p.toDOM=g=>m({mark:g,HTMLAttributes:Nd(g,c)})),[u.name,p]}));return new ab({topNode:s,nodes:a,marks:l})}function xc(t,e){return e.nodes[t]||e.marks[t]||null}function Jm(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function nh(t,e){const n=fi.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}const GD=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,a)=>{var l,u;const c=((u=(l=i.type.spec).toText)===null||u===void 0?void 0:u.call(l,{node:i,pos:o,parent:s,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,r-o))}),n};function rh(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Mu{constructor(e){this.find=e.find,this.handler=e.handler}}const JD=(t,e)=>{if(rh(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function ca(t){var e;const{editor:n,from:r,to:i,text:o,rules:s,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const u=l.state.doc.resolve(r);if(u.parent.type.spec.code||!((e=u.nodeBefore||u.nodeAfter)===null||e===void 0)&&e.marks.find(h=>h.type.spec.code))return!1;let c=!1;const d=GD(u)+o;return s.forEach(h=>{if(c)return;const p=JD(d,h.find);if(!p)return;const f=l.state.tr,m=Tu({state:l.state,transaction:f}),g={from:r-(p[0].length-o.length),to:i},{commands:y,chain:b,can:k}=new Ou({editor:n,state:m});h.handler({state:m,range:g,match:p,commands:y,chain:b,can:k})===null||!f.steps.length||(f.setMeta(a,{transform:f,from:r,to:i,text:o}),l.dispatch(f),c=!0)}),c}function XD(t){const{editor:e,rules:n}=t,r=new Ve({state:{init(){return null},apply(i,o,s){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=nh(A.from(u),s.schema);const{from:c}=l,d=c+u.length;ca({editor:e,from:c,to:d,text:u,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,a){return ca({editor:e,from:o,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&ca({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?ca({editor:e,from:s.pos,to:s.pos,text:`
18
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function YD(t){return Object.prototype.toString.call(t).slice(8,-1)}function da(t){return YD(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function _u(t,e){const n={...t};return da(t)&&da(e)&&Object.keys(e).forEach(r=>{da(e[r])&&da(t[r])?n[r]=_u(t[r],e[r]):n[r]=e[r]}),n}class zn{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=pe(j(this,"addOptions",{name:this.name}))),this.storage=pe(j(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new zn(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>_u(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new zn(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=pe(j(n,"addOptions",{name:n.name})),n.storage=pe(j(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!o.find(a=>a?.type.name===n.name))return!1;const s=o.find(a=>a?.type.name===n.name);return s&&r.removeStoredMark(s),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function ZD(t){return typeof t=="number"}class QD{constructor(e){this.find=e.find,this.handler=e.handler}}const eN=(t,e,n)=>{if(rh(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=t,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function tN(t){const{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:u,can:c}=new Ou({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,i,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;const f=Math.max(r,p),m=Math.min(i,p+h.content.size),g=h.textBetween(f-p,m-p,void 0,"");eN(g,o.find,s).forEach(y=>{if(y.index===void 0)return;const b=f+y.index+1,k=b+y[0].length,v={from:n.tr.mapping.map(b),to:n.tr.mapping.map(k)},w=o.handler({state:n,range:v,match:y,commands:l,chain:u,can:c,pasteEvent:s,dropEvent:a});d.push(w)})}),d.every(h=>h!==null)}let pa=null;const nN=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function rN(t){const{editor:e,rules:n}=t;let r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:c,to:d,rule:h,pasteEvt:p})=>{const f=u.tr,m=Tu({state:u,transaction:f});if(!(!tN({editor:e,state:m,from:Math.max(c-1,0),to:d.b-1,rule:h,pasteEvent:p,dropEvent:a})||!f.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,f}};return n.map(u=>new Ve({view(c){const d=p=>{var f;r=!((f=c.dom.parentElement)===null||f===void 0)&&f.contains(p.target)?c.dom.parentElement:null,r&&(pa=e)},h=()=>{pa&&(pa=null)};return window.addEventListener("dragstart",d),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",d),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(c,d)=>{if(o=r===c.dom.parentElement,a=d,!o){const h=pa;h&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(c,d)=>{var h;const p=(h=d.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return s=d,i=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(c,d,h)=>{const p=c[0],f=p.getMeta("uiEvent")==="paste"&&!i,m=p.getMeta("uiEvent")==="drop"&&!o,g=p.getMeta("applyPasteRules"),y=!!g;if(!f&&!m&&!y)return;if(y){let{text:v}=g;typeof v=="string"?v=v:v=nh(A.from(v),h.schema);const{from:w}=g,x=w+v.length,T=nN(v);return l({rule:u,state:h,from:w,to:{b:x},pasteEvt:T})}const b=d.doc.content.findDiffStart(h.doc.content),k=d.doc.content.findDiffEnd(h.doc.content);if(!(!ZD(b)||!k||b===k.b))return l({rule:u,state:h,from:b,to:k,pasteEvt:s})}}))}function iN(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class Pi{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=Pi.resolve(e),this.schema=KD(this.extensions,n),this.setupExtensions()}static resolve(e){const n=Pi.sort(Pi.flatten(e)),r=iN(n.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},i=j(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((n,r)=>{const i=j(n,"priority")||100,o=j(r,"priority")||100;return i>o?-1:i<o?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:xc(n.name,this.schema)},i=j(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=Pi.sort([...this.extensions].reverse()),r=[],i=[],o=n.map(s=>{const a={name:s.name,options:s.options,storage:s.storage,editor:e,type:xc(s.name,this.schema)},l=[],u=j(s,"addKeyboardShortcuts",a);let c={};if(s.type==="mark"&&j(s,"exitable",a)&&(c.ArrowRight=()=>zn.handleExit({editor:e,mark:s})),u){const m=Object.fromEntries(Object.entries(u()).map(([g,y])=>[g,()=>y({editor:e})]));c={...c,...m}}const d=vD(c);l.push(d);const h=j(s,"addInputRules",a);Jm(s,e.options.enableInputRules)&&h&&r.push(...h());const p=j(s,"addPasteRules",a);Jm(s,e.options.enablePasteRules)&&p&&i.push(...p());const f=j(s,"addProseMirrorPlugins",a);if(f){const m=f();l.push(...m)}return l}).flat();return[XD({editor:e,rules:r}),...rN({editor:e,rules:i}),...o]}get attributes(){return p0(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=Au(this.extensions);return Object.fromEntries(n.filter(r=>!!j(r,"addNodeView")).map(r=>{const i=this.attributes.filter(l=>l.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:Ue(r.name,this.schema)},s=j(r,"addNodeView",o);if(!s)return[];const a=(l,u,c,d,h)=>{const p=Nd(l,i);return s()({node:l,view:u,getPos:c,decorations:d,innerDecorations:h,editor:e,extension:r,HTMLAttributes:p})};return[r.name,a]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:xc(e.name,this.schema)};e.type==="mark"&&(!((n=pe(j(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=j(e,"onBeforeCreate",r),o=j(e,"onCreate",r),s=j(e,"onUpdate",r),a=j(e,"onSelectionUpdate",r),l=j(e,"onTransaction",r),u=j(e,"onFocus",r),c=j(e,"onBlur",r),d=j(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),u&&this.editor.on("focus",u),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}}class Ke{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=pe(j(this,"addOptions",{name:this.name}))),this.storage=pe(j(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ke(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>_u(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Ke({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=pe(j(n,"addOptions",{name:n.name})),n.storage=pe(j(n,"addStorage",{name:n.name,options:n.options})),n}}function f0(t,e,n){const{from:r,to:i}=e,{blockSeparator:o=`
19
19
 
20
- `,textSerializers:s={}}=n||{};let a="";return t.nodesBetween(r,i,(l,u,c,d)=>{var h;l.isBlock&&u>r&&(a+=o);const p=s?.[l.type.name];if(p)return c&&(a+=p({node:l,pos:u,parent:c,index:d,range:e})),!1;l.isText&&(a+=(h=l?.text)===null||h===void 0?void 0:h.slice(Math.max(r,u)-u,i-u))}),a}function rh(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const iN=Ke.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ve({key:new at("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:o}=i,s=Math.min(...o.map(u=>u.$from.pos)),a=Math.max(...o.map(u=>u.$to.pos)),l=rh(n);return f0(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),oN=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),sN=(t=!1)=>({commands:e})=>e.setContent("",t),aN=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:o,$to:s})=>{t.doc.nodesBetween(o.pos,s.pos,(a,l)=>{if(a.type.isText)return;const{doc:u,mapping:c}=e,d=u.resolve(c.map(l)),h=u.resolve(c.map(l+a.nodeSize)),p=d.blockRange(h);if(!p)return;const f=uo(p);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(p.start,m)}(f||f===0)&&e.lift(p,f)})}),!0},lN=t=>e=>t(e),uN=()=>({state:t,dispatch:e})=>MD(t,e),cN=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,o=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new oe(r.doc.resolve(s-1))),!0},dN=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const s=i.before(o),a=i.after(o);t.delete(s,a).scrollIntoView()}return!0}return!1},pN=t=>({tr:e,state:n,dispatch:r})=>{const i=Ue(t,n.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){const a=o.before(s),l=o.after(s);e.delete(a,l).scrollIntoView()}return!0}return!1},hN=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},fN=()=>({state:t,dispatch:e})=>vD(t,e),mN=()=>({commands:t})=>t.keyboardShortcut("Enter"),gN=()=>({state:t,dispatch:e})=>AD(t,e);function gl(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:nh(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function m0(t,e,n={}){return t.find(r=>r.type===e&&gl(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function Jm(t,e,n={}){return!!m0(t,e,n)}function ih(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(u=>u.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(u=>u.type===e)||(n=n||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!m0([...i.node.marks],e,n)))return;let o=i.index,s=t.start()+i.offset,a=o+1,l=s+i.node.nodeSize;for(;o>0&&Jm([...t.parent.child(o-1).marks],e,n);)o-=1,s-=t.parent.child(o).nodeSize;for(;a<t.parent.childCount&&Jm([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}function Or(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const vN=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const o=Or(t,r.schema),{doc:s,selection:a}=n,{$from:l,from:u,to:c}=a;if(i){const d=ih(l,o,e);if(d&&d.from<=u&&d.to>=c){const h=oe.create(s,d.from,d.to);n.setSelection(h)}}return!0},yN=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function oh(t){return t instanceof oe}function Fn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function g0(t,e=null){if(!e)return null;const n=le.atStart(t),r=le.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,o=r.to;return e==="all"?oe.create(t,Fn(0,i,o),Fn(t.content.size,i,o)):oe.create(t,Fn(e,i,o),Fn(e,i,o))}function bN(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function sh(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const kN=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{(sh()||bN())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(o&&t===null&&!oh(n.state.selection))return s(),!0;const a=g0(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return o&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},wN=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),xN=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),v0=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&v0(r)}return t};function ha(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return v0(n)}function vl(t,e,n){if(t instanceof fr||t instanceof A)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return A.fromArray(t.map(s=>e.nodeFromJSON(s)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),vl("",e,n)}if(i){if(n.errorOnInvalidContent){let s=!1,a="";const l=new ab({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(s=!0,a=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?mr.fromSchema(l).parseSlice(ha(t),n.parseOptions):mr.fromSchema(l).parse(ha(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const o=mr.fromSchema(e);return n.slice?o.parseSlice(ha(t),n.parseOptions).content:o.parse(ha(t),n.parseOptions)}return vl("",e,n)}function EN(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof je||i instanceof qe))return;const o=t.mapping.maps[r];let s=0;o.forEach((a,l,u,c)=>{s===0&&(s=c)}),t.setSelection(le.near(t.doc.resolve(s),n))}const CN=t=>!("type"in t),SN=(t,e,n)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;try{a=vl(e,o.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:(s=n.errorOnInvalidContent)!==null&&s!==void 0?s:o.options.enableContentCheck})}catch(p){return o.emit("contentError",{editor:o,error:p,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}}),!1}let{from:l,to:u}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},c=!0,d=!0;if((CN(a)?a:[a]).forEach(p=>{p.check(),c=c?p.isText&&p.marks.length===0:!1,d=d?p.isBlock:!1}),l===u&&d){const{parent:p}=r.doc.resolve(l);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(l-=1,u+=1)}let h;if(c){if(Array.isArray(e))h=e.map(p=>p.text||"").join("");else if(e instanceof A){let p="";e.forEach(f=>{f.text&&(p+=f.text)}),h=p}else typeof e=="object"&&e&&e.text?h=e.text:h=e;r.insertText(h,l,u)}else h=a,r.replaceWith(l,u,h);n.updateSelection&&EN(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:l,text:h}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:l,text:h})}return!0},TN=()=>({state:t,dispatch:e})=>CD(t,e),ON=()=>({state:t,dispatch:e})=>SD(t,e),AN=()=>({state:t,dispatch:e})=>yD(t,e),MN=()=>({state:t,dispatch:e})=>xD(t,e),_N=()=>({state:t,dispatch:e,tr:n})=>{try{const r=bu(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},DN=()=>({state:t,dispatch:e,tr:n})=>{try{const r=bu(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},NN=()=>({state:t,dispatch:e})=>bD(t,e),IN=()=>({state:t,dispatch:e})=>kD(t,e);function y0(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function RN(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,o,s;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))sh()||y0()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}const PN=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const o=RN(t).split(/-(?!$)/),s=o.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,a))});return l?.steps.forEach(u=>{const c=u.map(r.mapping);c&&i&&r.maybeStep(c)}),!0};function ys(t,e,n={}){const{from:r,to:i,empty:o}=t.selection,s=e?Ue(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(c,d)=>{if(c.isText)return;const h=Math.max(r,d),p=Math.min(i,d+c.nodeSize);a.push({node:c,from:h,to:p})});const l=i-r,u=a.filter(c=>s?s.name===c.node.type.name:!0).filter(c=>gl(c.node.attrs,n,{strict:!1}));return o?!!u.length:u.reduce((c,d)=>c+d.to-d.from,0)>=l}const FN=(t,e={})=>({state:n,dispatch:r})=>{const i=Ue(t,n.schema);return ys(n,i,e)?TD(n,r):!1},LN=()=>({state:t,dispatch:e})=>_D(t,e),VN=t=>({state:e,dispatch:n})=>{const r=Ue(t,e.schema);return BD(r)(e,n)},BN=()=>({state:t,dispatch:e})=>OD(t,e);function _u(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Xm(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}const $N=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const a=_u(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=Ue(t,r.schema)),a==="mark"&&(s=Or(t,r.schema)),i&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(u,c)=>{o&&o===u.type&&n.setNodeMarkup(c,void 0,Xm(u.attrs,e)),s&&u.marks.length&&u.marks.forEach(d=>{s===d.type&&n.addMark(c,c+u.nodeSize,s.create(Xm(d.attrs,e)))})})}),!0):!1},jN=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),zN=()=>({tr:t,dispatch:e})=>{if(e){const n=new jt(t.doc);t.setSelection(n)}return!0},HN=()=>({state:t,dispatch:e})=>wD(t,e),qN=()=>({state:t,dispatch:e})=>ED(t,e),WN=()=>({state:t,dispatch:e})=>DD(t,e),UN=()=>({state:t,dispatch:e})=>RD(t,e),KN=()=>({state:t,dispatch:e})=>ID(t,e);function Nd(t,e,n={},r={}){return vl(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const GN=(t,e=!1,n={},r={})=>({editor:i,tr:o,dispatch:s,commands:a})=>{var l,u;const{doc:c}=o;if(n.preserveWhitespace!=="full"){const d=Nd(t,i.schema,n,{errorOnInvalidContent:(l=r.errorOnInvalidContent)!==null&&l!==void 0?l:i.options.enableContentCheck});return s&&o.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!e),!0}return s&&o.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:c.content.size},t,{parseOptions:n,errorOnInvalidContent:(u=r.errorOnInvalidContent)!==null&&u!==void 0?u:i.options.enableContentCheck})};function b0(t,e){const n=Or(e,t.schema),{from:r,to:i,empty:o}=t.selection,s=[];o?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{s.push(...l.marks)});const a=s.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function JN(t,e){const n=new Eb(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function XN(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function YN(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,o)=>{n(i)&&r.push({node:i,pos:o})}),r}function ZN(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function ah(t){return e=>ZN(e.$from,t)}function k0(t,e){const n={from:0,to:t.content.size};return f0(t,n,e)}function QN(t,e){const n=Ue(e,t.schema),{from:r,to:i}=t.selection,o=[];t.doc.nodesBetween(r,i,a=>{o.push(a)});const s=o.reverse().find(a=>a.type.name===n.name);return s?{...s.attrs}:{}}function w0(t,e){const n=_u(typeof e=="string"?e:e.name,t.schema);return n==="node"?QN(t,e):n==="mark"?b0(t,e):{}}function eI(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function tI(t){const e=eI(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function nI(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,o)=>{const s=[];if(i.ranges.length)i.forEach((a,l)=>{s.push({from:a,to:l})});else{const{from:a,to:l}=n[o];if(a===void 0||l===void 0)return;s.push({from:a,to:l})}s.forEach(({from:a,to:l})=>{const u=e.slice(o).map(a,-1),c=e.slice(o).map(l),d=e.invert().map(u,-1),h=e.invert().map(c);r.push({oldRange:{from:d,to:h},newRange:{from:u,to:c}})})}),tI(r)}function lh(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const o=n.resolve(t),s=ih(o,i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(t,e,(i,o)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}function Ra(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function Id(t,e,n={}){const{empty:r,ranges:i}=t.selection,o=e?Or(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(c=>o?o.name===c.type.name:!0).find(c=>gl(c.attrs,n,{strict:!1}));let s=0;const a=[];if(i.forEach(({$from:c,$to:d})=>{const h=c.pos,p=d.pos;t.doc.nodesBetween(h,p,(f,m)=>{if(!f.isText&&!f.marks.length)return;const g=Math.max(h,m),y=Math.min(p,m+f.nodeSize),b=y-g;s+=b,a.push(...f.marks.map(k=>({mark:k,from:g,to:y})))})}),s===0)return!1;const l=a.filter(c=>o?o.name===c.mark.type.name:!0).filter(c=>gl(c.mark.attrs,n,{strict:!1})).reduce((c,d)=>c+d.to-d.from,0),u=a.filter(c=>o?c.mark.type!==o&&c.mark.type.excludes(o):!0).reduce((c,d)=>c+d.to-d.from,0);return(l>0?l+u:l)>=s}function rI(t,e,n={}){if(!e)return ys(t,null,n)||Id(t,null,n);const r=_u(e,t.schema);return r==="node"?ys(t,e,n):r==="mark"?Id(t,e,n):!1}function Ym(t,e){const{nodeExtensions:n}=Ou(e),r=n.find(s=>s.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=pe(j(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function Du(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!==null&&r!==void 0?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(o=>{i!==!1&&(Du(o,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function x0(t){return t instanceof Y}function E0(t,e,n){const r=t.state.doc.content.size,i=Fn(e,0,r),o=Fn(n,0,r),s=t.coordsAtPos(i),a=t.coordsAtPos(o,-1),l=Math.min(s.top,a.top),u=Math.max(s.bottom,a.bottom),c=Math.min(s.left,a.left),d=Math.max(s.right,a.right),h=d-c,p=u-l,f={top:l,bottom:u,left:c,right:d,width:h,height:p,x:c,y:l};return{...f,toJSON:()=>f}}function iI(t,e,n){var r;const{selection:i}=e;let o=null;if(oh(i)&&(o=i.$cursor),o){const a=(r=t.storedMarks)!==null&&r!==void 0?r:o.marks();return!!n.isInSet(a)||!a.some(l=>l.type.excludes(n))}const{ranges:s}=i;return s.some(({$from:a,$to:l})=>{let u=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(c,d,h)=>{if(u)return!1;if(c.isInline){const p=!h||h.type.allowsMarkType(n),f=!!n.isInSet(c.marks)||!c.marks.some(m=>m.type.excludes(n));u=p&&f}return!u}),u})}const oI=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=n,{empty:s,ranges:a}=o,l=Or(t,r.schema);if(i)if(s){const u=b0(r,l);n.addStoredMark(l.create({...u,...e}))}else a.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;r.doc.nodesBetween(c,d,(h,p)=>{const f=Math.max(p,c),m=Math.min(p+h.nodeSize,d);h.marks.find(g=>g.type===l)?h.marks.forEach(g=>{l===g.type&&n.addMark(f,m,l.create({...g.attrs,...e}))}):n.addMark(f,m,l.create(e))})});return iI(r,n,l)},sI=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),aI=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const o=Ue(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:a})=>Wm(o,{...s,...e})(n)?!0:a.clearNodes()).command(({state:a})=>Wm(o,{...s,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},lI=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Fn(t,0,r.content.size),o=Y.create(r,i);e.setSelection(o)}return!0},uI=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,s=oe.atStart(r).from,a=oe.atEnd(r).to,l=Fn(i,s,a),u=Fn(o,s,a),c=oe.create(r,l,u);e.setSelection(c)}return!0},cI=t=>({state:e,dispatch:n})=>{const r=Ue(t,e.schema);return zD(r)(e,n)};function Zm(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}const dI=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:o,doc:s}=e,{$from:a,$to:l}=o,u=i.extensionManager.attributes,c=Ra(u,a.node().type.name,a.node().attrs);if(o instanceof Y&&o.node.isBlock)return!a.parentOffset||!$i(s,a.pos)?!1:(r&&(t&&Zm(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,h=a.depth===0?void 0:XN(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=d&&h?[{type:h,attrs:c}]:void 0,f=$i(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!f&&$i(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(f=!0,p=h?[{type:h,attrs:c}]:void 0),r){if(f&&(o instanceof oe&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,p),h&&!d&&!a.parentOffset&&a.parent.type!==h)){const m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}t&&Zm(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return f},pI=(t,e={})=>({tr:n,state:r,dispatch:i,editor:o})=>{var s;const a=Ue(t,r.schema),{$from:l,$to:u}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(u))return!1;const d=l.node(-1);if(d.type!==a)return!1;const h=o.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let y=A.empty;const b=l.index(-1)?1:l.index(-2)?2:3;for(let F=l.depth-b;F>=l.depth-3;F-=1)y=A.from(l.node(F).copy(y));const k=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,v={...Ra(h,l.node().type.name,l.node().attrs),...e},w=((s=a.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(v))||void 0;y=y.append(A.from(a.createAndFill(null,w)||void 0));const x=l.before(l.depth-(b-1));n.replace(x,l.after(-k),new V(y,4-b,0));let T=-1;n.doc.nodesBetween(x,n.doc.content.size,(F,D)=>{if(T>-1)return!1;F.isTextblock&&F.content.size===0&&(T=D+1)}),T>-1&&n.setSelection(oe.near(n.doc.resolve(T))),n.scrollIntoView()}return!0}const p=u.pos===l.end()?d.contentMatchAt(0).defaultType:null,f={...Ra(h,d.type.name,d.attrs),...e},m={...Ra(h,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,u.pos);const g=p?[{type:a,attrs:f},{type:p,attrs:m}]:[{type:a,attrs:f}];if(!$i(n.doc,l.pos,2))return!1;if(i){const{selection:y,storedMarks:b}=r,{splittableMarks:k}=o.extensionManager,v=b||y.$to.parentOffset&&y.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!v||!i)return!0;const w=v.filter(x=>k.includes(x.type.name));n.ensureMarks(w)}return!0},xc=(t,e)=>{const n=ah(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&Sr(t.doc,n.pos)&&t.join(n.pos),!0},Ec=(t,e)=>{const n=ah(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&Sr(t.doc,r)&&t.join(r),!0},hI=(t,e,n,r={})=>({editor:i,tr:o,state:s,dispatch:a,chain:l,commands:u,can:c})=>{const{extensions:d,splittableMarks:h}=i.extensionManager,p=Ue(t,s.schema),f=Ue(e,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:b}=m,k=y.blockRange(b),v=g||m.$to.parentOffset&&m.$from.marks();if(!k)return!1;const w=ah(x=>Ym(x.type.name,d))(m);if(k.depth>=1&&w&&k.depth-w.depth<=1){if(w.node.type===p)return u.liftListItem(f);if(Ym(w.node.type.name,d)&&p.validContent(w.node.content)&&a)return l().command(()=>(o.setNodeMarkup(w.pos,p),!0)).command(()=>xc(o,p)).command(()=>Ec(o,p)).run()}return!n||!v||!a?l().command(()=>c().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>xc(o,p)).command(()=>Ec(o,p)).run():l().command(()=>{const x=c().wrapInList(p,r),T=v.filter(F=>h.includes(F.type.name));return o.ensureMarks(T),x?!0:u.clearNodes()}).wrapInList(p,r).command(()=>xc(o,p)).command(()=>Ec(o,p)).run()},fI=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,s=Or(t,r.schema);return Id(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},mI=(t,e,n={})=>({state:r,commands:i})=>{const o=Ue(t,r.schema),s=Ue(e,r.schema),a=ys(r,o,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(s,l):i.setNode(o,{...l,...n})},gI=(t,e={})=>({state:n,commands:r})=>{const i=Ue(t,n.schema);return ys(n,i,e)?r.lift(i):r.wrapIn(i,e)},vI=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let o;if(i.spec.isInputRules&&(o=i.getState(t))){if(e){const s=t.tr,a=o.transform;for(let l=a.steps.length-1;l>=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(o.text){const l=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,t.schema.text(o.text,l))}else s.delete(o.from,o.to)}return!0}}return!1},yI=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(o=>{t.removeMark(o.$from.pos,o.$to.pos)}),!0},bI=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=Or(t,r.schema),{$from:u,empty:c,ranges:d}=a;if(!i)return!0;if(c&&s){let{from:h,to:p}=a;const f=(o=u.marks().find(g=>g.type===l))===null||o===void 0?void 0:o.attrs,m=ih(u,l,f);m&&(h=m.from,p=m.to),n.removeMark(h,p,l)}else d.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,l)});return n.removeStoredMark(l),!0},kI=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const a=_u(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=Ue(t,r.schema)),a==="mark"&&(s=Or(t,r.schema)),i&&n.selection.ranges.forEach(l=>{const u=l.$from.pos,c=l.$to.pos;let d,h,p,f;n.selection.empty?r.doc.nodesBetween(u,c,(m,g)=>{o&&o===m.type&&(p=Math.max(g,u),f=Math.min(g+m.nodeSize,c),d=g,h=m)}):r.doc.nodesBetween(u,c,(m,g)=>{g<u&&o&&o===m.type&&(p=Math.max(g,u),f=Math.min(g+m.nodeSize,c),d=g,h=m),g>=u&&g<=c&&(o&&o===m.type&&n.setNodeMarkup(g,void 0,{...m.attrs,...e}),s&&m.marks.length&&m.marks.forEach(y=>{if(s===y.type){const b=Math.max(g,u),k=Math.min(g+m.nodeSize,c);n.addMark(b,k,s.create({...y.attrs,...e}))}}))}),h&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(m=>{s===m.type&&n.addMark(p,f,s.create({...m.attrs,...e}))}))}),!0):!1},wI=(t,e={})=>({state:n,dispatch:r})=>{const i=Ue(t,n.schema);return PD(i,e)(n,r)},xI=(t,e={})=>({state:n,dispatch:r})=>{const i=Ue(t,n.schema);return FD(i,e)(n,r)};var EI=Object.freeze({__proto__:null,blur:oN,clearContent:sN,clearNodes:aN,command:lN,createParagraphNear:uN,cut:cN,deleteCurrentNode:dN,deleteNode:pN,deleteRange:hN,deleteSelection:fN,enter:mN,exitCode:gN,extendMarkRange:vN,first:yN,focus:kN,forEach:wN,insertContent:xN,insertContentAt:SN,joinBackward:AN,joinDown:ON,joinForward:MN,joinItemBackward:_N,joinItemForward:DN,joinTextblockBackward:NN,joinTextblockForward:IN,joinUp:TN,keyboardShortcut:PN,lift:FN,liftEmptyBlock:LN,liftListItem:VN,newlineInCode:BN,resetAttributes:$N,scrollIntoView:jN,selectAll:zN,selectNodeBackward:HN,selectNodeForward:qN,selectParentNode:WN,selectTextblockEnd:UN,selectTextblockStart:KN,setContent:GN,setMark:oI,setMeta:sI,setNode:aI,setNodeSelection:lI,setTextSelection:uI,sinkListItem:cI,splitBlock:dI,splitListItem:pI,toggleList:hI,toggleMark:fI,toggleNode:mI,toggleWrap:gI,undoInputRule:vI,unsetAllMarks:yI,unsetMark:bI,updateAttributes:kI,wrapIn:wI,wrapInList:xI});const CI=Ke.create({name:"commands",addCommands(){return{...EI}}}),SI=Ke.create({name:"drop",addProseMirrorPlugins(){return[new Ve({key:new at("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),TI=Ke.create({name:"editable",addProseMirrorPlugins(){return[new Ve({key:new at("editable"),props:{editable:()=>this.editor.options.editable}})]}}),OI=Ke.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ve({key:new at("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),AI=Ke.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:s})=>{const{selection:a,doc:l}=s,{empty:u,$anchor:c}=a,{pos:d,parent:h}=c,p=c.parent.isTextblock&&d>0?s.doc.resolve(d-1):c,f=p.parent.type.spec.isolating,m=c.pos-c.parentOffset,g=f&&p.parent.childCount===1?m===c.pos:le.atStart(l).from===d;return!u||!h.type.isTextblock||h.textContent.length||!g||g&&c.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return sh()||y0()?i:r},addProseMirrorPlugins(){return[new Ve({key:new at("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(p=>p.getMeta("composition")))return;const r=t.some(p=>p.docChanged)&&!e.doc.eq(n.doc),i=t.some(p=>p.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:s,to:a}=e.selection,l=le.atStart(e.doc).from,u=le.atEnd(e.doc).to;if(o||!(s===l&&a===u)||!Du(n.doc))return;const c=n.tr,d=Su({state:n,transaction:c}),{commands:h}=new Tu({editor:this.editor,state:d});if(h.clearNodes(),!!c.steps.length)return c}})]}}),MI=Ke.create({name:"paste",addProseMirrorPlugins(){return[new Ve({key:new at("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),_I=Ke.create({name:"tabindex",addProseMirrorPlugins(){return[new Ve({key:new at("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Hr{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Hr(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Hr(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Hr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,s=this.pos+r+(o?0:1),a=this.resolvedPos.doc.resolve(s);if(!i&&a.depth<=this.depth)return;const l=new Hr(a,this.editor,i,i?n:null);i&&(l.actualDepth=this.depth+1),e.push(new Hr(a,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const o=i.node.attrs,s=Object.keys(n);for(let a=0;a<s.length;a+=1){const l=s[a];if(o[l]!==n[l])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const o=Object.keys(n);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===e&&o.every(a=>n[a]===s.node.attrs[a])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const DI=`.ProseMirror {
20
+ `,textSerializers:s={}}=n||{};let a="";return t.nodesBetween(r,i,(l,u,c,d)=>{var h;l.isBlock&&u>r&&(a+=o);const p=s?.[l.type.name];if(p)return c&&(a+=p({node:l,pos:u,parent:c,index:d,range:e})),!1;l.isText&&(a+=(h=l?.text)===null||h===void 0?void 0:h.slice(Math.max(r,u)-u,i-u))}),a}function ih(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const oN=Ke.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ve({key:new at("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:o}=i,s=Math.min(...o.map(u=>u.$from.pos)),a=Math.max(...o.map(u=>u.$to.pos)),l=ih(n);return f0(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),sN=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),aN=(t=!1)=>({commands:e})=>e.setContent("",t),lN=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:o,$to:s})=>{t.doc.nodesBetween(o.pos,s.pos,(a,l)=>{if(a.type.isText)return;const{doc:u,mapping:c}=e,d=u.resolve(c.map(l)),h=u.resolve(c.map(l+a.nodeSize)),p=d.blockRange(h);if(!p)return;const f=uo(p);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(p.start,m)}(f||f===0)&&e.lift(p,f)})}),!0},uN=t=>e=>t(e),cN=()=>({state:t,dispatch:e})=>_D(t,e),dN=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,o=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new oe(r.doc.resolve(s-1))),!0},pN=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const s=i.before(o),a=i.after(o);t.delete(s,a).scrollIntoView()}return!0}return!1},hN=t=>({tr:e,state:n,dispatch:r})=>{const i=Ue(t,n.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){const a=o.before(s),l=o.after(s);e.delete(a,l).scrollIntoView()}return!0}return!1},fN=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},mN=()=>({state:t,dispatch:e})=>yD(t,e),gN=()=>({commands:t})=>t.keyboardShortcut("Enter"),vN=()=>({state:t,dispatch:e})=>MD(t,e);function gl(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:rh(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function m0(t,e,n={}){return t.find(r=>r.type===e&&gl(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function Xm(t,e,n={}){return!!m0(t,e,n)}function oh(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(u=>u.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(u=>u.type===e)||(n=n||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!m0([...i.node.marks],e,n)))return;let o=i.index,s=t.start()+i.offset,a=o+1,l=s+i.node.nodeSize;for(;o>0&&Xm([...t.parent.child(o-1).marks],e,n);)o-=1,s-=t.parent.child(o).nodeSize;for(;a<t.parent.childCount&&Xm([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}function Or(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const yN=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const o=Or(t,r.schema),{doc:s,selection:a}=n,{$from:l,from:u,to:c}=a;if(i){const d=oh(l,o,e);if(d&&d.from<=u&&d.to>=c){const h=oe.create(s,d.from,d.to);n.setSelection(h)}}return!0},bN=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function sh(t){return t instanceof oe}function Fn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function g0(t,e=null){if(!e)return null;const n=le.atStart(t),r=le.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,o=r.to;return e==="all"?oe.create(t,Fn(0,i,o),Fn(t.content.size,i,o)):oe.create(t,Fn(e,i,o),Fn(e,i,o))}function kN(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ah(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const wN=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{(ah()||kN())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(o&&t===null&&!sh(n.state.selection))return s(),!0;const a=g0(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return o&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},xN=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),EN=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),v0=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&v0(r)}return t};function ha(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return v0(n)}function vl(t,e,n){if(t instanceof fr||t instanceof A)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return A.fromArray(t.map(s=>e.nodeFromJSON(s)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),vl("",e,n)}if(i){if(n.errorOnInvalidContent){let s=!1,a="";const l=new ab({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(s=!0,a=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?mr.fromSchema(l).parseSlice(ha(t),n.parseOptions):mr.fromSchema(l).parse(ha(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const o=mr.fromSchema(e);return n.slice?o.parseSlice(ha(t),n.parseOptions).content:o.parse(ha(t),n.parseOptions)}return vl("",e,n)}function CN(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof je||i instanceof qe))return;const o=t.mapping.maps[r];let s=0;o.forEach((a,l,u,c)=>{s===0&&(s=c)}),t.setSelection(le.near(t.doc.resolve(s),n))}const SN=t=>!("type"in t),TN=(t,e,n)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;try{a=vl(e,o.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:(s=n.errorOnInvalidContent)!==null&&s!==void 0?s:o.options.enableContentCheck})}catch(p){return o.emit("contentError",{editor:o,error:p,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}}),!1}let{from:l,to:u}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},c=!0,d=!0;if((SN(a)?a:[a]).forEach(p=>{p.check(),c=c?p.isText&&p.marks.length===0:!1,d=d?p.isBlock:!1}),l===u&&d){const{parent:p}=r.doc.resolve(l);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(l-=1,u+=1)}let h;if(c){if(Array.isArray(e))h=e.map(p=>p.text||"").join("");else if(e instanceof A){let p="";e.forEach(f=>{f.text&&(p+=f.text)}),h=p}else typeof e=="object"&&e&&e.text?h=e.text:h=e;r.insertText(h,l,u)}else h=a,r.replaceWith(l,u,h);n.updateSelection&&CN(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:l,text:h}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:l,text:h})}return!0},ON=()=>({state:t,dispatch:e})=>SD(t,e),AN=()=>({state:t,dispatch:e})=>TD(t,e),MN=()=>({state:t,dispatch:e})=>bD(t,e),_N=()=>({state:t,dispatch:e})=>ED(t,e),DN=()=>({state:t,dispatch:e,tr:n})=>{try{const r=ku(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},NN=()=>({state:t,dispatch:e,tr:n})=>{try{const r=ku(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},IN=()=>({state:t,dispatch:e})=>kD(t,e),RN=()=>({state:t,dispatch:e})=>wD(t,e);function y0(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function PN(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,o,s;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))ah()||y0()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}const FN=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const o=PN(t).split(/-(?!$)/),s=o.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,a))});return l?.steps.forEach(u=>{const c=u.map(r.mapping);c&&i&&r.maybeStep(c)}),!0};function ys(t,e,n={}){const{from:r,to:i,empty:o}=t.selection,s=e?Ue(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(c,d)=>{if(c.isText)return;const h=Math.max(r,d),p=Math.min(i,d+c.nodeSize);a.push({node:c,from:h,to:p})});const l=i-r,u=a.filter(c=>s?s.name===c.node.type.name:!0).filter(c=>gl(c.node.attrs,n,{strict:!1}));return o?!!u.length:u.reduce((c,d)=>c+d.to-d.from,0)>=l}const LN=(t,e={})=>({state:n,dispatch:r})=>{const i=Ue(t,n.schema);return ys(n,i,e)?OD(n,r):!1},VN=()=>({state:t,dispatch:e})=>DD(t,e),BN=t=>({state:e,dispatch:n})=>{const r=Ue(t,e.schema);return $D(r)(e,n)},$N=()=>({state:t,dispatch:e})=>AD(t,e);function Du(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Ym(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}const jN=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const a=Du(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=Ue(t,r.schema)),a==="mark"&&(s=Or(t,r.schema)),i&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(u,c)=>{o&&o===u.type&&n.setNodeMarkup(c,void 0,Ym(u.attrs,e)),s&&u.marks.length&&u.marks.forEach(d=>{s===d.type&&n.addMark(c,c+u.nodeSize,s.create(Ym(d.attrs,e)))})})}),!0):!1},zN=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),HN=()=>({tr:t,dispatch:e})=>{if(e){const n=new jt(t.doc);t.setSelection(n)}return!0},qN=()=>({state:t,dispatch:e})=>xD(t,e),WN=()=>({state:t,dispatch:e})=>CD(t,e),UN=()=>({state:t,dispatch:e})=>ND(t,e),KN=()=>({state:t,dispatch:e})=>PD(t,e),GN=()=>({state:t,dispatch:e})=>RD(t,e);function Id(t,e,n={},r={}){return vl(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const JN=(t,e=!1,n={},r={})=>({editor:i,tr:o,dispatch:s,commands:a})=>{var l,u;const{doc:c}=o;if(n.preserveWhitespace!=="full"){const d=Id(t,i.schema,n,{errorOnInvalidContent:(l=r.errorOnInvalidContent)!==null&&l!==void 0?l:i.options.enableContentCheck});return s&&o.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!e),!0}return s&&o.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:c.content.size},t,{parseOptions:n,errorOnInvalidContent:(u=r.errorOnInvalidContent)!==null&&u!==void 0?u:i.options.enableContentCheck})};function b0(t,e){const n=Or(e,t.schema),{from:r,to:i,empty:o}=t.selection,s=[];o?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{s.push(...l.marks)});const a=s.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function XN(t,e){const n=new Eb(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function YN(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function ZN(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,o)=>{n(i)&&r.push({node:i,pos:o})}),r}function QN(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function lh(t){return e=>QN(e.$from,t)}function k0(t,e){const n={from:0,to:t.content.size};return f0(t,n,e)}function eI(t,e){const n=Ue(e,t.schema),{from:r,to:i}=t.selection,o=[];t.doc.nodesBetween(r,i,a=>{o.push(a)});const s=o.reverse().find(a=>a.type.name===n.name);return s?{...s.attrs}:{}}function w0(t,e){const n=Du(typeof e=="string"?e:e.name,t.schema);return n==="node"?eI(t,e):n==="mark"?b0(t,e):{}}function tI(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function nI(t){const e=tI(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function rI(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,o)=>{const s=[];if(i.ranges.length)i.forEach((a,l)=>{s.push({from:a,to:l})});else{const{from:a,to:l}=n[o];if(a===void 0||l===void 0)return;s.push({from:a,to:l})}s.forEach(({from:a,to:l})=>{const u=e.slice(o).map(a,-1),c=e.slice(o).map(l),d=e.invert().map(u,-1),h=e.invert().map(c);r.push({oldRange:{from:d,to:h},newRange:{from:u,to:c}})})}),nI(r)}function uh(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const o=n.resolve(t),s=oh(o,i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(t,e,(i,o)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}function Ra(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function Rd(t,e,n={}){const{empty:r,ranges:i}=t.selection,o=e?Or(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(c=>o?o.name===c.type.name:!0).find(c=>gl(c.attrs,n,{strict:!1}));let s=0;const a=[];if(i.forEach(({$from:c,$to:d})=>{const h=c.pos,p=d.pos;t.doc.nodesBetween(h,p,(f,m)=>{if(!f.isText&&!f.marks.length)return;const g=Math.max(h,m),y=Math.min(p,m+f.nodeSize),b=y-g;s+=b,a.push(...f.marks.map(k=>({mark:k,from:g,to:y})))})}),s===0)return!1;const l=a.filter(c=>o?o.name===c.mark.type.name:!0).filter(c=>gl(c.mark.attrs,n,{strict:!1})).reduce((c,d)=>c+d.to-d.from,0),u=a.filter(c=>o?c.mark.type!==o&&c.mark.type.excludes(o):!0).reduce((c,d)=>c+d.to-d.from,0);return(l>0?l+u:l)>=s}function iI(t,e,n={}){if(!e)return ys(t,null,n)||Rd(t,null,n);const r=Du(e,t.schema);return r==="node"?ys(t,e,n):r==="mark"?Rd(t,e,n):!1}function Zm(t,e){const{nodeExtensions:n}=Au(e),r=n.find(s=>s.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=pe(j(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function Nu(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!==null&&r!==void 0?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(o=>{i!==!1&&(Nu(o,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function x0(t){return t instanceof Y}function E0(t,e,n){const r=t.state.doc.content.size,i=Fn(e,0,r),o=Fn(n,0,r),s=t.coordsAtPos(i),a=t.coordsAtPos(o,-1),l=Math.min(s.top,a.top),u=Math.max(s.bottom,a.bottom),c=Math.min(s.left,a.left),d=Math.max(s.right,a.right),h=d-c,p=u-l,f={top:l,bottom:u,left:c,right:d,width:h,height:p,x:c,y:l};return{...f,toJSON:()=>f}}function oI(t,e,n){var r;const{selection:i}=e;let o=null;if(sh(i)&&(o=i.$cursor),o){const a=(r=t.storedMarks)!==null&&r!==void 0?r:o.marks();return!!n.isInSet(a)||!a.some(l=>l.type.excludes(n))}const{ranges:s}=i;return s.some(({$from:a,$to:l})=>{let u=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(c,d,h)=>{if(u)return!1;if(c.isInline){const p=!h||h.type.allowsMarkType(n),f=!!n.isInSet(c.marks)||!c.marks.some(m=>m.type.excludes(n));u=p&&f}return!u}),u})}const sI=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=n,{empty:s,ranges:a}=o,l=Or(t,r.schema);if(i)if(s){const u=b0(r,l);n.addStoredMark(l.create({...u,...e}))}else a.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;r.doc.nodesBetween(c,d,(h,p)=>{const f=Math.max(p,c),m=Math.min(p+h.nodeSize,d);h.marks.find(g=>g.type===l)?h.marks.forEach(g=>{l===g.type&&n.addMark(f,m,l.create({...g.attrs,...e}))}):n.addMark(f,m,l.create(e))})});return oI(r,n,l)},aI=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),lI=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const o=Ue(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:a})=>Um(o,{...s,...e})(n)?!0:a.clearNodes()).command(({state:a})=>Um(o,{...s,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},uI=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Fn(t,0,r.content.size),o=Y.create(r,i);e.setSelection(o)}return!0},cI=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,s=oe.atStart(r).from,a=oe.atEnd(r).to,l=Fn(i,s,a),u=Fn(o,s,a),c=oe.create(r,l,u);e.setSelection(c)}return!0},dI=t=>({state:e,dispatch:n})=>{const r=Ue(t,e.schema);return HD(r)(e,n)};function Qm(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}const pI=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:o,doc:s}=e,{$from:a,$to:l}=o,u=i.extensionManager.attributes,c=Ra(u,a.node().type.name,a.node().attrs);if(o instanceof Y&&o.node.isBlock)return!a.parentOffset||!$i(s,a.pos)?!1:(r&&(t&&Qm(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,h=a.depth===0?void 0:YN(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=d&&h?[{type:h,attrs:c}]:void 0,f=$i(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!f&&$i(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(f=!0,p=h?[{type:h,attrs:c}]:void 0),r){if(f&&(o instanceof oe&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,p),h&&!d&&!a.parentOffset&&a.parent.type!==h)){const m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}t&&Qm(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return f},hI=(t,e={})=>({tr:n,state:r,dispatch:i,editor:o})=>{var s;const a=Ue(t,r.schema),{$from:l,$to:u}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(u))return!1;const d=l.node(-1);if(d.type!==a)return!1;const h=o.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let y=A.empty;const b=l.index(-1)?1:l.index(-2)?2:3;for(let F=l.depth-b;F>=l.depth-3;F-=1)y=A.from(l.node(F).copy(y));const k=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,v={...Ra(h,l.node().type.name,l.node().attrs),...e},w=((s=a.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(v))||void 0;y=y.append(A.from(a.createAndFill(null,w)||void 0));const x=l.before(l.depth-(b-1));n.replace(x,l.after(-k),new V(y,4-b,0));let T=-1;n.doc.nodesBetween(x,n.doc.content.size,(F,N)=>{if(T>-1)return!1;F.isTextblock&&F.content.size===0&&(T=N+1)}),T>-1&&n.setSelection(oe.near(n.doc.resolve(T))),n.scrollIntoView()}return!0}const p=u.pos===l.end()?d.contentMatchAt(0).defaultType:null,f={...Ra(h,d.type.name,d.attrs),...e},m={...Ra(h,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,u.pos);const g=p?[{type:a,attrs:f},{type:p,attrs:m}]:[{type:a,attrs:f}];if(!$i(n.doc,l.pos,2))return!1;if(i){const{selection:y,storedMarks:b}=r,{splittableMarks:k}=o.extensionManager,v=b||y.$to.parentOffset&&y.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!v||!i)return!0;const w=v.filter(x=>k.includes(x.type.name));n.ensureMarks(w)}return!0},Ec=(t,e)=>{const n=lh(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&Sr(t.doc,n.pos)&&t.join(n.pos),!0},Cc=(t,e)=>{const n=lh(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&Sr(t.doc,r)&&t.join(r),!0},fI=(t,e,n,r={})=>({editor:i,tr:o,state:s,dispatch:a,chain:l,commands:u,can:c})=>{const{extensions:d,splittableMarks:h}=i.extensionManager,p=Ue(t,s.schema),f=Ue(e,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:b}=m,k=y.blockRange(b),v=g||m.$to.parentOffset&&m.$from.marks();if(!k)return!1;const w=lh(x=>Zm(x.type.name,d))(m);if(k.depth>=1&&w&&k.depth-w.depth<=1){if(w.node.type===p)return u.liftListItem(f);if(Zm(w.node.type.name,d)&&p.validContent(w.node.content)&&a)return l().command(()=>(o.setNodeMarkup(w.pos,p),!0)).command(()=>Ec(o,p)).command(()=>Cc(o,p)).run()}return!n||!v||!a?l().command(()=>c().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>Ec(o,p)).command(()=>Cc(o,p)).run():l().command(()=>{const x=c().wrapInList(p,r),T=v.filter(F=>h.includes(F.type.name));return o.ensureMarks(T),x?!0:u.clearNodes()}).wrapInList(p,r).command(()=>Ec(o,p)).command(()=>Cc(o,p)).run()},mI=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,s=Or(t,r.schema);return Rd(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},gI=(t,e,n={})=>({state:r,commands:i})=>{const o=Ue(t,r.schema),s=Ue(e,r.schema),a=ys(r,o,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(s,l):i.setNode(o,{...l,...n})},vI=(t,e={})=>({state:n,commands:r})=>{const i=Ue(t,n.schema);return ys(n,i,e)?r.lift(i):r.wrapIn(i,e)},yI=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let o;if(i.spec.isInputRules&&(o=i.getState(t))){if(e){const s=t.tr,a=o.transform;for(let l=a.steps.length-1;l>=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(o.text){const l=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,t.schema.text(o.text,l))}else s.delete(o.from,o.to)}return!0}}return!1},bI=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(o=>{t.removeMark(o.$from.pos,o.$to.pos)}),!0},kI=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=Or(t,r.schema),{$from:u,empty:c,ranges:d}=a;if(!i)return!0;if(c&&s){let{from:h,to:p}=a;const f=(o=u.marks().find(g=>g.type===l))===null||o===void 0?void 0:o.attrs,m=oh(u,l,f);m&&(h=m.from,p=m.to),n.removeMark(h,p,l)}else d.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,l)});return n.removeStoredMark(l),!0},wI=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const a=Du(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=Ue(t,r.schema)),a==="mark"&&(s=Or(t,r.schema)),i&&n.selection.ranges.forEach(l=>{const u=l.$from.pos,c=l.$to.pos;let d,h,p,f;n.selection.empty?r.doc.nodesBetween(u,c,(m,g)=>{o&&o===m.type&&(p=Math.max(g,u),f=Math.min(g+m.nodeSize,c),d=g,h=m)}):r.doc.nodesBetween(u,c,(m,g)=>{g<u&&o&&o===m.type&&(p=Math.max(g,u),f=Math.min(g+m.nodeSize,c),d=g,h=m),g>=u&&g<=c&&(o&&o===m.type&&n.setNodeMarkup(g,void 0,{...m.attrs,...e}),s&&m.marks.length&&m.marks.forEach(y=>{if(s===y.type){const b=Math.max(g,u),k=Math.min(g+m.nodeSize,c);n.addMark(b,k,s.create({...y.attrs,...e}))}}))}),h&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(m=>{s===m.type&&n.addMark(p,f,s.create({...m.attrs,...e}))}))}),!0):!1},xI=(t,e={})=>({state:n,dispatch:r})=>{const i=Ue(t,n.schema);return FD(i,e)(n,r)},EI=(t,e={})=>({state:n,dispatch:r})=>{const i=Ue(t,n.schema);return LD(i,e)(n,r)};var CI=Object.freeze({__proto__:null,blur:sN,clearContent:aN,clearNodes:lN,command:uN,createParagraphNear:cN,cut:dN,deleteCurrentNode:pN,deleteNode:hN,deleteRange:fN,deleteSelection:mN,enter:gN,exitCode:vN,extendMarkRange:yN,first:bN,focus:wN,forEach:xN,insertContent:EN,insertContentAt:TN,joinBackward:MN,joinDown:AN,joinForward:_N,joinItemBackward:DN,joinItemForward:NN,joinTextblockBackward:IN,joinTextblockForward:RN,joinUp:ON,keyboardShortcut:FN,lift:LN,liftEmptyBlock:VN,liftListItem:BN,newlineInCode:$N,resetAttributes:jN,scrollIntoView:zN,selectAll:HN,selectNodeBackward:qN,selectNodeForward:WN,selectParentNode:UN,selectTextblockEnd:KN,selectTextblockStart:GN,setContent:JN,setMark:sI,setMeta:aI,setNode:lI,setNodeSelection:uI,setTextSelection:cI,sinkListItem:dI,splitBlock:pI,splitListItem:hI,toggleList:fI,toggleMark:mI,toggleNode:gI,toggleWrap:vI,undoInputRule:yI,unsetAllMarks:bI,unsetMark:kI,updateAttributes:wI,wrapIn:xI,wrapInList:EI});const SI=Ke.create({name:"commands",addCommands(){return{...CI}}}),TI=Ke.create({name:"drop",addProseMirrorPlugins(){return[new Ve({key:new at("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),OI=Ke.create({name:"editable",addProseMirrorPlugins(){return[new Ve({key:new at("editable"),props:{editable:()=>this.editor.options.editable}})]}}),AI=Ke.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ve({key:new at("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),MI=Ke.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:s})=>{const{selection:a,doc:l}=s,{empty:u,$anchor:c}=a,{pos:d,parent:h}=c,p=c.parent.isTextblock&&d>0?s.doc.resolve(d-1):c,f=p.parent.type.spec.isolating,m=c.pos-c.parentOffset,g=f&&p.parent.childCount===1?m===c.pos:le.atStart(l).from===d;return!u||!h.type.isTextblock||h.textContent.length||!g||g&&c.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ah()||y0()?i:r},addProseMirrorPlugins(){return[new Ve({key:new at("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(p=>p.getMeta("composition")))return;const r=t.some(p=>p.docChanged)&&!e.doc.eq(n.doc),i=t.some(p=>p.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:s,to:a}=e.selection,l=le.atStart(e.doc).from,u=le.atEnd(e.doc).to;if(o||!(s===l&&a===u)||!Nu(n.doc))return;const c=n.tr,d=Tu({state:n,transaction:c}),{commands:h}=new Ou({editor:this.editor,state:d});if(h.clearNodes(),!!c.steps.length)return c}})]}}),_I=Ke.create({name:"paste",addProseMirrorPlugins(){return[new Ve({key:new at("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),DI=Ke.create({name:"tabindex",addProseMirrorPlugins(){return[new Ve({key:new at("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Hr{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Hr(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Hr(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Hr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,s=this.pos+r+(o?0:1),a=this.resolvedPos.doc.resolve(s);if(!i&&a.depth<=this.depth)return;const l=new Hr(a,this.editor,i,i?n:null);i&&(l.actualDepth=this.depth+1),e.push(new Hr(a,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const o=i.node.attrs,s=Object.keys(n);for(let a=0;a<s.length;a+=1){const l=s[a];if(o[l]!==n[l])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const o=Object.keys(n);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===e&&o.every(a=>n[a]===s.node.attrs[a])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const NI=`.ProseMirror {
21
21
  position: relative;
22
22
  }
23
23
 
@@ -91,14 +91,14 @@ img.ProseMirror-separator {
91
91
 
92
92
  .tippy-box[data-animation=fade][data-state=hidden] {
93
93
  opacity: 0
94
- }`;function NI(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}let II=class extends HD{constructor(t={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:n,moved:r})=>this.options.onDrop(e,n,r)),this.on("paste",({event:e,slice:n})=>this.options.onPaste(e,n)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=NI(DI,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(t,e){const n=h0(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(i=>{const o=typeof i=="string"?`${i}$`:i.key;n=e.filter(s=>!s.key.startsWith(o))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const n=[...this.options.enableCoreExtensions?[TI,iN.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)===null||t===void 0?void 0:t.clipboardTextSerializer)===null||e===void 0?void 0:e.blockSeparator}),CI,OI,AI,_I,SI,MI].filter(r=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[r.name]!==!1:!0):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r?.type));this.extensionManager=new Pi(n,this)}createCommandManager(){this.commandManager=new Tu({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var t;let e;try{e=Nd(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(o){if(!(o instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(o.message))throw o;this.emit("contentError",{editor:this,error:o,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(s=>s.name!=="collaboration"),this.createExtensionManager()}}),e=Nd(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const n=g0(e,this.options.autofocus);this.view=new aD(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)===null||t===void 0?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:Ri.create({doc:e,selection:n||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(o=>{var s;return(s=this.capturedTransaction)===null||s===void 0?void 0:s.step(o)});return}const e=this.state.apply(t),n=!this.state.selection.eq(e.selection);this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t}),n&&this.emit("selectionUpdate",{editor:this,transaction:t});const r=t.getMeta("focus"),i=t.getMeta("blur");r&&this.emit("focus",{editor:this,event:r.event,transaction:t}),i&&this.emit("blur",{editor:this,event:i.event,transaction:t}),!(!t.docChanged||t.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return w0(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return rI(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return th(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
94
+ }`;function II(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}let RI=class extends qD{constructor(t={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:n,moved:r})=>this.options.onDrop(e,n,r)),this.on("paste",({event:e,slice:n})=>this.options.onPaste(e,n)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=II(NI,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(t,e){const n=h0(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(i=>{const o=typeof i=="string"?`${i}$`:i.key;n=e.filter(s=>!s.key.startsWith(o))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const n=[...this.options.enableCoreExtensions?[OI,oN.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)===null||t===void 0?void 0:t.clipboardTextSerializer)===null||e===void 0?void 0:e.blockSeparator}),SI,AI,MI,DI,TI,_I].filter(r=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[r.name]!==!1:!0):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r?.type));this.extensionManager=new Pi(n,this)}createCommandManager(){this.commandManager=new Ou({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var t;let e;try{e=Id(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(o){if(!(o instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(o.message))throw o;this.emit("contentError",{editor:this,error:o,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(s=>s.name!=="collaboration"),this.createExtensionManager()}}),e=Id(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const n=g0(e,this.options.autofocus);this.view=new lD(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)===null||t===void 0?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:Ri.create({doc:e,selection:n||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(o=>{var s;return(s=this.capturedTransaction)===null||s===void 0?void 0:s.step(o)});return}const e=this.state.apply(t),n=!this.state.selection.eq(e.selection);this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t}),n&&this.emit("selectionUpdate",{editor:this,transaction:t});const r=t.getMeta("focus"),i=t.getMeta("blur");r&&this.emit("focus",{editor:this,event:r.event,transaction:t}),i&&this.emit("blur",{editor:this,event:i.event,transaction:t}),!(!t.docChanged||t.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return w0(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return iI(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return nh(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
95
95
 
96
- `,textSerializers:n={}}=t||{};return k0(this.state.doc,{blockSeparator:e,textSerializers:{...rh(this.schema),...n}})}get isEmpty(){return Du(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const t=this.view.dom;t&&t.editor&&delete t.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var t;return!(!((t=this.view)===null||t===void 0)&&t.docView)}$node(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new Hr(e,this)}get $doc(){return this.$pos(0)}};function to(t){return new Au({find:t.find,handler:({state:e,range:n,match:r})=>{const i=pe(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=e,s=r[r.length-1],a=r[0];if(s){const l=a.search(/\S/),u=n.from+a.indexOf(s),c=u+s.length;if(lh(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(p=>p===t.type&&p!==h.mark.type)).filter(h=>h.to>u).length)return null;c<n.to&&o.delete(c,n.to),u>n.from&&o.delete(n.from+l,u);const d=n.from+l+s.length;o.addMark(n.from+l,d,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}function RI(t){return new Au({find:t.find,handler:({state:e,range:n,match:r})=>{const i=pe(t.getAttributes,void 0,r)||{},{tr:o}=e,s=n.from;let a=n.to;const l=t.type.create(i);if(r[1]){const u=r[0].lastIndexOf(r[1]);let c=s+u;c>a?c=a:a=c+r[1].length;const d=r[0][r[0].length-1];o.insertText(d,s+r[0].length-1),o.replaceWith(c,a,l)}else if(r[0]){const u=t.type.isInline?s:s-1;o.insert(u,t.type.create(i)).delete(o.mapping.map(s),o.mapping.map(a))}o.scrollIntoView()}})}function Rd(t){return new Au({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),o=pe(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,o)}})}function bs(t){return new Au({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const o=pe(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&zp(a,t.type,o);if(!l)return null;if(s.wrap(a,l),t.keepMarks&&t.editor){const{selection:c,storedMarks:d}=e,{splittableMarks:h}=t.editor.extensionManager,p=d||c.$to.parentOffset&&c.$from.marks();if(p){const f=p.filter(m=>h.includes(m.type.name));s.ensureMarks(f)}}if(t.keepAttributes){const c=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(c,o).run()}const u=s.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&Sr(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&s.join(n.from-1)}})}let rn=class Pd{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=pe(j(this,"addOptions",{name:this.name}))),this.storage=pe(j(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Pd(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Mu(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Pd(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=pe(j(n,"addOptions",{name:n.name})),n.storage=pe(j(n,"addStorage",{name:n.name,options:n.options})),n}};function li(t){return new ZD({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const o=pe(t.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:s}=e,a=r[r.length-1],l=r[0];let u=n.to;if(a){const c=l.search(/\S/),d=n.from+l.indexOf(a),h=d+a.length;if(lh(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(f=>f===t.type&&f!==p.mark.type)).filter(p=>p.to>d).length)return null;h<n.to&&s.delete(h,n.to),d>n.from&&s.delete(n.from+c,d),u=n.from+c+a.length,s.addMark(n.from+c,u,t.type.create(o||{})),s.removeStoredMark(t.type)}}})}var kt="top",Wt="bottom",Ut="right",wt="left",uh="auto",Rs=[kt,Wt,Ut,wt],no="start",ks="end",PI="clippingParents",C0="viewport",xo="popper",FI="reference",Qm=Rs.reduce(function(t,e){return t.concat([e+"-"+no,e+"-"+ks])},[]),S0=[].concat(Rs,[uh]).reduce(function(t,e){return t.concat([e,e+"-"+no,e+"-"+ks])},[]),LI="beforeRead",VI="read",BI="afterRead",$I="beforeMain",jI="main",zI="afterMain",HI="beforeWrite",qI="write",WI="afterWrite",UI=[LI,VI,BI,$I,jI,zI,HI,qI,WI];function En(t){return t?(t.nodeName||"").toLowerCase():null}function Nt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function ui(t){var e=Nt(t).Element;return t instanceof e||t instanceof Element}function Ht(t){var e=Nt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function ch(t){if(typeof ShadowRoot>"u")return!1;var e=Nt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function KI(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},i=e.attributes[n]||{},o=e.elements[n];!Ht(o)||!En(o)||(Object.assign(o.style,r),Object.keys(i).forEach(function(s){var a=i[s];a===!1?o.removeAttribute(s):o.setAttribute(s,a===!0?"":a)}))})}function GI(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],o=e.attributes[r]||{},s=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),a=s.reduce(function(l,u){return l[u]="",l},{});!Ht(i)||!En(i)||(Object.assign(i.style,a),Object.keys(o).forEach(function(l){i.removeAttribute(l)}))})}}const T0={name:"applyStyles",enabled:!0,phase:"write",fn:KI,effect:GI,requires:["computeStyles"]};function yn(t){return t.split("-")[0]}var Qr=Math.max,yl=Math.min,ro=Math.round;function Fd(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function O0(){return!/^((?!chrome|android).)*safari/i.test(Fd())}function io(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,o=1;e&&Ht(t)&&(i=t.offsetWidth>0&&ro(r.width)/t.offsetWidth||1,o=t.offsetHeight>0&&ro(r.height)/t.offsetHeight||1);var s=ui(t)?Nt(t):window,a=s.visualViewport,l=!O0()&&n,u=(r.left+(l&&a?a.offsetLeft:0))/i,c=(r.top+(l&&a?a.offsetTop:0))/o,d=r.width/i,h=r.height/o;return{width:d,height:h,top:c,right:u+d,bottom:c+h,left:u,x:u,y:c}}function dh(t){var e=io(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function A0(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&ch(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Hn(t){return Nt(t).getComputedStyle(t)}function JI(t){return["table","td","th"].indexOf(En(t))>=0}function Ar(t){return((ui(t)?t.ownerDocument:t.document)||window.document).documentElement}function Nu(t){return En(t)==="html"?t:t.assignedSlot||t.parentNode||(ch(t)?t.host:null)||Ar(t)}function eg(t){return!Ht(t)||Hn(t).position==="fixed"?null:t.offsetParent}function XI(t){var e=/firefox/i.test(Fd()),n=/Trident/i.test(Fd());if(n&&Ht(t)){var r=Hn(t);if(r.position==="fixed")return null}var i=Nu(t);for(ch(i)&&(i=i.host);Ht(i)&&["html","body"].indexOf(En(i))<0;){var o=Hn(i);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||e&&o.willChange==="filter"||e&&o.filter&&o.filter!=="none")return i;i=i.parentNode}return null}function Ps(t){for(var e=Nt(t),n=eg(t);n&&JI(n)&&Hn(n).position==="static";)n=eg(n);return n&&(En(n)==="html"||En(n)==="body"&&Hn(n).position==="static")?e:n||XI(t)||e}function ph(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Ko(t,e,n){return Qr(t,yl(e,n))}function YI(t,e,n){var r=Ko(t,e,n);return r>n?n:r}function M0(){return{top:0,right:0,bottom:0,left:0}}function _0(t){return Object.assign({},M0(),t)}function D0(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var ZI=function(t,e){return t=typeof t=="function"?t(Object.assign({},e.rects,{placement:e.placement})):t,_0(typeof t!="number"?t:D0(t,Rs))};function QI(t){var e,n=t.state,r=t.name,i=t.options,o=n.elements.arrow,s=n.modifiersData.popperOffsets,a=yn(n.placement),l=ph(a),u=[wt,Ut].indexOf(a)>=0,c=u?"height":"width";if(!(!o||!s)){var d=ZI(i.padding,n),h=dh(o),p=l==="y"?kt:wt,f=l==="y"?Wt:Ut,m=n.rects.reference[c]+n.rects.reference[l]-s[l]-n.rects.popper[c],g=s[l]-n.rects.reference[l],y=Ps(o),b=y?l==="y"?y.clientHeight||0:y.clientWidth||0:0,k=m/2-g/2,v=d[p],w=b-h[c]-d[f],x=b/2-h[c]/2+k,T=Ko(v,x,w),F=l;n.modifiersData[r]=(e={},e[F]=T,e.centerOffset=T-x,e)}}function eR(t){var e=t.state,n=t.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||A0(e.elements.popper,i)&&(e.elements.arrow=i))}const tR={name:"arrow",enabled:!0,phase:"main",fn:QI,effect:eR,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function oo(t){return t.split("-")[1]}var nR={top:"auto",right:"auto",bottom:"auto",left:"auto"};function rR(t,e){var n=t.x,r=t.y,i=e.devicePixelRatio||1;return{x:ro(n*i)/i||0,y:ro(r*i)/i||0}}function tg(t){var e,n=t.popper,r=t.popperRect,i=t.placement,o=t.variation,s=t.offsets,a=t.position,l=t.gpuAcceleration,u=t.adaptive,c=t.roundOffsets,d=t.isFixed,h=s.x,p=h===void 0?0:h,f=s.y,m=f===void 0?0:f,g=typeof c=="function"?c({x:p,y:m}):{x:p,y:m};p=g.x,m=g.y;var y=s.hasOwnProperty("x"),b=s.hasOwnProperty("y"),k=wt,v=kt,w=window;if(u){var x=Ps(n),T="clientHeight",F="clientWidth";if(x===Nt(n)&&(x=Ar(n),Hn(x).position!=="static"&&a==="absolute"&&(T="scrollHeight",F="scrollWidth")),x=x,i===kt||(i===wt||i===Ut)&&o===ks){v=Wt;var D=d&&x===w&&w.visualViewport?w.visualViewport.height:x[T];m-=D-r.height,m*=l?1:-1}if(i===wt||(i===kt||i===Wt)&&o===ks){k=Ut;var C=d&&x===w&&w.visualViewport?w.visualViewport.width:x[F];p-=C-r.width,p*=l?1:-1}}var _=Object.assign({position:a},u&&nR),L=c===!0?rR({x:p,y:m},Nt(n)):{x:p,y:m};if(p=L.x,m=L.y,l){var W;return Object.assign({},_,(W={},W[v]=b?"0":"",W[k]=y?"0":"",W.transform=(w.devicePixelRatio||1)<=1?"translate("+p+"px, "+m+"px)":"translate3d("+p+"px, "+m+"px, 0)",W))}return Object.assign({},_,(e={},e[v]=b?m+"px":"",e[k]=y?p+"px":"",e.transform="",e))}function iR(t){var e=t.state,n=t.options,r=n.gpuAcceleration,i=r===void 0?!0:r,o=n.adaptive,s=o===void 0?!0:o,a=n.roundOffsets,l=a===void 0?!0:a,u={placement:yn(e.placement),variation:oo(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,tg(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,tg(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const oR={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:iR,data:{}};var fa={passive:!0};function sR(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,o=i===void 0?!0:i,s=r.resize,a=s===void 0?!0:s,l=Nt(e.elements.popper),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&u.forEach(function(c){c.addEventListener("scroll",n.update,fa)}),a&&l.addEventListener("resize",n.update,fa),function(){o&&u.forEach(function(c){c.removeEventListener("scroll",n.update,fa)}),a&&l.removeEventListener("resize",n.update,fa)}}const aR={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:sR,data:{}};var lR={left:"right",right:"left",bottom:"top",top:"bottom"};function Pa(t){return t.replace(/left|right|bottom|top/g,function(e){return lR[e]})}var uR={start:"end",end:"start"};function ng(t){return t.replace(/start|end/g,function(e){return uR[e]})}function hh(t){var e=Nt(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function fh(t){return io(Ar(t)).left+hh(t).scrollLeft}function cR(t,e){var n=Nt(t),r=Ar(t),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;var u=O0();(u||!u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a+fh(t),y:l}}function dR(t){var e,n=Ar(t),r=hh(t),i=(e=t.ownerDocument)==null?void 0:e.body,o=Qr(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=Qr(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+fh(t),l=-r.scrollTop;return Hn(i||n).direction==="rtl"&&(a+=Qr(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:s,x:a,y:l}}function mh(t){var e=Hn(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function N0(t){return["html","body","#document"].indexOf(En(t))>=0?t.ownerDocument.body:Ht(t)&&mh(t)?t:N0(Nu(t))}function Go(t,e){var n;e===void 0&&(e=[]);var r=N0(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),o=Nt(r),s=i?[o].concat(o.visualViewport||[],mh(r)?r:[]):r,a=e.concat(s);return i?a:a.concat(Go(Nu(s)))}function Ld(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function pR(t,e){var n=io(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function rg(t,e,n){return e===C0?Ld(cR(t,n)):ui(e)?pR(e,n):Ld(dR(Ar(t)))}function hR(t){var e=Go(Nu(t)),n=["absolute","fixed"].indexOf(Hn(t).position)>=0,r=n&&Ht(t)?Ps(t):t;return ui(r)?e.filter(function(i){return ui(i)&&A0(i,r)&&En(i)!=="body"}):[]}function fR(t,e,n,r){var i=e==="clippingParents"?hR(t):[].concat(e),o=[].concat(i,[n]),s=o[0],a=o.reduce(function(l,u){var c=rg(t,u,r);return l.top=Qr(c.top,l.top),l.right=yl(c.right,l.right),l.bottom=yl(c.bottom,l.bottom),l.left=Qr(c.left,l.left),l},rg(t,s,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function I0(t){var e=t.reference,n=t.element,r=t.placement,i=r?yn(r):null,o=r?oo(r):null,s=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,l;switch(i){case kt:l={x:s,y:e.y-n.height};break;case Wt:l={x:s,y:e.y+e.height};break;case Ut:l={x:e.x+e.width,y:a};break;case wt:l={x:e.x-n.width,y:a};break;default:l={x:e.x,y:e.y}}var u=i?ph(i):null;if(u!=null){var c=u==="y"?"height":"width";switch(o){case no:l[u]=l[u]-(e[c]/2-n[c]/2);break;case ks:l[u]=l[u]+(e[c]/2-n[c]/2);break}}return l}function ws(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=r===void 0?t.placement:r,o=n.strategy,s=o===void 0?t.strategy:o,a=n.boundary,l=a===void 0?PI:a,u=n.rootBoundary,c=u===void 0?C0:u,d=n.elementContext,h=d===void 0?xo:d,p=n.altBoundary,f=p===void 0?!1:p,m=n.padding,g=m===void 0?0:m,y=_0(typeof g!="number"?g:D0(g,Rs)),b=h===xo?FI:xo,k=t.rects.popper,v=t.elements[f?b:h],w=fR(ui(v)?v:v.contextElement||Ar(t.elements.popper),l,c,s),x=io(t.elements.reference),T=I0({reference:x,element:k,placement:i}),F=Ld(Object.assign({},k,T)),D=h===xo?F:x,C={top:w.top-D.top+y.top,bottom:D.bottom-w.bottom+y.bottom,left:w.left-D.left+y.left,right:D.right-w.right+y.right},_=t.modifiersData.offset;if(h===xo&&_){var L=_[i];Object.keys(C).forEach(function(W){var q=[Ut,Wt].indexOf(W)>=0?1:-1,K=[kt,Wt].indexOf(W)>=0?"y":"x";C[W]+=L[K]*q})}return C}function mR(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=n.boundary,o=n.rootBoundary,s=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?S0:l,c=oo(r),d=c?a?Qm:Qm.filter(function(f){return oo(f)===c}):Rs,h=d.filter(function(f){return u.indexOf(f)>=0});h.length===0&&(h=d);var p=h.reduce(function(f,m){return f[m]=ws(t,{placement:m,boundary:i,rootBoundary:o,padding:s})[yn(m)],f},{});return Object.keys(p).sort(function(f,m){return p[f]-p[m]})}function gR(t){if(yn(t)===uh)return[];var e=Pa(t);return[ng(t),e,ng(e)]}function vR(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,a=s===void 0?!0:s,l=n.fallbackPlacements,u=n.padding,c=n.boundary,d=n.rootBoundary,h=n.altBoundary,p=n.flipVariations,f=p===void 0?!0:p,m=n.allowedAutoPlacements,g=e.options.placement,y=yn(g),b=y===g,k=l||(b||!f?[Pa(g)]:gR(g)),v=[g].concat(k).reduce(function(sn,It){return sn.concat(yn(It)===uh?mR(e,{placement:It,boundary:c,rootBoundary:d,padding:u,flipVariations:f,allowedAutoPlacements:m}):It)},[]),w=e.rects.reference,x=e.rects.popper,T=new Map,F=!0,D=v[0],C=0;C<v.length;C++){var _=v[C],L=yn(_),W=oo(_)===no,q=[kt,Wt].indexOf(L)>=0,K=q?"width":"height",J=ws(e,{placement:_,boundary:c,rootBoundary:d,altBoundary:h,padding:u}),ue=q?W?Ut:wt:W?Wt:kt;w[K]>x[K]&&(ue=Pa(ue));var ge=Pa(ue),Te=[];if(o&&Te.push(J[L]<=0),a&&Te.push(J[ue]<=0,J[ge]<=0),Te.every(function(sn){return sn})){D=_,F=!1;break}T.set(_,Te)}if(F)for(var mt=f?3:1,Mr=function(sn){var It=v.find(function(Kn){var Dr=T.get(Kn);if(Dr)return Dr.slice(0,sn).every(function(Gn){return Gn})});if(It)return D=It,"break"},on=mt;on>0;on--){var _r=Mr(on);if(_r==="break")break}e.placement!==D&&(e.modifiersData[r]._skip=!0,e.placement=D,e.reset=!0)}}const yR={name:"flip",enabled:!0,phase:"main",fn:vR,requiresIfExists:["offset"],data:{_skip:!1}};function ig(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function og(t){return[kt,Ut,Wt,wt].some(function(e){return t[e]>=0})}function bR(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,s=ws(e,{elementContext:"reference"}),a=ws(e,{altBoundary:!0}),l=ig(s,r),u=ig(a,i,o),c=og(l),d=og(u);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:c,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":d})}const kR={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:bR};function wR(t,e,n){var r=yn(t),i=[wt,kt].indexOf(r)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,s=o[0],a=o[1];return s=s||0,a=(a||0)*i,[wt,Ut].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}function xR(t){var e=t.state,n=t.options,r=t.name,i=n.offset,o=i===void 0?[0,0]:i,s=S0.reduce(function(c,d){return c[d]=wR(d,e.rects,o),c},{}),a=s[e.placement],l=a.x,u=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=u),e.modifiersData[r]=s}const ER={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:xR};function CR(t){var e=t.state,n=t.name;e.modifiersData[n]=I0({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const SR={name:"popperOffsets",enabled:!0,phase:"read",fn:CR,data:{}};function TR(t){return t==="x"?"y":"x"}function OR(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,a=s===void 0?!1:s,l=n.boundary,u=n.rootBoundary,c=n.altBoundary,d=n.padding,h=n.tether,p=h===void 0?!0:h,f=n.tetherOffset,m=f===void 0?0:f,g=ws(e,{boundary:l,rootBoundary:u,padding:d,altBoundary:c}),y=yn(e.placement),b=oo(e.placement),k=!b,v=ph(y),w=TR(v),x=e.modifiersData.popperOffsets,T=e.rects.reference,F=e.rects.popper,D=typeof m=="function"?m(Object.assign({},e.rects,{placement:e.placement})):m,C=typeof D=="number"?{mainAxis:D,altAxis:D}:Object.assign({mainAxis:0,altAxis:0},D),_=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,L={x:0,y:0};if(x){if(o){var W,q=v==="y"?kt:wt,K=v==="y"?Wt:Ut,J=v==="y"?"height":"width",ue=x[v],ge=ue+g[q],Te=ue-g[K],mt=p?-F[J]/2:0,Mr=b===no?T[J]:F[J],on=b===no?-F[J]:-T[J],_r=e.elements.arrow,sn=p&&_r?dh(_r):{width:0,height:0},It=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:M0(),Kn=It[q],Dr=It[K],Gn=Ko(0,T[J],sn[J]),Fs=k?T[J]/2-mt-Gn-Kn-C.mainAxis:Mr-Gn-Kn-C.mainAxis,Jn=k?-T[J]/2+mt+Gn+Dr+C.mainAxis:on+Gn+Dr+C.mainAxis,gi=e.elements.arrow&&Ps(e.elements.arrow),Ls=gi?v==="y"?gi.clientTop||0:gi.clientLeft||0:0,po=(W=_?.[v])!=null?W:0,Vs=ue+Fs-po-Ls,Bs=ue+Jn-po,ho=Ko(p?yl(ge,Vs):ge,ue,p?Qr(Te,Bs):Te);x[v]=ho,L[v]=ho-ue}if(a){var fo,$s=v==="x"?kt:wt,js=v==="x"?Wt:Ut,Tn=x[w],Xn=w==="y"?"height":"width",mo=Tn+g[$s],Nr=Tn-g[js],go=[kt,wt].indexOf(y)!==-1,zs=(fo=_?.[w])!=null?fo:0,Hs=go?mo:Tn-T[Xn]-F[Xn]-zs+C.altAxis,qs=go?Tn+T[Xn]+F[Xn]-zs-C.altAxis:Nr,Ws=p&&go?YI(Hs,Tn,qs):Ko(p?Hs:mo,Tn,p?qs:Nr);x[w]=Ws,L[w]=Ws-Tn}e.modifiersData[r]=L}}const AR={name:"preventOverflow",enabled:!0,phase:"main",fn:OR,requiresIfExists:["offset"]};function MR(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function _R(t){return t===Nt(t)||!Ht(t)?hh(t):MR(t)}function DR(t){var e=t.getBoundingClientRect(),n=ro(e.width)/t.offsetWidth||1,r=ro(e.height)/t.offsetHeight||1;return n!==1||r!==1}function NR(t,e,n){n===void 0&&(n=!1);var r=Ht(e),i=Ht(e)&&DR(e),o=Ar(e),s=io(t,i,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((En(e)!=="body"||mh(o))&&(a=_R(e)),Ht(e)?(l=io(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):o&&(l.x=fh(o))),{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function IR(t){var e=new Map,n=new Set,r=[];t.forEach(function(o){e.set(o.name,o)});function i(o){n.add(o.name);var s=[].concat(o.requires||[],o.requiresIfExists||[]);s.forEach(function(a){if(!n.has(a)){var l=e.get(a);l&&i(l)}}),r.push(o)}return t.forEach(function(o){n.has(o.name)||i(o)}),r}function RR(t){var e=IR(t);return UI.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function PR(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function FR(t){var e=t.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var sg={placement:"bottom",modifiers:[],strategy:"absolute"};function ag(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function LR(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,i=e.defaultOptions,o=i===void 0?sg:i;return function(s,a,l){l===void 0&&(l=o);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},sg,o),modifiersData:{},elements:{reference:s,popper:a},attributes:{},styles:{}},c=[],d=!1,h={state:u,setOptions:function(m){var g=typeof m=="function"?m(u.options):m;f(),u.options=Object.assign({},o,u.options,g),u.scrollParents={reference:ui(s)?Go(s):s.contextElement?Go(s.contextElement):[],popper:Go(a)};var y=RR(FR([].concat(r,u.options.modifiers)));return u.orderedModifiers=y.filter(function(b){return b.enabled}),p(),h.update()},forceUpdate:function(){if(!d){var m=u.elements,g=m.reference,y=m.popper;if(ag(g,y)){u.rects={reference:NR(g,Ps(y),u.options.strategy==="fixed"),popper:dh(y)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(F){return u.modifiersData[F.name]=Object.assign({},F.data)});for(var b=0;b<u.orderedModifiers.length;b++){if(u.reset===!0){u.reset=!1,b=-1;continue}var k=u.orderedModifiers[b],v=k.fn,w=k.options,x=w===void 0?{}:w,T=k.name;typeof v=="function"&&(u=v({state:u,options:x,name:T,instance:h})||u)}}}},update:PR(function(){return new Promise(function(m){h.forceUpdate(),m(u)})}),destroy:function(){f(),d=!0}};if(!ag(s,a))return h;h.setOptions(l).then(function(m){!d&&l.onFirstUpdate&&l.onFirstUpdate(m)});function p(){u.orderedModifiers.forEach(function(m){var g=m.name,y=m.options,b=y===void 0?{}:y,k=m.effect;if(typeof k=="function"){var v=k({state:u,name:g,instance:h,options:b}),w=function(){};c.push(v||w)}})}function f(){c.forEach(function(m){return m()}),c=[]}return h}}var VR=[aR,SR,oR,T0,ER,yR,AR,tR,kR],BR=LR({defaultModifiers:VR}),$R="tippy-box",R0="tippy-content",jR="tippy-backdrop",P0="tippy-arrow",F0="tippy-svg-arrow",jr={passive:!0,capture:!0},L0=function(){return document.body};function Cc(t,e,n){if(Array.isArray(t)){var r=t[e];return r??(Array.isArray(n)?n[e]:n)}return t}function gh(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function V0(t,e){return typeof t=="function"?t.apply(void 0,e):t}function lg(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function zR(t){return t.split(/\s+/).filter(Boolean)}function Mi(t){return[].concat(t)}function ug(t,e){t.indexOf(e)===-1&&t.push(e)}function HR(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function qR(t){return t.split("-")[0]}function bl(t){return[].slice.call(t)}function cg(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function Jo(){return document.createElement("div")}function Iu(t){return["Element","Fragment"].some(function(e){return gh(t,e)})}function WR(t){return gh(t,"NodeList")}function UR(t){return gh(t,"MouseEvent")}function KR(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function GR(t){return Iu(t)?[t]:WR(t)?bl(t):Array.isArray(t)?t:bl(document.querySelectorAll(t))}function Sc(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function dg(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function JR(t){var e,n=Mi(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function XR(t,e){var n=e.clientX,r=e.clientY;return t.every(function(i){var o=i.popperRect,s=i.popperState,a=i.props,l=a.interactiveBorder,u=qR(s.placement),c=s.modifiersData.offset;if(!c)return!0;var d=u==="bottom"?c.top.y:0,h=u==="top"?c.bottom.y:0,p=u==="right"?c.left.x:0,f=u==="left"?c.right.x:0,m=o.top-r+d>l,g=r-o.bottom-h>l,y=o.left-n+p>l,b=n-o.right-f>l;return m||g||y||b})}function Tc(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){t[r](i,n)})}function pg(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var hn={isTouch:!1},hg=0;function YR(){hn.isTouch||(hn.isTouch=!0,window.performance&&document.addEventListener("mousemove",B0))}function B0(){var t=performance.now();t-hg<20&&(hn.isTouch=!1,document.removeEventListener("mousemove",B0)),hg=t}function ZR(){var t=document.activeElement;if(KR(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function QR(){document.addEventListener("touchstart",YR,jr),window.addEventListener("blur",ZR)}var eP=typeof window<"u"&&typeof document<"u",tP=eP?!!window.msCrypto:!1,nP={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},rP={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Zt=Object.assign({appendTo:L0,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},nP,rP),iP=Object.keys(Zt),oP=function(t){var e=Object.keys(t);e.forEach(function(n){Zt[n]=t[n]})};function $0(t){var e=t.plugins||[],n=e.reduce(function(r,i){var o=i.name,s=i.defaultValue;if(o){var a;r[o]=t[o]!==void 0?t[o]:(a=Zt[o])!=null?a:s}return r},{});return Object.assign({},t,n)}function sP(t,e){var n=e?Object.keys($0(Object.assign({},Zt,{plugins:e}))):iP,r=n.reduce(function(i,o){var s=(t.getAttribute("data-tippy-"+o)||"").trim();if(!s)return i;if(o==="content")i[o]=s;else try{i[o]=JSON.parse(s)}catch{i[o]=s}return i},{});return r}function fg(t,e){var n=Object.assign({},e,{content:V0(e.content,[t])},e.ignoreAttributes?{}:sP(t,e.plugins));return n.aria=Object.assign({},Zt.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}var aP=function(){return"innerHTML"};function Vd(t,e){t[aP()]=e}function mg(t){var e=Jo();return t===!0?e.className=P0:(e.className=F0,Iu(t)?e.appendChild(t):Vd(e,t)),e}function gg(t,e){Iu(e.content)?(Vd(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Vd(t,e.content):t.textContent=e.content)}function Bd(t){var e=t.firstElementChild,n=bl(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(R0)}),arrow:n.find(function(r){return r.classList.contains(P0)||r.classList.contains(F0)}),backdrop:n.find(function(r){return r.classList.contains(jR)})}}function j0(t){var e=Jo(),n=Jo();n.className=$R,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=Jo();r.className=R0,r.setAttribute("data-state","hidden"),gg(r,t.props),e.appendChild(n),n.appendChild(r),i(t.props,t.props);function i(o,s){var a=Bd(e),l=a.box,u=a.content,c=a.arrow;s.theme?l.setAttribute("data-theme",s.theme):l.removeAttribute("data-theme"),typeof s.animation=="string"?l.setAttribute("data-animation",s.animation):l.removeAttribute("data-animation"),s.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?l.setAttribute("role",s.role):l.removeAttribute("role"),(o.content!==s.content||o.allowHTML!==s.allowHTML)&&gg(u,t.props),s.arrow?c?o.arrow!==s.arrow&&(l.removeChild(c),l.appendChild(mg(s.arrow))):l.appendChild(mg(s.arrow)):c&&l.removeChild(c)}return{popper:e,onUpdate:i}}j0.$$tippy=!0;var lP=1,ma=[],Oc=[];function uP(t,e){var n=fg(t,Object.assign({},Zt,$0(cg(e)))),r,i,o,s=!1,a=!1,l=!1,u=!1,c,d,h,p=[],f=lg(Vs,n.interactiveDebounce),m,g=lP++,y=null,b=HR(n.plugins),k={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:g,reference:t,popper:Jo(),popperInstance:y,props:n,state:k,plugins:b,clearDelayTimeouts:Hs,setProps:qs,setContent:Ws,show:lk,hide:uk,hideWithInteractivity:ck,enable:go,disable:zs,unmount:dk,destroy:pk};if(!n.render)return v;var w=n.render(v),x=w.popper,T=w.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+v.id,v.popper=x,t._tippy=v,x._tippy=v;var F=b.map(function(S){return S.fn(v)}),D=t.hasAttribute("aria-expanded");return gi(),mt(),ue(),ge("onCreate",[v]),n.showOnCreate&&mo(),x.addEventListener("mouseenter",function(){v.props.interactive&&v.state.isVisible&&v.clearDelayTimeouts()}),x.addEventListener("mouseleave",function(){v.props.interactive&&v.props.trigger.indexOf("mouseenter")>=0&&q().addEventListener("mousemove",f)}),v;function C(){var S=v.props.touch;return Array.isArray(S)?S:[S,0]}function _(){return C()[0]==="hold"}function L(){var S;return!!((S=v.props.render)!=null&&S.$$tippy)}function W(){return m||t}function q(){var S=W().parentNode;return S?JR(S):document}function K(){return Bd(x)}function J(S){return v.state.isMounted&&!v.state.isVisible||hn.isTouch||c&&c.type==="focus"?0:Cc(v.props.delay,S?0:1,Zt.delay)}function ue(S){S===void 0&&(S=!1),x.style.pointerEvents=v.props.interactive&&!S?"":"none",x.style.zIndex=""+v.props.zIndex}function ge(S,z,re){if(re===void 0&&(re=!0),F.forEach(function(fe){fe[S]&&fe[S].apply(fe,z)}),re){var ye;(ye=v.props)[S].apply(ye,z)}}function Te(){var S=v.props.aria;if(S.content){var z="aria-"+S.content,re=x.id,ye=Mi(v.props.triggerTarget||t);ye.forEach(function(fe){var lt=fe.getAttribute(z);if(v.state.isVisible)fe.setAttribute(z,lt?lt+" "+re:re);else{var Rt=lt&&lt.replace(re,"").trim();Rt?fe.setAttribute(z,Rt):fe.removeAttribute(z)}})}}function mt(){if(!(D||!v.props.aria.expanded)){var S=Mi(v.props.triggerTarget||t);S.forEach(function(z){v.props.interactive?z.setAttribute("aria-expanded",v.state.isVisible&&z===W()?"true":"false"):z.removeAttribute("aria-expanded")})}}function Mr(){q().removeEventListener("mousemove",f),ma=ma.filter(function(S){return S!==f})}function on(S){if(!(hn.isTouch&&(l||S.type==="mousedown"))){var z=S.composedPath&&S.composedPath()[0]||S.target;if(!(v.props.interactive&&pg(x,z))){if(Mi(v.props.triggerTarget||t).some(function(re){return pg(re,z)})){if(hn.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else ge("onClickOutside",[v,S]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),a=!0,setTimeout(function(){a=!1}),v.state.isMounted||Kn())}}}function _r(){l=!0}function sn(){l=!1}function It(){var S=q();S.addEventListener("mousedown",on,!0),S.addEventListener("touchend",on,jr),S.addEventListener("touchstart",sn,jr),S.addEventListener("touchmove",_r,jr)}function Kn(){var S=q();S.removeEventListener("mousedown",on,!0),S.removeEventListener("touchend",on,jr),S.removeEventListener("touchstart",sn,jr),S.removeEventListener("touchmove",_r,jr)}function Dr(S,z){Fs(S,function(){!v.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&z()})}function Gn(S,z){Fs(S,z)}function Fs(S,z){var re=K().box;function ye(fe){fe.target===re&&(Tc(re,"remove",ye),z())}if(S===0)return z();Tc(re,"remove",d),Tc(re,"add",ye),d=ye}function Jn(S,z,re){re===void 0&&(re=!1);var ye=Mi(v.props.triggerTarget||t);ye.forEach(function(fe){fe.addEventListener(S,z,re),p.push({node:fe,eventType:S,handler:z,options:re})})}function gi(){_()&&(Jn("touchstart",po,{passive:!0}),Jn("touchend",Bs,{passive:!0})),zR(v.props.trigger).forEach(function(S){if(S!=="manual")switch(Jn(S,po),S){case"mouseenter":Jn("mouseleave",Bs);break;case"focus":Jn(tP?"focusout":"blur",ho);break;case"focusin":Jn("focusout",ho);break}})}function Ls(){p.forEach(function(S){var z=S.node,re=S.eventType,ye=S.handler,fe=S.options;z.removeEventListener(re,ye,fe)}),p=[]}function po(S){var z,re=!1;if(!(!v.state.isEnabled||fo(S)||a)){var ye=((z=c)==null?void 0:z.type)==="focus";c=S,m=S.currentTarget,mt(),!v.state.isVisible&&UR(S)&&ma.forEach(function(fe){return fe(S)}),S.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||s)&&v.props.hideOnClick!==!1&&v.state.isVisible?re=!0:mo(S),S.type==="click"&&(s=!re),re&&!ye&&Nr(S)}}function Vs(S){var z=S.target,re=W().contains(z)||x.contains(z);if(!(S.type==="mousemove"&&re)){var ye=Xn().concat(x).map(function(fe){var lt,Rt=fe._tippy,vi=(lt=Rt.popperInstance)==null?void 0:lt.state;return vi?{popperRect:fe.getBoundingClientRect(),popperState:vi,props:n}:null}).filter(Boolean);XR(ye,S)&&(Mr(),Nr(S))}}function Bs(S){var z=fo(S)||v.props.trigger.indexOf("click")>=0&&s;if(!z){if(v.props.interactive){v.hideWithInteractivity(S);return}Nr(S)}}function ho(S){v.props.trigger.indexOf("focusin")<0&&S.target!==W()||v.props.interactive&&S.relatedTarget&&x.contains(S.relatedTarget)||Nr(S)}function fo(S){return hn.isTouch?_()!==S.type.indexOf("touch")>=0:!1}function $s(){js();var S=v.props,z=S.popperOptions,re=S.placement,ye=S.offset,fe=S.getReferenceClientRect,lt=S.moveTransition,Rt=L()?Bd(x).arrow:null,vi=fe?{getBoundingClientRect:fe,contextElement:fe.contextElement||W()}:t,Us={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Ks){var yi=Ks.state;if(L()){var hk=K(),Pu=hk.box;["placement","reference-hidden","escaped"].forEach(function(Gs){Gs==="placement"?Pu.setAttribute("data-placement",yi.placement):yi.attributes.popper["data-popper-"+Gs]?Pu.setAttribute("data-"+Gs,""):Pu.removeAttribute("data-"+Gs)}),yi.attributes.popper={}}}},Ir=[{name:"offset",options:{offset:ye}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!lt}},Us];L()&&Rt&&Ir.push({name:"arrow",options:{element:Rt,padding:3}}),Ir.push.apply(Ir,z?.modifiers||[]),v.popperInstance=BR(vi,x,Object.assign({},z,{placement:re,onFirstUpdate:h,modifiers:Ir}))}function js(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function Tn(){var S=v.props.appendTo,z,re=W();v.props.interactive&&S===L0||S==="parent"?z=re.parentNode:z=V0(S,[re]),z.contains(x)||z.appendChild(x),v.state.isMounted=!0,$s()}function Xn(){return bl(x.querySelectorAll("[data-tippy-root]"))}function mo(S){v.clearDelayTimeouts(),S&&ge("onTrigger",[v,S]),It();var z=J(!0),re=C(),ye=re[0],fe=re[1];hn.isTouch&&ye==="hold"&&fe&&(z=fe),z?r=setTimeout(function(){v.show()},z):v.show()}function Nr(S){if(v.clearDelayTimeouts(),ge("onUntrigger",[v,S]),!v.state.isVisible){Kn();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(S.type)>=0&&s)){var z=J(!1);z?i=setTimeout(function(){v.state.isVisible&&v.hide()},z):o=requestAnimationFrame(function(){v.hide()})}}function go(){v.state.isEnabled=!0}function zs(){v.hide(),v.state.isEnabled=!1}function Hs(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(o)}function qs(S){if(!v.state.isDestroyed){ge("onBeforeUpdate",[v,S]),Ls();var z=v.props,re=fg(t,Object.assign({},z,cg(S),{ignoreAttributes:!0}));v.props=re,gi(),z.interactiveDebounce!==re.interactiveDebounce&&(Mr(),f=lg(Vs,re.interactiveDebounce)),z.triggerTarget&&!re.triggerTarget?Mi(z.triggerTarget).forEach(function(ye){ye.removeAttribute("aria-expanded")}):re.triggerTarget&&t.removeAttribute("aria-expanded"),mt(),ue(),T&&T(z,re),v.popperInstance&&($s(),Xn().forEach(function(ye){requestAnimationFrame(ye._tippy.popperInstance.forceUpdate)})),ge("onAfterUpdate",[v,S])}}function Ws(S){v.setProps({content:S})}function lk(){var S=v.state.isVisible,z=v.state.isDestroyed,re=!v.state.isEnabled,ye=hn.isTouch&&!v.props.touch,fe=Cc(v.props.duration,0,Zt.duration);if(!(S||z||re||ye)&&!W().hasAttribute("disabled")&&(ge("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,L()&&(x.style.visibility="visible"),ue(),It(),v.state.isMounted||(x.style.transition="none"),L()){var lt=K(),Rt=lt.box,vi=lt.content;Sc([Rt,vi],0)}h=function(){var Us;if(!(!v.state.isVisible||u)){if(u=!0,x.offsetHeight,x.style.transition=v.props.moveTransition,L()&&v.props.animation){var Ir=K(),Ks=Ir.box,yi=Ir.content;Sc([Ks,yi],fe),dg([Ks,yi],"visible")}Te(),mt(),ug(Oc,v),(Us=v.popperInstance)==null||Us.forceUpdate(),ge("onMount",[v]),v.props.animation&&L()&&Gn(fe,function(){v.state.isShown=!0,ge("onShown",[v])})}},Tn()}}function uk(){var S=!v.state.isVisible,z=v.state.isDestroyed,re=!v.state.isEnabled,ye=Cc(v.props.duration,1,Zt.duration);if(!(S||z||re)&&(ge("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,u=!1,s=!1,L()&&(x.style.visibility="hidden"),Mr(),Kn(),ue(!0),L()){var fe=K(),lt=fe.box,Rt=fe.content;v.props.animation&&(Sc([lt,Rt],ye),dg([lt,Rt],"hidden"))}Te(),mt(),v.props.animation?L()&&Dr(ye,v.unmount):v.unmount()}}function ck(S){q().addEventListener("mousemove",f),ug(ma,f),f(S)}function dk(){v.state.isVisible&&v.hide(),v.state.isMounted&&(js(),Xn().forEach(function(S){S._tippy.unmount()}),x.parentNode&&x.parentNode.removeChild(x),Oc=Oc.filter(function(S){return S!==v}),v.state.isMounted=!1,ge("onHidden",[v]))}function pk(){!v.state.isDestroyed&&(v.clearDelayTimeouts(),v.unmount(),Ls(),delete t._tippy,v.state.isDestroyed=!0,ge("onDestroy",[v]))}}function co(t,e){e===void 0&&(e={});var n=Zt.plugins.concat(e.plugins||[]);QR();var r=Object.assign({},e,{plugins:n}),i=GR(t),o=i.reduce(function(s,a){var l=a&&uP(a,r);return l&&s.push(l),s},[]);return Iu(t)?o[0]:o}co.defaultProps=Zt;co.setDefaultProps=oP;co.currentInput=hn;Object.assign({},T0,{effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow)}});co.setDefaultProps({render:j0});class cP{constructor({editor:e,element:n,view:r,tippyOptions:i={},updateDelay:o=250,shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:a,state:l,from:u,to:c})=>{const{doc:d,selection:h}=l,{empty:p}=h,f=!d.textBetween(u,c).length&&oh(l.selection),m=this.element.contains(document.activeElement);return!(!(a.hasFocus()||m)||p||f||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:a})=>{var l;if(this.preventHide){this.preventHide=!1;return}a!=null&&a.relatedTarget&&!((l=this.element.parentNode)===null||l===void 0)&&l.contains(a.relatedTarget)||a?.relatedTarget!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=a=>{this.blurHandler({event:a})},this.handleDebouncedUpdate=(a,l)=>{const u=!(l!=null&&l.selection.eq(a.state.selection)),c=!(l!=null&&l.doc.eq(a.state.doc));!u&&!c||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(a,u,c,l)},this.updateDelay))},this.updateHandler=(a,l,u,c)=>{var d,h,p;const{state:f,composing:m}=a,{selection:g}=f;if(m||!l&&!u)return;this.createTooltip();const{ranges:y}=g,b=Math.min(...y.map(v=>v.$from.pos)),k=Math.max(...y.map(v=>v.$to.pos));if(!(!((d=this.shouldShow)===null||d===void 0)&&d.call(this,{editor:this.editor,element:this.element,view:a,state:f,oldState:c,from:b,to:k}))){this.hide();return}(h=this.tippy)===null||h===void 0||h.setProps({getReferenceClientRect:((p=this.tippyOptions)===null||p===void 0?void 0:p.getReferenceClientRect)||(()=>{if(x0(f.selection)){let v=a.nodeDOM(b);if(v){const w=v.dataset.nodeViewWrapper?v:v.querySelector("[data-node-view-wrapper]");if(w&&(v=w.firstChild),v)return v.getBoundingClientRect()}}return E0(a,b,k)})}),this.show()},this.editor=e,this.element=n,this.view=r,this.updateDelay=o,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=co(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){const{state:r}=e,i=r.selection.from!==r.selection.to;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(e,n);return}const o=!(n!=null&&n.selection.eq(e.state.selection)),s=!(n!=null&&n.doc.eq(e.state.doc));this.updateHandler(e,o,s,n)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const dP=t=>new Ve({key:typeof t.pluginKey=="string"?new at(t.pluginKey):t.pluginKey,view:e=>new cP({view:e,...t})});Ke.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[dP({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class pP{getTextContent(e){return k0(e,{textSerializers:rh(this.editor.schema)})}constructor({editor:e,element:n,view:r,tippyOptions:i={},shouldShow:o}){this.preventHide=!1,this.shouldShow=({view:s,state:a})=>{const{selection:l}=a,{$anchor:u,empty:c}=l,d=u.depth===1,h=u.parent.isTextblock&&!u.parent.type.spec.code&&!u.parent.textContent&&u.parent.childCount===0&&!this.getTextContent(u.parent);return!(!s.hasFocus()||!c||!d||!h||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:s})=>{var a;if(this.preventHide){this.preventHide=!1;return}s!=null&&s.relatedTarget&&!((a=this.element.parentNode)===null||a===void 0)&&a.contains(s.relatedTarget)||s?.relatedTarget!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=s=>{this.blurHandler({event:s})},this.editor=e,this.element=n,this.view=r,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=co(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){var r,i,o;const{state:s}=e,{doc:a,selection:l}=s,{from:u,to:c}=l;if(!(n&&n.doc.eq(a)&&n.selection.eq(l))){if(this.createTooltip(),!(!((r=this.shouldShow)===null||r===void 0)&&r.call(this,{editor:this.editor,view:e,state:s,oldState:n}))){this.hide();return}(i=this.tippy)===null||i===void 0||i.setProps({getReferenceClientRect:((o=this.tippyOptions)===null||o===void 0?void 0:o.getReferenceClientRect)||(()=>E0(e,u,c))}),this.show()}}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const hP=t=>new Ve({key:typeof t.pluginKey=="string"?new at(t.pluginKey):t.pluginKey,view:e=>new pP({view:e,...t})});Ke.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[hP({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});function vg(t){return Qd((e,n)=>({get(){return e(),t},set(r){t=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class fP extends II{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=vg(this.view.state),this.reactiveExtensionStorage=vg(this.extensionStorage),this.on("beforeTransaction",({nextState:n})=>{this.reactiveState.value=n,this.reactiveExtensionStorage.value=this.extensionStorage}),ka(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,n){const r=super.registerPlugin(e,n);return this.reactiveState&&(this.reactiveState.value=r),r}unregisterPlugin(e){const n=super.unregisterPlugin(e);return this.reactiveState&&n&&(this.reactiveState.value=n),n}}const mP=te({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=X(),n=tp();return Rg(()=>{const r=t.editor;r&&r.options.element&&e.value&&kr(()=>{if(!e.value||!r.options.element.firstChild)return;const i=$(e.value);e.value.append(...r.options.element.childNodes),r.contentComponent=n.ctx._,n&&(r.appContext={...n.appContext,provides:n.provides}),r.setOptions({element:i}),r.createNodeViews()})}),ao(()=>{const r=t.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return ns("div",{ref:t=>{this.rootEl=t}})}}),gP=(t={})=>{const e=qt();return qn(()=>{e.value=new fP(t)}),ao(()=>{var n,r,i;const o=(n=e.value)===null||n===void 0?void 0:n.options.element,s=o?.cloneNode(!0);(r=o?.parentNode)===null||r===void 0||r.replaceChild(s,o),(i=e.value)===null||i===void 0||i.destroy()}),e},vP="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",yP="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",so=(t,e)=>{for(const n in e)t[n]=e[n];return t},$d="numeric",jd="ascii",zd="alpha",Xo="asciinumeric",Fo="alphanumeric",Hd="domain",z0="emoji",bP="scheme",kP="slashscheme",Ac="whitespace";function wP(t,e){return t in e||(e[t]=[]),e[t]}function Kr(t,e,n){e[$d]&&(e[Xo]=!0,e[Fo]=!0),e[jd]&&(e[Xo]=!0,e[zd]=!0),e[Xo]&&(e[Fo]=!0),e[zd]&&(e[Fo]=!0),e[Fo]&&(e[Hd]=!0),e[z0]&&(e[Hd]=!0);for(const r in e){const i=wP(r,n);i.indexOf(t)<0&&i.push(t)}}function xP(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function vt(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}vt.groups={};vt.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],o=e.jr[r][1];if(o&&i.test(t))return o}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||vt.groups;let i;return e&&e.j?i=e:(i=new vt(e),n&&r&&Kr(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const o=t.length;if(!o)return i;for(let s=0;s<o-1;s++)i=i.tt(t[s]);return i.tt(t[o-1],e,n,r)},tt(t,e,n,r){r=r||vt.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const o=e;let s,a=i.go(t);if(a?(s=new vt,so(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new vt,o){if(r)if(s.t&&typeof s.t=="string"){const l=so(xP(s.t,r),n);Kr(o,l,r)}else n&&Kr(o,n,r);s.t=o}return i.j[t]=s,s}};const ce=(t,e,n,r,i)=>t.ta(e,n,r,i),Oe=(t,e,n,r,i)=>t.tr(e,n,r,i),yg=(t,e,n,r,i)=>t.ts(e,n,r,i),M=(t,e,n,r,i)=>t.tt(e,n,r,i),Dn="WORD",qd="UWORD",H0="ASCIINUMERICAL",q0="ALPHANUMERICAL",xs="LOCALHOST",Wd="TLD",Ud="UTLD",Fa="SCHEME",_i="SLASH_SCHEME",vh="NUM",Kd="WS",yh="NL",Yo="OPENBRACE",Zo="CLOSEBRACE",kl="OPENBRACKET",wl="CLOSEBRACKET",xl="OPENPAREN",El="CLOSEPAREN",Cl="OPENANGLEBRACKET",Sl="CLOSEANGLEBRACKET",Tl="FULLWIDTHLEFTPAREN",Ol="FULLWIDTHRIGHTPAREN",Al="LEFTCORNERBRACKET",Ml="RIGHTCORNERBRACKET",_l="LEFTWHITECORNERBRACKET",Dl="RIGHTWHITECORNERBRACKET",Nl="FULLWIDTHLESSTHAN",Il="FULLWIDTHGREATERTHAN",Rl="AMPERSAND",bh="APOSTROPHE",Pl="ASTERISK",tr="AT",Fl="BACKSLASH",Ll="BACKTICK",Vl="CARET",or="COLON",kh="COMMA",Bl="DOLLAR",un="DOT",$l="EQUALS",wh="EXCLAMATION",Ft="HYPHEN",Qo="PERCENT",jl="PIPE",zl="PLUS",Hl="POUND",es="QUERY",xh="QUOTE",W0="FULLWIDTHMIDDLEDOT",Eh="SEMI",cn="SLASH",ts="TILDE",ql="UNDERSCORE",U0="EMOJI",Wl="SYM";var K0=Object.freeze({__proto__:null,WORD:Dn,UWORD:qd,ASCIINUMERICAL:H0,ALPHANUMERICAL:q0,LOCALHOST:xs,TLD:Wd,UTLD:Ud,SCHEME:Fa,SLASH_SCHEME:_i,NUM:vh,WS:Kd,NL:yh,OPENBRACE:Yo,CLOSEBRACE:Zo,OPENBRACKET:kl,CLOSEBRACKET:wl,OPENPAREN:xl,CLOSEPAREN:El,OPENANGLEBRACKET:Cl,CLOSEANGLEBRACKET:Sl,FULLWIDTHLEFTPAREN:Tl,FULLWIDTHRIGHTPAREN:Ol,LEFTCORNERBRACKET:Al,RIGHTCORNERBRACKET:Ml,LEFTWHITECORNERBRACKET:_l,RIGHTWHITECORNERBRACKET:Dl,FULLWIDTHLESSTHAN:Nl,FULLWIDTHGREATERTHAN:Il,AMPERSAND:Rl,APOSTROPHE:bh,ASTERISK:Pl,AT:tr,BACKSLASH:Fl,BACKTICK:Ll,CARET:Vl,COLON:or,COMMA:kh,DOLLAR:Bl,DOT:un,EQUALS:$l,EXCLAMATION:wh,HYPHEN:Ft,PERCENT:Qo,PIPE:jl,PLUS:zl,POUND:Hl,QUERY:es,QUOTE:xh,FULLWIDTHMIDDLEDOT:W0,SEMI:Eh,SLASH:cn,TILDE:ts,UNDERSCORE:ql,EMOJI:U0,SYM:Wl});const An=/[a-z]/,Eo=/\p{L}/u,Mc=/\p{Emoji}/u,Mn=/\d/,_c=/\s/,bg="\r",Dc=`
97
- `,EP="️",CP="‍",Nc="";let ga=null,va=null;function SP(t=[]){const e={};vt.groups=e;const n=new vt;ga==null&&(ga=kg(vP)),va==null&&(va=kg(yP)),M(n,"'",bh),M(n,"{",Yo),M(n,"}",Zo),M(n,"[",kl),M(n,"]",wl),M(n,"(",xl),M(n,")",El),M(n,"<",Cl),M(n,">",Sl),M(n,"(",Tl),M(n,")",Ol),M(n,"「",Al),M(n,"」",Ml),M(n,"『",_l),M(n,"』",Dl),M(n,"<",Nl),M(n,">",Il),M(n,"&",Rl),M(n,"*",Pl),M(n,"@",tr),M(n,"`",Ll),M(n,"^",Vl),M(n,":",or),M(n,",",kh),M(n,"$",Bl),M(n,".",un),M(n,"=",$l),M(n,"!",wh),M(n,"-",Ft),M(n,"%",Qo),M(n,"|",jl),M(n,"+",zl),M(n,"#",Hl),M(n,"?",es),M(n,'"',xh),M(n,"/",cn),M(n,";",Eh),M(n,"~",ts),M(n,"_",ql),M(n,"\\",Fl),M(n,"・",W0);const r=Oe(n,Mn,vh,{[$d]:!0});Oe(r,Mn,r);const i=Oe(r,An,H0,{[Xo]:!0}),o=Oe(r,Eo,q0,{[Fo]:!0}),s=Oe(n,An,Dn,{[jd]:!0});Oe(s,Mn,i),Oe(s,An,s),Oe(i,Mn,i),Oe(i,An,i);const a=Oe(n,Eo,qd,{[zd]:!0});Oe(a,An),Oe(a,Mn,o),Oe(a,Eo,a),Oe(o,Mn,o),Oe(o,An),Oe(o,Eo,o);const l=M(n,Dc,yh,{[Ac]:!0}),u=M(n,bg,Kd,{[Ac]:!0}),c=Oe(n,_c,Kd,{[Ac]:!0});M(n,Nc,c),M(u,Dc,l),M(u,Nc,c),Oe(u,_c,c),M(c,bg),M(c,Dc),Oe(c,_c,c),M(c,Nc,c);const d=Oe(n,Mc,U0,{[z0]:!0});M(d,"#"),Oe(d,Mc,d),M(d,EP,d);const h=M(d,CP);M(h,"#"),Oe(h,Mc,d);const p=[[An,s],[Mn,i]],f=[[An,null],[Eo,a],[Mn,o]];for(let m=0;m<ga.length;m++)Yn(n,ga[m],Wd,Dn,p);for(let m=0;m<va.length;m++)Yn(n,va[m],Ud,qd,f);Kr(Wd,{tld:!0,ascii:!0},e),Kr(Ud,{utld:!0,alpha:!0},e),Yn(n,"file",Fa,Dn,p),Yn(n,"mailto",Fa,Dn,p),Yn(n,"http",_i,Dn,p),Yn(n,"https",_i,Dn,p),Yn(n,"ftp",_i,Dn,p),Yn(n,"ftps",_i,Dn,p),Kr(Fa,{scheme:!0,ascii:!0},e),Kr(_i,{slashscheme:!0,ascii:!0},e),t=t.sort((m,g)=>m[0]>g[0]?1:-1);for(let m=0;m<t.length;m++){const g=t[m][0],y=t[m][1]?{[bP]:!0}:{[kP]:!0};g.indexOf("-")>=0?y[Hd]=!0:An.test(g)?Mn.test(g)?y[Xo]=!0:y[jd]=!0:y[$d]=!0,yg(n,g,g,y)}return yg(n,"localhost",xs,{ascii:!0}),n.jd=new vt(Wl),{start:n,tokens:so({groups:e},K0)}}function G0(t,e){const n=TP(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,i=[];let o=0,s=0;for(;s<r;){let a=t,l=null,u=0,c=null,d=-1,h=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(d=0,h=0,c=a):d>=0&&(d+=n[s].length,h++),u+=n[s].length,o+=n[s].length,s++;o-=d,s-=h,u-=d,i.push({t:c.t,v:e.slice(o-u,o),s:o-u,e:o})}return i}function TP(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),o,s=i<55296||i>56319||r+1===n||(o=t.charCodeAt(r+1))<56320||o>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function Yn(t,e,n,r,i){let o;const s=e.length;for(let a=0;a<s-1;a++){const l=e[a];t.j[l]?o=t.j[l]:(o=new vt(r),o.jr=i.slice(),t.j[l]=o),t=o}return o=new vt(n),o.jr=i.slice(),t.j[e[s-1]]=o,o}function kg(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let o=0;for(;i.indexOf(t[r+o])>=0;)o++;if(o>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+o),10);s>0;s--)n.pop();r+=o}else n.push(t[r]),r++}return e}const Es={defaultProtocol:"http",events:null,format:wg,formatHref:wg,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Ch(t,e=null){let n=so({},Es);t&&(n=so(n,t instanceof Ch?t.o:t));const r=n.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}Ch.prototype={o:Es,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:Es[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function wg(t){return t}function J0(t,e){this.t="token",this.v=t,this.tk=e}J0.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Es.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),o=this.toFormattedString(t),s={},a=t.get("className",n,e),l=t.get("target",n,e),u=t.get("rel",n,e),c=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return s.href=r,a&&(s.class=a),l&&(s.target=l),u&&(s.rel=u),c&&so(s,c),{tagName:i,attributes:s,content:o,eventListeners:d}}};function Ru(t,e){class n extends J0{constructor(i,o){super(i,o),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const xg=Ru("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Eg=Ru("text"),OP=Ru("nl"),ya=Ru("url",{isLink:!0,toHref(t=Es.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==xs&&t[1].t===or}}),Pt=t=>new vt(t);function AP({groups:t}){const e=t.domain.concat([Rl,Pl,tr,Fl,Ll,Vl,Bl,$l,Ft,vh,Qo,jl,zl,Hl,cn,Wl,ts,ql]),n=[or,kh,un,wh,Qo,es,xh,Eh,Cl,Sl,Yo,Zo,wl,kl,xl,El,Tl,Ol,Al,Ml,_l,Dl,Nl,Il],r=[Rl,bh,Pl,Fl,Ll,Vl,Bl,$l,Ft,Yo,Zo,Qo,jl,zl,Hl,es,cn,Wl,ts,ql],i=Pt(),o=M(i,ts);ce(o,r,o),ce(o,t.domain,o);const s=Pt(),a=Pt(),l=Pt();ce(i,t.domain,s),ce(i,t.scheme,a),ce(i,t.slashscheme,l),ce(s,r,o),ce(s,t.domain,s);const u=M(s,tr);M(o,tr,u),M(a,tr,u),M(l,tr,u);const c=M(o,un);ce(c,r,o),ce(c,t.domain,o);const d=Pt();ce(u,t.domain,d),ce(d,t.domain,d);const h=M(d,un);ce(h,t.domain,d);const p=Pt(xg);ce(h,t.tld,p),ce(h,t.utld,p),M(u,xs,p);const f=M(d,Ft);M(f,Ft,f),ce(f,t.domain,d),ce(p,t.domain,d),M(p,un,h),M(p,Ft,f);const m=M(p,or);ce(m,t.numeric,xg);const g=M(s,Ft),y=M(s,un);M(g,Ft,g),ce(g,t.domain,s),ce(y,r,o),ce(y,t.domain,s);const b=Pt(ya);ce(y,t.tld,b),ce(y,t.utld,b),ce(b,t.domain,s),ce(b,r,o),M(b,un,y),M(b,Ft,g),M(b,tr,u);const k=M(b,or),v=Pt(ya);ce(k,t.numeric,v);const w=Pt(ya),x=Pt();ce(w,e,w),ce(w,n,x),ce(x,e,w),ce(x,n,x),M(b,cn,w),M(v,cn,w);const T=M(a,or),F=M(l,or),D=M(F,cn),C=M(D,cn);ce(a,t.domain,s),M(a,un,y),M(a,Ft,g),ce(l,t.domain,s),M(l,un,y),M(l,Ft,g),ce(T,t.domain,w),M(T,cn,w),M(T,es,w),ce(C,t.domain,w),ce(C,e,w),M(C,cn,w);const _=[[Yo,Zo],[kl,wl],[xl,El],[Cl,Sl],[Tl,Ol],[Al,Ml],[_l,Dl],[Nl,Il]];for(let L=0;L<_.length;L++){const[W,q]=_[L],K=M(w,W);M(x,W,K),M(K,q,w);const J=Pt(ya);ce(K,e,J);const ue=Pt();ce(K,n),ce(J,e,J),ce(J,n,ue),ce(ue,e,J),ce(ue,n,ue),M(J,q,w),M(ue,q,w)}return M(i,xs,b),M(i,yh,OP),{start:i,tokens:K0}}function MP(t,e,n){let r=n.length,i=0,o=[],s=[];for(;i<r;){let a=t,l=null,u=null,c=0,d=null,h=-1;for(;i<r&&!(l=a.go(n[i].t));)s.push(n[i++]);for(;i<r&&(u=l||a.go(n[i].t));)l=null,a=u,a.accepts()?(h=0,d=a):h>=0&&h++,i++,c++;if(h<0)i-=c,i<r&&(s.push(n[i]),i++);else{s.length>0&&(o.push(Ic(Eg,e,s)),s=[]),i-=h,c-=h;const p=d.t,f=n.slice(i-c,i);o.push(Ic(p,e,f))}}return s.length>0&&o.push(Ic(Eg,e,s)),o}function Ic(t,e,n){const r=n[0].s,i=n[n.length-1].e,o=e.slice(r,i);return new t(o,n)}const _P=typeof console<"u"&&console&&console.warn||(()=>{}),DP="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",we={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function NP(){return vt.groups={},we.scanner=null,we.parser=null,we.tokenQueue=[],we.pluginQueue=[],we.customSchemes=[],we.initialized=!1,we}function Cg(t,e=!1){if(we.initialized&&_P(`linkifyjs: already initialized - will not register custom scheme "${t}" ${DP}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
96
+ `,textSerializers:n={}}=t||{};return k0(this.state.doc,{blockSeparator:e,textSerializers:{...ih(this.schema),...n}})}get isEmpty(){return Nu(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const t=this.view.dom;t&&t.editor&&delete t.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var t;return!(!((t=this.view)===null||t===void 0)&&t.docView)}$node(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new Hr(e,this)}get $doc(){return this.$pos(0)}};function to(t){return new Mu({find:t.find,handler:({state:e,range:n,match:r})=>{const i=pe(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=e,s=r[r.length-1],a=r[0];if(s){const l=a.search(/\S/),u=n.from+a.indexOf(s),c=u+s.length;if(uh(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(p=>p===t.type&&p!==h.mark.type)).filter(h=>h.to>u).length)return null;c<n.to&&o.delete(c,n.to),u>n.from&&o.delete(n.from+l,u);const d=n.from+l+s.length;o.addMark(n.from+l,d,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}function PI(t){return new Mu({find:t.find,handler:({state:e,range:n,match:r})=>{const i=pe(t.getAttributes,void 0,r)||{},{tr:o}=e,s=n.from;let a=n.to;const l=t.type.create(i);if(r[1]){const u=r[0].lastIndexOf(r[1]);let c=s+u;c>a?c=a:a=c+r[1].length;const d=r[0][r[0].length-1];o.insertText(d,s+r[0].length-1),o.replaceWith(c,a,l)}else if(r[0]){const u=t.type.isInline?s:s-1;o.insert(u,t.type.create(i)).delete(o.mapping.map(s),o.mapping.map(a))}o.scrollIntoView()}})}function Pd(t){return new Mu({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),o=pe(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,o)}})}function bs(t){return new Mu({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const o=pe(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&Hp(a,t.type,o);if(!l)return null;if(s.wrap(a,l),t.keepMarks&&t.editor){const{selection:c,storedMarks:d}=e,{splittableMarks:h}=t.editor.extensionManager,p=d||c.$to.parentOffset&&c.$from.marks();if(p){const f=p.filter(m=>h.includes(m.type.name));s.ensureMarks(f)}}if(t.keepAttributes){const c=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(c,o).run()}const u=s.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&Sr(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&s.join(n.from-1)}})}let on=class Fd{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=pe(j(this,"addOptions",{name:this.name}))),this.storage=pe(j(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Fd(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>_u(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Fd(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=pe(j(n,"addOptions",{name:n.name})),n.storage=pe(j(n,"addStorage",{name:n.name,options:n.options})),n}};function li(t){return new QD({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const o=pe(t.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:s}=e,a=r[r.length-1],l=r[0];let u=n.to;if(a){const c=l.search(/\S/),d=n.from+l.indexOf(a),h=d+a.length;if(uh(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(f=>f===t.type&&f!==p.mark.type)).filter(p=>p.to>d).length)return null;h<n.to&&s.delete(h,n.to),d>n.from&&s.delete(n.from+c,d),u=n.from+c+a.length,s.addMark(n.from+c,u,t.type.create(o||{})),s.removeStoredMark(t.type)}}})}var kt="top",Wt="bottom",Ut="right",wt="left",ch="auto",Rs=[kt,Wt,Ut,wt],no="start",ks="end",FI="clippingParents",C0="viewport",xo="popper",LI="reference",eg=Rs.reduce(function(t,e){return t.concat([e+"-"+no,e+"-"+ks])},[]),S0=[].concat(Rs,[ch]).reduce(function(t,e){return t.concat([e,e+"-"+no,e+"-"+ks])},[]),VI="beforeRead",BI="read",$I="afterRead",jI="beforeMain",zI="main",HI="afterMain",qI="beforeWrite",WI="write",UI="afterWrite",KI=[VI,BI,$I,jI,zI,HI,qI,WI,UI];function Cn(t){return t?(t.nodeName||"").toLowerCase():null}function Nt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function ui(t){var e=Nt(t).Element;return t instanceof e||t instanceof Element}function Ht(t){var e=Nt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function dh(t){if(typeof ShadowRoot>"u")return!1;var e=Nt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function GI(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},i=e.attributes[n]||{},o=e.elements[n];!Ht(o)||!Cn(o)||(Object.assign(o.style,r),Object.keys(i).forEach(function(s){var a=i[s];a===!1?o.removeAttribute(s):o.setAttribute(s,a===!0?"":a)}))})}function JI(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],o=e.attributes[r]||{},s=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),a=s.reduce(function(l,u){return l[u]="",l},{});!Ht(i)||!Cn(i)||(Object.assign(i.style,a),Object.keys(o).forEach(function(l){i.removeAttribute(l)}))})}}const T0={name:"applyStyles",enabled:!0,phase:"write",fn:GI,effect:JI,requires:["computeStyles"]};function bn(t){return t.split("-")[0]}var Qr=Math.max,yl=Math.min,ro=Math.round;function Ld(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function O0(){return!/^((?!chrome|android).)*safari/i.test(Ld())}function io(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,o=1;e&&Ht(t)&&(i=t.offsetWidth>0&&ro(r.width)/t.offsetWidth||1,o=t.offsetHeight>0&&ro(r.height)/t.offsetHeight||1);var s=ui(t)?Nt(t):window,a=s.visualViewport,l=!O0()&&n,u=(r.left+(l&&a?a.offsetLeft:0))/i,c=(r.top+(l&&a?a.offsetTop:0))/o,d=r.width/i,h=r.height/o;return{width:d,height:h,top:c,right:u+d,bottom:c+h,left:u,x:u,y:c}}function ph(t){var e=io(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function A0(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&dh(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Hn(t){return Nt(t).getComputedStyle(t)}function XI(t){return["table","td","th"].indexOf(Cn(t))>=0}function Ar(t){return((ui(t)?t.ownerDocument:t.document)||window.document).documentElement}function Iu(t){return Cn(t)==="html"?t:t.assignedSlot||t.parentNode||(dh(t)?t.host:null)||Ar(t)}function tg(t){return!Ht(t)||Hn(t).position==="fixed"?null:t.offsetParent}function YI(t){var e=/firefox/i.test(Ld()),n=/Trident/i.test(Ld());if(n&&Ht(t)){var r=Hn(t);if(r.position==="fixed")return null}var i=Iu(t);for(dh(i)&&(i=i.host);Ht(i)&&["html","body"].indexOf(Cn(i))<0;){var o=Hn(i);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||e&&o.willChange==="filter"||e&&o.filter&&o.filter!=="none")return i;i=i.parentNode}return null}function Ps(t){for(var e=Nt(t),n=tg(t);n&&XI(n)&&Hn(n).position==="static";)n=tg(n);return n&&(Cn(n)==="html"||Cn(n)==="body"&&Hn(n).position==="static")?e:n||YI(t)||e}function hh(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Ko(t,e,n){return Qr(t,yl(e,n))}function ZI(t,e,n){var r=Ko(t,e,n);return r>n?n:r}function M0(){return{top:0,right:0,bottom:0,left:0}}function _0(t){return Object.assign({},M0(),t)}function D0(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var QI=function(t,e){return t=typeof t=="function"?t(Object.assign({},e.rects,{placement:e.placement})):t,_0(typeof t!="number"?t:D0(t,Rs))};function eR(t){var e,n=t.state,r=t.name,i=t.options,o=n.elements.arrow,s=n.modifiersData.popperOffsets,a=bn(n.placement),l=hh(a),u=[wt,Ut].indexOf(a)>=0,c=u?"height":"width";if(!(!o||!s)){var d=QI(i.padding,n),h=ph(o),p=l==="y"?kt:wt,f=l==="y"?Wt:Ut,m=n.rects.reference[c]+n.rects.reference[l]-s[l]-n.rects.popper[c],g=s[l]-n.rects.reference[l],y=Ps(o),b=y?l==="y"?y.clientHeight||0:y.clientWidth||0:0,k=m/2-g/2,v=d[p],w=b-h[c]-d[f],x=b/2-h[c]/2+k,T=Ko(v,x,w),F=l;n.modifiersData[r]=(e={},e[F]=T,e.centerOffset=T-x,e)}}function tR(t){var e=t.state,n=t.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||A0(e.elements.popper,i)&&(e.elements.arrow=i))}const nR={name:"arrow",enabled:!0,phase:"main",fn:eR,effect:tR,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function oo(t){return t.split("-")[1]}var rR={top:"auto",right:"auto",bottom:"auto",left:"auto"};function iR(t,e){var n=t.x,r=t.y,i=e.devicePixelRatio||1;return{x:ro(n*i)/i||0,y:ro(r*i)/i||0}}function ng(t){var e,n=t.popper,r=t.popperRect,i=t.placement,o=t.variation,s=t.offsets,a=t.position,l=t.gpuAcceleration,u=t.adaptive,c=t.roundOffsets,d=t.isFixed,h=s.x,p=h===void 0?0:h,f=s.y,m=f===void 0?0:f,g=typeof c=="function"?c({x:p,y:m}):{x:p,y:m};p=g.x,m=g.y;var y=s.hasOwnProperty("x"),b=s.hasOwnProperty("y"),k=wt,v=kt,w=window;if(u){var x=Ps(n),T="clientHeight",F="clientWidth";if(x===Nt(n)&&(x=Ar(n),Hn(x).position!=="static"&&a==="absolute"&&(T="scrollHeight",F="scrollWidth")),x=x,i===kt||(i===wt||i===Ut)&&o===ks){v=Wt;var N=d&&x===w&&w.visualViewport?w.visualViewport.height:x[T];m-=N-r.height,m*=l?1:-1}if(i===wt||(i===kt||i===Wt)&&o===ks){k=Ut;var C=d&&x===w&&w.visualViewport?w.visualViewport.width:x[F];p-=C-r.width,p*=l?1:-1}}var _=Object.assign({position:a},u&&rR),L=c===!0?iR({x:p,y:m},Nt(n)):{x:p,y:m};if(p=L.x,m=L.y,l){var W;return Object.assign({},_,(W={},W[v]=b?"0":"",W[k]=y?"0":"",W.transform=(w.devicePixelRatio||1)<=1?"translate("+p+"px, "+m+"px)":"translate3d("+p+"px, "+m+"px, 0)",W))}return Object.assign({},_,(e={},e[v]=b?m+"px":"",e[k]=y?p+"px":"",e.transform="",e))}function oR(t){var e=t.state,n=t.options,r=n.gpuAcceleration,i=r===void 0?!0:r,o=n.adaptive,s=o===void 0?!0:o,a=n.roundOffsets,l=a===void 0?!0:a,u={placement:bn(e.placement),variation:oo(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,ng(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,ng(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const sR={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:oR,data:{}};var fa={passive:!0};function aR(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,o=i===void 0?!0:i,s=r.resize,a=s===void 0?!0:s,l=Nt(e.elements.popper),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&u.forEach(function(c){c.addEventListener("scroll",n.update,fa)}),a&&l.addEventListener("resize",n.update,fa),function(){o&&u.forEach(function(c){c.removeEventListener("scroll",n.update,fa)}),a&&l.removeEventListener("resize",n.update,fa)}}const lR={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:aR,data:{}};var uR={left:"right",right:"left",bottom:"top",top:"bottom"};function Pa(t){return t.replace(/left|right|bottom|top/g,function(e){return uR[e]})}var cR={start:"end",end:"start"};function rg(t){return t.replace(/start|end/g,function(e){return cR[e]})}function fh(t){var e=Nt(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function mh(t){return io(Ar(t)).left+fh(t).scrollLeft}function dR(t,e){var n=Nt(t),r=Ar(t),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;var u=O0();(u||!u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a+mh(t),y:l}}function pR(t){var e,n=Ar(t),r=fh(t),i=(e=t.ownerDocument)==null?void 0:e.body,o=Qr(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=Qr(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+mh(t),l=-r.scrollTop;return Hn(i||n).direction==="rtl"&&(a+=Qr(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:s,x:a,y:l}}function gh(t){var e=Hn(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function N0(t){return["html","body","#document"].indexOf(Cn(t))>=0?t.ownerDocument.body:Ht(t)&&gh(t)?t:N0(Iu(t))}function Go(t,e){var n;e===void 0&&(e=[]);var r=N0(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),o=Nt(r),s=i?[o].concat(o.visualViewport||[],gh(r)?r:[]):r,a=e.concat(s);return i?a:a.concat(Go(Iu(s)))}function Vd(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function hR(t,e){var n=io(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function ig(t,e,n){return e===C0?Vd(dR(t,n)):ui(e)?hR(e,n):Vd(pR(Ar(t)))}function fR(t){var e=Go(Iu(t)),n=["absolute","fixed"].indexOf(Hn(t).position)>=0,r=n&&Ht(t)?Ps(t):t;return ui(r)?e.filter(function(i){return ui(i)&&A0(i,r)&&Cn(i)!=="body"}):[]}function mR(t,e,n,r){var i=e==="clippingParents"?fR(t):[].concat(e),o=[].concat(i,[n]),s=o[0],a=o.reduce(function(l,u){var c=ig(t,u,r);return l.top=Qr(c.top,l.top),l.right=yl(c.right,l.right),l.bottom=yl(c.bottom,l.bottom),l.left=Qr(c.left,l.left),l},ig(t,s,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function I0(t){var e=t.reference,n=t.element,r=t.placement,i=r?bn(r):null,o=r?oo(r):null,s=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,l;switch(i){case kt:l={x:s,y:e.y-n.height};break;case Wt:l={x:s,y:e.y+e.height};break;case Ut:l={x:e.x+e.width,y:a};break;case wt:l={x:e.x-n.width,y:a};break;default:l={x:e.x,y:e.y}}var u=i?hh(i):null;if(u!=null){var c=u==="y"?"height":"width";switch(o){case no:l[u]=l[u]-(e[c]/2-n[c]/2);break;case ks:l[u]=l[u]+(e[c]/2-n[c]/2);break}}return l}function ws(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=r===void 0?t.placement:r,o=n.strategy,s=o===void 0?t.strategy:o,a=n.boundary,l=a===void 0?FI:a,u=n.rootBoundary,c=u===void 0?C0:u,d=n.elementContext,h=d===void 0?xo:d,p=n.altBoundary,f=p===void 0?!1:p,m=n.padding,g=m===void 0?0:m,y=_0(typeof g!="number"?g:D0(g,Rs)),b=h===xo?LI:xo,k=t.rects.popper,v=t.elements[f?b:h],w=mR(ui(v)?v:v.contextElement||Ar(t.elements.popper),l,c,s),x=io(t.elements.reference),T=I0({reference:x,element:k,placement:i}),F=Vd(Object.assign({},k,T)),N=h===xo?F:x,C={top:w.top-N.top+y.top,bottom:N.bottom-w.bottom+y.bottom,left:w.left-N.left+y.left,right:N.right-w.right+y.right},_=t.modifiersData.offset;if(h===xo&&_){var L=_[i];Object.keys(C).forEach(function(W){var q=[Ut,Wt].indexOf(W)>=0?1:-1,K=[kt,Wt].indexOf(W)>=0?"y":"x";C[W]+=L[K]*q})}return C}function gR(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=n.boundary,o=n.rootBoundary,s=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?S0:l,c=oo(r),d=c?a?eg:eg.filter(function(f){return oo(f)===c}):Rs,h=d.filter(function(f){return u.indexOf(f)>=0});h.length===0&&(h=d);var p=h.reduce(function(f,m){return f[m]=ws(t,{placement:m,boundary:i,rootBoundary:o,padding:s})[bn(m)],f},{});return Object.keys(p).sort(function(f,m){return p[f]-p[m]})}function vR(t){if(bn(t)===ch)return[];var e=Pa(t);return[rg(t),e,rg(e)]}function yR(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,a=s===void 0?!0:s,l=n.fallbackPlacements,u=n.padding,c=n.boundary,d=n.rootBoundary,h=n.altBoundary,p=n.flipVariations,f=p===void 0?!0:p,m=n.allowedAutoPlacements,g=e.options.placement,y=bn(g),b=y===g,k=l||(b||!f?[Pa(g)]:vR(g)),v=[g].concat(k).reduce(function(an,It){return an.concat(bn(It)===ch?gR(e,{placement:It,boundary:c,rootBoundary:d,padding:u,flipVariations:f,allowedAutoPlacements:m}):It)},[]),w=e.rects.reference,x=e.rects.popper,T=new Map,F=!0,N=v[0],C=0;C<v.length;C++){var _=v[C],L=bn(_),W=oo(_)===no,q=[kt,Wt].indexOf(L)>=0,K=q?"width":"height",J=ws(e,{placement:_,boundary:c,rootBoundary:d,altBoundary:h,padding:u}),ue=q?W?Ut:wt:W?Wt:kt;w[K]>x[K]&&(ue=Pa(ue));var ge=Pa(ue),Te=[];if(o&&Te.push(J[L]<=0),a&&Te.push(J[ue]<=0,J[ge]<=0),Te.every(function(an){return an})){N=_,F=!1;break}T.set(_,Te)}if(F)for(var mt=f?3:1,Mr=function(an){var It=v.find(function(Kn){var Dr=T.get(Kn);if(Dr)return Dr.slice(0,an).every(function(Gn){return Gn})});if(It)return N=It,"break"},sn=mt;sn>0;sn--){var _r=Mr(sn);if(_r==="break")break}e.placement!==N&&(e.modifiersData[r]._skip=!0,e.placement=N,e.reset=!0)}}const bR={name:"flip",enabled:!0,phase:"main",fn:yR,requiresIfExists:["offset"],data:{_skip:!1}};function og(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function sg(t){return[kt,Ut,Wt,wt].some(function(e){return t[e]>=0})}function kR(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,s=ws(e,{elementContext:"reference"}),a=ws(e,{altBoundary:!0}),l=og(s,r),u=og(a,i,o),c=sg(l),d=sg(u);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:c,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":d})}const wR={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:kR};function xR(t,e,n){var r=bn(t),i=[wt,kt].indexOf(r)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,s=o[0],a=o[1];return s=s||0,a=(a||0)*i,[wt,Ut].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}function ER(t){var e=t.state,n=t.options,r=t.name,i=n.offset,o=i===void 0?[0,0]:i,s=S0.reduce(function(c,d){return c[d]=xR(d,e.rects,o),c},{}),a=s[e.placement],l=a.x,u=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=u),e.modifiersData[r]=s}const CR={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:ER};function SR(t){var e=t.state,n=t.name;e.modifiersData[n]=I0({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const TR={name:"popperOffsets",enabled:!0,phase:"read",fn:SR,data:{}};function OR(t){return t==="x"?"y":"x"}function AR(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,a=s===void 0?!1:s,l=n.boundary,u=n.rootBoundary,c=n.altBoundary,d=n.padding,h=n.tether,p=h===void 0?!0:h,f=n.tetherOffset,m=f===void 0?0:f,g=ws(e,{boundary:l,rootBoundary:u,padding:d,altBoundary:c}),y=bn(e.placement),b=oo(e.placement),k=!b,v=hh(y),w=OR(v),x=e.modifiersData.popperOffsets,T=e.rects.reference,F=e.rects.popper,N=typeof m=="function"?m(Object.assign({},e.rects,{placement:e.placement})):m,C=typeof N=="number"?{mainAxis:N,altAxis:N}:Object.assign({mainAxis:0,altAxis:0},N),_=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,L={x:0,y:0};if(x){if(o){var W,q=v==="y"?kt:wt,K=v==="y"?Wt:Ut,J=v==="y"?"height":"width",ue=x[v],ge=ue+g[q],Te=ue-g[K],mt=p?-F[J]/2:0,Mr=b===no?T[J]:F[J],sn=b===no?-F[J]:-T[J],_r=e.elements.arrow,an=p&&_r?ph(_r):{width:0,height:0},It=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:M0(),Kn=It[q],Dr=It[K],Gn=Ko(0,T[J],an[J]),Fs=k?T[J]/2-mt-Gn-Kn-C.mainAxis:Mr-Gn-Kn-C.mainAxis,Jn=k?-T[J]/2+mt+Gn+Dr+C.mainAxis:sn+Gn+Dr+C.mainAxis,gi=e.elements.arrow&&Ps(e.elements.arrow),Ls=gi?v==="y"?gi.clientTop||0:gi.clientLeft||0:0,po=(W=_?.[v])!=null?W:0,Vs=ue+Fs-po-Ls,Bs=ue+Jn-po,ho=Ko(p?yl(ge,Vs):ge,ue,p?Qr(Te,Bs):Te);x[v]=ho,L[v]=ho-ue}if(a){var fo,$s=v==="x"?kt:wt,js=v==="x"?Wt:Ut,Tn=x[w],Xn=w==="y"?"height":"width",mo=Tn+g[$s],Nr=Tn-g[js],go=[kt,wt].indexOf(y)!==-1,zs=(fo=_?.[w])!=null?fo:0,Hs=go?mo:Tn-T[Xn]-F[Xn]-zs+C.altAxis,qs=go?Tn+T[Xn]+F[Xn]-zs-C.altAxis:Nr,Ws=p&&go?ZI(Hs,Tn,qs):Ko(p?Hs:mo,Tn,p?qs:Nr);x[w]=Ws,L[w]=Ws-Tn}e.modifiersData[r]=L}}const MR={name:"preventOverflow",enabled:!0,phase:"main",fn:AR,requiresIfExists:["offset"]};function _R(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function DR(t){return t===Nt(t)||!Ht(t)?fh(t):_R(t)}function NR(t){var e=t.getBoundingClientRect(),n=ro(e.width)/t.offsetWidth||1,r=ro(e.height)/t.offsetHeight||1;return n!==1||r!==1}function IR(t,e,n){n===void 0&&(n=!1);var r=Ht(e),i=Ht(e)&&NR(e),o=Ar(e),s=io(t,i,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Cn(e)!=="body"||gh(o))&&(a=DR(e)),Ht(e)?(l=io(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):o&&(l.x=mh(o))),{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function RR(t){var e=new Map,n=new Set,r=[];t.forEach(function(o){e.set(o.name,o)});function i(o){n.add(o.name);var s=[].concat(o.requires||[],o.requiresIfExists||[]);s.forEach(function(a){if(!n.has(a)){var l=e.get(a);l&&i(l)}}),r.push(o)}return t.forEach(function(o){n.has(o.name)||i(o)}),r}function PR(t){var e=RR(t);return KI.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function FR(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function LR(t){var e=t.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var ag={placement:"bottom",modifiers:[],strategy:"absolute"};function lg(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function VR(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,i=e.defaultOptions,o=i===void 0?ag:i;return function(s,a,l){l===void 0&&(l=o);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},ag,o),modifiersData:{},elements:{reference:s,popper:a},attributes:{},styles:{}},c=[],d=!1,h={state:u,setOptions:function(m){var g=typeof m=="function"?m(u.options):m;f(),u.options=Object.assign({},o,u.options,g),u.scrollParents={reference:ui(s)?Go(s):s.contextElement?Go(s.contextElement):[],popper:Go(a)};var y=PR(LR([].concat(r,u.options.modifiers)));return u.orderedModifiers=y.filter(function(b){return b.enabled}),p(),h.update()},forceUpdate:function(){if(!d){var m=u.elements,g=m.reference,y=m.popper;if(lg(g,y)){u.rects={reference:IR(g,Ps(y),u.options.strategy==="fixed"),popper:ph(y)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(F){return u.modifiersData[F.name]=Object.assign({},F.data)});for(var b=0;b<u.orderedModifiers.length;b++){if(u.reset===!0){u.reset=!1,b=-1;continue}var k=u.orderedModifiers[b],v=k.fn,w=k.options,x=w===void 0?{}:w,T=k.name;typeof v=="function"&&(u=v({state:u,options:x,name:T,instance:h})||u)}}}},update:FR(function(){return new Promise(function(m){h.forceUpdate(),m(u)})}),destroy:function(){f(),d=!0}};if(!lg(s,a))return h;h.setOptions(l).then(function(m){!d&&l.onFirstUpdate&&l.onFirstUpdate(m)});function p(){u.orderedModifiers.forEach(function(m){var g=m.name,y=m.options,b=y===void 0?{}:y,k=m.effect;if(typeof k=="function"){var v=k({state:u,name:g,instance:h,options:b}),w=function(){};c.push(v||w)}})}function f(){c.forEach(function(m){return m()}),c=[]}return h}}var BR=[lR,TR,sR,T0,CR,bR,MR,nR,wR],$R=VR({defaultModifiers:BR}),jR="tippy-box",R0="tippy-content",zR="tippy-backdrop",P0="tippy-arrow",F0="tippy-svg-arrow",jr={passive:!0,capture:!0},L0=function(){return document.body};function Sc(t,e,n){if(Array.isArray(t)){var r=t[e];return r??(Array.isArray(n)?n[e]:n)}return t}function vh(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function V0(t,e){return typeof t=="function"?t.apply(void 0,e):t}function ug(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function HR(t){return t.split(/\s+/).filter(Boolean)}function Mi(t){return[].concat(t)}function cg(t,e){t.indexOf(e)===-1&&t.push(e)}function qR(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function WR(t){return t.split("-")[0]}function bl(t){return[].slice.call(t)}function dg(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function Jo(){return document.createElement("div")}function Ru(t){return["Element","Fragment"].some(function(e){return vh(t,e)})}function UR(t){return vh(t,"NodeList")}function KR(t){return vh(t,"MouseEvent")}function GR(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function JR(t){return Ru(t)?[t]:UR(t)?bl(t):Array.isArray(t)?t:bl(document.querySelectorAll(t))}function Tc(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function pg(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function XR(t){var e,n=Mi(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function YR(t,e){var n=e.clientX,r=e.clientY;return t.every(function(i){var o=i.popperRect,s=i.popperState,a=i.props,l=a.interactiveBorder,u=WR(s.placement),c=s.modifiersData.offset;if(!c)return!0;var d=u==="bottom"?c.top.y:0,h=u==="top"?c.bottom.y:0,p=u==="right"?c.left.x:0,f=u==="left"?c.right.x:0,m=o.top-r+d>l,g=r-o.bottom-h>l,y=o.left-n+p>l,b=n-o.right-f>l;return m||g||y||b})}function Oc(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){t[r](i,n)})}function hg(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var fn={isTouch:!1},fg=0;function ZR(){fn.isTouch||(fn.isTouch=!0,window.performance&&document.addEventListener("mousemove",B0))}function B0(){var t=performance.now();t-fg<20&&(fn.isTouch=!1,document.removeEventListener("mousemove",B0)),fg=t}function QR(){var t=document.activeElement;if(GR(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function eP(){document.addEventListener("touchstart",ZR,jr),window.addEventListener("blur",QR)}var tP=typeof window<"u"&&typeof document<"u",nP=tP?!!window.msCrypto:!1,rP={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},iP={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Zt=Object.assign({appendTo:L0,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},rP,iP),oP=Object.keys(Zt),sP=function(t){var e=Object.keys(t);e.forEach(function(n){Zt[n]=t[n]})};function $0(t){var e=t.plugins||[],n=e.reduce(function(r,i){var o=i.name,s=i.defaultValue;if(o){var a;r[o]=t[o]!==void 0?t[o]:(a=Zt[o])!=null?a:s}return r},{});return Object.assign({},t,n)}function aP(t,e){var n=e?Object.keys($0(Object.assign({},Zt,{plugins:e}))):oP,r=n.reduce(function(i,o){var s=(t.getAttribute("data-tippy-"+o)||"").trim();if(!s)return i;if(o==="content")i[o]=s;else try{i[o]=JSON.parse(s)}catch{i[o]=s}return i},{});return r}function mg(t,e){var n=Object.assign({},e,{content:V0(e.content,[t])},e.ignoreAttributes?{}:aP(t,e.plugins));return n.aria=Object.assign({},Zt.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}var lP=function(){return"innerHTML"};function Bd(t,e){t[lP()]=e}function gg(t){var e=Jo();return t===!0?e.className=P0:(e.className=F0,Ru(t)?e.appendChild(t):Bd(e,t)),e}function vg(t,e){Ru(e.content)?(Bd(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Bd(t,e.content):t.textContent=e.content)}function $d(t){var e=t.firstElementChild,n=bl(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(R0)}),arrow:n.find(function(r){return r.classList.contains(P0)||r.classList.contains(F0)}),backdrop:n.find(function(r){return r.classList.contains(zR)})}}function j0(t){var e=Jo(),n=Jo();n.className=jR,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=Jo();r.className=R0,r.setAttribute("data-state","hidden"),vg(r,t.props),e.appendChild(n),n.appendChild(r),i(t.props,t.props);function i(o,s){var a=$d(e),l=a.box,u=a.content,c=a.arrow;s.theme?l.setAttribute("data-theme",s.theme):l.removeAttribute("data-theme"),typeof s.animation=="string"?l.setAttribute("data-animation",s.animation):l.removeAttribute("data-animation"),s.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?l.setAttribute("role",s.role):l.removeAttribute("role"),(o.content!==s.content||o.allowHTML!==s.allowHTML)&&vg(u,t.props),s.arrow?c?o.arrow!==s.arrow&&(l.removeChild(c),l.appendChild(gg(s.arrow))):l.appendChild(gg(s.arrow)):c&&l.removeChild(c)}return{popper:e,onUpdate:i}}j0.$$tippy=!0;var uP=1,ma=[],Ac=[];function cP(t,e){var n=mg(t,Object.assign({},Zt,$0(dg(e)))),r,i,o,s=!1,a=!1,l=!1,u=!1,c,d,h,p=[],f=ug(Vs,n.interactiveDebounce),m,g=uP++,y=null,b=qR(n.plugins),k={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:g,reference:t,popper:Jo(),popperInstance:y,props:n,state:k,plugins:b,clearDelayTimeouts:Hs,setProps:qs,setContent:Ws,show:lk,hide:uk,hideWithInteractivity:ck,enable:go,disable:zs,unmount:dk,destroy:pk};if(!n.render)return v;var w=n.render(v),x=w.popper,T=w.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+v.id,v.popper=x,t._tippy=v,x._tippy=v;var F=b.map(function(S){return S.fn(v)}),N=t.hasAttribute("aria-expanded");return gi(),mt(),ue(),ge("onCreate",[v]),n.showOnCreate&&mo(),x.addEventListener("mouseenter",function(){v.props.interactive&&v.state.isVisible&&v.clearDelayTimeouts()}),x.addEventListener("mouseleave",function(){v.props.interactive&&v.props.trigger.indexOf("mouseenter")>=0&&q().addEventListener("mousemove",f)}),v;function C(){var S=v.props.touch;return Array.isArray(S)?S:[S,0]}function _(){return C()[0]==="hold"}function L(){var S;return!!((S=v.props.render)!=null&&S.$$tippy)}function W(){return m||t}function q(){var S=W().parentNode;return S?XR(S):document}function K(){return $d(x)}function J(S){return v.state.isMounted&&!v.state.isVisible||fn.isTouch||c&&c.type==="focus"?0:Sc(v.props.delay,S?0:1,Zt.delay)}function ue(S){S===void 0&&(S=!1),x.style.pointerEvents=v.props.interactive&&!S?"":"none",x.style.zIndex=""+v.props.zIndex}function ge(S,z,re){if(re===void 0&&(re=!0),F.forEach(function(fe){fe[S]&&fe[S].apply(fe,z)}),re){var ye;(ye=v.props)[S].apply(ye,z)}}function Te(){var S=v.props.aria;if(S.content){var z="aria-"+S.content,re=x.id,ye=Mi(v.props.triggerTarget||t);ye.forEach(function(fe){var lt=fe.getAttribute(z);if(v.state.isVisible)fe.setAttribute(z,lt?lt+" "+re:re);else{var Rt=lt&&lt.replace(re,"").trim();Rt?fe.setAttribute(z,Rt):fe.removeAttribute(z)}})}}function mt(){if(!(N||!v.props.aria.expanded)){var S=Mi(v.props.triggerTarget||t);S.forEach(function(z){v.props.interactive?z.setAttribute("aria-expanded",v.state.isVisible&&z===W()?"true":"false"):z.removeAttribute("aria-expanded")})}}function Mr(){q().removeEventListener("mousemove",f),ma=ma.filter(function(S){return S!==f})}function sn(S){if(!(fn.isTouch&&(l||S.type==="mousedown"))){var z=S.composedPath&&S.composedPath()[0]||S.target;if(!(v.props.interactive&&hg(x,z))){if(Mi(v.props.triggerTarget||t).some(function(re){return hg(re,z)})){if(fn.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else ge("onClickOutside",[v,S]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),a=!0,setTimeout(function(){a=!1}),v.state.isMounted||Kn())}}}function _r(){l=!0}function an(){l=!1}function It(){var S=q();S.addEventListener("mousedown",sn,!0),S.addEventListener("touchend",sn,jr),S.addEventListener("touchstart",an,jr),S.addEventListener("touchmove",_r,jr)}function Kn(){var S=q();S.removeEventListener("mousedown",sn,!0),S.removeEventListener("touchend",sn,jr),S.removeEventListener("touchstart",an,jr),S.removeEventListener("touchmove",_r,jr)}function Dr(S,z){Fs(S,function(){!v.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&z()})}function Gn(S,z){Fs(S,z)}function Fs(S,z){var re=K().box;function ye(fe){fe.target===re&&(Oc(re,"remove",ye),z())}if(S===0)return z();Oc(re,"remove",d),Oc(re,"add",ye),d=ye}function Jn(S,z,re){re===void 0&&(re=!1);var ye=Mi(v.props.triggerTarget||t);ye.forEach(function(fe){fe.addEventListener(S,z,re),p.push({node:fe,eventType:S,handler:z,options:re})})}function gi(){_()&&(Jn("touchstart",po,{passive:!0}),Jn("touchend",Bs,{passive:!0})),HR(v.props.trigger).forEach(function(S){if(S!=="manual")switch(Jn(S,po),S){case"mouseenter":Jn("mouseleave",Bs);break;case"focus":Jn(nP?"focusout":"blur",ho);break;case"focusin":Jn("focusout",ho);break}})}function Ls(){p.forEach(function(S){var z=S.node,re=S.eventType,ye=S.handler,fe=S.options;z.removeEventListener(re,ye,fe)}),p=[]}function po(S){var z,re=!1;if(!(!v.state.isEnabled||fo(S)||a)){var ye=((z=c)==null?void 0:z.type)==="focus";c=S,m=S.currentTarget,mt(),!v.state.isVisible&&KR(S)&&ma.forEach(function(fe){return fe(S)}),S.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||s)&&v.props.hideOnClick!==!1&&v.state.isVisible?re=!0:mo(S),S.type==="click"&&(s=!re),re&&!ye&&Nr(S)}}function Vs(S){var z=S.target,re=W().contains(z)||x.contains(z);if(!(S.type==="mousemove"&&re)){var ye=Xn().concat(x).map(function(fe){var lt,Rt=fe._tippy,vi=(lt=Rt.popperInstance)==null?void 0:lt.state;return vi?{popperRect:fe.getBoundingClientRect(),popperState:vi,props:n}:null}).filter(Boolean);YR(ye,S)&&(Mr(),Nr(S))}}function Bs(S){var z=fo(S)||v.props.trigger.indexOf("click")>=0&&s;if(!z){if(v.props.interactive){v.hideWithInteractivity(S);return}Nr(S)}}function ho(S){v.props.trigger.indexOf("focusin")<0&&S.target!==W()||v.props.interactive&&S.relatedTarget&&x.contains(S.relatedTarget)||Nr(S)}function fo(S){return fn.isTouch?_()!==S.type.indexOf("touch")>=0:!1}function $s(){js();var S=v.props,z=S.popperOptions,re=S.placement,ye=S.offset,fe=S.getReferenceClientRect,lt=S.moveTransition,Rt=L()?$d(x).arrow:null,vi=fe?{getBoundingClientRect:fe,contextElement:fe.contextElement||W()}:t,Us={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Ks){var yi=Ks.state;if(L()){var hk=K(),Fu=hk.box;["placement","reference-hidden","escaped"].forEach(function(Gs){Gs==="placement"?Fu.setAttribute("data-placement",yi.placement):yi.attributes.popper["data-popper-"+Gs]?Fu.setAttribute("data-"+Gs,""):Fu.removeAttribute("data-"+Gs)}),yi.attributes.popper={}}}},Ir=[{name:"offset",options:{offset:ye}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!lt}},Us];L()&&Rt&&Ir.push({name:"arrow",options:{element:Rt,padding:3}}),Ir.push.apply(Ir,z?.modifiers||[]),v.popperInstance=$R(vi,x,Object.assign({},z,{placement:re,onFirstUpdate:h,modifiers:Ir}))}function js(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function Tn(){var S=v.props.appendTo,z,re=W();v.props.interactive&&S===L0||S==="parent"?z=re.parentNode:z=V0(S,[re]),z.contains(x)||z.appendChild(x),v.state.isMounted=!0,$s()}function Xn(){return bl(x.querySelectorAll("[data-tippy-root]"))}function mo(S){v.clearDelayTimeouts(),S&&ge("onTrigger",[v,S]),It();var z=J(!0),re=C(),ye=re[0],fe=re[1];fn.isTouch&&ye==="hold"&&fe&&(z=fe),z?r=setTimeout(function(){v.show()},z):v.show()}function Nr(S){if(v.clearDelayTimeouts(),ge("onUntrigger",[v,S]),!v.state.isVisible){Kn();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(S.type)>=0&&s)){var z=J(!1);z?i=setTimeout(function(){v.state.isVisible&&v.hide()},z):o=requestAnimationFrame(function(){v.hide()})}}function go(){v.state.isEnabled=!0}function zs(){v.hide(),v.state.isEnabled=!1}function Hs(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(o)}function qs(S){if(!v.state.isDestroyed){ge("onBeforeUpdate",[v,S]),Ls();var z=v.props,re=mg(t,Object.assign({},z,dg(S),{ignoreAttributes:!0}));v.props=re,gi(),z.interactiveDebounce!==re.interactiveDebounce&&(Mr(),f=ug(Vs,re.interactiveDebounce)),z.triggerTarget&&!re.triggerTarget?Mi(z.triggerTarget).forEach(function(ye){ye.removeAttribute("aria-expanded")}):re.triggerTarget&&t.removeAttribute("aria-expanded"),mt(),ue(),T&&T(z,re),v.popperInstance&&($s(),Xn().forEach(function(ye){requestAnimationFrame(ye._tippy.popperInstance.forceUpdate)})),ge("onAfterUpdate",[v,S])}}function Ws(S){v.setProps({content:S})}function lk(){var S=v.state.isVisible,z=v.state.isDestroyed,re=!v.state.isEnabled,ye=fn.isTouch&&!v.props.touch,fe=Sc(v.props.duration,0,Zt.duration);if(!(S||z||re||ye)&&!W().hasAttribute("disabled")&&(ge("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,L()&&(x.style.visibility="visible"),ue(),It(),v.state.isMounted||(x.style.transition="none"),L()){var lt=K(),Rt=lt.box,vi=lt.content;Tc([Rt,vi],0)}h=function(){var Us;if(!(!v.state.isVisible||u)){if(u=!0,x.offsetHeight,x.style.transition=v.props.moveTransition,L()&&v.props.animation){var Ir=K(),Ks=Ir.box,yi=Ir.content;Tc([Ks,yi],fe),pg([Ks,yi],"visible")}Te(),mt(),cg(Ac,v),(Us=v.popperInstance)==null||Us.forceUpdate(),ge("onMount",[v]),v.props.animation&&L()&&Gn(fe,function(){v.state.isShown=!0,ge("onShown",[v])})}},Tn()}}function uk(){var S=!v.state.isVisible,z=v.state.isDestroyed,re=!v.state.isEnabled,ye=Sc(v.props.duration,1,Zt.duration);if(!(S||z||re)&&(ge("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,u=!1,s=!1,L()&&(x.style.visibility="hidden"),Mr(),Kn(),ue(!0),L()){var fe=K(),lt=fe.box,Rt=fe.content;v.props.animation&&(Tc([lt,Rt],ye),pg([lt,Rt],"hidden"))}Te(),mt(),v.props.animation?L()&&Dr(ye,v.unmount):v.unmount()}}function ck(S){q().addEventListener("mousemove",f),cg(ma,f),f(S)}function dk(){v.state.isVisible&&v.hide(),v.state.isMounted&&(js(),Xn().forEach(function(S){S._tippy.unmount()}),x.parentNode&&x.parentNode.removeChild(x),Ac=Ac.filter(function(S){return S!==v}),v.state.isMounted=!1,ge("onHidden",[v]))}function pk(){!v.state.isDestroyed&&(v.clearDelayTimeouts(),v.unmount(),Ls(),delete t._tippy,v.state.isDestroyed=!0,ge("onDestroy",[v]))}}function co(t,e){e===void 0&&(e={});var n=Zt.plugins.concat(e.plugins||[]);eP();var r=Object.assign({},e,{plugins:n}),i=JR(t),o=i.reduce(function(s,a){var l=a&&cP(a,r);return l&&s.push(l),s},[]);return Ru(t)?o[0]:o}co.defaultProps=Zt;co.setDefaultProps=sP;co.currentInput=fn;Object.assign({},T0,{effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow)}});co.setDefaultProps({render:j0});class dP{constructor({editor:e,element:n,view:r,tippyOptions:i={},updateDelay:o=250,shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:a,state:l,from:u,to:c})=>{const{doc:d,selection:h}=l,{empty:p}=h,f=!d.textBetween(u,c).length&&sh(l.selection),m=this.element.contains(document.activeElement);return!(!(a.hasFocus()||m)||p||f||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:a})=>{var l;if(this.preventHide){this.preventHide=!1;return}a!=null&&a.relatedTarget&&!((l=this.element.parentNode)===null||l===void 0)&&l.contains(a.relatedTarget)||a?.relatedTarget!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=a=>{this.blurHandler({event:a})},this.handleDebouncedUpdate=(a,l)=>{const u=!(l!=null&&l.selection.eq(a.state.selection)),c=!(l!=null&&l.doc.eq(a.state.doc));!u&&!c||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(a,u,c,l)},this.updateDelay))},this.updateHandler=(a,l,u,c)=>{var d,h,p;const{state:f,composing:m}=a,{selection:g}=f;if(m||!l&&!u)return;this.createTooltip();const{ranges:y}=g,b=Math.min(...y.map(v=>v.$from.pos)),k=Math.max(...y.map(v=>v.$to.pos));if(!(!((d=this.shouldShow)===null||d===void 0)&&d.call(this,{editor:this.editor,element:this.element,view:a,state:f,oldState:c,from:b,to:k}))){this.hide();return}(h=this.tippy)===null||h===void 0||h.setProps({getReferenceClientRect:((p=this.tippyOptions)===null||p===void 0?void 0:p.getReferenceClientRect)||(()=>{if(x0(f.selection)){let v=a.nodeDOM(b);if(v){const w=v.dataset.nodeViewWrapper?v:v.querySelector("[data-node-view-wrapper]");if(w&&(v=w.firstChild),v)return v.getBoundingClientRect()}}return E0(a,b,k)})}),this.show()},this.editor=e,this.element=n,this.view=r,this.updateDelay=o,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=co(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){const{state:r}=e,i=r.selection.from!==r.selection.to;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(e,n);return}const o=!(n!=null&&n.selection.eq(e.state.selection)),s=!(n!=null&&n.doc.eq(e.state.doc));this.updateHandler(e,o,s,n)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const pP=t=>new Ve({key:typeof t.pluginKey=="string"?new at(t.pluginKey):t.pluginKey,view:e=>new dP({view:e,...t})});Ke.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[pP({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class hP{getTextContent(e){return k0(e,{textSerializers:ih(this.editor.schema)})}constructor({editor:e,element:n,view:r,tippyOptions:i={},shouldShow:o}){this.preventHide=!1,this.shouldShow=({view:s,state:a})=>{const{selection:l}=a,{$anchor:u,empty:c}=l,d=u.depth===1,h=u.parent.isTextblock&&!u.parent.type.spec.code&&!u.parent.textContent&&u.parent.childCount===0&&!this.getTextContent(u.parent);return!(!s.hasFocus()||!c||!d||!h||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:s})=>{var a;if(this.preventHide){this.preventHide=!1;return}s!=null&&s.relatedTarget&&!((a=this.element.parentNode)===null||a===void 0)&&a.contains(s.relatedTarget)||s?.relatedTarget!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=s=>{this.blurHandler({event:s})},this.editor=e,this.element=n,this.view=r,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=co(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){var r,i,o;const{state:s}=e,{doc:a,selection:l}=s,{from:u,to:c}=l;if(!(n&&n.doc.eq(a)&&n.selection.eq(l))){if(this.createTooltip(),!(!((r=this.shouldShow)===null||r===void 0)&&r.call(this,{editor:this.editor,view:e,state:s,oldState:n}))){this.hide();return}(i=this.tippy)===null||i===void 0||i.setProps({getReferenceClientRect:((o=this.tippyOptions)===null||o===void 0?void 0:o.getReferenceClientRect)||(()=>E0(e,u,c))}),this.show()}}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const fP=t=>new Ve({key:typeof t.pluginKey=="string"?new at(t.pluginKey):t.pluginKey,view:e=>new hP({view:e,...t})});Ke.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[fP({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});function yg(t){return ep((e,n)=>({get(){return e(),t},set(r){t=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class mP extends RI{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=yg(this.view.state),this.reactiveExtensionStorage=yg(this.extensionStorage),this.on("beforeTransaction",({nextState:n})=>{this.reactiveState.value=n,this.reactiveExtensionStorage.value=this.extensionStorage}),ka(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,n){const r=super.registerPlugin(e,n);return this.reactiveState&&(this.reactiveState.value=r),r}unregisterPlugin(e){const n=super.unregisterPlugin(e);return this.reactiveState&&n&&(this.reactiveState.value=n),n}}const gP=Q({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=X(),n=np();return Pg(()=>{const r=t.editor;r&&r.options.element&&e.value&&kr(()=>{if(!e.value||!r.options.element.firstChild)return;const i=B(e.value);e.value.append(...r.options.element.childNodes),r.contentComponent=n.ctx._,n&&(r.appContext={...n.appContext,provides:n.provides}),r.setOptions({element:i}),r.createNodeViews()})}),ao(()=>{const r=t.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return ns("div",{ref:t=>{this.rootEl=t}})}}),vP=(t={})=>{const e=qt();return qn(()=>{e.value=new mP(t)}),ao(()=>{var n,r,i;const o=(n=e.value)===null||n===void 0?void 0:n.options.element,s=o?.cloneNode(!0);(r=o?.parentNode)===null||r===void 0||r.replaceChild(s,o),(i=e.value)===null||i===void 0||i.destroy()}),e},yP="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",bP="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",so=(t,e)=>{for(const n in e)t[n]=e[n];return t},jd="numeric",zd="ascii",Hd="alpha",Xo="asciinumeric",Fo="alphanumeric",qd="domain",z0="emoji",kP="scheme",wP="slashscheme",Mc="whitespace";function xP(t,e){return t in e||(e[t]=[]),e[t]}function Kr(t,e,n){e[jd]&&(e[Xo]=!0,e[Fo]=!0),e[zd]&&(e[Xo]=!0,e[Hd]=!0),e[Xo]&&(e[Fo]=!0),e[Hd]&&(e[Fo]=!0),e[Fo]&&(e[qd]=!0),e[z0]&&(e[qd]=!0);for(const r in e){const i=xP(r,n);i.indexOf(t)<0&&i.push(t)}}function EP(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function vt(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}vt.groups={};vt.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],o=e.jr[r][1];if(o&&i.test(t))return o}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||vt.groups;let i;return e&&e.j?i=e:(i=new vt(e),n&&r&&Kr(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const o=t.length;if(!o)return i;for(let s=0;s<o-1;s++)i=i.tt(t[s]);return i.tt(t[o-1],e,n,r)},tt(t,e,n,r){r=r||vt.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const o=e;let s,a=i.go(t);if(a?(s=new vt,so(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new vt,o){if(r)if(s.t&&typeof s.t=="string"){const l=so(EP(s.t,r),n);Kr(o,l,r)}else n&&Kr(o,n,r);s.t=o}return i.j[t]=s,s}};const ce=(t,e,n,r,i)=>t.ta(e,n,r,i),Oe=(t,e,n,r,i)=>t.tr(e,n,r,i),bg=(t,e,n,r,i)=>t.ts(e,n,r,i),M=(t,e,n,r,i)=>t.tt(e,n,r,i),Dn="WORD",Wd="UWORD",H0="ASCIINUMERICAL",q0="ALPHANUMERICAL",xs="LOCALHOST",Ud="TLD",Kd="UTLD",Fa="SCHEME",_i="SLASH_SCHEME",yh="NUM",Gd="WS",bh="NL",Yo="OPENBRACE",Zo="CLOSEBRACE",kl="OPENBRACKET",wl="CLOSEBRACKET",xl="OPENPAREN",El="CLOSEPAREN",Cl="OPENANGLEBRACKET",Sl="CLOSEANGLEBRACKET",Tl="FULLWIDTHLEFTPAREN",Ol="FULLWIDTHRIGHTPAREN",Al="LEFTCORNERBRACKET",Ml="RIGHTCORNERBRACKET",_l="LEFTWHITECORNERBRACKET",Dl="RIGHTWHITECORNERBRACKET",Nl="FULLWIDTHLESSTHAN",Il="FULLWIDTHGREATERTHAN",Rl="AMPERSAND",kh="APOSTROPHE",Pl="ASTERISK",tr="AT",Fl="BACKSLASH",Ll="BACKTICK",Vl="CARET",or="COLON",wh="COMMA",Bl="DOLLAR",cn="DOT",$l="EQUALS",xh="EXCLAMATION",Ft="HYPHEN",Qo="PERCENT",jl="PIPE",zl="PLUS",Hl="POUND",es="QUERY",Eh="QUOTE",W0="FULLWIDTHMIDDLEDOT",Ch="SEMI",dn="SLASH",ts="TILDE",ql="UNDERSCORE",U0="EMOJI",Wl="SYM";var K0=Object.freeze({__proto__:null,WORD:Dn,UWORD:Wd,ASCIINUMERICAL:H0,ALPHANUMERICAL:q0,LOCALHOST:xs,TLD:Ud,UTLD:Kd,SCHEME:Fa,SLASH_SCHEME:_i,NUM:yh,WS:Gd,NL:bh,OPENBRACE:Yo,CLOSEBRACE:Zo,OPENBRACKET:kl,CLOSEBRACKET:wl,OPENPAREN:xl,CLOSEPAREN:El,OPENANGLEBRACKET:Cl,CLOSEANGLEBRACKET:Sl,FULLWIDTHLEFTPAREN:Tl,FULLWIDTHRIGHTPAREN:Ol,LEFTCORNERBRACKET:Al,RIGHTCORNERBRACKET:Ml,LEFTWHITECORNERBRACKET:_l,RIGHTWHITECORNERBRACKET:Dl,FULLWIDTHLESSTHAN:Nl,FULLWIDTHGREATERTHAN:Il,AMPERSAND:Rl,APOSTROPHE:kh,ASTERISK:Pl,AT:tr,BACKSLASH:Fl,BACKTICK:Ll,CARET:Vl,COLON:or,COMMA:wh,DOLLAR:Bl,DOT:cn,EQUALS:$l,EXCLAMATION:xh,HYPHEN:Ft,PERCENT:Qo,PIPE:jl,PLUS:zl,POUND:Hl,QUERY:es,QUOTE:Eh,FULLWIDTHMIDDLEDOT:W0,SEMI:Ch,SLASH:dn,TILDE:ts,UNDERSCORE:ql,EMOJI:U0,SYM:Wl});const An=/[a-z]/,Eo=/\p{L}/u,_c=/\p{Emoji}/u,Mn=/\d/,Dc=/\s/,kg="\r",Nc=`
97
+ `,CP="️",SP="‍",Ic="";let ga=null,va=null;function TP(t=[]){const e={};vt.groups=e;const n=new vt;ga==null&&(ga=wg(yP)),va==null&&(va=wg(bP)),M(n,"'",kh),M(n,"{",Yo),M(n,"}",Zo),M(n,"[",kl),M(n,"]",wl),M(n,"(",xl),M(n,")",El),M(n,"<",Cl),M(n,">",Sl),M(n,"(",Tl),M(n,")",Ol),M(n,"「",Al),M(n,"」",Ml),M(n,"『",_l),M(n,"』",Dl),M(n,"<",Nl),M(n,">",Il),M(n,"&",Rl),M(n,"*",Pl),M(n,"@",tr),M(n,"`",Ll),M(n,"^",Vl),M(n,":",or),M(n,",",wh),M(n,"$",Bl),M(n,".",cn),M(n,"=",$l),M(n,"!",xh),M(n,"-",Ft),M(n,"%",Qo),M(n,"|",jl),M(n,"+",zl),M(n,"#",Hl),M(n,"?",es),M(n,'"',Eh),M(n,"/",dn),M(n,";",Ch),M(n,"~",ts),M(n,"_",ql),M(n,"\\",Fl),M(n,"・",W0);const r=Oe(n,Mn,yh,{[jd]:!0});Oe(r,Mn,r);const i=Oe(r,An,H0,{[Xo]:!0}),o=Oe(r,Eo,q0,{[Fo]:!0}),s=Oe(n,An,Dn,{[zd]:!0});Oe(s,Mn,i),Oe(s,An,s),Oe(i,Mn,i),Oe(i,An,i);const a=Oe(n,Eo,Wd,{[Hd]:!0});Oe(a,An),Oe(a,Mn,o),Oe(a,Eo,a),Oe(o,Mn,o),Oe(o,An),Oe(o,Eo,o);const l=M(n,Nc,bh,{[Mc]:!0}),u=M(n,kg,Gd,{[Mc]:!0}),c=Oe(n,Dc,Gd,{[Mc]:!0});M(n,Ic,c),M(u,Nc,l),M(u,Ic,c),Oe(u,Dc,c),M(c,kg),M(c,Nc),Oe(c,Dc,c),M(c,Ic,c);const d=Oe(n,_c,U0,{[z0]:!0});M(d,"#"),Oe(d,_c,d),M(d,CP,d);const h=M(d,SP);M(h,"#"),Oe(h,_c,d);const p=[[An,s],[Mn,i]],f=[[An,null],[Eo,a],[Mn,o]];for(let m=0;m<ga.length;m++)Yn(n,ga[m],Ud,Dn,p);for(let m=0;m<va.length;m++)Yn(n,va[m],Kd,Wd,f);Kr(Ud,{tld:!0,ascii:!0},e),Kr(Kd,{utld:!0,alpha:!0},e),Yn(n,"file",Fa,Dn,p),Yn(n,"mailto",Fa,Dn,p),Yn(n,"http",_i,Dn,p),Yn(n,"https",_i,Dn,p),Yn(n,"ftp",_i,Dn,p),Yn(n,"ftps",_i,Dn,p),Kr(Fa,{scheme:!0,ascii:!0},e),Kr(_i,{slashscheme:!0,ascii:!0},e),t=t.sort((m,g)=>m[0]>g[0]?1:-1);for(let m=0;m<t.length;m++){const g=t[m][0],y=t[m][1]?{[kP]:!0}:{[wP]:!0};g.indexOf("-")>=0?y[qd]=!0:An.test(g)?Mn.test(g)?y[Xo]=!0:y[zd]=!0:y[jd]=!0,bg(n,g,g,y)}return bg(n,"localhost",xs,{ascii:!0}),n.jd=new vt(Wl),{start:n,tokens:so({groups:e},K0)}}function G0(t,e){const n=OP(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,i=[];let o=0,s=0;for(;s<r;){let a=t,l=null,u=0,c=null,d=-1,h=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(d=0,h=0,c=a):d>=0&&(d+=n[s].length,h++),u+=n[s].length,o+=n[s].length,s++;o-=d,s-=h,u-=d,i.push({t:c.t,v:e.slice(o-u,o),s:o-u,e:o})}return i}function OP(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),o,s=i<55296||i>56319||r+1===n||(o=t.charCodeAt(r+1))<56320||o>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function Yn(t,e,n,r,i){let o;const s=e.length;for(let a=0;a<s-1;a++){const l=e[a];t.j[l]?o=t.j[l]:(o=new vt(r),o.jr=i.slice(),t.j[l]=o),t=o}return o=new vt(n),o.jr=i.slice(),t.j[e[s-1]]=o,o}function wg(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let o=0;for(;i.indexOf(t[r+o])>=0;)o++;if(o>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+o),10);s>0;s--)n.pop();r+=o}else n.push(t[r]),r++}return e}const Es={defaultProtocol:"http",events:null,format:xg,formatHref:xg,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Sh(t,e=null){let n=so({},Es);t&&(n=so(n,t instanceof Sh?t.o:t));const r=n.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}Sh.prototype={o:Es,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:Es[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function xg(t){return t}function J0(t,e){this.t="token",this.v=t,this.tk=e}J0.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Es.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),o=this.toFormattedString(t),s={},a=t.get("className",n,e),l=t.get("target",n,e),u=t.get("rel",n,e),c=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return s.href=r,a&&(s.class=a),l&&(s.target=l),u&&(s.rel=u),c&&so(s,c),{tagName:i,attributes:s,content:o,eventListeners:d}}};function Pu(t,e){class n extends J0{constructor(i,o){super(i,o),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const Eg=Pu("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Cg=Pu("text"),AP=Pu("nl"),ya=Pu("url",{isLink:!0,toHref(t=Es.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==xs&&t[1].t===or}}),Pt=t=>new vt(t);function MP({groups:t}){const e=t.domain.concat([Rl,Pl,tr,Fl,Ll,Vl,Bl,$l,Ft,yh,Qo,jl,zl,Hl,dn,Wl,ts,ql]),n=[or,wh,cn,xh,Qo,es,Eh,Ch,Cl,Sl,Yo,Zo,wl,kl,xl,El,Tl,Ol,Al,Ml,_l,Dl,Nl,Il],r=[Rl,kh,Pl,Fl,Ll,Vl,Bl,$l,Ft,Yo,Zo,Qo,jl,zl,Hl,es,dn,Wl,ts,ql],i=Pt(),o=M(i,ts);ce(o,r,o),ce(o,t.domain,o);const s=Pt(),a=Pt(),l=Pt();ce(i,t.domain,s),ce(i,t.scheme,a),ce(i,t.slashscheme,l),ce(s,r,o),ce(s,t.domain,s);const u=M(s,tr);M(o,tr,u),M(a,tr,u),M(l,tr,u);const c=M(o,cn);ce(c,r,o),ce(c,t.domain,o);const d=Pt();ce(u,t.domain,d),ce(d,t.domain,d);const h=M(d,cn);ce(h,t.domain,d);const p=Pt(Eg);ce(h,t.tld,p),ce(h,t.utld,p),M(u,xs,p);const f=M(d,Ft);M(f,Ft,f),ce(f,t.domain,d),ce(p,t.domain,d),M(p,cn,h),M(p,Ft,f);const m=M(p,or);ce(m,t.numeric,Eg);const g=M(s,Ft),y=M(s,cn);M(g,Ft,g),ce(g,t.domain,s),ce(y,r,o),ce(y,t.domain,s);const b=Pt(ya);ce(y,t.tld,b),ce(y,t.utld,b),ce(b,t.domain,s),ce(b,r,o),M(b,cn,y),M(b,Ft,g),M(b,tr,u);const k=M(b,or),v=Pt(ya);ce(k,t.numeric,v);const w=Pt(ya),x=Pt();ce(w,e,w),ce(w,n,x),ce(x,e,w),ce(x,n,x),M(b,dn,w),M(v,dn,w);const T=M(a,or),F=M(l,or),N=M(F,dn),C=M(N,dn);ce(a,t.domain,s),M(a,cn,y),M(a,Ft,g),ce(l,t.domain,s),M(l,cn,y),M(l,Ft,g),ce(T,t.domain,w),M(T,dn,w),M(T,es,w),ce(C,t.domain,w),ce(C,e,w),M(C,dn,w);const _=[[Yo,Zo],[kl,wl],[xl,El],[Cl,Sl],[Tl,Ol],[Al,Ml],[_l,Dl],[Nl,Il]];for(let L=0;L<_.length;L++){const[W,q]=_[L],K=M(w,W);M(x,W,K),M(K,q,w);const J=Pt(ya);ce(K,e,J);const ue=Pt();ce(K,n),ce(J,e,J),ce(J,n,ue),ce(ue,e,J),ce(ue,n,ue),M(J,q,w),M(ue,q,w)}return M(i,xs,b),M(i,bh,AP),{start:i,tokens:K0}}function _P(t,e,n){let r=n.length,i=0,o=[],s=[];for(;i<r;){let a=t,l=null,u=null,c=0,d=null,h=-1;for(;i<r&&!(l=a.go(n[i].t));)s.push(n[i++]);for(;i<r&&(u=l||a.go(n[i].t));)l=null,a=u,a.accepts()?(h=0,d=a):h>=0&&h++,i++,c++;if(h<0)i-=c,i<r&&(s.push(n[i]),i++);else{s.length>0&&(o.push(Rc(Cg,e,s)),s=[]),i-=h,c-=h;const p=d.t,f=n.slice(i-c,i);o.push(Rc(p,e,f))}}return s.length>0&&o.push(Rc(Cg,e,s)),o}function Rc(t,e,n){const r=n[0].s,i=n[n.length-1].e,o=e.slice(r,i);return new t(o,n)}const DP=typeof console<"u"&&console&&console.warn||(()=>{}),NP="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",we={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function IP(){return vt.groups={},we.scanner=null,we.parser=null,we.tokenQueue=[],we.pluginQueue=[],we.customSchemes=[],we.initialized=!1,we}function Sg(t,e=!1){if(we.initialized&&DP(`linkifyjs: already initialized - will not register custom scheme "${t}" ${NP}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
98
98
  1. Must only contain digits, lowercase ASCII letters or "-"
99
99
  2. Cannot start or end with "-"
100
- 3. "-" cannot repeat`);we.customSchemes.push([t,e])}function IP(){we.scanner=SP(we.customSchemes);for(let t=0;t<we.tokenQueue.length;t++)we.tokenQueue[t][1]({scanner:we.scanner});we.parser=AP(we.scanner.tokens);for(let t=0;t<we.pluginQueue.length;t++)we.pluginQueue[t][1]({scanner:we.scanner,parser:we.parser});return we.initialized=!0,we}function Sh(t){return we.initialized||IP(),MP(we.parser.start,t,G0(we.scanner.start,t))}Sh.scan=G0;function X0(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Ch(n),i=Sh(t),o=[];for(let s=0;s<i.length;s++){const a=i[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&o.push(a.toFormattedObject(r))}return o}function RP(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function PP(t){return new Ve({key:new at("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(l=>l.docChanged)&&!n.doc.eq(r.doc),o=e.some(l=>l.getMeta("preventAutolink"));if(!i||o)return;const{tr:s}=r,a=JN(n.doc,[...e]);if(nI(a).forEach(({newRange:l})=>{const u=YN(r.doc,l,h=>h.isTextblock);let c,d;if(u.length>1?(c=u[0],d=r.doc.textBetween(c.pos,c.pos+c.node.nodeSize,void 0," ")):u.length&&r.doc.textBetween(l.from,l.to," "," ").endsWith(" ")&&(c=u[0],d=r.doc.textBetween(c.pos,l.to,void 0," ")),c&&d){const h=d.split(" ").filter(g=>g!=="");if(h.length<=0)return!1;const p=h[h.length-1],f=c.pos+d.lastIndexOf(p);if(!p)return!1;const m=Sh(p).map(g=>g.toObject(t.defaultProtocol));if(!RP(m))return!1;m.filter(g=>g.isLink).map(g=>({...g,from:f+g.start+1,to:f+g.end+1})).filter(g=>r.schema.marks.code?!r.doc.rangeHasMark(g.from,g.to,r.schema.marks.code):!0).filter(g=>t.validate(g.value)).filter(g=>t.shouldAutoLink(g.value)).forEach(g=>{lh(g.from,g.to,r.doc).some(y=>y.mark.type===t.type)||s.addMark(g.from,g.to,t.type.create({href:g.href}))})}}),!!s.steps.length)return s}})}function FP(t){return new Ve({key:new at("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,o;if(r.button!==0||!e.editable)return!1;let s=r.target;const a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(h=>h.nodeName==="A"))return!1;const l=w0(e.state,t.type.name),u=r.target,c=(i=u?.href)!==null&&i!==void 0?i:l.href,d=(o=u?.target)!==null&&o!==void 0?o:l.target;return u&&c?(window.open(c,d),!0):!1}}})}function LP(t){return new Ve({key:new at("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:i}=e,{selection:o}=i,{empty:s}=o;if(s)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const l=X0(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}const VP=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Lr(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(VP,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const BP=zn.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Cg(t);return}Cg(t.scheme,t.optionalSlashes)})},onDestroy(){NP()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Lr(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Lr(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Lr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",et(this.options.HTMLAttributes,t),0]:["a",et(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Lr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Lr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[li({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=X0(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:s=>!!Lr(s,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(o=>e.push({text:o.value,data:{href:o.href},index:o.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(PP({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Lr(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(FP({type:this.type})),this.options.linkOnPaste&&t.push(LP({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),$P=Ke.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Ve({key:new at("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!n)return null;const o=this.editor.isEmpty;return t.descendants((s,a)=>{const l=r>=a&&r<=a+s.nodeSize,u=!s.isLeaf&&Du(s);if((l||!this.options.showOnlyCurrent)&&u){const c=[this.options.emptyNodeClass];o&&c.push(this.options.emptyEditorClass);const d=Mt.node(a,a+s.nodeSize,{class:c.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});i.push(d)}return this.options.includeChildren}),Pe.create(t,i)}}})]}}),jP=/^\s*>\s$/,zP=rn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",et(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[bs({find:jP,type:this.type})]}}),HP=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,qP=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,WP=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,UP=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,KP=zn.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",et(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[to({find:HP,type:this.type}),to({find:WP,type:this.type})]},addPasteRules(){return[li({find:qP,type:this.type}),li({find:UP,type:this.type})]}}),GP="listItem",Sg="textStyle",Tg=/^\s*([-+*])\s$/,JP=rn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",et(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(GP,this.editor.getAttributes(Sg)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=bs({find:Tg,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=bs({find:Tg,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Sg),editor:this.editor})),[t]}}),XP=/(^|[^`])`([^`]+)`(?!`)/,YP=/(^|[^`])`([^`]+)`(?!`)/g,ZP=zn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",et(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[to({find:XP,type:this.type})]},addPasteRules(){return[li({find:YP,type:this.type})]}}),QP=/^```([a-z]+)?[\s\n]$/,eF=/^~~~([a-z]+)?[\s\n]$/,tF=rn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;return[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(i=>i.startsWith(n)).map(i=>i.replace(n,""))[0]||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",et(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
100
+ 3. "-" cannot repeat`);we.customSchemes.push([t,e])}function RP(){we.scanner=TP(we.customSchemes);for(let t=0;t<we.tokenQueue.length;t++)we.tokenQueue[t][1]({scanner:we.scanner});we.parser=MP(we.scanner.tokens);for(let t=0;t<we.pluginQueue.length;t++)we.pluginQueue[t][1]({scanner:we.scanner,parser:we.parser});return we.initialized=!0,we}function Th(t){return we.initialized||RP(),_P(we.parser.start,t,G0(we.scanner.start,t))}Th.scan=G0;function X0(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Sh(n),i=Th(t),o=[];for(let s=0;s<i.length;s++){const a=i[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&o.push(a.toFormattedObject(r))}return o}function PP(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function FP(t){return new Ve({key:new at("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(l=>l.docChanged)&&!n.doc.eq(r.doc),o=e.some(l=>l.getMeta("preventAutolink"));if(!i||o)return;const{tr:s}=r,a=XN(n.doc,[...e]);if(rI(a).forEach(({newRange:l})=>{const u=ZN(r.doc,l,h=>h.isTextblock);let c,d;if(u.length>1?(c=u[0],d=r.doc.textBetween(c.pos,c.pos+c.node.nodeSize,void 0," ")):u.length&&r.doc.textBetween(l.from,l.to," "," ").endsWith(" ")&&(c=u[0],d=r.doc.textBetween(c.pos,l.to,void 0," ")),c&&d){const h=d.split(" ").filter(g=>g!=="");if(h.length<=0)return!1;const p=h[h.length-1],f=c.pos+d.lastIndexOf(p);if(!p)return!1;const m=Th(p).map(g=>g.toObject(t.defaultProtocol));if(!PP(m))return!1;m.filter(g=>g.isLink).map(g=>({...g,from:f+g.start+1,to:f+g.end+1})).filter(g=>r.schema.marks.code?!r.doc.rangeHasMark(g.from,g.to,r.schema.marks.code):!0).filter(g=>t.validate(g.value)).filter(g=>t.shouldAutoLink(g.value)).forEach(g=>{uh(g.from,g.to,r.doc).some(y=>y.mark.type===t.type)||s.addMark(g.from,g.to,t.type.create({href:g.href}))})}}),!!s.steps.length)return s}})}function LP(t){return new Ve({key:new at("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,o;if(r.button!==0||!e.editable)return!1;let s=r.target;const a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(h=>h.nodeName==="A"))return!1;const l=w0(e.state,t.type.name),u=r.target,c=(i=u?.href)!==null&&i!==void 0?i:l.href,d=(o=u?.target)!==null&&o!==void 0?o:l.target;return u&&c?(window.open(c,d),!0):!1}}})}function VP(t){return new Ve({key:new at("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:i}=e,{selection:o}=i,{empty:s}=o;if(s)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const l=X0(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}const BP=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Lr(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(BP,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const $P=zn.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Sg(t);return}Sg(t.scheme,t.optionalSlashes)})},onDestroy(){IP()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Lr(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Lr(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Lr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",et(this.options.HTMLAttributes,t),0]:["a",et(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Lr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Lr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[li({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=X0(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:s=>!!Lr(s,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(o=>e.push({text:o.value,data:{href:o.href},index:o.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(FP({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Lr(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(LP({type:this.type})),this.options.linkOnPaste&&t.push(VP({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),jP=Ke.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Ve({key:new at("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!n)return null;const o=this.editor.isEmpty;return t.descendants((s,a)=>{const l=r>=a&&r<=a+s.nodeSize,u=!s.isLeaf&&Nu(s);if((l||!this.options.showOnlyCurrent)&&u){const c=[this.options.emptyNodeClass];o&&c.push(this.options.emptyEditorClass);const d=Mt.node(a,a+s.nodeSize,{class:c.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});i.push(d)}return this.options.includeChildren}),Pe.create(t,i)}}})]}}),zP=/^\s*>\s$/,HP=on.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",et(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[bs({find:zP,type:this.type})]}}),qP=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,WP=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,UP=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,KP=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,GP=zn.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",et(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[to({find:qP,type:this.type}),to({find:UP,type:this.type})]},addPasteRules(){return[li({find:WP,type:this.type}),li({find:KP,type:this.type})]}}),JP="listItem",Tg="textStyle",Og=/^\s*([-+*])\s$/,XP=on.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",et(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(JP,this.editor.getAttributes(Tg)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=bs({find:Og,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=bs({find:Og,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Tg),editor:this.editor})),[t]}}),YP=/(^|[^`])`([^`]+)`(?!`)/,ZP=/(^|[^`])`([^`]+)`(?!`)/g,QP=zn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",et(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[to({find:YP,type:this.type})]},addPasteRules(){return[li({find:ZP,type:this.type})]}}),eF=/^```([a-z]+)?[\s\n]$/,tF=/^~~~([a-z]+)?[\s\n]$/,nF=on.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;return[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(i=>i.startsWith(n)).map(i=>i.replace(n,""))[0]||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",et(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
101
101
 
102
- `);return!o||!s?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;const s=i.after();return s===void 0?!1:r.nodeAt(s)?t.commands.command(({tr:a})=>(a.setSelection(le.near(r.resolve(s))),!0)):t.commands.exitCode()}}},addInputRules(){return[Rd({find:QP,type:this.type,getAttributes:t=>({language:t[1]})}),Rd({find:eF,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ve({key:new at("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i?.mode;if(!n||!o)return!1;const{tr:s,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,`
103
- `));return s.replaceSelectionWith(this.type.create({language:o},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(oe.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),nF=rn.create({name:"doc",topNode:!0,content:"block+"});function rF(t={}){return new Ve({view(e){return new iF(e,t)}})}class iF{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r;if(n){let a=e.nodeBefore,l=e.nodeAfter;if(a||l){let u=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(u){let c=u.getBoundingClientRect(),d=a?c.bottom:c.top;a&&l&&(d=(d+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:c.left,right:c.right,top:d-this.width/2,bottom:d+this.width/2}}}}if(!r){let a=this.editorView.coordsAtPos(this.cursorPos);r={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let o,s;if(!i||i==document.body&&getComputedStyle(i).position=="static")o=-pageXOffset,s=-pageYOffset;else{let a=i.getBoundingClientRect();o=a.left-i.scrollLeft,s=a.top-i.scrollTop}this.element.style.left=r.left-o+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!o){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=yb(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const oF=Ke.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[rF(this.options)]}});class _e extends le{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return _e.valid(r)?new _e(r):le.near(r)}content(){return V.empty}eq(e){return e instanceof _e&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new _e(e.resolve(n.pos))}getBookmark(){return new Th(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!sF(e)||!aF(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&_e.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){o=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=n;let l=e.doc.resolve(i);if(_e.valid(l))return l}for(;;){let s=n>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!Y.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=s,i+=n;let a=e.doc.resolve(i);if(_e.valid(a))return a}return null}}}_e.prototype.visible=!1;_e.findFrom=_e.findGapCursorFrom;le.jsonID("gapcursor",_e);class Th{constructor(e){this.pos=e}map(e){return new Th(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return _e.valid(n)?new _e(n):le.near(n)}}function sF(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function aF(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function lF(){return new Ve({props:{decorations:pF,createSelectionBetween(t,e,n){return e.pos==n.pos&&_e.valid(n)?new _e(n):null},handleClick:cF,handleKeyDown:uF,handleDOMEvents:{beforeinput:dF}}})}const uF=o0({ArrowLeft:ba("horiz",-1),ArrowRight:ba("horiz",1),ArrowUp:ba("vert",-1),ArrowDown:ba("vert",1)});function ba(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof oe){if(!o.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let u=_e.findGapCursorFrom(a,e,l);return u?(i&&i(r.tr.setSelection(new _e(u))),!0):!1}}function cF(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!_e.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Y.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new _e(r))),!0)}function dF(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof _e))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=A.empty;for(let s=r.length-1;s>=0;s--)i=A.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new V(i,0,0));return o.setSelection(oe.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function pF(t){if(!(t.selection instanceof _e))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Pe.create(t.doc,[Mt.widget(t.selection.head,e,{key:"gapcursor"})])}const hF=Ke.create({name:"gapCursor",addProseMirrorPlugins(){return[lF()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=pe(j(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),fF=rn.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",et(this.options.HTMLAttributes,t)]},renderText(){return`
104
- `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:a}=r.extensionManager,l=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:c})=>{if(c&&l&&s){const d=l.filter(h=>a.includes(h.type.name));u.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),mF=rn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,et(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Rd({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Ul=200,We=function(){};We.prototype.append=function(t){return t.length?(t=We.from(t),!this.length&&t||t.length<Ul&&this.leafAppend(t)||this.length<Ul&&t.leafPrepend(this)||this.appendInner(t)):this};We.prototype.prepend=function(t){return t.length?We.from(t).append(this):this};We.prototype.appendInner=function(t){return new gF(this,t)};We.prototype.slice=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.length),t>=e?We.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))};We.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};We.prototype.forEach=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)};We.prototype.map=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(i,o){return r.push(t(i,o))},e,n),r};We.from=function(t){return t instanceof We?t:t&&t.length?new Y0(t):We.empty};var Y0=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,i){return r==0&&i==this.length?this:new e(this.values.slice(r,i))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,i,o,s){for(var a=i;a<o;a++)if(r(this.values[a],s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){for(var a=i-1;a>=o;a--)if(r(this.values[a],s+a)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=Ul)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=Ul)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(We);We.empty=new Y0([]);var gF=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,r,i,o){var s=this.left.length;if(r<s&&this.left.forEachInner(n,r,Math.min(i,s),o)===!1||i>s&&this.right.forEachInner(n,Math.max(r-s,0),Math.min(this.length,i)-s,o+s)===!1)return!1},e.prototype.forEachInvertedInner=function(n,r,i,o){var s=this.left.length;if(r>s&&this.right.forEachInvertedInner(n,r-s,Math.max(i,s)-s,o+s)===!1||i<s&&this.left.forEachInvertedInner(n,Math.min(r,s),i,o)===!1)return!1},e.prototype.sliceInner=function(n,r){if(n==0&&r==this.length)return this;var i=this.left.length;return r<=i?this.left.slice(n,r):n>=i?this.right.slice(n-i,r-i):this.left.slice(n,i).append(this.right.slice(0,r-i))},e.prototype.leafAppend=function(n){var r=this.right.leafAppend(n);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(n){var r=this.left.leafPrepend(n);if(r)return new e(r,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(We);const vF=500;class Xt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,a,l,u=[],c=[];return this.items.forEach((d,h)=>{if(!d.step){i||(i=this.remapping(r,h+1),o=i.maps.length),o--,c.push(d);return}if(i){c.push(new dn(d.map));let p=d.step.map(i.slice(o)),f;p&&s.maybeStep(p).doc&&(f=s.mapping.maps[s.mapping.maps.length-1],u.push(new dn(f,void 0,void 0,u.length+c.length))),o--,f&&i.appendMap(f,o)}else s.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(o)):d.selection,l=new Xt(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,n,r,i){let o=[],s=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),h=new dn(e.mapping.maps[c],d,n),p;(p=l&&l.merge(h))&&(h=p,c?o.pop():a=a.slice(0,a.length-1)),o.push(h),n&&(s++,n=void 0),i||(l=h)}let u=s-r.depth;return u>bF&&(a=yF(a,u),s-=u),new Xt(a.append(o),s)}remapping(e,n){let r=new Bi;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new Xt(this.items.append(e.map(n=>new dn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=n;this.items.forEach(h=>{let p=o.getMirror(--l);if(p==null)return;s=Math.min(s,p);let f=o.maps[p];if(h.step){let m=e.steps[p].invert(e.docs[p]),g=h.selection&&h.selection.map(o.slice(l+1,p));g&&a++,r.push(new dn(f,m,g))}else r.push(new dn(f))},i);let u=[];for(let h=n;h<s;h++)u.push(new dn(o.maps[h]));let c=this.items.slice(0,i).append(u).append(r),d=new Xt(c,a);return d.emptyItemCount()>vF&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],o=0;return this.items.forEach((s,a)=>{if(a>=e)i.push(s),s.selection&&o++;else if(s.step){let l=s.step.map(n.slice(r)),u=l&&l.getMap();if(r--,u&&n.appendMap(u,r),l){let c=s.selection&&s.selection.map(n.slice(r));c&&o++;let d=new dn(u.invert(),l,c),h,p=i.length-1;(h=i.length&&i[p].merge(d))?i[p]=h:i.push(d)}}else s.map&&r--},this.items.length,0),new Xt(We.from(i.reverse()),o)}}Xt.empty=new Xt(We.empty,0);function yF(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class dn{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new dn(n.getMap().invert(),n,this.selection)}}}class nr{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const bF=20;function kF(t,e,n,r){let i=n.getMeta(ei),o;if(i)return i.historyState;n.getMeta(EF)&&(t=new nr(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(ei))return s.getMeta(ei).redo?new nr(t.done.addTransform(n,void 0,r,La(e)),t.undone,Og(n.mapping.maps),t.prevTime,t.prevComposition):new nr(t.done,t.undone.addTransform(n,void 0,r,La(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!wF(n,t.prevRanges)),u=s?Rc(t.prevRanges,n.mapping):Og(n.mapping.maps);return new nr(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,La(e)),Xt.empty,u,n.time,a??t.prevComposition)}else return(o=n.getMeta("rebased"))?new nr(t.done.rebased(n,o),t.undone.rebased(n,o),Rc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new nr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Rc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function wF(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(n=!0)}),n}function Og(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,o,s)=>e.push(o,s));return e}function Rc(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),o=e.map(t[r+1],-1);i<=o&&n.push(i,o)}return n}function xF(t,e,n){let r=La(e),i=ei.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),a=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),l=new nr(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(s).setMeta(ei,{redo:n,historyState:l})}let Pc=!1,Ag=null;function La(t){let e=t.plugins;if(Ag!=e){Pc=!1,Ag=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Pc=!0;break}}return Pc}const ei=new at("history"),EF=new at("closeHistory");function CF(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ve({key:ei,state:{init(){return new nr(Xt.empty,Xt.empty,null,0,-1)},apply(e,n,r){return kF(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?Q0:r=="historyRedo"?ek:null;return i?(n.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function Z0(t,e){return(n,r)=>{let i=ei.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=xF(i,n,t);o&&r(o.scrollIntoView())}return!0}}const Q0=Z0(!1),ek=Z0(!0),SF=Ke.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Q0(t,e),redo:()=>({state:t,dispatch:e})=>ek(t,e)}},addProseMirrorPlugins(){return[CF(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),TF=rn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",et(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{selection:n}=e,{$from:r,$to:i}=n,o=t();return r.parentOffset===0?o.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):x0(n)?o.insertContentAt(i.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:s,dispatch:a})=>{var l;if(a){const{$to:u}=s.selection,c=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?s.setSelection(oe.create(s.doc,u.pos+1)):u.nodeAfter.isBlock?s.setSelection(Y.create(s.doc,u.pos)):s.setSelection(oe.create(s.doc,u.pos));else{const d=(l=u.parent.type.contentMatch.defaultType)===null||l===void 0?void 0:l.create();d&&(s.insert(c,d),s.setSelection(oe.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[RI({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),OF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,AF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,MF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,_F=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,DF=zn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",et(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[to({find:OF,type:this.type}),to({find:MF,type:this.type})]},addPasteRules(){return[li({find:AF,type:this.type}),li({find:_F,type:this.type})]}}),NF=rn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",et(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),IF="listItem",Mg="textStyle",_g=/^(\d+)\.\s$/,RF=rn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",et(this.options.HTMLAttributes,n),0]:["ol",et(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(IF,this.editor.getAttributes(Mg)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=bs({find:_g,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=bs({find:_g,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Mg)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),PF=rn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",et(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),FF=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,LF=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,VF=zn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",et(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[to({find:FF,type:this.type})]},addPasteRules(){return[li({find:LF,type:this.type})]}}),BF=rn.create({name:"text",group:"inline"}),$F=Ke.create({name:"starterKit",addExtensions(){var t,e,n,r,i,o,s,a,l,u,c,d,h,p,f,m,g,y;const b=[];return this.options.bold!==!1&&b.push(KP.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&b.push(zP.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&b.push(JP.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&b.push(ZP.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&b.push(tF.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&b.push(nF.configure((o=this.options)===null||o===void 0?void 0:o.document)),this.options.dropcursor!==!1&&b.push(oF.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&b.push(hF.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&b.push(fF.configure((l=this.options)===null||l===void 0?void 0:l.hardBreak)),this.options.heading!==!1&&b.push(mF.configure((u=this.options)===null||u===void 0?void 0:u.heading)),this.options.history!==!1&&b.push(SF.configure((c=this.options)===null||c===void 0?void 0:c.history)),this.options.horizontalRule!==!1&&b.push(TF.configure((d=this.options)===null||d===void 0?void 0:d.horizontalRule)),this.options.italic!==!1&&b.push(DF.configure((h=this.options)===null||h===void 0?void 0:h.italic)),this.options.listItem!==!1&&b.push(NF.configure((p=this.options)===null||p===void 0?void 0:p.listItem)),this.options.orderedList!==!1&&b.push(RF.configure((f=this.options)===null||f===void 0?void 0:f.orderedList)),this.options.paragraph!==!1&&b.push(PF.configure((m=this.options)===null||m===void 0?void 0:m.paragraph)),this.options.strike!==!1&&b.push(VF.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&b.push(BF.configure((y=this.options)===null||y===void 0?void 0:y.text)),b}}),jF={class:"k-richtext__menu"},AL=te({__name:"RichText",props:{modelValue:{default:""},disabled:{type:Boolean},actions:{default:()=>["heading2","bold","italic","orderedList","bulletList"]},placeholder:{default:"Write something..."}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=gP({extensions:[$F,$P.configure({placeholder:n.placeholder}),BP.configure({defaultProtocol:"https",protocols:["mailto"],HTMLAttributes:{class:"",rel:"noopener noreferrer nofollow",target:"_blank"}})],editable:!n.disabled,content:n.modelValue,onUpdate:({editor:a})=>{r("update:modelValue",a.getHTML())}}),o=N(()=>!i||!i.value?[]:[{id:"heading2",icon:"fa-pro-regular:heading",action:()=>{var a;return(a=i.value)==null?void 0:a.chain().focus().toggleHeading({level:2}).run()},isActive:()=>{var a;return(a=i.value)==null?void 0:a.isActive("heading",{level:2})}},{id:"bold",icon:"fa-pro-regular:bold",action:()=>{var a;return(a=i.value)==null?void 0:a.chain().focus().toggleBold().run()},isActive:()=>{var a;return(a=i.value)==null?void 0:a.isActive("bold")}},{id:"italic",icon:"fa-pro-regular:italic",action:()=>{var a;return(a=i.value)==null?void 0:a.chain().focus().toggleItalic().run()},isActive:()=>{var a;return(a=i.value)==null?void 0:a.isActive("italic")}},{id:"orderedList",icon:"fa-pro-regular:list-ol",action:()=>{var a;return(a=i.value)==null?void 0:a.chain().focus().toggleOrderedList().run()},isActive:()=>{var a;return(a=i.value)==null?void 0:a.isActive("orderedList")}},{id:"bulletList",icon:"fa-pro-regular:list-ul",action:()=>{var a;return(a=i.value)==null?void 0:a.chain().focus().toggleBulletList().run()},isActive:()=>{var a;return(a=i.value)==null?void 0:a.isActive("bulletList")}}].filter(a=>n.actions.includes(a.id))),s=Cn("k-richtext",{variants:{disabled:{true:"k-richtext--disabled"}}});return Ee(()=>n.modelValue,()=>{if(i.value&&i.value.getHTML()!==n.modelValue)return i.value.commands.setContent(n.modelValue)}),(a,l)=>(E(),O("div",{class:Ce($(s)({disabled:a.disabled}))},[H("div",jF,[he($y,{class:"k-richtext__menu-group",modelValue:[],multiple:!0},{default:Z(({getItemProps:u})=>[(E(!0),O(Ie,null,_t(o.value,c=>(E(),B(ze,{disabled:a.disabled,variant:"tertiary",class:"k-richtext__item","data-part":"item","data-state":`${c.isActive()?"on":"off"}`,onClick:()=>c.action(),icon:c.icon},null,8,["disabled","data-state","onClick","icon"]))),256))]),_:1})]),he($(mP),{editor:$(i),class:"k-richtext__editor"},null,8,["editor"])],2))}});function zF(t){return t%4===0&&t%100!==0||t%400===0}function HF(t=""){if(t.length===10){let e=t.replace(".","-").replace("/","-").split("-");if(e.length===3&&e[0].length===4){let n=parseInt(e[0]),r=parseInt(e[1]),i=parseInt(e[2]);if(r===2){if(zF(n)){if(i>29)return!1}else if(i>28)return!1}if((r===4||r===6||r===9||r===11)&&i>30)return!1}return!0}return!0}function _n(t){let e;if(typeof t=="number"&&(e=new Date(t),typeof e=="object"))return!0;if(e=new Date(t),typeof e=="object")return!(e.toString()==="Invalid Date"||!HF(t));var n=/^\d{4}\-\d{1,2}\-\d{1,2}$/;if(!n.test(t))return!1;var r=t.split("-"),i=parseInt(r[2],10),o=parseInt(r[1],10),s=parseInt(r[0],10);if(s<1e3||s>3e3||o==0||o>12)return!1;var a=[31,28,31,30,31,30,31,31,30,31,30,31];return(s%400==0||s%100!=0&&s%4==0)&&(a[1]=29),i>0&&i<=a[o-1]}var Kl={required:function(t){var e;return t==null?!1:(e=String(t).replace(/\s/g,""),e.length>0)},required_if:function(t,e,n){return e=this.getParameters(),this.validator._objectPath(this.validator.input,e[0])===e[1]?this.validator.getRule("required").validate(t):!0},required_unless:function(t,e,n){return e=this.getParameters(),this.validator._objectPath(this.validator.input,e[0])!==e[1]?this.validator.getRule("required").validate(t):!0},required_with:function(t,e,n){return this.validator._objectPath(this.validator.input,e)?this.validator.getRule("required").validate(t):!0},required_with_all:function(t,e,n){e=this.getParameters();for(var r=0;r<e.length;r++)if(!this.validator._objectPath(this.validator.input,e[r]))return!0;return this.validator.getRule("required").validate(t)},required_without:function(t,e,n){return this.validator._objectPath(this.validator.input,e)?!0:this.validator.getRule("required").validate(t)},required_without_all:function(t,e,n){e=this.getParameters();for(var r=0;r<e.length;r++)if(this.validator._objectPath(this.validator.input,e[r]))return!0;return this.validator.getRule("required").validate(t)},boolean:function(t){return t===!0||t===!1||t===0||t===1||t==="0"||t==="1"||t==="true"||t==="false"},size:function(t,e,n){if(t){e=parseFloat(e);var r=this.getSize();return r===e}return!0},string:function(t,e,n){return typeof t=="string"},sometimes:function(t){return!0},min:function(t,e,n){var r=this.getSize();return r>=e},max:function(t,e,n){var r=this.getSize();return r<=e},between:function(t,e,n){e=this.getParameters();var r=this.getSize(),i=parseFloat(e[0],10),o=parseFloat(e[1],10);return r>=i&&r<=o},email:function(t){var e=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return e.test(t)||(e=/^((?:[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]|[^\u0000-\u007F])+@(?:[a-zA-Z0-9]|[^\u0000-\u007F])(?:(?:[a-zA-Z0-9-]|[^\u0000-\u007F]){0,61}(?:[a-zA-Z0-9]|[^\u0000-\u007F]))?(?:\.(?:[a-zA-Z0-9]|[^\u0000-\u007F])(?:(?:[a-zA-Z0-9-]|[^\u0000-\u007F]){0,61}(?:[a-zA-Z0-9]|[^\u0000-\u007F]))?)+)*$/),e.test(t)},numeric:function(t){var e;return e=Number(t),typeof e=="number"&&!isNaN(e)&&typeof t!="boolean"},array:function(t){return t instanceof Array},url:function(t){return/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_\+.~#?&/=]*)/i.test(t)},alpha:function(t){return/^[a-zA-Z]+$/.test(t)},alpha_dash:function(t){return/^[a-zA-Z0-9_\-]+$/.test(t)},alpha_num:function(t){return/^[a-zA-Z0-9]+$/.test(t)},same:function(t,e){var n=this.validator._flattenObject(this.validator.input)[e],r=t;return n===r},different:function(t,e){var n=this.validator._flattenObject(this.validator.input)[e],r=t;return n!==r},in:function(t,e){var n,r;if(t&&(n=this.getParameters()),t&&!(t instanceof Array)){var i=t;for(r=0;r<n.length;r++)if(typeof n[r]=="string"&&(i=String(t)),i===n[r])return!0;return!1}if(t&&t instanceof Array){for(r=0;r<t.length;r++)if(n.indexOf(t[r])<0)return!1}return!0},not_in:function(t,e){for(var n=this.getParameters(),r=n.length,i=!0,o=0;o<r;o++){var s=t;if(typeof n[o]=="string"&&(s=String(t)),s===n[o]){i=!1;break}}return i},accepted:function(t){return t==="on"||t==="yes"||t===1||t==="1"||t===!0},confirmed:function(t,e,n){var r=n+"_confirmation";return this.validator.input[r]===t},integer:function(t){return String(parseInt(t,10))===String(t)},digits:function(t,e){var n=this.validator.getRule("numeric");return!!(n.validate(t)&&String(t.trim()).length===parseInt(e))},digits_between:function(t){var e=this.validator.getRule("numeric"),n=this.getParameters(),r=String(t).length,i=parseFloat(n[0],10),o=parseFloat(n[1],10);return!!(e.validate(t)&&r>=i&&r<=o)},regex:function(t,e){var n=/[g|i|m]{1,3}$/,r=e.match(n);return r=r?r[0]:"",e=e.replace(n,"").slice(1,-1),e=new RegExp(e,r),!!e.test(t)},date:function(t,e){return _n(t)},present:function(t){return typeof t<"u"},after:function(t,e){var n=this.validator.input[e],r=t;return!_n(n)||!_n(r)?!1:new Date(n).getTime()<new Date(r).getTime()},after_or_equal:function(t,e){var n=this.validator.input[e],r=t;return!_n(n)||!_n(r)?!1:new Date(n).getTime()<=new Date(r).getTime()},before:function(t,e){var n=this.validator.input[e],r=t;return!_n(n)||!_n(r)?!1:new Date(n).getTime()>new Date(r).getTime()},before_or_equal:function(t,e){var n=this.validator.input[e],r=t;return!_n(n)||!_n(r)?!1:new Date(n).getTime()>=new Date(r).getTime()},hex:function(t){return/^[0-9a-f]+$/i.test(t)},ipv4:function(t,e,n){if(typeof t!="string")return!1;var r=/^[0-9]+$/;if(octets=t.split("."),octets.length!=4)return!1;for(let o=0;o<octets.length;o++){const s=octets[o];if(!r.test(s))return!1;var i=parseInt(s);if(i>=256)return!1}return!0},ipv6:function(t,e,n){if(typeof t!="string")return!1;var r=/^[0-9a-f]+$/;if(hextets=t.split(":"),colons=t.match(/::/),colons!=null&&t.match(/::/g).length>1||t[0]==":"&&(colons==null||colons!=null&&colons.index!=0)||t[t.length-1]==":"&&(colons==null||colons!=null&&colons.index!=t.length-2)||3>hextets.length)return!1;var i=hextets.length==9&&colons!=null&&(colons.index==0||colons.index==t.length-2);if(hextets.length>8&&!i||hextets.length!=8&&colons==null)return!1;for(let o=0;o<hextets.length;o++){const s=hextets[o];if(s.length!=0&&(!r.test(s)||s.length>4))return!1}return!0},ip:function(t,e,n){return Kl.ipv4(t,e,n)||Kl.ipv6(t,e,n)}},tk=function(){throw new Error("Validator `"+this.name+"` is not defined!")},nk;function rk(t,e,n){this.name=t,this.fn=e,this.passes=null,this._customMessage=void 0,this.async=n}rk.prototype={validate:function(t,e,n,r){var i=this;if(this._setValidatingData(n,t,e),typeof r=="function"){this.callback=r;var o=function(s,a){i.response(s,a)};return this.async?this._apply(t,e,n,o):o(this._apply(t,e,n))}return this._apply(t,e,n)},_apply:function(t,e,n,r){var i=this.isMissed()?tk:this.fn;return i.apply(this,[t,e,n,r])},_setValidatingData:function(t,e,n){this.attribute=t,this.inputValue=e,this.ruleValue=n},getParameters:function(){var t=[];return typeof this.ruleValue=="string"&&(t=this.ruleValue.split(",")),typeof this.ruleValue=="number"&&t.push(this.ruleValue),this.ruleValue instanceof Array&&(t=this.ruleValue),t},getSize:function(){var t=this.inputValue;return t instanceof Array?t.length:typeof t=="number"?t:this.validator._hasNumericRule(this.attribute)?parseFloat(t,10):t.length},_getValueType:function(){return typeof this.inputValue=="number"||this.validator._hasNumericRule(this.attribute)?"numeric":"string"},response:function(t,e){this.passes=t===void 0||t===!0,this._customMessage=e,this.callback(this.passes,e)},setValidator:function(t){this.validator=t},isMissed:function(){return typeof this.fn!="function"},get customMessage(){return this.isMissed()?nk:this._customMessage}};var qF={asyncRules:[],implicitRules:["required","required_if","required_unless","required_with","required_with_all","required_without","required_without_all","accepted","present"],make:function(t,e){var n=this.isAsync(t),r=new rk(t,Kl[t],n);return r.setValidator(e),r},isAsync:function(t){for(var e=0,n=this.asyncRules.length;e<n;e++)if(this.asyncRules[e]===t)return!0;return!1},isImplicit:function(t){return this.implicitRules.indexOf(t)>-1},register:function(t,e){Kl[t]=e},registerImplicit:function(t,e){this.register(t,e),this.implicitRules.push(t)},registerAsync:function(t,e){this.register(t,e),this.asyncRules.push(t)},registerAsyncImplicit:function(t,e){this.registerImplicit(t,e),this.asyncRules.push(t)},registerMissedRuleValidator:function(t,e){tk=t,nk=e}},WF=qF;function UF(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var KF={between:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{min:n[0],max:n[1]})},digits_between:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{min:n[0],max:n[1]})},required_if:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{other:this._getAttributeName(n[0]),value:n[1]})},required_unless:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{other:this._getAttributeName(n[0]),value:n[1]})},required_with:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{field:this._getAttributeName(n[0])})},required_with_all:function(t,e){var n=e.getParameters(),r=this._getAttributeName.bind(this);return this._replacePlaceholders(e,t,{fields:n.map(r).join(", ")})},required_without:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{field:this._getAttributeName(n[0])})},required_without_all:function(t,e){var n=e.getParameters(),r=this._getAttributeName.bind(this);return this._replacePlaceholders(e,t,{fields:n.map(r).join(", ")})},after:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{after:this._getAttributeName(n[0])})},before:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{before:this._getAttributeName(n[0])})},after_or_equal:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{after_or_equal:this._getAttributeName(n[0])})},before_or_equal:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{before_or_equal:this._getAttributeName(n[0])})},same:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{same:this._getAttributeName(n[0])})}};function GF(t){return t.replace(/[_\[]/g," ").replace(/]/g,"")}var ik={replacements:KF,formatter:GF},Dg=ik,Gd=function(t,e){this.lang=t,this.messages=e,this.customMessages={},this.attributeNames={}};Gd.prototype={constructor:Gd,_setCustom:function(t){this.customMessages=t||{}},_setAttributeNames:function(t){this.attributeNames=t},_setAttributeFormatter:function(t){this.attributeFormatter=t},_getAttributeName:function(t){var e=t;return this.attributeNames.hasOwnProperty(t)?this.attributeNames[t]:(this.messages.attributes.hasOwnProperty(t)&&(e=this.messages.attributes[t]),this.attributeFormatter&&(e=this.attributeFormatter(e)),e)},all:function(){return this.messages},render:function(t){if(t.customMessage)return t.customMessage;var e=this._getTemplate(t),n;return Dg.replacements[t.name]?n=Dg.replacements[t.name].apply(this,[e,t]):n=this._replacePlaceholders(t,e,{}),n},_getTemplate:function(t){for(var e=this.messages,n=e.def,r=this.customMessages,i=[t.name+"."+t.attribute,t.name],o=0,s;o<i.length;o++)if(s=i[o],r.hasOwnProperty(s)){n=r[s];break}else if(e.hasOwnProperty(s)){n=e[s];break}return typeof n=="object"&&(n=n[t._getValueType()]),n},_replacePlaceholders:function(t,e,n){var r,i;if(n.attribute=this._getAttributeName(t.attribute),n[t.name]=n[t.name]||t.getParameters().join(","),typeof e=="string"&&typeof n=="object"){r=e;for(i in n)r=r.replace(new RegExp(":"+i,"g"),n[i])}return r}};var JF=Gd,XF={accepted:"The :attribute must be accepted.",after:"The :attribute must be after :after.",after_or_equal:"The :attribute must be equal or after :after_or_equal.",alpha:"The :attribute field must contain only alphabetic characters.",alpha_dash:"The :attribute field may only contain alpha-numeric characters, as well as dashes and underscores.",alpha_num:"The :attribute field must be alphanumeric.",before:"The :attribute must be before :before.",before_or_equal:"The :attribute must be equal or before :before_or_equal.",between:{numeric:"The :attribute field must be between :min and :max.",string:"The :attribute field must be between :min and :max characters."},confirmed:"The :attribute confirmation does not match.",email:"The :attribute format is invalid.",date:"The :attribute is not a valid date format.",def:"The :attribute attribute has errors.",digits:"The :attribute must be :digits digits.",digits_between:"The :attribute field must be between :min and :max digits.",different:"The :attribute and :different must be different.",in:"The selected :attribute is invalid.",integer:"The :attribute must be an integer.",hex:"The :attribute field should have hexadecimal format",min:{numeric:"The :attribute must be at least :min.",string:"The :attribute must be at least :min characters."},max:{numeric:"The :attribute may not be greater than :max.",string:"The :attribute may not be greater than :max characters."},not_in:"The selected :attribute is invalid.",numeric:"The :attribute must be a number.",present:"The :attribute field must be present (but can be empty).",required:"The :attribute field is required.",required_if:"The :attribute field is required when :other is :value.",required_unless:"The :attribute field is required when :other is not :value.",required_with:"The :attribute field is required when :field is not empty.",required_with_all:"The :attribute field is required when :fields are not empty.",required_without:"The :attribute field is required when :field is empty.",required_without_all:"The :attribute field is required when :fields are empty.",same:"The :attribute and :same fields must match.",size:{numeric:"The :attribute must be :size.",string:"The :attribute must be :size characters."},string:"The :attribute must be a string.",url:"The :attribute format is invalid.",regex:"The :attribute format is invalid.",attributes:{}};const YF=hu(XF);var ZF=JF,QF=UF,eL={messages:{},_set:function(t,e){this.messages[t]=e},_setRuleMessage:function(t,e,n){this._load(t),n===void 0&&(n=this.messages[t].def),this.messages[t][e]=n},_load:function(t){if(!this.messages[t])try{var e=QF("./lang/"+t);this._set(t,e)}catch{}},_get:function(t){return this._load(t),this.messages[t]},_make:function(t){return this._load(t),new ZF(t,this.messages[t])}},ok=eL;const sk=hu(ok);var Jd=function(){this.errors={}};Jd.prototype={constructor:Jd,add:function(t,e){this.has(t)||(this.errors[t]=[]),this.errors[t].indexOf(e)===-1&&this.errors[t].push(e)},get:function(t){return this.has(t)?this.errors[t]:[]},first:function(t){return this.has(t)?this.errors[t][0]:!1},all:function(){return this.errors},has:function(t){return!!this.errors.hasOwnProperty(t)}};var tL=Jd;function ak(t,e){this.onResolvedAll=e,this.onFailedOne=t,this.resolvers={},this.resolversCount=0,this.passed=[],this.failed=[],this.firing=!1}ak.prototype={add:function(t){var e=this.resolversCount;return this.resolvers[e]=t,this.resolversCount++,e},resolve:function(t){var e=this.resolvers[t];e.passes===!0?this.passed.push(e):e.passes===!1&&(this.failed.push(e),this.onFailedOne(e)),this.fire()},isAllResolved:function(){return this.passed.length+this.failed.length===this.resolversCount},fire:function(){this.firing&&this.isAllResolved()&&this.onResolvedAll(this.failed.length===0)},enableFiring:function(){this.firing=!0}};var nL=ak,br=WF,mi=ok,rL=tL,iL=ik,oL=nL,Le=function(t,e,n){var r=Le.getDefaultLang();this.input=t||{},this.messages=mi._make(r),this.messages._setCustom(n),this.setAttributeFormatter(Le.prototype.attributeFormatter),this.errors=new rL,this.errorCount=0,this.hasAsync=!1,this.rules=this._parseRules(e)};Le.prototype={constructor:Le,lang:"en",numericRules:["integer","numeric"],attributeFormatter:iL.formatter,check:function(){for(var t in this.rules){var e=this.rules[t],n=this._objectPath(this.input,t);if(!(this._hasRule(t,["sometimes"])&&!this._suppliedWithData(t)))for(var r=0,i=e.length,o,s,a;r<i&&(s=e[r],o=this.getRule(s.name),!(this._isValidatable(o,n)&&(a=o.validate(n,s.value,t),a||this._addFailure(o),this._shouldStopValidating(t,a))));r++);}return this.errorCount===0},checkAsync:function(t,e){var n=this;t=t||function(){},e=e||function(){};var r=function(f,m){n._addFailure(f,m)},i=function(f){f?t():e()},o=new oL(r,i),s=function(f,m,g,y){return function(){var b=o.add(y);y.validate(f,m.value,g,function(){o.resolve(b)})}};for(var a in this.rules){var l=this.rules[a],u=this._objectPath(this.input,a);if(!(this._hasRule(a,["sometimes"])&&!this._suppliedWithData(a)))for(var c=0,d=l.length,h,p;c<d;c++)p=l[c],h=this.getRule(p.name),this._isValidatable(h,u)&&s(u,p,a,h)()}o.enableFiring(),o.fire()},_addFailure:function(t){var e=this.messages.render(t);this.errors.add(t.attribute,e),this.errorCount++},_flattenObject:function(t){var e={};function n(r,i){if(!(!i&&Object.getOwnPropertyNames(r).length===0))if(Object(r)!==r||Array.isArray(r))e[i]=r;else{var o=!0;for(var s in r)o=!1,n(r[s],i?i+"."+s:s);o&&(e[i]={})}}return t&&n(t),e},_objectPath:function(t,e){if(Object.prototype.hasOwnProperty.call(t,e))return t[e];var n=e.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split("."),r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i]);for(var o=0,s=n.length;o<s;o++)if(typeof r=="object"&&r!==null&&Object.hasOwnProperty.call(r,n[o]))r=r[n[o]];else return;return r},_parseRules:function(t){var e={};t=this._flattenObject(t);for(var n in t){var r=t[n];this._parseRulesCheck(n,r,e)}return e},_parseRulesCheck:function(t,e,n,r){t.indexOf("*")>-1?this._parsedRulesRecurse(t,e,n,r):this._parseRulesDefault(t,e,n,r)},_parsedRulesRecurse:function(t,e,n,r){var i=t.substr(0,t.indexOf("*")-1),o=this._objectPath(this.input,i);if(o)for(var s=0;s<o.length;s++){var a=r?r.slice():[];a.push(s),this._parseRulesCheck(t.replace("*",s),e,n,a)}},_parseRulesDefault:function(t,e,n,r){var i=[];e instanceof Array&&(e=this._prepareRulesArray(e)),typeof e=="string"&&(e=e.split("|"));for(var o=0,s=e.length,a;o<s;o++)a=typeof e[o]=="string"?this._extractRuleAndRuleValue(e[o]):e[o],a.value&&(a.value=this._replaceWildCards(a.value,r),this._replaceWildCardsMessages(r)),br.isAsync(a.name)&&(this.hasAsync=!0),i.push(a);n[t]=i},_replaceWildCards:function(t,e){if(!e)return t;var n=t;return e.forEach(function(r){Array.isArray(n)&&(n=n[0]);const i=n.indexOf("*");if(i===-1)return n;n=n.substr(0,i)+r+n.substr(i+1)}),Array.isArray(t)&&(t[0]=n,n=t),n},_replaceWildCardsMessages:function(t){var e=this.messages.customMessages,n=this;Object.keys(e).forEach(function(r){if(t){var i=n._replaceWildCards(r,t);e[i]=e[r]}}),this.messages._setCustom(e)},_prepareRulesArray:function(t){for(var e=[],n=0,r=t.length;n<r;n++)if(typeof t[n]=="object")for(var i in t[n])e.push({name:i,value:t[n][i]});else e.push(t[n]);return e},_suppliedWithData:function(t){return this.input.hasOwnProperty(t)},_extractRuleAndRuleValue:function(t){var e={},n;return e.name=t,t.indexOf(":")>=0&&(n=t.split(":"),e.name=n[0],e.value=n.slice(1).join(":")),e},_hasRule:function(t,e){for(var n=this.rules[t]||[],r=0,i=n.length;r<i;r++)if(e.indexOf(n[r].name)>-1)return!0;return!1},_hasNumericRule:function(t){return this._hasRule(t,this.numericRules)},_isValidatable:function(t,e){return Array.isArray(e)||br.isImplicit(t.name)?!0:this.getRule("required").validate(e)},_shouldStopValidating:function(t,e){var n=this.stopOnAttributes;return typeof n>"u"||n===!1||e===!0?!1:n instanceof Array?n.indexOf(t)>-1:!0},setAttributeNames:function(t){this.messages._setAttributeNames(t)},setAttributeFormatter:function(t){this.messages._setAttributeFormatter(t)},getRule:function(t){return br.make(t,this)},stopOnError:function(t){this.stopOnAttributes=t},passes:function(t){var e=this._checkAsync("passes",t);return e?this.checkAsync(t):this.check()},fails:function(t){var e=this._checkAsync("fails",t);return e?this.checkAsync(function(){},t):!this.check()},_checkAsync:function(t,e){var n=typeof e=="function";if(this.hasAsync&&!n)throw t+" expects a callback when async rules are being tested.";return this.hasAsync||n}};Le.setMessages=function(t,e){return mi._set(t,e),this};Le.getMessages=function(t){return mi._get(t)};Le.useLang=function(t){this.prototype.lang=t};Le.getDefaultLang=function(){return this.prototype.lang};Le.setAttributeFormatter=function(t){this.prototype.attributeFormatter=t};Le.stopOnError=function(t){this.prototype.stopOnAttributes=t};Le.register=function(t,e,n,r){var i=Le.getDefaultLang();br.register(t,e),mi._setRuleMessage(i,t,n)};Le.registerImplicit=function(t,e,n,r){var i=Le.getDefaultLang();br.registerImplicit(t,e),mi._setRuleMessage(i,t,n)};Le.registerAsync=function(t,e,n,r){var i=Le.getDefaultLang();br.registerAsync(t,e),mi._setRuleMessage(i,t,n)};Le.registerAsyncImplicit=function(t,e,n){var r=Le.getDefaultLang();br.registerAsyncImplicit(t,e),mi._setRuleMessage(r,t,n)};Le.registerMissedRuleValidator=function(t,e){br.registerMissedRuleValidator(t,e)};var sL=Le;const cr=hu(sL);sk._set("en",YF);cr.useLang("en");const Xd=X(!1),aL=t=>{Xd.value=!Xd.value,sk._set("default",t),cr.useLang("default")},lL=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>{const i=n.split(".").pop();return[n,e(i)]})),Yd=(t,e={})=>{const{rule:n="required",prefix:r=""}=e;let i={};return Object.entries(t).forEach(([o,s])=>{const a=r+o;if(Dw(s)){s.map((l,u)=>{i=Object.assign(i,Yd(l,{rule:n,prefix:`${a}.${u}.`}))});return}if(_w(s)){i=Object.assign(i,Yd(s,{rule:n,prefix:`${a}.`}));return}i[a]=n}),i},uL=cr.register,cL=cr.registerAsync;function dL(t={}){const{rules:e,labels:n,data:r,customMessages:i,visitImmediate:o=!1}=t;if(i){let m=cr.getMessages("default");Object.entries(i.value).forEach(([g,y])=>m[g]=y),cr.setMessages("default",m)}let s=new cr({},{}),a=()=>Object.fromEntries(Object.keys(e.value).map(m=>[m,{rule:e.value[m],valid:!c.value.get(m).length,error:c.value.first(m)||void 0,visited:l.value[m]}])),l=X(o?Object.fromEntries(Object.keys(e.value).map(m=>[m,!0])):{}),u=X(!0),c=X(s.errors),d=N(()=>a());function h(m){var g;let y=(g=d.value)==null?void 0:g[m];const b={valid:!0,error:void 0};return!y||!y.visited?b:y}let p=()=>{let m=new cr(r.value,e.value);n&&m.setAttributeNames(n.value);const g=()=>{c.value=s.errors,u.value=!0},y=()=>{u.value=!1,c.value=m.errors};m.checkAsync(g,y)};Ee([r,Xd],p,{deep:!0,immediate:!0});const f=m=>{if(!m)return!1;const g=typeof m=="string"?m.split("|"):Array.isArray(m)?m:[],y={required:()=>!0,required_if:(b,k)=>r.value[b]===k,required_unless:(b,k)=>r.value[b]!==k,required_with:b=>b.some(k=>k in r.value),required_with_all:b=>b.every(k=>k in r.value),required_without:b=>b.some(k=>!(k in r.value)),required_without_all:b=>b.every(k=>!(k in r.value))};for(const b of g){if(typeof b=="string"){if(b==="required")return y.required;const[k,...v]=b.split(":");if(y[k]){const w=v.map(x=>["true",!0,"false",!1].includes(x)?JSON.parse(x):x);return y[k](...w)}}if(typeof b=="object"){for(const[k,v]of Object.entries(b))if(y[k])return Array.isArray(v)?y[k](...v):y[k](v)}}return!1};return{onChange:p,errors:c,passes:u,fields:d,bind:m=>({onBlur:()=>l.value[m]=!0,error:h(m).error,required:f(e.value[m])})}}const ML=Object.freeze(Object.defineProperty({__proto__:null,default:dL,generateLabels:lL,generateRules:Yd,register:uL,registerAsync:cL,setLabels:aL},Symbol.toStringTag,{value:"Module"}));export{du as $,Qg as C,AL as E,dL as G,fL as Q,ze as S,sT as U,su as V,hL as X,mE as Z,ni as _,N1 as a,gL as b,bL as c,kL as d,vL as e,wL as f,TL as g,mL as i,OL as k,yL as l,EL as m,xL as p,Ze as q,Yh as r,IE as s,CL as v,ML as x,SL as y};
102
+ `);return!o||!s?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;const s=i.after();return s===void 0?!1:r.nodeAt(s)?t.commands.command(({tr:a})=>(a.setSelection(le.near(r.resolve(s))),!0)):t.commands.exitCode()}}},addInputRules(){return[Pd({find:eF,type:this.type,getAttributes:t=>({language:t[1]})}),Pd({find:tF,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ve({key:new at("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i?.mode;if(!n||!o)return!1;const{tr:s,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,`
103
+ `));return s.replaceSelectionWith(this.type.create({language:o},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(oe.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),rF=on.create({name:"doc",topNode:!0,content:"block+"});function iF(t={}){return new Ve({view(e){return new oF(e,t)}})}class oF{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r;if(n){let a=e.nodeBefore,l=e.nodeAfter;if(a||l){let u=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(u){let c=u.getBoundingClientRect(),d=a?c.bottom:c.top;a&&l&&(d=(d+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:c.left,right:c.right,top:d-this.width/2,bottom:d+this.width/2}}}}if(!r){let a=this.editorView.coordsAtPos(this.cursorPos);r={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let o,s;if(!i||i==document.body&&getComputedStyle(i).position=="static")o=-pageXOffset,s=-pageYOffset;else{let a=i.getBoundingClientRect();o=a.left-i.scrollLeft,s=a.top-i.scrollTop}this.element.style.left=r.left-o+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!o){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=yb(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const sF=Ke.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[iF(this.options)]}});class _e extends le{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return _e.valid(r)?new _e(r):le.near(r)}content(){return V.empty}eq(e){return e instanceof _e&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new _e(e.resolve(n.pos))}getBookmark(){return new Oh(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!aF(e)||!lF(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&_e.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){o=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=n;let l=e.doc.resolve(i);if(_e.valid(l))return l}for(;;){let s=n>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!Y.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=s,i+=n;let a=e.doc.resolve(i);if(_e.valid(a))return a}return null}}}_e.prototype.visible=!1;_e.findFrom=_e.findGapCursorFrom;le.jsonID("gapcursor",_e);class Oh{constructor(e){this.pos=e}map(e){return new Oh(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return _e.valid(n)?new _e(n):le.near(n)}}function aF(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function lF(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function uF(){return new Ve({props:{decorations:hF,createSelectionBetween(t,e,n){return e.pos==n.pos&&_e.valid(n)?new _e(n):null},handleClick:dF,handleKeyDown:cF,handleDOMEvents:{beforeinput:pF}}})}const cF=o0({ArrowLeft:ba("horiz",-1),ArrowRight:ba("horiz",1),ArrowUp:ba("vert",-1),ArrowDown:ba("vert",1)});function ba(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof oe){if(!o.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let u=_e.findGapCursorFrom(a,e,l);return u?(i&&i(r.tr.setSelection(new _e(u))),!0):!1}}function dF(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!_e.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Y.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new _e(r))),!0)}function pF(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof _e))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=A.empty;for(let s=r.length-1;s>=0;s--)i=A.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new V(i,0,0));return o.setSelection(oe.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function hF(t){if(!(t.selection instanceof _e))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Pe.create(t.doc,[Mt.widget(t.selection.head,e,{key:"gapcursor"})])}const fF=Ke.create({name:"gapCursor",addProseMirrorPlugins(){return[uF()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=pe(j(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),mF=on.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",et(this.options.HTMLAttributes,t)]},renderText(){return`
104
+ `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:a}=r.extensionManager,l=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:c})=>{if(c&&l&&s){const d=l.filter(h=>a.includes(h.type.name));u.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),gF=on.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,et(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Pd({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Ul=200,We=function(){};We.prototype.append=function(t){return t.length?(t=We.from(t),!this.length&&t||t.length<Ul&&this.leafAppend(t)||this.length<Ul&&t.leafPrepend(this)||this.appendInner(t)):this};We.prototype.prepend=function(t){return t.length?We.from(t).append(this):this};We.prototype.appendInner=function(t){return new vF(this,t)};We.prototype.slice=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.length),t>=e?We.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))};We.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};We.prototype.forEach=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)};We.prototype.map=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(i,o){return r.push(t(i,o))},e,n),r};We.from=function(t){return t instanceof We?t:t&&t.length?new Y0(t):We.empty};var Y0=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,i){return r==0&&i==this.length?this:new e(this.values.slice(r,i))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,i,o,s){for(var a=i;a<o;a++)if(r(this.values[a],s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){for(var a=i-1;a>=o;a--)if(r(this.values[a],s+a)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=Ul)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=Ul)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(We);We.empty=new Y0([]);var vF=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,r,i,o){var s=this.left.length;if(r<s&&this.left.forEachInner(n,r,Math.min(i,s),o)===!1||i>s&&this.right.forEachInner(n,Math.max(r-s,0),Math.min(this.length,i)-s,o+s)===!1)return!1},e.prototype.forEachInvertedInner=function(n,r,i,o){var s=this.left.length;if(r>s&&this.right.forEachInvertedInner(n,r-s,Math.max(i,s)-s,o+s)===!1||i<s&&this.left.forEachInvertedInner(n,Math.min(r,s),i,o)===!1)return!1},e.prototype.sliceInner=function(n,r){if(n==0&&r==this.length)return this;var i=this.left.length;return r<=i?this.left.slice(n,r):n>=i?this.right.slice(n-i,r-i):this.left.slice(n,i).append(this.right.slice(0,r-i))},e.prototype.leafAppend=function(n){var r=this.right.leafAppend(n);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(n){var r=this.left.leafPrepend(n);if(r)return new e(r,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(We);const yF=500;class Xt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,a,l,u=[],c=[];return this.items.forEach((d,h)=>{if(!d.step){i||(i=this.remapping(r,h+1),o=i.maps.length),o--,c.push(d);return}if(i){c.push(new pn(d.map));let p=d.step.map(i.slice(o)),f;p&&s.maybeStep(p).doc&&(f=s.mapping.maps[s.mapping.maps.length-1],u.push(new pn(f,void 0,void 0,u.length+c.length))),o--,f&&i.appendMap(f,o)}else s.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(o)):d.selection,l=new Xt(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,n,r,i){let o=[],s=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),h=new pn(e.mapping.maps[c],d,n),p;(p=l&&l.merge(h))&&(h=p,c?o.pop():a=a.slice(0,a.length-1)),o.push(h),n&&(s++,n=void 0),i||(l=h)}let u=s-r.depth;return u>kF&&(a=bF(a,u),s-=u),new Xt(a.append(o),s)}remapping(e,n){let r=new Bi;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new Xt(this.items.append(e.map(n=>new pn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=n;this.items.forEach(h=>{let p=o.getMirror(--l);if(p==null)return;s=Math.min(s,p);let f=o.maps[p];if(h.step){let m=e.steps[p].invert(e.docs[p]),g=h.selection&&h.selection.map(o.slice(l+1,p));g&&a++,r.push(new pn(f,m,g))}else r.push(new pn(f))},i);let u=[];for(let h=n;h<s;h++)u.push(new pn(o.maps[h]));let c=this.items.slice(0,i).append(u).append(r),d=new Xt(c,a);return d.emptyItemCount()>yF&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],o=0;return this.items.forEach((s,a)=>{if(a>=e)i.push(s),s.selection&&o++;else if(s.step){let l=s.step.map(n.slice(r)),u=l&&l.getMap();if(r--,u&&n.appendMap(u,r),l){let c=s.selection&&s.selection.map(n.slice(r));c&&o++;let d=new pn(u.invert(),l,c),h,p=i.length-1;(h=i.length&&i[p].merge(d))?i[p]=h:i.push(d)}}else s.map&&r--},this.items.length,0),new Xt(We.from(i.reverse()),o)}}Xt.empty=new Xt(We.empty,0);function bF(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class pn{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new pn(n.getMap().invert(),n,this.selection)}}}class nr{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const kF=20;function wF(t,e,n,r){let i=n.getMeta(ei),o;if(i)return i.historyState;n.getMeta(CF)&&(t=new nr(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(ei))return s.getMeta(ei).redo?new nr(t.done.addTransform(n,void 0,r,La(e)),t.undone,Ag(n.mapping.maps),t.prevTime,t.prevComposition):new nr(t.done,t.undone.addTransform(n,void 0,r,La(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!xF(n,t.prevRanges)),u=s?Pc(t.prevRanges,n.mapping):Ag(n.mapping.maps);return new nr(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,La(e)),Xt.empty,u,n.time,a??t.prevComposition)}else return(o=n.getMeta("rebased"))?new nr(t.done.rebased(n,o),t.undone.rebased(n,o),Pc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new nr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Pc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function xF(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(n=!0)}),n}function Ag(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,o,s)=>e.push(o,s));return e}function Pc(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),o=e.map(t[r+1],-1);i<=o&&n.push(i,o)}return n}function EF(t,e,n){let r=La(e),i=ei.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),a=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),l=new nr(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(s).setMeta(ei,{redo:n,historyState:l})}let Fc=!1,Mg=null;function La(t){let e=t.plugins;if(Mg!=e){Fc=!1,Mg=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Fc=!0;break}}return Fc}const ei=new at("history"),CF=new at("closeHistory");function SF(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ve({key:ei,state:{init(){return new nr(Xt.empty,Xt.empty,null,0,-1)},apply(e,n,r){return wF(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?Q0:r=="historyRedo"?ek:null;return i?(n.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function Z0(t,e){return(n,r)=>{let i=ei.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=EF(i,n,t);o&&r(o.scrollIntoView())}return!0}}const Q0=Z0(!1),ek=Z0(!0),TF=Ke.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Q0(t,e),redo:()=>({state:t,dispatch:e})=>ek(t,e)}},addProseMirrorPlugins(){return[SF(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),OF=on.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",et(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{selection:n}=e,{$from:r,$to:i}=n,o=t();return r.parentOffset===0?o.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):x0(n)?o.insertContentAt(i.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:s,dispatch:a})=>{var l;if(a){const{$to:u}=s.selection,c=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?s.setSelection(oe.create(s.doc,u.pos+1)):u.nodeAfter.isBlock?s.setSelection(Y.create(s.doc,u.pos)):s.setSelection(oe.create(s.doc,u.pos));else{const d=(l=u.parent.type.contentMatch.defaultType)===null||l===void 0?void 0:l.create();d&&(s.insert(c,d),s.setSelection(oe.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[PI({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),AF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,MF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,_F=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,DF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,NF=zn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",et(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[to({find:AF,type:this.type}),to({find:_F,type:this.type})]},addPasteRules(){return[li({find:MF,type:this.type}),li({find:DF,type:this.type})]}}),IF=on.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",et(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),RF="listItem",_g="textStyle",Dg=/^(\d+)\.\s$/,PF=on.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",et(this.options.HTMLAttributes,n),0]:["ol",et(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(RF,this.editor.getAttributes(_g)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=bs({find:Dg,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=bs({find:Dg,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(_g)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),FF=on.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",et(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),LF=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,VF=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,BF=zn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",et(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[to({find:LF,type:this.type})]},addPasteRules(){return[li({find:VF,type:this.type})]}}),$F=on.create({name:"text",group:"inline"}),jF=Ke.create({name:"starterKit",addExtensions(){var t,e,n,r,i,o,s,a,l,u,c,d,h,p,f,m,g,y;const b=[];return this.options.bold!==!1&&b.push(GP.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&b.push(HP.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&b.push(XP.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&b.push(QP.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&b.push(nF.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&b.push(rF.configure((o=this.options)===null||o===void 0?void 0:o.document)),this.options.dropcursor!==!1&&b.push(sF.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&b.push(fF.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&b.push(mF.configure((l=this.options)===null||l===void 0?void 0:l.hardBreak)),this.options.heading!==!1&&b.push(gF.configure((u=this.options)===null||u===void 0?void 0:u.heading)),this.options.history!==!1&&b.push(TF.configure((c=this.options)===null||c===void 0?void 0:c.history)),this.options.horizontalRule!==!1&&b.push(OF.configure((d=this.options)===null||d===void 0?void 0:d.horizontalRule)),this.options.italic!==!1&&b.push(NF.configure((h=this.options)===null||h===void 0?void 0:h.italic)),this.options.listItem!==!1&&b.push(IF.configure((p=this.options)===null||p===void 0?void 0:p.listItem)),this.options.orderedList!==!1&&b.push(PF.configure((f=this.options)===null||f===void 0?void 0:f.orderedList)),this.options.paragraph!==!1&&b.push(FF.configure((m=this.options)===null||m===void 0?void 0:m.paragraph)),this.options.strike!==!1&&b.push(BF.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&b.push($F.configure((y=this.options)===null||y===void 0?void 0:y.text)),b}}),zF={class:"k-richtext__menu"},_L=Q({__name:"RichText",props:{modelValue:{default:""},disabled:{type:Boolean},actions:{default:()=>["heading2","bold","italic","orderedList","bulletList"]},placeholder:{default:"Write something..."}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=vP({extensions:[jF,jP.configure({placeholder:n.placeholder}),$P.configure({defaultProtocol:"https",protocols:["mailto"],HTMLAttributes:{class:"",rel:"noopener noreferrer nofollow",target:"_blank"}})],editable:!n.disabled,content:n.modelValue,onUpdate:({editor:a})=>{r("update:modelValue",a.getHTML())}}),o=D(()=>!i||!i.value?[]:[{id:"heading2",icon:"fa-pro-regular:heading",action:()=>{var a;return(a=i.value)==null?void 0:a.chain().focus().toggleHeading({level:2}).run()},isActive:()=>{var a;return(a=i.value)==null?void 0:a.isActive("heading",{level:2})}},{id:"bold",icon:"fa-pro-regular:bold",action:()=>{var a;return(a=i.value)==null?void 0:a.chain().focus().toggleBold().run()},isActive:()=>{var a;return(a=i.value)==null?void 0:a.isActive("bold")}},{id:"italic",icon:"fa-pro-regular:italic",action:()=>{var a;return(a=i.value)==null?void 0:a.chain().focus().toggleItalic().run()},isActive:()=>{var a;return(a=i.value)==null?void 0:a.isActive("italic")}},{id:"orderedList",icon:"fa-pro-regular:list-ol",action:()=>{var a;return(a=i.value)==null?void 0:a.chain().focus().toggleOrderedList().run()},isActive:()=>{var a;return(a=i.value)==null?void 0:a.isActive("orderedList")}},{id:"bulletList",icon:"fa-pro-regular:list-ul",action:()=>{var a;return(a=i.value)==null?void 0:a.chain().focus().toggleBulletList().run()},isActive:()=>{var a;return(a=i.value)==null?void 0:a.isActive("bulletList")}}].filter(a=>n.actions.includes(a.id))),s=rn("k-richtext",{variants:{disabled:{true:"k-richtext--disabled"}}});return Ee(()=>n.modelValue,()=>{if(i.value&&i.value.getHTML()!==n.modelValue)return i.value.commands.setContent(n.modelValue)}),(a,l)=>(E(),O("div",{class:Ce(B(s)({disabled:a.disabled}))},[H("div",zF,[he($y,{class:"k-richtext__menu-group",modelValue:[],multiple:!0},{default:Z(({getItemProps:u})=>[(E(!0),O(Ie,null,_t(o.value,c=>(E(),$(ze,{disabled:a.disabled,variant:"tertiary",class:"k-richtext__item","data-part":"item","data-state":`${c.isActive()?"on":"off"}`,onClick:()=>c.action(),icon:c.icon},null,8,["disabled","data-state","onClick","icon"]))),256))]),_:1})]),he(B(gP),{editor:B(i),class:"k-richtext__editor"},null,8,["editor"])],2))}});function HF(t){return t%4===0&&t%100!==0||t%400===0}function qF(t=""){if(t.length===10){let e=t.replace(".","-").replace("/","-").split("-");if(e.length===3&&e[0].length===4){let n=parseInt(e[0]),r=parseInt(e[1]),i=parseInt(e[2]);if(r===2){if(HF(n)){if(i>29)return!1}else if(i>28)return!1}if((r===4||r===6||r===9||r===11)&&i>30)return!1}return!0}return!0}function _n(t){let e;if(typeof t=="number"&&(e=new Date(t),typeof e=="object"))return!0;if(e=new Date(t),typeof e=="object")return!(e.toString()==="Invalid Date"||!qF(t));var n=/^\d{4}\-\d{1,2}\-\d{1,2}$/;if(!n.test(t))return!1;var r=t.split("-"),i=parseInt(r[2],10),o=parseInt(r[1],10),s=parseInt(r[0],10);if(s<1e3||s>3e3||o==0||o>12)return!1;var a=[31,28,31,30,31,30,31,31,30,31,30,31];return(s%400==0||s%100!=0&&s%4==0)&&(a[1]=29),i>0&&i<=a[o-1]}var Kl={required:function(t){var e;return t==null?!1:(e=String(t).replace(/\s/g,""),e.length>0)},required_if:function(t,e,n){return e=this.getParameters(),this.validator._objectPath(this.validator.input,e[0])===e[1]?this.validator.getRule("required").validate(t):!0},required_unless:function(t,e,n){return e=this.getParameters(),this.validator._objectPath(this.validator.input,e[0])!==e[1]?this.validator.getRule("required").validate(t):!0},required_with:function(t,e,n){return this.validator._objectPath(this.validator.input,e)?this.validator.getRule("required").validate(t):!0},required_with_all:function(t,e,n){e=this.getParameters();for(var r=0;r<e.length;r++)if(!this.validator._objectPath(this.validator.input,e[r]))return!0;return this.validator.getRule("required").validate(t)},required_without:function(t,e,n){return this.validator._objectPath(this.validator.input,e)?!0:this.validator.getRule("required").validate(t)},required_without_all:function(t,e,n){e=this.getParameters();for(var r=0;r<e.length;r++)if(this.validator._objectPath(this.validator.input,e[r]))return!0;return this.validator.getRule("required").validate(t)},boolean:function(t){return t===!0||t===!1||t===0||t===1||t==="0"||t==="1"||t==="true"||t==="false"},size:function(t,e,n){if(t){e=parseFloat(e);var r=this.getSize();return r===e}return!0},string:function(t,e,n){return typeof t=="string"},sometimes:function(t){return!0},min:function(t,e,n){var r=this.getSize();return r>=e},max:function(t,e,n){var r=this.getSize();return r<=e},between:function(t,e,n){e=this.getParameters();var r=this.getSize(),i=parseFloat(e[0],10),o=parseFloat(e[1],10);return r>=i&&r<=o},email:function(t){var e=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return e.test(t)||(e=/^((?:[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]|[^\u0000-\u007F])+@(?:[a-zA-Z0-9]|[^\u0000-\u007F])(?:(?:[a-zA-Z0-9-]|[^\u0000-\u007F]){0,61}(?:[a-zA-Z0-9]|[^\u0000-\u007F]))?(?:\.(?:[a-zA-Z0-9]|[^\u0000-\u007F])(?:(?:[a-zA-Z0-9-]|[^\u0000-\u007F]){0,61}(?:[a-zA-Z0-9]|[^\u0000-\u007F]))?)+)*$/),e.test(t)},numeric:function(t){var e;return e=Number(t),typeof e=="number"&&!isNaN(e)&&typeof t!="boolean"},array:function(t){return t instanceof Array},url:function(t){return/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_\+.~#?&/=]*)/i.test(t)},alpha:function(t){return/^[a-zA-Z]+$/.test(t)},alpha_dash:function(t){return/^[a-zA-Z0-9_\-]+$/.test(t)},alpha_num:function(t){return/^[a-zA-Z0-9]+$/.test(t)},same:function(t,e){var n=this.validator._flattenObject(this.validator.input)[e],r=t;return n===r},different:function(t,e){var n=this.validator._flattenObject(this.validator.input)[e],r=t;return n!==r},in:function(t,e){var n,r;if(t&&(n=this.getParameters()),t&&!(t instanceof Array)){var i=t;for(r=0;r<n.length;r++)if(typeof n[r]=="string"&&(i=String(t)),i===n[r])return!0;return!1}if(t&&t instanceof Array){for(r=0;r<t.length;r++)if(n.indexOf(t[r])<0)return!1}return!0},not_in:function(t,e){for(var n=this.getParameters(),r=n.length,i=!0,o=0;o<r;o++){var s=t;if(typeof n[o]=="string"&&(s=String(t)),s===n[o]){i=!1;break}}return i},accepted:function(t){return t==="on"||t==="yes"||t===1||t==="1"||t===!0},confirmed:function(t,e,n){var r=n+"_confirmation";return this.validator.input[r]===t},integer:function(t){return String(parseInt(t,10))===String(t)},digits:function(t,e){var n=this.validator.getRule("numeric");return!!(n.validate(t)&&String(t.trim()).length===parseInt(e))},digits_between:function(t){var e=this.validator.getRule("numeric"),n=this.getParameters(),r=String(t).length,i=parseFloat(n[0],10),o=parseFloat(n[1],10);return!!(e.validate(t)&&r>=i&&r<=o)},regex:function(t,e){var n=/[g|i|m]{1,3}$/,r=e.match(n);return r=r?r[0]:"",e=e.replace(n,"").slice(1,-1),e=new RegExp(e,r),!!e.test(t)},date:function(t,e){return _n(t)},present:function(t){return typeof t<"u"},after:function(t,e){var n=this.validator.input[e],r=t;return!_n(n)||!_n(r)?!1:new Date(n).getTime()<new Date(r).getTime()},after_or_equal:function(t,e){var n=this.validator.input[e],r=t;return!_n(n)||!_n(r)?!1:new Date(n).getTime()<=new Date(r).getTime()},before:function(t,e){var n=this.validator.input[e],r=t;return!_n(n)||!_n(r)?!1:new Date(n).getTime()>new Date(r).getTime()},before_or_equal:function(t,e){var n=this.validator.input[e],r=t;return!_n(n)||!_n(r)?!1:new Date(n).getTime()>=new Date(r).getTime()},hex:function(t){return/^[0-9a-f]+$/i.test(t)},ipv4:function(t,e,n){if(typeof t!="string")return!1;var r=/^[0-9]+$/;if(octets=t.split("."),octets.length!=4)return!1;for(let o=0;o<octets.length;o++){const s=octets[o];if(!r.test(s))return!1;var i=parseInt(s);if(i>=256)return!1}return!0},ipv6:function(t,e,n){if(typeof t!="string")return!1;var r=/^[0-9a-f]+$/;if(hextets=t.split(":"),colons=t.match(/::/),colons!=null&&t.match(/::/g).length>1||t[0]==":"&&(colons==null||colons!=null&&colons.index!=0)||t[t.length-1]==":"&&(colons==null||colons!=null&&colons.index!=t.length-2)||3>hextets.length)return!1;var i=hextets.length==9&&colons!=null&&(colons.index==0||colons.index==t.length-2);if(hextets.length>8&&!i||hextets.length!=8&&colons==null)return!1;for(let o=0;o<hextets.length;o++){const s=hextets[o];if(s.length!=0&&(!r.test(s)||s.length>4))return!1}return!0},ip:function(t,e,n){return Kl.ipv4(t,e,n)||Kl.ipv6(t,e,n)}},tk=function(){throw new Error("Validator `"+this.name+"` is not defined!")},nk;function rk(t,e,n){this.name=t,this.fn=e,this.passes=null,this._customMessage=void 0,this.async=n}rk.prototype={validate:function(t,e,n,r){var i=this;if(this._setValidatingData(n,t,e),typeof r=="function"){this.callback=r;var o=function(s,a){i.response(s,a)};return this.async?this._apply(t,e,n,o):o(this._apply(t,e,n))}return this._apply(t,e,n)},_apply:function(t,e,n,r){var i=this.isMissed()?tk:this.fn;return i.apply(this,[t,e,n,r])},_setValidatingData:function(t,e,n){this.attribute=t,this.inputValue=e,this.ruleValue=n},getParameters:function(){var t=[];return typeof this.ruleValue=="string"&&(t=this.ruleValue.split(",")),typeof this.ruleValue=="number"&&t.push(this.ruleValue),this.ruleValue instanceof Array&&(t=this.ruleValue),t},getSize:function(){var t=this.inputValue;return t instanceof Array?t.length:typeof t=="number"?t:this.validator._hasNumericRule(this.attribute)?parseFloat(t,10):t.length},_getValueType:function(){return typeof this.inputValue=="number"||this.validator._hasNumericRule(this.attribute)?"numeric":"string"},response:function(t,e){this.passes=t===void 0||t===!0,this._customMessage=e,this.callback(this.passes,e)},setValidator:function(t){this.validator=t},isMissed:function(){return typeof this.fn!="function"},get customMessage(){return this.isMissed()?nk:this._customMessage}};var WF={asyncRules:[],implicitRules:["required","required_if","required_unless","required_with","required_with_all","required_without","required_without_all","accepted","present"],make:function(t,e){var n=this.isAsync(t),r=new rk(t,Kl[t],n);return r.setValidator(e),r},isAsync:function(t){for(var e=0,n=this.asyncRules.length;e<n;e++)if(this.asyncRules[e]===t)return!0;return!1},isImplicit:function(t){return this.implicitRules.indexOf(t)>-1},register:function(t,e){Kl[t]=e},registerImplicit:function(t,e){this.register(t,e),this.implicitRules.push(t)},registerAsync:function(t,e){this.register(t,e),this.asyncRules.push(t)},registerAsyncImplicit:function(t,e){this.registerImplicit(t,e),this.asyncRules.push(t)},registerMissedRuleValidator:function(t,e){tk=t,nk=e}},UF=WF;function KF(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var GF={between:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{min:n[0],max:n[1]})},digits_between:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{min:n[0],max:n[1]})},required_if:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{other:this._getAttributeName(n[0]),value:n[1]})},required_unless:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{other:this._getAttributeName(n[0]),value:n[1]})},required_with:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{field:this._getAttributeName(n[0])})},required_with_all:function(t,e){var n=e.getParameters(),r=this._getAttributeName.bind(this);return this._replacePlaceholders(e,t,{fields:n.map(r).join(", ")})},required_without:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{field:this._getAttributeName(n[0])})},required_without_all:function(t,e){var n=e.getParameters(),r=this._getAttributeName.bind(this);return this._replacePlaceholders(e,t,{fields:n.map(r).join(", ")})},after:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{after:this._getAttributeName(n[0])})},before:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{before:this._getAttributeName(n[0])})},after_or_equal:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{after_or_equal:this._getAttributeName(n[0])})},before_or_equal:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{before_or_equal:this._getAttributeName(n[0])})},same:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{same:this._getAttributeName(n[0])})}};function JF(t){return t.replace(/[_\[]/g," ").replace(/]/g,"")}var ik={replacements:GF,formatter:JF},Ng=ik,Jd=function(t,e){this.lang=t,this.messages=e,this.customMessages={},this.attributeNames={}};Jd.prototype={constructor:Jd,_setCustom:function(t){this.customMessages=t||{}},_setAttributeNames:function(t){this.attributeNames=t},_setAttributeFormatter:function(t){this.attributeFormatter=t},_getAttributeName:function(t){var e=t;return this.attributeNames.hasOwnProperty(t)?this.attributeNames[t]:(this.messages.attributes.hasOwnProperty(t)&&(e=this.messages.attributes[t]),this.attributeFormatter&&(e=this.attributeFormatter(e)),e)},all:function(){return this.messages},render:function(t){if(t.customMessage)return t.customMessage;var e=this._getTemplate(t),n;return Ng.replacements[t.name]?n=Ng.replacements[t.name].apply(this,[e,t]):n=this._replacePlaceholders(t,e,{}),n},_getTemplate:function(t){for(var e=this.messages,n=e.def,r=this.customMessages,i=[t.name+"."+t.attribute,t.name],o=0,s;o<i.length;o++)if(s=i[o],r.hasOwnProperty(s)){n=r[s];break}else if(e.hasOwnProperty(s)){n=e[s];break}return typeof n=="object"&&(n=n[t._getValueType()]),n},_replacePlaceholders:function(t,e,n){var r,i;if(n.attribute=this._getAttributeName(t.attribute),n[t.name]=n[t.name]||t.getParameters().join(","),typeof e=="string"&&typeof n=="object"){r=e;for(i in n)r=r.replace(new RegExp(":"+i,"g"),n[i])}return r}};var XF=Jd,YF={accepted:"The :attribute must be accepted.",after:"The :attribute must be after :after.",after_or_equal:"The :attribute must be equal or after :after_or_equal.",alpha:"The :attribute field must contain only alphabetic characters.",alpha_dash:"The :attribute field may only contain alpha-numeric characters, as well as dashes and underscores.",alpha_num:"The :attribute field must be alphanumeric.",before:"The :attribute must be before :before.",before_or_equal:"The :attribute must be equal or before :before_or_equal.",between:{numeric:"The :attribute field must be between :min and :max.",string:"The :attribute field must be between :min and :max characters."},confirmed:"The :attribute confirmation does not match.",email:"The :attribute format is invalid.",date:"The :attribute is not a valid date format.",def:"The :attribute attribute has errors.",digits:"The :attribute must be :digits digits.",digits_between:"The :attribute field must be between :min and :max digits.",different:"The :attribute and :different must be different.",in:"The selected :attribute is invalid.",integer:"The :attribute must be an integer.",hex:"The :attribute field should have hexadecimal format",min:{numeric:"The :attribute must be at least :min.",string:"The :attribute must be at least :min characters."},max:{numeric:"The :attribute may not be greater than :max.",string:"The :attribute may not be greater than :max characters."},not_in:"The selected :attribute is invalid.",numeric:"The :attribute must be a number.",present:"The :attribute field must be present (but can be empty).",required:"The :attribute field is required.",required_if:"The :attribute field is required when :other is :value.",required_unless:"The :attribute field is required when :other is not :value.",required_with:"The :attribute field is required when :field is not empty.",required_with_all:"The :attribute field is required when :fields are not empty.",required_without:"The :attribute field is required when :field is empty.",required_without_all:"The :attribute field is required when :fields are empty.",same:"The :attribute and :same fields must match.",size:{numeric:"The :attribute must be :size.",string:"The :attribute must be :size characters."},string:"The :attribute must be a string.",url:"The :attribute format is invalid.",regex:"The :attribute format is invalid.",attributes:{}};const ZF=fu(YF);var QF=XF,eL=KF,tL={messages:{},_set:function(t,e){this.messages[t]=e},_setRuleMessage:function(t,e,n){this._load(t),n===void 0&&(n=this.messages[t].def),this.messages[t][e]=n},_load:function(t){if(!this.messages[t])try{var e=eL("./lang/"+t);this._set(t,e)}catch{}},_get:function(t){return this._load(t),this.messages[t]},_make:function(t){return this._load(t),new QF(t,this.messages[t])}},ok=tL;const sk=fu(ok);var Xd=function(){this.errors={}};Xd.prototype={constructor:Xd,add:function(t,e){this.has(t)||(this.errors[t]=[]),this.errors[t].indexOf(e)===-1&&this.errors[t].push(e)},get:function(t){return this.has(t)?this.errors[t]:[]},first:function(t){return this.has(t)?this.errors[t][0]:!1},all:function(){return this.errors},has:function(t){return!!this.errors.hasOwnProperty(t)}};var nL=Xd;function ak(t,e){this.onResolvedAll=e,this.onFailedOne=t,this.resolvers={},this.resolversCount=0,this.passed=[],this.failed=[],this.firing=!1}ak.prototype={add:function(t){var e=this.resolversCount;return this.resolvers[e]=t,this.resolversCount++,e},resolve:function(t){var e=this.resolvers[t];e.passes===!0?this.passed.push(e):e.passes===!1&&(this.failed.push(e),this.onFailedOne(e)),this.fire()},isAllResolved:function(){return this.passed.length+this.failed.length===this.resolversCount},fire:function(){this.firing&&this.isAllResolved()&&this.onResolvedAll(this.failed.length===0)},enableFiring:function(){this.firing=!0}};var rL=ak,br=UF,mi=ok,iL=nL,oL=ik,sL=rL,Le=function(t,e,n){var r=Le.getDefaultLang();this.input=t||{},this.messages=mi._make(r),this.messages._setCustom(n),this.setAttributeFormatter(Le.prototype.attributeFormatter),this.errors=new iL,this.errorCount=0,this.hasAsync=!1,this.rules=this._parseRules(e)};Le.prototype={constructor:Le,lang:"en",numericRules:["integer","numeric"],attributeFormatter:oL.formatter,check:function(){for(var t in this.rules){var e=this.rules[t],n=this._objectPath(this.input,t);if(!(this._hasRule(t,["sometimes"])&&!this._suppliedWithData(t)))for(var r=0,i=e.length,o,s,a;r<i&&(s=e[r],o=this.getRule(s.name),!(this._isValidatable(o,n)&&(a=o.validate(n,s.value,t),a||this._addFailure(o),this._shouldStopValidating(t,a))));r++);}return this.errorCount===0},checkAsync:function(t,e){var n=this;t=t||function(){},e=e||function(){};var r=function(f,m){n._addFailure(f,m)},i=function(f){f?t():e()},o=new sL(r,i),s=function(f,m,g,y){return function(){var b=o.add(y);y.validate(f,m.value,g,function(){o.resolve(b)})}};for(var a in this.rules){var l=this.rules[a],u=this._objectPath(this.input,a);if(!(this._hasRule(a,["sometimes"])&&!this._suppliedWithData(a)))for(var c=0,d=l.length,h,p;c<d;c++)p=l[c],h=this.getRule(p.name),this._isValidatable(h,u)&&s(u,p,a,h)()}o.enableFiring(),o.fire()},_addFailure:function(t){var e=this.messages.render(t);this.errors.add(t.attribute,e),this.errorCount++},_flattenObject:function(t){var e={};function n(r,i){if(!(!i&&Object.getOwnPropertyNames(r).length===0))if(Object(r)!==r||Array.isArray(r))e[i]=r;else{var o=!0;for(var s in r)o=!1,n(r[s],i?i+"."+s:s);o&&(e[i]={})}}return t&&n(t),e},_objectPath:function(t,e){if(Object.prototype.hasOwnProperty.call(t,e))return t[e];var n=e.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split("."),r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i]);for(var o=0,s=n.length;o<s;o++)if(typeof r=="object"&&r!==null&&Object.hasOwnProperty.call(r,n[o]))r=r[n[o]];else return;return r},_parseRules:function(t){var e={};t=this._flattenObject(t);for(var n in t){var r=t[n];this._parseRulesCheck(n,r,e)}return e},_parseRulesCheck:function(t,e,n,r){t.indexOf("*")>-1?this._parsedRulesRecurse(t,e,n,r):this._parseRulesDefault(t,e,n,r)},_parsedRulesRecurse:function(t,e,n,r){var i=t.substr(0,t.indexOf("*")-1),o=this._objectPath(this.input,i);if(o)for(var s=0;s<o.length;s++){var a=r?r.slice():[];a.push(s),this._parseRulesCheck(t.replace("*",s),e,n,a)}},_parseRulesDefault:function(t,e,n,r){var i=[];e instanceof Array&&(e=this._prepareRulesArray(e)),typeof e=="string"&&(e=e.split("|"));for(var o=0,s=e.length,a;o<s;o++)a=typeof e[o]=="string"?this._extractRuleAndRuleValue(e[o]):e[o],a.value&&(a.value=this._replaceWildCards(a.value,r),this._replaceWildCardsMessages(r)),br.isAsync(a.name)&&(this.hasAsync=!0),i.push(a);n[t]=i},_replaceWildCards:function(t,e){if(!e)return t;var n=t;return e.forEach(function(r){Array.isArray(n)&&(n=n[0]);const i=n.indexOf("*");if(i===-1)return n;n=n.substr(0,i)+r+n.substr(i+1)}),Array.isArray(t)&&(t[0]=n,n=t),n},_replaceWildCardsMessages:function(t){var e=this.messages.customMessages,n=this;Object.keys(e).forEach(function(r){if(t){var i=n._replaceWildCards(r,t);e[i]=e[r]}}),this.messages._setCustom(e)},_prepareRulesArray:function(t){for(var e=[],n=0,r=t.length;n<r;n++)if(typeof t[n]=="object")for(var i in t[n])e.push({name:i,value:t[n][i]});else e.push(t[n]);return e},_suppliedWithData:function(t){return this.input.hasOwnProperty(t)},_extractRuleAndRuleValue:function(t){var e={},n;return e.name=t,t.indexOf(":")>=0&&(n=t.split(":"),e.name=n[0],e.value=n.slice(1).join(":")),e},_hasRule:function(t,e){for(var n=this.rules[t]||[],r=0,i=n.length;r<i;r++)if(e.indexOf(n[r].name)>-1)return!0;return!1},_hasNumericRule:function(t){return this._hasRule(t,this.numericRules)},_isValidatable:function(t,e){return Array.isArray(e)||br.isImplicit(t.name)?!0:this.getRule("required").validate(e)},_shouldStopValidating:function(t,e){var n=this.stopOnAttributes;return typeof n>"u"||n===!1||e===!0?!1:n instanceof Array?n.indexOf(t)>-1:!0},setAttributeNames:function(t){this.messages._setAttributeNames(t)},setAttributeFormatter:function(t){this.messages._setAttributeFormatter(t)},getRule:function(t){return br.make(t,this)},stopOnError:function(t){this.stopOnAttributes=t},passes:function(t){var e=this._checkAsync("passes",t);return e?this.checkAsync(t):this.check()},fails:function(t){var e=this._checkAsync("fails",t);return e?this.checkAsync(function(){},t):!this.check()},_checkAsync:function(t,e){var n=typeof e=="function";if(this.hasAsync&&!n)throw t+" expects a callback when async rules are being tested.";return this.hasAsync||n}};Le.setMessages=function(t,e){return mi._set(t,e),this};Le.getMessages=function(t){return mi._get(t)};Le.useLang=function(t){this.prototype.lang=t};Le.getDefaultLang=function(){return this.prototype.lang};Le.setAttributeFormatter=function(t){this.prototype.attributeFormatter=t};Le.stopOnError=function(t){this.prototype.stopOnAttributes=t};Le.register=function(t,e,n,r){var i=Le.getDefaultLang();br.register(t,e),mi._setRuleMessage(i,t,n)};Le.registerImplicit=function(t,e,n,r){var i=Le.getDefaultLang();br.registerImplicit(t,e),mi._setRuleMessage(i,t,n)};Le.registerAsync=function(t,e,n,r){var i=Le.getDefaultLang();br.registerAsync(t,e),mi._setRuleMessage(i,t,n)};Le.registerAsyncImplicit=function(t,e,n){var r=Le.getDefaultLang();br.registerAsyncImplicit(t,e),mi._setRuleMessage(r,t,n)};Le.registerMissedRuleValidator=function(t,e){br.registerMissedRuleValidator(t,e)};var aL=Le;const cr=fu(aL);sk._set("en",ZF);cr.useLang("en");const Yd=X(!1),lL=t=>{Yd.value=!Yd.value,sk._set("default",t),cr.useLang("default")},uL=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>{const i=n.split(".").pop();return[n,e(i)]})),Zd=(t,e={})=>{const{rule:n="required",prefix:r=""}=e;let i={};return Object.entries(t).forEach(([o,s])=>{const a=r+o;if(Dw(s)){s.map((l,u)=>{i=Object.assign(i,Zd(l,{rule:n,prefix:`${a}.${u}.`}))});return}if(_w(s)){i=Object.assign(i,Zd(s,{rule:n,prefix:`${a}.`}));return}i[a]=n}),i},cL=cr.register,dL=cr.registerAsync;function pL(t={}){const{rules:e,labels:n,data:r,customMessages:i,visitImmediate:o=!1}=t;if(i){let m=cr.getMessages("default");Object.entries(i.value).forEach(([g,y])=>m[g]=y),cr.setMessages("default",m)}let s=new cr({},{}),a=()=>Object.fromEntries(Object.keys(e.value).map(m=>[m,{rule:e.value[m],valid:!c.value.get(m).length,error:c.value.first(m)||void 0,visited:l.value[m]}])),l=X(o?Object.fromEntries(Object.keys(e.value).map(m=>[m,!0])):{}),u=X(!0),c=X(s.errors),d=D(()=>a());function h(m){var g;let y=(g=d.value)==null?void 0:g[m];const b={valid:!0,error:void 0};return!y||!y.visited?b:y}let p=()=>{let m=new cr(r.value,e.value);n&&m.setAttributeNames(n.value);const g=()=>{c.value=s.errors,u.value=!0},y=()=>{u.value=!1,c.value=m.errors};m.checkAsync(g,y)};Ee([r,Yd],p,{deep:!0,immediate:!0});const f=m=>{if(!m)return!1;const g=typeof m=="string"?m.split("|"):Array.isArray(m)?m:[],y={required:()=>!0,required_if:(b,k)=>r.value[b]===k,required_unless:(b,k)=>r.value[b]!==k,required_with:b=>b.some(k=>k in r.value),required_with_all:b=>b.every(k=>k in r.value),required_without:b=>b.some(k=>!(k in r.value)),required_without_all:b=>b.every(k=>!(k in r.value))};for(const b of g){if(typeof b=="string"){if(b==="required")return y.required;const[k,...v]=b.split(":");if(y[k]){const w=v.map(x=>["true",!0,"false",!1].includes(x)?JSON.parse(x):x);return y[k](...w)}}if(typeof b=="object"){for(const[k,v]of Object.entries(b))if(y[k])return Array.isArray(v)?y[k](...v):y[k](v)}}return!1};return{onChange:p,errors:c,passes:u,fields:d,bind:m=>({onBlur:()=>l.value[m]=!0,error:h(m).error,required:f(e.value[m])})}}const DL=Object.freeze(Object.defineProperty({__proto__:null,default:pL,generateLabels:uL,generateRules:Zd,register:cL,registerAsync:dL,setLabels:lL},Symbol.toStringTag,{value:"Module"}));export{pu as $,Qg as C,_L as E,pL as G,mL as Q,ze as S,aT as U,au as V,fL as X,mE as Z,ni as _,N1 as a,yL as b,wL as c,xL as d,bL as e,EL as f,AL as g,vL as i,ML as k,kL as l,SL as m,CL as p,Ze as q,Zh as r,RE as s,gL as t,TL as v,DL as x,OL as y};