@kvass/widgets 1.9.53 → 1.9.55

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{E as Ta,q as Q,o as E,d as z,i as Tn,c as O,b as P,y as qa,z as Wg,a as U,n as Se,g as L,x as kn,f as H,e as I,D as xe,w as ee,j as he,v as B,B as Be,t as oe,m as re,r as Qe,G as Ug,H as qc,O as Tk,I as be,J as Re,F as Oe,l as Mt,C as pi,L as lp,M as Ms,A as up,N as Kg,s as ls,Q as Gg,V as Zt,U as xr,X as Xt,aj as Ok,u as cp,P as dp,R as Jg,S as Yg,$ as pp,a4 as Xg,a5 as Zg,W as Ak,Y as hp,k as Wa,a0 as Qg,ac as Mk,h as fp,K as Mo,a6 as Ei,aa as mp,T as _k,Z as Dk,a3 as Ik}from"./_plugin-vue_export-helper.js";var Nk=Object.defineProperty,Rk=(t,e,n)=>e in t?Nk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Jt=(t,e,n)=>(Rk(t,typeof e!="symbol"?e+"":e,n),n);function ev(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=ev(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function Pk(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=ev(t))&&(r&&(r+=" "),r+=e);return r}const $h=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,jh=Pk,rn=(t,e)=>n=>{var r;if(e?.variants==null)return jh(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=$h(c)||$h(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 jh(t,s,l,n?.class,n?.className)},tv=/^[a-z0-9]+(-[a-z0-9]+)*$/,nu=(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&&!Oa(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&&!Oa(a)?null:a}if(n&&r===""){const a={provider:r,prefix:"",name:o};return e&&!Oa(a,n)?null:a}return null},Oa=(t,e)=>t?!!((e&&t.prefix===""||t.prefix)&&t.name):!1,nv=Object.freeze({left:0,top:0,width:16,height:16}),Ua=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),ru=Object.freeze({...nv,...Ua}),Wc=Object.freeze({...ru,body:"",hidden:!1});function Fk(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 zh(t,e){const n=Fk(t,e);for(const r in Wc)r in Ua?r in t&&!(r in n)&&(n[r]=Ua[r]):r in e?n[r]=e[r]:r in t&&(n[r]=t[r]);return n}function Lk(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 Bk(t,e,n){const r=t.icons,i=t.aliases||Object.create(null);let o={};function s(a){o=zh(r[a]||i[a],o)}return s(e),n.forEach(s),zh(t,o)}function rv(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=Lk(t);for(const i in r){const o=r[i];o&&(e(i,Bk(t,i,o)),n.push(i))}return n}const Vk={provider:"",aliases:{},not_found:{},...nv};function Uu(t,e){for(const n in e)if(n in t&&typeof t[n]!=typeof e[n])return!1;return!0}function iv(t){if(typeof t!="object"||t===null)return null;const e=t;if(typeof e.prefix!="string"||!t.icons||typeof t.icons!="object"||!Uu(t,Vk))return null;const n=e.icons;for(const i in n){const o=n[i];if(!i||typeof o.body!="string"||!Uu(o,Wc))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]||!Uu(o,Wc))return null}return e}const Hh=Object.create(null);function $k(t,e){return{provider:t,prefix:e,icons:Object.create(null),missing:new Set}}function Yi(t,e){const n=Hh[t]||(Hh[t]=Object.create(null));return n[e]||(n[e]=$k(t,e))}function ov(t,e){return iv(e)?rv(e,(n,r)=>{r?t.icons[n]=r:t.missing.add(n)}):[]}function jk(t,e,n){try{if(typeof n.body=="string")return t.icons[e]={...n},!0}catch{}return!1}let us=!1;function sv(t){return typeof t=="boolean"&&(us=t),us}function zk(t){const e=typeof t=="string"?nu(t,!0,us):t;if(e){const n=Yi(e.provider,e.prefix),r=e.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function Hk(t,e){const n=nu(t,!0,us);if(!n)return!1;const r=Yi(n.provider,n.prefix);return e?jk(r,n.name,e):(r.missing.add(n.name),!0)}function qk(t,e){if(typeof t!="object")return!1;if(typeof e!="string"&&(e=t.provider||""),us&&!e&&!t.prefix){let i=!1;return iv(t)&&(t.prefix="",rv(t,(o,s)=>{Hk(o,s)&&(i=!0)})),i}const n=t.prefix;if(!Oa({prefix:n,name:"a"}))return!1;const r=Yi(e,n);return!!ov(r,t)}const av=Object.freeze({width:null,height:null}),lv=Object.freeze({...av,...Ua}),Wk=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Uk=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function qh(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(Wk);if(r===null||!r.length)return t;const i=[];let o=r.shift(),s=Uk.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 Kk(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 Gk(t,e){return t?"<defs>"+t+"</defs>"+e:e}function Jk(t,e,n){const r=Kk(t);return Gk(r.defs,e+r.content+n)}const Yk=t=>t==="unset"||t==="undefined"||t==="none";function Xk(t,e){const n={...ru,...t},r={...lv,...e},i={left:n.left,top:n.top,width:n.width,height:n.height};let o=n.body;[n,r].forEach(m=>{const g=[],b=m.hFlip,y=m.vFlip;let k=m.rotate;b?y?k+=2:(g.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),g.push("scale(-1 1)"),i.top=i.left=0):y&&(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=qh(d,l/u)):(c=s==="auto"?l:s,d=a===null?qh(c,u/l):a==="auto"?u:a);const h={},p=(m,g)=>{Yk(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 Zk=/\sid="(\S+)"/g,Qk="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let ew=0;function tw(t,e=Qk){const n=[];let r;for(;r=Zk.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+(ew++).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 Uc=Object.create(null);function nw(t,e){Uc[t]=e}function Kc(t){return Uc[t]||Uc[""]}function gp(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 vp=Object.create(null),ta=["https://api.simplesvg.com","https://api.unisvg.com"],Gc=[];for(;ta.length>0;)ta.length===1||Math.random()>.5?Gc.push(ta.shift()):Gc.push(ta.pop());vp[""]=gp({resources:["https://api.iconify.design"].concat(Gc)});function uv(t,e){const n=gp(e);return n===null?!1:(vp[t]=n,!0)}function yp(t){return vp[t]}const rw=()=>{let t;try{if(t=fetch,typeof t=="function")return t}catch{}};let Wh=rw();function iw(t,e){const n=yp(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 ow(t){return t===404}const sw=(t,e,n)=>{const r=[],i=iw(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 aw(t){if(typeof t=="string"){const e=yp(t);if(e)return e.path}return"/"}const lw=(t,e,n)=>{if(!Wh){n("abort",424);return}let r=aw(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;Wh(t+r).then(o=>{const s=o.status;if(s!==200){setTimeout(()=>{n(ow(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)})},uw={prepare:sw,send:lw};function cw(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]=Yi(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 cv(t,e){t.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(i=>i.id!==e))})}function dw(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||cv([t],o.id),o.callback(s.loaded.slice(0),s.missing.slice(0),s.pending.slice(0),o.abort))})}))}let pw=0;function hw(t,e,n){const r=pw++,i=cv.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 fw(t,e=!0,n=!1){const r=[];return t.forEach(i=>{const o=typeof i=="string"?nu(i,e,n):i;o&&r.push(o)}),r}var mw={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function gw(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 C=Math.floor(Math.random()*x.length);s.push(x[C]),x=x.slice(0,C).concat(x.slice(C+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,C){C&&(p=[]),typeof x=="function"&&p.push(x)}function b(){return{startTime:a,payload:e,status:l,queriesSent:u,queriesPending:h.length,subscribe:g,abort:m}}function y(){l="failed",p.forEach(x=>{x(void 0,c)})}function k(){h.forEach(x=>{x.status==="pending"&&(x.status="aborted")}),h=[]}function v(x,C,M){const T=C!=="success";switch(h=h.filter(A=>A!==x),l){case"pending":break;case"failed":if(T||!t.dataAfterTimeout)return;break;default:return}if(C==="abort"){c=M,y();return}if(T){c=M,h.length||(s.length?w():y());return}if(f(),k(),!t.random){const A=t.resources.indexOf(x.resource);A!==-1&&A!==t.index&&(t.index=A)}l="completed",p.forEach(A=>{A(M)})}function w(){if(l!=="pending")return;f();const x=s.shift();if(x===void 0){if(h.length){d=setTimeout(()=>{f(),l==="pending"&&(k(),y())},t.timeout);return}y();return}const C={status:"pending",resource:x,callback:(M,T)=>{v(C,M,T)}};h.push(C),u++,d=setTimeout(w,t.rotate),n(x,e,C.callback)}return setTimeout(w),b}function dv(t){const e={...mw,...t};let n=[];function r(){n=n.filter(s=>s().status==="pending")}function i(s,a,l){const u=gw(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 Uh(){}const Ku=Object.create(null);function vw(t){if(!Ku[t]){const e=yp(t);if(!e)return;const n=dv(e),r={config:e,redundancy:n};Ku[t]=r}return Ku[t]}function yw(t,e,n){let r,i;if(typeof t=="string"){const o=Kc(t);if(!o)return n(void 0,424),Uh;i=o.send;const s=vw(t);s&&(r=s.redundancy)}else{const o=gp(t);if(o){r=dv(o);const s=t.resources?t.resources[0]:"",a=Kc(s);a&&(i=a.send)}}return!r||!i?(n(void 0,424),Uh):r.query(e,i,n)().abort}function Kh(){}function bw(t){t.iconsLoaderFlag||(t.iconsLoaderFlag=!0,setTimeout(()=>{t.iconsLoaderFlag=!1,dw(t)}))}function kw(t){const e=[],n=[];return t.forEach(r=>{(r.match(tv)?e:n).push(r)}),{valid:e,invalid:n}}function xo(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(!ov(t,n).length){r();return}}catch(i){console.error(i)}r(),bw(t)}function Gh(t,e){t instanceof Promise?t.then(n=>{e(n)}).catch(()=>{e(null)}):e(t)}function ww(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)){Gh(t.loadIcons(i,r,n),u=>{xo(t,i,u)});return}if(o){i.forEach(u=>{const c=o(u,r,n);Gh(c,d=>{const h=d?{prefix:r,icons:{[u]:d}}:null;xo(t,[u],h)})});return}const{valid:s,invalid:a}=kw(i);if(a.length&&xo(t,a,null),!s.length)return;const l=r.match(tv)?Kc(n):null;if(!l){xo(t,s,null);return}l.prepare(n,r,s).forEach(u=>{yw(n,u,c=>{xo(t,u.icons,c)})})}))}const xw=(t,e)=>{const n=fw(t,!0,sv()),r=cw(n);if(!r.pending.length){let l=!0;return e&&setTimeout(()=>{l&&e(r.loaded,r.missing,r.pending,Kh)}),()=>{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(Yi(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=Yi(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&&ww(l,u)}),e?hw(e,r,o):Kh};function Ew(t,e){const n={...t};for(const r in e){const i=e[r],o=typeof i;r in av?(i===null||i&&(o==="string"||o==="number"))&&(n[r]=i):o===typeof n[r]&&(n[r]=r==="rotate"?i%4:i)}return n}const Cw=/[\s,]+/;function Sw(t,e){e.split(Cw).forEach(n=>{switch(n.trim()){case"horizontal":t.hFlip=!0;break;case"vertical":t.vFlip=!0;break}})}function Tw(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 Ow(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 Aw(t){return t.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Mw(t){return"data:image/svg+xml,"+Aw(t)}function _w(t){return'url("'+Mw(t)+'")'}const Jh={...lv,inline:!1},Dw={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Iw={display:"inline-block"},Jc={backgroundColor:"currentColor"},pv={backgroundColor:"transparent"},Yh={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Xh={webkitMask:Jc,mask:Jc,background:pv};for(const t in Xh){const e=Xh[t];for(const n in Yh)e[t+n]=Yh[n]}const Aa={};["horizontal","vertical"].forEach(t=>{const e=t.slice(0,1)+"Flip";Aa[t+"-flip"]=e,Aa[t.slice(0,1)+"-flip"]=e,Aa[t+"Flip"]=e});function Zh(t){return t+(t.match(/^[-0-9.]+$/)?"px":"")}const Qh=(t,e)=>{const n=Ew(Jh,e),r={...Dw},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"&&Sw(n,g);break;case"color":o.color=g;break;case"rotate":typeof g=="string"?n[m]=Tw(g):typeof g=="number"&&(n[m]=g);break;case"ariaHidden":case"aria-hidden":g!==!0&&g!=="true"&&delete r["aria-hidden"];break;default:{const b=Aa[m];b?(g===!0||g==="true"||g===1)&&(n[b]=!0):Jh[m]===void 0&&(r[m]=g)}}}const l=Xk(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=tw(l.body,g?()=>g+"ID"+m++:"iconifyVue"),ls("svg",r)}const{body:c,width:d,height:h}=t,p=i==="mask"||(i==="bg"?!1:c.indexOf("currentColor")!==-1),f=Ow(c,{...u,width:d+"",height:h+""});return r.style={...o,"--svg":_w(f),width:Zh(u.width),height:Zh(u.height),...Iw,...p?Jc:pv,...a},ls("span",r)};sv(!0);nw("",uw);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"||!qk(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;uv(n,i)||console.error(r)}catch{console.error(r)}}}}const Nw={...ru,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=nu(t,!1,!0))===null)return this.abortLoading(),null;let i=zk(r);if(!i)return(!this._loadingIcon||this._loadingIcon.name!==t)&&(this.abortLoading(),this._name="",i!==null&&(this._loadingIcon={name:t,abort:xw([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 Qh(Nw,t);let n=t;return e.classes&&(n={...t,class:(typeof t.class=="string"?t.class+" ":"")+e.classes.join(" ")}),Qh({...ru,...e.data},n)}});uv("",{resources:["https://icons.ui.kvass.no"]});function Rw(t){return!t||typeof t!="object"?!1:typeof t.then=="function"&&typeof t.catch=="function"}const Pw=["xxs","xs","sm","default","lg","xl","xxl","3xl","4xl"],Fw=(t,e)=>e==="default"?`var(--k-ui-${t})`:`var(--k-ui-${t}-${e})`,Ka=t=>{switch(t){case"start":case"end":return`flex-${t}`;default:return t}},bp=(t,e="spacing")=>t.split(" ").map(n=>typeof n=="number"||typeof n=="string"&&n.match(/^\d+$/)?`${n}rem`:typeof n=="string"&&Pw.includes(n)?Fw(e,n):n).join(" ");function Lw(){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 hv=(t,e)=>Object.fromEntries(Object.entries(e).map(([n,r])=>[`--k-${t}-${n}`,r])),Bw=function(t){return Object.prototype.toString.call(t)==="[object Object]"};function Vw(t){return Array.isArray(t)}const fv=Q({__name:"Spinner",props:{size:{default:"medium"}},setup(t){return(e,n)=>(E(),O("span",{class:Se(`k-spinner k-spinner--size-${e.size}`)},null,2))}}),$w={class:"k-button__content"},jw={key:0,class:"k-button__icon k-button__icon--left"},zw={key:1,class:"k-button__icon k-button__icon--right"},Hw={key:2,class:"k-button__confirm-label"},He=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=I(()=>!h.value||u.value==="loading"?n.variant:u.value=="confirm"?"warning":i[u.value]||n.variant),s=I(()=>n.loading||u.value==="loading"),a=H(),l=I(()=>{if(u.value)return["error","success"].includes(u.value)||s.value}),u=H("idle"),c=H(),d=H(),h=I(()=>u.value||s.value),p=I(()=>["error","success"].includes(u.value)),f=I(()=>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=C=>{g(),n.stateTimeout?(u.value=C,c.value=setTimeout(()=>{g(),r(C)},n.stateTimeout)):r(C)};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"}xe(()=>n.promise,w=>{w&&Rw(w)&&m(w)});const b=H(),y=I(()=>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(),z(Qe(w.is),re({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:b}),{default:ee(()=>[qa(U("span",$w,[w.icon||w.iconLeft||w.$slots.icon||w.$slots["icon-left"]?(E(),O("span",jw,[L(w.$slots,"icon-left",{},()=>[L(w.$slots,"icon",{},()=>[he(B(Ze),{icon:w.icon||w.iconLeft},null,8,["icon"])])])])):P("",!0),L(w.$slots,"default",{},()=>[Be(oe(w.label),1)]),w.iconRight||w.$slots["icon-right"]?(E(),O("span",zw,[L(w.$slots,"icon-right",{},()=>[he(B(Ze),{icon:w.iconRight},null,8,["icon"])])])):P("",!0)],512),[[Wg,!y.value]]),s.value?(E(),z(fv,{key:0})):P("",!0),p.value?(E(),z(B(Ze),{key:1,class:"k-button__state-indicator",icon:f.value},null,8,["icon"])):P("",!0),y.value?(E(),O("span",Hw,oe(w.confirmLabel),1)):P("",!0)]),_:3},16,["class","aria-busy","inert"]))}}),qw={class:"k-alert__content"},Ww={key:0,class:"k-alert__title"},Uw={class:"k-alert__icon"},vL=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:Se(B(i)({...n}))},[U("div",qw,[s.title||s.$slots.title?(E(),O("div",Ww,[L(s.$slots,"title",{},()=>[U("strong",null,oe(s.title),1)])])):P("",!0),L(s.$slots,"default",{},()=>[U("span",null,oe(s.content),1)]),s.action?(E(),z(He,{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"])):P("",!0)]),U("div",Uw,[L(s.$slots,"icon",{},()=>[s.icon||o[s.variant]?(E(),z(B(Ze),{key:0,icon:s.icon||o[s.variant]},null,8,["icon"])):P("",!0)])])],2))}}),Kw={class:"k-badge__label"},yL=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=H(!1);function a(){s.value=!0,r("dismiss",n)}return(l,u)=>s.value?P("",!0):(E(),O("span",{key:0,class:Se(B(o)({appearance:l.appearance,variant:l.variant,rounded:l.rounded}))},[L(l.$slots,"icon",{},()=>[l.icon||i[l.appearance]?(E(),z(B(Ze),{key:0,icon:l.icon||i[l.appearance],class:"k-badge__icon"},null,8,["icon"])):P("",!0)]),L(l.$slots,"default",{},()=>[U("span",Kw,oe(l.label),1)]),l.dismissable?(E(),O("button",{key:0,class:"k-badge__dismiss",onClick:a},[he(B(Ze),{icon:"fa-pro-light:times"})])):P("",!0)],2))}});var $n=(t,e=[])=>({parts:(...n)=>{if(Gw(e))return $n(t,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>$n(t,[...e,...n]),rename:n=>$n(n,e),keys:()=>e,build:()=>[...new Set(e)].reduce((n,r)=>Object.assign(n,{[r]:{selector:[`&[data-scope="${Ci(t)}"][data-part="${Ci(r)}"]`,`& [data-scope="${Ci(t)}"][data-part="${Ci(r)}"]`].join(", "),attrs:{"data-scope":Ci(t),"data-part":Ci(r)}}}),{})}),Ci=t=>t.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),Gw=t=>t.length===0,ef=t=>Math.max(0,Math.min(1,t)),Gu=(...t)=>e=>t.reduce((n,r)=>r(n),e),Bi=()=>{},iu=t=>typeof t=="object"&&t!==null,J=t=>t?"":void 0,Jw=t=>t?"true":void 0,Yw=1,Xw=9,Zw=11,st=t=>iu(t)&&t.nodeType===Yw&&typeof t.nodeName=="string",kp=t=>iu(t)&&t.nodeType===Xw,Qw=t=>iu(t)&&t===t.window,mv=t=>st(t)?t.localName||"":"#document";function ex(t){return["html","body","#document"].includes(mv(t))}var tx=t=>iu(t)&&t.nodeType!==void 0,cs=t=>tx(t)&&t.nodeType===Zw&&"host"in t,nx=t=>st(t)&&t.localName==="input",rx=t=>st(t)?t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0:!1,ix=/(textarea|select)/;function ox(t){if(t==null||!st(t))return!1;try{return nx(t)&&t.selectionStart!=null||ix.test(t.localName)||t.isContentEditable||t.getAttribute("contenteditable")==="true"||t.getAttribute("contenteditable")===""}catch{return!1}}function Xi(t,e){var n;if(!t||!e||!st(t)||!st(e))return!1;const r=(n=e.getRootNode)==null?void 0:n.call(e);if(t===e||t.contains(e))return!0;if(r&&cs(r)){let i=e;for(;i;){if(t===i)return!0;i=i.parentNode||i.host}}return!1}function Wt(t){return kp(t)?t:Qw(t)?t.document:t?.ownerDocument??document}function sx(t){return Wt(t).documentElement}function pt(t){var e;return cs(t)?pt(t.host):kp(t)?t.defaultView??window:st(t)?((e=t.ownerDocument)==null?void 0:e.defaultView)??window:window}function gv(t){let e=t.activeElement;for(;e!=null&&e.shadowRoot;){const n=e.shadowRoot.activeElement;if(n===e)break;e=n}return e}function ax(t){if(mv(t)==="html")return t;const e=t.assignedSlot||t.parentNode||cs(t)&&t.host||sx(t);return cs(e)?e.host:e}var Ju=new WeakMap;function lx(t){return Ju.has(t)||Ju.set(t,pt(t).getComputedStyle(t)),Ju.get(t)}var ou=()=>typeof document<"u";function ux(){const t=navigator.userAgentData;return t?.platform??navigator.platform}function cx(){const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(({brand:e,version:n})=>`${e}/${n}`).join(" "):navigator.userAgent}var wp=t=>ou()&&t.test(ux()),dx=t=>ou()&&t.test(cx()),px=t=>ou()&&t.test(navigator.vendor),tf=()=>ou()&&!!navigator.maxTouchPoints,hx=()=>wp(/^iPhone/i),fx=()=>wp(/^iPad/i)||au()&&navigator.maxTouchPoints>1,su=()=>hx()||fx(),mx=()=>au()||su(),au=()=>wp(/^Mac/i),xp=()=>mx()&&px(/apple/i),gx=()=>dx(/Android/i);function vx(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 dt(t){const e=vx(t);return e?.[0]??t.target}var yx=t=>Xi(t.currentTarget,dt(t));function bx(t){return t.mozInputSource===0&&t.isTrusted?!0:gx()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}var kx=t=>t.button===0,wx=t=>t.button===2||au()&&t.ctrlKey&&t.button===0,xx=t=>t.ctrlKey||t.altKey||t.metaKey,Ex=t=>"touches"in t&&t.touches.length>0,Cx={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},nf={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};function vv(t,e={}){const{dir:n="ltr",orientation:r="horizontal"}=e;let i=t.key;return i=Cx[i]??i,n==="rtl"&&r==="horizontal"&&i in nf&&(i=nf[i]),i}var Sx=new Set(["PageUp","PageDown"]),Tx=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function Ox(t){return t.ctrlKey||t.metaKey?.1:Sx.has(t.key)||t.shiftKey&&Tx.has(t.key)?10:1}function Ep(t,e="client"){const n=Ex(t)?t.touches[0]||t.changedTouches[0]:t;return{x:n[`${e}X`],y:n[`${e}Y`]}}var Ne=(t,e,n,r)=>{const i=typeof t=="function"?t():t;return i?.addEventListener(e,n,r),()=>{i?.removeEventListener(e,n,r)}};function yv(t,e){const{type:n="HTMLInputElement",property:r="value"}=e,i=pt(t)[n].prototype;return Object.getOwnPropertyDescriptor(i,r)??{}}function Ax(t){if(t.localName==="input")return"HTMLInputElement";if(t.localName==="textarea")return"HTMLTextAreaElement";if(t.localName==="select")return"HTMLSelectElement"}function bv(t,e,n="value"){var r;if(!t)return;const i=Ax(t);i&&((r=yv(t,{type:i,property:n}).set)==null||r.call(t,e)),t.setAttribute(n,e)}function Cp(t,e){var n;t&&((n=yv(t,{type:"HTMLInputElement",property:"checked"}).set)==null||n.call(t,e),e?t.setAttribute("checked",""):t.removeAttribute("checked"))}function Mx(t,e){const{value:n,bubbles:r=!0}=e;if(!t)return;const i=pt(t);t instanceof i.HTMLInputElement&&(bv(t,`${n}`),t.dispatchEvent(new i.Event("input",{bubbles:r})))}function Sp(t,e){const{checked:n,bubbles:r=!0}=e;if(!t)return;const i=pt(t);t instanceof i.HTMLInputElement&&(Cp(t,n),t.dispatchEvent(new i.Event("click",{bubbles:r})))}function _x(t){return Dx(t)?t.form:t.closest("form")}function Dx(t){return t.matches("textarea, input, select, button")}function Ix(t,e){if(!t)return;const n=_x(t),r=i=>{i.defaultPrevented||e()};return n?.addEventListener("reset",r,{passive:!0}),()=>n?.removeEventListener("reset",r)}function Nx(t,e){const n=t?.closest("fieldset");if(!n)return;e(n.disabled);const r=pt(n),i=new r.MutationObserver(()=>e(n.disabled));return i.observe(n,{attributes:!0,attributeFilter:["disabled"]}),()=>i.disconnect()}function lu(t,e){if(!t)return;const{onFieldsetDisabledChange:n,onFormReset:r}=e,i=[Ix(t,r),Nx(t,n)];return()=>i.forEach(o=>o?.())}var kv=t=>st(t)&&t.tagName==="IFRAME",Rx=t=>!Number.isNaN(parseInt(t.getAttribute("tabindex")||"0",10)),Px=t=>parseInt(t.getAttribute("tabindex")||"0",10)<0,Tp="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",wv=(t,e=!1)=>{if(!t)return[];const n=Array.from(t.querySelectorAll(Tp));(e==!0||e=="if-empty"&&n.length===0)&&st(t)&&hr(t)&&n.unshift(t);const r=n.filter(hr);return r.forEach((i,o)=>{if(kv(i)&&i.contentDocument){const s=i.contentDocument.body;r.splice(o,1,...wv(s))}}),r};function hr(t){return!t||t.closest("[inert]")?!1:t.matches(Tp)&&rx(t)}function xv(t,e){if(!t)return[];const n=Array.from(t.querySelectorAll(Tp)),r=n.filter(Br);return r.forEach((i,o)=>{if(kv(i)&&i.contentDocument){const s=i.contentDocument.body,a=xv(s);r.splice(o,1,...a)}}),!r.length&&e?n:r}function Br(t){return t!=null&&t.tabIndex>0?!0:hr(t)&&!Px(t)}function Eo(t){return t.tabIndex<0&&(/^(audio|video|details)$/.test(t.localName)||ox(t))&&!Rx(t)?0:t.tabIndex}function Fx(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 Ot(t){let e;const n=globalThis.requestAnimationFrame(()=>{e=t()});return()=>{globalThis.cancelAnimationFrame(n),e?.()}}function Yc(t){const e=ax(t);return ex(e)?Wt(e).body:st(e)&&Bx(e)?e:Yc(e)}var Lx=/auto|scroll|overlay|hidden|clip/;function Bx(t){const e=pt(t),{overflow:n,overflowX:r,overflowY:i,display:o}=e.getComputedStyle(t);return Lx.test(n+i+r)&&!["inline","contents"].includes(o)}function Vx(t,e){const{left:n,top:r,width:i,height:o}=e.getBoundingClientRect(),s={x:t.x-n,y:t.y-r},a={x:ef(s.x/i),y:ef(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 Vi="default",Xc="",Ma=new WeakMap;function $x(t={}){const{target:e,doc:n}=t,r=n??document,i=r.documentElement;return su()?(Vi==="default"&&(Xc=i.style.webkitUserSelect,i.style.webkitUserSelect="none"),Vi="disabled"):e&&(Ma.set(e,e.style.userSelect),e.style.userSelect="none"),()=>jx({target:e,doc:r})}function jx(t={}){const{target:e,doc:n}=t,r=(n??document).documentElement;if(su()){if(Vi!=="disabled")return;Vi="restoring",setTimeout(()=>{Fx(()=>{Vi==="restoring"&&(r.style.webkitUserSelect==="none"&&(r.style.webkitUserSelect=Xc||""),Xc="",Vi="default")})},300)}else if(e&&Ma.has(e)){const i=Ma.get(e);e.style.userSelect==="none"&&(e.style.userSelect=i??""),e.getAttribute("style")===""&&e.removeAttribute("style"),Ma.delete(e)}}function zx(t={}){const{defer:e,target:n,...r}=t,i=e?Ot:s=>s(),o=[];return o.push(i(()=>{const s=typeof n=="function"?n():n;o.push($x({...r,target:s}))})),()=>{o.forEach(s=>s?.())}}function Hx(t,e){const{onPointerMove:n,onPointerUp:r}=e,i=[Ne(t,"pointermove",o=>{const s=Ep(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),Ne(t,"pointerup",r,!1),Ne(t,"pointercancel",r,!1),Ne(t,"contextmenu",r,!1),zx({doc:t})];return()=>{i.forEach(o=>o())}}function Ev(t){const{pointerNode:e,keyboardNode:n=e,onPress:r,onPressStart:i,onPressEnd:o,isValidKey:s=y=>y.key==="Enter"}=t;if(!e)return Bi;const a=pt(e),l=Wt(e);let u=Bi,c=Bi,d=Bi;const h=y=>({point:Ep(y),event:y});function p(y){i?.(h(y))}function f(y){o?.(h(y))}const m=Ne(e,"pointerdown",y=>{c();const k=Ne(a,"pointerup",w=>{const x=dt(w);Xi(e,x)?r?.(h(w)):o?.(h(w))},{passive:!r,once:!0}),v=Ne(a,"pointercancel",f,{passive:!o,once:!0});c=Gu(k,v),l.activeElement===n&&y.pointerType==="mouse"&&y.preventDefault(),p(y)},{passive:!i}),g=Ne(n,"focus",b);u=Gu(m,g);function b(){const y=x=>{if(!s(x))return;const C=T=>{if(!s(T))return;const A=new a.PointerEvent("pointerup"),_=h(A);r?.(_),o?.(_)};c(),c=Ne(n,"keyup",C);const M=new a.PointerEvent("pointerdown");p(M)},k=()=>{const x=new a.PointerEvent("pointercancel");f(x)},v=Ne(n,"keydown",y),w=Ne(n,"blur",k);d=Gu(v,w)}return()=>{u(),c(),d()}}function Op(t,e){return Array.from(t?.querySelectorAll(e)??[])}var Cv=t=>t.id;function qx(t,e,n=Cv){return t.find(r=>n(r)===e)}function Sv(t,e,n=Cv){const r=qx(t,e,n);return r?t.indexOf(r):-1}function Wx(t,e,n=!0){let r=Sv(t,e);return r=n?(r+1)%t.length:Math.min(r+1,t.length-1),t[r]}function Ux(t,e,n=!0){let r=Sv(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])}function Tv(t,e){const{onEntry:n,measure:r,box:i="border-box"}=e,o=(Array.isArray(t)?t:[t]).filter(st),s=pt(o[0]),a=u=>{const c=o.map(d=>r(d));n({rects:c,entries:u})};a([]);const l=new s.ResizeObserver(a);return o.forEach(u=>l.observe(u,{box:i})),()=>l.disconnect()}function Zc(t,e){if(!t)return Bi;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),t.style.length===0&&t.removeAttribute("style")}}function Kx(t,e,n){if(!t)return Bi;const r=t.style.getPropertyValue(e);return t.style.setProperty(e,n),()=>{t.style.setProperty(e,r),t.style.length===0&&t.removeAttribute("style")}}var Ap={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"},Gx=1e3/60;function Jx(t,e){const n=t();if(st(n)&&n.isConnected)return e(n),()=>{};{const r=setInterval(()=>{const i=t();st(i)&&i.isConnected&&(e(i),clearInterval(r))},Gx);return()=>clearInterval(r)}}function Yx(t,e){const n=[];return t?.forEach(r=>{const i=Jx(r,e);n.push(i)}),()=>{n.forEach(r=>r())}}function Xx(t){return!(t.metaKey||!au()&&t.altKey||t.ctrlKey||t.key==="Control"||t.key==="Shift"||t.key==="Meta")}var Zx=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Qx(t,e,n){const r=n?dt(n):null,i=pt(r);return t=t||r instanceof i.HTMLInputElement&&!Zx.has(r?.type)||r instanceof i.HTMLTextAreaElement||r instanceof i.HTMLElement&&r.isContentEditable,!(t&&e==="keyboard"&&n instanceof i.KeyboardEvent&&!Reflect.has(e1,n.key))}var hi=null,Qc=new Set,jo=new Map,ti=!1,ed=!1,e1={Tab:!0,Escape:!0};function uu(t,e){for(let n of Qc)n(t,e)}function Ga(t){ti=!0,Xx(t)&&(hi="keyboard",uu("keyboard",t))}function Bt(t){hi="pointer",(t.type==="mousedown"||t.type==="pointerdown")&&(ti=!0,uu("pointer",t))}function Ov(t){bx(t)&&(ti=!0,hi="virtual")}function Av(t){const e=dt(t);e===pt(e)||e===Wt(e)||(!ti&&!ed&&(hi="virtual",uu("virtual",t)),ti=!1,ed=!1)}function Mv(){ti=!1,ed=!0}function t1(t){if(typeof window>"u"||jo.get(pt(t)))return;const e=pt(t),n=Wt(t);let r=e.HTMLElement.prototype.focus;e.HTMLElement.prototype.focus=function(){hi="virtual",uu("virtual",null),ti=!0,r.apply(this,arguments)},n.addEventListener("keydown",Ga,!0),n.addEventListener("keyup",Ga,!0),n.addEventListener("click",Ov,!0),e.addEventListener("focus",Av,!0),e.addEventListener("blur",Mv,!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",()=>{n1(t)},{once:!0}),jo.set(e,{focus:r})}var n1=(t,e)=>{const n=pt(t),r=Wt(t);jo.has(n)&&(n.HTMLElement.prototype.focus=jo.get(n).focus,r.removeEventListener("keydown",Ga,!0),r.removeEventListener("keyup",Ga,!0),r.removeEventListener("click",Ov,!0),n.removeEventListener("focus",Av,!0),n.removeEventListener("blur",Mv,!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)),jo.delete(n))};function ds(){return hi==="keyboard"}function Mp(t={}){const{isTextInput:e,autoFocus:n,onChange:r,root:i}=t;t1(i),r?.({isFocusVisible:n||ds(),modality:hi});const o=(s,a)=>{Qx(!!e,s,a)&&r?.({isFocusVisible:ds(),modality:s})};return Qc.add(o),()=>{Qc.delete(o)}}function r1(t){return t?Array.isArray(t)?t:[t]:[]}var _v=t=>t[0],Dv=t=>t[t.length-1],i1=(t,e)=>t.indexOf(e)!==-1,o1=(t,...e)=>t.concat(e),s1=(t,...e)=>t.filter(n=>!e.includes(n)),a1=(t,e)=>i1(t,e)?s1(t,e):o1(t,e),rf=t=>t?.constructor.name==="Array",l1=(t,e)=>{if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!_s(t[n],e[n]))return!1;return!0},_s=(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(rf(t)&&rf(e))return l1(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(!_s(t[o],e[o]))return!1}return!0},u1=t=>Array.isArray(t),Iv=t=>typeof t=="string",$i=t=>typeof t=="function",c1=Function.prototype.toString;c1.call(Object);var of=(...t)=>(...e)=>{t.forEach(function(n){n?.(...e)})},{floor:sf,abs:Ja,round:Nv,min:d1,max:p1,pow:h1,sign:f1}=Math,_o=t=>Number.isNaN(t),_p=t=>_o(t)?0:t,m1=(t,e,n)=>t===0?n:e[t-1],g1=(t,e,n)=>t===e.length-1?n:e[t+1],v1=(t,e,n)=>Nv((_p(t)-e)/n)*n+e,Ds=(t,e,n)=>d1(p1(_p(t),e),n),Dp=(t,e,n)=>(_p(t)-e)/(n-e),Rv=(t,e,n,r)=>Ds(v1(t*(n-e)+e,e,r),e,n),na=(t,e)=>{let n=t,r=e.toString(),i=r.indexOf("."),o=i>=0?r.length-i:0;if(o>0){let s=h1(10,o);n=Nv(n*s)/s}return n},Ip=(t,e,n,r)=>{e=Number(e),n=Number(n);let i=(t-(_o(e)?0:e))%r,o=na(Ja(i)*2>=r?t+f1(i)*(r-Ja(i)):t-i,r);return _o(e)?!_o(n)&&o>n&&(o=e+sf(na((n-e)/r,r))*r):o<e?o=e:!_o(n)&&o>n&&(o=e+sf(na((n-e)/r,r))*r),na(o,r)},Do=(t,e,n)=>t[e]===n?t:[...t.slice(0,e),n,...t.slice(e+1)];function Pv(t,e){const n=m1(t,e.values,e.min),r=g1(t,e.values,e.max);let i=e.values.slice();return function(o){let s=Ip(o,n,r,e.step);return i=Do(i,t,o),i[t]=s,i}}function y1(t,e){const n=e.values[t]+e.step;return Pv(t,e)(n)}function b1(t,e){const n=e.values[t]-e.step;return Pv(t,e)(n)}var k1=(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 Ja(r-e)<Ja(i-e)?n-1:n},Fv=(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})),td=(t,e)=>{const[n,r]=t,[i,o]=e;return s=>n===r||i===o?i:i+(o-i)/(r-n)*(s-n)},af=t=>t!=null?`${t}px`:void 0;function Lv(t){if(!w1(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]=Lv(i))}return n}var w1=t=>t&&typeof t=="object"&&t.constructor===Object;function x1(t,e){const n={};for(const r of e){const i=t[r];i!==void 0&&(n[r]=i)}return n}function nd(...t){t.length===1?t[0]:t[1],t.length!==2||t[0]}function E1(t,e){if(t==null)throw new Error(e())}function C1(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 cu(){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)}}}var Di=(t=>(t.NotStarted="Not Started",t.Started="Started",t.Stopped="Stopped",t))(Di||{}),Yu="__init__";function S1(t){const e=()=>{var o;return((o=t.getRootNode)==null?void 0:o.call(t))??document},n=()=>Wt(e()),r=()=>n().defaultView??window,i=()=>gv(e());return{...t,getRootNode:e,getDoc:n,getWin:r,getActiveElement:i,isActiveElement:o=>o===i(),getById:o=>e().getElementById(o)}}function T1(t){return new Proxy({},{get(e,n){return n==="style"?r=>t({style:r}).style:t}})}var Kn=()=>t=>Array.from(new Set(t)),O1=$n("checkbox").parts("root","label","control","indicator"),ra=O1.build(),Bv=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`checkbox:${t.id}`},lf=t=>{var e;return((e=t.ids)==null?void 0:e.label)??`checkbox:${t.id}:label`},A1=t=>{var e;return((e=t.ids)==null?void 0:e.control)??`checkbox:${t.id}:control`},rd=t=>{var e;return((e=t.ids)==null?void 0:e.hiddenInput)??`checkbox:${t.id}:input`},M1=t=>t.getById(Bv(t)),Io=t=>t.getById(rd(t));function _1(t,e){const{send:n,context:r,prop:i,computed:o,scope:s}=t,a=i("disabled"),l=i("readOnly"),u=i("invalid"),c=!a&&r.get("focused"),d=!a&&r.get("focusVisible"),h=o("checked"),p=o("indeterminate"),f={"data-active":J(r.get("active")),"data-focus":J(c),"data-focus-visible":J(d),"data-readonly":J(l),"data-hover":J(r.get("hovered")),"data-disabled":J(a),"data-state":p?"indeterminate":h?"checked":"unchecked","data-invalid":J(u)};return{checked:h,disabled:a,indeterminate:p,focused:c,checkedState:h,setChecked(m){n({type:"CHECKED.SET",checked:m,isTrusted:!1})},toggleChecked(){n({type:"CHECKED.TOGGLE",checked:h,isTrusted:!1})},getRootProps(){return e.label({...ra.root.attrs,...f,dir:i("dir"),id:Bv(s),htmlFor:rd(s),onPointerMove(){a||n({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){a||n({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(m){dt(m)===Io(s)&&m.stopPropagation()}})},getLabelProps(){return e.element({...ra.label.attrs,...f,dir:i("dir"),id:lf(s)})},getControlProps(){return e.element({...ra.control.attrs,...f,dir:i("dir"),id:A1(s),"aria-hidden":!0})},getIndicatorProps(){return e.element({...ra.indicator.attrs,...f,dir:i("dir"),hidden:!p&&!h})},getHiddenInputProps(){return e.input({id:rd(s),type:"checkbox",required:i("required"),defaultChecked:h,disabled:a,"aria-labelledby":lf(s),"aria-invalid":u,name:i("name"),form:i("form"),value:i("value"),style:Ap,onFocus(){const m=ds();n({type:"CONTEXT.SET",context:{focused:!0,focusVisible:m}})},onBlur(){n({type:"CONTEXT.SET",context:{focused:!1,focusVisible:!1}})},onClick(m){if(l){m.preventDefault();return}const g=m.currentTarget.checked;n({type:"CHECKED.SET",checked:g,isTrusted:!0})}})}}}var{not:uf}=cu(),D1={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:uf("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:uf("isTrusted"),actions:["setChecked","dispatchChangeEvent"]},{actions:["setChecked"]}],"CONTEXT.SET":{actions:["setContext"]}},computed:{indeterminate:({context:t})=>_a(t.get("checked")),checked:({context:t})=>I1(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 Ev({pointerNode:M1(n),keyboardNode:Io(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 Mp({root:(n=e.getRootNode)==null?void 0:n.call(e)})},trackFormControlState({context:t,scope:e}){return lu(Io(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=Io(n);r&&(Cp(r,e("checked")),r.indeterminate=_a(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=_a(e("checked"))?!0:!e("checked");t.set("checked",n)},dispatchChangeEvent({computed:t,scope:e}){queueMicrotask(()=>{const n=Io(e);Sp(n,{checked:t("checked")})})}}}};function _a(t){return t==="indeterminate"}function I1(t){return _a(t)?!1:!!t}Kn()(["defaultChecked","checked","dir","disabled","form","getRootNode","id","ids","invalid","name","onCheckedChange","readOnly","required","value"]);function N1(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()}var cf={htmlFor:"for",className:"class",onDoubleClick:"onDblclick",onChange:"onInput",onFocus:"onFocusin",onBlur:"onFocusout",defaultValue:"value",defaultChecked:"checked"},R1="viewBox,className,preserveAspectRatio,fillRule,clipPath,clipRule,strokeWidth,strokeLinecap,strokeLinejoin,strokeDasharray,strokeDashoffset,strokeMiterlimit".split(",");function P1(t){return t in cf?cf[t]:t.startsWith("on")?`on${N1(t.substr(2))}`:R1.includes(t)?t:t.toLowerCase()}var fi=T1(t=>{const e={};for(const n in t){const r=t[n];n==="children"?typeof r=="string"&&(e.innerHTML=r):e[P1(n)]=t[n]}return e});function Ya(t){const e=t().defaultValue??t().value,n=t().isEqual??Object.is,r=Zt(e),i=I(()=>t().value!==void 0),o=Zt(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=$i(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)}}}Ya.cleanup=t=>{Jg(()=>t())};Ya.ref=t=>{let e=t;return{get:()=>e,set:n=>{e=n}}};function F1(t){const e=H(t);return{get(n){return e.value[n]},set(n,r){e.value[n]=r}}}var L1=(t,e)=>{xe(()=>[...t.map(n=>n())],(n,r)=>{let i=!1;for(let o=0;o<n.length;o++)if(!_s(r[o],Xt(n[o]))){i=!0;break}i&&e()})};function mi(t,e={}){var n,r,i;const o=I(()=>{const{id:_,ids:N,getRootNode:$}=Xt(e);return S1({id:_,ids:N,getRootNode:$})}),s=(..._)=>{t.debug&&console.log(..._)},a=I(()=>{var _;return((_=t.props)==null?void 0:_.call(t,{props:Lv(Xt(e)),get scope(){return o.value}}))??Xt(e)}),l=B1(a),u=(n=t.context)==null?void 0:n.call(t,{prop:l,bindable:Ya,get scope(){return o.value},flush:df,getContext(){return c},getComputed(){return C},getRefs(){return b}}),c={get(_){var N;return(N=u[_])==null?void 0:N.get()},set(_,N){var $;($=u[_])==null||$.set(N)},initial(_){var N;return(N=u[_])==null?void 0:N.initial},hash(_){var N,$;const j=(N=u[_])==null?void 0:N.get();return($=u[_])==null?void 0:$.hash(j)}};let d=new Map,h=null,p={current:null},f={current:{type:""}};const m=()=>({...f.current,current(){return f.current},previous(){return p.current}}),g=()=>({...M,matches(..._){const N=M.get();return _.includes(N)},hasTag(_){var N,$;const j=M.get();return!!(($=(N=t.states[j])==null?void 0:N.tags)!=null&&$.includes(_))}}),b=F1(((r=t.refs)==null?void 0:r.call(t,{prop:l,context:c}))??{}),y=()=>({state:g(),context:c,event:m(),prop:l,send:A,action:k,guard:v,track:L1,refs:b,computed:C,flush:df,get scope(){return o.value},choose:x}),k=_=>{const N=$i(_)?_(y()):_;if(!N)return;const $=N.map(j=>{var q,K;const X=(K=(q=t.implementations)==null?void 0:q.actions)==null?void 0:K[j];return X||nd(`[zag-js] No implementation found for action "${JSON.stringify(j)}"`),X});for(const j of $)j?.(y())},v=_=>{var N,$;return $i(_)?_(y()):($=(N=t.implementations)==null?void 0:N.guards)==null?void 0:$[_](y())},w=_=>{const N=$i(_)?_(y()):_;if(!N)return;const $=N.map(q=>{var K,X;const fe=(X=(K=t.implementations)==null?void 0:K.effects)==null?void 0:X[q];return fe||nd(`[zag-js] No implementation found for effect "${JSON.stringify(q)}"`),fe}),j=[];for(const q of $){const K=q?.(y());K&&j.push(K)}return()=>j.forEach(q=>q?.())},x=_=>r1(_).find(N=>{let $=!N.guard;return Iv(N.guard)?$=!!v(N.guard):$i(N.guard)&&($=N.guard(y())),$}),C=_=>{E1(t.computed,()=>"[zag-js] No computed object found on machine");const N=t.computed[_];return N({context:c,event:m(),prop:l,refs:b,get scope(){return o.value},computed:C})},M=Ya(()=>({defaultValue:t.initialState({prop:l}),onChange(_,N){var $,j,q;if(N){const X=d.get(N);X?.(),d.delete(N)}N&&k(($=t.states[N])==null?void 0:$.exit),k(h?.actions);const K=w((j=t.states[_])==null?void 0:j.effects);if(K&&d.set(_,K),N===Yu){k(t.entry);const X=w(t.effects);X&&d.set(Yu,X)}k((q=t.states[_])==null?void 0:q.entry)}}));let T=Di.NotStarted;Tn(()=>{const _=T===Di.Started;T=Di.Started,s(_?"rehydrating...":"initializing..."),M.invoke(M.initial,Yu)}),pi(()=>{T=Di.Stopped,s("unmounting...");const _=d.values();for(const N of _)N?.();d=new Map,k(t.exit)});const A=_=>{var N,$;if(T!==Di.Started)return;p.current=f.current,f.current=_,s("send",_);let j=M.get();const q=((N=t.states[j].on)==null?void 0:N[_.type])??(($=t.on)==null?void 0:$[_.type]),K=x(q);if(!K)return;h=K;const X=K.target??j;s("transition",K);const fe=X!==j;fe?M.set(X):K.reenter&&!fe?M.invoke(j,j):k(K.actions)};return(i=t.watch)==null||i.call(t,y()),{state:g(),send:A,context:c,prop:l,get scope(){return o.value},refs:b,computed:C,event:m(),getStatus:()=>T}}function B1(t){return function(e){return t.value[e]}}var df=t=>{xr().then(()=>{t()})};function Qt(t={}){const{prefix:e}=t,n=Lw();return e?`${e}-${n}`:n}const V1={key:0,class:"k-checkbox__help"},pf=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=>Mo(c)===Mo(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=>Mo(d)!==Mo(c)))}const s=mi(D1,{id:Qt(),defaultChecked:i(),onCheckedChange:({checked:l})=>{if(i()!==l)return o(l)},disabled:n.disabled,required:n.required}),a=I(()=>_1(s,fi));return xe(()=>n.modelValue,()=>{const l=i();if(a.value.checked!==l)return a.value.setChecked(l)}),(l,u)=>(E(),O("label",re({class:"k-checkbox"},a.value.getRootProps()),[U("div",be(Re(a.value.getControlProps())),[a.value.checked?(E(),z(B(Ze),{key:0,icon:"fa-pro-solid:check"})):P("",!0)],16),l.label||l.$slots.help||l.$slots.default?(E(),O("span",be(re({key:0},a.value.getLabelProps())),[U("span",{class:Se(["k-checkbox__label",{"k-checkbox__label-required":l.required}])},[L(l.$slots,"default",{},()=>[Be(oe(l.label),1)])],2),l.$slots.help||l.help?(E(),O("span",V1,[L(l.$slots,"help",{},()=>[Be(oe(l.help),1)])])):P("",!0)],16)):P("",!0),U("input",be(Re(a.value.getHiddenInputProps())),null,16)],16))}}),du=Symbol("form-control"),$1={class:"k-formcontrol"},j1=["for"],z1={key:1,class:"k-formcontrol__error"},H1={key:2,class:"k-formcontrol__help"},q1=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=I(()=>`${i}_label`),s=I(()=>`${i}_help`),a={onBlur:()=>r("blur"),onFocus:()=>r("focus")};return Ik(du,I(()=>({...n,id:i,labelId:o.value,helpId:s.value,invalid:!!n.error,required:n.required,events:a}))),(l,u)=>(E(),O("div",$1,[l.$slots.label||l.label?(E(),O("label",{key:0,class:Se(["k-formcontrol__label",{"k-formcontrol__label-required":l.required}]),for:B(i)},[L(l.$slots,"label",{},()=>[Be(oe(l.label),1)])],10,j1)):P("",!0),L(l.$slots,"default",{id:B(i)}),l.$slots.error||l.error?(E(),O("span",z1,[L(l.$slots,"error",{},()=>[Be(oe(l.error),1)])])):P("",!0),l.$slots.help||l.help?(E(),O("span",H1,[L(l.$slots,"help",{},()=>[Be(oe(l.help),1)])])):P("",!0)]))}}),W1={class:"k-filter-type-dropdown"},U1=Q({__name:"Dropdown",props:qc({label:{},items:{}},{modelValue:{default:""},modelModifiers:{}}),emits:qc(["disable"],["update:modelValue"]),setup(t,{emit:e}){const n=t,r=Ug(t,"modelValue"),i=I(()=>{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=I(()=>n.items.map(a=>({...a,action:()=>s.value=a.value}))),s=I({get(){return r.value},set(a){r.value=a}});return(a,l)=>(E(),O("div",W1,[he(B(q1),{label:a.label},{default:ee(()=>[he(B(wu),{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"])]))}}),K1=Object.freeze(Object.defineProperty({__proto__:null,default:U1},Symbol.toStringTag,{value:"Module"}));function G1(t,e){let n,r,i;const o=Zt(!0),s=()=>{o.value=!0,i()};xe(t,s,{flush:"sync"});const a=typeof e=="function"?e:e.get,l=typeof e=="function"?void 0:e.set,u=Gg((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 Np(t){return Xg()?(Zg(t),!0):!1}const Rp=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const J1=t=>t!=null,Y1=Object.prototype.toString,X1=t=>Y1.call(t)==="[object Object]";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 Da(t){return Array.isArray(t)?t:[t]}function Q1(t,e,n={}){const{immediate:r=!0,immediateCallback:i=!1}=n,o=Zt(!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)},Xt(e))}return r&&(o.value=!0,Rp&&u()),Np(l),{isPending:Yg(o),start:u,stop:l}}function eE(t,e,n){return xe(t,e,{...n,immediate:!0})}const Vv=Rp?window:void 0,$v=Rp?window.navigator:void 0;function jv(t){var e;const n=Xt(t);return(e=n?.$el)!=null?e:n}function Pp(...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=I(()=>{const a=Da(Xt(t[0])).filter(l=>l!=null);return a.every(l=>typeof l!="string")?a:void 0}),o=eE(()=>{var a,l;return[(l=(a=i.value)==null?void 0:a.map(u=>jv(u)))!=null?l:[Vv].filter(u=>u!=null),Da(Xt(i.value?t[1]:t[0])),Da(B(i.value?t[2]:t[1])),Xt(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=X1(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 Np(n),s}function tE(){const t=Zt(!1),e=hp();return e&&Tn(()=>{t.value=!0},e),t}function Fp(t){const e=tE();return I(()=>(e.value,!!t()))}function nE(t,e,n={}){const{window:r=Vv,...i}=n;let o;const s=Fp(()=>r&&"MutationObserver"in r),a=()=>{o&&(o.disconnect(),o=void 0)},l=I(()=>{const h=Xt(t),p=Da(h).map(jv).filter(J1);return new Set(p)}),u=xe(()=>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 Np(d),{isSupported:s,stop:d,takeRecords:c}}function hf(t,e={}){const{controls:n=!1,navigator:r=$v}=e,i=Fp(()=>r&&"permissions"in r),o=Zt(),s=typeof t=="string"?{name:t}:t,a=Zt(),l=()=>{var c,d;a.value=(d=(c=o.value)==null?void 0:c.state)!=null?d:"prompt"};Pp(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 Mo(o.value)}});return u(),n?{state:a,isSupported:i,query:u}:a}function rE(t={}){const{navigator:e=$v,read:n=!1,source:r,copiedDuring:i=1500,legacy:o=!1}=t,s=Fp(()=>e&&"clipboard"in e),a=hf("clipboard-read"),l=hf("clipboard-write"),u=I(()=>s.value||o),c=Zt(""),d=Zt(!1),h=Q1(()=>d.value=!1,i,{immediate:!1});async function p(){let y=!(s.value&&b(a.value));if(!y)try{c.value=await e.clipboard.readText()}catch{y=!0}y&&(c.value=g())}u.value&&n&&Pp(["copy","cut"],p,{passive:!0});async function f(y=Xt(r)){if(u.value&&y!=null){let k=!(s.value&&b(l.value));if(!k)try{await e.clipboard.writeText(y)}catch{k=!0}k&&m(y),c.value=y,d.value=!0,h.start()}}function m(y){const k=document.createElement("textarea");k.value=y??"",k.style.position="absolute",k.style.opacity="0",document.body.appendChild(k),k.select(),document.execCommand("copy"),k.remove()}function g(){var y,k,v;return(v=(k=(y=document?.getSelection)==null?void 0:y.call(document))==null?void 0:k.toString())!=null?v:""}function b(y){return y==="granted"||y==="prompt"}return{isSupported:u,text:c,copied:d,copy:f}}function pu(t){const e=hp(),n=G1(()=>null,()=>e.proxy.$el);return Tk(n.trigger),Tn(n.trigger),n}const iE={class:"k-filter-type-range"},oE={class:"k-filter-type-range__header"},sE={class:"k-filter-type-range__header-label"},aE={class:"k-filter-type-range__value"},lE={class:"k-filter-type-range__value-display"},uE=Q({__name:"RangeSlider",props:qc({min:{},max:{},label:{},suffix:{},step:{},type:{}},{modelValue:{default:[0,1e3]},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const e=Ug(t,"modelValue"),n=pu();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",iE,[U("div",oE,[U("label",sE,[U("span",null,oe(s.label),1),he(B(Ze),{icon:s.$attrs.icon},null,8,["icon"])]),L(s.$slots,"remove")]),U("div",aE,[he(B(yC),re({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"]),U("div",lE,[U("span",null,oe(o(e.value[0])),1),U("span",null,oe(o(e.value[1])),1)])])]))}}),cE=Object.freeze(Object.defineProperty({__proto__:null,default:uE},Symbol.toStringTag,{value:"Module"})),ff=Object.assign({"./Dropdown.vue":K1,"./RangeSlider.vue":cE});for(const t in ff)t.replace(/(\.\/|\.vue)/g,""),ff[t].default;function fr(t){return typeof t=="string"||t instanceof String}function mf(t){var e;return typeof t=="object"&&t!=null&&(t==null||(e=t.constructor)==null?void 0:e.name)==="Object"}function zv(t,e){return Array.isArray(e)?zv(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 Y={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function dE(t){switch(t){case Y.LEFT:return Y.FORCE_LEFT;case Y.RIGHT:return Y.FORCE_RIGHT;default:return t}}function Xu(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function Xa(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(!Xa(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(!Xa(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 pE{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?Y.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?Y.RIGHT:Y.LEFT}}function se(t,e){return new se.InputMask(t,e)}function Hv(t){if(t==null)throw new Error("mask property should be defined");return t instanceof RegExp?se.MaskedRegExp:fr(t)?se.MaskedPattern:t===Date?se.MaskedDate:t===Number?se.MaskedNumber:Array.isArray(t)||t===Array?se.MaskedDynamic:se.Masked&&t.prototype instanceof se.Masked?t:se.Masked&&t instanceof se.Masked?t.constructor:t instanceof Function?se.MaskedFunction:(console.warn("Mask not found for mask",t),se.Masked)}function ps(t){if(!t)throw new Error("Options in not defined");if(se.Masked){if(t.prototype instanceof se.Masked)return{mask:t};const{mask:e=void 0,...n}=t instanceof se.Masked?{mask:t}:mf(t)&&t.mask instanceof se.Masked?t:{};if(e){const r=e.mask;return{...zv(e,(i,o)=>!o.startsWith("_")),mask:e.constructor,_mask:r,...n}}}return mf(t)?{...t}:{mask:t}}function Hn(t){if(se.Masked&&t instanceof se.Masked)return t;const e=ps(t),n=Hv(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)}se.createMask=Hn;class Lp{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}}se.MaskElement=Lp;const gf=90,hE=89;class hu extends Lp{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===gf&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===hE&&e.ctrlKey))return e.preventDefault(),this._handlers.redo(e);if(this._handlers.undo&&e.keyCode===gf&&(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={}}}se.HTMLMaskElement=hu;class fE extends hu{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}}se.HTMLMaskElement=hu;class qv extends hu{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}}se.HTMLContenteditableMaskElement=qv;class fu{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>fu.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}}fu.MAX_LENGTH=100;class mE{constructor(e,n){this.el=e instanceof Lp?e:e.isContentEditable&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"?new qv(e):new fE(e),this.masked=Hn(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new fu,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 se.Masked)&&this.masked.constructor===Hv(e)){this.masked.updateOptions({mask:e});return}const n=e instanceof se.Masked?e:Hn({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,Y.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 pE({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:Y.NONE;let s=this.masked.nearestInputPos(n.startChangePos+i,o);o!==Y.NONE&&(s=this.masked.nearestInputPos(s,Y.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}}se.InputMask=mE;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}}se.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 fr(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(!fr(e))throw new Error("value should be string");const i=fr(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=Y.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=dE(i),u=this.extractInput(0,s,{raw:!0}));let c=e;const d=new de;if(i!==Y.NONE&&(c=this.nearestInputPos(e,n>1&&e!==0&&!l?Y.NONE:i),d.tailShift=c-e),d.aggregate(this.remove(c)),l&&i!==Y.NONE&&u===this.rawInputValue)if(i===Y.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===Y.FORCE_RIGHT&&a.unshift();return d.aggregate(this.append(r,o,a))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!Xa(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,""];se.Masked=it;class Hr{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=fr(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 Hr){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 se.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 Hr||e._stops.indexOf(s)>=0)&&n.aggregate(e._appendPlaceholder(s)),a=i instanceof Hr&&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 Hr: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 gE{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,Y.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,Y.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,Y.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,Y.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,Y.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,Y.NONE),!0})}}class Wv{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=Y.NONE);const r=0,i=this._value.length;switch(n){case Y.LEFT:case Y.FORCE_LEFT:return r;case Y.NONE:case Y.RIGHT:case Y.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 fr(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 Za{constructor(e){const{parent:n,isOptional:r,placeholderChar:i,displayChar:o,lazy:s,eager:a,...l}=e;this.masked=Hn(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=Y.NONE);const r=0,i=this.value.length,o=Math.min(Math.max(e,r),i);switch(n){case Y.LEFT:case Y.FORCE_LEFT:return this.isComplete?o:r;case Y.RIGHT:case Y.FORCE_RIGHT:return this.isComplete?o:i;case Y.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}}Za.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 vE extends it{updateOptions(e){super.updateOptions(e)}_update(e){const n=e.mask;n&&(e.validate=r=>r.search(n)>=0),super._update(e)}}se.MaskedRegExp=vE;class ot extends it{constructor(e){super({...ot.DEFAULTS,...e,definitions:Object.assign({},Za.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}=ps(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 se.RepeatBlock(m):Hn(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 Za({isOptional:i,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...ps(e[s]),parent:this}):new Wv({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 Hr;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 Hr&&(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=Y.NONE),!this._blocks.length)return 0;const r=new gE(this,e);if(n===Y.NONE)return r.pushRightBeforeInput()||(r.popState(),r.pushLeftBeforeInput())?r.pos:this.displayValue.length;if(n===Y.LEFT||n===Y.FORCE_LEFT){if(n===Y.LEFT){if(r.pushRightBeforeFilled(),r.ok&&r.pos===e)return e;r.popState()}if(r.pushLeftBeforeInput(),r.pushLeftBeforeRequired(),r.pushLeftBeforeFilled(),n===Y.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===Y.FORCE_LEFT?0:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:0)}return n===Y.RIGHT||n===Y.FORCE_RIGHT?(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.pushRightBeforeFilled()?r.pos:n===Y.FORCE_RIGHT?this.displayValue.length:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:this.nearestInputPos(e,Y.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=Za;ot.FixedDefinition=Wv;se.MaskedPattern=ot;class Ia 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}}se.MaskedRange=Ia;const yE="d{.}`m{.}`Y";class Fn extends ot{static extractPatternOptions(e){const{mask:n,pattern:r,...i}=e;return{...i,mask:fr(n)?n:r}}constructor(e){super(Fn.extractPatternOptions({...Fn.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:n,pattern:r,blocks:i,...o}={...Fn.DEFAULTS,...e},s=Object.assign({},Fn.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:fr(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(Fn.extractPatternOptions(e))}}Fn.GET_DEFAULT_BLOCKS=()=>({d:{mask:Ia,from:1,to:31,maxLength:2},m:{mask:Ia,from:1,to:12,maxLength:2},Y:{mask:Ia,from:1900,to:9999}});Fn.DEFAULTS={...ot.DEFAULTS,mask:Date,pattern:yE,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)}};se.MaskedDate=Fn;class mu extends it{constructor(e){super({...mu.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}=ps(n),o=Hn({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 Xa(n,o)&&n.maskEquals(i)}):super.maskEquals(e)}typedValueEquals(e){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(e))}}mu.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,Y.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,Y.FORCE_LEFT)))}});return o.sort((s,a)=>a.weight-s.weight||a.totalInputPositions-s.totalInputPositions),e.compiledMasks[o[0].index]}};se.MaskedDynamic=mu;class gu extends ot{constructor(e){super({...gu.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,Y.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,Y.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}}gu.DEFAULTS={...ot.DEFAULTS,matchValue:(t,e,n)=>t.indexOf(e,n)===n};se.MaskedEnum=gu;class bE extends it{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}se.MaskedFunction=bE;var Uv;class Ct extends it{constructor(e){super({...Ct.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),n="\\d*",r=(this.scale?"("+Xu(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+n+r),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(Xu).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(Xu(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(Ct.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 Y.NONE:case Y.LEFT:case Y.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===Y.FORCE_LEFT)return r}break}case Y.RIGHT:case Y.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===Ct.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,Ct.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(Ct.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)||Ct.EMPTY_VALUES.includes(e)&&Ct.EMPTY_VALUES.includes(this.typedValue))&&!(e===0&&this.value==="")}}Uv=Ct;Ct.UNMASKED_RADIX=".";Ct.EMPTY_VALUES=[...it.EMPTY_VALUES,0];Ct.DEFAULTS={...it.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[Uv.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})};se.MaskedNumber=Ct;const id={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function Kv(t,e,n){e===void 0&&(e=id.MASKED),n===void 0&&(n=id.MASKED);const r=Hn(t);return i=>r.runIsolated(o=>(o[e]=i,o[n]))}function kE(t,e,n,r){return Kv(e,n,r)(t)}se.PIPE_TYPE=id;se.createPipe=Kv;se.pipe=kE;class wE 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}=ps(e);this._blockOpts=Object.assign({},this._blockOpts,s);const a=Hn(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(Hn(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}}se.RepeatBlock=wE;try{globalThis.IMask=se}catch{}function xE(t,e){let{emit:n,onAccept:r,onComplete:i,defaultValue:o,defaultUnmaskedValue:s,defaultTypedValue:a}=e===void 0?{}:e;const l=Ak(t)?t:H(t),u=H(),c=H(),d=H(""),h=H(""),p=H();let f,m=d.value,g=h.value,b=p.value;function y(){b=p.value=c.value.typedValue,g=h.value=c.value.unmaskedValue,m=d.value=c.value.value}function k(A){y(),n&&(n("accept",d.value,A),n("accept:masked",d.value,A),n("accept:typed",p.value,A),n("accept:unmasked",h.value,A)),r?.(A)}function v(A){n&&(n("complete",c.value.value,A),n("complete:masked",c.value.value,A),n("complete:typed",c.value.typedValue,A),n("complete:unmasked",c.value.unmaskedValue,A)),i?.(A)}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)};xe(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)};xe(d,x);const C=()=>{!c.value||p.value===void 0||(b!==p.value&&(c.value.typedValue=p.value,c.value.masked.typedValueEquals(p.value)||k()),b=void 0)};xe(p,C);function M(){f=u.value;const A=l.value;!f||!(A!=null&&A.mask)||(c.value=se(f,A),o!==void 0&&(d.value=o),s!==void 0&&(h.value=s),a!==void 0&&(p.value=a),w(),x(),C(),y(),c.value.on("accept",k).on("complete",v))}function T(){var A;(A=c.value)==null||A.destroy(),c.value=void 0}return Tn(M),Jg(T),xe([u,l],()=>{const A=u.value,_=l.value;(!(_!=null&&_.mask)||A!==f)&&T(),A&&(c.value?c.value.updateOptions(_):M())}),{el:u,mask:Yg(c),masked:d,unmasked:h,typed:p}}const EE={key:0,class:"k-input__prefix"},CE=["id","aria-labelledby","aria-describedby","required","type"],SE={key:1,class:"k-input__suffix"},TE=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=cp(),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=dp(du,I(()=>({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}=xE(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 Tn(()=>{xe(()=>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:Se(B(s)({invalid:B(a).invalid,align:p.align}))},[p.$slots.prefix||p.prefix?(E(),O("span",EE,[L(p.$slots,"prefix",{},()=>[Be(oe(p.prefix),1)])])):P("",!0),U("input",re({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,CE),p.$slots.suffix||p.suffix?(E(),O("span",SE,[L(p.$slots,"suffix",{},()=>[Be(oe(p.suffix),1)])])):P("",!0)],2))}}),OE=["id","value","aria-labelledby","aria-describedby","required"],bL=Q({__name:"TextArea",props:{invalid:{type:Boolean},id:{},modelValue:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=cp(),r=t,i=e;function o(c){i("update:modelValue",c.target.value)}const s=rn("k-textarea",{variants:{invalid:{true:"k-textarea--invalid"}}}),a=dp(du,I(()=>({id:r.id,invalid:r.invalid,required:!1,events:{onBlur:()=>{},onFocus:()=>{}}}))),l=c=>{var d;(d=a.value.events)==null||d.onFocus(c),n.onFocus&&n.onFocus(c)},u=c=>{var d;(d=a.value.events)==null||d.onBlur(c),n.onBlur&&n.onBlur(c)};return(c,d)=>(E(),O("textarea",re({class:B(s)({invalid:B(a).invalid}),id:B(a).id,value:c.modelValue,"aria-labelledby":B(a).labelId,"aria-describedby":B(a).helpId,required:B(a).required,onInput:o,onBlur:u,onFocus:l},c.$attrs),null,16,OE))}});let AE=class{constructor(t,e){Jt(this,"key"),Jt(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(){}},ME=class{constructor(t,e){Jt(this,"key"),Jt(this,"goto"),Jt(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 _E{constructor(e,n){Jt(this,"key"),Jt(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 DE=Object.freeze(Object.defineProperty({__proto__:null,localStorage:AE,none:ME,sessionStorage:_E},Symbol.toStringTag,{value:"Module"})),IE=["data-step"],NE={key:0,class:"k-stepper-breadcrumbs-wrapper"},RE={key:0,class:"k-stepper__breadcrumb-arrow"},PE=["disabled","onClick"],FE={class:"k-stepper__breadcrumb-icon"},LE={class:"k-stepper__breadcrumb-label"},BE={class:"k-stepper__component-wrapper"},VE={key:0,class:"k-stepper__navigation"},kL=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=H(),i=H(),o=H(n.steps[0].id);let s;const a=typeof n.stateHandler=="string"?DE[n.stateHandler]:n.stateHandler;s=new a(n.stateKey,f),pi(()=>s.destroy());const l=I(()=>c(o.value)),u=I(()=>{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=fp({next:h,prev:p,goto:f});xe(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 b(){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 C=["top","bottom"].includes(x)?"h":"v";return`k-stepper-${v}-${C}-${g()}`}const y=()=>{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:Se(`k-stepper k-stepper--breadcrumb-placement-${k.breadcrumbPlacement}`),"data-step":o.value},[k.hidebreadcrumbs?P("",!0):(E(),O("div",NE,[L(k.$slots,"before-breadcrumbs",be(Re({meta:l.value,navigate:m}))),U("div",{class:"k-stepper__breadcrumbs",ref_key:"breadcrumb",ref:r},[(E(!0),O(Oe,null,Mt(k.steps,(w,x)=>(E(),O(Oe,null,[x>0?(E(),O("div",RE)):P("",!0),L(k.$slots,"breadcrumb",{step:w,isActive:w.id===o.value,index:x,select:()=>f(w.id)},()=>[U("button",{type:"button",class:Se(["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:C=>f(w.id)},[U("span",FE,[L(k.$slots,"breadcrumb-icon",{step:w},()=>[w.isValid===!0?(E(),z(B(Ze),{key:0,icon:"heroicons-solid:check",width:12})):w.isValid===!1?(E(),z(B(Ze),{key:1,icon:"heroicons:exclamation-triangle",width:17})):(E(),O(Oe,{key:2},[Be(oe(x+1),1)],64))])]),U("span",LE,oe(w.label),1)],10,PE)])],64))),256))],512),L(k.$slots,"after-breadcrumbs",be(Re({meta:l.value,navigate:m})))])),L(k.$slots,"before-content",be(Re({meta:l.value,navigate:m}))),U("div",BE,[he(up,{name:b(),mode:"out-in",onAfterEnter:y},{default:ee(()=>[k.keepAlive?(E(),z(Mk,{key:0},[(E(),z(Qe(u.value.step.component),re({key:o.value},u.value),null,16))],1024)):(E(),z(Qe(u.value.step.component),re({key:o.value},u.value),null,16))]),_:1},8,["name"]),k.$slots.navigation?(E(),O("div",VE,[L(k.$slots,"navigation",be(Re({meta:l.value,navigate:m})))])):P("",!0)]),L(k.$slots,"after-content",be(Re({meta:l.value,navigate:m})))],10,IE))}}),$E=["src","alt"],vu=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=H(),o=H(!1),s=H(!1),a=H(),l=I(()=>({"--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 Tn(()=>{var d;return((d=i.value)==null?void 0:d.complete)&&u()}),(d,h)=>(E(),O("figure",{class:Se(["k-image",[`k-image--size-${d.size}`,{"k-image--loaded":o.value,"k-image--loading":!o.value}]]),style:kn(l.value)},[o.value?P("",!0):(E(),z(fv,{key:0,size:"small"})),qa(U("img",{src:d.src,alt:d.alt||d.caption,onLoad:u,onError:c,ref_key:"image",ref:i},null,40,$E),[[Wg,!s.value]]),d.$slots.caption||d.caption?(E(),O("figcaption",{key:1,class:Se(`k-image__caption k-image__caption--visibility-${d.captionVisibility} k-image__caption--theme-${!o.value||s.value?"light":d.captionTheme}`)},[L(d.$slots,"caption",{},()=>[Be(oe(d.caption),1)])],2)):P("",!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=I(()=>hv("flex",{justify:Ka(e.justify)||"initial",align:Ka(e.align)||"initial",wrap:e.nowrap?"nowrap":"wrap",gap:bp(e.gap),direction:e.direction}));return(r,i)=>(E(),z(Qe(r.is),{class:"k-flex",style:kn(n.value)},{default:ee(()=>[L(r.$slots,"default")]),_:3},8,["style"]))}}),jE={key:0,class:"k-card__thumbnail"},zE={key:0,class:"k-card__title"},HE={key:1,class:"k-card__subtitle"},qE={key:2,class:"k-card__content"},WE=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=pp(),r=I(()=>e.thumbnail||n.thumbnail),i=I(()=>e.title||e.subtitle||n.header),o=I(()=>n.actions),s=I(()=>n.default);return(a,l)=>(E(),z(Qe(a.is),re({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:ee(()=>[r.value?(E(),O("div",jE,[L(a.$slots,"thumbnail",{},()=>[a.thumbnail?(E(),z(vu,re({key:0},a.thumbnailOptions,{src:a.thumbnail}),null,16,["src"])):P("",!0)])])):P("",!0),i.value?(E(),z(ni,{key:1,is:"header",direction:"column",gap:"0rem",class:"k-card__header"},{default:ee(()=>[L(a.$slots,"header",{},()=>[a.title?(E(),O("div",zE,oe(a.title),1)):P("",!0),a.subtitle?(E(),O("div",HE,oe(a.subtitle),1)):P("",!0)])]),_:3})):P("",!0),s.value?(E(),O("div",qE,[L(a.$slots,"default")])):P("",!0),o.value?(E(),z(ni,{key:3,justify:"center",align:"center",class:"k-card__actions"},{default:ee(()=>[L(a.$slots,"actions")]),_:3})):P("",!0)]),_:3},16,["class"]))}}),wL=Q({__name:"Skeleton",props:{variant:{default:"shiny"},aspectRatio:{},width:{},height:{},rounding:{}},setup(t){const e=()=>t.rounding?t.rounding==="full"?"9999px":bp(t.rounding,"rounding"):"initial",n=I(()=>({"--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:Se(["k-skeleton",`k-skeleton--variant-${r.variant}`]),style:kn(n.value)},[L(r.$slots,"default")],6))}});var UE=$n("slider").parts("root","label","thumb","valueText","track","range","control","markerGroup","marker","draggingIndicator"),ln=UE.build(),Gv=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`slider:${t.id}`},Jv=(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}`},od=(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}`},Yv=t=>{var e;return((e=t.ids)==null?void 0:e.control)??`slider:${t.id}:control`},KE=t=>{var e;return((e=t.ids)==null?void 0:e.track)??`slider:${t.id}:track`},GE=t=>{var e;return((e=t.ids)==null?void 0:e.range)??`slider:${t.id}:range`},vf=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`},YE=(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}`},XE=t=>t.getById(Gv(t)),ZE=(t,e)=>t.getById(Jv(t,e)),Xv=t=>Op(Qv(t),"[role=slider]"),QE=t=>Xv(t)[0],Zv=(t,e)=>t.getById(od(t,e)),Qv=t=>t.getById(Yv(t)),yf=(t,e)=>{const{prop:n,scope:r}=t,i=Qv(r);if(!i)return;const o=Vx(e,i).getPercentValue({orientation:n("orientation"),dir:n("dir"),inverted:{y:!0}});return Rv(o,n("min"),n("max"),n("step"))},eC=(t,e)=>{e.forEach((n,r)=>{const i=Zv(t,r);i&&Mx(i,{value:n})})},tC=t=>({left:t?.offsetLeft??0,top:t?.offsetTop??0,width:t?.offsetWidth??0,height:t?.offsetHeight??0});function nC(t){const e=t[0],n=t[t.length-1];return[e,n]}function rC(t){const{prop:e,computed:n}=t,r=n("valuePercent"),[i,o]=nC(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 e("origin")==="end"?{start:`${o}%`,end:"0%"}:{start:"0%",end:`${100-o}%`}}return{start:`${i}%`,end:`${100-o}%`}}function iC(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 oC(t,e){const{context:n,prop:r}=t,{height:i=0}=n.get("thumbSize")??{},o=td([r("min"),r("max")],[-i/2,i/2]);return parseFloat(o(e).toFixed(2))}function sC(t,e){const{computed:n,context:r,prop:i}=t,{width:o=0}=r.get("thumbSize")??{};if(n("isRtl")){const a=td([i("max"),i("min")],[-o/2,o/2]);return-1*parseFloat(a(e).toFixed(2))}const s=td([i("min"),i("max")],[-o/2,o/2]);return parseFloat(s(e).toFixed(2))}function aC(t,e,n){const{computed:r,prop:i}=t;if(i("thumbAlignment")==="center")return`${e}%`;const o=r("isVertical")?oC(t,n):sC(t,n);return`calc(${e}% - ${o}px)`}function ey(t,e){const{prop:n}=t,r=Dp(e,n("min"),n("max"))*100;return aC(t,r,e)}function ty(t){const{computed:e,prop:n}=t;let r="visible";return n("thumbAlignment")==="contain"&&!e("hasMeasuredThumbSize")&&(r="hidden"),r}function bf(t,e){const{computed:n}=t,r=n("isVertical")?"bottom":"insetInlineStart";return{visibility:ty(t),position:"absolute",transform:"var(--slider-thumb-transform)",[r]:`var(--slider-thumb-offset-${e})`}}function lC(){return{touchAction:"none",userSelect:"none",WebkitUserSelect:"none",position:"relative"}}function uC(t){const{context:e,computed:n}=t,r=n("isVertical"),i=n("isRtl"),o=rC(t),s=e.get("thumbSize");return{...e.get("value").reduce((a,l,u)=>{const c=ey(t,l);return{...a,[`--slider-thumb-offset-${u}`]:c}},{}),"--slider-thumb-width":af(s?.width),"--slider-thumb-height":af(s?.height),"--slider-thumb-transform":r?"translateY(50%)":i?"translateX(50%)":"translateX(-50%)","--slider-range-start":o.start,"--slider-range-end":o.end}}function cC(t,e){const{computed:n}=t,r=n("isHorizontal"),i=n("isRtl");return{visibility:ty(t),position:"absolute",pointerEvents:"none",[r?"insetInlineStart":"bottom"]:ey(t,e),translate:"var(--tx) var(--ty)","--tx":r?i?"50%":"-50%":"0%","--ty":r?"0%":"50%"}}function dC(){return{userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none",position:"relative"}}function pC(t,e){return e.map((n,r)=>sd(t,n,r))}function mr(t,e){const{context:n,prop:r}=t;return Fv(n.get("value"),r("min"),r("max"),r("minStepsBetweenThumbs"))[e]}function sd(t,e,n){const{prop:r}=t,i=mr(t,n),o=Ip(e,r("min"),r("max"),r("step"));return Ds(o,i.min,i.max)}function hC(t,e,n){const{context:r,prop:i}=t,o=e??r.get("focusedIndex"),s=mr(t,o),a=b1(o,{...s,step:n??i("step"),values:r.get("value")});return a[o]=Ds(a[o],s.min,s.max),a}function fC(t,e,n){const{context:r,prop:i}=t,o=e??r.get("focusedIndex"),s=mr(t,o),a=y1(o,{...s,step:n??i("step"),values:r.get("value")});return a[o]=Ds(a[o],s.min,s.max),a}function mC(t,e){const{context:n}=t;return k1(n.get("value"),e)}function ny(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"),b=o("orientation")==="horizontal",y=o("orientation")==="vertical";function k(w){return Dp(w,o("min"),o("max"))}function v(w){return Rv(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 C=v(x);r({type:"SET_VALUE",index:w,value:C})},getThumbMin(w){return mr(t,w).min},getThumbMax(w){return mr(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":J(f),"data-orientation":o("orientation"),"data-invalid":J(m),"data-dragging":J(p),"data-focus":J(h),id:vf(a),htmlFor:od(a,0),onClick(w){var x;g&&(w.preventDefault(),(x=QE(a))==null||x.focus())},style:{userSelect:"none",WebkitUserSelect:"none"}})},getRootProps(){return e.element({...ln.root.attrs,"data-disabled":J(f),"data-orientation":o("orientation"),"data-dragging":J(p),"data-invalid":J(m),"data-focus":J(h),id:Gv(a),dir:o("dir"),style:uC(t)})},getValueTextProps(){return e.element({...ln.valueText.attrs,dir:o("dir"),"data-disabled":J(f),"data-orientation":o("orientation"),"data-invalid":J(m),"data-focus":J(h),id:JE(a)})},getTrackProps(){return e.element({...ln.track.attrs,dir:o("dir"),id:KE(a),"data-disabled":J(f),"data-invalid":J(m),"data-dragging":J(p),"data-orientation":o("orientation"),"data-focus":J(h),style:{position:"relative"}})},getThumbProps(w){var x;const{index:C=0,name:M}=w,T=c[C],A=mr(t,C),_=(x=o("getAriaValueText"))==null?void 0:x({value:T,index:C}),N=Array.isArray(l)?l[C]:l,$=Array.isArray(u)?u[C]:u;return e.element({...ln.thumb.attrs,dir:o("dir"),"data-index":C,"data-name":M,id:Jv(a,C),"data-disabled":J(f),"data-orientation":o("orientation"),"data-focus":J(h&&d===C),"data-dragging":J(p&&d===C),draggable:!1,"aria-disabled":Jw(f),"aria-label":N,"aria-labelledby":$??vf(a),"aria-orientation":o("orientation"),"aria-valuemax":A.max,"aria-valuemin":A.min,"aria-valuenow":c[C],"aria-valuetext":_,role:"slider",tabIndex:f?void 0:0,style:bf(t,C),onPointerDown(j){g&&(r({type:"THUMB_POINTER_DOWN",index:C}),j.stopPropagation())},onBlur(){g&&r({type:"BLUR"})},onFocus(){g&&r({type:"FOCUS",index:C})},onKeyDown(j){if(j.defaultPrevented||!g)return;const q=Ox(j)*o("step"),K={ArrowUp(){b||r({type:"ARROW_INC",step:q,src:"ArrowUp"})},ArrowDown(){b||r({type:"ARROW_DEC",step:q,src:"ArrowDown"})},ArrowLeft(){y||r({type:"ARROW_DEC",step:q,src:"ArrowLeft"})},ArrowRight(){y||r({type:"ARROW_INC",step:q,src:"ArrowRight"})},PageUp(){r({type:"ARROW_INC",step:q,src:"PageUp"})},PageDown(){r({type:"ARROW_DEC",step:q,src:"PageDown"})},Home(){r({type:"HOME"})},End(){r({type:"END"})}},X=vv(j,{dir:o("dir"),orientation:o("orientation")}),fe=K[X];fe&&(fe(j),j.preventDefault(),j.stopPropagation())}})},getHiddenInputProps(w){const{index:x=0,name:C}=w;return e.input({name:C??(o("name")?o("name")+(c.length>1?"[]":""):void 0),form:o("form"),type:"text",hidden:!0,defaultValue:c[x],id:od(a,x)})},getRangeProps(){return e.element({id:GE(a),...ln.range.attrs,dir:o("dir"),"data-dragging":J(p),"data-focus":J(h),"data-invalid":J(m),"data-disabled":J(f),"data-orientation":o("orientation"),style:iC(t)})},getControlProps(){return e.element({...ln.control.attrs,dir:o("dir"),id:Yv(a),"data-dragging":J(p),"data-disabled":J(f),"data-orientation":o("orientation"),"data-invalid":J(m),"data-focus":J(h),style:lC(),onPointerDown(w){if(!g||!kx(w)||xx(w))return;const x=Ep(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:dC()})},getMarkerProps(w){const x=cC(t,w.value);let C;return w.value<_v(c)?C="under-value":w.value>Dv(c)?C="over-value":C="at-value",e.element({...ln.marker.attrs,id:YE(a,w.value),role:"presentation",dir:o("dir"),"data-orientation":o("orientation"),"data-value":w.value,"data-disabled":J(f),"data-state":C,style:x})},getDraggingIndicatorProps(w){const{index:x=0}=w,C=x===d&&p;return e.element({...ln.draggingIndicator.attrs,role:"presentation",dir:o("dir"),hidden:!C,"data-orientation":o("orientation"),"data-state":C?"open":"closed",style:bf(t,x)})}}}var gC=(t,e)=>t?.width===e?.width&&t?.height===e?.height,kf=(t,e,n,r,i)=>Fv(t,e,n,i*r).map(o=>{const s=Ip(o.value,o.min,o.max,r);return Ds(s,o.min,o.max)}),ry={props({props:t}){const e=t.min??0,n=t.max??100,r=t.step??1,i=t.defaultValue??[e],o=t.minStepsBetweenThumbs??0;return{dir:"ltr",thumbAlignment:"contain",origin:"start",orientation:"horizontal",minStepsBetweenThumbs:o,...t,defaultValue:kf(i,e,n,r,o),value:t.value?kf(t.value,e,n,r,o):void 0,max:n,step:r,min:e}},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"),isEqual:_s,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*Dp(n,e("min"),e("max")))}},watch({track:t,action:e,context:n}){t([()=>n.hash("value")],()=>{e(["syncInputElements","dispatchChangeEvent"])})},effects:["trackFormControlState","trackThumbSize"],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 lu(XE(e),{onFieldsetDisabledChange(n){t.set("fieldsetDisabled",n)},onFormReset(){t.set("value",t.initial("value"))}})},trackPointerMove({scope:t,send:e}){return Hx(t.getDoc(),{onPointerMove(n){e({type:"POINTER_MOVE",point:n.point})},onPointerUp(){e({type:"POINTER_UP"})}})},trackThumbSize({context:t,scope:e,prop:n}){if(!(n("thumbAlignment")!=="contain"||n("thumbSize")))return Tv(Xv(e),{box:"border-box",measure(r){return tC(r)},onEntry({rects:r}){const i=x1(r[0],["width","height"]);gC(t.get("thumbSize"),i)||t.set("thumbSize",i)}})}},actions:{dispatchChangeEvent({context:t,scope:e}){eC(e,t.get("value"))},syncInputElements({context:t,scope:e}){t.get("value").forEach((n,r)=>{const i=Zv(e,r);bv(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=yf(t,n.point);if(r==null)return;const i=mC(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=yf(t,n.point);if(r==null)return;const i=e.get("focusedIndex"),o=sd(t,r,i);e.set("value",s=>Do(s,i,o))})},focusActiveThumb({scope:t,context:e}){Ot(()=>{const n=ZE(t,e.get("focusedIndex"));n?.focus({preventScroll:!0})})},decrementThumbAtIndex(t){const{context:e,event:n}=t,r=hC(t,n.index,n.step);e.set("value",r)},incrementThumbAtIndex(t){const{context:e,event:n}=t,r=fC(t,n.index,n.step);e.set("value",r)},setFocusedThumbToMin(t){const{context:e}=t,n=e.get("focusedIndex"),{min:r}=mr(t,n);e.set("value",i=>Do(i,n,r))},setFocusedThumbToMax(t){const{context:e}=t,n=e.get("focusedIndex"),{max:r}=mr(t,n);e.set("value",i=>Do(i,n,r))},setValueAtIndex(t){const{context:e,event:n}=t,r=sd(t,n.value,n.index);e.set("value",i=>Do(i,n.index,r))},setValue(t){const{context:e,event:n}=t,r=pC(t,n.value);e.set("value",r)}}}};Kn()(["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"]);Kn()(["index","name"]);const vC=["data-value"],yC=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=mi(ry,{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=I(()=>ny(i,fi)),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 b=Math.max(u,Math.min(c,m)),y=Math.min(h,Math.max(d,g));return p===b&&f===y?r("update:modelValue",[b,y]):o.value.setValue([b,y])},a=I(()=>{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 xe(()=>n.modelValue,s,{deep:!0}),(l,u)=>(E(),O("div",re(o.value.getRootProps(),{class:"k-rangeslider"}),[U("div",be(Re(o.value.getControlProps())),[U("div",be(Re(o.value.getTrackProps())),[U("div",be(Re(o.value.getRangeProps())),null,16)],16),(E(!0),O(Oe,null,Mt(o.value.value,(c,d)=>(E(),O("div",re({key:d,ref_for:!0},o.value.getThumbProps({index:d})),[U("input",re({ref_for:!0},o.value.getHiddenInputProps({index:d})),null,16)],16))),128))],16),a.value.length?(E(),O("div",be(re({key:0},o.value.getMarkerGroupProps())),[(E(!0),O(Oe,null,Mt(a.value,c=>(E(),O("span",re({ref_for:!0},o.value.getMarkerProps({value:c.value}),{"data-value":c.label}),null,16,vC))),256))],16)):P("",!0)],16))}}),bC=["data-value"],xL=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=mi(ry,{id:Qt(),...n,defaultValue:[n.modelValue],onValueChange:({value:l})=>{r("update:modelValue",l[0])}}),o=I(()=>ny(i,fi)),s=l=>o.value.setValue([Math.max(n.min||l,Math.min(n.max||l,l))]),a=I(()=>{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 xe(()=>n.modelValue,s,{deep:!0}),(l,u)=>(E(),O("div",re(o.value.getRootProps(),{class:["k-slider",{"k-slider--marker-highlight":l.markerHighlight}]}),[U("div",be(Re(o.value.getControlProps())),[U("div",be(Re(o.value.getTrackProps())),[U("div",be(Re(o.value.getRangeProps())),null,16)],16),U("div",be(Re(o.value.getThumbProps({index:0}))),[U("input",be(Re(o.value.getHiddenInputProps({index:0}))),null,16)],16),U("output",be(Re(o.value.getValueTextProps())),[L(l.$slots,"value",{value:o.value.value},()=>[Be(oe(l.format(o.value.value.at(0))),1)])],16)],16),a.value.length?(E(),O("div",be(re({key:0},o.value.getMarkerGroupProps())),[(E(!0),O(Oe,null,Mt(a.value,c=>(E(),O("span",re({ref_for:!0},o.value.getMarkerProps({value:c.value}),{"data-value":c.label}),null,16,bC))),256))],16)):P("",!0)],16))}}),Zi=Math.min,Kr=Math.max,Qa=Math.round,ia=Math.floor,vn=t=>({x:t,y:t}),kC={left:"right",right:"left",bottom:"top",top:"bottom"},wC={start:"end",end:"start"};function ad(t,e,n){return Kr(t,Zi(e,n))}function Is(t,e){return typeof t=="function"?t(e):t}function ri(t){return t.split("-")[0]}function Ns(t){return t.split("-")[1]}function iy(t){return t==="x"?"y":"x"}function Bp(t){return t==="y"?"height":"width"}function Gr(t){return["top","bottom"].includes(ri(t))?"y":"x"}function Vp(t){return iy(Gr(t))}function xC(t,e,n){n===void 0&&(n=!1);const r=Ns(t),i=Vp(t),o=Bp(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=el(s)),[s,el(s)]}function EC(t){const e=el(t);return[ld(t),e,ld(e)]}function ld(t){return t.replace(/start|end/g,e=>wC[e])}function CC(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 SC(t,e,n,r){const i=Ns(t);let o=CC(ri(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(ld)))),o}function el(t){return t.replace(/left|right|bottom|top/g,e=>kC[e])}function TC(t){return{top:0,right:0,bottom:0,left:0,...t}}function oy(t){return typeof t!="number"?TC(t):{top:t,right:t,bottom:t,left:t}}function tl(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 wf(t,e,n){let{reference:r,floating:i}=t;const o=Gr(e),s=Vp(e),a=Bp(s),l=ri(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(Ns(e)){case"start":p[s]-=h*(n&&u?-1:1);break;case"end":p[s]+=h*(n&&u?-1:1);break}return p}const OC=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}=wf(u,r,l),h=r,p={},f=0;for(let m=0;m<a.length;m++){const{name:g,fn:b}=a[m],{x:y,y:k,data:v,reset:w}=await b({x:c,y:d,initialPlacement:r,placement:h,strategy:i,middlewareData:p,rects:u,platform:s,elements:{reference:t,floating:e}});c=y??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}=wf(u,h,l)),m=-1)}return{x:c,y:d,placement:h,strategy:i,middlewareData:p}};async function sy(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}=Is(e,t),f=oy(p),m=a[h?d==="floating"?"reference":"floating":d],g=tl(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})),b=d==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,y=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),k=await(o.isElement==null?void 0:o.isElement(y))?await(o.getScale==null?void 0:o.getScale(y))||{x:1,y:1}:{x:1,y:1},v=tl(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:y,strategy:l}):b);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 AC=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=e,{element:u,padding:c=0}=Is(t,e)||{};if(u==null)return{};const d=oy(c),h={x:n,y:r},p=Vp(i),f=Bp(p),m=await s.getDimensions(u),g=p==="y",b=g?"top":"left",y=g?"bottom":"right",k=g?"clientHeight":"clientWidth",v=o.reference[f]+o.reference[p]-h[p]-o.floating[f],w=h[p]-o.reference[p],x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let C=x?x[k]:0;(!C||!await(s.isElement==null?void 0:s.isElement(x)))&&(C=a.floating[k]||o.floating[f]);const M=v/2-w/2,T=C/2-m[f]/2-1,A=Zi(d[b],T),_=Zi(d[y],T),N=A,$=C-m[f]-_,j=C/2-m[f]/2+M,q=ad(N,j,$),K=!l.arrow&&Ns(i)!=null&&j!==q&&o.reference[f]/2-(j<N?A:_)-m[f]/2<0,X=K?j<N?j-N:j-$:0;return{[p]:h[p]+X,data:{[p]:q,centerOffset:j-q-X,...K&&{alignmentOffset:X}},reset:K}}}),MC=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}=Is(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const b=ri(i),y=Gr(a),k=ri(a)===a,v=await(l.isRTL==null?void 0:l.isRTL(u.floating)),w=h||(k||!m?[el(a)]:EC(a)),x=f!=="none";!h&&x&&w.push(...SC(a,m,f,v));const C=[a,...w],M=await sy(e,g),T=[];let A=((r=o.flip)==null?void 0:r.overflows)||[];if(c&&T.push(M[b]),d){const q=xC(i,s,v);T.push(M[q[0]],M[q[1]])}if(A=[...A,{placement:i,overflows:T}],!T.every(q=>q<=0)){var _,N;const q=(((_=o.flip)==null?void 0:_.index)||0)+1,K=C[q];if(K){var $;const fe=d==="alignment"?y!==Gr(K):!1,Ee=(($=A[0])==null?void 0:$.overflows[0])>0;if(!fe||Ee)return{data:{index:q,overflows:A},reset:{placement:K}}}let X=(N=A.filter(fe=>fe.overflows[0]<=0).sort((fe,Ee)=>fe.overflows[1]-Ee.overflows[1])[0])==null?void 0:N.placement;if(!X)switch(p){case"bestFit":{var j;const fe=(j=A.filter(Ee=>{if(x){const Ie=Gr(Ee.placement);return Ie===y||Ie==="y"}return!0}).map(Ee=>[Ee.placement,Ee.overflows.filter(Ie=>Ie>0).reduce((Ie,An)=>Ie+An,0)]).sort((Ee,Ie)=>Ee[1]-Ie[1])[0])==null?void 0:j[0];fe&&(X=fe);break}case"initialPlacement":X=a;break}if(i!==X)return{reset:{placement:X}}}return{}}}};async function _C(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=ri(n),a=Ns(n),l=Gr(n)==="y",u=["left","top"].includes(s)?-1:1,c=o&&l?-1:1,d=Is(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 DC=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 _C(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}}}}},IC=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:g=>{let{x:b,y}=g;return{x:b,y}}},...l}=Is(t,e),u={x:n,y:r},c=await sy(e,l),d=Gr(ri(i)),h=iy(d);let p=u[h],f=u[d];if(o){const g=h==="y"?"top":"left",b=h==="y"?"bottom":"right",y=p+c[g],k=p-c[b];p=ad(y,p,k)}if(s){const g=d==="y"?"top":"left",b=d==="y"?"bottom":"right",y=f+c[g],k=f-c[b];f=ad(y,f,k)}const m=a.fn({...e,[h]:p,[d]:f});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:o,[d]:s}}}}}};function yu(){return typeof window<"u"}function gi(t){return $p(t)?(t.nodeName||"").toLowerCase():"#document"}function _t(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function On(t){var e;return(e=($p(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function $p(t){return yu()?t instanceof Node||t instanceof _t(t).Node:!1}function en(t){return yu()?t instanceof Element||t instanceof _t(t).Element:!1}function wn(t){return yu()?t instanceof HTMLElement||t instanceof _t(t).HTMLElement:!1}function xf(t){return!yu()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof _t(t).ShadowRoot}function Rs(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 NC(t){return["table","td","th"].includes(gi(t))}function bu(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function jp(t){const e=zp(),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 RC(t){let e=Er(t);for(;wn(e)&&!Qi(e);){if(jp(e))return e;if(bu(e))return null;e=Er(e)}return null}function zp(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Qi(t){return["html","body","#document"].includes(gi(t))}function tn(t){return _t(t).getComputedStyle(t)}function ku(t){return en(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Er(t){if(gi(t)==="html")return t;const e=t.assignedSlot||t.parentNode||xf(t)&&t.host||On(t);return xf(e)?e.host:e}function ay(t){const e=Er(t);return Qi(e)?t.ownerDocument?t.ownerDocument.body:t.body:wn(e)&&Rs(e)?e:ay(e)}function hs(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=ay(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=_t(i);if(o){const a=ud(s);return e.concat(s,s.visualViewport||[],Rs(i)?i:[],a&&n?hs(a):[])}return e.concat(i,hs(i,[],n))}function ud(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ly(t){const e=tn(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=wn(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,a=Qa(n)!==o||Qa(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function Hp(t){return en(t)?t:t.contextElement}function Wi(t){const e=Hp(t);if(!wn(e))return vn(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=ly(e);let s=(o?Qa(n.width):n.width)/r,a=(o?Qa(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const PC=vn(0);function uy(t){const e=_t(t);return!zp()||!e.visualViewport?PC:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function FC(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==_t(t)?!1:e}function ii(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=Hp(t);let s=vn(1);e&&(r?en(r)&&(s=Wi(r)):s=Wi(t));const a=FC(o,n,r)?uy(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=_t(o),p=r&&en(r)?_t(r):r;let f=h,m=ud(f);for(;m&&r&&p!==f;){const g=Wi(m),b=m.getBoundingClientRect(),y=tn(m),k=b.left+(m.clientLeft+parseFloat(y.paddingLeft))*g.x,v=b.top+(m.clientTop+parseFloat(y.paddingTop))*g.y;l*=g.x,u*=g.y,c*=g.x,d*=g.y,l+=k,u+=v,f=_t(m),m=ud(f)}}return tl({width:c,height:d,x:l,y:u})}function qp(t,e){const n=ku(t).scrollLeft;return e?e.left+n:ii(On(t)).left+n}function cy(t,e,n){n===void 0&&(n=!1);const r=t.getBoundingClientRect(),i=r.left+e.scrollLeft-(n?0:qp(t,r)),o=r.top+e.scrollTop;return{x:i,y:o}}function LC(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const o=i==="fixed",s=On(r),a=e?bu(e.floating):!1;if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},u=vn(1);const c=vn(0),d=wn(r);if((d||!d&&!o)&&((gi(r)!=="body"||Rs(s))&&(l=ku(r)),wn(r))){const p=ii(r);u=Wi(r),c.x=p.x+r.clientLeft,c.y=p.y+r.clientTop}const h=s&&!d&&!o?cy(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 BC(t){return Array.from(t.getClientRects())}function VC(t){const e=On(t),n=ku(t),r=t.ownerDocument.body,i=Kr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=Kr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+qp(t);const a=-n.scrollTop;return tn(r).direction==="rtl"&&(s+=Kr(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function $C(t,e){const n=_t(t),r=On(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=zp();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a,y:l}}function jC(t,e){const n=ii(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=wn(t)?Wi(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 Ef(t,e,n){let r;if(e==="viewport")r=$C(t,n);else if(e==="document")r=VC(On(t));else if(en(e))r=jC(e,n);else{const i=uy(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return tl(r)}function dy(t,e){const n=Er(t);return n===e||!en(n)||Qi(n)?!1:tn(n).position==="fixed"||dy(n,e)}function zC(t,e){const n=e.get(t);if(n)return n;let r=hs(t,[],!1).filter(a=>en(a)&&gi(a)!=="body"),i=null;const o=tn(t).position==="fixed";let s=o?Er(t):t;for(;en(s)&&!Qi(s);){const a=tn(s),l=jp(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&i&&["absolute","fixed"].includes(i.position)||Rs(s)&&!l&&dy(t,s))?r=r.filter(u=>u!==s):i=a,s=Er(s)}return e.set(t,r),r}function HC(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?bu(e)?[]:zC(e,this._c):[].concat(n),r],s=o[0],a=o.reduce((l,u)=>{const c=Ef(e,u,i);return l.top=Kr(c.top,l.top),l.right=Zi(c.right,l.right),l.bottom=Zi(c.bottom,l.bottom),l.left=Kr(c.left,l.left),l},Ef(e,s,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function qC(t){const{width:e,height:n}=ly(t);return{width:e,height:n}}function WC(t,e,n){const r=wn(e),i=On(e),o=n==="fixed",s=ii(t,!0,o,e);let a={scrollLeft:0,scrollTop:0};const l=vn(0);if(r||!r&&!o)if((gi(e)!=="body"||Rs(i))&&(a=ku(e)),r){const h=ii(e,!0,o,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else i&&(l.x=qp(i));const u=i&&!r&&!o?cy(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 Zu(t){return tn(t).position==="static"}function Cf(t,e){if(!wn(t)||tn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return On(t)===n&&(n=n.ownerDocument.body),n}function py(t,e){const n=_t(t);if(bu(t))return n;if(!wn(t)){let i=Er(t);for(;i&&!Qi(i);){if(en(i)&&!Zu(i))return i;i=Er(i)}return n}let r=Cf(t,e);for(;r&&NC(r)&&Zu(r);)r=Cf(r,e);return r&&Qi(r)&&Zu(r)&&!jp(r)?n:r||RC(t)||n}const UC=async function(t){const e=this.getOffsetParent||py,n=this.getDimensions,r=await n(t.floating);return{reference:WC(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function KC(t){return tn(t).direction==="rtl"}const cd={convertOffsetParentRelativeRectToViewportRelativeRect:LC,getDocumentElement:On,getClippingRect:HC,getOffsetParent:py,getElementRects:UC,getClientRects:BC,getDimensions:qC,getScale:Wi,isElement:en,isRTL:KC};function hy(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function GC(t,e){let n=null,r;const i=On(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=ia(d),m=ia(i.clientWidth-(c+h)),g=ia(i.clientHeight-(d+p)),b=ia(c),y={rootMargin:-f+"px "+-m+"px "+-g+"px "+-b+"px",threshold:Kr(0,Zi(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&&!hy(u,t.getBoundingClientRect())&&s(),k=!1}try{n=new IntersectionObserver(v,{...y,root:i.ownerDocument})}catch{n=new IntersectionObserver(v,y)}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=Hp(t),c=i||o?[...u?hs(u):[],...hs(e)]:[];c.forEach(b=>{i&&b.addEventListener("scroll",n,{passive:!0}),o&&b.addEventListener("resize",n)});const d=u&&a?GC(u,n):null;let h=-1,p=null;s&&(p=new ResizeObserver(b=>{let[y]=b;y&&y.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?ii(t):null;l&&g();function g(){const b=ii(t);m&&!hy(m,b)&&n(),m=b,f=requestAnimationFrame(g)}return n(),()=>{var b;c.forEach(y=>{i&&y.removeEventListener("scroll",n),o&&y.removeEventListener("resize",n)}),d?.(),(b=p)==null||b.disconnect(),p=null,l&&cancelAnimationFrame(f)}}const fy=DC,YC=IC,my=MC,XC=AC,gy=(t,e,n)=>{const r=new Map,i={platform:cd,...n},o={...i.platform,_c:r};return OC(t,e,{...i,platform:o})};function ZC(t){return QC(t)}function Qu(t){return t.assignedSlot?t.assignedSlot:t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}function QC(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 wu=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=I(()=>{const{items:v,placement:w,teleport:x,keepOpen:C,...M}=n;return M}),i=H(!1),o=pu(),s=H(),a=H(),l=H({top:"",left:"",position:""});let u=()=>{};function c(){!s.value||!a.value||(u=JC(s.value.$el,a.value,()=>{!s.value||!a.value||gy(s.value.$el,a.value,{placement:n.placement,middleware:[fy(n.offset),my()],platform:{...cd,getOffsetParent:v=>cd.getOffsetParent(v,ZC)}}).then(({x:v,y:w})=>{l.value={top:`${w}px`,left:`${v}px`,position:"absolute"}})}))}pi(u),lp(()=>{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?y():k(),i.value=v,!0),f=I(()=>o.value.getRootNode()),m=I(()=>f.value instanceof ShadowRoot);function g(v){d(v,"dom")}function b(v){d(v,"shadow-dom")}function y(){window.addEventListener("keydown",h),m.value?(f.value.addEventListener("click",g),window.addEventListener("click",b)):window.addEventListener("click",g)}function k(){window.removeEventListener("keydown",h),m.value?(f.value.removeEventListener("click",g),window.removeEventListener("click",b)):window.removeEventListener("click",g)}return e({isOpen:i}),(v,w)=>(E(),O(Oe,null,[he(He,re({...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}]}),Ms({_:2},[v.$slots["icon-left"]?{name:"icon-left",fn:ee(()=>[L(v.$slots,"icon-left")]),key:"0"}:void 0,v.$slots.trigger?{name:"default",fn:ee(()=>[L(v.$slots,"trigger")]),key:"1"}:void 0,v.$slots["icon-right"]?{name:"icon-right",fn:ee(()=>[L(v.$slots,"icon-right")]),key:"2"}:void 0]),1040,["class"]),(E(),z(Kg,{to:v.teleportTo,disabled:!v.teleport},[he(up,{name:"k-dropdown"},{default:ee(()=>[i.value?(E(),O("div",{key:0,class:Se(`k-dropdown k-dropdown--theme-${v.theme}`),style:kn(l.value),ref_key:"content",ref:a,onClick:w[1]||(w[1]=()=>!v.keepOpen&&p(!1))},[L(v.$slots,"default",{close:p.bind(null,!1)},()=>[(E(!0),O(Oe,null,Mt(v.items,({action:x,icon:C,...M})=>(E(),z(He,re({ref_for:!0},M,{variant:"tertiary","icon-right":M.iconRight||C,onClick:()=>x()}),null,16,["icon-right","onClick"]))),256))])],6)):P("",!0)]),_:3})],8,["to","disabled"]))],64))}});function eS(t){return t!=null&&typeof t=="object"&&"$el"in t}function dd(t){if(eS(t)){const e=t.$el;return $p(e)&&gi(e)==="#comment"?null:e}return t}function Ii(t){return typeof t=="function"?t():B(t)}function tS(t){return{name:"arrow",options:t,fn(e){const n=dd(Ii(t.element));return n==null?{}:XC({element:n,padding:t.padding}).fn(e)}}}function vy(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Sf(t,e){const n=vy(t);return Math.round(e*n)/n}function nS(t,e,n){n===void 0&&(n={});const r=n.whileElementsMounted,i=I(()=>{var C;return(C=Ii(n.open))!=null?C:!0}),o=I(()=>Ii(n.middleware)),s=I(()=>{var C;return(C=Ii(n.placement))!=null?C:"bottom"}),a=I(()=>{var C;return(C=Ii(n.strategy))!=null?C:"absolute"}),l=I(()=>{var C;return(C=Ii(n.transform))!=null?C:!0}),u=I(()=>dd(t.value)),c=I(()=>dd(e.value)),d=H(0),h=H(0),p=H(a.value),f=H(s.value),m=Zt({}),g=H(!1),b=I(()=>{const C={position:p.value,left:"0",top:"0"};if(!c.value)return C;const M=Sf(c.value,d.value),T=Sf(c.value,h.value);return l.value?{...C,transform:"translate("+M+"px, "+T+"px)",...vy(c.value)>=1.5&&{willChange:"transform"}}:{position:p.value,left:M+"px",top:T+"px"}});let y;function k(){if(u.value==null||c.value==null)return;const C=i.value;gy(u.value,c.value,{middleware:o.value,placement:s.value,strategy:a.value}).then(M=>{d.value=M.x,h.value=M.y,p.value=M.strategy,f.value=M.placement,m.value=M.middlewareData,g.value=C!==!1})}function v(){typeof y=="function"&&(y(),y=void 0)}function w(){if(v(),r===void 0){k();return}if(u.value!=null&&c.value!=null){y=r(u.value,c.value,k);return}}function x(){i.value||(g.value=!1)}return xe([o,s,a,i],k,{flush:"sync"}),xe([u,c],w,{flush:"sync"}),xe(i,x,{flush:"sync"}),Xg()&&Zg(v),{x:Ei(d),y:Ei(h),strategy:Ei(p),placement:Ei(f),middlewareData:Ei(m),isPositioned:Ei(g),floatingStyles:b,update:k}}const rS=["innerHTML"],iS=Q({__name:"ColumnLabel",props:{label:{},tooltip:{}},setup(t){const e=t,n=H(!1),r=H(!1),i=H(!1),o=H(null),s=H(null),a=H(null),{floatingStyles:l,middlewareData:u,placement:c,update:d}=nS(o,s,{placement:"top",middleware:[fy(8),my(),YC({padding:8}),tS({element:a})]}),h=I(()=>{const{x:b,y}=u.value.arrow||{},k={left:b!=null?`${b}px`:"",top:y!=null?`${y}px`:""},v=c.value||"top";return v.startsWith("top")&&(k.bottom="-6px"),v.startsWith("bottom")&&(k.top="-6px"),v.startsWith("left")&&(k.right="-6px"),v.startsWith("right")&&(k.left="-6px"),k});lp(()=>{n.value=i.value||r.value,n.value&&d()});const p=()=>{i.value=!0,r.value=!1},f=()=>{i.value=!1,r.value=!1},m=b=>{r.value=!r.value,b.stopPropagation()},g=()=>{r.value=!1};return Tn(()=>{document.addEventListener("click",g)}),pi(()=>{document.removeEventListener("click",g)}),(b,y)=>(E(),O(Oe,null,[U("span",{ref_key:"labelEl",ref:o,onClick:m,onMouseenter:p,onMouseleave:f,innerHTML:e.label},null,40,rS),n.value&&e.tooltip?(E(),O("div",{key:0,class:"k-datatable-label__tooltip",ref_key:"tooltipEl",ref:s,style:kn(B(l))},[Be(oe(e.tooltip)+" ",1),U("div",{ref_key:"arrowEl",ref:a,style:kn(h.value),class:"k-datatable-label__tooltip-arrow"},null,4)],4)):P("",!0)],64))}}),oS={key:0,class:"k-datatable__row"},sS={key:0,class:"k-datatable__cell k-datatable__cell-select"},aS=["data-col-id","onClick"],lS={key:1,class:"k-datatable__cell k-datatable__cell-actions"},uS={key:0,class:"k-datatable__cell k-datatable__cell-select"},cS={key:1,class:"k-datatable__cell k-datatable__cell-actions"},dS={key:0,class:"k-datatable__footer"},EL=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=pp(),i=e,o=H([-1]),s=I(()=>n.items.filter(f=>!n.isDisabled(f))),a=I(()=>!!n.selected),l=I(()=>!!(Object.keys(n.sortBy||{}).length&&n.sortableBy.length)),u=I(()=>!!r.rowActions),c=I({get:()=>!!(s.value.length&&s.value.every(f=>n.selected&&n.selected.includes(f))),set:f=>i("update:selected",f?[...s.value]:[])}),d=I(()=>[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,b=[];if(f.shiftKey){let y=g>m,k=g+(y?-1:1);for(;y?k>m:k<m;){let v=n.items[k];!(n.selected||[]).includes(v)&&!n.isDisabled(v)&&b.push(v),y?k--:k++}}f.target.checked?o.value.push(m):g===m&&o.value.pop(),i("update:selected",[...n.selected||[],...b])}return(f,m)=>(E(),O("div",{class:Se([`k-datatable k-datatable--${f.theme}`,{"k-datatable--sticky":!!f.sticky,"k-datatable--no-header":!f.header}]),style:kn(`--k-datatable-layout: ${d.value}; --k-datatable-sticky-top: ${typeof f.sticky=="string"?f.sticky:"0"}`)},[f.header?(E(),O("div",oS,[a.value?(E(),O("div",sS,[he(pf,{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"])])):P("",!0),(E(!0),O(Oe,null,Mt(f.columns.filter(({disabled:g})=>!g),g=>(E(),O("div",{class:Se(["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:b=>h(g.id)},[L(f.$slots,`${g.id}-label`,{item:g},()=>[he(iS,{label:g.label,tooltip:g.tooltip},null,8,["label","tooltip"])]),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,aS))),128)),u.value?(E(),O("div",lS)):P("",!0)])):P("",!0),(E(!0),O(Oe,null,Mt(f.items,(g,b)=>(E(),O("div",{class:"k-datatable__row",key:f.sortBy?g?.id||B(Qt)():b},[a.value?(E(),O("div",uS,[he(pf,{class:"k-datatable__checkbox","model-value":f.selected||[],"onUpdate:modelValue":m[1]||(m[1]=y=>i("update:selected",y)),value:g,onMousedown:m[2]||(m[2]=Wa(()=>{},["prevent"])),onClick:y=>p(y,b),disabled:f.isDisabled(g)},null,8,["model-value","value","onClick","disabled"])])):P("",!0),(E(),z(Qe(f.rowWrapper(g).component),re({class:"k-datatable__row-wrapper",ref_for:!0},f.rowWrapper(g).bind,Qg(f.rowWrapper(g).listeners)),{default:ee(()=>[(E(!0),O(Oe,null,Mt(f.columns.filter(({disabled:y})=>!y),(y,k)=>(E(),z(Qe(f.cellWrapper(g,y).component),re({ref_for:!0},f.cellWrapper(g,y).bind,{class:`k-datatable__cell k-datatable__cell--text-align-${y.align||"start"}`,key:`col-${y.id}`,"data-cell-id":y.id}),{default:ee(()=>[L(f.$slots,y.id,{item:g,column:y,rowIndex:b,colIndex:k})]),_:2},1040,["class","data-cell-id"]))),128))]),_:2},1040)),f.$slots["row-actions"]?(E(),O("div",cS,[L(f.$slots,"row-actions",{item:g})])):P("",!0)]))),128)),he(up,{name:"k-datatable-footer"},{default:ee(()=>{var g,b;return[f.$slots.footer||(g=f.selected)!=null&&g.length?(E(),O("div",dS,[(b=f.selected)!=null&&b.length?(E(),z(wu,{key:0,label:`${f.labels.selection} (${f.selected.length})`,teleport:!0},{default:ee(()=>[L(f.$slots,"select-actions"),he(He,{label:f.labels.resetSelection,"icon-right":"fa-pro-light:times-square",variant:"tertiary",onClick:m[3]||(m[3]=y=>i("update:selected",[]))},null,8,["label"])]),_:3},8,["label"])):P("",!0),L(f.$slots,"footer")])):P("",!0)]}),_:3})],6))}});var pS=$n("radio-group").parts("root","label","item","itemText","itemControl","indicator"),Si=pS.build(),nl=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`radio-group:${t.id}`},Tf=t=>{var e;return((e=t.ids)==null?void 0:e.label)??`radio-group:${t.id}:label`},yy=(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}`},pd=(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}`},hS=(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}`},fS=(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}`},by=t=>{var e;return((e=t.ids)==null?void 0:e.indicator)??`radio-group:${t.id}:indicator`},xu=t=>t.getById(nl(t)),mS=(t,e)=>t.getById(pd(t,e)),gS=t=>t.getById(by(t)),vS=t=>{var e;return(e=xu(t))==null?void 0:e.querySelector("input:not(:disabled)")},yS=t=>{var e;return(e=xu(t))==null?void 0:e.querySelector("input:not(:disabled):checked")},Of=t=>{const e=`input[type=radio][data-ownedby='${CSS.escape(nl(t))}']:not([disabled])`;return Op(xu(t),e)},bS=(t,e)=>{if(e)return t.getById(yy(t,e))},kS=t=>({left:t?.offsetLeft??0,top:t?.offsetTop??0,width:t?.offsetWidth??0,height:t?.offsetHeight??0}),wS=t=>({width:`${t.width}px`,height:`${t.height}px`,left:`${t.left}px`,top:`${t.top}px`});function xS(t,e){const{context:n,send:r,computed:i,prop:o,scope:s}=t,a=i("isDisabled"),l=o("readOnly");function u(h){const p=n.get("focusedValue")===h.value,f=p&&ds();return{value:h.value,invalid:!!h.invalid,disabled:!!h.disabled||a,checked:n.get("value")===h.value,focused:p,focusVisible:f,hovered:n.get("hoveredValue")===h.value,active:n.get("activeValue")===h.value}}function c(h){const p=u(h);return{"data-focus":J(p.focused),"data-focus-visible":J(p.focusVisible),"data-disabled":J(p.disabled),"data-readonly":J(l),"data-state":p.checked?"checked":"unchecked","data-hover":J(p.hovered),"data-invalid":J(p.invalid),"data-orientation":o("orientation"),"data-ssr":J(n.get("ssr"))}}const d=()=>{const h=yS(s)??vS(s);h?.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({...Si.root.attrs,role:"radiogroup",id:nl(s),"aria-labelledby":Tf(s),"data-orientation":o("orientation"),"data-disabled":J(a),"aria-orientation":o("orientation"),dir:o("dir"),style:{position:"relative"}})},getLabelProps(){return e.element({...Si.label.attrs,dir:o("dir"),"data-orientation":o("orientation"),"data-disabled":J(a),id:Tf(s),onClick:d})},getItemState:u,getItemProps(h){const p=u(h);return e.label({...Si.item.attrs,dir:o("dir"),id:yy(s,h.value),htmlFor:pd(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})},onClick(){var f;!p.disabled&&xp()&&((f=mS(s,h.value))==null||f.focus())}})},getItemTextProps(h){return e.element({...Si.itemText.attrs,dir:o("dir"),id:fS(s,h.value),...c(h)})},getItemControlProps(h){const p=u(h);return e.element({...Si.itemControl.attrs,dir:o("dir"),id:hS(s,h.value),"data-active":J(p.active),"aria-hidden":!0,...c(h)})},getItemHiddenInputProps(h){const p=u(h);return e.input({"data-ownedby":nl(s),id:pd(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})},onFocus(){r({type:"SET_FOCUSED",value:h.value,focused:!0})},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:Ap})},getIndicatorProps(){const h=n.get("indicatorRect");return e.element({id:by(s),...Si.indicator.attrs,dir:o("dir"),hidden:n.get("value")==null,"data-disabled":J(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:ES}=cu(),CS={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})),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:ES("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 lu(xu(e),{onFieldsetDisabledChange(n){t.set("fieldsetDisabled",n)},onFormReset(){t.set("value",t.initial("value"))}})},trackFocusVisible({scope:t}){var e;return Mp({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)},syncInputElements({context:t,scope:e}){Of(e).forEach(n=>{n.checked=n.value===t.get("value")})},setIndicatorTransition({context:t}){t.set("canIndicatorTransition",Iv(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(),!gS(e))return;const i=t.get("value"),o=bS(e,i);if(i==null||!o){t.set("canIndicatorTransition",!1),t.set("indicatorRect",{});return}const s=Tv([o],{measure(a){return kS(a)},onEntry({rects:a}){t.set("indicatorRect",wS(a[0]))}});n.set("indicatorCleanup",s)},dispatchChangeEvent({context:t,scope:e}){Of(e).forEach(n=>{const r=n.value===t.get("value");r!==n.checked&&Sp(n,{checked:r})})}}}};Kn()(["dir","disabled","form","getRootNode","id","ids","name","onValueChange","orientation","readOnly","value","defaultValue"]);Kn()(["value","disabled","invalid"]);const SS=["aria-describedby"],CL=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=dp(du,I(()=>({label:""}))),r=t,i=e,o=mi(CS,{id:Qt(),name:Qt(),...r,defaultValue:r.modelValue,onValueChange:({value:a})=>i("update:modelValue",a)}),s=I(()=>xS(o,fi));return xe(()=>r.modelValue,a=>s.value.setValue(a)),(a,l)=>(E(),O("div",re({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(re({key:0},s.value.getLabelProps())),oe(B(n).label||a.label),17)):P("",!0),a.variant==="segment"?(E(),O("div",be(re({key:1},s.value.getIndicatorProps())),null,16)):P("",!0),(E(!0),O(Oe,null,Mt(a.items,u=>(E(),O("label",re({ref_for:!0},s.value.getItemProps({value:u.id})),[U("span",re({ref_for:!0},s.value.getItemTextProps({value:u.id})),oe(u.label),17),U("input",re({ref_for:!0},s.value.getItemHiddenInputProps({value:u.id})),null,16),U("div",re({ref_for:!0},s.value.getItemControlProps({value:u.id})),null,16)],16))),256))],16,SS))}}),SL=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(`
1
+ import{E as Ma,r as z,q as Q,o as E,e as H,G as It,D as we,b as I,i as Tn,c as O,d as P,y as Ua,z as Yg,a as U,n as Se,g as L,x as kn,w as ee,j as he,v as B,B as Be,t as oe,m as re,f as et,H as qe,N as Xg,O as Gc,I as Ik,J as pp,K as hp,L as Zg,M as Qg,W as Nk,P as be,Q as Re,F as Oe,l as _t,C as hi,S as fp,U as _s,A as mp,V as ev,a6 as Rk,s as us,$ as xr,aj as Pk,u as gp,X as vp,Y as Fk,Z as tv,a2 as yp,a0 as bp,k as Ka,a3 as nv,ab as kp,R as _o,h as wp,ac as Lk,T as Bk,a1 as Vk,a7 as Ci}from"./_plugin-vue_export-helper.js";var $k=Object.defineProperty,jk=(t,e,n)=>e in t?$k(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Xt=(t,e,n)=>(jk(t,typeof e!="symbol"?e+"":e,n),n);function rv(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=rv(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function zk(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=rv(t))&&(r&&(r+=" "),r+=e);return r}const qh=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Wh=zk,rn=(t,e)=>n=>{var r;if(e?.variants==null)return Wh(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=qh(c)||qh(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 Wh(t,s,l,n?.class,n?.className)},iv=/^[a-z0-9]+(-[a-z0-9]+)*$/,iu=(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&&!_a(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&&!_a(a)?null:a}if(n&&r===""){const a={provider:r,prefix:"",name:o};return e&&!_a(a,n)?null:a}return null},_a=(t,e)=>t?!!((e&&t.prefix===""||t.prefix)&&t.name):!1,ov=Object.freeze({left:0,top:0,width:16,height:16}),Ga=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),ou=Object.freeze({...ov,...Ga}),Jc=Object.freeze({...ou,body:"",hidden:!1});function Hk(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 Uh(t,e){const n=Hk(t,e);for(const r in Jc)r in Ga?r in t&&!(r in n)&&(n[r]=Ga[r]):r in e?n[r]=e[r]:r in t&&(n[r]=t[r]);return n}function qk(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 Wk(t,e,n){const r=t.icons,i=t.aliases||Object.create(null);let o={};function s(a){o=Uh(r[a]||i[a],o)}return s(e),n.forEach(s),Uh(t,o)}function sv(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=qk(t);for(const i in r){const o=r[i];o&&(e(i,Wk(t,i,o)),n.push(i))}return n}const Uk={provider:"",aliases:{},not_found:{},...ov};function Gu(t,e){for(const n in e)if(n in t&&typeof t[n]!=typeof e[n])return!1;return!0}function av(t){if(typeof t!="object"||t===null)return null;const e=t;if(typeof e.prefix!="string"||!t.icons||typeof t.icons!="object"||!Gu(t,Uk))return null;const n=e.icons;for(const i in n){const o=n[i];if(!i||typeof o.body!="string"||!Gu(o,Jc))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]||!Gu(o,Jc))return null}return e}const Kh=Object.create(null);function Kk(t,e){return{provider:t,prefix:e,icons:Object.create(null),missing:new Set}}function Xi(t,e){const n=Kh[t]||(Kh[t]=Object.create(null));return n[e]||(n[e]=Kk(t,e))}function lv(t,e){return av(e)?sv(e,(n,r)=>{r?t.icons[n]=r:t.missing.add(n)}):[]}function Gk(t,e,n){try{if(typeof n.body=="string")return t.icons[e]={...n},!0}catch{}return!1}let cs=!1;function uv(t){return typeof t=="boolean"&&(cs=t),cs}function Jk(t){const e=typeof t=="string"?iu(t,!0,cs):t;if(e){const n=Xi(e.provider,e.prefix),r=e.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function Yk(t,e){const n=iu(t,!0,cs);if(!n)return!1;const r=Xi(n.provider,n.prefix);return e?Gk(r,n.name,e):(r.missing.add(n.name),!0)}function Xk(t,e){if(typeof t!="object")return!1;if(typeof e!="string"&&(e=t.provider||""),cs&&!e&&!t.prefix){let i=!1;return av(t)&&(t.prefix="",sv(t,(o,s)=>{Yk(o,s)&&(i=!0)})),i}const n=t.prefix;if(!_a({prefix:n,name:"a"}))return!1;const r=Xi(e,n);return!!lv(r,t)}const cv=Object.freeze({width:null,height:null}),dv=Object.freeze({...cv,...Ga}),Zk=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Qk=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Gh(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(Zk);if(r===null||!r.length)return t;const i=[];let o=r.shift(),s=Qk.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 ew(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 tw(t,e){return t?"<defs>"+t+"</defs>"+e:e}function nw(t,e,n){const r=ew(t);return tw(r.defs,e+r.content+n)}const rw=t=>t==="unset"||t==="undefined"||t==="none";function iw(t,e){const n={...ou,...t},r={...dv,...e},i={left:n.left,top:n.top,width:n.width,height:n.height};let o=n.body;[n,r].forEach(m=>{const g=[],b=m.hFlip,y=m.vFlip;let k=m.rotate;b?y?k+=2:(g.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),g.push("scale(-1 1)"),i.top=i.left=0):y&&(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=nw(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=Gh(d,l/u)):(c=s==="auto"?l:s,d=a===null?Gh(c,u/l):a==="auto"?u:a);const h={},p=(m,g)=>{rw(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 ow=/\sid="(\S+)"/g,sw="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let aw=0;function lw(t,e=sw){const n=[];let r;for(;r=ow.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+(aw++).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 Yc=Object.create(null);function uw(t,e){Yc[t]=e}function Xc(t){return Yc[t]||Yc[""]}function xp(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 Ep=Object.create(null),ia=["https://api.simplesvg.com","https://api.unisvg.com"],Zc=[];for(;ia.length>0;)ia.length===1||Math.random()>.5?Zc.push(ia.shift()):Zc.push(ia.pop());Ep[""]=xp({resources:["https://api.iconify.design"].concat(Zc)});function pv(t,e){const n=xp(e);return n===null?!1:(Ep[t]=n,!0)}function Cp(t){return Ep[t]}const cw=()=>{let t;try{if(t=fetch,typeof t=="function")return t}catch{}};let Jh=cw();function dw(t,e){const n=Cp(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 pw(t){return t===404}const hw=(t,e,n)=>{const r=[],i=dw(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 fw(t){if(typeof t=="string"){const e=Cp(t);if(e)return e.path}return"/"}const mw=(t,e,n)=>{if(!Jh){n("abort",424);return}let r=fw(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;Jh(t+r).then(o=>{const s=o.status;if(s!==200){setTimeout(()=>{n(pw(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)})},gw={prepare:hw,send:mw};function vw(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]=Xi(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 hv(t,e){t.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(i=>i.id!==e))})}function yw(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||hv([t],o.id),o.callback(s.loaded.slice(0),s.missing.slice(0),s.pending.slice(0),o.abort))})}))}let bw=0;function kw(t,e,n){const r=bw++,i=hv.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 ww(t,e=!0,n=!1){const r=[];return t.forEach(i=>{const o=typeof i=="string"?iu(i,e,n):i;o&&r.push(o)}),r}var xw={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Ew(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 C=Math.floor(Math.random()*x.length);s.push(x[C]),x=x.slice(0,C).concat(x.slice(C+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,C){C&&(p=[]),typeof x=="function"&&p.push(x)}function b(){return{startTime:a,payload:e,status:l,queriesSent:u,queriesPending:h.length,subscribe:g,abort:m}}function y(){l="failed",p.forEach(x=>{x(void 0,c)})}function k(){h.forEach(x=>{x.status==="pending"&&(x.status="aborted")}),h=[]}function v(x,C,M){const T=C!=="success";switch(h=h.filter(A=>A!==x),l){case"pending":break;case"failed":if(T||!t.dataAfterTimeout)return;break;default:return}if(C==="abort"){c=M,y();return}if(T){c=M,h.length||(s.length?w():y());return}if(f(),k(),!t.random){const A=t.resources.indexOf(x.resource);A!==-1&&A!==t.index&&(t.index=A)}l="completed",p.forEach(A=>{A(M)})}function w(){if(l!=="pending")return;f();const x=s.shift();if(x===void 0){if(h.length){d=setTimeout(()=>{f(),l==="pending"&&(k(),y())},t.timeout);return}y();return}const C={status:"pending",resource:x,callback:(M,T)=>{v(C,M,T)}};h.push(C),u++,d=setTimeout(w,t.rotate),n(x,e,C.callback)}return setTimeout(w),b}function fv(t){const e={...xw,...t};let n=[];function r(){n=n.filter(s=>s().status==="pending")}function i(s,a,l){const u=Ew(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 Yh(){}const Ju=Object.create(null);function Cw(t){if(!Ju[t]){const e=Cp(t);if(!e)return;const n=fv(e),r={config:e,redundancy:n};Ju[t]=r}return Ju[t]}function Sw(t,e,n){let r,i;if(typeof t=="string"){const o=Xc(t);if(!o)return n(void 0,424),Yh;i=o.send;const s=Cw(t);s&&(r=s.redundancy)}else{const o=xp(t);if(o){r=fv(o);const s=t.resources?t.resources[0]:"",a=Xc(s);a&&(i=a.send)}}return!r||!i?(n(void 0,424),Yh):r.query(e,i,n)().abort}function Xh(){}function Tw(t){t.iconsLoaderFlag||(t.iconsLoaderFlag=!0,setTimeout(()=>{t.iconsLoaderFlag=!1,yw(t)}))}function Ow(t){const e=[],n=[];return t.forEach(r=>{(r.match(iv)?e:n).push(r)}),{valid:e,invalid:n}}function Eo(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(!lv(t,n).length){r();return}}catch(i){console.error(i)}r(),Tw(t)}function Zh(t,e){t instanceof Promise?t.then(n=>{e(n)}).catch(()=>{e(null)}):e(t)}function Aw(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)){Zh(t.loadIcons(i,r,n),u=>{Eo(t,i,u)});return}if(o){i.forEach(u=>{const c=o(u,r,n);Zh(c,d=>{const h=d?{prefix:r,icons:{[u]:d}}:null;Eo(t,[u],h)})});return}const{valid:s,invalid:a}=Ow(i);if(a.length&&Eo(t,a,null),!s.length)return;const l=r.match(iv)?Xc(n):null;if(!l){Eo(t,s,null);return}l.prepare(n,r,s).forEach(u=>{Sw(n,u,c=>{Eo(t,u.icons,c)})})}))}const Mw=(t,e)=>{const n=ww(t,!0,uv()),r=vw(n);if(!r.pending.length){let l=!0;return e&&setTimeout(()=>{l&&e(r.loaded,r.missing,r.pending,Xh)}),()=>{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(Xi(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=Xi(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&&Aw(l,u)}),e?kw(e,r,o):Xh};function _w(t,e){const n={...t};for(const r in e){const i=e[r],o=typeof i;r in cv?(i===null||i&&(o==="string"||o==="number"))&&(n[r]=i):o===typeof n[r]&&(n[r]=r==="rotate"?i%4:i)}return n}const Dw=/[\s,]+/;function Iw(t,e){e.split(Dw).forEach(n=>{switch(n.trim()){case"horizontal":t.hFlip=!0;break;case"vertical":t.vFlip=!0;break}})}function Nw(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 Rw(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 Pw(t){return t.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Fw(t){return"data:image/svg+xml,"+Pw(t)}function Lw(t){return'url("'+Fw(t)+'")'}const Qh={...dv,inline:!1},Bw={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Vw={display:"inline-block"},Qc={backgroundColor:"currentColor"},mv={backgroundColor:"transparent"},ef={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},tf={webkitMask:Qc,mask:Qc,background:mv};for(const t in tf){const e=tf[t];for(const n in ef)e[t+n]=ef[n]}const Da={};["horizontal","vertical"].forEach(t=>{const e=t.slice(0,1)+"Flip";Da[t+"-flip"]=e,Da[t.slice(0,1)+"-flip"]=e,Da[t+"Flip"]=e});function nf(t){return t+(t.match(/^[-0-9.]+$/)?"px":"")}const rf=(t,e)=>{const n=_w(Qh,e),r={...Bw},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"&&Iw(n,g);break;case"color":o.color=g;break;case"rotate":typeof g=="string"?n[m]=Nw(g):typeof g=="number"&&(n[m]=g);break;case"ariaHidden":case"aria-hidden":g!==!0&&g!=="true"&&delete r["aria-hidden"];break;default:{const b=Da[m];b?(g===!0||g==="true"||g===1)&&(n[b]=!0):Qh[m]===void 0&&(r[m]=g)}}}const l=iw(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=lw(l.body,g?()=>g+"ID"+m++:"iconifyVue"),us("svg",r)}const{body:c,width:d,height:h}=t,p=i==="mask"||(i==="bg"?!1:c.indexOf("currentColor")!==-1),f=Rw(c,{...u,width:d+"",height:h+""});return r.style={...o,"--svg":Lw(f),width:nf(u.width),height:nf(u.height),...Vw,...p?Qc:mv,...a},us("span",r)};uv(!0);uw("",gw);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"||!Xk(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;pv(n,i)||console.error(r)}catch{console.error(r)}}}}const $w={...ou,body:""},Qe=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=iu(t,!1,!0))===null)return this.abortLoading(),null;let i=Jk(r);if(!i)return(!this._loadingIcon||this._loadingIcon.name!==t)&&(this.abortLoading(),this._name="",i!==null&&(this._loadingIcon={name:t,abort:Mw([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 rf($w,t);let n=t;return e.classes&&(n={...t,class:(typeof t.class=="string"?t.class+" ":"")+e.classes.join(" ")}),rf({...ou,...e.data},n)}});pv("",{resources:["https://icons.ui.kvass.no"]});function jw(t){return!t||typeof t!="object"?!1:typeof t.then=="function"&&typeof t.catch=="function"}const zw=["xxs","xs","sm","default","lg","xl","xxl","3xl","4xl"],Hw=(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}},Sp=(t,e="spacing")=>t.split(" ").map(n=>typeof n=="number"||typeof n=="string"&&n.match(/^\d+$/)?`${n}rem`:typeof n=="string"&&zw.includes(n)?Hw(e,n):n).join(" ");function qw(){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 gv=(t,e)=>Object.fromEntries(Object.entries(e).map(([n,r])=>[`--k-${t}-${n}`,r])),Ww=function(t){return Object.prototype.toString.call(t)==="[object Object]"};function Uw(t){return Array.isArray(t)}const vv=Q({__name:"Spinner",props:{size:{default:"medium"}},setup(t){return(e,n)=>(E(),O("span",{class:Se(`k-spinner k-spinner--size-${e.size}`)},null,2))}}),Kw={class:"k-button__content"},Gw={key:0,class:"k-button__icon k-button__icon--left"},Jw={key:1,class:"k-button__icon k-button__icon--right"},Yw={key:2,class:"k-button__confirm-label"},He=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=I(()=>!h.value||u.value==="loading"?n.variant:u.value=="confirm"?"warning":i[u.value]||n.variant),s=I(()=>n.loading||u.value==="loading"),a=z(),l=I(()=>{if(u.value)return["error","success"].includes(u.value)||s.value}),u=z("idle"),c=z(),d=z(),h=I(()=>u.value||s.value),p=I(()=>["error","success"].includes(u.value)),f=I(()=>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=C=>{g(),n.stateTimeout?(u.value=C,c.value=setTimeout(()=>{g(),r(C)},n.stateTimeout)):r(C)};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"}we(()=>n.promise,w=>{w&&jw(w)&&m(w)});const b=z(),y=I(()=>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(),H(et(w.is),re({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:b}),{default:ee(()=>[Ua(U("span",Kw,[w.icon||w.iconLeft||w.$slots.icon||w.$slots["icon-left"]?(E(),O("span",Gw,[L(w.$slots,"icon-left",{},()=>[L(w.$slots,"icon",{},()=>[he(B(Qe),{icon:w.icon||w.iconLeft},null,8,["icon"])])])])):P("",!0),L(w.$slots,"default",{},()=>[Be(oe(w.label),1)]),w.iconRight||w.$slots["icon-right"]?(E(),O("span",Jw,[L(w.$slots,"icon-right",{},()=>[he(B(Qe),{icon:w.iconRight},null,8,["icon"])])])):P("",!0)],512),[[Yg,!y.value]]),s.value?(E(),H(vv,{key:0})):P("",!0),p.value?(E(),H(B(Qe),{key:1,class:"k-button__state-indicator",icon:f.value},null,8,["icon"])):P("",!0),y.value?(E(),O("span",Yw,oe(w.confirmLabel),1)):P("",!0)]),_:3},16,["class","aria-busy","inert"]))}}),Xw={class:"k-alert__content"},Zw={key:0,class:"k-alert__title"},Qw={class:"k-alert__icon"},DL=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:Se(B(i)({...n}))},[U("div",Xw,[s.title||s.$slots.title?(E(),O("div",Zw,[L(s.$slots,"title",{},()=>[U("strong",null,oe(s.title),1)])])):P("",!0),L(s.$slots,"default",{},()=>[U("span",null,oe(s.content),1)]),s.action?(E(),H(He,{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"])):P("",!0)]),U("div",Qw,[L(s.$slots,"icon",{},()=>[s.icon||o[s.variant]?(E(),H(B(Qe),{key:0,icon:s.icon||o[s.variant]},null,8,["icon"])):P("",!0)])])],2))}}),ex={class:"k-badge__label"},IL=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=z(!1);function a(){s.value=!0,r("dismiss",n)}return(l,u)=>s.value?P("",!0):(E(),O("span",{key:0,class:Se(B(o)({appearance:l.appearance,variant:l.variant,rounded:l.rounded}))},[L(l.$slots,"icon",{},()=>[l.icon||i[l.appearance]?(E(),H(B(Qe),{key:0,icon:l.icon||i[l.appearance],class:"k-badge__icon"},null,8,["icon"])):P("",!0)]),L(l.$slots,"default",{},()=>[U("span",ex,oe(l.label),1)]),l.dismissable?(E(),O("button",{key:0,class:"k-badge__dismiss",onClick:a},[he(B(Qe),{icon:"fa-pro-light:times"})])):P("",!0)],2))}});var $n=(t,e=[])=>({parts:(...n)=>{if(tx(e))return $n(t,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>$n(t,[...e,...n]),rename:n=>$n(n,e),keys:()=>e,build:()=>[...new Set(e)].reduce((n,r)=>Object.assign(n,{[r]:{selector:[`&[data-scope="${Si(t)}"][data-part="${Si(r)}"]`,`& [data-scope="${Si(t)}"][data-part="${Si(r)}"]`].join(", "),attrs:{"data-scope":Si(t),"data-part":Si(r)}}}),{})}),Si=t=>t.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),tx=t=>t.length===0,of=t=>Math.max(0,Math.min(1,t)),Yu=(...t)=>e=>t.reduce((n,r)=>r(n),e),Vi=()=>{},su=t=>typeof t=="object"&&t!==null,J=t=>t?"":void 0,nx=t=>t?"true":void 0,rx=1,ix=9,ox=11,at=t=>su(t)&&t.nodeType===rx&&typeof t.nodeName=="string",Tp=t=>su(t)&&t.nodeType===ix,sx=t=>su(t)&&t===t.window,yv=t=>at(t)?t.localName||"":"#document";function ax(t){return["html","body","#document"].includes(yv(t))}var lx=t=>su(t)&&t.nodeType!==void 0,ds=t=>lx(t)&&t.nodeType===ox&&"host"in t,ux=t=>at(t)&&t.localName==="input",cx=t=>at(t)?t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0:!1,dx=/(textarea|select)/;function px(t){if(t==null||!at(t))return!1;try{return ux(t)&&t.selectionStart!=null||dx.test(t.localName)||t.isContentEditable||t.getAttribute("contenteditable")==="true"||t.getAttribute("contenteditable")===""}catch{return!1}}function Zi(t,e){var n;if(!t||!e||!at(t)||!at(e))return!1;const r=(n=e.getRootNode)==null?void 0:n.call(e);if(t===e||t.contains(e))return!0;if(r&&ds(r)){let i=e;for(;i;){if(t===i)return!0;i=i.parentNode||i.host}}return!1}function Kt(t){return Tp(t)?t:sx(t)?t.document:t?.ownerDocument??document}function hx(t){return Kt(t).documentElement}function ht(t){var e;return ds(t)?ht(t.host):Tp(t)?t.defaultView??window:at(t)?((e=t.ownerDocument)==null?void 0:e.defaultView)??window:window}function bv(t){let e=t.activeElement;for(;e!=null&&e.shadowRoot;){const n=e.shadowRoot.activeElement;if(n===e)break;e=n}return e}function fx(t){if(yv(t)==="html")return t;const e=t.assignedSlot||t.parentNode||ds(t)&&t.host||hx(t);return ds(e)?e.host:e}var Xu=new WeakMap;function mx(t){return Xu.has(t)||Xu.set(t,ht(t).getComputedStyle(t)),Xu.get(t)}var au=()=>typeof document<"u";function gx(){const t=navigator.userAgentData;return t?.platform??navigator.platform}function vx(){const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(({brand:e,version:n})=>`${e}/${n}`).join(" "):navigator.userAgent}var Op=t=>au()&&t.test(gx()),yx=t=>au()&&t.test(vx()),bx=t=>au()&&t.test(navigator.vendor),sf=()=>au()&&!!navigator.maxTouchPoints,kx=()=>Op(/^iPhone/i),wx=()=>Op(/^iPad/i)||uu()&&navigator.maxTouchPoints>1,lu=()=>kx()||wx(),xx=()=>uu()||lu(),uu=()=>Op(/^Mac/i),Ap=()=>xx()&&bx(/apple/i),Ex=()=>yx(/Android/i);function Cx(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 pt(t){const e=Cx(t);return e?.[0]??t.target}var Sx=t=>Zi(t.currentTarget,pt(t));function Tx(t){return t.mozInputSource===0&&t.isTrusted?!0:Ex()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}var Ox=t=>t.button===0,Ax=t=>t.button===2||uu()&&t.ctrlKey&&t.button===0,Mx=t=>t.ctrlKey||t.altKey||t.metaKey,_x=t=>"touches"in t&&t.touches.length>0,Dx={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},af={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};function kv(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 af&&(i=af[i]),i}var Ix=new Set(["PageUp","PageDown"]),Nx=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function Rx(t){return t.ctrlKey||t.metaKey?.1:Ix.has(t.key)||t.shiftKey&&Nx.has(t.key)?10:1}function Mp(t,e="client"){const n=_x(t)?t.touches[0]||t.changedTouches[0]:t;return{x:n[`${e}X`],y:n[`${e}Y`]}}var Ne=(t,e,n,r)=>{const i=typeof t=="function"?t():t;return i?.addEventListener(e,n,r),()=>{i?.removeEventListener(e,n,r)}};function wv(t,e){const{type:n="HTMLInputElement",property:r="value"}=e,i=ht(t)[n].prototype;return Object.getOwnPropertyDescriptor(i,r)??{}}function Px(t){if(t.localName==="input")return"HTMLInputElement";if(t.localName==="textarea")return"HTMLTextAreaElement";if(t.localName==="select")return"HTMLSelectElement"}function xv(t,e,n="value"){var r;if(!t)return;const i=Px(t);i&&((r=wv(t,{type:i,property:n}).set)==null||r.call(t,e)),t.setAttribute(n,e)}function _p(t,e){var n;t&&((n=wv(t,{type:"HTMLInputElement",property:"checked"}).set)==null||n.call(t,e),e?t.setAttribute("checked",""):t.removeAttribute("checked"))}function Fx(t,e){const{value:n,bubbles:r=!0}=e;if(!t)return;const i=ht(t);t instanceof i.HTMLInputElement&&(xv(t,`${n}`),t.dispatchEvent(new i.Event("input",{bubbles:r})))}function Dp(t,e){const{checked:n,bubbles:r=!0}=e;if(!t)return;const i=ht(t);t instanceof i.HTMLInputElement&&(_p(t,n),t.dispatchEvent(new i.Event("click",{bubbles:r})))}function Lx(t){return Bx(t)?t.form:t.closest("form")}function Bx(t){return t.matches("textarea, input, select, button")}function Vx(t,e){if(!t)return;const n=Lx(t),r=i=>{i.defaultPrevented||e()};return n?.addEventListener("reset",r,{passive:!0}),()=>n?.removeEventListener("reset",r)}function $x(t,e){const n=t?.closest("fieldset");if(!n)return;e(n.disabled);const r=ht(n),i=new r.MutationObserver(()=>e(n.disabled));return i.observe(n,{attributes:!0,attributeFilter:["disabled"]}),()=>i.disconnect()}function cu(t,e){if(!t)return;const{onFieldsetDisabledChange:n,onFormReset:r}=e,i=[Vx(t,r),$x(t,n)];return()=>i.forEach(o=>o?.())}var Ev=t=>at(t)&&t.tagName==="IFRAME",jx=t=>!Number.isNaN(parseInt(t.getAttribute("tabindex")||"0",10)),zx=t=>parseInt(t.getAttribute("tabindex")||"0",10)<0,Ip="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",Cv=(t,e=!1)=>{if(!t)return[];const n=Array.from(t.querySelectorAll(Ip));(e==!0||e=="if-empty"&&n.length===0)&&at(t)&&hr(t)&&n.unshift(t);const r=n.filter(hr);return r.forEach((i,o)=>{if(Ev(i)&&i.contentDocument){const s=i.contentDocument.body;r.splice(o,1,...Cv(s))}}),r};function hr(t){return!t||t.closest("[inert]")?!1:t.matches(Ip)&&cx(t)}function Sv(t,e){if(!t)return[];const n=Array.from(t.querySelectorAll(Ip)),r=n.filter(Br);return r.forEach((i,o)=>{if(Ev(i)&&i.contentDocument){const s=i.contentDocument.body,a=Sv(s);r.splice(o,1,...a)}}),!r.length&&e?n:r}function Br(t){return t!=null&&t.tabIndex>0?!0:hr(t)&&!zx(t)}function Co(t){return t.tabIndex<0&&(/^(audio|video|details)$/.test(t.localName)||px(t))&&!jx(t)?0:t.tabIndex}function Hx(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 ed(t){const e=fx(t);return ax(e)?Kt(e).body:at(e)&&Wx(e)?e:ed(e)}var qx=/auto|scroll|overlay|hidden|clip/;function Wx(t){const e=ht(t),{overflow:n,overflowX:r,overflowY:i,display:o}=e.getComputedStyle(t);return qx.test(n+i+r)&&!["inline","contents"].includes(o)}function Ux(t,e){const{left:n,top:r,width:i,height:o}=e.getBoundingClientRect(),s={x:t.x-n,y:t.y-r},a={x:of(s.x/i),y:of(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 $i="default",td="",Ia=new WeakMap;function Kx(t={}){const{target:e,doc:n}=t,r=n??document,i=r.documentElement;return lu()?($i==="default"&&(td=i.style.webkitUserSelect,i.style.webkitUserSelect="none"),$i="disabled"):e&&(Ia.set(e,e.style.userSelect),e.style.userSelect="none"),()=>Gx({target:e,doc:r})}function Gx(t={}){const{target:e,doc:n}=t,r=(n??document).documentElement;if(lu()){if($i!=="disabled")return;$i="restoring",setTimeout(()=>{Hx(()=>{$i==="restoring"&&(r.style.webkitUserSelect==="none"&&(r.style.webkitUserSelect=td||""),td="",$i="default")})},300)}else if(e&&Ia.has(e)){const i=Ia.get(e);e.style.userSelect==="none"&&(e.style.userSelect=i??""),e.getAttribute("style")===""&&e.removeAttribute("style"),Ia.delete(e)}}function Jx(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(Kx({...r,target:s}))})),()=>{o.forEach(s=>s?.())}}function Yx(t,e){const{onPointerMove:n,onPointerUp:r}=e,i=[Ne(t,"pointermove",o=>{const s=Mp(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),Ne(t,"pointerup",r,!1),Ne(t,"pointercancel",r,!1),Ne(t,"contextmenu",r,!1),Jx({doc:t})];return()=>{i.forEach(o=>o())}}function Tv(t){const{pointerNode:e,keyboardNode:n=e,onPress:r,onPressStart:i,onPressEnd:o,isValidKey:s=y=>y.key==="Enter"}=t;if(!e)return Vi;const a=ht(e),l=Kt(e);let u=Vi,c=Vi,d=Vi;const h=y=>({point:Mp(y),event:y});function p(y){i?.(h(y))}function f(y){o?.(h(y))}const m=Ne(e,"pointerdown",y=>{c();const k=Ne(a,"pointerup",w=>{const x=pt(w);Zi(e,x)?r?.(h(w)):o?.(h(w))},{passive:!r,once:!0}),v=Ne(a,"pointercancel",f,{passive:!o,once:!0});c=Yu(k,v),l.activeElement===n&&y.pointerType==="mouse"&&y.preventDefault(),p(y)},{passive:!i}),g=Ne(n,"focus",b);u=Yu(m,g);function b(){const y=x=>{if(!s(x))return;const C=T=>{if(!s(T))return;const A=new a.PointerEvent("pointerup"),_=h(A);r?.(_),o?.(_)};c(),c=Ne(n,"keyup",C);const M=new a.PointerEvent("pointerdown");p(M)},k=()=>{const x=new a.PointerEvent("pointercancel");f(x)},v=Ne(n,"keydown",y),w=Ne(n,"blur",k);d=Yu(v,w)}return()=>{u(),c(),d()}}function Np(t,e){return Array.from(t?.querySelectorAll(e)??[])}var Ov=t=>t.id;function Xx(t,e,n=Ov){return t.find(r=>n(r)===e)}function Av(t,e,n=Ov){const r=Xx(t,e,n);return r?t.indexOf(r):-1}function Zx(t,e,n=!0){let r=Av(t,e);return r=n?(r+1)%t.length:Math.min(r+1,t.length-1),t[r]}function Qx(t,e,n=!0){let r=Av(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])}function Mv(t,e){const{onEntry:n,measure:r,box:i="border-box"}=e,o=(Array.isArray(t)?t:[t]).filter(at),s=ht(o[0]),a=u=>{const c=o.map(d=>r(d));n({rects:c,entries:u})};a([]);const l=new s.ResizeObserver(a);return o.forEach(u=>l.observe(u,{box:i})),()=>l.disconnect()}function nd(t,e){if(!t)return Vi;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),t.style.length===0&&t.removeAttribute("style")}}function e1(t,e,n){if(!t)return Vi;const r=t.style.getPropertyValue(e);return t.style.setProperty(e,n),()=>{t.style.setProperty(e,r),t.style.length===0&&t.removeAttribute("style")}}var Rp={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"},t1=1e3/60;function n1(t,e){const n=t();if(at(n)&&n.isConnected)return e(n),()=>{};{const r=setInterval(()=>{const i=t();at(i)&&i.isConnected&&(e(i),clearInterval(r))},t1);return()=>clearInterval(r)}}function r1(t,e){const n=[];return t?.forEach(r=>{const i=n1(r,e);n.push(i)}),()=>{n.forEach(r=>r())}}function i1(t){return!(t.metaKey||!uu()&&t.altKey||t.ctrlKey||t.key==="Control"||t.key==="Shift"||t.key==="Meta")}var o1=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function s1(t,e,n){const r=n?pt(n):null,i=ht(r);return t=t||r instanceof i.HTMLInputElement&&!o1.has(r?.type)||r instanceof i.HTMLTextAreaElement||r instanceof i.HTMLElement&&r.isContentEditable,!(t&&e==="keyboard"&&n instanceof i.KeyboardEvent&&!Reflect.has(a1,n.key))}var fi=null,rd=new Set,zo=new Map,ni=!1,id=!1,a1={Tab:!0,Escape:!0};function du(t,e){for(let n of rd)n(t,e)}function Ya(t){ni=!0,i1(t)&&(fi="keyboard",du("keyboard",t))}function $t(t){fi="pointer",(t.type==="mousedown"||t.type==="pointerdown")&&(ni=!0,du("pointer",t))}function _v(t){Tx(t)&&(ni=!0,fi="virtual")}function Dv(t){const e=pt(t);e===ht(e)||e===Kt(e)||(!ni&&!id&&(fi="virtual",du("virtual",t)),ni=!1,id=!1)}function Iv(){ni=!1,id=!0}function l1(t){if(typeof window>"u"||zo.get(ht(t)))return;const e=ht(t),n=Kt(t);let r=e.HTMLElement.prototype.focus;e.HTMLElement.prototype.focus=function(){fi="virtual",du("virtual",null),ni=!0,r.apply(this,arguments)},n.addEventListener("keydown",Ya,!0),n.addEventListener("keyup",Ya,!0),n.addEventListener("click",_v,!0),e.addEventListener("focus",Dv,!0),e.addEventListener("blur",Iv,!1),typeof e.PointerEvent<"u"?(n.addEventListener("pointerdown",$t,!0),n.addEventListener("pointermove",$t,!0),n.addEventListener("pointerup",$t,!0)):(n.addEventListener("mousedown",$t,!0),n.addEventListener("mousemove",$t,!0),n.addEventListener("mouseup",$t,!0)),e.addEventListener("beforeunload",()=>{u1(t)},{once:!0}),zo.set(e,{focus:r})}var u1=(t,e)=>{const n=ht(t),r=Kt(t);zo.has(n)&&(n.HTMLElement.prototype.focus=zo.get(n).focus,r.removeEventListener("keydown",Ya,!0),r.removeEventListener("keyup",Ya,!0),r.removeEventListener("click",_v,!0),n.removeEventListener("focus",Dv,!0),n.removeEventListener("blur",Iv,!1),typeof n.PointerEvent<"u"?(r.removeEventListener("pointerdown",$t,!0),r.removeEventListener("pointermove",$t,!0),r.removeEventListener("pointerup",$t,!0)):(r.removeEventListener("mousedown",$t,!0),r.removeEventListener("mousemove",$t,!0),r.removeEventListener("mouseup",$t,!0)),zo.delete(n))};function ps(){return fi==="keyboard"}function Pp(t={}){const{isTextInput:e,autoFocus:n,onChange:r,root:i}=t;l1(i),r?.({isFocusVisible:n||ps(),modality:fi});const o=(s,a)=>{s1(!!e,s,a)&&r?.({isFocusVisible:ps(),modality:s})};return rd.add(o),()=>{rd.delete(o)}}function c1(t){return t?Array.isArray(t)?t:[t]:[]}var Nv=t=>t[0],Rv=t=>t[t.length-1],d1=(t,e)=>t.indexOf(e)!==-1,p1=(t,...e)=>t.concat(e),h1=(t,...e)=>t.filter(n=>!e.includes(n)),f1=(t,e)=>d1(t,e)?h1(t,e):p1(t,e),lf=t=>t?.constructor.name==="Array",m1=(t,e)=>{if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Ds(t[n],e[n]))return!1;return!0},Ds=(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(lf(t)&&lf(e))return m1(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(!Ds(t[o],e[o]))return!1}return!0},g1=t=>Array.isArray(t),Pv=t=>typeof t=="string",ji=t=>typeof t=="function",v1=Function.prototype.toString;v1.call(Object);var uf=(...t)=>(...e)=>{t.forEach(function(n){n?.(...e)})},{floor:cf,abs:Xa,round:Fv,min:y1,max:b1,pow:k1,sign:w1}=Math,Do=t=>Number.isNaN(t),Fp=t=>Do(t)?0:t,x1=(t,e,n)=>t===0?n:e[t-1],E1=(t,e,n)=>t===e.length-1?n:e[t+1],C1=(t,e,n)=>Fv((Fp(t)-e)/n)*n+e,Is=(t,e,n)=>y1(b1(Fp(t),e),n),Lp=(t,e,n)=>(Fp(t)-e)/(n-e),Lv=(t,e,n,r)=>Is(C1(t*(n-e)+e,e,r),e,n),oa=(t,e)=>{let n=t,r=e.toString(),i=r.indexOf("."),o=i>=0?r.length-i:0;if(o>0){let s=k1(10,o);n=Fv(n*s)/s}return n},Bp=(t,e,n,r)=>{e=Number(e),n=Number(n);let i=(t-(Do(e)?0:e))%r,o=oa(Xa(i)*2>=r?t+w1(i)*(r-Xa(i)):t-i,r);return Do(e)?!Do(n)&&o>n&&(o=e+cf(oa((n-e)/r,r))*r):o<e?o=e:!Do(n)&&o>n&&(o=e+cf(oa((n-e)/r,r))*r),oa(o,r)},Io=(t,e,n)=>t[e]===n?t:[...t.slice(0,e),n,...t.slice(e+1)];function Bv(t,e){const n=x1(t,e.values,e.min),r=E1(t,e.values,e.max);let i=e.values.slice();return function(o){let s=Bp(o,n,r,e.step);return i=Io(i,t,o),i[t]=s,i}}function S1(t,e){const n=e.values[t]+e.step;return Bv(t,e)(n)}function T1(t,e){const n=e.values[t]-e.step;return Bv(t,e)(n)}var O1=(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 Xa(r-e)<Xa(i-e)?n-1:n},Vv=(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})),od=(t,e)=>{const[n,r]=t,[i,o]=e;return s=>n===r||i===o?i:i+(o-i)/(r-n)*(s-n)},df=t=>t!=null?`${t}px`:void 0;function $v(t){if(!A1(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]=$v(i))}return n}var A1=t=>t&&typeof t=="object"&&t.constructor===Object;function M1(t,e){const n={};for(const r of e){const i=t[r];i!==void 0&&(n[r]=i)}return n}function sd(...t){t.length===1?t[0]:t[1],t.length!==2||t[0]}function _1(t,e){if(t==null)throw new Error(e())}function D1(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 pu(){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)}}}var Ii=(t=>(t.NotStarted="Not Started",t.Started="Started",t.Stopped="Stopped",t))(Ii||{}),Zu="__init__";function I1(t){const e=()=>{var o;return((o=t.getRootNode)==null?void 0:o.call(t))??document},n=()=>Kt(e()),r=()=>n().defaultView??window,i=()=>bv(e());return{...t,getRootNode:e,getDoc:n,getWin:r,getActiveElement:i,isActiveElement:o=>o===i(),getById:o=>e().getElementById(o)}}function N1(t){return new Proxy({},{get(e,n){return n==="style"?r=>t({style:r}).style:t}})}var Kn=()=>t=>Array.from(new Set(t)),R1=$n("checkbox").parts("root","label","control","indicator"),sa=R1.build(),jv=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`checkbox:${t.id}`},pf=t=>{var e;return((e=t.ids)==null?void 0:e.label)??`checkbox:${t.id}:label`},P1=t=>{var e;return((e=t.ids)==null?void 0:e.control)??`checkbox:${t.id}:control`},ad=t=>{var e;return((e=t.ids)==null?void 0:e.hiddenInput)??`checkbox:${t.id}:input`},F1=t=>t.getById(jv(t)),No=t=>t.getById(ad(t));function L1(t,e){const{send:n,context:r,prop:i,computed:o,scope:s}=t,a=i("disabled"),l=i("readOnly"),u=i("invalid"),c=!a&&r.get("focused"),d=!a&&r.get("focusVisible"),h=o("checked"),p=o("indeterminate"),f={"data-active":J(r.get("active")),"data-focus":J(c),"data-focus-visible":J(d),"data-readonly":J(l),"data-hover":J(r.get("hovered")),"data-disabled":J(a),"data-state":p?"indeterminate":h?"checked":"unchecked","data-invalid":J(u)};return{checked:h,disabled:a,indeterminate:p,focused:c,checkedState:h,setChecked(m){n({type:"CHECKED.SET",checked:m,isTrusted:!1})},toggleChecked(){n({type:"CHECKED.TOGGLE",checked:h,isTrusted:!1})},getRootProps(){return e.label({...sa.root.attrs,...f,dir:i("dir"),id:jv(s),htmlFor:ad(s),onPointerMove(){a||n({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){a||n({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(m){pt(m)===No(s)&&m.stopPropagation()}})},getLabelProps(){return e.element({...sa.label.attrs,...f,dir:i("dir"),id:pf(s)})},getControlProps(){return e.element({...sa.control.attrs,...f,dir:i("dir"),id:P1(s),"aria-hidden":!0})},getIndicatorProps(){return e.element({...sa.indicator.attrs,...f,dir:i("dir"),hidden:!p&&!h})},getHiddenInputProps(){return e.input({id:ad(s),type:"checkbox",required:i("required"),defaultChecked:h,disabled:a,"aria-labelledby":pf(s),"aria-invalid":u,name:i("name"),form:i("form"),value:i("value"),style:Rp,onFocus(){const m=ps();n({type:"CONTEXT.SET",context:{focused:!0,focusVisible:m}})},onBlur(){n({type:"CONTEXT.SET",context:{focused:!1,focusVisible:!1}})},onClick(m){if(l){m.preventDefault();return}const g=m.currentTarget.checked;n({type:"CHECKED.SET",checked:g,isTrusted:!0})}})}}}var{not:hf}=pu(),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:hf("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:hf("isTrusted"),actions:["setChecked","dispatchChangeEvent"]},{actions:["setChecked"]}],"CONTEXT.SET":{actions:["setContext"]}},computed:{indeterminate:({context:t})=>Na(t.get("checked")),checked:({context:t})=>V1(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 Tv({pointerNode:F1(n),keyboardNode:No(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 Pp({root:(n=e.getRootNode)==null?void 0:n.call(e)})},trackFormControlState({context:t,scope:e}){return cu(No(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=No(n);r&&(_p(r,e("checked")),r.indeterminate=Na(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=Na(e("checked"))?!0:!e("checked");t.set("checked",n)},dispatchChangeEvent({computed:t,scope:e}){queueMicrotask(()=>{const n=No(e);Dp(n,{checked:t("checked")})})}}}};function Na(t){return t==="indeterminate"}function V1(t){return Na(t)?!1:!!t}Kn()(["defaultChecked","checked","dir","disabled","form","getRootNode","id","ids","invalid","name","onCheckedChange","readOnly","required","value"]);function $1(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()}var ff={htmlFor:"for",className:"class",onDoubleClick:"onDblclick",onChange:"onInput",onFocus:"onFocusin",onBlur:"onFocusout",defaultValue:"value",defaultChecked:"checked"},j1="viewBox,className,preserveAspectRatio,fillRule,clipPath,clipRule,strokeWidth,strokeLinecap,strokeLinejoin,strokeDasharray,strokeDashoffset,strokeMiterlimit".split(",");function z1(t){return t in ff?ff[t]:t.startsWith("on")?`on${$1(t.substr(2))}`:j1.includes(t)?t:t.toLowerCase()}var mi=N1(t=>{const e={};for(const n in t){const r=t[n];n==="children"?typeof r=="string"&&(e.innerHTML=r):e[z1(n)]=t[n]}return e});function Za(t){const e=t().defaultValue??t().value,n=t().isEqual??Object.is,r=It(e),i=I(()=>t().value!==void 0),o=It(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=ji(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)}}}Za.cleanup=t=>{tv(()=>t())};Za.ref=t=>{let e=t;return{get:()=>e,set:n=>{e=n}}};function H1(t){const e=z(t);return{get(n){return e.value[n]},set(n,r){e.value[n]=r}}}var q1=(t,e)=>{we(()=>[...t.map(n=>n())],(n,r)=>{let i=!1;for(let o=0;o<n.length;o++)if(!Ds(r[o],qe(n[o]))){i=!0;break}i&&e()})};function gi(t,e={}){var n,r,i;const o=I(()=>{const{id:_,ids:N,getRootNode:$}=qe(e);return I1({id:_,ids:N,getRootNode:$})}),s=(..._)=>{t.debug&&console.log(..._)},a=I(()=>{var _;return((_=t.props)==null?void 0:_.call(t,{props:$v(qe(e)),get scope(){return o.value}}))??qe(e)}),l=W1(a),u=(n=t.context)==null?void 0:n.call(t,{prop:l,bindable:Za,get scope(){return o.value},flush:mf,getContext(){return c},getComputed(){return C},getRefs(){return b}}),c={get(_){var N;return(N=u[_])==null?void 0:N.get()},set(_,N){var $;($=u[_])==null||$.set(N)},initial(_){var N;return(N=u[_])==null?void 0:N.initial},hash(_){var N,$;const j=(N=u[_])==null?void 0:N.get();return($=u[_])==null?void 0:$.hash(j)}};let d=new Map,h=null,p={current:null},f={current:{type:""}};const m=()=>({...f.current,current(){return f.current},previous(){return p.current}}),g=()=>({...M,matches(..._){const N=M.get();return _.includes(N)},hasTag(_){var N,$;const j=M.get();return!!(($=(N=t.states[j])==null?void 0:N.tags)!=null&&$.includes(_))}}),b=H1(((r=t.refs)==null?void 0:r.call(t,{prop:l,context:c}))??{}),y=()=>({state:g(),context:c,event:m(),prop:l,send:A,action:k,guard:v,track:q1,refs:b,computed:C,flush:mf,get scope(){return o.value},choose:x}),k=_=>{const N=ji(_)?_(y()):_;if(!N)return;const $=N.map(j=>{var q,K;const X=(K=(q=t.implementations)==null?void 0:q.actions)==null?void 0:K[j];return X||sd(`[zag-js] No implementation found for action "${JSON.stringify(j)}"`),X});for(const j of $)j?.(y())},v=_=>{var N,$;return ji(_)?_(y()):($=(N=t.implementations)==null?void 0:N.guards)==null?void 0:$[_](y())},w=_=>{const N=ji(_)?_(y()):_;if(!N)return;const $=N.map(q=>{var K,X;const fe=(X=(K=t.implementations)==null?void 0:K.effects)==null?void 0:X[q];return fe||sd(`[zag-js] No implementation found for effect "${JSON.stringify(q)}"`),fe}),j=[];for(const q of $){const K=q?.(y());K&&j.push(K)}return()=>j.forEach(q=>q?.())},x=_=>c1(_).find(N=>{let $=!N.guard;return Pv(N.guard)?$=!!v(N.guard):ji(N.guard)&&($=N.guard(y())),$}),C=_=>{_1(t.computed,()=>"[zag-js] No computed object found on machine");const N=t.computed[_];return N({context:c,event:m(),prop:l,refs:b,get scope(){return o.value},computed:C})},M=Za(()=>({defaultValue:t.initialState({prop:l}),onChange(_,N){var $,j,q;if(N){const X=d.get(N);X?.(),d.delete(N)}N&&k(($=t.states[N])==null?void 0:$.exit),k(h?.actions);const K=w((j=t.states[_])==null?void 0:j.effects);if(K&&d.set(_,K),N===Zu){k(t.entry);const X=w(t.effects);X&&d.set(Zu,X)}k((q=t.states[_])==null?void 0:q.entry)}}));let T=Ii.NotStarted;Tn(()=>{const _=T===Ii.Started;T=Ii.Started,s(_?"rehydrating...":"initializing..."),M.invoke(M.initial,Zu)}),hi(()=>{T=Ii.Stopped,s("unmounting...");const _=d.values();for(const N of _)N?.();d=new Map,k(t.exit)});const A=_=>{var N,$;if(T!==Ii.Started)return;p.current=f.current,f.current=_,s("send",_);let j=M.get();const q=((N=t.states[j].on)==null?void 0:N[_.type])??(($=t.on)==null?void 0:$[_.type]),K=x(q);if(!K)return;h=K;const X=K.target??j;s("transition",K);const fe=X!==j;fe?M.set(X):K.reenter&&!fe?M.invoke(j,j):k(K.actions)};return(i=t.watch)==null||i.call(t,y()),{state:g(),send:A,context:c,prop:l,get scope(){return o.value},refs:b,computed:C,event:m(),getStatus:()=>T}}function W1(t){return function(e){return t.value[e]}}var mf=t=>{xr().then(()=>{t()})};function Qt(t={}){const{prefix:e}=t,n=qw();return e?`${e}-${n}`:n}const U1={key:0,class:"k-checkbox__help"},gf=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=>_o(c)===_o(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=>_o(d)!==_o(c)))}const s=gi(B1,{id:Qt(),defaultChecked:i(),onCheckedChange:({checked:l})=>{if(i()!==l)return o(l)},disabled:n.disabled,required:n.required}),a=I(()=>L1(s,mi));return we(()=>n.modelValue,()=>{const l=i();if(a.value.checked!==l)return a.value.setChecked(l)}),(l,u)=>(E(),O("label",re({class:"k-checkbox"},a.value.getRootProps()),[U("div",be(Re(a.value.getControlProps())),[a.value.checked?(E(),H(B(Qe),{key:0,icon:"fa-pro-solid:check"})):P("",!0)],16),l.label||l.$slots.help||l.$slots.default?(E(),O("span",be(re({key:0},a.value.getLabelProps())),[U("span",{class:Se(["k-checkbox__label",{"k-checkbox__label-required":l.required}])},[L(l.$slots,"default",{},()=>[Be(oe(l.label),1)])],2),l.$slots.help||l.help?(E(),O("span",U1,[L(l.$slots,"help",{},()=>[Be(oe(l.help),1)])])):P("",!0)],16)):P("",!0),U("input",be(Re(a.value.getHiddenInputProps())),null,16)],16))}}),hu=Symbol("form-control"),K1={class:"k-formcontrol"},G1=["for"],J1={key:1,class:"k-formcontrol__error"},Y1={key:2,class:"k-formcontrol__help"},X1=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=I(()=>`${i}_label`),s=I(()=>`${i}_help`),a={onBlur:()=>r("blur"),onFocus:()=>r("focus")};return Rk(hu,I(()=>({...n,id:i,labelId:o.value,helpId:s.value,invalid:!!n.error,required:n.required,events:a}))),(l,u)=>(E(),O("div",K1,[l.$slots.label||l.label?(E(),O("label",{key:0,class:Se(["k-formcontrol__label",{"k-formcontrol__label-required":l.required}]),for:B(i)},[L(l.$slots,"label",{},()=>[Be(oe(l.label),1)])],10,G1)):P("",!0),L(l.$slots,"default",{id:B(i)}),l.$slots.error||l.error?(E(),O("span",J1,[L(l.$slots,"error",{},()=>[Be(oe(l.error),1)])])):P("",!0),l.$slots.help||l.help?(E(),O("span",Y1,[L(l.$slots,"help",{},()=>[Be(oe(l.help),1)])])):P("",!0)]))}}),Z1={class:"k-filter-type-dropdown"},Q1=Q({__name:"Dropdown",props:Gc({label:{},items:{}},{modelValue:{default:""},modelModifiers:{}}),emits:Gc(["disable"],["update:modelValue"]),setup(t,{emit:e}){const n=t,r=Xg(t,"modelValue"),i=I(()=>{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=I(()=>n.items.map(a=>({...a,action:()=>s.value=a.value}))),s=I({get(){return r.value},set(a){r.value=a}});return(a,l)=>(E(),O("div",Z1,[he(B(X1),{label:a.label},{default:ee(()=>[he(B(Eu),{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"])]))}}),eE=Object.freeze(Object.defineProperty({__proto__:null,default:Q1},Symbol.toStringTag,{value:"Module"}));function tE(t,e){let n,r,i;const o=It(!0),s=()=>{o.value=!0,i()};we(t,s,{flush:"sync"});const a=typeof e=="function"?e:e.get,l=typeof e=="function"?void 0:e.set,u=hp((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 Ns(t){return Zg()?(Qg(t),!0):!1}const Rs=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const nE=t=>t!=null,rE=Object.prototype.toString,zv=t=>rE.call(t)==="[object Object]",iE=()=>{},vf=oE();function oE(){var t,e;return Rs&&((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 sE(...t){if(t.length!==1)return Ik(...t);const e=t[0];return typeof e=="function"?pp(hp(()=>({get:e,set:iE}))):z(e)}function aE(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 Kr(t){return Array.isArray(t)?t:[t]}function lE(t,e,n={}){const{immediate:r=!0,immediateCallback:i=!1}=n,o=It(!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)},qe(e))}return r&&(o.value=!0,Rs&&u()),Ns(l),{isPending:pp(o),start:u,stop:l}}function Hv(t,e,n){return we(t,e,{...n,immediate:!0})}const qv=Rs?window:void 0,Wv=Rs?window.navigator:void 0;function Uv(t){var e;const n=qe(t);return(e=n?.$el)!=null?e:n}function Vp(...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=I(()=>{const a=Kr(qe(t[0])).filter(l=>l!=null);return a.every(l=>typeof l!="string")?a:void 0}),o=Hv(()=>{var a,l;return[(l=(a=i.value)==null?void 0:a.map(u=>Uv(u)))!=null?l:[qv].filter(u=>u!=null),Kr(qe(i.value?t[1]:t[0])),Kr(B(i.value?t[2]:t[1])),qe(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=zv(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 Ns(n),s}function uE(){const t=It(!1),e=bp();return e&&Tn(()=>{t.value=!0},e),t}function $p(t){const e=uE();return I(()=>(e.value,!!t()))}function cE(t,e,n={}){const{window:r=qv,...i}=n;let o;const s=$p(()=>r&&"MutationObserver"in r),a=()=>{o&&(o.disconnect(),o=void 0)},l=I(()=>{const h=qe(t),p=Kr(h).map(Uv).filter(nE);return new Set(p)}),u=we(()=>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 Ns(d),{isSupported:s,stop:d,takeRecords:c}}function yf(t,e={}){const{controls:n=!1,navigator:r=Wv}=e,i=$p(()=>r&&"permissions"in r),o=It(),s=typeof t=="string"?{name:t}:t,a=It(),l=()=>{var c,d;a.value=(d=(c=o.value)==null?void 0:c.state)!=null?d:"prompt"};Vp(o,"change",l,{passive:!0});const u=aE(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 _o(o.value)}});return u(),n?{state:a,isSupported:i,query:u}:a}function dE(t={}){const{navigator:e=Wv,read:n=!1,source:r,copiedDuring:i=1500,legacy:o=!1}=t,s=$p(()=>e&&"clipboard"in e),a=yf("clipboard-read"),l=yf("clipboard-write"),u=I(()=>s.value||o),c=It(""),d=It(!1),h=lE(()=>d.value=!1,i,{immediate:!1});async function p(){let y=!(s.value&&b(a.value));if(!y)try{c.value=await e.clipboard.readText()}catch{y=!0}y&&(c.value=g())}u.value&&n&&Vp(["copy","cut"],p,{passive:!0});async function f(y=qe(r)){if(u.value&&y!=null){let k=!(s.value&&b(l.value));if(!k)try{await e.clipboard.writeText(y)}catch{k=!0}k&&m(y),c.value=y,d.value=!0,h.start()}}function m(y){const k=document.createElement("textarea");k.value=y??"",k.style.position="absolute",k.style.opacity="0",document.body.appendChild(k),k.select(),document.execCommand("copy"),k.remove()}function g(){var y,k,v;return(v=(k=(y=document?.getSelection)==null?void 0:y.call(document))==null?void 0:k.toString())!=null?v:""}function b(y){return y==="granted"||y==="prompt"}return{isSupported:u,text:c,copied:d,copy:f}}function fu(t){const e=bp(),n=tE(()=>null,()=>e.proxy.$el);return Nk(n.trigger),Tn(n.trigger),n}const pE={class:"k-filter-type-range"},hE={class:"k-filter-type-range__header"},fE={class:"k-filter-type-range__header-label"},mE={class:"k-filter-type-range__value"},gE={class:"k-filter-type-range__value-display"},vE=Q({__name:"RangeSlider",props:Gc({min:{},max:{},label:{},suffix:{},step:{},type:{}},{modelValue:{default:[0,1e3]},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const e=Xg(t,"modelValue"),n=fu();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",pE,[U("div",hE,[U("label",fE,[U("span",null,oe(s.label),1),he(B(Qe),{icon:s.$attrs.icon},null,8,["icon"])]),L(s.$slots,"remove")]),U("div",mE,[he(B(TC),re({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"]),U("div",gE,[U("span",null,oe(o(e.value[0])),1),U("span",null,oe(o(e.value[1])),1)])])]))}}),yE=Object.freeze(Object.defineProperty({__proto__:null,default:vE},Symbol.toStringTag,{value:"Module"})),bf=Object.assign({"./Dropdown.vue":eE,"./RangeSlider.vue":yE});for(const t in bf)t.replace(/(\.\/|\.vue)/g,""),bf[t].default;function fr(t){return typeof t=="string"||t instanceof String}function kf(t){var e;return typeof t=="object"&&t!=null&&(t==null||(e=t.constructor)==null?void 0:e.name)==="Object"}function Kv(t,e){return Array.isArray(e)?Kv(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 Y={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function bE(t){switch(t){case Y.LEFT:return Y.FORCE_LEFT;case Y.RIGHT:return Y.FORCE_RIGHT;default:return t}}function Qu(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function Qa(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(!Qa(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(!Qa(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 kE{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?Y.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?Y.RIGHT:Y.LEFT}}function se(t,e){return new se.InputMask(t,e)}function Gv(t){if(t==null)throw new Error("mask property should be defined");return t instanceof RegExp?se.MaskedRegExp:fr(t)?se.MaskedPattern:t===Date?se.MaskedDate:t===Number?se.MaskedNumber:Array.isArray(t)||t===Array?se.MaskedDynamic:se.Masked&&t.prototype instanceof se.Masked?t:se.Masked&&t instanceof se.Masked?t.constructor:t instanceof Function?se.MaskedFunction:(console.warn("Mask not found for mask",t),se.Masked)}function hs(t){if(!t)throw new Error("Options in not defined");if(se.Masked){if(t.prototype instanceof se.Masked)return{mask:t};const{mask:e=void 0,...n}=t instanceof se.Masked?{mask:t}:kf(t)&&t.mask instanceof se.Masked?t:{};if(e){const r=e.mask;return{...Kv(e,(i,o)=>!o.startsWith("_")),mask:e.constructor,_mask:r,...n}}}return kf(t)?{...t}:{mask:t}}function Hn(t){if(se.Masked&&t instanceof se.Masked)return t;const e=hs(t),n=Gv(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)}se.createMask=Hn;class jp{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}}se.MaskElement=jp;const wf=90,wE=89;class mu extends jp{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===wf&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===wE&&e.ctrlKey))return e.preventDefault(),this._handlers.redo(e);if(this._handlers.undo&&e.keyCode===wf&&(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={}}}se.HTMLMaskElement=mu;class xE extends mu{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}}se.HTMLMaskElement=mu;class Jv extends mu{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}}se.HTMLContenteditableMaskElement=Jv;class gu{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>gu.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}}gu.MAX_LENGTH=100;class EE{constructor(e,n){this.el=e instanceof jp?e:e.isContentEditable&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"?new Jv(e):new xE(e),this.masked=Hn(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new gu,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 se.Masked)&&this.masked.constructor===Gv(e)){this.masked.updateOptions({mask:e});return}const n=e instanceof se.Masked?e:Hn({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,Y.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 kE({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:Y.NONE;let s=this.masked.nearestInputPos(n.startChangePos+i,o);o!==Y.NONE&&(s=this.masked.nearestInputPos(s,Y.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}}se.InputMask=EE;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}}se.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 ot{constructor(e){this._value="",this._update({...ot.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 fr(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(!fr(e))throw new Error("value should be string");const i=fr(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=Y.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=bE(i),u=this.extractInput(0,s,{raw:!0}));let c=e;const d=new de;if(i!==Y.NONE&&(c=this.nearestInputPos(e,n>1&&e!==0&&!l?Y.NONE:i),d.tailShift=c-e),d.aggregate(this.remove(c)),l&&i!==Y.NONE&&u===this.rawInputValue)if(i===Y.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===Y.FORCE_RIGHT&&a.unshift();return d.aggregate(this.append(r,o,a))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!Qa(this,e)}typedValueEquals(e){const n=this.typedValue;return e===n||ot.EMPTY_VALUES.includes(e)&&ot.EMPTY_VALUES.includes(n)||(this.format?this.format(e,this)===this.format(this.typedValue,this):!1)}pad(e){return new de}}ot.DEFAULTS={skipInvalid:!0};ot.EMPTY_VALUES=[void 0,null,""];se.Masked=ot;class Hr{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=fr(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 Hr){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 se.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 Hr||e._stops.indexOf(s)>=0)&&n.aggregate(e._appendPlaceholder(s)),a=i instanceof Hr&&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 Hr: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 CE{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,Y.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,Y.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,Y.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,Y.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,Y.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,Y.NONE),!0})}}class Yv{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=Y.NONE);const r=0,i=this._value.length;switch(n){case Y.LEFT:case Y.FORCE_LEFT:return r;case Y.NONE:case Y.RIGHT:case Y.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 fr(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 el{constructor(e){const{parent:n,isOptional:r,placeholderChar:i,displayChar:o,lazy:s,eager:a,...l}=e;this.masked=Hn(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=Y.NONE);const r=0,i=this.value.length,o=Math.min(Math.max(e,r),i);switch(n){case Y.LEFT:case Y.FORCE_LEFT:return this.isComplete?o:r;case Y.RIGHT:case Y.FORCE_RIGHT:return this.isComplete?o:i;case Y.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}}el.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 ot{updateOptions(e){super.updateOptions(e)}_update(e){const n=e.mask;n&&(e.validate=r=>r.search(n)>=0),super._update(e)}}se.MaskedRegExp=SE;class st extends ot{constructor(e){super({...st.DEFAULTS,...e,definitions:Object.assign({},el.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}=hs(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 se.RepeatBlock(m):Hn(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===st.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(s==="{"||s==="}"){r=!r;continue}if(s==="["||s==="]"){i=!i;continue}if(s===st.ESCAPE_CHAR){if(++o,s=n[o],!s)break;a=!1}const l=a?new el({isOptional:i,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...hs(e[s]),parent:this}):new Yv({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 Hr;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 Hr&&(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=Y.NONE),!this._blocks.length)return 0;const r=new CE(this,e);if(n===Y.NONE)return r.pushRightBeforeInput()||(r.popState(),r.pushLeftBeforeInput())?r.pos:this.displayValue.length;if(n===Y.LEFT||n===Y.FORCE_LEFT){if(n===Y.LEFT){if(r.pushRightBeforeFilled(),r.ok&&r.pos===e)return e;r.popState()}if(r.pushLeftBeforeInput(),r.pushLeftBeforeRequired(),r.pushLeftBeforeFilled(),n===Y.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===Y.FORCE_LEFT?0:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:0)}return n===Y.RIGHT||n===Y.FORCE_RIGHT?(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.pushRightBeforeFilled()?r.pos:n===Y.FORCE_RIGHT?this.displayValue.length:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:this.nearestInputPos(e,Y.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}}st.DEFAULTS={...ot.DEFAULTS,lazy:!0,placeholderChar:"_"};st.STOP_CHAR="`";st.ESCAPE_CHAR="\\";st.InputDefinition=el;st.FixedDefinition=Yv;se.MaskedPattern=st;class Ra extends st{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}}se.MaskedRange=Ra;const TE="d{.}`m{.}`Y";class Fn extends st{static extractPatternOptions(e){const{mask:n,pattern:r,...i}=e;return{...i,mask:fr(n)?n:r}}constructor(e){super(Fn.extractPatternOptions({...Fn.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:n,pattern:r,blocks:i,...o}={...Fn.DEFAULTS,...e},s=Object.assign({},Fn.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:fr(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(Fn.extractPatternOptions(e))}}Fn.GET_DEFAULT_BLOCKS=()=>({d:{mask:Ra,from:1,to:31,maxLength:2},m:{mask:Ra,from:1,to:12,maxLength:2},Y:{mask:Ra,from:1900,to:9999}});Fn.DEFAULTS={...st.DEFAULTS,mask:Date,pattern:TE,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)}};se.MaskedDate=Fn;class vu extends ot{constructor(e){super({...vu.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}=hs(n),o=Hn({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 Qa(n,o)&&n.maskEquals(i)}):super.maskEquals(e)}typedValueEquals(e){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(e))}}vu.DEFAULTS={...ot.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,Y.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,Y.FORCE_LEFT)))}});return o.sort((s,a)=>a.weight-s.weight||a.totalInputPositions-s.totalInputPositions),e.compiledMasks[o[0].index]}};se.MaskedDynamic=vu;class yu extends st{constructor(e){super({...yu.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,Y.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,Y.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}}yu.DEFAULTS={...st.DEFAULTS,matchValue:(t,e,n)=>t.indexOf(e,n)===n};se.MaskedEnum=yu;class OE extends ot{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}se.MaskedFunction=OE;var Xv;class St extends ot{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?"("+Qu(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+n+r),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(Qu).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(Qu(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 Y.NONE:case Y.LEFT:case Y.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===Y.FORCE_LEFT)return r}break}case Y.RIGHT:case Y.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==="")}}Xv=St;St.UNMASKED_RADIX=".";St.EMPTY_VALUES=[...ot.EMPTY_VALUES,0];St.DEFAULTS={...ot.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[Xv.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})};se.MaskedNumber=St;const ld={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function Zv(t,e,n){e===void 0&&(e=ld.MASKED),n===void 0&&(n=ld.MASKED);const r=Hn(t);return i=>r.runIsolated(o=>(o[e]=i,o[n]))}function AE(t,e,n,r){return Zv(e,n,r)(t)}se.PIPE_TYPE=ld;se.createPipe=Zv;se.pipe=AE;class ME extends st{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}=hs(e);this._blockOpts=Object.assign({},this._blockOpts,s);const a=Hn(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(Hn(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}}se.RepeatBlock=ME;try{globalThis.IMask=se}catch{}function _E(t,e){let{emit:n,onAccept:r,onComplete:i,defaultValue:o,defaultUnmaskedValue:s,defaultTypedValue:a}=e===void 0?{}:e;const l=Fk(t)?t:z(t),u=z(),c=z(),d=z(""),h=z(""),p=z();let f,m=d.value,g=h.value,b=p.value;function y(){b=p.value=c.value.typedValue,g=h.value=c.value.unmaskedValue,m=d.value=c.value.value}function k(A){y(),n&&(n("accept",d.value,A),n("accept:masked",d.value,A),n("accept:typed",p.value,A),n("accept:unmasked",h.value,A)),r?.(A)}function v(A){n&&(n("complete",c.value.value,A),n("complete:masked",c.value.value,A),n("complete:typed",c.value.typedValue,A),n("complete:unmasked",c.value.unmaskedValue,A)),i?.(A)}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)};we(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)};we(d,x);const C=()=>{!c.value||p.value===void 0||(b!==p.value&&(c.value.typedValue=p.value,c.value.masked.typedValueEquals(p.value)||k()),b=void 0)};we(p,C);function M(){f=u.value;const A=l.value;!f||!(A!=null&&A.mask)||(c.value=se(f,A),o!==void 0&&(d.value=o),s!==void 0&&(h.value=s),a!==void 0&&(p.value=a),w(),x(),C(),y(),c.value.on("accept",k).on("complete",v))}function T(){var A;(A=c.value)==null||A.destroy(),c.value=void 0}return Tn(M),tv(T),we([u,l],()=>{const A=u.value,_=l.value;(!(_!=null&&_.mask)||A!==f)&&T(),A&&(c.value?c.value.updateOptions(_):M())}),{el:u,mask:pp(c),masked:d,unmasked:h,typed:p}}const DE={key:0,class:"k-input__prefix"},IE=["id","aria-labelledby","aria-describedby","required","type"],NE={key:1,class:"k-input__suffix"},RE=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=gp(),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=vp(hu,I(()=>({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}=_E(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 Tn(()=>{we(()=>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:Se(B(s)({invalid:B(a).invalid,align:p.align}))},[p.$slots.prefix||p.prefix?(E(),O("span",DE,[L(p.$slots,"prefix",{},()=>[Be(oe(p.prefix),1)])])):P("",!0),U("input",re({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,IE),p.$slots.suffix||p.suffix?(E(),O("span",NE,[L(p.$slots,"suffix",{},()=>[Be(oe(p.suffix),1)])])):P("",!0)],2))}}),PE=["id","value","aria-labelledby","aria-describedby","required"],NL=Q({__name:"TextArea",props:{invalid:{type:Boolean},id:{},modelValue:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=gp(),r=t,i=e;function o(c){i("update:modelValue",c.target.value)}const s=rn("k-textarea",{variants:{invalid:{true:"k-textarea--invalid"}}}),a=vp(hu,I(()=>({id:r.id,invalid:r.invalid,required:!1,events:{onBlur:()=>{},onFocus:()=>{}}}))),l=c=>{var d;(d=a.value.events)==null||d.onFocus(c),n.onFocus&&n.onFocus(c)},u=c=>{var d;(d=a.value.events)==null||d.onBlur(c),n.onBlur&&n.onBlur(c)};return(c,d)=>(E(),O("textarea",re({class:B(s)({invalid:B(a).invalid}),id:B(a).id,value:c.modelValue,"aria-labelledby":B(a).labelId,"aria-describedby":B(a).helpId,required:B(a).required,onInput:o,onBlur:u,onFocus:l},c.$attrs),null,16,PE))}});let FE=class{constructor(t,e){Xt(this,"key"),Xt(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(){}},LE=class{constructor(t,e){Xt(this,"key"),Xt(this,"goto"),Xt(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){Xt(this,"key"),Xt(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 VE=Object.freeze(Object.defineProperty({__proto__:null,localStorage:FE,none:LE,sessionStorage:BE},Symbol.toStringTag,{value:"Module"})),$E=["data-step"],jE={key:0,class:"k-stepper-breadcrumbs-wrapper"},zE={key:0,class:"k-stepper__breadcrumb-arrow"},HE=["disabled","onClick"],qE={class:"k-stepper__breadcrumb-icon"},WE={class:"k-stepper__breadcrumb-label"},UE={class:"k-stepper__component-wrapper"},KE={key:0,class:"k-stepper__navigation"},RL=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=z(),i=z(),o=z(n.steps[0].id);let s;const a=typeof n.stateHandler=="string"?VE[n.stateHandler]:n.stateHandler;s=new a(n.stateKey,f),hi(()=>s.destroy());const l=I(()=>c(o.value)),u=I(()=>{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=wp({next:h,prev:p,goto:f});we(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 b(){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 C=["top","bottom"].includes(x)?"h":"v";return`k-stepper-${v}-${C}-${g()}`}const y=()=>{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:Se(`k-stepper k-stepper--breadcrumb-placement-${k.breadcrumbPlacement}`),"data-step":o.value},[k.hidebreadcrumbs?P("",!0):(E(),O("div",jE,[L(k.$slots,"before-breadcrumbs",be(Re({meta:l.value,navigate:m}))),U("div",{class:"k-stepper__breadcrumbs",ref_key:"breadcrumb",ref:r},[(E(!0),O(Oe,null,_t(k.steps,(w,x)=>(E(),O(Oe,null,[x>0?(E(),O("div",zE)):P("",!0),L(k.$slots,"breadcrumb",{step:w,isActive:w.id===o.value,index:x,select:()=>f(w.id)},()=>[U("button",{type:"button",class:Se(["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:C=>f(w.id)},[U("span",qE,[L(k.$slots,"breadcrumb-icon",{step:w},()=>[w.isValid===!0?(E(),H(B(Qe),{key:0,icon:"heroicons-solid:check",width:12})):w.isValid===!1?(E(),H(B(Qe),{key:1,icon:"heroicons:exclamation-triangle",width:17})):(E(),O(Oe,{key:2},[Be(oe(x+1),1)],64))])]),U("span",WE,oe(w.label),1)],10,HE)])],64))),256))],512),L(k.$slots,"after-breadcrumbs",be(Re({meta:l.value,navigate:m})))])),L(k.$slots,"before-content",be(Re({meta:l.value,navigate:m}))),U("div",UE,[he(mp,{name:b(),mode:"out-in",onAfterEnter:y},{default:ee(()=>[k.keepAlive?(E(),H(Lk,{key:0},[(E(),H(et(u.value.step.component),re({key:o.value},u.value),null,16))],1024)):(E(),H(et(u.value.step.component),re({key:o.value},u.value),null,16))]),_:1},8,["name"]),k.$slots.navigation?(E(),O("div",KE,[L(k.$slots,"navigation",be(Re({meta:l.value,navigate:m})))])):P("",!0)]),L(k.$slots,"after-content",be(Re({meta:l.value,navigate:m})))],10,$E))}}),GE=["src","alt"],bu=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=z(),o=z(!1),s=z(!1),a=z(),l=I(()=>({"--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 Tn(()=>{var d;return((d=i.value)==null?void 0:d.complete)&&u()}),(d,h)=>(E(),O("figure",{class:Se(["k-image",[`k-image--size-${d.size}`,{"k-image--loaded":o.value,"k-image--loading":!o.value}]]),style:kn(l.value)},[o.value?P("",!0):(E(),H(vv,{key:0,size:"small"})),Ua(U("img",{src:d.src,alt:d.alt||d.caption,onLoad:u,onError:c,ref_key:"image",ref:i},null,40,GE),[[Yg,!s.value]]),d.$slots.caption||d.caption?(E(),O("figcaption",{key:1,class:Se(`k-image__caption k-image__caption--visibility-${d.captionVisibility} k-image__caption--theme-${!o.value||s.value?"light":d.captionTheme}`)},[L(d.$slots,"caption",{},()=>[Be(oe(d.caption),1)])],2)):P("",!0)],6))}}),ri=Q({__name:"Flex",props:{is:{default:"div"},gap:{default:"default"},justify:{},align:{},direction:{default:"row"},nowrap:{type:Boolean}},setup(t){const e=t,n=I(()=>gv("flex",{justify:Ja(e.justify)||"initial",align:Ja(e.align)||"initial",wrap:e.nowrap?"nowrap":"wrap",gap:Sp(e.gap),direction:e.direction}));return(r,i)=>(E(),H(et(r.is),{class:"k-flex",style:kn(n.value)},{default:ee(()=>[L(r.$slots,"default")]),_:3},8,["style"]))}}),JE={key:0,class:"k-card__thumbnail"},YE={key:0,class:"k-card__title"},XE={key:1,class:"k-card__subtitle"},ZE={key:2,class:"k-card__content"},QE=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=yp(),r=I(()=>e.thumbnail||n.thumbnail),i=I(()=>e.title||e.subtitle||n.header),o=I(()=>n.actions),s=I(()=>n.default);return(a,l)=>(E(),H(et(a.is),re({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:ee(()=>[r.value?(E(),O("div",JE,[L(a.$slots,"thumbnail",{},()=>[a.thumbnail?(E(),H(bu,re({key:0},a.thumbnailOptions,{src:a.thumbnail}),null,16,["src"])):P("",!0)])])):P("",!0),i.value?(E(),H(ri,{key:1,is:"header",direction:"column",gap:"0rem",class:"k-card__header"},{default:ee(()=>[L(a.$slots,"header",{},()=>[a.title?(E(),O("div",YE,oe(a.title),1)):P("",!0),a.subtitle?(E(),O("div",XE,oe(a.subtitle),1)):P("",!0)])]),_:3})):P("",!0),s.value?(E(),O("div",ZE,[L(a.$slots,"default")])):P("",!0),o.value?(E(),H(ri,{key:3,justify:"center",align:"center",class:"k-card__actions"},{default:ee(()=>[L(a.$slots,"actions")]),_:3})):P("",!0)]),_:3},16,["class"]))}}),PL=Q({__name:"Skeleton",props:{variant:{default:"shiny"},aspectRatio:{},width:{},height:{},rounding:{}},setup(t){const e=()=>t.rounding?t.rounding==="full"?"9999px":Sp(t.rounding,"rounding"):"initial",n=I(()=>({"--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:Se(["k-skeleton",`k-skeleton--variant-${r.variant}`]),style:kn(n.value)},[L(r.$slots,"default")],6))}});var eC=$n("slider").parts("root","label","thumb","valueText","track","range","control","markerGroup","marker","draggingIndicator"),ln=eC.build(),Qv=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`slider:${t.id}`},ey=(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}`},ud=(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}`},ty=t=>{var e;return((e=t.ids)==null?void 0:e.control)??`slider:${t.id}:control`},tC=t=>{var e;return((e=t.ids)==null?void 0:e.track)??`slider:${t.id}:track`},nC=t=>{var e;return((e=t.ids)==null?void 0:e.range)??`slider:${t.id}:range`},xf=t=>{var e;return((e=t.ids)==null?void 0:e.label)??`slider:${t.id}:label`},rC=t=>{var e;return((e=t.ids)==null?void 0:e.valueText)??`slider:${t.id}:value-text`},iC=(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}`},oC=t=>t.getById(Qv(t)),sC=(t,e)=>t.getById(ey(t,e)),ny=t=>Np(iy(t),"[role=slider]"),aC=t=>ny(t)[0],ry=(t,e)=>t.getById(ud(t,e)),iy=t=>t.getById(ty(t)),Ef=(t,e)=>{const{prop:n,scope:r}=t,i=iy(r);if(!i)return;const o=Ux(e,i).getPercentValue({orientation:n("orientation"),dir:n("dir"),inverted:{y:!0}});return Lv(o,n("min"),n("max"),n("step"))},lC=(t,e)=>{e.forEach((n,r)=>{const i=ry(t,r);i&&Fx(i,{value:n})})},uC=t=>({left:t?.offsetLeft??0,top:t?.offsetTop??0,width:t?.offsetWidth??0,height:t?.offsetHeight??0});function cC(t){const e=t[0],n=t[t.length-1];return[e,n]}function dC(t){const{prop:e,computed:n}=t,r=n("valuePercent"),[i,o]=cC(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 e("origin")==="end"?{start:`${o}%`,end:"0%"}:{start:"0%",end:`${100-o}%`}}return{start:`${i}%`,end:`${100-o}%`}}function pC(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 hC(t,e){const{context:n,prop:r}=t,{height:i=0}=n.get("thumbSize")??{},o=od([r("min"),r("max")],[-i/2,i/2]);return parseFloat(o(e).toFixed(2))}function fC(t,e){const{computed:n,context:r,prop:i}=t,{width:o=0}=r.get("thumbSize")??{};if(n("isRtl")){const a=od([i("max"),i("min")],[-o/2,o/2]);return-1*parseFloat(a(e).toFixed(2))}const s=od([i("min"),i("max")],[-o/2,o/2]);return parseFloat(s(e).toFixed(2))}function mC(t,e,n){const{computed:r,prop:i}=t;if(i("thumbAlignment")==="center")return`${e}%`;const o=r("isVertical")?hC(t,n):fC(t,n);return`calc(${e}% - ${o}px)`}function oy(t,e){const{prop:n}=t,r=Lp(e,n("min"),n("max"))*100;return mC(t,r,e)}function sy(t){const{computed:e,prop:n}=t;let r="visible";return n("thumbAlignment")==="contain"&&!e("hasMeasuredThumbSize")&&(r="hidden"),r}function Cf(t,e){const{computed:n}=t,r=n("isVertical")?"bottom":"insetInlineStart";return{visibility:sy(t),position:"absolute",transform:"var(--slider-thumb-transform)",[r]:`var(--slider-thumb-offset-${e})`}}function gC(){return{touchAction:"none",userSelect:"none",WebkitUserSelect:"none",position:"relative"}}function vC(t){const{context:e,computed:n}=t,r=n("isVertical"),i=n("isRtl"),o=dC(t),s=e.get("thumbSize");return{...e.get("value").reduce((a,l,u)=>{const c=oy(t,l);return{...a,[`--slider-thumb-offset-${u}`]:c}},{}),"--slider-thumb-width":df(s?.width),"--slider-thumb-height":df(s?.height),"--slider-thumb-transform":r?"translateY(50%)":i?"translateX(50%)":"translateX(-50%)","--slider-range-start":o.start,"--slider-range-end":o.end}}function yC(t,e){const{computed:n}=t,r=n("isHorizontal"),i=n("isRtl");return{visibility:sy(t),position:"absolute",pointerEvents:"none",[r?"insetInlineStart":"bottom"]:oy(t,e),translate:"var(--tx) var(--ty)","--tx":r?i?"50%":"-50%":"0%","--ty":r?"0%":"50%"}}function bC(){return{userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none",position:"relative"}}function kC(t,e){return e.map((n,r)=>cd(t,n,r))}function mr(t,e){const{context:n,prop:r}=t;return Vv(n.get("value"),r("min"),r("max"),r("minStepsBetweenThumbs"))[e]}function cd(t,e,n){const{prop:r}=t,i=mr(t,n),o=Bp(e,r("min"),r("max"),r("step"));return Is(o,i.min,i.max)}function wC(t,e,n){const{context:r,prop:i}=t,o=e??r.get("focusedIndex"),s=mr(t,o),a=T1(o,{...s,step:n??i("step"),values:r.get("value")});return a[o]=Is(a[o],s.min,s.max),a}function xC(t,e,n){const{context:r,prop:i}=t,o=e??r.get("focusedIndex"),s=mr(t,o),a=S1(o,{...s,step:n??i("step"),values:r.get("value")});return a[o]=Is(a[o],s.min,s.max),a}function EC(t,e){const{context:n}=t;return O1(n.get("value"),e)}function ay(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"),b=o("orientation")==="horizontal",y=o("orientation")==="vertical";function k(w){return Lp(w,o("min"),o("max"))}function v(w){return Lv(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 C=v(x);r({type:"SET_VALUE",index:w,value:C})},getThumbMin(w){return mr(t,w).min},getThumbMax(w){return mr(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":J(f),"data-orientation":o("orientation"),"data-invalid":J(m),"data-dragging":J(p),"data-focus":J(h),id:xf(a),htmlFor:ud(a,0),onClick(w){var x;g&&(w.preventDefault(),(x=aC(a))==null||x.focus())},style:{userSelect:"none",WebkitUserSelect:"none"}})},getRootProps(){return e.element({...ln.root.attrs,"data-disabled":J(f),"data-orientation":o("orientation"),"data-dragging":J(p),"data-invalid":J(m),"data-focus":J(h),id:Qv(a),dir:o("dir"),style:vC(t)})},getValueTextProps(){return e.element({...ln.valueText.attrs,dir:o("dir"),"data-disabled":J(f),"data-orientation":o("orientation"),"data-invalid":J(m),"data-focus":J(h),id:rC(a)})},getTrackProps(){return e.element({...ln.track.attrs,dir:o("dir"),id:tC(a),"data-disabled":J(f),"data-invalid":J(m),"data-dragging":J(p),"data-orientation":o("orientation"),"data-focus":J(h),style:{position:"relative"}})},getThumbProps(w){var x;const{index:C=0,name:M}=w,T=c[C],A=mr(t,C),_=(x=o("getAriaValueText"))==null?void 0:x({value:T,index:C}),N=Array.isArray(l)?l[C]:l,$=Array.isArray(u)?u[C]:u;return e.element({...ln.thumb.attrs,dir:o("dir"),"data-index":C,"data-name":M,id:ey(a,C),"data-disabled":J(f),"data-orientation":o("orientation"),"data-focus":J(h&&d===C),"data-dragging":J(p&&d===C),draggable:!1,"aria-disabled":nx(f),"aria-label":N,"aria-labelledby":$??xf(a),"aria-orientation":o("orientation"),"aria-valuemax":A.max,"aria-valuemin":A.min,"aria-valuenow":c[C],"aria-valuetext":_,role:"slider",tabIndex:f?void 0:0,style:Cf(t,C),onPointerDown(j){g&&(r({type:"THUMB_POINTER_DOWN",index:C}),j.stopPropagation())},onBlur(){g&&r({type:"BLUR"})},onFocus(){g&&r({type:"FOCUS",index:C})},onKeyDown(j){if(j.defaultPrevented||!g)return;const q=Rx(j)*o("step"),K={ArrowUp(){b||r({type:"ARROW_INC",step:q,src:"ArrowUp"})},ArrowDown(){b||r({type:"ARROW_DEC",step:q,src:"ArrowDown"})},ArrowLeft(){y||r({type:"ARROW_DEC",step:q,src:"ArrowLeft"})},ArrowRight(){y||r({type:"ARROW_INC",step:q,src:"ArrowRight"})},PageUp(){r({type:"ARROW_INC",step:q,src:"PageUp"})},PageDown(){r({type:"ARROW_DEC",step:q,src:"PageDown"})},Home(){r({type:"HOME"})},End(){r({type:"END"})}},X=kv(j,{dir:o("dir"),orientation:o("orientation")}),fe=K[X];fe&&(fe(j),j.preventDefault(),j.stopPropagation())}})},getHiddenInputProps(w){const{index:x=0,name:C}=w;return e.input({name:C??(o("name")?o("name")+(c.length>1?"[]":""):void 0),form:o("form"),type:"text",hidden:!0,defaultValue:c[x],id:ud(a,x)})},getRangeProps(){return e.element({id:nC(a),...ln.range.attrs,dir:o("dir"),"data-dragging":J(p),"data-focus":J(h),"data-invalid":J(m),"data-disabled":J(f),"data-orientation":o("orientation"),style:pC(t)})},getControlProps(){return e.element({...ln.control.attrs,dir:o("dir"),id:ty(a),"data-dragging":J(p),"data-disabled":J(f),"data-orientation":o("orientation"),"data-invalid":J(m),"data-focus":J(h),style:gC(),onPointerDown(w){if(!g||!Ox(w)||Mx(w))return;const x=Mp(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:bC()})},getMarkerProps(w){const x=yC(t,w.value);let C;return w.value<Nv(c)?C="under-value":w.value>Rv(c)?C="over-value":C="at-value",e.element({...ln.marker.attrs,id:iC(a,w.value),role:"presentation",dir:o("dir"),"data-orientation":o("orientation"),"data-value":w.value,"data-disabled":J(f),"data-state":C,style:x})},getDraggingIndicatorProps(w){const{index:x=0}=w,C=x===d&&p;return e.element({...ln.draggingIndicator.attrs,role:"presentation",dir:o("dir"),hidden:!C,"data-orientation":o("orientation"),"data-state":C?"open":"closed",style:Cf(t,x)})}}}var CC=(t,e)=>t?.width===e?.width&&t?.height===e?.height,Sf=(t,e,n,r,i)=>Vv(t,e,n,i*r).map(o=>{const s=Bp(o.value,o.min,o.max,r);return Is(s,o.min,o.max)}),ly={props({props:t}){const e=t.min??0,n=t.max??100,r=t.step??1,i=t.defaultValue??[e],o=t.minStepsBetweenThumbs??0;return{dir:"ltr",thumbAlignment:"contain",origin:"start",orientation:"horizontal",minStepsBetweenThumbs:o,...t,defaultValue:Sf(i,e,n,r,o),value:t.value?Sf(t.value,e,n,r,o):void 0,max:n,step:r,min:e}},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"),isEqual:Ds,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*Lp(n,e("min"),e("max")))}},watch({track:t,action:e,context:n}){t([()=>n.hash("value")],()=>{e(["syncInputElements","dispatchChangeEvent"])})},effects:["trackFormControlState","trackThumbSize"],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 cu(oC(e),{onFieldsetDisabledChange(n){t.set("fieldsetDisabled",n)},onFormReset(){t.set("value",t.initial("value"))}})},trackPointerMove({scope:t,send:e}){return Yx(t.getDoc(),{onPointerMove(n){e({type:"POINTER_MOVE",point:n.point})},onPointerUp(){e({type:"POINTER_UP"})}})},trackThumbSize({context:t,scope:e,prop:n}){if(!(n("thumbAlignment")!=="contain"||n("thumbSize")))return Mv(ny(e),{box:"border-box",measure(r){return uC(r)},onEntry({rects:r}){const i=M1(r[0],["width","height"]);CC(t.get("thumbSize"),i)||t.set("thumbSize",i)}})}},actions:{dispatchChangeEvent({context:t,scope:e}){lC(e,t.get("value"))},syncInputElements({context:t,scope:e}){t.get("value").forEach((n,r)=>{const i=ry(e,r);xv(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=Ef(t,n.point);if(r==null)return;const i=EC(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=Ef(t,n.point);if(r==null)return;const i=e.get("focusedIndex"),o=cd(t,r,i);e.set("value",s=>Io(s,i,o))})},focusActiveThumb({scope:t,context:e}){At(()=>{const n=sC(t,e.get("focusedIndex"));n?.focus({preventScroll:!0})})},decrementThumbAtIndex(t){const{context:e,event:n}=t,r=wC(t,n.index,n.step);e.set("value",r)},incrementThumbAtIndex(t){const{context:e,event:n}=t,r=xC(t,n.index,n.step);e.set("value",r)},setFocusedThumbToMin(t){const{context:e}=t,n=e.get("focusedIndex"),{min:r}=mr(t,n);e.set("value",i=>Io(i,n,r))},setFocusedThumbToMax(t){const{context:e}=t,n=e.get("focusedIndex"),{max:r}=mr(t,n);e.set("value",i=>Io(i,n,r))},setValueAtIndex(t){const{context:e,event:n}=t,r=cd(t,n.value,n.index);e.set("value",i=>Io(i,n.index,r))},setValue(t){const{context:e,event:n}=t,r=kC(t,n.value);e.set("value",r)}}}};Kn()(["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"]);Kn()(["index","name"]);const SC=["data-value"],TC=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=gi(ly,{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=I(()=>ay(i,mi)),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 b=Math.max(u,Math.min(c,m)),y=Math.min(h,Math.max(d,g));return p===b&&f===y?r("update:modelValue",[b,y]):o.value.setValue([b,y])},a=I(()=>{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 we(()=>n.modelValue,s,{deep:!0}),(l,u)=>(E(),O("div",re(o.value.getRootProps(),{class:"k-rangeslider"}),[U("div",be(Re(o.value.getControlProps())),[U("div",be(Re(o.value.getTrackProps())),[U("div",be(Re(o.value.getRangeProps())),null,16)],16),(E(!0),O(Oe,null,_t(o.value.value,(c,d)=>(E(),O("div",re({key:d,ref_for:!0},o.value.getThumbProps({index:d})),[U("input",re({ref_for:!0},o.value.getHiddenInputProps({index:d})),null,16)],16))),128))],16),a.value.length?(E(),O("div",be(re({key:0},o.value.getMarkerGroupProps())),[(E(!0),O(Oe,null,_t(a.value,c=>(E(),O("span",re({ref_for:!0},o.value.getMarkerProps({value:c.value}),{"data-value":c.label}),null,16,SC))),256))],16)):P("",!0)],16))}}),OC=["data-value"],FL=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=gi(ly,{id:Qt(),...n,defaultValue:[n.modelValue],onValueChange:({value:l})=>{r("update:modelValue",l[0])}}),o=I(()=>ay(i,mi)),s=l=>o.value.setValue([Math.max(n.min||l,Math.min(n.max||l,l))]),a=I(()=>{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 we(()=>n.modelValue,s,{deep:!0}),(l,u)=>(E(),O("div",re(o.value.getRootProps(),{class:["k-slider",{"k-slider--marker-highlight":l.markerHighlight}]}),[U("div",be(Re(o.value.getControlProps())),[U("div",be(Re(o.value.getTrackProps())),[U("div",be(Re(o.value.getRangeProps())),null,16)],16),U("div",be(Re(o.value.getThumbProps({index:0}))),[U("input",be(Re(o.value.getHiddenInputProps({index:0}))),null,16)],16),U("output",be(Re(o.value.getValueTextProps())),[L(l.$slots,"value",{value:o.value.value},()=>[Be(oe(l.format(o.value.value.at(0))),1)])],16)],16),a.value.length?(E(),O("div",be(re({key:0},o.value.getMarkerGroupProps())),[(E(!0),O(Oe,null,_t(a.value,c=>(E(),O("span",re({ref_for:!0},o.value.getMarkerProps({value:c.value}),{"data-value":c.label}),null,16,OC))),256))],16)):P("",!0)],16))}}),Qi=Math.min,Gr=Math.max,tl=Math.round,aa=Math.floor,vn=t=>({x:t,y:t}),AC={left:"right",right:"left",bottom:"top",top:"bottom"},MC={start:"end",end:"start"};function dd(t,e,n){return Gr(t,Qi(e,n))}function Ps(t,e){return typeof t=="function"?t(e):t}function ii(t){return t.split("-")[0]}function Fs(t){return t.split("-")[1]}function uy(t){return t==="x"?"y":"x"}function zp(t){return t==="y"?"height":"width"}function Jr(t){return["top","bottom"].includes(ii(t))?"y":"x"}function Hp(t){return uy(Jr(t))}function _C(t,e,n){n===void 0&&(n=!1);const r=Fs(t),i=Hp(t),o=zp(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=nl(s)),[s,nl(s)]}function DC(t){const e=nl(t);return[pd(t),e,pd(e)]}function pd(t){return t.replace(/start|end/g,e=>MC[e])}function IC(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 NC(t,e,n,r){const i=Fs(t);let o=IC(ii(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(pd)))),o}function nl(t){return t.replace(/left|right|bottom|top/g,e=>AC[e])}function RC(t){return{top:0,right:0,bottom:0,left:0,...t}}function cy(t){return typeof t!="number"?RC(t):{top:t,right:t,bottom:t,left:t}}function rl(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 Tf(t,e,n){let{reference:r,floating:i}=t;const o=Jr(e),s=Hp(e),a=zp(s),l=ii(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(Fs(e)){case"start":p[s]-=h*(n&&u?-1:1);break;case"end":p[s]+=h*(n&&u?-1:1);break}return p}const PC=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}=Tf(u,r,l),h=r,p={},f=0;for(let m=0;m<a.length;m++){const{name:g,fn:b}=a[m],{x:y,y:k,data:v,reset:w}=await b({x:c,y:d,initialPlacement:r,placement:h,strategy:i,middlewareData:p,rects:u,platform:s,elements:{reference:t,floating:e}});c=y??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}=Tf(u,h,l)),m=-1)}return{x:c,y:d,placement:h,strategy:i,middlewareData:p}};async function dy(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}=Ps(e,t),f=cy(p),m=a[h?d==="floating"?"reference":"floating":d],g=rl(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})),b=d==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,y=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),k=await(o.isElement==null?void 0:o.isElement(y))?await(o.getScale==null?void 0:o.getScale(y))||{x:1,y:1}:{x:1,y:1},v=rl(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:y,strategy:l}):b);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 FC=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=e,{element:u,padding:c=0}=Ps(t,e)||{};if(u==null)return{};const d=cy(c),h={x:n,y:r},p=Hp(i),f=zp(p),m=await s.getDimensions(u),g=p==="y",b=g?"top":"left",y=g?"bottom":"right",k=g?"clientHeight":"clientWidth",v=o.reference[f]+o.reference[p]-h[p]-o.floating[f],w=h[p]-o.reference[p],x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let C=x?x[k]:0;(!C||!await(s.isElement==null?void 0:s.isElement(x)))&&(C=a.floating[k]||o.floating[f]);const M=v/2-w/2,T=C/2-m[f]/2-1,A=Qi(d[b],T),_=Qi(d[y],T),N=A,$=C-m[f]-_,j=C/2-m[f]/2+M,q=dd(N,j,$),K=!l.arrow&&Fs(i)!=null&&j!==q&&o.reference[f]/2-(j<N?A:_)-m[f]/2<0,X=K?j<N?j-N:j-$:0;return{[p]:h[p]+X,data:{[p]:q,centerOffset:j-q-X,...K&&{alignmentOffset:X}},reset:K}}}),LC=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}=Ps(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const b=ii(i),y=Jr(a),k=ii(a)===a,v=await(l.isRTL==null?void 0:l.isRTL(u.floating)),w=h||(k||!m?[nl(a)]:DC(a)),x=f!=="none";!h&&x&&w.push(...NC(a,m,f,v));const C=[a,...w],M=await dy(e,g),T=[];let A=((r=o.flip)==null?void 0:r.overflows)||[];if(c&&T.push(M[b]),d){const q=_C(i,s,v);T.push(M[q[0]],M[q[1]])}if(A=[...A,{placement:i,overflows:T}],!T.every(q=>q<=0)){var _,N;const q=(((_=o.flip)==null?void 0:_.index)||0)+1,K=C[q];if(K){var $;const fe=d==="alignment"?y!==Jr(K):!1,Ee=(($=A[0])==null?void 0:$.overflows[0])>0;if(!fe||Ee)return{data:{index:q,overflows:A},reset:{placement:K}}}let X=(N=A.filter(fe=>fe.overflows[0]<=0).sort((fe,Ee)=>fe.overflows[1]-Ee.overflows[1])[0])==null?void 0:N.placement;if(!X)switch(p){case"bestFit":{var j;const fe=(j=A.filter(Ee=>{if(x){const Ie=Jr(Ee.placement);return Ie===y||Ie==="y"}return!0}).map(Ee=>[Ee.placement,Ee.overflows.filter(Ie=>Ie>0).reduce((Ie,An)=>Ie+An,0)]).sort((Ee,Ie)=>Ee[1]-Ie[1])[0])==null?void 0:j[0];fe&&(X=fe);break}case"initialPlacement":X=a;break}if(i!==X)return{reset:{placement:X}}}return{}}}};async function BC(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=ii(n),a=Fs(n),l=Jr(n)==="y",u=["left","top"].includes(s)?-1:1,c=o&&l?-1:1,d=Ps(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 VC=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 BC(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}}}}},$C=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:g=>{let{x:b,y}=g;return{x:b,y}}},...l}=Ps(t,e),u={x:n,y:r},c=await dy(e,l),d=Jr(ii(i)),h=uy(d);let p=u[h],f=u[d];if(o){const g=h==="y"?"top":"left",b=h==="y"?"bottom":"right",y=p+c[g],k=p-c[b];p=dd(y,p,k)}if(s){const g=d==="y"?"top":"left",b=d==="y"?"bottom":"right",y=f+c[g],k=f-c[b];f=dd(y,f,k)}const m=a.fn({...e,[h]:p,[d]:f});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:o,[d]:s}}}}}};function ku(){return typeof window<"u"}function vi(t){return qp(t)?(t.nodeName||"").toLowerCase():"#document"}function Dt(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function On(t){var e;return(e=(qp(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function qp(t){return ku()?t instanceof Node||t instanceof Dt(t).Node:!1}function en(t){return ku()?t instanceof Element||t instanceof Dt(t).Element:!1}function wn(t){return ku()?t instanceof HTMLElement||t instanceof Dt(t).HTMLElement:!1}function Of(t){return!ku()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Dt(t).ShadowRoot}function Ls(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 jC(t){return["table","td","th"].includes(vi(t))}function wu(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Wp(t){const e=Up(),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 zC(t){let e=Er(t);for(;wn(e)&&!eo(e);){if(Wp(e))return e;if(wu(e))return null;e=Er(e)}return null}function Up(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function eo(t){return["html","body","#document"].includes(vi(t))}function tn(t){return Dt(t).getComputedStyle(t)}function xu(t){return en(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Er(t){if(vi(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Of(t)&&t.host||On(t);return Of(e)?e.host:e}function py(t){const e=Er(t);return eo(e)?t.ownerDocument?t.ownerDocument.body:t.body:wn(e)&&Ls(e)?e:py(e)}function fs(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=py(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=Dt(i);if(o){const a=hd(s);return e.concat(s,s.visualViewport||[],Ls(i)?i:[],a&&n?fs(a):[])}return e.concat(i,fs(i,[],n))}function hd(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function hy(t){const e=tn(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=wn(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,a=tl(n)!==o||tl(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function Kp(t){return en(t)?t:t.contextElement}function Ui(t){const e=Kp(t);if(!wn(e))return vn(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=hy(e);let s=(o?tl(n.width):n.width)/r,a=(o?tl(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const HC=vn(0);function fy(t){const e=Dt(t);return!Up()||!e.visualViewport?HC:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function qC(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Dt(t)?!1:e}function oi(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=Kp(t);let s=vn(1);e&&(r?en(r)&&(s=Ui(r)):s=Ui(t));const a=qC(o,n,r)?fy(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=hd(f);for(;m&&r&&p!==f;){const g=Ui(m),b=m.getBoundingClientRect(),y=tn(m),k=b.left+(m.clientLeft+parseFloat(y.paddingLeft))*g.x,v=b.top+(m.clientTop+parseFloat(y.paddingTop))*g.y;l*=g.x,u*=g.y,c*=g.x,d*=g.y,l+=k,u+=v,f=Dt(m),m=hd(f)}}return rl({width:c,height:d,x:l,y:u})}function Gp(t,e){const n=xu(t).scrollLeft;return e?e.left+n:oi(On(t)).left+n}function my(t,e,n){n===void 0&&(n=!1);const r=t.getBoundingClientRect(),i=r.left+e.scrollLeft-(n?0:Gp(t,r)),o=r.top+e.scrollTop;return{x:i,y:o}}function WC(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const o=i==="fixed",s=On(r),a=e?wu(e.floating):!1;if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},u=vn(1);const c=vn(0),d=wn(r);if((d||!d&&!o)&&((vi(r)!=="body"||Ls(s))&&(l=xu(r)),wn(r))){const p=oi(r);u=Ui(r),c.x=p.x+r.clientLeft,c.y=p.y+r.clientTop}const h=s&&!d&&!o?my(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 UC(t){return Array.from(t.getClientRects())}function KC(t){const e=On(t),n=xu(t),r=t.ownerDocument.body,i=Gr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=Gr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Gp(t);const a=-n.scrollTop;return tn(r).direction==="rtl"&&(s+=Gr(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function GC(t,e){const n=Dt(t),r=On(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=Up();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a,y:l}}function JC(t,e){const n=oi(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=wn(t)?Ui(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 Af(t,e,n){let r;if(e==="viewport")r=GC(t,n);else if(e==="document")r=KC(On(t));else if(en(e))r=JC(e,n);else{const i=fy(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return rl(r)}function gy(t,e){const n=Er(t);return n===e||!en(n)||eo(n)?!1:tn(n).position==="fixed"||gy(n,e)}function YC(t,e){const n=e.get(t);if(n)return n;let r=fs(t,[],!1).filter(a=>en(a)&&vi(a)!=="body"),i=null;const o=tn(t).position==="fixed";let s=o?Er(t):t;for(;en(s)&&!eo(s);){const a=tn(s),l=Wp(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&i&&["absolute","fixed"].includes(i.position)||Ls(s)&&!l&&gy(t,s))?r=r.filter(u=>u!==s):i=a,s=Er(s)}return e.set(t,r),r}function XC(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?wu(e)?[]:YC(e,this._c):[].concat(n),r],s=o[0],a=o.reduce((l,u)=>{const c=Af(e,u,i);return l.top=Gr(c.top,l.top),l.right=Qi(c.right,l.right),l.bottom=Qi(c.bottom,l.bottom),l.left=Gr(c.left,l.left),l},Af(e,s,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function ZC(t){const{width:e,height:n}=hy(t);return{width:e,height:n}}function QC(t,e,n){const r=wn(e),i=On(e),o=n==="fixed",s=oi(t,!0,o,e);let a={scrollLeft:0,scrollTop:0};const l=vn(0);if(r||!r&&!o)if((vi(e)!=="body"||Ls(i))&&(a=xu(e)),r){const h=oi(e,!0,o,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else i&&(l.x=Gp(i));const u=i&&!r&&!o?my(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 ec(t){return tn(t).position==="static"}function Mf(t,e){if(!wn(t)||tn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return On(t)===n&&(n=n.ownerDocument.body),n}function vy(t,e){const n=Dt(t);if(wu(t))return n;if(!wn(t)){let i=Er(t);for(;i&&!eo(i);){if(en(i)&&!ec(i))return i;i=Er(i)}return n}let r=Mf(t,e);for(;r&&jC(r)&&ec(r);)r=Mf(r,e);return r&&eo(r)&&ec(r)&&!Wp(r)?n:r||zC(t)||n}const eS=async function(t){const e=this.getOffsetParent||vy,n=this.getDimensions,r=await n(t.floating);return{reference:QC(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function tS(t){return tn(t).direction==="rtl"}const fd={convertOffsetParentRelativeRectToViewportRelativeRect:WC,getDocumentElement:On,getClippingRect:XC,getOffsetParent:vy,getElementRects:eS,getClientRects:UC,getDimensions:ZC,getScale:Ui,isElement:en,isRTL:tS};function yy(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function nS(t,e){let n=null,r;const i=On(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=aa(d),m=aa(i.clientWidth-(c+h)),g=aa(i.clientHeight-(d+p)),b=aa(c),y={rootMargin:-f+"px "+-m+"px "+-g+"px "+-b+"px",threshold:Gr(0,Qi(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&&!yy(u,t.getBoundingClientRect())&&s(),k=!1}try{n=new IntersectionObserver(v,{...y,root:i.ownerDocument})}catch{n=new IntersectionObserver(v,y)}n.observe(t)}return s(!0),o}function rS(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=Kp(t),c=i||o?[...u?fs(u):[],...fs(e)]:[];c.forEach(b=>{i&&b.addEventListener("scroll",n,{passive:!0}),o&&b.addEventListener("resize",n)});const d=u&&a?nS(u,n):null;let h=-1,p=null;s&&(p=new ResizeObserver(b=>{let[y]=b;y&&y.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?oi(t):null;l&&g();function g(){const b=oi(t);m&&!yy(m,b)&&n(),m=b,f=requestAnimationFrame(g)}return n(),()=>{var b;c.forEach(y=>{i&&y.removeEventListener("scroll",n),o&&y.removeEventListener("resize",n)}),d?.(),(b=p)==null||b.disconnect(),p=null,l&&cancelAnimationFrame(f)}}const by=VC,iS=$C,ky=LC,oS=FC,wy=(t,e,n)=>{const r=new Map,i={platform:fd,...n},o={...i.platform,_c:r};return PC(t,e,{...i,platform:o})};function sS(t){return aS(t)}function tc(t){return t.assignedSlot?t.assignedSlot:t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}function aS(t){for(let e=t;e;e=tc(e))if(e instanceof Element&&getComputedStyle(e).display==="none")return null;for(let e=tc(t);e;e=tc(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 Eu=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=I(()=>{const{items:v,placement:w,teleport:x,keepOpen:C,...M}=n;return M}),i=z(!1),o=fu(),s=z(),a=z(),l=z({top:"",left:"",position:""});let u=()=>{};function c(){!s.value||!a.value||(u=rS(s.value.$el,a.value,()=>{!s.value||!a.value||wy(s.value.$el,a.value,{placement:n.placement,middleware:[by(n.offset),ky()],platform:{...fd,getOffsetParent:v=>fd.getOffsetParent(v,sS)}}).then(({x:v,y:w})=>{l.value={top:`${w}px`,left:`${v}px`,position:"absolute"}})}))}hi(u),fp(()=>{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?y():k(),i.value=v,!0),f=I(()=>o.value.getRootNode()),m=I(()=>f.value instanceof ShadowRoot);function g(v){d(v,"dom")}function b(v){d(v,"shadow-dom")}function y(){window.addEventListener("keydown",h),m.value?(f.value.addEventListener("click",g),window.addEventListener("click",b)):window.addEventListener("click",g)}function k(){window.removeEventListener("keydown",h),m.value?(f.value.removeEventListener("click",g),window.removeEventListener("click",b)):window.removeEventListener("click",g)}return e({isOpen:i}),(v,w)=>(E(),O(Oe,null,[he(He,re({...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}]}),_s({_:2},[v.$slots["icon-left"]?{name:"icon-left",fn:ee(()=>[L(v.$slots,"icon-left")]),key:"0"}:void 0,v.$slots.trigger?{name:"default",fn:ee(()=>[L(v.$slots,"trigger")]),key:"1"}:void 0,v.$slots["icon-right"]?{name:"icon-right",fn:ee(()=>[L(v.$slots,"icon-right")]),key:"2"}:void 0]),1040,["class"]),(E(),H(ev,{to:v.teleportTo,disabled:!v.teleport},[he(mp,{name:"k-dropdown"},{default:ee(()=>[i.value?(E(),O("div",{key:0,class:Se(`k-dropdown k-dropdown--theme-${v.theme}`),style:kn(l.value),ref_key:"content",ref:a,onClick:w[1]||(w[1]=()=>!v.keepOpen&&p(!1))},[L(v.$slots,"default",{close:p.bind(null,!1)},()=>[(E(!0),O(Oe,null,_t(v.items,({action:x,icon:C,...M})=>(E(),H(He,re({ref_for:!0},M,{variant:"tertiary","icon-right":M.iconRight||C,onClick:()=>x()}),null,16,["icon-right","onClick"]))),256))])],6)):P("",!0)]),_:3})],8,["to","disabled"]))],64))}});function lS(t){return t!=null&&typeof t=="object"&&"$el"in t}function md(t){if(lS(t)){const e=t.$el;return qp(e)&&vi(e)==="#comment"?null:e}return t}function Ni(t){return typeof t=="function"?t():B(t)}function uS(t){return{name:"arrow",options:t,fn(e){const n=md(Ni(t.element));return n==null?{}:oS({element:n,padding:t.padding}).fn(e)}}}function xy(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function _f(t,e){const n=xy(t);return Math.round(e*n)/n}function cS(t,e,n){n===void 0&&(n={});const r=n.whileElementsMounted,i=I(()=>{var C;return(C=Ni(n.open))!=null?C:!0}),o=I(()=>Ni(n.middleware)),s=I(()=>{var C;return(C=Ni(n.placement))!=null?C:"bottom"}),a=I(()=>{var C;return(C=Ni(n.strategy))!=null?C:"absolute"}),l=I(()=>{var C;return(C=Ni(n.transform))!=null?C:!0}),u=I(()=>md(t.value)),c=I(()=>md(e.value)),d=z(0),h=z(0),p=z(a.value),f=z(s.value),m=It({}),g=z(!1),b=I(()=>{const C={position:p.value,left:"0",top:"0"};if(!c.value)return C;const M=_f(c.value,d.value),T=_f(c.value,h.value);return l.value?{...C,transform:"translate("+M+"px, "+T+"px)",...xy(c.value)>=1.5&&{willChange:"transform"}}:{position:p.value,left:M+"px",top:T+"px"}});let y;function k(){if(u.value==null||c.value==null)return;const C=i.value;wy(u.value,c.value,{middleware:o.value,placement:s.value,strategy:a.value}).then(M=>{d.value=M.x,h.value=M.y,p.value=M.strategy,f.value=M.placement,m.value=M.middlewareData,g.value=C!==!1})}function v(){typeof y=="function"&&(y(),y=void 0)}function w(){if(v(),r===void 0){k();return}if(u.value!=null&&c.value!=null){y=r(u.value,c.value,k);return}}function x(){i.value||(g.value=!1)}return we([o,s,a,i],k,{flush:"sync"}),we([u,c],w,{flush:"sync"}),we(i,x,{flush:"sync"}),Zg()&&Qg(v),{x:Ci(d),y:Ci(h),strategy:Ci(p),placement:Ci(f),middlewareData:Ci(m),isPositioned:Ci(g),floatingStyles:b,update:k}}const dS=["innerHTML"],pS=Q({__name:"ColumnLabel",props:{label:{},tooltip:{}},setup(t){const e=t,n=z(!1),r=z(!1),i=z(!1),o=z(null),s=z(null),a=z(null),{floatingStyles:l,middlewareData:u,placement:c,update:d}=cS(o,s,{placement:"top",middleware:[by(8),ky(),iS({padding:8}),uS({element:a})]}),h=I(()=>{const{x:b,y}=u.value.arrow||{},k={left:b!=null?`${b}px`:"",top:y!=null?`${y}px`:""},v=c.value||"top";return v.startsWith("top")&&(k.bottom="-6px"),v.startsWith("bottom")&&(k.top="-6px"),v.startsWith("left")&&(k.right="-6px"),v.startsWith("right")&&(k.left="-6px"),k});fp(()=>{n.value=i.value||r.value,n.value&&d()});const p=()=>{i.value=!0,r.value=!1},f=()=>{i.value=!1,r.value=!1},m=b=>{r.value=!r.value,b.stopPropagation()},g=()=>{r.value=!1};return Tn(()=>{document.addEventListener("click",g)}),hi(()=>{document.removeEventListener("click",g)}),(b,y)=>(E(),O(Oe,null,[U("span",{ref_key:"labelEl",ref:o,onClick:m,onMouseenter:p,onMouseleave:f,innerHTML:e.label},null,40,dS),n.value&&e.tooltip?(E(),O("div",{key:0,class:"k-datatable-label__tooltip",ref_key:"tooltipEl",ref:s,style:kn(B(l))},[Be(oe(e.tooltip)+" ",1),U("div",{ref_key:"arrowEl",ref:a,style:kn(h.value),class:"k-datatable-label__tooltip-arrow"},null,4)],4)):P("",!0)],64))}}),hS={key:0,class:"k-datatable__row"},fS={key:0,class:"k-datatable__cell k-datatable__cell-select"},mS=["data-col-id","onClick"],gS={key:1,class:"k-datatable__cell k-datatable__cell-actions"},vS={key:0,class:"k-datatable__cell k-datatable__cell-select"},yS={key:1,class:"k-datatable__cell k-datatable__cell-actions"},bS={key:0,class:"k-datatable__footer"},LL=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=yp(),i=e,o=z([-1]),s=I(()=>n.items.filter(f=>!n.isDisabled(f))),a=I(()=>!!n.selected),l=I(()=>!!(Object.keys(n.sortBy||{}).length&&n.sortableBy.length)),u=I(()=>!!r.rowActions),c=I({get:()=>!!(s.value.length&&s.value.every(f=>n.selected&&n.selected.includes(f))),set:f=>i("update:selected",f?[...s.value]:[])}),d=I(()=>[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,b=[];if(f.shiftKey){let y=g>m,k=g+(y?-1:1);for(;y?k>m:k<m;){let v=n.items[k];!(n.selected||[]).includes(v)&&!n.isDisabled(v)&&b.push(v),y?k--:k++}}f.target.checked?o.value.push(m):g===m&&o.value.pop(),i("update:selected",[...n.selected||[],...b])}return(f,m)=>(E(),O("div",{class:Se([`k-datatable k-datatable--${f.theme}`,{"k-datatable--sticky":!!f.sticky,"k-datatable--no-header":!f.header}]),style:kn(`--k-datatable-layout: ${d.value}; --k-datatable-sticky-top: ${typeof f.sticky=="string"?f.sticky:"0"}`)},[f.header?(E(),O("div",hS,[a.value?(E(),O("div",fS,[he(gf,{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"])])):P("",!0),(E(!0),O(Oe,null,_t(f.columns.filter(({disabled:g})=>!g),g=>(E(),O("div",{class:Se(["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:b=>h(g.id)},[L(f.$slots,`${g.id}-label`,{item:g},()=>[he(pS,{label:g.label,tooltip:g.tooltip},null,8,["label","tooltip"])]),he(B(Qe),{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,mS))),128)),u.value?(E(),O("div",gS)):P("",!0)])):P("",!0),(E(!0),O(Oe,null,_t(f.items,(g,b)=>(E(),O("div",{class:"k-datatable__row",key:f.sortBy?g?.id||B(Qt)():b},[a.value?(E(),O("div",vS,[he(gf,{class:"k-datatable__checkbox","model-value":f.selected||[],"onUpdate:modelValue":m[1]||(m[1]=y=>i("update:selected",y)),value:g,onMousedown:m[2]||(m[2]=Ka(()=>{},["prevent"])),onClick:y=>p(y,b),disabled:f.isDisabled(g)},null,8,["model-value","value","onClick","disabled"])])):P("",!0),(E(),H(et(f.rowWrapper(g).component),re({class:"k-datatable__row-wrapper",ref_for:!0},f.rowWrapper(g).bind,nv(f.rowWrapper(g).listeners)),{default:ee(()=>[(E(!0),O(Oe,null,_t(f.columns.filter(({disabled:y})=>!y),(y,k)=>(E(),H(et(f.cellWrapper(g,y).component),re({ref_for:!0},f.cellWrapper(g,y).bind,{class:`k-datatable__cell k-datatable__cell--text-align-${y.align||"start"}`,key:`col-${y.id}`,"data-cell-id":y.id}),{default:ee(()=>[L(f.$slots,y.id,{item:g,column:y,rowIndex:b,colIndex:k})]),_:2},1040,["class","data-cell-id"]))),128))]),_:2},1040)),f.$slots["row-actions"]?(E(),O("div",yS,[L(f.$slots,"row-actions",{item:g})])):P("",!0)]))),128)),he(mp,{name:"k-datatable-footer"},{default:ee(()=>{var g,b;return[f.$slots.footer||(g=f.selected)!=null&&g.length?(E(),O("div",bS,[(b=f.selected)!=null&&b.length?(E(),H(Eu,{key:0,label:`${f.labels.selection} (${f.selected.length})`,teleport:!0},{default:ee(()=>[L(f.$slots,"select-actions"),he(He,{label:f.labels.resetSelection,"icon-right":"fa-pro-light:times-square",variant:"tertiary",onClick:m[3]||(m[3]=y=>i("update:selected",[]))},null,8,["label"])]),_:3},8,["label"])):P("",!0),L(f.$slots,"footer")])):P("",!0)]}),_:3})],6))}});var kS=$n("radio-group").parts("root","label","item","itemText","itemControl","indicator"),Ti=kS.build(),il=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`},Ey=(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}`},gd=(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}`},wS=(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}`},xS=(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}`},Cy=t=>{var e;return((e=t.ids)==null?void 0:e.indicator)??`radio-group:${t.id}:indicator`},Cu=t=>t.getById(il(t)),ES=(t,e)=>t.getById(gd(t,e)),CS=t=>t.getById(Cy(t)),SS=t=>{var e;return(e=Cu(t))==null?void 0:e.querySelector("input:not(:disabled)")},TS=t=>{var e;return(e=Cu(t))==null?void 0:e.querySelector("input:not(:disabled):checked")},If=t=>{const e=`input[type=radio][data-ownedby='${CSS.escape(il(t))}']:not([disabled])`;return Np(Cu(t),e)},OS=(t,e)=>{if(e)return t.getById(Ey(t,e))},AS=t=>({left:t?.offsetLeft??0,top:t?.offsetTop??0,width:t?.offsetWidth??0,height:t?.offsetHeight??0}),MS=t=>({width:`${t.width}px`,height:`${t.height}px`,left:`${t.left}px`,top:`${t.top}px`});function _S(t,e){const{context:n,send:r,computed:i,prop:o,scope:s}=t,a=i("isDisabled"),l=o("readOnly");function u(h){const p=n.get("focusedValue")===h.value,f=p&&ps();return{value:h.value,invalid:!!h.invalid,disabled:!!h.disabled||a,checked:n.get("value")===h.value,focused:p,focusVisible:f,hovered:n.get("hoveredValue")===h.value,active:n.get("activeValue")===h.value}}function c(h){const p=u(h);return{"data-focus":J(p.focused),"data-focus-visible":J(p.focusVisible),"data-disabled":J(p.disabled),"data-readonly":J(l),"data-state":p.checked?"checked":"unchecked","data-hover":J(p.hovered),"data-invalid":J(p.invalid),"data-orientation":o("orientation"),"data-ssr":J(n.get("ssr"))}}const d=()=>{const h=TS(s)??SS(s);h?.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({...Ti.root.attrs,role:"radiogroup",id:il(s),"aria-labelledby":Df(s),"data-orientation":o("orientation"),"data-disabled":J(a),"aria-orientation":o("orientation"),dir:o("dir"),style:{position:"relative"}})},getLabelProps(){return e.element({...Ti.label.attrs,dir:o("dir"),"data-orientation":o("orientation"),"data-disabled":J(a),id:Df(s),onClick:d})},getItemState:u,getItemProps(h){const p=u(h);return e.label({...Ti.item.attrs,dir:o("dir"),id:Ey(s,h.value),htmlFor:gd(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})},onClick(){var f;!p.disabled&&Ap()&&((f=ES(s,h.value))==null||f.focus())}})},getItemTextProps(h){return e.element({...Ti.itemText.attrs,dir:o("dir"),id:xS(s,h.value),...c(h)})},getItemControlProps(h){const p=u(h);return e.element({...Ti.itemControl.attrs,dir:o("dir"),id:wS(s,h.value),"data-active":J(p.active),"aria-hidden":!0,...c(h)})},getItemHiddenInputProps(h){const p=u(h);return e.input({"data-ownedby":il(s),id:gd(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})},onFocus(){r({type:"SET_FOCUSED",value:h.value,focused:!0})},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:Rp})},getIndicatorProps(){const h=n.get("indicatorRect");return e.element({id:Cy(s),...Ti.indicator.attrs,dir:o("dir"),hidden:n.get("value")==null,"data-disabled":J(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:DS}=pu(),IS={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})),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:DS("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 cu(Cu(e),{onFieldsetDisabledChange(n){t.set("fieldsetDisabled",n)},onFormReset(){t.set("value",t.initial("value"))}})},trackFocusVisible({scope:t}){var e;return Pp({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)},syncInputElements({context:t,scope:e}){If(e).forEach(n=>{n.checked=n.value===t.get("value")})},setIndicatorTransition({context:t}){t.set("canIndicatorTransition",Pv(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(),!CS(e))return;const i=t.get("value"),o=OS(e,i);if(i==null||!o){t.set("canIndicatorTransition",!1),t.set("indicatorRect",{});return}const s=Mv([o],{measure(a){return AS(a)},onEntry({rects:a}){t.set("indicatorRect",MS(a[0]))}});n.set("indicatorCleanup",s)},dispatchChangeEvent({context:t,scope:e}){If(e).forEach(n=>{const r=n.value===t.get("value");r!==n.checked&&Dp(n,{checked:r})})}}}};Kn()(["dir","disabled","form","getRootNode","id","ids","name","onValueChange","orientation","readOnly","value","defaultValue"]);Kn()(["value","disabled","invalid"]);const NS=["aria-describedby"],BL=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=vp(hu,I(()=>({label:""}))),r=t,i=e,o=gi(IS,{id:Qt(),name:Qt(),...r,defaultValue:r.modelValue,onValueChange:({value:a})=>i("update:modelValue",a)}),s=I(()=>_S(o,mi));return we(()=>r.modelValue,a=>s.value.setValue(a)),(a,l)=>(E(),O("div",re({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(re({key:0},s.value.getLabelProps())),oe(B(n).label||a.label),17)):P("",!0),a.variant==="segment"?(E(),O("div",be(re({key:1},s.value.getIndicatorProps())),null,16)):P("",!0),(E(!0),O(Oe,null,_t(a.items,u=>(E(),O("label",re({ref_for:!0},s.value.getItemProps({value:u.id})),[U("span",re({ref_for:!0},s.value.getItemTextProps({value:u.id})),oe(u.label),17),U("input",re({ref_for:!0},s.value.getItemHiddenInputProps({value:u.id})),null,16),U("div",re({ref_for:!0},s.value.getItemControlProps({value:u.id})),null,16)],16))),256))],16,NS))}}),VL=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=I(()=>hv("grid",{columns:n(e.columns,"1fr"),align:Ka(e.align)||"initial",rows:n(e.rows,"auto"),gap:bp(e.gap),areas:r(e.areas)||"unset"}));return(o,s)=>(E(),z(Qe(o.is),{class:"k-grid",style:kn(i.value)},{default:ee(()=>[L(o.$slots,"default")]),_:3},8,["style"]))}});function ky(t){return t?t.flatMap(e=>{const{type:n,children:r}=e;return n===Oe?ky(r):[e]}):[]}const TL=Q({props:{area:String,align:String},inheritAttrs:!1,setup({area:t,align:e},{slots:n}){return()=>{if(!n.default)return null;const[r]=ky(n.default());if(!r)return null;const i=re({style:{"--k-grid-item-area":t,"--k-grid-item-align-self":Ka(e)||"initial"}},r.props??{});return Ok(r,i)}}}),TS={key:0,class:"k-scroller__indicator"},OL=Q({__name:"Scroller",props:{is:{default:"div"},appearance:{default:"default"},treshhold:{default:80}},setup(t){const e=pu(),n=Qt({prefix:"k-scroller-"}),r=t,i=H({top:!1,right:!1,left:!1,bottom:!1}),o=I(()=>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 Tn(()=>{const a=e.value;a&&(Pp(a,"scroll",()=>s(a)),nE(a,()=>s(a),{childList:!0,subtree:!0}))}),(a,l)=>(E(),z(Qe(a.is),{id:B(n),class:Se([`k-scroller k-scroller--appearance-${a.appearance}`,...o.value.map(u=>`k-scroller--scrolled-to-${u}`)])},{default:ee(()=>[a.appearance==="indicator"?(E(),O("div",TS,[L(a.$slots,"indicator",{},()=>[he(B(Ze),{icon:"fa-pro-thin:arrow-right"})])])):P("",!0),L(a.$slots,"default")]),_:3},8,["id","class"]))}});var Ti=new WeakMap,oa=new WeakMap,sa={},ec=0,wy=t=>t&&(t.host||wy(t.parentNode)),OS=(t,e)=>e.map(n=>{if(t.contains(n))return n;const r=wy(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),AS=t=>t.localName==="next-route-announcer"||t.localName==="script"||t.hasAttribute("aria-live")?!0:t.matches("[data-live-announcer]"),MS=(t,e)=>{const{parentNode:n,markerName:r,controlAttribute:i}=e,o=OS(n,Array.isArray(t)?t:[t]);sa[r]||(sa[r]=new WeakMap);const s=sa[r],a=[],l=new Set,u=new Set(o),c=h=>{!h||l.has(h)||(l.add(h),c(h.parentNode))};o.forEach(c);const d=h=>{!h||u.has(h)||Array.prototype.forEach.call(h.children,p=>{if(l.has(p))d(p);else try{if(AS(p))return;const f=p.getAttribute(i)==="true",m=(Ti.get(p)||0)+1,g=(s.get(p)||0)+1;Ti.set(p,m),s.set(p,g),a.push(p),m===1&&f&&oa.set(p,!0),g===1&&p.setAttribute(r,""),f||p.setAttribute(i,"true")}catch(f){console.error("[zag-js > ariaHidden] cannot operate on ",p,f)}})};return d(n),l.clear(),ec++,()=>{a.forEach(h=>{const p=Ti.get(h)-1,f=s.get(h)-1;Ti.set(h,p),s.set(h,f),p||(oa.has(h)||h.removeAttribute(i),oa.delete(h)),f||h.removeAttribute(r)}),ec--,ec||(Ti=new WeakMap,Ti=new WeakMap,oa=new WeakMap,sa={})}},_S=t=>(Array.isArray(t)?t[0]:t).ownerDocument.body,DS=(t,e=_S(t),n="data-aria-hidden")=>{if(e)return MS(t,{parentNode:e,markerName:n,controlAttribute:"aria-hidden"})},IS=t=>{const e=requestAnimationFrame(()=>t());return()=>cancelAnimationFrame(e)};function NS(t,e={}){const{defer:n=!0}=e,r=n?IS:o=>o(),i=[];return i.push(r(()=>{const o=(typeof t=="function"?t():t).filter(Boolean);o.length!==0&&i.push(DS(o))})),()=>{i.forEach(o=>o?.())}}function RS(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 PS(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 Af="pointerdown.outside",Mf="focus.outside";function FS(t){for(const e of t)if(st(e)&&hr(e))return!0;return!1}var xy=t=>"clientY"in t;function LS(t,e){if(!xy(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 BS(t,e){return t.y<=e.y&&e.y<=t.y+t.height&&t.x<=e.x&&e.x<=t.x+t.width}function _f(t,e){if(!e||!xy(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 BS(s,a)?r||o:!1}function VS(t,e){const{exclude:n,onFocusOutside:r,onPointerDownOutside:i,onInteractOutside:o,defer:s}=e;if(!t)return;const a=Wt(t),l=pt(t),u=RS(l),c=PS(l);function d(y,k){if(!st(k)||!k.isConnected||Xi(t,k)||LS(t,y))return!1;const v=a.querySelector(`[aria-controls="${t.id}"]`);if(v){const x=Yc(v);if(_f(y,x))return!1}const w=Yc(t);return _f(y,w)?!1:!(n!=null&&n(k))}const h=new Set,p=cs(t?.getRootNode());function f(y){function k(v){var w;const x=s&&!tf()?Ot:T=>T(),C=v??y,M=((w=C?.composedPath)==null?void 0:w.call(C))??[C?.target];x(()=>{const T=p?M[0]:dt(y);if(!(!t||!d(y,T))){if(i||o){const A=of(i,o);t.addEventListener(Af,A,{once:!0})}Df(t,Af,{bubbles:!1,cancelable:!0,detail:{originalEvent:C,contextmenu:wx(C),focusable:FS(M),target:T}})}})}y.pointerType==="touch"?(h.forEach(v=>v()),h.add(Ne(a,"click",k,{once:!0})),h.add(c.addEventListener("click",k,{once:!0})),h.add(u.addEventListener("click",k,{once:!0}))):k()}const m=new Set,g=setTimeout(()=>{m.add(Ne(a,"pointerdown",f,!0)),m.add(c.addEventListener("pointerdown",f,!0)),m.add(u.addEventListener("pointerdown",f,!0))},0);function b(y){(s?Ot:k=>k())(()=>{const k=dt(y);if(!(!t||!d(y,k))){if(r||o){const v=of(r,o);t.addEventListener(Mf,v,{once:!0})}Df(t,Mf,{bubbles:!1,cancelable:!0,detail:{originalEvent:y,contextmenu:!1,focusable:hr(k),target:k}})}})}return tf()||(m.add(Ne(a,"focusin",b,!0)),m.add(c.addEventListener("focusin",b,!0)),m.add(u.addEventListener("focusin",b,!0))),()=>{clearTimeout(g),h.forEach(y=>y()),m.forEach(y=>y())}}function $S(t,e){const{defer:n}=e,r=n?Ot:o=>o(),i=[];return i.push(r(()=>{const o=typeof t=="function"?t():t;i.push(VS(o,e))})),()=>{i.forEach(o=>o?.())}}function Df(t,e,n){const r=t.ownerDocument.defaultView||window,i=new r.CustomEvent(e,n);return t.dispatchEvent(i)}function jS(t,e){const n=r=>{r.key==="Escape"&&(r.isComposing||e==null||e(r))};return Ne(Wt(t),"keydown",n,{capture:!0})}var Kt={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=>Xi(n.node,e))},isInBranch(t){return Array.from(this.branches).some(e=>Xi(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)}},If;function Nf(){Kt.layers.forEach(({node:t})=>{t.style.pointerEvents=Kt.isBelowPointerBlockingLayer(t)?"none":"auto"})}function zS(t){t.style.pointerEvents=""}function HS(t,e){const n=Wt(t),r=[];if(Kt.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(If=document.body.style.pointerEvents,queueMicrotask(()=>{n.body.style.pointerEvents="none",n.body.setAttribute("data-inert","")})),e){const i=Yx(e,o=>{r.push(Zc(o,{pointerEvents:"auto"}))});r.push(i)}return()=>{Kt.hasPointerBlockingLayer()||(queueMicrotask(()=>{n.body.style.pointerEvents=If,n.body.removeAttribute("data-inert"),n.body.style.length===0&&n.body.removeAttribute("style")}),r.forEach(i=>i()))}}function qS(t,e){const{warnOnMissingNode:n=!0}=e;if(n&&!t){nd("[@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};Kt.add(a),Nf();function l(p){var f,m;const g=dt(p.detail.originalEvent);Kt.isBelowPointerBlockingLayer(t)||Kt.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=dt(p.detail.originalEvent);Kt.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;Kt.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],b=(f=e.persistentElements)==null?void 0:f.map(y=>y()).filter(st);return b&&g.push(...b),g.some(y=>Xi(y,p))||Kt.isInNestedLayer(t,p)}const h=[i?HS(t,e.persistentElements):void 0,jS(t,c),$S(t,{exclude:d,onFocusOutside:u,onPointerDownOutside:l,defer:e.defer})];return()=>{Kt.remove(t),Nf(),zS(t),h.forEach(p=>p?.())}}function WS(t,e){const{defer:n}=e,r=n?Ot:o=>o(),i=[];return i.push(r(()=>{const o=$i(t)?t():t;i.push(qS(o,e))})),()=>{i.forEach(o=>o?.())}}var US=Object.defineProperty,KS=(t,e,n)=>e in t?US(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Te=(t,e,n)=>KS(t,typeof e!="symbol"?e+"":e,n),Rf={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()}},GS=[],JS=class{constructor(t,e){Te(this,"trapStack"),Te(this,"config"),Te(this,"doc"),Te(this,"state",{containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0}),Te(this,"listenerCleanups",[]),Te(this,"handleFocus",r=>{const i=dt(r),o=this.findContainerIndex(i,r)>=0;if(o||kp(i))o&&(this.state.mostRecentlyFocusedNode=i);else{r.stopImmediatePropagation();let s,a=!0;if(this.state.mostRecentlyFocusedNode)if(Eo(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=>Eo(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}),Te(this,"handlePointerDown",r=>{const i=dt(r);if(!(this.findContainerIndex(i,r)>=0)){if(So(this.config.clickOutsideDeactivates,r)){this.deactivate({returnFocus:this.config.returnFocusOnDeactivate});return}So(this.config.allowOutsideClick,r)||r.preventDefault()}}),Te(this,"handleClick",r=>{const i=dt(r);this.findContainerIndex(i,r)>=0||So(this.config.clickOutsideDeactivates,r)||So(this.config.allowOutsideClick,r)||(r.preventDefault(),r.stopImmediatePropagation())}),Te(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;Co(r)&&r.preventDefault(),this.tryFocus(o)}}),Te(this,"handleEscapeKey",r=>{YS(r)&&So(this.config.escapeDeactivates,r)!==!1&&(r.preventDefault(),this.deactivate())}),Te(this,"_mutationObserver"),Te(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())})}),Te(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})})}),Te(this,"getInitialFocusNode",()=>{let r=this.getNodeForOption("initialFocus",{hasFallback:!0});if(r===!1)return!1;if(r===void 0||r&&!hr(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}),Te(this,"tryFocus",r=>{if(r!==!1&&r!==gv(this.doc)){if(!r||!r.focus){this.tryFocus(this.getInitialFocusNode());return}r.focus({preventScroll:!!this.config.preventScroll}),this.state.mostRecentlyFocusedNode=r,XS(r)&&r.select()}}),Te(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(),Rf.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=()=>{Pf(()=>{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}),Te(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}),Te(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}),Te(this,"updateContainerElements",r=>(this.state.containers=Array.isArray(r)?r.filter(Boolean):[r].filter(Boolean),this.state.active&&this.updateTabbableNodes(),this.updateObservedNodes(),this)),Te(this,"getReturnFocusNode",r=>{const i=this.getNodeForOption("setReturnFocus",{params:[r]});return i||(i===!1?!1:r)}),Te(this,"getOption",(r,i,o)=>r&&r[i]!==void 0?r[i]:this.config[o||i]),Te(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}),Te(this,"findNextNavNode",r=>{const{event:i,isBackward:o=!1}=r,s=r.target||dt(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||hr(s)&&!Br(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=Eo(s)>=0?h.lastTabbableNode:h.lastDomTabbableNode}else Co(i)||(a=u?.nextTabbableNode(s,!1))}else{let c=this.state.tabbableGroups.findIndex(({lastTabbableNode:d})=>s===d);if(c<0&&(u?.container===s||hr(s)&&!Br(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=Eo(s)>=0?h.firstTabbableNode:h.firstDomTabbableNode}else Co(i)||(a=u?.nextTabbableNode(s))}}else a=this.getNodeForOption("fallbackFocus");return a}),this.trapStack=e.trapStack||GS;const n={returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward(r){return Co(r)&&!r.shiftKey},isKeyBackward(r){return Co(r)&&r.shiftKey},...e};this.doc=n.document||Wt(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=xv(t),n=wv(t),r=e.length>0?e[0]:void 0,i=e.length>0?e[e.length-1]:void 0,o=n.find(u=>Br(u)),s=n.slice().reverse().find(u=>Br(u)),a=!!e.find(u=>Eo(u)>0);function l(u,c=!0){const d=e.indexOf(u);return d<0?c?n.slice(n.indexOf(u)+1).find(h=>Br(h)):n.slice(0,n.indexOf(u)).reverse().find(h=>Br(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 Rf.activateTrap(this.trapStack,this),this.state.delayInitialFocusTimer=this.config.delayInitialFocus?Pf(()=>{this.tryFocus(this.getInitialFocusNode())}):this.tryFocus(this.getInitialFocusNode()),this.listenerCleanups.push(Ne(this.doc,"focusin",this.handleFocus,!0),Ne(this.doc,"mousedown",this.handlePointerDown,{capture:!0,passive:!1}),Ne(this.doc,"touchstart",this.handlePointerDown,{capture:!0,passive:!1}),Ne(this.doc,"click",this.handleClick,{capture:!0,passive:!1}),Ne(this.doc,"keydown",this.handleTabKey,{capture:!0,passive:!1}),Ne(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)}},Co=t=>t.key==="Tab",So=(t,...e)=>typeof t=="function"?t(...e):t,YS=t=>!t.isComposing&&t.key==="Escape",Pf=t=>setTimeout(t,0),XS=t=>t.localName==="input"&&"select"in t&&typeof t.select=="function";function ZS(t,e={}){let n;const r=Ot(()=>{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:Wt(i)});try{n.activate()}catch{}}});return function(){n?.deactivate(),r()}}var tc="data-scroll-lock";function QS(t){const e=t.getBoundingClientRect().left;return Math.round(e)+t.scrollLeft?"paddingLeft":"paddingRight"}function eT(t){const e=t??document,n=e.defaultView??window,{documentElement:r,body:i}=e;if(i.hasAttribute(tc))return;i.setAttribute(tc,"");const o=n.innerWidth-r.clientWidth,s=()=>Kx(r,"--scrollbar-width",`${o}px`),a=QS(r),l=()=>Zc(i,{overflow:"hidden",[a]:`${o}px`}),u=()=>{const{scrollX:d,scrollY:h,visualViewport:p}=n,f=p?.offsetLeft??0,m=p?.offsetTop??0,g=Zc(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(),su()?u():l()];return()=>{c.forEach(d=>d?.()),i.removeAttribute(tc)}}var tT=$n("dialog").parts("trigger","backdrop","positioner","content","title","description","closeTrigger"),Rr=tT.build(),Ey=t=>{var e;return((e=t.ids)==null?void 0:e.positioner)??`dialog:${t.id}:positioner`},Cy=t=>{var e;return((e=t.ids)==null?void 0:e.backdrop)??`dialog:${t.id}:backdrop`},hd=t=>{var e;return((e=t.ids)==null?void 0:e.content)??`dialog:${t.id}:content`},Sy=t=>{var e;return((e=t.ids)==null?void 0:e.trigger)??`dialog:${t.id}:trigger`},fd=t=>{var e;return((e=t.ids)==null?void 0:e.title)??`dialog:${t.id}:title`},md=t=>{var e;return((e=t.ids)==null?void 0:e.description)??`dialog:${t.id}:description`},Ty=t=>{var e;return((e=t.ids)==null?void 0:e.closeTrigger)??`dialog:${t.id}:close`},aa=t=>t.getById(hd(t)),nT=t=>t.getById(Ey(t)),rT=t=>t.getById(Cy(t)),iT=t=>t.getById(Sy(t)),oT=t=>t.getById(fd(t)),sT=t=>t.getById(md(t)),aT=t=>t.getById(Ty(t));function lT(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){n.matches("open")!==u&&r({type:u?"OPEN":"CLOSE"})},getTriggerProps(){return e.button({...Rr.trigger.attrs,dir:o("dir"),id:Sy(s),"aria-haspopup":"dialog",type:"button","aria-expanded":l,"data-state":l?"open":"closed","aria-controls":hd(s),onClick(u){u.defaultPrevented||r({type:"TOGGLE"})}})},getBackdropProps(){return e.element({...Rr.backdrop.attrs,dir:o("dir"),hidden:!l,id:Cy(s),"data-state":l?"open":"closed"})},getPositionerProps(){return e.element({...Rr.positioner.attrs,dir:o("dir"),id:Ey(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:hd(s),tabIndex:-1,"data-state":l?"open":"closed","aria-modal":!0,"aria-label":a||void 0,"aria-labelledby":a||!u.title?void 0:fd(s),"aria-describedby":u.description?md(s):void 0})},getTitleProps(){return e.element({...Rr.title.attrs,dir:o("dir"),id:fd(s)})},getDescriptionProps(){return e.element({...Rr.description.attrs,dir:o("dir"),id:md(s)})},getCloseTriggerProps(){return e.button({...Rr.closeTrigger.attrs,dir:o("dir"),id:Ty(s),type:"button",onClick(u){u.defaultPrevented||(u.stopPropagation(),r({type:"CLOSE"}))}})}}}var uT={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?()=>aT(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 WS(()=>aa(t),{defer:!0,pointerBlocking:n("modal"),exclude:[iT(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 eT(t.getDoc())},trapFocus({scope:t,prop:e}){return!e("trapFocus")||!e("modal")?void 0:ZS(()=>aa(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")?NS(()=>[aa(t)],{defer:!0}):void 0}},actions:{checkRenderedElements({context:t,scope:e}){Ot(()=>{t.set("rendered",{title:!!oT(e),description:!!sT(e)})})},syncZIndex({scope:t}){Ot(()=>{const e=aa(t);if(!e)return;const n=lx(e);[nT(t),rT(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})}}}};Kn()(["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 cT=["data-id"],dT=["data-id"],pT=["data-id"],hT=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=pu(),s=mi(uT,{id:Qt({prefix:"dialog"}),closeOnEscape:r.closeOnEsc,modal:!0,closeOnInteractOutside:!1,onOpenChange({open:u}){i(u?"open":"close")},onInteractOutside(u){if(!r.closeOnOutsideClick)return u.preventDefault()},onPointerDownOutside(){i("clickoutside"),r.closeOnOutsideClick&&a.value.setOpen(!1)},getRootNode:()=>{var u;return r.teleport?document:(u=o.value)==null?void 0:u.getRootNode()},...r}),a=I(()=>lT(s,fi)),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},[L(u.$slots,"trigger",{triggerProps:a.value.getTriggerProps()},()=>[u.triggerLabel?(E(),z(He,re({key:0,class:"k-dialog__trigger",variant:"secondary"},a.value.getTriggerProps(),{disabled:u.disabled}),{default:ee(()=>[Be(oe(u.triggerLabel),1)]),_:1},16,["disabled"])):P("",!0)]),(E(),z(Kg,{to:"body",disabled:!u.teleport},[a.value.open?(E(),O(Oe,{key:0},[U("div",re({class:"k-dialog__backdrop"},a.value.getBackdropProps(),{"data-id":l("backdrop")}),null,16,dT),U("div",re({class:`k-dialog__container k-dialog--align-${u.alignment}`},a.value.getPositionerProps(),{"data-id":l("container")}),[he(WE,re({class:"k-dialog__card",variant:u.variant,appearance:"shadow"},a.value.getContentProps(),{"data-id":l("dialog"),thumbnail:u.thumbnail,thumbnailOptions:u.thumbnailOptions}),Ms({_:2},[u.$slots.header||u.$slots.title||u.$slots.subtitle||u.title||u.subtitle||u.showCloseTrigger?{name:"header",fn:ee(()=>[L(u.$slots,"header",{titleProps:a.value.getTitleProps(),descriptionProps:a.value.getDescriptionProps(),closeTriggerProps:a.value.getCloseTriggerProps()},()=>[L(u.$slots,"title",{titleProps:a.value.getTitleProps()},()=>[u.title?(E(),O("div",re({key:0,class:"k-dialog__title k-card__title"},a.value.getTitleProps()),oe(u.title),17)):P("",!0)]),L(u.$slots,"subtitle",{descriptionProps:a.value.getDescriptionProps()},()=>[u.subtitle?(E(),O("div",re({key:0,class:"k-dialog__subtitle k-card__subtitle"},a.value.getDescriptionProps()),oe(u.subtitle),17)):P("",!0)]),u.showCloseTrigger?(E(),z(He,re({key:0,class:"k-dialog__close-trigger",variant:"tertiary",icon:"fa-pro-light:times",size:"small"},a.value.getCloseTriggerProps()),null,16)):P("",!0)])]),key:"0"}:void 0,u.$slots.default?{name:"default",fn:ee(()=>[L(u.$slots,"default",{descriptionProps:a.value.getDescriptionProps()})]),key:"1"}:void 0,u.$slots.actions?{name:"actions",fn:ee(()=>[L(u.$slots,"actions",{close:()=>a.value.setOpen(!1)})]),key:"2"}:void 0]),1040,["variant","data-id","thumbnail","thumbnailOptions"])],16,pT)],64)):P("",!0)],8,["disabled"]))],8,cT))}});function Eu(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Cu(){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)}Cu.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)}}};Cu.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};Cu.prototype.getExtension=function(t){return t=/^\s*([^;\s]*)/.test(t)&&RegExp.$1,t&&this._extensions[t.toLowerCase()]||null};var fT=Cu,mT={"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 gT=fT;var vT=new gT(mT);const rl=Eu(vT);function Wp(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 Ff(t){return JSON.parse(JSON.stringify(t))}function Up(t,e,n={fromDirectory:!1}){var r;const{fromDirectory:i}=n,o=Array.isArray(e)?e:e?.split(","),s=((r=("name"in t?t.name:"").split(".").pop())==null?void 0:r.toLowerCase())||"",a="type"in t?t.type:"";return o!=null&&o.includes("directory")&&(i||!t.type)?!0:!t.type&&!e?!1:e?o.map(l=>l.trim()).some(l=>{if(l.startsWith(".")){const u=l.slice(1),c=rl.getType(u),d=rl.getType(s);return c&&a?c===a:!!(!a&&c&&d&&c===d||!c&&!a&&s===u)}return l.includes("*")?a.startsWith(l.replace("*","")):a===l}):!0}const Lf={counter:0,total:0,progress:0,bytes:0,result:[]};class Oy{constructor(e){Jt(this,"queue"),Jt(this,"upload"),Jt(this,"uploadOptions"),Jt(this,"accept"),this.queue=fp(Ff(Lf)),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,Ff(Lf))}async run(e){e=Array.from(e).filter(o=>Up(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 Bf={"image/*":["jpeg","png","gif"]};function yT(t){return t?(Array.isArray(t)?t:t.split(",")).map(e=>e.trim()).map(e=>e.startsWith(".")?e.substring(1):e in Bf?Bf[e]:rl.getExtension(e)).flat():[]}function gd(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,rl.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 bT={class:"k-media-thumbnail-actions"},Ay=Q({__name:"ThumbnailActions",props:{value:{},disabled:{type:Boolean}},emits:["delete"],setup(t,{emit:e}){const n=t,r=I(()=>n.value.type.startsWith("image/")?{component:"button",bind:{onClick:()=>{gd(n.value)}}}:{component:"a",bind:{href:n.value.url,download:n.value.name,target:"_blank"}});return(i,o)=>(E(),O("div",bT,[i.disabled?P("",!0):(E(),z(He,{key:0,class:"k-media-thumbnail-actions__delete",icon:"fa-pro-solid:trash",variant:"danger",onClick:o[0]||(o[0]=Wa(s=>i.$emit("delete"),["stop"]))})),he(He,re({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"])]))}}),kT=Q({__name:"Thumbnail",props:{value:{},size:{default:"4rem"},disabled:{type:Boolean}},setup(t){const e=t,n=cp(),r=I(()=>n["data-draggable"]),i=I(()=>{let s={};for(const a in n){if(a==="data-draggable")return;s[a]=n[a]}return s}),o=I(()=>({width:e.size,height:e.size}));return(s,a)=>(E(),O("div",re({class:"k-media-thumbnail"},r.value,{class:{"k-media-thumbnail--selected":s.value.selected}}),[(E(),z(Qe(s.value.typeConfig.components.Thumbnail),re({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(Ay,{value:s.value,disabled:s.disabled,onDelete:a[0]||(a[0]=l=>s.$emit("delete",s.value))},null,8,["value","disabled"])],16))}}),wT={key:0,class:"k-media-type-selector"},xT={class:"k-media-type-selector__info"},ET=Q({__name:"TypeSelector",props:{value:{},upload:{type:Function},labels:{}},emits:["add","cancel","success","openFileWindow"],setup(t,{emit:e}){const n=t,r=e,i=H(null),o=H(),s=H(!0),a=H(!1),l=H(),u=H();xe(a,g=>{var b,y;return g?(b=l.value)==null?void 0:b.open():(y=l.value)==null?void 0:y.close()},{immediate:!0});const c=I(()=>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 b=n.labels[g];return!b||typeof b=="string"?g:b.createLabel||g}return(g,b)=>c.value?P("",!0):(E(),O("div",wT,[U("span",xT,oe(g.labels.selectMessage),1),he(wu,{teleport:!0,label:g.labels.select,iconRight:"fa6-solid:plus",theme:"shadow",placement:"bottom-end"},{default:ee(()=>[(E(!0),O(Oe,null,Mt(g.value,y=>(E(),z(Qe(y.components.CreateTrigger),{key:y.name,label:m(y.name.toLowerCase()),onClick:k=>h(y)},null,8,["label","onClick"]))),128))]),_:1},8,["label"]),he(hT,{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:ee(()=>[i.value?(E(),z(Qe(i.value.components.Create),re({key:0,isValid:s.value,"onUpdate:isValid":b[0]||(b[0]=y=>s.value=y),upload:g.upload,labels:g.labels,name:i.value.name,ref_key:"creator",ref:u},g.$attrs),null,16,["isValid","upload","labels","name"])):P("",!0)]),footer:ee(()=>[he(He,{label:g.labels.cancel,type:"button",onClick:p},null,8,["label"]),he(He,{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)]))}}),CT=Q({__name:"Description",props:{modelValue:{},placeholder:{}},emits:["update:modelValue"],setup(t,{emit:e}){return(n,r)=>(E(),z(TE,{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"]))}}),ST={class:"k-media-uploader"},TT={class:"k-media-uploader__bar"},OT={class:"k-media-uploader__meta"},AT={key:0},MT={key:1},_T=Q({__name:"Uploader",props:{value:{},bytes:{},current:{default:1},total:{default:1}},setup(t){const e=t,n=I(()=>e.total>1),r=I(()=>Wp(e.bytes)),i=I(()=>Math.floor(e.value));return(o,s)=>(E(),O("div",ST,[U("div",null,oe(i.value)+" %",1),U("div",TT,[U("div",{class:"k-media-uploader__bar-value",style:kn({width:o.value+"%"})},null,4)]),U("div",OT,[n.value?(E(),O("div",AT,oe(o.current)+" / "+oe(o.total),1)):P("",!0),o.bytes?(E(),O("div",MT,"("+oe(r.value)+")",1)):P("",!0)])]))}}),DT=["innerHTML"],IT=Q({__name:"SlotHandler",props:{value:{}},setup(t){const e=t,n=I(()=>typeof e.value=="string"?e.value:void 0),r=I(()=>typeof e.value=="string"?"div":e.value);return(i,o)=>(E(),z(Qe(r.value),be(Re(i.$attrs)),{default:ee(()=>[n.value?(E(),O("span",{key:0,innerHTML:n.value},null,8,DT)):P("",!0)]),_:1},16))}}),NT={class:"k-media-droparea__instruction"},RT=["type","accept","required","disabled","multiple"],PT=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=H(!1),o=H(!0),s=H(),a=I(()=>!!(!n.required||n.value)),l=I(()=>n.disabled),u=I(()=>!l.value&&!d.total),{run:c,queue:d}=new Oy(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)&&xr(()=>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=>Up(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 b=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"}}}),y=()=>{var k;return(k=s.value)==null?void 0:k.click()};return(k,v)=>(E(),O(Oe,null,[U("div",{class:Se(B(b)({active:i.value,invalid:!o.value,selected:!!k.selected,disabled:l.value})),onDrop:f,onDragover:m,onDragleave:g},[L(k.$slots,"preview"),U("div",NT,[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,RT)):P("",!0),o.value?(E(),O(Oe,{key:1},[L(k.$slots,"drop-message",{},()=>[he(IT,{value:k.dropMessage},null,8,["value"])]),L(k.$slots,"default",{openFileWindow:y})],64)):(E(),z(B(Ze),{key:2,icon:"fa-pro-light:ban",style:{"font-size":"2rem"}})),L(k.$slots,"custom-message")]),!k.multiple&&k.selected?(E(),z(Ay,{key:0,value:k.selected,disabled:l.value,onDelete:v[0]||(v[0]=w=>k.$emit("remove",k.selected))},null,8,["value","disabled"])):P("",!0)],34),B(d).total?(E(),z(_T,{key:0,value:B(d).progress,bytes:B(d).bytes,current:B(d).counter,total:B(d).total},null,8,["value","bytes","current","total"])):P("",!0)],64))}}),FT=Q({__name:"CreateTrigger",props:{label:{}},setup(t){return(e,n)=>(E(),z(He,{type:"button",label:e.label,iconRight:"fa6-solid:image",size:"small",variant:"tertiary"},null,8,["label"]))}}),LT=Q({__name:"Thumbnail",props:{value:{}},setup(t){const e=t;return(n,r)=>(E(),z(vu,{class:"k-media-image__thumbnail",src:e.value.url,onClick:r[0]||(r[0]=i=>n.$emit("click"))},null,8,["src"]))}}),BT=Q({__name:"Preview",props:{value:{},size:{}},setup(t){const e=t;return(n,r)=>(E(),z(vu,{src:e.value.url,class:"k-media-image-preview",size:n.size,width:"100%",height:"100%"},null,8,["src","size"]))}}),VT={name:"Image",condition:t=>/^image\/.+/i.test(t.type),components:{CreateTrigger:Ta(FT),Thumbnail:Ta(LT),Preview:Ta(BT)}},$T={Image:VT};/**!
3
+ `)},i=I(()=>gv("grid",{columns:n(e.columns,"1fr"),align:Ja(e.align)||"initial",rows:n(e.rows,"auto"),gap:Sp(e.gap),areas:r(e.areas)||"unset"}));return(o,s)=>(E(),H(et(o.is),{class:"k-grid",style:kn(i.value)},{default:ee(()=>[L(o.$slots,"default")]),_:3},8,["style"]))}});function Sy(t){return t?t.flatMap(e=>{const{type:n,children:r}=e;return n===Oe?Sy(r):[e]}):[]}const $L=Q({props:{area:String,align:String},inheritAttrs:!1,setup({area:t,align:e},{slots:n}){return()=>{if(!n.default)return null;const[r]=Sy(n.default());if(!r)return null;const i=re({style:{"--k-grid-item-area":t,"--k-grid-item-align-self":Ja(e)||"initial"}},r.props??{});return Pk(r,i)}}}),RS={key:0,class:"k-scroller__indicator"},jL=Q({__name:"Scroller",props:{is:{default:"div"},appearance:{default:"default"},treshhold:{default:80}},setup(t){const e=fu(),n=Qt({prefix:"k-scroller-"}),r=t,i=z({top:!1,right:!1,left:!1,bottom:!1}),o=I(()=>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 Tn(()=>{const a=e.value;a&&(Vp(a,"scroll",()=>s(a)),cE(a,()=>s(a),{childList:!0,subtree:!0}))}),(a,l)=>(E(),H(et(a.is),{id:B(n),class:Se([`k-scroller k-scroller--appearance-${a.appearance}`,...o.value.map(u=>`k-scroller--scrolled-to-${u}`)])},{default:ee(()=>[a.appearance==="indicator"?(E(),O("div",RS,[L(a.$slots,"indicator",{},()=>[he(B(Qe),{icon:"fa-pro-thin:arrow-right"})])])):P("",!0),L(a.$slots,"default")]),_:3},8,["id","class"]))}});var Oi=new WeakMap,la=new WeakMap,ua={},nc=0,Ty=t=>t&&(t.host||Ty(t.parentNode)),PS=(t,e)=>e.map(n=>{if(t.contains(n))return n;const r=Ty(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),FS=t=>t.localName==="next-route-announcer"||t.localName==="script"||t.hasAttribute("aria-live")?!0:t.matches("[data-live-announcer]"),LS=(t,e)=>{const{parentNode:n,markerName:r,controlAttribute:i}=e,o=PS(n,Array.isArray(t)?t:[t]);ua[r]||(ua[r]=new WeakMap);const s=ua[r],a=[],l=new Set,u=new Set(o),c=h=>{!h||l.has(h)||(l.add(h),c(h.parentNode))};o.forEach(c);const d=h=>{!h||u.has(h)||Array.prototype.forEach.call(h.children,p=>{if(l.has(p))d(p);else try{if(FS(p))return;const f=p.getAttribute(i)==="true",m=(Oi.get(p)||0)+1,g=(s.get(p)||0)+1;Oi.set(p,m),s.set(p,g),a.push(p),m===1&&f&&la.set(p,!0),g===1&&p.setAttribute(r,""),f||p.setAttribute(i,"true")}catch(f){console.error("[zag-js > ariaHidden] cannot operate on ",p,f)}})};return d(n),l.clear(),nc++,()=>{a.forEach(h=>{const p=Oi.get(h)-1,f=s.get(h)-1;Oi.set(h,p),s.set(h,f),p||(la.has(h)||h.removeAttribute(i),la.delete(h)),f||h.removeAttribute(r)}),nc--,nc||(Oi=new WeakMap,Oi=new WeakMap,la=new WeakMap,ua={})}},BS=t=>(Array.isArray(t)?t[0]:t).ownerDocument.body,VS=(t,e=BS(t),n="data-aria-hidden")=>{if(e)return LS(t,{parentNode:e,markerName:n,controlAttribute:"aria-hidden"})},$S=t=>{const e=requestAnimationFrame(()=>t());return()=>cancelAnimationFrame(e)};function jS(t,e={}){const{defer:n=!0}=e,r=n?$S:o=>o(),i=[];return i.push(r(()=>{const o=(typeof t=="function"?t():t).filter(Boolean);o.length!==0&&i.push(VS(o))})),()=>{i.forEach(o=>o?.())}}function zS(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 HS(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 Nf="pointerdown.outside",Rf="focus.outside";function qS(t){for(const e of t)if(at(e)&&hr(e))return!0;return!1}var Oy=t=>"clientY"in t;function WS(t,e){if(!Oy(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 US(t,e){return t.y<=e.y&&e.y<=t.y+t.height&&t.x<=e.x&&e.x<=t.x+t.width}function Pf(t,e){if(!e||!Oy(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 US(s,a)?r||o:!1}function KS(t,e){const{exclude:n,onFocusOutside:r,onPointerDownOutside:i,onInteractOutside:o,defer:s}=e;if(!t)return;const a=Kt(t),l=ht(t),u=zS(l),c=HS(l);function d(y,k){if(!at(k)||!k.isConnected||Zi(t,k)||WS(t,y))return!1;const v=a.querySelector(`[aria-controls="${t.id}"]`);if(v){const x=ed(v);if(Pf(y,x))return!1}const w=ed(t);return Pf(y,w)?!1:!(n!=null&&n(k))}const h=new Set,p=ds(t?.getRootNode());function f(y){function k(v){var w;const x=s&&!sf()?At:T=>T(),C=v??y,M=((w=C?.composedPath)==null?void 0:w.call(C))??[C?.target];x(()=>{const T=p?M[0]:pt(y);if(!(!t||!d(y,T))){if(i||o){const A=uf(i,o);t.addEventListener(Nf,A,{once:!0})}Ff(t,Nf,{bubbles:!1,cancelable:!0,detail:{originalEvent:C,contextmenu:Ax(C),focusable:qS(M),target:T}})}})}y.pointerType==="touch"?(h.forEach(v=>v()),h.add(Ne(a,"click",k,{once:!0})),h.add(c.addEventListener("click",k,{once:!0})),h.add(u.addEventListener("click",k,{once:!0}))):k()}const m=new Set,g=setTimeout(()=>{m.add(Ne(a,"pointerdown",f,!0)),m.add(c.addEventListener("pointerdown",f,!0)),m.add(u.addEventListener("pointerdown",f,!0))},0);function b(y){(s?At:k=>k())(()=>{const k=pt(y);if(!(!t||!d(y,k))){if(r||o){const v=uf(r,o);t.addEventListener(Rf,v,{once:!0})}Ff(t,Rf,{bubbles:!1,cancelable:!0,detail:{originalEvent:y,contextmenu:!1,focusable:hr(k),target:k}})}})}return sf()||(m.add(Ne(a,"focusin",b,!0)),m.add(c.addEventListener("focusin",b,!0)),m.add(u.addEventListener("focusin",b,!0))),()=>{clearTimeout(g),h.forEach(y=>y()),m.forEach(y=>y())}}function GS(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(KS(o,e))})),()=>{i.forEach(o=>o?.())}}function Ff(t,e,n){const r=t.ownerDocument.defaultView||window,i=new r.CustomEvent(e,n);return t.dispatchEvent(i)}function JS(t,e){const n=r=>{r.key==="Escape"&&(r.isComposing||e==null||e(r))};return Ne(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=>Zi(n.node,e))},isInBranch(t){return Array.from(this.branches).some(e=>Zi(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)}},Lf;function Bf(){Jt.layers.forEach(({node:t})=>{t.style.pointerEvents=Jt.isBelowPointerBlockingLayer(t)?"none":"auto"})}function YS(t){t.style.pointerEvents=""}function XS(t,e){const n=Kt(t),r=[];if(Jt.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(Lf=document.body.style.pointerEvents,queueMicrotask(()=>{n.body.style.pointerEvents="none",n.body.setAttribute("data-inert","")})),e){const i=r1(e,o=>{r.push(nd(o,{pointerEvents:"auto"}))});r.push(i)}return()=>{Jt.hasPointerBlockingLayer()||(queueMicrotask(()=>{n.body.style.pointerEvents=Lf,n.body.removeAttribute("data-inert"),n.body.style.length===0&&n.body.removeAttribute("style")}),r.forEach(i=>i()))}}function ZS(t,e){const{warnOnMissingNode:n=!0}=e;if(n&&!t){sd("[@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=pt(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=pt(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],b=(f=e.persistentElements)==null?void 0:f.map(y=>y()).filter(at);return b&&g.push(...b),g.some(y=>Zi(y,p))||Jt.isInNestedLayer(t,p)}const h=[i?XS(t,e.persistentElements):void 0,JS(t,c),GS(t,{exclude:d,onFocusOutside:u,onPointerDownOutside:l,defer:e.defer})];return()=>{Jt.remove(t),Bf(),YS(t),h.forEach(p=>p?.())}}function QS(t,e){const{defer:n}=e,r=n?At:o=>o(),i=[];return i.push(r(()=>{const o=ji(t)?t():t;i.push(ZS(o,e))})),()=>{i.forEach(o=>o?.())}}var eT=Object.defineProperty,tT=(t,e,n)=>e in t?eT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Te=(t,e,n)=>tT(t,typeof e!="symbol"?e+"":e,n),Vf={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()}},nT=[],rT=class{constructor(t,e){Te(this,"trapStack"),Te(this,"config"),Te(this,"doc"),Te(this,"state",{containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0}),Te(this,"listenerCleanups",[]),Te(this,"handleFocus",r=>{const i=pt(r),o=this.findContainerIndex(i,r)>=0;if(o||Tp(i))o&&(this.state.mostRecentlyFocusedNode=i);else{r.stopImmediatePropagation();let s,a=!0;if(this.state.mostRecentlyFocusedNode)if(Co(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=>Co(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}),Te(this,"handlePointerDown",r=>{const i=pt(r);if(!(this.findContainerIndex(i,r)>=0)){if(To(this.config.clickOutsideDeactivates,r)){this.deactivate({returnFocus:this.config.returnFocusOnDeactivate});return}To(this.config.allowOutsideClick,r)||r.preventDefault()}}),Te(this,"handleClick",r=>{const i=pt(r);this.findContainerIndex(i,r)>=0||To(this.config.clickOutsideDeactivates,r)||To(this.config.allowOutsideClick,r)||(r.preventDefault(),r.stopImmediatePropagation())}),Te(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;So(r)&&r.preventDefault(),this.tryFocus(o)}}),Te(this,"handleEscapeKey",r=>{iT(r)&&To(this.config.escapeDeactivates,r)!==!1&&(r.preventDefault(),this.deactivate())}),Te(this,"_mutationObserver"),Te(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())})}),Te(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})})}),Te(this,"getInitialFocusNode",()=>{let r=this.getNodeForOption("initialFocus",{hasFallback:!0});if(r===!1)return!1;if(r===void 0||r&&!hr(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}),Te(this,"tryFocus",r=>{if(r!==!1&&r!==bv(this.doc)){if(!r||!r.focus){this.tryFocus(this.getInitialFocusNode());return}r.focus({preventScroll:!!this.config.preventScroll}),this.state.mostRecentlyFocusedNode=r,oT(r)&&r.select()}}),Te(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(),Vf.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=()=>{$f(()=>{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}),Te(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}),Te(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}),Te(this,"updateContainerElements",r=>(this.state.containers=Array.isArray(r)?r.filter(Boolean):[r].filter(Boolean),this.state.active&&this.updateTabbableNodes(),this.updateObservedNodes(),this)),Te(this,"getReturnFocusNode",r=>{const i=this.getNodeForOption("setReturnFocus",{params:[r]});return i||(i===!1?!1:r)}),Te(this,"getOption",(r,i,o)=>r&&r[i]!==void 0?r[i]:this.config[o||i]),Te(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}),Te(this,"findNextNavNode",r=>{const{event:i,isBackward:o=!1}=r,s=r.target||pt(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||hr(s)&&!Br(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=Co(s)>=0?h.lastTabbableNode:h.lastDomTabbableNode}else So(i)||(a=u?.nextTabbableNode(s,!1))}else{let c=this.state.tabbableGroups.findIndex(({lastTabbableNode:d})=>s===d);if(c<0&&(u?.container===s||hr(s)&&!Br(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=Co(s)>=0?h.firstTabbableNode:h.firstDomTabbableNode}else So(i)||(a=u?.nextTabbableNode(s))}}else a=this.getNodeForOption("fallbackFocus");return a}),this.trapStack=e.trapStack||nT;const n={returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward(r){return So(r)&&!r.shiftKey},isKeyBackward(r){return So(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=Sv(t),n=Cv(t),r=e.length>0?e[0]:void 0,i=e.length>0?e[e.length-1]:void 0,o=n.find(u=>Br(u)),s=n.slice().reverse().find(u=>Br(u)),a=!!e.find(u=>Co(u)>0);function l(u,c=!0){const d=e.indexOf(u);return d<0?c?n.slice(n.indexOf(u)+1).find(h=>Br(h)):n.slice(0,n.indexOf(u)).reverse().find(h=>Br(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 Vf.activateTrap(this.trapStack,this),this.state.delayInitialFocusTimer=this.config.delayInitialFocus?$f(()=>{this.tryFocus(this.getInitialFocusNode())}):this.tryFocus(this.getInitialFocusNode()),this.listenerCleanups.push(Ne(this.doc,"focusin",this.handleFocus,!0),Ne(this.doc,"mousedown",this.handlePointerDown,{capture:!0,passive:!1}),Ne(this.doc,"touchstart",this.handlePointerDown,{capture:!0,passive:!1}),Ne(this.doc,"click",this.handleClick,{capture:!0,passive:!1}),Ne(this.doc,"keydown",this.handleTabKey,{capture:!0,passive:!1}),Ne(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)}},So=t=>t.key==="Tab",To=(t,...e)=>typeof t=="function"?t(...e):t,iT=t=>!t.isComposing&&t.key==="Escape",$f=t=>setTimeout(t,0),oT=t=>t.localName==="input"&&"select"in t&&typeof t.select=="function";function sT(t,e={}){let n;const r=At(()=>{const i=typeof t=="function"?t():t;if(i){n=new rT(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 rc="data-scroll-lock";function aT(t){const e=t.getBoundingClientRect().left;return Math.round(e)+t.scrollLeft?"paddingLeft":"paddingRight"}function lT(t){const e=t??document,n=e.defaultView??window,{documentElement:r,body:i}=e;if(i.hasAttribute(rc))return;i.setAttribute(rc,"");const o=n.innerWidth-r.clientWidth,s=()=>e1(r,"--scrollbar-width",`${o}px`),a=aT(r),l=()=>nd(i,{overflow:"hidden",[a]:`${o}px`}),u=()=>{const{scrollX:d,scrollY:h,visualViewport:p}=n,f=p?.offsetLeft??0,m=p?.offsetTop??0,g=nd(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(),lu()?u():l()];return()=>{c.forEach(d=>d?.()),i.removeAttribute(rc)}}var uT=$n("dialog").parts("trigger","backdrop","positioner","content","title","description","closeTrigger"),Rr=uT.build(),Ay=t=>{var e;return((e=t.ids)==null?void 0:e.positioner)??`dialog:${t.id}:positioner`},My=t=>{var e;return((e=t.ids)==null?void 0:e.backdrop)??`dialog:${t.id}:backdrop`},vd=t=>{var e;return((e=t.ids)==null?void 0:e.content)??`dialog:${t.id}:content`},_y=t=>{var e;return((e=t.ids)==null?void 0:e.trigger)??`dialog:${t.id}:trigger`},yd=t=>{var e;return((e=t.ids)==null?void 0:e.title)??`dialog:${t.id}:title`},bd=t=>{var e;return((e=t.ids)==null?void 0:e.description)??`dialog:${t.id}:description`},Dy=t=>{var e;return((e=t.ids)==null?void 0:e.closeTrigger)??`dialog:${t.id}:close`},ca=t=>t.getById(vd(t)),cT=t=>t.getById(Ay(t)),dT=t=>t.getById(My(t)),pT=t=>t.getById(_y(t)),hT=t=>t.getById(yd(t)),fT=t=>t.getById(bd(t)),mT=t=>t.getById(Dy(t));function gT(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){n.matches("open")!==u&&r({type:u?"OPEN":"CLOSE"})},getTriggerProps(){return e.button({...Rr.trigger.attrs,dir:o("dir"),id:_y(s),"aria-haspopup":"dialog",type:"button","aria-expanded":l,"data-state":l?"open":"closed","aria-controls":vd(s),onClick(u){u.defaultPrevented||r({type:"TOGGLE"})}})},getBackdropProps(){return e.element({...Rr.backdrop.attrs,dir:o("dir"),hidden:!l,id:My(s),"data-state":l?"open":"closed"})},getPositionerProps(){return e.element({...Rr.positioner.attrs,dir:o("dir"),id:Ay(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:vd(s),tabIndex:-1,"data-state":l?"open":"closed","aria-modal":!0,"aria-label":a||void 0,"aria-labelledby":a||!u.title?void 0:yd(s),"aria-describedby":u.description?bd(s):void 0})},getTitleProps(){return e.element({...Rr.title.attrs,dir:o("dir"),id:yd(s)})},getDescriptionProps(){return e.element({...Rr.description.attrs,dir:o("dir"),id:bd(s)})},getCloseTriggerProps(){return e.button({...Rr.closeTrigger.attrs,dir:o("dir"),id:Dy(s),type:"button",onClick(u){u.defaultPrevented||(u.stopPropagation(),r({type:"CLOSE"}))}})}}}var vT={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?()=>mT(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 QS(()=>ca(t),{defer:!0,pointerBlocking:n("modal"),exclude:[pT(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 lT(t.getDoc())},trapFocus({scope:t,prop:e}){return!e("trapFocus")||!e("modal")?void 0:sT(()=>ca(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")?jS(()=>[ca(t)],{defer:!0}):void 0}},actions:{checkRenderedElements({context:t,scope:e}){At(()=>{t.set("rendered",{title:!!hT(e),description:!!fT(e)})})},syncZIndex({scope:t}){At(()=>{const e=ca(t);if(!e)return;const n=mx(e);[cT(t),dT(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})}}}};Kn()(["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 yT=["data-id"],bT=["data-id"],kT=["data-id"],wT=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=fu(),s=gi(vT,{id:Qt({prefix:"dialog"}),closeOnEscape:r.closeOnEsc,modal:!0,closeOnInteractOutside:!1,onOpenChange({open:u}){i(u?"open":"close")},onInteractOutside(u){if(!r.closeOnOutsideClick)return u.preventDefault()},onPointerDownOutside(){i("clickoutside"),r.closeOnOutsideClick&&a.value.setOpen(!1)},getRootNode:()=>{var u;return r.teleport?document:(u=o.value)==null?void 0:u.getRootNode()},...r}),a=I(()=>gT(s,mi)),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},[L(u.$slots,"trigger",{triggerProps:a.value.getTriggerProps()},()=>[u.triggerLabel?(E(),H(He,re({key:0,class:"k-dialog__trigger",variant:"secondary"},a.value.getTriggerProps(),{disabled:u.disabled}),{default:ee(()=>[Be(oe(u.triggerLabel),1)]),_:1},16,["disabled"])):P("",!0)]),(E(),H(ev,{to:"body",disabled:!u.teleport},[a.value.open?(E(),O(Oe,{key:0},[U("div",re({class:"k-dialog__backdrop"},a.value.getBackdropProps(),{"data-id":l("backdrop")}),null,16,bT),U("div",re({class:`k-dialog__container k-dialog--align-${u.alignment}`},a.value.getPositionerProps(),{"data-id":l("container")}),[he(QE,re({class:"k-dialog__card",variant:u.variant,appearance:"shadow"},a.value.getContentProps(),{"data-id":l("dialog"),thumbnail:u.thumbnail,thumbnailOptions:u.thumbnailOptions}),_s({_:2},[u.$slots.header||u.$slots.title||u.$slots.subtitle||u.title||u.subtitle||u.showCloseTrigger?{name:"header",fn:ee(()=>[L(u.$slots,"header",{titleProps:a.value.getTitleProps(),descriptionProps:a.value.getDescriptionProps(),closeTriggerProps:a.value.getCloseTriggerProps()},()=>[L(u.$slots,"title",{titleProps:a.value.getTitleProps()},()=>[u.title?(E(),O("div",re({key:0,class:"k-dialog__title k-card__title"},a.value.getTitleProps()),oe(u.title),17)):P("",!0)]),L(u.$slots,"subtitle",{descriptionProps:a.value.getDescriptionProps()},()=>[u.subtitle?(E(),O("div",re({key:0,class:"k-dialog__subtitle k-card__subtitle"},a.value.getDescriptionProps()),oe(u.subtitle),17)):P("",!0)]),u.showCloseTrigger?(E(),H(He,re({key:0,class:"k-dialog__close-trigger",variant:"tertiary",icon:"fa-pro-light:times",size:"small"},a.value.getCloseTriggerProps()),null,16)):P("",!0)])]),key:"0"}:void 0,u.$slots.default?{name:"default",fn:ee(()=>[L(u.$slots,"default",{descriptionProps:a.value.getDescriptionProps()})]),key:"1"}:void 0,u.$slots.actions?{name:"actions",fn:ee(()=>[L(u.$slots,"actions",{close:()=>a.value.setOpen(!1)})]),key:"2"}:void 0]),1040,["variant","data-id","thumbnail","thumbnailOptions"])],16,kT)],64)):P("",!0)],8,["disabled"]))],8,yT))}});function Su(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Tu(){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)}Tu.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)}}};Tu.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};Tu.prototype.getExtension=function(t){return t=/^\s*([^;\s]*)/.test(t)&&RegExp.$1,t&&this._extensions[t.toLowerCase()]||null};var xT=Tu,ET={"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=xT;var ST=new CT(ET);const ol=Su(ST);function Jp(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 jf(t){return JSON.parse(JSON.stringify(t))}function Yp(t,e,n={fromDirectory:!1}){var r;const{fromDirectory:i}=n,o=Array.isArray(e)?e:e?.split(","),s=((r=("name"in t?t.name:"").split(".").pop())==null?void 0:r.toLowerCase())||"",a="type"in t?t.type:"";return o!=null&&o.includes("directory")&&(i||!t.type)?!0:!t.type&&!e?!1:e?o.map(l=>l.trim()).some(l=>{if(l.startsWith(".")){const u=l.slice(1),c=ol.getType(u),d=ol.getType(s);return c&&a?c===a:!!(!a&&c&&d&&c===d||!c&&!a&&s===u)}return l.includes("*")?a.startsWith(l.replace("*","")):a===l}):!0}const zf={counter:0,total:0,progress:0,bytes:0,result:[]};class Iy{constructor(e){Xt(this,"queue"),Xt(this,"upload"),Xt(this,"uploadOptions"),Xt(this,"accept"),this.queue=wp(jf(zf)),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,jf(zf))}async run(e){e=Array.from(e).filter(o=>Yp(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 Hf={"image/*":["jpeg","png","gif"]};function TT(t){return t?(Array.isArray(t)?t:t.split(",")).map(e=>e.trim()).map(e=>e.startsWith(".")?e.substring(1):e in Hf?Hf[e]:ol.getExtension(e)).flat():[]}function kd(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,ol.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 OT={class:"k-media-thumbnail-actions"},Ny=Q({__name:"ThumbnailActions",props:{value:{},disabled:{type:Boolean}},emits:["delete"],setup(t,{emit:e}){const n=t,r=I(()=>n.value.type.startsWith("image/")?{component:"button",bind:{onClick:()=>{kd(n.value)}}}:{component:"a",bind:{href:n.value.url,download:n.value.name,target:"_blank"}});return(i,o)=>(E(),O("div",OT,[i.disabled?P("",!0):(E(),H(He,{key:0,class:"k-media-thumbnail-actions__delete",icon:"fa-pro-solid:trash",variant:"danger",onClick:o[0]||(o[0]=Ka(s=>i.$emit("delete"),["stop"]))})),he(He,re({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"])]))}}),AT=Q({__name:"Thumbnail",props:{value:{},size:{default:"4rem"},disabled:{type:Boolean}},setup(t){const e=t,n=gp(),r=I(()=>n["data-draggable"]),i=I(()=>{let s={};for(const a in n){if(a==="data-draggable")return;s[a]=n[a]}return s}),o=I(()=>({width:e.size,height:e.size}));return(s,a)=>(E(),O("div",re({class:"k-media-thumbnail"},r.value,{class:{"k-media-thumbnail--selected":s.value.selected}}),[(E(),H(et(s.value.typeConfig.components.Thumbnail),re({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(Ny,{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"},_T={class:"k-media-type-selector__info"},DT=Q({__name:"TypeSelector",props:{value:{},upload:{type:Function},labels:{}},emits:["add","cancel","success","openFileWindow"],setup(t,{emit:e}){const n=t,r=e,i=z(null),o=z(),s=z(!0),a=z(!1),l=z(),u=z();we(a,g=>{var b,y;return g?(b=l.value)==null?void 0:b.open():(y=l.value)==null?void 0:y.close()},{immediate:!0});const c=I(()=>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 b=n.labels[g];return!b||typeof b=="string"?g:b.createLabel||g}return(g,b)=>c.value?P("",!0):(E(),O("div",MT,[U("span",_T,oe(g.labels.selectMessage),1),he(Eu,{teleport:!0,label:g.labels.select,iconRight:"fa6-solid:plus",theme:"shadow",placement:"bottom-end"},{default:ee(()=>[(E(!0),O(Oe,null,_t(g.value,y=>(E(),H(et(y.components.CreateTrigger),{key:y.name,label:m(y.name.toLowerCase()),onClick:k=>h(y)},null,8,["label","onClick"]))),128))]),_:1},8,["label"]),he(wT,{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:ee(()=>[i.value?(E(),H(et(i.value.components.Create),re({key:0,isValid:s.value,"onUpdate:isValid":b[0]||(b[0]=y=>s.value=y),upload:g.upload,labels:g.labels,name:i.value.name,ref_key:"creator",ref:u},g.$attrs),null,16,["isValid","upload","labels","name"])):P("",!0)]),footer:ee(()=>[he(He,{label:g.labels.cancel,type:"button",onClick:p},null,8,["label"]),he(He,{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)]))}}),IT=Q({__name:"Description",props:{modelValue:{},placeholder:{}},emits:["update:modelValue"],setup(t,{emit:e}){return(n,r)=>(E(),H(RE,{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"]))}}),NT={class:"k-media-uploader"},RT={class:"k-media-uploader__bar"},PT={class:"k-media-uploader__meta"},FT={key:0},LT={key:1},BT=Q({__name:"Uploader",props:{value:{},bytes:{},current:{default:1},total:{default:1}},setup(t){const e=t,n=I(()=>e.total>1),r=I(()=>Jp(e.bytes)),i=I(()=>Math.floor(e.value));return(o,s)=>(E(),O("div",NT,[U("div",null,oe(i.value)+" %",1),U("div",RT,[U("div",{class:"k-media-uploader__bar-value",style:kn({width:o.value+"%"})},null,4)]),U("div",PT,[n.value?(E(),O("div",FT,oe(o.current)+" / "+oe(o.total),1)):P("",!0),o.bytes?(E(),O("div",LT,"("+oe(r.value)+")",1)):P("",!0)])]))}}),VT=["innerHTML"],$T=Q({__name:"SlotHandler",props:{value:{}},setup(t){const e=t,n=I(()=>typeof e.value=="string"?e.value:void 0),r=I(()=>typeof e.value=="string"?"div":e.value);return(i,o)=>(E(),H(et(r.value),be(Re(i.$attrs)),{default:ee(()=>[n.value?(E(),O("span",{key:0,innerHTML:n.value},null,8,VT)):P("",!0)]),_:1},16))}}),jT={class:"k-media-droparea__instruction"},zT=["type","accept","required","disabled","multiple"],HT=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=z(!1),o=z(!0),s=z(),a=I(()=>!!(!n.required||n.value)),l=I(()=>n.disabled),u=I(()=>!l.value&&!d.total),{run:c,queue:d}=new Iy(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)&&xr(()=>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=>Yp(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 b=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"}}}),y=()=>{var k;return(k=s.value)==null?void 0:k.click()};return(k,v)=>(E(),O(Oe,null,[U("div",{class:Se(B(b)({active:i.value,invalid:!o.value,selected:!!k.selected,disabled:l.value})),onDrop:f,onDragover:m,onDragleave:g},[L(k.$slots,"preview"),U("div",jT,[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,zT)):P("",!0),o.value?(E(),O(Oe,{key:1},[L(k.$slots,"drop-message",{},()=>[he($T,{value:k.dropMessage},null,8,["value"])]),L(k.$slots,"default",{openFileWindow:y})],64)):(E(),H(B(Qe),{key:2,icon:"fa-pro-light:ban",style:{"font-size":"2rem"}})),L(k.$slots,"custom-message")]),!k.multiple&&k.selected?(E(),H(Ny,{key:0,value:k.selected,disabled:l.value,onDelete:v[0]||(v[0]=w=>k.$emit("remove",k.selected))},null,8,["value","disabled"])):P("",!0)],34),B(d).total?(E(),H(BT,{key:0,value:B(d).progress,bytes:B(d).bytes,current:B(d).counter,total:B(d).total},null,8,["value","bytes","current","total"])):P("",!0)],64))}}),qT=Q({__name:"CreateTrigger",props:{label:{}},setup(t){return(e,n)=>(E(),H(He,{type:"button",label:e.label,iconRight:"fa6-solid:image",size:"small",variant:"tertiary"},null,8,["label"]))}}),WT=Q({__name:"Thumbnail",props:{value:{}},setup(t){const e=t;return(n,r)=>(E(),H(bu,{class:"k-media-image__thumbnail",src:e.value.url,onClick:r[0]||(r[0]=i=>n.$emit("click"))},null,8,["src"]))}}),UT=Q({__name:"Preview",props:{value:{},size:{}},setup(t){const e=t;return(n,r)=>(E(),H(bu,{src:e.value.url,class:"k-media-image-preview",size:n.size,width:"100%",height:"100%"},null,8,["src","size"]))}}),KT={name:"Image",condition:t=>/^image\/.+/i.test(t.type),components:{CreateTrigger:Ma(qT),Thumbnail:Ma(WT),Preview:Ma(UT)}},GT={Image:KT};/**!
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 Vf(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 xn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Vf(Object(n),!0).forEach(function(r){jT(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Vf(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Na(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Na=function(e){return typeof e}:Na=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Na(t)}function jT(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qn(){return qn=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},qn.apply(this,arguments)}function zT(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 HT(t,e){if(t==null)return{};var n=zT(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 qT="1.14.0";function jn(t){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(t)}var Gn=jn(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Ps=jn(/Edge/i),$f=jn(/firefox/i),zo=jn(/safari/i)&&!jn(/chrome/i)&&!jn(/android/i),My=jn(/iP(ad|od|hone)/i),WT=jn(/chrome/i)&&jn(/android/i),_y={capture:!1,passive:!1};function ve(t,e,n){t.addEventListener(e,n,!Gn&&_y)}function ge(t,e,n){t.removeEventListener(e,n,!Gn&&_y)}function il(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 UT(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&&il(t,e):il(t,e))||r&&t===n)return t;if(t===n)break}while(t=UT(t))}return null}var jf=/\s+/g;function xt(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var r=(" "+t.className+" ").replace(jf," ").replace(" "+e+" "," ");t.className=(r+(n?" "+e:"")).replace(jf," ")}}function te(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 Ui(t,e){var n="";if(typeof t=="string")n=t;else do{var r=te(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 Dy(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 je(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,!Gn))do if(i&&i.getBoundingClientRect&&(te(i,"transform")!=="none"||n&&te(i,"position")!=="static")){var h=i.getBoundingClientRect();s-=h.top+parseInt(te(i,"border-top-width")),a-=h.left+parseInt(te(i,"border-left-width")),l=s+o.height,u=a+o.width;break}while(i=i.parentNode);if(r&&t!==window){var p=Ui(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 zf(t,e,n){for(var r=lr(t,!0),i=je(t)[e];r;){var o=je(r)[n],s=void 0;if(s=i>=o,!s)return r;if(r===yn())break;r=lr(r,!1)}return!1}function eo(t,e,n,r){for(var i=0,o=0,s=t.children;o<s.length;){if(s[o].style.display!=="none"&&s[o]!==ne.ghost&&(r||s[o]!==ne.dragged)&&hn(s[o],n.draggable,t,!1)){if(i===e)return s[o];i++}o++}return null}function Kp(t,e){for(var n=t.lastElementChild;n&&(n===ne.ghost||te(n,"display")==="none"||e&&!il(n,e));)n=n.previousElementSibling;return n||null}function Ft(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)t.nodeName.toUpperCase()!=="TEMPLATE"&&t!==ne.clone&&(!e||il(t,e))&&n++;return n}function Hf(t){var e=0,n=0,r=yn();if(t)do{var i=Ui(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 KT(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 lr(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=te(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 GT(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function nc(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 Ho;function Iy(t,e){return function(){if(!Ho){var n=arguments,r=this;n.length===1?t.call(r,n[0]):t.apply(r,n),Ho=setTimeout(function(){Ho=void 0},e)}}}function JT(){clearTimeout(Ho),Ho=void 0}function Ny(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function Ry(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 St="Sortable"+new Date().getTime();function YT(){var t=[],e;return{captureAnimationState:function(){if(t=[],!!this.options.animation){var n=[].slice.call(this.el.children);n.forEach(function(r){if(!(te(r,"display")==="none"||r===ne.ghost)){t.push({target:r,rect:je(r)});var i=xn({},t[t.length-1].rect);if(r.thisAnimationDuration){var o=Ui(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(KT(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=je(l),d=l.prevFromRect,h=l.prevToRect,p=s.rect,f=Ui(l,!0);f&&(c.top-=f.f,c.left-=f.e),l.toRect=c,l.thisAnimationDuration&&nc(d,c)&&!nc(u,c)&&(p.top-c.top)/(p.left-c.left)===(u.top-c.top)/(u.left-c.left)&&(a=ZT(p,d,h,r.options)),nc(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){te(n,"transition",""),te(n,"transform","");var s=Ui(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,te(n,"transform","translate3d("+u+"px,"+c+"px,0)"),this.forRepaintDummy=XT(n),te(n,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),te(n,"transform","translate3d(0,0,0)"),typeof n.animated=="number"&&clearTimeout(n.animated),n.animated=setTimeout(function(){te(n,"transition",""),te(n,"transform",""),n.animated=!1,n.animatingX=!1,n.animatingY=!1},o)}}}}function XT(t){return t.offsetWidth}function ZT(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 Oi=[],rc={initializeByDefault:!0},Fs={mount:function(t){for(var e in rc)rc.hasOwnProperty(e)&&!(e in t)&&(t[e]=rc[e]);Oi.forEach(function(n){if(n.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}),Oi.push(t)},pluginEvent:function(t,e,n){var r=this;this.eventCanceled=!1,n.cancel=function(){r.eventCanceled=!0};var i=t+"Global";Oi.forEach(function(o){e[o.pluginName]&&(e[o.pluginName][i]&&e[o.pluginName][i](xn({sortable:e},n)),e.options[o.pluginName]&&e[o.pluginName][t]&&e[o.pluginName][t](xn({sortable:e},n)))})},initializePlugins:function(t,e,n,r){Oi.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,qn(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 Oi.forEach(function(r){typeof r.eventProperties=="function"&&qn(n,r.eventProperties.call(e[r.pluginName],t))}),n},modifyOption:function(t,e,n){var r;return Oi.forEach(function(i){t[i.pluginName]&&i.optionListeners&&typeof i.optionListeners[e]=="function"&&(r=i.optionListeners[e].call(t[i.pluginName],n))}),r}};function QT(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[St],!!e){var m,g=e.options,b="on"+r.charAt(0).toUpperCase()+r.substr(1);window.CustomEvent&&!Gn&&!Ps?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 y=xn(xn({},f),Fs.getEventProperties(r,e));for(var k in y)m[k]=y[k];n&&n.dispatchEvent(m),g[b]&&g[b].call(e,m)}}var eO=["evt"],gt=function(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.evt,i=HT(n,eO);Fs.pluginEvent.bind(ne)(t,e,xn({dragEl:F,parentEl:Me,ghostEl:le,rootEl:Ce,nextEl:Vr,lastDownEl:Ra,cloneEl:_e,cloneHidden:or,dragStarted:No,putSortable:Ge,activeSortable:ne.active,originalEvent:r,oldIndex:ji,oldDraggableIndex:qo,newIndex:Et,newDraggableIndex:tr,hideGhostForTarget:By,unhideGhostForTarget:Vy,cloneNowHidden:function(){or=!0},cloneNowShown:function(){or=!1},dispatchSortableEvent:function(o){ct({sortable:e,name:o,originalEvent:r})}},i))};function ct(t){QT(xn({putSortable:Ge,cloneEl:_e,targetEl:F,rootEl:Ce,oldIndex:ji,oldDraggableIndex:qo,newIndex:Et,newDraggableIndex:tr},t))}var F,Me,le,Ce,Vr,Ra,_e,or,ji,Et,qo,tr,la,Ge,Ni=!1,ol=!1,sl=[],Pr,Ut,ic,oc,qf,Wf,No,Ai,Wo,Uo=!1,ua=!1,Pa,tt,sc=[],vd=!1,al=[],Su=typeof document<"u",ca=My,Uf=Ps||Gn?"cssFloat":"float",tO=Su&&!WT&&!My&&"draggable"in document.createElement("div"),Py=function(){if(Su){if(Gn)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),Fy=function(t,e){var n=te(t),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=eo(t,0,e),o=eo(t,1,e),s=i&&te(i),a=o&&te(o),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+je(i).width,u=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+je(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[Uf]==="none"||o&&n[Uf]==="none"&&l+u>r)?"vertical":"horizontal"},nO=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},rO=function(t,e){var n;return sl.some(function(r){var i=r[St].options.emptyInsertThreshold;if(!(!i||Kp(r))){var o=je(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},Ly=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||Na(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},By=function(){!Py&&le&&te(le,"display","none")},Vy=function(){!Py&&le&&te(le,"display","")};Su&&document.addEventListener("click",function(t){if(ol)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),ol=!1,!1},!0);var Fr=function(t){if(F){t=t.touches?t.touches[0]:t;var e=rO(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[St]._onDragOver(n)}}},iO=function(t){F&&F.parentNode[St]._isOutsideThisEl(t.target)};function ne(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=qn({},e),t[St]=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 Fy(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:ne.supportPointer!==!1&&"PointerEvent"in window&&!zo,emptyInsertThreshold:5};Fs.initializePlugins(this,t,n);for(var r in n)!(r in e)&&(e[r]=n[r]);Ly(e);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=e.forceFallback?!1:tO,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)),sl.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),qn(this,YT())}ne.prototype={constructor:ne,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(Ai=null)},_getDirection:function(t,e){return typeof this.options.direction=="function"?this.options.direction.call(this,t,e,F):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(pO(n),!F&&!(/mousedown|pointerdown/.test(o)&&t.button!==0||r.disabled)&&!l.isContentEditable&&!(!this.nativeDraggable&&zo&&a&&a.tagName.toUpperCase()==="SELECT")&&(a=hn(a,r.draggable,n,!1),!(a&&a.animated)&&Ra!==a)){if(ji=Ft(a),qo=Ft(a,r.draggable),typeof u=="function"){if(u.call(this,t,a,this)){ct({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 ct({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&&!F&&n.parentNode===i){var l=je(n);if(Ce=i,F=n,Me=F.parentNode,Vr=F.nextSibling,Ra=n,la=o.group,ne.dragged=F,Pr={target:F,clientX:(e||t).clientX,clientY:(e||t).clientY},qf=Pr.clientX-l.left,Wf=Pr.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,F.style["will-change"]="all",a=function(){if(gt("delayEnded",r,{evt:t}),ne.eventCanceled){r._onDrop();return}r._disableDelayedDragEvents(),!$f&&r.nativeDraggable&&(F.draggable=!0),r._triggerDragStart(t,e),ct({sortable:r,name:"choose",originalEvent:t}),xt(F,o.chosenClass,!0)},o.ignore.split(",").forEach(function(u){Dy(F,u.trim(),ac)}),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),$f&&this.nativeDraggable&&(this.options.touchStartThreshold=4,F.draggable=!0),gt("delayStart",this,{evt:t}),o.delay&&(!o.delayOnTouchOnly||e)&&(!this.nativeDraggable||!(Ps||Gn))){if(ne.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(){F&&ac(F),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;ge(t,"mouseup",this._disableDelayedDrag),ge(t,"touchend",this._disableDelayedDrag),ge(t,"touchcancel",this._disableDelayedDrag),ge(t,"mousemove",this._delayedDragTouchMoveHandler),ge(t,"touchmove",this._delayedDragTouchMoveHandler),ge(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(F,"dragend",this),ve(Ce,"dragstart",this._onDragStart));try{document.selection?Fa(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,e){if(Ni=!1,Ce&&F){gt("dragStarted",this,{evt:e}),this.nativeDraggable&&ve(document,"dragover",iO);var n=this.options;!t&&xt(F,n.dragClass,!1),xt(F,n.ghostClass,!0),ne.active=this,t&&this._appendGhost(),ct({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(Ut){this._lastX=Ut.clientX,this._lastY=Ut.clientY,By();for(var t=document.elementFromPoint(Ut.clientX,Ut.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Ut.clientX,Ut.clientY),t!==e);)e=t;if(F.parentNode[St]._isOutsideThisEl(t),e)do{if(e[St]){var n=void 0;if(n=e[St]._onDragOver({clientX:Ut.clientX,clientY:Ut.clientY,target:t,rootEl:e}),n&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);Vy()}},_onTouchMove:function(t){if(Pr){var e=this.options,n=e.fallbackTolerance,r=e.fallbackOffset,i=t.touches?t.touches[0]:t,o=le&&Ui(le,!0),s=le&&o&&o.a,a=le&&o&&o.d,l=ca&&tt&&Hf(tt),u=(i.clientX-Pr.clientX+r.x)/(s||1)+(l?l[0]-sc[0]:0)/(s||1),c=(i.clientY-Pr.clientY+r.y)/(a||1)+(l?l[1]-sc[1]:0)/(a||1);if(!ne.active&&!Ni){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(t,!0)}if(le){o?(o.e+=u-(ic||0),o.f+=c-(oc||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,")");te(le,"webkitTransform",d),te(le,"mozTransform",d),te(le,"msTransform",d),te(le,"transform",d),ic=u,oc=c,Ut=i}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!le){var t=this.options.fallbackOnBody?document.body:Ce,e=je(F,!0,ca,!0,t),n=this.options;if(ca){for(tt=t;te(tt,"position")==="static"&&te(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(),sc=Hf(tt)}le=F.cloneNode(!0),xt(le,n.ghostClass,!1),xt(le,n.fallbackClass,!0),xt(le,n.dragClass,!0),te(le,"transition",""),te(le,"transform",""),te(le,"box-sizing","border-box"),te(le,"margin",0),te(le,"top",e.top),te(le,"left",e.left),te(le,"width",e.width),te(le,"height",e.height),te(le,"opacity","0.8"),te(le,"position",ca?"absolute":"fixed"),te(le,"zIndex","100000"),te(le,"pointerEvents","none"),ne.ghost=le,t.appendChild(le),te(le,"transform-origin",qf/parseInt(le.style.width)*100+"% "+Wf/parseInt(le.style.height)*100+"%")}},_onDragStart:function(t,e){var n=this,r=t.dataTransfer,i=n.options;if(gt("dragStart",this,{evt:t}),ne.eventCanceled){this._onDrop();return}gt("setupClone",this),ne.eventCanceled||(_e=Ry(F),_e.draggable=!1,_e.style["will-change"]="",this._hideClone(),xt(_e,this.options.chosenClass,!1),ne.clone=_e),n.cloneId=Fa(function(){gt("clone",n),!ne.eventCanceled&&(n.options.removeCloneOnHide||Ce.insertBefore(_e,F),n._hideClone(),ct({sortable:n,name:"clone"}))}),!e&&xt(F,i.dragClass,!0),e?(ol=!0,n._loopId=setInterval(n._emulateDragOver,50)):(ge(document,"mouseup",n._onDrop),ge(document,"touchend",n._onDrop),ge(document,"touchcancel",n._onDrop),r&&(r.effectAllowed="move",i.setData&&i.setData.call(n,r,F)),ve(document,"drop",n),te(F,"transform","translateZ(0)")),Ni=!0,n._dragStartId=Fa(n._dragStarted.bind(n,e,t)),ve(document,"selectstart",n),No=!0,zo&&te(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=ne.active,u=la===a,c=s.sort,d=Ge||l,h,p=this,f=!1;if(vd)return;function m(X,fe){gt(X,p,xn({evt:t,isOwner:u,axis:h?"vertical":"horizontal",revert:o,dragRect:r,targetRect:i,canSort:c,fromSortable:d,target:n,completed:b,onMove:function(Ee,Ie){return da(Ce,e,F,r,Ee,je(Ee),t,Ie)},changed:y},fe))}function g(){m("dragOverAnimationCapture"),p.captureAnimationState(),p!==d&&d.captureAnimationState()}function b(X){return m("dragOverCompleted",{insertion:X}),X&&(u?l._hideClone():l._showClone(p),p!==d&&(xt(F,Ge?Ge.options.ghostClass:l.options.ghostClass,!1),xt(F,s.ghostClass,!0)),Ge!==p&&p!==ne.active?Ge=p:p===ne.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===F&&!F.animated||n===e&&!n.animated)&&(Ai=null),!s.dragoverBubble&&!t.rootEl&&n!==document&&(F.parentNode[St]._isOutsideThisEl(t.target),!X&&Fr(t)),!s.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function y(){Et=Ft(F),tr=Ft(F,s.draggable),ct({sortable:p,name:"change",toEl:e,newIndex:Et,newDraggableIndex:tr,originalEvent:t})}if(t.preventDefault!==void 0&&t.cancelable&&t.preventDefault(),n=hn(n,s.draggable,e,!0),m("dragOver"),ne.eventCanceled)return f;if(F.contains(t.target)||n.animated&&n.animatingX&&n.animatingY||p._ignoreWhileAnimating===n)return b(!1);if(ol=!1,l&&!s.disabled&&(u?c||(o=Me!==Ce):Ge===this||(this.lastPutMode=la.checkPull(this,l,F,t))&&a.checkPut(this,l,F,t))){if(h=this._getDirection(t,n)==="vertical",r=je(F),m("dragOverValid"),ne.eventCanceled)return f;if(o)return Me=Ce,g(),this._hideClone(),m("revert"),ne.eventCanceled||(Vr?Ce.insertBefore(F,Vr):Ce.appendChild(F)),b(!0);var k=Kp(e,s.draggable);if(!k||lO(t,h,this)&&!k.animated){if(k===F)return b(!1);if(k&&e===t.target&&(n=k),n&&(i=je(n)),da(Ce,e,F,r,n,i,t,!!n)!==!1)return g(),e.appendChild(F),Me=e,y(),b(!0)}else if(k&&aO(t,h,this)){var v=eo(e,0,s,!0);if(v===F)return b(!1);if(n=v,i=je(n),da(Ce,e,F,r,n,i,t,!1)!==!1)return g(),e.insertBefore(F,v),Me=e,y(),b(!0)}else if(n.parentNode===e){i=je(n);var w=0,x,C=F.parentNode!==e,M=!nO(F.animated&&F.toRect||r,n.animated&&n.toRect||i,h),T=h?"top":"left",A=zf(n,"top","top")||zf(F,"top","top"),_=A?A.scrollTop:void 0;Ai!==n&&(x=i[T],Uo=!1,ua=!M&&s.invertSwap||C),w=uO(t,n,i,h,M?1:s.swapThreshold,s.invertedSwapThreshold==null?s.swapThreshold:s.invertedSwapThreshold,ua,Ai===n);var N;if(w!==0){var $=Ft(F);do $-=w,N=Me.children[$];while(N&&(te(N,"display")==="none"||N===le))}if(w===0||N===n)return b(!1);Ai=n,Wo=w;var j=n.nextElementSibling,q=!1;q=w===1;var K=da(Ce,e,F,r,n,i,t,q);if(K!==!1)return(K===1||K===-1)&&(q=K===1),vd=!0,setTimeout(sO,30),g(),q&&!j?e.appendChild(F):n.parentNode.insertBefore(F,q?j:n),A&&Ny(A,0,_-A.scrollTop),Me=F.parentNode,x!==void 0&&!ua&&(Pa=Math.abs(x-je(n)[T])),y(),b(!0)}if(e.contains(F))return b(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){ge(document,"mousemove",this._onTouchMove),ge(document,"touchmove",this._onTouchMove),ge(document,"pointermove",this._onTouchMove),ge(document,"dragover",Fr),ge(document,"mousemove",Fr),ge(document,"touchmove",Fr)},_offUpEvents:function(){var t=this.el.ownerDocument;ge(t,"mouseup",this._onDrop),ge(t,"touchend",this._onDrop),ge(t,"pointerup",this._onDrop),ge(t,"touchcancel",this._onDrop),ge(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;if(Et=Ft(F),tr=Ft(F,n.draggable),gt("drop",this,{evt:t}),Me=F&&F.parentNode,Et=Ft(F),tr=Ft(F,n.draggable),ne.eventCanceled){this._nulling();return}Ni=!1,ua=!1,Uo=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),yd(this.cloneId),yd(this._dragStartId),this.nativeDraggable&&(ge(document,"drop",this),ge(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),zo&&te(document.body,"user-select",""),te(F,"transform",""),t&&(No&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),le&&le.parentNode&&le.parentNode.removeChild(le),(Ce===Me||Ge&&Ge.lastPutMode!=="clone")&&_e&&_e.parentNode&&_e.parentNode.removeChild(_e),F&&(this.nativeDraggable&&ge(F,"dragend",this),ac(F),F.style["will-change"]="",No&&!Ni&&xt(F,Ge?Ge.options.ghostClass:this.options.ghostClass,!1),xt(F,this.options.chosenClass,!1),ct({sortable:this,name:"unchoose",toEl:Me,newIndex:null,newDraggableIndex:null,originalEvent:t}),Ce!==Me?(Et>=0&&(ct({rootEl:Me,name:"add",toEl:Me,fromEl:Ce,originalEvent:t}),ct({sortable:this,name:"remove",toEl:Me,originalEvent:t}),ct({rootEl:Me,name:"sort",toEl:Me,fromEl:Ce,originalEvent:t}),ct({sortable:this,name:"sort",toEl:Me,originalEvent:t})),Ge&&Ge.save()):Et!==ji&&Et>=0&&(ct({sortable:this,name:"update",toEl:Me,originalEvent:t}),ct({sortable:this,name:"sort",toEl:Me,originalEvent:t})),ne.active&&((Et==null||Et===-1)&&(Et=ji,tr=qo),ct({sortable:this,name:"end",toEl:Me,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){gt("nulling",this),Ce=F=Me=le=Vr=_e=Ra=or=Pr=Ut=No=Et=tr=ji=qo=Ai=Wo=Ge=la=ne.dragged=ne.ghost=ne.clone=ne.active=null,al.forEach(function(t){t.checked=!0}),al.length=ic=oc=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":F&&(this._onDragOver(t),oO(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)||dO(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=Fs.modifyOption(this,t,e);typeof r<"u"?n[t]=r:n[t]=e,t==="group"&&Ly(n)},destroy:function(){gt("destroy",this);var t=this.el;t[St]=null,ge(t,"mousedown",this._onTapStart),ge(t,"touchstart",this._onTapStart),ge(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(ge(t,"dragover",this),ge(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(e){e.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),sl.splice(sl.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!or){if(gt("hideClone",this),ne.eventCanceled)return;te(_e,"display","none"),this.options.removeCloneOnHide&&_e.parentNode&&_e.parentNode.removeChild(_e),or=!0}},_showClone:function(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(or){if(gt("showClone",this),ne.eventCanceled)return;F.parentNode==Ce&&!this.options.group.revertClone?Ce.insertBefore(_e,F):Vr?Ce.insertBefore(_e,Vr):Ce.appendChild(_e),this.options.group.revertClone&&this.animate(F,_e),te(_e,"display",""),or=!1}}};function oO(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}function da(t,e,n,r,i,o,s,a){var l,u=t[St],c=u.options.onMove,d;return window.CustomEvent&&!Gn&&!Ps?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||je(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),c&&(d=c.call(u,l,s)),d}function ac(t){t.draggable=!1}function sO(){vd=!1}function aO(t,e,n){var r=je(eo(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 lO(t,e,n){var r=je(Kp(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 uO(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&&Pa<u*i){if(!Uo&&(Wo===1?l>c+u*o/2:l<d-u*o/2)&&(Uo=!0),Uo)h=!0;else if(Wo===1?l<c+Pa:l>d-Pa)return-Wo}else if(l>c+u*(1-i)/2&&l<d-u*(1-i)/2)return cO(e)}return h=h||s,h&&(l<c+u*o/2||l>d-u*o/2)?l>c+u/2?1:-1:0}function cO(t){return Ft(F)<Ft(t)?1:-1}function dO(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 pO(t){al.length=0;for(var e=t.getElementsByTagName("input"),n=e.length;n--;){var r=e[n];r.checked&&al.push(r)}}function Fa(t){return setTimeout(t,0)}function yd(t){return clearTimeout(t)}Su&&ve(document,"touchmove",function(t){(ne.active||Ni)&&t.cancelable&&t.preventDefault()});ne.utils={on:ve,off:ge,css:te,find:Dy,is:function(t,e){return!!hn(t,e,t,!1)},extend:GT,throttle:Iy,closest:hn,toggleClass:xt,clone:Ry,index:Ft,nextTick:Fa,cancelNextTick:yd,detectDirection:Fy,getChild:eo};ne.get=function(t){return t[St]};ne.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&&(ne.utils=xn(xn({},ne.utils),r.utils)),Fs.mount(r)})};ne.create=function(t,e){return new ne(t,e)};ne.version=qT;var Pe=[],Ro,bd,kd=!1,lc,uc,ll,Po;function hO(){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?ge(document,"dragover",this._handleAutoScroll):(ge(document,"pointermove",this._handleFallbackAutoScroll),ge(document,"touchmove",this._handleFallbackAutoScroll),ge(document,"mousemove",this._handleFallbackAutoScroll)),Kf(),La(),JT()},nulling:function(){ll=bd=Ro=kd=Po=lc=uc=null,Pe.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(ll=e,n||this.options.forceAutoScrollFallback||Ps||Gn||zo){cc(e,this.options,s,n);var a=lr(s,!0);kd&&(!Po||i!==lc||o!==uc)&&(Po&&Kf(),Po=setInterval(function(){var l=lr(document.elementFromPoint(i,o),!0);l!==a&&(a=l,La()),cc(e,r.options,l,n)},10),lc=i,uc=o)}else{if(!this.options.bubbleScroll||lr(s,!0)===yn()){La();return}cc(e,this.options,lr(s,!1),!1)}}},qn(t,{pluginName:"scroll",initializeByDefault:!0})}function La(){Pe.forEach(function(t){clearInterval(t.pid)}),Pe=[]}function Kf(){clearInterval(Po)}var cc=Iy(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;bd!==n&&(bd=n,La(),Ro=e.scroll,c=e.scrollFn,Ro===!0&&(Ro=lr(n,!0)));var d=0,h=Ro;do{var p=h,f=je(p),m=f.top,g=f.bottom,b=f.left,y=f.right,k=f.width,v=f.height,w=void 0,x=void 0,C=p.scrollWidth,M=p.scrollHeight,T=te(p),A=p.scrollLeft,_=p.scrollTop;p===l?(w=k<C&&(T.overflowX==="auto"||T.overflowX==="scroll"||T.overflowX==="visible"),x=v<M&&(T.overflowY==="auto"||T.overflowY==="scroll"||T.overflowY==="visible")):(w=k<C&&(T.overflowX==="auto"||T.overflowX==="scroll"),x=v<M&&(T.overflowY==="auto"||T.overflowY==="scroll"));var N=w&&(Math.abs(y-i)<=s&&A+k<C)-(Math.abs(b-i)<=s&&!!A),$=x&&(Math.abs(g-o)<=s&&_+v<M)-(Math.abs(m-o)<=s&&!!_);if(!Pe[d])for(var j=0;j<=d;j++)Pe[j]||(Pe[j]={});(Pe[d].vx!=N||Pe[d].vy!=$||Pe[d].el!==p)&&(Pe[d].el=p,Pe[d].vx=N,Pe[d].vy=$,clearInterval(Pe[d].pid),(N!=0||$!=0)&&(u=!0,Pe[d].pid=setInterval(function(){r&&this.layer===0&&ne.active._onTouchMove(ll);var q=Pe[this.layer].vy?Pe[this.layer].vy*a:0,K=Pe[this.layer].vx?Pe[this.layer].vx*a:0;typeof c=="function"&&c.call(ne.dragged.parentNode[St],K,q,t,ll,Pe[this.layer].el)!=="continue"||Ny(Pe[this.layer].el,K,q)}.bind({layer:d}),24))),d++}while(e.bubbleScroll&&h!==l&&(h=lr(h,!1)));kd=u}},30),$y=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 Gp(){}Gp.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=eo(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:$y};qn(Gp,{pluginName:"revertOnSpill"});function Jp(){}Jp.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:$y};qn(Jp,{pluginName:"removeOnSpill"});ne.mount(new hO);ne.mount(Jp,Gp);function dc(t){t.parentElement!==null&&t.parentElement.removeChild(t)}function Gf(t,e,n){const r=n===0?t.children[0]:t.children[n-1].nextSibling;t.insertBefore(e,r)}function fO(){return typeof window<"u"?window.console:global.console}const mO=fO();function gO(t){const e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}const vO=/-(\w)/g,yO=gO(t=>t.replace(vO,(e,n)=>n.toUpperCase())),jy=["Start","Add","Remove","Update","End"],zy=["Choose","Unchoose","Sort","Filter","Clone"],Hy=["Move"],bO=[Hy,jy,zy].flatMap(t=>t).map(t=>`on${t}`),wd={manage:Hy,manageAndEmit:jy,emit:zy};function kO(t){return bO.indexOf(t)!==-1}const wO=["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 xO(t){return wO.includes(t)}function EO(t){return["transition-group","TransitionGroup"].includes(t)}function qy(t){return["id","class","role","style"].includes(t)||t.startsWith("data-")||t.startsWith("aria-")||t.startsWith("on")}function Wy(t){return t.reduce((e,[n,r])=>(e[n]=r,e),{})}function CO({$attrs:t,componentData:e={}}){return{...Wy(Object.entries(t).filter(([n,r])=>qy(n))),...e}}function SO({$attrs:t,callBackBuilder:e}){const n=Wy(Uy(t));Object.entries(e).forEach(([i,o])=>{wd[i].forEach(s=>{n[`on${s}`]=o(s)})});const r=`[data-draggable]${n.draggable||""}`;return{...n,draggable:r}}function Uy(t){return Object.entries(t).filter(([e,n])=>!qy(e)).map(([e,n])=>[yO(e),n]).filter(([e,n])=>!kO(e))}const Jf=({el:t})=>t,TO=(t,e)=>t.__draggable_context=e,Yf=t=>t.__draggable_context;class OO{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)=>{TO(Jf(r),{element:n[i],index:i})})}getUnderlyingVm(e){return Yf(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=Yf(s);if(a)return a.index;if(i===0)return 0;const l=Jf(r[0]),u=[...o].findIndex(c=>c===l);return e<u?0:i}}function AO(t,e){const n=t[e];return n?n():[]}function MO({$slots:t,realList:e,getKey:n}){const r=e||[],[i,o]=["header","footer"].map(l=>AO(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 _O(t){const e=EO(t),n=!xO(t)&&!e;return{transition:e,externalComponent:n,tag:n?Dk(t):e?_k:t}}function DO({$slots:t,tag:e,realList:n,getKey:r}){const i=MO({$slots:t,realList:n,getKey:r}),o=_O(e);return new OO({nodes:i,root:o,realList:n})}function Ky(t,e){xr(()=>this.$emit(t.toLowerCase(),e))}function Gy(t){return(e,n)=>{if(this.realList!==null)return this[`onDrag${t}`](e,n)}}function IO(t){const e=Gy.call(this,t);return(n,r)=>{e.call(this,n,r),Ky.call(this,t,n)}}let pc=null;const NO={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}},RO=["update:modelValue","change",...[...wd.manageAndEmit,...wd.emit].map(t=>t.toLowerCase())],Jy=Q({name:"draggable",inheritAttrs:!1,props:NO,emits:RO,data(){return{error:!1}},render(){try{this.error=!1;const{$slots:t,$attrs:e,tag:n,componentData:r,realList:i,getKey:o}=this,s=DO({$slots:t,tag:n,realList:i,getKey:o});this.componentStructure=s;const a=CO({$attrs:e,componentData:r});return s.render(ls,a)}catch(t){return this.error=!0,ls("pre",{style:{color:"red"}},t.stack)}},created(){this.list!==null&&this.modelValue!==null&&mO.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=SO({$attrs:t,callBackBuilder:{manageAndEmit:o=>IO.call(this,o),emit:o=>Ky.bind(this,o),manage:o=>Gy.call(this,o)}}),i=e.nodeType===1?e:e.parentElement;this._sortable=new ne(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&&Uy(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){xr(()=>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),pc=t.item},onDragAdd(t){const e=t.item._underlying_vm_;if(e===void 0)return;dc(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(Gf(this.$el,t.item,t.oldIndex),t.pullMode==="clone"){dc(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){dc(t.item),Gf(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(pc)!==-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(){pc=null}}}),PO={key:0,class:"k-media__label-wrapper"},FO={key:1,class:"k-media__sublabel"},AL=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=H(null),o=I(()=>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=I({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,...b}=f;return b}))}}),a=I(()=>n.types.map(p=>typeof p=="string"?$T[p]:p).filter(Boolean));xe(()=>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,...b}=p;r("update:modelValue",n.multiple?(n.modelValue||[]).filter(y=>y.url!==b.url):null),((f=i?.value)==null?void 0:f.url)===p.url&&xr(()=>{l()})}function c(p){r("update:modelValue",n.multiple?[...n.modelValue||[],p]:p),xr(()=>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:Se(B(h)({placement:p.placement}))},[p.label||p.sublabel||p.$slots.sublabel||p.$slots.label?(E(),O("div",PO,[p.label||p.$slots.label?(E(),O("label",{key:0,class:Se(["k-media__label",{"k-media__label-required":p.required}])},[L(p.$slots,"label",{},()=>[Be(oe(p.label),1)])],2)):P("",!0),p.sublabel||p.$slots.sublabel?(E(),O("span",FO,[L(p.$slots,"sublabel",{},()=>[Be(oe(p.sublabel),1)])])):P("",!0)])):P("",!0),he(PT,{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},Ms({default:ee(({openFileWindow:m})=>[he(ET,{onOpenFileWindow:m,ref:"typeSelector",value:a.value,onAdd:c,labels:p.labels,upload:p.upload},null,8,["onOpenFileWindow","value","labels","upload"])]),"drop-message":ee(()=>[L(p.$slots,"drop-message")]),"custom-message":ee(()=>[L(p.$slots,"custom-message")]),_:2},[i.value?{name:"preview",fn:ee(()=>[p.description&&o.value?(E(),z(CT,{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"])):P("",!0),(E(),z(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"]),L(p.$slots,"bottom"),p.multiple?(E(),z(B(Jy),{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:ee(({element:m,index:g})=>[(E(),z(kT,{onKeydown:mp(b=>i.value=m,["enter"]),tabindex:"0",size:p.thumbnailSize,key:m.url,value:m,disabled:p.disabled,onClick:b=>i.value=m,onDelete:b=>u(m)},null,8,["onKeydown","size","value","disabled","onClick","onDelete"]))]),_:1},8,["modelValue","sort"])):P("",!0)],2))}});var LO=$n("switch").parts("root","label","control","thumb"),pa=LO.build(),Yy=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`switch:${t.id}`},Xf=t=>{var e;return((e=t.ids)==null?void 0:e.label)??`switch:${t.id}:label`},BO=t=>{var e;return((e=t.ids)==null?void 0:e.thumb)??`switch:${t.id}:thumb`},VO=t=>{var e;return((e=t.ids)==null?void 0:e.control)??`switch:${t.id}:control`},xd=t=>{var e;return((e=t.ids)==null?void 0:e.hiddenInput)??`switch:${t.id}:input`},$O=t=>t.getById(Yy(t)),zi=t=>t.getById(xd(t));function jO(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":J(n.get("active")),"data-focus":J(u),"data-focus-visible":J(c),"data-readonly":J(a),"data-hover":J(n.get("hovered")),"data-disabled":J(s),"data-state":l?"checked":"unchecked","data-invalid":J(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({...pa.root.attrs,...d,dir:i("dir"),id:Yy(o),htmlFor:xd(o),onPointerMove(){s||r({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){s||r({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(h){var p;s||(dt(h)===zi(o)&&h.stopPropagation(),xp()&&((p=zi(o))==null||p.focus()))}})},getLabelProps(){return e.element({...pa.label.attrs,...d,dir:i("dir"),id:Xf(o)})},getThumbProps(){return e.element({...pa.thumb.attrs,...d,dir:i("dir"),id:BO(o),"aria-hidden":!0})},getControlProps(){return e.element({...pa.control.attrs,...d,dir:i("dir"),id:VO(o),"aria-hidden":!0})},getHiddenInputProps(){return e.input({id:xd(o),type:"checkbox",required:i("required"),defaultChecked:l,disabled:s,"aria-labelledby":Xf(o),"aria-invalid":i("invalid"),name:i("name"),form:i("form"),value:i("value"),style:Ap,onFocus(){const h=ds();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:Zf}=cu(),zO={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:Zf("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:Zf("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 Ev({pointerNode:$O(e),keyboardNode:zi(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 Mp({root:e.getRootNode()})},trackFormControlState({context:t,send:e,scope:n}){return lu(zi(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=zi(e);n&&Cp(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=zi(e);Sp(n,{checked:t.get("checked")})}}}};Kn()(["checked","defaultChecked","dir","disabled","form","getRootNode","id","ids","invalid","label","name","onCheckedChange","readOnly","required","value"]);const HO={class:"k-switch__label"},ML=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=mi(zO,{id:Qt(),...n,defaultChecked:n.modelValue,onCheckedChange:({checked:s})=>r("update:modelValue",s)}),o=I(()=>jO(i,fi));return xe(()=>n.modelValue,()=>{if(o.value.checked!==n.modelValue)return o.value.setChecked(n.modelValue)}),(s,a)=>(E(),O("label",re({class:"k-switch"},o.value.getRootProps()),[U("input",be(Re(o.value.getHiddenInputProps())),null,16),U("span",be(Re(o.value.getControlProps())),[U("span",be(Re(o.value.getThumbProps())),null,16)],16),s.labels||s.$slots.default?(E(),O("span",be(re({key:0},o.value.getLabelProps())),[U("span",HO,[L(s.$slots,"default",{checked:o.value.checked},()=>[Be(oe(o.value.checked?s.labels.on:s.labels.off),1)])])],16)):P("",!0)],16))}}),_L=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=H(!1);function o(u){const c=u[0];c.isIntersecting&&(i.value=!0,xr(()=>{r("intersect",c),l()}))}const s=H(),a=H();Tn(()=>{s.value=new IntersectionObserver(o,{root:n.observerRoot,threshold:n.threshold}),s.value.observe(a.value)}),pi(()=>{l()});function l(){s.value&&s.value.disconnect()}return(u,c)=>(E(),z(Qe(u.wrapperTag),{ref_key:"rootRef",ref:a,class:"k-lazyload"},{default:ee(()=>[i.value?L(u.$slots,"default",{key:0}):L(u.$slots,"placeholder",{key:1})]),_:3},512))}}),qO={class:"k-file-uploader__bar"},WO={class:"k-file-uploader__meta"},UO={key:0},KO={key:1},GO=Q({__name:"Uploader",props:{value:{},bytes:{},current:{default:1},total:{default:1}},setup(t){const e=t,n=I(()=>e.total>1),r=I(()=>Wp(e.bytes)),i=I(()=>Math.floor(e.value));return(o,s)=>(E(),z(ni,{class:"k-file-uploader",align:"center",justify:"space-between",gap:"0rem"},{default:ee(()=>[U("div",null,oe(i.value)+" %",1),U("div",qO,[U("div",{class:"k-file-uploader__bar-value",style:kn({width:o.value+"%"})},null,4)]),U("div",WO,[n.value?(E(),O("div",UO,oe(o.current)+" / "+oe(o.total),1)):P("",!0),o.bytes?(E(),O("div",KO,"("+oe(r.value)+")",1)):P("",!0)])]),_:1}))}}),JO=["innerHTML"],Qf=Q({__name:"SlotHandler",props:{value:{}},setup(t){const e=t,n=I(()=>typeof e.value=="string"?e.value:void 0),r=I(()=>typeof e.value=="string"?"div":e.value);return(i,o)=>(E(),z(Qe(r.value),be(Re(i.$attrs)),{default:ee(()=>[n.value?(E(),O("span",{key:0,innerHTML:n.value},null,8,JO)):P("",!0)]),_:1},16))}}),YO={class:"k-file-droparea__instruction"},XO=["accept","required","disabled","multiple"],ZO={key:0,class:"k-file-droparea__max-size"},QO=Q({__name:"DropArea",props:{value:{},multiple:{type:Boolean},upload:{},uploadOptions:{},accept:{},dropMessage:{},fileSizeError:{},disabled:{type:Boolean},required:{type:Boolean},rename:{type:Boolean},labels:{}},emits:["input"],setup(t,{emit:e}){const n=t,r=e,i=H(!1),o=H(!0),s=H(),a=H(!1),l=I(()=>!!n.required),u=I(()=>n.disabled),c=I(()=>!u.value&&!p.total),d=I(()=>yT(n.accept)),{run:h,queue:p}=new Oy(n);function f(C){return h(C).then(M=>{!M||!M.length||r("input",n.multiple?[...n.value||[],...M]:M[0])})}function m(C){if(!C)return 0;const M={bytes:1,b:1,kb:1024,mb:1024**2,gb:1024**3,tb:1024**4,pb:1024**5},T=C.trim().toLowerCase().match(/^([\d.]+)\s*(bytes|b|kb|mb|gb|tb|pb)$/);if(!T)throw new Error("Invalid size format");const A=parseFloat(T[1]),_=T[2];return Math.round(A*M[_])}function g(){return o.value=!1,a.value=!0,setTimeout(()=>{w()},1500)}function b(C=0){var M;return m((M=n?.uploadOptions)==null?void 0:M.maxSize)<C}async function y(C){var M;if(u.value)return;let T=C.target.files||[];if(Array.from(T).some(A=>b(A.size))&&(M=n.uploadOptions)!=null&&M.maxSize)return g();n.uploadOptions.preTransform&&(T=await n.uploadOptions.preTransform(C)),f(T),s.value&&(s.value.value="")}async function k(C){var M,T;if(u.value||!s.value)return;C.preventDefault();let A=(M=C.dataTransfer)==null?void 0:M.files;if(A!=null&&A.length){if(Array.from(A).some(_=>b(_.size))&&(T=n.uploadOptions)!=null&&T.maxSize)return g();if(!o.value)return w();w(),n.uploadOptions.preTransform&&(A=await n.uploadOptions.preTransform(C)),A!=null&&A.length&&(s.value.files=C.dataTransfer.files,s.value.dispatchEvent(new InputEvent("input")),f(A))}}function v(C){if(u.value||!C.dataTransfer)return;const M=Array.from(C.dataTransfer.items).every(A=>Up(A,n.accept)),T=n.multiple?!0:C.dataTransfer.items.length===1;o.value=M&&T,i.value=!0,C.preventDefault()}function w(){o.value=!0,i.value=!1,a.value=!1}const x=rn("k-file-droparea",{variants:{active:{true:"k-file-droparea--active"},invalid:{true:"k-file-droparea--invalid"},disabled:{true:"k-file-droparea--disabled"}}});return(C,M)=>{var T,A,_;return E(),O(Oe,null,[U("div",{class:Se(B(x)({active:i.value,invalid:!o.value,disabled:u.value})),onDrop:k,onDragover:v,onDragleave:w},[L(C.$slots,"preview"),U("div",YO,[c.value?(E(),O("input",{key:0,type:"file",accept:Array.isArray(C.accept)?C.accept.join(","):C.accept,required:l.value,ref_key:"input",ref:s,onChange:y,disabled:!c.value,multiple:C.multiple,class:"k-file-droparea__input"},null,40,XO)):P("",!0),o.value?(E(),O(Oe,{key:1},[L(C.$slots,"drop-message",{extensions:d.value},()=>[he(Qf,{value:C.dropMessage,extensions:d.value},null,8,["value","extensions"])]),(T=n.uploadOptions)!=null&&T.maxSize?(E(),O("div",ZO,[U("span",null,oe(`${(A=C.labels)==null?void 0:A.maxSize}: ${(_=n?.uploadOptions)==null?void 0:_.maxSize}`),1)])):P("",!0)],64)):(E(),z(B(Ze),{key:2,icon:"fa-pro-light:ban",style:{"font-size":"2rem"}})),a.value?L(C.$slots,"file-size-error",{key:3,extensions:d.value},()=>[he(Qf,{class:"k-file-droparea__file-size-error",value:C.fileSizeError,extensions:d.value},null,8,["value","extensions"])]):P("",!0),L(C.$slots,"custom-message")])],34),B(p).total?(E(),z(GO,{key:0,value:B(p).progress,bytes:B(p).bytes,current:B(p).counter,total:B(p).total},null,8,["value","bytes","current","total"])):P("",!0)],64)}}}),eA=Q({name:"UseClipboard",props:["source","read","navigator","copiedDuring","legacy"],setup(t,{slots:e}){const n=fp(rE(t));return()=>{var r;return(r=e.default)==null?void 0:r.call(e,n)}}});var tA=$n("toggle-group").parts("root","item"),em=tA.build(),ul=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}`},Xy=t=>t.getById(ul(t)),Tu=t=>{const e=`[data-ownedby='${CSS.escape(ul(t))}']:not([data-disabled])`;return Op(Xy(t),e)},tm=t=>_v(Tu(t)),rA=t=>Dv(Tu(t)),iA=(t,e,n)=>Wx(Tu(t),e,n),oA=(t,e,n)=>Ux(Tu(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({...em.root.attrs,id:ul(o),dir:i("dir"),role:l?"radiogroup":"group",tabIndex:n.get("isTabbingBackward")?-1:0,"data-disabled":J(a),"data-orientation":i("orientation"),"data-focus":J(n.get("focusedId")!=null),style:{outline:"none"},onMouseDown(){a||r({type:"ROOT.MOUSE_DOWN"})},onFocus(h){a||h.currentTarget===dt(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({...em.item.attrs,id:p.id,type:"button","data-ownedby":ul(o),"data-focus":J(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":J(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}),xp()&&m.currentTarget.focus({preventScroll:!0}))},onKeyDown(m){if(m.defaultPrevented||!yx(m)||p.disabled)return;const g={Tab(b){const y=b.shiftKey;r({type:"TOGGLE.SHIFT_TAB",isShiftTab:y})},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"})}}[vv(m)];g&&(g(m),m.key!=="Tab"&&m.preventDefault())}})}}}var{not:nm,and:aA}=cu(),lA={props({props:t}){return{defaultValue:[],orientation:"horizontal",rovingFocus:!0,loopFocus:!0,deselectable:!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:nm(aA("isClickFocus","isTabbingBackward")),actions:["focusFirstToggle","clearClickFocus"]},"TOGGLE.FOCUS":{target:"focused",actions:["setFocusedId"]}}},focused:{on:{"ROOT.BLUR":{target:"idle",actions:["clearIsTabbingBackward","clearFocusedId","clearClickFocus"]},"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:nm("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=tm(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=Xy(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}){C1(e,["value"]);let r=t.get("value");u1(e.value)?r=e.value:n("multiple")?r=a1(r,e.value):r=_s(r,[e.value])&&n("deselectable")?[]:[e.value],t.set("value",r)},focusNextToggle({context:t,scope:e,prop:n}){Ot(()=>{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}){Ot(()=>{var r;const i=t.get("focusedId");i&&((r=oA(e,i,n("loopFocus")))==null||r.focus({preventScroll:!0}))})},focusFirstToggle({scope:t}){Ot(()=>{var e;(e=tm(t))==null||e.focus({preventScroll:!0})})},focusLastToggle({scope:t}){Ot(()=>{var e;(e=rA(t))==null||e.focus({preventScroll:!0})})}}}};Kn()(["dir","disabled","getRootNode","id","ids","loopFocus","multiple","onValueChange","orientation","rovingFocus","value","defaultValue","deselectable"]);Kn()(["value","disabled"]);const Zy=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=mi(lA,{id:Qt(),...n,orientation:n.direction,defaultValue:n.modelValue,onValueChange:({value:a})=>{r("update:modelValue",a)},rovingFocus:!0,loopFocus:!0}),o=I(()=>sA(i,fi)),s=H();return xe(()=>{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"))}),xe(()=>n.modelValue,a=>{a.every(l=>o.value.value.includes(l))&&a.length===o.value.value.length||o.value.setValue([...a])},{deep:!1}),(a,l)=>(E(),O("div",re({class:["k-buttongroup",`k-buttongroup--direction-${a.direction}`]},o.value.getRootProps()),[L(a.$slots,"default",{getItemProps:o.value.getItemProps},()=>[a.items?(E(!0),O(Oe,{key:0},Mt(a.items,({id:u,...c})=>(E(),z(He,re({class:"k-buttongroup__item",variant:"tertiary",ref_for:!0},{...c,...o.value.getItemProps({value:u})}),null,16))),256)):P("",!0)]),a.dropdownItems||a.$slots.dropdown?(E(),z(wu,re({key:0,ref_key:"dropdown",ref:s,keepOpen:!0,items:a.dropdownItems},o.value.getItemProps({value:"dropdown"})),{default:ee(({close:u})=>[L(a.$slots,"dropdown",{close:u,getItemProps:o.value.getItemProps})]),_:3},16,["items"])):P("",!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},disablePreview:{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=I(()=>{let p=[...n,...r.icons].find(f=>r.value.type.match(f.pattern));return p?.icon||"fa-pro-solid:file"}),o=I(()=>r.disabled?"a":"div"),s=I(()=>r.disabled?{click:p=>{p.preventDefault(),gd(r.value)}}:{}),a=I(()=>r.disabled?{title:r.disabled?"Download":null}:{});function l(){r.disabled||gd(r.value)}const u=H(),c=H([]),d=H();function h(){var p;(p=u.value)==null||p.blur()}return(p,f)=>(E(),z(Qe(o.value),re({class:["k-file-thumbnail",{"k-file-thumbnail--clickable":p.disabled}]},a.value,Qg(s.value)),{default:ee(()=>[he(ni,{class:"k-file-thumbnail__preview",gap:"0rem",justify:"center",align:"center"},{default:ee(()=>[L(p.$slots,"icon",{},()=>[!r.disablePreview&&p.value.type.includes("image")&&p.value.url?(E(),O("a",{key:0,href:p.value.url,target:"_blank"},[he(vu,{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(),z(B(Ze),{key:1,icon:i.value,class:"k-file-thumbnail__preview-icon"},null,8,["icon"]))])]),_:3}),U("div",cA,[U("input",{type:"text",ref_key:"input",ref:u,class:"k-file-thumbnail__name",value:p.value.name,onKeypress:mp(h,["enter"]),disabled:p.disabled||!p.rename,onInput:f[0]||(f[0]=m=>p.$emit("rename",m.target.value))},null,40,dA),U("div",pA,[p.value.size?(E(),O("span",hA,oe(B(Wp)(p.value.size)),1)):P("",!0)])]),he(Zy,{modelValue:c.value,"onUpdate:modelValue":f[1]||(f[1]=m=>{c.value=m.filter(g=>g!=="download")}),disabled:p.disabled},{default:ee(({getItemProps:m})=>[p.value.url?(E(),z(He,re({key:0,is:"a",href:p.value.url,class:"k-file-thumbnail__download",onClick:Wa(l,["prevent"]),icon:"fa-pro-light:arrow-down-to-line",variant:"tertiary"},m({value:"download"})),null,16,["href"])):P("",!0)]),dropdown:ee(({close:m})=>[p.value.url?(E(),z(He,{key:0,is:"a",href:p.value.url,class:"k-file-thumbnail__download",onClick:Wa(l,["prevent"]),iconRight:"fa-pro-light:arrow-down-to-line",label:p.labels.download,variant:"tertiary"},null,8,["href","label"])):P("",!0),he(B(eA),null,{default:ee(({copy:g,copied:b})=>[p.value.url?(E(),z(He,{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"])):P("",!0)]),_:1}),p.disabled?P("",!0):(E(),z(He,{key:1,variant:"danger",label:p.labels.delete,class:"k-file-thumbnail__delete",iconRight:"fa-pro-light:times",onClick:()=>{p.$emit("delete"),m()}},null,8,["label","onClick"]))]),_:1},8,["modelValue","disabled"]),p.sortable?(E(),z(B(Ze),{key:0,icon:"fa-pro-solid:arrows-alt-v",class:"k-file-thumbnail__handle"})):P("",!0)]),_:3},16,["class"]))}}),mA={key:0,class:"k-file__label-wrapper"},gA={key:1,class:"k-file__sublabel"},DL=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."},fileSizeError:{default:"The file size exceeds the allowed limit."},rename:{type:Boolean,default:!0},accept:{},serialize:{type:Function,default:t=>t},required:{type:Boolean},disabled:{type:Boolean},disablePreview:{type:Boolean},icons:{default:()=>[]},labels:{default:()=>({delete:"Delete",download:"Download",copy:"Copy link",maxSize:"Maximum size"})}},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=I(()=>n.multiple||!n.modelValue),a=I({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:Se(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:Se(["k-file__label",{"k-file__label-required":u.required}])},[L(u.$slots,"label",{},()=>[Be(oe(u.label),1)])],2)):P("",!0),u.sublabel||u.$slots.sublabel?(E(),O("span",gA,[L(u.$slots,"sublabel",{},()=>[Be(oe(u.sublabel),1)])])):P("",!0)])):P("",!0),he(ni,{direction:"column"},{default:ee(()=>[a.value.length?(E(),z(B(Jy),{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:ee(({element:d,index:h})=>[(E(),z(fA,{key:d.url||h,disabled:u.disabled,sortable:!u.disabled&&u.sortable&&u.multiple&&a.value.length>1,"disable-preview":u.disablePreview,rename:u.rename===!0,value:u.serialize(d),onRename:p=>d.name=p,onDelete:p=>o(d),icons:u.icons,labels:u.labels},Ms({_:2},[Mt(u.$slots,(p,f)=>({name:f,fn:ee(()=>[L(u.$slots,f,{item:d})])}))]),1032,["disabled","sortable","disable-preview","rename","value","onRename","onDelete","icons","labels"]))]),_:3},8,["modelValue","disabled"])):P("",!0),s.value?(E(),z(QO,{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,fileSizeError:u.fileSizeError,rename:u.rename,labels:u.labels},{"drop-message":ee(({extensions:d})=>[L(u.$slots,"drop-message",{extensions:d})]),"custom-message":ee(()=>[L(u.$slots,"custom-message")]),_:3},8,["accept","value","multiple","required","disabled","upload-options","upload","dropMessage","fileSizeError","rename","labels"])):P("",!0)]),_:3})],2))}}),Qy=new Set,yt=new WeakMap,to=new WeakMap,oi=new WeakMap,Ed=new WeakMap,vA=new WeakMap,no=new WeakMap,cl=new WeakMap,Fo=new WeakSet;let Cr,Yp=0,Xp=0;const Ln="__aa_tgt",fs="__aa_del",dl="__aa_new",yA=t=>{const e=CA(t);e&&e.forEach(n=>SA(n))},bA=t=>{t.forEach(e=>{e.target===Cr&&wA(),yt.has(e.target)&&vi(e.target)})};function kA(t){const e=Ed.get(t);e?.disconnect();let n=yt.get(t),r=0;const i=5;n||(n=ro(t),yt.set(t,n));const{offsetWidth:o,offsetHeight:s}=Cr,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&&vi(t)},{root:Cr,threshold:1,rootMargin:a});l.observe(t),Ed.set(t,l)}function vi(t){clearTimeout(cl.get(t));const e=Ou(t),n=ms(e)?500:e.duration;cl.set(t,setTimeout(async()=>{const r=oi.get(t);try{await r?.finished,yt.set(t,ro(t)),kA(t)}catch{}},n))}function wA(){clearTimeout(cl.get(Cr)),cl.set(Cr,setTimeout(()=>{Qy.forEach(t=>rb(t,e=>eb(()=>vi(e))))},100))}function xA(t){setTimeout(()=>{vA.set(t,setInterval(()=>eb(vi.bind(null,t)),2e3))},Math.round(2e3*Math.random()))}function eb(t){typeof requestIdleCallback=="function"?requestIdleCallback(()=>t()):requestAnimationFrame(()=>t())}let Cd,Ko;const EA=typeof window<"u"&&"ResizeObserver"in window;EA&&(Cr=document.documentElement,Cd=new MutationObserver(yA),Ko=new ResizeObserver(bA),window.addEventListener("scroll",()=>{Xp=window.scrollY,Yp=window.scrollX}),Ko.observe(Cr));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(hc(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(fs in i)return!1;hc(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(fs in i)return!1;i instanceof Element&&(e.add(i),hc(n.target,i),to.set(i,[n.previousSibling,n.nextSibling]))}}return e},new Set)}function hc(t,e){!e&&!(Ln in t)?Object.defineProperty(t,Ln,{value:t}):e&&!(Ln in e)&&Object.defineProperty(e,Ln,{value:t})}function SA(t){var e;const n=t.isConnected,r=yt.has(t);n&&to.has(t)&&to.delete(t),oi.has(t)&&((e=oi.get(t))===null||e===void 0||e.cancel()),dl in t?rm(t):r&&n?OA(t):r&&!n?AA(t):rm(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 ro(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 tb(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 Ou(t){return Ln in t&&no.has(t[Ln])?no.get(t[Ln]):{duration:250,easing:"ease-in-out"}}function nb(t){if(Ln in t)return t[Ln]}function Zp(t){const e=nb(t);return e?Fo.has(e):!1}function rb(t,...e){e.forEach(n=>n(t,no.has(t)));for(let n=0;n<t.children.length;n++){const r=t.children.item(n);r&&e.forEach(i=>i(r,no.has(r)))}}function Qp(t){return Array.isArray(t)?t:[t]}function ms(t){return typeof t=="function"}function OA(t){const e=yt.get(t),n=ro(t);if(!Zp(t))return yt.set(t,n);let r;if(!e)return;const i=Ou(t);if(typeof i!="function"){const o=e.left-n.left,s=e.top-n.top,[a,l,u,c]=tb(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]=Qp(i(t,"remain",e,n));r=new Animation(o),r.play()}oi.set(t,r),yt.set(t,n),r.addEventListener("finish",vi.bind(null,t))}function rm(t){dl in t&&delete t[dl];const e=ro(t);yt.set(t,e);const n=Ou(t);if(!Zp(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]=Qp(n(t,"add",e));r=new Animation(i),r.play()}oi.set(t,r),r.addEventListener("finish",vi.bind(null,t))}function im(t,e){var n;t.remove(),yt.delete(t),to.delete(t),oi.delete(t),(n=Ed.get(t))===null||n===void 0||n.disconnect(),setTimeout(()=>{if(fs in t&&delete t[fs],Object.defineProperty(t,dl,{value:!0,configurable:!0}),e&&t instanceof HTMLElement)for(const r in e)t.style[r]=""},0)}function AA(t){var e;if(!to.has(t)||!yt.has(t))return;const[n,r]=to.get(t);Object.defineProperty(t,fs,{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=nb(t))===null||e===void 0||e.appendChild(t),!Zp(t))return im(t);const[s,a,l,u]=_A(t),c=Ou(t),d=yt.get(t);(i!==Yp||o!==Xp)&&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(!ms(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]=Qp(c(t,"remove",d));m?.styleReset!==!1&&(p=m?.styleReset||p,Object.assign(t.style,p)),h=new Animation(f),h.play()}oi.set(t,h),h.addEventListener("finish",im.bind(null,t,p))}function MA(t,e,n,r){const i=Yp-e,o=Xp-n,s=document.documentElement.style.scrollBehavior;if(getComputedStyle(Cr).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(!ms(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]=tb(t,e,ro(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)||ro(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 Cd&&Ko&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!ms(e)&&!e.disrespectUserMotionPreference||(Fo.add(t),getComputedStyle(t).position==="static"&&Object.assign(t.style,{position:"relative"}),rb(t,vi,xA,n=>Ko?.observe(n)),ms(e)?no.set(t,e):no.set(t,{duration:250,easing:"ease-in-out",...e}),Cd.observe(t,{childList:!0}),Qy.add(t))),Object.freeze({parent:t,enable:()=>{Fo.add(t)},disable:()=>{Fo.delete(t)},isEnabled:()=>Fo.has(t)})}const om={mounted:(t,e)=>{DA(t,e.value||{})},getSSRProps:()=>({})},IA=["disabled"],NA={key:0,class:"k-expandable__title"},RA={key:1,class:"k-expandable__subtitle"},PA={key:2,class:"k-expandable__actions"},IL=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=pp(),r=I(()=>n.actions),i=I(()=>n.footer),o=I(()=>n.default),s=H(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)=>qa((E(),O("fieldset",{disabled:u.disabled,class:Se(B(l)({disabled:u.disabled,expandable:u.expandable,expanded:s.value,variant:u.variant}))},[he(He,{class:Se(["k-expandable__header",{"k-expandable__header--open":s.value}]),is:"legend",tabindex:"0",onKeydown:mp(a,["enter"]),onClick:a,variant:"tertiary"},Ms({default:ee(()=>[u.$slots.title||u.title?(E(),O("span",NA,[L(u.$slots,"title",{},()=>[Be(oe(u.title),1)])])):P("",!0),u.$slots.subtitle||u.subtitle?(E(),O("span",RA,[L(u.$slots,"subtitle",{},()=>[Be(oe(u.subtitle),1)])])):P("",!0),r.value?(E(),O("span",PA,[L(u.$slots,"actions")])):P("",!0)]),_:2},[u.expandable?{name:"icon-left",fn:ee(()=>[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(Oe,{key:0},[qa((E(),z(ni,{class:"k-expandable__content",direction:"column",gap:u.gap},{default:ee(()=>[L(u.$slots,"default")]),_:3},8,["gap"])),[[B(om)]]),i.value?(E(),z(ni,{key:0,justify:"center",align:"center",class:"k-expandable__footer"},{default:ee(()=>[L(u.$slots,"footer")]),_:3})):P("",!0)],64)):P("",!0)],10,IA)),[[B(om)]])}});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 ib(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=ib(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function ob(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=ob(s.content,a.content,n-1,r-1);if(u)return u}n-=l,r-=l}}class D{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 D(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 D(r,i)}cutByIndex(e,n){return e==n?D.empty:e==0&&n==this.content.length?this:new D(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 D(i,o)}addToStart(e){return new D([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new D(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 ib(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return ob(this,e,n,r)}findIndex(e,n=-1){if(e==0)return ha(0,e);if(e==this.size)return ha(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?ha(r+1,s):ha(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 D.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new D(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return D.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 D(n||e,r)}static from(e){if(!e)return D.empty;if(e instanceof D)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new D([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}D.empty=new D([],0);const fc={index:0,offset:0};function ha(t,e){return fc.index=t,fc.offset=e,fc}function pl(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(!pl(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!pl(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let ke=class Sd{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&&pl(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 Sd.none;if(e instanceof Sd)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};ke.none=[];class hl 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=ab(this.content,e+this.openStart,n);return r&&new V(r,this.openStart,this.openEnd)}removeBetween(e,n){return new V(sb(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(D.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(D.empty,0,0);function sb(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(sb(o.content,e-i-1,n-i-1)))}function ab(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=ab(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 hl("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new hl("Inconsistent open depths");return lb(t,e,n,0)}function lb(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=lb(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 Yr(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=LA(n,t);return Yr(o,cb(t,s,a,e,r))}else return Yr(o,fl(t,e,r))}function ub(t,e){if(!e.type.compatibleContent(t.type))throw new hl("Cannot join "+e.type.name+" onto "+t.type.name)}function Td(t,e,n){let r=t.node(n);return ub(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 Go(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 Yr(t,e){return t.type.checkContent(e),t.copy(e)}function cb(t,e,n,r,i){let o=t.depth>i&&Td(t,e,i+1),s=r.depth>i&&Td(n,r,i+1),a=[];return Go(null,t,i,a),o&&s&&e.index(i)==n.index(i)?(ub(o,s),Jr(Yr(o,cb(t,e,n,r,i+1)),a)):(o&&Jr(Yr(o,fl(t,e,i+1)),a),Go(e,n,i,a),s&&Jr(Yr(s,fl(n,r,i+1)),a)),Go(r,null,i,a),new D(a)}function fl(t,e,n){let r=[];if(Go(null,t,n,r),t.depth>n){let i=Td(t,e,n+1);Jr(Yr(i,fl(t,e,n+1)),r)}return Go(e,null,n,r),new D(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(D.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class gs{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 ml(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 gs(n,r,o)}static resolveCached(e,n){let r=sm.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 sm.set(e,r=new BA);let i=r.elts[r.i]=gs.resolve(e,n);return r.i=(r.i+1)%VA,i}}class BA{constructor(){this.elts=[],this.i=0}}const VA=12,sm=new WeakMap;class ml{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 gr=class Od{constructor(e,n,r,i=ke.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||D.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&&pl(this.attrs,n||e.defaultAttrs||$A)&&ke.sameSet(this.marks,r||ke.none)}copy(e=null){return e==this.content?this:new Od(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Od(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 gs.resolveCached(this,e)}resolveNoCache(e){return gs.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()+")"),db(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=D.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=D.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};gr.prototype.text=void 0;class gl extends gr{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):db(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 gl(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new gl(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 db(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class si{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new jA(e,n);if(r.next==null)return si.empty;let i=pb(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 D.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
- `)}}si.empty=new si(!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 pb(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 am(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=am(t),r=n;return t.eat(",")&&(t.next!="}"?r=am(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=pb(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 hb(t,e){return e-t}function lm(t,e){let n=[];return r(e),n.sort(hb);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(lm(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]);lm(t,l).forEach(c=>{u||i.push([a,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let o=e[r.join(",")]=new si(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let a=i[s][1].sort(hb);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 fb(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 mb(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 gb(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 vb(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 um=class yb{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=vb(e,r.attrs),this.defaultAttrs=fb(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==si.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:mb(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new gr(this,this.computeAttrs(e),D.from(n),ke.setFrom(r))}createChecked(e=null,n,r){return n=D.from(n),this.checkContent(n),new gr(this,this.computeAttrs(e),n,ke.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=D.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(D.empty,!0);return o?new gr(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){gb(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 yb(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 YA(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"?YA(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Au{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=vb(e,i.attrs),this.excluded=null;let o=fb(this.attrs);this.instance=o?new ke(this,o):null}create(e=null){return!e&&this.instance?this.instance:new ke(this,mb(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new Au(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){gb(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class bb{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=um.compile(this.spec.nodes,this),this.marks=Au.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]=si.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?cm(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==""?[]:cm(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 um){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 gl(r,r.defaultAttrs,e,ke.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return gr.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 cm(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 vr{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 pm(this,n,!1);return r.addAll(e,ke.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new pm(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=hm(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=hm(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new vr(e,vr.schemaRules(e)))}}const kb={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},wb={ol:!0,ul:!0},vs=1,Ad=2,Jo=4;function dm(t,e,n){return e!=null?(e?vs:0)|(e==="full"?Ad:0):t&&t.whitespace=="pre"?vs|Ad:n&~Jo}class fa{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&Jo?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(D.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&vs)){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=D.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(D.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&&!kb.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class pm{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=dm(null,n.preserveWhitespace,0)|(r?Jo:0);i?o=new fa(i.type,i.attrs,ke.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new fa(null,null,ke.none,!0,null,s):o=new fa(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&Ad?"full":this.localPreserveWS||(i.options&vs)>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,!/\S/.test(r)),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;wb.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(kb.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,!0)}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,e.nodeName=="BR")||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,!1));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,r){let i,o;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],u=l.findWrapping(e);if(u&&(!i||i.length>u.length+a)&&(i=u,o=l,!u.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(o);for(let s=0;s<i.length;s++)n=this.enterInner(i[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let s=ke.none;for(let a of i.concat(e.marks))(o.type?o.type.allowsMarkType(a.type):fm(a.type,e.type))&&(s=a.addToSet(s));return o.content.push(e.mark(s)),!0}return!1}enter(e,n,r,i){let o=this.findPlace(e.create(n),r,!1);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=dm(e,o,s.options);s.options&Jo&&s.content.length==0&&(a|=Jo);let l=ke.none;return r=r.filter(u=>(s.type?s.type.allowsMarkType(u.type):fm(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new fa(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|=vs)}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&&wb.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 hm(t){let e={};for(let n in t)e[n]=t[n];return e}function fm(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 yi{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=mc(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}=Ba(mc(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&&Ba(mc(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Ba(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new yi(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=mm(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return mm(e.marks)}}function mm(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function mc(t){return t.document||window.document}const gm=new WeakMap;function rM(t){let e=gm.get(t);return e===void 0&&gm.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 Ba(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}=Ba(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 xb=65535,Eb=Math.pow(2,16);function oM(t,e){return t+e*Eb}function vm(t){return t&xb}function sM(t){return(t-(t&xb))/Eb}const Cb=1,Sb=2,Va=4,Tb=8;class Md{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Tb)>0}get deletedBefore(){return(this.delInfo&(Cb|Va))>0}get deletedAfter(){return(this.delInfo&(Sb|Va))>0}get deletedAcross(){return(this.delInfo&Va)>0}}class Tt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Tt.empty)return Tt.empty}recover(e){let n=0,r=vm(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?Sb:e==d?Cb:Va;return(n<0?e!=l:e!=d)&&(m|=Tb),new Md(p,m,f)}i+=c-u}return r?e+i:new Md(e+i,0,null)}touches(e,n){let r=0,i=vm(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 Tt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Tt.empty:new Tt(e<0?[0,-e,0]:[0,0,e])}}Tt.empty=new Tt([]);class ys{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new ys(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,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 ys;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 Md(e,i,null)}}const gc=Object.create(null);class at{getMap(){return Tt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=gc[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 gc)throw new RangeError("Duplicate use of step JSON ID "+e);return gc[e]=n,n.prototype.jsonID=e,n}}class Le{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Le(e,null)}static fail(e){return new Le(null,e)}static fromReplace(e,n,r,i){try{return Le.ok(e.replace(n,r,i))}catch(o){if(o instanceof hl)return Le.fail(o.message);throw o}}}function eh(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(eh(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return D.fromArray(r)}class ur extends at{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(eh(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 Le.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 ur(n.pos,r.pos,this.mark)}merge(e){return e instanceof ur&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ur(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 ur(n.from,n.to,e.markFromJSON(n.mark))}}at.jsonID("addMark",ur);class gn extends at{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(eh(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Le.fromReplace(e,this.from,this.to,r)}invert(){return new ur(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))}}at.jsonID("removeMark",gn);class cr extends at{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Le.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Le.fromReplace(e,this.pos,this.pos+1,new V(D.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 cr(this.pos,n.marks[i]);return new cr(this.pos,this.mark)}}return new ai(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new cr(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 cr(n.pos,e.markFromJSON(n.mark))}}at.jsonID("addNodeMark",cr);class ai extends at{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Le.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Le.fromReplace(e,this.pos,this.pos+1,new V(D.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new cr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ai(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 ai(n.pos,e.markFromJSON(n.mark))}}at.jsonID("removeNodeMark",ai);class ze extends at{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&_d(e,this.from,this.to)?Le.fail("Structure replace would overwrite content"):Le.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Tt([this.from,this.to-this.from,this.slice.size])}invert(e){return new ze(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 ze(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ze)||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 ze(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 ze(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 ze(n.from,n.to,V.fromJSON(e,n.slice),!!n.structure)}}at.jsonID("replace",ze);class qe extends at{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&&(_d(e,this.from,this.gapFrom)||_d(e,this.gapTo,this.to)))return Le.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Le.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Le.fromReplace(e,this.from,this.to,r):Le.fail("Content does not fit in gap")}getMap(){return new Tt([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)}}at.jsonID("replaceAround",qe);function _d(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 ur(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 Au){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 th(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 ze(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(D.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),s.push(new ze(a+h.index,a+h.index+h[0].length,f))}}a=c}if(!r.validEnd){let l=r.fillBefore(D.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 mo(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=D.empty,d=0;for(let f=o,m=!1;f>n;f--)m||r.index(f)>0?(m=!0,c=D.from(r.node(f).copy(c)),d++):l--;let h=D.empty,p=0;for(let f=o,m=!1;f>n;f--)m||i.after(f+1)<i.end(f)?(m=!0,h=D.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 nh(t,e,n=null,r=t){let i=dM(t,e),o=i&&pM(r,e);return o?i.map(ym).concat({type:e,attrs:n}).concat(o.map(ym)):null}function ym(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=D.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=D.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&&Ab(t,s,a,o),th(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(D.from(r.create(l,null,s.marks)),0,0),1,!0)),u===!0&&Ob(t,s,a,o),!1}})}function Ob(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 Ab(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(D.from(s),0,0),1,!0))}function Ki(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=D.empty,s=D.empty;for(let a=i.depth,l=i.depth-n,u=n-1;a>l;a--,u--){o=D.from(i.node(a).copy(o));let c=r&&r[u];s=D.from(c?c.type.create(c.attrs,s):i.node(a).copy(s))}t.step(new ze(e,e,new V(o.append(s),n,n),!0))}function Tr(t,e){let n=t.resolve(e),r=n.index();return Mb(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 Mb(t,e){return!!(t&&e&&!t.isLeaf&&yM(t,e))}function Mu(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&&Mb(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);Ab(t,c.node(),c.before(),a)}s.inlineContent&&th(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 ze(u,l.map(e+n,-1),V.empty,!0)),r===!0){let c=t.doc.resolve(u);Ob(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 _b(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 _u(t,e,n=e,r=V.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return Db(i,o,r)?new ze(e,n,r):new wM(i,o,r).fit()}function Db(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=D.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=D.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 ze(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=vc(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(D.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=vc(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=vc(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new V(Lo(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new V(Lo(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(Ib(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=Bo(this.placed,n,D.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 b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=f?e==0?V.empty:new V(Lo(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new V(Lo(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||!yc(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=yc(e,n,i,r,o);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:u}=this.frontier[a],c=yc(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=Bo(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=Bo(this.placed,this.depth,D.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(D.empty,!0);e.childCount&&(this.placed=Bo(this.placed,this.frontier.length,e))}}function Lo(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Lo(t.firstChild.content,e-1,n)))}function Bo(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Bo(t.lastChild.content,e-1,n)))}function vc(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Ib(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Ib(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(D.empty,!0)))),t.copy(r)}function yc(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(Db(i,o,r))return t.step(new ze(e,n,r));let s=Rb(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],b=!0;g<0&&(b=!1,g=-g);let y=i.node(g-1),k=i.index(g-1);if(y.canReplaceWith(k,k,f.type,f.marks))return t.replace(i.before(g),b?o.after(g):n,new V(Nb(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 Nb(t,e,n,r,i){if(e<n){let o=t.firstChild;t=t.replaceChild(0,o.copy(Nb(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(D.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(D.from(r),0,0))}function TM(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=Rb(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 Rb(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 Gi extends at{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 Le.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 Le.fromReplace(e,this.pos,this.pos+1,new V(D.from(i),0,n.isLeaf?0:1))}getMap(){return Tt.empty}invert(e){return new Gi(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 Gi(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 Gi(n.pos,n.attr,n.value)}}at.jsonID("attr",Gi);class bs extends at{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 Le.ok(r)}getMap(){return Tt.empty}invert(e){return new bs(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 bs(n.attr,n.value)}}at.jsonID("docAttr",bs);let io=class extends Error{};io=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};io.prototype=Object.create(Error.prototype);io.prototype.constructor=io;io.prototype.name="TransformError";class Pb{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ys}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new io(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=_u(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new V(D.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 Gi(e,n,r)),this}setDocAttribute(e,n){return this.step(new bs(e,n)),this}addNodeMark(e,n){return this.step(new cr(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof ke)n.isInSet(r.marks)&&this.step(new ai(e,n));else{let i=r.marks,o,s=[];for(;o=n.isInSet(i);)s.push(new ai(e,o)),i=o.removeFromSet(i);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return 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 th(this,e,n,r),this}}const bc=Object.create(null);class ue{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&&wm(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),wm(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new ae(e):Ri(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?Ri(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Ri(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 $t(e.node(0))}static atStart(e){return Ri(e,e,0,0,1)||new $t(e)}static atEnd(e){return Ri(e,e,e.content.size,e.childCount,-1)||new $t(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=bc[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 bc)throw new RangeError("Duplicate use of selection JSON ID "+e);return bc[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ae.between(this.$anchor,this.$head).getBookmark()}}ue.prototype.visible=!0;class OM{constructor(e,n){this.$from=e,this.$to=n}}let bm=!1;function km(t){!bm&&!t.parent.inlineContent&&(bm=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ae extends ue{constructor(e,n=e){km(e),km(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 ue.near(r);let i=e.resolve(n.map(this.anchor));return new ae(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 ae&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Du(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 ae(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=ue.findFrom(n,r,!0)||ue.findFrom(n,-r,!0);if(o)n=o.$head;else return ue.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(ue.findFrom(e,-r,!0)||ue.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new ae(e,n)}}ue.jsonID("text",ae);class Du{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Du(e.map(this.anchor),e.map(this.head))}resolve(e){return ae.between(e.resolve(this.anchor),e.resolve(this.head))}}class Z extends ue{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?ue.near(o):new Z(o)}content(){return new V(D.from(this.node),0,0)}eq(e){return e instanceof Z&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new rh(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Z(e.resolve(n.anchor))}static create(e,n){return new Z(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Z.prototype.visible=!1;ue.jsonID("node",Z);class rh{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Du(r,r):new rh(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Z.isSelectable(r)?new Z(n):ue.near(n)}}class $t extends ue{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=ue.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new $t(e)}map(e){return new $t(e)}eq(e){return e instanceof $t}getBookmark(){return AM}}ue.jsonID("all",$t);const AM={map(){return this},resolve(t){return new $t(t)}};function Ri(t,e,n,r,i,o=!1){if(e.inlineContent)return ae.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&&Z.isSelectable(a))return Z.create(t,n-(i<0?a.nodeSize:0))}else{let l=Ri(t,a,n+i,i<0?a.childCount:0,i,o);if(l)return l}n+=a.nodeSize*i}return null}function wm(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof ze||i instanceof qe))return;let o=t.mapping.maps[r],s;o.forEach((a,l,u,c)=>{s==null&&(s=c)}),t.setSelection(ue.near(t.doc.resolve(s),n))}const xm=1,ma=2,Em=4;class MM extends Pb{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|xm)&~ma,this.storedMarks=null,this}get selectionSet(){return(this.updated&xm)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ma,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&ma)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~ma,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(ue.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|=Em,this}get scrolledIntoView(){return(this.updated&Em)>0}}function Cm(t,e){return!e||!t?t:t.bind(e)}class Vo{constructor(e,n,r){this.name=e,this.init=Cm(n.init,r),this.apply=Cm(n.apply,r)}}const _M=[new Vo("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Vo("selection",{init(t,e){return t.selection||ue.atStart(e.doc)},apply(t){return t.selection}}),new Vo("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Vo("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class kc{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 Vo(r.key,r.spec.state,r))})}}class Hi{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 Hi(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 kc(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Hi(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 kc(this.schema,e.plugins),r=n.fields,i=new Hi(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 kc(e.schema,e.plugins),o=new Hi(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=gr.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=ue.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 Fb(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Fb(i,e,{})),n[r]=i}return n}class $e{constructor(e){this.spec=e,this.props={},e.props&&Fb(e.props,this,this.props),this.key=e.key?e.key.key:Lb("plugin")}getState(e){return e[this.key]}}const wc=Object.create(null);function Lb(t){return t in wc?t+"$"+ ++wc[t]:(wc[t]=0,t+"$")}class lt{constructor(e="key"){this.key=Lb(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ye=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},oo=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Dd=null;const Pn=function(t,e,n){let r=Dd||(Dd=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},DM=function(){Dd=null},li=function(t,e,n,r){return n&&(Sm(t,e,n,r,-1)||Sm(t,e,n,r,1))},IM=/^(img|br|input|textarea|hr)$/i;function Sm(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Vt(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Ls(t)||IM.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ye(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?Vt(t):0}else return!1}}function Vt(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=Vt(t)}else if(t.parentNode&&!Ls(t))e=Ye(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&&!Ls(t))e=Ye(t)+1,t=t.parentNode;else return null}}function PM(t,e,n){for(let r=e==0,i=e==Vt(t);r||i;){if(t==n)return!0;let o=Ye(t);if(t=t.parentNode,!t)return!1;r=r&&o==0,i=i&&o==Vt(t)}}function Ls(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 Iu=function(t){return t.focusNode&&li(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function jr(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(Vt(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Vt(r.startContainer),r.startOffset)}}}const En=typeof navigator<"u"?navigator:null,Tm=typeof document<"u"?document:null,Or=En&&En.userAgent||"",Id=/Edge\/(\d+)/.exec(Or),Bb=/MSIE \d/.exec(Or),Nd=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Or),bt=!!(Bb||Nd||Id),yr=Bb?document.documentMode:Nd?+Nd[1]:Id?+Id[1]:0,nn=!bt&&/gecko\/(\d+)/i.test(Or);nn&&+(/Firefox\/(\d+)/.exec(Or)||[0,0])[1];const Rd=!bt&&/Chrome\/(\d+)/.exec(Or),rt=!!Rd,Vb=Rd?+Rd[1]:0,ht=!bt&&!!En&&/Apple Computer/.test(En.vendor),so=ht&&(/Mobile\/\w+/.test(Or)||!!En&&En.maxTouchPoints>2),Lt=so||(En?/Mac/.test(En.platform):!1),BM=En?/Win/.test(En.platform):!1,Bn=/Android \d/.test(Or),Bs=!!Tm&&"webkitFontSmoothing"in Tm.documentElement.style,VM=Bs?+(/\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 _n(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 Om(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;){if(s.nodeType!=1){s=oo(s);continue}let a=s,l=a==o.body,u=l?$M(o):jM(a),c=0,d=0;if(e.top<u.top+_n(r,"top")?d=-(u.top-e.top+_n(i,"top")):e.bottom>u.bottom-_n(r,"bottom")&&(d=e.bottom-e.top>u.bottom-u.top?e.top+_n(i,"top")-u.top:e.bottom-u.bottom+_n(i,"bottom")),e.left<u.left+_n(r,"left")?c=-(u.left-e.left+_n(i,"left")):e.right>u.right-_n(r,"right")&&(c=e.right-u.right+_n(i,"right")),c||d)if(l)o.defaultView.scrollBy(c,d);else{let p=a.scrollLeft,f=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);let m=a.scrollLeft-p,g=a.scrollTop-f;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let h=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(h))break;s=h=="absolute"?s.offsetParent:oo(s)}}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:$b(t.dom)}}function $b(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=oo(r));return e}function HM({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;jb(n,r==0?0:r-e)}function jb(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 Mi=null;function qM(t){if(t.setActive)return t.setActive();if(Mi)return t.focus(Mi);let e=$b(t);t.focus(Mi==null?{get preventScroll(){return Mi={preventScroll:!0},!0}}:void 0),Mi||(Mi=!1,jb(e,0))}function zb(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=Pn(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}:zb(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=er(r,1);if(o.top!=o.bottom&&ih(e,o))return{node:t,offset:i+(e.left>=(o.left+o.right)/2?1:0)}}return{node:t,offset:0}}function ih(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}=zb(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 Hb(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(ih(e,u))return Hb(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(!ih(e,u)||(s=Hb(t.dom,e,u),!s))return null}if(ht)for(let u=s;r&&u;u=oo(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;Bs&&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 Am(t){return t.top<t.bottom||t.left<t.right}function er(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Am(r))return r}return Array.prototype.find.call(n,Am)||t.getBoundingClientRect()}const YM=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function qb(t,e,n){let{node:r,offset:i,atom:o}=t.docView.domFromPos(e,n<0?-1:1),s=Bs||nn;if(r.nodeType==3)if(s&&(YM.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let a=er(Pn(r,i,i),n);if(nn&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let l=er(Pn(r,i-1,i-1),-1);if(l.top==a.top){let u=er(Pn(r,i,i+1),-1);if(u.top!=a.top)return To(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++,To(er(Pn(r,a,l),u),u<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==Vt(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return xc(a.getBoundingClientRect(),!1)}if(o==null&&i<Vt(r)){let a=r.childNodes[i];if(a.nodeType==1)return xc(a.getBoundingClientRect(),!0)}return xc(r.getBoundingClientRect(),n>=0)}if(o==null&&i&&(n<0||i==Vt(r))){let a=r.childNodes[i-1],l=a.nodeType==3?Pn(a,Vt(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(l)return To(er(l,1),!1)}if(o==null&&i<Vt(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let l=a?a.nodeType==3?Pn(a,0,s?0:1):a.nodeType==1?a:null:null;if(l)return To(er(l,-1),!0)}return To(er(r.nodeType==3?Pn(r):r,-n),n>=0)}function To(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 xc(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 Wb(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 Wb(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=qb(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=Pn(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:Wb(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 Mm=null,_m=null,Dm=!1;function e_(t,e,n){return Mm==e&&_m==n?Dm:(Mm=e,_m=n,Dm=n=="up"||n=="down"?XM(t,e,n):QM(t,e,n))}const jt=0,Im=1,qr=2,Cn=3;class Vs{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=jt,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>Ye(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 Kb){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 Ub&&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?Ye(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?Ye(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=Ye(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=Ye(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||ht)&&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:Ye(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.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&&ht)&&li(a.node,a.offset,c.anchorNode,c.anchorOffset)&&li(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?qr:Im,e==a&&n==l&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Cn:o.markDirty(e-a,n-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?qr:Cn}r=s}this.dirty=qr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?qr:Im;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class Ub extends Vs{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==jt&&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 Vs{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 ui extends Vs{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=yi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ui(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Cn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Cn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=jt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=jt}}slice(e,n,r){let i=ui.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;n<s&&(o=Fd(o,n,s,r)),e>0&&(o=Fd(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 br extends Vs{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}=yi.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=Yb(c,r,n),u?l=new n_(e,n,r,i,c,d||null,h,u,o,s+1):n.isText?new Nu(e,n,r,i,c,h,o):new br(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=()=>D.empty)}return e}matchesNode(e,n,r){return this.dirty==jt&&e.eq(this.node)&&vl(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==qr)&&(s&&this.protectLocalComposition(e,s),Gb(this.contentDOM,this.children,e),so&&l_(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof ae)||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=Fd(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==Cn||!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=jt}updateOuterDeco(e){if(vl(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Jb(this.dom,this.nodeDOM,Pd(this.outerDeco,this.node,n),Pd(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 Nm(t,e,n,r,i){Yb(r,e,t);let o=new br(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Nu extends br{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==Cn||this.dirty!=jt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=jt||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=jt,!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 Nu(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=Cn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Kb extends Vs{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==jt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class n_ extends br{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==Cn)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 Gb(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=Rm(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(s instanceof ui){let l=r?r.previousSibling:t.lastChild;Gb(s.contentDOM,s.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=Rm(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Yo=function(t){t&&(this.nodeName=t)};Yo.prototype=Object.create(null);const Wr=[new Yo];function Pd(t,e,n){if(t.length==0)return Wr;let r=n?Wr[0]:new Yo,i=[r];for(let o=0;o<t.length;o++){let s=t[o].type.attrs;if(s){s.nodeName&&i.push(r=new Yo(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&i.length==1&&i.push(r=new Yo(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 Jb(t,e,n,r){if(n==Wr&&r==Wr)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=Wr[0]),i=l}r_(i,a||Wr[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 Yb(t,e,n){return Jb(t,t,Wr,Pd(e,n,t.nodeType!=1))}function vl(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 Rm(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=jt,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=ui.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==Cn&&s.dom==s.contentDOM&&(s.dirty=qr),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 br){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!=Cn&&vl(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=qr,d.updateChildren(i,s+1),d.dirty=jt),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)||!vl(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=br.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=br.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 Ub(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 ui;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Nu)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ht||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 Kb(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 ui)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 b=0;b<a.length;b++)a[b].to<g&&(g=a[b].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 Fd(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 oh(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(Iu(n)){for(l=s;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&Z.isSelectable(d)&&i.parent&&!(d.isInline&&PM(n.focusNode,n.focusOffset,i.dom))){let h=i.posBefore;u=new Z(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=sh(t,c,a,d)}return u}function Xb(t){return t.editable?t.hasFocus():Qb(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function zn(t,e=!1){let n=t.state.selection;if(Zb(t,n),!!Xb(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&rt){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&li(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;Pm&&!(n instanceof ae)&&(n.$from.parent.inlineContent||(o=Fm(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=Fm(t,n.to))),t.docView.setSelection(r,i,t,e),Pm&&(o&&Lm(o),s&&Lm(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 Pm=ht||rt&&Vb<63;function Fm(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(ht&&i&&i.contentEditable=="false")return Ec(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Ec(i);if(o)return Ec(o)}}function Ec(t){return t.contentEditable="true",ht&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Lm(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(()=>{(!Xb(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,Ye(r)+1):n.setStart(r,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!i&&!t.state.selection.visible&&bt&&yr<=11&&(r.disabled=!0,r.disabled=!1)}function Zb(t,e){if(e instanceof Z){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Bm(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Bm(t)}function Bm(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function sh(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||ae.between(e,n,r)}function Vm(t){return t.editable&&!t.hasFocus()?!1:Qb(t)}function Qb(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 li(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Ld(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&&ue.findFrom(o,e)}function nr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function $m(t,e,n){let r=t.state.selection;if(r instanceof ae)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 nr(t,new ae(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Ld(t.state,e);return i&&i instanceof Z?nr(t,i):!1}else if(!(Lt&&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?Z.isSelectable(o)?nr(t,new Z(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):Bs?nr(t,new ae(t.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Z&&r.node.isInline)return nr(t,new ae(e>0?r.$to:r.$from));{let i=Ld(t.state,e);return i?nr(t,i):!1}}}function yl(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Xo(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function _i(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<yl(n)&&Xo(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Xo(a,-1))i=n,o=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(e0(n))break;{let a=n.previousSibling;for(;a&&Xo(a,-1);)i=n.parentNode,o=Ye(a),a=a.previousSibling;if(a)n=a,r=yl(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?Bd(t,n,r):i&&Bd(t,i,o)}function f_(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=yl(n),o,s;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Xo(a,1))o=n,s=++r;else break}else{if(e0(n))break;{let a=n.nextSibling;for(;a&&Xo(a,1);)o=a.parentNode,s=Ye(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=yl(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}o&&Bd(t,o,s)}function e0(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function m_(t,e){for(;t&&e==t.childNodes.length&&!Ls(t);)e=Ye(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&&!Ls(t);)e=Ye(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 Bd(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(Iu(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&&zn(t)},50)}function jm(t,e){let n=t.state.doc.resolve(e);if(!(rt||BM)&&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 zm(t,e,n){let r=t.state.selection;if(r instanceof ae&&!r.empty||n.indexOf("s")>-1||Lt&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Ld(t.state,e);if(s&&s instanceof Z)return nr(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,a=r instanceof $t?ue.near(s,e):ue.findFrom(s,e);return a?nr(t,a):!1}return!1}function Hm(t,e){if(!(t.state.selection instanceof ae))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 qm(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function v_(t){if(!ht||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;qm(t,r,"true"),setTimeout(()=>qm(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||Lt&&n==72&&r=="c")return Hm(t,-1)||_i(t,-1);if(n==46&&!e.shiftKey||Lt&&n==68&&r=="c")return Hm(t,1)||_i(t,1);if(n==13||n==27)return!0;if(n==37||Lt&&n==66&&r=="c"){let i=n==37?jm(t,t.state.selection.from)=="ltr"?-1:1:-1;return $m(t,i,r)||_i(t,i)}else if(n==39||Lt&&n==70&&r=="c"){let i=n==39?jm(t,t.state.selection.from)=="ltr"?1:-1:1;return $m(t,i,r)||_i(t,i)}else{if(n==38||Lt&&n==80&&r=="c")return zm(t,-1,r)||_i(t,-1);if(n==40||Lt&&n==78&&r=="c")return v_(t)||zm(t,1,r)||_i(t,1);if(r==(Lt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function ah(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")||yi.fromSchema(t.state.schema),a=s0(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let u=l.firstChild,c,d=0;for(;u&&u.nodeType==1&&(c=o0[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
-
15
- `);return{dom:l,text:h,slice:e}}function t0(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(D.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=yi.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),Bs&&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")||vr.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_(Wm(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=Wm(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&&r0(a,i,s,o[o.length-1],0))o[o.length-1]=l;else{o.length&&(o[o.length-1]=i0(o[o.length-1],i.length));let u=n0(s,a);o.push(u),r=r.matchType(u.type),i=a}}),o)return D.from(o)}return t}function n0(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,D.from(t));return t}function r0(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let o=r0(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(D.from(n0(n,t,i+1))))}}function i0(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,i0(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(D.empty,!0);return t.copy(n.append(r))}function Vd(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=Vd(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(D.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function Wm(t,e,n){return e<t.openStart&&(t=new V(Vd(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new V(Vd(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const o0={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 Um=null;function s0(){return Um||(Um=document.implementation.createHTMLDocument("title"))}let Cc=null;function x_(t){let e=window.trustedTypes;return e?(Cc||(Cc=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Cc.createHTML(t)):t}function E_(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=s0().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&o0[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=D.from(l.create(r[a+1],i)),o++,s++}return new V(i,o,s)}const ft={},mt={},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:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function A_(t){for(let e in ft){let n=ft[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{__(t,r)&&!lh(t,r)&&(t.editable||!(r.type in mt))&&n(t,r)},T_[e]?{passive:!0}:void 0)}ht&&t.dom.addEventListener("input",()=>null),$d(t)}function dr(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 $d(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>lh(t,r))})}function lh(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){!lh(t,e)&&ft[e.type]&&(t.editable||!(e.type in mt))&&ft[e.type](t,e)}mt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!l0(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Bn&&rt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),so&&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,jr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||b_(t,n)?n.preventDefault():dr(t,"key")};mt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};mt.keypress=(t,e)=>{let n=e;if(l0(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Lt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof ae)||!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 Ru(t){return{left:t.clientX,top:t.clientY}}function I_(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function uh(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 Ji(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&&Z.isSelectable(r)?(Ji(t,new Z(n)),!0):!1}function R_(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Z&&(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(Z.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?(Ji(t,Z.create(t.state.doc,i)),!0):!1}function P_(t,e,n,r,i){return uh(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?R_(t,n):N_(t,n))}function F_(t,e,n,r){return uh(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function L_(t,e,n,r){return uh(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||B_(t,n,r)}function B_(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Ji(t,ae.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)Ji(t,ae.create(r,a+1,a+1+s.content.size));else if(Z.isSelectable(s))Ji(t,Z.create(r,a));else continue;return!0}}function ch(t){return bl(t)}const a0=Lt?"metaKey":"ctrlKey";ft.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=ch(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&I_(n,t.input.lastClick)&&!n[a0]&&t.input.lastClick.button==n.button&&(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,button:n.button};let s=t.posAtCoords(Ru(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new V_(t,s,n,!!r)):(o=="doubleClick"?F_:L_)(t,s.pos,s.inside,n)?n.preventDefault():dr(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[a0],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 Z&&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)),dr(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(()=>zn(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(Ru(e))),this.updateAllowDefault(e),this.allowDefault||!n?dr(this.view,"pointer"):P_(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ht&&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)?(Ji(this.view,ue.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):dr(this.view,"pointer")}move(e){this.updateAllowDefault(e),dr(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)}}ft.touchstart=t=>{t.input.lastTouch=Date.now(),ch(t),dr(t,"pointer")};ft.touchmove=t=>{t.input.lastTouch=Date.now(),dr(t,"pointer")};ft.contextmenu=t=>ch(t);function l0(t,e){return t.composing?!0:ht&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const $_=Bn?5e3:-1;mt.compositionstart=mt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ae&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),bl(t,!0),t.markCursor=null;else if(bl(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}u0(t,$_)};mt.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++,u0(t,20))};function u0(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>bl(t),e))}function c0(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=NM(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 bl(t,e=!1){if(!(Bn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),c0(t),e||t.docView&&t.docView.dirty){let n=oh(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?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 ks=bt&&yr<15||so&&VM<604;ft.copy=mt.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=ks?null:n.clipboardData,s=r.content(),{dom:a,text:l}=ah(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?ws(t,r.value,null,i,e):ws(t,r.textContent,r.innerHTML,i,e)},50)}function ws(t,e,n,r,i){let o=t0(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 d0(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," "):""}mt.paste=(t,e)=>{let n=e;if(t.composing&&!Bn)return;let r=ks?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ws(t,d0(r),r.getData("text/html"),i,n)?n.preventDefault():W_(t,n)};class p0{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const U_=Lt?"altKey":"ctrlKey";function h0(t,e){return t.someProp("dragCopies",r=>!r(e))??!e[U_]}ft.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(Ru(n)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof Z?i.to-1:i.to))){if(r&&r.mightDrag)s=Z.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=Z.create(t.state.doc,d.posBefore))}}let a=(s||t.state.selection).content(),{dom:l,text:u,slice:c}=ah(t,a);(!n.dataTransfer.files.length||!rt||Vb>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ks?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ks||n.dataTransfer.setData("text/plain",u),t.dragging=new p0(c,h0(t,n),s)};ft.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};mt.dragover=mt.dragenter=(t,e)=>e.preventDefault();mt.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(Ru(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=t0(t,d0(n.dataTransfer),ks?null:n.dataTransfer.getData("text/html"),!1,o);let a=!!(r&&h0(t,n));if(t.someProp("handleDrop",f=>f(t,n,s||V.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?_b(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&&Z.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new Z(p));else{let f=u.mapping.map(l);u.mapping.maps[u.mapping.maps.length-1].forEach((m,g,b,y)=>f=y),u.setSelection(sh(t,p,u.doc.resolve(f)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))};ft.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())&&zn(t)},20))};ft.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)};ft.beforeinput=(t,e)=>{if(rt&&Bn&&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,jr(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 mt)ft[t]=mt[t];function xs(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 kl{constructor(e,n){this.toDOM=e,this.spec=n||Xr,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 At(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof kl&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&xs(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class kr{constructor(e,n){this.attrs=e,this.spec=n||Xr}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 At(o,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof kr&&xs(this.attrs,e.attrs)&&xs(this.spec,e.spec)}static is(e){return e.type instanceof kr}destroy(){}}class dh{constructor(e,n){this.attrs=e,this.spec=n||Xr}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 At(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 dh&&xs(this.attrs,e.attrs)&&xs(this.spec,e.spec)}destroy(){}}class At{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new At(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 At(e,e,new kl(n,r))}static inline(e,n,r,i){return new At(e,n,new kr(r,i))}static node(e,n,r,i){return new At(e,n,new dh(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof kr}get widget(){return this.type instanceof kl}}const Pi=[],Xr={};class Fe{constructor(e,n){this.local=e.length?e:Pi,this.children=n.length?n:Pi}static create(e,n){return n.length?wl(n,e,0,Xr):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||Xr)}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?K_(this.children,s||[],e,n,r,i,o):s?new Fe(s.sort(Zr),Pi):nt}add(e,n){return n.length?this==nt?Fe.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=m0(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,wl(c,a,u+1,Xr)),o+=3}});let s=f0(o?g0(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new Fe(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 Fe(i,r):nt}forChild(e,n){if(this==nt)return this;if(n.isLeaf)return Fe.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 kr){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 Fe(i.sort(Zr),Pi);return r?new sr([a,r]):a}return r||nt}eq(e){if(this==e)return!0;if(!(e instanceof Fe)||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 ph(this.localsInner(e))}localsInner(e){if(this==nt)return Pi;if(e.inlineContent||!this.local.some(kr.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof kr||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Fe.empty=new Fe([],[]);Fe.removeOverlap=ph;const nt=Fe.empty;class sr{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Xr));return sr.from(r)}forChild(e,n){if(n.isLeaf)return Fe.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,n);o!=nt&&(o instanceof sr?r=r.concat(o.members):r.push(o))}return sr.from(r)}eq(e){if(!(e instanceof sr)||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?ph(r?n:n.sort(Zr)):Pi}static from(e){switch(e.length){case 0:return nt;case 1:return e[0];default:return new sr(e.every(n=>n instanceof Fe)?e:e.reduce((n,r)=>n.concat(r instanceof Fe?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function K_(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 b=0;b<a.length;b+=3){let y=a[b+1];if(y<0||h>y+c-d)continue;let k=a[b]+c-d;p>=k?a[b+1]=h<=k?-2:-1:h>=c&&g&&(a[b]+=g,a[b+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 b=a[u+2].mapInner(n,g,c+1,t[u]+o+1,s);b!=nt?(a[u]=d,a[u+1]=p,a[u+2]=b):(a[u+1]=-2,l=!0)}else l=!0}if(l){let u=G_(a,t,e,n,i,o,s),c=wl(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 Fe(e.sort(Zr),a)}function f0(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 At(i.from+e,i.to+e,i.type))}return n}function G_(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 m0(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 g0(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function wl(t,e,n,r){let i=[],o=!1;e.forEach((a,l)=>{let u=m0(t,a,l+n);if(u){o=!0;let c=wl(u,a,n+l+1,r);c!=nt&&i.push(l,l+a.nodeSize,c)}});let s=f0(o?g0(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 Fe(s,i):nt}function Zr(t,e){return t.from-e.from||t.to-e.to}function ph(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),Km(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),Km(e,i,r.copy(o.from,r.to)));break}}}return e}function Km(t,e,n){for(;e<t.length&&Zr(n,t[e])>0;)e++;t.splice(e,0,n)}function Sc(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=nt&&e.push(r)}),t.cursorWrapper&&e.push(Fe.create(t.state.doc,[t.cursorWrapper.deco])),sr.from(e)}const J_={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Y_=bt&&yr<=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 Z_{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&&yr<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Y_&&(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,J_)),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(Vm(this.view)){if(this.suppressingSelectionUpdates)return zn(this.view);if(bt&&yr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&li(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=oo(o))n.add(o);for(let o=e.anchorNode;o;o=oo(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)&&Vm(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||tD(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&&Iu(r)&&(u=oh(e))&&u.eq(ue.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,zn(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),Q_(e)),this.handleDOMChange(o,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||zn(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&&yr<=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?Ye(i)+1:0,a=r.localPosFromDOM(e.target,s,-1),l=o&&o.parentNode==e.target?Ye(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 Gm=new WeakMap,Jm=!1;function Q_(t){if(!Gm.has(t)&&(Gm.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=nn,Jm)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."),Jm=!0}}function Ym(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return li(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function eD(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Ym(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?Ym(t,n):null}function tD(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 nD(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}],Iu(l)||u.push({node:l.focusNode,offset:l.focusOffset})),rt&&t.input.lastKeyCode===8)for(let g=o;g>i;g--){let b=r.childNodes[g-1],y=b.pmViewDesc;if(b.nodeName=="BR"&&!y){o=g;break}if(!y||y.size)break}let d=t.state.doc,h=t.someProp("domParser")||vr.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:rD,context:p});if(u&&u[0].pos!=null){let g=u[0].pos,b=u[1]&&u[1].pos;b==null&&(b=g),f={anchor:g+s,head:b+s}}return{doc:m,sel:f,from:s,to:a}}function rD(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(ht&&/^(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||ht&&/^(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 iD=/^(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 oD(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let T=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,A=oh(t,T);if(A&&!t.state.selection.eq(A)){if(rt&&Bn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",N=>N(t,jr(13,"Enter"))))return;let _=t.state.tr.setSelection(A);T=="pointer"?_.setMeta("pointer",!0):T=="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=nD(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=lD(d.content,u.doc.content,u.from,h,p);if(f&&t.input.domChangeCount++,(so&&t.input.lastIOSEnter>Date.now()-225||Bn)&&i.some(T=>T.nodeType==1&&!iD.test(T.nodeName))&&(!f||f.endA>=f.endB)&&t.someProp("handleKeyDown",T=>T(t,jr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!f)if(r&&l instanceof ae&&!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 T=Xm(t,t.state.doc,u.sel);if(T&&!T.eq(t.state.selection)){let A=t.state.tr.setSelection(T);o&&A.setMeta("composition",o),t.dispatch(A)}}return}t.state.selection.from<t.state.selection.to&&f.start==f.endB&&t.state.selection instanceof ae&&(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&&yr<=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),b=c.resolve(f.start),y=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=f.endA,k;if((so&&t.input.lastIOSEnter>Date.now()-225&&(!y||i.some(T=>T.nodeName=="DIV"||T.nodeName=="P"))||!y&&m.pos<u.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&!/\S/.test(u.doc.textBetween(m.pos,g.pos,"",""))&&(k=ue.findFrom(u.doc.resolve(m.pos+1),1,!0))&&k.head>m.pos)&&t.someProp("handleKeyDown",T=>T(t,jr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>f.start&&aD(c,f.start,f.endA,m,g)&&t.someProp("handleKeyDown",T=>T(t,jr(8,"Backspace")))){Bn&&rt&&t.domObserver.suppressSelectionUpdates();return}rt&&f.endB==f.start&&(t.input.lastChromeDelete=Date.now()),Bn&&!y&&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(T){return T(t,jr(13,"Enter"))})},20));let v=f.start,w=f.endA,x,C,M;if(y){if(m.pos==g.pos)bt&&yr<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>zn(t),20)),x=t.state.tr.delete(v,w),C=c.resolve(f.start).marksAcross(c.resolve(f.endA));else if(f.endA==f.endB&&(M=sD(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,f.endA-b.start()))))x=t.state.tr,M.type=="add"?x.addMark(v,w,M.mark):x.removeMark(v,w,M.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let T=m.parent.textBetween(m.parentOffset,g.parentOffset);if(t.someProp("handleTextInput",A=>A(t,v,w,T)))return;x=t.state.tr.insertText(T,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 T=Xm(t,x.doc,u.sel);T&&!(rt&&t.composing&&T.empty&&(f.start!=f.endB||t.input.lastChromeDelete<Date.now()-100)&&(T.head==v||T.head==x.mapping.map(w)-1)||bt&&T.empty&&T.head==v)&&x.setSelection(T)}C&&x.ensureMarks(C),o&&x.setMeta("composition",o),t.dispatch(x.scrollIntoView())}function Xm(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:sh(t,e.resolve(n.anchor),e.resolve(n.head))}function sD(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(D.from(u).eq(t))return{mark:a,type:s}}function aD(t,e,n,r,i){if(n-e<=i.pos-r.pos||Tc(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(Tc(o,!0,!0));return!s.parent.isTextblock||s.pos>n||Tc(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Tc(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 lD(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&&Zm(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&&Zm(t.textBetween(o-1,o+1))&&(o+=l?1:-1),s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}function Zm(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 uD{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(rg),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=tg(this),eg(this),this.nodeViews=ng(this),this.docView=Nm(this.state.doc,Qm(this),Sc(this),this.dom,this),this.domObserver=new Z_(this,(r,i,o,s)=>oD(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&&$d(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(rg),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&&(c0(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=ng(this);dD(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&$d(this),this.editable=tg(this),eg(this);let l=Sc(this),u=Qm(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&&cD(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=Nm(e.doc,u,l,this.dom,this)),f&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&p_(this))?zn(this,p):(Zb(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 Z){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Om(this,n.getBoundingClientRect(),e)}else Om(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 p0(e.slice,e.move,i<0?void 0:Z.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),zn(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 qb(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 ws(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ws(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return ah(this,e)}destroy(){this.docView&&(M_(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Sc(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?ht&&this.root.nodeType===11&&FM(this.dom.ownerDocument)==this.dom&&eD(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Qm(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"),[At.node(0,t.state.doc.content.size,e)]}function eg(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:At.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function tg(t){return!t.someProp("editable",e=>e(t.state)===!1)}function cD(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 ng(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 dD(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 rg(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 Sr={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:"'"},xl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},pD=typeof navigator<"u"&&/Mac/.test(navigator.platform),hD=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Xe=0;Xe<10;Xe++)Sr[48+Xe]=Sr[96+Xe]=String(Xe);for(var Xe=1;Xe<=24;Xe++)Sr[Xe+111]="F"+Xe;for(var Xe=65;Xe<=90;Xe++)Sr[Xe]=String.fromCharCode(Xe+32),xl[Xe]=String.fromCharCode(Xe);for(var Oc in Sr)xl.hasOwnProperty(Oc)||(xl[Oc]=Sr[Oc]);function fD(t){var e=pD&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||hD&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?xl:Sr)[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 mD=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),gD=typeof navigator<"u"&&/Win/.test(navigator.platform);function vD(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))mD?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 yD(t){let e=Object.create(null);for(let n in t)e[vD(n)]=t[n];return e}function Ac(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 bD(t){return new $e({props:{handleKeyDown:v0(t)}})}function v0(t){let e=yD(t);return function(n,r){let i=fD(r),o,s=e[Ac(i,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[Ac(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(gD&&r.ctrlKey&&r.altKey)&&(o=Sr[r.keyCode])&&o!=i){let a=e[Ac(o,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}const kD=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function y0(t,e){let{$cursor:n}=t.selection;return!n||n.parentOffset>0?null:n}const wD=(t,e,n)=>{let r=y0(t);if(!r)return!1;let i=hh(r);if(!i){let s=r.blockRange(),a=s&&mo(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(x0(t,i,e,-1))return!0;if(r.parent.content.size==0&&(ao(o,"end")||Z.isSelectable(o)))for(let s=r.depth;;s--){let a=_u(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(ao(o,"end")?ue.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):Z.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},xD=(t,e,n)=>{let r=y0(t);if(!r)return!1;let i=hh(r);return i?b0(t,i,e):!1},ED=(t,e,n)=>{let r=k0(t);if(!r)return!1;let i=fh(r);return i?b0(t,i,e):!1};function b0(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=_u(t.doc,o,l,V.empty);if(!u||u.from!=o||u instanceof ze&&u.slice.size>=l-o)return!1;if(n){let c=t.tr.step(u);c.setSelection(ae.create(c.doc,o)),n(c.scrollIntoView())}return!0}function ao(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 CD=(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=hh(r)}let s=o&&o.nodeBefore;return!s||!Z.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Z.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function hh(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 k0(t,e){let{$cursor:n}=t.selection;return!n||n.parentOffset<n.parent.content.size?null:n}const SD=(t,e,n)=>{let r=k0(t);if(!r)return!1;let i=fh(r);if(!i)return!1;let o=i.nodeAfter;if(x0(t,i,e,1))return!0;if(r.parent.content.size==0&&(ao(o,"start")||Z.isSelectable(o))){let s=_u(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(ao(o,"start")?ue.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):Z.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},TD=(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=fh(r)}let s=o&&o.nodeAfter;return!s||!Z.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Z.create(t.doc,o.pos)).scrollIntoView()),!0)};function fh(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 OD=(t,e)=>{let n=t.selection,r=n instanceof Z,i;if(r){if(n.node.isTextblock||!Tr(t.doc,n.from))return!1;i=n.from}else if(i=Mu(t.doc,n.from,-1),i==null)return!1;if(e){let o=t.tr.join(i);r&&o.setSelection(Z.create(o.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},AD=(t,e)=>{let n=t.selection,r;if(n instanceof Z){if(n.node.isTextblock||!Tr(t.doc,n.to))return!1;r=n.to}else if(r=Mu(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},MD=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&mo(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},_D=(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 w0(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 DD=(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=w0(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(ue.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},ID=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof $t||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=w0(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(ae.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},ND=(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(Ki(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&mo(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},RD=(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(Z.create(t.doc,i))),!0)};function PD(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||Tr(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function x0(t,e,n,r){let i=e.nodeBefore,o=e.nodeAfter,s,a,l=i.type.spec.isolating||o.type.spec.isolating;if(!l&&PD(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=D.empty;for(let b=s.length-1;b>=0;b--)f=D.from(s[b].create(null,f));f=D.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&&Tr(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let c=o.type.spec.isolating||r>0&&l?null:ue.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),h=d&&mo(d);if(h!=null&&h>=e.depth)return n&&n(t.tr.lift(d,h).scrollIntoView()),!0;if(u&&ao(o,"start",!0)&&ao(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 b=D.empty;for(let k=f.length-1;k>=0;k--)b=D.from(f[k].copy(b));let y=t.tr.step(new qe(e.pos-f.length,e.pos+o.nodeSize,e.pos+g,e.pos+o.nodeSize-g,new V(b,f.length,0),0,!0));n(y.scrollIntoView())}return!0}}return!1}function E0(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(ae.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}const FD=E0(-1),LD=E0(1);function BD(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&nh(s,t,e);return a?(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function ig(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 VD(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 $D(a,s,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function $D(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 ml(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new ml(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=nh(o,n,r,e);return a?(t&&jD(t,e,a,i,n),!0):!1}function jD(t,e,n,r,i){let o=D.empty;for(let c=n.length-1;c>=0;c--)o=D.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&&Ki(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=u.child(c).nodeSize;return t}function zD(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?HD(e,n,t,o):qD(e,n,o):!0:!1}}function HD(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(D.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ml(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const a=mo(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(o,-1)-1);return Tr(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function qD(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?D.empty:D.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?D.empty:D.from(i.copy(D.empty))).append(l?D.empty:D.from(i.copy(D.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function WD(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=D.from(u?t.create():null),d=new V(D.from(t.create(null,D.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 Pu(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 Fu{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:Pu({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 UD{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 W(t,e,n){return t.config[e]===void 0&&t.parent?W(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?W(t.parent,e,n):null}):t.config[e]}function Lu(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 C0(t){const e=[],{nodeExtensions:n,markExtensions:r}=Lu(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=W(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=W(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 jd(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 S0(t){return typeof t=="function"}function pe(t,e=void 0,...n){return S0(t)?e?t.bind(e)(...n):t(...n):t}function KD(t={}){return Object.keys(t).length===0&&t.constructor===Object}function GD(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function og(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):GD(n.getAttribute(s.name));return a==null?o:{...o,[s.name]:a}},{});return{...r,...i}}}}function sg(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&KD(n)?!1:n!=null))}function JD(t,e){var n;const r=C0(t),{nodeExtensions:i,markExtensions:o}=Lu(t),s=(n=i.find(u=>W(u,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(u=>{const c=r.filter(b=>b.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},h=t.reduce((b,y)=>{const k=W(y,"extendNodeSchema",d);return{...b,...k?k(u):{}}},{}),p=sg({...h,content:pe(W(u,"content",d)),marks:pe(W(u,"marks",d)),group:pe(W(u,"group",d)),inline:pe(W(u,"inline",d)),atom:pe(W(u,"atom",d)),selectable:pe(W(u,"selectable",d)),draggable:pe(W(u,"draggable",d)),code:pe(W(u,"code",d)),whitespace:pe(W(u,"whitespace",d)),linebreakReplacement:pe(W(u,"linebreakReplacement",d)),defining:pe(W(u,"defining",d)),isolating:pe(W(u,"isolating",d)),attrs:Object.fromEntries(c.map(b=>{var y;return[b.name,{default:(y=b?.attribute)===null||y===void 0?void 0:y.default}]}))}),f=pe(W(u,"parseHTML",d));f&&(p.parseDOM=f.map(b=>og(b,c)));const m=W(u,"renderHTML",d);m&&(p.toDOM=b=>m({node:b,HTMLAttributes:jd(b,c)}));const g=W(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,b)=>{const y=W(b,"extendMarkSchema",d);return{...g,...y?y(u):{}}},{}),p=sg({...h,inclusive:pe(W(u,"inclusive",d)),excludes:pe(W(u,"excludes",d)),group:pe(W(u,"group",d)),spanning:pe(W(u,"spanning",d)),code:pe(W(u,"code",d)),attrs:Object.fromEntries(c.map(g=>{var b;return[g.name,{default:(b=g?.attribute)===null||b===void 0?void 0:b.default}]}))}),f=pe(W(u,"parseHTML",d));f&&(p.parseDOM=f.map(g=>og(g,c)));const m=W(u,"renderHTML",d);return m&&(p.toDOM=g=>m({mark:g,HTMLAttributes:jd(g,c)})),[u.name,p]}));return new bb({topNode:s,nodes:a,marks:l})}function Mc(t,e){return e.nodes[t]||e.marks[t]||null}function ag(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function mh(t,e){const n=yi.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}const YD=(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 gh(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Bu{constructor(e){this.find=e.find,this.handler=e.handler}}const XD=(t,e)=>{if(gh(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 ga(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=YD(u)+o;return s.forEach(h=>{if(c)return;const p=XD(d,h.find);if(!p)return;const f=l.state.tr,m=Pu({state:l.state,transaction:f}),g={from:r-(p[0].length-o.length),to:i},{commands:b,chain:y,can:k}=new Fu({editor:n,state:m});h.handler({state:m,range:g,match:p,commands:b,chain:y,can:k})===null||!f.steps.length||(f.setMeta(a,{transform:f,from:r,to:i,text:o}),l.dispatch(f),c=!0)}),c}function ZD(t){const{editor:e,rules:n}=t,r=new $e({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=mh(D.from(u),s.schema);const{from:c}=l,d=c+u.length;ga({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 ga({editor:e,from:o,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&ga({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?ga({editor:e,from:s.pos,to:s.pos,text:`
18
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function QD(t){return Object.prototype.toString.call(t).slice(8,-1)}function va(t){return QD(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Vu(t,e){const n={...t};return va(t)&&va(e)&&Object.keys(e).forEach(r=>{va(e[r])&&va(t[r])?n[r]=Vu(t[r],e[r]):n[r]=e[r]}),n}class Wn{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(W(this,"addOptions",{name:this.name}))),this.storage=pe(W(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Wn(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Vu(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Wn(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(W(n,"addOptions",{name:n.name})),n.storage=pe(W(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 eI(t){return typeof t=="number"}class tI{constructor(e){this.find=e.find,this.handler=e.handler}}const nI=(t,e,n)=>{if(gh(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 rI(t){const{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:u,can:c}=new Fu({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,"");nI(g,o.find,s).forEach(b=>{if(b.index===void 0)return;const y=f+b.index+1,k=y+b[0].length,v={from:n.tr.mapping.map(y),to:n.tr.mapping.map(k)},w=o.handler({state:n,range:v,match:b,commands:l,chain:u,can:c,pasteEvent:s,dropEvent:a});d.push(w)})}),d.every(h=>h!==null)}let ya=null;const iI=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 oI(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=Pu({state:u,transaction:f});if(!(!rI({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 $e({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&&(ya=e)},h=()=>{ya&&(ya=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=ya;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"),b=!!g;if(!f&&!m&&!b)return;if(b){let{text:v}=g;typeof v=="string"?v=v:v=mh(D.from(v),h.schema);const{from:w}=g,x=w+v.length,C=iI(v);return l({rule:u,state:h,from:w,to:{b:x},pasteEvt:C})}const y=d.doc.content.findDiffStart(h.doc.content),k=d.doc.content.findDiffEnd(h.doc.content);if(!(!eI(y)||!k||y===k.b))return l({rule:u,state:h,from:y,to:k,pasteEvt:s})}}))}function sI(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class qi{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=qi.resolve(e),this.schema=JD(this.extensions,n),this.setupExtensions()}static resolve(e){const n=qi.sort(qi.flatten(e)),r=sI(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=W(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((n,r)=>{const i=W(n,"priority")||100,o=W(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:Mc(n.name,this.schema)},i=W(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=qi.sort([...this.extensions].reverse()),r=[],i=[],o=n.map(s=>{const a={name:s.name,options:s.options,storage:s.storage,editor:e,type:Mc(s.name,this.schema)},l=[],u=W(s,"addKeyboardShortcuts",a);let c={};if(s.type==="mark"&&W(s,"exitable",a)&&(c.ArrowRight=()=>Wn.handleExit({editor:e,mark:s})),u){const m=Object.fromEntries(Object.entries(u()).map(([g,b])=>[g,()=>b({editor:e})]));c={...c,...m}}const d=bD(c);l.push(d);const h=W(s,"addInputRules",a);ag(s,e.options.enableInputRules)&&h&&r.push(...h());const p=W(s,"addPasteRules",a);ag(s,e.options.enablePasteRules)&&p&&i.push(...p());const f=W(s,"addProseMirrorPlugins",a);if(f){const m=f();l.push(...m)}return l}).flat();return[ZD({editor:e,rules:r}),...oI({editor:e,rules:i}),...o]}get attributes(){return C0(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=Lu(this.extensions);return Object.fromEntries(n.filter(r=>!!W(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=W(r,"addNodeView",o);if(!s)return[];const a=(l,u,c,d,h)=>{const p=jd(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:Mc(e.name,this.schema)};e.type==="mark"&&(!((n=pe(W(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=W(e,"onBeforeCreate",r),o=W(e,"onCreate",r),s=W(e,"onUpdate",r),a=W(e,"onSelectionUpdate",r),l=W(e,"onTransaction",r),u=W(e,"onFocus",r),c=W(e,"onBlur",r),d=W(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(W(this,"addOptions",{name:this.name}))),this.storage=pe(W(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ke(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Vu(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(W(n,"addOptions",{name:n.name})),n.storage=pe(W(n,"addStorage",{name:n.name,options:n.options})),n}}function T0(t,e,n){const{from:r,to:i}=e,{blockSeparator:o=`
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 vh(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const aI=Ke.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new $e({key:new lt("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=vh(n);return T0(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),lI=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),uI=(t=!1)=>({commands:e})=>e.setContent("",t),cI=()=>({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=mo(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},dI=t=>e=>t(e),pI=()=>({state:t,dispatch:e})=>ID(t,e),hI=(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 ae(r.doc.resolve(s-1))),!0},fI=()=>({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},mI=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},gI=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},vI=()=>({state:t,dispatch:e})=>kD(t,e),yI=()=>({commands:t})=>t.keyboardShortcut("Enter"),bI=()=>({state:t,dispatch:e})=>DD(t,e);function El(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:gh(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function O0(t,e,n={}){return t.find(r=>r.type===e&&El(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function lg(t,e,n={}){return!!O0(t,e,n)}function yh(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),!O0([...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&&lg([...t.parent.child(o-1).marks],e,n);)o-=1,s-=t.parent.child(o).nodeSize;for(;a<t.parent.childCount&&lg([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}function Ar(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 kI=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const o=Ar(t,r.schema),{doc:s,selection:a}=n,{$from:l,from:u,to:c}=a;if(i){const d=yh(l,o,e);if(d&&d.from<=u&&d.to>=c){const h=ae.create(s,d.from,d.to);n.setSelection(h)}}return!0},wI=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 bh(t){return t instanceof ae}function Vn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function A0(t,e=null){if(!e)return null;const n=ue.atStart(t),r=ue.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,o=r.to;return e==="all"?ae.create(t,Vn(0,i,o),Vn(t.content.size,i,o)):ae.create(t,Vn(e,i,o),Vn(e,i,o))}function xI(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function kh(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const EI=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{(kh()||xI())&&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&&!bh(n.state.selection))return s(),!0;const a=A0(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},CI=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),SI=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),M0=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&&M0(r)}return t};function ba(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return M0(n)}function Cl(t,e,n){if(t instanceof gr||t instanceof D)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 D.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),Cl("",e,n)}if(i){if(n.errorOnInvalidContent){let s=!1,a="";const l=new bb({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?vr.fromSchema(l).parseSlice(ba(t),n.parseOptions):vr.fromSchema(l).parse(ba(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const o=vr.fromSchema(e);return n.slice?o.parseSlice(ba(t),n.parseOptions).content:o.parse(ba(t),n.parseOptions)}return Cl("",e,n)}function TI(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof ze||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(ue.near(t.doc.resolve(s),n))}const OI=t=>!("type"in t),AI=(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=Cl(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((OI(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 D){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&&TI(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},MI=()=>({state:t,dispatch:e})=>OD(t,e),_I=()=>({state:t,dispatch:e})=>AD(t,e),DI=()=>({state:t,dispatch:e})=>wD(t,e),II=()=>({state:t,dispatch:e})=>SD(t,e),NI=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Mu(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},RI=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Mu(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},PI=()=>({state:t,dispatch:e})=>xD(t,e),FI=()=>({state:t,dispatch:e})=>ED(t,e);function _0(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function LI(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))kh()||_0()?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 BI=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const o=LI(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 Es(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=>El(c.node.attrs,n,{strict:!1}));return o?!!u.length:u.reduce((c,d)=>c+d.to-d.from,0)>=l}const VI=(t,e={})=>({state:n,dispatch:r})=>{const i=Ue(t,n.schema);return Es(n,i,e)?MD(n,r):!1},$I=()=>({state:t,dispatch:e})=>ND(t,e),jI=t=>({state:e,dispatch:n})=>{const r=Ue(t,e.schema);return zD(r)(e,n)},zI=()=>({state:t,dispatch:e})=>_D(t,e);function $u(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function ug(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 HI=(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=Ar(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,ug(u.attrs,e)),s&&u.marks.length&&u.marks.forEach(d=>{s===d.type&&n.addMark(c,c+u.nodeSize,s.create(ug(d.attrs,e)))})})}),!0):!1},qI=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),WI=()=>({tr:t,dispatch:e})=>{if(e){const n=new $t(t.doc);t.setSelection(n)}return!0},UI=()=>({state:t,dispatch:e})=>CD(t,e),KI=()=>({state:t,dispatch:e})=>TD(t,e),GI=()=>({state:t,dispatch:e})=>RD(t,e),JI=()=>({state:t,dispatch:e})=>LD(t,e),YI=()=>({state:t,dispatch:e})=>FD(t,e);function zd(t,e,n={},r={}){return Cl(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const XI=(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=zd(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 D0(t,e){const n=Ar(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 ZI(t,e){const n=new Pb(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function QI(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 eN(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,o)=>{n(i)&&r.push({node:i,pos:o})}),r}function tN(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 wh(t){return e=>tN(e.$from,t)}function I0(t,e){const n={from:0,to:t.content.size};return T0(t,n,e)}function nN(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 N0(t,e){const n=$u(typeof e=="string"?e:e.name,t.schema);return n==="node"?nN(t,e):n==="mark"?D0(t,e):{}}function rN(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 iN(t){const e=rN(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 oN(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}})})}),iN(r)}function xh(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const o=n.resolve(t),s=yh(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 $a(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 Hd(t,e,n={}){const{empty:r,ranges:i}=t.selection,o=e?Ar(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(c=>o?o.name===c.type.name:!0).find(c=>El(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),b=Math.min(p,m+f.nodeSize),y=b-g;s+=y,a.push(...f.marks.map(k=>({mark:k,from:g,to:b})))})}),s===0)return!1;const l=a.filter(c=>o?o.name===c.mark.type.name:!0).filter(c=>El(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 sN(t,e,n={}){if(!e)return Es(t,null,n)||Hd(t,null,n);const r=$u(e,t.schema);return r==="node"?Es(t,e,n):r==="mark"?Hd(t,e,n):!1}function cg(t,e){const{nodeExtensions:n}=Lu(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(W(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function ju(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&&(ju(o,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function R0(t){return t instanceof Z}function P0(t,e,n){const r=t.state.doc.content.size,i=Vn(e,0,r),o=Vn(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 aN(t,e,n){var r;const{selection:i}=e;let o=null;if(bh(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 lN=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=n,{empty:s,ranges:a}=o,l=Ar(t,r.schema);if(i)if(s){const u=D0(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 aN(r,n,l)},uN=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),cN=(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})=>ig(o,{...s,...e})(n)?!0:a.clearNodes()).command(({state:a})=>ig(o,{...s,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},dN=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Vn(t,0,r.content.size),o=Z.create(r,i);e.setSelection(o)}return!0},pN=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,s=ae.atStart(r).from,a=ae.atEnd(r).to,l=Vn(i,s,a),u=Vn(o,s,a),c=ae.create(r,l,u);e.setSelection(c)}return!0},hN=t=>({state:e,dispatch:n})=>{const r=Ue(t,e.schema);return WD(r)(e,n)};function dg(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 fN=({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=$a(u,a.node().type.name,a.node().attrs);if(o instanceof Z&&o.node.isBlock)return!a.parentOffset||!Ki(s,a.pos)?!1:(r&&(t&&dg(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:QI(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=d&&h?[{type:h,attrs:c}]:void 0,f=Ki(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!f&&Ki(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 ae&&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&&dg(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return f},mN=(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 b=D.empty;const y=l.index(-1)?1:l.index(-2)?2:3;for(let M=l.depth-y;M>=l.depth-3;M-=1)b=D.from(l.node(M).copy(b));const k=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,v={...$a(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;b=b.append(D.from(a.createAndFill(null,w)||void 0));const x=l.before(l.depth-(y-1));n.replace(x,l.after(-k),new V(b,4-y,0));let C=-1;n.doc.nodesBetween(x,n.doc.content.size,(M,T)=>{if(C>-1)return!1;M.isTextblock&&M.content.size===0&&(C=T+1)}),C>-1&&n.setSelection(ae.near(n.doc.resolve(C))),n.scrollIntoView()}return!0}const p=u.pos===l.end()?d.contentMatchAt(0).defaultType:null,f={...$a(h,d.type.name,d.attrs),...e},m={...$a(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(!Ki(n.doc,l.pos,2))return!1;if(i){const{selection:b,storedMarks:y}=r,{splittableMarks:k}=o.extensionManager,v=y||b.$to.parentOffset&&b.$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},_c=(t,e)=>{const n=wh(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&&Tr(t.doc,n.pos)&&t.join(n.pos),!0},Dc=(t,e)=>{const n=wh(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&&Tr(t.doc,r)&&t.join(r),!0},gN=(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:b,$to:y}=m,k=b.blockRange(y),v=g||m.$to.parentOffset&&m.$from.marks();if(!k)return!1;const w=wh(x=>cg(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(cg(w.node.type.name,d)&&p.validContent(w.node.content)&&a)return l().command(()=>(o.setNodeMarkup(w.pos,p),!0)).command(()=>_c(o,p)).command(()=>Dc(o,p)).run()}return!n||!v||!a?l().command(()=>c().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>_c(o,p)).command(()=>Dc(o,p)).run():l().command(()=>{const x=c().wrapInList(p,r),C=v.filter(M=>h.includes(M.type.name));return o.ensureMarks(C),x?!0:u.clearNodes()}).wrapInList(p,r).command(()=>_c(o,p)).command(()=>Dc(o,p)).run()},vN=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,s=Ar(t,r.schema);return Hd(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},yN=(t,e,n={})=>({state:r,commands:i})=>{const o=Ue(t,r.schema),s=Ue(e,r.schema),a=Es(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})},bN=(t,e={})=>({state:n,commands:r})=>{const i=Ue(t,n.schema);return Es(n,i,e)?r.lift(i):r.wrapIn(i,e)},kN=()=>({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},wN=()=>({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},xN=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=Ar(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=yh(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},EN=(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=Ar(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(b=>{if(s===b.type){const y=Math.max(g,u),k=Math.min(g+m.nodeSize,c);n.addMark(y,k,s.create({...b.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},CN=(t,e={})=>({state:n,dispatch:r})=>{const i=Ue(t,n.schema);return BD(i,e)(n,r)},SN=(t,e={})=>({state:n,dispatch:r})=>{const i=Ue(t,n.schema);return VD(i,e)(n,r)};var TN=Object.freeze({__proto__:null,blur:lI,clearContent:uI,clearNodes:cI,command:dI,createParagraphNear:pI,cut:hI,deleteCurrentNode:fI,deleteNode:mI,deleteRange:gI,deleteSelection:vI,enter:yI,exitCode:bI,extendMarkRange:kI,first:wI,focus:EI,forEach:CI,insertContent:SI,insertContentAt:AI,joinBackward:DI,joinDown:_I,joinForward:II,joinItemBackward:NI,joinItemForward:RI,joinTextblockBackward:PI,joinTextblockForward:FI,joinUp:MI,keyboardShortcut:BI,lift:VI,liftEmptyBlock:$I,liftListItem:jI,newlineInCode:zI,resetAttributes:HI,scrollIntoView:qI,selectAll:WI,selectNodeBackward:UI,selectNodeForward:KI,selectParentNode:GI,selectTextblockEnd:JI,selectTextblockStart:YI,setContent:XI,setMark:lN,setMeta:uN,setNode:cN,setNodeSelection:dN,setTextSelection:pN,sinkListItem:hN,splitBlock:fN,splitListItem:mN,toggleList:gN,toggleMark:vN,toggleNode:yN,toggleWrap:bN,undoInputRule:kN,unsetAllMarks:wN,unsetMark:xN,updateAttributes:EN,wrapIn:CN,wrapInList:SN});const ON=Ke.create({name:"commands",addCommands(){return{...TN}}}),AN=Ke.create({name:"drop",addProseMirrorPlugins(){return[new $e({key:new lt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),MN=Ke.create({name:"editable",addProseMirrorPlugins(){return[new $e({key:new lt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),_N=new lt("focusEvents"),DN=Ke.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new $e({key:_N,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}}}})]}}),IN=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:ue.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 kh()||_0()?i:r},addProseMirrorPlugins(){return[new $e({key:new lt("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=ue.atStart(e.doc).from,u=ue.atEnd(e.doc).to;if(o||!(s===l&&a===u)||!ju(n.doc))return;const c=n.tr,d=Pu({state:n,transaction:c}),{commands:h}=new Fu({editor:this.editor,state:d});if(h.clearNodes(),!!c.steps.length)return c}})]}}),NN=Ke.create({name:"paste",addProseMirrorPlugins(){return[new $e({key:new lt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),RN=Ke.create({name:"tabindex",addProseMirrorPlugins(){return[new $e({key:new lt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class zr{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 zr(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 zr(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 zr(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 zr(a,this.editor,i,i?n:null);i&&(l.actualDepth=this.depth+1),e.push(new zr(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 PN=`.ProseMirror {
8
+ */function qf(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 xn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?qf(Object(n),!0).forEach(function(r){JT(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):qf(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Pa(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Pa=function(e){return typeof e}:Pa=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pa(t)}function JT(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qn(){return qn=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},qn.apply(this,arguments)}function YT(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 XT(t,e){if(t==null)return{};var n=YT(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 ZT="1.14.0";function jn(t){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(t)}var Gn=jn(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Bs=jn(/Edge/i),Wf=jn(/firefox/i),Ho=jn(/safari/i)&&!jn(/chrome/i)&&!jn(/android/i),Ry=jn(/iP(ad|od|hone)/i),QT=jn(/chrome/i)&&jn(/android/i),Py={capture:!1,passive:!1};function ve(t,e,n){t.addEventListener(e,n,!Gn&&Py)}function ge(t,e,n){t.removeEventListener(e,n,!Gn&&Py)}function sl(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 eO(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&&sl(t,e):sl(t,e))||r&&t===n)return t;if(t===n)break}while(t=eO(t))}return null}var Uf=/\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(Uf," ").replace(" "+e+" "," ");t.className=(r+(n?" "+e:"")).replace(Uf," ")}}function te(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 Ki(t,e){var n="";if(typeof t=="string")n=t;else do{var r=te(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 Fy(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 je(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,!Gn))do if(i&&i.getBoundingClientRect&&(te(i,"transform")!=="none"||n&&te(i,"position")!=="static")){var h=i.getBoundingClientRect();s-=h.top+parseInt(te(i,"border-top-width")),a-=h.left+parseInt(te(i,"border-left-width")),l=s+o.height,u=a+o.width;break}while(i=i.parentNode);if(r&&t!==window){var p=Ki(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 Kf(t,e,n){for(var r=lr(t,!0),i=je(t)[e];r;){var o=je(r)[n],s=void 0;if(s=i>=o,!s)return r;if(r===yn())break;r=lr(r,!1)}return!1}function to(t,e,n,r){for(var i=0,o=0,s=t.children;o<s.length;){if(s[o].style.display!=="none"&&s[o]!==ne.ghost&&(r||s[o]!==ne.dragged)&&hn(s[o],n.draggable,t,!1)){if(i===e)return s[o];i++}o++}return null}function Xp(t,e){for(var n=t.lastElementChild;n&&(n===ne.ghost||te(n,"display")==="none"||e&&!sl(n,e));)n=n.previousElementSibling;return n||null}function Bt(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)t.nodeName.toUpperCase()!=="TEMPLATE"&&t!==ne.clone&&(!e||sl(t,e))&&n++;return n}function Gf(t){var e=0,n=0,r=yn();if(t)do{var i=Ki(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 tO(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 lr(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=te(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 nO(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function ic(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 qo;function Ly(t,e){return function(){if(!qo){var n=arguments,r=this;n.length===1?t.call(r,n[0]):t.apply(r,n),qo=setTimeout(function(){qo=void 0},e)}}}function rO(){clearTimeout(qo),qo=void 0}function By(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function Vy(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 iO(){var t=[],e;return{captureAnimationState:function(){if(t=[],!!this.options.animation){var n=[].slice.call(this.el.children);n.forEach(function(r){if(!(te(r,"display")==="none"||r===ne.ghost)){t.push({target:r,rect:je(r)});var i=xn({},t[t.length-1].rect);if(r.thisAnimationDuration){var o=Ki(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(tO(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=je(l),d=l.prevFromRect,h=l.prevToRect,p=s.rect,f=Ki(l,!0);f&&(c.top-=f.f,c.left-=f.e),l.toRect=c,l.thisAnimationDuration&&ic(d,c)&&!ic(u,c)&&(p.top-c.top)/(p.left-c.left)===(u.top-c.top)/(u.left-c.left)&&(a=sO(p,d,h,r.options)),ic(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){te(n,"transition",""),te(n,"transform","");var s=Ki(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,te(n,"transform","translate3d("+u+"px,"+c+"px,0)"),this.forRepaintDummy=oO(n),te(n,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),te(n,"transform","translate3d(0,0,0)"),typeof n.animated=="number"&&clearTimeout(n.animated),n.animated=setTimeout(function(){te(n,"transition",""),te(n,"transform",""),n.animated=!1,n.animatingX=!1,n.animatingY=!1},o)}}}}function oO(t){return t.offsetWidth}function sO(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 Ai=[],oc={initializeByDefault:!0},Vs={mount:function(t){for(var e in oc)oc.hasOwnProperty(e)&&!(e in t)&&(t[e]=oc[e]);Ai.forEach(function(n){if(n.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}),Ai.push(t)},pluginEvent:function(t,e,n){var r=this;this.eventCanceled=!1,n.cancel=function(){r.eventCanceled=!0};var i=t+"Global";Ai.forEach(function(o){e[o.pluginName]&&(e[o.pluginName][i]&&e[o.pluginName][i](xn({sortable:e},n)),e.options[o.pluginName]&&e[o.pluginName][t]&&e[o.pluginName][t](xn({sortable:e},n)))})},initializePlugins:function(t,e,n,r){Ai.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,qn(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 Ai.forEach(function(r){typeof r.eventProperties=="function"&&qn(n,r.eventProperties.call(e[r.pluginName],t))}),n},modifyOption:function(t,e,n){var r;return Ai.forEach(function(i){t[i.pluginName]&&i.optionListeners&&typeof i.optionListeners[e]=="function"&&(r=i.optionListeners[e].call(t[i.pluginName],n))}),r}};function aO(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,b="on"+r.charAt(0).toUpperCase()+r.substr(1);window.CustomEvent&&!Gn&&!Bs?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 y=xn(xn({},f),Vs.getEventProperties(r,e));for(var k in y)m[k]=y[k];n&&n.dispatchEvent(m),g[b]&&g[b].call(e,m)}}var lO=["evt"],vt=function(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.evt,i=XT(n,lO);Vs.pluginEvent.bind(ne)(t,e,xn({dragEl:F,parentEl:Me,ghostEl:le,rootEl:Ce,nextEl:Vr,lastDownEl:Fa,cloneEl:_e,cloneHidden:or,dragStarted:Ro,putSortable:Je,activeSortable:ne.active,originalEvent:r,oldIndex:zi,oldDraggableIndex:Wo,newIndex:Ct,newDraggableIndex:tr,hideGhostForTarget:Hy,unhideGhostForTarget:qy,cloneNowHidden:function(){or=!0},cloneNowShown:function(){or=!1},dispatchSortableEvent:function(o){dt({sortable:e,name:o,originalEvent:r})}},i))};function dt(t){aO(xn({putSortable:Je,cloneEl:_e,targetEl:F,rootEl:Ce,oldIndex:zi,oldDraggableIndex:Wo,newIndex:Ct,newDraggableIndex:tr},t))}var F,Me,le,Ce,Vr,Fa,_e,or,zi,Ct,Wo,tr,da,Je,Ri=!1,al=!1,ll=[],Pr,Gt,sc,ac,Jf,Yf,Ro,Mi,Uo,Ko=!1,pa=!1,La,nt,lc=[],wd=!1,ul=[],Ou=typeof document<"u",ha=Ry,Xf=Bs||Gn?"cssFloat":"float",uO=Ou&&!QT&&!Ry&&"draggable"in document.createElement("div"),$y=function(){if(Ou){if(Gn)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),jy=function(t,e){var n=te(t),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=to(t,0,e),o=to(t,1,e),s=i&&te(i),a=o&&te(o),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+je(i).width,u=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+je(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[Xf]==="none"||o&&n[Xf]==="none"&&l+u>r)?"vertical":"horizontal"},cO=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},dO=function(t,e){var n;return ll.some(function(r){var i=r[Tt].options.emptyInsertThreshold;if(!(!i||Xp(r))){var o=je(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},zy=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||Pa(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},Hy=function(){!$y&&le&&te(le,"display","none")},qy=function(){!$y&&le&&te(le,"display","")};Ou&&document.addEventListener("click",function(t){if(al)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),al=!1,!1},!0);var Fr=function(t){if(F){t=t.touches?t.touches[0]:t;var e=dO(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)}}},pO=function(t){F&&F.parentNode[Tt]._isOutsideThisEl(t.target)};function ne(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=qn({},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 jy(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:ne.supportPointer!==!1&&"PointerEvent"in window&&!Ho,emptyInsertThreshold:5};Vs.initializePlugins(this,t,n);for(var r in n)!(r in e)&&(e[r]=n[r]);zy(e);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=e.forceFallback?!1:uO,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)),ll.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),qn(this,iO())}ne.prototype={constructor:ne,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(Mi=null)},_getDirection:function(t,e){return typeof this.options.direction=="function"?this.options.direction.call(this,t,e,F):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(kO(n),!F&&!(/mousedown|pointerdown/.test(o)&&t.button!==0||r.disabled)&&!l.isContentEditable&&!(!this.nativeDraggable&&Ho&&a&&a.tagName.toUpperCase()==="SELECT")&&(a=hn(a,r.draggable,n,!1),!(a&&a.animated)&&Fa!==a)){if(zi=Bt(a),Wo=Bt(a,r.draggable),typeof u=="function"){if(u.call(this,t,a,this)){dt({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),vt("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 dt({sortable:e,rootEl:c,name:"filter",targetEl:a,fromEl:n,toEl:n}),vt("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&&!F&&n.parentNode===i){var l=je(n);if(Ce=i,F=n,Me=F.parentNode,Vr=F.nextSibling,Fa=n,da=o.group,ne.dragged=F,Pr={target:F,clientX:(e||t).clientX,clientY:(e||t).clientY},Jf=Pr.clientX-l.left,Yf=Pr.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,F.style["will-change"]="all",a=function(){if(vt("delayEnded",r,{evt:t}),ne.eventCanceled){r._onDrop();return}r._disableDelayedDragEvents(),!Wf&&r.nativeDraggable&&(F.draggable=!0),r._triggerDragStart(t,e),dt({sortable:r,name:"choose",originalEvent:t}),Et(F,o.chosenClass,!0)},o.ignore.split(",").forEach(function(u){Fy(F,u.trim(),uc)}),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),Wf&&this.nativeDraggable&&(this.options.touchStartThreshold=4,F.draggable=!0),vt("delayStart",this,{evt:t}),o.delay&&(!o.delayOnTouchOnly||e)&&(!this.nativeDraggable||!(Bs||Gn))){if(ne.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(){F&&uc(F),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;ge(t,"mouseup",this._disableDelayedDrag),ge(t,"touchend",this._disableDelayedDrag),ge(t,"touchcancel",this._disableDelayedDrag),ge(t,"mousemove",this._delayedDragTouchMoveHandler),ge(t,"touchmove",this._delayedDragTouchMoveHandler),ge(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(F,"dragend",this),ve(Ce,"dragstart",this._onDragStart));try{document.selection?Ba(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,e){if(Ri=!1,Ce&&F){vt("dragStarted",this,{evt:e}),this.nativeDraggable&&ve(document,"dragover",pO);var n=this.options;!t&&Et(F,n.dragClass,!1),Et(F,n.ghostClass,!0),ne.active=this,t&&this._appendGhost(),dt({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(Gt){this._lastX=Gt.clientX,this._lastY=Gt.clientY,Hy();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(F.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);qy()}},_onTouchMove:function(t){if(Pr){var e=this.options,n=e.fallbackTolerance,r=e.fallbackOffset,i=t.touches?t.touches[0]:t,o=le&&Ki(le,!0),s=le&&o&&o.a,a=le&&o&&o.d,l=ha&&nt&&Gf(nt),u=(i.clientX-Pr.clientX+r.x)/(s||1)+(l?l[0]-lc[0]:0)/(s||1),c=(i.clientY-Pr.clientY+r.y)/(a||1)+(l?l[1]-lc[1]:0)/(a||1);if(!ne.active&&!Ri){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(t,!0)}if(le){o?(o.e+=u-(sc||0),o.f+=c-(ac||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,")");te(le,"webkitTransform",d),te(le,"mozTransform",d),te(le,"msTransform",d),te(le,"transform",d),sc=u,ac=c,Gt=i}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!le){var t=this.options.fallbackOnBody?document.body:Ce,e=je(F,!0,ha,!0,t),n=this.options;if(ha){for(nt=t;te(nt,"position")==="static"&&te(nt,"transform")==="none"&&nt!==document;)nt=nt.parentNode;nt!==document.body&&nt!==document.documentElement?(nt===document&&(nt=yn()),e.top+=nt.scrollTop,e.left+=nt.scrollLeft):nt=yn(),lc=Gf(nt)}le=F.cloneNode(!0),Et(le,n.ghostClass,!1),Et(le,n.fallbackClass,!0),Et(le,n.dragClass,!0),te(le,"transition",""),te(le,"transform",""),te(le,"box-sizing","border-box"),te(le,"margin",0),te(le,"top",e.top),te(le,"left",e.left),te(le,"width",e.width),te(le,"height",e.height),te(le,"opacity","0.8"),te(le,"position",ha?"absolute":"fixed"),te(le,"zIndex","100000"),te(le,"pointerEvents","none"),ne.ghost=le,t.appendChild(le),te(le,"transform-origin",Jf/parseInt(le.style.width)*100+"% "+Yf/parseInt(le.style.height)*100+"%")}},_onDragStart:function(t,e){var n=this,r=t.dataTransfer,i=n.options;if(vt("dragStart",this,{evt:t}),ne.eventCanceled){this._onDrop();return}vt("setupClone",this),ne.eventCanceled||(_e=Vy(F),_e.draggable=!1,_e.style["will-change"]="",this._hideClone(),Et(_e,this.options.chosenClass,!1),ne.clone=_e),n.cloneId=Ba(function(){vt("clone",n),!ne.eventCanceled&&(n.options.removeCloneOnHide||Ce.insertBefore(_e,F),n._hideClone(),dt({sortable:n,name:"clone"}))}),!e&&Et(F,i.dragClass,!0),e?(al=!0,n._loopId=setInterval(n._emulateDragOver,50)):(ge(document,"mouseup",n._onDrop),ge(document,"touchend",n._onDrop),ge(document,"touchcancel",n._onDrop),r&&(r.effectAllowed="move",i.setData&&i.setData.call(n,r,F)),ve(document,"drop",n),te(F,"transform","translateZ(0)")),Ri=!0,n._dragStartId=Ba(n._dragStarted.bind(n,e,t)),ve(document,"selectstart",n),Ro=!0,Ho&&te(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=ne.active,u=da===a,c=s.sort,d=Je||l,h,p=this,f=!1;if(wd)return;function m(X,fe){vt(X,p,xn({evt:t,isOwner:u,axis:h?"vertical":"horizontal",revert:o,dragRect:r,targetRect:i,canSort:c,fromSortable:d,target:n,completed:b,onMove:function(Ee,Ie){return fa(Ce,e,F,r,Ee,je(Ee),t,Ie)},changed:y},fe))}function g(){m("dragOverAnimationCapture"),p.captureAnimationState(),p!==d&&d.captureAnimationState()}function b(X){return m("dragOverCompleted",{insertion:X}),X&&(u?l._hideClone():l._showClone(p),p!==d&&(Et(F,Je?Je.options.ghostClass:l.options.ghostClass,!1),Et(F,s.ghostClass,!0)),Je!==p&&p!==ne.active?Je=p:p===ne.active&&Je&&(Je=null),d===p&&(p._ignoreWhileAnimating=n),p.animateAll(function(){m("dragOverAnimationComplete"),p._ignoreWhileAnimating=null}),p!==d&&(d.animateAll(),d._ignoreWhileAnimating=null)),(n===F&&!F.animated||n===e&&!n.animated)&&(Mi=null),!s.dragoverBubble&&!t.rootEl&&n!==document&&(F.parentNode[Tt]._isOutsideThisEl(t.target),!X&&Fr(t)),!s.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function y(){Ct=Bt(F),tr=Bt(F,s.draggable),dt({sortable:p,name:"change",toEl:e,newIndex:Ct,newDraggableIndex:tr,originalEvent:t})}if(t.preventDefault!==void 0&&t.cancelable&&t.preventDefault(),n=hn(n,s.draggable,e,!0),m("dragOver"),ne.eventCanceled)return f;if(F.contains(t.target)||n.animated&&n.animatingX&&n.animatingY||p._ignoreWhileAnimating===n)return b(!1);if(al=!1,l&&!s.disabled&&(u?c||(o=Me!==Ce):Je===this||(this.lastPutMode=da.checkPull(this,l,F,t))&&a.checkPut(this,l,F,t))){if(h=this._getDirection(t,n)==="vertical",r=je(F),m("dragOverValid"),ne.eventCanceled)return f;if(o)return Me=Ce,g(),this._hideClone(),m("revert"),ne.eventCanceled||(Vr?Ce.insertBefore(F,Vr):Ce.appendChild(F)),b(!0);var k=Xp(e,s.draggable);if(!k||gO(t,h,this)&&!k.animated){if(k===F)return b(!1);if(k&&e===t.target&&(n=k),n&&(i=je(n)),fa(Ce,e,F,r,n,i,t,!!n)!==!1)return g(),e.appendChild(F),Me=e,y(),b(!0)}else if(k&&mO(t,h,this)){var v=to(e,0,s,!0);if(v===F)return b(!1);if(n=v,i=je(n),fa(Ce,e,F,r,n,i,t,!1)!==!1)return g(),e.insertBefore(F,v),Me=e,y(),b(!0)}else if(n.parentNode===e){i=je(n);var w=0,x,C=F.parentNode!==e,M=!cO(F.animated&&F.toRect||r,n.animated&&n.toRect||i,h),T=h?"top":"left",A=Kf(n,"top","top")||Kf(F,"top","top"),_=A?A.scrollTop:void 0;Mi!==n&&(x=i[T],Ko=!1,pa=!M&&s.invertSwap||C),w=vO(t,n,i,h,M?1:s.swapThreshold,s.invertedSwapThreshold==null?s.swapThreshold:s.invertedSwapThreshold,pa,Mi===n);var N;if(w!==0){var $=Bt(F);do $-=w,N=Me.children[$];while(N&&(te(N,"display")==="none"||N===le))}if(w===0||N===n)return b(!1);Mi=n,Uo=w;var j=n.nextElementSibling,q=!1;q=w===1;var K=fa(Ce,e,F,r,n,i,t,q);if(K!==!1)return(K===1||K===-1)&&(q=K===1),wd=!0,setTimeout(fO,30),g(),q&&!j?e.appendChild(F):n.parentNode.insertBefore(F,q?j:n),A&&By(A,0,_-A.scrollTop),Me=F.parentNode,x!==void 0&&!pa&&(La=Math.abs(x-je(n)[T])),y(),b(!0)}if(e.contains(F))return b(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){ge(document,"mousemove",this._onTouchMove),ge(document,"touchmove",this._onTouchMove),ge(document,"pointermove",this._onTouchMove),ge(document,"dragover",Fr),ge(document,"mousemove",Fr),ge(document,"touchmove",Fr)},_offUpEvents:function(){var t=this.el.ownerDocument;ge(t,"mouseup",this._onDrop),ge(t,"touchend",this._onDrop),ge(t,"pointerup",this._onDrop),ge(t,"touchcancel",this._onDrop),ge(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;if(Ct=Bt(F),tr=Bt(F,n.draggable),vt("drop",this,{evt:t}),Me=F&&F.parentNode,Ct=Bt(F),tr=Bt(F,n.draggable),ne.eventCanceled){this._nulling();return}Ri=!1,pa=!1,Ko=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),xd(this.cloneId),xd(this._dragStartId),this.nativeDraggable&&(ge(document,"drop",this),ge(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Ho&&te(document.body,"user-select",""),te(F,"transform",""),t&&(Ro&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),le&&le.parentNode&&le.parentNode.removeChild(le),(Ce===Me||Je&&Je.lastPutMode!=="clone")&&_e&&_e.parentNode&&_e.parentNode.removeChild(_e),F&&(this.nativeDraggable&&ge(F,"dragend",this),uc(F),F.style["will-change"]="",Ro&&!Ri&&Et(F,Je?Je.options.ghostClass:this.options.ghostClass,!1),Et(F,this.options.chosenClass,!1),dt({sortable:this,name:"unchoose",toEl:Me,newIndex:null,newDraggableIndex:null,originalEvent:t}),Ce!==Me?(Ct>=0&&(dt({rootEl:Me,name:"add",toEl:Me,fromEl:Ce,originalEvent:t}),dt({sortable:this,name:"remove",toEl:Me,originalEvent:t}),dt({rootEl:Me,name:"sort",toEl:Me,fromEl:Ce,originalEvent:t}),dt({sortable:this,name:"sort",toEl:Me,originalEvent:t})),Je&&Je.save()):Ct!==zi&&Ct>=0&&(dt({sortable:this,name:"update",toEl:Me,originalEvent:t}),dt({sortable:this,name:"sort",toEl:Me,originalEvent:t})),ne.active&&((Ct==null||Ct===-1)&&(Ct=zi,tr=Wo),dt({sortable:this,name:"end",toEl:Me,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){vt("nulling",this),Ce=F=Me=le=Vr=_e=Fa=or=Pr=Gt=Ro=Ct=tr=zi=Wo=Mi=Uo=Je=da=ne.dragged=ne.ghost=ne.clone=ne.active=null,ul.forEach(function(t){t.checked=!0}),ul.length=sc=ac=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":F&&(this._onDragOver(t),hO(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)||bO(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=Vs.modifyOption(this,t,e);typeof r<"u"?n[t]=r:n[t]=e,t==="group"&&zy(n)},destroy:function(){vt("destroy",this);var t=this.el;t[Tt]=null,ge(t,"mousedown",this._onTapStart),ge(t,"touchstart",this._onTapStart),ge(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(ge(t,"dragover",this),ge(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(e){e.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),ll.splice(ll.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!or){if(vt("hideClone",this),ne.eventCanceled)return;te(_e,"display","none"),this.options.removeCloneOnHide&&_e.parentNode&&_e.parentNode.removeChild(_e),or=!0}},_showClone:function(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(or){if(vt("showClone",this),ne.eventCanceled)return;F.parentNode==Ce&&!this.options.group.revertClone?Ce.insertBefore(_e,F):Vr?Ce.insertBefore(_e,Vr):Ce.appendChild(_e),this.options.group.revertClone&&this.animate(F,_e),te(_e,"display",""),or=!1}}};function hO(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}function fa(t,e,n,r,i,o,s,a){var l,u=t[Tt],c=u.options.onMove,d;return window.CustomEvent&&!Gn&&!Bs?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||je(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),c&&(d=c.call(u,l,s)),d}function uc(t){t.draggable=!1}function fO(){wd=!1}function mO(t,e,n){var r=je(to(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 gO(t,e,n){var r=je(Xp(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 vO(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&&La<u*i){if(!Ko&&(Uo===1?l>c+u*o/2:l<d-u*o/2)&&(Ko=!0),Ko)h=!0;else if(Uo===1?l<c+La:l>d-La)return-Uo}else if(l>c+u*(1-i)/2&&l<d-u*(1-i)/2)return yO(e)}return h=h||s,h&&(l<c+u*o/2||l>d-u*o/2)?l>c+u/2?1:-1:0}function yO(t){return Bt(F)<Bt(t)?1:-1}function bO(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 kO(t){ul.length=0;for(var e=t.getElementsByTagName("input"),n=e.length;n--;){var r=e[n];r.checked&&ul.push(r)}}function Ba(t){return setTimeout(t,0)}function xd(t){return clearTimeout(t)}Ou&&ve(document,"touchmove",function(t){(ne.active||Ri)&&t.cancelable&&t.preventDefault()});ne.utils={on:ve,off:ge,css:te,find:Fy,is:function(t,e){return!!hn(t,e,t,!1)},extend:nO,throttle:Ly,closest:hn,toggleClass:Et,clone:Vy,index:Bt,nextTick:Ba,cancelNextTick:xd,detectDirection:jy,getChild:to};ne.get=function(t){return t[Tt]};ne.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&&(ne.utils=xn(xn({},ne.utils),r.utils)),Vs.mount(r)})};ne.create=function(t,e){return new ne(t,e)};ne.version=ZT;var Pe=[],Po,Ed,Cd=!1,cc,dc,cl,Fo;function wO(){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?ge(document,"dragover",this._handleAutoScroll):(ge(document,"pointermove",this._handleFallbackAutoScroll),ge(document,"touchmove",this._handleFallbackAutoScroll),ge(document,"mousemove",this._handleFallbackAutoScroll)),Zf(),Va(),rO()},nulling:function(){cl=Ed=Po=Cd=Fo=cc=dc=null,Pe.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(cl=e,n||this.options.forceAutoScrollFallback||Bs||Gn||Ho){pc(e,this.options,s,n);var a=lr(s,!0);Cd&&(!Fo||i!==cc||o!==dc)&&(Fo&&Zf(),Fo=setInterval(function(){var l=lr(document.elementFromPoint(i,o),!0);l!==a&&(a=l,Va()),pc(e,r.options,l,n)},10),cc=i,dc=o)}else{if(!this.options.bubbleScroll||lr(s,!0)===yn()){Va();return}pc(e,this.options,lr(s,!1),!1)}}},qn(t,{pluginName:"scroll",initializeByDefault:!0})}function Va(){Pe.forEach(function(t){clearInterval(t.pid)}),Pe=[]}function Zf(){clearInterval(Fo)}var pc=Ly(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;Ed!==n&&(Ed=n,Va(),Po=e.scroll,c=e.scrollFn,Po===!0&&(Po=lr(n,!0)));var d=0,h=Po;do{var p=h,f=je(p),m=f.top,g=f.bottom,b=f.left,y=f.right,k=f.width,v=f.height,w=void 0,x=void 0,C=p.scrollWidth,M=p.scrollHeight,T=te(p),A=p.scrollLeft,_=p.scrollTop;p===l?(w=k<C&&(T.overflowX==="auto"||T.overflowX==="scroll"||T.overflowX==="visible"),x=v<M&&(T.overflowY==="auto"||T.overflowY==="scroll"||T.overflowY==="visible")):(w=k<C&&(T.overflowX==="auto"||T.overflowX==="scroll"),x=v<M&&(T.overflowY==="auto"||T.overflowY==="scroll"));var N=w&&(Math.abs(y-i)<=s&&A+k<C)-(Math.abs(b-i)<=s&&!!A),$=x&&(Math.abs(g-o)<=s&&_+v<M)-(Math.abs(m-o)<=s&&!!_);if(!Pe[d])for(var j=0;j<=d;j++)Pe[j]||(Pe[j]={});(Pe[d].vx!=N||Pe[d].vy!=$||Pe[d].el!==p)&&(Pe[d].el=p,Pe[d].vx=N,Pe[d].vy=$,clearInterval(Pe[d].pid),(N!=0||$!=0)&&(u=!0,Pe[d].pid=setInterval(function(){r&&this.layer===0&&ne.active._onTouchMove(cl);var q=Pe[this.layer].vy?Pe[this.layer].vy*a:0,K=Pe[this.layer].vx?Pe[this.layer].vx*a:0;typeof c=="function"&&c.call(ne.dragged.parentNode[Tt],K,q,t,cl,Pe[this.layer].el)!=="continue"||By(Pe[this.layer].el,K,q)}.bind({layer:d}),24))),d++}while(e.bubbleScroll&&h!==l&&(h=lr(h,!1)));Cd=u}},30),Wy=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 Zp(){}Zp.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=to(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:Wy};qn(Zp,{pluginName:"revertOnSpill"});function Qp(){}Qp.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:Wy};qn(Qp,{pluginName:"removeOnSpill"});ne.mount(new wO);ne.mount(Qp,Zp);function hc(t){t.parentElement!==null&&t.parentElement.removeChild(t)}function Qf(t,e,n){const r=n===0?t.children[0]:t.children[n-1].nextSibling;t.insertBefore(e,r)}function xO(){return typeof window<"u"?window.console:global.console}const EO=xO();function CO(t){const e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}const SO=/-(\w)/g,TO=CO(t=>t.replace(SO,(e,n)=>n.toUpperCase())),Uy=["Start","Add","Remove","Update","End"],Ky=["Choose","Unchoose","Sort","Filter","Clone"],Gy=["Move"],OO=[Gy,Uy,Ky].flatMap(t=>t).map(t=>`on${t}`),Sd={manage:Gy,manageAndEmit:Uy,emit:Ky};function AO(t){return OO.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 _O(t){return MO.includes(t)}function DO(t){return["transition-group","TransitionGroup"].includes(t)}function Jy(t){return["id","class","role","style"].includes(t)||t.startsWith("data-")||t.startsWith("aria-")||t.startsWith("on")}function Yy(t){return t.reduce((e,[n,r])=>(e[n]=r,e),{})}function IO({$attrs:t,componentData:e={}}){return{...Yy(Object.entries(t).filter(([n,r])=>Jy(n))),...e}}function NO({$attrs:t,callBackBuilder:e}){const n=Yy(Xy(t));Object.entries(e).forEach(([i,o])=>{Sd[i].forEach(s=>{n[`on${s}`]=o(s)})});const r=`[data-draggable]${n.draggable||""}`;return{...n,draggable:r}}function Xy(t){return Object.entries(t).filter(([e,n])=>!Jy(e)).map(([e,n])=>[TO(e),n]).filter(([e,n])=>!AO(e))}const em=({el:t})=>t,RO=(t,e)=>t.__draggable_context=e,tm=t=>t.__draggable_context;class PO{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)=>{RO(em(r),{element:n[i],index:i})})}getUnderlyingVm(e){return tm(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=tm(s);if(a)return a.index;if(i===0)return 0;const l=em(r[0]),u=[...o].findIndex(c=>c===l);return e<u?0:i}}function FO(t,e){const n=t[e];return n?n():[]}function LO({$slots:t,realList:e,getKey:n}){const r=e||[],[i,o]=["header","footer"].map(l=>FO(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 BO(t){const e=DO(t),n=!_O(t)&&!e;return{transition:e,externalComponent:n,tag:n?Vk(t):e?Bk:t}}function VO({$slots:t,tag:e,realList:n,getKey:r}){const i=LO({$slots:t,realList:n,getKey:r}),o=BO(e);return new PO({nodes:i,root:o,realList:n})}function Zy(t,e){xr(()=>this.$emit(t.toLowerCase(),e))}function Qy(t){return(e,n)=>{if(this.realList!==null)return this[`onDrag${t}`](e,n)}}function $O(t){const e=Qy.call(this,t);return(n,r)=>{e.call(this,n,r),Zy.call(this,t,n)}}let fc=null;const jO={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}},zO=["update:modelValue","change",...[...Sd.manageAndEmit,...Sd.emit].map(t=>t.toLowerCase())],eb=Q({name:"draggable",inheritAttrs:!1,props:jO,emits:zO,data(){return{error:!1}},render(){try{this.error=!1;const{$slots:t,$attrs:e,tag:n,componentData:r,realList:i,getKey:o}=this,s=VO({$slots:t,tag:n,realList:i,getKey:o});this.componentStructure=s;const a=IO({$attrs:e,componentData:r});return s.render(us,a)}catch(t){return this.error=!0,us("pre",{style:{color:"red"}},t.stack)}},created(){this.list!==null&&this.modelValue!==null&&EO.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=NO({$attrs:t,callBackBuilder:{manageAndEmit:o=>$O.call(this,o),emit:o=>Zy.bind(this,o),manage:o=>Qy.call(this,o)}}),i=e.nodeType===1?e:e.parentElement;this._sortable=new ne(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&&Xy(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){xr(()=>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),fc=t.item},onDragAdd(t){const e=t.item._underlying_vm_;if(e===void 0)return;hc(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(Qf(this.$el,t.item,t.oldIndex),t.pullMode==="clone"){hc(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){hc(t.item),Qf(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(fc)!==-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(){fc=null}}}),HO={key:0,class:"k-media__label-wrapper"},qO={key:1,class:"k-media__sublabel"},zL=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=z(null),o=I(()=>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=I({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,...b}=f;return b}))}}),a=I(()=>n.types.map(p=>typeof p=="string"?GT[p]:p).filter(Boolean));we(()=>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,...b}=p;r("update:modelValue",n.multiple?(n.modelValue||[]).filter(y=>y.url!==b.url):null),((f=i?.value)==null?void 0:f.url)===p.url&&xr(()=>{l()})}function c(p){r("update:modelValue",n.multiple?[...n.modelValue||[],p]:p),xr(()=>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:Se(B(h)({placement:p.placement}))},[p.label||p.sublabel||p.$slots.sublabel||p.$slots.label?(E(),O("div",HO,[p.label||p.$slots.label?(E(),O("label",{key:0,class:Se(["k-media__label",{"k-media__label-required":p.required}])},[L(p.$slots,"label",{},()=>[Be(oe(p.label),1)])],2)):P("",!0),p.sublabel||p.$slots.sublabel?(E(),O("span",qO,[L(p.$slots,"sublabel",{},()=>[Be(oe(p.sublabel),1)])])):P("",!0)])):P("",!0),he(HT,{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},_s({default:ee(({openFileWindow:m})=>[he(DT,{onOpenFileWindow:m,ref:"typeSelector",value:a.value,onAdd:c,labels:p.labels,upload:p.upload},null,8,["onOpenFileWindow","value","labels","upload"])]),"drop-message":ee(()=>[L(p.$slots,"drop-message")]),"custom-message":ee(()=>[L(p.$slots,"custom-message")]),_:2},[i.value?{name:"preview",fn:ee(()=>[p.description&&o.value?(E(),H(IT,{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"])):P("",!0),(E(),H(et(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"]),L(p.$slots,"bottom"),p.multiple?(E(),H(B(eb),{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:ee(({element:m,index:g})=>[(E(),H(AT,{onKeydown:kp(b=>i.value=m,["enter"]),tabindex:"0",size:p.thumbnailSize,key:m.url,value:m,disabled:p.disabled,onClick:b=>i.value=m,onDelete:b=>u(m)},null,8,["onKeydown","size","value","disabled","onClick","onDelete"]))]),_:1},8,["modelValue","sort"])):P("",!0)],2))}});var WO=$n("switch").parts("root","label","control","thumb"),ma=WO.build(),tb=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`switch:${t.id}`},nm=t=>{var e;return((e=t.ids)==null?void 0:e.label)??`switch:${t.id}:label`},UO=t=>{var e;return((e=t.ids)==null?void 0:e.thumb)??`switch:${t.id}:thumb`},KO=t=>{var e;return((e=t.ids)==null?void 0:e.control)??`switch:${t.id}:control`},Td=t=>{var e;return((e=t.ids)==null?void 0:e.hiddenInput)??`switch:${t.id}:input`},GO=t=>t.getById(tb(t)),Hi=t=>t.getById(Td(t));function JO(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":J(n.get("active")),"data-focus":J(u),"data-focus-visible":J(c),"data-readonly":J(a),"data-hover":J(n.get("hovered")),"data-disabled":J(s),"data-state":l?"checked":"unchecked","data-invalid":J(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({...ma.root.attrs,...d,dir:i("dir"),id:tb(o),htmlFor:Td(o),onPointerMove(){s||r({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){s||r({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(h){var p;s||(pt(h)===Hi(o)&&h.stopPropagation(),Ap()&&((p=Hi(o))==null||p.focus()))}})},getLabelProps(){return e.element({...ma.label.attrs,...d,dir:i("dir"),id:nm(o)})},getThumbProps(){return e.element({...ma.thumb.attrs,...d,dir:i("dir"),id:UO(o),"aria-hidden":!0})},getControlProps(){return e.element({...ma.control.attrs,...d,dir:i("dir"),id:KO(o),"aria-hidden":!0})},getHiddenInputProps(){return e.input({id:Td(o),type:"checkbox",required:i("required"),defaultChecked:l,disabled:s,"aria-labelledby":nm(o),"aria-invalid":i("invalid"),name:i("name"),form:i("form"),value:i("value"),style:Rp,onFocus(){const h=ps();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:rm}=pu(),YO={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:rm("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:rm("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 Tv({pointerNode:GO(e),keyboardNode:Hi(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 Pp({root:e.getRootNode()})},trackFormControlState({context:t,send:e,scope:n}){return cu(Hi(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=Hi(e);n&&_p(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=Hi(e);Dp(n,{checked:t.get("checked")})}}}};Kn()(["checked","defaultChecked","dir","disabled","form","getRootNode","id","ids","invalid","label","name","onCheckedChange","readOnly","required","value"]);const XO={class:"k-switch__label"},HL=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=gi(YO,{id:Qt(),...n,defaultChecked:n.modelValue,onCheckedChange:({checked:s})=>r("update:modelValue",s)}),o=I(()=>JO(i,mi));return we(()=>n.modelValue,()=>{if(o.value.checked!==n.modelValue)return o.value.setChecked(n.modelValue)}),(s,a)=>(E(),O("label",re({class:"k-switch"},o.value.getRootProps()),[U("input",be(Re(o.value.getHiddenInputProps())),null,16),U("span",be(Re(o.value.getControlProps())),[U("span",be(Re(o.value.getThumbProps())),null,16)],16),s.labels||s.$slots.default?(E(),O("span",be(re({key:0},o.value.getLabelProps())),[U("span",XO,[L(s.$slots,"default",{checked:o.value.checked},()=>[Be(oe(o.value.checked?s.labels.on:s.labels.off),1)])])],16)):P("",!0)],16))}}),qL=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=z(!1);function o(u){const c=u[0];c.isIntersecting&&(i.value=!0,xr(()=>{r("intersect",c),l()}))}const s=z(),a=z();Tn(()=>{s.value=new IntersectionObserver(o,{root:n.observerRoot,threshold:n.threshold}),s.value.observe(a.value)}),hi(()=>{l()});function l(){s.value&&s.value.disconnect()}return(u,c)=>(E(),H(et(u.wrapperTag),{ref_key:"rootRef",ref:a,class:"k-lazyload"},{default:ee(()=>[i.value?L(u.$slots,"default",{key:0}):L(u.$slots,"placeholder",{key:1})]),_:3},512))}}),ZO={class:"k-file-uploader__bar"},QO={class:"k-file-uploader__meta"},eA={key:0},tA={key:1},nA=Q({__name:"Uploader",props:{value:{},bytes:{},current:{default:1},total:{default:1}},setup(t){const e=t,n=I(()=>e.total>1),r=I(()=>Jp(e.bytes)),i=I(()=>Math.floor(e.value));return(o,s)=>(E(),H(ri,{class:"k-file-uploader",align:"center",justify:"space-between",gap:"0rem"},{default:ee(()=>[U("div",null,oe(i.value)+" %",1),U("div",ZO,[U("div",{class:"k-file-uploader__bar-value",style:kn({width:o.value+"%"})},null,4)]),U("div",QO,[n.value?(E(),O("div",eA,oe(o.current)+" / "+oe(o.total),1)):P("",!0),o.bytes?(E(),O("div",tA,"("+oe(r.value)+")",1)):P("",!0)])]),_:1}))}}),rA=["innerHTML"],im=Q({__name:"SlotHandler",props:{value:{}},setup(t){const e=t,n=I(()=>typeof e.value=="string"?e.value:void 0),r=I(()=>typeof e.value=="string"?"div":e.value);return(i,o)=>(E(),H(et(r.value),be(Re(i.$attrs)),{default:ee(()=>[n.value?(E(),O("span",{key:0,innerHTML:n.value},null,8,rA)):P("",!0)]),_:1},16))}}),iA={class:"k-file-droparea__instruction"},oA=["accept","required","disabled","multiple"],sA={key:0,class:"k-file-droparea__max-size"},aA=Q({__name:"DropArea",props:{value:{},multiple:{type:Boolean},upload:{},uploadOptions:{},accept:{},dropMessage:{},fileSizeError:{},disabled:{type:Boolean},required:{type:Boolean},rename:{type:Boolean},labels:{}},emits:["input"],setup(t,{emit:e}){const n=t,r=e,i=z(!1),o=z(!0),s=z(),a=z(!1),l=I(()=>!!n.required),u=I(()=>n.disabled),c=I(()=>!u.value&&!p.total),d=I(()=>TT(n.accept)),{run:h,queue:p}=new Iy(n);function f(C){return h(C).then(M=>{!M||!M.length||r("input",n.multiple?[...n.value||[],...M]:M[0])})}function m(C){if(!C)return 0;const M={bytes:1,b:1,kb:1024,mb:1024**2,gb:1024**3,tb:1024**4,pb:1024**5},T=C.trim().toLowerCase().match(/^([\d.]+)\s*(bytes|b|kb|mb|gb|tb|pb)$/);if(!T)throw new Error("Invalid size format");const A=parseFloat(T[1]),_=T[2];return Math.round(A*M[_])}function g(){return o.value=!1,a.value=!0,setTimeout(()=>{w()},1500)}function b(C=0){var M;return m((M=n?.uploadOptions)==null?void 0:M.maxSize)<C}async function y(C){var M;if(u.value)return;let T=C.target.files||[];if(Array.from(T).some(A=>b(A.size))&&(M=n.uploadOptions)!=null&&M.maxSize)return g();n.uploadOptions.preTransform&&(T=await n.uploadOptions.preTransform(C)),f(T),s.value&&(s.value.value="")}async function k(C){var M,T;if(u.value||!s.value)return;C.preventDefault();let A=(M=C.dataTransfer)==null?void 0:M.files;if(A!=null&&A.length){if(Array.from(A).some(_=>b(_.size))&&(T=n.uploadOptions)!=null&&T.maxSize)return g();if(!o.value)return w();w(),n.uploadOptions.preTransform&&(A=await n.uploadOptions.preTransform(C)),A!=null&&A.length&&(s.value.files=C.dataTransfer.files,s.value.dispatchEvent(new InputEvent("input")),f(A))}}function v(C){if(u.value||!C.dataTransfer)return;const M=Array.from(C.dataTransfer.items).every(A=>Yp(A,n.accept)),T=n.multiple?!0:C.dataTransfer.items.length===1;o.value=M&&T,i.value=!0,C.preventDefault()}function w(){o.value=!0,i.value=!1,a.value=!1}const x=rn("k-file-droparea",{variants:{active:{true:"k-file-droparea--active"},invalid:{true:"k-file-droparea--invalid"},disabled:{true:"k-file-droparea--disabled"}}});return(C,M)=>{var T,A,_;return E(),O(Oe,null,[U("div",{class:Se(B(x)({active:i.value,invalid:!o.value,disabled:u.value})),onDrop:k,onDragover:v,onDragleave:w},[L(C.$slots,"preview"),U("div",iA,[c.value?(E(),O("input",{key:0,type:"file",accept:Array.isArray(C.accept)?C.accept.join(","):C.accept,required:l.value,ref_key:"input",ref:s,onChange:y,disabled:!c.value,multiple:C.multiple,class:"k-file-droparea__input"},null,40,oA)):P("",!0),o.value?(E(),O(Oe,{key:1},[L(C.$slots,"drop-message",{extensions:d.value},()=>[he(im,{value:C.dropMessage,extensions:d.value},null,8,["value","extensions"])]),(T=n.uploadOptions)!=null&&T.maxSize?(E(),O("div",sA,[U("span",null,oe(`${(A=C.labels)==null?void 0:A.maxSize}: ${(_=n?.uploadOptions)==null?void 0:_.maxSize}`),1)])):P("",!0)],64)):(E(),H(B(Qe),{key:2,icon:"fa-pro-light:ban",style:{"font-size":"2rem"}})),a.value?L(C.$slots,"file-size-error",{key:3,extensions:d.value},()=>[he(im,{class:"k-file-droparea__file-size-error",value:C.fileSizeError,extensions:d.value},null,8,["value","extensions"])]):P("",!0),L(C.$slots,"custom-message")])],34),B(p).total?(E(),H(nA,{key:0,value:B(p).progress,bytes:B(p).bytes,current:B(p).counter,total:B(p).total},null,8,["value","bytes","current","total"])):P("",!0)],64)}}}),lA=Rs?window:void 0;function uA(t){var e;const n=qe(t);return(e=n?.$el)!=null?e:n}function cA(...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=I(()=>{const a=Kr(qe(t[0])).filter(l=>l!=null);return a.every(l=>typeof l!="string")?a:void 0}),o=Hv(()=>{var a,l;return[(l=(a=i.value)==null?void 0:a.map(u=>uA(u)))!=null?l:[lA].filter(u=>u!=null),Kr(qe(i.value?t[1]:t[0])),Kr(B(i.value?t[2]:t[1])),qe(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=zv(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 Ns(n),s}const dA=Q({name:"UseClipboard",props:["source","read","navigator","copiedDuring","legacy"],setup(t,{slots:e}){const n=wp(dE(t));return()=>{var r;return(r=e.default)==null?void 0:r.call(e,n)}}});function mc(t){return typeof Window<"u"&&t instanceof Window?t.document.documentElement:typeof Document<"u"&&t instanceof Document?t.documentElement:t}function nb(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:nb(n)}}function pA(t){const e=t||window.event,n=e.target;return nb(n)?!1:e.touches.length>1?!0:(e.preventDefault&&e.preventDefault(),!1)}const gc=new WeakMap;function hA(t,e=!1){const n=It(e);let r=null,i="";we(sE(t),a=>{const l=mc(qe(a));if(l){const u=l;if(gc.get(u)||gc.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=mc(qe(t));!a||n.value||(vf&&(r=cA(a,"touchmove",l=>{pA(l)},{passive:!1})),a.style.overflow="hidden",n.value=!0)},s=()=>{const a=mc(qe(t));!a||!n.value||(vf&&r?.(),a.style.overflow=i,gc.delete(a),n.value=!1)};return Ns(s),I({get(){return n.value},set(a){a?o():s()}})}function fA(){let t=!1;const e=It(!1);return(n,r)=>{if(e.value=r.value,t)return;t=!0;const i=hA(n,r.value);we(e,o=>i.value=o)}}fA();var mA=$n("toggle-group").parts("root","item"),om=mA.build(),dl=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`toggle-group:${t.id}`},gA=(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}`},rb=t=>t.getById(dl(t)),Au=t=>{const e=`[data-ownedby='${CSS.escape(dl(t))}']:not([data-disabled])`;return Np(rb(t),e)},sm=t=>Nv(Au(t)),vA=t=>Rv(Au(t)),yA=(t,e,n)=>Zx(Au(t),e,n),bA=(t,e,n)=>Qx(Au(t),e,n);function kA(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=gA(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({...om.root.attrs,id:dl(o),dir:i("dir"),role:l?"radiogroup":"group",tabIndex:n.get("isTabbingBackward")?-1:0,"data-disabled":J(a),"data-orientation":i("orientation"),"data-focus":J(n.get("focusedId")!=null),style:{outline:"none"},onMouseDown(){a||r({type:"ROOT.MOUSE_DOWN"})},onFocus(h){a||h.currentTarget===pt(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({...om.item.attrs,id:p.id,type:"button","data-ownedby":dl(o),"data-focus":J(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":J(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}),Ap()&&m.currentTarget.focus({preventScroll:!0}))},onKeyDown(m){if(m.defaultPrevented||!Sx(m)||p.disabled)return;const g={Tab(b){const y=b.shiftKey;r({type:"TOGGLE.SHIFT_TAB",isShiftTab:y})},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"})}}[kv(m)];g&&(g(m),m.key!=="Tab"&&m.preventDefault())}})}}}var{not:am,and:wA}=pu(),xA={props({props:t}){return{defaultValue:[],orientation:"horizontal",rovingFocus:!0,loopFocus:!0,deselectable:!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:am(wA("isClickFocus","isTabbingBackward")),actions:["focusFirstToggle","clearClickFocus"]},"TOGGLE.FOCUS":{target:"focused",actions:["setFocusedId"]}}},focused:{on:{"ROOT.BLUR":{target:"idle",actions:["clearIsTabbingBackward","clearFocusedId","clearClickFocus"]},"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:am("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=sm(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=rb(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}){D1(e,["value"]);let r=t.get("value");g1(e.value)?r=e.value:n("multiple")?r=f1(r,e.value):r=Ds(r,[e.value])&&n("deselectable")?[]:[e.value],t.set("value",r)},focusNextToggle({context:t,scope:e,prop:n}){At(()=>{var r;const i=t.get("focusedId");i&&((r=yA(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=bA(e,i,n("loopFocus")))==null||r.focus({preventScroll:!0}))})},focusFirstToggle({scope:t}){At(()=>{var e;(e=sm(t))==null||e.focus({preventScroll:!0})})},focusLastToggle({scope:t}){At(()=>{var e;(e=vA(t))==null||e.focus({preventScroll:!0})})}}}};Kn()(["dir","disabled","getRootNode","id","ids","loopFocus","multiple","onValueChange","orientation","rovingFocus","value","defaultValue","deselectable"]);Kn()(["value","disabled"]);const ib=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=gi(xA,{id:Qt(),...n,orientation:n.direction,defaultValue:n.modelValue,onValueChange:({value:a})=>{r("update:modelValue",a)},rovingFocus:!0,loopFocus:!0}),o=I(()=>kA(i,mi)),s=z();return we(()=>{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"))}),we(()=>n.modelValue,a=>{a.every(l=>o.value.value.includes(l))&&a.length===o.value.value.length||o.value.setValue([...a])},{deep:!1}),(a,l)=>(E(),O("div",re({class:["k-buttongroup",`k-buttongroup--direction-${a.direction}`]},o.value.getRootProps()),[L(a.$slots,"default",{getItemProps:o.value.getItemProps},()=>[a.items?(E(!0),O(Oe,{key:0},_t(a.items,({id:u,...c})=>(E(),H(He,re({class:"k-buttongroup__item",variant:"tertiary",ref_for:!0},{...c,...o.value.getItemProps({value:u})}),null,16))),256)):P("",!0)]),a.dropdownItems||a.$slots.dropdown?(E(),H(Eu,re({key:0,ref_key:"dropdown",ref:s,keepOpen:!0,items:a.dropdownItems},o.value.getItemProps({value:"dropdown"})),{default:ee(({close:u})=>[L(a.$slots,"dropdown",{close:u,getItemProps:o.value.getItemProps})]),_:3},16,["items"])):P("",!0)],16))}}),EA=["href"],CA={class:"k-file-thumbnail__info"},SA=["value","disabled"],TA={class:"k-file-thumbnail__info-footer"},OA={key:0,class:"k-file-thumbnail__size"},AA=Q({__name:"Thumbnail",props:{value:{},disabled:{type:Boolean},rename:{type:Boolean},sortable:{type:Boolean},disablePreview:{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=I(()=>{let p=[...n,...r.icons].find(f=>r.value.type.match(f.pattern));return p?.icon||"fa-pro-solid:file"}),o=I(()=>r.disabled?"a":"div"),s=I(()=>r.disabled?{click:p=>{p.preventDefault(),kd(r.value)}}:{}),a=I(()=>r.disabled?{title:r.disabled?"Download":null}:{});function l(){r.disabled||kd(r.value)}const u=z(),c=z([]),d=z();function h(){var p;(p=u.value)==null||p.blur()}return(p,f)=>(E(),H(et(o.value),re({class:["k-file-thumbnail",{"k-file-thumbnail--clickable":p.disabled}]},a.value,nv(s.value)),{default:ee(()=>[he(ri,{class:"k-file-thumbnail__preview",gap:"0rem",justify:"center",align:"center"},{default:ee(()=>[L(p.$slots,"icon",{},()=>[!r.disablePreview&&p.value.type.includes("image")&&p.value.url?(E(),O("a",{key:0,href:p.value.url,target:"_blank"},[he(bu,{class:"k-file-thumbnail__preview-image",src:p.value.url,alt:p.value.name,size:"contain",aspectRatio:"1/1"},null,8,["src","alt"])],8,EA)):(E(),H(B(Qe),{key:1,icon:i.value,class:"k-file-thumbnail__preview-icon"},null,8,["icon"]))])]),_:3}),U("div",CA,[U("input",{type:"text",ref_key:"input",ref:u,class:"k-file-thumbnail__name",value:p.value.name,onKeypress:kp(h,["enter"]),disabled:p.disabled||!p.rename,onInput:f[0]||(f[0]=m=>p.$emit("rename",m.target.value))},null,40,SA),U("div",TA,[p.value.size?(E(),O("span",OA,oe(B(Jp)(p.value.size)),1)):P("",!0)])]),he(ib,{modelValue:c.value,"onUpdate:modelValue":f[1]||(f[1]=m=>{c.value=m.filter(g=>g!=="download")}),disabled:p.disabled},{default:ee(({getItemProps:m})=>[p.value.url?(E(),H(He,re({key:0,is:"a",href:p.value.url,class:"k-file-thumbnail__download",onClick:Ka(l,["prevent"]),icon:"fa-pro-light:arrow-down-to-line",variant:"tertiary"},m({value:"download"})),null,16,["href"])):P("",!0)]),dropdown:ee(({close:m})=>[p.value.url?(E(),H(He,{key:0,is:"a",href:p.value.url,class:"k-file-thumbnail__download",onClick:Ka(l,["prevent"]),iconRight:"fa-pro-light:arrow-down-to-line",label:p.labels.download,variant:"tertiary"},null,8,["href","label"])):P("",!0),he(B(dA),null,{default:ee(({copy:g,copied:b})=>[p.value.url?(E(),H(He,{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"])):P("",!0)]),_:1}),p.disabled?P("",!0):(E(),H(He,{key:1,variant:"danger",label:p.labels.delete,class:"k-file-thumbnail__delete",iconRight:"fa-pro-light:times",onClick:()=>{p.$emit("delete"),m()}},null,8,["label","onClick"]))]),_:1},8,["modelValue","disabled"]),p.sortable?(E(),H(B(Qe),{key:0,icon:"fa-pro-solid:arrows-alt-v",class:"k-file-thumbnail__handle"})):P("",!0)]),_:3},16,["class"]))}}),MA={key:0,class:"k-file__label-wrapper"},_A={key:1,class:"k-file__sublabel"},WL=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."},fileSizeError:{default:"The file size exceeds the allowed limit."},rename:{type:Boolean,default:!0},accept:{},serialize:{type:Function,default:t=>t},required:{type:Boolean},disabled:{type:Boolean},disablePreview:{type:Boolean},icons:{default:()=>[]},labels:{default:()=>({delete:"Delete",download:"Download",copy:"Copy link",maxSize:"Maximum size"})}},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=I(()=>n.multiple||!n.modelValue),a=I({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:Se(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:Se(["k-file__label",{"k-file__label-required":u.required}])},[L(u.$slots,"label",{},()=>[Be(oe(u.label),1)])],2)):P("",!0),u.sublabel||u.$slots.sublabel?(E(),O("span",_A,[L(u.$slots,"sublabel",{},()=>[Be(oe(u.sublabel),1)])])):P("",!0)])):P("",!0),he(ri,{direction:"column"},{default:ee(()=>[a.value.length?(E(),H(B(eb),{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:ee(({element:d,index:h})=>[(E(),H(AA,{key:d.url||h,disabled:u.disabled,sortable:!u.disabled&&u.sortable&&u.multiple&&a.value.length>1,"disable-preview":u.disablePreview,rename:u.rename===!0,value:u.serialize(d),onRename:p=>d.name=p,onDelete:p=>o(d),icons:u.icons,labels:u.labels},_s({_:2},[_t(u.$slots,(p,f)=>({name:f,fn:ee(()=>[L(u.$slots,f,{item:d})])}))]),1032,["disabled","sortable","disable-preview","rename","value","onRename","onDelete","icons","labels"]))]),_:3},8,["modelValue","disabled"])):P("",!0),s.value?(E(),H(aA,{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,fileSizeError:u.fileSizeError,rename:u.rename,labels:u.labels},{"drop-message":ee(({extensions:d})=>[L(u.$slots,"drop-message",{extensions:d})]),"custom-message":ee(()=>[L(u.$slots,"custom-message")]),_:3},8,["accept","value","multiple","required","disabled","upload-options","upload","dropMessage","fileSizeError","rename","labels"])):P("",!0)]),_:3})],2))}}),ob=new Set,bt=new WeakMap,no=new WeakMap,si=new WeakMap,Od=new WeakMap,DA=new WeakMap,ro=new WeakMap,pl=new WeakMap,Lo=new WeakSet;let Cr,eh=0,th=0;const Ln="__aa_tgt",ms="__aa_del",hl="__aa_new",IA=t=>{const e=BA(t);e&&e.forEach(n=>VA(n))},NA=t=>{t.forEach(e=>{e.target===Cr&&PA(),bt.has(e.target)&&yi(e.target)})};function RA(t){const e=Od.get(t);e?.disconnect();let n=bt.get(t),r=0;const i=5;n||(n=io(t),bt.set(t,n));const{offsetWidth:o,offsetHeight:s}=Cr,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&&yi(t)},{root:Cr,threshold:1,rootMargin:a});l.observe(t),Od.set(t,l)}function yi(t){clearTimeout(pl.get(t));const e=Mu(t),n=gs(e)?500:e.duration;pl.set(t,setTimeout(async()=>{const r=si.get(t);try{await r?.finished,bt.set(t,io(t)),RA(t)}catch{}},n))}function PA(){clearTimeout(pl.get(Cr)),pl.set(Cr,setTimeout(()=>{ob.forEach(t=>ub(t,e=>sb(()=>yi(e))))},100))}function FA(t){setTimeout(()=>{DA.set(t,setInterval(()=>sb(yi.bind(null,t)),2e3))},Math.round(2e3*Math.random()))}function sb(t){typeof requestIdleCallback=="function"?requestIdleCallback(()=>t()):requestAnimationFrame(()=>t())}let Ad,Go;const LA=typeof window<"u"&&"ResizeObserver"in window;LA&&(Cr=document.documentElement,Ad=new MutationObserver(IA),Go=new ResizeObserver(NA),window.addEventListener("scroll",()=>{th=window.scrollY,eh=window.scrollX}),Go.observe(Cr));function BA(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(vc(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(ms in i)return!1;vc(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(ms in i)return!1;i instanceof Element&&(e.add(i),vc(n.target,i),no.set(i,[n.previousSibling,n.nextSibling]))}}return e},new Set)}function vc(t,e){!e&&!(Ln in t)?Object.defineProperty(t,Ln,{value:t}):e&&!(Ln in e)&&Object.defineProperty(e,Ln,{value:t})}function VA(t){var e;const n=t.isConnected,r=bt.has(t);n&&no.has(t)&&no.delete(t),si.has(t)&&((e=si.get(t))===null||e===void 0||e.cancel()),hl in t?lm(t):r&&n?jA(t):r&&!n?zA(t):lm(t)}function un(t){return Number(t.replace(/[^0-9.\-]/g,""))}function $A(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 io(t){const e=t.getBoundingClientRect(),{x:n,y:r}=$A(t);return{top:e.top+r,left:e.left+n,width:e.width,height:e.height}}function ab(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 Mu(t){return Ln in t&&ro.has(t[Ln])?ro.get(t[Ln]):{duration:250,easing:"ease-in-out"}}function lb(t){if(Ln in t)return t[Ln]}function nh(t){const e=lb(t);return e?Lo.has(e):!1}function ub(t,...e){e.forEach(n=>n(t,ro.has(t)));for(let n=0;n<t.children.length;n++){const r=t.children.item(n);r&&e.forEach(i=>i(r,ro.has(r)))}}function rh(t){return Array.isArray(t)?t:[t]}function gs(t){return typeof t=="function"}function jA(t){const e=bt.get(t),n=io(t);if(!nh(t))return bt.set(t,n);let r;if(!e)return;const i=Mu(t);if(typeof i!="function"){const o=e.left-n.left,s=e.top-n.top,[a,l,u,c]=ab(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]=rh(i(t,"remain",e,n));r=new Animation(o),r.play()}si.set(t,r),bt.set(t,n),r.addEventListener("finish",yi.bind(null,t))}function lm(t){hl in t&&delete t[hl];const e=io(t);bt.set(t,e);const n=Mu(t);if(!nh(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]=rh(n(t,"add",e));r=new Animation(i),r.play()}si.set(t,r),r.addEventListener("finish",yi.bind(null,t))}function um(t,e){var n;t.remove(),bt.delete(t),no.delete(t),si.delete(t),(n=Od.get(t))===null||n===void 0||n.disconnect(),setTimeout(()=>{if(ms in t&&delete t[ms],Object.defineProperty(t,hl,{value:!0,configurable:!0}),e&&t instanceof HTMLElement)for(const r in e)t.style[r]=""},0)}function zA(t){var e;if(!no.has(t)||!bt.has(t))return;const[n,r]=no.get(t);Object.defineProperty(t,ms,{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=lb(t))===null||e===void 0||e.appendChild(t),!nh(t))return um(t);const[s,a,l,u]=qA(t),c=Mu(t),d=bt.get(t);(i!==eh||o!==th)&&HA(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(!gs(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]=rh(c(t,"remove",d));m?.styleReset!==!1&&(p=m?.styleReset||p,Object.assign(t.style,p)),h=new Animation(f),h.play()}si.set(t,h),h.addEventListener("finish",um.bind(null,t,p))}function HA(t,e,n,r){const i=eh-e,o=th-n,s=document.documentElement.style.scrollBehavior;if(getComputedStyle(Cr).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(!gs(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 qA(t){const e=bt.get(t),[n,,r]=ab(t,e,io(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=bt.get(i)||io(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 WA(t,e={}){return Ad&&Go&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!gs(e)&&!e.disrespectUserMotionPreference||(Lo.add(t),getComputedStyle(t).position==="static"&&Object.assign(t.style,{position:"relative"}),ub(t,yi,FA,n=>Go?.observe(n)),gs(e)?ro.set(t,e):ro.set(t,{duration:250,easing:"ease-in-out",...e}),Ad.observe(t,{childList:!0}),ob.add(t))),Object.freeze({parent:t,enable:()=>{Lo.add(t)},disable:()=>{Lo.delete(t)},isEnabled:()=>Lo.has(t)})}const cm={mounted:(t,e)=>{WA(t,e.value||{})},getSSRProps:()=>({})},UA=["disabled"],KA={key:0,class:"k-expandable__title"},GA={key:1,class:"k-expandable__subtitle"},JA={key:2,class:"k-expandable__actions"},UL=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=yp(),r=I(()=>n.actions),i=I(()=>n.footer),o=I(()=>n.default),s=z(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)=>Ua((E(),O("fieldset",{disabled:u.disabled,class:Se(B(l)({disabled:u.disabled,expandable:u.expandable,expanded:s.value,variant:u.variant}))},[he(He,{class:Se(["k-expandable__header",{"k-expandable__header--open":s.value}]),is:"legend",tabindex:"0",onKeydown:kp(a,["enter"]),onClick:a,variant:"tertiary"},_s({default:ee(()=>[u.$slots.title||u.title?(E(),O("span",KA,[L(u.$slots,"title",{},()=>[Be(oe(u.title),1)])])):P("",!0),u.$slots.subtitle||u.subtitle?(E(),O("span",GA,[L(u.$slots,"subtitle",{},()=>[Be(oe(u.subtitle),1)])])):P("",!0),r.value?(E(),O("span",JA,[L(u.$slots,"actions")])):P("",!0)]),_:2},[u.expandable?{name:"icon-left",fn:ee(()=>[he(B(Qe),{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(Oe,{key:0},[Ua((E(),H(ri,{class:"k-expandable__content",direction:"column",gap:u.gap},{default:ee(()=>[L(u.$slots,"default")]),_:3},8,["gap"])),[[B(cm)]]),i.value?(E(),H(ri,{key:0,justify:"center",align:"center",class:"k-expandable__footer"},{default:ee(()=>[L(u.$slots,"footer")]),_:3})):P("",!0)],64)):P("",!0)],10,UA)),[[B(cm)]])}});function Ye(t){this.content=t}Ye.prototype={constructor:Ye,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 Ye(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 Ye(n)},addToStart:function(t,e){return new Ye([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ye(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 Ye(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=Ye.from(t),t.size?new Ye(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ye.from(t),t.size?new Ye(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ye.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}};Ye.from=function(t){if(t instanceof Ye)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ye(e)};function cb(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=cb(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function db(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=db(s.content,a.content,n-1,r-1);if(u)return u}n-=l,r-=l}}class D{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 D(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 D(r,i)}cutByIndex(e,n){return e==n?D.empty:e==0&&n==this.content.length?this:new D(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 D(i,o)}addToStart(e){return new D([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new D(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 cb(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return db(this,e,n,r)}findIndex(e,n=-1){if(e==0)return ga(0,e);if(e==this.size)return ga(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?ga(r+1,s):ga(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 D.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new D(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return D.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 D(n||e,r)}static from(e){if(!e)return D.empty;if(e instanceof D)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new D([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}D.empty=new D([],0);const yc={index:0,offset:0};function ga(t,e){return yc.index=t,yc.offset=e,yc}function fl(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(!fl(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!fl(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&&fl(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 ml 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=hb(this.content,e+this.openStart,n);return r&&new V(r,this.openStart,this.openEnd)}removeBetween(e,n){return new V(pb(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(D.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(D.empty,0,0);function pb(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(pb(o.content,e-i-1,n-i-1)))}function hb(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=hb(s.content,e-o-1,n);return a&&t.replaceChild(i,s.copy(a))}function YA(t,e,n){if(n.openStart>t.depth)throw new ml("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ml("Inconsistent open depths");return fb(t,e,n,0)}function fb(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=fb(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}=XA(n,t);return Xr(o,gb(t,s,a,e,r))}else return Xr(o,gl(t,e,r))}function mb(t,e){if(!e.type.compatibleContent(t.type))throw new ml("Cannot join "+e.type.name+" onto "+t.type.name)}function _d(t,e,n){let r=t.node(n);return mb(r,e.node(n)),r}function Yr(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 Jo(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&&(Yr(t.nodeAfter,r),o++));for(let a=o;a<s;a++)Yr(i.child(a),r);e&&e.depth==n&&e.textOffset&&Yr(e.nodeBefore,r)}function Xr(t,e){return t.type.checkContent(e),t.copy(e)}function gb(t,e,n,r,i){let o=t.depth>i&&_d(t,e,i+1),s=r.depth>i&&_d(n,r,i+1),a=[];return Jo(null,t,i,a),o&&s&&e.index(i)==n.index(i)?(mb(o,s),Yr(Xr(o,gb(t,e,n,r,i+1)),a)):(o&&Yr(Xr(o,gl(t,e,i+1)),a),Jo(e,n,i,a),s&&Yr(Xr(s,gl(n,r,i+1)),a)),Jo(r,null,i,a),new D(a)}function gl(t,e,n){let r=[];if(Jo(null,t,n,r),t.depth>n){let i=_d(t,e,n+1);Yr(Xr(i,gl(t,e,n+1)),r)}return Jo(e,null,n,r),new D(r)}function XA(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(D.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class vs{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 vl(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 vs(n,r,o)}static resolveCached(e,n){let r=dm.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 dm.set(e,r=new ZA);let i=r.elts[r.i]=vs.resolve(e,n);return r.i=(r.i+1)%QA,i}}class ZA{constructor(){this.elts=[],this.i=0}}const QA=12,dm=new WeakMap;class vl{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 eM=Object.create(null);let gr=class Dd{constructor(e,n,r,i=ke.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||D.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&&fl(this.attrs,n||e.defaultAttrs||eM)&&ke.sameSet(this.marks,r||ke.none)}copy(e=null){return e==this.content?this:new Dd(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Dd(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 YA(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 vs.resolveCached(this,e)}resolveNoCache(e){return vs.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()+")"),vb(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=D.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=D.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};gr.prototype.text=void 0;class yl extends gr{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):vb(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 yl(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new yl(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 vb(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class ai{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new tM(e,n);if(r.next==null)return ai.empty;let i=yb(r);r.next&&r.err("Unexpected trailing text");let o=lM(aM(i));return uM(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 D.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
+ `)}}ai.empty=new ai(!0);class tM{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 yb(t){let e=[];do e.push(nM(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function nM(t){let e=[];do e.push(rM(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function rM(t){let e=sM(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=iM(t,e);else break;return e}function pm(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function iM(t,e){let n=pm(t),r=n;return t.eat(",")&&(t.next!="}"?r=pm(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function oM(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 sM(t){if(t.eat("(")){let e=yb(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=oM(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 aM(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 bb(t,e){return e-t}function hm(t,e){let n=[];return r(e),n.sort(bb);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 lM(t){let e=Object.create(null);return n(hm(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]);hm(t,l).forEach(c=>{u||i.push([a,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let o=e[r.join(",")]=new ai(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let a=i[s][1].sort(bb);o.next.push({type:i[s][0],next:e[a.join(",")]||n(a)})}return o}}function uM(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 kb(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 wb(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 xb(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 Eb(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new dM(t,r,e[r]);return n}let fm=class Cb{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=Eb(e,r.attrs),this.defaultAttrs=kb(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==ai.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:wb(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new gr(this,this.computeAttrs(e),D.from(n),ke.setFrom(r))}createChecked(e=null,n,r){return n=D.from(n),this.checkContent(n),new gr(this,this.computeAttrs(e),n,ke.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=D.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(D.empty,!0);return o?new gr(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){xb(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 Cb(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 cM(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 dM{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?cM(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class _u{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=Eb(e,i.attrs),this.excluded=null;let o=kb(this.attrs);this.instance=o?new ke(this,o):null}create(e=null){return!e&&this.instance?this.instance:new ke(this,wb(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new _u(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){xb(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Sb{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=Ye.from(e.nodes),n.marks=Ye.from(e.marks||{}),this.nodes=fm.compile(this.spec.nodes,this),this.marks=_u.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]=ai.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?mm(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==""?[]:mm(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 fm){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 yl(r,r.defaultAttrs,e,ke.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return gr.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 mm(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 pM(t){return t.tag!=null}function hM(t){return t.style!=null}class vr{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(pM(i))this.tags.push(i);else if(hM(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 vm(this,n,!1);return r.addAll(e,ke.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new vm(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(gM(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=ym(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=ym(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new vr(e,vr.schemaRules(e)))}}const Tb={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},fM={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ob={ol:!0,ul:!0},ys=1,Id=2,Yo=4;function gm(t,e,n){return e!=null?(e?ys:0)|(e==="full"?Id:0):t&&t.whitespace=="pre"?ys|Id:n&~Yo}class va{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&Yo?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(D.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&ys)){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=D.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(D.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&&!Tb.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class vm{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=gm(null,n.preserveWhitespace,0)|(r?Yo:0);i?o=new va(i.type,i.attrs,ke.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new va(null,null,ke.none,!0,null,s):o=new va(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&Id?"full":this.localPreserveWS||(i.options&ys)>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,!/\S/.test(r)),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;Ob.hasOwnProperty(s)&&this.parser.normalizeLists&&mM(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:fM.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(Tb.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,!0)}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,e.nodeName=="BR")||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,!1));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,r){let i,o;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],u=l.findWrapping(e);if(u&&(!i||i.length>u.length+a)&&(i=u,o=l,!u.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(o);for(let s=0;s<i.length;s++)n=this.enterInner(i[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let s=ke.none;for(let a of i.concat(e.marks))(o.type?o.type.allowsMarkType(a.type):bm(a.type,e.type))&&(s=a.addToSet(s));return o.content.push(e.mark(s)),!0}return!1}enter(e,n,r,i){let o=this.findPlace(e.create(n),r,!1);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=gm(e,o,s.options);s.options&Yo&&s.content.length==0&&(a|=Yo);let l=ke.none;return r=r.filter(u=>(s.type?s.type.allowsMarkType(u.type):bm(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new va(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|=ys)}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 mM(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Ob.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function gM(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function ym(t){let e={};for(let n in t)e[n]=t[n];return e}function bm(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 bi{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=bc(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}=$a(bc(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&&$a(bc(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return $a(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new bi(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=km(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return km(e.marks)}}function km(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function bc(t){return t.document||window.document}const wm=new WeakMap;function vM(t){let e=wm.get(t);return e===void 0&&wm.set(t,e=yM(t)),e}function yM(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 $a(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=vM(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}=$a(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 Ab=65535,Mb=Math.pow(2,16);function bM(t,e){return t+e*Mb}function xm(t){return t&Ab}function kM(t){return(t-(t&Ab))/Mb}const _b=1,Db=2,ja=4,Ib=8;class Nd{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Ib)>0}get deletedBefore(){return(this.delInfo&(_b|ja))>0}get deletedAfter(){return(this.delInfo&(Db|ja))>0}get deletedAcross(){return(this.delInfo&ja)>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=xm(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+kM(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:bM(a/3,e-l),m=e==l?Db:e==d?_b:ja;return(n<0?e!=l:e!=d)&&(m|=Ib),new Nd(p,m,f)}i+=c-u}return r?e+i:new Nd(e+i,0,null)}touches(e,n){let r=0,i=xm(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 bs{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new bs(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,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 bs;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 Nd(e,i,null)}}const kc=Object.create(null);class lt{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=kc[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 kc)throw new RangeError("Duplicate use of step JSON ID "+e);return kc[e]=n,n.prototype.jsonID=e,n}}class Le{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Le(e,null)}static fail(e){return new Le(null,e)}static fromReplace(e,n,r,i){try{return Le.ok(e.replace(n,r,i))}catch(o){if(o instanceof ml)return Le.fail(o.message);throw o}}}function ih(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(ih(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return D.fromArray(r)}class ur extends lt{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(ih(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 Le.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 ur(n.pos,r.pos,this.mark)}merge(e){return e instanceof ur&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ur(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 ur(n.from,n.to,e.markFromJSON(n.mark))}}lt.jsonID("addMark",ur);class gn extends lt{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(ih(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Le.fromReplace(e,this.from,this.to,r)}invert(){return new ur(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))}}lt.jsonID("removeMark",gn);class cr extends lt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Le.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Le.fromReplace(e,this.pos,this.pos+1,new V(D.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 cr(this.pos,n.marks[i]);return new cr(this.pos,this.mark)}}return new li(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new cr(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 cr(n.pos,e.markFromJSON(n.mark))}}lt.jsonID("addNodeMark",cr);class li extends lt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Le.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Le.fromReplace(e,this.pos,this.pos+1,new V(D.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new cr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new li(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 li(n.pos,e.markFromJSON(n.mark))}}lt.jsonID("removeNodeMark",li);class ze extends lt{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Rd(e,this.from,this.to)?Le.fail("Structure replace would overwrite content"):Le.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 ze(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 ze(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ze)||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 ze(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 ze(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 ze(n.from,n.to,V.fromJSON(e,n.slice),!!n.structure)}}lt.jsonID("replace",ze);class We extends lt{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&&(Rd(e,this.from,this.gapFrom)||Rd(e,this.gapTo,this.to)))return Le.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Le.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Le.fromReplace(e,this.from,this.to,r):Le.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 We(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 We(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 We(n.from,n.to,n.gapFrom,n.gapTo,V.fromJSON(e,n.slice),n.insert,!!n.structure)}}lt.jsonID("replaceAround",We);function Rd(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 wM(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 ur(h,p,r))}}),i.forEach(l=>t.step(l)),o.forEach(l=>t.step(l))}function xM(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 _u){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 oh(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 ze(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(D.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),s.push(new ze(a+h.index,a+h.index+h[0].length,f))}}a=c}if(!r.validEnd){let l=r.fillBefore(D.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 EM(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function go(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||!EM(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=D.empty,d=0;for(let f=o,m=!1;f>n;f--)m||r.index(f)>0?(m=!0,c=D.from(r.node(f).copy(c)),d++):l--;let h=D.empty,p=0;for(let f=o,m=!1;f>n;f--)m||i.after(f+1)<i.end(f)?(m=!0,h=D.from(i.node(f).copy(h)),p++):u++;t.step(new We(l,u,s,a,new V(c.append(h),d,p),c.size-d,!0))}function sh(t,e,n=null,r=t){let i=SM(t,e),o=i&&TM(r,e);return o?i.map(Em).concat({type:e,attrs:n}).concat(o.map(Em)):null}function Em(t){return{type:t,attrs:null}}function SM(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 TM(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 OM(t,e,n){let r=D.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=D.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new We(i,o,i,o,new V(r,0,0),n.length,!0))}function AM(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&&Rb(t,s,a,o),oh(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 We(d,h,d+1,h-1,new V(D.from(r.create(l,null,s.marks)),0,0),1,!0)),u===!0&&Nb(t,s,a,o),!1}})}function Nb(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 Rb(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 _M(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 We(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new V(D.from(s),0,0),1,!0))}function Gi(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 DM(t,e,n=1,r){let i=t.doc.resolve(e),o=D.empty,s=D.empty;for(let a=i.depth,l=i.depth-n,u=n-1;a>l;a--,u--){o=D.from(i.node(a).copy(o));let c=r&&r[u];s=D.from(c?c.type.create(c.attrs,s):i.node(a).copy(s))}t.step(new ze(e,e,new V(o.append(s),n,n),!0))}function Tr(t,e){let n=t.resolve(e),r=n.index();return Pb(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function IM(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 Pb(t,e){return!!(t&&e&&!t.isLeaf&&IM(t,e))}function Du(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&&Pb(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 NM(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);Rb(t,c.node(),c.before(),a)}s.inlineContent&&oh(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 ze(u,l.map(e+n,-1),V.empty,!0)),r===!0){let c=t.doc.resolve(u);Nb(t,c.node(),c.before(),t.steps.length)}return t}function RM(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 Fb(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 Iu(t,e,n=e,r=V.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return Lb(i,o,r)?new ze(e,n,r):new PM(i,o,r).fit()}function Lb(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class PM{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=D.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=D.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 We(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new ze(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=wc(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(D.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=wc(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=wc(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new V(Bo(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new V(Bo(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(Bb(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=Vo(this.placed,n,D.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 b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=f?e==0?V.empty:new V(Bo(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new V(Bo(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||!xc(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=xc(e,n,i,r,o);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:u}=this.frontier[a],c=xc(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=Vo(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=Vo(this.placed,this.depth,D.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(D.empty,!0);e.childCount&&(this.placed=Vo(this.placed,this.frontier.length,e))}}function Bo(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Bo(t.firstChild.content,e-1,n)))}function Vo(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Vo(t.lastChild.content,e-1,n)))}function wc(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Bb(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Bb(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(D.empty,!0)))),t.copy(r)}function xc(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&&!FM(n,o.content,s)?a:null}function FM(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function LM(t){return t.spec.defining||t.spec.definingForContent}function BM(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),o=t.doc.resolve(n);if(Lb(i,o,r))return t.step(new ze(e,n,r));let s=$b(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=LM(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],b=!0;g<0&&(b=!1,g=-g);let y=i.node(g-1),k=i.index(g-1);if(y.canReplaceWith(k,k,f.type,f.marks))return t.replace(i.before(g),b?o.after(g):n,new V(Vb(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 Vb(t,e,n,r,i){if(e<n){let o=t.firstChild;t=t.replaceChild(0,o.copy(Vb(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(D.empty,!0))}return t}function VM(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=RM(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new V(D.from(r),0,0))}function $M(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=$b(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 $b(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 lt{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 Le.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 Le.fromReplace(e,this.pos,this.pos+1,new V(D.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)}}lt.jsonID("attr",Ji);class ks extends lt{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 Le.ok(r)}getMap(){return Ot.empty}invert(e){return new ks(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 ks(n.attr,n.value)}}lt.jsonID("docAttr",ks);let oo=class extends Error{};oo=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};oo.prototype=Object.create(Error.prototype);oo.prototype.constructor=oo;oo.prototype.name="TransformError";class jb{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new bs}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new oo(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=Iu(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new V(D.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 BM(this,e,n,r),this}replaceRangeWith(e,n,r){return VM(this,e,n,r),this}deleteRange(e,n){return $M(this,e,n),this}lift(e,n){return CM(this,e,n),this}join(e,n=1){return NM(this,e,n),this}wrap(e,n){return OM(this,e,n),this}setBlockType(e,n=e,r,i=null){return AM(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return _M(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 ks(e,n)),this}addNodeMark(e,n){return this.step(new cr(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof ke)n.isInSet(r.marks)&&this.step(new li(e,n));else{let i=r.marks,o,s=[];for(;o=n.isInSet(i);)s.push(new li(e,o)),i=o.removeFromSet(i);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return this}split(e,n=1,r){return DM(this,e,n,r),this}addMark(e,n,r){return wM(this,e,n,r),this}removeMark(e,n,r){return xM(this,e,n,r),this}clearIncompatible(e,n,r){return oh(this,e,n,r),this}}const Ec=Object.create(null);class ue{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new jM(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&&Tm(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),Tm(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new ae(e):Pi(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?Pi(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Pi(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 zt(e.node(0))}static atStart(e){return Pi(e,e,0,0,1)||new zt(e)}static atEnd(e){return Pi(e,e,e.content.size,e.childCount,-1)||new zt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ec[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 Ec)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ec[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ae.between(this.$anchor,this.$head).getBookmark()}}ue.prototype.visible=!0;class jM{constructor(e,n){this.$from=e,this.$to=n}}let Cm=!1;function Sm(t){!Cm&&!t.parent.inlineContent&&(Cm=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ae extends ue{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 ue.near(r);let i=e.resolve(n.map(this.anchor));return new ae(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 ae&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Nu(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 ae(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=ue.findFrom(n,r,!0)||ue.findFrom(n,-r,!0);if(o)n=o.$head;else return ue.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(ue.findFrom(e,-r,!0)||ue.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new ae(e,n)}}ue.jsonID("text",ae);class Nu{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Nu(e.map(this.anchor),e.map(this.head))}resolve(e){return ae.between(e.resolve(this.anchor),e.resolve(this.head))}}class Z extends ue{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?ue.near(o):new Z(o)}content(){return new V(D.from(this.node),0,0)}eq(e){return e instanceof Z&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ah(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Z(e.resolve(n.anchor))}static create(e,n){return new Z(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Z.prototype.visible=!1;ue.jsonID("node",Z);class ah{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Nu(r,r):new ah(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Z.isSelectable(r)?new Z(n):ue.near(n)}}class zt extends ue{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=ue.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new zt(e)}map(e){return new zt(e)}eq(e){return e instanceof zt}getBookmark(){return zM}}ue.jsonID("all",zt);const zM={map(){return this},resolve(t){return new zt(t)}};function Pi(t,e,n,r,i,o=!1){if(e.inlineContent)return ae.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&&Z.isSelectable(a))return Z.create(t,n-(i<0?a.nodeSize:0))}else{let l=Pi(t,a,n+i,i<0?a.childCount:0,i,o);if(l)return l}n+=a.nodeSize*i}return null}function Tm(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof ze||i instanceof We))return;let o=t.mapping.maps[r],s;o.forEach((a,l,u,c)=>{s==null&&(s=c)}),t.setSelection(ue.near(t.doc.resolve(s),n))}const Om=1,ya=2,Am=4;class HM extends jb{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|Om)&~ya,this.storedMarks=null,this}get selectionSet(){return(this.updated&Om)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ya,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&ya)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~ya,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(ue.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|=Am,this}get scrolledIntoView(){return(this.updated&Am)>0}}function Mm(t,e){return!e||!t?t:t.bind(e)}class $o{constructor(e,n,r){this.name=e,this.init=Mm(n.init,r),this.apply=Mm(n.apply,r)}}const qM=[new $o("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new $o("selection",{init(t,e){return t.selection||ue.atStart(e.doc)},apply(t){return t.selection}}),new $o("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new $o("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Cc{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=qM.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 $o(r.key,r.spec.state,r))})}}class qi{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 qi(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 HM(this)}static create(e){let n=new Cc(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new qi(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 Cc(this.schema,e.plugins),r=n.fields,i=new qi(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 Cc(e.schema,e.plugins),o=new qi(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=gr.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=ue.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 zb(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=zb(i,e,{})),n[r]=i}return n}class $e{constructor(e){this.spec=e,this.props={},e.props&&zb(e.props,this,this.props),this.key=e.key?e.key.key:Hb("plugin")}getState(e){return e[this.key]}}const Sc=Object.create(null);function Hb(t){return t in Sc?t+"$"+ ++Sc[t]:(Sc[t]=0,t+"$")}class ut{constructor(e="key"){this.key=Hb(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},so=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Pd=null;const Pn=function(t,e,n){let r=Pd||(Pd=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},WM=function(){Pd=null},ui=function(t,e,n,r){return n&&(_m(t,e,n,r,-1)||_m(t,e,n,r,1))},UM=/^(img|br|input|textarea|hr)$/i;function _m(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:jt(t))){let o=t.parentNode;if(!o||o.nodeType!=1||$s(t)||UM.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?jt(t):0}else return!1}}function jt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function KM(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=jt(t)}else if(t.parentNode&&!$s(t))e=Xe(t),t=t.parentNode;else return null}}function GM(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&&!$s(t))e=Xe(t)+1,t=t.parentNode;else return null}}function JM(t,e,n){for(let r=e==0,i=e==jt(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==jt(t)}}function $s(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 Ru=function(t){return t.focusNode&&ui(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function jr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function YM(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function XM(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(jt(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(jt(r.startContainer),r.startOffset)}}}const En=typeof navigator<"u"?navigator:null,Dm=typeof document<"u"?document:null,Or=En&&En.userAgent||"",Fd=/Edge\/(\d+)/.exec(Or),qb=/MSIE \d/.exec(Or),Ld=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Or),kt=!!(qb||Ld||Fd),yr=qb?document.documentMode:Ld?+Ld[1]:Fd?+Fd[1]:0,nn=!kt&&/gecko\/(\d+)/i.test(Or);nn&&+(/Firefox\/(\d+)/.exec(Or)||[0,0])[1];const Bd=!kt&&/Chrome\/(\d+)/.exec(Or),it=!!Bd,Wb=Bd?+Bd[1]:0,ft=!kt&&!!En&&/Apple Computer/.test(En.vendor),ao=ft&&(/Mobile\/\w+/.test(Or)||!!En&&En.maxTouchPoints>2),Vt=ao||(En?/Mac/.test(En.platform):!1),ZM=En?/Win/.test(En.platform):!1,Bn=/Android \d/.test(Or),js=!!Dm&&"webkitFontSmoothing"in Dm.documentElement.style,QM=js?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function e_(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function _n(t,e){return typeof t=="number"?t:t[e]}function t_(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 Im(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;){if(s.nodeType!=1){s=so(s);continue}let a=s,l=a==o.body,u=l?e_(o):t_(a),c=0,d=0;if(e.top<u.top+_n(r,"top")?d=-(u.top-e.top+_n(i,"top")):e.bottom>u.bottom-_n(r,"bottom")&&(d=e.bottom-e.top>u.bottom-u.top?e.top+_n(i,"top")-u.top:e.bottom-u.bottom+_n(i,"bottom")),e.left<u.left+_n(r,"left")?c=-(u.left-e.left+_n(i,"left")):e.right>u.right-_n(r,"right")&&(c=e.right-u.right+_n(i,"right")),c||d)if(l)o.defaultView.scrollBy(c,d);else{let p=a.scrollLeft,f=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);let m=a.scrollLeft-p,g=a.scrollTop-f;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let h=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(h))break;s=h=="absolute"?s.offsetParent:so(s)}}function n_(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:Ub(t.dom)}}function Ub(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=so(r));return e}function r_({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Kb(n,r==0?0:r-e)}function Kb(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 _i=null;function i_(t){if(t.setActive)return t.setActive();if(_i)return t.focus(_i);let e=Ub(t);t.focus(_i==null?{get preventScroll(){return _i={preventScroll:!0},!0}}:void 0),_i||(_i=!1,Kb(e,0))}function Gb(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=Pn(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?o_(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:Gb(n,i)}function o_(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=er(r,1);if(o.top!=o.bottom&&lh(e,o))return{node:t,offset:i+(e.left>=(o.left+o.right)/2?1:0)}}return{node:t,offset:0}}function lh(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function s_(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function a_(t,e,n){let{node:r,offset:i}=Gb(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 l_(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 Jb(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(lh(e,u))return Jb(s,e,u)}}if((o=(o+1)%r)==i)break}return t}function u_(t,e){let n=t.dom.ownerDocument,r,i=0,o=XM(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(!lh(e,u)||(s=Jb(t.dom,e,u),!s))return null}if(ft)for(let u=s;r&&u;u=so(u))u.draggable&&(r=void 0);if(s=s_(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;js&&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=l_(t,r,i,e))}a==null&&(a=a_(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Nm(t){return t.top<t.bottom||t.left<t.right}function er(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Nm(r))return r}return Array.prototype.find.call(n,Nm)||t.getBoundingClientRect()}const c_=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Yb(t,e,n){let{node:r,offset:i,atom:o}=t.docView.domFromPos(e,n<0?-1:1),s=js||nn;if(r.nodeType==3)if(s&&(c_.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let a=er(Pn(r,i,i),n);if(nn&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let l=er(Pn(r,i-1,i-1),-1);if(l.top==a.top){let u=er(Pn(r,i,i+1),-1);if(u.top!=a.top)return Oo(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++,Oo(er(Pn(r,a,l),u),u<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==jt(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Tc(a.getBoundingClientRect(),!1)}if(o==null&&i<jt(r)){let a=r.childNodes[i];if(a.nodeType==1)return Tc(a.getBoundingClientRect(),!0)}return Tc(r.getBoundingClientRect(),n>=0)}if(o==null&&i&&(n<0||i==jt(r))){let a=r.childNodes[i-1],l=a.nodeType==3?Pn(a,jt(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(l)return Oo(er(l,1),!1)}if(o==null&&i<jt(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let l=a?a.nodeType==3?Pn(a,0,s?0:1):a.nodeType==1?a:null:null;if(l)return Oo(er(l,-1),!0)}return Oo(er(r.nodeType==3?Pn(r):r,-n),n>=0)}function Oo(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 Tc(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 Xb(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 d_(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Xb(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=Yb(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=Pn(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 p_=/[\u0590-\u08ac]/;function h_(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?!p_.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?o:s:Xb(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 Rm=null,Pm=null,Fm=!1;function f_(t,e,n){return Rm==e&&Pm==n?Fm:(Rm=e,Pm=n,Fm=n=="up"||n=="down"?d_(t,e,n):h_(t,e,n))}const Ht=0,Lm=1,qr=2,Cn=3;class zs{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Ht,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 Qb){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 Zb&&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||ft)&&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 b=m.pmViewDesc;if(b&&b.node&&b.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&&ft)&&ui(a.node,a.offset,c.anchorNode,c.anchorOffset)&&ui(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?qr:Lm,e==a&&n==l&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Cn:o.markDirty(e-a,n-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?qr:Cn}r=s}this.dirty=qr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?qr:Lm;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class Zb extends zs{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==Ht&&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 m_ extends zs{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 ci extends zs{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=bi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ci(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Cn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Cn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Ht){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Ht}}slice(e,n,r){let i=ci.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;n<s&&(o=$d(o,n,s,r)),e>0&&(o=$d(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 br extends zs{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}=bi.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=n0(c,r,n),u?l=new g_(e,n,r,i,c,d||null,h,u,o,s+1):n.isText?new Pu(e,n,r,i,c,h,o):new br(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=()=>D.empty)}return e}matchesNode(e,n,r){return this.dirty==Ht&&e.eq(this.node)&&bl(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 y_(this,s&&s.node,e);w_(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==qr)&&(s&&this.protectLocalComposition(e,s),e0(this.contentDOM,this.children,e),ao&&x_(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof ae)||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=E_(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 m_(this,o,n,i);e.input.compositionNodes.push(s),this.children=$d(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==Cn||!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=Ht}updateOuterDeco(e){if(bl(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=t0(this.dom,this.nodeDOM,Vd(this.outerDeco,this.node,n),Vd(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 Bm(t,e,n,r,i){n0(r,e,t);let o=new br(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Pu extends br{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==Cn||this.dirty!=Ht&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Ht||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=Ht,!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 Pu(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=Cn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Qb extends zs{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ht&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class g_ extends br{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==Cn)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 e0(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=Vm(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(s instanceof ci){let l=r?r.previousSibling:t.lastChild;e0(s.contentDOM,s.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=Vm(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Xo=function(t){t&&(this.nodeName=t)};Xo.prototype=Object.create(null);const Wr=[new Xo];function Vd(t,e,n){if(t.length==0)return Wr;let r=n?Wr[0]:new Xo,i=[r];for(let o=0;o<t.length;o++){let s=t[o].type.attrs;if(s){s.nodeName&&i.push(r=new Xo(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&i.length==1&&i.push(r=new Xo(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 t0(t,e,n,r){if(n==Wr&&r==Wr)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=Wr[0]),i=l}v_(i,a||Wr[0],s)}return i}function v_(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 n0(t,e,n){return t0(t,t,Wr,Vd(e,n,t.nodeType!=1))}function bl(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 Vm(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class y_{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=b_(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=Ht,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=ci.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==Cn&&s.dom==s.contentDOM&&(s.dirty=qr),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 br){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!=Cn&&bl(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=qr,d.updateChildren(i,s+1),d.dirty=Ht),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)||!bl(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=br.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=br.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 Zb(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 ci;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Pu)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ft||it)&&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 Qb(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 b_(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 ci)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 k_(t,e){return t.type.side-e.type.side}function w_(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(k_);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 b=0;b<a.length;b++)a[b].to<g&&(g=a[b].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 x_(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 E_(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 $d(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 uh(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(Ru(n)){for(l=s;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&Z.isSelectable(d)&&i.parent&&!(d.isInline&&JM(n.focusNode,n.focusOffset,i.dom))){let h=i.posBefore;u=new Z(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=ch(t,c,a,d)}return u}function r0(t){return t.editable?t.hasFocus():o0(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function zn(t,e=!1){let n=t.state.selection;if(i0(t,n),!!r0(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&it){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&ui(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)S_(t);else{let{anchor:r,head:i}=n,o,s;$m&&!(n instanceof ae)&&(n.$from.parent.inlineContent||(o=jm(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=jm(t,n.to))),t.docView.setSelection(r,i,t,e),$m&&(o&&zm(o),s&&zm(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 $m=ft||it&&Wb<63;function jm(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(ft&&i&&i.contentEditable=="false")return Oc(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Oc(i);if(o)return Oc(o)}}function Oc(t){return t.contentEditable="true",ft&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function zm(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(()=>{(!r0(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function S_(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&&kt&&yr<=11&&(r.disabled=!0,r.disabled=!1)}function i0(t,e){if(e instanceof Z){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Hm(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Hm(t)}function Hm(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function ch(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||ae.between(e,n,r)}function qm(t){return t.editable&&!t.hasFocus()?!1:o0(t)}function o0(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 T_(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ui(e.node,e.offset,n.anchorNode,n.anchorOffset)}function jd(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&&ue.findFrom(o,e)}function nr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Wm(t,e,n){let r=t.state.selection;if(r instanceof ae)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 nr(t,new ae(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=jd(t.state,e);return i&&i instanceof Z?nr(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?Z.isSelectable(o)?nr(t,new Z(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):js?nr(t,new ae(t.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Z&&r.node.isInline)return nr(t,new ae(e>0?r.$to:r.$from));{let i=jd(t.state,e);return i?nr(t,i):!1}}}function kl(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Zo(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Di(t,e){return e<0?O_(t):A_(t)}function O_(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<kl(n)&&Zo(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Zo(a,-1))i=n,o=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(s0(n))break;{let a=n.previousSibling;for(;a&&Zo(a,-1);)i=n.parentNode,o=Xe(a),a=a.previousSibling;if(a)n=a,r=kl(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?zd(t,n,r):i&&zd(t,i,o)}function A_(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=kl(n),o,s;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Zo(a,1))o=n,s=++r;else break}else{if(s0(n))break;{let a=n.nextSibling;for(;a&&Zo(a,1);)o=a.parentNode,s=Xe(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=kl(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}o&&zd(t,o,s)}function s0(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function M_(t,e){for(;t&&e==t.childNodes.length&&!$s(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 __(t,e){for(;t&&!e&&!$s(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 zd(t,e,n){if(e.nodeType!=3){let o,s;(s=M_(e,n))?(e=s,n=0):(o=__(e,n))&&(e=o,n=o.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Ru(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&&zn(t)},50)}function Um(t,e){let n=t.state.doc.resolve(e);if(!(it||ZM)&&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 Km(t,e,n){let r=t.state.selection;if(r instanceof ae&&!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=jd(t.state,e);if(s&&s instanceof Z)return nr(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,a=r instanceof zt?ue.near(s,e):ue.findFrom(s,e);return a?nr(t,a):!1}return!1}function Gm(t,e){if(!(t.state.selection instanceof ae))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 Jm(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function D_(t){if(!ft||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;Jm(t,r,"true"),setTimeout(()=>Jm(t,r,"false"),20)}return!1}function I_(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function N_(t,e){let n=e.keyCode,r=I_(e);if(n==8||Vt&&n==72&&r=="c")return Gm(t,-1)||Di(t,-1);if(n==46&&!e.shiftKey||Vt&&n==68&&r=="c")return Gm(t,1)||Di(t,1);if(n==13||n==27)return!0;if(n==37||Vt&&n==66&&r=="c"){let i=n==37?Um(t,t.state.selection.from)=="ltr"?-1:1:-1;return Wm(t,i,r)||Di(t,i)}else if(n==39||Vt&&n==70&&r=="c"){let i=n==39?Um(t,t.state.selection.from)=="ltr"?1:-1:1;return Wm(t,i,r)||Di(t,i)}else{if(n==38||Vt&&n==80&&r=="c")return Km(t,-1,r)||Di(t,-1);if(n==40||Vt&&n==78&&r=="c")return D_(t)||Km(t,1,r)||Di(t,1);if(r==(Vt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function dh(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")||bi.fromSchema(t.state.schema),a=p0(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let u=l.firstChild,c,d=0;for(;u&&u.nodeType==1&&(c=d0[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
+
15
+ `);return{dom:l,text:h,slice:e}}function a0(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(D.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=bi.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=L_(n),js&&B_(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")||vr.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||c),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!R_.test(d.parentNode.nodeName)?{ignore:!0}:null}})),c)a=V_(Ym(a,+c[1],+c[2]),c[4]);else if(a=V.maxOpen(P_(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=Ym(a,d,h)}return t.someProp("transformPasted",d=>{a=d(a,t)}),a}const R_=/^(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 P_(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&&u0(a,i,s,o[o.length-1],0))o[o.length-1]=l;else{o.length&&(o[o.length-1]=c0(o[o.length-1],i.length));let u=l0(s,a);o.push(u),r=r.matchType(u.type),i=a}}),o)return D.from(o)}return t}function l0(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,D.from(t));return t}function u0(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let o=u0(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(D.from(l0(n,t,i+1))))}}function c0(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,c0(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(D.empty,!0);return t.copy(n.append(r))}function Hd(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=Hd(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(D.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function Ym(t,e,n){return e<t.openStart&&(t=new V(Hd(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new V(Hd(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const d0={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 Xm=null;function p0(){return Xm||(Xm=document.implementation.createHTMLDocument("title"))}let Ac=null;function F_(t){let e=window.trustedTypes;return e?(Ac||(Ac=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Ac.createHTML(t)):t}function L_(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=p0().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&d0[r[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"</"+o+">").reverse().join("")),n.innerHTML=F_(t),i)for(let o=0;o<i.length;o++)n=n.querySelector(i[o])||n;return n}function B_(t){let e=t.querySelectorAll(it?"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 V_(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=D.from(l.create(r[a+1],i)),o++,s++}return new V(i,o,s)}const mt={},gt={},$_={touchstart:!0,touchmove:!0};class j_{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function z_(t){for(let e in mt){let n=mt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{q_(t,r)&&!ph(t,r)&&(t.editable||!(r.type in gt))&&n(t,r)},$_[e]?{passive:!0}:void 0)}ft&&t.dom.addEventListener("input",()=>null),qd(t)}function dr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function H_(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 qd(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>ph(t,r))})}function ph(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function q_(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 W_(t,e){!ph(t,e)&&mt[e.type]&&(t.editable||!(e.type in gt))&&mt[e.type](t,e)}gt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!f0(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Bn&&it&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ao&&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,jr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||N_(t,n)?n.preventDefault():dr(t,"key")};gt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};gt.keypress=(t,e)=>{let n=e;if(f0(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 ae)||!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 Fu(t){return{left:t.clientX,top:t.clientY}}function U_(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function hh(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 Yi(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 K_(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Z.isSelectable(r)?(Yi(t,new Z(n)),!0):!1}function G_(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Z&&(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(Z.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?(Yi(t,Z.create(t.state.doc,i)),!0):!1}function J_(t,e,n,r,i){return hh(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?G_(t,n):K_(t,n))}function Y_(t,e,n,r){return hh(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function X_(t,e,n,r){return hh(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||Z_(t,n,r)}function Z_(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Yi(t,ae.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)Yi(t,ae.create(r,a+1,a+1+s.content.size));else if(Z.isSelectable(s))Yi(t,Z.create(r,a));else continue;return!0}}function fh(t){return wl(t)}const h0=Vt?"metaKey":"ctrlKey";mt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=fh(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&U_(n,t.input.lastClick)&&!n[h0]&&t.input.lastClick.button==n.button&&(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,button:n.button};let s=t.posAtCoords(Fu(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Q_(t,s,n,!!r)):(o=="doubleClick"?Y_:X_)(t,s.pos,s.inside,n)?n.preventDefault():dr(t,"pointer"))};class Q_{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[h0],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 Z&&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)),dr(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(()=>zn(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(Fu(e))),this.updateAllowDefault(e),this.allowDefault||!n?dr(this.view,"pointer"):J_(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ft&&this.mightDrag&&!this.mightDrag.node.isAtom||it&&!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)?(Yi(this.view,ue.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):dr(this.view,"pointer")}move(e){this.updateAllowDefault(e),dr(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)}}mt.touchstart=t=>{t.input.lastTouch=Date.now(),fh(t),dr(t,"pointer")};mt.touchmove=t=>{t.input.lastTouch=Date.now(),dr(t,"pointer")};mt.contextmenu=t=>fh(t);function f0(t,e){return t.composing?!0:ft&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const eD=Bn?5e3:-1;gt.compositionstart=gt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ae&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),wl(t,!0),t.markCursor=null;else if(wl(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}m0(t,eD)};gt.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++,m0(t,20))};function m0(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>wl(t),e))}function g0(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=nD());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function tD(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=KM(e.focusNode,e.focusOffset),r=GM(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 nD(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function wl(t,e=!1){if(!(Bn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),g0(t),e||t.docView&&t.docView.dirty){let n=uh(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function rD(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 ws=kt&&yr<15||ao&&QM<604;mt.copy=gt.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=ws?null:n.clipboardData,s=r.content(),{dom:a,text:l}=dh(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):rD(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function iD(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function oD(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?xs(t,r.value,null,i,e):xs(t,r.textContent,r.innerHTML,i,e)},50)}function xs(t,e,n,r,i){let o=a0(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=iD(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 v0(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," "):""}gt.paste=(t,e)=>{let n=e;if(t.composing&&!Bn)return;let r=ws?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&xs(t,v0(r),r.getData("text/html"),i,n)?n.preventDefault():oD(t,n)};class y0{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const sD=Vt?"altKey":"ctrlKey";function b0(t,e){return t.someProp("dragCopies",r=>!r(e))??!e[sD]}mt.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(Fu(n)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof Z?i.to-1:i.to))){if(r&&r.mightDrag)s=Z.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=Z.create(t.state.doc,d.posBefore))}}let a=(s||t.state.selection).content(),{dom:l,text:u,slice:c}=dh(t,a);(!n.dataTransfer.files.length||!it||Wb>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ws?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ws||n.dataTransfer.setData("text/plain",u),t.dragging=new y0(c,b0(t,n),s)};mt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};gt.dragover=gt.dragenter=(t,e)=>e.preventDefault();gt.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(Fu(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=a0(t,v0(n.dataTransfer),ws?null:n.dataTransfer.getData("text/html"),!1,o);let a=!!(r&&b0(t,n));if(t.someProp("handleDrop",f=>f(t,n,s||V.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?Fb(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&&Z.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new Z(p));else{let f=u.mapping.map(l);u.mapping.maps[u.mapping.maps.length-1].forEach((m,g,b,y)=>f=y),u.setSelection(ch(t,p,u.doc.resolve(f)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))};mt.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())&&zn(t)},20))};mt.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)};mt.beforeinput=(t,e)=>{if(it&&Bn&&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,jr(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 gt)mt[t]=gt[t];function Es(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 xl{constructor(e,n){this.toDOM=e,this.spec=n||Zr,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 xl&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Es(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class kr{constructor(e,n){this.attrs=e,this.spec=n||Zr}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 kr&&Es(this.attrs,e.attrs)&&Es(this.spec,e.spec)}static is(e){return e.type instanceof kr}destroy(){}}class mh{constructor(e,n){this.attrs=e,this.spec=n||Zr}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 mh&&Es(this.attrs,e.attrs)&&Es(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 xl(n,r))}static inline(e,n,r,i){return new Mt(e,n,new kr(r,i))}static node(e,n,r,i){return new Mt(e,n,new mh(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof kr}get widget(){return this.type instanceof xl}}const Fi=[],Zr={};class Fe{constructor(e,n){this.local=e.length?e:Fi,this.children=n.length?n:Fi}static create(e,n){return n.length?El(n,e,0,Zr):rt}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==rt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Zr)}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?aD(this.children,s||[],e,n,r,i,o):s?new Fe(s.sort(Qr),Fi):rt}add(e,n){return n.length?this==rt?Fe.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=w0(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,El(c,a,u+1,Zr)),o+=3}});let s=k0(o?x0(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new Fe(s.length?this.local.concat(s).sort(Qr):this.local,i||this.children)}remove(e){return e.length==0||this==rt?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!=rt?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 Fe(i,r):rt}forChild(e,n){if(this==rt)return this;if(n.isLeaf)return Fe.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 kr){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 Fe(i.sort(Qr),Fi);return r?new sr([a,r]):a}return r||rt}eq(e){if(this==e)return!0;if(!(e instanceof Fe)||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 gh(this.localsInner(e))}localsInner(e){if(this==rt)return Fi;if(e.inlineContent||!this.local.some(kr.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof kr||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Fe.empty=new Fe([],[]);Fe.removeOverlap=gh;const rt=Fe.empty;class sr{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Zr));return sr.from(r)}forChild(e,n){if(n.isLeaf)return Fe.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,n);o!=rt&&(o instanceof sr?r=r.concat(o.members):r.push(o))}return sr.from(r)}eq(e){if(!(e instanceof sr)||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?gh(r?n:n.sort(Qr)):Fi}static from(e){switch(e.length){case 0:return rt;case 1:return e[0];default:return new sr(e.every(n=>n instanceof Fe)?e:e.reduce((n,r)=>n.concat(r instanceof Fe?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function aD(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 b=0;b<a.length;b+=3){let y=a[b+1];if(y<0||h>y+c-d)continue;let k=a[b]+c-d;p>=k?a[b+1]=h<=k?-2:-1:h>=c&&g&&(a[b]+=g,a[b+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 b=a[u+2].mapInner(n,g,c+1,t[u]+o+1,s);b!=rt?(a[u]=d,a[u+1]=p,a[u+2]=b):(a[u+1]=-2,l=!0)}else l=!0}if(l){let u=lD(a,t,e,n,i,o,s),c=El(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 Fe(e.sort(Qr),a)}function k0(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 lD(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 w0(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 x0(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function El(t,e,n,r){let i=[],o=!1;e.forEach((a,l)=>{let u=w0(t,a,l+n);if(u){o=!0;let c=El(u,a,n+l+1,r);c!=rt&&i.push(l,l+a.nodeSize,c)}});let s=k0(o?x0(t):t,-n).sort(Qr);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 Fe(s,i):rt}function Qr(t,e){return t.from-e.from||t.to-e.to}function gh(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),Zm(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),Zm(e,i,r.copy(o.from,r.to)));break}}}return e}function Zm(t,e,n){for(;e<t.length&&Qr(n,t[e])>0;)e++;t.splice(e,0,n)}function Mc(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=rt&&e.push(r)}),t.cursorWrapper&&e.push(Fe.create(t.state.doc,[t.cursorWrapper.deco])),sr.from(e)}const uD={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},cD=kt&&yr<=11;class dD{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 pD{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new dD,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]);kt&&yr<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),cD&&(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,uD)),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(qm(this.view)){if(this.suppressingSelectionUpdates)return zn(this.view);if(kt&&yr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ui(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=so(o))n.add(o);for(let o=e.anchorNode;o;o=so(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)&&qm(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||mD(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&&Ru(r)&&(u=uh(e))&&u.eq(ue.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,zn(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),hD(e)),this.handleDOMChange(o,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||zn(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(kt&&yr<=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 Qm=new WeakMap,eg=!1;function hD(t){if(!Qm.has(t)&&(Qm.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=nn,eg)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."),eg=!0}}function tg(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return ui(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function fD(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return tg(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?tg(t,n):null}function mD(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 gD(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}],Ru(l)||u.push({node:l.focusNode,offset:l.focusOffset})),it&&t.input.lastKeyCode===8)for(let g=o;g>i;g--){let b=r.childNodes[g-1],y=b.pmViewDesc;if(b.nodeName=="BR"&&!y){o=g;break}if(!y||y.size)break}let d=t.state.doc,h=t.someProp("domParser")||vr.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:vD,context:p});if(u&&u[0].pos!=null){let g=u[0].pos,b=u[1]&&u[1].pos;b==null&&(b=g),f={anchor:g+s,head:b+s}}return{doc:m,sel:f,from:s,to:a}}function vD(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(ft&&/^(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||ft&&/^(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 yD=/^(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 bD(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let T=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,A=uh(t,T);if(A&&!t.state.selection.eq(A)){if(it&&Bn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",N=>N(t,jr(13,"Enter"))))return;let _=t.state.tr.setSelection(A);T=="pointer"?_.setMeta("pointer",!0):T=="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=gD(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=xD(d.content,u.doc.content,u.from,h,p);if(f&&t.input.domChangeCount++,(ao&&t.input.lastIOSEnter>Date.now()-225||Bn)&&i.some(T=>T.nodeType==1&&!yD.test(T.nodeName))&&(!f||f.endA>=f.endB)&&t.someProp("handleKeyDown",T=>T(t,jr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!f)if(r&&l instanceof ae&&!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 T=ng(t,t.state.doc,u.sel);if(T&&!T.eq(t.state.selection)){let A=t.state.tr.setSelection(T);o&&A.setMeta("composition",o),t.dispatch(A)}}return}t.state.selection.from<t.state.selection.to&&f.start==f.endB&&t.state.selection instanceof ae&&(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)),kt&&yr<=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),b=c.resolve(f.start),y=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=f.endA,k;if((ao&&t.input.lastIOSEnter>Date.now()-225&&(!y||i.some(T=>T.nodeName=="DIV"||T.nodeName=="P"))||!y&&m.pos<u.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&!/\S/.test(u.doc.textBetween(m.pos,g.pos,"",""))&&(k=ue.findFrom(u.doc.resolve(m.pos+1),1,!0))&&k.head>m.pos)&&t.someProp("handleKeyDown",T=>T(t,jr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>f.start&&wD(c,f.start,f.endA,m,g)&&t.someProp("handleKeyDown",T=>T(t,jr(8,"Backspace")))){Bn&&it&&t.domObserver.suppressSelectionUpdates();return}it&&f.endB==f.start&&(t.input.lastChromeDelete=Date.now()),Bn&&!y&&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(T){return T(t,jr(13,"Enter"))})},20));let v=f.start,w=f.endA,x,C,M;if(y){if(m.pos==g.pos)kt&&yr<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>zn(t),20)),x=t.state.tr.delete(v,w),C=c.resolve(f.start).marksAcross(c.resolve(f.endA));else if(f.endA==f.endB&&(M=kD(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,f.endA-b.start()))))x=t.state.tr,M.type=="add"?x.addMark(v,w,M.mark):x.removeMark(v,w,M.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let T=m.parent.textBetween(m.parentOffset,g.parentOffset);if(t.someProp("handleTextInput",A=>A(t,v,w,T)))return;x=t.state.tr.insertText(T,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 T=ng(t,x.doc,u.sel);T&&!(it&&t.composing&&T.empty&&(f.start!=f.endB||t.input.lastChromeDelete<Date.now()-100)&&(T.head==v||T.head==x.mapping.map(w)-1)||kt&&T.empty&&T.head==v)&&x.setSelection(T)}C&&x.ensureMarks(C),o&&x.setMeta("composition",o),t.dispatch(x.scrollIntoView())}function ng(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:ch(t,e.resolve(n.anchor),e.resolve(n.head))}function kD(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(D.from(u).eq(t))return{mark:a,type:s}}function wD(t,e,n,r,i){if(n-e<=i.pos-r.pos||_c(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(_c(o,!0,!0));return!s.parent.isTextblock||s.pos>n||_c(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function _c(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 xD(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&&rg(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&&rg(t.textBetween(o-1,o+1))&&(o+=l?1:-1),s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}function rg(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 ED{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 j_,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(lg),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=sg(this),og(this),this.nodeViews=ag(this),this.docView=Bm(this.state.doc,ig(this),Mc(this),this.dom,this),this.domObserver=new pD(this,(r,i,o,s)=>bD(this,r,i,o,s)),this.domObserver.start(),z_(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&&qd(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(lg),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&&(g0(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=ag(this);SD(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&qd(this),this.editable=sg(this),og(this);let l=Mc(this),u=ig(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&&n_(this);if(s){this.domObserver.stop();let p=d&&(kt||it)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&CD(i.selection,e.selection);if(d){let f=it?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=tD(this)),(o||!this.docView.update(e.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=Bm(e.doc,u,l,this.dom,this)),f&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&T_(this))?zn(this,p):(i0(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&&r_(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 Z){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Im(this,n.getBoundingClientRect(),e)}else Im(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 y0(e.slice,e.move,i<0?void 0:Z.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(kt){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&&i_(this.dom),zn(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 u_(this,e)}coordsAtPos(e,n=1){return Yb(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 f_(this,n||this.state,e)}pasteHTML(e,n){return xs(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return xs(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return dh(this,e)}destroy(){this.docView&&(H_(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Mc(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,WM())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return W_(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?ft&&this.root.nodeType===11&&YM(this.dom.ownerDocument)==this.dom&&fD(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function ig(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 og(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 sg(t){return!t.someProp("editable",e=>e(t.state)===!1)}function CD(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 ag(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 SD(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 lg(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 Sr={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:"'"},Cl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},TD=typeof navigator<"u"&&/Mac/.test(navigator.platform),OD=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ze=0;Ze<10;Ze++)Sr[48+Ze]=Sr[96+Ze]=String(Ze);for(var Ze=1;Ze<=24;Ze++)Sr[Ze+111]="F"+Ze;for(var Ze=65;Ze<=90;Ze++)Sr[Ze]=String.fromCharCode(Ze+32),Cl[Ze]=String.fromCharCode(Ze);for(var Dc in Sr)Cl.hasOwnProperty(Dc)||(Cl[Dc]=Sr[Dc]);function AD(t){var e=TD&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||OD&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Cl:Sr)[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 MD=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),_D=typeof navigator<"u"&&/Win/.test(navigator.platform);function DD(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))MD?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 ID(t){let e=Object.create(null);for(let n in t)e[DD(n)]=t[n];return e}function Ic(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 ND(t){return new $e({props:{handleKeyDown:E0(t)}})}function E0(t){let e=ID(t);return function(n,r){let i=AD(r),o,s=e[Ic(i,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[Ic(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(_D&&r.ctrlKey&&r.altKey)&&(o=Sr[r.keyCode])&&o!=i){let a=e[Ic(o,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}const RD=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function C0(t,e){let{$cursor:n}=t.selection;return!n||n.parentOffset>0?null:n}const PD=(t,e,n)=>{let r=C0(t);if(!r)return!1;let i=vh(r);if(!i){let s=r.blockRange(),a=s&&go(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(A0(t,i,e,-1))return!0;if(r.parent.content.size==0&&(lo(o,"end")||Z.isSelectable(o)))for(let s=r.depth;;s--){let a=Iu(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(lo(o,"end")?ue.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):Z.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},FD=(t,e,n)=>{let r=C0(t);if(!r)return!1;let i=vh(r);return i?S0(t,i,e):!1},LD=(t,e,n)=>{let r=T0(t);if(!r)return!1;let i=yh(r);return i?S0(t,i,e):!1};function S0(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=Iu(t.doc,o,l,V.empty);if(!u||u.from!=o||u instanceof ze&&u.slice.size>=l-o)return!1;if(n){let c=t.tr.step(u);c.setSelection(ae.create(c.doc,o)),n(c.scrollIntoView())}return!0}function lo(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 BD=(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=vh(r)}let s=o&&o.nodeBefore;return!s||!Z.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Z.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function vh(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 T0(t,e){let{$cursor:n}=t.selection;return!n||n.parentOffset<n.parent.content.size?null:n}const VD=(t,e,n)=>{let r=T0(t);if(!r)return!1;let i=yh(r);if(!i)return!1;let o=i.nodeAfter;if(A0(t,i,e,1))return!0;if(r.parent.content.size==0&&(lo(o,"start")||Z.isSelectable(o))){let s=Iu(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(lo(o,"start")?ue.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):Z.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},$D=(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=yh(r)}let s=o&&o.nodeAfter;return!s||!Z.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Z.create(t.doc,o.pos)).scrollIntoView()),!0)};function yh(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 jD=(t,e)=>{let n=t.selection,r=n instanceof Z,i;if(r){if(n.node.isTextblock||!Tr(t.doc,n.from))return!1;i=n.from}else if(i=Du(t.doc,n.from,-1),i==null)return!1;if(e){let o=t.tr.join(i);r&&o.setSelection(Z.create(o.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},zD=(t,e)=>{let n=t.selection,r;if(n instanceof Z){if(n.node.isTextblock||!Tr(t.doc,n.to))return!1;r=n.to}else if(r=Du(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},HD=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&go(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},qD=(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 O0(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 WD=(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=O0(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(ue.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},UD=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof zt||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=O0(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(ae.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},KD=(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(Gi(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&go(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},GD=(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(Z.create(t.doc,i))),!0)};function JD(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||Tr(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function A0(t,e,n,r){let i=e.nodeBefore,o=e.nodeAfter,s,a,l=i.type.spec.isolating||o.type.spec.isolating;if(!l&&JD(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=D.empty;for(let b=s.length-1;b>=0;b--)f=D.from(s[b].create(null,f));f=D.from(i.copy(f));let m=t.tr.step(new We(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&&Tr(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let c=o.type.spec.isolating||r>0&&l?null:ue.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),h=d&&go(d);if(h!=null&&h>=e.depth)return n&&n(t.tr.lift(d,h).scrollIntoView()),!0;if(u&&lo(o,"start",!0)&&lo(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 b=D.empty;for(let k=f.length-1;k>=0;k--)b=D.from(f[k].copy(b));let y=t.tr.step(new We(e.pos-f.length,e.pos+o.nodeSize,e.pos+g,e.pos+o.nodeSize-g,new V(b,f.length,0),0,!0));n(y.scrollIntoView())}return!0}}return!1}function M0(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(ae.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}const YD=M0(-1),XD=M0(1);function ZD(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&sh(s,t,e);return a?(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function ug(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 QD(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 eI(a,s,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function eI(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 vl(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new vl(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=sh(o,n,r,e);return a?(t&&tI(t,e,a,i,n),!0):!1}function tI(t,e,n,r,i){let o=D.empty;for(let c=n.length-1;c>=0;c--)o=D.from(n[c].type.create(n[c].attrs,o));t.step(new We(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&&Gi(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=u.child(c).nodeSize;return t}function nI(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?rI(e,n,t,o):iI(e,n,o):!0:!1}}function rI(t,e,n,r){let i=t.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new We(o-1,s,o,s,new V(D.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new vl(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const a=go(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(o,-1)-1);return Tr(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function iI(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?D.empty:D.from(i))))return!1;let d=o.pos,h=d+s.nodeSize;return r.step(new We(d-(a?1:0),h+(l?1:0),d+1,h-1,new V((a?D.empty:D.from(i.copy(D.empty))).append(l?D.empty:D.from(i.copy(D.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function oI(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=D.from(u?t.create():null),d=new V(D.from(t.create(null,D.from(a.type.create(null,c)))),u?3:1,0),h=o.start,p=o.end;n(e.tr.step(new We(h-(u?3:1),p,h,p,d,1,!0)).scrollIntoView())}return!0}}function Lu(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 Bu{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:Lu({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 sI{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 W(t,e,n){return t.config[e]===void 0&&t.parent?W(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?W(t.parent,e,n):null}):t.config[e]}function Vu(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 _0(t){const e=[],{nodeExtensions:n,markExtensions:r}=Vu(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=W(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=W(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 Ke(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 tt(...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 Wd(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)=>tt(n,r),{})}function D0(t){return typeof t=="function"}function pe(t,e=void 0,...n){return D0(t)?e?t.bind(e)(...n):t(...n):t}function aI(t={}){return Object.keys(t).length===0&&t.constructor===Object}function lI(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function cg(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):lI(n.getAttribute(s.name));return a==null?o:{...o,[s.name]:a}},{});return{...r,...i}}}}function dg(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&aI(n)?!1:n!=null))}function uI(t,e){var n;const r=_0(t),{nodeExtensions:i,markExtensions:o}=Vu(t),s=(n=i.find(u=>W(u,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(u=>{const c=r.filter(b=>b.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},h=t.reduce((b,y)=>{const k=W(y,"extendNodeSchema",d);return{...b,...k?k(u):{}}},{}),p=dg({...h,content:pe(W(u,"content",d)),marks:pe(W(u,"marks",d)),group:pe(W(u,"group",d)),inline:pe(W(u,"inline",d)),atom:pe(W(u,"atom",d)),selectable:pe(W(u,"selectable",d)),draggable:pe(W(u,"draggable",d)),code:pe(W(u,"code",d)),whitespace:pe(W(u,"whitespace",d)),linebreakReplacement:pe(W(u,"linebreakReplacement",d)),defining:pe(W(u,"defining",d)),isolating:pe(W(u,"isolating",d)),attrs:Object.fromEntries(c.map(b=>{var y;return[b.name,{default:(y=b?.attribute)===null||y===void 0?void 0:y.default}]}))}),f=pe(W(u,"parseHTML",d));f&&(p.parseDOM=f.map(b=>cg(b,c)));const m=W(u,"renderHTML",d);m&&(p.toDOM=b=>m({node:b,HTMLAttributes:Wd(b,c)}));const g=W(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,b)=>{const y=W(b,"extendMarkSchema",d);return{...g,...y?y(u):{}}},{}),p=dg({...h,inclusive:pe(W(u,"inclusive",d)),excludes:pe(W(u,"excludes",d)),group:pe(W(u,"group",d)),spanning:pe(W(u,"spanning",d)),code:pe(W(u,"code",d)),attrs:Object.fromEntries(c.map(g=>{var b;return[g.name,{default:(b=g?.attribute)===null||b===void 0?void 0:b.default}]}))}),f=pe(W(u,"parseHTML",d));f&&(p.parseDOM=f.map(g=>cg(g,c)));const m=W(u,"renderHTML",d);return m&&(p.toDOM=g=>m({mark:g,HTMLAttributes:Wd(g,c)})),[u.name,p]}));return new Sb({topNode:s,nodes:a,marks:l})}function Nc(t,e){return e.nodes[t]||e.marks[t]||null}function pg(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function bh(t,e){const n=bi.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}const cI=(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 kh(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class $u{constructor(e){this.find=e.find,this.handler=e.handler}}const dI=(t,e)=>{if(kh(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 ba(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=cI(u)+o;return s.forEach(h=>{if(c)return;const p=dI(d,h.find);if(!p)return;const f=l.state.tr,m=Lu({state:l.state,transaction:f}),g={from:r-(p[0].length-o.length),to:i},{commands:b,chain:y,can:k}=new Bu({editor:n,state:m});h.handler({state:m,range:g,match:p,commands:b,chain:y,can:k})===null||!f.steps.length||(f.setMeta(a,{transform:f,from:r,to:i,text:o}),l.dispatch(f),c=!0)}),c}function pI(t){const{editor:e,rules:n}=t,r=new $e({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=bh(D.from(u),s.schema);const{from:c}=l,d=c+u.length;ba({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 ba({editor:e,from:o,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&ba({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?ba({editor:e,from:s.pos,to:s.pos,text:`
18
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function hI(t){return Object.prototype.toString.call(t).slice(8,-1)}function ka(t){return hI(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function ju(t,e){const n={...t};return ka(t)&&ka(e)&&Object.keys(e).forEach(r=>{ka(e[r])&&ka(t[r])?n[r]=ju(t[r],e[r]):n[r]=e[r]}),n}class Wn{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(W(this,"addOptions",{name:this.name}))),this.storage=pe(W(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Wn(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>ju(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Wn(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(W(n,"addOptions",{name:n.name})),n.storage=pe(W(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 fI(t){return typeof t=="number"}class mI{constructor(e){this.find=e.find,this.handler=e.handler}}const gI=(t,e,n)=>{if(kh(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 vI(t){const{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:u,can:c}=new Bu({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,"");gI(g,o.find,s).forEach(b=>{if(b.index===void 0)return;const y=f+b.index+1,k=y+b[0].length,v={from:n.tr.mapping.map(y),to:n.tr.mapping.map(k)},w=o.handler({state:n,range:v,match:b,commands:l,chain:u,can:c,pasteEvent:s,dropEvent:a});d.push(w)})}),d.every(h=>h!==null)}let wa=null;const yI=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 bI(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=Lu({state:u,transaction:f});if(!(!vI({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 $e({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&&(wa=e)},h=()=>{wa&&(wa=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=wa;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"),b=!!g;if(!f&&!m&&!b)return;if(b){let{text:v}=g;typeof v=="string"?v=v:v=bh(D.from(v),h.schema);const{from:w}=g,x=w+v.length,C=yI(v);return l({rule:u,state:h,from:w,to:{b:x},pasteEvt:C})}const y=d.doc.content.findDiffStart(h.doc.content),k=d.doc.content.findDiffEnd(h.doc.content);if(!(!fI(y)||!k||y===k.b))return l({rule:u,state:h,from:y,to:k,pasteEvt:s})}}))}function kI(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class Wi{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=Wi.resolve(e),this.schema=uI(this.extensions,n),this.setupExtensions()}static resolve(e){const n=Wi.sort(Wi.flatten(e)),r=kI(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=W(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((n,r)=>{const i=W(n,"priority")||100,o=W(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:Nc(n.name,this.schema)},i=W(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=Wi.sort([...this.extensions].reverse()),r=[],i=[],o=n.map(s=>{const a={name:s.name,options:s.options,storage:s.storage,editor:e,type:Nc(s.name,this.schema)},l=[],u=W(s,"addKeyboardShortcuts",a);let c={};if(s.type==="mark"&&W(s,"exitable",a)&&(c.ArrowRight=()=>Wn.handleExit({editor:e,mark:s})),u){const m=Object.fromEntries(Object.entries(u()).map(([g,b])=>[g,()=>b({editor:e})]));c={...c,...m}}const d=ND(c);l.push(d);const h=W(s,"addInputRules",a);pg(s,e.options.enableInputRules)&&h&&r.push(...h());const p=W(s,"addPasteRules",a);pg(s,e.options.enablePasteRules)&&p&&i.push(...p());const f=W(s,"addProseMirrorPlugins",a);if(f){const m=f();l.push(...m)}return l}).flat();return[pI({editor:e,rules:r}),...bI({editor:e,rules:i}),...o]}get attributes(){return _0(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=Vu(this.extensions);return Object.fromEntries(n.filter(r=>!!W(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:Ke(r.name,this.schema)},s=W(r,"addNodeView",o);if(!s)return[];const a=(l,u,c,d,h)=>{const p=Wd(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:Nc(e.name,this.schema)};e.type==="mark"&&(!((n=pe(W(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=W(e,"onBeforeCreate",r),o=W(e,"onCreate",r),s=W(e,"onUpdate",r),a=W(e,"onSelectionUpdate",r),l=W(e,"onTransaction",r),u=W(e,"onFocus",r),c=W(e,"onBlur",r),d=W(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 Ge{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(W(this,"addOptions",{name:this.name}))),this.storage=pe(W(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ge(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>ju(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Ge({...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(W(n,"addOptions",{name:n.name})),n.storage=pe(W(n,"addStorage",{name:n.name,options:n.options})),n}}function I0(t,e,n){const{from:r,to:i}=e,{blockSeparator:o=`
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 wh(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const wI=Ge.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new $e({key:new ut("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=wh(n);return I0(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),xI=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),EI=(t=!1)=>({commands:e})=>e.setContent("",t),CI=()=>({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=go(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},SI=t=>e=>t(e),TI=()=>({state:t,dispatch:e})=>UD(t,e),OI=(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 ae(r.doc.resolve(s-1))),!0},AI=()=>({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},MI=t=>({tr:e,state:n,dispatch:r})=>{const i=Ke(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},_I=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},DI=()=>({state:t,dispatch:e})=>RD(t,e),II=()=>({commands:t})=>t.keyboardShortcut("Enter"),NI=()=>({state:t,dispatch:e})=>WD(t,e);function Sl(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:kh(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function N0(t,e,n={}){return t.find(r=>r.type===e&&Sl(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function hg(t,e,n={}){return!!N0(t,e,n)}function xh(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),!N0([...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&&hg([...t.parent.child(o-1).marks],e,n);)o-=1,s-=t.parent.child(o).nodeSize;for(;a<t.parent.childCount&&hg([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}function Ar(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 RI=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const o=Ar(t,r.schema),{doc:s,selection:a}=n,{$from:l,from:u,to:c}=a;if(i){const d=xh(l,o,e);if(d&&d.from<=u&&d.to>=c){const h=ae.create(s,d.from,d.to);n.setSelection(h)}}return!0},PI=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 Eh(t){return t instanceof ae}function Vn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function R0(t,e=null){if(!e)return null;const n=ue.atStart(t),r=ue.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,o=r.to;return e==="all"?ae.create(t,Vn(0,i,o),Vn(t.content.size,i,o)):ae.create(t,Vn(e,i,o),Vn(e,i,o))}function FI(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Ch(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const LI=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{(Ch()||FI())&&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&&!Eh(n.state.selection))return s(),!0;const a=R0(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},BI=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),VI=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),P0=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&&P0(r)}return t};function xa(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return P0(n)}function Tl(t,e,n){if(t instanceof gr||t instanceof D)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 D.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),Tl("",e,n)}if(i){if(n.errorOnInvalidContent){let s=!1,a="";const l=new Sb({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?vr.fromSchema(l).parseSlice(xa(t),n.parseOptions):vr.fromSchema(l).parse(xa(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const o=vr.fromSchema(e);return n.slice?o.parseSlice(xa(t),n.parseOptions).content:o.parse(xa(t),n.parseOptions)}return Tl("",e,n)}function $I(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof ze||i instanceof We))return;const o=t.mapping.maps[r];let s=0;o.forEach((a,l,u,c)=>{s===0&&(s=c)}),t.setSelection(ue.near(t.doc.resolve(s),n))}const jI=t=>!("type"in t),zI=(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=Tl(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((jI(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 D){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&&$I(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},HI=()=>({state:t,dispatch:e})=>jD(t,e),qI=()=>({state:t,dispatch:e})=>zD(t,e),WI=()=>({state:t,dispatch:e})=>PD(t,e),UI=()=>({state:t,dispatch:e})=>VD(t,e),KI=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Du(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},GI=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Du(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},JI=()=>({state:t,dispatch:e})=>FD(t,e),YI=()=>({state:t,dispatch:e})=>LD(t,e);function F0(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function XI(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))Ch()||F0()?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 ZI=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const o=XI(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 Cs(t,e,n={}){const{from:r,to:i,empty:o}=t.selection,s=e?Ke(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=>Sl(c.node.attrs,n,{strict:!1}));return o?!!u.length:u.reduce((c,d)=>c+d.to-d.from,0)>=l}const QI=(t,e={})=>({state:n,dispatch:r})=>{const i=Ke(t,n.schema);return Cs(n,i,e)?HD(n,r):!1},eN=()=>({state:t,dispatch:e})=>KD(t,e),tN=t=>({state:e,dispatch:n})=>{const r=Ke(t,e.schema);return nI(r)(e,n)},nN=()=>({state:t,dispatch:e})=>qD(t,e);function zu(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function fg(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 rN=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const a=zu(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=Ke(t,r.schema)),a==="mark"&&(s=Ar(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,fg(u.attrs,e)),s&&u.marks.length&&u.marks.forEach(d=>{s===d.type&&n.addMark(c,c+u.nodeSize,s.create(fg(d.attrs,e)))})})}),!0):!1},iN=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),oN=()=>({tr:t,dispatch:e})=>{if(e){const n=new zt(t.doc);t.setSelection(n)}return!0},sN=()=>({state:t,dispatch:e})=>BD(t,e),aN=()=>({state:t,dispatch:e})=>$D(t,e),lN=()=>({state:t,dispatch:e})=>GD(t,e),uN=()=>({state:t,dispatch:e})=>XD(t,e),cN=()=>({state:t,dispatch:e})=>YD(t,e);function Ud(t,e,n={},r={}){return Tl(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const dN=(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=Ud(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 L0(t,e){const n=Ar(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 pN(t,e){const n=new jb(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function hN(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 fN(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,o)=>{n(i)&&r.push({node:i,pos:o})}),r}function mN(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 Sh(t){return e=>mN(e.$from,t)}function B0(t,e){const n={from:0,to:t.content.size};return I0(t,n,e)}function gN(t,e){const n=Ke(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 V0(t,e){const n=zu(typeof e=="string"?e:e.name,t.schema);return n==="node"?gN(t,e):n==="mark"?L0(t,e):{}}function vN(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 yN(t){const e=vN(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 bN(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}})})}),yN(r)}function Th(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const o=n.resolve(t),s=xh(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 za(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 Kd(t,e,n={}){const{empty:r,ranges:i}=t.selection,o=e?Ar(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(c=>o?o.name===c.type.name:!0).find(c=>Sl(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),b=Math.min(p,m+f.nodeSize),y=b-g;s+=y,a.push(...f.marks.map(k=>({mark:k,from:g,to:b})))})}),s===0)return!1;const l=a.filter(c=>o?o.name===c.mark.type.name:!0).filter(c=>Sl(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 kN(t,e,n={}){if(!e)return Cs(t,null,n)||Kd(t,null,n);const r=zu(e,t.schema);return r==="node"?Cs(t,e,n):r==="mark"?Kd(t,e,n):!1}function mg(t,e){const{nodeExtensions:n}=Vu(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(W(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function Hu(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&&(Hu(o,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function $0(t){return t instanceof Z}function j0(t,e,n){const r=t.state.doc.content.size,i=Vn(e,0,r),o=Vn(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 wN(t,e,n){var r;const{selection:i}=e;let o=null;if(Eh(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 xN=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=n,{empty:s,ranges:a}=o,l=Ar(t,r.schema);if(i)if(s){const u=L0(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 wN(r,n,l)},EN=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),CN=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const o=Ke(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})=>ug(o,{...s,...e})(n)?!0:a.clearNodes()).command(({state:a})=>ug(o,{...s,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},SN=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Vn(t,0,r.content.size),o=Z.create(r,i);e.setSelection(o)}return!0},TN=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,s=ae.atStart(r).from,a=ae.atEnd(r).to,l=Vn(i,s,a),u=Vn(o,s,a),c=ae.create(r,l,u);e.setSelection(c)}return!0},ON=t=>({state:e,dispatch:n})=>{const r=Ke(t,e.schema);return oI(r)(e,n)};function gg(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 AN=({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=za(u,a.node().type.name,a.node().attrs);if(o instanceof Z&&o.node.isBlock)return!a.parentOffset||!Gi(s,a.pos)?!1:(r&&(t&&gg(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:hN(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=d&&h?[{type:h,attrs:c}]:void 0,f=Gi(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!f&&Gi(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 ae&&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&&gg(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return f},MN=(t,e={})=>({tr:n,state:r,dispatch:i,editor:o})=>{var s;const a=Ke(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 b=D.empty;const y=l.index(-1)?1:l.index(-2)?2:3;for(let M=l.depth-y;M>=l.depth-3;M-=1)b=D.from(l.node(M).copy(b));const k=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,v={...za(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;b=b.append(D.from(a.createAndFill(null,w)||void 0));const x=l.before(l.depth-(y-1));n.replace(x,l.after(-k),new V(b,4-y,0));let C=-1;n.doc.nodesBetween(x,n.doc.content.size,(M,T)=>{if(C>-1)return!1;M.isTextblock&&M.content.size===0&&(C=T+1)}),C>-1&&n.setSelection(ae.near(n.doc.resolve(C))),n.scrollIntoView()}return!0}const p=u.pos===l.end()?d.contentMatchAt(0).defaultType:null,f={...za(h,d.type.name,d.attrs),...e},m={...za(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(!Gi(n.doc,l.pos,2))return!1;if(i){const{selection:b,storedMarks:y}=r,{splittableMarks:k}=o.extensionManager,v=y||b.$to.parentOffset&&b.$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},Rc=(t,e)=>{const n=Sh(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&&Tr(t.doc,n.pos)&&t.join(n.pos),!0},Pc=(t,e)=>{const n=Sh(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&&Tr(t.doc,r)&&t.join(r),!0},_N=(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=Ke(t,s.schema),f=Ke(e,s.schema),{selection:m,storedMarks:g}=s,{$from:b,$to:y}=m,k=b.blockRange(y),v=g||m.$to.parentOffset&&m.$from.marks();if(!k)return!1;const w=Sh(x=>mg(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(mg(w.node.type.name,d)&&p.validContent(w.node.content)&&a)return l().command(()=>(o.setNodeMarkup(w.pos,p),!0)).command(()=>Rc(o,p)).command(()=>Pc(o,p)).run()}return!n||!v||!a?l().command(()=>c().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>Rc(o,p)).command(()=>Pc(o,p)).run():l().command(()=>{const x=c().wrapInList(p,r),C=v.filter(M=>h.includes(M.type.name));return o.ensureMarks(C),x?!0:u.clearNodes()}).wrapInList(p,r).command(()=>Rc(o,p)).command(()=>Pc(o,p)).run()},DN=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,s=Ar(t,r.schema);return Kd(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},IN=(t,e,n={})=>({state:r,commands:i})=>{const o=Ke(t,r.schema),s=Ke(e,r.schema),a=Cs(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})},NN=(t,e={})=>({state:n,commands:r})=>{const i=Ke(t,n.schema);return Cs(n,i,e)?r.lift(i):r.wrapIn(i,e)},RN=()=>({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},PN=()=>({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},FN=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=Ar(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=xh(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},LN=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const a=zu(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=Ke(t,r.schema)),a==="mark"&&(s=Ar(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(b=>{if(s===b.type){const y=Math.max(g,u),k=Math.min(g+m.nodeSize,c);n.addMark(y,k,s.create({...b.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},BN=(t,e={})=>({state:n,dispatch:r})=>{const i=Ke(t,n.schema);return ZD(i,e)(n,r)},VN=(t,e={})=>({state:n,dispatch:r})=>{const i=Ke(t,n.schema);return QD(i,e)(n,r)};var $N=Object.freeze({__proto__:null,blur:xI,clearContent:EI,clearNodes:CI,command:SI,createParagraphNear:TI,cut:OI,deleteCurrentNode:AI,deleteNode:MI,deleteRange:_I,deleteSelection:DI,enter:II,exitCode:NI,extendMarkRange:RI,first:PI,focus:LI,forEach:BI,insertContent:VI,insertContentAt:zI,joinBackward:WI,joinDown:qI,joinForward:UI,joinItemBackward:KI,joinItemForward:GI,joinTextblockBackward:JI,joinTextblockForward:YI,joinUp:HI,keyboardShortcut:ZI,lift:QI,liftEmptyBlock:eN,liftListItem:tN,newlineInCode:nN,resetAttributes:rN,scrollIntoView:iN,selectAll:oN,selectNodeBackward:sN,selectNodeForward:aN,selectParentNode:lN,selectTextblockEnd:uN,selectTextblockStart:cN,setContent:dN,setMark:xN,setMeta:EN,setNode:CN,setNodeSelection:SN,setTextSelection:TN,sinkListItem:ON,splitBlock:AN,splitListItem:MN,toggleList:_N,toggleMark:DN,toggleNode:IN,toggleWrap:NN,undoInputRule:RN,unsetAllMarks:PN,unsetMark:FN,updateAttributes:LN,wrapIn:BN,wrapInList:VN});const jN=Ge.create({name:"commands",addCommands(){return{...$N}}}),zN=Ge.create({name:"drop",addProseMirrorPlugins(){return[new $e({key:new ut("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),HN=Ge.create({name:"editable",addProseMirrorPlugins(){return[new $e({key:new ut("editable"),props:{editable:()=>this.editor.options.editable}})]}}),qN=new ut("focusEvents"),WN=Ge.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new $e({key:qN,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}}}})]}}),UN=Ge.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:ue.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 Ch()||F0()?i:r},addProseMirrorPlugins(){return[new $e({key:new ut("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=ue.atStart(e.doc).from,u=ue.atEnd(e.doc).to;if(o||!(s===l&&a===u)||!Hu(n.doc))return;const c=n.tr,d=Lu({state:n,transaction:c}),{commands:h}=new Bu({editor:this.editor,state:d});if(h.clearNodes(),!!c.steps.length)return c}})]}}),KN=Ge.create({name:"paste",addProseMirrorPlugins(){return[new $e({key:new ut("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),GN=Ge.create({name:"tabindex",addProseMirrorPlugins(){return[new $e({key:new ut("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class zr{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 zr(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 zr(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 zr(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 zr(a,this.editor,i,i?n:null);i&&(l.actualDepth=this.depth+1),e.push(new zr(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 JN=`.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 FN(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 LN=class extends UD{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=FN(PN,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=S0(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=n.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?[MN,aI.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)===null||t===void 0?void 0:t.clipboardTextSerializer)===null||e===void 0?void 0:e.blockSeparator}),ON,DN,IN,RN,AN,NN].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 qi(n,this)}createCommandManager(){this.commandManager=new Fu({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var t;let e;try{e=zd(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=zd(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const n=A0(e,this.options.autofocus);this.view=new uD(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:Hi.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 N0(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return sN(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return mh(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
94
+ }`;function YN(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 XN=class extends sI{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=YN(JN,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=D0(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=n.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?[HN,wI.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)===null||t===void 0?void 0:t.clipboardTextSerializer)===null||e===void 0?void 0:e.blockSeparator}),jN,WN,UN,GN,zN,KN].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 Wi(n,this)}createCommandManager(){this.commandManager=new Bu({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var t;let e;try{e=Ud(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=Ud(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const n=R0(e,this.options.autofocus);this.view=new ED(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:qi.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 V0(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return kN(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return bh(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
95
95
 
96
- `,textSerializers:n={}}=t||{};return I0(this.state.doc,{blockSeparator:e,textSerializers:{...vh(this.schema),...n}})}get isEmpty(){return ju(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 zr(e,this)}get $doc(){return this.$pos(0)}};function lo(t){return new Bu({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(xh(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 BN(t){return new Bu({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 qd(t){return new Bu({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 Cs(t){return new Bu({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&&nh(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&&Tr(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&s.join(n.from-1)}})}let on=class Wd{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(W(this,"addOptions",{name:this.name}))),this.storage=pe(W(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Wd(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Vu(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Wd(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(W(n,"addOptions",{name:n.name})),n.storage=pe(W(n,"addStorage",{name:n.name,options:n.options})),n}};function ci(t){return new tI({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(xh(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",Ht="bottom",qt="right",wt="left",Eh="auto",$s=[kt,Ht,qt,wt],uo="start",Ss="end",VN="clippingParents",F0="viewport",Oo="popper",$N="reference",pg=$s.reduce(function(t,e){return t.concat([e+"-"+uo,e+"-"+Ss])},[]),L0=[].concat($s,[Eh]).reduce(function(t,e){return t.concat([e,e+"-"+uo,e+"-"+Ss])},[]),jN="beforeRead",zN="read",HN="afterRead",qN="beforeMain",WN="main",UN="afterMain",KN="beforeWrite",GN="write",JN="afterWrite",YN=[jN,zN,HN,qN,WN,UN,KN,GN,JN];function Sn(t){return t?(t.nodeName||"").toLowerCase():null}function Dt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function di(t){var e=Dt(t).Element;return t instanceof e||t instanceof Element}function zt(t){var e=Dt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Ch(t){if(typeof ShadowRoot>"u")return!1;var e=Dt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function XN(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];!zt(o)||!Sn(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 ZN(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},{});!zt(i)||!Sn(i)||(Object.assign(i.style,a),Object.keys(o).forEach(function(l){i.removeAttribute(l)}))})}}const B0={name:"applyStyles",enabled:!0,phase:"write",fn:XN,effect:ZN,requires:["computeStyles"]};function bn(t){return t.split("-")[0]}var Qr=Math.max,Sl=Math.min,co=Math.round;function Ud(){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 V0(){return!/^((?!chrome|android).)*safari/i.test(Ud())}function po(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,o=1;e&&zt(t)&&(i=t.offsetWidth>0&&co(r.width)/t.offsetWidth||1,o=t.offsetHeight>0&&co(r.height)/t.offsetHeight||1);var s=di(t)?Dt(t):window,a=s.visualViewport,l=!V0()&&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 Sh(t){var e=po(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 $0(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 Un(t){return Dt(t).getComputedStyle(t)}function QN(t){return["table","td","th"].indexOf(Sn(t))>=0}function Mr(t){return((di(t)?t.ownerDocument:t.document)||window.document).documentElement}function zu(t){return Sn(t)==="html"?t:t.assignedSlot||t.parentNode||(Ch(t)?t.host:null)||Mr(t)}function hg(t){return!zt(t)||Un(t).position==="fixed"?null:t.offsetParent}function eR(t){var e=/firefox/i.test(Ud()),n=/Trident/i.test(Ud());if(n&&zt(t)){var r=Un(t);if(r.position==="fixed")return null}var i=zu(t);for(Ch(i)&&(i=i.host);zt(i)&&["html","body"].indexOf(Sn(i))<0;){var o=Un(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 js(t){for(var e=Dt(t),n=hg(t);n&&QN(n)&&Un(n).position==="static";)n=hg(n);return n&&(Sn(n)==="html"||Sn(n)==="body"&&Un(n).position==="static")?e:n||eR(t)||e}function Th(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Zo(t,e,n){return Qr(t,Sl(e,n))}function tR(t,e,n){var r=Zo(t,e,n);return r>n?n:r}function j0(){return{top:0,right:0,bottom:0,left:0}}function z0(t){return Object.assign({},j0(),t)}function H0(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var nR=function(t,e){return t=typeof t=="function"?t(Object.assign({},e.rects,{placement:e.placement})):t,z0(typeof t!="number"?t:H0(t,$s))};function rR(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=Th(a),u=[wt,qt].indexOf(a)>=0,c=u?"height":"width";if(!(!o||!s)){var d=nR(i.padding,n),h=Sh(o),p=l==="y"?kt:wt,f=l==="y"?Ht:qt,m=n.rects.reference[c]+n.rects.reference[l]-s[l]-n.rects.popper[c],g=s[l]-n.rects.reference[l],b=js(o),y=b?l==="y"?b.clientHeight||0:b.clientWidth||0:0,k=m/2-g/2,v=d[p],w=y-h[c]-d[f],x=y/2-h[c]/2+k,C=Zo(v,x,w),M=l;n.modifiersData[r]=(e={},e[M]=C,e.centerOffset=C-x,e)}}function iR(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)||$0(e.elements.popper,i)&&(e.elements.arrow=i))}const oR={name:"arrow",enabled:!0,phase:"main",fn:rR,effect:iR,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ho(t){return t.split("-")[1]}var sR={top:"auto",right:"auto",bottom:"auto",left:"auto"};function aR(t,e){var n=t.x,r=t.y,i=e.devicePixelRatio||1;return{x:co(n*i)/i||0,y:co(r*i)/i||0}}function fg(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 b=s.hasOwnProperty("x"),y=s.hasOwnProperty("y"),k=wt,v=kt,w=window;if(u){var x=js(n),C="clientHeight",M="clientWidth";if(x===Dt(n)&&(x=Mr(n),Un(x).position!=="static"&&a==="absolute"&&(C="scrollHeight",M="scrollWidth")),x=x,i===kt||(i===wt||i===qt)&&o===Ss){v=Ht;var T=d&&x===w&&w.visualViewport?w.visualViewport.height:x[C];m-=T-r.height,m*=l?1:-1}if(i===wt||(i===kt||i===Ht)&&o===Ss){k=qt;var A=d&&x===w&&w.visualViewport?w.visualViewport.width:x[M];p-=A-r.width,p*=l?1:-1}}var _=Object.assign({position:a},u&&sR),N=c===!0?aR({x:p,y:m},Dt(n)):{x:p,y:m};if(p=N.x,m=N.y,l){var $;return Object.assign({},_,($={},$[v]=y?"0":"",$[k]=b?"0":"",$.transform=(w.devicePixelRatio||1)<=1?"translate("+p+"px, "+m+"px)":"translate3d("+p+"px, "+m+"px, 0)",$))}return Object.assign({},_,(e={},e[v]=y?m+"px":"",e[k]=b?p+"px":"",e.transform="",e))}function lR(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:ho(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,fg(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,fg(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 uR={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:lR,data:{}};var ka={passive:!0};function cR(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=Dt(e.elements.popper),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&u.forEach(function(c){c.addEventListener("scroll",n.update,ka)}),a&&l.addEventListener("resize",n.update,ka),function(){o&&u.forEach(function(c){c.removeEventListener("scroll",n.update,ka)}),a&&l.removeEventListener("resize",n.update,ka)}}const dR={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:cR,data:{}};var pR={left:"right",right:"left",bottom:"top",top:"bottom"};function ja(t){return t.replace(/left|right|bottom|top/g,function(e){return pR[e]})}var hR={start:"end",end:"start"};function mg(t){return t.replace(/start|end/g,function(e){return hR[e]})}function Oh(t){var e=Dt(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Ah(t){return po(Mr(t)).left+Oh(t).scrollLeft}function fR(t,e){var n=Dt(t),r=Mr(t),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;var u=V0();(u||!u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a+Ah(t),y:l}}function mR(t){var e,n=Mr(t),r=Oh(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+Ah(t),l=-r.scrollTop;return Un(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=Un(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function q0(t){return["html","body","#document"].indexOf(Sn(t))>=0?t.ownerDocument.body:zt(t)&&Mh(t)?t:q0(zu(t))}function Qo(t,e){var n;e===void 0&&(e=[]);var r=q0(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),o=Dt(r),s=i?[o].concat(o.visualViewport||[],Mh(r)?r:[]):r,a=e.concat(s);return i?a:a.concat(Qo(zu(s)))}function Kd(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function gR(t,e){var n=po(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 gg(t,e,n){return e===F0?Kd(fR(t,n)):di(e)?gR(e,n):Kd(mR(Mr(t)))}function vR(t){var e=Qo(zu(t)),n=["absolute","fixed"].indexOf(Un(t).position)>=0,r=n&&zt(t)?js(t):t;return di(r)?e.filter(function(i){return di(i)&&$0(i,r)&&Sn(i)!=="body"}):[]}function yR(t,e,n,r){var i=e==="clippingParents"?vR(t):[].concat(e),o=[].concat(i,[n]),s=o[0],a=o.reduce(function(l,u){var c=gg(t,u,r);return l.top=Qr(c.top,l.top),l.right=Sl(c.right,l.right),l.bottom=Sl(c.bottom,l.bottom),l.left=Qr(c.left,l.left),l},gg(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 W0(t){var e=t.reference,n=t.element,r=t.placement,i=r?bn(r):null,o=r?ho(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 Ht:l={x:s,y:e.y+e.height};break;case qt: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?Th(i):null;if(u!=null){var c=u==="y"?"height":"width";switch(o){case uo:l[u]=l[u]-(e[c]/2-n[c]/2);break;case Ss:l[u]=l[u]+(e[c]/2-n[c]/2);break}}return l}function Ts(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?VN:a,u=n.rootBoundary,c=u===void 0?F0:u,d=n.elementContext,h=d===void 0?Oo:d,p=n.altBoundary,f=p===void 0?!1:p,m=n.padding,g=m===void 0?0:m,b=z0(typeof g!="number"?g:H0(g,$s)),y=h===Oo?$N:Oo,k=t.rects.popper,v=t.elements[f?y:h],w=yR(di(v)?v:v.contextElement||Mr(t.elements.popper),l,c,s),x=po(t.elements.reference),C=W0({reference:x,element:k,placement:i}),M=Kd(Object.assign({},k,C)),T=h===Oo?M:x,A={top:w.top-T.top+b.top,bottom:T.bottom-w.bottom+b.bottom,left:w.left-T.left+b.left,right:T.right-w.right+b.right},_=t.modifiersData.offset;if(h===Oo&&_){var N=_[i];Object.keys(A).forEach(function($){var j=[qt,Ht].indexOf($)>=0?1:-1,q=[kt,Ht].indexOf($)>=0?"y":"x";A[$]+=N[q]*j})}return A}function bR(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?L0:l,c=ho(r),d=c?a?pg:pg.filter(function(f){return ho(f)===c}):$s,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]=Ts(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 kR(t){if(bn(t)===Eh)return[];var e=ja(t);return[mg(t),e,mg(e)]}function wR(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,b=bn(g),y=b===g,k=l||(y||!f?[ja(g)]:kR(g)),v=[g].concat(k).reduce(function(an,It){return an.concat(bn(It)===Eh?bR(e,{placement:It,boundary:c,rootBoundary:d,padding:u,flipVariations:f,allowedAutoPlacements:m}):It)},[]),w=e.rects.reference,x=e.rects.popper,C=new Map,M=!0,T=v[0],A=0;A<v.length;A++){var _=v[A],N=bn(_),$=ho(_)===uo,j=[kt,Ht].indexOf(N)>=0,q=j?"width":"height",K=Ts(e,{placement:_,boundary:c,rootBoundary:d,altBoundary:h,padding:u}),X=j?$?qt:wt:$?Ht:kt;w[q]>x[q]&&(X=ja(X));var fe=ja(X),Ee=[];if(o&&Ee.push(K[N]<=0),a&&Ee.push(K[X]<=0,K[fe]<=0),Ee.every(function(an){return an})){T=_,M=!1;break}C.set(_,Ee)}if(M)for(var Ie=f?3:1,An=function(an){var It=v.find(function(Jn){var Dr=C.get(Jn);if(Dr)return Dr.slice(0,an).every(function(Yn){return Yn})});if(It)return T=It,"break"},sn=Ie;sn>0;sn--){var _r=An(sn);if(_r==="break")break}e.placement!==T&&(e.modifiersData[r]._skip=!0,e.placement=T,e.reset=!0)}}const xR={name:"flip",enabled:!0,phase:"main",fn:wR,requiresIfExists:["offset"],data:{_skip:!1}};function vg(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 yg(t){return[kt,qt,Ht,wt].some(function(e){return t[e]>=0})}function ER(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,s=Ts(e,{elementContext:"reference"}),a=Ts(e,{altBoundary:!0}),l=vg(s,r),u=vg(a,i,o),c=yg(l),d=yg(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 CR={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:ER};function SR(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,qt].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}function TR(t){var e=t.state,n=t.options,r=t.name,i=n.offset,o=i===void 0?[0,0]:i,s=L0.reduce(function(c,d){return c[d]=SR(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 OR={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:TR};function AR(t){var e=t.state,n=t.name;e.modifiersData[n]=W0({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const MR={name:"popperOffsets",enabled:!0,phase:"read",fn:AR,data:{}};function _R(t){return t==="x"?"y":"x"}function DR(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=Ts(e,{boundary:l,rootBoundary:u,padding:d,altBoundary:c}),b=bn(e.placement),y=ho(e.placement),k=!y,v=Th(b),w=_R(v),x=e.modifiersData.popperOffsets,C=e.rects.reference,M=e.rects.popper,T=typeof m=="function"?m(Object.assign({},e.rects,{placement:e.placement})):m,A=typeof T=="number"?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),_=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,N={x:0,y:0};if(x){if(o){var $,j=v==="y"?kt:wt,q=v==="y"?Ht:qt,K=v==="y"?"height":"width",X=x[v],fe=X+g[j],Ee=X-g[q],Ie=p?-M[K]/2:0,An=y===uo?C[K]:M[K],sn=y===uo?-M[K]:-C[K],_r=e.elements.arrow,an=p&&_r?Sh(_r):{width:0,height:0},It=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:j0(),Jn=It[j],Dr=It[q],Yn=Zo(0,C[K],an[K]),zs=k?C[K]/2-Ie-Yn-Jn-A.mainAxis:An-Yn-Jn-A.mainAxis,Xn=k?-C[K]/2+Ie+Yn+Dr+A.mainAxis:sn+Yn+Dr+A.mainAxis,ki=e.elements.arrow&&js(e.elements.arrow),Hs=ki?v==="y"?ki.clientTop||0:ki.clientLeft||0:0,vo=($=_?.[v])!=null?$:0,qs=X+zs-vo-Hs,Ws=X+Xn-vo,yo=Zo(p?Sl(fe,qs):fe,X,p?Qr(Ee,Ws):Ee);x[v]=yo,N[v]=yo-X}if(a){var bo,Us=v==="x"?kt:wt,Ks=v==="x"?Ht:qt,Mn=x[w],Zn=w==="y"?"height":"width",ko=Mn+g[Us],Ir=Mn-g[Ks],wo=[kt,wt].indexOf(b)!==-1,Gs=(bo=_?.[w])!=null?bo:0,Js=wo?ko:Mn-C[Zn]-M[Zn]-Gs+A.altAxis,Ys=wo?Mn+C[Zn]+M[Zn]-Gs-A.altAxis:Ir,Xs=p&&wo?tR(Js,Mn,Ys):Zo(p?Js:ko,Mn,p?Ys:Ir);x[w]=Xs,N[w]=Xs-Mn}e.modifiersData[r]=N}}const IR={name:"preventOverflow",enabled:!0,phase:"main",fn:DR,requiresIfExists:["offset"]};function NR(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function RR(t){return t===Dt(t)||!zt(t)?Oh(t):NR(t)}function PR(t){var e=t.getBoundingClientRect(),n=co(e.width)/t.offsetWidth||1,r=co(e.height)/t.offsetHeight||1;return n!==1||r!==1}function FR(t,e,n){n===void 0&&(n=!1);var r=zt(e),i=zt(e)&&PR(e),o=Mr(e),s=po(t,i,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Sn(e)!=="body"||Mh(o))&&(a=RR(e)),zt(e)?(l=po(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):o&&(l.x=Ah(o))),{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function LR(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 BR(t){var e=LR(t);return YN.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function VR(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function $R(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 bg={placement:"bottom",modifiers:[],strategy:"absolute"};function kg(){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 jR(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,i=e.defaultOptions,o=i===void 0?bg:i;return function(s,a,l){l===void 0&&(l=o);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},bg,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:di(s)?Qo(s):s.contextElement?Qo(s.contextElement):[],popper:Qo(a)};var b=BR($R([].concat(r,u.options.modifiers)));return u.orderedModifiers=b.filter(function(y){return y.enabled}),p(),h.update()},forceUpdate:function(){if(!d){var m=u.elements,g=m.reference,b=m.popper;if(kg(g,b)){u.rects={reference:FR(g,js(b),u.options.strategy==="fixed"),popper:Sh(b)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(M){return u.modifiersData[M.name]=Object.assign({},M.data)});for(var y=0;y<u.orderedModifiers.length;y++){if(u.reset===!0){u.reset=!1,y=-1;continue}var k=u.orderedModifiers[y],v=k.fn,w=k.options,x=w===void 0?{}:w,C=k.name;typeof v=="function"&&(u=v({state:u,options:x,name:C,instance:h})||u)}}}},update:VR(function(){return new Promise(function(m){h.forceUpdate(),m(u)})}),destroy:function(){f(),d=!0}};if(!kg(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,b=m.options,y=b===void 0?{}:b,k=m.effect;if(typeof k=="function"){var v=k({state:u,name:g,instance:h,options:y}),w=function(){};c.push(v||w)}})}function f(){c.forEach(function(m){return m()}),c=[]}return h}}var zR=[dR,MR,uR,B0,OR,xR,IR,oR,CR],HR=jR({defaultModifiers:zR}),qR="tippy-box",U0="tippy-content",WR="tippy-backdrop",K0="tippy-arrow",G0="tippy-svg-arrow",$r={passive:!0,capture:!0},J0=function(){return document.body};function Ic(t,e,n){if(Array.isArray(t)){var r=t[e];return r??(Array.isArray(n)?n[e]:n)}return t}function _h(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function Y0(t,e){return typeof t=="function"?t.apply(void 0,e):t}function wg(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function UR(t){return t.split(/\s+/).filter(Boolean)}function Fi(t){return[].concat(t)}function xg(t,e){t.indexOf(e)===-1&&t.push(e)}function KR(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function GR(t){return t.split("-")[0]}function Tl(t){return[].slice.call(t)}function Eg(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function es(){return document.createElement("div")}function Hu(t){return["Element","Fragment"].some(function(e){return _h(t,e)})}function JR(t){return _h(t,"NodeList")}function YR(t){return _h(t,"MouseEvent")}function XR(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function ZR(t){return Hu(t)?[t]:JR(t)?Tl(t):Array.isArray(t)?t:Tl(document.querySelectorAll(t))}function Nc(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function Cg(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function QR(t){var e,n=Fi(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function eP(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=GR(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,b=o.left-n+p>l,y=n-o.right-f>l;return m||g||b||y})}function Rc(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){t[r](i,n)})}function Sg(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},Tg=0;function tP(){fn.isTouch||(fn.isTouch=!0,window.performance&&document.addEventListener("mousemove",X0))}function X0(){var t=performance.now();t-Tg<20&&(fn.isTouch=!1,document.removeEventListener("mousemove",X0)),Tg=t}function nP(){var t=document.activeElement;if(XR(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function rP(){document.addEventListener("touchstart",tP,$r),window.addEventListener("blur",nP)}var iP=typeof window<"u"&&typeof document<"u",oP=iP?!!window.msCrypto:!1,sP={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},aP={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Yt=Object.assign({appendTo:J0,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},sP,aP),lP=Object.keys(Yt),uP=function(t){var e=Object.keys(t);e.forEach(function(n){Yt[n]=t[n]})};function Z0(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=Yt[o])!=null?a:s}return r},{});return Object.assign({},t,n)}function cP(t,e){var n=e?Object.keys(Z0(Object.assign({},Yt,{plugins:e}))):lP,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 Og(t,e){var n=Object.assign({},e,{content:Y0(e.content,[t])},e.ignoreAttributes?{}:cP(t,e.plugins));return n.aria=Object.assign({},Yt.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 dP=function(){return"innerHTML"};function Gd(t,e){t[dP()]=e}function Ag(t){var e=es();return t===!0?e.className=K0:(e.className=G0,Hu(t)?e.appendChild(t):Gd(e,t)),e}function Mg(t,e){Hu(e.content)?(Gd(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Gd(t,e.content):t.textContent=e.content)}function Jd(t){var e=t.firstElementChild,n=Tl(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(U0)}),arrow:n.find(function(r){return r.classList.contains(K0)||r.classList.contains(G0)}),backdrop:n.find(function(r){return r.classList.contains(WR)})}}function Q0(t){var e=es(),n=es();n.className=qR,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=es();r.className=U0,r.setAttribute("data-state","hidden"),Mg(r,t.props),e.appendChild(n),n.appendChild(r),i(t.props,t.props);function i(o,s){var a=Jd(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)&&Mg(u,t.props),s.arrow?c?o.arrow!==s.arrow&&(l.removeChild(c),l.appendChild(Ag(s.arrow))):l.appendChild(Ag(s.arrow)):c&&l.removeChild(c)}return{popper:e,onUpdate:i}}Q0.$$tippy=!0;var pP=1,wa=[],Pc=[];function hP(t,e){var n=Og(t,Object.assign({},Yt,Z0(Eg(e)))),r,i,o,s=!1,a=!1,l=!1,u=!1,c,d,h,p=[],f=wg(qs,n.interactiveDebounce),m,g=pP++,b=null,y=KR(n.plugins),k={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:g,reference:t,popper:es(),popperInstance:b,props:n,state:k,plugins:y,clearDelayTimeouts:Js,setProps:Ys,setContent:Xs,show:kk,hide:wk,hideWithInteractivity:xk,enable:wo,disable:Gs,unmount:Ek,destroy:Ck};if(!n.render)return v;var w=n.render(v),x=w.popper,C=w.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+v.id,v.popper=x,t._tippy=v,x._tippy=v;var M=y.map(function(S){return S.fn(v)}),T=t.hasAttribute("aria-expanded");return ki(),Ie(),X(),fe("onCreate",[v]),n.showOnCreate&&ko(),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&&j().addEventListener("mousemove",f)}),v;function A(){var S=v.props.touch;return Array.isArray(S)?S:[S,0]}function _(){return A()[0]==="hold"}function N(){var S;return!!((S=v.props.render)!=null&&S.$$tippy)}function $(){return m||t}function j(){var S=$().parentNode;return S?QR(S):document}function q(){return Jd(x)}function K(S){return v.state.isMounted&&!v.state.isVisible||fn.isTouch||c&&c.type==="focus"?0:Ic(v.props.delay,S?0:1,Yt.delay)}function X(S){S===void 0&&(S=!1),x.style.pointerEvents=v.props.interactive&&!S?"":"none",x.style.zIndex=""+v.props.zIndex}function fe(S,G,ie){if(ie===void 0&&(ie=!0),M.forEach(function(me){me[S]&&me[S].apply(me,G)}),ie){var ye;(ye=v.props)[S].apply(ye,G)}}function Ee(){var S=v.props.aria;if(S.content){var G="aria-"+S.content,ie=x.id,ye=Fi(v.props.triggerTarget||t);ye.forEach(function(me){var ut=me.getAttribute(G);if(v.state.isVisible)me.setAttribute(G,ut?ut+" "+ie:ie);else{var Nt=ut&&ut.replace(ie,"").trim();Nt?me.setAttribute(G,Nt):me.removeAttribute(G)}})}}function Ie(){if(!(T||!v.props.aria.expanded)){var S=Fi(v.props.triggerTarget||t);S.forEach(function(G){v.props.interactive?G.setAttribute("aria-expanded",v.state.isVisible&&G===$()?"true":"false"):G.removeAttribute("aria-expanded")})}}function An(){j().removeEventListener("mousemove",f),wa=wa.filter(function(S){return S!==f})}function sn(S){if(!(fn.isTouch&&(l||S.type==="mousedown"))){var G=S.composedPath&&S.composedPath()[0]||S.target;if(!(v.props.interactive&&Sg(x,G))){if(Fi(v.props.triggerTarget||t).some(function(ie){return Sg(ie,G)})){if(fn.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else fe("onClickOutside",[v,S]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),a=!0,setTimeout(function(){a=!1}),v.state.isMounted||Jn())}}}function _r(){l=!0}function an(){l=!1}function It(){var S=j();S.addEventListener("mousedown",sn,!0),S.addEventListener("touchend",sn,$r),S.addEventListener("touchstart",an,$r),S.addEventListener("touchmove",_r,$r)}function Jn(){var S=j();S.removeEventListener("mousedown",sn,!0),S.removeEventListener("touchend",sn,$r),S.removeEventListener("touchstart",an,$r),S.removeEventListener("touchmove",_r,$r)}function Dr(S,G){zs(S,function(){!v.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&G()})}function Yn(S,G){zs(S,G)}function zs(S,G){var ie=q().box;function ye(me){me.target===ie&&(Rc(ie,"remove",ye),G())}if(S===0)return G();Rc(ie,"remove",d),Rc(ie,"add",ye),d=ye}function Xn(S,G,ie){ie===void 0&&(ie=!1);var ye=Fi(v.props.triggerTarget||t);ye.forEach(function(me){me.addEventListener(S,G,ie),p.push({node:me,eventType:S,handler:G,options:ie})})}function ki(){_()&&(Xn("touchstart",vo,{passive:!0}),Xn("touchend",Ws,{passive:!0})),UR(v.props.trigger).forEach(function(S){if(S!=="manual")switch(Xn(S,vo),S){case"mouseenter":Xn("mouseleave",Ws);break;case"focus":Xn(oP?"focusout":"blur",yo);break;case"focusin":Xn("focusout",yo);break}})}function Hs(){p.forEach(function(S){var G=S.node,ie=S.eventType,ye=S.handler,me=S.options;G.removeEventListener(ie,ye,me)}),p=[]}function vo(S){var G,ie=!1;if(!(!v.state.isEnabled||bo(S)||a)){var ye=((G=c)==null?void 0:G.type)==="focus";c=S,m=S.currentTarget,Ie(),!v.state.isVisible&&YR(S)&&wa.forEach(function(me){return me(S)}),S.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||s)&&v.props.hideOnClick!==!1&&v.state.isVisible?ie=!0:ko(S),S.type==="click"&&(s=!ie),ie&&!ye&&Ir(S)}}function qs(S){var G=S.target,ie=$().contains(G)||x.contains(G);if(!(S.type==="mousemove"&&ie)){var ye=Zn().concat(x).map(function(me){var ut,Nt=me._tippy,wi=(ut=Nt.popperInstance)==null?void 0:ut.state;return wi?{popperRect:me.getBoundingClientRect(),popperState:wi,props:n}:null}).filter(Boolean);eP(ye,S)&&(An(),Ir(S))}}function Ws(S){var G=bo(S)||v.props.trigger.indexOf("click")>=0&&s;if(!G){if(v.props.interactive){v.hideWithInteractivity(S);return}Ir(S)}}function yo(S){v.props.trigger.indexOf("focusin")<0&&S.target!==$()||v.props.interactive&&S.relatedTarget&&x.contains(S.relatedTarget)||Ir(S)}function bo(S){return fn.isTouch?_()!==S.type.indexOf("touch")>=0:!1}function Us(){Ks();var S=v.props,G=S.popperOptions,ie=S.placement,ye=S.offset,me=S.getReferenceClientRect,ut=S.moveTransition,Nt=N()?Jd(x).arrow:null,wi=me?{getBoundingClientRect:me,contextElement:me.contextElement||$()}:t,Zs={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Qs){var xi=Qs.state;if(N()){var Sk=q(),Wu=Sk.box;["placement","reference-hidden","escaped"].forEach(function(ea){ea==="placement"?Wu.setAttribute("data-placement",xi.placement):xi.attributes.popper["data-popper-"+ea]?Wu.setAttribute("data-"+ea,""):Wu.removeAttribute("data-"+ea)}),xi.attributes.popper={}}}},Nr=[{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:!ut}},Zs];N()&&Nt&&Nr.push({name:"arrow",options:{element:Nt,padding:3}}),Nr.push.apply(Nr,G?.modifiers||[]),v.popperInstance=HR(wi,x,Object.assign({},G,{placement:ie,onFirstUpdate:h,modifiers:Nr}))}function Ks(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function Mn(){var S=v.props.appendTo,G,ie=$();v.props.interactive&&S===J0||S==="parent"?G=ie.parentNode:G=Y0(S,[ie]),G.contains(x)||G.appendChild(x),v.state.isMounted=!0,Us()}function Zn(){return Tl(x.querySelectorAll("[data-tippy-root]"))}function ko(S){v.clearDelayTimeouts(),S&&fe("onTrigger",[v,S]),It();var G=K(!0),ie=A(),ye=ie[0],me=ie[1];fn.isTouch&&ye==="hold"&&me&&(G=me),G?r=setTimeout(function(){v.show()},G):v.show()}function Ir(S){if(v.clearDelayTimeouts(),fe("onUntrigger",[v,S]),!v.state.isVisible){Jn();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(S.type)>=0&&s)){var G=K(!1);G?i=setTimeout(function(){v.state.isVisible&&v.hide()},G):o=requestAnimationFrame(function(){v.hide()})}}function wo(){v.state.isEnabled=!0}function Gs(){v.hide(),v.state.isEnabled=!1}function Js(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(o)}function Ys(S){if(!v.state.isDestroyed){fe("onBeforeUpdate",[v,S]),Hs();var G=v.props,ie=Og(t,Object.assign({},G,Eg(S),{ignoreAttributes:!0}));v.props=ie,ki(),G.interactiveDebounce!==ie.interactiveDebounce&&(An(),f=wg(qs,ie.interactiveDebounce)),G.triggerTarget&&!ie.triggerTarget?Fi(G.triggerTarget).forEach(function(ye){ye.removeAttribute("aria-expanded")}):ie.triggerTarget&&t.removeAttribute("aria-expanded"),Ie(),X(),C&&C(G,ie),v.popperInstance&&(Us(),Zn().forEach(function(ye){requestAnimationFrame(ye._tippy.popperInstance.forceUpdate)})),fe("onAfterUpdate",[v,S])}}function Xs(S){v.setProps({content:S})}function kk(){var S=v.state.isVisible,G=v.state.isDestroyed,ie=!v.state.isEnabled,ye=fn.isTouch&&!v.props.touch,me=Ic(v.props.duration,0,Yt.duration);if(!(S||G||ie||ye)&&!$().hasAttribute("disabled")&&(fe("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,N()&&(x.style.visibility="visible"),X(),It(),v.state.isMounted||(x.style.transition="none"),N()){var ut=q(),Nt=ut.box,wi=ut.content;Nc([Nt,wi],0)}h=function(){var Zs;if(!(!v.state.isVisible||u)){if(u=!0,x.offsetHeight,x.style.transition=v.props.moveTransition,N()&&v.props.animation){var Nr=q(),Qs=Nr.box,xi=Nr.content;Nc([Qs,xi],me),Cg([Qs,xi],"visible")}Ee(),Ie(),xg(Pc,v),(Zs=v.popperInstance)==null||Zs.forceUpdate(),fe("onMount",[v]),v.props.animation&&N()&&Yn(me,function(){v.state.isShown=!0,fe("onShown",[v])})}},Mn()}}function wk(){var S=!v.state.isVisible,G=v.state.isDestroyed,ie=!v.state.isEnabled,ye=Ic(v.props.duration,1,Yt.duration);if(!(S||G||ie)&&(fe("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,u=!1,s=!1,N()&&(x.style.visibility="hidden"),An(),Jn(),X(!0),N()){var me=q(),ut=me.box,Nt=me.content;v.props.animation&&(Nc([ut,Nt],ye),Cg([ut,Nt],"hidden"))}Ee(),Ie(),v.props.animation?N()&&Dr(ye,v.unmount):v.unmount()}}function xk(S){j().addEventListener("mousemove",f),xg(wa,f),f(S)}function Ek(){v.state.isVisible&&v.hide(),v.state.isMounted&&(Ks(),Zn().forEach(function(S){S._tippy.unmount()}),x.parentNode&&x.parentNode.removeChild(x),Pc=Pc.filter(function(S){return S!==v}),v.state.isMounted=!1,fe("onHidden",[v]))}function Ck(){!v.state.isDestroyed&&(v.clearDelayTimeouts(),v.unmount(),Hs(),delete t._tippy,v.state.isDestroyed=!0,fe("onDestroy",[v]))}}function go(t,e){e===void 0&&(e={});var n=Yt.plugins.concat(e.plugins||[]);rP();var r=Object.assign({},e,{plugins:n}),i=ZR(t),o=i.reduce(function(s,a){var l=a&&hP(a,r);return l&&s.push(l),s},[]);return Hu(t)?o[0]:o}go.defaultProps=Yt;go.setDefaultProps=uP;go.currentInput=fn;Object.assign({},B0,{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)}});go.setDefaultProps({render:Q0});class fP{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&&bh(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:b}=g,y=Math.min(...b.map(v=>v.$from.pos)),k=Math.max(...b.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:y,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(R0(f.selection)){let v=a.nodeDOM(y);if(v){const w=v.dataset.nodeViewWrapper?v:v.querySelector("[data-node-view-wrapper]");if(w&&(v=w.firstChild),v)return v.getBoundingClientRect()}}return P0(a,y,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=go(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 mP=t=>new $e({key:typeof t.pluginKey=="string"?new lt(t.pluginKey):t.pluginKey,view:e=>new fP({view:e,...t})});Ke.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[mP({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class gP{getTextContent(e){return I0(e,{textSerializers:vh(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=go(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)||(()=>P0(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 vP=t=>new $e({key:typeof t.pluginKey=="string"?new lt(t.pluginKey):t.pluginKey,view:e=>new gP({view:e,...t})});Ke.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[vP({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});function _g(t){return Gg((e,n)=>({get(){return e(),t},set(r){t=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class yP extends LN{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=_g(this.view.state),this.reactiveExtensionStorage=_g(this.extensionStorage),this.on("beforeTransaction",({nextState:n})=>{this.reactiveState.value=n,this.reactiveExtensionStorage.value=this.extensionStorage}),Ta(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 bP=Q({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=H(),n=hp();return lp(()=>{const r=t.editor;r&&r.options.element&&e.value&&xr(()=>{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()})}),pi(()=>{const r=t.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return ls("div",{ref:t=>{this.rootEl=t}})}}),kP=(t={})=>{const e=Zt();return Tn(()=>{e.value=new yP(t)}),pi(()=>{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},wP="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",xP="ελ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",fo=(t,e)=>{for(const n in e)t[n]=e[n];return t},Yd="numeric",Xd="ascii",Zd="alpha",ts="asciinumeric",$o="alphanumeric",Qd="domain",ek="emoji",EP="scheme",CP="slashscheme",Fc="whitespace";function SP(t,e){return t in e||(e[t]=[]),e[t]}function Ur(t,e,n){e[Yd]&&(e[ts]=!0,e[$o]=!0),e[Xd]&&(e[ts]=!0,e[Zd]=!0),e[ts]&&(e[$o]=!0),e[Zd]&&(e[$o]=!0),e[$o]&&(e[Qd]=!0),e[ek]&&(e[Qd]=!0);for(const r in e){const i=SP(r,n);i.indexOf(t)<0&&i.push(t)}}function TP(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&&Ur(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,fo(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=fo(TP(s.t,r),n);Ur(o,l,r)}else n&&Ur(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),Ae=(t,e,n,r,i)=>t.tr(e,n,r,i),Dg=(t,e,n,r,i)=>t.ts(e,n,r,i),R=(t,e,n,r,i)=>t.tt(e,n,r,i),Rn="WORD",ep="UWORD",tk="ASCIINUMERICAL",nk="ALPHANUMERICAL",Os="LOCALHOST",tp="TLD",np="UTLD",za="SCHEME",Li="SLASH_SCHEME",Dh="NUM",rp="WS",Ih="NL",ns="OPENBRACE",rs="CLOSEBRACE",Ol="OPENBRACKET",Al="CLOSEBRACKET",Ml="OPENPAREN",_l="CLOSEPAREN",Dl="OPENANGLEBRACKET",Il="CLOSEANGLEBRACKET",Nl="FULLWIDTHLEFTPAREN",Rl="FULLWIDTHRIGHTPAREN",Pl="LEFTCORNERBRACKET",Fl="RIGHTCORNERBRACKET",Ll="LEFTWHITECORNERBRACKET",Bl="RIGHTWHITECORNERBRACKET",Vl="FULLWIDTHLESSTHAN",$l="FULLWIDTHGREATERTHAN",jl="AMPERSAND",zl="APOSTROPHE",Hl="ASTERISK",rr="AT",ql="BACKSLASH",Wl="BACKTICK",Ul="CARET",ar="COLON",Nh="COMMA",Kl="DOLLAR",cn="DOT",Gl="EQUALS",Rh="EXCLAMATION",Pt="HYPHEN",is="PERCENT",Jl="PIPE",Yl="PLUS",Xl="POUND",ss="QUERY",Ph="QUOTE",rk="FULLWIDTHMIDDLEDOT",Fh="SEMI",dn="SLASH",as="TILDE",Zl="UNDERSCORE",ik="EMOJI",Ql="SYM";var ok=Object.freeze({__proto__:null,ALPHANUMERICAL:nk,AMPERSAND:jl,APOSTROPHE:zl,ASCIINUMERICAL:tk,ASTERISK:Hl,AT:rr,BACKSLASH:ql,BACKTICK:Wl,CARET:Ul,CLOSEANGLEBRACKET:Il,CLOSEBRACE:rs,CLOSEBRACKET:Al,CLOSEPAREN:_l,COLON:ar,COMMA:Nh,DOLLAR:Kl,DOT:cn,EMOJI:ik,EQUALS:Gl,EXCLAMATION:Rh,FULLWIDTHGREATERTHAN:$l,FULLWIDTHLEFTPAREN:Nl,FULLWIDTHLESSTHAN:Vl,FULLWIDTHMIDDLEDOT:rk,FULLWIDTHRIGHTPAREN:Rl,HYPHEN:Pt,LEFTCORNERBRACKET:Pl,LEFTWHITECORNERBRACKET:Ll,LOCALHOST:Os,NL:Ih,NUM:Dh,OPENANGLEBRACKET:Dl,OPENBRACE:ns,OPENBRACKET:Ol,OPENPAREN:Ml,PERCENT:is,PIPE:Jl,PLUS:Yl,POUND:Xl,QUERY:ss,QUOTE:Ph,RIGHTCORNERBRACKET:Fl,RIGHTWHITECORNERBRACKET:Bl,SCHEME:za,SEMI:Fh,SLASH:dn,SLASH_SCHEME:Li,SYM:Ql,TILDE:as,TLD:tp,UNDERSCORE:Zl,UTLD:np,UWORD:ep,WORD:Rn,WS:rp});const Dn=/[a-z]/,Ao=/\p{L}/u,Lc=/\p{Emoji}/u,In=/\d/,Bc=/\s/,Ig="\r",Vc=`
97
- `,OP="️",AP="‍",$c="";let xa=null,Ea=null;function MP(t=[]){const e={};vt.groups=e;const n=new vt;xa==null&&(xa=Ng(wP)),Ea==null&&(Ea=Ng(xP)),R(n,"'",zl),R(n,"{",ns),R(n,"}",rs),R(n,"[",Ol),R(n,"]",Al),R(n,"(",Ml),R(n,")",_l),R(n,"<",Dl),R(n,">",Il),R(n,"(",Nl),R(n,")",Rl),R(n,"「",Pl),R(n,"」",Fl),R(n,"『",Ll),R(n,"』",Bl),R(n,"<",Vl),R(n,">",$l),R(n,"&",jl),R(n,"*",Hl),R(n,"@",rr),R(n,"`",Wl),R(n,"^",Ul),R(n,":",ar),R(n,",",Nh),R(n,"$",Kl),R(n,".",cn),R(n,"=",Gl),R(n,"!",Rh),R(n,"-",Pt),R(n,"%",is),R(n,"|",Jl),R(n,"+",Yl),R(n,"#",Xl),R(n,"?",ss),R(n,'"',Ph),R(n,"/",dn),R(n,";",Fh),R(n,"~",as),R(n,"_",Zl),R(n,"\\",ql),R(n,"・",rk);const r=Ae(n,In,Dh,{[Yd]:!0});Ae(r,In,r);const i=Ae(r,Dn,tk,{[ts]:!0}),o=Ae(r,Ao,nk,{[$o]:!0}),s=Ae(n,Dn,Rn,{[Xd]:!0});Ae(s,In,i),Ae(s,Dn,s),Ae(i,In,i),Ae(i,Dn,i);const a=Ae(n,Ao,ep,{[Zd]:!0});Ae(a,Dn),Ae(a,In,o),Ae(a,Ao,a),Ae(o,In,o),Ae(o,Dn),Ae(o,Ao,o);const l=R(n,Vc,Ih,{[Fc]:!0}),u=R(n,Ig,rp,{[Fc]:!0}),c=Ae(n,Bc,rp,{[Fc]:!0});R(n,$c,c),R(u,Vc,l),R(u,$c,c),Ae(u,Bc,c),R(c,Ig),R(c,Vc),Ae(c,Bc,c),R(c,$c,c);const d=Ae(n,Lc,ik,{[ek]:!0});R(d,"#"),Ae(d,Lc,d),R(d,OP,d);const h=R(d,AP);R(h,"#"),Ae(h,Lc,d);const p=[[Dn,s],[In,i]],f=[[Dn,null],[Ao,a],[In,o]];for(let m=0;m<xa.length;m++)Qn(n,xa[m],tp,Rn,p);for(let m=0;m<Ea.length;m++)Qn(n,Ea[m],np,ep,f);Ur(tp,{tld:!0,ascii:!0},e),Ur(np,{utld:!0,alpha:!0},e),Qn(n,"file",za,Rn,p),Qn(n,"mailto",za,Rn,p),Qn(n,"http",Li,Rn,p),Qn(n,"https",Li,Rn,p),Qn(n,"ftp",Li,Rn,p),Qn(n,"ftps",Li,Rn,p),Ur(za,{scheme:!0,ascii:!0},e),Ur(Li,{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],b=t[m][1]?{[EP]:!0}:{[CP]:!0};g.indexOf("-")>=0?b[Qd]=!0:Dn.test(g)?In.test(g)?b[ts]=!0:b[Xd]=!0:b[Yd]=!0,Dg(n,g,g,b)}return Dg(n,"localhost",Os,{ascii:!0}),n.jd=new vt(Ql),{start:n,tokens:fo({groups:e},ok)}}function sk(t,e){const n=_P(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 _P(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 Qn(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 Ng(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 As={defaultProtocol:"http",events:null,format:Rg,formatHref:Rg,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Lh(t,e=null){let n=fo({},As);t&&(n=fo(n,t instanceof Lh?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}Lh.prototype={o:As,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]:As[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 Rg(t){return t}function ak(t,e){this.t="token",this.v=t,this.tk=e}ak.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=As.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&&fo(s,c),{tagName:i,attributes:s,content:o,eventListeners:d}}};function qu(t,e){class n extends ak{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 Pg=qu("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Fg=qu("text"),DP=qu("nl"),Ca=qu("url",{isLink:!0,toHref(t=As.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Os&&t[1].t===ar}}),Rt=t=>new vt(t);function IP({groups:t}){const e=t.domain.concat([jl,Hl,rr,ql,Wl,Ul,Kl,Gl,Pt,Dh,is,Jl,Yl,Xl,dn,Ql,as,Zl]),n=[zl,ar,Nh,cn,Rh,is,ss,Ph,Fh,Dl,Il,ns,rs,Al,Ol,Ml,_l,Nl,Rl,Pl,Fl,Ll,Bl,Vl,$l],r=[jl,zl,Hl,ql,Wl,Ul,Kl,Gl,Pt,ns,rs,is,Jl,Yl,Xl,ss,dn,Ql,as,Zl],i=Rt(),o=R(i,as);ce(o,r,o),ce(o,t.domain,o);const s=Rt(),a=Rt(),l=Rt();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=R(s,rr);R(o,rr,u),R(a,rr,u),R(l,rr,u);const c=R(o,cn);ce(c,r,o),ce(c,t.domain,o);const d=Rt();ce(u,t.domain,d),ce(d,t.domain,d);const h=R(d,cn);ce(h,t.domain,d);const p=Rt(Pg);ce(h,t.tld,p),ce(h,t.utld,p),R(u,Os,p);const f=R(d,Pt);R(f,Pt,f),ce(f,t.domain,d),ce(p,t.domain,d),R(p,cn,h),R(p,Pt,f);const m=R(p,ar);ce(m,t.numeric,Pg);const g=R(s,Pt),b=R(s,cn);R(g,Pt,g),ce(g,t.domain,s),ce(b,r,o),ce(b,t.domain,s);const y=Rt(Ca);ce(b,t.tld,y),ce(b,t.utld,y),ce(y,t.domain,s),ce(y,r,o),R(y,cn,b),R(y,Pt,g),R(y,rr,u);const k=R(y,ar),v=Rt(Ca);ce(k,t.numeric,v);const w=Rt(Ca),x=Rt();ce(w,e,w),ce(w,n,x),ce(x,e,w),ce(x,n,x),R(y,dn,w),R(v,dn,w);const C=R(a,ar),M=R(l,ar),T=R(M,dn),A=R(T,dn);ce(a,t.domain,s),R(a,cn,b),R(a,Pt,g),ce(l,t.domain,s),R(l,cn,b),R(l,Pt,g),ce(C,t.domain,w),R(C,dn,w),R(C,ss,w),ce(A,t.domain,w),ce(A,e,w),R(A,dn,w);const _=[[ns,rs],[Ol,Al],[Ml,_l],[Dl,Il],[Nl,Rl],[Pl,Fl],[Ll,Bl],[Vl,$l]];for(let N=0;N<_.length;N++){const[$,j]=_[N],q=R(w,$);R(x,$,q),R(q,j,w);const K=Rt(Ca);ce(q,e,K);const X=Rt();ce(q,n),ce(K,e,K),ce(K,n,X),ce(X,e,K),ce(X,n,X),R(K,j,w),R(X,j,w)}return R(i,Os,y),R(i,Ih,DP),{start:i,tokens:ok}}function NP(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(jc(Fg,e,s)),s=[]),i-=h,c-=h;const p=d.t,f=n.slice(i-c,i);o.push(jc(p,e,f))}}return s.length>0&&o.push(jc(Fg,e,s)),o}function jc(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 RP=typeof console<"u"&&console&&console.warn||(()=>{}),PP="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 FP(){return vt.groups={},we.scanner=null,we.parser=null,we.tokenQueue=[],we.pluginQueue=[],we.customSchemes=[],we.initialized=!1,we}function Lg(t,e=!1){if(we.initialized&&RP(`linkifyjs: already initialized - will not register custom scheme "${t}" ${PP}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
96
+ `,textSerializers:n={}}=t||{};return B0(this.state.doc,{blockSeparator:e,textSerializers:{...wh(this.schema),...n}})}get isEmpty(){return Hu(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 zr(e,this)}get $doc(){return this.$pos(0)}};function uo(t){return new $u({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(Th(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 ZN(t){return new $u({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 Gd(t){return new $u({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 Ss(t){return new $u({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&&sh(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&&Tr(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&s.join(n.from-1)}})}let on=class Jd{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(W(this,"addOptions",{name:this.name}))),this.storage=pe(W(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Jd(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>ju(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Jd(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(W(n,"addOptions",{name:n.name})),n.storage=pe(W(n,"addStorage",{name:n.name,options:n.options})),n}};function di(t){return new mI({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(Th(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 wt="top",Wt="bottom",Ut="right",xt="left",Oh="auto",Hs=[wt,Wt,Ut,xt],co="start",Ts="end",QN="clippingParents",z0="viewport",Ao="popper",eR="reference",vg=Hs.reduce(function(t,e){return t.concat([e+"-"+co,e+"-"+Ts])},[]),H0=[].concat(Hs,[Oh]).reduce(function(t,e){return t.concat([e,e+"-"+co,e+"-"+Ts])},[]),tR="beforeRead",nR="read",rR="afterRead",iR="beforeMain",oR="main",sR="afterMain",aR="beforeWrite",lR="write",uR="afterWrite",cR=[tR,nR,rR,iR,oR,sR,aR,lR,uR];function Sn(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 pi(t){var e=Nt(t).Element;return t instanceof e||t instanceof Element}function qt(t){var e=Nt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Ah(t){if(typeof ShadowRoot>"u")return!1;var e=Nt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function dR(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];!qt(o)||!Sn(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 pR(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},{});!qt(i)||!Sn(i)||(Object.assign(i.style,a),Object.keys(o).forEach(function(l){i.removeAttribute(l)}))})}}const q0={name:"applyStyles",enabled:!0,phase:"write",fn:dR,effect:pR,requires:["computeStyles"]};function bn(t){return t.split("-")[0]}var ei=Math.max,Ol=Math.min,po=Math.round;function Yd(){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 W0(){return!/^((?!chrome|android).)*safari/i.test(Yd())}function ho(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,o=1;e&&qt(t)&&(i=t.offsetWidth>0&&po(r.width)/t.offsetWidth||1,o=t.offsetHeight>0&&po(r.height)/t.offsetHeight||1);var s=pi(t)?Nt(t):window,a=s.visualViewport,l=!W0()&&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 Mh(t){var e=ho(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 U0(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Ah(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Un(t){return Nt(t).getComputedStyle(t)}function hR(t){return["table","td","th"].indexOf(Sn(t))>=0}function Mr(t){return((pi(t)?t.ownerDocument:t.document)||window.document).documentElement}function qu(t){return Sn(t)==="html"?t:t.assignedSlot||t.parentNode||(Ah(t)?t.host:null)||Mr(t)}function yg(t){return!qt(t)||Un(t).position==="fixed"?null:t.offsetParent}function fR(t){var e=/firefox/i.test(Yd()),n=/Trident/i.test(Yd());if(n&&qt(t)){var r=Un(t);if(r.position==="fixed")return null}var i=qu(t);for(Ah(i)&&(i=i.host);qt(i)&&["html","body"].indexOf(Sn(i))<0;){var o=Un(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 qs(t){for(var e=Nt(t),n=yg(t);n&&hR(n)&&Un(n).position==="static";)n=yg(n);return n&&(Sn(n)==="html"||Sn(n)==="body"&&Un(n).position==="static")?e:n||fR(t)||e}function _h(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Qo(t,e,n){return ei(t,Ol(e,n))}function mR(t,e,n){var r=Qo(t,e,n);return r>n?n:r}function K0(){return{top:0,right:0,bottom:0,left:0}}function G0(t){return Object.assign({},K0(),t)}function J0(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var gR=function(t,e){return t=typeof t=="function"?t(Object.assign({},e.rects,{placement:e.placement})):t,G0(typeof t!="number"?t:J0(t,Hs))};function vR(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=_h(a),u=[xt,Ut].indexOf(a)>=0,c=u?"height":"width";if(!(!o||!s)){var d=gR(i.padding,n),h=Mh(o),p=l==="y"?wt:xt,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],b=qs(o),y=b?l==="y"?b.clientHeight||0:b.clientWidth||0:0,k=m/2-g/2,v=d[p],w=y-h[c]-d[f],x=y/2-h[c]/2+k,C=Qo(v,x,w),M=l;n.modifiersData[r]=(e={},e[M]=C,e.centerOffset=C-x,e)}}function yR(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)||U0(e.elements.popper,i)&&(e.elements.arrow=i))}const bR={name:"arrow",enabled:!0,phase:"main",fn:vR,effect:yR,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function fo(t){return t.split("-")[1]}var kR={top:"auto",right:"auto",bottom:"auto",left:"auto"};function wR(t,e){var n=t.x,r=t.y,i=e.devicePixelRatio||1;return{x:po(n*i)/i||0,y:po(r*i)/i||0}}function bg(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 b=s.hasOwnProperty("x"),y=s.hasOwnProperty("y"),k=xt,v=wt,w=window;if(u){var x=qs(n),C="clientHeight",M="clientWidth";if(x===Nt(n)&&(x=Mr(n),Un(x).position!=="static"&&a==="absolute"&&(C="scrollHeight",M="scrollWidth")),x=x,i===wt||(i===xt||i===Ut)&&o===Ts){v=Wt;var T=d&&x===w&&w.visualViewport?w.visualViewport.height:x[C];m-=T-r.height,m*=l?1:-1}if(i===xt||(i===wt||i===Wt)&&o===Ts){k=Ut;var A=d&&x===w&&w.visualViewport?w.visualViewport.width:x[M];p-=A-r.width,p*=l?1:-1}}var _=Object.assign({position:a},u&&kR),N=c===!0?wR({x:p,y:m},Nt(n)):{x:p,y:m};if(p=N.x,m=N.y,l){var $;return Object.assign({},_,($={},$[v]=y?"0":"",$[k]=b?"0":"",$.transform=(w.devicePixelRatio||1)<=1?"translate("+p+"px, "+m+"px)":"translate3d("+p+"px, "+m+"px, 0)",$))}return Object.assign({},_,(e={},e[v]=y?m+"px":"",e[k]=b?p+"px":"",e.transform="",e))}function xR(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:fo(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,bg(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,bg(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 ER={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:xR,data:{}};var Ea={passive:!0};function CR(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,Ea)}),a&&l.addEventListener("resize",n.update,Ea),function(){o&&u.forEach(function(c){c.removeEventListener("scroll",n.update,Ea)}),a&&l.removeEventListener("resize",n.update,Ea)}}const SR={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:CR,data:{}};var TR={left:"right",right:"left",bottom:"top",top:"bottom"};function Ha(t){return t.replace(/left|right|bottom|top/g,function(e){return TR[e]})}var OR={start:"end",end:"start"};function kg(t){return t.replace(/start|end/g,function(e){return OR[e]})}function Dh(t){var e=Nt(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Ih(t){return ho(Mr(t)).left+Dh(t).scrollLeft}function AR(t,e){var n=Nt(t),r=Mr(t),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;var u=W0();(u||!u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a+Ih(t),y:l}}function MR(t){var e,n=Mr(t),r=Dh(t),i=(e=t.ownerDocument)==null?void 0:e.body,o=ei(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=ei(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+Ih(t),l=-r.scrollTop;return Un(i||n).direction==="rtl"&&(a+=ei(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:s,x:a,y:l}}function Nh(t){var e=Un(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function Y0(t){return["html","body","#document"].indexOf(Sn(t))>=0?t.ownerDocument.body:qt(t)&&Nh(t)?t:Y0(qu(t))}function es(t,e){var n;e===void 0&&(e=[]);var r=Y0(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),o=Nt(r),s=i?[o].concat(o.visualViewport||[],Nh(r)?r:[]):r,a=e.concat(s);return i?a:a.concat(es(qu(s)))}function Xd(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function _R(t,e){var n=ho(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 wg(t,e,n){return e===z0?Xd(AR(t,n)):pi(e)?_R(e,n):Xd(MR(Mr(t)))}function DR(t){var e=es(qu(t)),n=["absolute","fixed"].indexOf(Un(t).position)>=0,r=n&&qt(t)?qs(t):t;return pi(r)?e.filter(function(i){return pi(i)&&U0(i,r)&&Sn(i)!=="body"}):[]}function IR(t,e,n,r){var i=e==="clippingParents"?DR(t):[].concat(e),o=[].concat(i,[n]),s=o[0],a=o.reduce(function(l,u){var c=wg(t,u,r);return l.top=ei(c.top,l.top),l.right=Ol(c.right,l.right),l.bottom=Ol(c.bottom,l.bottom),l.left=ei(c.left,l.left),l},wg(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 X0(t){var e=t.reference,n=t.element,r=t.placement,i=r?bn(r):null,o=r?fo(r):null,s=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,l;switch(i){case wt: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 xt:l={x:e.x-n.width,y:a};break;default:l={x:e.x,y:e.y}}var u=i?_h(i):null;if(u!=null){var c=u==="y"?"height":"width";switch(o){case co:l[u]=l[u]-(e[c]/2-n[c]/2);break;case Ts:l[u]=l[u]+(e[c]/2-n[c]/2);break}}return l}function Os(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?QN:a,u=n.rootBoundary,c=u===void 0?z0:u,d=n.elementContext,h=d===void 0?Ao:d,p=n.altBoundary,f=p===void 0?!1:p,m=n.padding,g=m===void 0?0:m,b=G0(typeof g!="number"?g:J0(g,Hs)),y=h===Ao?eR:Ao,k=t.rects.popper,v=t.elements[f?y:h],w=IR(pi(v)?v:v.contextElement||Mr(t.elements.popper),l,c,s),x=ho(t.elements.reference),C=X0({reference:x,element:k,placement:i}),M=Xd(Object.assign({},k,C)),T=h===Ao?M:x,A={top:w.top-T.top+b.top,bottom:T.bottom-w.bottom+b.bottom,left:w.left-T.left+b.left,right:T.right-w.right+b.right},_=t.modifiersData.offset;if(h===Ao&&_){var N=_[i];Object.keys(A).forEach(function($){var j=[Ut,Wt].indexOf($)>=0?1:-1,q=[wt,Wt].indexOf($)>=0?"y":"x";A[$]+=N[q]*j})}return A}function NR(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?H0:l,c=fo(r),d=c?a?vg:vg.filter(function(f){return fo(f)===c}):Hs,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]=Os(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 RR(t){if(bn(t)===Oh)return[];var e=Ha(t);return[kg(t),e,kg(e)]}function PR(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,b=bn(g),y=b===g,k=l||(y||!f?[Ha(g)]:RR(g)),v=[g].concat(k).reduce(function(an,Rt){return an.concat(bn(Rt)===Oh?NR(e,{placement:Rt,boundary:c,rootBoundary:d,padding:u,flipVariations:f,allowedAutoPlacements:m}):Rt)},[]),w=e.rects.reference,x=e.rects.popper,C=new Map,M=!0,T=v[0],A=0;A<v.length;A++){var _=v[A],N=bn(_),$=fo(_)===co,j=[wt,Wt].indexOf(N)>=0,q=j?"width":"height",K=Os(e,{placement:_,boundary:c,rootBoundary:d,altBoundary:h,padding:u}),X=j?$?Ut:xt:$?Wt:wt;w[q]>x[q]&&(X=Ha(X));var fe=Ha(X),Ee=[];if(o&&Ee.push(K[N]<=0),a&&Ee.push(K[X]<=0,K[fe]<=0),Ee.every(function(an){return an})){T=_,M=!1;break}C.set(_,Ee)}if(M)for(var Ie=f?3:1,An=function(an){var Rt=v.find(function(Jn){var Dr=C.get(Jn);if(Dr)return Dr.slice(0,an).every(function(Yn){return Yn})});if(Rt)return T=Rt,"break"},sn=Ie;sn>0;sn--){var _r=An(sn);if(_r==="break")break}e.placement!==T&&(e.modifiersData[r]._skip=!0,e.placement=T,e.reset=!0)}}const FR={name:"flip",enabled:!0,phase:"main",fn:PR,requiresIfExists:["offset"],data:{_skip:!1}};function xg(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 Eg(t){return[wt,Ut,Wt,xt].some(function(e){return t[e]>=0})}function LR(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,s=Os(e,{elementContext:"reference"}),a=Os(e,{altBoundary:!0}),l=xg(s,r),u=xg(a,i,o),c=Eg(l),d=Eg(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 BR={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:LR};function VR(t,e,n){var r=bn(t),i=[xt,wt].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,[xt,Ut].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}function $R(t){var e=t.state,n=t.options,r=t.name,i=n.offset,o=i===void 0?[0,0]:i,s=H0.reduce(function(c,d){return c[d]=VR(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 jR={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:$R};function zR(t){var e=t.state,n=t.name;e.modifiersData[n]=X0({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const HR={name:"popperOffsets",enabled:!0,phase:"read",fn:zR,data:{}};function qR(t){return t==="x"?"y":"x"}function WR(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=Os(e,{boundary:l,rootBoundary:u,padding:d,altBoundary:c}),b=bn(e.placement),y=fo(e.placement),k=!y,v=_h(b),w=qR(v),x=e.modifiersData.popperOffsets,C=e.rects.reference,M=e.rects.popper,T=typeof m=="function"?m(Object.assign({},e.rects,{placement:e.placement})):m,A=typeof T=="number"?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),_=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,N={x:0,y:0};if(x){if(o){var $,j=v==="y"?wt:xt,q=v==="y"?Wt:Ut,K=v==="y"?"height":"width",X=x[v],fe=X+g[j],Ee=X-g[q],Ie=p?-M[K]/2:0,An=y===co?C[K]:M[K],sn=y===co?-M[K]:-C[K],_r=e.elements.arrow,an=p&&_r?Mh(_r):{width:0,height:0},Rt=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:K0(),Jn=Rt[j],Dr=Rt[q],Yn=Qo(0,C[K],an[K]),Ws=k?C[K]/2-Ie-Yn-Jn-A.mainAxis:An-Yn-Jn-A.mainAxis,Xn=k?-C[K]/2+Ie+Yn+Dr+A.mainAxis:sn+Yn+Dr+A.mainAxis,wi=e.elements.arrow&&qs(e.elements.arrow),Us=wi?v==="y"?wi.clientTop||0:wi.clientLeft||0:0,yo=($=_?.[v])!=null?$:0,Ks=X+Ws-yo-Us,Gs=X+Xn-yo,bo=Qo(p?Ol(fe,Ks):fe,X,p?ei(Ee,Gs):Ee);x[v]=bo,N[v]=bo-X}if(a){var ko,Js=v==="x"?wt:xt,Ys=v==="x"?Wt:Ut,Mn=x[w],Zn=w==="y"?"height":"width",wo=Mn+g[Js],Ir=Mn-g[Ys],xo=[wt,xt].indexOf(b)!==-1,Xs=(ko=_?.[w])!=null?ko:0,Zs=xo?wo:Mn-C[Zn]-M[Zn]-Xs+A.altAxis,Qs=xo?Mn+C[Zn]+M[Zn]-Xs-A.altAxis:Ir,ea=p&&xo?mR(Zs,Mn,Qs):Qo(p?Zs:wo,Mn,p?Qs:Ir);x[w]=ea,N[w]=ea-Mn}e.modifiersData[r]=N}}const UR={name:"preventOverflow",enabled:!0,phase:"main",fn:WR,requiresIfExists:["offset"]};function KR(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function GR(t){return t===Nt(t)||!qt(t)?Dh(t):KR(t)}function JR(t){var e=t.getBoundingClientRect(),n=po(e.width)/t.offsetWidth||1,r=po(e.height)/t.offsetHeight||1;return n!==1||r!==1}function YR(t,e,n){n===void 0&&(n=!1);var r=qt(e),i=qt(e)&&JR(e),o=Mr(e),s=ho(t,i,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Sn(e)!=="body"||Nh(o))&&(a=GR(e)),qt(e)?(l=ho(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):o&&(l.x=Ih(o))),{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function XR(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 ZR(t){var e=XR(t);return cR.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function QR(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function eP(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 Cg={placement:"bottom",modifiers:[],strategy:"absolute"};function Sg(){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 tP(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,i=e.defaultOptions,o=i===void 0?Cg:i;return function(s,a,l){l===void 0&&(l=o);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},Cg,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:pi(s)?es(s):s.contextElement?es(s.contextElement):[],popper:es(a)};var b=ZR(eP([].concat(r,u.options.modifiers)));return u.orderedModifiers=b.filter(function(y){return y.enabled}),p(),h.update()},forceUpdate:function(){if(!d){var m=u.elements,g=m.reference,b=m.popper;if(Sg(g,b)){u.rects={reference:YR(g,qs(b),u.options.strategy==="fixed"),popper:Mh(b)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(M){return u.modifiersData[M.name]=Object.assign({},M.data)});for(var y=0;y<u.orderedModifiers.length;y++){if(u.reset===!0){u.reset=!1,y=-1;continue}var k=u.orderedModifiers[y],v=k.fn,w=k.options,x=w===void 0?{}:w,C=k.name;typeof v=="function"&&(u=v({state:u,options:x,name:C,instance:h})||u)}}}},update:QR(function(){return new Promise(function(m){h.forceUpdate(),m(u)})}),destroy:function(){f(),d=!0}};if(!Sg(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,b=m.options,y=b===void 0?{}:b,k=m.effect;if(typeof k=="function"){var v=k({state:u,name:g,instance:h,options:y}),w=function(){};c.push(v||w)}})}function f(){c.forEach(function(m){return m()}),c=[]}return h}}var nP=[SR,HR,ER,q0,jR,FR,UR,bR,BR],rP=tP({defaultModifiers:nP}),iP="tippy-box",Z0="tippy-content",oP="tippy-backdrop",Q0="tippy-arrow",ek="tippy-svg-arrow",$r={passive:!0,capture:!0},tk=function(){return document.body};function Fc(t,e,n){if(Array.isArray(t)){var r=t[e];return r??(Array.isArray(n)?n[e]:n)}return t}function Rh(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function nk(t,e){return typeof t=="function"?t.apply(void 0,e):t}function Tg(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function sP(t){return t.split(/\s+/).filter(Boolean)}function Li(t){return[].concat(t)}function Og(t,e){t.indexOf(e)===-1&&t.push(e)}function aP(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function lP(t){return t.split("-")[0]}function Al(t){return[].slice.call(t)}function Ag(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function ts(){return document.createElement("div")}function Wu(t){return["Element","Fragment"].some(function(e){return Rh(t,e)})}function uP(t){return Rh(t,"NodeList")}function cP(t){return Rh(t,"MouseEvent")}function dP(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function pP(t){return Wu(t)?[t]:uP(t)?Al(t):Array.isArray(t)?t:Al(document.querySelectorAll(t))}function Lc(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function Mg(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function hP(t){var e,n=Li(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function fP(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=lP(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,b=o.left-n+p>l,y=n-o.right-f>l;return m||g||b||y})}function Bc(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){t[r](i,n)})}function _g(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},Dg=0;function mP(){fn.isTouch||(fn.isTouch=!0,window.performance&&document.addEventListener("mousemove",rk))}function rk(){var t=performance.now();t-Dg<20&&(fn.isTouch=!1,document.removeEventListener("mousemove",rk)),Dg=t}function gP(){var t=document.activeElement;if(dP(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function vP(){document.addEventListener("touchstart",mP,$r),window.addEventListener("blur",gP)}var yP=typeof window<"u"&&typeof document<"u",bP=yP?!!window.msCrypto:!1,kP={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},wP={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Zt=Object.assign({appendTo:tk,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},kP,wP),xP=Object.keys(Zt),EP=function(t){var e=Object.keys(t);e.forEach(function(n){Zt[n]=t[n]})};function ik(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 CP(t,e){var n=e?Object.keys(ik(Object.assign({},Zt,{plugins:e}))):xP,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 Ig(t,e){var n=Object.assign({},e,{content:nk(e.content,[t])},e.ignoreAttributes?{}:CP(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 SP=function(){return"innerHTML"};function Zd(t,e){t[SP()]=e}function Ng(t){var e=ts();return t===!0?e.className=Q0:(e.className=ek,Wu(t)?e.appendChild(t):Zd(e,t)),e}function Rg(t,e){Wu(e.content)?(Zd(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Zd(t,e.content):t.textContent=e.content)}function Qd(t){var e=t.firstElementChild,n=Al(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(Z0)}),arrow:n.find(function(r){return r.classList.contains(Q0)||r.classList.contains(ek)}),backdrop:n.find(function(r){return r.classList.contains(oP)})}}function ok(t){var e=ts(),n=ts();n.className=iP,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=ts();r.className=Z0,r.setAttribute("data-state","hidden"),Rg(r,t.props),e.appendChild(n),n.appendChild(r),i(t.props,t.props);function i(o,s){var a=Qd(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)&&Rg(u,t.props),s.arrow?c?o.arrow!==s.arrow&&(l.removeChild(c),l.appendChild(Ng(s.arrow))):l.appendChild(Ng(s.arrow)):c&&l.removeChild(c)}return{popper:e,onUpdate:i}}ok.$$tippy=!0;var TP=1,Ca=[],Vc=[];function OP(t,e){var n=Ig(t,Object.assign({},Zt,ik(Ag(e)))),r,i,o,s=!1,a=!1,l=!1,u=!1,c,d,h,p=[],f=Tg(Ks,n.interactiveDebounce),m,g=TP++,b=null,y=aP(n.plugins),k={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:g,reference:t,popper:ts(),popperInstance:b,props:n,state:k,plugins:y,clearDelayTimeouts:Zs,setProps:Qs,setContent:ea,show:Tk,hide:Ok,hideWithInteractivity:Ak,enable:xo,disable:Xs,unmount:Mk,destroy:_k};if(!n.render)return v;var w=n.render(v),x=w.popper,C=w.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+v.id,v.popper=x,t._tippy=v,x._tippy=v;var M=y.map(function(S){return S.fn(v)}),T=t.hasAttribute("aria-expanded");return wi(),Ie(),X(),fe("onCreate",[v]),n.showOnCreate&&wo(),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&&j().addEventListener("mousemove",f)}),v;function A(){var S=v.props.touch;return Array.isArray(S)?S:[S,0]}function _(){return A()[0]==="hold"}function N(){var S;return!!((S=v.props.render)!=null&&S.$$tippy)}function $(){return m||t}function j(){var S=$().parentNode;return S?hP(S):document}function q(){return Qd(x)}function K(S){return v.state.isMounted&&!v.state.isVisible||fn.isTouch||c&&c.type==="focus"?0:Fc(v.props.delay,S?0:1,Zt.delay)}function X(S){S===void 0&&(S=!1),x.style.pointerEvents=v.props.interactive&&!S?"":"none",x.style.zIndex=""+v.props.zIndex}function fe(S,G,ie){if(ie===void 0&&(ie=!0),M.forEach(function(me){me[S]&&me[S].apply(me,G)}),ie){var ye;(ye=v.props)[S].apply(ye,G)}}function Ee(){var S=v.props.aria;if(S.content){var G="aria-"+S.content,ie=x.id,ye=Li(v.props.triggerTarget||t);ye.forEach(function(me){var ct=me.getAttribute(G);if(v.state.isVisible)me.setAttribute(G,ct?ct+" "+ie:ie);else{var Pt=ct&&ct.replace(ie,"").trim();Pt?me.setAttribute(G,Pt):me.removeAttribute(G)}})}}function Ie(){if(!(T||!v.props.aria.expanded)){var S=Li(v.props.triggerTarget||t);S.forEach(function(G){v.props.interactive?G.setAttribute("aria-expanded",v.state.isVisible&&G===$()?"true":"false"):G.removeAttribute("aria-expanded")})}}function An(){j().removeEventListener("mousemove",f),Ca=Ca.filter(function(S){return S!==f})}function sn(S){if(!(fn.isTouch&&(l||S.type==="mousedown"))){var G=S.composedPath&&S.composedPath()[0]||S.target;if(!(v.props.interactive&&_g(x,G))){if(Li(v.props.triggerTarget||t).some(function(ie){return _g(ie,G)})){if(fn.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else fe("onClickOutside",[v,S]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),a=!0,setTimeout(function(){a=!1}),v.state.isMounted||Jn())}}}function _r(){l=!0}function an(){l=!1}function Rt(){var S=j();S.addEventListener("mousedown",sn,!0),S.addEventListener("touchend",sn,$r),S.addEventListener("touchstart",an,$r),S.addEventListener("touchmove",_r,$r)}function Jn(){var S=j();S.removeEventListener("mousedown",sn,!0),S.removeEventListener("touchend",sn,$r),S.removeEventListener("touchstart",an,$r),S.removeEventListener("touchmove",_r,$r)}function Dr(S,G){Ws(S,function(){!v.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&G()})}function Yn(S,G){Ws(S,G)}function Ws(S,G){var ie=q().box;function ye(me){me.target===ie&&(Bc(ie,"remove",ye),G())}if(S===0)return G();Bc(ie,"remove",d),Bc(ie,"add",ye),d=ye}function Xn(S,G,ie){ie===void 0&&(ie=!1);var ye=Li(v.props.triggerTarget||t);ye.forEach(function(me){me.addEventListener(S,G,ie),p.push({node:me,eventType:S,handler:G,options:ie})})}function wi(){_()&&(Xn("touchstart",yo,{passive:!0}),Xn("touchend",Gs,{passive:!0})),sP(v.props.trigger).forEach(function(S){if(S!=="manual")switch(Xn(S,yo),S){case"mouseenter":Xn("mouseleave",Gs);break;case"focus":Xn(bP?"focusout":"blur",bo);break;case"focusin":Xn("focusout",bo);break}})}function Us(){p.forEach(function(S){var G=S.node,ie=S.eventType,ye=S.handler,me=S.options;G.removeEventListener(ie,ye,me)}),p=[]}function yo(S){var G,ie=!1;if(!(!v.state.isEnabled||ko(S)||a)){var ye=((G=c)==null?void 0:G.type)==="focus";c=S,m=S.currentTarget,Ie(),!v.state.isVisible&&cP(S)&&Ca.forEach(function(me){return me(S)}),S.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||s)&&v.props.hideOnClick!==!1&&v.state.isVisible?ie=!0:wo(S),S.type==="click"&&(s=!ie),ie&&!ye&&Ir(S)}}function Ks(S){var G=S.target,ie=$().contains(G)||x.contains(G);if(!(S.type==="mousemove"&&ie)){var ye=Zn().concat(x).map(function(me){var ct,Pt=me._tippy,xi=(ct=Pt.popperInstance)==null?void 0:ct.state;return xi?{popperRect:me.getBoundingClientRect(),popperState:xi,props:n}:null}).filter(Boolean);fP(ye,S)&&(An(),Ir(S))}}function Gs(S){var G=ko(S)||v.props.trigger.indexOf("click")>=0&&s;if(!G){if(v.props.interactive){v.hideWithInteractivity(S);return}Ir(S)}}function bo(S){v.props.trigger.indexOf("focusin")<0&&S.target!==$()||v.props.interactive&&S.relatedTarget&&x.contains(S.relatedTarget)||Ir(S)}function ko(S){return fn.isTouch?_()!==S.type.indexOf("touch")>=0:!1}function Js(){Ys();var S=v.props,G=S.popperOptions,ie=S.placement,ye=S.offset,me=S.getReferenceClientRect,ct=S.moveTransition,Pt=N()?Qd(x).arrow:null,xi=me?{getBoundingClientRect:me,contextElement:me.contextElement||$()}:t,ta={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(na){var Ei=na.state;if(N()){var Dk=q(),Ku=Dk.box;["placement","reference-hidden","escaped"].forEach(function(ra){ra==="placement"?Ku.setAttribute("data-placement",Ei.placement):Ei.attributes.popper["data-popper-"+ra]?Ku.setAttribute("data-"+ra,""):Ku.removeAttribute("data-"+ra)}),Ei.attributes.popper={}}}},Nr=[{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:!ct}},ta];N()&&Pt&&Nr.push({name:"arrow",options:{element:Pt,padding:3}}),Nr.push.apply(Nr,G?.modifiers||[]),v.popperInstance=rP(xi,x,Object.assign({},G,{placement:ie,onFirstUpdate:h,modifiers:Nr}))}function Ys(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function Mn(){var S=v.props.appendTo,G,ie=$();v.props.interactive&&S===tk||S==="parent"?G=ie.parentNode:G=nk(S,[ie]),G.contains(x)||G.appendChild(x),v.state.isMounted=!0,Js()}function Zn(){return Al(x.querySelectorAll("[data-tippy-root]"))}function wo(S){v.clearDelayTimeouts(),S&&fe("onTrigger",[v,S]),Rt();var G=K(!0),ie=A(),ye=ie[0],me=ie[1];fn.isTouch&&ye==="hold"&&me&&(G=me),G?r=setTimeout(function(){v.show()},G):v.show()}function Ir(S){if(v.clearDelayTimeouts(),fe("onUntrigger",[v,S]),!v.state.isVisible){Jn();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(S.type)>=0&&s)){var G=K(!1);G?i=setTimeout(function(){v.state.isVisible&&v.hide()},G):o=requestAnimationFrame(function(){v.hide()})}}function xo(){v.state.isEnabled=!0}function Xs(){v.hide(),v.state.isEnabled=!1}function Zs(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(o)}function Qs(S){if(!v.state.isDestroyed){fe("onBeforeUpdate",[v,S]),Us();var G=v.props,ie=Ig(t,Object.assign({},G,Ag(S),{ignoreAttributes:!0}));v.props=ie,wi(),G.interactiveDebounce!==ie.interactiveDebounce&&(An(),f=Tg(Ks,ie.interactiveDebounce)),G.triggerTarget&&!ie.triggerTarget?Li(G.triggerTarget).forEach(function(ye){ye.removeAttribute("aria-expanded")}):ie.triggerTarget&&t.removeAttribute("aria-expanded"),Ie(),X(),C&&C(G,ie),v.popperInstance&&(Js(),Zn().forEach(function(ye){requestAnimationFrame(ye._tippy.popperInstance.forceUpdate)})),fe("onAfterUpdate",[v,S])}}function ea(S){v.setProps({content:S})}function Tk(){var S=v.state.isVisible,G=v.state.isDestroyed,ie=!v.state.isEnabled,ye=fn.isTouch&&!v.props.touch,me=Fc(v.props.duration,0,Zt.duration);if(!(S||G||ie||ye)&&!$().hasAttribute("disabled")&&(fe("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,N()&&(x.style.visibility="visible"),X(),Rt(),v.state.isMounted||(x.style.transition="none"),N()){var ct=q(),Pt=ct.box,xi=ct.content;Lc([Pt,xi],0)}h=function(){var ta;if(!(!v.state.isVisible||u)){if(u=!0,x.offsetHeight,x.style.transition=v.props.moveTransition,N()&&v.props.animation){var Nr=q(),na=Nr.box,Ei=Nr.content;Lc([na,Ei],me),Mg([na,Ei],"visible")}Ee(),Ie(),Og(Vc,v),(ta=v.popperInstance)==null||ta.forceUpdate(),fe("onMount",[v]),v.props.animation&&N()&&Yn(me,function(){v.state.isShown=!0,fe("onShown",[v])})}},Mn()}}function Ok(){var S=!v.state.isVisible,G=v.state.isDestroyed,ie=!v.state.isEnabled,ye=Fc(v.props.duration,1,Zt.duration);if(!(S||G||ie)&&(fe("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,u=!1,s=!1,N()&&(x.style.visibility="hidden"),An(),Jn(),X(!0),N()){var me=q(),ct=me.box,Pt=me.content;v.props.animation&&(Lc([ct,Pt],ye),Mg([ct,Pt],"hidden"))}Ee(),Ie(),v.props.animation?N()&&Dr(ye,v.unmount):v.unmount()}}function Ak(S){j().addEventListener("mousemove",f),Og(Ca,f),f(S)}function Mk(){v.state.isVisible&&v.hide(),v.state.isMounted&&(Ys(),Zn().forEach(function(S){S._tippy.unmount()}),x.parentNode&&x.parentNode.removeChild(x),Vc=Vc.filter(function(S){return S!==v}),v.state.isMounted=!1,fe("onHidden",[v]))}function _k(){!v.state.isDestroyed&&(v.clearDelayTimeouts(),v.unmount(),Us(),delete t._tippy,v.state.isDestroyed=!0,fe("onDestroy",[v]))}}function vo(t,e){e===void 0&&(e={});var n=Zt.plugins.concat(e.plugins||[]);vP();var r=Object.assign({},e,{plugins:n}),i=pP(t),o=i.reduce(function(s,a){var l=a&&OP(a,r);return l&&s.push(l),s},[]);return Wu(t)?o[0]:o}vo.defaultProps=Zt;vo.setDefaultProps=EP;vo.currentInput=fn;Object.assign({},q0,{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)}});vo.setDefaultProps({render:ok});class AP{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&&Eh(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:b}=g,y=Math.min(...b.map(v=>v.$from.pos)),k=Math.max(...b.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:y,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($0(f.selection)){let v=a.nodeDOM(y);if(v){const w=v.dataset.nodeViewWrapper?v:v.querySelector("[data-node-view-wrapper]");if(w&&(v=w.firstChild),v)return v.getBoundingClientRect()}}return j0(a,y,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=vo(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 MP=t=>new $e({key:typeof t.pluginKey=="string"?new ut(t.pluginKey):t.pluginKey,view:e=>new AP({view:e,...t})});Ge.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[MP({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class _P{getTextContent(e){return B0(e,{textSerializers:wh(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=vo(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)||(()=>j0(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 DP=t=>new $e({key:typeof t.pluginKey=="string"?new ut(t.pluginKey):t.pluginKey,view:e=>new _P({view:e,...t})});Ge.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[DP({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});function Pg(t){return hp((e,n)=>({get(){return e(),t},set(r){t=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class IP extends XN{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=Pg(this.view.state),this.reactiveExtensionStorage=Pg(this.extensionStorage),this.on("beforeTransaction",({nextState:n})=>{this.reactiveState.value=n,this.reactiveExtensionStorage.value=this.extensionStorage}),Ma(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 NP=Q({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=z(),n=bp();return fp(()=>{const r=t.editor;r&&r.options.element&&e.value&&xr(()=>{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()})}),hi(()=>{const r=t.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return us("div",{ref:t=>{this.rootEl=t}})}}),RP=(t={})=>{const e=It();return Tn(()=>{e.value=new IP(t)}),hi(()=>{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},PP="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",FP="ελ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",mo=(t,e)=>{for(const n in e)t[n]=e[n];return t},ep="numeric",tp="ascii",np="alpha",ns="asciinumeric",jo="alphanumeric",rp="domain",sk="emoji",LP="scheme",BP="slashscheme",$c="whitespace";function VP(t,e){return t in e||(e[t]=[]),e[t]}function Ur(t,e,n){e[ep]&&(e[ns]=!0,e[jo]=!0),e[tp]&&(e[ns]=!0,e[np]=!0),e[ns]&&(e[jo]=!0),e[np]&&(e[jo]=!0),e[jo]&&(e[rp]=!0),e[sk]&&(e[rp]=!0);for(const r in e){const i=VP(r,n);i.indexOf(t)<0&&i.push(t)}}function $P(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function yt(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}yt.groups={};yt.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||yt.groups;let i;return e&&e.j?i=e:(i=new yt(e),n&&r&&Ur(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||yt.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 yt,mo(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new yt,o){if(r)if(s.t&&typeof s.t=="string"){const l=mo($P(s.t,r),n);Ur(o,l,r)}else n&&Ur(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),Ae=(t,e,n,r,i)=>t.tr(e,n,r,i),Fg=(t,e,n,r,i)=>t.ts(e,n,r,i),R=(t,e,n,r,i)=>t.tt(e,n,r,i),Rn="WORD",ip="UWORD",ak="ASCIINUMERICAL",lk="ALPHANUMERICAL",As="LOCALHOST",op="TLD",sp="UTLD",qa="SCHEME",Bi="SLASH_SCHEME",Ph="NUM",ap="WS",Fh="NL",rs="OPENBRACE",is="CLOSEBRACE",Ml="OPENBRACKET",_l="CLOSEBRACKET",Dl="OPENPAREN",Il="CLOSEPAREN",Nl="OPENANGLEBRACKET",Rl="CLOSEANGLEBRACKET",Pl="FULLWIDTHLEFTPAREN",Fl="FULLWIDTHRIGHTPAREN",Ll="LEFTCORNERBRACKET",Bl="RIGHTCORNERBRACKET",Vl="LEFTWHITECORNERBRACKET",$l="RIGHTWHITECORNERBRACKET",jl="FULLWIDTHLESSTHAN",zl="FULLWIDTHGREATERTHAN",Hl="AMPERSAND",ql="APOSTROPHE",Wl="ASTERISK",rr="AT",Ul="BACKSLASH",Kl="BACKTICK",Gl="CARET",ar="COLON",Lh="COMMA",Jl="DOLLAR",cn="DOT",Yl="EQUALS",Bh="EXCLAMATION",Lt="HYPHEN",ss="PERCENT",Xl="PIPE",Zl="PLUS",Ql="POUND",as="QUERY",Vh="QUOTE",uk="FULLWIDTHMIDDLEDOT",$h="SEMI",dn="SLASH",ls="TILDE",eu="UNDERSCORE",ck="EMOJI",tu="SYM";var dk=Object.freeze({__proto__:null,ALPHANUMERICAL:lk,AMPERSAND:Hl,APOSTROPHE:ql,ASCIINUMERICAL:ak,ASTERISK:Wl,AT:rr,BACKSLASH:Ul,BACKTICK:Kl,CARET:Gl,CLOSEANGLEBRACKET:Rl,CLOSEBRACE:is,CLOSEBRACKET:_l,CLOSEPAREN:Il,COLON:ar,COMMA:Lh,DOLLAR:Jl,DOT:cn,EMOJI:ck,EQUALS:Yl,EXCLAMATION:Bh,FULLWIDTHGREATERTHAN:zl,FULLWIDTHLEFTPAREN:Pl,FULLWIDTHLESSTHAN:jl,FULLWIDTHMIDDLEDOT:uk,FULLWIDTHRIGHTPAREN:Fl,HYPHEN:Lt,LEFTCORNERBRACKET:Ll,LEFTWHITECORNERBRACKET:Vl,LOCALHOST:As,NL:Fh,NUM:Ph,OPENANGLEBRACKET:Nl,OPENBRACE:rs,OPENBRACKET:Ml,OPENPAREN:Dl,PERCENT:ss,PIPE:Xl,PLUS:Zl,POUND:Ql,QUERY:as,QUOTE:Vh,RIGHTCORNERBRACKET:Bl,RIGHTWHITECORNERBRACKET:$l,SCHEME:qa,SEMI:$h,SLASH:dn,SLASH_SCHEME:Bi,SYM:tu,TILDE:ls,TLD:op,UNDERSCORE:eu,UTLD:sp,UWORD:ip,WORD:Rn,WS:ap});const Dn=/[a-z]/,Mo=/\p{L}/u,jc=/\p{Emoji}/u,In=/\d/,zc=/\s/,Lg="\r",Hc=`
97
+ `,jP="️",zP="‍",qc="";let Sa=null,Ta=null;function HP(t=[]){const e={};yt.groups=e;const n=new yt;Sa==null&&(Sa=Bg(PP)),Ta==null&&(Ta=Bg(FP)),R(n,"'",ql),R(n,"{",rs),R(n,"}",is),R(n,"[",Ml),R(n,"]",_l),R(n,"(",Dl),R(n,")",Il),R(n,"<",Nl),R(n,">",Rl),R(n,"(",Pl),R(n,")",Fl),R(n,"「",Ll),R(n,"」",Bl),R(n,"『",Vl),R(n,"』",$l),R(n,"<",jl),R(n,">",zl),R(n,"&",Hl),R(n,"*",Wl),R(n,"@",rr),R(n,"`",Kl),R(n,"^",Gl),R(n,":",ar),R(n,",",Lh),R(n,"$",Jl),R(n,".",cn),R(n,"=",Yl),R(n,"!",Bh),R(n,"-",Lt),R(n,"%",ss),R(n,"|",Xl),R(n,"+",Zl),R(n,"#",Ql),R(n,"?",as),R(n,'"',Vh),R(n,"/",dn),R(n,";",$h),R(n,"~",ls),R(n,"_",eu),R(n,"\\",Ul),R(n,"・",uk);const r=Ae(n,In,Ph,{[ep]:!0});Ae(r,In,r);const i=Ae(r,Dn,ak,{[ns]:!0}),o=Ae(r,Mo,lk,{[jo]:!0}),s=Ae(n,Dn,Rn,{[tp]:!0});Ae(s,In,i),Ae(s,Dn,s),Ae(i,In,i),Ae(i,Dn,i);const a=Ae(n,Mo,ip,{[np]:!0});Ae(a,Dn),Ae(a,In,o),Ae(a,Mo,a),Ae(o,In,o),Ae(o,Dn),Ae(o,Mo,o);const l=R(n,Hc,Fh,{[$c]:!0}),u=R(n,Lg,ap,{[$c]:!0}),c=Ae(n,zc,ap,{[$c]:!0});R(n,qc,c),R(u,Hc,l),R(u,qc,c),Ae(u,zc,c),R(c,Lg),R(c,Hc),Ae(c,zc,c),R(c,qc,c);const d=Ae(n,jc,ck,{[sk]:!0});R(d,"#"),Ae(d,jc,d),R(d,jP,d);const h=R(d,zP);R(h,"#"),Ae(h,jc,d);const p=[[Dn,s],[In,i]],f=[[Dn,null],[Mo,a],[In,o]];for(let m=0;m<Sa.length;m++)Qn(n,Sa[m],op,Rn,p);for(let m=0;m<Ta.length;m++)Qn(n,Ta[m],sp,ip,f);Ur(op,{tld:!0,ascii:!0},e),Ur(sp,{utld:!0,alpha:!0},e),Qn(n,"file",qa,Rn,p),Qn(n,"mailto",qa,Rn,p),Qn(n,"http",Bi,Rn,p),Qn(n,"https",Bi,Rn,p),Qn(n,"ftp",Bi,Rn,p),Qn(n,"ftps",Bi,Rn,p),Ur(qa,{scheme:!0,ascii:!0},e),Ur(Bi,{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],b=t[m][1]?{[LP]:!0}:{[BP]:!0};g.indexOf("-")>=0?b[rp]=!0:Dn.test(g)?In.test(g)?b[ns]=!0:b[tp]=!0:b[ep]=!0,Fg(n,g,g,b)}return Fg(n,"localhost",As,{ascii:!0}),n.jd=new yt(tu),{start:n,tokens:mo({groups:e},dk)}}function pk(t,e){const n=qP(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 qP(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 Qn(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 yt(r),o.jr=i.slice(),t.j[l]=o),t=o}return o=new yt(n),o.jr=i.slice(),t.j[e[s-1]]=o,o}function Bg(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 Ms={defaultProtocol:"http",events:null,format:Vg,formatHref:Vg,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function jh(t,e=null){let n=mo({},Ms);t&&(n=mo(n,t instanceof jh?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}jh.prototype={o:Ms,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]:Ms[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 Vg(t){return t}function hk(t,e){this.t="token",this.v=t,this.tk=e}hk.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=Ms.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&&mo(s,c),{tagName:i,attributes:s,content:o,eventListeners:d}}};function Uu(t,e){class n extends hk{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 $g=Uu("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),jg=Uu("text"),WP=Uu("nl"),Oa=Uu("url",{isLink:!0,toHref(t=Ms.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==As&&t[1].t===ar}}),Ft=t=>new yt(t);function UP({groups:t}){const e=t.domain.concat([Hl,Wl,rr,Ul,Kl,Gl,Jl,Yl,Lt,Ph,ss,Xl,Zl,Ql,dn,tu,ls,eu]),n=[ql,ar,Lh,cn,Bh,ss,as,Vh,$h,Nl,Rl,rs,is,_l,Ml,Dl,Il,Pl,Fl,Ll,Bl,Vl,$l,jl,zl],r=[Hl,ql,Wl,Ul,Kl,Gl,Jl,Yl,Lt,rs,is,ss,Xl,Zl,Ql,as,dn,tu,ls,eu],i=Ft(),o=R(i,ls);ce(o,r,o),ce(o,t.domain,o);const s=Ft(),a=Ft(),l=Ft();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=R(s,rr);R(o,rr,u),R(a,rr,u),R(l,rr,u);const c=R(o,cn);ce(c,r,o),ce(c,t.domain,o);const d=Ft();ce(u,t.domain,d),ce(d,t.domain,d);const h=R(d,cn);ce(h,t.domain,d);const p=Ft($g);ce(h,t.tld,p),ce(h,t.utld,p),R(u,As,p);const f=R(d,Lt);R(f,Lt,f),ce(f,t.domain,d),ce(p,t.domain,d),R(p,cn,h),R(p,Lt,f);const m=R(p,ar);ce(m,t.numeric,$g);const g=R(s,Lt),b=R(s,cn);R(g,Lt,g),ce(g,t.domain,s),ce(b,r,o),ce(b,t.domain,s);const y=Ft(Oa);ce(b,t.tld,y),ce(b,t.utld,y),ce(y,t.domain,s),ce(y,r,o),R(y,cn,b),R(y,Lt,g),R(y,rr,u);const k=R(y,ar),v=Ft(Oa);ce(k,t.numeric,v);const w=Ft(Oa),x=Ft();ce(w,e,w),ce(w,n,x),ce(x,e,w),ce(x,n,x),R(y,dn,w),R(v,dn,w);const C=R(a,ar),M=R(l,ar),T=R(M,dn),A=R(T,dn);ce(a,t.domain,s),R(a,cn,b),R(a,Lt,g),ce(l,t.domain,s),R(l,cn,b),R(l,Lt,g),ce(C,t.domain,w),R(C,dn,w),R(C,as,w),ce(A,t.domain,w),ce(A,e,w),R(A,dn,w);const _=[[rs,is],[Ml,_l],[Dl,Il],[Nl,Rl],[Pl,Fl],[Ll,Bl],[Vl,$l],[jl,zl]];for(let N=0;N<_.length;N++){const[$,j]=_[N],q=R(w,$);R(x,$,q),R(q,j,w);const K=Ft(Oa);ce(q,e,K);const X=Ft();ce(q,n),ce(K,e,K),ce(K,n,X),ce(X,e,K),ce(X,n,X),R(K,j,w),R(X,j,w)}return R(i,As,y),R(i,Fh,WP),{start:i,tokens:dk}}function KP(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(Wc(jg,e,s)),s=[]),i-=h,c-=h;const p=d.t,f=n.slice(i-c,i);o.push(Wc(p,e,f))}}return s.length>0&&o.push(Wc(jg,e,s)),o}function Wc(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 GP=typeof console<"u"&&console&&console.warn||(()=>{}),JP="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",xe={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function YP(){return yt.groups={},xe.scanner=null,xe.parser=null,xe.tokenQueue=[],xe.pluginQueue=[],xe.customSchemes=[],xe.initialized=!1,xe}function zg(t,e=!1){if(xe.initialized&&GP(`linkifyjs: already initialized - will not register custom scheme "${t}" ${JP}`),!/^[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 LP(){we.scanner=MP(we.customSchemes);for(let t=0;t<we.tokenQueue.length;t++)we.tokenQueue[t][1]({scanner:we.scanner});we.parser=IP(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 Bh(t){return we.initialized||LP(),NP(we.parser.start,t,sk(we.scanner.start,t))}Bh.scan=sk;function lk(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 Lh(n),i=Bh(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 BP(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function VP(t){return new $e({key:new lt("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=ZI(n.doc,[...e]);if(oN(a).forEach(({newRange:l})=>{const u=eN(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=Bh(p).map(g=>g.toObject(t.defaultProtocol));if(!BP(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=>{xh(g.from,g.to,r.doc).some(b=>b.mark.type===t.type)||s.addMark(g.from,g.to,t.type.create({href:g.href}))})}}),!!s.steps.length)return s}})}function $P(t){return new $e({key:new lt("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=N0(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 jP(t){return new $e({key:new lt("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=lk(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 zP=/[\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(zP,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const HP=Wn.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"){Lg(t);return}Lg(t.scheme,t.optionalSlashes)})},onDestroy(){FP()},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[ci({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=lk(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(VP({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($P({type:this.type})),this.options.linkOnPaste&&t.push(jP({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),qP=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 $e({key:new lt("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&&ju(s);if((l||!this.options.showOnlyCurrent)&&u){const c=[this.options.emptyNodeClass];o&&c.push(this.options.emptyEditorClass);const d=At.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}),Fe.create(t,i)}}})]}}),WP=/^\s*>\s$/,UP=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[Cs({find:WP,type:this.type})]}}),KP=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,GP=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,JP=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,YP=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,XP=Wn.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[lo({find:KP,type:this.type}),lo({find:JP,type:this.type})]},addPasteRules(){return[ci({find:GP,type:this.type}),ci({find:YP,type:this.type})]}}),ZP="listItem",Bg="textStyle",Vg=/^\s*([-+*])\s$/,QP=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(ZP,this.editor.getAttributes(Bg)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Cs({find:Vg,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Cs({find:Vg,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Bg),editor:this.editor})),[t]}}),eF=/(^|[^`])`([^`]+)`(?!`)/,tF=/(^|[^`])`([^`]+)`(?!`)/g,nF=Wn.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[lo({find:eF,type:this.type})]},addPasteRules(){return[ci({find:tF,type:this.type})]}}),rF=/^```([a-z]+)?[\s\n]$/,iF=/^~~~([a-z]+)?[\s\n]$/,oF=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(`
100
+ 3. "-" cannot repeat`);xe.customSchemes.push([t,e])}function XP(){xe.scanner=HP(xe.customSchemes);for(let t=0;t<xe.tokenQueue.length;t++)xe.tokenQueue[t][1]({scanner:xe.scanner});xe.parser=UP(xe.scanner.tokens);for(let t=0;t<xe.pluginQueue.length;t++)xe.pluginQueue[t][1]({scanner:xe.scanner,parser:xe.parser});return xe.initialized=!0,xe}function zh(t){return xe.initialized||XP(),KP(xe.parser.start,t,pk(xe.scanner.start,t))}zh.scan=pk;function fk(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 jh(n),i=zh(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 ZP(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function QP(t){return new $e({key:new ut("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=pN(n.doc,[...e]);if(bN(a).forEach(({newRange:l})=>{const u=fN(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=zh(p).map(g=>g.toObject(t.defaultProtocol));if(!ZP(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=>{Th(g.from,g.to,r.doc).some(b=>b.mark.type===t.type)||s.addMark(g.from,g.to,t.type.create({href:g.href}))})}}),!!s.steps.length)return s}})}function eF(t){return new $e({key:new ut("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=V0(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 tF(t){return new $e({key:new ut("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=fk(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 nF=/[\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(nF,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const rF=Wn.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"){zg(t);return}zg(t.scheme,t.optionalSlashes)})},onDestroy(){YP()},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",tt(this.options.HTMLAttributes,t),0]:["a",tt(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[di({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=fk(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(QP({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(eF({type:this.type})),this.options.linkOnPaste&&t.push(tF({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),iF=Ge.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new $e({key:new ut("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&&Hu(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}),Fe.create(t,i)}}})]}}),oF=/^\s*>\s$/,sF=on.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",tt(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[Ss({find:oF,type:this.type})]}}),aF=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,lF=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,uF=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,cF=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,dF=Wn.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",tt(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[uo({find:aF,type:this.type}),uo({find:uF,type:this.type})]},addPasteRules(){return[di({find:lF,type:this.type}),di({find:cF,type:this.type})]}}),pF="listItem",Hg="textStyle",qg=/^\s*([-+*])\s$/,hF=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",tt(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(pF,this.editor.getAttributes(Hg)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Ss({find:qg,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ss({find:qg,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Hg),editor:this.editor})),[t]}}),fF=/(^|[^`])`([^`]+)`(?!`)/,mF=/(^|[^`])`([^`]+)`(?!`)/g,gF=Wn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",tt(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[uo({find:fF,type:this.type})]},addPasteRules(){return[di({find:mF,type:this.type})]}}),vF=/^```([a-z]+)?[\s\n]$/,yF=/^~~~([a-z]+)?[\s\n]$/,bF=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",tt(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(ue.near(r.resolve(s))),!0)):t.commands.exitCode()}}},addInputRules(){return[qd({find:rF,type:this.type,getAttributes:t=>({language:t[1]})}),qd({find:iF,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new $e({key:new lt("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(ae.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),sF=on.create({name:"doc",topNode:!0,content:"block+"});function aF(t={}){return new $e({view(e){return new lF(e,t)}})}class lF{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,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,a=o.height/i.offsetHeight;if(n){let d=e.nodeBefore,h=e.nodeAfter;if(d||h){let p=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(p){let f=p.getBoundingClientRect(),m=d?f.bottom:f.top;d&&h&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;r={left:f.left,right:f.right,top:m-g,bottom:m+g}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*s;r={left:d.left-h,right:d.left+h,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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 u,c;if(!l||l==document.body&&getComputedStyle(l).position=="static")u=-pageXOffset,c=-pageYOffset;else{let d=l.getBoundingClientRect(),h=d.width/l.offsetWidth,p=d.height/l.offsetHeight;u=d.left-l.scrollLeft*h,c=d.top-l.scrollTop*p}this.element.style.left=(r.left-u)/s+"px",this.element.style.top=(r.top-c)/a+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let 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=_b(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){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const uF=Ke.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[aF(this.options)]}});class De extends ue{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return De.valid(r)?new De(r):ue.near(r)}content(){return V.empty}eq(e){return e instanceof De&&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 De(e.resolve(n.pos))}getBookmark(){return new Vh(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!cF(e)||!dF(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&&De.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(De.valid(l))return l}for(;;){let s=n>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!Z.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(De.valid(a))return a}return null}}}De.prototype.visible=!1;De.findFrom=De.findGapCursorFrom;ue.jsonID("gapcursor",De);class Vh{constructor(e){this.pos=e}map(e){return new Vh(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return De.valid(n)?new De(n):ue.near(n)}}function cF(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 dF(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 pF(){return new $e({props:{decorations:gF,createSelectionBetween(t,e,n){return e.pos==n.pos&&De.valid(n)?new De(n):null},handleClick:fF,handleKeyDown:hF,handleDOMEvents:{beforeinput:mF}}})}const hF=v0({ArrowLeft:Sa("horiz",-1),ArrowRight:Sa("horiz",1),ArrowUp:Sa("vert",-1),ArrowDown:Sa("vert",1)});function Sa(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 ae){if(!o.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let u=De.findGapCursorFrom(a,e,l);return u?(i&&i(r.tr.setSelection(new De(u))),!0):!1}}function fF(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!De.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Z.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new De(r))),!0)}function mF(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof De))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=D.empty;for(let s=r.length-1;s>=0;s--)i=D.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new V(i,0,0));return o.setSelection(ae.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function gF(t){if(!(t.selection instanceof De))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Fe.create(t.doc,[At.widget(t.selection.head,e,{key:"gapcursor"})])}const vF=Ke.create({name:"gapCursor",addProseMirrorPlugins(){return[pF()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=pe(W(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),yF=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()}}}),bF=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=>qd({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var eu=200,We=function(){};We.prototype.append=function(t){return t.length?(t=We.from(t),!this.length&&t||t.length<eu&&this.leafAppend(t)||this.length<eu&&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 kF(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 uk(t):We.empty};var uk=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<=eu)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=eu)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 uk([]);var kF=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 wF=500;class Gt{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 Gt(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>EF&&(a=xF(a,u),s-=u),new Gt(a.append(o),s)}remapping(e,n){let r=new ys;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 Gt(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 Gt(c,a);return d.emptyItemCount()>wF&&(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 Gt(We.from(i.reverse()),o)}}Gt.empty=new Gt(We.empty,0);function xF(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 ir{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const EF=20;function CF(t,e,n,r){let i=n.getMeta(ei),o;if(i)return i.historyState;n.getMeta(OF)&&(t=new ir(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 ir(t.done.addTransform(n,void 0,r,Ha(e)),t.undone,$g(n.mapping.maps),t.prevTime,t.prevComposition):new ir(t.done,t.undone.addTransform(n,void 0,r,Ha(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||!SF(n,t.prevRanges)),u=s?zc(t.prevRanges,n.mapping):$g(n.mapping.maps);return new ir(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Ha(e)),Gt.empty,u,n.time,a??t.prevComposition)}else return(o=n.getMeta("rebased"))?new ir(t.done.rebased(n,o),t.undone.rebased(n,o),zc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new ir(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),zc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function SF(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 $g(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 zc(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 TF(t,e,n){let r=Ha(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 ir(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(s).setMeta(ei,{redo:n,historyState:l})}let Hc=!1,jg=null;function Ha(t){let e=t.plugins;if(jg!=e){Hc=!1,jg=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Hc=!0;break}}return Hc}const ei=new lt("history"),OF=new lt("closeHistory");function AF(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new $e({key:ei,state:{init(){return new ir(Gt.empty,Gt.empty,null,0,-1)},apply(e,n,r){return CF(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?dk:r=="historyRedo"?pk:null;return i?(n.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function ck(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=TF(i,n,t);o&&r(o.scrollIntoView())}return!0}}const dk=ck(!1),pk=ck(!0),MF=Ke.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>dk(t,e),redo:()=>({state:t,dispatch:e})=>pk(t,e)}},addProseMirrorPlugins(){return[AF(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()}}}),_F=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}):R0(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(ae.create(s.doc,u.pos+1)):u.nodeAfter.isBlock?s.setSelection(Z.create(s.doc,u.pos)):s.setSelection(ae.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(ae.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[BN({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),DF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,IF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,NF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,RF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,PF=Wn.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[lo({find:DF,type:this.type}),lo({find:NF,type:this.type})]},addPasteRules(){return[ci({find:IF,type:this.type}),ci({find:RF,type:this.type})]}}),FF=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)}}}),LF="listItem",zg="textStyle",Hg=/^(\d+)\.\s$/,BF=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:null,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(LF,this.editor.getAttributes(zg)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Cs({find:Hg,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=Cs({find:Hg,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(zg)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),VF=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()}}}),$F=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,jF=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,zF=Wn.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[lo({find:$F,type:this.type})]},addPasteRules(){return[ci({find:jF,type:this.type})]}}),HF=on.create({name:"text",group:"inline"}),qF=Ke.create({name:"starterKit",addExtensions(){var t,e,n,r,i,o,s,a,l,u,c,d,h,p,f,m,g,b;const y=[];return this.options.bold!==!1&&y.push(XP.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&y.push(UP.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&y.push(QP.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&y.push(nF.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&y.push(oF.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&y.push(sF.configure((o=this.options)===null||o===void 0?void 0:o.document)),this.options.dropcursor!==!1&&y.push(uF.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&y.push(vF.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&y.push(yF.configure((l=this.options)===null||l===void 0?void 0:l.hardBreak)),this.options.heading!==!1&&y.push(bF.configure((u=this.options)===null||u===void 0?void 0:u.heading)),this.options.history!==!1&&y.push(MF.configure((c=this.options)===null||c===void 0?void 0:c.history)),this.options.horizontalRule!==!1&&y.push(_F.configure((d=this.options)===null||d===void 0?void 0:d.horizontalRule)),this.options.italic!==!1&&y.push(PF.configure((h=this.options)===null||h===void 0?void 0:h.italic)),this.options.listItem!==!1&&y.push(FF.configure((p=this.options)===null||p===void 0?void 0:p.listItem)),this.options.orderedList!==!1&&y.push(BF.configure((f=this.options)===null||f===void 0?void 0:f.orderedList)),this.options.paragraph!==!1&&y.push(VF.configure((m=this.options)===null||m===void 0?void 0:m.paragraph)),this.options.strike!==!1&&y.push(zF.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&y.push(HF.configure((b=this.options)===null||b===void 0?void 0:b.text)),y}}),WF={class:"k-richtext__menu"},NL=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=kP({extensions:[qF,qP.configure({placeholder:n.placeholder}),HP.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=I(()=>!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 xe(()=>n.modelValue,()=>{if(i.value&&i.value.getHTML()!==n.modelValue)return i.value.commands.setContent(n.modelValue)}),(a,l)=>(E(),O("div",{class:Se(B(s)({disabled:a.disabled}))},[U("div",WF,[he(Zy,{class:"k-richtext__menu-group",modelValue:[],multiple:!0},{default:ee(({getItemProps:u})=>[(E(!0),O(Oe,null,Mt(o.value,c=>(E(),z(He,{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(bP),{editor:B(i),class:"k-richtext__editor"},null,8,["editor"])],2))}});function UF(t){return t%4===0&&t%100!==0||t%400===0}function KF(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(UF(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 Nn(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"||!KF(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 tu={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 Nn(t)},present:function(t){return typeof t<"u"},after:function(t,e){var n=this.validator.input[e],r=t;return!Nn(n)||!Nn(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!Nn(n)||!Nn(r)?!1:new Date(n).getTime()<=new Date(r).getTime()},before:function(t,e){var n=this.validator.input[e],r=t;return!Nn(n)||!Nn(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!Nn(n)||!Nn(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 tu.ipv4(t,e,n)||tu.ipv6(t,e,n)}},hk=function(){throw new Error("Validator `"+this.name+"` is not defined!")},fk;function mk(t,e,n){this.name=t,this.fn=e,this.passes=null,this._customMessage=void 0,this.async=n}mk.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()?hk: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()?fk:this._customMessage}};var GF={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 mk(t,tu[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){tu[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){hk=t,fk=e}},JF=GF;function YF(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 XF={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 ZF(t){return t.replace(/[_\[]/g," ").replace(/]/g,"")}var gk={replacements:XF,formatter:ZF},qg=gk,ip=function(t,e){this.lang=t,this.messages=e,this.customMessages={},this.attributeNames={}};ip.prototype={constructor:ip,_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 qg.replacements[t.name]?n=qg.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 QF=ip,eL={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 tL=Eu(eL);var nL=QF,rL=YF,iL={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=rL("./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 nL(t,this.messages[t])}},vk=iL;const yk=Eu(vk);var op=function(){this.errors={}};op.prototype={constructor:op,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 oL=op;function bk(t,e){this.onResolvedAll=e,this.onFailedOne=t,this.resolvers={},this.resolversCount=0,this.passed=[],this.failed=[],this.firing=!1}bk.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 sL=bk,wr=JF,bi=vk,aL=oL,lL=gk,uL=sL,Ve=function(t,e,n){var r=Ve.getDefaultLang();this.input=t||{},this.messages=bi._make(r),this.messages._setCustom(n),this.setAttributeFormatter(Ve.prototype.attributeFormatter),this.errors=new aL,this.errorCount=0,this.hasAsync=!1,this.rules=this._parseRules(e)};Ve.prototype={constructor:Ve,lang:"en",numericRules:["integer","numeric"],attributeFormatter:lL.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 uL(r,i),s=function(f,m,g,b){return function(){var y=o.add(b);b.validate(f,m.value,g,function(){o.resolve(y)})}};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)),wr.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)||wr.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 wr.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}};Ve.setMessages=function(t,e){return bi._set(t,e),this};Ve.getMessages=function(t){return bi._get(t)};Ve.useLang=function(t){this.prototype.lang=t};Ve.getDefaultLang=function(){return this.prototype.lang};Ve.setAttributeFormatter=function(t){this.prototype.attributeFormatter=t};Ve.stopOnError=function(t){this.prototype.stopOnAttributes=t};Ve.register=function(t,e,n,r){var i=Ve.getDefaultLang();wr.register(t,e),bi._setRuleMessage(i,t,n)};Ve.registerImplicit=function(t,e,n,r){var i=Ve.getDefaultLang();wr.registerImplicit(t,e),bi._setRuleMessage(i,t,n)};Ve.registerAsync=function(t,e,n,r){var i=Ve.getDefaultLang();wr.registerAsync(t,e),bi._setRuleMessage(i,t,n)};Ve.registerAsyncImplicit=function(t,e,n){var r=Ve.getDefaultLang();wr.registerAsyncImplicit(t,e),bi._setRuleMessage(r,t,n)};Ve.registerMissedRuleValidator=function(t,e){wr.registerMissedRuleValidator(t,e)};var cL=Ve;const pr=Eu(cL);yk._set("en",tL);pr.useLang("en");const sp=H(!1),dL=t=>{sp.value=!sp.value,yk._set("default",t),pr.useLang("default")},pL=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>{const i=n.split(".").pop();return[n,e(i)]})),ap=(t,e={})=>{const{rule:n="required",prefix:r=""}=e;let i={};return Object.entries(t).forEach(([o,s])=>{const a=r+o;if(Vw(s)){s.map((l,u)=>{i=Object.assign(i,ap(l,{rule:n,prefix:`${a}.${u}.`}))});return}if(Bw(s)){i=Object.assign(i,ap(s,{rule:n,prefix:`${a}.`}));return}i[a]=n}),i},hL=pr.register,fL=pr.registerAsync;function mL(t={}){const{rules:e,labels:n,data:r,customMessages:i,visitImmediate:o=!1}=t;if(i){let m=pr.getMessages("default");Object.entries(i.value).forEach(([g,b])=>m[g]=b),pr.setMessages("default",m)}let s=new pr({},{}),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=H(o?Object.fromEntries(Object.keys(e.value).map(m=>[m,!0])):{}),u=H(!0),c=H(s.errors),d=I(()=>a());function h(m){var g;let b=(g=d.value)==null?void 0:g[m];const y={valid:!0,error:void 0};return!b||!b.visited?y:b}let p=()=>{let m=new pr(r.value,e.value);n&&m.setAttributeNames(n.value);const g=()=>{c.value=s.errors,u.value=!0},b=()=>{u.value=!1,c.value=m.errors};m.checkAsync(g,b)};xe([r,sp],p,{deep:!0,immediate:!0});const f=m=>{if(!m)return!1;const g=typeof m=="string"?m.split("|"):Array.isArray(m)?m:[],b={required:()=>!0,required_if:(y,k)=>r.value[y]===k,required_unless:(y,k)=>r.value[y]!==k,required_with:y=>y.some(k=>k in r.value),required_with_all:y=>y.every(k=>k in r.value),required_without:y=>y.some(k=>!(k in r.value)),required_without_all:y=>y.every(k=>!(k in r.value))};for(const y of g){if(typeof y=="string"){if(y==="required")return b.required;const[k,...v]=y.split(":");if(b[k]){const w=v.map(x=>["true",!0,"false",!1].includes(x)?JSON.parse(x):x);return b[k](...w)}}if(typeof y=="object"){for(const[k,v]of Object.entries(y))if(b[k])return Array.isArray(v)?b[k](...v):b[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 RL=Object.freeze(Object.defineProperty({__proto__:null,default:mL,generateLabels:pL,generateRules:ap,register:hL,registerAsync:fL,setLabels:dL},Symbol.toStringTag,{value:"Module"}));export{NL as $,SL as A,fv as B,kL as E,_L as F,wu as G,OL as I,DL as L,TL as M,AL as N,CL as O,ML as P,WE as S,EL as T,Ze as U,vu as W,ni as _,He as a,pf as b,xL as c,bL as d,IL as e,mL as f,q1 as g,TE as h,vL as m,hT as u,yL as v,Zy as w,wL as x,RL as z};
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(ue.near(r.resolve(s))),!0)):t.commands.exitCode()}}},addInputRules(){return[Gd({find:vF,type:this.type,getAttributes:t=>({language:t[1]})}),Gd({find:yF,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new $e({key:new ut("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(ae.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),kF=on.create({name:"doc",topNode:!0,content:"block+"});function wF(t={}){return new $e({view(e){return new xF(e,t)}})}class xF{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,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,a=o.height/i.offsetHeight;if(n){let d=e.nodeBefore,h=e.nodeAfter;if(d||h){let p=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(p){let f=p.getBoundingClientRect(),m=d?f.bottom:f.top;d&&h&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;r={left:f.left,right:f.right,top:m-g,bottom:m+g}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*s;r={left:d.left-h,right:d.left+h,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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 u,c;if(!l||l==document.body&&getComputedStyle(l).position=="static")u=-pageXOffset,c=-pageYOffset;else{let d=l.getBoundingClientRect(),h=d.width/l.offsetWidth,p=d.height/l.offsetHeight;u=d.left-l.scrollLeft*h,c=d.top-l.scrollTop*p}this.element.style.left=(r.left-u)/s+"px",this.element.style.top=(r.top-c)/a+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let 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=Fb(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){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const EF=Ge.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[wF(this.options)]}});class De extends ue{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return De.valid(r)?new De(r):ue.near(r)}content(){return V.empty}eq(e){return e instanceof De&&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 De(e.resolve(n.pos))}getBookmark(){return new Hh(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!CF(e)||!SF(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&&De.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(De.valid(l))return l}for(;;){let s=n>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!Z.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(De.valid(a))return a}return null}}}De.prototype.visible=!1;De.findFrom=De.findGapCursorFrom;ue.jsonID("gapcursor",De);class Hh{constructor(e){this.pos=e}map(e){return new Hh(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return De.valid(n)?new De(n):ue.near(n)}}function CF(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 SF(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 TF(){return new $e({props:{decorations:_F,createSelectionBetween(t,e,n){return e.pos==n.pos&&De.valid(n)?new De(n):null},handleClick:AF,handleKeyDown:OF,handleDOMEvents:{beforeinput:MF}}})}const OF=E0({ArrowLeft:Aa("horiz",-1),ArrowRight:Aa("horiz",1),ArrowUp:Aa("vert",-1),ArrowDown:Aa("vert",1)});function Aa(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 ae){if(!o.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let u=De.findGapCursorFrom(a,e,l);return u?(i&&i(r.tr.setSelection(new De(u))),!0):!1}}function AF(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!De.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Z.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new De(r))),!0)}function MF(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof De))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=D.empty;for(let s=r.length-1;s>=0;s--)i=D.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new V(i,0,0));return o.setSelection(ae.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function _F(t){if(!(t.selection instanceof De))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Fe.create(t.doc,[Mt.widget(t.selection.head,e,{key:"gapcursor"})])}const DF=Ge.create({name:"gapCursor",addProseMirrorPlugins(){return[TF()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=pe(W(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),IF=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",tt(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()}}}),NF=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]}`,tt(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=>Gd({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var nu=200,Ue=function(){};Ue.prototype.append=function(t){return t.length?(t=Ue.from(t),!this.length&&t||t.length<nu&&this.leafAppend(t)||this.length<nu&&t.leafPrepend(this)||this.appendInner(t)):this};Ue.prototype.prepend=function(t){return t.length?Ue.from(t).append(this):this};Ue.prototype.appendInner=function(t){return new RF(this,t)};Ue.prototype.slice=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.length),t>=e?Ue.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))};Ue.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};Ue.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)};Ue.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};Ue.from=function(t){return t instanceof Ue?t:t&&t.length?new mk(t):Ue.empty};var mk=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<=nu)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=nu)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}(Ue);Ue.empty=new mk([]);var RF=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}(Ue);const PF=500;class Yt{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 Yt(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>LF&&(a=FF(a,u),s-=u),new Yt(a.append(o),s)}remapping(e,n){let r=new bs;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 Yt(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 Yt(c,a);return d.emptyItemCount()>PF&&(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 Yt(Ue.from(i.reverse()),o)}}Yt.empty=new Yt(Ue.empty,0);function FF(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 ir{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const LF=20;function BF(t,e,n,r){let i=n.getMeta(ti),o;if(i)return i.historyState;n.getMeta(jF)&&(t=new ir(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(ti))return s.getMeta(ti).redo?new ir(t.done.addTransform(n,void 0,r,Wa(e)),t.undone,Wg(n.mapping.maps),t.prevTime,t.prevComposition):new ir(t.done,t.undone.addTransform(n,void 0,r,Wa(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||!VF(n,t.prevRanges)),u=s?Uc(t.prevRanges,n.mapping):Wg(n.mapping.maps);return new ir(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Wa(e)),Yt.empty,u,n.time,a??t.prevComposition)}else return(o=n.getMeta("rebased"))?new ir(t.done.rebased(n,o),t.undone.rebased(n,o),Uc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new ir(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Uc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function VF(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 Wg(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 Uc(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 $F(t,e,n){let r=Wa(e),i=ti.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 ir(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(s).setMeta(ti,{redo:n,historyState:l})}let Kc=!1,Ug=null;function Wa(t){let e=t.plugins;if(Ug!=e){Kc=!1,Ug=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Kc=!0;break}}return Kc}const ti=new ut("history"),jF=new ut("closeHistory");function zF(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new $e({key:ti,state:{init(){return new ir(Yt.empty,Yt.empty,null,0,-1)},apply(e,n,r){return BF(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?vk:r=="historyRedo"?yk:null;return i?(n.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function gk(t,e){return(n,r)=>{let i=ti.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=$F(i,n,t);o&&r(o.scrollIntoView())}return!0}}const vk=gk(!1),yk=gk(!0),HF=Ge.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>vk(t,e),redo:()=>({state:t,dispatch:e})=>yk(t,e)}},addProseMirrorPlugins(){return[zF(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()}}}),qF=on.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",tt(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}):$0(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(ae.create(s.doc,u.pos+1)):u.nodeAfter.isBlock?s.setSelection(Z.create(s.doc,u.pos)):s.setSelection(ae.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(ae.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ZN({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),WF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,UF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,KF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,GF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,JF=Wn.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",tt(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[uo({find:WF,type:this.type}),uo({find:KF,type:this.type})]},addPasteRules(){return[di({find:UF,type:this.type}),di({find:GF,type:this.type})]}}),YF=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",tt(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)}}}),XF="listItem",Kg="textStyle",Gg=/^(\d+)\.\s$/,ZF=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:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",tt(this.options.HTMLAttributes,n),0]:["ol",tt(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(XF,this.editor.getAttributes(Kg)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ss({find:Gg,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=Ss({find:Gg,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Kg)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),QF=on.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",tt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),eL=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,tL=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,nL=Wn.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",tt(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[uo({find:eL,type:this.type})]},addPasteRules(){return[di({find:tL,type:this.type})]}}),rL=on.create({name:"text",group:"inline"}),iL=Ge.create({name:"starterKit",addExtensions(){var t,e,n,r,i,o,s,a,l,u,c,d,h,p,f,m,g,b;const y=[];return this.options.bold!==!1&&y.push(dF.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&y.push(sF.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&y.push(hF.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&y.push(gF.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&y.push(bF.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&y.push(kF.configure((o=this.options)===null||o===void 0?void 0:o.document)),this.options.dropcursor!==!1&&y.push(EF.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&y.push(DF.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&y.push(IF.configure((l=this.options)===null||l===void 0?void 0:l.hardBreak)),this.options.heading!==!1&&y.push(NF.configure((u=this.options)===null||u===void 0?void 0:u.heading)),this.options.history!==!1&&y.push(HF.configure((c=this.options)===null||c===void 0?void 0:c.history)),this.options.horizontalRule!==!1&&y.push(qF.configure((d=this.options)===null||d===void 0?void 0:d.horizontalRule)),this.options.italic!==!1&&y.push(JF.configure((h=this.options)===null||h===void 0?void 0:h.italic)),this.options.listItem!==!1&&y.push(YF.configure((p=this.options)===null||p===void 0?void 0:p.listItem)),this.options.orderedList!==!1&&y.push(ZF.configure((f=this.options)===null||f===void 0?void 0:f.orderedList)),this.options.paragraph!==!1&&y.push(QF.configure((m=this.options)===null||m===void 0?void 0:m.paragraph)),this.options.strike!==!1&&y.push(nL.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&y.push(rL.configure((b=this.options)===null||b===void 0?void 0:b.text)),y}}),oL={class:"k-richtext__menu"},KL=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=RP({extensions:[iL,iF.configure({placeholder:n.placeholder}),rF.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=I(()=>!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 we(()=>n.modelValue,()=>{if(i.value&&i.value.getHTML()!==n.modelValue)return i.value.commands.setContent(n.modelValue)}),(a,l)=>(E(),O("div",{class:Se(B(s)({disabled:a.disabled}))},[U("div",oL,[he(ib,{class:"k-richtext__menu-group",modelValue:[],multiple:!0},{default:ee(({getItemProps:u})=>[(E(!0),O(Oe,null,_t(o.value,c=>(E(),H(He,{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(NP),{editor:B(i),class:"k-richtext__editor"},null,8,["editor"])],2))}});function sL(t){return t%4===0&&t%100!==0||t%400===0}function aL(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(sL(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 Nn(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"||!aL(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 ru={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 Nn(t)},present:function(t){return typeof t<"u"},after:function(t,e){var n=this.validator.input[e],r=t;return!Nn(n)||!Nn(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!Nn(n)||!Nn(r)?!1:new Date(n).getTime()<=new Date(r).getTime()},before:function(t,e){var n=this.validator.input[e],r=t;return!Nn(n)||!Nn(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!Nn(n)||!Nn(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 ru.ipv4(t,e,n)||ru.ipv6(t,e,n)}},bk=function(){throw new Error("Validator `"+this.name+"` is not defined!")},kk;function wk(t,e,n){this.name=t,this.fn=e,this.passes=null,this._customMessage=void 0,this.async=n}wk.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()?bk: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()?kk:this._customMessage}};var lL={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 wk(t,ru[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){ru[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){bk=t,kk=e}},uL=lL;function cL(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 dL={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 pL(t){return t.replace(/[_\[]/g," ").replace(/]/g,"")}var xk={replacements:dL,formatter:pL},Jg=xk,lp=function(t,e){this.lang=t,this.messages=e,this.customMessages={},this.attributeNames={}};lp.prototype={constructor:lp,_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 Jg.replacements[t.name]?n=Jg.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 hL=lp,fL={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 mL=Su(fL);var gL=hL,vL=cL,yL={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=vL("./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 gL(t,this.messages[t])}},Ek=yL;const Ck=Su(Ek);var up=function(){this.errors={}};up.prototype={constructor:up,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 bL=up;function Sk(t,e){this.onResolvedAll=e,this.onFailedOne=t,this.resolvers={},this.resolversCount=0,this.passed=[],this.failed=[],this.firing=!1}Sk.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 kL=Sk,wr=uL,ki=Ek,wL=bL,xL=xk,EL=kL,Ve=function(t,e,n){var r=Ve.getDefaultLang();this.input=t||{},this.messages=ki._make(r),this.messages._setCustom(n),this.setAttributeFormatter(Ve.prototype.attributeFormatter),this.errors=new wL,this.errorCount=0,this.hasAsync=!1,this.rules=this._parseRules(e)};Ve.prototype={constructor:Ve,lang:"en",numericRules:["integer","numeric"],attributeFormatter:xL.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 EL(r,i),s=function(f,m,g,b){return function(){var y=o.add(b);b.validate(f,m.value,g,function(){o.resolve(y)})}};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)),wr.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)||wr.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 wr.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}};Ve.setMessages=function(t,e){return ki._set(t,e),this};Ve.getMessages=function(t){return ki._get(t)};Ve.useLang=function(t){this.prototype.lang=t};Ve.getDefaultLang=function(){return this.prototype.lang};Ve.setAttributeFormatter=function(t){this.prototype.attributeFormatter=t};Ve.stopOnError=function(t){this.prototype.stopOnAttributes=t};Ve.register=function(t,e,n,r){var i=Ve.getDefaultLang();wr.register(t,e),ki._setRuleMessage(i,t,n)};Ve.registerImplicit=function(t,e,n,r){var i=Ve.getDefaultLang();wr.registerImplicit(t,e),ki._setRuleMessage(i,t,n)};Ve.registerAsync=function(t,e,n,r){var i=Ve.getDefaultLang();wr.registerAsync(t,e),ki._setRuleMessage(i,t,n)};Ve.registerAsyncImplicit=function(t,e,n){var r=Ve.getDefaultLang();wr.registerAsyncImplicit(t,e),ki._setRuleMessage(r,t,n)};Ve.registerMissedRuleValidator=function(t,e){wr.registerMissedRuleValidator(t,e)};var CL=Ve;const pr=Su(CL);Ck._set("en",mL);pr.useLang("en");const cp=z(!1),SL=t=>{cp.value=!cp.value,Ck._set("default",t),pr.useLang("default")},TL=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>{const i=n.split(".").pop();return[n,e(i)]})),dp=(t,e={})=>{const{rule:n="required",prefix:r=""}=e;let i={};return Object.entries(t).forEach(([o,s])=>{const a=r+o;if(Uw(s)){s.map((l,u)=>{i=Object.assign(i,dp(l,{rule:n,prefix:`${a}.${u}.`}))});return}if(Ww(s)){i=Object.assign(i,dp(s,{rule:n,prefix:`${a}.`}));return}i[a]=n}),i},OL=pr.register,AL=pr.registerAsync;function ML(t={}){const{rules:e,labels:n,data:r,customMessages:i,visitImmediate:o=!1}=t;if(i){let m=pr.getMessages("default");Object.entries(i.value).forEach(([g,b])=>m[g]=b),pr.setMessages("default",m)}let s=new pr({},{}),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=z(o?Object.fromEntries(Object.keys(e.value).map(m=>[m,!0])):{}),u=z(!0),c=z(s.errors),d=I(()=>a());function h(m){var g;let b=(g=d.value)==null?void 0:g[m];const y={valid:!0,error:void 0};return!b||!b.visited?y:b}let p=()=>{let m=new pr(r.value,e.value);n&&m.setAttributeNames(n.value);const g=()=>{c.value=s.errors,u.value=!0},b=()=>{u.value=!1,c.value=m.errors};m.checkAsync(g,b)};we([r,cp],p,{deep:!0,immediate:!0});const f=m=>{if(!m)return!1;const g=typeof m=="string"?m.split("|"):Array.isArray(m)?m:[],b={required:()=>!0,required_if:(y,k)=>r.value[y]===k,required_unless:(y,k)=>r.value[y]!==k,required_with:y=>y.some(k=>k in r.value),required_with_all:y=>y.every(k=>k in r.value),required_without:y=>y.some(k=>!(k in r.value)),required_without_all:y=>y.every(k=>!(k in r.value))};for(const y of g){if(typeof y=="string"){if(y==="required")return b.required;const[k,...v]=y.split(":");if(b[k]){const w=v.map(x=>["true",!0,"false",!1].includes(x)?JSON.parse(x):x);return b[k](...w)}}if(typeof y=="object"){for(const[k,v]of Object.entries(y))if(b[k])return Array.isArray(v)?b[k](...v):b[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 GL=Object.freeze(Object.defineProperty({__proto__:null,default:ML,generateLabels:TL,generateRules:dp,register:OL,registerAsync:AL,setLabels:SL},Symbol.toStringTag,{value:"Module"}));export{KL as $,VL as A,vv as B,RL as E,qL as F,Eu as G,jL as I,WL as L,$L as M,zL as N,BL as O,HL as P,QE as S,LL as T,Qe as U,bu as W,ri as _,He as a,gf as b,FL as c,NL as d,UL as e,ML as f,X1 as g,RE as h,DL as m,wT as u,IL as v,ib as w,PL as x,GL as z};