Files
lucent-laravel/front/dist/assets/main-DtbuHUXl.js
T
2026-05-15 17:07:12 +03:00

214 lines
1.1 MiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var uP=Object.defineProperty;var hP=(i,e,t)=>e in i?uP(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var Qh=(i,e,t)=>(hP(i,typeof e!="symbol"?e+"":e,t),t);function U(){}const fP=i=>i;function Ps(i,e){for(const t in e)i[t]=e[t];return i}function Yw(i){return i()}function Jp(){return Object.create(null)}function ht(i){i.forEach(Yw)}function nh(i){return typeof i=="function"}function re(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}let qa;function ad(i,e){return i===e?!0:(qa||(qa=document.createElement("a")),qa.href=e,i===qa.href)}function dP(i){return Object.keys(i).length===0}function Hl(i,e,t,n){if(i){const r=zw(i,e,t,n);return i[0](r)}}function zw(i,e,t,n){return i[1]&&n?Ps(t.ctx.slice(),i[1](n(e))):t.ctx}function Kl(i,e,t,n){if(i[2]&&n){const r=i[2](n(t));if(e.dirty===void 0)return r;if(typeof r=="object"){const s=[],o=Math.max(e.dirty.length,r.length);for(let l=0;l<o;l+=1)s[l]=e.dirty[l]|r[l];return s}return e.dirty|r}return e.dirty}function Jl(i,e,t,n,r,s){if(r){const o=zw(e,t,n,s);i.p(o,r)}}function ea(i){if(i.ctx.length>32){const e=[],t=i.ctx.length/32;for(let n=0;n<t;n++)e[n]=-1;return e}return-1}function mP(i){return i&&nh(i.destroy)?i.destroy:U}function eg(i){const e=typeof i=="string"&&i.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return e?[parseFloat(e[1]),e[2]||"px"]:[i,"px"]}const Vw=typeof window<"u";let pP=Vw?()=>window.performance.now():()=>Date.now(),Xm=Vw?i=>requestAnimationFrame(i):U;const lo=new Set;function Uw(i){lo.forEach(e=>{e.c(i)||(lo.delete(e),e.f())}),lo.size!==0&&Xm(Uw)}function gP(i){let e;return lo.size===0&&Xm(Uw),{promise:new Promise(t=>{lo.add(e={c:i,f:t})}),abort(){lo.delete(e)}}}const OP=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function b(i,e){i.appendChild(e)}function jw(i){if(!i)return document;const e=i.getRootNode?i.getRootNode():i.ownerDocument;return e&&e.host?e:i.ownerDocument}function bP(i){const e=y("style");return e.textContent="/* empty */",vP(jw(i),e),e.sheet}function vP(i,e){return b(i.head||i,e),e.sheet}function x(i,e,t){i.insertBefore(e,t||null)}function P(i){i.parentNode&&i.parentNode.removeChild(i)}function Ot(i,e){for(let t=0;t<i.length;t+=1)i[t]&&i[t].d(e)}function y(i){return document.createElement(i)}function wP(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function W(i){return document.createTextNode(i)}function D(){return W(" ")}function Ie(){return W("")}function G(i,e,t,n){return i.addEventListener(e,t,n),()=>i.removeEventListener(e,t,n)}function Ln(i){return function(e){return e.preventDefault(),i.call(this,e)}}function O(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function Jo(i,e,t){const n=e.toLowerCase();n in i?i[n]=typeof i[n]=="boolean"&&t===""?!0:t:e in i?i[e]=typeof i[e]=="boolean"&&t===""?!0:t:O(i,e,t)}function qw(i){let e;return{p(...t){e=t,e.forEach(n=>i.push(n))},r(){e.forEach(t=>i.splice(i.indexOf(t),1))}}}function Gw(i){return i===""?null:+i}function yP(i){return Array.from(i.childNodes)}function K(i,e){e=""+e,i.data!==e&&(i.data=e)}function Le(i,e){i.value=e??""}function le(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,"")}function tg(i,e,t){for(let n=0;n<i.options.length;n+=1){const r=i.options[n];if(r.__value===e){r.selected=!0;return}}(!t||e!==void 0)&&(i.selectedIndex=-1)}function kP(i){const e=i.querySelector(":checked");return e&&e.__value}function Ae(i,e,t){i.classList.toggle(e,!!t)}function Hw(i,e,{bubbles:t=!1,cancelable:n=!1}={}){return new CustomEvent(i,{detail:e,bubbles:t,cancelable:n})}function Xr(i,e){return new i(e)}const su=new Map;let ou=0;function SP(i){let e=5381,t=i.length;for(;t--;)e=(e<<5)-e^i.charCodeAt(t);return e>>>0}function _P(i,e){const t={stylesheet:bP(e),rules:{}};return su.set(i,t),t}function ng(i,e,t,n,r,s,o,l=0){const a=16.666/n;let c=`{
`;for(let g=0;g<=1;g+=a){const v=e+(t-e)*s(g);c+=g*100+`%{${o(v,1-v)}}
`}const u=c+`100% {${o(t,1-t)}}
}`,h=`__svelte_${SP(u)}_${l}`,f=jw(i),{stylesheet:d,rules:m}=su.get(f)||_P(f,i);m[h]||(m[h]=!0,d.insertRule(`@keyframes ${h} ${u}`,d.cssRules.length));const p=i.style.animation||"";return i.style.animation=`${p?`${p}, `:""}${h} ${n}ms linear ${r}ms 1 both`,ou+=1,h}function CP(i,e){const t=(i.style.animation||"").split(", "),n=t.filter(e?s=>s.indexOf(e)<0:s=>s.indexOf("__svelte")===-1),r=t.length-n.length;r&&(i.style.animation=n.join(", "),ou-=r,ou||PP())}function PP(){Xm(()=>{ou||(su.forEach(i=>{const{ownerNode:e}=i.stylesheet;e&&P(e)}),su.clear())})}let ta;function Tl(i){ta=i}function Bo(){if(!ta)throw new Error("Function called outside component initialization");return ta}function xi(i){Bo().$$.on_mount.push(i)}function Kw(i){Bo().$$.after_update.push(i)}function Jw(i){Bo().$$.on_destroy.push(i)}function nn(){const i=Bo();return(e,t,{cancelable:n=!1}={})=>{const r=i.$$.callbacks[e];if(r){const s=Hw(e,t,{cancelable:n});return r.slice().forEach(o=>{o.call(i,s)}),!s.defaultPrevented}return!0}}function Ql(i,e){return Bo().$$.context.set(i,e),e}function Ue(i){return Bo().$$.context.get(i)}function vs(i,e){const t=i.$$.callbacks[e.type];t&&t.slice().forEach(n=>n.call(this,e))}const Hs=[],Ce=[];let ao=[];const cd=[],AP=Promise.resolve();let ud=!1;function xP(){ud||(ud=!0,AP.then(ey))}function As(i){ao.push(i)}function st(i){cd.push(i)}const Mh=new Set;let Vs=0;function ey(){if(Vs!==0)return;const i=ta;do{try{for(;Vs<Hs.length;){const e=Hs[Vs];Vs++,Tl(e),TP(e.$$)}}catch(e){throw Hs.length=0,Vs=0,e}for(Tl(null),Hs.length=0,Vs=0;Ce.length;)Ce.pop()();for(let e=0;e<ao.length;e+=1){const t=ao[e];Mh.has(t)||(Mh.add(t),t())}ao.length=0}while(Hs.length);for(;cd.length;)cd.pop()();ud=!1,Mh.clear(),Tl(i)}function TP(i){if(i.fragment!==null){i.update(),ht(i.before_update);const e=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,e),i.after_update.forEach(As)}}function QP(i){const e=[],t=[];ao.forEach(n=>i.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),ao=e}let el;function MP(){return el||(el=Promise.resolve(),el.then(()=>{el=null})),el}function Eh(i,e,t){i.dispatchEvent(Hw(`${e?"intro":"outro"}${t}`))}const Lc=new Set;let sr;function Oe(){sr={r:0,c:[],p:sr}}function be(){sr.r||ht(sr.c),sr=sr.p}function T(i,e){i&&i.i&&(Lc.delete(i),i.i(e))}function R(i,e,t,n){if(i&&i.o){if(Lc.has(i))return;Lc.add(i),sr.c.push(()=>{Lc.delete(i),n&&(t&&i.d(1),n())}),i.o(e)}else n&&n()}const EP={duration:0};function lu(i,e,t,n){let s=e(i,t,{direction:"both"}),o=n?0:1,l=null,a=null,c=null,u;function h(){c&&CP(i,c)}function f(m,p){const g=m.b-o;return p*=Math.abs(g),{a:o,b:m.b,d:g,duration:p,start:m.start,end:m.start+p,group:m.group}}function d(m){const{delay:p=0,duration:g=300,easing:v=fP,tick:w=U,css:S}=s||EP,_={start:pP()+p,b:m};m||(_.group=sr,sr.r+=1),"inert"in i&&(m?u!==void 0&&(i.inert=u):(u=i.inert,i.inert=!0)),l||a?a=_:(S&&(h(),c=ng(i,o,m,g,p,v,S)),m&&w(0,1),l=f(_,g),As(()=>Eh(i,m,"start")),gP(k=>{if(a&&k>a.start&&(l=f(a,g),a=null,Eh(i,l.b,"start"),S&&(h(),c=ng(i,o,l.b,l.duration,0,v,s.css))),l){if(k>=l.end)w(o=l.b,1-o),Eh(i,l.b,"end"),a||(l.b?h():--l.group.r||ht(l.group.c)),l=null;else if(k>=l.start){const A=k-l.start;o=l.a+l.d*v(A/l.duration),w(o,1-o)}}return!!(l||a)}))}return{run(m){nh(s)?MP().then(()=>{s=s({direction:m?"in":"out"}),d(m)}):d(m)},end(){h(),l=a=null}}}function fe(i){return(i==null?void 0:i.length)!==void 0?i:Array.from(i)}function Fm(i,e){i.d(1),e.delete(i.key)}function Jr(i,e){R(i,1,1,()=>{e.delete(i.key)})}function Ti(i,e,t,n,r,s,o,l,a,c,u,h){let f=i.length,d=s.length,m=f;const p={};for(;m--;)p[i[m].key]=m;const g=[],v=new Map,w=new Map,S=[];for(m=d;m--;){const C=h(r,s,m),Q=t(C);let M=o.get(Q);M?S.push(()=>M.p(C,e)):(M=c(Q,C),M.c()),v.set(Q,g[m]=M),Q in p&&w.set(Q,Math.abs(m-p[Q]))}const _=new Set,k=new Set;function A(C){T(C,1),C.m(l,u),o.set(C.key,C),u=C.first,d--}for(;f&&d;){const C=g[d-1],Q=i[f-1],M=C.key,L=Q.key;C===Q?(u=C.first,f--,d--):v.has(L)?!o.has(M)||_.has(M)?A(C):k.has(L)?f--:w.get(M)>w.get(L)?(k.add(M),A(C)):(_.add(L),f--):(a(Q,o),f--)}for(;f--;){const C=i[f];v.has(C.key)||a(C,o)}for(;d;)A(g[d-1]);return ht(S),g}function _o(i,e){const t={},n={},r={$$scope:1};let s=i.length;for(;s--;){const o=i[s],l=e[s];if(l){for(const a in o)a in l||(n[a]=1);for(const a in l)r[a]||(t[a]=l[a],r[a]=1);i[s]=l}else for(const a in o)r[a]=1}for(const o in n)o in t||(t[o]=void 0);return t}function Co(i){return typeof i=="object"&&i!==null?i:{}}function nt(i,e,t){const n=i.$$.props[e];n!==void 0&&(i.$$.bound[n]=t,t(i.$$.ctx[n]))}function V(i){i&&i.c()}function Y(i,e,t){const{fragment:n,after_update:r}=i.$$;n&&n.m(e,t),As(()=>{const s=i.$$.on_mount.map(Yw).filter(nh);i.$$.on_destroy?i.$$.on_destroy.push(...s):ht(s),i.$$.on_mount=[]}),r.forEach(As)}function z(i,e){const t=i.$$;t.fragment!==null&&(QP(t.after_update),ht(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function RP(i,e){i.$$.dirty[0]===-1&&(Hs.push(i),xP(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function se(i,e,t,n,r,s,o=null,l=[-1]){const a=ta;Tl(i);const c=i.$$={fragment:null,ctx:[],props:s,update:U,not_equal:r,bound:Jp(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:Jp(),dirty:l,skip_bound:!1,root:e.target||a.$$.root};o&&o(c.root);let u=!1;if(c.ctx=t?t(i,e.props||{},(h,f,...d)=>{const m=d.length?d[0]:f;return c.ctx&&r(c.ctx[h],c.ctx[h]=m)&&(!c.skip_bound&&c.bound[h]&&c.bound[h](m),u&&RP(i,h)),f}):[],c.update(),u=!0,ht(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const h=yP(e.target);c.fragment&&c.fragment.l(h),h.forEach(P)}else c.fragment&&c.fragment.c();e.intro&&T(i.$$.fragment),Y(i,e.target,e.anchor),ey()}Tl(a)}class oe{constructor(){Qh(this,"$$");Qh(this,"$$set")}$destroy(){z(this,1),this.$destroy=U}$on(e,t){if(!nh(t))return U;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const r=n.indexOf(t);r!==-1&&n.splice(r,1)}}$set(e){this.$$set&&!dP(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const DP="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(DP);function _t(i){const e=Object.prototype.toString.call(i);return i instanceof Date||typeof i=="object"&&e==="[object Date]"?new i.constructor(+i):typeof i=="number"||e==="[object Number]"||typeof i=="string"||e==="[object String]"?new Date(i):new Date(NaN)}function Fr(i,e){return i instanceof Date?new i.constructor(e):new Date(e)}const ty=6048e5,$P=864e5,Ga=43200,ig=1440;let LP={};function Ta(){return LP}function na(i,e){var l,a,c,u;const t=Ta(),n=(e==null?void 0:e.weekStartsOn)??((a=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:a.weekStartsOn)??t.weekStartsOn??((u=(c=t.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,r=_t(i),s=r.getDay(),o=(s<n?7:0)+s-n;return r.setDate(r.getDate()-o),r.setHours(0,0,0,0),r}function au(i){return na(i,{weekStartsOn:1})}function ny(i){const e=_t(i),t=e.getFullYear(),n=Fr(i,0);n.setFullYear(t+1,0,4),n.setHours(0,0,0,0);const r=au(n),s=Fr(i,0);s.setFullYear(t,0,4),s.setHours(0,0,0,0);const o=au(s);return e.getTime()>=r.getTime()?t+1:e.getTime()>=o.getTime()?t:t-1}function rg(i){const e=_t(i);return e.setHours(0,0,0,0),e}function cu(i){const e=_t(i),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+i-+t}function IP(i,e){const t=rg(i),n=rg(e),r=+t-cu(t),s=+n-cu(n);return Math.round((r-s)/$P)}function NP(i){const e=ny(i),t=Fr(i,0);return t.setFullYear(e,0,4),t.setHours(0,0,0,0),au(t)}function Ic(i,e){const t=_t(i),n=_t(e),r=t.getTime()-n.getTime();return r<0?-1:r>0?1:r}function ZP(i){return Fr(i,Date.now())}function BP(i){return i instanceof Date||typeof i=="object"&&Object.prototype.toString.call(i)==="[object Date]"}function WP(i){if(!BP(i)&&typeof i!="number")return!1;const e=_t(i);return!isNaN(Number(e))}function XP(i,e){const t=_t(i),n=_t(e),r=t.getFullYear()-n.getFullYear(),s=t.getMonth()-n.getMonth();return r*12+s}function FP(i){return e=>{const n=(i?Math[i]:Math.trunc)(e);return n===0?0:n}}function YP(i,e){return+_t(i)-+_t(e)}function zP(i){const e=_t(i);return e.setHours(23,59,59,999),e}function VP(i){const e=_t(i),t=e.getMonth();return e.setFullYear(e.getFullYear(),t+1,0),e.setHours(23,59,59,999),e}function UP(i){const e=_t(i);return+zP(e)==+VP(e)}function jP(i,e){const t=_t(i),n=_t(e),r=Ic(t,n),s=Math.abs(XP(t,n));let o;if(s<1)o=0;else{t.getMonth()===1&&t.getDate()>27&&t.setDate(30),t.setMonth(t.getMonth()-r*s);let l=Ic(t,n)===-r;UP(_t(i))&&s===1&&Ic(i,n)===1&&(l=!1),o=r*(s-Number(l))}return o===0?0:o}function qP(i,e,t){const n=YP(i,e)/1e3;return FP(t==null?void 0:t.roundingMethod)(n)}function GP(i){const e=_t(i),t=Fr(i,0);return t.setFullYear(e.getFullYear(),0,1),t.setHours(0,0,0,0),t}const HP={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},KP=(i,e,t)=>{let n;const r=HP[i];return typeof r=="string"?n=r:e===1?n=r.one:n=r.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n};function Rh(i){return(e={})=>{const t=e.width?String(e.width):i.defaultWidth;return i.formats[t]||i.formats[i.defaultWidth]}}const JP={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},eA={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},tA={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},nA={date:Rh({formats:JP,defaultWidth:"full"}),time:Rh({formats:eA,defaultWidth:"full"}),dateTime:Rh({formats:tA,defaultWidth:"full"})},iA={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},rA=(i,e,t,n)=>iA[i];function tl(i){return(e,t)=>{const n=t!=null&&t.context?String(t.context):"standalone";let r;if(n==="formatting"&&i.formattingValues){const o=i.defaultFormattingWidth||i.defaultWidth,l=t!=null&&t.width?String(t.width):o;r=i.formattingValues[l]||i.formattingValues[o]}else{const o=i.defaultWidth,l=t!=null&&t.width?String(t.width):i.defaultWidth;r=i.values[l]||i.values[o]}const s=i.argumentCallback?i.argumentCallback(e):e;return r[s]}}const sA={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},oA={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},lA={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},aA={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},cA={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},uA={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},hA=(i,e)=>{const t=Number(i),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},fA={ordinalNumber:hA,era:tl({values:sA,defaultWidth:"wide"}),quarter:tl({values:oA,defaultWidth:"wide",argumentCallback:i=>i-1}),month:tl({values:lA,defaultWidth:"wide"}),day:tl({values:aA,defaultWidth:"wide"}),dayPeriod:tl({values:cA,defaultWidth:"wide",formattingValues:uA,defaultFormattingWidth:"wide"})};function nl(i){return(e,t={})=>{const n=t.width,r=n&&i.matchPatterns[n]||i.matchPatterns[i.defaultMatchWidth],s=e.match(r);if(!s)return null;const o=s[0],l=n&&i.parsePatterns[n]||i.parsePatterns[i.defaultParseWidth],a=Array.isArray(l)?mA(l,h=>h.test(o)):dA(l,h=>h.test(o));let c;c=i.valueCallback?i.valueCallback(a):a,c=t.valueCallback?t.valueCallback(c):c;const u=e.slice(o.length);return{value:c,rest:u}}}function dA(i,e){for(const t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&e(i[t]))return t}function mA(i,e){for(let t=0;t<i.length;t++)if(e(i[t]))return t}function pA(i){return(e,t={})=>{const n=e.match(i.matchPattern);if(!n)return null;const r=n[0],s=e.match(i.parsePattern);if(!s)return null;let o=i.valueCallback?i.valueCallback(s[0]):s[0];o=t.valueCallback?t.valueCallback(o):o;const l=e.slice(r.length);return{value:o,rest:l}}}const gA=/^(\d+)(th|st|nd|rd)?/i,OA=/\d+/i,bA={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},vA={any:[/^b/i,/^(a|c)/i]},wA={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},yA={any:[/1/i,/2/i,/3/i,/4/i]},kA={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},SA={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},_A={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},CA={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},PA={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},AA={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},xA={ordinalNumber:pA({matchPattern:gA,parsePattern:OA,valueCallback:i=>parseInt(i,10)}),era:nl({matchPatterns:bA,defaultMatchWidth:"wide",parsePatterns:vA,defaultParseWidth:"any"}),quarter:nl({matchPatterns:wA,defaultMatchWidth:"wide",parsePatterns:yA,defaultParseWidth:"any",valueCallback:i=>i+1}),month:nl({matchPatterns:kA,defaultMatchWidth:"wide",parsePatterns:SA,defaultParseWidth:"any"}),day:nl({matchPatterns:_A,defaultMatchWidth:"wide",parsePatterns:CA,defaultParseWidth:"any"}),dayPeriod:nl({matchPatterns:PA,defaultMatchWidth:"any",parsePatterns:AA,defaultParseWidth:"any"})},iy={code:"en-US",formatDistance:KP,formatLong:nA,formatRelative:rA,localize:fA,match:xA,options:{weekStartsOn:0,firstWeekContainsDate:1}};function TA(i){const e=_t(i);return IP(e,GP(e))+1}function QA(i){const e=_t(i),t=+au(e)-+NP(e);return Math.round(t/ty)+1}function ry(i,e){var u,h,f,d;const t=_t(i),n=t.getFullYear(),r=Ta(),s=(e==null?void 0:e.firstWeekContainsDate)??((h=(u=e==null?void 0:e.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??r.firstWeekContainsDate??((d=(f=r.locale)==null?void 0:f.options)==null?void 0:d.firstWeekContainsDate)??1,o=Fr(i,0);o.setFullYear(n+1,0,s),o.setHours(0,0,0,0);const l=na(o,e),a=Fr(i,0);a.setFullYear(n,0,s),a.setHours(0,0,0,0);const c=na(a,e);return t.getTime()>=l.getTime()?n+1:t.getTime()>=c.getTime()?n:n-1}function MA(i,e){var l,a,c,u;const t=Ta(),n=(e==null?void 0:e.firstWeekContainsDate)??((a=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:a.firstWeekContainsDate)??t.firstWeekContainsDate??((u=(c=t.locale)==null?void 0:c.options)==null?void 0:u.firstWeekContainsDate)??1,r=ry(i,e),s=Fr(i,0);return s.setFullYear(r,0,n),s.setHours(0,0,0,0),na(s,e)}function EA(i,e){const t=_t(i),n=+na(t,e)-+MA(t,e);return Math.round(n/ty)+1}function vt(i,e){const t=i<0?"-":"",n=Math.abs(i).toString().padStart(e,"0");return t+n}const _r={y(i,e){const t=i.getFullYear(),n=t>0?t:1-t;return vt(e==="yy"?n%100:n,e.length)},M(i,e){const t=i.getMonth();return e==="M"?String(t+1):vt(t+1,2)},d(i,e){return vt(i.getDate(),e.length)},a(i,e){const t=i.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(i,e){return vt(i.getHours()%12||12,e.length)},H(i,e){return vt(i.getHours(),e.length)},m(i,e){return vt(i.getMinutes(),e.length)},s(i,e){return vt(i.getSeconds(),e.length)},S(i,e){const t=e.length,n=i.getMilliseconds(),r=Math.trunc(n*Math.pow(10,t-3));return vt(r,e.length)}},Us={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},sg={G:function(i,e,t){const n=i.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(i,e,t){if(e==="yo"){const n=i.getFullYear(),r=n>0?n:1-n;return t.ordinalNumber(r,{unit:"year"})}return _r.y(i,e)},Y:function(i,e,t,n){const r=ry(i,n),s=r>0?r:1-r;if(e==="YY"){const o=s%100;return vt(o,2)}return e==="Yo"?t.ordinalNumber(s,{unit:"year"}):vt(s,e.length)},R:function(i,e){const t=ny(i);return vt(t,e.length)},u:function(i,e){const t=i.getFullYear();return vt(t,e.length)},Q:function(i,e,t){const n=Math.ceil((i.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return vt(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(i,e,t){const n=Math.ceil((i.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return vt(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(i,e,t){const n=i.getMonth();switch(e){case"M":case"MM":return _r.M(i,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(i,e,t){const n=i.getMonth();switch(e){case"L":return String(n+1);case"LL":return vt(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(i,e,t,n){const r=EA(i,n);return e==="wo"?t.ordinalNumber(r,{unit:"week"}):vt(r,e.length)},I:function(i,e,t){const n=QA(i);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):vt(n,e.length)},d:function(i,e,t){return e==="do"?t.ordinalNumber(i.getDate(),{unit:"date"}):_r.d(i,e)},D:function(i,e,t){const n=TA(i);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):vt(n,e.length)},E:function(i,e,t){const n=i.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(i,e,t,n){const r=i.getDay(),s=(r-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return vt(s,2);case"eo":return t.ordinalNumber(s,{unit:"day"});case"eee":return t.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(r,{width:"short",context:"formatting"});case"eeee":default:return t.day(r,{width:"wide",context:"formatting"})}},c:function(i,e,t,n){const r=i.getDay(),s=(r-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return vt(s,e.length);case"co":return t.ordinalNumber(s,{unit:"day"});case"ccc":return t.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(r,{width:"narrow",context:"standalone"});case"cccccc":return t.day(r,{width:"short",context:"standalone"});case"cccc":default:return t.day(r,{width:"wide",context:"standalone"})}},i:function(i,e,t){const n=i.getDay(),r=n===0?7:n;switch(e){case"i":return String(r);case"ii":return vt(r,e.length);case"io":return t.ordinalNumber(r,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(i,e,t){const r=i.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(r,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(i,e,t){const n=i.getHours();let r;switch(n===12?r=Us.noon:n===0?r=Us.midnight:r=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(r,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(i,e,t){const n=i.getHours();let r;switch(n>=17?r=Us.evening:n>=12?r=Us.afternoon:n>=4?r=Us.morning:r=Us.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(r,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(i,e,t){if(e==="ho"){let n=i.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return _r.h(i,e)},H:function(i,e,t){return e==="Ho"?t.ordinalNumber(i.getHours(),{unit:"hour"}):_r.H(i,e)},K:function(i,e,t){const n=i.getHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):vt(n,e.length)},k:function(i,e,t){let n=i.getHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):vt(n,e.length)},m:function(i,e,t){return e==="mo"?t.ordinalNumber(i.getMinutes(),{unit:"minute"}):_r.m(i,e)},s:function(i,e,t){return e==="so"?t.ordinalNumber(i.getSeconds(),{unit:"second"}):_r.s(i,e)},S:function(i,e){return _r.S(i,e)},X:function(i,e,t){const n=i.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return lg(n);case"XXXX":case"XX":return fs(n);case"XXXXX":case"XXX":default:return fs(n,":")}},x:function(i,e,t){const n=i.getTimezoneOffset();switch(e){case"x":return lg(n);case"xxxx":case"xx":return fs(n);case"xxxxx":case"xxx":default:return fs(n,":")}},O:function(i,e,t){const n=i.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+og(n,":");case"OOOO":default:return"GMT"+fs(n,":")}},z:function(i,e,t){const n=i.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+og(n,":");case"zzzz":default:return"GMT"+fs(n,":")}},t:function(i,e,t){const n=Math.trunc(i.getTime()/1e3);return vt(n,e.length)},T:function(i,e,t){const n=i.getTime();return vt(n,e.length)}};function og(i,e=""){const t=i>0?"-":"+",n=Math.abs(i),r=Math.trunc(n/60),s=n%60;return s===0?t+String(r):t+String(r)+e+vt(s,2)}function lg(i,e){return i%60===0?(i>0?"-":"+")+vt(Math.abs(i)/60,2):fs(i,e)}function fs(i,e=""){const t=i>0?"-":"+",n=Math.abs(i),r=vt(Math.trunc(n/60),2),s=vt(n%60,2);return t+r+e+s}const ag=(i,e)=>{switch(i){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},sy=(i,e)=>{switch(i){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},RA=(i,e)=>{const t=i.match(/(P+)(p+)?/)||[],n=t[1],r=t[2];if(!r)return ag(i,e);let s;switch(n){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",ag(n,e)).replace("{{time}}",sy(r,e))},DA={p:sy,P:RA},$A=/^D+$/,LA=/^Y+$/,IA=["D","DD","YY","YYYY"];function NA(i){return $A.test(i)}function ZA(i){return LA.test(i)}function BA(i,e,t){const n=WA(i,e,t);if(console.warn(n),IA.includes(i))throw new RangeError(n)}function WA(i,e,t){const n=i[0]==="Y"?"years":"days of the month";return`Use \`${i.toLowerCase()}\` instead of \`${i}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const XA=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,FA=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,YA=/^'([^]*?)'?$/,zA=/''/g,VA=/[a-zA-Z]/;function oy(i,e,t){var u,h,f,d;const n=Ta(),r=n.locale??iy,s=n.firstWeekContainsDate??((h=(u=n.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??1,o=n.weekStartsOn??((d=(f=n.locale)==null?void 0:f.options)==null?void 0:d.weekStartsOn)??0,l=_t(i);if(!WP(l))throw new RangeError("Invalid time value");let a=e.match(FA).map(m=>{const p=m[0];if(p==="p"||p==="P"){const g=DA[p];return g(m,r.formatLong)}return m}).join("").match(XA).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const p=m[0];if(p==="'")return{isToken:!1,value:UA(m)};if(sg[p])return{isToken:!0,value:m};if(p.match(VA))throw new RangeError("Format string contains an unescaped latin alphabet character `"+p+"`");return{isToken:!1,value:m}});r.localize.preprocessor&&(a=r.localize.preprocessor(l,a));const c={firstWeekContainsDate:s,weekStartsOn:o,locale:r};return a.map(m=>{if(!m.isToken)return m.value;const p=m.value;(ZA(p)||NA(p))&&BA(p,e,String(i));const g=sg[p[0]];return g(l,p,r.localize,c)}).join("")}function UA(i){const e=i.match(YA);return e?e[1].replace(zA,"'"):i}function jA(i,e,t){const n=Ta(),r=(t==null?void 0:t.locale)??n.locale??iy,s=2520,o=Ic(i,e);if(isNaN(o))throw new RangeError("Invalid time value");const l=Object.assign({},t,{addSuffix:t==null?void 0:t.addSuffix,comparison:o});let a,c;o>0?(a=_t(e),c=_t(i)):(a=_t(i),c=_t(e));const u=qP(c,a),h=(cu(c)-cu(a))/1e3,f=Math.round((u-h)/60);let d;if(f<2)return t!=null&&t.includeSeconds?u<5?r.formatDistance("lessThanXSeconds",5,l):u<10?r.formatDistance("lessThanXSeconds",10,l):u<20?r.formatDistance("lessThanXSeconds",20,l):u<40?r.formatDistance("halfAMinute",0,l):u<60?r.formatDistance("lessThanXMinutes",1,l):r.formatDistance("xMinutes",1,l):f===0?r.formatDistance("lessThanXMinutes",1,l):r.formatDistance("xMinutes",f,l);if(f<45)return r.formatDistance("xMinutes",f,l);if(f<90)return r.formatDistance("aboutXHours",1,l);if(f<ig){const m=Math.round(f/60);return r.formatDistance("aboutXHours",m,l)}else{if(f<s)return r.formatDistance("xDays",1,l);if(f<Ga){const m=Math.round(f/ig);return r.formatDistance("xDays",m,l)}else if(f<Ga*2)return d=Math.round(f/Ga),r.formatDistance("aboutXMonths",d,l)}if(d=jP(c,a),d<12){const m=Math.round(f/Ga);return r.formatDistance("xMonths",m,l)}else{const m=d%12,p=Math.trunc(d/12);return m<3?r.formatDistance("aboutXYears",p,l):m<9?r.formatDistance("overXYears",p,l):r.formatDistance("almostXYears",p+1,l)}}function ly(i,e){return jA(i,ZP(i),e)}function ih(i){const e=i.match(/(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/);return e?new Date(Date.UTC(+e[1],+e[2]-1,+e[3],+e[4]-(+e[9]||0)*(e[8]=="-"?-1:1),+e[5]-(+e[10]||0)*(e[8]=="-"?-1:1),+e[6],+((e[7]||"0")+"00").substring(0,3))):new Date(NaN)}function Bi(i){return ly(ih(i),{addSuffix:!0})}function cg(i){return i?oy(ih(i),"dd MMM yyyy"):""}function ug(i){return i?oy(ih(i),"dd MMM yyyy HH:mm"):""}function qA(i){const e=t=>{i&&!i.contains(t.target)&&!t.defaultPrevented&&i.dispatchEvent(new CustomEvent("click_outside",i))};return document.addEventListener("click",e,!0),{destroy(){document.removeEventListener("click",e,!0)}}}function Jn(i,e,t={}){return fetch(i,{...t,method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest","X-CSRF-TOKEN":document.querySelector('meta[name="csrf-token"]').content,...t.headers}}).then(n=>n.json())}function Qa(i,e={}){return fetch(i,{...e,method:"GET",headers:{"X-CSRF-TOKEN":document.querySelector('meta[name="csrf-token"]').content,"X-Requested-With":"XMLHttpRequest",...e.headers}}).then(t=>t.json())}function ia(i,e){let t=l=>typeof l=="object"&&!Array.isArray(l)&&l!==null,n=l=>(l==null?void 0:l.constructor)===Array,r=l=>l==null;const s=i??null,o=e??null;return t(s)?Object.keys(s).reduce((a,c)=>a===!1?!1:ia(s==null?void 0:s[c],o==null?void 0:o[c]),!0):n(s)?!n(o)||s.length!==o.length?!1:s.reduce((l,a,c)=>l===!1?!1:ia(a,o[c]),!0):!!(r(s)&&r(o)||s==o)}function GA(i,e){let t;return(...n)=>{clearTimeout(t),t=setTimeout(()=>i(...n),e)}}function hg(i,e){const t=new Set;return i.filter(n=>{const r=e(n);return t.has(r)?!1:(t.add(r),!0)})}function fg(i){let e,t,n,r,s;return{c(){e=y("div"),t=y("div"),t.textContent="Submission Errors",n=D(),r=y("div"),s=W(i[0]),O(t,"class","title"),O(r,"class","content"),O(e,"class","notice notice-error"),O(e,"role","alert")},m(o,l){x(o,e,l),b(e,t),b(e,n),b(e,r),b(r,s)},p(o,l){l&1&&K(s,o[0])},d(o){o&&P(e)}}}function HA(i){let e,t=i[0]&&fg(i);return{c(){t&&t.c(),e=Ie()},m(n,r){t&&t.m(n,r),x(n,e,r)},p(n,[r]){n[0]?t?t.p(n,r):(t=fg(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:U,o:U,d(n){n&&P(e),t&&t.d(n)}}}function KA(i,e,t){let{message:n=""}=e;return i.$$set=r=>{"message"in r&&t(0,n=r.message)},[n]}class Ma extends oe{constructor(e){super(),se(this,e,KA,HA,re,{message:0})}}function JA(i){let e,t,n,r;return{c(){e=y("button"),t=y("span"),n=D(),r=W(i[0]),O(t,"class","spinner-border spinner-border-sm"),O(t,"role","status"),O(t,"aria-hidden","true"),O(e,"type","submit"),O(e,"class","button secondary btn-spinner"),e.disabled=i[1]},m(s,o){x(s,e,o),b(e,t),b(e,n),b(e,r)},p(s,[o]){o&1&&K(r,s[0]),o&2&&(e.disabled=s[1])},i:U,o:U,d(s){s&&P(e)}}}function ex(i,e,t){let{label:n=""}=e,{disabled:r=!1}=e;return i.$$set=s=>{"label"in s&&t(0,n=s.label),"disabled"in s&&t(1,r=s.disabled)},[n,r]}class uu extends oe{constructor(e){super(),se(this,e,ex,JA,re,{label:0,disabled:1})}}function tx(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,v,w,S;return t=new Ma({props:{message:i[2]}}),g=new uu({props:{label:"Register"}}),{c(){e=y("div"),V(t.$$.fragment),n=D(),r=y("form"),s=y("div"),o=y("label"),o.textContent="Name",l=D(),a=y("input"),c=D(),u=y("div"),h=y("label"),h.textContent="Email address",f=D(),d=y("input"),m=D(),p=y("div"),V(g.$$.fragment),O(o,"for","name"),O(o,"class","form-label"),O(a,"type","text"),O(a,"class","form-control"),O(a,"id","name"),O(s,"class","mb-3"),O(h,"for","email"),O(h,"class","form-label"),O(d,"type","email"),O(d,"class","form-control"),O(d,"id","email"),O(u,"class","mb-3"),O(p,"class","text-center mt-5 d-block"),O(e,"class","wrapper-tiny")},m(_,k){x(_,e,k),Y(t,e,null),b(e,n),b(e,r),b(r,s),b(s,o),b(s,l),b(s,a),Le(a,i[1]),b(r,c),b(r,u),b(u,h),b(u,f),b(u,d),Le(d,i[0]),b(r,m),b(r,p),Y(g,p,null),v=!0,w||(S=[G(a,"input",i[4]),G(d,"input",i[5]),G(r,"submit",i[3])],w=!0)},p(_,[k]){const A={};k&4&&(A.message=_[2]),t.$set(A),k&2&&a.value!==_[1]&&Le(a,_[1]),k&1&&d.value!==_[0]&&Le(d,_[0])},i(_){v||(T(t.$$.fragment,_),T(g.$$.fragment,_),v=!0)},o(_){R(t.$$.fragment,_),R(g.$$.fragment,_),v=!1},d(_){_&&P(e),z(t),z(g),w=!1,ht(S)}}}function nx(i,e,t){const n=Ue("channel");let r="",{email:s=""}=e,o="";function l(u){u.preventDefault(),t(2,o=""),Jn(n.lucentUrl+"/register",{name:r,email:s}).then(()=>{window.location=n.lucentUrl+"/login"}).catch(h=>{var f;t(2,o=(f=h.response)==null?void 0:f.data.error),console.log({errorMessage:o})})}function a(){r=this.value,t(1,r)}function c(){s=this.value,t(0,s)}return i.$$set=u=>{"email"in u&&t(0,s=u.email)},[s,r,o,l,a,c]}class ix extends oe{constructor(e){super(),se(this,e,nx,tx,re,{email:0})}}function rx(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g;return{c(){e=y("div"),t=y("h2"),t.textContent="Enter Lucent",n=D(),r=y("form"),s=y("p"),s.innerHTML="Submit your email address and you will receive a <b>login link</b> to your email",o=D(),l=y("p"),l.textContent="Don't forget to check your spam folder",a=D(),c=y("div"),u=y("label"),u.textContent="Email address",h=D(),f=y("input"),d=D(),m=y("button"),m.innerHTML=`Send email
<img alt="indicator" id="indicator" class="htmx-indicator" src="/img/spinner.svg"/>`,O(t,"class","mb-5"),O(u,"for","emailaddress"),O(u,"class","form-label"),O(f,"type","email"),O(f,"class","form-control"),O(f,"id","emailaddress"),f.required=!0,O(c,"class","mt-5 mb-3"),O(m,"class","bt bt-primary"),O(e,"class","form")},m(v,w){x(v,e,w),b(e,t),b(e,n),b(e,r),b(r,s),b(r,o),b(r,l),b(r,a),b(r,c),b(c,u),b(c,h),b(c,f),Le(f,i[0]),b(r,d),b(r,m),p||(g=[G(f,"input",i[3]),G(r,"submit",i[2])],p=!0)},p(v,w){w&1&&f.value!==v[0]&&Le(f,v[0])},d(v){v&&P(e),p=!1,ht(g)}}}function sx(i){let e,t,n,r,s,o,l,a;return{c(){e=y("div"),t=y("p"),n=W("You will receive an email with a login link at "),r=y("b"),s=W(i[0]),o=W("."),l=D(),a=y("p"),a.textContent="Check your spam folder",O(e,"class","alert alert-info"),O(e,"role","alert")},m(c,u){x(c,e,u),b(e,t),b(t,n),b(t,r),b(r,s),b(t,o),b(e,l),b(e,a)},p(c,u){u&1&&K(s,c[0])},d(c){c&&P(e)}}}function ox(i){let e,t,n,r;function s(a,c){return a[1]?sx:rx}let o=s(i),l=o(i);return{c(){e=y("div"),t=y("div"),n=D(),r=y("div"),l.c(),O(t,"class","bg-image"),O(r,"class","login-form"),O(e,"class","scope-login")},m(a,c){x(a,e,c),b(e,t),b(e,n),b(e,r),l.m(r,null)},p(a,[c]){o===(o=s(a))&&l?l.p(a,c):(l.d(1),l=o(a),l&&(l.c(),l.m(r,null)))},i:U,o:U,d(a){a&&P(e),l.d()}}}function lx(i,e,t){const n=Ue("channel");let r="",s=!1;function o(a){a.preventDefault(),Jn(n.lucentUrl+"/login",{email:r}).then(()=>{t(1,s=!0)}).catch(()=>{})}function l(){r=this.value,t(0,r)}return[r,s,o,l]}class ax extends oe{constructor(e){super(),se(this,e,lx,ox,re,{})}}function cx(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,v,w;return{c(){e=y("div"),t=y("div"),n=D(),r=y("div"),s=y("div"),o=y("h2"),o.textContent="Welcome to Lucent",l=D(),a=y("form"),c=y("button"),u=W("Enter as "),h=W(i[0]),f=D(),d=y("img"),p=D(),g=y("div"),O(t,"class","bg-image"),O(o,"class","mb-5"),O(d,"alt","indicator"),O(d,"id","indicator"),O(d,"class","htmx-indicator"),ad(d.src,m="/img/spinner.svg")||O(d,"src",m),O(c,"class","bt bt-primary"),O(g,"class","form-errors"),O(s,"class","form"),O(r,"class","login-form"),O(e,"class","scope-login")},m(S,_){x(S,e,_),b(e,t),b(e,n),b(e,r),b(r,s),b(s,o),b(s,l),b(s,a),b(a,c),b(c,u),b(c,h),b(c,f),b(c,d),b(s,p),b(s,g),v||(w=G(a,"submit",i[1]),v=!0)},p(S,[_]){_&1&&K(h,S[0])},i:U,o:U,d(S){S&&P(e),v=!1,w()}}}function ux(i,e,t){const n=Ue("channel");let{email:r}=e,{token:s}=e;function o(l){l.preventDefault(),Jn(n.lucentUrl+"/verify",{email:r,token:s}).then(a=>{window.location=n.lucentUrl}).catch(a=>{})}return i.$$set=l=>{"email"in l&&t(0,r=l.email),"token"in l&&t(2,s=l.token)},[r,o,s]}class hx extends oe{constructor(e){super(),se(this,e,ux,cx,re,{email:0,token:2})}}function fx(i){let e,t,n;return{c(){e=y("div"),t=y("div"),n=W(i[2]),O(t,"class","avatar__letters"),O(e,"class","avatar"),O(e,"title",i[0]),le(e,"background-color",i[3][i[4]]),le(e,"height",i[1]+"px"),le(e,"width",i[1]+"px"),le(e,"font-size",i[1]/2+"px")},m(r,s){x(r,e,s),b(e,t),b(t,n)},p(r,[s]){s&4&&K(n,r[2]),s&1&&O(e,"title",r[0]),s&2&&le(e,"height",r[1]+"px"),s&2&&le(e,"width",r[1]+"px"),s&2&&le(e,"font-size",r[1]/2+"px")},i:U,o:U,d(r){r&&P(e)}}}function dx(i,e,t){let{name:n}=e,{side:r=48}=e;const s=["#00AA55","#009FD4","#B381B3","#939393","#E3BC00","#D47500","#DC2A2A","#3ede91","#377dd4","#0256b0","#053d82","#3d026e","#b378e3","#c4065c","#543208","#d97811","#0c6b40"];let o="";n.split(" ").length>1?o=n.split(" ")[0].charAt(0).toUpperCase()+n.split(" ")[1].charAt(0).toUpperCase():o=n.split(" ")[0].charAt(0).toUpperCase()+n.split(" ")[0].charAt(1).toUpperCase();let a=(n.charCodeAt(1)+n.length)%19;return i.$$set=c=>{"name"in c&&t(0,n=c.name),"side"in c&&t(1,r=c.side)},[n,r,o,s,a]}class _i extends oe{constructor(e){super(),se(this,e,dx,fx,re,{name:0,side:1})}}function mx(i){const e=i-1;return e*e*e+1}function hu(i,{delay:e=0,duration:t=400,easing:n=mx,x:r=0,y:s=0,opacity:o=0}={}){const l=getComputedStyle(i),a=+l.opacity,c=l.transform==="none"?"":l.transform,u=a*(1-o),[h,f]=eg(r),[d,m]=eg(s);return{delay:e,duration:t,easing:n,css:(p,g)=>`
transform: ${c} translate(${(1-p)*h}${f}, ${(1-p)*d}${m});
opacity: ${a-u*g}`}}function dg(i){let e,t,n,r,s,o,l;return{c(){e=y("div"),t=y("div"),t.textContent="Success",n=D(),r=y("div"),s=W(i[1]),O(t,"class","title"),O(r,"class","content"),O(e,"class","notice notice-success"),O(e,"role","alert")},m(a,c){x(a,e,c),b(e,t),b(e,n),b(e,r),b(r,s),l=!0},p(a,c){(!l||c&2)&&K(s,a[1])},i(a){l||(a&&As(()=>{l&&(o||(o=lu(e,hu,{duration:500},!0)),o.run(1))}),l=!0)},o(a){a&&(o||(o=lu(e,hu,{duration:500},!1)),o.run(0)),l=!1},d(a){a&&P(e),a&&o&&o.end()}}}function px(i){let e,t=i[0]&&dg(i);return{c(){t&&t.c(),e=Ie()},m(n,r){t&&t.m(n,r),x(n,e,r)},p(n,[r]){n[0]?t?(t.p(n,r),r&1&&T(t,1)):(t=dg(n),t.c(),T(t,1),t.m(e.parentNode,e)):t&&(Oe(),R(t,1,1,()=>{t=null}),be())},i(n){T(t)},o(n){R(t)},d(n){n&&P(e),t&&t.d(n)}}}function gx(i,e,t){let n,r;function s(o="Saved"){t(1,n=o),t(0,r=!0),setTimeout(function(){t(0,r=!1)},2e3)}return t(1,n="Saved"),t(0,r=!1),[r,n,s]}class ay extends oe{constructor(e){super(),se(this,e,gx,px,re,{show:2})}get show(){return this.$$.ctx[2]}}function Ox(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,v,w,S,_,k,A,C,Q,M,L;t=new Ma({props:{message:i[2]}});let N={};return r=new ay({props:N}),i[8](r),l=new _i({props:{name:i[4].name}}),d=new uu({props:{label:"Update Name"}}),S=new uu({props:{label:"Update Email"}}),{c(){e=y("div"),V(t.$$.fragment),n=D(),V(r.$$.fragment),s=D(),o=y("h3"),V(l.$$.fragment),a=D(),c=y("form"),u=y("div"),h=y("input"),f=D(),V(d.$$.fragment),m=D(),p=y("form"),g=y("div"),v=y("input"),w=D(),V(S.$$.fragment),_=D(),k=y("div"),A=y("a"),C=W("Logout from this device"),O(o,"class","header-small mb-5"),O(h,"type","text"),O(h,"class","form-control mb-3"),O(h,"placeholder","Name"),h.required=!0,O(u,"class","input-group mb-5"),O(v,"type","email"),O(v,"class","form-control mb-3"),O(v,"placeholder","Email"),v.required=!0,O(g,"class","input-group mb-5"),O(A,"class","list-group-item list-group-item-action"),O(A,"href",i[5].lucentUrl+"/logout"),O(k,"class","list-group"),O(e,"class","wrapper-tiny")},m(B,J){x(B,e,J),Y(t,e,null),b(e,n),Y(r,e,null),b(e,s),b(e,o),Y(l,o,null),b(e,a),b(e,c),b(c,u),b(u,h),Le(h,i[0]),b(u,f),Y(d,u,null),b(e,m),b(e,p),b(p,g),b(g,v),Le(v,i[1]),b(g,w),Y(S,g,null),b(e,_),b(e,k),b(k,A),b(A,C),Q=!0,M||(L=[G(h,"input",i[9]),G(c,"submit",i[6]),G(v,"input",i[10]),G(p,"submit",i[7])],M=!0)},p(B,[J]){const te={};J&4&&(te.message=B[2]),t.$set(te);const ie={};r.$set(ie),J&1&&h.value!==B[0]&&Le(h,B[0]),J&2&&v.value!==B[1]&&Le(v,B[1])},i(B){Q||(T(t.$$.fragment,B),T(r.$$.fragment,B),T(l.$$.fragment,B),T(d.$$.fragment,B),T(S.$$.fragment,B),Q=!0)},o(B){R(t.$$.fragment,B),R(r.$$.fragment,B),R(l.$$.fragment,B),R(d.$$.fragment,B),R(S.$$.fragment,B),Q=!1},d(B){B&&P(e),z(t),i[8](null),z(r),z(l),z(d),z(S),M=!1,ht(L)}}}function bx(i,e,t){const n=Ue("user"),r=Ue("channel");let s=n.name,o=n.email,l="",a;function c(m){m.preventDefault(),t(2,l=""),Jn(r.lucentUrl+"/account/update-name",{name:s}).then(p=>{a.show()}).catch(p=>{var g;t(2,l=(g=p.response)==null?void 0:g.data.error),console.log({errorMessage:l})})}function u(m){m.preventDefault(),t(2,l=""),Jn(r.lucentUrl+"/account/update-email",{email:o}).then(p=>{a.show()}).catch(p=>{var g;t(2,l=(g=p.response)==null?void 0:g.data.error),console.log({errorMessage:l})})}function h(m){Ce[m?"unshift":"push"](()=>{a=m,t(3,a)})}function f(){s=this.value,t(0,s)}function d(){o=this.value,t(1,o)}return[s,o,l,a,n,r,c,u,h,f,d]}class vx extends oe{constructor(e){super(),se(this,e,bx,Ox,re,{})}}function wx(i){let e,t,n;const r=[{channel:i[3]},{title:i[0]},i[2]];var s=i[4][i[1]];function o(l,a){let c={};for(let u=0;u<r.length;u+=1)c=Ps(c,r[u]);return a!==void 0&&a&13&&(c=Ps(c,_o(r,[a&8&&{channel:l[3]},a&1&&{title:l[0]},a&4&&Co(l[2])]))),{props:c}}return s&&(t=Xr(s,o(i))),{c(){e=y("div"),t&&V(t.$$.fragment)},m(l,a){x(l,e,a),t&&Y(t,e,null),n=!0},p(l,[a]){if(a&2&&s!==(s=l[4][l[1]])){if(t){Oe();const c=t;R(c.$$.fragment,1,0,()=>{z(c,1)}),be()}s?(t=Xr(s,o(l,a)),V(t.$$.fragment),T(t.$$.fragment,1),Y(t,e,null)):t=null}else if(s){const c=a&13?_o(r,[a&8&&{channel:l[3]},a&1&&{title:l[0]},a&4&&Co(l[2])]):{};t.$set(c)}},i(l){n||(t&&T(t.$$.fragment,l),n=!0)},o(l){t&&R(t.$$.fragment,l),n=!1},d(l){l&&P(e),t&&z(t)}}}function yx(i,e,t){const n={register:ix,login:ax,verify:hx,profile:vx};let{title:r}=e,{view:s}=e,{user:o}=e,{data:l}=e,{channel:a}=e;return Ql("channel",a),Ql("user",o),i.$$set=c=>{"title"in c&&t(0,r=c.title),"view"in c&&t(1,s=c.view),"user"in c&&t(5,o=c.user),"data"in c&&t(2,l=c.data),"channel"in c&&t(3,a=c.channel)},[r,s,l,a,n,o]}class kx extends oe{constructor(e){super(),se(this,e,yx,wx,re,{title:0,view:1,user:5,data:2,channel:3})}}const Sx=i=>({}),mg=i=>({});function _x(i){let e;return{c(){e=W("Dropdown")},m(t,n){x(t,e,n)},d(t){t&&P(e)}}}function Cx(i){let e,t,n,r,s,o,l,a;const c=i[6].button,u=Hl(c,i,i[5],mg),h=u||_x(),f=i[6].default,d=Hl(f,i,i[5],null);return{c(){e=y("div"),t=y("button"),h&&h.c(),n=D(),r=y("div"),d&&d.c(),O(t,"class","button dropdown-button"),O(t,"type","button"),O(t,"aria-expanded","false"),O(r,"class",s="dropdown-menu hide orientation-"+i[0]),O(e,"class","dropdown")},m(m,p){x(m,e,p),b(e,t),h&&h.m(t,null),b(e,n),b(e,r),d&&d.m(r,null),i[7](r),o=!0,l||(a=[G(t,"click",i[1]),mP(qA.call(null,r)),G(r,"click_outside",i[3])],l=!0)},p(m,[p]){u&&u.p&&(!o||p&32)&&Jl(u,c,m,m[5],o?Kl(c,m[5],p,Sx):ea(m[5]),mg),d&&d.p&&(!o||p&32)&&Jl(d,f,m,m[5],o?Kl(f,m[5],p,null):ea(m[5]),null),(!o||p&1&&s!==(s="dropdown-menu hide orientation-"+m[0]))&&O(r,"class",s)},i(m){o||(T(h,m),T(d,m),o=!0)},o(m){R(h,m),R(d,m),o=!1},d(m){m&&P(e),h&&h.d(m),d&&d.d(m),i[7](null),l=!1,ht(a)}}}function Px(i,e,t){let{$$slots:n={},$$scope:r}=e,s,{orientation:o="left"}=e;function l(){s.classList.remove("hide")}function a(){s.classList.add("hide")}function c(){s.classList.add("hide")}function u(h){Ce[h?"unshift":"push"](()=>{s=h,t(2,s)})}return i.$$set=h=>{"orientation"in h&&t(0,o=h.orientation),"$$scope"in h&&t(5,r=h.$$scope)},[o,l,s,c,a,r,n,u]}class ur extends oe{constructor(e){super(),se(this,e,Px,Cx,re,{orientation:0,open:1,close:4})}get open(){return this.$$.ctx[1]}get close(){return this.$$.ctx[4]}}function pg(i,e,t){const n=i.slice();return n[7]=e[t],n}function gg(i,e,t){const n=i.slice();return n[7]=e[t],n}function Og(i){let e,t=i[7]+"",n,r,s;function o(...l){return i[4](i[7],...l)}return{c(){e=y("button"),n=W(t),O(e,"class","dropdown-item button")},m(l,a){x(l,e,a),b(e,n),r||(s=G(e,"click",o),r=!0)},p(l,a){i=l,a&2&&t!==(t=i[7]+"")&&K(n,t)},d(l){l&&P(e),r=!1,s()}}}function bg(i){let e=i[0].roles.includes(i[7]),t,n=e&&Og(i);return{c(){n&&n.c(),t=Ie()},m(r,s){n&&n.m(r,s),x(r,t,s)},p(r,s){s&3&&(e=r[0].roles.includes(r[7])),e?n?n.p(r,s):(n=Og(r),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},d(r){r&&P(t),n&&n.d(r)}}}function vg(i){let e,t=i[7]+"",n,r,s,o;function l(...a){return i[5](i[7],...a)}return{c(){e=y("button"),n=W(t),r=D(),O(e,"class","dropdown-item button")},m(a,c){x(a,e,c),b(e,n),b(e,r),s||(o=G(e,"click",l),s=!0)},p(a,c){i=a,c&2&&t!==(t=i[7]+"")&&K(n,t)},d(a){a&&P(e),s=!1,o()}}}function wg(i){let e=!i[0].roles.includes(i[7]),t,n=e&&vg(i);return{c(){n&&n.c(),t=Ie()},m(r,s){n&&n.m(r,s),x(r,t,s)},p(r,s){s&3&&(e=!r[0].roles.includes(r[7])),e?n?n.p(r,s):(n=vg(r),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},d(r){r&&P(t),n&&n.d(r)}}}function Ax(i){let e,t,n,r,s,o,l=fe(i[1]),a=[];for(let h=0;h<l.length;h+=1)a[h]=bg(gg(i,l,h));let c=fe(i[1]),u=[];for(let h=0;h<c.length;h+=1)u[h]=wg(pg(i,c,h));return{c(){e=y("h6"),e.textContent="Remove role",t=D();for(let h=0;h<a.length;h+=1)a[h].c();n=D(),r=y("h6"),r.textContent="Add role",s=D();for(let h=0;h<u.length;h+=1)u[h].c();o=Ie(),O(e,"class","dropdown-header"),O(r,"class","dropdown-header")},m(h,f){x(h,e,f),x(h,t,f);for(let d=0;d<a.length;d+=1)a[d]&&a[d].m(h,f);x(h,n,f),x(h,r,f),x(h,s,f);for(let d=0;d<u.length;d+=1)u[d]&&u[d].m(h,f);x(h,o,f)},p(h,f){if(f&7){l=fe(h[1]);let d;for(d=0;d<l.length;d+=1){const m=gg(h,l,d);a[d]?a[d].p(m,f):(a[d]=bg(m),a[d].c(),a[d].m(n.parentNode,n))}for(;d<a.length;d+=1)a[d].d(1);a.length=l.length}if(f&11){c=fe(h[1]);let d;for(d=0;d<c.length;d+=1){const m=pg(h,c,d);u[d]?u[d].p(m,f):(u[d]=wg(m),u[d].c(),u[d].m(o.parentNode,o))}for(;d<u.length;d+=1)u[d].d(1);u.length=c.length}},d(h){h&&(P(e),P(t),P(n),P(r),P(s),P(o)),Ot(a,h),Ot(u,h)}}}function xx(i){let e;return{c(){e=y("div"),e.textContent="Roles",O(e,"slot","button")},m(t,n){x(t,e,n)},p:U,d(t){t&&P(e)}}}function Tx(i){let e,t,n,r,s,o,l=i[0].name+"",a,c,u,h=i[0].email+"",f,d,m,p,g,v;return n=new _i({props:{name:i[0].name??"",side:32}}),p=new ur({props:{orientation:"right",$$slots:{button:[xx],default:[Ax]},$$scope:{ctx:i}}}),{c(){e=y("div"),t=y("div"),V(n.$$.fragment),r=D(),s=y("div"),o=y("div"),a=W(l),c=D(),u=y("div"),f=W(h),m=D(),V(p.$$.fragment),O(t,"class",d="member-name status-"+(i[0].roles.includes("removed")?"removed":"active")+" svelte-1jo1k1d"),O(e,"class","member-item")},m(w,S){x(w,e,S),b(e,t),Y(n,t,null),b(t,r),b(t,s),b(s,o),b(o,a),b(s,c),b(s,u),b(u,f),b(e,m),Y(p,e,null),v=!0},p(w,[S]){const _={};S&1&&(_.name=w[0].name??""),n.$set(_),(!v||S&1)&&l!==(l=w[0].name+"")&&K(a,l),(!v||S&1)&&h!==(h=w[0].email+"")&&K(f,h),(!v||S&1&&d!==(d="member-name status-"+(w[0].roles.includes("removed")?"removed":"active")+" svelte-1jo1k1d"))&&O(t,"class",d);const k={};S&4099&&(k.$$scope={dirty:S,ctx:w}),p.$set(k)},i(w){v||(T(n.$$.fragment,w),T(p.$$.fragment,w),w&&As(()=>{v&&(g||(g=lu(e,hu,{duration:200},!0)),g.run(1))}),v=!0)},o(w){R(n.$$.fragment,w),R(p.$$.fragment,w),w&&(g||(g=lu(e,hu,{duration:200},!1)),g.run(0)),v=!1},d(w){w&&P(e),z(n),z(p),w&&g&&g.end()}}}function Qx(i,e,t){const n=nn();let{member:r}=e,{roles:s}=e;function o(u,h){u.preventDefault();let f=r.roles.filter(d=>d!==h);n("update",{user:r.id,roles:f})}function l(u,h){u.preventDefault();let f=[...r.roles,h];console.log(r.roles),console.log(h),console.log(f),n("update",{user:r.id,roles:f})}const a=(u,h)=>o(h,u),c=(u,h)=>l(h,u);return i.$$set=u=>{"member"in u&&t(0,r=u.member),"roles"in u&&t(1,s=u.roles)},[r,s,o,l,a,c]}class Mx extends oe{constructor(e){super(),se(this,e,Qx,Tx,re,{member:0,roles:1})}}function yg(i,e,t){const n=i.slice();return n[15]=e[t],n}function kg(i,e,t){const n=i.slice();return n[18]=e[t],n}function Sg(i){let e,t=i[18]+"",n;return{c(){e=y("option"),n=W(t),e.__value=i[18],Le(e,e.__value)},m(r,s){x(r,e,s),b(e,n)},p:U,d(r){r&&P(e)}}}function _g(i){let e,t;return e=new Mx({props:{member:i[15],roles:i[6].roles}}),e.$on("update",i[9]),e.$on("reinvite",i[14]),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&1&&(s.member=n[15]),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function Ex(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,v,w,S,_,k,A,C,Q,M,L,N,B,J,te,ie;s=new Ma({props:{message:i[4]}});let ae={};l=new ay({props:ae}),i[10](l);let X=fe(i[6].roles.filter(Cg)),ee=[];for(let ne=0;ne<X.length;ne+=1)ee[ne]=Sg(kg(i,X,ne));Q=new uu({props:{label:"Invite"}});let Te=fe(i[0]),ve=[];for(let ne=0;ne<Te.length;ne+=1)ve[ne]=_g(yg(i,Te,ne));const je=ne=>R(ve[ne],1,1,()=>{ve[ne]=null});return{c(){e=y("div"),t=y("div"),n=y("h3"),n.textContent="Invite people",r=D(),V(s.$$.fragment),o=D(),V(l.$$.fragment),a=D(),c=y("form"),u=y("div"),h=y("label"),h.textContent="Invitee Name",f=D(),d=y("input"),m=D(),p=y("div"),g=y("label"),g.textContent="Invitee Email Address",v=D(),w=y("input"),S=D(),_=y("div"),k=y("select");for(let ne=0;ne<ee.length;ne+=1)ee[ne].c();A=D(),C=y("div"),V(Q.$$.fragment),M=D(),L=y("div"),N=y("h3"),N.textContent="Members",B=D();for(let ne=0;ne<ve.length;ne+=1)ve[ne].c();O(n,"class","header-small mb-5"),O(h,"for","inviteeName"),O(h,"class","form-label"),O(d,"type","text"),O(d,"class","form-control"),O(d,"id","inviteeName"),O(d,"placeholder","Member name"),d.required=!0,O(u,"class","mb-3"),O(g,"for","inviteeEmail"),O(g,"class","form-label"),O(w,"type","email"),O(w,"class","form-control"),O(w,"id","inviteeEmail"),O(w,"placeholder","Member email"),w.required=!0,O(p,"class","mb-3"),i[3]===void 0&&As(()=>i[13].call(k)),O(_,"class","me-3"),O(C,"class","mt-5 d-block text-center"),O(t,"class","lx-card mt-5"),O(N,"class","header-small mb-5 mt-5"),O(L,"class","member-list"),O(e,"class","common-wrapper")},m(ne,Ee){x(ne,e,Ee),b(e,t),b(t,n),b(t,r),Y(s,t,null),b(t,o),Y(l,t,null),b(t,a),b(t,c),b(c,u),b(u,h),b(u,f),b(u,d),Le(d,i[1]),b(c,m),b(c,p),b(p,g),b(p,v),b(p,w),Le(w,i[2]),b(c,S),b(c,_),b(_,k);for(let Re=0;Re<ee.length;Re+=1)ee[Re]&&ee[Re].m(k,null);tg(k,i[3],!0),b(c,A),b(c,C),Y(Q,C,null),b(e,M),b(e,L),b(L,N),b(L,B);for(let Re=0;Re<ve.length;Re+=1)ve[Re]&&ve[Re].m(L,null);J=!0,te||(ie=[G(d,"input",i[11]),G(w,"input",i[12]),G(k,"change",i[13]),G(c,"submit",i[7])],te=!0)},p(ne,[Ee]){const Re={};Ee&16&&(Re.message=ne[4]),s.$set(Re);const xt={};if(l.$set(xt),Ee&2&&d.value!==ne[1]&&Le(d,ne[1]),Ee&4&&w.value!==ne[2]&&Le(w,ne[2]),Ee&64){X=fe(ne[6].roles.filter(Cg));let H;for(H=0;H<X.length;H+=1){const Pe=kg(ne,X,H);ee[H]?ee[H].p(Pe,Ee):(ee[H]=Sg(Pe),ee[H].c(),ee[H].m(k,null))}for(;H<ee.length;H+=1)ee[H].d(1);ee.length=X.length}if(Ee&72&&tg(k,ne[3]),Ee&833){Te=fe(ne[0]);let H;for(H=0;H<Te.length;H+=1){const Pe=yg(ne,Te,H);ve[H]?(ve[H].p(Pe,Ee),T(ve[H],1)):(ve[H]=_g(Pe),ve[H].c(),T(ve[H],1),ve[H].m(L,null))}for(Oe(),H=Te.length;H<ve.length;H+=1)je(H);be()}},i(ne){if(!J){T(s.$$.fragment,ne),T(l.$$.fragment,ne),T(Q.$$.fragment,ne);for(let Ee=0;Ee<Te.length;Ee+=1)T(ve[Ee]);J=!0}},o(ne){R(s.$$.fragment,ne),R(l.$$.fragment,ne),R(Q.$$.fragment,ne),ve=ve.filter(Boolean);for(let Ee=0;Ee<ve.length;Ee+=1)R(ve[Ee]);J=!1},d(ne){ne&&P(e),z(s),i[10](null),z(l),Ot(ee,ne),z(Q),Ot(ve,ne),te=!1,ht(ie)}}}const Cg=i=>i!=="removed";function Rx(i,e,t){const n=Ue("channel");let{users:r}=e,s,o,l,a="",c;function u(w){w.preventDefault(),h(s,o,l)}function h(w,S,_){t(4,a=""),Jn(n.lucentUrl+"/members/invite",{name:w,email:S,roles:[_]}).then(k=>{c.show("User was invited"),t(0,r=[...r,k.user]),t(1,s=null),t(2,o=null),t(3,l=null)}).catch(k=>{var A,C;t(4,a=((C=(A=k.response)==null?void 0:A.data)==null?void 0:C.error)??"")})}function f(w){w.preventDefault(),t(4,a=""),Jn(n.lucentUrl+"/members/update",{id:w.detail.user,roles:w.detail.roles}).then(S=>{c.show("Users updated"),t(0,r=S.users)}).catch(S=>{var _,k;t(4,a=((k=(_=S.response)==null?void 0:_.data)==null?void 0:k.error)??"")})}function d(w){Ce[w?"unshift":"push"](()=>{c=w,t(5,c)})}function m(){s=this.value,t(1,s)}function p(){o=this.value,t(2,o)}function g(){l=kP(this),t(3,l),t(6,n)}const v=w=>h(w.detail.email,w.detail.role);return i.$$set=w=>{"users"in w&&t(0,r=w.users)},[r,s,o,l,a,c,n,u,h,f,d,m,p,g,v]}class Dx extends oe{constructor(e){super(),se(this,e,Rx,Ex,re,{users:0})}}function $x(i){let e,t,n;return{c(){e=y("div"),t=y("div"),n=W(i[0]),O(t,"class","header-normal"),O(e,"class","wrapper-normal ")},m(r,s){x(r,e,s),b(e,t),b(t,n)},p(r,[s]){s&1&&K(n,r[0])},i:U,o:U,d(r){r&&P(e)}}}function Lx(i,e,t){let{title:n}=e;return i.$$set=r=>{"title"in r&&t(0,n=r.title)},[n]}class Ix extends oe{constructor(e){super(),se(this,e,Lx,$x,re,{title:0})}}function Nx(i){let e,t=i[5].path+"";return{c(){e=wP("svg"),O(e,"class","bi svelte-1coky4l"),O(e,"xmlns","http://www.w3.org/2000/svg"),O(e,"width",i[0]),O(e,"height",i[1]),O(e,"viewBox",i[5].viewBox),O(e,"aria-labelledby",i[2]),O(e,"role","presentation"),O(e,"stroke",i[4]),O(e,"fill",i[3])},m(n,r){x(n,e,r),e.innerHTML=t},p(n,[r]){r&1&&O(e,"width",n[0]),r&2&&O(e,"height",n[1]),r&4&&O(e,"aria-labelledby",n[2]),r&16&&O(e,"stroke",n[4]),r&8&&O(e,"fill",n[3])},i:U,o:U,d(n){n&&P(e)}}}function Zx(i,e,t){const n={"trash-can":{path:'<path d="M135.2 17.69C140.6 6.848 151.7 0 163.8 0H284.2C296.3 0 307.4 6.848 312.8 17.69L320 32H416C433.7 32 448 46.33 448 64C448 81.67 433.7 96 416 96H32C14.33 96 0 81.67 0 64C0 46.33 14.33 32 32 32H128L135.2 17.69zM31.1 128H416V448C416 483.3 387.3 512 352 512H95.1C60.65 512 31.1 483.3 31.1 448V128zM111.1 208V432C111.1 440.8 119.2 448 127.1 448C136.8 448 143.1 440.8 143.1 432V208C143.1 199.2 136.8 192 127.1 192C119.2 192 111.1 199.2 111.1 208zM207.1 208V432C207.1 440.8 215.2 448 223.1 448C232.8 448 240 440.8 240 432V208C240 199.2 232.8 192 223.1 192C215.2 192 207.1 199.2 207.1 208zM304 208V432C304 440.8 311.2 448 320 448C328.8 448 336 440.8 336 432V208C336 199.2 328.8 192 320 192C311.2 192 304 199.2 304 208z"/>',viewBox:"0 0 448 512"},"circle-chevron-down":{path:'<path d="M256 0C114.6 0 0 114.6 0 256c0 141.4 114.6 256 256 256s256-114.6 256-256C512 114.6 397.4 0 256 0zM390.6 246.6l-112 112C272.4 364.9 264.2 368 256 368s-16.38-3.125-22.62-9.375l-112-112c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L256 290.8l89.38-89.38c12.5-12.5 32.75-12.5 45.25 0S403.1 234.1 390.6 246.6z"/>',viewBox:"0 0 512 512"},"circle-chevron-up":{path:'<path d="M256 0C114.6 0 0 114.6 0 256c0 141.4 114.6 256 256 256s256-114.6 256-256C512 114.6 397.4 0 256 0zM390.6 310.6c-12.5 12.5-32.75 12.5-45.25 0L256 221.3L166.6 310.6c-12.5 12.5-32.75 12.5-45.25 0s-12.5-32.75 0-45.25l112-112C239.6 147.1 247.8 144 256 144s16.38 3.125 22.62 9.375l112 112C403.1 277.9 403.1 298.1 390.6 310.6z"/>',viewBox:"0 0 512 512"},ellipsis:{path:'<path d="M120 256C120 286.9 94.93 312 64 312C33.07 312 8 286.9 8 256C8 225.1 33.07 200 64 200C94.93 200 120 225.1 120 256zM280 256C280 286.9 254.9 312 224 312C193.1 312 168 286.9 168 256C168 225.1 193.1 200 224 200C254.9 200 280 225.1 280 256zM328 256C328 225.1 353.1 200 384 200C414.9 200 440 225.1 440 256C440 286.9 414.9 312 384 312C353.1 312 328 286.9 328 256z"/>',viewBox:"0 0 448 512"},"ellipsis-vertical":{path:'<path d="M64 360C94.93 360 120 385.1 120 416C120 446.9 94.93 472 64 472C33.07 472 8 446.9 8 416C8 385.1 33.07 360 64 360zM64 200C94.93 200 120 225.1 120 256C120 286.9 94.93 312 64 312C33.07 312 8 286.9 8 256C8 225.1 33.07 200 64 200zM64 152C33.07 152 8 126.9 8 96C8 65.07 33.07 40 64 40C94.93 40 120 65.07 120 96C120 126.9 94.93 152 64 152z"/>',viewBox:"0 0 128 512"},"angles-down":{path:'<path d="M169.4 278.6C175.6 284.9 183.8 288 192 288s16.38-3.125 22.62-9.375l160-160c12.5-12.5 12.5-32.75 0-45.25s-32.75-12.5-45.25 0L192 210.8L54.63 73.38c-12.5-12.5-32.75-12.5-45.25 0s-12.5 32.75 0 45.25L169.4 278.6zM329.4 265.4L192 402.8L54.63 265.4c-12.5-12.5-32.75-12.5-45.25 0s-12.5 32.75 0 45.25l160 160C175.6 476.9 183.8 480 192 480s16.38-3.125 22.62-9.375l160-160c12.5-12.5 12.5-32.75 0-45.25S341.9 252.9 329.4 265.4z"/>',viewBox:"0 0 384 512"},"angle-right":{path:'<path d="M64 448c-8.188 0-16.38-3.125-22.62-9.375c-12.5-12.5-12.5-32.75 0-45.25L178.8 256L41.38 118.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0l160 160c12.5 12.5 12.5 32.75 0 45.25l-160 160C80.38 444.9 72.19 448 64 448z"/>',viewBox:"0 0 256 512"},"photo-film":{path:'<path d="M352 432c0 8.836-7.164 16-16 16H176c-8.838 0-16-7.164-16-16L160 128H48C21.49 128 .0003 149.5 .0003 176v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48L512 384h-160L352 432zM104 439c0 4.969-4.031 9-9 9h-30c-4.969 0-9-4.031-9-9v-30c0-4.969 4.031-9 9-9h30c4.969 0 9 4.031 9 9V439zM104 335c0 4.969-4.031 9-9 9h-30c-4.969 0-9-4.031-9-9v-30c0-4.969 4.031-9 9-9h30c4.969 0 9 4.031 9 9V335zM104 231c0 4.969-4.031 9-9 9h-30c-4.969 0-9-4.031-9-9v-30C56 196 60.03 192 65 192h30c4.969 0 9 4.031 9 9V231zM408 409c0-4.969 4.031-9 9-9h30c4.969 0 9 4.031 9 9v30c0 4.969-4.031 9-9 9h-30c-4.969 0-9-4.031-9-9V409zM591.1 0H239.1C213.5 0 191.1 21.49 191.1 48v256c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48v-256C640 21.49 618.5 0 591.1 0zM303.1 64c17.68 0 32 14.33 32 32s-14.32 32-32 32C286.3 128 271.1 113.7 271.1 96S286.3 64 303.1 64zM574.1 279.6C571.3 284.8 565.9 288 560 288H271.1C265.1 288 260.5 284.6 257.7 279.3C255 273.9 255.5 267.4 259.1 262.6l70-96C332.1 162.4 336.9 160 341.1 160c5.11 0 9.914 2.441 12.93 6.574l22.35 30.66l62.74-94.11C442.1 98.67 447.1 96 453.3 96c5.348 0 10.34 2.672 13.31 7.125l106.7 160C576.6 268 576.9 274.3 574.1 279.6z"/>',viewBox:"0 0 640 512"},file:{path:'<path d="M0 64C0 28.65 28.65 0 64 0H224V128C224 145.7 238.3 160 256 160H384V448C384 483.3 355.3 512 320 512H64C28.65 512 0 483.3 0 448V64zM256 128V0L384 128H256z"/>',viewBox:"0 0 384 512"},"circle-info":{path:'<path d="M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 128c17.67 0 32 14.33 32 32c0 17.67-14.33 32-32 32S224 177.7 224 160C224 142.3 238.3 128 256 128zM296 384h-80C202.8 384 192 373.3 192 360s10.75-24 24-24h16v-64H224c-13.25 0-24-10.75-24-24S210.8 224 224 224h32c13.25 0 24 10.75 24 24v88h16c13.25 0 24 10.75 24 24S309.3 384 296 384z"/>',viewBox:"0 0 512 512"},"table-columns":{path:'<path d="M0 96C0 60.65 28.65 32 64 32H448C483.3 32 512 60.65 512 96V416C512 451.3 483.3 480 448 480H64C28.65 480 0 451.3 0 416V96zM64 416H224V160H64V416zM448 160H288V416H448V160z"/>',viewBox:"0 0 512 512"},"arrow-down-a-z":{path:'<path d="M239.6 373.1c11.94-13.05 11.06-33.31-1.969-45.27c-13.55-12.42-33.76-10.52-45.22 1.973L160 366.1V64.03c0-17.7-14.33-32.03-32-32.03S96 46.33 96 64.03v302l-32.4-35.39C51.64 317.7 31.39 316.7 18.38 328.7c-13.03 11.95-13.9 32.22-1.969 45.27l87.1 96.09c12.12 13.26 35.06 13.26 47.19 0L239.6 373.1zM448 416h-50.75l73.38-73.38c9.156-9.156 11.89-22.91 6.938-34.88S460.9 288 447.1 288H319.1C302.3 288 288 302.3 288 320s14.33 32 32 32h50.75l-73.38 73.38c-9.156 9.156-11.89 22.91-6.938 34.88S307.1 480 319.1 480h127.1C465.7 480 480 465.7 480 448S465.7 416 448 416zM492.6 209.3l-79.99-160.1c-10.84-21.81-46.4-21.81-57.24 0L275.4 209.3c-7.906 15.91-1.5 35.24 14.31 43.19c15.87 7.922 35.04 1.477 42.93-14.4l7.154-14.39h88.43l7.154 14.39c6.174 12.43 23.97 23.87 42.93 14.4C494.1 244.6 500.5 225.2 492.6 209.3zM367.8 167.4L384 134.7l16.22 32.63H367.8z"/>',viewBox:"0 0 512 512"},"arrow-up-short-wide":{path:'<path d="M544 416h-223.1c-17.67 0-32 14.33-32 32s14.33 32 32 32H544c17.67 0 32-14.33 32-32S561.7 416 544 416zM320 96h32c17.67 0 31.1-14.33 31.1-32s-14.33-32-31.1-32h-32c-17.67 0-32 14.33-32 32S302.3 96 320 96zM320 224H416c17.67 0 32-14.33 32-32s-14.33-32-32-32h-95.1c-17.67 0-32 14.33-32 32S302.3 224 320 224zM320 352H480c17.67 0 32-14.33 32-32s-14.33-32-32-32h-159.1c-17.67 0-32 14.33-32 32S302.3 352 320 352zM151.6 41.95c-12.12-13.26-35.06-13.26-47.19 0l-87.1 96.09C4.475 151.1 5.35 171.4 18.38 183.3c6.141 5.629 13.89 8.414 21.61 8.414c8.672 0 17.3-3.504 23.61-10.39L96 145.9v302C96 465.7 110.3 480 128 480s32-14.33 32-32.03V145.9L192.4 181.3C204.4 194.3 224.6 195.3 237.6 183.3c13.03-11.95 13.9-32.22 1.969-45.27L151.6 41.95z"/>',viewBox:"0 0 576 512"},"arrow-down-wide-short":{path:'<path d="M416 288h-95.1c-17.67 0-32 14.33-32 32s14.33 32 32 32H416c17.67 0 32-14.33 32-32S433.7 288 416 288zM544 32h-223.1c-17.67 0-32 14.33-32 32s14.33 32 32 32H544c17.67 0 32-14.33 32-32S561.7 32 544 32zM352 416h-32c-17.67 0-32 14.33-32 32s14.33 32 32 32h32c17.67 0 31.1-14.33 31.1-32S369.7 416 352 416zM480 160h-159.1c-17.67 0-32 14.33-32 32s14.33 32 32 32H480c17.67 0 32-14.33 32-32S497.7 160 480 160zM192.4 330.7L160 366.1V64.03C160 46.33 145.7 32 128 32S96 46.33 96 64.03v302L63.6 330.7c-6.312-6.883-14.94-10.38-23.61-10.38c-7.719 0-15.47 2.781-21.61 8.414c-13.03 11.95-13.9 32.22-1.969 45.27l87.1 96.09c12.12 13.26 35.06 13.26 47.19 0l87.1-96.09c11.94-13.05 11.06-33.31-1.969-45.27C224.6 316.8 204.4 317.7 192.4 330.7z"/>',viewBox:"0 0 576 512"},filter:{path:'<path d="M3.853 54.87C10.47 40.9 24.54 32 40 32H472C487.5 32 501.5 40.9 508.1 54.87C514.8 68.84 512.7 85.37 502.1 97.33L320 320.9V448C320 460.1 313.2 471.2 302.3 476.6C291.5 482 278.5 480.9 268.8 473.6L204.8 425.6C196.7 419.6 192 410.1 192 400V320.9L9.042 97.33C-.745 85.37-2.765 68.84 3.854 54.87L3.853 54.87z"/>',viewBox:"0 0 512 512"},calendar:{path:'<path d="M96 32C96 14.33 110.3 0 128 0C145.7 0 160 14.33 160 32V64H288V32C288 14.33 302.3 0 320 0C337.7 0 352 14.33 352 32V64H400C426.5 64 448 85.49 448 112V160H0V112C0 85.49 21.49 64 48 64H96V32zM448 464C448 490.5 426.5 512 400 512H48C21.49 512 0 490.5 0 464V192H448V464z"/>',viewBox:"0 0 448 512"},pencil:{path:'<path d="M421.7 220.3L188.5 453.4L154.6 419.5L158.1 416H112C103.2 416 96 408.8 96 400V353.9L92.51 357.4C87.78 362.2 84.31 368 82.42 374.4L59.44 452.6L137.6 429.6C143.1 427.7 149.8 424.2 154.6 419.5L188.5 453.4C178.1 463.8 165.2 471.5 151.1 475.6L30.77 511C22.35 513.5 13.24 511.2 7.03 504.1C.8198 498.8-1.502 489.7 .976 481.2L36.37 360.9C40.53 346.8 48.16 333.9 58.57 323.5L291.7 90.34L421.7 220.3zM492.7 58.75C517.7 83.74 517.7 124.3 492.7 149.3L444.3 197.7L314.3 67.72L362.7 19.32C387.7-5.678 428.3-5.678 453.3 19.32L492.7 58.75z"/>',viewBox:"0 0 512 512"},database:{path:'<path d="M448 80V128C448 172.2 347.7 208 224 208C100.3 208 0 172.2 0 128V80C0 35.82 100.3 0 224 0C347.7 0 448 35.82 448 80zM393.2 214.7C413.1 207.3 433.1 197.8 448 186.1V288C448 332.2 347.7 368 224 368C100.3 368 0 332.2 0 288V186.1C14.93 197.8 34.02 207.3 54.85 214.7C99.66 230.7 159.5 240 224 240C288.5 240 348.3 230.7 393.2 214.7V214.7zM54.85 374.7C99.66 390.7 159.5 400 224 400C288.5 400 348.3 390.7 393.2 374.7C413.1 367.3 433.1 357.8 448 346.1V432C448 476.2 347.7 512 224 512C100.3 512 0 476.2 0 432V346.1C14.93 357.8 34.02 367.3 54.85 374.7z"/>',viewBox:"0 0 448 512"},dice:{path:'<path d="M447.1 224c0-12.56-4.781-25.13-14.35-34.76l-174.9-174.9C249.1 4.786 236.5 0 223.1 0C211.4 0 198.9 4.786 189.2 14.35L14.35 189.2C4.783 198.9-.0011 211.4-.0011 223.1c0 12.56 4.785 25.17 14.35 34.8l174.9 174.9c9.625 9.562 22.19 14.35 34.75 14.35s25.13-4.783 34.75-14.35l174.9-174.9C443.2 249.1 447.1 236.6 447.1 224zM96 248c-13.25 0-23.1-10.75-23.1-23.1s10.75-23.1 23.1-23.1S120 210.8 120 224S109.3 248 96 248zM224 376c-13.25 0-23.1-10.75-23.1-23.1s10.75-23.1 23.1-23.1s23.1 10.75 23.1 23.1S237.3 376 224 376zM224 248c-13.25 0-23.1-10.75-23.1-23.1s10.75-23.1 23.1-23.1S248 210.8 248 224S237.3 248 224 248zM224 120c-13.25 0-23.1-10.75-23.1-23.1s10.75-23.1 23.1-23.1s23.1 10.75 23.1 23.1S237.3 120 224 120zM352 248c-13.25 0-23.1-10.75-23.1-23.1s10.75-23.1 23.1-23.1s23.1 10.75 23.1 23.1S365.3 248 352 248zM591.1 192l-118.7 0c4.418 10.27 6.604 21.25 6.604 32.23c0 20.7-7.865 41.38-23.63 57.14l-136.2 136.2v46.37C320 490.5 341.5 512 368 512h223.1c26.5 0 47.1-21.5 47.1-47.1V240C639.1 213.5 618.5 192 591.1 192zM479.1 376c-13.25 0-23.1-10.75-23.1-23.1s10.75-23.1 23.1-23.1s23.1 10.75 23.1 23.1S493.2 376 479.1 376z"/>',viewBox:"0 0 640 512"},"triangle-exclamation":{path:'<path d="M506.3 417l-213.3-364c-16.33-28-57.54-28-73.98 0l-213.2 364C-10.59 444.9 9.849 480 42.74 480h426.6C502.1 480 522.6 445 506.3 417zM232 168c0-13.25 10.75-24 24-24S280 154.8 280 168v128c0 13.25-10.75 24-23.1 24S232 309.3 232 296V168zM256 416c-17.36 0-31.44-14.08-31.44-31.44c0-17.36 14.07-31.44 31.44-31.44s31.44 14.08 31.44 31.44C287.4 401.9 273.4 416 256 416z"/>',viewBox:"0 0 512 512"},eye:{path:'<path d="M279.6 160.4C282.4 160.1 285.2 160 288 160C341 160 384 202.1 384 256C384 309 341 352 288 352C234.1 352 192 309 192 256C192 253.2 192.1 250.4 192.4 247.6C201.7 252.1 212.5 256 224 256C259.3 256 288 227.3 288 192C288 180.5 284.1 169.7 279.6 160.4zM480.6 112.6C527.4 156 558.7 207.1 573.5 243.7C576.8 251.6 576.8 260.4 573.5 268.3C558.7 304 527.4 355.1 480.6 399.4C433.5 443.2 368.8 480 288 480C207.2 480 142.5 443.2 95.42 399.4C48.62 355.1 17.34 304 2.461 268.3C-.8205 260.4-.8205 251.6 2.461 243.7C17.34 207.1 48.62 156 95.42 112.6C142.5 68.84 207.2 32 288 32C368.8 32 433.5 68.84 480.6 112.6V112.6zM288 112C208.5 112 144 176.5 144 256C144 335.5 208.5 400 288 400C367.5 400 432 335.5 432 256C432 176.5 367.5 112 288 112z"/>',viewBox:"0 0 576 512"},"circle-plus":{path:'<path d="M0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256zM256 368C269.3 368 280 357.3 280 344V280H344C357.3 280 368 269.3 368 256C368 242.7 357.3 232 344 232H280V168C280 154.7 269.3 144 256 144C242.7 144 232 154.7 232 168V232H168C154.7 232 144 242.7 144 256C144 269.3 154.7 280 168 280H232V344C232 357.3 242.7 368 256 368z"/>',viewBox:"0 0 512 512"},"magnifying-glass":{path:'<path d="M500.3 443.7l-119.7-119.7c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723C99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9c53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0C515.9 484.7 515.9 459.3 500.3 443.7zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128c0 70.58-57.42 128-128 128S79.1 278.6 79.1 208z"/>',viewBox:"0 0 512 512"},expand:{path:'<path d="M128 32H32C14.31 32 0 46.31 0 64v96c0 17.69 14.31 32 32 32s32-14.31 32-32V96h64c17.69 0 32-14.31 32-32S145.7 32 128 32zM416 32h-96c-17.69 0-32 14.31-32 32s14.31 32 32 32h64v64c0 17.69 14.31 32 32 32s32-14.31 32-32V64C448 46.31 433.7 32 416 32zM128 416H64v-64c0-17.69-14.31-32-32-32s-32 14.31-32 32v96c0 17.69 14.31 32 32 32h96c17.69 0 32-14.31 32-32S145.7 416 128 416zM416 320c-17.69 0-32 14.31-32 32v64h-64c-17.69 0-32 14.31-32 32s14.31 32 32 32h96c17.69 0 32-14.31 32-32v-96C448 334.3 433.7 320 416 320z"/>',viewBox:"0 0 448 512"},compress:{path:'<path d="M128 320H32c-17.69 0-32 14.31-32 32s14.31 32 32 32h64v64c0 17.69 14.31 32 32 32s32-14.31 32-32v-96C160 334.3 145.7 320 128 320zM416 320h-96c-17.69 0-32 14.31-32 32v96c0 17.69 14.31 32 32 32s32-14.31 32-32v-64h64c17.69 0 32-14.31 32-32S433.7 320 416 320zM320 192h96c17.69 0 32-14.31 32-32s-14.31-32-32-32h-64V64c0-17.69-14.31-32-32-32s-32 14.31-32 32v96C288 177.7 302.3 192 320 192zM128 32C110.3 32 96 46.31 96 64v64H32C14.31 128 0 142.3 0 160s14.31 32 32 32h96c17.69 0 32-14.31 32-32V64C160 46.31 145.7 32 128 32z"/>',viewBox:"0 0 448 512"},check:{path:'<path d="M438.6 105.4C451.1 117.9 451.1 138.1 438.6 150.6L182.6 406.6C170.1 419.1 149.9 419.1 137.4 406.6L9.372 278.6C-3.124 266.1-3.124 245.9 9.372 233.4C21.87 220.9 42.13 220.9 54.63 233.4L159.1 338.7L393.4 105.4C405.9 92.88 426.1 92.88 438.6 105.4H438.6z"/>',viewBox:"0 0 448 512"},close:{path:'<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18 17.94 6M18 18 6.06 6"/>',viewBox:"0 0 24 24"},"arrow-left":{path:'<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M5 12l4-4m-4 4 4 4"/>',viewBox:"0 0 24 24"},list:{path:'<path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9 8h10M9 12h10M9 16h10M4.99 8H5m-.02 4h.01m0 4H5"/>',viewBox:"0 0 24 24"},"ordered-list":{path:'<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6h8m-8 6h8m-8 6h8M4 16a2 2 0 1 1 3.321 1.5L4 20h5M4 5l2-1v6m-2 0h4"/>',viewBox:"0 0 24 24"},italic:{path:'<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m8.874 19 6.143-14M6 19h6.33m-.66-14H18"/>',viewBox:"0 0 24 24"},upload:{path:'<path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5"/> <path d="M7.646 1.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 2.707V11.5a.5.5 0 0 1-1 0V2.707L5.354 4.854a.5.5 0 1 1-.708-.708z"/>',viewBox:"0 0 16 16"}};let{width:r=16}=e,{height:s=16}=e,{icon:o=""}=e,{fill:l="currentColor"}=e,{stroke:a="currentColor"}=e,c=n[o];return i.$$set=u=>{"width"in u&&t(0,r=u.width),"height"in u&&t(1,s=u.height),"icon"in u&&t(2,o=u.icon),"fill"in u&&t(3,l=u.fill),"stroke"in u&&t(4,a=u.stroke)},[r,s,o,l,a,c]}class ut extends oe{constructor(e){super(),se(this,e,Zx,Nx,re,{width:0,height:1,icon:2,fill:3,stroke:4})}}function Bx(i){let e,t,n;return{c(){e=y("input"),O(e,"type","checkbox"),e.value=i[0],O(e,"class","switch"),e.checked=i[1]},m(r,s){x(r,e,s),t||(n=G(e,"change",i[2]),t=!0)},p(r,[s]){s&1&&(e.value=r[0]),s&2&&(e.checked=r[1])},i:U,o:U,d(r){r&&P(e),t=!1,n()}}}function Wx(i,e,t){let{value:n}=e,{checked:r=!1}=e;function s(o){vs.call(this,i,o)}return i.$$set=o=>{"value"in o&&t(0,n=o.value),"checked"in o&&t(1,r=o.checked)},[n,r,s]}class Xx extends oe{constructor(e){super(),se(this,e,Wx,Bx,re,{value:0,checked:1})}}function Pg(i){let e,t;return e=new Xx({props:{value:"published",checked:i[0].status==="published"}}),e.$on("change",i[1]),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&1&&(s.checked=n[0].status==="published"),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function Fx(i){let e;return{c(){e=W("Trashed")},m(t,n){x(t,e,n)},d(t){t&&P(e)}}}function Yx(i){let e;return{c(){e=W("Draft")},m(t,n){x(t,e,n)},d(t){t&&P(e)}}}function zx(i){let e;return{c(){e=W("Published")},m(t,n){x(t,e,n)},d(t){t&&P(e)}}}function Vx(i){let e,t,n,r=i[0].status!=="trashed"&&Pg(i);function s(a,c){if(a[0].status==="published")return zx;if(a[0].status==="draft")return Yx;if(a[0].status==="trashed")return Fx}let o=s(i),l=o&&o(i);return{c(){r&&r.c(),e=D(),l&&l.c(),t=Ie()},m(a,c){r&&r.m(a,c),x(a,e,c),l&&l.m(a,c),x(a,t,c),n=!0},p(a,[c]){a[0].status!=="trashed"?r?(r.p(a,c),c&1&&T(r,1)):(r=Pg(a),r.c(),T(r,1),r.m(e.parentNode,e)):r&&(Oe(),R(r,1,1,()=>{r=null}),be()),o!==(o=s(a))&&(l&&l.d(1),l=o&&o(a),l&&(l.c(),l.m(t.parentNode,t)))},i(a){n||(T(r),n=!0)},o(a){R(r),n=!1},d(a){a&&(P(e),P(t)),r&&r.d(a),l&&l.d(a)}}}function Ux(i,e,t){let{status:n="draft"}=e,{record:r}=e;function s(o){o.target.checked?t(2,n="published"):t(2,n="draft")}return i.$$set=o=>{"status"in o&&t(2,n=o.status),"record"in o&&t(0,r=o.record)},[r,s,n]}class jx extends oe{constructor(e){super(),se(this,e,Ux,Vx,re,{status:2,record:0})}}function Ag(i){let e,t;return e=new ur({props:{$$slots:{button:[Gx],default:[qx]},$$scope:{ctx:i}}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&270&&(s.$$scope={dirty:r,ctx:n}),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function xg(i){let e,t,n,r;return{c(){e=y("a"),t=W("Clone"),O(e,"class","dropdown-item"),O(e,"href",i[4].lucentUrl)},m(s,o){x(s,e,o),b(e,t),n||(r=G(e,"click",i[5]),n=!0)},p:U,d(s){s&&P(e),n=!1,r()}}}function qx(i){let e,t,n,r,s,o,l,a,c,u,h,f=!i[3]&&xg(i);return{c(){e=y("h6"),e.textContent="Record Actions",t=D(),n=y("a"),r=W("Create new"),o=D(),f&&f.c(),l=D(),a=y("a"),c=W("Revisions"),O(e,"class","dropdown-header"),O(n,"class","dropdown-item"),O(n,"href",s=i[4].lucentUrl+"/records/new?schema="+i[2].name),O(a,"class","dropdown-item"),O(a,"href",i[4].lucentUrl)},m(d,m){x(d,e,m),x(d,t,m),x(d,n,m),b(n,r),x(d,o,m),f&&f.m(d,m),x(d,l,m),x(d,a,m),b(a,c),u||(h=G(a,"click",Ln(i[6])),u=!0)},p(d,m){m&4&&s!==(s=d[4].lucentUrl+"/records/new?schema="+d[2].name)&&O(n,"href",s),d[3]?f&&(f.d(1),f=null):f?f.p(d,m):(f=xg(d),f.c(),f.m(l.parentNode,l))},d(d){d&&(P(e),P(t),P(n),P(o),P(l),P(a)),f&&f.d(d),u=!1,h()}}}function Gx(i){let e,t,n;return t=new ut({props:{icon:"ellipsis"}}),{c(){e=y("div"),V(t.$$.fragment),O(e,"slot","button")},m(r,s){x(r,e,s),Y(t,e,null),n=!0},p:U,i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){R(t.$$.fragment,r),n=!1},d(r){r&&P(e),z(t)}}}function Hx(i){let e,t,n,r,s,o=!i[3]&&Ag(i);function l(c){i[7](c)}let a={record:i[0]};return i[0].status!==void 0&&(a.status=i[0].status),n=new jx({props:a}),Ce.push(()=>nt(n,"status",l)),{c(){e=y("div"),o&&o.c(),t=D(),V(n.$$.fragment),le(e,"display","flex"),le(e,"align-items","center"),le(e,"gap","10px")},m(c,u){x(c,e,u),o&&o.m(e,null),b(e,t),Y(n,e,null),s=!0},p(c,[u]){c[3]?o&&(Oe(),R(o,1,1,()=>{o=null}),be()):o?(o.p(c,u),u&8&&T(o,1)):(o=Ag(c),o.c(),T(o,1),o.m(e,t));const h={};u&1&&(h.record=c[0]),!r&&u&1&&(r=!0,h.status=c[0].status,st(()=>r=!1)),n.$set(h)},i(c){s||(T(o),T(n.$$.fragment,c),s=!0)},o(c){R(o),R(n.$$.fragment,c),s=!1},d(c){c&&P(e),o&&o.d(),z(n)}}}function Kx(i,e,t){const n=Ue("channel");let{schema:r}=e,{record:s}=e,{isCreateMode:o}=e,{activeContentTab:l}=e;function a(h){h.preventDefault(),Jn(n.lucentUrl+"/records/clone/"+s.id).then(f=>{window.location=n.lucentUrl+"/records/"+f.id}).catch(f=>{})}const c=h=>t(1,l="_info");function u(h){i.$$.not_equal(s.status,h)&&(s.status=h,t(0,s))}return i.$$set=h=>{"schema"in h&&t(2,r=h.schema),"record"in h&&t(0,s=h.record),"isCreateMode"in h&&t(3,o=h.isCreateMode),"activeContentTab"in h&&t(1,l=h.activeContentTab)},[s,l,r,o,n,a,c,u]}class cy extends oe{constructor(e){super(),se(this,e,Kx,Hx,re,{schema:2,record:0,isCreateMode:3,activeContentTab:1})}}function Tg(i,e,t){const n=i.slice();return n[9]=e[t],n}function Qg(i){let e,t=fe(i[1]),n=[];for(let r=0;r<t.length;r+=1)n[r]=Mg(Tg(i,t,r));return{c(){e=y("ul");for(let r=0;r<n.length;r+=1)n[r].c();O(e,"class","tabs")},m(r,s){x(r,e,s);for(let o=0;o<n.length;o+=1)n[o]&&n[o].m(e,null)},p(r,s){if(s&7){t=fe(r[1]);let o;for(o=0;o<t.length;o+=1){const l=Tg(r,t,o);n[o]?n[o].p(l,s):(n[o]=Mg(l),n[o].c(),n[o].m(e,null))}for(;o<n.length;o+=1)n[o].d(1);n.length=t.length}},d(r){r&&P(e),Ot(n,r)}}}function Mg(i){let e,t,n=i[9].label+"",r,s,o,l;function a(...c){return i[5](i[9],...c)}return{c(){e=y("li"),t=y("button"),r=W(n),s=D(),O(t,"class","button"),O(t,"aria-current","page"),Ae(t,"active",i[0]===i[9].name),O(e,"class","tab")},m(c,u){x(c,e,u),b(e,t),b(t,r),b(e,s),o||(l=G(t,"click",a),o=!0)},p(c,u){i=c,u&2&&n!==(n=i[9].label+"")&&K(r,n),u&3&&Ae(t,"active",i[0]===i[9].name)},d(c){c&&P(e),o=!1,l()}}}function Jx(i){let e,t=i[1].length>1&&Qg(i);return{c(){t&&t.c(),e=Ie()},m(n,r){t&&t.m(n,r),x(n,e,r)},p(n,[r]){n[1].length>1?t?t.p(n,r):(t=Qg(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:U,o:U,d(n){n&&P(e),t&&t.d(n)}}}function e3(i,e,t){var f;let{schema:n}=e,{isCreateMode:r}=e,{active:s=""}=e,o=((f=n.groups)==null?void 0:f.map(d=>({label:d,name:d})))??[],l={label:"Main",name:""},a={label:"Backlinks",name:"_graph"};r?o=[l,...o]:o=[l,...o,a];function c(d){d.preventDefault(),t(0,s="_graph")}function u(d,m){d.preventDefault(),m=="_graph"?c(d):t(0,s=m)}const h=(d,m)=>u(m,d.name);return i.$$set=d=>{"schema"in d&&t(3,n=d.schema),"isCreateMode"in d&&t(4,r=d.isCreateMode),"active"in d&&t(0,s=d.active)},[s,o,u,n,r,h]}class uy extends oe{constructor(e){super(),se(this,e,e3,Jx,re,{schema:3,isCreateMode:4,active:0})}}function In(i,e){return i&&i[e]?i[e].message:null}function hr(i){return Array.isArray?Array.isArray(i):dy(i)==="[object Array]"}function t3(i){if(typeof i=="string")return i;let e=i+"";return e=="0"&&1/i==-1/0?"-0":e}function n3(i){return i==null?"":t3(i)}function Wi(i){return typeof i=="string"}function hy(i){return typeof i=="number"}function i3(i){return i===!0||i===!1||r3(i)&&dy(i)=="[object Boolean]"}function fy(i){return typeof i=="object"}function r3(i){return fy(i)&&i!==null}function Un(i){return i!=null}function Dh(i){return!i.trim().length}function dy(i){return i==null?i===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(i)}const s3="Incorrect 'index' type",o3=i=>`Invalid value for key ${i}`,l3=i=>`Pattern length exceeds max of ${i}.`,a3=i=>`Missing ${i} property in key`,c3=i=>`Property 'weight' in key '${i}' must be a positive integer`,Eg=Object.prototype.hasOwnProperty;class u3{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(n=>{let r=my(n);this._keys.push(r),this._keyMap[r.id]=r,t+=r.weight}),this._keys.forEach(n=>{n.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function my(i){let e=null,t=null,n=null,r=1,s=null;if(Wi(i)||hr(i))n=i,e=Rg(i),t=hd(i);else{if(!Eg.call(i,"name"))throw new Error(a3("name"));const o=i.name;if(n=o,Eg.call(i,"weight")&&(r=i.weight,r<=0))throw new Error(c3(o));e=Rg(o),t=hd(o),s=i.getFn}return{path:e,id:t,weight:r,src:n,getFn:s}}function Rg(i){return hr(i)?i:i.split(".")}function hd(i){return hr(i)?i.join("."):i}function h3(i,e){let t=[],n=!1;const r=(s,o,l)=>{if(Un(s))if(!o[l])t.push(s);else{let a=o[l];const c=s[a];if(!Un(c))return;if(l===o.length-1&&(Wi(c)||hy(c)||i3(c)))t.push(n3(c));else if(hr(c)){n=!0;for(let u=0,h=c.length;u<h;u+=1)r(c[u],o,l+1)}else o.length&&r(c,o,l+1)}};return r(i,Wi(e)?e.split("."):e,0),n?t:t[0]}const f3={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},d3={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(i,e)=>i.score===e.score?i.idx<e.idx?-1:1:i.score<e.score?-1:1},m3={location:0,threshold:.6,distance:100},p3={useExtendedSearch:!1,getFn:h3,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var Be={...d3,...f3,...m3,...p3};const g3=/[^ ]+/g;function O3(i=1,e=3){const t=new Map,n=Math.pow(10,e);return{get(r){const s=r.match(g3).length;if(t.has(s))return t.get(s);const o=1/Math.pow(s,.5*i),l=parseFloat(Math.round(o*n)/n);return t.set(s,l),l},clear(){t.clear()}}}class Ym{constructor({getFn:e=Be.getFn,fieldNormWeight:t=Be.fieldNormWeight}={}){this.norm=O3(t,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((t,n)=>{this._keysMap[t.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,Wi(this.docs[0])?this.docs.forEach((e,t)=>{this._addString(e,t)}):this.docs.forEach((e,t)=>{this._addObject(e,t)}),this.norm.clear())}add(e){const t=this.size();Wi(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,n=this.size();t<n;t+=1)this.records[t].i-=1}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!Un(e)||Dh(e))return;let n={v:e,i:t,n:this.norm.get(e)};this.records.push(n)}_addObject(e,t){let n={i:t,$:{}};this.keys.forEach((r,s)=>{let o=r.getFn?r.getFn(e):this.getFn(e,r.path);if(Un(o)){if(hr(o)){let l=[];const a=[{nestedArrIndex:-1,value:o}];for(;a.length;){const{nestedArrIndex:c,value:u}=a.pop();if(Un(u))if(Wi(u)&&!Dh(u)){let h={v:u,i:c,n:this.norm.get(u)};l.push(h)}else hr(u)&&u.forEach((h,f)=>{a.push({nestedArrIndex:f,value:h})})}n.$[s]=l}else if(Wi(o)&&!Dh(o)){let l={v:o,n:this.norm.get(o)};n.$[s]=l}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function py(i,e,{getFn:t=Be.getFn,fieldNormWeight:n=Be.fieldNormWeight}={}){const r=new Ym({getFn:t,fieldNormWeight:n});return r.setKeys(i.map(my)),r.setSources(e),r.create(),r}function b3(i,{getFn:e=Be.getFn,fieldNormWeight:t=Be.fieldNormWeight}={}){const{keys:n,records:r}=i,s=new Ym({getFn:e,fieldNormWeight:t});return s.setKeys(n),s.setIndexRecords(r),s}function Ha(i,{errors:e=0,currentLocation:t=0,expectedLocation:n=0,distance:r=Be.distance,ignoreLocation:s=Be.ignoreLocation}={}){const o=e/i.length;if(s)return o;const l=Math.abs(n-t);return r?o+l/r:l?1:o}function v3(i=[],e=Be.minMatchCharLength){let t=[],n=-1,r=-1,s=0;for(let o=i.length;s<o;s+=1){let l=i[s];l&&n===-1?n=s:!l&&n!==-1&&(r=s-1,r-n+1>=e&&t.push([n,r]),n=-1)}return i[s-1]&&s-n>=e&&t.push([n,s-1]),t}const ms=32;function w3(i,e,t,{location:n=Be.location,distance:r=Be.distance,threshold:s=Be.threshold,findAllMatches:o=Be.findAllMatches,minMatchCharLength:l=Be.minMatchCharLength,includeMatches:a=Be.includeMatches,ignoreLocation:c=Be.ignoreLocation}={}){if(e.length>ms)throw new Error(l3(ms));const u=e.length,h=i.length,f=Math.max(0,Math.min(n,h));let d=s,m=f;const p=l>1||a,g=p?Array(h):[];let v;for(;(v=i.indexOf(e,m))>-1;){let C=Ha(e,{currentLocation:v,expectedLocation:f,distance:r,ignoreLocation:c});if(d=Math.min(C,d),m=v+u,p){let Q=0;for(;Q<u;)g[v+Q]=1,Q+=1}}m=-1;let w=[],S=1,_=u+h;const k=1<<u-1;for(let C=0;C<u;C+=1){let Q=0,M=_;for(;Q<M;)Ha(e,{errors:C,currentLocation:f+M,expectedLocation:f,distance:r,ignoreLocation:c})<=d?Q=M:_=M,M=Math.floor((_-Q)/2+Q);_=M;let L=Math.max(1,f-M+1),N=o?h:Math.min(f+M,h)+u,B=Array(N+2);B[N+1]=(1<<C)-1;for(let te=N;te>=L;te-=1){let ie=te-1,ae=t[i.charAt(ie)];if(p&&(g[ie]=+!!ae),B[te]=(B[te+1]<<1|1)&ae,C&&(B[te]|=(w[te+1]|w[te])<<1|1|w[te+1]),B[te]&k&&(S=Ha(e,{errors:C,currentLocation:ie,expectedLocation:f,distance:r,ignoreLocation:c}),S<=d)){if(d=S,m=ie,m<=f)break;L=Math.max(1,2*f-m)}}if(Ha(e,{errors:C+1,currentLocation:f,expectedLocation:f,distance:r,ignoreLocation:c})>d)break;w=B}const A={isMatch:m>=0,score:Math.max(.001,S)};if(p){const C=v3(g,l);C.length?a&&(A.indices=C):A.isMatch=!1}return A}function y3(i){let e={};for(let t=0,n=i.length;t<n;t+=1){const r=i.charAt(t);e[r]=(e[r]||0)|1<<n-t-1}return e}class gy{constructor(e,{location:t=Be.location,threshold:n=Be.threshold,distance:r=Be.distance,includeMatches:s=Be.includeMatches,findAllMatches:o=Be.findAllMatches,minMatchCharLength:l=Be.minMatchCharLength,isCaseSensitive:a=Be.isCaseSensitive,ignoreLocation:c=Be.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:r,includeMatches:s,findAllMatches:o,minMatchCharLength:l,isCaseSensitive:a,ignoreLocation:c},this.pattern=a?e:e.toLowerCase(),this.chunks=[],!this.pattern.length)return;const u=(f,d)=>{this.chunks.push({pattern:f,alphabet:y3(f),startIndex:d})},h=this.pattern.length;if(h>ms){let f=0;const d=h%ms,m=h-d;for(;f<m;)u(this.pattern.substr(f,ms),f),f+=ms;if(d){const p=h-ms;u(this.pattern.substr(p),p)}}else u(this.pattern,0)}searchIn(e){const{isCaseSensitive:t,includeMatches:n}=this.options;if(t||(e=e.toLowerCase()),this.pattern===e){let m={isMatch:!0,score:0};return n&&(m.indices=[[0,e.length-1]]),m}const{location:r,distance:s,threshold:o,findAllMatches:l,minMatchCharLength:a,ignoreLocation:c}=this.options;let u=[],h=0,f=!1;this.chunks.forEach(({pattern:m,alphabet:p,startIndex:g})=>{const{isMatch:v,score:w,indices:S}=w3(e,m,p,{location:r+g,distance:s,threshold:o,findAllMatches:l,minMatchCharLength:a,includeMatches:n,ignoreLocation:c});v&&(f=!0),h+=w,v&&S&&(u=[...u,...S])});let d={isMatch:f,score:f?h/this.chunks.length:1};return f&&n&&(d.indices=u),d}}class es{constructor(e){this.pattern=e}static isMultiMatch(e){return Dg(e,this.multiRegex)}static isSingleMatch(e){return Dg(e,this.singleRegex)}search(){}}function Dg(i,e){const t=i.match(e);return t?t[1]:null}class k3 extends es{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}class S3 extends es{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const n=e.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class _3 extends es{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}class C3 extends es{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}class P3 extends es{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class A3 extends es{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}class Oy extends es{constructor(e,{location:t=Be.location,threshold:n=Be.threshold,distance:r=Be.distance,includeMatches:s=Be.includeMatches,findAllMatches:o=Be.findAllMatches,minMatchCharLength:l=Be.minMatchCharLength,isCaseSensitive:a=Be.isCaseSensitive,ignoreLocation:c=Be.ignoreLocation}={}){super(e),this._bitapSearch=new gy(e,{location:t,threshold:n,distance:r,includeMatches:s,findAllMatches:o,minMatchCharLength:l,isCaseSensitive:a,ignoreLocation:c})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class by extends es{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t=0,n;const r=[],s=this.pattern.length;for(;(n=e.indexOf(this.pattern,t))>-1;)t=n+s,r.push([n,t-1]);const o=!!r.length;return{isMatch:o,score:o?0:1,indices:r}}}const fd=[k3,by,_3,C3,A3,P3,S3,Oy],$g=fd.length,x3=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,T3="|";function Q3(i,e={}){return i.split(T3).map(t=>{let n=t.trim().split(x3).filter(s=>s&&!!s.trim()),r=[];for(let s=0,o=n.length;s<o;s+=1){const l=n[s];let a=!1,c=-1;for(;!a&&++c<$g;){const u=fd[c];let h=u.isMultiMatch(l);h&&(r.push(new u(h,e)),a=!0)}if(!a)for(c=-1;++c<$g;){const u=fd[c];let h=u.isSingleMatch(l);if(h){r.push(new u(h,e));break}}}return r})}const M3=new Set([Oy.type,by.type]);class E3{constructor(e,{isCaseSensitive:t=Be.isCaseSensitive,includeMatches:n=Be.includeMatches,minMatchCharLength:r=Be.minMatchCharLength,ignoreLocation:s=Be.ignoreLocation,findAllMatches:o=Be.findAllMatches,location:l=Be.location,threshold:a=Be.threshold,distance:c=Be.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:n,minMatchCharLength:r,findAllMatches:o,ignoreLocation:s,location:l,threshold:a,distance:c},this.pattern=t?e:e.toLowerCase(),this.query=Q3(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){const t=this.query;if(!t)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:r}=this.options;e=r?e:e.toLowerCase();let s=0,o=[],l=0;for(let a=0,c=t.length;a<c;a+=1){const u=t[a];o.length=0,s=0;for(let h=0,f=u.length;h<f;h+=1){const d=u[h],{isMatch:m,indices:p,score:g}=d.search(e);if(m){if(s+=1,l+=g,n){const v=d.constructor.type;M3.has(v)?o=[...o,...p]:o.push(p)}}else{l=0,s=0,o.length=0;break}}if(s){let h={isMatch:!0,score:l/s};return n&&(h.indices=o),h}}return{isMatch:!1,score:1}}}const dd=[];function R3(...i){dd.push(...i)}function md(i,e){for(let t=0,n=dd.length;t<n;t+=1){let r=dd[t];if(r.condition(i,e))return new r(i,e)}return new gy(i,e)}const fu={AND:"$and",OR:"$or"},pd={PATH:"$path",PATTERN:"$val"},gd=i=>!!(i[fu.AND]||i[fu.OR]),D3=i=>!!i[pd.PATH],$3=i=>!hr(i)&&fy(i)&&!gd(i),Lg=i=>({[fu.AND]:Object.keys(i).map(e=>({[e]:i[e]}))});function vy(i,e,{auto:t=!0}={}){const n=r=>{let s=Object.keys(r);const o=D3(r);if(!o&&s.length>1&&!gd(r))return n(Lg(r));if($3(r)){const a=o?r[pd.PATH]:s[0],c=o?r[pd.PATTERN]:r[a];if(!Wi(c))throw new Error(o3(a));const u={keyId:hd(a),pattern:c};return t&&(u.searcher=md(c,e)),u}let l={children:[],operator:s[0]};return s.forEach(a=>{const c=r[a];hr(c)&&c.forEach(u=>{l.children.push(n(u))})}),l};return gd(i)||(i=Lg(i)),n(i)}function L3(i,{ignoreFieldNorm:e=Be.ignoreFieldNorm}){i.forEach(t=>{let n=1;t.matches.forEach(({key:r,norm:s,score:o})=>{const l=r?r.weight:null;n*=Math.pow(o===0&&l?Number.EPSILON:o,(l||1)*(e?1:s))}),t.score=n})}function I3(i,e){const t=i.matches;e.matches=[],Un(t)&&t.forEach(n=>{if(!Un(n.indices)||!n.indices.length)return;const{indices:r,value:s}=n;let o={indices:r,value:s};n.key&&(o.key=n.key.src),n.idx>-1&&(o.refIndex=n.idx),e.matches.push(o)})}function N3(i,e){e.score=i.score}function Z3(i,e,{includeMatches:t=Be.includeMatches,includeScore:n=Be.includeScore}={}){const r=[];return t&&r.push(I3),n&&r.push(N3),i.map(s=>{const{idx:o}=s,l={item:e[o],refIndex:o};return r.length&&r.forEach(a=>{a(s,l)}),l})}class Wo{constructor(e,t={},n){this.options={...Be,...t},this.options.useExtendedSearch,this._keyStore=new u3(this.options.keys),this.setCollection(e,n)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof Ym))throw new Error(s3);this._myIndex=t||py(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){Un(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const t=[];for(let n=0,r=this._docs.length;n<r;n+=1){const s=this._docs[n];e(s,n)&&(this.removeAt(n),n-=1,r-=1,t.push(s))}return t}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:t=-1}={}){const{includeMatches:n,includeScore:r,shouldSort:s,sortFn:o,ignoreFieldNorm:l}=this.options;let a=Wi(e)?Wi(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return L3(a,{ignoreFieldNorm:l}),s&&a.sort(o),hy(t)&&t>-1&&(a=a.slice(0,t)),Z3(a,this._docs,{includeMatches:n,includeScore:r})}_searchStringList(e){const t=md(e,this.options),{records:n}=this._myIndex,r=[];return n.forEach(({v:s,i:o,n:l})=>{if(!Un(s))return;const{isMatch:a,score:c,indices:u}=t.searchIn(s);a&&r.push({item:s,idx:o,matches:[{score:c,value:s,norm:l,indices:u}]})}),r}_searchLogical(e){const t=vy(e,this.options),n=(l,a,c)=>{if(!l.children){const{keyId:h,searcher:f}=l,d=this._findMatches({key:this._keyStore.get(h),value:this._myIndex.getValueForItemAtKeyId(a,h),searcher:f});return d&&d.length?[{idx:c,item:a,matches:d}]:[]}const u=[];for(let h=0,f=l.children.length;h<f;h+=1){const d=l.children[h],m=n(d,a,c);if(m.length)u.push(...m);else if(l.operator===fu.AND)return[]}return u},r=this._myIndex.records,s={},o=[];return r.forEach(({$:l,i:a})=>{if(Un(l)){let c=n(t,l,a);c.length&&(s[a]||(s[a]={idx:a,item:l,matches:[]},o.push(s[a])),c.forEach(({matches:u})=>{s[a].matches.push(...u)}))}}),o}_searchObjectList(e){const t=md(e,this.options),{keys:n,records:r}=this._myIndex,s=[];return r.forEach(({$:o,i:l})=>{if(!Un(o))return;let a=[];n.forEach((c,u)=>{a.push(...this._findMatches({key:c,value:o[u],searcher:t}))}),a.length&&s.push({idx:l,item:o,matches:a})}),s}_findMatches({key:e,value:t,searcher:n}){if(!Un(t))return[];let r=[];if(hr(t))t.forEach(({v:s,i:o,n:l})=>{if(!Un(s))return;const{isMatch:a,score:c,indices:u}=n.searchIn(s);a&&r.push({score:c,key:e,value:s,idx:o,norm:l,indices:u})});else{const{v:s,n:o}=t,{isMatch:l,score:a,indices:c}=n.searchIn(s);l&&r.push({score:a,key:e,value:s,norm:o,indices:c})}return r}}Wo.version="7.0.0";Wo.createIndex=py;Wo.parseIndex=b3;Wo.config=Be;Wo.parseQuery=vy;R3(E3);function Ig(i,e,t){const n=i.slice();return n[10]=e[t],n}function Ng(i){let e=[],t=new Map,n,r=fe(i[0]);const s=o=>o[10].value;for(let o=0;o<r.length;o+=1){let l=Ig(i,r,o),a=s(l);t.set(a,e[o]=Zg(a,l))}return{c(){for(let o=0;o<e.length;o+=1)e[o].c();n=Ie()},m(o,l){for(let a=0;a<e.length;a+=1)e[a]&&e[a].m(o,l);x(o,n,l)},p(o,l){l&3&&(r=fe(o[0]),e=Ti(e,l,s,1,o,r,t,n.parentNode,Fm,Zg,n,Ig))},d(o){o&&P(n);for(let l=0;l<e.length;l+=1)e[l].d(o)}}}function Zg(i,e){let t,n=e[10].label+"",r,s,o,l;function a(...u){return e[5](e[10],...u)}function c(...u){return e[6](e[10],...u)}return{key:i,first:null,c(){t=y("div"),r=W(n),s=D(),O(t,"class","autocomplete-option"),O(t,"role","button"),O(t,"tabindex","0"),this.first=t},m(u,h){x(u,t,h),b(t,r),b(t,s),o||(l=[G(t,"click",a),G(t,"keypress",c)],o=!0)},p(u,h){e=u,h&1&&n!==(n=e[10].label+"")&&K(r,n)},d(u){u&&P(t),o=!1,ht(l)}}}function B3(i){let e,t=i[0]&&Ng(i);return{c(){t&&t.c(),e=Ie()},m(n,r){t&&t.m(n,r),x(n,e,r)},p(n,[r]){n[0]?t?t.p(n,r):(t=Ng(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:U,o:U,d(n){n&&P(e),t&&t.d(n)}}}function W3(i){return Array.isArray(i)?i.map(e=>({value:e,label:e})):Object.entries(i).map(([e,t])=>({value:e,label:t}))}function X3(i,e,t){let n,{field:r}=e,{value:s}=e,{search:o=""}=e;const l=nn();function a(d,m){d.preventDefault(),t(3,s=m.value),t(2,o=""),l("selected",{option:m})}let c=W3(r.selectOptions);const u=new Wo(c,{includeScore:!1,keys:["value","label"]}),h=(d,m)=>a(m,d),f=(d,m)=>a(m,d);return i.$$set=d=>{"field"in d&&t(4,r=d.field),"value"in d&&t(3,s=d.value),"search"in d&&t(2,o=d.search)},i.$$.update=()=>{i.$$.dirty&4&&t(0,n=o===""?c:u.search(o).map(d=>d.item))},[n,a,o,s,r,h,f]}class F3 extends oe{constructor(e){super(),se(this,e,X3,B3,re,{field:4,value:3,search:2})}}function Bg(i){let e,t,n,r,s,o,l,a;function c(f,d){return d&2&&(t=null),t==null&&(t=!!Array.isArray(f[1].selectOptions)),t?z3:Y3}let u=c(i,-1),h=u(i);return s=new ut({props:{width:12,height:12,icon:"close"}}),{c(){e=y("div"),h.c(),n=D(),r=y("button"),V(s.$$.fragment),O(r,"type","button"),O(r,"class","button-text"),O(r,"aria-label","Close"),O(e,"class","autocomplete-selected-value")},m(f,d){x(f,e,d),h.m(e,null),b(e,n),b(e,r),Y(s,r,null),o=!0,l||(a=G(r,"click",Ln(i[9])),l=!0)},p(f,d){u===(u=c(f,d))&&h?h.p(f,d):(h.d(1),h=u(f),h&&(h.c(),h.m(e,n)))},i(f){o||(T(s.$$.fragment,f),o=!0)},o(f){R(s.$$.fragment,f),o=!1},d(f){f&&P(e),h.d(),z(s),l=!1,a()}}}function Y3(i){let e=i[1].selectOptions[i[0]]+"",t;return{c(){t=W(e)},m(n,r){x(n,t,r)},p(n,r){r&3&&e!==(e=n[1].selectOptions[n[0]]+"")&&K(t,e)},d(n){n&&P(t)}}}function z3(i){let e;return{c(){e=W(i[0])},m(t,n){x(t,e,n)},p(t,n){n&1&&K(e,t[0])},d(t){t&&P(e)}}}function V3(i){let e,t,n,r,s,o,l,a,c,u,h,f;function d(v){i[7](v)}function m(v){i[8](v)}let p={field:i[1]};i[0]!==void 0&&(p.value=i[0]),i[3]!==void 0&&(p.search=i[3]),s=new F3({props:p}),Ce.push(()=>nt(s,"value",d)),Ce.push(()=>nt(s,"search",m)),s.$on("selected",i[4]);let g=i[0]&&Bg(i);return{c(){e=y("div"),t=y("input"),n=D(),r=y("div"),V(s.$$.fragment),a=D(),g&&g.c(),c=Ie(),O(t,"type","search"),O(t,"placeholder","Search for options"),O(t,"autocomplete","off"),O(r,"class","autocomplete-results"),O(e,"class","autocomplete")},m(v,w){x(v,e,w),b(e,t),Le(t,i[3]),i[6](t),b(e,n),b(e,r),Y(s,r,null),x(v,a,w),g&&g.m(v,w),x(v,c,w),u=!0,h||(f=G(t,"input",i[5]),h=!0)},p(v,[w]){w&8&&t.value!==v[3]&&Le(t,v[3]);const S={};w&2&&(S.field=v[1]),!o&&w&1&&(o=!0,S.value=v[0],st(()=>o=!1)),!l&&w&8&&(l=!0,S.search=v[3],st(()=>l=!1)),s.$set(S),v[0]?g?(g.p(v,w),w&1&&T(g,1)):(g=Bg(v),g.c(),T(g,1),g.m(c.parentNode,c)):g&&(Oe(),R(g,1,1,()=>{g=null}),be())},i(v){u||(T(s.$$.fragment,v),T(g),u=!0)},o(v){R(s.$$.fragment,v),R(g),u=!1},d(v){v&&(P(e),P(a),P(c)),i[6](null),z(s),g&&g.d(v),h=!1,f()}}}function U3(i,e,t){let n,r,{value:s}=e,{field:o}=e;function l(){n.focus(),n.blur()}function a(){r=this.value,t(3,r)}function c(d){Ce[d?"unshift":"push"](()=>{n=d,t(2,n)})}function u(d){s=d,t(0,s)}function h(d){r=d,t(3,r)}const f=d=>t(0,s="");return i.$$set=d=>{"value"in d&&t(0,s=d.value),"field"in d&&t(1,o=d.field)},[s,o,n,r,l,a,c,u,h,f]}class j3 extends oe{constructor(e){super(),se(this,e,U3,V3,re,{value:0,field:1})}}function q3(i){let e,t,n,r;return{c(){e=y("input"),O(e,"type","text"),O(e,"id",i[3]),O(e,"class","form-control"),O(e,"autocomplete","off"),e.readOnly=t=i[1].readonly&&!i[2],Ae(e,"is-invalid",i[4])},m(s,o){x(s,e,o),Le(e,i[0]),n||(r=G(e,"input",i[7]),n=!0)},p(s,o){o&8&&O(e,"id",s[3]),o&6&&t!==(t=s[1].readonly&&!s[2])&&(e.readOnly=t),o&1&&e.value!==s[0]&&Le(e,s[0]),o&16&&Ae(e,"is-invalid",s[4])},i:U,o:U,d(s){s&&P(e),n=!1,r()}}}function G3(i){let e,t,n;function r(o){i[6](o)}let s={field:i[1]};return i[0]!==void 0&&(s.value=i[0]),e=new j3({props:s}),Ce.push(()=>nt(e,"value",r)),{c(){V(e.$$.fragment)},m(o,l){Y(e,o,l),n=!0},p(o,l){const a={};l&2&&(a.field=o[1]),!t&&l&1&&(t=!0,a.value=o[0],st(()=>t=!1)),e.$set(a)},i(o){n||(T(e.$$.fragment,o),n=!0)},o(o){R(e.$$.fragment,o),n=!1},d(o){z(e,o)}}}function Wg(i){let e,t;return{c(){e=y("div"),t=W(i[4]),O(e,"class","invalid-feedback d-block")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&16&&K(t,n[4])},d(n){n&&P(e)}}}function H3(i){let e,t,n,r,s;const o=[G3,q3],l=[];function a(u,h){return u[1].selectOptions?0:1}t=a(i),n=l[t]=o[t](i);let c=i[4]&&Wg(i);return{c(){e=y("div"),n.c(),r=D(),c&&c.c(),le(e,"position","relative")},m(u,h){x(u,e,h),l[t].m(e,null),b(e,r),c&&c.m(e,null),s=!0},p(u,[h]){let f=t;t=a(u),t===f?l[t].p(u,h):(Oe(),R(l[f],1,1,()=>{l[f]=null}),be(),n=l[t],n?n.p(u,h):(n=l[t]=o[t](u),n.c()),T(n,1),n.m(e,r)),u[4]?c?c.p(u,h):(c=Wg(u),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i(u){s||(T(n),s=!0)},o(u){R(n),s=!1},d(u){u&&P(e),l[t].d(),c&&c.d()}}}function K3(i,e,t){let n,{field:r}=e,{value:s}=e,{isCreateMode:o}=e,{validationErrors:l}=e,{id:a}=e;function c(h){s=h,t(0,s)}function u(){s=this.value,t(0,s)}return i.$$set=h=>{"field"in h&&t(1,r=h.field),"value"in h&&t(0,s=h.value),"isCreateMode"in h&&t(2,o=h.isCreateMode),"validationErrors"in h&&t(5,l=h.validationErrors),"id"in h&&t(3,a=h.id)},i.$$.update=()=>{i.$$.dirty&34&&t(4,n=In(l,r.name))},[s,r,o,a,n,l,c,u]}let wy=class extends oe{constructor(e){super(),se(this,e,K3,H3,re,{field:1,value:0,isCreateMode:2,validationErrors:5,id:3})}};function Xg(i){let e,t;return{c(){e=y("div"),t=W(i[4]),O(e,"class","invalid-feedback d-block")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&16&&K(t,n[4])},d(n){n&&P(e)}}}function J3(i){let e,t,n,r,s,o,l,a=i[1].source+"",c,u,h,f,d=i[4]&&Xg(i);return{c(){e=y("div"),t=y("input"),r=D(),s=y("div"),o=W("Leave this empty to autogenerate from "),l=y("i"),c=W(a),u=D(),d&&d.c(),O(t,"type","text"),O(t,"id",i[3]),O(t,"class","form-control"),O(t,"autocomplete","off"),t.readOnly=n=i[1].readonly&&!i[2],Ae(t,"is-invalid",i[4]),O(s,"class","system-help-text light-text"),O(e,"class","mb-0")},m(m,p){x(m,e,p),b(e,t),Le(t,i[0]),b(e,r),b(e,s),b(s,o),b(s,l),b(l,c),b(e,u),d&&d.m(e,null),h||(f=G(t,"input",i[6]),h=!0)},p(m,[p]){p&8&&O(t,"id",m[3]),p&6&&n!==(n=m[1].readonly&&!m[2])&&(t.readOnly=n),p&1&&t.value!==m[0]&&Le(t,m[0]),p&16&&Ae(t,"is-invalid",m[4]),p&2&&a!==(a=m[1].source+"")&&K(c,a),m[4]?d?d.p(m,p):(d=Xg(m),d.c(),d.m(e,null)):d&&(d.d(1),d=null)},i:U,o:U,d(m){m&&P(e),d&&d.d(),h=!1,f()}}}function eT(i,e,t){let n,{field:r}=e,{value:s}=e,{isCreateMode:o}=e,{validationErrors:l}=e,{id:a}=e;function c(){s=this.value,t(0,s)}return i.$$set=u=>{"field"in u&&t(1,r=u.field),"value"in u&&t(0,s=u.value),"isCreateMode"in u&&t(2,o=u.isCreateMode),"validationErrors"in u&&t(5,l=u.validationErrors),"id"in u&&t(3,a=u.id)},i.$$.update=()=>{i.$$.dirty&34&&t(4,n=In(l,r.name))},[s,r,o,a,n,l,c]}class yy extends oe{constructor(e){super(),se(this,e,eT,J3,re,{field:1,value:0,isCreateMode:2,validationErrors:5,id:3})}}function ky(i,e,t,n,r=""){let s=t.map(l=>({target:l.id,source:e.id,sourceSchema:e.schema,targetSchema:l.schema,field:n,depth:1,rank:""})),o=i.edges;return r==="replace"&&(o=o.filter(l=>l.field!==field.name)),i.records=hg([...i.records,...t],l=>l.id),i.edges=hg([...o,...s],l=>l.source+l.target+l.field+l.depth),i}function tT(i,e,t,n,r){if(i===e)return t;let s=r.map(a=>a.id),o=(t==null?void 0:t.filter(a=>a.field===n&&a.depth===1&&s.includes(a.target)))??[],l=(t==null?void 0:t.filter(a=>!(a.field===n&&a.depth===1)))??[];return o=Sy(o,i,e),[...l,...o]}function Sy(i,e,t){if(t>=i.length)for(var n=t-i.length+1;n--;)i.push(void 0);return i.splice(t,0,i.splice(e,1)[0]),i}function Fg(i,e){if(e.mime==="image/svg+xml")return Gi(i,e);const t=e.path.slice(0,e.path.lastIndexOf("."))+".webp";return i.filesUrl+`/thumbs/${t}`}function nT(i,e,t){if(e.mime==="image/svg+xml")return Gi(i,e);const n=e.path.slice(0,e.path.lastIndexOf("."))+".webp";return i.filesUrl+`/templates/${t}/${n}`}function Gi(i,e){return i.filesUrl+`/${e.path}`}function iT(i,e,t){let n="",r=Gi(i,e);if(e.width>0){let s=r;if(t){const o=e.path.slice(0,e.path.lastIndexOf("."))+".webp";s=i.filesUrl+`/templates/${t}/${o}`}n=`<img src="${s}" alt="${e.path}" />`}else e.mime==="image/svg+xml"?n=`<img src="${r}" alt="${e.path}"/>`:n=`<a href="${r}">${e.filename}</a>`;return n}function Yg(i){let e,t,n,r,s;const o=[sT,rT],l=[];function a(c,u){return u&1&&(e=null),e==null&&(e=!!c[0].mime.startsWith("image")),e?0:1}return t=a(i,-1),n=l[t]=o[t](i),{c(){n.c(),r=Ie()},m(c,u){l[t].m(c,u),x(c,r,u),s=!0},p(c,u){let h=t;t=a(c,u),t===h?l[t].p(c,u):(Oe(),R(l[h],1,1,()=>{l[h]=null}),be(),n=l[t],n?n.p(c,u):(n=l[t]=o[t](c),n.c()),T(n,1),n.m(r.parentNode,r))},i(c){s||(T(n),s=!0)},o(c){R(n),s=!1},d(c){c&&P(r),l[t].d(c)}}}function rT(i){let e,t,n,r,s,o=i[0].path.split(".").pop().toLowerCase()+"",l,a,c,u;return t=new ut({props:{icon:"file",width:i[3],height:i[3]}}),{c(){e=y("a"),V(t.$$.fragment),n=D(),r=y("span"),s=W("."),l=W(o),O(r,"class","ms-2"),O(e,"href",a=i[4].lucentUrl+"/files/"+i[0].id),O(e,"title",c=i[0].path),O(e,"class","file-preview-small"),le(e,"width",i[2]+"px"),le(e,"height",i[2]+"px")},m(h,f){x(h,e,f),Y(t,e,null),b(e,n),b(e,r),b(r,s),b(r,l),u=!0},p(h,f){const d={};f&8&&(d.width=h[3]),f&8&&(d.height=h[3]),t.$set(d),(!u||f&1)&&o!==(o=h[0].path.split(".").pop().toLowerCase()+"")&&K(l,o),(!u||f&1&&a!==(a=h[4].lucentUrl+"/files/"+h[0].id))&&O(e,"href",a),(!u||f&1&&c!==(c=h[0].path))&&O(e,"title",c),(!u||f&4)&&le(e,"width",h[2]+"px"),(!u||f&4)&&le(e,"height",h[2]+"px")},i(h){u||(T(t.$$.fragment,h),u=!0)},o(h){R(t.$$.fragment,h),u=!1},d(h){h&&P(e),z(t)}}}function sT(i){let e,t,n,r,s,o;return{c(){e=y("a"),t=y("img"),O(t,"class","rounded w-100 svelte-sv092r"),ad(t.src,n=Fg(i[4],i[0]))||O(t,"src",n),O(t,"alt",r=i[0].path),O(e,"target","_blank"),O(e,"href",s=Gi(i[4],i[0])),O(e,"title",o=i[0].filename),le(e,"width",i[2]+"px"),le(e,"height",i[2]+"px")},m(l,a){x(l,e,a),b(e,t)},p(l,a){a&1&&!ad(t.src,n=Fg(l[4],l[0]))&&O(t,"src",n),a&1&&r!==(r=l[0].path)&&O(t,"alt",r),a&1&&s!==(s=Gi(l[4],l[0]))&&O(e,"href",s),a&1&&o!==(o=l[0].filename)&&O(e,"title",o),a&4&&le(e,"width",l[2]+"px"),a&4&&le(e,"height",l[2]+"px")},i:U,o:U,d(l){l&&P(e)}}}function zg(i){let e,t=i[0].path+"",n,r,s;return{c(){e=y("a"),n=W(t),O(e,"href",r=i[4].lucentUrl+"/files/"+i[0].id),O(e,"title",s=i[0].path),O(e,"class","preview-file-filename lx-small-text text-decoration-none")},m(o,l){x(o,e,l),b(e,n)},p(o,l){l&1&&t!==(t=o[0].path+"")&&K(n,t),l&1&&r!==(r=o[4].lucentUrl+"/files/"+o[0].id)&&O(e,"href",r),l&1&&s!==(s=o[0].path)&&O(e,"title",s)},d(o){o&&P(e)}}}function oT(i){let e,t,n,r=i[0]&&Yg(i),s=i[1]&&zg(i);return{c(){e=y("div"),r&&r.c(),t=D(),s&&s.c(),le(e,"display","flex"),le(e,"align-items","center"),le(e,"gap","5px")},m(o,l){x(o,e,l),r&&r.m(e,null),b(e,t),s&&s.m(e,null),n=!0},p(o,[l]){o[0]?r?(r.p(o,l),l&1&&T(r,1)):(r=Yg(o),r.c(),T(r,1),r.m(e,t)):r&&(Oe(),R(r,1,1,()=>{r=null}),be()),o[1]?s?s.p(o,l):(s=zg(o),s.c(),s.m(e,null)):s&&(s.d(1),s=null)},i(o){n||(T(r),n=!0)},o(o){R(r),n=!1},d(o){o&&P(e),r&&r.d(),s&&s.d()}}}function lT(i,e,t){let{file:n}=e;const r=Ue("channel");let{size:s="small"}=e,{showFilename:o=!1}=e,l,a;return s=="large"?(l=256,a=32):s=="medium"?(l=128,a=12):s=="small"?(l=64,a=12):s=="tiny"&&(l=42,a=12),i.$$set=c=>{"file"in c&&t(0,n=c.file),"size"in c&&t(5,s=c.size),"showFilename"in c&&t(1,o=c.showFilename)},[n,o,l,a,r,s]}class Xo extends oe{constructor(e){super(),se(this,e,lT,oT,re,{file:0,size:5,showFilename:1})}}function Vg(i){let e,t,n,r,s,o,l,a,c,u=i[0]._file.path+"",h,f,d,m,p,g,v=i[0]._file.originalName+"",w,S,_,k,A,C,Q=i[0]._file.mime+"",M,L,N,B,J,te,ie,ae=(i[0]._file.size/1024).toFixed(1)+"",X,ee,Te,ve,je,ne,Ee,Re=i[0]._file.checksum+"",xt,H,Pe,Ye,Tt,yt,wt;n=new Xo({props:{record:i[0],size:"large"}});let Qt=i[0]._file.width&&Ug(i);return{c(){e=y("div"),t=y("div"),V(n.$$.fragment),r=D(),s=y("div"),o=y("div"),l=y("span"),l.textContent="Filename",a=D(),c=y("span"),h=W(u),f=D(),d=y("div"),m=y("span"),m.textContent="Original name",p=D(),g=y("span"),w=W(v),S=D(),_=y("div"),k=y("span"),k.textContent="Mime type",A=D(),C=y("span"),M=W(Q),L=D(),Qt&&Qt.c(),N=D(),B=y("div"),J=y("span"),J.textContent="File size",te=D(),ie=y("span"),X=W(ae),ee=W("kB"),Te=D(),ve=y("div"),je=y("span"),je.textContent="Checksum",ne=D(),Ee=y("span"),xt=W(Re),H=D(),Pe=y("div"),Ye=y("a"),Tt=W("Download"),O(l,"class","text-muted"),O(o,"class","file-details-item"),O(m,"class","text-muted"),O(d,"class","file-details-item"),O(k,"class","text-muted"),O(_,"class","file-details-item"),O(J,"class","text-muted"),O(B,"class","file-details-item"),O(je,"class","text-muted"),O(ve,"class","file-details-item"),O(Ye,"class","button primary"),O(Ye,"target","_blank"),le(Ye,"display","inline-flex"),O(Ye,"href",yt=Gi(i[2],i[0])),O(Pe,"class","file-details-item"),O(s,"class","file-details"),O(e,"class","record-edit-file-preview")},m(He,Ut){x(He,e,Ut),b(e,t),Y(n,t,null),b(e,r),b(e,s),b(s,o),b(o,l),b(o,a),b(o,c),b(c,h),b(s,f),b(s,d),b(d,m),b(d,p),b(d,g),b(g,w),b(s,S),b(s,_),b(_,k),b(_,A),b(_,C),b(C,M),b(s,L),Qt&&Qt.m(s,null),b(s,N),b(s,B),b(B,J),b(B,te),b(B,ie),b(ie,X),b(ie,ee),b(s,Te),b(s,ve),b(ve,je),b(ve,ne),b(ve,Ee),b(Ee,xt),b(s,H),b(s,Pe),b(Pe,Ye),b(Ye,Tt),wt=!0},p(He,Ut){const ct={};Ut&1&&(ct.record=He[0]),n.$set(ct),(!wt||Ut&1)&&u!==(u=He[0]._file.path+"")&&K(h,u),(!wt||Ut&1)&&v!==(v=He[0]._file.originalName+"")&&K(w,v),(!wt||Ut&1)&&Q!==(Q=He[0]._file.mime+"")&&K(M,Q),He[0]._file.width?Qt?Qt.p(He,Ut):(Qt=Ug(He),Qt.c(),Qt.m(s,N)):Qt&&(Qt.d(1),Qt=null),(!wt||Ut&1)&&ae!==(ae=(He[0]._file.size/1024).toFixed(1)+"")&&K(X,ae),(!wt||Ut&1)&&Re!==(Re=He[0]._file.checksum+"")&&K(xt,Re),(!wt||Ut&1&&yt!==(yt=Gi(He[2],He[0])))&&O(Ye,"href",yt)},i(He){wt||(T(n.$$.fragment,He),wt=!0)},o(He){R(n.$$.fragment,He),wt=!1},d(He){He&&P(e),z(n),Qt&&Qt.d()}}}function Ug(i){let e,t,n,r,s=i[0]._file.width+"",o,l,a=i[0]._file.height+"",c;return{c(){e=y("div"),t=y("span"),t.textContent="Dimensions",n=D(),r=y("span"),o=W(s),l=W("x"),c=W(a),O(t,"class","text-muted"),O(e,"class","file-details-item")},m(u,h){x(u,e,h),b(e,t),b(e,n),b(e,r),b(r,o),b(r,l),b(r,c)},p(u,h){h&1&&s!==(s=u[0]._file.width+"")&&K(o,s),h&1&&a!==(a=u[0]._file.height+"")&&K(c,a)},d(u){u&&P(e)}}}function aT(i){let e,t,n=i[1].type==="files"&&Vg(i);return{c(){n&&n.c(),e=Ie()},m(r,s){n&&n.m(r,s),x(r,e,s),t=!0},p(r,[s]){r[1].type==="files"?n?(n.p(r,s),s&2&&T(n,1)):(n=Vg(r),n.c(),T(n,1),n.m(e.parentNode,e)):n&&(Oe(),R(n,1,1,()=>{n=null}),be())},i(r){t||(T(n),t=!0)},o(r){R(n),t=!1},d(r){r&&P(e),n&&n.d(r)}}}function cT(i,e,t){const n=Ue("channel");let{record:r}=e,{schema:s}=e;return i.$$set=o=>{"record"in o&&t(0,r=o.record),"schema"in o&&t(1,s=o.schema)},[r,s,n]}class uT extends oe{constructor(e){super(),se(this,e,cT,aT,re,{record:0,schema:1})}}function hT(i){let e;return{c(){e=W("New Record")},m(t,n){x(t,e,n)},p:U,d(t){t&&P(e)}}}function fT(i){let e=i[1].data.name+"",t;return{c(){t=W(e)},m(n,r){x(n,t,r)},p(n,r){r&2&&e!==(e=n[1].data.name+"")&&K(t,e)},d(n){n&&P(t)}}}function dT(i){let e,t,n=i[0].label.toUpperCase()+"",r,s,o,l;function a(h,f){return h[2]?hT:fT}let c=a(i),u=c(i);return{c(){e=y("div"),t=y("a"),r=W(n),o=D(),l=y("span"),u.c(),O(t,"class","schema-name"),O(t,"href",s=i[3].lucentUrl+"/content/"+i[0].name),O(l,"class","record-title"),O(e,"class","record-header")},m(h,f){x(h,e,f),b(e,t),b(t,r),b(e,o),b(e,l),u.m(l,null)},p(h,[f]){f&1&&n!==(n=h[0].label.toUpperCase()+"")&&K(r,n),f&1&&s!==(s=h[3].lucentUrl+"/content/"+h[0].name)&&O(t,"href",s),c===(c=a(h))&&u?u.p(h,f):(u.d(1),u=c(h),u&&(u.c(),u.m(l,null)))},i:U,o:U,d(h){h&&P(e),u.d()}}}function mT(i,e,t){const n=Ue("channel");let{schema:r}=e,{record:s}=e,{isCreateMode:o}=e;return i.$$set=l=>{"schema"in l&&t(0,r=l.schema),"record"in l&&t(1,s=l.record),"isCreateMode"in l&&t(2,o=l.isCreateMode)},[r,s,o,n]}class _y extends oe{constructor(e){super(),se(this,e,mT,dT,re,{schema:0,record:1,isCreateMode:2})}}function jg(i,e,t){const n=i.slice();return n[24]=e[t],n}function pT(i){let e,t,n;return{c(){e=y("button"),e.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
Save`,O(e,"type","button"),O(e,"class","button primary ms-2 btn btn-primary btn-spinner")},m(r,s){x(r,e,s),t||(n=G(e,"click",i[10]),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function gT(i){let e,t,n;return{c(){e=y("button"),e.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
Create`,O(e,"class","button primary btn-spinner")},m(r,s){x(r,e,s),t||(n=G(e,"click",i[10]),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function qg(i){let e,t,n,r;function s(a){i[14](a)}function o(a){i[15](a)}let l={field:i[24],schema:i[2],record:i[0],validationErrors:i[4],isCreateMode:i[3]};return i[0].data!==void 0&&(l.data=i[0].data),i[1]!==void 0&&(l.graph=i[1]),e=new aP({props:l}),Ce.push(()=>nt(e,"data",s)),Ce.push(()=>nt(e,"graph",o)),{c(){V(e.$$.fragment)},m(a,c){Y(e,a,c),r=!0},p(a,c){const u={};c&4&&(u.schema=a[2]),c&1&&(u.record=a[0]),c&16&&(u.validationErrors=a[4]),c&8&&(u.isCreateMode=a[3]),!t&&c&1&&(t=!0,u.data=a[0].data,st(()=>t=!1)),!n&&c&2&&(n=!0,u.graph=a[1],st(()=>n=!1)),e.$set(u)},i(a){r||(T(e.$$.fragment,a),r=!0)},o(a){R(e.$$.fragment,a),r=!1},d(a){z(e,a)}}}function Gg(i,e){let t,n,r,s=e[5]===e[24].group&&qg(e);return{key:i,first:null,c(){t=Ie(),s&&s.c(),n=Ie(),this.first=t},m(o,l){x(o,t,l),s&&s.m(o,l),x(o,n,l),r=!0},p(o,l){e=o,e[5]===e[24].group?s?(s.p(e,l),l&32&&T(s,1)):(s=qg(e),s.c(),T(s,1),s.m(n.parentNode,n)):s&&(Oe(),R(s,1,1,()=>{s=null}),be())},i(o){r||(T(s),r=!0)},o(o){R(s),r=!1},d(o){o&&(P(t),P(n)),s&&s.d(o)}}}function OT(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,v,w=[],S=new Map,_,k,A;function C(X){i[11](X)}function Q(X){i[12](X)}let M={schema:i[2],isCreateMode:i[3]};i[0]!==void 0&&(M.record=i[0]),i[5]!==void 0&&(M.activeContentTab=i[5]),n=new cy({props:M}),Ce.push(()=>nt(n,"record",C)),Ce.push(()=>nt(n,"activeContentTab",Q));function L(X,ee){if(X[3])return gT;if(X[6])return pT}let N=L(i),B=N&&N(i);a=new _y({props:{schema:i[2],record:i[0],isCreateMode:i[3]}}),u=new Ma({props:{message:i[7]}});function J(X){i[13](X)}let te={schema:i[2],isCreateMode:i[3]};i[5]!==void 0&&(te.active=i[5]),d=new uy({props:te}),Ce.push(()=>nt(d,"active",J)),g=new uT({props:{record:i[0],schema:i[2]}});let ie=fe(i[8]);const ae=X=>X[24].name;for(let X=0;X<ie.length;X+=1){let ee=jg(i,ie,X),Te=ae(ee);S.set(Te,w[X]=Gg(Te,ee))}return{c(){e=y("div"),t=y("div"),V(n.$$.fragment),o=D(),B&&B.c(),l=D(),V(a.$$.fragment),c=D(),V(u.$$.fragment),h=D(),f=y("div"),V(d.$$.fragment),p=D(),V(g.$$.fragment),v=D();for(let X=0;X<w.length;X+=1)w[X].c();O(t,"class","tools-header"),O(f,"class","mt-4"),le(f,"margin-bottom","150px"),le(f,"position","relative"),O(e,"class","inline-edit record-edit")},m(X,ee){x(X,e,ee),b(e,t),Y(n,t,null),b(t,o),B&&B.m(t,null),b(e,l),Y(a,e,null),b(e,c),Y(u,e,null),b(e,h),b(e,f),Y(d,f,null),b(f,p),Y(g,f,null),b(f,v);for(let Te=0;Te<w.length;Te+=1)w[Te]&&w[Te].m(f,null);_=!0,k||(A=G(window,"beforeunload",i[9]),k=!0)},p(X,[ee]){const Te={};ee&4&&(Te.schema=X[2]),ee&8&&(Te.isCreateMode=X[3]),!r&&ee&1&&(r=!0,Te.record=X[0],st(()=>r=!1)),!s&&ee&32&&(s=!0,Te.activeContentTab=X[5],st(()=>s=!1)),n.$set(Te),N===(N=L(X))&&B?B.p(X,ee):(B&&B.d(1),B=N&&N(X),B&&(B.c(),B.m(t,null)));const ve={};ee&4&&(ve.schema=X[2]),ee&1&&(ve.record=X[0]),ee&8&&(ve.isCreateMode=X[3]),a.$set(ve);const je={};ee&128&&(je.message=X[7]),u.$set(je);const ne={};ee&4&&(ne.schema=X[2]),ee&8&&(ne.isCreateMode=X[3]),!m&&ee&32&&(m=!0,ne.active=X[5],st(()=>m=!1)),d.$set(ne);const Ee={};ee&1&&(Ee.record=X[0]),ee&4&&(Ee.schema=X[2]),g.$set(Ee),ee&319&&(ie=fe(X[8]),Oe(),w=Ti(w,ee,ae,1,X,ie,S,f,Jr,Gg,null,jg),be())},i(X){if(!_){T(n.$$.fragment,X),T(a.$$.fragment,X),T(u.$$.fragment,X),T(d.$$.fragment,X),T(g.$$.fragment,X);for(let ee=0;ee<ie.length;ee+=1)T(w[ee]);_=!0}},o(X){R(n.$$.fragment,X),R(a.$$.fragment,X),R(u.$$.fragment,X),R(d.$$.fragment,X),R(g.$$.fragment,X);for(let ee=0;ee<w.length;ee+=1)R(w[ee]);_=!1},d(X){X&&P(e),z(n),B&&B.d(),z(a),z(u),z(d),z(g);for(let ee=0;ee<w.length;ee+=1)w[ee].d();k=!1,A()}}}function bT(i,e,t){let n,r;const s=Ue("channel"),o=nn();let{schema:l}=e,{record:a}=e,{graph:c={records:[],edges:[]}}=e,{isCreateMode:u}=e,h,f="",d=!1,m=l.fields.filter(M=>M.name!=="id"),p="_default";l.fields.reduce((M,L)=>L.ui==="tab"?(p=L.name,M):(M[p]=[...M[p]??[],L.name],M),[]),xi(()=>{g()});function g(){h={data:JSON.parse(JSON.stringify(a.data)),schema:a.schema,status:a.status,edges:JSON.parse(JSON.stringify(c.edges))}}Kw(()=>{t(6,d=w())});function v(M){return d?M.returnValue="You have unsaved changes. Are you sure you want to exit?":(delete M.returnValue,"...")}function w(){return u?!1:!ia(h,{data:a.data,schema:a.schema,status:a.status,edges:c.edges})}function S(M){return M.preventDefault(),console.log("SAVE: Attempt"),t(4,n=null),t(7,r=""),new Promise(function(L,N){var B;if(!d&&!u){L(null);return}if(!a){L(null);return}t(1,c.edges=((B=c.edges)==null?void 0:B.filter(J=>!J._isTrashed&&J.source===a.id))??[],c),Jn(s.lucentUrl+"/records",{record:a,edges:c.edges,isCreateMode:u}).then(function(J){console.log("SAVE: SAVED INLINE"),t(0,a=J.records[0]),t(1,c=J),u||g(),o("inlinesaved",{records:[a]}),L(null)}).catch(function(J){J.response&&(typeof J.response.data.error=="string"?t(7,r=J.response.data.error):t(4,n=J.response.data.error)),L(null)})})}function _(M){a=M,t(0,a)}function k(M){f=M,t(5,f)}function A(M){f=M,t(5,f)}function C(M){i.$$.not_equal(a.data,M)&&(a.data=M,t(0,a))}function Q(M){c=M,t(1,c)}return i.$$set=M=>{"schema"in M&&t(2,l=M.schema),"record"in M&&t(0,a=M.record),"graph"in M&&t(1,c=M.graph),"isCreateMode"in M&&t(3,u=M.isCreateMode)},i.$$.update=()=>{i.$$.dirty&16&&t(7,r=n?`Record submission failed. ${Object.entries(n).length} error(s)`:null)},t(4,n=null),[a,c,l,u,n,f,d,r,m,v,S,_,k,A,C,Q]}class vT extends oe{constructor(e){super(),se(this,e,bT,OT,re,{schema:2,record:0,graph:1,isCreateMode:3})}}function Hg(i,e,t){const n=i.slice();return n[11]=e[t],n}function Kg(i){let e=[],t=new Map,n,r=fe(i[2]);const s=l=>l[11].id;for(let l=0;l<r.length;l+=1){let a=Hg(i,r,l),c=s(a);t.set(c,e[l]=eO(c,a))}let o=null;return r.length||(o=Jg()),{c(){for(let l=0;l<e.length;l+=1)e[l].c();n=Ie(),o&&o.c()},m(l,a){for(let c=0;c<e.length;c+=1)e[c]&&e[c].m(l,a);x(l,n,a),o&&o.m(l,a)},p(l,a){a&20&&(r=fe(l[2]),e=Ti(e,a,s,1,l,r,t,n.parentNode,Fm,eO,n,Hg),!r.length&&o?o.p(l,a):r.length?o&&(o.d(1),o=null):(o=Jg(),o.c(),o.m(n.parentNode,n)))},d(l){l&&P(n);for(let a=0;a<e.length;a+=1)e[a].d(l);o&&o.d(l)}}}function Jg(i){let e;return{c(){e=y("div"),e.textContent="Start typing...",O(e,"class","start-typing")},m(t,n){x(t,e,n)},p:U,d(t){t&&P(e)}}}function eO(i,e){let t,n=e[11].data.name+"",r,s,o,l;function a(...u){return e[7](e[11],...u)}function c(...u){return e[8](e[11],...u)}return{key:i,first:null,c(){t=y("div"),r=W(n),s=D(),O(t,"class","reference-tags-option"),O(t,"role","button"),O(t,"tabindex","0"),this.first=t},m(u,h){x(u,t,h),b(t,r),b(t,s),o||(l=[G(t,"click",a),G(t,"keypress",c)],o=!0)},p(u,h){e=u,h&4&&n!==(n=e[11].data.name+"")&&K(r,n)},d(u){u&&P(t),o=!1,ht(l)}}}function wT(i){let e,t,n,r,s,o,l,a=i[2]&&Kg(i);return{c(){e=y("div"),t=y("input"),r=D(),s=y("div"),a&&a.c(),O(t,"type","search"),O(t,"placeholder",n="Search for "+i[0].label),O(t,"autocomplete","off"),O(s,"class","reference-tags-results"),O(e,"class","reference-tags")},m(c,u){x(c,e,u),b(e,t),Le(t,i[1]),b(e,r),b(e,s),a&&a.m(s,null),o||(l=[G(t,"keyup",i[3]),G(t,"input",i[6])],o=!0)},p(c,[u]){u&1&&n!==(n="Search for "+c[0].label)&&O(t,"placeholder",n),u&2&&t.value!==c[1]&&Le(t,c[1]),c[2]?a?a.p(c,u):(a=Kg(c),a.c(),a.m(s,null)):a&&(a.d(1),a=null)},i:U,o:U,d(c){c&&P(e),a&&a.d(),o=!1,ht(l)}}}function yT(i,e,t){let n;const r=Ue("channel"),s=nn();let{value:o=""}=e,{field:l}=e,a="";const c=GA(m=>{Qa(r.lucentUrl+"/records/suggestions",{params:{schema:l.collections[0],field:"search",value:a,ui:"search"}}).then(p=>{t(2,n=p)}).catch(p=>{t(2,n=[]),console.log(p)})},500);function u(m,p){m.preventDefault(),t(5,o=p.id),s("addFilter"),t(5,o="")}function h(){a=this.value,t(1,a)}const f=(m,p)=>u(p,m),d=(m,p)=>u(p,m);return i.$$set=m=>{"value"in m&&t(5,o=m.value),"field"in m&&t(0,l=m.field)},t(2,n=[]),[l,a,n,c,u,o,h,f,d]}class kT extends oe{constructor(e){super(),se(this,e,yT,wT,re,{value:5,field:0})}}function tO(i,e,t){const n=i.slice();return n[39]=e[t],n}function nO(i,e,t){const n=i.slice();return n[42]=e[t],n}function iO(i,e,t){const n=i.slice();return n[39]=e[t],n}function rO(i){let e,t,n,r,s,o,l,a;t=new ut({props:{icon:"arrow-left"}});let c=fe(i[9]),u=[];for(let h=0;h<c.length;h+=1)u[h]=sO(iO(i,c,h));return{c(){e=y("button"),V(t.$$.fragment),n=W(`
Back`),r=D();for(let h=0;h<u.length;h+=1)u[h].c();s=Ie(),O(e,"class","dropdown-item button")},m(h,f){x(h,e,f),Y(t,e,null),b(e,n),x(h,r,f);for(let d=0;d<u.length;d+=1)u[d]&&u[d].m(h,f);x(h,s,f),o=!0,l||(a=G(e,"click",i[23]),l=!0)},p(h,f){if(f[0]&2560){c=fe(h[9]);let d;for(d=0;d<c.length;d+=1){const m=iO(h,c,d);u[d]?u[d].p(m,f):(u[d]=sO(m),u[d].c(),u[d].m(s.parentNode,s))}for(;d<u.length;d+=1)u[d].d(1);u.length=c.length}},i(h){o||(T(t.$$.fragment,h),o=!0)},o(h){R(t.$$.fragment,h),o=!1},d(h){h&&(P(e),P(r),P(s)),z(t),Ot(u,h),l=!1,a()}}}function sO(i){let e,t,n;function r(...s){return i[24](i[39],...s)}return{c(){e=y("button"),e.textContent=`${i[39].label} `,O(e,"class","dropdown-item button")},m(s,o){x(s,e,o),t||(n=G(e,"click",r),t=!0)},p(s,o){i=s},d(s){s&&P(e),t=!1,n()}}}function oO(i){let e,t,n,r,s,o,l=i[3].label+"",a,c,u,h,f,d;t=new ut({props:{icon:"arrow-left"}});let m=fe(i[7]),p=[];for(let g=0;g<m.length;g+=1)p[g]=lO(nO(i,m,g));return{c(){e=y("button"),V(t.$$.fragment),n=W(`
Back`),r=D(),s=y("div"),o=W("field: "),a=W(l),c=D();for(let g=0;g<p.length;g+=1)p[g].c();u=Ie(),O(e,"class","dropdown-item button"),O(s,"class","selected-filter")},m(g,v){x(g,e,v),Y(t,e,null),b(e,n),x(g,r,v),x(g,s,v),b(s,o),b(s,a),x(g,c,v);for(let w=0;w<p.length;w+=1)p[w]&&p[w].m(g,v);x(g,u,v),h=!0,f||(d=G(e,"click",i[25]),f=!0)},p(g,v){if((!h||v[0]&8)&&l!==(l=g[3].label+"")&&K(a,l),v[0]&8320){m=fe(g[7]);let w;for(w=0;w<m.length;w+=1){const S=nO(g,m,w);p[w]?p[w].p(S,v):(p[w]=lO(S),p[w].c(),p[w].m(u.parentNode,u))}for(;w<p.length;w+=1)p[w].d(1);p.length=m.length}},i(g){h||(T(t.$$.fragment,g),h=!0)},o(g){R(t.$$.fragment,g),h=!1},d(g){g&&(P(e),P(r),P(s),P(c),P(u)),z(t),Ot(p,g),f=!1,d()}}}function lO(i){let e,t=i[42].label+"",n,r,s,o;function l(...a){return i[26](i[42],...a)}return{c(){e=y("button"),n=W(t),r=D(),O(e,"class","dropdown-item button")},m(a,c){x(a,e,c),b(e,n),b(e,r),s||(o=G(e,"click",l),s=!0)},p(a,c){i=a,c[0]&128&&t!==(t=i[42].label+"")&&K(n,t)},d(a){a&&P(e),s=!1,o()}}}function aO(i){let e,t,n,r,s,o,l=i[3].label+"",a,c,u=i[5].label+"",h,f,d,m,p,g,v,w,S;return t=new ut({props:{icon:"arrow-left"}}),{c(){e=y("button"),V(t.$$.fragment),n=W(`
Back`),r=D(),s=y("div"),o=W("field: "),a=W(l),c=W(" operator: "),h=W(u),f=D(),d=y("div"),m=y("input"),p=D(),g=y("button"),g.textContent="Add filter",O(e,"class","dropdown-item button"),O(s,"class","selected-filter"),O(m,"type","text"),O(m,"class","form-control"),O(d,"class","filter-input"),O(g,"class","button applied-filter"),O(g,"type","button")},m(_,k){x(_,e,k),Y(t,e,null),b(e,n),x(_,r,k),x(_,s,k),b(s,o),b(s,a),b(s,c),b(s,h),x(_,f,k),x(_,d,k),b(d,m),Le(m,i[2]),x(_,p,k),x(_,g,k),v=!0,w||(S=[G(e,"click",i[27]),G(m,"input",i[28]),G(g,"click",i[14])],w=!0)},p(_,k){(!v||k[0]&8)&&l!==(l=_[3].label+"")&&K(a,l),(!v||k[0]&32)&&u!==(u=_[5].label+"")&&K(h,u),k[0]&4&&m.value!==_[2]&&Le(m,_[2])},i(_){v||(T(t.$$.fragment,_),v=!0)},o(_){R(t.$$.fragment,_),v=!1},d(_){_&&(P(e),P(r),P(s),P(f),P(d),P(p),P(g)),z(t),w=!1,ht(S)}}}function cO(i){let e,t,n,r,s,o,l,a;t=new ut({props:{icon:"arrow-left"}});let c=fe(i[10]),u=[];for(let h=0;h<c.length;h+=1)u[h]=uO(tO(i,c,h));return{c(){e=y("button"),V(t.$$.fragment),n=W(`
Back`),r=D();for(let h=0;h<u.length;h+=1)u[h].c();s=Ie(),O(e,"class","dropdown-item button")},m(h,f){x(h,e,f),Y(t,e,null),b(e,n),x(h,r,f);for(let d=0;d<u.length;d+=1)u[d]&&u[d].m(h,f);x(h,s,f),o=!0,l||(a=G(e,"click",i[29]),l=!0)},p(h,f){if(f[0]&5120){c=fe(h[10]);let d;for(d=0;d<c.length;d+=1){const m=tO(h,c,d);u[d]?u[d].p(m,f):(u[d]=uO(m),u[d].c(),u[d].m(s.parentNode,s))}for(;d<u.length;d+=1)u[d].d(1);u.length=c.length}},i(h){o||(T(t.$$.fragment,h),o=!0)},o(h){R(t.$$.fragment,h),o=!1},d(h){h&&(P(e),P(r),P(s)),z(t),Ot(u,h),l=!1,a()}}}function uO(i){let e,t,n;function r(...s){return i[30](i[39],...s)}return{c(){e=y("button"),e.textContent=`${i[39].label} `,O(e,"class","dropdown-item button")},m(s,o){x(s,e,o),t||(n=G(e,"click",r),t=!0)},p(s,o){i=s},d(s){s&&P(e),t=!1,n()}}}function hO(i){let e,t,n,r,s,o,l=i[4].label+"",a,c,u,h,f,d,m,p;t=new ut({props:{icon:"arrow-left"}});function g(w){i[32](w)}let v={field:i[4]};return i[2]!==void 0&&(v.value=i[2]),h=new kT({props:v}),Ce.push(()=>nt(h,"value",g)),h.$on("addFilter",i[14]),{c(){e=y("button"),V(t.$$.fragment),n=W(`
Back`),r=D(),s=y("div"),o=W("field: "),a=W(l),c=D(),u=y("div"),V(h.$$.fragment),O(e,"class","dropdown-item button"),O(s,"class","selected-filter"),O(u,"class","mt-2")},m(w,S){x(w,e,S),Y(t,e,null),b(e,n),x(w,r,S),x(w,s,S),b(s,o),b(s,a),x(w,c,S),x(w,u,S),Y(h,u,null),d=!0,m||(p=G(e,"click",i[31]),m=!0)},p(w,S){(!d||S[0]&16)&&l!==(l=w[4].label+"")&&K(a,l);const _={};S[0]&16&&(_.field=w[4]),!f&&S[0]&4&&(f=!0,_.value=w[2],st(()=>f=!1)),h.$set(_)},i(w){d||(T(t.$$.fragment,w),T(h.$$.fragment,w),d=!0)},o(w){R(t.$$.fragment,w),R(h.$$.fragment,w),d=!1},d(w){w&&(P(e),P(r),P(s),P(c),P(u)),z(t),z(h),m=!1,p()}}}function ST(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,v,w,S,_,k,A,C,Q,M,L,N=!i[3]&&rO(i),B=i[3]&&!i[5]&&oO(i),J=i[3]&&i[5]&&aO(i),te=!i[4]&&cO(i),ie=i[4]&&hO(i);return v=new ut({props:{icon:"arrow-left"}}),{c(){e=y("div"),t=y("button"),t.textContent="Filter by field",n=D(),r=y("button"),r.textContent="Filter by Reference",s=D(),o=y("button"),o.textContent="Advanced filter",l=D(),a=y("div"),N&&N.c(),c=D(),B&&B.c(),u=D(),J&&J.c(),h=D(),f=y("div"),te&&te.c(),d=D(),ie&&ie.c(),m=D(),p=y("div"),g=y("button"),V(v.$$.fragment),w=W(`
Back`),S=D(),_=y("form"),k=y("input"),A=D(),C=y("button"),C.textContent="Submit",O(t,"class","dropdown-item button"),O(r,"class","dropdown-item button"),O(o,"class","dropdown-item button"),Ae(e,"hide",i[6]!=="main"),Ae(a,"hide",i[6]!=="byField"),Ae(f,"hide",i[6]!=="byReference"),O(g,"class","dropdown-item button"),O(k,"type","search"),O(k,"class","mb-2 mt-2"),O(k,"placeholder","Advanced filters"),k.required=!0,O(C,"class","button applied-filter"),Ae(p,"hide",i[6]!=="advanced")},m(ae,X){x(ae,e,X),b(e,t),b(e,n),b(e,r),b(e,s),b(e,o),x(ae,l,X),x(ae,a,X),N&&N.m(a,null),b(a,c),B&&B.m(a,null),b(a,u),J&&J.m(a,null),x(ae,h,X),x(ae,f,X),te&&te.m(f,null),b(f,d),ie&&ie.m(f,null),x(ae,m,X),x(ae,p,X),b(p,g),Y(v,g,null),b(g,w),b(p,S),b(p,_),b(_,k),Le(k,i[1]),b(_,A),b(_,C),Q=!0,M||(L=[G(t,"click",i[20]),G(r,"click",i[21]),G(o,"click",i[22]),G(g,"click",i[33]),G(k,"input",i[34]),G(_,"submit",i[8])],M=!0)},p(ae,X){(!Q||X[0]&64)&&Ae(e,"hide",ae[6]!=="main"),ae[3]?N&&(Oe(),R(N,1,1,()=>{N=null}),be()):N?(N.p(ae,X),X[0]&8&&T(N,1)):(N=rO(ae),N.c(),T(N,1),N.m(a,c)),ae[3]&&!ae[5]?B?(B.p(ae,X),X[0]&40&&T(B,1)):(B=oO(ae),B.c(),T(B,1),B.m(a,u)):B&&(Oe(),R(B,1,1,()=>{B=null}),be()),ae[3]&&ae[5]?J?(J.p(ae,X),X[0]&40&&T(J,1)):(J=aO(ae),J.c(),T(J,1),J.m(a,null)):J&&(Oe(),R(J,1,1,()=>{J=null}),be()),(!Q||X[0]&64)&&Ae(a,"hide",ae[6]!=="byField"),ae[4]?te&&(Oe(),R(te,1,1,()=>{te=null}),be()):te?(te.p(ae,X),X[0]&16&&T(te,1)):(te=cO(ae),te.c(),T(te,1),te.m(f,d)),ae[4]?ie?(ie.p(ae,X),X[0]&16&&T(ie,1)):(ie=hO(ae),ie.c(),T(ie,1),ie.m(f,null)):ie&&(Oe(),R(ie,1,1,()=>{ie=null}),be()),(!Q||X[0]&64)&&Ae(f,"hide",ae[6]!=="byReference"),X[0]&2&&k.value!==ae[1]&&Le(k,ae[1]),(!Q||X[0]&64)&&Ae(p,"hide",ae[6]!=="advanced")},i(ae){Q||(T(N),T(B),T(J),T(te),T(ie),T(v.$$.fragment,ae),Q=!0)},o(ae){R(N),R(B),R(J),R(te),R(ie),R(v.$$.fragment,ae),Q=!1},d(ae){ae&&(P(e),P(l),P(a),P(h),P(f),P(m),P(p)),N&&N.d(),B&&B.d(),J&&J.d(),te&&te.d(),ie&&ie.d(),z(v),M=!1,ht(L)}}}function _T(i){let e,t,n,r,s;return t=new ut({props:{icon:"filter"}}),{c(){e=y("div"),V(t.$$.fragment),n=D(),r=y("span"),r.textContent="Filter",O(r,"class","ms-1"),O(e,"slot","button")},m(o,l){x(o,e,l),Y(t,e,null),b(e,n),b(e,r),s=!0},p:U,i(o){s||(T(t.$$.fragment,o),s=!0)},o(o){R(t.$$.fragment,o),s=!1},d(o){o&&P(e),z(t)}}}function CT(i){let e,t,n,r={$$slots:{button:[_T],default:[ST]},$$scope:{ctx:i}};return t=new ur({props:r}),i[35](t),{c(){e=y("div"),V(t.$$.fragment)},m(s,o){x(s,e,o),Y(t,e,null),n=!0},p(s,o){const l={};o[0]&254|o[1]&65536&&(l.$$scope={dirty:o,ctx:s}),t.$set(l)},i(s){n||(T(t.$$.fragment,s),n=!0)},o(s){R(t.$$.fragment,s),n=!1},d(s){s&&P(e),i[35](null),z(t)}}}function PT(i,e,t){const n=nn();let{schema:r}=e,{systemFields:s=[]}=e,{operators:o}=e,{inModal:l}=e,{modalUrl:a}=e,c,u="",h=s;r.type==="collection"&&(h=s.filter(H=>H.files===!1));function f(H){H.preventDefault();let Pe=u.split("=")[0]??"";if(!Pe)return;let Ye=`filter[${Pe}]`,Tt=u.split("=")[1]??"";if(!Tt)return;const yt=new URL(a??window.location.href);yt.searchParams.set("skip","0"),yt.searchParams.set(Ye,Tt),l?n("refresh",yt):window.location.replace(yt),M()}let d=null,m=null,p=null,g=null,v="main",w=null,S=[...r.fields,...h].filter(H=>{var Pe;return!["file","json","reference"].includes(((Pe=H.info)==null?void 0:Pe.name)??H.ui)}),_=[...r.fields].filter(H=>{var Pe;return["reference"].includes(((Pe=H.info)==null?void 0:Pe.name)??H.ui)});function k(H,Pe){t(3,m=Pe),t(7,w=o.filter(Ye=>{var Tt;return Ye.uis.includes((Tt=m==null?void 0:m.info)==null?void 0:Tt.name)||Ye.uis[0]==="*"}))}function A(H,Pe){t(4,p=Pe),t(5,g=o.find(Ye=>Ye.name==="eq"))}function C(H,Pe){t(5,g=Pe),Pe.hasValue||Q(H)}function Q(H){H.preventDefault();let Pe="",Ye,Tt=m??p;r.fields.find(wt=>wt.name===Tt.name)&&(Tt.info.name==="reference"&&g.name==="eq"?(Pe="children."+Tt.name+".id",Ye=`filter[${Pe}]`):(Pe="data.",Ye=`filter[${Pe+Tt.name}_${g.name}]`));const yt=new URL(a??window.location.href);yt.searchParams.set("skip","0"),yt.searchParams.set(Ye,d),l?(n("refresh",yt),c.close()):window.location.href=yt.toString(),M()}function M(){t(3,m=null),t(5,g=null),t(6,v="main"),t(4,p=null)}const L=H=>t(6,v="byField"),N=H=>t(6,v="byReference"),B=H=>t(6,v="advanced"),J=H=>t(6,v="main"),te=(H,Pe)=>k(Pe,H),ie=H=>t(3,m=null),ae=(H,Pe)=>C(Pe,H),X=H=>t(5,g=null);function ee(){d=this.value,t(2,d)}const Te=H=>t(6,v="main"),ve=(H,Pe)=>A(Pe,H),je=H=>t(4,p=null);function ne(H){d=H,t(2,d)}const Ee=H=>t(6,v="main");function Re(){u=this.value,t(1,u)}function xt(H){Ce[H?"unshift":"push"](()=>{c=H,t(0,c)})}return i.$$set=H=>{"schema"in H&&t(15,r=H.schema),"systemFields"in H&&t(16,s=H.systemFields),"operators"in H&&t(17,o=H.operators),"inModal"in H&&t(18,l=H.inModal),"modalUrl"in H&&t(19,a=H.modalUrl)},[c,u,d,m,p,g,v,w,f,S,_,k,A,C,Q,r,s,o,l,a,L,N,B,J,te,ie,ae,X,ee,Te,ve,je,ne,Ee,Re,xt]}class AT extends oe{constructor(e){super(),se(this,e,PT,CT,re,{schema:15,systemFields:16,operators:17,inModal:18,modalUrl:19},null,[-1,-1])}}function fO(i,e,t){const n=i.slice();return n[18]=e[t],n}function dO(i,e,t){const n=i.slice();return n[18]=e[t],n}function mO(i){let e,t,n,r,s,o,l,a,c,u,h=i[18].label+"",f,d,m,p;n=new ut({props:{icon:"arrow-up-short-wide"}});function g(...S){return i[10](i[18],...S)}l=new ut({props:{icon:"arrow-down-wide-short"}});function v(...S){return i[11](i[18],...S)}function w(...S){return i[12](i[18],...S)}return{c(){e=y("div"),t=y("button"),V(n.$$.fragment),s=D(),o=y("button"),V(l.$$.fragment),c=D(),u=y("button"),f=W(h),O(t,"title","Sort Ascending"),O(t,"class",r="button button-icon "+(i[18].name==i[1].name&&!i[0].startsWith("-")?"active":"")),O(o,"title","Sort Descending"),O(o,"class",a="button button-icon "+(i[18].name==i[1].name&&i[0].startsWith("-")?"active":"")),O(u,"title","Sort Ascending"),O(u,"class","button"),O(e,"class","dropdown-item")},m(S,_){x(S,e,_),b(e,t),Y(n,t,null),b(e,s),b(e,o),Y(l,o,null),b(e,c),b(e,u),b(u,f),d=!0,m||(p=[G(t,"click",g),G(o,"click",v),G(u,"click",w)],m=!0)},p(S,_){i=S,(!d||_&11&&r!==(r="button button-icon "+(i[18].name==i[1].name&&!i[0].startsWith("-")?"active":"")))&&O(t,"class",r),(!d||_&11&&a!==(a="button button-icon "+(i[18].name==i[1].name&&i[0].startsWith("-")?"active":"")))&&O(o,"class",a),(!d||_&8)&&h!==(h=i[18].label+"")&&K(f,h)},i(S){d||(T(n.$$.fragment,S),T(l.$$.fragment,S),d=!0)},o(S){R(n.$$.fragment,S),R(l.$$.fragment,S),d=!1},d(S){S&&P(e),z(n),z(l),m=!1,ht(p)}}}function pO(i){let e,t,n,r,s,o,l,a,c,u,h=i[18].label+"",f,d,m,p,g;n=new ut({props:{icon:"arrow-up-short-wide"}});function v(..._){return i[13](i[18],..._)}l=new ut({props:{icon:"arrow-down-wide-short"}});function w(..._){return i[14](i[18],..._)}function S(..._){return i[15](i[18],..._)}return{c(){e=y("div"),t=y("button"),V(n.$$.fragment),s=D(),o=y("button"),V(l.$$.fragment),c=D(),u=y("button"),f=W(h),d=D(),O(t,"title","Sort Ascending"),O(t,"class",r="button button-icon "+(i[18].name==i[0]?"active":"")),O(o,"title","Sort Descending"),O(o,"class",a="button button-icon "+("-"+i[18].name==i[0]?"active":"")),O(u,"title","Sort Ascending"),O(u,"class","button"),O(e,"class","dropdown-item")},m(_,k){x(_,e,k),b(e,t),Y(n,t,null),b(e,s),b(e,o),Y(l,o,null),b(e,c),b(e,u),b(u,f),b(e,d),m=!0,p||(g=[G(t,"click",v),G(o,"click",w),G(u,"click",S)],p=!0)},p(_,k){i=_,(!m||k&5&&r!==(r="button button-icon "+(i[18].name==i[0]?"active":"")))&&O(t,"class",r),(!m||k&5&&a!==(a="button button-icon "+("-"+i[18].name==i[0]?"active":"")))&&O(o,"class",a),(!m||k&4)&&h!==(h=i[18].label+"")&&K(f,h)},i(_){m||(T(n.$$.fragment,_),T(l.$$.fragment,_),m=!0)},o(_){R(n.$$.fragment,_),R(l.$$.fragment,_),m=!1},d(_){_&&P(e),z(n),z(l),p=!1,ht(g)}}}function xT(i){let e,t,n,r,s,o=fe(i[3]),l=[];for(let f=0;f<o.length;f+=1)l[f]=mO(dO(i,o,f));const a=f=>R(l[f],1,1,()=>{l[f]=null});let c=fe(i[2]),u=[];for(let f=0;f<c.length;f+=1)u[f]=pO(fO(i,c,f));const h=f=>R(u[f],1,1,()=>{u[f]=null});return{c(){e=y("div");for(let f=0;f<l.length;f+=1)l[f].c();t=D(),n=y("h6"),n.textContent="System",r=D();for(let f=0;f<u.length;f+=1)u[f].c();O(n,"class","dropdown-header")},m(f,d){x(f,e,d);for(let m=0;m<l.length;m+=1)l[m]&&l[m].m(e,null);b(e,t),b(e,n),b(e,r);for(let m=0;m<u.length;m+=1)u[m]&&u[m].m(e,null);s=!0},p(f,d){if(d&59){o=fe(f[3]);let m;for(m=0;m<o.length;m+=1){const p=dO(f,o,m);l[m]?(l[m].p(p,d),T(l[m],1)):(l[m]=mO(p),l[m].c(),T(l[m],1),l[m].m(e,t))}for(Oe(),m=o.length;m<l.length;m+=1)a(m);be()}if(d&53){c=fe(f[2]);let m;for(m=0;m<c.length;m+=1){const p=fO(f,c,m);u[m]?(u[m].p(p,d),T(u[m],1)):(u[m]=pO(p),u[m].c(),T(u[m],1),u[m].m(e,null))}for(Oe(),m=c.length;m<u.length;m+=1)h(m);be()}},i(f){if(!s){for(let d=0;d<o.length;d+=1)T(l[d]);for(let d=0;d<c.length;d+=1)T(u[d]);s=!0}},o(f){l=l.filter(Boolean);for(let d=0;d<l.length;d+=1)R(l[d]);u=u.filter(Boolean);for(let d=0;d<u.length;d+=1)R(u[d]);s=!1},d(f){f&&P(e),Ot(l,f),Ot(u,f)}}}function TT(i){let e,t;return e=new ut({props:{icon:"arrow-up-short-wide"}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function QT(i){let e,t;return e=new ut({props:{icon:"arrow-down-wide-short"}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function MT(i){let e,t,n,r,s,o,l=i[1].label+"",a,c;const u=[QT,TT],h=[];function f(d,m){return m&1&&(t=null),t==null&&(t=!!d[0].startsWith("-")),t?0:1}return n=f(i,-1),r=h[n]=u[n](i),{c(){e=y("div"),r.c(),s=D(),o=y("span"),a=W(l),O(o,"class","ms-1"),O(e,"slot","button")},m(d,m){x(d,e,m),h[n].m(e,null),b(e,s),b(e,o),b(o,a),c=!0},p(d,m){let p=n;n=f(d,m),n!==p&&(Oe(),R(h[p],1,1,()=>{h[p]=null}),be(),r=h[n],r||(r=h[n]=u[n](d),r.c()),T(r,1),r.m(e,s)),(!c||m&2)&&l!==(l=d[1].label+"")&&K(a,l)},i(d){c||(T(r),c=!0)},o(d){R(r),c=!1},d(d){d&&P(e),h[n].d()}}}function ET(i){let e,t;return e=new ur({props:{$$slots:{button:[MT],default:[xT]},$$scope:{ctx:i}}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,[r]){const s={};r&8388623&&(s.$$scope={dirty:r,ctx:n}),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function RT(i,e,t){let n,r;const s=nn();let{schema:o}=e,{sortParam:l}=e,{sortField:a}=e,{inModal:c}=e,{modalUrl:u}=e,{systemFields:h=[]}=e;function f(k){const A=new URL(u??window.location.href);A.searchParams.set("sort",k),c?s("refresh",A):window.location=A}function d(k,A){k.preventDefault();let C=h.map(Q=>Q.name).includes(A.name)?"":"data.";return f(C+A.name)}function m(k,A){k.preventDefault();let C=h.map(Q=>Q.name).includes(A.name)?"":"data.";return f("-"+C+A.name)}const p=(k,A)=>d(A,k),g=(k,A)=>m(A,k),v=(k,A)=>d(A,k),w=(k,A)=>d(A,k),S=(k,A)=>m(A,k),_=(k,A)=>d(A,k);return i.$$set=k=>{"schema"in k&&t(6,o=k.schema),"sortParam"in k&&t(0,l=k.sortParam),"sortField"in k&&t(1,a=k.sortField),"inModal"in k&&t(7,c=k.inModal),"modalUrl"in k&&t(8,u=k.modalUrl),"systemFields"in k&&t(9,h=k.systemFields)},i.$$.update=()=>{i.$$.dirty&64&&t(3,n=o.fields.filter(k=>!["reference","file","json","id","rich","markdown","block"].includes(k.info.name))),i.$$.dirty&512&&t(2,r=h),i.$$.dirty&576&&o.type==="collection"&&t(2,r=h.filter(k=>k.files===!1))},[l,a,r,n,d,m,o,c,u,h,p,g,v,w,S,_]}class DT extends oe{constructor(e){super(),se(this,e,RT,ET,re,{schema:6,sortParam:0,sortField:1,inModal:7,modalUrl:8,systemFields:9})}}function $T(i){var c,u;let e=i[3].label+"",t,n,r=(((c=i[0].find(i[10]))==null?void 0:c.symbol)??"")+"",s,o,l=((u=i[0].find(i[11]))!=null&&u.hasValue?i[2]:"")+"",a;return{c(){t=W(e),n=D(),s=W(r),o=D(),a=W(l)},m(h,f){x(h,t,f),x(h,n,f),x(h,s,f),x(h,o,f),x(h,a,f)},p(h,f){var d,m;f&8&&e!==(e=h[3].label+"")&&K(t,e),f&9&&r!==(r=(((d=h[0].find(h[10]))==null?void 0:d.symbol)??"")+"")&&K(s,r),f&13&&l!==(l=((m=h[0].find(h[11]))!=null&&m.hasValue?h[2]:"")+"")&&K(a,l)},d(h){h&&(P(t),P(n),P(s),P(o),P(a))}}}function LT(i){let e=i[3].label+"",t,n,r=i[4].data.name+"",s;return{c(){t=W(e),n=W(" is "),s=W(r)},m(o,l){x(o,t,l),x(o,n,l),x(o,s,l)},p(o,l){l&8&&e!==(e=o[3].label+"")&&K(t,e)},d(o){o&&(P(t),P(n),P(s))}}}function IT(i){let e,t,n,r,s,o,l;function a(h,f){return h[3].isReference&&h[4]?LT:$T}let c=a(i),u=c(i);return r=new ut({props:{width:12,height:12,icon:"close"}}),{c(){e=y("span"),u.c(),t=D(),n=y("button"),V(r.$$.fragment),O(n,"type","button"),O(n,"class","button-text"),O(n,"aria-label","Close"),O(e,"class","applied-filter")},m(h,f){x(h,e,f),u.m(e,null),b(e,t),b(e,n),Y(r,n,null),s=!0,o||(l=G(n,"click",Ln(i[12])),o=!0)},p(h,[f]){c===(c=a(h))&&u?u.p(h,f):(u.d(1),u=c(h),u&&(u.c(),u.m(e,t)))},i(h){s||(T(r.$$.fragment,h),s=!0)},o(h){R(r.$$.fragment,h),s=!1},d(h){h&&P(e),u.d(),z(r),o=!1,l()}}}function NT(i){return e=>{if(e.isReference)return e.operator="eq",e;const t=i.split("_");return e.operator=t[t.length-1]??"eq",e}}function ZT(i,e){return t=>{let n="";t.isReference?n=e.split(".")[1]:n=e.replace("_"+t.operator,"");const r=i.fields.find(s=>s.name===n);return t.label=(r==null?void 0:r.label)??n,t}}function BT(i,e,t){const n=nn();let{schema:r}=e,{operators:s}=e,{key:o}=e,{value:l}=e,{inModal:a}=e,{modalUrl:c}=e,{graph:u}=e,h={label:"",operator:"",value:l,isReference:o.startsWith("children")};h=[NT(o),ZT(r,o)].reduce((w,S)=>S(w),h);const f=d(u,l);function d(w,S){return h.isReference?w.records.find(_=>_.id===S):null}function m(w){let S=`filter[${w}]`;const _=new URL(c??window.location.href);_.searchParams.set("skip","0"),_.searchParams.delete(S),a?n("refresh",_):window.location.replace(_)}const p=w=>w.name===h.operator,g=w=>w.name===h.operator,v=()=>m(o);return i.$$set=w=>{"schema"in w&&t(6,r=w.schema),"operators"in w&&t(0,s=w.operators),"key"in w&&t(1,o=w.key),"value"in w&&t(2,l=w.value),"inModal"in w&&t(7,a=w.inModal),"modalUrl"in w&&t(8,c=w.modalUrl),"graph"in w&&t(9,u=w.graph)},[s,o,l,h,f,m,r,a,c,u,p,g,v]}class WT extends oe{constructor(e){super(),se(this,e,BT,IT,re,{schema:6,operators:0,key:1,value:2,inModal:7,modalUrl:8,graph:9})}}function XT(i){let e,t,n,r,s,o,l;return r=new ut({props:{width:12,height:12,icon:"close"}}),{c(){e=y("span"),t=W(`Not linked
`),n=y("button"),V(r.$$.fragment),O(n,"type","button"),O(n,"class","button-text"),O(n,"aria-label","Close"),O(e,"class","applied-filter")},m(a,c){x(a,e,c),b(e,t),b(e,n),Y(r,n,null),s=!0,o||(l=G(n,"click",Ln(i[4])),o=!0)},p:U,i(a){s||(T(r.$$.fragment,a),s=!0)},o(a){R(r.$$.fragment,a),s=!1},d(a){a&&P(e),z(r),o=!1,l()}}}function FT(i){let e=i[0].searchParams.get("notlinked"),t,n,r=e&&XT(i);return{c(){r&&r.c(),t=Ie()},m(s,o){r&&r.m(s,o),x(s,t,o),n=!0},p(s,[o]){e&&r.p(s,o)},i(s){n||(T(r),n=!0)},o(s){R(r),n=!1},d(s){s&&P(t),r&&r.d(s)}}}function YT(i,e,t){Ue("channel");const n=nn();let{inModal:r}=e,{modalUrl:s}=e;const o=new URL(s??window.location.href);function l(c){const u=new URL(s??window.location.href);u.searchParams.set("skip","0"),u.searchParams.delete("notlinked"),r?n("refresh",u):window.location.replace(u)}const a=()=>l();return i.$$set=c=>{"inModal"in c&&t(2,r=c.inModal),"modalUrl"in c&&t(3,s=c.modalUrl)},[o,l,r,s,a]}class zT extends oe{constructor(e){super(),se(this,e,YT,FT,re,{inModal:2,modalUrl:3})}}function gO(i,e,t){const n=i.slice();return n[21]=e[t][0],n[22]=e[t][1],n}function OO(i){let e,t,n;return{c(){e=y("a"),t=W("New Record"),O(e,"href",n=i[10].lucentUrl+"/records/new?schema="+i[0].name),O(e,"class","button")},m(r,s){x(r,e,s),b(e,t)},p(r,s){s&1&&n!==(n=r[10].lucentUrl+"/records/new?schema="+r[0].name)&&O(e,"href",n)},d(r){r&&P(e)}}}function bO(i){let e,t;return e=new ur({props:{orientation:"right",$$slots:{button:[qT],default:[jT]},$$scope:{ctx:i}}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&33554577&&(s.$$scope={dirty:r,ctx:n}),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function VT(i){let e,t,n,r,s,o,l,a,c,u;return{c(){e=y("a"),t=W("Export to CSV"),n=D(),r=y("a"),s=W("View trashed records"),l=D(),a=y("a"),c=W("View unlinked records"),O(e,"class","dropdown-item"),O(e,"href",i[11]),O(r,"class","dropdown-item"),O(r,"href",o=i[10].lucentUrl+"/content/"+i[0].name+"?filter[status_in]=trashed"),O(a,"class","dropdown-item"),O(a,"href",u=i[10].lucentUrl+"/content/"+i[0].name+"?notlinked=*")},m(h,f){x(h,e,f),b(e,t),x(h,n,f),x(h,r,f),b(r,s),x(h,l,f),x(h,a,f),b(a,c)},p(h,f){f&1&&o!==(o=h[10].lucentUrl+"/content/"+h[0].name+"?filter[status_in]=trashed")&&O(r,"href",o),f&1&&u!==(u=h[10].lucentUrl+"/content/"+h[0].name+"?notlinked=*")&&O(a,"href",u)},d(h){h&&(P(e),P(n),P(r),P(l),P(a))}}}function UT(i){let e,t=i[7]&&vO(i);return{c(){t&&t.c(),e=Ie()},m(n,r){t&&t.m(n,r),x(n,e,r)},p(n,r){n[7]?t?t.p(n,r):(t=vO(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(n){n&&P(e),t&&t.d(n)}}}function vO(i){let e,t,n;return{c(){e=y("a"),t=W("Empty trash"),O(e,"class","dropdown-item"),O(e,"href",n=i[10].lucentUrl+"/content/"+i[0].name+"/emptyTrash")},m(r,s){x(r,e,s),b(e,t)},p(r,s){s&1&&n!==(n=r[10].lucentUrl+"/content/"+r[0].name+"/emptyTrash")&&O(e,"href",n)},d(r){r&&P(e)}}}function jT(i){let e;function t(s,o){return s[4].status_in==="trashed"?UT:VT}let n=t(i),r=n(i);return{c(){r.c(),e=Ie()},m(s,o){r.m(s,o),x(s,e,o)},p(s,o){n===(n=t(s))&&r?r.p(s,o):(r.d(1),r=n(s),r&&(r.c(),r.m(e.parentNode,e)))},d(s){s&&P(e),r.d(s)}}}function qT(i){let e,t,n;return t=new ut({props:{icon:"ellipsis-vertical"}}),{c(){e=y("div"),V(t.$$.fragment),O(e,"slot","button")},m(r,s){x(r,e,s),Y(t,e,null),n=!0},p:U,i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){R(t.$$.fragment,r),n=!1},d(r){r&&P(e),z(t)}}}function wO(i){let e,t,n=fe(Object.entries(i[4])),r=[];for(let o=0;o<n.length;o+=1)r[o]=yO(gO(i,n,o));const s=o=>R(r[o],1,1,()=>{r[o]=null});return{c(){for(let o=0;o<r.length;o+=1)r[o].c();e=Ie()},m(o,l){for(let a=0;a<r.length;a+=1)r[a]&&r[a].m(o,l);x(o,e,l),t=!0},p(o,l){if(l&377){n=fe(Object.entries(o[4]));let a;for(a=0;a<n.length;a+=1){const c=gO(o,n,a);r[a]?(r[a].p(c,l),T(r[a],1)):(r[a]=yO(c),r[a].c(),T(r[a],1),r[a].m(e.parentNode,e))}for(Oe(),a=n.length;a<r.length;a+=1)s(a);be()}},i(o){if(!t){for(let l=0;l<n.length;l+=1)T(r[l]);t=!0}},o(o){r=r.filter(Boolean);for(let l=0;l<r.length;l+=1)R(r[l]);t=!1},d(o){o&&P(e),Ot(r,o)}}}function yO(i){let e,t;return e=new WT({props:{schema:i[0],operators:i[3],key:i[21],value:i[22],inModal:i[5],modalUrl:i[6],graph:i[8]}}),e.$on("refresh",i[18]),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&1&&(s.schema=n[0]),r&8&&(s.operators=n[3]),r&16&&(s.key=n[21]),r&16&&(s.value=n[22]),r&32&&(s.inModal=n[5]),r&64&&(s.modalUrl=n[6]),r&256&&(s.graph=n[8]),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function GT(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g=Object.entries(i[4]).length>0,v,w,S;n=new DT({props:{schema:i[0],sortParam:i[1],sortField:i[2],systemFields:i[9],inModal:i[5],modalUrl:i[6]}}),n.$on("refresh",i[14]);function _(M){i[15](M)}let k={systemFields:i[9],operators:i[3],filter:i[4],inModal:i[5],modalUrl:i[6]};i[0]!==void 0&&(k.schema=i[0]),s=new AT({props:k}),Ce.push(()=>nt(s,"schema",_)),s.$on("refresh",i[16]);let A=!i[5]&&i[7]&&OO(i),C=!i[5]&&bO(i);m=new zT({props:{inModal:i[5],modalUrl:i[6]}}),m.$on("refresh",i[17]);let Q=g&&wO(i);return{c(){e=y("div"),t=y("div"),V(n.$$.fragment),r=D(),V(s.$$.fragment),l=D(),a=y("form"),a.innerHTML='<input type="search" name="filter[search_regex]" placeholder="Search" class="search" required=""/>',c=D(),u=y("div"),A&&A.c(),h=D(),C&&C.c(),f=D(),d=y("div"),V(m.$$.fragment),p=D(),Q&&Q.c(),O(a,"method","GET"),O(t,"class","toolbar-filters"),le(u,"display","flex"),le(u,"align-items","center"),le(u,"gap","4px"),O(e,"class","toolbar"),O(d,"class","applied-filters")},m(M,L){x(M,e,L),b(e,t),Y(n,t,null),b(t,r),Y(s,t,null),b(t,l),b(t,a),b(e,c),b(e,u),A&&A.m(u,null),b(u,h),C&&C.m(u,null),x(M,f,L),x(M,d,L),Y(m,d,null),b(d,p),Q&&Q.m(d,null),v=!0,w||(S=G(a,"submit",i[12]),w=!0)},p(M,[L]){const N={};L&1&&(N.schema=M[0]),L&2&&(N.sortParam=M[1]),L&4&&(N.sortField=M[2]),L&512&&(N.systemFields=M[9]),L&32&&(N.inModal=M[5]),L&64&&(N.modalUrl=M[6]),n.$set(N);const B={};L&512&&(B.systemFields=M[9]),L&8&&(B.operators=M[3]),L&16&&(B.filter=M[4]),L&32&&(B.inModal=M[5]),L&64&&(B.modalUrl=M[6]),!o&&L&1&&(o=!0,B.schema=M[0],st(()=>o=!1)),s.$set(B),!M[5]&&M[7]?A?A.p(M,L):(A=OO(M),A.c(),A.m(u,h)):A&&(A.d(1),A=null),M[5]?C&&(Oe(),R(C,1,1,()=>{C=null}),be()):C?(C.p(M,L),L&32&&T(C,1)):(C=bO(M),C.c(),T(C,1),C.m(u,null));const J={};L&32&&(J.inModal=M[5]),L&64&&(J.modalUrl=M[6]),m.$set(J),L&16&&(g=Object.entries(M[4]).length>0),g?Q?(Q.p(M,L),L&16&&T(Q,1)):(Q=wO(M),Q.c(),T(Q,1),Q.m(d,null)):Q&&(Oe(),R(Q,1,1,()=>{Q=null}),be())},i(M){v||(T(n.$$.fragment,M),T(s.$$.fragment,M),T(C),T(m.$$.fragment,M),T(Q),v=!0)},o(M){R(n.$$.fragment,M),R(s.$$.fragment,M),R(C),R(m.$$.fragment,M),R(Q),v=!1},d(M){M&&(P(e),P(f),P(d)),z(n),z(s),A&&A.d(),C&&C.d(),z(m),Q&&Q.d(),w=!1,S()}}}function HT(i,e,t){const n=Ue("channel"),r=nn();let{sortParam:s}=e,{sortField:o}=e,{schema:l}=e,{operators:a}=e,{filter:c}=e,{inModal:u}=e,{modalUrl:h}=e,{isWritable:f}=e,{records:d}=e,{graph:m}=e,{systemFields:p=[]}=e,g=new URL(window.location.href),v=g.pathname+"/csv?"+g.searchParams.toString();function w(Q){Q.preventDefault();const M=new FormData(Q.target);let L=M.keys().next().value,N=M.values().next().value;const B=new URL(h??window.location.href);B.searchParams.set("skip","0"),B.searchParams.set(L,N),u?r("refresh",B):window.location=B}function S(Q){vs.call(this,i,Q)}function _(Q){l=Q,t(0,l)}function k(Q){vs.call(this,i,Q)}function A(Q){vs.call(this,i,Q)}function C(Q){vs.call(this,i,Q)}return i.$$set=Q=>{"sortParam"in Q&&t(1,s=Q.sortParam),"sortField"in Q&&t(2,o=Q.sortField),"schema"in Q&&t(0,l=Q.schema),"operators"in Q&&t(3,a=Q.operators),"filter"in Q&&t(4,c=Q.filter),"inModal"in Q&&t(5,u=Q.inModal),"modalUrl"in Q&&t(6,h=Q.modalUrl),"isWritable"in Q&&t(7,f=Q.isWritable),"records"in Q&&t(13,d=Q.records),"graph"in Q&&t(8,m=Q.graph),"systemFields"in Q&&t(9,p=Q.systemFields)},[l,s,o,a,c,u,h,f,m,p,n,v,w,d,S,_,k,A,C]}class KT extends oe{constructor(e){super(),se(this,e,HT,GT,re,{sortParam:1,sortField:2,schema:0,operators:3,filter:4,inModal:5,modalUrl:6,isWritable:7,records:13,graph:8,systemFields:9})}}function kO(i,e,t){const n=i.slice();return n[9]=e[t],n}function JT(i){let e,t=i[9]+"",n,r,s,o;function l(...a){return i[7](i[9],...a)}return{c(){e=y("a"),n=W(t),O(e,"class","page-link"),O(e,"href",r=i[2](i[9]))},m(a,c){x(a,e,c),b(e,n),s||(o=G(e,"click",l),s=!0)},p(a,c){i=a,c&1&&t!==(t=i[9]+"")&&K(n,t),c&1&&r!==(r=i[2](i[9]))&&O(e,"href",r)},d(a){a&&P(e),s=!1,o()}}}function eQ(i){let e,t=i[9]+"",n;return{c(){e=y("span"),n=W(t),O(e,"class","page-link active")},m(r,s){x(r,e,s),b(e,n)},p(r,s){s&1&&t!==(t=r[9]+"")&&K(n,t)},d(r){r&&P(e)}}}function SO(i){let e,t;function n(o,l){return o[1]===o[9]?eQ:JT}let r=n(i),s=r(i);return{c(){e=y("li"),s.c(),t=D(),O(e,"class","page-item"),Ae(e,"active",i[1]===i[9])},m(o,l){x(o,e,l),s.m(e,null),b(e,t)},p(o,l){r===(r=n(o))&&s?s.p(o,l):(s.d(1),s=r(o),s&&(s.c(),s.m(e,t))),l&3&&Ae(e,"active",o[1]===o[9])},d(o){o&&P(e),s.d()}}}function tQ(i){let e,t=fe(i[0]),n=[];for(let r=0;r<t.length;r+=1)n[r]=SO(kO(i,t,r));return{c(){for(let r=0;r<n.length;r+=1)n[r].c();e=Ie()},m(r,s){for(let o=0;o<n.length;o+=1)n[o]&&n[o].m(r,s);x(r,e,s)},p(r,[s]){if(s&15){t=fe(r[0]);let o;for(o=0;o<t.length;o+=1){const l=kO(r,t,o);n[o]?n[o].p(l,s):(n[o]=SO(l),n[o].c(),n[o].m(e.parentNode,e))}for(;o<n.length;o+=1)n[o].d(1);n.length=t.length}},i:U,o:U,d(r){r&&P(e),Ot(n,r)}}}function nQ(i,e,t){const n=nn();let{pages:r}=e,{limit:s}=e,{currentPage:o}=e,{inModal:l}=e,{modalUrl:a}=e;function c(f){const d=new URL(a??window.location.href);let m=f*s-s;return d.searchParams.set("skip",m),d}function u(f,d){f.preventDefault();const m=new URL(a??window.location.href);let p=d*s-s;m.searchParams.set("skip",p),l?n("refresh",m):window.location=m}const h=(f,d)=>u(d,f);return i.$$set=f=>{"pages"in f&&t(0,r=f.pages),"limit"in f&&t(4,s=f.limit),"currentPage"in f&&t(1,o=f.currentPage),"inModal"in f&&t(5,l=f.inModal),"modalUrl"in f&&t(6,a=f.modalUrl)},[r,o,c,u,s,l,a,h]}class iQ extends oe{constructor(e){super(),se(this,e,nQ,tQ,re,{pages:0,limit:4,currentPage:1,inModal:5,modalUrl:6})}}function _O(i){let e,t,n,r,s,o,l,a,c,u;return r=new iQ({props:{pages:i[7],currentPage:i[6],limit:i[2],inModal:i[0],modalUrl:i[1]}}),r.$on("refresh",i[10]),{c(){e=y("li"),t=y("a"),t.textContent="First",n=D(),V(r.$$.fragment),s=D(),o=y("li"),l=y("a"),l.textContent="Last",O(t,"href","/"),O(t,"class","page-link"),O(e,"class","page-item disabled"),Ae(e,"disabled",i[6]===1),O(l,"class","page-link"),O(l,"href","/"),Ae(l,"disabled",i[6]===i[5]),O(o,"class","page-item")},m(h,f){x(h,e,f),b(e,t),x(h,n,f),Y(r,h,f),x(h,s,f),x(h,o,f),b(o,l),a=!0,c||(u=[G(t,"click",i[9]),G(l,"click",i[8])],c=!0)},p(h,f){(!a||f&64)&&Ae(e,"disabled",h[6]===1);const d={};f&128&&(d.pages=h[7]),f&64&&(d.currentPage=h[6]),f&4&&(d.limit=h[2]),f&1&&(d.inModal=h[0]),f&2&&(d.modalUrl=h[1]),r.$set(d),(!a||f&96)&&Ae(l,"disabled",h[6]===h[5])},i(h){a||(T(r.$$.fragment,h),a=!0)},o(h){R(r.$$.fragment,h),a=!1},d(h){h&&(P(e),P(n),P(s),P(o)),z(r,h),c=!1,ht(u)}}}function rQ(i){let e,t,n,r,s,o,l=+i[3]+1+"",a,c,u,h=(+i[3]+i[2]>i[4]?i[4]:+i[3]+i[2])+"",f,d,m,p,g,v,w=i[5]>1&&_O(i);return{c(){e=y("nav"),t=y("ul"),w&&w.c(),n=D(),r=y("p"),s=W(`Showing
`),o=y("span"),a=W(l),c=W(`
to
`),u=y("span"),f=W(h),d=W(`
of
`),m=y("span"),p=W(i[4]),g=W(`
total`),O(t,"class","pagination"),O(o,"class","font-medium"),O(u,"class","font-medium"),O(m,"class","font-medium"),le(r,"display","flex"),le(r,"justify-content","center"),le(r,"gap","4px")},m(S,_){x(S,e,_),b(e,t),w&&w.m(t,null),x(S,n,_),x(S,r,_),b(r,s),b(r,o),b(o,a),b(r,c),b(r,u),b(u,f),b(r,d),b(r,m),b(m,p),b(r,g),v=!0},p(S,[_]){S[5]>1?w?(w.p(S,_),_&32&&T(w,1)):(w=_O(S),w.c(),T(w,1),w.m(t,null)):w&&(Oe(),R(w,1,1,()=>{w=null}),be()),(!v||_&8)&&l!==(l=+S[3]+1+"")&&K(a,l),(!v||_&28)&&h!==(h=(+S[3]+S[2]>S[4]?S[4]:+S[3]+S[2])+"")&&K(f,h),(!v||_&16)&&K(p,S[4])},i(S){v||(T(w),v=!0)},o(S){R(w),v=!1},d(S){S&&(P(e),P(n),P(r)),w&&w.d()}}}function sQ(i,e,t){let n,r,s;const o=nn();let{inModal:l}=e,{modalUrl:a}=e,{limit:c}=e,{skip:u}=e,{total:h}=e;const f=(v,w,S=1)=>Array.from({length:Math.ceil((w-v)/S)},(_,k)=>v+k*S);function d(v){v.preventDefault(),p(n)}function m(v){v.preventDefault(),p(1)}function p(v){const w=new URL(a??window.location.href);let S=v*c-c;w.searchParams.set("skip",S),l?o("refresh",w):window.location=w}function g(v){vs.call(this,i,v)}return i.$$set=v=>{"inModal"in v&&t(0,l=v.inModal),"modalUrl"in v&&t(1,a=v.modalUrl),"limit"in v&&t(2,c=v.limit),"skip"in v&&t(3,u=v.skip),"total"in v&&t(4,h=v.total)},i.$$.update=()=>{i.$$.dirty&20&&t(5,n=Math.ceil(h/c)),i.$$.dirty&12&&t(6,r=Math.ceil((u-1)/c)+1),i.$$.dirty&96&&t(7,s=f(r-3,r+4).filter(v=>v>0&&v<=n))},[l,a,c,u,h,n,r,s,d,m,g]}class oQ extends oe{constructor(e){super(),se(this,e,sQ,rQ,re,{inModal:0,modalUrl:1,limit:2,skip:3,total:4})}}function lQ(i){let e,t,n;return{c(){e=y("button"),e.textContent="Move to trash",O(e,"type","button"),O(e,"class","button")},m(r,s){x(r,e,s),t||(n=G(e,"click",Ln(i[9])),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function aQ(i){let e,t,n,r,s,o,l=i[1].hasDrafts&&CO(i);return{c(){e=y("button"),e.textContent="Publish",t=D(),l&&l.c(),n=D(),r=y("button"),r.textContent="Delete forever",O(e,"type","button"),O(e,"class","button"),O(r,"type","button"),O(r,"class","button")},m(a,c){x(a,e,c),x(a,t,c),l&&l.m(a,c),x(a,n,c),x(a,r,c),s||(o=[G(e,"click",Ln(i[7])),G(r,"click",Ln(i[3]))],s=!0)},p(a,c){a[1].hasDrafts?l?l.p(a,c):(l=CO(a),l.c(),l.m(n.parentNode,n)):l&&(l.d(1),l=null)},d(a){a&&(P(e),P(t),P(n),P(r)),l&&l.d(a),s=!1,ht(o)}}}function CO(i){let e,t,n;return{c(){e=y("button"),e.textContent="Make Draft",O(e,"type","button"),O(e,"class","button")},m(r,s){x(r,e,s),t||(n=G(e,"click",Ln(i[8])),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function cQ(i){let e,t,n=i[0].length+"",r,s,o,l,a,c,u,h,f;function d(g,v){return g[2].status_in==="trashed"?aQ:lQ}let m=d(i),p=m(i);return{c(){e=y("div"),t=y("span"),r=W(n),s=W(" records selected"),o=D(),l=y("button"),l.textContent="Publish",a=D(),c=y("button"),c.textContent="Make Draft",u=D(),p.c(),O(t,"class","me-2"),O(l,"type","button"),O(l,"class","button"),O(c,"type","button"),O(c,"class","button"),le(e,"display","flex"),le(e,"align-items","center"),le(e,"gap","8px")},m(g,v){x(g,e,v),b(e,t),b(t,r),b(t,s),b(e,o),b(e,l),b(e,a),b(e,c),b(e,u),p.m(e,null),h||(f=[G(l,"click",Ln(i[5])),G(c,"click",Ln(i[6]))],h=!0)},p(g,[v]){v&1&&n!==(n=g[0].length+"")&&K(r,n),m===(m=d(g))&&p?p.p(g,v):(p.d(1),p=m(g),p&&(p.c(),p.m(e,null)))},i:U,o:U,d(g){g&&P(e),p.d(),h=!1,ht(f)}}}function uQ(i,e,t){const n=Ue("channel");let{selected:r}=e,{schema:s}=e,{filter:o}=e;function l(m){m.preventDefault(),Jn(n.lucentUrl+"/records/delete",{ids:r.map(p=>p.id)}).then(p=>{window.location.reload()}).catch(p=>{console.log(p)})}function a(m,p){Jn(n.lucentUrl+"/records/status/"+p,{schemaName:s.name,records:r}).then(g=>{window.location.reload()}).catch(g=>{console.log(g)})}const c=m=>a(m,"published"),u=m=>a(m,"draft"),h=m=>a(m,"published"),f=m=>a(m,"draft"),d=m=>a(m,"trashed");return i.$$set=m=>{"selected"in m&&t(0,r=m.selected),"schema"in m&&t(1,s=m.schema),"filter"in m&&t(2,o=m.filter)},[r,s,o,l,a,c,u,h,f,d]}class hQ extends oe{constructor(e){super(),se(this,e,uQ,cQ,re,{selected:0,schema:1,filter:2})}}function fQ(i){let e;return{c(){e=W(i[0])},m(t,n){x(t,e,n)},p(t,[n]){n&1&&K(e,t[0])},i:U,o:U,d(t){t&&P(e)}}}function dQ(i,e,t){let{value:n}=e;return i.$$set=r=>{"value"in r&&t(0,n=r.value)},[n]}let mQ=class extends oe{constructor(e){super(),se(this,e,dQ,fQ,re,{value:0})}};function PO(i){let e,t,n,r;return{c(){e=y("div"),t=y("span"),n=D(),r=W(i[0]),O(t,"class","color border border-2 svelte-78o2k4"),le(t,"background",i[0]),O(e,"class","d-inline-flex")},m(s,o){x(s,e,o),b(e,t),b(e,n),b(e,r)},p(s,o){o&1&&le(t,"background",s[0]),o&1&&K(r,s[0])},d(s){s&&P(e)}}}function pQ(i){let e,t=i[0]&&PO(i);return{c(){t&&t.c(),e=Ie()},m(n,r){t&&t.m(n,r),x(n,e,r)},p(n,[r]){n[0]?t?t.p(n,r):(t=PO(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:U,o:U,d(n){n&&P(e),t&&t.d(n)}}}function gQ(i,e,t){let{value:n}=e;return i.$$set=r=>{"value"in r&&t(0,n=r.value)},[n]}let OQ=class extends oe{constructor(e){super(),se(this,e,gQ,pQ,re,{value:0})}};function AO(i){let e,t,n;return{c(){e=y("a"),t=W(i[1]),O(e,"href",n=i[2].lucentUrl+"/records/"+i[0].id),O(e,"title",i[1]),O(e,"class","reference svelte-nbbgyi")},m(r,s){x(r,e,s),b(e,t)},p(r,s){s&2&&K(t,r[1]),s&1&&n!==(n=r[2].lucentUrl+"/records/"+r[0].id)&&O(e,"href",n),s&2&&O(e,"title",r[1])},d(r){r&&P(e)}}}function bQ(i){var n;let e,t=((n=i[0])==null?void 0:n.data)&&AO(i);return{c(){t&&t.c(),e=Ie()},m(r,s){t&&t.m(r,s),x(r,e,s)},p(r,[s]){var o;(o=r[0])!=null&&o.data?t?t.p(r,s):(t=AO(r),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:U,o:U,d(r){r&&P(e),t&&t.d(r)}}}function vQ(i,e,t){let n;const r=Ue("channel");let{record:s}=e;return i.$$set=o=>{"record"in o&&t(0,s=o.record)},i.$$.update=()=>{i.$$.dirty&1&&t(1,n=s.data.name)},[s,n,r]}class Cy extends oe{constructor(e){super(),se(this,e,vQ,bQ,re,{record:0})}}function xO(i,e,t){const n=i.slice();return n[5]=e[t],n}function TO(i){let e,t,n,r;return t=new Cy({props:{schemas:i[0],graph:i[1],record:i[5]}}),{c(){e=y("span"),V(t.$$.fragment),n=D(),O(e,"class","reference")},m(s,o){x(s,e,o),Y(t,e,null),b(e,n),r=!0},p(s,o){const l={};o&1&&(l.schemas=s[0]),o&2&&(l.graph=s[1]),o&4&&(l.record=s[5]),t.$set(l)},i(s){r||(T(t.$$.fragment,s),r=!0)},o(s){R(t.$$.fragment,s),r=!1},d(s){s&&P(e),z(t)}}}function wQ(i){let e,t,n=fe(i[2]),r=[];for(let o=0;o<n.length;o+=1)r[o]=TO(xO(i,n,o));const s=o=>R(r[o],1,1,()=>{r[o]=null});return{c(){e=y("div");for(let o=0;o<r.length;o+=1)r[o].c();O(e,"class","references svelte-15ilpfz")},m(o,l){x(o,e,l);for(let a=0;a<r.length;a+=1)r[a]&&r[a].m(e,null);t=!0},p(o,[l]){if(l&7){n=fe(o[2]);let a;for(a=0;a<n.length;a+=1){const c=xO(o,n,a);r[a]?(r[a].p(c,l),T(r[a],1)):(r[a]=TO(c),r[a].c(),T(r[a],1),r[a].m(e,null))}for(Oe(),a=n.length;a<r.length;a+=1)s(a);be()}},i(o){if(!t){for(let l=0;l<n.length;l+=1)T(r[l]);t=!0}},o(o){r=r.filter(Boolean);for(let l=0;l<r.length;l+=1)R(r[l]);t=!1},d(o){o&&P(e),Ot(r,o)}}}function yQ(i,e,t){let n,{record:r}=e,{field:s}=e,{schemas:o}=e,{graph:l}=e;return i.$$set=a=>{"record"in a&&t(3,r=a.record),"field"in a&&t(4,s=a.field),"schemas"in a&&t(0,o=a.schemas),"graph"in a&&t(1,l=a.graph)},i.$$.update=()=>{var a;i.$$.dirty&26&&t(2,n=((a=l.edges)==null?void 0:a.filter(c=>c.field===s.name&&c.source===r.id).map(c=>l.records.find(u=>u.id===c.target)).filter(c=>!!c))??[])},[o,l,n,r,s]}let kQ=class extends oe{constructor(e){super(),se(this,e,yQ,wQ,re,{record:3,field:4,schemas:0,graph:1})}};function SQ(i){let e;return{c(){e=W(i[0])},m(t,n){x(t,e,n)},p(t,[n]){n&1&&K(e,t[0])},i:U,o:U,d(t){t&&P(e)}}}function _Q(i,e,t){let{value:n}=e;return i.$$set=r=>{"value"in r&&t(0,n=r.value)},[n]}let CQ=class extends oe{constructor(e){super(),se(this,e,_Q,SQ,re,{value:0})}};function PQ(i){let e,t;return{c(){e=y("div"),t=W(i[0]),O(e,"title",i[0]),O(e,"data-bs-toggle","tooltip"),O(e,"data-bs-placement","top"),O(e,"class","svelte-1ft053t")},m(n,r){x(n,e,r),b(e,t)},p(n,[r]){r&1&&K(t,n[0]),r&1&&O(e,"title",n[0])},i:U,o:U,d(n){n&&P(e)}}}function AQ(i,e,t){let{value:n}=e;return i.$$set=r=>{"value"in r&&t(0,n=r.value)},[n]}let $h=class extends oe{constructor(e){super(),se(this,e,AQ,PQ,re,{value:0})}};function xQ(i){let e,t;return{c(){e=y("a"),t=W(i[0]),O(e,"href",i[0]),O(e,"target","_blank")},m(n,r){x(n,e,r),b(e,t)},p(n,[r]){r&1&&K(t,n[0]),r&1&&O(e,"href",n[0])},i:U,o:U,d(n){n&&P(e)}}}function TQ(i,e,t){let{value:n}=e;return i.$$set=r=>{"value"in r&&t(0,n=r.value)},[n]}let QQ=class extends oe{constructor(e){super(),se(this,e,TQ,xQ,re,{value:0})}};function MQ(i){let e,t;return{c(){e=y("div"),t=W(i[0]),O(e,"title",i[0]),O(e,"data-bs-toggle","tooltip"),O(e,"data-bs-placement","top")},m(n,r){x(n,e,r),b(e,t)},p(n,[r]){r&1&&K(t,n[0]),r&1&&O(e,"title",n[0])},i:U,o:U,d(n){n&&P(e)}}}function EQ(i,e,t){let{value:n}=e;return i.$$set=r=>{"value"in r&&t(0,n=r.value)},[n]}let RQ=class extends oe{constructor(e){super(),se(this,e,EQ,MQ,re,{value:0})}};function DQ(i){let e,t=cg(i[0])+"",n,r;return{c(){e=y("div"),n=W(t),O(e,"title",r=ug(i[0])),O(e,"data-bs-toggle","tooltip"),O(e,"data-bs-placement","top")},m(s,o){x(s,e,o),b(e,n)},p(s,[o]){o&1&&t!==(t=cg(s[0])+"")&&K(n,t),o&1&&r!==(r=ug(s[0]))&&O(e,"title",r)},i:U,o:U,d(s){s&&P(e)}}}function $Q(i,e,t){let{value:n}=e;return i.$$set=r=>{"value"in r&&t(0,n=r.value)},[n]}let LQ=class extends oe{constructor(e){super(),se(this,e,$Q,DQ,re,{value:0})}};function QO(i,e,t){const n=i.slice();return n[4]=e[t],n}function MO(i){let e,t,n,r;return t=new Xo({props:{record:i[4],size:"tiny"}}),{c(){e=y("div"),V(t.$$.fragment),n=D(),O(e,"class","me-1")},m(s,o){x(s,e,o),Y(t,e,null),b(e,n),r=!0},p:U,i(s){r||(T(t.$$.fragment,s),r=!0)},o(s){R(t.$$.fragment,s),r=!1},d(s){s&&P(e),z(t)}}}function IQ(i){let e,t,n=fe(i[0]),r=[];for(let o=0;o<n.length;o+=1)r[o]=MO(QO(i,n,o));const s=o=>R(r[o],1,1,()=>{r[o]=null});return{c(){e=y("div");for(let o=0;o<r.length;o+=1)r[o].c();O(e,"class","d-flex me-1")},m(o,l){x(o,e,l);for(let a=0;a<r.length;a+=1)r[a]&&r[a].m(e,null);t=!0},p(o,[l]){if(l&1){n=fe(o[0]);let a;for(a=0;a<n.length;a+=1){const c=QO(o,n,a);r[a]?(r[a].p(c,l),T(r[a],1)):(r[a]=MO(c),r[a].c(),T(r[a],1),r[a].m(e,null))}for(Oe(),a=n.length;a<r.length;a+=1)s(a);be()}},i(o){if(!t){for(let l=0;l<n.length;l+=1)T(r[l]);t=!0}},o(o){r=r.filter(Boolean);for(let l=0;l<r.length;l+=1)R(r[l]);t=!1},d(o){o&&P(e),Ot(r,o)}}}function NQ(i,e,t){var l;let{record:n}=e,{field:r}=e,{graph:s}=e,o=(l=s.edges)==null?void 0:l.filter(a=>a.field===r.name&&a.source===n.id).map(a=>s.records.find(c=>c.id===a.target));return i.$$set=a=>{"record"in a&&t(1,n=a.record),"field"in a&&t(2,r=a.field),"graph"in a&&t(3,s=a.graph)},[o,n,r,s]}let ZQ=class extends oe{constructor(e){super(),se(this,e,NQ,IQ,re,{record:1,field:2,graph:3})}};function BQ(i){let e,t;return{c(){e=y("span"),t=W(i[0]),O(e,"class","badge rounded-pill bg-primary bg-opacity-75"),le(e,"max-width","64px"),le(e,"overflow","hidden"),le(e,"white-space","nowrap"),le(e,"text-overflow","ellipsis"),O(e,"title",i[0]),O(e,"data-bs-toggle","tooltip")},m(n,r){x(n,e,r),b(e,t)},p(n,[r]){r&1&&K(t,n[0]),r&1&&O(e,"title",n[0])},i:U,o:U,d(n){n&&P(e)}}}function WQ(i,e,t){let{value:n}=e;return i.$$set=r=>{"value"in r&&t(0,n=r.value)},[n]}let XQ=class extends oe{constructor(e){super(),se(this,e,WQ,BQ,re,{value:0})}};function FQ(i){let e,t;return{c(){e=y("div"),t=W(i[0]),O(e,"class","svelte-1ft053t")},m(n,r){x(n,e,r),b(e,t)},p(n,[r]){r&1&&K(t,n[0])},i:U,o:U,d(n){n&&P(e)}}}function YQ(i,e,t){let{value:n}=e;return i.$$set=r=>{"value"in r&&t(0,n=r.value)},[n]}class zQ extends oe{constructor(e){super(),se(this,e,YQ,FQ,re,{value:0})}}function VQ(i){let e,t,n;var r=i[4][i[0].info.name];function s(o,l){return{props:{value:o[2].data[o[0].name],record:o[2],graph:o[3],schema:o[1],field:o[0]}}}return r&&(e=Xr(r,s(i))),{c(){e&&V(e.$$.fragment),t=Ie()},m(o,l){e&&Y(e,o,l),x(o,t,l),n=!0},p(o,[l]){if(l&1&&r!==(r=o[4][o[0].info.name])){if(e){Oe();const a=e;R(a.$$.fragment,1,0,()=>{z(a,1)}),be()}r?(e=Xr(r,s(o)),V(e.$$.fragment),T(e.$$.fragment,1),Y(e,t.parentNode,t)):e=null}else if(r){const a={};l&5&&(a.value=o[2].data[o[0].name]),l&4&&(a.record=o[2]),l&8&&(a.graph=o[3]),l&2&&(a.schema=o[1]),l&1&&(a.field=o[0]),e.$set(a)}},i(o){n||(e&&T(e.$$.fragment,o),n=!0)},o(o){e&&R(e.$$.fragment,o),n=!1},d(o){o&&P(t),e&&z(e,o)}}}function UQ(i,e,t){const n={text:$h,slug:$h,rich:zQ,textarea:$h,color:OQ,checkbox:mQ,reference:kQ,number:CQ,url:QQ,date:RQ,datetime:LQ,uuid:XQ,file:ZQ};let{field:r}=e,{schema:s}=e,{record:o}=e,{graph:l}=e;return i.$$set=a=>{"field"in a&&t(0,r=a.field),"schema"in a&&t(1,s=a.schema),"record"in a&&t(2,o=a.record),"graph"in a&&t(3,l=a.graph)},[r,s,o,l,n]}class jQ extends oe{constructor(e){super(),se(this,e,UQ,VQ,re,{field:0,schema:1,record:2,graph:3})}}function qQ(i){return GQ()[i]}function GQ(){return{published:{value:"published",text:"Published",bg:"success",color:"white"},trashed:{value:"trashed",text:"Trashed",bg:"danger",color:"white"},draft:{value:"draft",text:"Draft",bg:"warning",color:"dark"}}}function HQ(i){let e,t=i[0].text+"",n;return{c(){e=y("span"),n=W(t),O(e,"class","badge text-bg-"+i[0].bg),le(e,"max-width","84px")},m(r,s){x(r,e,s),b(e,n)},p:U,i:U,o:U,d(r){r&&P(e)}}}function KQ(i,e,t){let{status:n}=e,r=qQ(n);return i.$$set=s=>{"status"in s&&t(1,n=s.status)},[r,n]}class Py extends oe{constructor(e){super(),se(this,e,KQ,HQ,re,{status:1})}}function Dn(i,e){var t;return i?((t=i.find(n=>n.id===e))==null?void 0:t.name)??e:e}function EO(i,e,t){const n=i.slice();return n[7]=e[t],n[9]=t,n}function RO(i){let e,t,n,r;return t=new jQ({props:{record:i[3],schema:i[0],graph:i[2],field:i[7]}}),{c(){e=y("td"),V(t.$$.fragment),O(e,"class",n="field-ui-"+i[7].info.name),Ae(e,"is-sort",i[7].name===i[5].name)},m(s,o){x(s,e,o),Y(t,e,null),r=!0},p(s,o){const l={};o&8&&(l.record=s[3]),o&1&&(l.schema=s[0]),o&4&&(l.graph=s[2]),o&64&&(l.field=s[7]),t.$set(l),(!r||o&64&&n!==(n="field-ui-"+s[7].info.name))&&O(e,"class",n),(!r||o&96)&&Ae(e,"is-sort",s[7].name===s[5].name)},i(s){r||(T(t.$$.fragment,s),r=!0)},o(s){R(t.$$.fragment,s),r=!1},d(s){s&&P(e),z(t)}}}function DO(i){let e,t,n;return t=new Py({props:{status:i[3].status}}),{c(){e=y("td"),V(t.$$.fragment),O(e,"class","text-center"),Ae(e,"is-sort",i[4]=="-status"||i[4]=="status")},m(r,s){x(r,e,s),Y(t,e,null),n=!0},p(r,s){const o={};s&8&&(o.status=r[3].status),t.$set(o),(!n||s&16)&&Ae(e,"is-sort",r[4]=="-status"||r[4]=="status")},i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){R(t.$$.fragment,r),n=!1},d(r){r&&P(e),z(t)}}}function $O(i){let e,t,n;return t=new _i({props:{name:Dn(i[1],i[3].createdBy),side:24}}),{c(){e=y("td"),V(t.$$.fragment),O(e,"class","text-center"),Ae(e,"is-sort",i[4]=="-_sys.createdBy"||i[4]=="_sys.createdBy")},m(r,s){x(r,e,s),Y(t,e,null),n=!0},p(r,s){const o={};s&10&&(o.name=Dn(r[1],r[3].createdBy)),t.$set(o),(!n||s&16)&&Ae(e,"is-sort",r[4]=="-_sys.createdBy"||r[4]=="_sys.createdBy")},i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){R(t.$$.fragment,r),n=!1},d(r){r&&P(e),z(t)}}}function LO(i){let e,t,n;return t=new _i({props:{name:Dn(i[1],i[3].updatedBy),side:24}}),{c(){e=y("td"),V(t.$$.fragment),O(e,"class","text-center"),Ae(e,"is-sort",i[4]=="-_sys.updatedBy"||i[4]=="_sys.updatedBy")},m(r,s){x(r,e,s),Y(t,e,null),n=!0},p(r,s){const o={};s&10&&(o.name=Dn(r[1],r[3].updatedBy)),t.$set(o),(!n||s&16)&&Ae(e,"is-sort",r[4]=="-_sys.updatedBy"||r[4]=="_sys.updatedBy")},i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){R(t.$$.fragment,r),n=!1},d(r){r&&P(e),z(t)}}}function IO(i){let e,t=Bi(i[3].createdAt)+"",n;return{c(){e=y("td"),n=W(t),Ae(e,"is-sort",i[4]=="-_sys.createdAt"||i[4]=="_sys.createdAt")},m(r,s){x(r,e,s),b(e,n)},p(r,s){s&8&&t!==(t=Bi(r[3].createdAt)+"")&&K(n,t),s&16&&Ae(e,"is-sort",r[4]=="-_sys.createdAt"||r[4]=="_sys.createdAt")},d(r){r&&P(e)}}}function NO(i){let e,t=Bi(i[3].updatedAt)+"",n;return{c(){e=y("td"),n=W(t),Ae(e,"is-sort",i[4]=="-_sys.updatedAt"||i[4]=="_sys.updatedAt")},m(r,s){x(r,e,s),b(e,n)},p(r,s){s&8&&t!==(t=Bi(r[3].updatedAt)+"")&&K(n,t),s&16&&Ae(e,"is-sort",r[4]=="-_sys.updatedAt"||r[4]=="_sys.updatedAt")},d(r){r&&P(e)}}}function JQ(i){var k,A,C,Q,M;let e,t=(k=i[0].visible)==null?void 0:k.includes("_sys.status"),n,r=(A=i[0].visible)==null?void 0:A.includes("_sys.createdBy"),s,o=(C=i[0].visible)==null?void 0:C.includes("_sys.updatedBy"),l,a=(Q=i[0].visible)==null?void 0:Q.includes("_sys.createdAt"),c,u=(M=i[0].visible)==null?void 0:M.includes("_sys.updatedAt"),h,f,d=fe(i[6]),m=[];for(let L=0;L<d.length;L+=1)m[L]=RO(EO(i,d,L));const p=L=>R(m[L],1,1,()=>{m[L]=null});let g=t&&DO(i),v=r&&$O(i),w=o&&LO(i),S=a&&IO(i),_=u&&NO(i);return{c(){for(let L=0;L<m.length;L+=1)m[L].c();e=D(),g&&g.c(),n=D(),v&&v.c(),s=D(),w&&w.c(),l=D(),S&&S.c(),c=D(),_&&_.c(),h=Ie()},m(L,N){for(let B=0;B<m.length;B+=1)m[B]&&m[B].m(L,N);x(L,e,N),g&&g.m(L,N),x(L,n,N),v&&v.m(L,N),x(L,s,N),w&&w.m(L,N),x(L,l,N),S&&S.m(L,N),x(L,c,N),_&&_.m(L,N),x(L,h,N),f=!0},p(L,[N]){var B,J,te,ie,ae;if(N&109){d=fe(L[6]);let X;for(X=0;X<d.length;X+=1){const ee=EO(L,d,X);m[X]?(m[X].p(ee,N),T(m[X],1)):(m[X]=RO(ee),m[X].c(),T(m[X],1),m[X].m(e.parentNode,e))}for(Oe(),X=d.length;X<m.length;X+=1)p(X);be()}N&1&&(t=(B=L[0].visible)==null?void 0:B.includes("_sys.status")),t?g?(g.p(L,N),N&1&&T(g,1)):(g=DO(L),g.c(),T(g,1),g.m(n.parentNode,n)):g&&(Oe(),R(g,1,1,()=>{g=null}),be()),N&1&&(r=(J=L[0].visible)==null?void 0:J.includes("_sys.createdBy")),r?v?(v.p(L,N),N&1&&T(v,1)):(v=$O(L),v.c(),T(v,1),v.m(s.parentNode,s)):v&&(Oe(),R(v,1,1,()=>{v=null}),be()),N&1&&(o=(te=L[0].visible)==null?void 0:te.includes("_sys.updatedBy")),o?w?(w.p(L,N),N&1&&T(w,1)):(w=LO(L),w.c(),T(w,1),w.m(l.parentNode,l)):w&&(Oe(),R(w,1,1,()=>{w=null}),be()),N&1&&(a=(ie=L[0].visible)==null?void 0:ie.includes("_sys.createdAt")),a?S?S.p(L,N):(S=IO(L),S.c(),S.m(c.parentNode,c)):S&&(S.d(1),S=null),N&1&&(u=(ae=L[0].visible)==null?void 0:ae.includes("_sys.updatedAt")),u?_?_.p(L,N):(_=NO(L),_.c(),_.m(h.parentNode,h)):_&&(_.d(1),_=null)},i(L){if(!f){for(let N=0;N<d.length;N+=1)T(m[N]);T(g),T(v),T(w),f=!0}},o(L){m=m.filter(Boolean);for(let N=0;N<m.length;N+=1)R(m[N]);R(g),R(v),R(w),f=!1},d(L){L&&(P(e),P(n),P(s),P(l),P(c),P(h)),Ot(m,L),g&&g.d(L),v&&v.d(L),w&&w.d(L),S&&S.d(L),_&&_.d(L)}}}function eM(i,e,t){let{schema:n}=e,{users:r}=e,{graph:s}=e,{record:o}=e,{sortParam:l}=e,{sortField:a}=e,{visibleColumns:c}=e;return i.$$set=u=>{"schema"in u&&t(0,n=u.schema),"users"in u&&t(1,r=u.users),"graph"in u&&t(2,s=u.graph),"record"in u&&t(3,o=u.record),"sortParam"in u&&t(4,l=u.sortParam),"sortField"in u&&t(5,a=u.sortField),"visibleColumns"in u&&t(6,c=u.visibleColumns)},[n,r,s,o,l,a,c]}let tM=class extends oe{constructor(e){super(),se(this,e,eM,JQ,re,{schema:0,users:1,graph:2,record:3,sortParam:4,sortField:5,visibleColumns:6})}};const nM=(i,e,t)=>t.length===e.length?[]:(i.currentTarget.checked=t.length>0,e),iM=(i,e)=>e.find(n=>n.id===i.id)?e.filter(n=>n.id!==i.id):[...e,i];function rM(i){let e,t,n,r;return{c(){e=y("div"),t=y("input"),O(t,"id","c1-13"),O(t,"type","checkbox"),t.value=i[1],t.indeterminate=i[0],t.checked=i[2],O(e,"class","checkbox-wrapper")},m(s,o){x(s,e,o),b(e,t),i[5](t),n||(r=G(t,"change",i[4]),n=!0)},p(s,[o]){o&2&&(t.value=s[1]),o&1&&(t.indeterminate=s[0]),o&4&&(t.checked=s[2])},i:U,o:U,d(s){s&&P(e),i[5](null),n=!1,r()}}}function sM(i,e,t){let n=null,{indeterminate:r=!1}=e,{value:s}=e,{checked:o=!1}=e;function l(c){vs.call(this,i,c)}function a(c){Ce[c?"unshift":"push"](()=>{n=c,t(3,n)})}return i.$$set=c=>{"indeterminate"in c&&t(0,r=c.indeterminate),"value"in c&&t(1,s=c.value),"checked"in c&&t(2,o=c.checked)},[r,s,o,n,l,a]}let rh=class extends oe{constructor(e){super(),se(this,e,sM,rM,re,{indeterminate:0,value:1,checked:2})}};function ZO(i,e,t){const n=i.slice();return n[17]=e[t],n}function BO(i,e,t){const n=i.slice();return n[20]=e[t],n}function WO(i,e,t){const n=i.slice();return n[23]=e[t],n}function XO(i){let e,t,n;return t=new rh({props:{value:"",indeterminate:i[0].length>0&&i[0].length<i[3].length,checked:i[0].length===i[3].length}}),t.$on("change",i[12]),{c(){e=y("th"),V(t.$$.fragment)},m(r,s){x(r,e,s),Y(t,e,null),n=!0},p(r,s){const o={};s&9&&(o.indeterminate=r[0].length>0&&r[0].length<r[3].length),s&9&&(o.checked=r[0].length===r[3].length),t.$set(o)},i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){R(t.$$.fragment,r),n=!1},d(r){r&&P(e),z(t)}}}function FO(i){let e,t=i[23].label+"",n,r,s;return{c(){e=y("th"),n=W(t),O(e,"class",r="field-ui-"+(i[23].info.name??i[23].ui)),O(e,"scope","col"),O(e,"title",s=i[23].help),Ae(e,"is-sort",i[23].name===i[7].name)},m(o,l){x(o,e,l),b(e,n)},p(o,l){l&1024&&t!==(t=o[23].label+"")&&K(n,t),l&1024&&r!==(r="field-ui-"+(o[23].info.name??o[23].ui))&&O(e,"class",r),l&1024&&s!==(s=o[23].help)&&O(e,"title",s),l&1152&&Ae(e,"is-sort",o[23].name===o[7].name)},d(o){o&&P(e)}}}function YO(i){let e,t=i[20].label+"",n;return{c(){e=y("th"),n=W(t),Ae(e,"is-sort",i[20].name===i[7].name)},m(r,s){x(r,e,s),b(e,n)},p(r,s){s&34&&t!==(t=r[20].label+"")&&K(n,t),s&162&&Ae(e,"is-sort",r[20].name===r[7].name)},d(r){r&&P(e)}}}function zO(i){let e,t;function n(...s){return i[15](i[17],...s)}function r(){return i[16](i[17])}return e=new rh({props:{checked:i[0].find(n),value:i[17]}}),e.$on("change",r),{c(){V(e.$$.fragment)},m(s,o){Y(e,s,o),t=!0},p(s,o){i=s;const l={};o&9&&(l.checked=i[0].find(n)),o&8&&(l.value=i[17]),e.$set(l)},i(s){t||(T(e.$$.fragment,s),t=!0)},o(s){R(e.$$.fragment,s),t=!1},d(s){z(e,s)}}}function VO(i){let e,t=i[17].status+"",n;return{c(){e=y("span"),n=W(t),le(e,"text-transform","uppercase"),le(e,"font-size","10px")},m(r,s){x(r,e,s),b(e,n)},p(r,s){s&8&&t!==(t=r[17].status+"")&&K(n,t)},d(r){r&&P(e)}}}function UO(i,e){let t,n,r,s,o,l,a=e[17].data.name+"",c,u,h,f,d,m,p,g,v,w,S=e[9]&&zO(e),_=e[17].status==="draft"&&VO(e);return d=new tM({props:{record:e[17],graph:e[4],schema:e[1],visibleColumns:e[10],sortParam:e[6],sortField:e[7],users:e[2]}}),g=new _i({props:{name:Dn(e[2],e[17].updatedBy),side:24}}),{key:i,first:null,c(){t=y("tr"),n=y("td"),r=y("div"),S&&S.c(),s=D(),o=y("a"),_&&_.c(),l=D(),c=W(a),f=D(),V(d.$$.fragment),m=D(),p=y("td"),V(g.$$.fragment),v=D(),O(o,"href",u=e[11].lucentUrl+"/records/"+e[17].id),O(o,"target",h=e[8]?"_blank":"_self"),O(r,"class","title-td-contents"),O(n,"class","title-td"),this.first=t},m(k,A){x(k,t,A),b(t,n),b(n,r),S&&S.m(r,null),b(r,s),b(r,o),_&&_.m(o,null),b(o,l),b(o,c),b(t,f),Y(d,t,null),b(t,m),b(t,p),Y(g,p,null),b(t,v),w=!0},p(k,A){e=k,e[9]?S?(S.p(e,A),A&512&&T(S,1)):(S=zO(e),S.c(),T(S,1),S.m(r,s)):S&&(Oe(),R(S,1,1,()=>{S=null}),be()),e[17].status==="draft"?_?_.p(e,A):(_=VO(e),_.c(),_.m(o,l)):_&&(_.d(1),_=null),(!w||A&8)&&a!==(a=e[17].data.name+"")&&K(c,a),(!w||A&8&&u!==(u=e[11].lucentUrl+"/records/"+e[17].id))&&O(o,"href",u),(!w||A&256&&h!==(h=e[8]?"_blank":"_self"))&&O(o,"target",h);const C={};A&8&&(C.record=e[17]),A&16&&(C.graph=e[4]),A&2&&(C.schema=e[1]),A&1024&&(C.visibleColumns=e[10]),A&64&&(C.sortParam=e[6]),A&128&&(C.sortField=e[7]),A&4&&(C.users=e[2]),d.$set(C);const Q={};A&12&&(Q.name=Dn(e[2],e[17].updatedBy)),g.$set(Q)},i(k){w||(T(S),T(d.$$.fragment,k),T(g.$$.fragment,k),w=!0)},o(k){R(S),R(d.$$.fragment,k),R(g.$$.fragment,k),w=!1},d(k){k&&P(t),S&&S.d(),_&&_.d(),z(d),z(g)}}}function oM(i){let e,t,n,r,s,o,l,a,c,u,h=[],f=new Map,d,m=i[9]&&XO(i),p=fe(i[10]),g=[];for(let k=0;k<p.length;k+=1)g[k]=FO(WO(i,p,k));let v=fe(i[5].filter(i[14])),w=[];for(let k=0;k<v.length;k+=1)w[k]=YO(BO(i,v,k));let S=fe(i[3]);const _=k=>k[17].id;for(let k=0;k<S.length;k+=1){let A=ZO(i,S,k),C=_(A);f.set(C,h[k]=UO(C,A))}return{c(){e=y("div"),t=y("table"),n=y("thead"),r=y("tr"),m&&m.c(),s=D();for(let k=0;k<g.length;k+=1)g[k].c();o=D();for(let k=0;k<w.length;k+=1)w[k].c();l=D(),a=y("th"),c=D(),u=y("tbody");for(let k=0;k<h.length;k+=1)h[k].c();O(e,"class","table mt-5")},m(k,A){x(k,e,A),b(e,t),b(t,n),b(n,r),m&&m.m(r,null),b(r,s);for(let C=0;C<g.length;C+=1)g[C]&&g[C].m(r,null);b(r,o);for(let C=0;C<w.length;C+=1)w[C]&&w[C].m(r,null);b(r,l),b(r,a),b(t,c),b(t,u);for(let C=0;C<h.length;C+=1)h[C]&&h[C].m(u,null);d=!0},p(k,[A]){if(k[9]?m?(m.p(k,A),A&512&&T(m,1)):(m=XO(k),m.c(),T(m,1),m.m(r,s)):m&&(Oe(),R(m,1,1,()=>{m=null}),be()),A&1152){p=fe(k[10]);let C;for(C=0;C<p.length;C+=1){const Q=WO(k,p,C);g[C]?g[C].p(Q,A):(g[C]=FO(Q),g[C].c(),g[C].m(r,o))}for(;C<g.length;C+=1)g[C].d(1);g.length=p.length}if(A&162){v=fe(k[5].filter(k[14]));let C;for(C=0;C<v.length;C+=1){const Q=BO(k,v,C);w[C]?w[C].p(Q,A):(w[C]=YO(Q),w[C].c(),w[C].m(r,l))}for(;C<w.length;C+=1)w[C].d(1);w.length=v.length}A&12255&&(S=fe(k[3]),Oe(),h=Ti(h,A,_,1,k,S,f,u,Jr,UO,null,ZO),be())},i(k){if(!d){T(m);for(let A=0;A<S.length;A+=1)T(h[A]);d=!0}},o(k){R(m);for(let A=0;A<h.length;A+=1)R(h[A]);d=!1},d(k){k&&P(e),m&&m.d(),Ot(g,k),Ot(w,k);for(let A=0;A<h.length;A+=1)h[A].d()}}}function lM(i,e,t){let n;const r=Ue("channel");let{schema:s}=e,{users:o}=e,{records:l}=e,{graph:a}=e,{systemFields:c}=e,{sortParam:u}=e,{sortField:h}=e,{inModal:f}=e,{isWritable:d}=e,{selected:m=[]}=e;function p(_){t(0,m=nM(_,l,m))}function g(_){t(0,m=iM(_,m))}console.log(s);const v=_=>{var k;return(k=s.visible)==null?void 0:k.includes(_.name)},w=(_,k)=>k.id===_.id,S=_=>g(_);return i.$$set=_=>{"schema"in _&&t(1,s=_.schema),"users"in _&&t(2,o=_.users),"records"in _&&t(3,l=_.records),"graph"in _&&t(4,a=_.graph),"systemFields"in _&&t(5,c=_.systemFields),"sortParam"in _&&t(6,u=_.sortParam),"sortField"in _&&t(7,h=_.sortField),"inModal"in _&&t(8,f=_.inModal),"isWritable"in _&&t(9,d=_.isWritable),"selected"in _&&t(0,m=_.selected)},i.$$.update=()=>{i.$$.dirty&2&&t(10,n=s.fields.filter(_=>{var k;return((k=s.visible)==null?void 0:k.includes(_.name))??[]}))},[m,s,o,l,a,c,u,h,f,d,n,r,p,g,v,w,S]}let aM=class extends oe{constructor(e){super(),se(this,e,lM,oM,re,{schema:1,users:2,records:3,graph:4,systemFields:5,sortParam:6,sortField:7,inModal:8,isWritable:9,selected:0})}};function cM(i){let e,t,n,r;function s(a){i[17](a)}function o(a){i[18](a)}let l={systemFields:i[13],sortParam:i[2],sortField:i[3],operators:i[4],filter:i[5],graph:i[12],inModal:i[14],modalUrl:i[9],isWritable:i[15]};return i[0]!==void 0&&(l.schema=i[0]),i[1]!==void 0&&(l.records=i[1]),e=new KT({props:l}),Ce.push(()=>nt(e,"schema",s)),Ce.push(()=>nt(e,"records",o)),e.$on("refresh",i[16]),{c(){V(e.$$.fragment)},m(a,c){Y(e,a,c),r=!0},p(a,c){const u={};c&8192&&(u.systemFields=a[13]),c&4&&(u.sortParam=a[2]),c&8&&(u.sortField=a[3]),c&16&&(u.operators=a[4]),c&32&&(u.filter=a[5]),c&4096&&(u.graph=a[12]),c&16384&&(u.inModal=a[14]),c&512&&(u.modalUrl=a[9]),c&32768&&(u.isWritable=a[15]),!t&&c&1&&(t=!0,u.schema=a[0],st(()=>t=!1)),!n&&c&2&&(n=!0,u.records=a[1],st(()=>n=!1)),e.$set(u)},i(a){r||(T(e.$$.fragment,a),r=!0)},o(a){R(e.$$.fragment,a),r=!1},d(a){z(e,a)}}}function uM(i){let e,t;return e=new hQ({props:{schema:i[0],selected:i[10],filter:i[5]}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&1&&(s.schema=n[0]),r&1024&&(s.selected=n[10]),r&32&&(s.filter=n[5]),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function hM(i){let e,t,n,r=i[0].label+"",s,o,l,a,c,u,h,f,d,m,p;const g=[uM,cM],v=[];function w(k,A){return k[10].length>0&&!k[14]&&k[15]?0:1}l=w(i),a=v[l]=g[l](i);function S(k){i[19](k)}let _={records:i[1],graph:i[12],schema:i[0],sortParam:i[2],sortField:i[3],systemFields:i[13],inModal:i[14],users:i[11],isWritable:i[15]};return i[10]!==void 0&&(_.selected=i[10]),u=new aM({props:_}),Ce.push(()=>nt(u,"selected",S)),m=new oQ({props:{limit:i[6],skip:i[7],total:i[8],inModal:i[14],modalUrl:i[9]}}),m.$on("refresh",i[16]),{c(){e=y("div"),t=y("div"),n=y("h3"),s=W(r),o=D(),a.c(),c=D(),V(u.$$.fragment),d=D(),V(m.$$.fragment),O(n,"class","header-normal mb-5"),O(t,"class",f=i[14]?"mt-0":"mt-5"),O(e,"class","")},m(k,A){x(k,e,A),b(e,t),b(t,n),b(n,s),b(t,o),v[l].m(t,null),b(t,c),Y(u,t,null),b(e,d),Y(m,e,null),p=!0},p(k,[A]){(!p||A&1)&&r!==(r=k[0].label+"")&&K(s,r);let C=l;l=w(k),l===C?v[l].p(k,A):(Oe(),R(v[C],1,1,()=>{v[C]=null}),be(),a=v[l],a?a.p(k,A):(a=v[l]=g[l](k),a.c()),T(a,1),a.m(t,c));const Q={};A&2&&(Q.records=k[1]),A&4096&&(Q.graph=k[12]),A&1&&(Q.schema=k[0]),A&4&&(Q.sortParam=k[2]),A&8&&(Q.sortField=k[3]),A&8192&&(Q.systemFields=k[13]),A&16384&&(Q.inModal=k[14]),A&2048&&(Q.users=k[11]),A&32768&&(Q.isWritable=k[15]),!h&&A&1024&&(h=!0,Q.selected=k[10],st(()=>h=!1)),u.$set(Q),(!p||A&16384&&f!==(f=k[14]?"mt-0":"mt-5"))&&O(t,"class",f);const M={};A&64&&(M.limit=k[6]),A&128&&(M.skip=k[7]),A&256&&(M.total=k[8]),A&16384&&(M.inModal=k[14]),A&512&&(M.modalUrl=k[9]),m.$set(M)},i(k){p||(T(a),T(u.$$.fragment,k),T(m.$$.fragment,k),p=!0)},o(k){R(a),R(u.$$.fragment,k),R(m.$$.fragment,k),p=!1},d(k){k&&P(e),v[l].d(),z(u),z(m)}}}function fM(i,e,t){let{schema:n}=e,{users:r}=e,{records:s}=e,{graph:o}=e,{systemFields:l}=e,{sortParam:a}=e,{sortField:c}=e,{operators:u}=e,{filter:h}=e,{limit:f}=e,{skip:d}=e,{total:m}=e,{inModal:p}=e,{modalUrl:g}=e,{selected:v=[]}=e,{isWritable:w=!1}=e;function S(C){const Q=C.detail;Qa(Q).then(M=>{t(1,s=M.records),t(2,a=M.sortParam),t(3,c=M.sortField),t(4,u=M.operators),t(5,h=M.filter),t(7,d=M.skip),t(6,f=M.limit),t(8,m=M.total),t(9,g=M.modalUrl),document.querySelector("dialog h3").scrollIntoView()}).catch(M=>{console.log(M)})}function _(C){n=C,t(0,n)}function k(C){s=C,t(1,s)}function A(C){v=C,t(10,v)}return i.$$set=C=>{"schema"in C&&t(0,n=C.schema),"users"in C&&t(11,r=C.users),"records"in C&&t(1,s=C.records),"graph"in C&&t(12,o=C.graph),"systemFields"in C&&t(13,l=C.systemFields),"sortParam"in C&&t(2,a=C.sortParam),"sortField"in C&&t(3,c=C.sortField),"operators"in C&&t(4,u=C.operators),"filter"in C&&t(5,h=C.filter),"limit"in C&&t(6,f=C.limit),"skip"in C&&t(7,d=C.skip),"total"in C&&t(8,m=C.total),"inModal"in C&&t(14,p=C.inModal),"modalUrl"in C&&t(9,g=C.modalUrl),"selected"in C&&t(10,v=C.selected),"isWritable"in C&&t(15,w=C.isWritable)},[n,s,a,c,u,h,f,d,m,g,v,r,o,l,p,w,S,_,k,A]}let Ay=class extends oe{constructor(e){super(),se(this,e,fM,hM,re,{schema:0,users:11,records:1,graph:12,systemFields:13,sortParam:2,sortField:3,operators:4,filter:5,limit:6,skip:7,total:8,inModal:14,modalUrl:9,selected:10,isWritable:15})}};function jO(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,v,w,S,_=i[2].length>0&&qO(i);f=new ut({props:{icon:"close"}});const k=[i[3]];function A(Q){i[7](Q)}let C={};for(let Q=0;Q<k.length;Q+=1)C=Ps(C,k[Q]);return i[2]!==void 0&&(C.selected=i[2]),p=new Ay({props:C}),Ce.push(()=>nt(p,"selected",A)),{c(){e=y("div"),t=y("button"),n=W("Insert"),s=D(),o=y("button"),l=W("Replace"),c=D(),_&&_.c(),u=D(),h=y("button"),V(f.$$.fragment),d=D(),m=y("div"),V(p.$$.fragment),O(t,"type","button"),O(t,"class","button"),t.disabled=r=i[2].length===0,O(o,"type","button"),O(o,"class","button"),o.disabled=a=i[2].length===0,O(h,"type","button"),O(h,"class","button close"),O(h,"aria-label","Close"),O(e,"class","dialog-header"),O(m,"class","dialog-body")},m(Q,M){x(Q,e,M),b(e,t),b(t,n),b(e,s),b(e,o),b(o,l),b(e,c),_&&_.m(e,null),b(e,u),b(e,h),Y(f,h,null),x(Q,d,M),x(Q,m,M),Y(p,m,null),v=!0,w||(S=[G(t,"click",i[4]),G(o,"click",i[5]),G(h,"click",Ln(i[0]))],w=!0)},p(Q,M){(!v||M&4&&r!==(r=Q[2].length===0))&&(t.disabled=r),(!v||M&4&&a!==(a=Q[2].length===0))&&(o.disabled=a),Q[2].length>0?_?_.p(Q,M):(_=qO(Q),_.c(),_.m(e,u)):_&&(_.d(1),_=null);const L=M&8?_o(k,[Co(Q[3])]):{};!g&&M&4&&(g=!0,L.selected=Q[2],st(()=>g=!1)),p.$set(L)},i(Q){v||(T(f.$$.fragment,Q),T(p.$$.fragment,Q),v=!0)},o(Q){R(f.$$.fragment,Q),R(p.$$.fragment,Q),v=!1},d(Q){Q&&(P(e),P(d),P(m)),_&&_.d(),z(f),z(p),w=!1,ht(S)}}}function qO(i){let e,t=i[2].length+"",n,r;return{c(){e=y("span"),n=W(t),r=W(" records selected"),O(e,"class","")},m(s,o){x(s,e,o),b(e,n),b(e,r)},p(s,o){o&4&&t!==(t=s[2].length+"")&&K(n,t)},d(s){s&&P(e)}}}function dM(i){let e,t,n=i[3].schema&&jO(i);return{c(){e=y("dialog"),n&&n.c()},m(r,s){x(r,e,s),n&&n.m(e,null),i[8](e),t=!0},p(r,[s]){r[3].schema?n?(n.p(r,s),s&8&&T(n,1)):(n=jO(r),n.c(),T(n,1),n.m(e,null)):n&&(Oe(),R(n,1,1,()=>{n=null}),be())},i(r){t||(T(n),t=!0)},o(r){R(n),t=!1},d(r){r&&P(e),n&&n.d(),i[8](null)}}}function mM(i,e,t){let n,r;const s=nn(),o=Ue("channel");let l=[];function a(p){p&&p.preventDefault(),r.close(),t(2,l=[])}function c(p){Qa(o.lucentUrl+"/content/"+p).then(g=>{t(3,n=g)}).catch(g=>console.log(g))}function u(p){p.preventDefault(),s("insert",{records:l,action:"insert",schema:n.schema.name})}function h(p){p.preventDefault(),s("insert",{records:l,action:"replace"})}function f(p){r.showModal(),c(p)}function d(p){l=p,t(2,l)}function m(p){Ce[p?"unshift":"push"](()=>{r=p,t(1,r)})}return t(3,n={}),[a,r,l,n,u,h,f,d,m]}class pM extends oe{constructor(e){super(),se(this,e,mM,dM,re,{close:0,open:6})}get close(){return this.$$.ctx[0]}get open(){return this.$$.ctx[6]}}function gM(i){let e,t,n,r,s,o,l,a,c;r=new ut({props:{icon:"close"}});const u=i[4].default,h=Hl(u,i,i[3],null);return{c(){e=y("dialog"),t=y("div"),n=y("button"),V(r.$$.fragment),s=D(),o=y("div"),h&&h.c(),O(n,"type","button"),O(n,"class","button close"),O(n,"aria-label","Close"),O(t,"class","dialog-header"),O(o,"class","dialog-body"),le(o,"min-width","900px")},m(f,d){x(f,e,d),b(e,t),b(t,n),Y(r,n,null),b(e,s),b(e,o),h&&h.m(o,null),i[5](e),l=!0,a||(c=G(n,"click",Ln(i[0])),a=!0)},p(f,[d]){h&&h.p&&(!l||d&8)&&Jl(h,u,f,f[3],l?Kl(u,f[3],d,null):ea(f[3]),null)},i(f){l||(T(r.$$.fragment,f),T(h,f),l=!0)},o(f){R(r.$$.fragment,f),R(h,f),l=!1},d(f){f&&P(e),z(r),h&&h.d(f),i[5](null),a=!1,c()}}}function OM(i,e,t){let{$$slots:n={},$$scope:r}=e,s;function o(c){c&&c.preventDefault(),s.close()}function l(){s.showModal()}function a(c){Ce[c?"unshift":"push"](()=>{s=c,t(1,s)})}return i.$$set=c=>{"$$scope"in c&&t(3,r=c.$$scope)},[o,s,l,r,n,a]}class bM extends oe{constructor(e){super(),se(this,e,OM,gM,re,{close:0,open:2})}get close(){return this.$$.ctx[0]}get open(){return this.$$.ctx[2]}}function GO(i,e,t){const n=i.slice();return n[18]=e[t],n}function HO(i,e,t){const n=i.slice();return n[18]=e[t],n}function vM(i){let e,t,n,r,s,o,l,a;return s=new ut({props:{icon:"magnifying-glass"}}),{c(){e=y("div"),t=y("button"),t.textContent="New",n=D(),r=y("button"),V(s.$$.fragment),O(t,"class","button"),O(r,"class","button"),le(e,"display","flex"),le(e,"align-items","center"),le(e,"gap","4px")},m(c,u){x(c,e,u),b(e,t),b(e,n),b(e,r),Y(s,r,null),o=!0,l||(a=[G(t,"click",i[11]),G(r,"click",i[12])],l=!0)},p:U,i(c){o||(T(s.$$.fragment,c),o=!0)},o(c){R(s.$$.fragment,c),o=!1},d(c){c&&P(e),z(s),l=!1,ht(a)}}}function wM(i){let e,t,n,r,s;return t=new ur({props:{$$slots:{button:[kM],default:[yM]},$$scope:{ctx:i}}}),r=new ur({props:{$$slots:{button:[_M],default:[SM]},$$scope:{ctx:i}}}),{c(){e=y("div"),V(t.$$.fragment),n=D(),V(r.$$.fragment),le(e,"display","flex"),le(e,"align-items","center"),le(e,"gap","4px")},m(o,l){x(o,e,l),Y(t,e,null),b(e,n),Y(r,e,null),s=!0},p(o,l){const a={};l&8388609&&(a.$$scope={dirty:l,ctx:o}),t.$set(a);const c={};l&8388609&&(c.$$scope={dirty:l,ctx:o}),r.$set(c)},i(o){s||(T(t.$$.fragment,o),T(r.$$.fragment,o),s=!0)},o(o){R(t.$$.fragment,o),R(r.$$.fragment,o),s=!1},d(o){o&&P(e),z(t),z(r)}}}function KO(i){let e,t=i[18].label+"",n,r,s,o;function l(...a){return i[9](i[18],...a)}return{c(){e=y("button"),n=W(t),r=D(),O(e,"class","button")},m(a,c){x(a,e,c),b(e,n),b(e,r),s||(o=G(e,"click",l),s=!0)},p(a,c){i=a,c&1&&t!==(t=i[18].label+"")&&K(n,t)},d(a){a&&P(e),s=!1,o()}}}function yM(i){let e,t=fe(i[0]),n=[];for(let r=0;r<t.length;r+=1)n[r]=KO(HO(i,t,r));return{c(){for(let r=0;r<n.length;r+=1)n[r].c();e=Ie()},m(r,s){for(let o=0;o<n.length;o+=1)n[o]&&n[o].m(r,s);x(r,e,s)},p(r,s){if(s&129){t=fe(r[0]);let o;for(o=0;o<t.length;o+=1){const l=HO(r,t,o);n[o]?n[o].p(l,s):(n[o]=KO(l),n[o].c(),n[o].m(e.parentNode,e))}for(;o<n.length;o+=1)n[o].d(1);n.length=t.length}},d(r){r&&P(e),Ot(n,r)}}}function kM(i){let e;return{c(){e=y("div"),e.textContent="New",O(e,"slot","button")},m(t,n){x(t,e,n)},p:U,d(t){t&&P(e)}}}function JO(i){let e,t=i[18].label+"",n,r,s,o;function l(...a){return i[10](i[18],...a)}return{c(){e=y("button"),n=W(t),r=D(),O(e,"class","button")},m(a,c){x(a,e,c),b(e,n),b(e,r),s||(o=G(e,"click",l),s=!0)},p(a,c){i=a,c&1&&t!==(t=i[18].label+"")&&K(n,t)},d(a){a&&P(e),s=!1,o()}}}function SM(i){let e,t=fe(i[0]),n=[];for(let r=0;r<t.length;r+=1)n[r]=JO(GO(i,t,r));return{c(){for(let r=0;r<n.length;r+=1)n[r].c();e=Ie()},m(r,s){for(let o=0;o<n.length;o+=1)n[o]&&n[o].m(r,s);x(r,e,s)},p(r,s){if(s&17){t=fe(r[0]);let o;for(o=0;o<t.length;o+=1){const l=GO(r,t,o);n[o]?n[o].p(l,s):(n[o]=JO(l),n[o].c(),n[o].m(e.parentNode,e))}for(;o<n.length;o+=1)n[o].d(1);n.length=t.length}},d(r){r&&P(e),Ot(n,r)}}}function _M(i){let e,t,n;return t=new ut({props:{icon:"magnifying-glass"}}),{c(){e=y("div"),V(t.$$.fragment),O(e,"slot","button")},m(r,s){x(r,e,s),Y(t,e,null),n=!0},p:U,i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){R(t.$$.fragment,r),n=!1},d(r){r&&P(e),z(t)}}}function e1(i){let e,t;const n=[i[3],{isCreateMode:!0}];let r={};for(let s=0;s<n.length;s+=1)r=Ps(r,n[s]);return e=new vT({props:r}),e.$on("cancel",i[13]),e.$on("inlinesaved",i[5]),{c(){V(e.$$.fragment)},m(s,o){Y(e,s,o),t=!0},p(s,o){const l=o&8?_o(n,[Co(s[3]),n[1]]):{};e.$set(l)},i(s){t||(T(e.$$.fragment,s),t=!0)},o(s){R(e.$$.fragment,s),t=!1},d(s){z(e,s)}}}function CM(i){let e,t,n=i[3]&&e1(i);return{c(){n&&n.c(),e=Ie()},m(r,s){n&&n.m(r,s),x(r,e,s),t=!0},p(r,s){r[3]?n?(n.p(r,s),s&8&&T(n,1)):(n=e1(r),n.c(),T(n,1),n.m(e.parentNode,e)):n&&(Oe(),R(n,1,1,()=>{n=null}),be())},i(r){t||(T(n),t=!0)},o(r){R(n),t=!1},d(r){r&&P(e),n&&n.d(r)}}}function PM(i){let e,t,n,r,s,o,l;const a=[wM,vM],c=[];function u(d,m){return d[0].length>1?0:1}e=u(i),t=c[e]=a[e](i);let h={$$slots:{default:[CM]},$$scope:{ctx:i}};r=new bM({props:h}),i[14](r);let f={};return o=new pM({props:f}),i[15](o),o.$on("insert",i[6]),{c(){t.c(),n=D(),V(r.$$.fragment),s=D(),V(o.$$.fragment)},m(d,m){c[e].m(d,m),x(d,n,m),Y(r,d,m),x(d,s,m),Y(o,d,m),l=!0},p(d,[m]){let p=e;e=u(d),e===p?c[e].p(d,m):(Oe(),R(c[p],1,1,()=>{c[p]=null}),be(),t=c[e],t?t.p(d,m):(t=c[e]=a[e](d),t.c()),T(t,1),t.m(n.parentNode,n));const g={};m&8388616&&(g.$$scope={dirty:m,ctx:d}),r.$set(g);const v={};o.$set(v)},i(d){l||(T(t),T(r.$$.fragment,d),T(o.$$.fragment,d),l=!0)},o(d){R(t),R(r.$$.fragment,d),R(o.$$.fragment,d),l=!1},d(d){d&&(P(n),P(s)),c[e].d(d),i[14](null),z(r,d),i[15](null),z(o,d)}}}function AM(i,e,t){const n=nn(),r=Ue("channel");let{schemas:s}=e,{recordId:o}=e,l,a,c;function u(k,A){k.preventDefault(),l.open(A)}function h(k){k.preventDefault(),console.log("Save inline"),t(3,c=null),a.close(),n("save",{records:k.detail.records,after:o})}function f(k){k.preventDefault(),l.close(),n("insert",{records:k.detail.records,schema:k.detail.schema,after:o})}function d(k,A){k.preventDefault(),t(3,c=null),Qa(r.lucentUrl+"/records/newInline?schema="+A).then(C=>{t(3,c=C),a.open()}).catch(C=>{console.log(C)})}const m=(k,A)=>d(A,k.name),p=(k,A)=>u(A,k.name),g=k=>d(k,s[0].name),v=k=>u(k,s[0].name),w=k=>t(3,c=null);function S(k){Ce[k?"unshift":"push"](()=>{a=k,t(2,a)})}function _(k){Ce[k?"unshift":"push"](()=>{l=k,t(1,l)})}return i.$$set=k=>{"schemas"in k&&t(0,s=k.schemas),"recordId"in k&&t(8,o=k.recordId)},[s,l,a,c,u,h,f,d,o,m,p,g,v,w,S,_]}class xM extends oe{constructor(e){super(),se(this,e,AM,PM,re,{schemas:0,recordId:8})}}/**!
* Sortable 1.15.2
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
*/function t1(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Hi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?t1(Object(t),!0).forEach(function(n){TM(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):t1(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Nc(i){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Nc=function(e){return typeof e}:Nc=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Nc(i)}function TM(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function fr(){return fr=Object.assign||function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},fr.apply(this,arguments)}function QM(i,e){if(i==null)return{};var t={},n=Object.keys(i),r,s;for(s=0;s<n.length;s++)r=n[s],!(e.indexOf(r)>=0)&&(t[r]=i[r]);return t}function MM(i,e){if(i==null)return{};var t=QM(i,e),n,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(r=0;r<s.length;r++)n=s[r],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(i,n)&&(t[n]=i[n])}return t}var EM="1.15.2";function lr(i){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(i)}var pr=lr(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Ea=lr(/Edge/i),n1=lr(/firefox/i),Ml=lr(/safari/i)&&!lr(/chrome/i)&&!lr(/android/i),xy=lr(/iP(ad|od|hone)/i),Ty=lr(/chrome/i)&&lr(/android/i),Qy={capture:!1,passive:!1};function mt(i,e,t){i.addEventListener(e,t,!pr&&Qy)}function lt(i,e,t){i.removeEventListener(e,t,!pr&&Qy)}function du(i,e){if(e){if(e[0]===">"&&(e=e.substring(1)),i)try{if(i.matches)return i.matches(e);if(i.msMatchesSelector)return i.msMatchesSelector(e);if(i.webkitMatchesSelector)return i.webkitMatchesSelector(e)}catch{return!1}return!1}}function RM(i){return i.host&&i!==document&&i.host.nodeType?i.host:i.parentNode}function ki(i,e,t,n){if(i){t=t||document;do{if(e!=null&&(e[0]===">"?i.parentNode===t&&du(i,e):du(i,e))||n&&i===t)return i;if(i===t)break}while(i=RM(i))}return null}var i1=/\s+/g;function Fn(i,e,t){if(i&&e)if(i.classList)i.classList[t?"add":"remove"](e);else{var n=(" "+i.className+" ").replace(i1," ").replace(" "+e+" "," ");i.className=(n+(t?" "+e:"")).replace(i1," ")}}function De(i,e,t){var n=i&&i.style;if(n){if(t===void 0)return document.defaultView&&document.defaultView.getComputedStyle?t=document.defaultView.getComputedStyle(i,""):i.currentStyle&&(t=i.currentStyle),e===void 0?t:t[e];!(e in n)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),n[e]=t+(typeof t=="string"?"":"px")}}function co(i,e){var t="";if(typeof i=="string")t=i;else do{var n=De(i,"transform");n&&n!=="none"&&(t=n+" "+t)}while(!e&&(i=i.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(t)}function My(i,e,t){if(i){var n=i.getElementsByTagName(e),r=0,s=n.length;if(t)for(;r<s;r++)t(n[r],r);return n}return[]}function Ui(){var i=document.scrollingElement;return i||document.documentElement}function Gt(i,e,t,n,r){if(!(!i.getBoundingClientRect&&i!==window)){var s,o,l,a,c,u,h;if(i!==window&&i.parentNode&&i!==Ui()?(s=i.getBoundingClientRect(),o=s.top,l=s.left,a=s.bottom,c=s.right,u=s.height,h=s.width):(o=0,l=0,a=window.innerHeight,c=window.innerWidth,u=window.innerHeight,h=window.innerWidth),(e||t)&&i!==window&&(r=r||i.parentNode,!pr))do if(r&&r.getBoundingClientRect&&(De(r,"transform")!=="none"||t&&De(r,"position")!=="static")){var f=r.getBoundingClientRect();o-=f.top+parseInt(De(r,"border-top-width")),l-=f.left+parseInt(De(r,"border-left-width")),a=o+s.height,c=l+s.width;break}while(r=r.parentNode);if(n&&i!==window){var d=co(r||i),m=d&&d.a,p=d&&d.d;d&&(o/=p,l/=m,h/=m,u/=p,a=o+u,c=l+h)}return{top:o,left:l,bottom:a,right:c,width:h,height:u}}}function r1(i,e,t){for(var n=Lr(i,!0),r=Gt(i)[e];n;){var s=Gt(n)[t],o=void 0;if(o=r>=s,!o)return n;if(n===Ui())break;n=Lr(n,!1)}return!1}function Po(i,e,t,n){for(var r=0,s=0,o=i.children;s<o.length;){if(o[s].style.display!=="none"&&o[s]!==$e.ghost&&(n||o[s]!==$e.dragged)&&ki(o[s],t.draggable,i,!1)){if(r===e)return o[s];r++}s++}return null}function zm(i,e){for(var t=i.lastElementChild;t&&(t===$e.ghost||De(t,"display")==="none"||e&&!du(t,e));)t=t.previousElementSibling;return t||null}function ii(i,e){var t=0;if(!i||!i.parentNode)return-1;for(;i=i.previousElementSibling;)i.nodeName.toUpperCase()!=="TEMPLATE"&&i!==$e.clone&&(!e||du(i,e))&&t++;return t}function s1(i){var e=0,t=0,n=Ui();if(i)do{var r=co(i),s=r.a,o=r.d;e+=i.scrollLeft*s,t+=i.scrollTop*o}while(i!==n&&(i=i.parentNode));return[e,t]}function DM(i,e){for(var t in i)if(i.hasOwnProperty(t)){for(var n in e)if(e.hasOwnProperty(n)&&e[n]===i[t][n])return Number(t)}return-1}function Lr(i,e){if(!i||!i.getBoundingClientRect)return Ui();var t=i,n=!1;do if(t.clientWidth<t.scrollWidth||t.clientHeight<t.scrollHeight){var r=De(t);if(t.clientWidth<t.scrollWidth&&(r.overflowX=="auto"||r.overflowX=="scroll")||t.clientHeight<t.scrollHeight&&(r.overflowY=="auto"||r.overflowY=="scroll")){if(!t.getBoundingClientRect||t===document.body)return Ui();if(n||e)return t;n=!0}}while(t=t.parentNode);return Ui()}function $M(i,e){if(i&&e)for(var t in e)e.hasOwnProperty(t)&&(i[t]=e[t]);return i}function Lh(i,e){return Math.round(i.top)===Math.round(e.top)&&Math.round(i.left)===Math.round(e.left)&&Math.round(i.height)===Math.round(e.height)&&Math.round(i.width)===Math.round(e.width)}var El;function Ey(i,e){return function(){if(!El){var t=arguments,n=this;t.length===1?i.call(n,t[0]):i.apply(n,t),El=setTimeout(function(){El=void 0},e)}}}function LM(){clearTimeout(El),El=void 0}function Ry(i,e,t){i.scrollLeft+=e,i.scrollTop+=t}function Dy(i){var e=window.Polymer,t=window.jQuery||window.Zepto;return e&&e.dom?e.dom(i).cloneNode(!0):t?t(i).clone(!0)[0]:i.cloneNode(!0)}function $y(i,e,t){var n={};return Array.from(i.children).forEach(function(r){var s,o,l,a;if(!(!ki(r,e.draggable,i,!1)||r.animated||r===t)){var c=Gt(r);n.left=Math.min((s=n.left)!==null&&s!==void 0?s:1/0,c.left),n.top=Math.min((o=n.top)!==null&&o!==void 0?o:1/0,c.top),n.right=Math.max((l=n.right)!==null&&l!==void 0?l:-1/0,c.right),n.bottom=Math.max((a=n.bottom)!==null&&a!==void 0?a:-1/0,c.bottom)}}),n.width=n.right-n.left,n.height=n.bottom-n.top,n.x=n.left,n.y=n.top,n}var qn="Sortable"+new Date().getTime();function IM(){var i=[],e;return{captureAnimationState:function(){if(i=[],!!this.options.animation){var n=[].slice.call(this.el.children);n.forEach(function(r){if(!(De(r,"display")==="none"||r===$e.ghost)){i.push({target:r,rect:Gt(r)});var s=Hi({},i[i.length-1].rect);if(r.thisAnimationDuration){var o=co(r,!0);o&&(s.top-=o.f,s.left-=o.e)}r.fromRect=s}})}},addAnimationState:function(n){i.push(n)},removeAnimationState:function(n){i.splice(DM(i,{target:n}),1)},animateAll:function(n){var r=this;if(!this.options.animation){clearTimeout(e),typeof n=="function"&&n();return}var s=!1,o=0;i.forEach(function(l){var a=0,c=l.target,u=c.fromRect,h=Gt(c),f=c.prevFromRect,d=c.prevToRect,m=l.rect,p=co(c,!0);p&&(h.top-=p.f,h.left-=p.e),c.toRect=h,c.thisAnimationDuration&&Lh(f,h)&&!Lh(u,h)&&(m.top-h.top)/(m.left-h.left)===(u.top-h.top)/(u.left-h.left)&&(a=ZM(m,f,d,r.options)),Lh(h,u)||(c.prevFromRect=u,c.prevToRect=h,a||(a=r.options.animation),r.animate(c,m,h,a)),a&&(s=!0,o=Math.max(o,a),clearTimeout(c.animationResetTimer),c.animationResetTimer=setTimeout(function(){c.animationTime=0,c.prevFromRect=null,c.fromRect=null,c.prevToRect=null,c.thisAnimationDuration=null},a),c.thisAnimationDuration=a)}),clearTimeout(e),s?e=setTimeout(function(){typeof n=="function"&&n()},o):typeof n=="function"&&n(),i=[]},animate:function(n,r,s,o){if(o){De(n,"transition",""),De(n,"transform","");var l=co(this.el),a=l&&l.a,c=l&&l.d,u=(r.left-s.left)/(a||1),h=(r.top-s.top)/(c||1);n.animatingX=!!u,n.animatingY=!!h,De(n,"transform","translate3d("+u+"px,"+h+"px,0)"),this.forRepaintDummy=NM(n),De(n,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),De(n,"transform","translate3d(0,0,0)"),typeof n.animated=="number"&&clearTimeout(n.animated),n.animated=setTimeout(function(){De(n,"transition",""),De(n,"transform",""),n.animated=!1,n.animatingX=!1,n.animatingY=!1},o)}}}}function NM(i){return i.offsetWidth}function ZM(i,e,t,n){return Math.sqrt(Math.pow(e.top-i.top,2)+Math.pow(e.left-i.left,2))/Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))*n.animation}var js=[],Ih={initializeByDefault:!0},Ra={mount:function(e){for(var t in Ih)Ih.hasOwnProperty(t)&&!(t in e)&&(e[t]=Ih[t]);js.forEach(function(n){if(n.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")}),js.push(e)},pluginEvent:function(e,t,n){var r=this;this.eventCanceled=!1,n.cancel=function(){r.eventCanceled=!0};var s=e+"Global";js.forEach(function(o){t[o.pluginName]&&(t[o.pluginName][s]&&t[o.pluginName][s](Hi({sortable:t},n)),t.options[o.pluginName]&&t[o.pluginName][e]&&t[o.pluginName][e](Hi({sortable:t},n)))})},initializePlugins:function(e,t,n,r){js.forEach(function(l){var a=l.pluginName;if(!(!e.options[a]&&!l.initializeByDefault)){var c=new l(e,t,e.options);c.sortable=e,c.options=e.options,e[a]=c,fr(n,c.defaults)}});for(var s in e.options)if(e.options.hasOwnProperty(s)){var o=this.modifyOption(e,s,e.options[s]);typeof o<"u"&&(e.options[s]=o)}},getEventProperties:function(e,t){var n={};return js.forEach(function(r){typeof r.eventProperties=="function"&&fr(n,r.eventProperties.call(t[r.pluginName],e))}),n},modifyOption:function(e,t,n){var r;return js.forEach(function(s){e[s.pluginName]&&s.optionListeners&&typeof s.optionListeners[t]=="function"&&(r=s.optionListeners[t].call(e[s.pluginName],n))}),r}};function BM(i){var e=i.sortable,t=i.rootEl,n=i.name,r=i.targetEl,s=i.cloneEl,o=i.toEl,l=i.fromEl,a=i.oldIndex,c=i.newIndex,u=i.oldDraggableIndex,h=i.newDraggableIndex,f=i.originalEvent,d=i.putSortable,m=i.extraEventProperties;if(e=e||t&&t[qn],!!e){var p,g=e.options,v="on"+n.charAt(0).toUpperCase()+n.substr(1);window.CustomEvent&&!pr&&!Ea?p=new CustomEvent(n,{bubbles:!0,cancelable:!0}):(p=document.createEvent("Event"),p.initEvent(n,!0,!0)),p.to=o||t,p.from=l||t,p.item=r||t,p.clone=s,p.oldIndex=a,p.newIndex=c,p.oldDraggableIndex=u,p.newDraggableIndex=h,p.originalEvent=f,p.pullMode=d?d.lastPutMode:void 0;var w=Hi(Hi({},m),Ra.getEventProperties(n,e));for(var S in w)p[S]=w[S];t&&t.dispatchEvent(p),g[v]&&g[v].call(e,p)}}var WM=["evt"],Tn=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.evt,s=MM(n,WM);Ra.pluginEvent.bind($e)(e,t,Hi({dragEl:he,parentEl:Bt,ghostEl:Xe,rootEl:Dt,nextEl:ds,lastDownEl:Zc,cloneEl:It,cloneHidden:Er,dragStarted:vl,putSortable:sn,activeSortable:$e.active,originalEvent:r,oldIndex:io,oldDraggableIndex:Rl,newIndex:zn,newDraggableIndex:xr,hideGhostForTarget:Zy,unhideGhostForTarget:By,cloneNowHidden:function(){Er=!0},cloneNowShown:function(){Er=!1},dispatchSortableEvent:function(l){yn({sortable:t,name:l,originalEvent:r})}},s))};function yn(i){BM(Hi({putSortable:sn,cloneEl:It,targetEl:he,rootEl:Dt,oldIndex:io,oldDraggableIndex:Rl,newIndex:zn,newDraggableIndex:xr},i))}var he,Bt,Xe,Dt,ds,Zc,It,Er,io,zn,Rl,xr,Ka,sn,Ks=!1,mu=!1,pu=[],ls,vi,Nh,Zh,o1,l1,vl,qs,Dl,$l=!1,Ja=!1,Bc,fn,Bh=[],Od=!1,gu=[],sh=typeof document<"u",ec=xy,a1=Ea||pr?"cssFloat":"float",XM=sh&&!Ty&&!xy&&"draggable"in document.createElement("div"),Ly=function(){if(sh){if(pr)return!1;var i=document.createElement("x");return i.style.cssText="pointer-events:auto",i.style.pointerEvents==="auto"}}(),Iy=function(e,t){var n=De(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),s=Po(e,0,t),o=Po(e,1,t),l=s&&De(s),a=o&&De(o),c=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+Gt(s).width,u=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Gt(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(s&&l.float&&l.float!=="none"){var h=l.float==="left"?"left":"right";return o&&(a.clear==="both"||a.clear===h)?"vertical":"horizontal"}return s&&(l.display==="block"||l.display==="flex"||l.display==="table"||l.display==="grid"||c>=r&&n[a1]==="none"||o&&n[a1]==="none"&&c+u>r)?"vertical":"horizontal"},FM=function(e,t,n){var r=n?e.left:e.top,s=n?e.right:e.bottom,o=n?e.width:e.height,l=n?t.left:t.top,a=n?t.right:t.bottom,c=n?t.width:t.height;return r===l||s===a||r+o/2===l+c/2},YM=function(e,t){var n;return pu.some(function(r){var s=r[qn].options.emptyInsertThreshold;if(!(!s||zm(r))){var o=Gt(r),l=e>=o.left-s&&e<=o.right+s,a=t>=o.top-s&&t<=o.bottom+s;if(l&&a)return n=r}}),n},Ny=function(e){function t(s,o){return function(l,a,c,u){var h=l.options.group.name&&a.options.group.name&&l.options.group.name===a.options.group.name;if(s==null&&(o||h))return!0;if(s==null||s===!1)return!1;if(o&&s==="clone")return s;if(typeof s=="function")return t(s(l,a,c,u),o)(l,a,c,u);var f=(o?l:a).options.group.name;return s===!0||typeof s=="string"&&s===f||s.join&&s.indexOf(f)>-1}}var n={},r=e.group;(!r||Nc(r)!="object")&&(r={name:r}),n.name=r.name,n.checkPull=t(r.pull,!0),n.checkPut=t(r.put),n.revertClone=r.revertClone,e.group=n},Zy=function(){!Ly&&Xe&&De(Xe,"display","none")},By=function(){!Ly&&Xe&&De(Xe,"display","")};sh&&!Ty&&document.addEventListener("click",function(i){if(mu)return i.preventDefault(),i.stopPropagation&&i.stopPropagation(),i.stopImmediatePropagation&&i.stopImmediatePropagation(),mu=!1,!1},!0);var as=function(e){if(he){e=e.touches?e.touches[0]:e;var t=YM(e.clientX,e.clientY);if(t){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[qn]._onDragOver(n)}}},zM=function(e){he&&he.parentNode[qn]._isOutsideThisEl(e.target)};function $e(i,e){if(!(i&&i.nodeType&&i.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(i));this.el=i,this.options=e=fr({},e),i[qn]=this;var t={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(i.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Iy(i,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,l){o.setData("Text",l.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:$e.supportPointer!==!1&&"PointerEvent"in window&&!Ml,emptyInsertThreshold:5};Ra.initializePlugins(this,i,t);for(var n in t)!(n in e)&&(e[n]=t[n]);Ny(e);for(var r in this)r.charAt(0)==="_"&&typeof this[r]=="function"&&(this[r]=this[r].bind(this));this.nativeDraggable=e.forceFallback?!1:XM,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?mt(i,"pointerdown",this._onTapStart):(mt(i,"mousedown",this._onTapStart),mt(i,"touchstart",this._onTapStart)),this.nativeDraggable&&(mt(i,"dragover",this),mt(i,"dragenter",this)),pu.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),fr(this,IM())}$e.prototype={constructor:$e,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(qs=null)},_getDirection:function(e,t){return typeof this.options.direction=="function"?this.options.direction.call(this,e,t,he):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,s=r.preventOnFilter,o=e.type,l=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,a=(l||e).target,c=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||a,u=r.filter;if(JM(n),!he&&!(/mousedown|pointerdown/.test(o)&&e.button!==0||r.disabled)&&!c.isContentEditable&&!(!this.nativeDraggable&&Ml&&a&&a.tagName.toUpperCase()==="SELECT")&&(a=ki(a,r.draggable,n,!1),!(a&&a.animated)&&Zc!==a)){if(io=ii(a),Rl=ii(a,r.draggable),typeof u=="function"){if(u.call(this,e,a,this)){yn({sortable:t,rootEl:c,name:"filter",targetEl:a,toEl:n,fromEl:n}),Tn("filter",t,{evt:e}),s&&e.cancelable&&e.preventDefault();return}}else if(u&&(u=u.split(",").some(function(h){if(h=ki(c,h.trim(),n,!1),h)return yn({sortable:t,rootEl:h,name:"filter",targetEl:a,fromEl:n,toEl:n}),Tn("filter",t,{evt:e}),!0}),u)){s&&e.cancelable&&e.preventDefault();return}r.handle&&!ki(c,r.handle,n,!1)||this._prepareDragStart(e,l,a)}}},_prepareDragStart:function(e,t,n){var r=this,s=r.el,o=r.options,l=s.ownerDocument,a;if(n&&!he&&n.parentNode===s){var c=Gt(n);if(Dt=s,he=n,Bt=he.parentNode,ds=he.nextSibling,Zc=n,Ka=o.group,$e.dragged=he,ls={target:he,clientX:(t||e).clientX,clientY:(t||e).clientY},o1=ls.clientX-c.left,l1=ls.clientY-c.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,he.style["will-change"]="all",a=function(){if(Tn("delayEnded",r,{evt:e}),$e.eventCanceled){r._onDrop();return}r._disableDelayedDragEvents(),!n1&&r.nativeDraggable&&(he.draggable=!0),r._triggerDragStart(e,t),yn({sortable:r,name:"choose",originalEvent:e}),Fn(he,o.chosenClass,!0)},o.ignore.split(",").forEach(function(u){My(he,u.trim(),Wh)}),mt(l,"dragover",as),mt(l,"mousemove",as),mt(l,"touchmove",as),mt(l,"mouseup",r._onDrop),mt(l,"touchend",r._onDrop),mt(l,"touchcancel",r._onDrop),n1&&this.nativeDraggable&&(this.options.touchStartThreshold=4,he.draggable=!0),Tn("delayStart",this,{evt:e}),o.delay&&(!o.delayOnTouchOnly||t)&&(!this.nativeDraggable||!(Ea||pr))){if($e.eventCanceled){this._onDrop();return}mt(l,"mouseup",r._disableDelayedDrag),mt(l,"touchend",r._disableDelayedDrag),mt(l,"touchcancel",r._disableDelayedDrag),mt(l,"mousemove",r._delayedDragTouchMoveHandler),mt(l,"touchmove",r._delayedDragTouchMoveHandler),o.supportPointer&&mt(l,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(a,o.delay)}else a()}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){he&&Wh(he),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;lt(e,"mouseup",this._disableDelayedDrag),lt(e,"touchend",this._disableDelayedDrag),lt(e,"touchcancel",this._disableDelayedDrag),lt(e,"mousemove",this._delayedDragTouchMoveHandler),lt(e,"touchmove",this._delayedDragTouchMoveHandler),lt(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||e.pointerType=="touch"&&e,!this.nativeDraggable||t?this.options.supportPointer?mt(document,"pointermove",this._onTouchMove):t?mt(document,"touchmove",this._onTouchMove):mt(document,"mousemove",this._onTouchMove):(mt(he,"dragend",this),mt(Dt,"dragstart",this._onDragStart));try{document.selection?Wc(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,t){if(Ks=!1,Dt&&he){Tn("dragStarted",this,{evt:t}),this.nativeDraggable&&mt(document,"dragover",zM);var n=this.options;!e&&Fn(he,n.dragClass,!1),Fn(he,n.ghostClass,!0),$e.active=this,e&&this._appendGhost(),yn({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(vi){this._lastX=vi.clientX,this._lastY=vi.clientY,Zy();for(var e=document.elementFromPoint(vi.clientX,vi.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(vi.clientX,vi.clientY),e!==t);)t=e;if(he.parentNode[qn]._isOutsideThisEl(e),t)do{if(t[qn]){var n=void 0;if(n=t[qn]._onDragOver({clientX:vi.clientX,clientY:vi.clientY,target:e,rootEl:t}),n&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);By()}},_onTouchMove:function(e){if(ls){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,s=e.touches?e.touches[0]:e,o=Xe&&co(Xe,!0),l=Xe&&o&&o.a,a=Xe&&o&&o.d,c=ec&&fn&&s1(fn),u=(s.clientX-ls.clientX+r.x)/(l||1)+(c?c[0]-Bh[0]:0)/(l||1),h=(s.clientY-ls.clientY+r.y)/(a||1)+(c?c[1]-Bh[1]:0)/(a||1);if(!$e.active&&!Ks){if(n&&Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))<n)return;this._onDragStart(e,!0)}if(Xe){o?(o.e+=u-(Nh||0),o.f+=h-(Zh||0)):o={a:1,b:0,c:0,d:1,e:u,f:h};var f="matrix(".concat(o.a,",").concat(o.b,",").concat(o.c,",").concat(o.d,",").concat(o.e,",").concat(o.f,")");De(Xe,"webkitTransform",f),De(Xe,"mozTransform",f),De(Xe,"msTransform",f),De(Xe,"transform",f),Nh=u,Zh=h,vi=s}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!Xe){var e=this.options.fallbackOnBody?document.body:Dt,t=Gt(he,!0,ec,!0,e),n=this.options;if(ec){for(fn=e;De(fn,"position")==="static"&&De(fn,"transform")==="none"&&fn!==document;)fn=fn.parentNode;fn!==document.body&&fn!==document.documentElement?(fn===document&&(fn=Ui()),t.top+=fn.scrollTop,t.left+=fn.scrollLeft):fn=Ui(),Bh=s1(fn)}Xe=he.cloneNode(!0),Fn(Xe,n.ghostClass,!1),Fn(Xe,n.fallbackClass,!0),Fn(Xe,n.dragClass,!0),De(Xe,"transition",""),De(Xe,"transform",""),De(Xe,"box-sizing","border-box"),De(Xe,"margin",0),De(Xe,"top",t.top),De(Xe,"left",t.left),De(Xe,"width",t.width),De(Xe,"height",t.height),De(Xe,"opacity","0.8"),De(Xe,"position",ec?"absolute":"fixed"),De(Xe,"zIndex","100000"),De(Xe,"pointerEvents","none"),$e.ghost=Xe,e.appendChild(Xe),De(Xe,"transform-origin",o1/parseInt(Xe.style.width)*100+"% "+l1/parseInt(Xe.style.height)*100+"%")}},_onDragStart:function(e,t){var n=this,r=e.dataTransfer,s=n.options;if(Tn("dragStart",this,{evt:e}),$e.eventCanceled){this._onDrop();return}Tn("setupClone",this),$e.eventCanceled||(It=Dy(he),It.removeAttribute("id"),It.draggable=!1,It.style["will-change"]="",this._hideClone(),Fn(It,this.options.chosenClass,!1),$e.clone=It),n.cloneId=Wc(function(){Tn("clone",n),!$e.eventCanceled&&(n.options.removeCloneOnHide||Dt.insertBefore(It,he),n._hideClone(),yn({sortable:n,name:"clone"}))}),!t&&Fn(he,s.dragClass,!0),t?(mu=!0,n._loopId=setInterval(n._emulateDragOver,50)):(lt(document,"mouseup",n._onDrop),lt(document,"touchend",n._onDrop),lt(document,"touchcancel",n._onDrop),r&&(r.effectAllowed="move",s.setData&&s.setData.call(n,r,he)),mt(document,"drop",n),De(he,"transform","translateZ(0)")),Ks=!0,n._dragStartId=Wc(n._dragStarted.bind(n,t,e)),mt(document,"selectstart",n),vl=!0,Ml&&De(document.body,"user-select","none")},_onDragOver:function(e){var t=this.el,n=e.target,r,s,o,l=this.options,a=l.group,c=$e.active,u=Ka===a,h=l.sort,f=sn||c,d,m=this,p=!1;if(Od)return;function g(ee,Te){Tn(ee,m,Hi({evt:e,isOwner:u,axis:d?"vertical":"horizontal",revert:o,dragRect:r,targetRect:s,canSort:h,fromSortable:f,target:n,completed:w,onMove:function(je,ne){return tc(Dt,t,he,r,je,Gt(je),e,ne)},changed:S},Te))}function v(){g("dragOverAnimationCapture"),m.captureAnimationState(),m!==f&&f.captureAnimationState()}function w(ee){return g("dragOverCompleted",{insertion:ee}),ee&&(u?c._hideClone():c._showClone(m),m!==f&&(Fn(he,sn?sn.options.ghostClass:c.options.ghostClass,!1),Fn(he,l.ghostClass,!0)),sn!==m&&m!==$e.active?sn=m:m===$e.active&&sn&&(sn=null),f===m&&(m._ignoreWhileAnimating=n),m.animateAll(function(){g("dragOverAnimationComplete"),m._ignoreWhileAnimating=null}),m!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(n===he&&!he.animated||n===t&&!n.animated)&&(qs=null),!l.dragoverBubble&&!e.rootEl&&n!==document&&(he.parentNode[qn]._isOutsideThisEl(e.target),!ee&&as(e)),!l.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),p=!0}function S(){zn=ii(he),xr=ii(he,l.draggable),yn({sortable:m,name:"change",toEl:t,newIndex:zn,newDraggableIndex:xr,originalEvent:e})}if(e.preventDefault!==void 0&&e.cancelable&&e.preventDefault(),n=ki(n,l.draggable,t,!0),g("dragOver"),$e.eventCanceled)return p;if(he.contains(e.target)||n.animated&&n.animatingX&&n.animatingY||m._ignoreWhileAnimating===n)return w(!1);if(mu=!1,c&&!l.disabled&&(u?h||(o=Bt!==Dt):sn===this||(this.lastPutMode=Ka.checkPull(this,c,he,e))&&a.checkPut(this,c,he,e))){if(d=this._getDirection(e,n)==="vertical",r=Gt(he),g("dragOverValid"),$e.eventCanceled)return p;if(o)return Bt=Dt,v(),this._hideClone(),g("revert"),$e.eventCanceled||(ds?Dt.insertBefore(he,ds):Dt.appendChild(he)),w(!0);var _=zm(t,l.draggable);if(!_||qM(e,d,this)&&!_.animated){if(_===he)return w(!1);if(_&&t===e.target&&(n=_),n&&(s=Gt(n)),tc(Dt,t,he,r,n,s,e,!!n)!==!1)return v(),_&&_.nextSibling?t.insertBefore(he,_.nextSibling):t.appendChild(he),Bt=t,S(),w(!0)}else if(_&&jM(e,d,this)){var k=Po(t,0,l,!0);if(k===he)return w(!1);if(n=k,s=Gt(n),tc(Dt,t,he,r,n,s,e,!1)!==!1)return v(),t.insertBefore(he,k),Bt=t,S(),w(!0)}else if(n.parentNode===t){s=Gt(n);var A=0,C,Q=he.parentNode!==t,M=!FM(he.animated&&he.toRect||r,n.animated&&n.toRect||s,d),L=d?"top":"left",N=r1(n,"top","top")||r1(he,"top","top"),B=N?N.scrollTop:void 0;qs!==n&&(C=s[L],$l=!1,Ja=!M&&l.invertSwap||Q),A=GM(e,n,s,d,M?1:l.swapThreshold,l.invertedSwapThreshold==null?l.swapThreshold:l.invertedSwapThreshold,Ja,qs===n);var J;if(A!==0){var te=ii(he);do te-=A,J=Bt.children[te];while(J&&(De(J,"display")==="none"||J===Xe))}if(A===0||J===n)return w(!1);qs=n,Dl=A;var ie=n.nextElementSibling,ae=!1;ae=A===1;var X=tc(Dt,t,he,r,n,s,e,ae);if(X!==!1)return(X===1||X===-1)&&(ae=X===1),Od=!0,setTimeout(UM,30),v(),ae&&!ie?t.appendChild(he):n.parentNode.insertBefore(he,ae?ie:n),N&&Ry(N,0,B-N.scrollTop),Bt=he.parentNode,C!==void 0&&!Ja&&(Bc=Math.abs(C-Gt(n)[L])),S(),w(!0)}if(t.contains(he))return w(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){lt(document,"mousemove",this._onTouchMove),lt(document,"touchmove",this._onTouchMove),lt(document,"pointermove",this._onTouchMove),lt(document,"dragover",as),lt(document,"mousemove",as),lt(document,"touchmove",as)},_offUpEvents:function(){var e=this.el.ownerDocument;lt(e,"mouseup",this._onDrop),lt(e,"touchend",this._onDrop),lt(e,"pointerup",this._onDrop),lt(e,"touchcancel",this._onDrop),lt(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;if(zn=ii(he),xr=ii(he,n.draggable),Tn("drop",this,{evt:e}),Bt=he&&he.parentNode,zn=ii(he),xr=ii(he,n.draggable),$e.eventCanceled){this._nulling();return}Ks=!1,Ja=!1,$l=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),bd(this.cloneId),bd(this._dragStartId),this.nativeDraggable&&(lt(document,"drop",this),lt(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Ml&&De(document.body,"user-select",""),De(he,"transform",""),e&&(vl&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),Xe&&Xe.parentNode&&Xe.parentNode.removeChild(Xe),(Dt===Bt||sn&&sn.lastPutMode!=="clone")&&It&&It.parentNode&&It.parentNode.removeChild(It),he&&(this.nativeDraggable&&lt(he,"dragend",this),Wh(he),he.style["will-change"]="",vl&&!Ks&&Fn(he,sn?sn.options.ghostClass:this.options.ghostClass,!1),Fn(he,this.options.chosenClass,!1),yn({sortable:this,name:"unchoose",toEl:Bt,newIndex:null,newDraggableIndex:null,originalEvent:e}),Dt!==Bt?(zn>=0&&(yn({rootEl:Bt,name:"add",toEl:Bt,fromEl:Dt,originalEvent:e}),yn({sortable:this,name:"remove",toEl:Bt,originalEvent:e}),yn({rootEl:Bt,name:"sort",toEl:Bt,fromEl:Dt,originalEvent:e}),yn({sortable:this,name:"sort",toEl:Bt,originalEvent:e})),sn&&sn.save()):zn!==io&&zn>=0&&(yn({sortable:this,name:"update",toEl:Bt,originalEvent:e}),yn({sortable:this,name:"sort",toEl:Bt,originalEvent:e})),$e.active&&((zn==null||zn===-1)&&(zn=io,xr=Rl),yn({sortable:this,name:"end",toEl:Bt,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){Tn("nulling",this),Dt=he=Bt=Xe=ds=It=Zc=Er=ls=vi=vl=zn=xr=io=Rl=qs=Dl=sn=Ka=$e.dragged=$e.ghost=$e.clone=$e.active=null,gu.forEach(function(e){e.checked=!0}),gu.length=Nh=Zh=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":he&&(this._onDragOver(e),VM(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],t,n=this.el.children,r=0,s=n.length,o=this.options;r<s;r++)t=n[r],ki(t,o.draggable,this.el,!1)&&e.push(t.getAttribute(o.dataIdAttr)||KM(t));return e},sort:function(e,t){var n={},r=this.el;this.toArray().forEach(function(s,o){var l=r.children[o];ki(l,this.options.draggable,r,!1)&&(n[s]=l)},this),t&&this.captureAnimationState(),e.forEach(function(s){n[s]&&(r.removeChild(n[s]),r.appendChild(n[s]))}),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return ki(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var n=this.options;if(t===void 0)return n[e];var r=Ra.modifyOption(this,e,t);typeof r<"u"?n[e]=r:n[e]=t,e==="group"&&Ny(n)},destroy:function(){Tn("destroy",this);var e=this.el;e[qn]=null,lt(e,"mousedown",this._onTapStart),lt(e,"touchstart",this._onTapStart),lt(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(lt(e,"dragover",this),lt(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),function(t){t.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),pu.splice(pu.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!Er){if(Tn("hideClone",this),$e.eventCanceled)return;De(It,"display","none"),this.options.removeCloneOnHide&&It.parentNode&&It.parentNode.removeChild(It),Er=!0}},_showClone:function(e){if(e.lastPutMode!=="clone"){this._hideClone();return}if(Er){if(Tn("showClone",this),$e.eventCanceled)return;he.parentNode==Dt&&!this.options.group.revertClone?Dt.insertBefore(It,he):ds?Dt.insertBefore(It,ds):Dt.appendChild(It),this.options.group.revertClone&&this.animate(he,It),De(It,"display",""),Er=!1}}};function VM(i){i.dataTransfer&&(i.dataTransfer.dropEffect="move"),i.cancelable&&i.preventDefault()}function tc(i,e,t,n,r,s,o,l){var a,c=i[qn],u=c.options.onMove,h;return window.CustomEvent&&!pr&&!Ea?a=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(a=document.createEvent("Event"),a.initEvent("move",!0,!0)),a.to=e,a.from=i,a.dragged=t,a.draggedRect=n,a.related=r||e,a.relatedRect=s||Gt(e),a.willInsertAfter=l,a.originalEvent=o,i.dispatchEvent(a),u&&(h=u.call(c,a,o)),h}function Wh(i){i.draggable=!1}function UM(){Od=!1}function jM(i,e,t){var n=Gt(Po(t.el,0,t.options,!0)),r=$y(t.el,t.options,Xe),s=10;return e?i.clientX<r.left-s||i.clientY<n.top&&i.clientX<n.right:i.clientY<r.top-s||i.clientY<n.bottom&&i.clientX<n.left}function qM(i,e,t){var n=Gt(zm(t.el,t.options.draggable)),r=$y(t.el,t.options,Xe),s=10;return e?i.clientX>r.right+s||i.clientY>n.bottom&&i.clientX>n.left:i.clientY>r.bottom+s||i.clientX>n.right&&i.clientY>n.top}function GM(i,e,t,n,r,s,o,l){var a=n?i.clientY:i.clientX,c=n?t.height:t.width,u=n?t.top:t.left,h=n?t.bottom:t.right,f=!1;if(!o){if(l&&Bc<c*r){if(!$l&&(Dl===1?a>u+c*s/2:a<h-c*s/2)&&($l=!0),$l)f=!0;else if(Dl===1?a<u+Bc:a>h-Bc)return-Dl}else if(a>u+c*(1-r)/2&&a<h-c*(1-r)/2)return HM(e)}return f=f||o,f&&(a<u+c*s/2||a>h-c*s/2)?a>u+c/2?1:-1:0}function HM(i){return ii(he)<ii(i)?1:-1}function KM(i){for(var e=i.tagName+i.className+i.src+i.href+i.textContent,t=e.length,n=0;t--;)n+=e.charCodeAt(t);return n.toString(36)}function JM(i){gu.length=0;for(var e=i.getElementsByTagName("input"),t=e.length;t--;){var n=e[t];n.checked&&gu.push(n)}}function Wc(i){return setTimeout(i,0)}function bd(i){return clearTimeout(i)}sh&&mt(document,"touchmove",function(i){($e.active||Ks)&&i.cancelable&&i.preventDefault()});$e.utils={on:mt,off:lt,css:De,find:My,is:function(e,t){return!!ki(e,t,e,!1)},extend:$M,throttle:Ey,closest:ki,toggleClass:Fn,clone:Dy,index:ii,nextTick:Wc,cancelNextTick:bd,detectDirection:Iy,getChild:Po};$e.get=function(i){return i[qn]};$e.mount=function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];e[0].constructor===Array&&(e=e[0]),e.forEach(function(n){if(!n.prototype||!n.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(n));n.utils&&($e.utils=Hi(Hi({},$e.utils),n.utils)),Ra.mount(n)})};$e.create=function(i,e){return new $e(i,e)};$e.version=EM;var jt=[],wl,vd,wd=!1,Xh,Fh,Ou,yl;function eE(){function i(){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 i.prototype={dragStarted:function(t){var n=t.originalEvent;this.sortable.nativeDraggable?mt(document,"dragover",this._handleAutoScroll):this.options.supportPointer?mt(document,"pointermove",this._handleFallbackAutoScroll):n.touches?mt(document,"touchmove",this._handleFallbackAutoScroll):mt(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var n=t.originalEvent;!this.options.dragOverBubble&&!n.rootEl&&this._handleAutoScroll(n)},drop:function(){this.sortable.nativeDraggable?lt(document,"dragover",this._handleAutoScroll):(lt(document,"pointermove",this._handleFallbackAutoScroll),lt(document,"touchmove",this._handleFallbackAutoScroll),lt(document,"mousemove",this._handleFallbackAutoScroll)),c1(),Xc(),LM()},nulling:function(){Ou=vd=wl=wd=yl=Xh=Fh=null,jt.length=0},_handleFallbackAutoScroll:function(t){this._handleAutoScroll(t,!0)},_handleAutoScroll:function(t,n){var r=this,s=(t.touches?t.touches[0]:t).clientX,o=(t.touches?t.touches[0]:t).clientY,l=document.elementFromPoint(s,o);if(Ou=t,n||this.options.forceAutoScrollFallback||Ea||pr||Ml){Yh(t,this.options,l,n);var a=Lr(l,!0);wd&&(!yl||s!==Xh||o!==Fh)&&(yl&&c1(),yl=setInterval(function(){var c=Lr(document.elementFromPoint(s,o),!0);c!==a&&(a=c,Xc()),Yh(t,r.options,c,n)},10),Xh=s,Fh=o)}else{if(!this.options.bubbleScroll||Lr(l,!0)===Ui()){Xc();return}Yh(t,this.options,Lr(l,!1),!1)}}},fr(i,{pluginName:"scroll",initializeByDefault:!0})}function Xc(){jt.forEach(function(i){clearInterval(i.pid)}),jt=[]}function c1(){clearInterval(yl)}var Yh=Ey(function(i,e,t,n){if(e.scroll){var r=(i.touches?i.touches[0]:i).clientX,s=(i.touches?i.touches[0]:i).clientY,o=e.scrollSensitivity,l=e.scrollSpeed,a=Ui(),c=!1,u;vd!==t&&(vd=t,Xc(),wl=e.scroll,u=e.scrollFn,wl===!0&&(wl=Lr(t,!0)));var h=0,f=wl;do{var d=f,m=Gt(d),p=m.top,g=m.bottom,v=m.left,w=m.right,S=m.width,_=m.height,k=void 0,A=void 0,C=d.scrollWidth,Q=d.scrollHeight,M=De(d),L=d.scrollLeft,N=d.scrollTop;d===a?(k=S<C&&(M.overflowX==="auto"||M.overflowX==="scroll"||M.overflowX==="visible"),A=_<Q&&(M.overflowY==="auto"||M.overflowY==="scroll"||M.overflowY==="visible")):(k=S<C&&(M.overflowX==="auto"||M.overflowX==="scroll"),A=_<Q&&(M.overflowY==="auto"||M.overflowY==="scroll"));var B=k&&(Math.abs(w-r)<=o&&L+S<C)-(Math.abs(v-r)<=o&&!!L),J=A&&(Math.abs(g-s)<=o&&N+_<Q)-(Math.abs(p-s)<=o&&!!N);if(!jt[h])for(var te=0;te<=h;te++)jt[te]||(jt[te]={});(jt[h].vx!=B||jt[h].vy!=J||jt[h].el!==d)&&(jt[h].el=d,jt[h].vx=B,jt[h].vy=J,clearInterval(jt[h].pid),(B!=0||J!=0)&&(c=!0,jt[h].pid=setInterval((function(){n&&this.layer===0&&$e.active._onTouchMove(Ou);var ie=jt[this.layer].vy?jt[this.layer].vy*l:0,ae=jt[this.layer].vx?jt[this.layer].vx*l:0;typeof u=="function"&&u.call($e.dragged.parentNode[qn],ae,ie,i,Ou,jt[this.layer].el)!=="continue"||Ry(jt[this.layer].el,ae,ie)}).bind({layer:h}),24))),h++}while(e.bubbleScroll&&f!==a&&(f=Lr(f,!1)));wd=c}},30),Wy=function(e){var t=e.originalEvent,n=e.putSortable,r=e.dragEl,s=e.activeSortable,o=e.dispatchSortableEvent,l=e.hideGhostForTarget,a=e.unhideGhostForTarget;if(t){var c=n||s;l();var u=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,h=document.elementFromPoint(u.clientX,u.clientY);a(),c&&!c.el.contains(h)&&(o("spill"),this.onSpill({dragEl:r,putSortable:n}))}};function Vm(){}Vm.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,n=e.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var r=Po(this.sortable.el,this.startIndex,this.options);r?this.sortable.el.insertBefore(t,r):this.sortable.el.appendChild(t),this.sortable.animateAll(),n&&n.animateAll()},drop:Wy};fr(Vm,{pluginName:"revertOnSpill"});function Um(){}Um.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable,r=n||this.sortable;r.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),r.animateAll()},drop:Wy};fr(Um,{pluginName:"removeOnSpill"});$e.mount(new eE);$e.mount(Um,Vm);function tE(i){let e,t,n;const r=i[5].default,s=Hl(r,i,i[4],null);return{c(){e=y("div"),s&&s.c(),O(e,"class",t="sortable-container "+i[0])},m(o,l){x(o,e,l),s&&s.m(e,null),i[7](e),n=!0},p(o,l){s&&s.p&&(!n||l&16)&&Jl(s,r,o,o[4],n?Kl(r,o[4],l,null):ea(o[4]),null),(!n||l&1&&t!==(t="sortable-container "+o[0]))&&O(e,"class",t)},i(o){n||(T(s,o),n=!0)},o(o){R(s,o),n=!1},d(o){o&&P(e),s&&s.d(o),i[7](null)}}}function nE(i){let e,t,n;const r=i[5].default,s=Hl(r,i,i[4],null);return{c(){e=y("tbody"),s&&s.c(),O(e,"class",t="sortable-container "+i[0])},m(o,l){x(o,e,l),s&&s.m(e,null),i[6](e),n=!0},p(o,l){s&&s.p&&(!n||l&16)&&Jl(s,r,o,o[4],n?Kl(r,o[4],l,null):ea(o[4]),null),(!n||l&1&&t!==(t="sortable-container "+o[0]))&&O(e,"class",t)},i(o){n||(T(s,o),n=!0)},o(o){R(s,o),n=!1},d(o){o&&P(e),s&&s.d(o),i[6](null)}}}function iE(i){let e,t,n,r;const s=[nE,tE],o=[];function l(a,c){return a[1]?0:1}return e=l(i),t=o[e]=s[e](i),{c(){t.c(),n=Ie()},m(a,c){o[e].m(a,c),x(a,n,c),r=!0},p(a,[c]){let u=e;e=l(a),e===u?o[e].p(a,c):(Oe(),R(o[u],1,1,()=>{o[u]=null}),be(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),T(t,1),t.m(n.parentNode,n))},i(a){r||(T(t),r=!0)},o(a){R(t),r=!1},d(a){a&&P(n),o[e].d(a)}}}function rE(i,e,t){let{$$slots:n={},$$scope:r}=e,{sortableClass:s=""}=e,{isTable:o=!1}=e,{sortableInstance:l}=e;const a=nn();let c;xi(()=>{let f={animation:150,easing:"cubic-bezier(1, 0, 0, 1)",direction:"vertical",onUpdate(d){a("update",{source:d.oldIndex,target:d.newIndex})}};t(3,l=$e.create(c,f))});function u(f){Ce[f?"unshift":"push"](()=>{c=f,t(2,c)})}function h(f){Ce[f?"unshift":"push"](()=>{c=f,t(2,c)})}return i.$$set=f=>{"sortableClass"in f&&t(0,s=f.sortableClass),"isTable"in f&&t(1,o=f.isTable),"sortableInstance"in f&&t(3,l=f.sortableInstance),"$$scope"in f&&t(4,r=f.$$scope)},[s,o,c,l,r,n,u,h]}class Xy extends oe{constructor(e){super(),se(this,e,rE,iE,re,{sortableClass:0,isTable:1,sortableInstance:3})}}function sE(i){let e,t,n;return t=new Xo({props:{record:i[4],size:"small"}}),{c(){e=y("div"),V(t.$$.fragment),O(e,"class","image")},m(r,s){x(r,e,s),Y(t,e,null),n=!0},p:U,i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){R(t.$$.fragment,r),n=!1},d(r){r&&P(e),z(t)}}}function u1(i){let e,t;return e=new Py({props:{status:i[0].status}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&1&&(s.status=n[0].status),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function h1(i){let e,t,n,r,s,o;return n=new ut({props:{icon:"trash-can"}}),{c(){e=y("div"),t=y("button"),V(n.$$.fragment),O(t,"class","button"),O(e,"class","reference-action")},m(l,a){x(l,e,a),b(e,t),Y(n,t,null),r=!0,s||(o=G(t,"click",i[5]),s=!0)},p:U,i(l){r||(T(n.$$.fragment,l),r=!0)},o(l){R(n.$$.fragment,l),r=!1},d(l){l&&P(e),z(n),s=!1,o()}}}function oE(i){let e,t,n,r,s,o,l=i[0].data.name+"",a,c,u,h,f,d=i[3].label+"",m,p,g,v,w=i[4]&&sE(i),S=i[0].status==="draft"&&u1(i),_=i[1]&&h1(i);return{c(){e=y("div"),t=y("div"),w&&w.c(),n=D(),r=y("div"),s=y("div"),o=y("a"),a=W(l),u=D(),h=y("small"),f=W("from "),m=W(d),p=D(),S&&S.c(),g=D(),_&&_.c(),O(o,"class","record-title"),O(o,"href",c=i[2].lucentUrl+"/records/"+i[0].id),O(h,"class","d-block"),O(r,"class","title"),le(t,"display","flex"),le(t,"align-items","center"),le(t,"gap","10px"),O(e,"class","preview-reference")},m(k,A){x(k,e,A),b(e,t),w&&w.m(t,null),b(t,n),b(t,r),b(r,s),b(s,o),b(o,a),b(s,u),b(s,h),b(h,f),b(h,m),b(h,p),S&&S.m(h,null),b(e,g),_&&_.m(e,null),v=!0},p(k,[A]){k[4]&&w.p(k,A),(!v||A&1)&&l!==(l=k[0].data.name+"")&&K(a,l),(!v||A&1&&c!==(c=k[2].lucentUrl+"/records/"+k[0].id))&&O(o,"href",c),k[0].status==="draft"?S?(S.p(k,A),A&1&&T(S,1)):(S=u1(k),S.c(),T(S,1),S.m(h,null)):S&&(Oe(),R(S,1,1,()=>{S=null}),be()),k[1]?_?(_.p(k,A),A&2&&T(_,1)):(_=h1(k),_.c(),T(_,1),_.m(e,null)):_&&(Oe(),R(_,1,1,()=>{_=null}),be())},i(k){v||(T(w),T(S),T(_),v=!0)},o(k){R(w),R(S),R(_),v=!1},d(k){k&&P(e),w&&w.d(),S&&S.d(),_&&_.d()}}}function lE(i,e,t){const n=nn(),r=Ue("channel");let{graph:s}=e,{record:o}=e,{hasDelete:l=!1}=e,a=r.schemas.find(f=>f.name===o.schema);const c=s.edges.find(f=>f.source===o.id&&f.field===a.cardImage);let u=s.records.find(f=>f.id===(c==null?void 0:c.target));function h(f){f.preventDefault(),n("remove",o.id)}return i.$$set=f=>{"graph"in f&&t(6,s=f.graph),"record"in f&&t(0,o=f.record),"hasDelete"in f&&t(1,l=f.hasDelete)},[o,l,r,a,u,h,s]}class Fy extends oe{constructor(e){super(),se(this,e,lE,oE,re,{graph:6,record:0,hasDelete:1})}}function f1(i,e,t){const n=i.slice();return n[11]=e[t],n}function d1(i){let e,t;return{c(){e=y("div"),t=W(i[2]),O(e,"class","invalid-feedback d-block mb-3")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&4&&K(t,n[2])},d(n){n&&P(e)}}}function m1(i){let e,t;return e=new Xy({props:{sortableClass:"row row-cols-3 mt-3",$$slots:{default:[aE]},$$scope:{ctx:i}}}),e.$on("update",i[5]),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&16387&&(s.$$scope={dirty:r,ctx:n}),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function p1(i,e){let t,n,r,s;return n=new Fy({props:{graph:e[0],record:e[11],hasDelete:!0}}),n.$on("remove",e[4]),{key:i,first:null,c(){t=y("div"),V(n.$$.fragment),r=D(),this.first=t},m(o,l){x(o,t,l),Y(n,t,null),b(t,r),s=!0},p(o,l){e=o;const a={};l&1&&(a.graph=e[0]),l&2&&(a.record=e[11]),n.$set(a)},i(o){s||(T(n.$$.fragment,o),s=!0)},o(o){R(n.$$.fragment,o),s=!1},d(o){o&&P(t),z(n)}}}function aE(i){let e=[],t=new Map,n,r,s=fe(i[1]);const o=l=>l[11].id;for(let l=0;l<s.length;l+=1){let a=f1(i,s,l),c=o(a);t.set(c,e[l]=p1(c,a))}return{c(){for(let l=0;l<e.length;l+=1)e[l].c();n=Ie()},m(l,a){for(let c=0;c<e.length;c+=1)e[c]&&e[c].m(l,a);x(l,n,a),r=!0},p(l,a){a&19&&(s=fe(l[1]),Oe(),e=Ti(e,a,o,1,l,s,t,n.parentNode,Jr,p1,n,f1),be())},i(l){if(!r){for(let a=0;a<s.length;a+=1)T(e[a]);r=!0}},o(l){for(let a=0;a<e.length;a+=1)R(e[a]);r=!1},d(l){l&&P(n);for(let a=0;a<e.length;a+=1)e[a].d(l)}}}function cE(i){let e,t,n,r,s,o,l=i[2]&&d1(i);n=new xM({props:{recordId:null,schemas:i[3]}}),n.$on("insert",i[6]),n.$on("save",i[6]);let a=i[1].length>0&&m1(i);return{c(){l&&l.c(),e=D(),t=y("div"),V(n.$$.fragment),r=D(),a&&a.c(),s=Ie(),O(t,"class","inline-card-wrapper")},m(c,u){l&&l.m(c,u),x(c,e,u),x(c,t,u),Y(n,t,null),x(c,r,u),a&&a.m(c,u),x(c,s,u),o=!0},p(c,[u]){c[2]?l?l.p(c,u):(l=d1(c),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null),c[1].length>0?a?(a.p(c,u),u&2&&T(a,1)):(a=m1(c),a.c(),T(a,1),a.m(s.parentNode,s)):a&&(Oe(),R(a,1,1,()=>{a=null}),be())},i(c){o||(T(n.$$.fragment,c),T(a),o=!0)},o(c){R(n.$$.fragment,c),R(a),o=!1},d(c){c&&(P(e),P(t),P(r),P(s)),l&&l.d(c),z(n),a&&a.d(c)}}}function uE(i,e,t){let n,r;const s=Ue("channel");let{record:o}=e,{field:l}=e,{graph:a}=e,{validationErrors:c}=e,u=s.schemas.filter(m=>l.collections.includes(m.name));function h(m){m.preventDefault(),t(0,a.edges=a.edges.filter(p=>!(p.target===m.detail&&p.field===l.name)),a)}function f(m){t(0,a.edges=tT(m.detail.source,m.detail.target,a.edges,l.name,r),a)}function d(m){m.preventDefault(),t(0,a=ky(a,o,m.detail.records,l.name,m.detail.action))}return i.$$set=m=>{"record"in m&&t(7,o=m.record),"field"in m&&t(8,l=m.field),"graph"in m&&t(0,a=m.graph),"validationErrors"in m&&t(9,c=m.validationErrors)},i.$$.update=()=>{i.$$.dirty&768&&t(2,n=In(c,l.name)),i.$$.dirty&385&&t(1,r=a.edges.filter(m=>m.field===l.name).map(m=>a.records.find(p=>p.id===m.target&&o.id===m.source)).filter(m=>!!(m!=null&&m.id))??[])},[a,r,n,u,h,f,d,o,l,c]}class hE extends oe{constructor(e){super(),se(this,e,uE,cE,re,{record:7,field:8,graph:0,validationErrors:9})}}function g1(i){let e,t;return{c(){e=y("div"),t=W(i[4]),O(e,"class","invalid-feedback d-block")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&16&&K(t,n[4])},d(n){n&&P(e)}}}function fE(i){let e,t,n,r,s,o,l,a,c,u,h=i[4]&&g1(i);return{c(){e=y("div"),t=y("div"),n=y("input"),s=D(),o=y("input"),a=D(),h&&h.c(),O(n,"type","color"),O(n,"id",i[3]),le(n,"border","none"),le(n,"background","transparent"),le(n,"padding","0"),le(n,"width","64px"),n.disabled=r=i[1].readonly&&!i[2],O(o,"type","text"),O(o,"id",i[3]),O(o,"class","form-control"),o.readOnly=l=i[1].readonly&&!i[2],Ae(o,"is-invalid",i[4]),le(t,"display","flex"),le(t,"align-items","center"),le(t,"gap","10px"),O(e,"class","mb-0")},m(f,d){x(f,e,d),b(e,t),b(t,n),Le(n,i[0]),b(t,s),b(t,o),Le(o,i[0]),b(e,a),h&&h.m(e,null),c||(u=[G(n,"input",i[6]),G(o,"input",i[7])],c=!0)},p(f,[d]){d&8&&O(n,"id",f[3]),d&6&&r!==(r=f[1].readonly&&!f[2])&&(n.disabled=r),d&1&&Le(n,f[0]),d&8&&O(o,"id",f[3]),d&6&&l!==(l=f[1].readonly&&!f[2])&&(o.readOnly=l),d&1&&o.value!==f[0]&&Le(o,f[0]),d&16&&Ae(o,"is-invalid",f[4]),f[4]?h?h.p(f,d):(h=g1(f),h.c(),h.m(e,null)):h&&(h.d(1),h=null)},i:U,o:U,d(f){f&&P(e),h&&h.d(),c=!1,ht(u)}}}function dE(i,e,t){let n,{field:r}=e,{value:s}=e,{isCreateMode:o}=e,{validationErrors:l}=e,{id:a}=e;function c(){s=this.value,t(0,s)}function u(){s=this.value,t(0,s)}return i.$$set=h=>{"field"in h&&t(1,r=h.field),"value"in h&&t(0,s=h.value),"isCreateMode"in h&&t(2,o=h.isCreateMode),"validationErrors"in h&&t(5,l=h.validationErrors),"id"in h&&t(3,a=h.id)},i.$$.update=()=>{i.$$.dirty&34&&t(4,n=In(l,r.name))},[s,r,o,a,n,l,c,u]}class mE extends oe{constructor(e){super(),se(this,e,dE,fE,re,{field:1,value:0,isCreateMode:2,validationErrors:5,id:3})}}function O1(i){let e,t,n,r,s,o,l,a,c,u,h;return c=qw(i[7][0]),{c(){e=y("div"),t=y("input"),s=D(),o=y("label"),l=W("Don't Know"),O(t,"class","form-check-input"),O(t,"id",n=i[1]+"-3"),O(t,"type","radio"),t.__value=null,Le(t,t.__value),t.disabled=r=i[2].readonly&&!i[3],Ae(t,"is-invalid",i[4]),O(o,"class","form-check-label"),O(o,"for",a=i[1]+"-3"),O(e,"class","form-check form-check-inline"),c.p(t)},m(f,d){x(f,e,d),b(e,t),t.checked=t.__value===i[0],b(e,s),b(e,o),b(o,l),u||(h=G(t,"change",i[9]),u=!0)},p(f,d){d&2&&n!==(n=f[1]+"-3")&&O(t,"id",n),d&12&&r!==(r=f[2].readonly&&!f[3])&&(t.disabled=r),d&1&&(t.checked=t.__value===f[0]),d&16&&Ae(t,"is-invalid",f[4]),d&2&&a!==(a=f[1]+"-3")&&O(o,"for",a)},d(f){f&&P(e),c.r(),u=!1,h()}}}function b1(i){let e,t;return{c(){e=y("div"),t=W(i[4]),O(e,"class","invalid-feedback d-block")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&16&&K(t,n[4])},d(n){n&&P(e)}}}function pE(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,v,w,S,_,k,A,C,Q,M=i[2].nullable&&O1(i),L=i[4]&&b1(i);return A=qw(i[7][0]),{c(){e=y("div"),t=y("div"),n=y("input"),o=D(),l=y("label"),a=W("Yes"),u=D(),h=y("div"),f=y("input"),p=D(),g=y("label"),v=W("No"),S=D(),M&&M.c(),_=D(),L&&L.c(),k=Ie(),O(n,"class","form-check-input"),O(n,"type","radio"),O(n,"id",r=i[1]+"-1"),n.__value=!0,Le(n,n.__value),n.disabled=s=i[2].readonly&&!i[3],Ae(n,"is-invalid",i[4]),O(l,"class","form-check-label"),O(l,"for",c=i[1]+"-1"),O(t,"class","form-check form-check-inline"),O(f,"class","form-check-input"),O(f,"type","radio"),O(f,"id",d=i[1]+"-2"),f.__value=!1,Le(f,f.__value),f.disabled=m=i[2].readonly&&!i[3],Ae(f,"is-invalid",i[4]),O(g,"class","form-check-label"),O(g,"for",w=i[1]+"-2"),O(h,"class","form-check form-check-inline"),O(e,"class","field-checkbox"),A.p(n,f)},m(N,B){x(N,e,B),b(e,t),b(t,n),n.checked=n.__value===i[0],b(t,o),b(t,l),b(l,a),b(e,u),b(e,h),b(h,f),f.checked=f.__value===i[0],b(h,p),b(h,g),b(g,v),b(e,S),M&&M.m(e,null),x(N,_,B),L&&L.m(N,B),x(N,k,B),C||(Q=[G(n,"change",i[6]),G(f,"change",i[8])],C=!0)},p(N,[B]){B&2&&r!==(r=N[1]+"-1")&&O(n,"id",r),B&12&&s!==(s=N[2].readonly&&!N[3])&&(n.disabled=s),B&1&&(n.checked=n.__value===N[0]),B&16&&Ae(n,"is-invalid",N[4]),B&2&&c!==(c=N[1]+"-1")&&O(l,"for",c),B&2&&d!==(d=N[1]+"-2")&&O(f,"id",d),B&12&&m!==(m=N[2].readonly&&!N[3])&&(f.disabled=m),B&1&&(f.checked=f.__value===N[0]),B&16&&Ae(f,"is-invalid",N[4]),B&2&&w!==(w=N[1]+"-2")&&O(g,"for",w),N[2].nullable?M?M.p(N,B):(M=O1(N),M.c(),M.m(e,null)):M&&(M.d(1),M=null),N[4]?L?L.p(N,B):(L=b1(N),L.c(),L.m(k.parentNode,k)):L&&(L.d(1),L=null)},i:U,o:U,d(N){N&&(P(e),P(_),P(k)),M&&M.d(),L&&L.d(N),A.r(),C=!1,ht(Q)}}}function gE(i,e,t){let n,{id:r}=e,{field:s}=e,{value:o}=e,{isCreateMode:l}=e,{validationErrors:a}=e;const c=[[]];function u(){o=this.__value,t(0,o)}function h(){o=this.__value,t(0,o)}function f(){o=this.__value,t(0,o)}return i.$$set=d=>{"id"in d&&t(1,r=d.id),"field"in d&&t(2,s=d.field),"value"in d&&t(0,o=d.value),"isCreateMode"in d&&t(3,l=d.isCreateMode),"validationErrors"in d&&t(5,a=d.validationErrors)},i.$$.update=()=>{i.$$.dirty&36&&t(4,n=In(a,s.name))},[o,r,s,l,n,a,u,c,h,f]}class OE extends oe{constructor(e){super(),se(this,e,gE,pE,re,{id:1,field:2,value:0,isCreateMode:3,validationErrors:5})}}function v1(i){let e,t;return{c(){e=y("div"),t=W(i[4]),O(e,"class","invalid-feedback d-block")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&16&&K(t,n[4])},d(n){n&&P(e)}}}function bE(i){let e,t,n,r,s,o,l=i[4]&&v1(i);return{c(){e=y("div"),t=y("input"),r=D(),l&&l.c(),O(t,"type","number"),O(t,"id",i[3]),O(t,"class","form-control"),O(t,"autocomplete","off"),t.readOnly=n=i[1].readonly&&!i[2],Ae(t,"is-invalid",i[4]),O(e,"class","mb-0")},m(a,c){x(a,e,c),b(e,t),Le(t,i[0]),b(e,r),l&&l.m(e,null),s||(o=[G(t,"change",i[5]),G(t,"input",i[7])],s=!0)},p(a,[c]){c&8&&O(t,"id",a[3]),c&6&&n!==(n=a[1].readonly&&!a[2])&&(t.readOnly=n),c&1&&Gw(t.value)!==a[0]&&Le(t,a[0]),c&16&&Ae(t,"is-invalid",a[4]),a[4]?l?l.p(a,c):(l=v1(a),l.c(),l.m(e,null)):l&&(l.d(1),l=null)},i:U,o:U,d(a){a&&P(e),l&&l.d(),s=!1,ht(o)}}}function vE(i,e,t){let n,{field:r}=e,{value:s}=e,{validationErrors:o}=e,{isCreateMode:l}=e,{id:a}=e;function c(f){const d=f.currentTarget.value,m=u(d);t(0,s=isNaN(m)?null:m)}function u(f){return parseFloat(f).toFixed(r.decimals)}function h(){s=Gw(this.value),t(0,s)}return i.$$set=f=>{"field"in f&&t(1,r=f.field),"value"in f&&t(0,s=f.value),"validationErrors"in f&&t(6,o=f.validationErrors),"isCreateMode"in f&&t(2,l=f.isCreateMode),"id"in f&&t(3,a=f.id)},i.$$.update=()=>{i.$$.dirty&66&&t(4,n=In(o,r.name))},[s,r,l,a,n,c,o,h]}let wE=class extends oe{constructor(e){super(),se(this,e,vE,bE,re,{field:1,value:0,validationErrors:6,isCreateMode:2,id:3})}};function w1(i){let e,t=i[1].help+"",n;return{c(){e=y("small"),n=W(t),O(e,"class","text-primary opacity-50")},m(r,s){x(r,e,s),b(e,n)},p(r,s){s&2&&t!==(t=r[1].help+"")&&K(n,t)},d(r){r&&P(e)}}}function yE(i){let e,t,n,r=i[1].label+"",s,o,l,a,c=i[1].name+"",u,h,f,d,m,p,g,v=i[1].help&&w1(i);return{c(){e=y("div"),t=y("div"),n=y("label"),s=W(r),o=D(),l=y("a"),a=y("code"),u=W(c),f=D(),d=y("input"),m=D(),v&&v.c(),O(n,"for",i[4]),O(n,"class","form-label"),O(a,"class","text-primary opacity-50"),O(l,"class","text-decoration-none"),O(l,"href",h=i[3]+"/schemas/"+i[2].name+"/fields/edit/"+i[1].name),O(t,"class","d-flex justify-content-between"),O(d,"type","url"),O(d,"id",i[4]),O(d,"class","form-control"),O(d,"placeholder","https://www.example.com"),O(e,"class","mb-0")},m(w,S){x(w,e,S),b(e,t),b(t,n),b(n,s),b(t,o),b(t,l),b(l,a),b(a,u),b(e,f),b(e,d),Le(d,i[0]),b(e,m),v&&v.m(e,null),p||(g=G(d,"input",i[5]),p=!0)},p(w,[S]){S&2&&r!==(r=w[1].label+"")&&K(s,r),S&2&&c!==(c=w[1].name+"")&&K(u,c),S&6&&h!==(h=w[3]+"/schemas/"+w[2].name+"/fields/edit/"+w[1].name)&&O(l,"href",h),S&1&&d.value!==w[0]&&Le(d,w[0]),w[1].help?v?v.p(w,S):(v=w1(w),v.c(),v.m(e,null)):v&&(v.d(1),v=null)},i:U,o:U,d(w){w&&P(e),v&&v.d(),p=!1,g()}}}function kE(i,e,t){const n=Ue("channelurl");let{field:r}=e,{value:s}=e,{schema:o}=e,l=self.crypto.randomUUID();function a(){s=this.value,t(0,s)}return i.$$set=c=>{"field"in c&&t(1,r=c.field),"value"in c&&t(0,s=c.value),"schema"in c&&t(2,o=c.schema)},[s,r,o,n,l,a]}class SE extends oe{constructor(e){super(),se(this,e,kE,yE,re,{field:1,value:0,schema:2})}}var zh=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],uo={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:typeof window=="object"&&window.navigator.userAgent.indexOf("MSIE")===-1,ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(i){return typeof console<"u"&&console.warn(i)},getWeek:function(i){var e=new Date(i.getTime());e.setHours(0,0,0,0),e.setDate(e.getDate()+3-(e.getDay()+6)%7);var t=new Date(e.getFullYear(),0,4);return 1+Math.round(((e.getTime()-t.getTime())/864e5-3+(t.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},ra={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(i){var e=i%100;if(e>3&&e<21)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},Mn=function(i,e){return e===void 0&&(e=2),("000"+i).slice(e*-1)},ni=function(i){return i===!0?1:0};function y1(i,e){var t;return function(){var n=this,r=arguments;clearTimeout(t),t=setTimeout(function(){return i.apply(n,r)},e)}}var Vh=function(i){return i instanceof Array?i:[i]};function vn(i,e,t){if(t===!0)return i.classList.add(e);i.classList.remove(e)}function dt(i,e,t){var n=window.document.createElement(i);return e=e||"",t=t||"",n.className=e,t!==void 0&&(n.textContent=t),n}function nc(i){for(;i.firstChild;)i.removeChild(i.firstChild)}function Yy(i,e){if(e(i))return i;if(i.parentNode)return Yy(i.parentNode,e)}function ic(i,e){var t=dt("div","numInputWrapper"),n=dt("input","numInput "+i),r=dt("span","arrowUp"),s=dt("span","arrowDown");if(navigator.userAgent.indexOf("MSIE 9.0")===-1?n.type="number":(n.type="text",n.pattern="\\d*"),e!==void 0)for(var o in e)n.setAttribute(o,e[o]);return t.appendChild(n),t.appendChild(r),t.appendChild(s),t}function Zn(i){try{if(typeof i.composedPath=="function"){var e=i.composedPath();return e[0]}return i.target}catch{return i.target}}var Uh=function(){},bu=function(i,e,t){return t.months[e?"shorthand":"longhand"][i]},_E={D:Uh,F:function(i,e,t){i.setMonth(t.months.longhand.indexOf(e))},G:function(i,e){i.setHours((i.getHours()>=12?12:0)+parseFloat(e))},H:function(i,e){i.setHours(parseFloat(e))},J:function(i,e){i.setDate(parseFloat(e))},K:function(i,e,t){i.setHours(i.getHours()%12+12*ni(new RegExp(t.amPM[1],"i").test(e)))},M:function(i,e,t){i.setMonth(t.months.shorthand.indexOf(e))},S:function(i,e){i.setSeconds(parseFloat(e))},U:function(i,e){return new Date(parseFloat(e)*1e3)},W:function(i,e,t){var n=parseInt(e),r=new Date(i.getFullYear(),0,2+(n-1)*7,0,0,0,0);return r.setDate(r.getDate()-r.getDay()+t.firstDayOfWeek),r},Y:function(i,e){i.setFullYear(parseFloat(e))},Z:function(i,e){return new Date(e)},d:function(i,e){i.setDate(parseFloat(e))},h:function(i,e){i.setHours((i.getHours()>=12?12:0)+parseFloat(e))},i:function(i,e){i.setMinutes(parseFloat(e))},j:function(i,e){i.setDate(parseFloat(e))},l:Uh,m:function(i,e){i.setMonth(parseFloat(e)-1)},n:function(i,e){i.setMonth(parseFloat(e)-1)},s:function(i,e){i.setSeconds(parseFloat(e))},u:function(i,e){return new Date(parseFloat(e))},w:Uh,y:function(i,e){i.setFullYear(2e3+parseFloat(e))}},ps={D:"",F:"",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},Ll={Z:function(i){return i.toISOString()},D:function(i,e,t){return e.weekdays.shorthand[Ll.w(i,e,t)]},F:function(i,e,t){return bu(Ll.n(i,e,t)-1,!1,e)},G:function(i,e,t){return Mn(Ll.h(i,e,t))},H:function(i){return Mn(i.getHours())},J:function(i,e){return e.ordinal!==void 0?i.getDate()+e.ordinal(i.getDate()):i.getDate()},K:function(i,e){return e.amPM[ni(i.getHours()>11)]},M:function(i,e){return bu(i.getMonth(),!0,e)},S:function(i){return Mn(i.getSeconds())},U:function(i){return i.getTime()/1e3},W:function(i,e,t){return t.getWeek(i)},Y:function(i){return Mn(i.getFullYear(),4)},d:function(i){return Mn(i.getDate())},h:function(i){return i.getHours()%12?i.getHours()%12:12},i:function(i){return Mn(i.getMinutes())},j:function(i){return i.getDate()},l:function(i,e){return e.weekdays.longhand[i.getDay()]},m:function(i){return Mn(i.getMonth()+1)},n:function(i){return i.getMonth()+1},s:function(i){return i.getSeconds()},u:function(i){return i.getTime()},w:function(i){return i.getDay()},y:function(i){return String(i.getFullYear()).substring(2)}},zy=function(i){var e=i.config,t=e===void 0?uo:e,n=i.l10n,r=n===void 0?ra:n,s=i.isMobile,o=s===void 0?!1:s;return function(l,a,c){var u=c||r;return t.formatDate!==void 0&&!o?t.formatDate(l,a,u):a.split("").map(function(h,f,d){return Ll[h]&&d[f-1]!=="\\"?Ll[h](l,u,t):h!=="\\"?h:""}).join("")}},yd=function(i){var e=i.config,t=e===void 0?uo:e,n=i.l10n,r=n===void 0?ra:n;return function(s,o,l,a){if(!(s!==0&&!s)){var c=a||r,u,h=s;if(s instanceof Date)u=new Date(s.getTime());else if(typeof s!="string"&&s.toFixed!==void 0)u=new Date(s);else if(typeof s=="string"){var f=o||(t||uo).dateFormat,d=String(s).trim();if(d==="today")u=new Date,l=!0;else if(t&&t.parseDate)u=t.parseDate(s,f);else if(/Z$/.test(d)||/GMT$/.test(d))u=new Date(s);else{for(var m=void 0,p=[],g=0,v=0,w="";g<f.length;g++){var S=f[g],_=S==="\\",k=f[g-1]==="\\"||_;if(ps[S]&&!k){w+=ps[S];var A=new RegExp(w).exec(s);A&&(m=!0)&&p[S!=="Y"?"push":"unshift"]({fn:_E[S],val:A[++v]})}else _||(w+=".")}u=!t||!t.noCalendar?new Date(new Date().getFullYear(),0,1,0,0,0,0):new Date(new Date().setHours(0,0,0,0)),p.forEach(function(C){var Q=C.fn,M=C.val;return u=Q(u,M,c)||u}),u=m?u:void 0}}if(!(u instanceof Date&&!isNaN(u.getTime()))){t.errorHandler(new Error("Invalid date provided: "+h));return}return l===!0&&u.setHours(0,0,0,0),u}}};function Yn(i,e,t){return t===void 0&&(t=!0),t!==!1?new Date(i.getTime()).setHours(0,0,0,0)-new Date(e.getTime()).setHours(0,0,0,0):i.getTime()-e.getTime()}var CE=function(i,e,t){return i>Math.min(e,t)&&i<Math.max(e,t)},jh=function(i,e,t){return i*3600+e*60+t},PE=function(i){var e=Math.floor(i/3600),t=(i-e*3600)/60;return[e,t,i-e*3600-t*60]},AE={DAY:864e5};function qh(i){var e=i.defaultHour,t=i.defaultMinute,n=i.defaultSeconds;if(i.minDate!==void 0){var r=i.minDate.getHours(),s=i.minDate.getMinutes(),o=i.minDate.getSeconds();e<r&&(e=r),e===r&&t<s&&(t=s),e===r&&t===s&&n<o&&(n=i.minDate.getSeconds())}if(i.maxDate!==void 0){var l=i.maxDate.getHours(),a=i.maxDate.getMinutes();e=Math.min(e,l),e===l&&(t=Math.min(a,t)),e===l&&t===a&&(n=i.maxDate.getSeconds())}return{hours:e,minutes:t,seconds:n}}typeof Object.assign!="function"&&(Object.assign=function(i){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];if(!i)throw TypeError("Cannot convert undefined or null to object");for(var n=function(l){l&&Object.keys(l).forEach(function(a){return i[a]=l[a]})},r=0,s=e;r<s.length;r++){var o=s[r];n(o)}return i});var dn=function(){return dn=Object.assign||function(i){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=e[r])}return i},dn.apply(this,arguments)},k1=function(){for(var i=0,e=0,t=arguments.length;e<t;e++)i+=arguments[e].length;for(var n=Array(i),r=0,e=0;e<t;e++)for(var s=arguments[e],o=0,l=s.length;o<l;o++,r++)n[r]=s[o];return n},xE=300;function TE(i,e){var t={config:dn(dn({},uo),Yt.defaultConfig),l10n:ra};t.parseDate=yd({config:t.config,l10n:t.l10n}),t._handlers=[],t.pluginElements=[],t.loadedPlugins=[],t._bind=p,t._setHoursFromDate=f,t._positionCalendar=ti,t.changeMonth=je,t.changeYear=Pe,t.clear=ne,t.close=Ee,t.onMouseOver=Qt,t._createElement=dt,t.createDay=A,t.destroy=Re,t.isEnabled=Ye,t.jumpToDate=w,t.updateValue=Oi,t.open=Ut,t.redraw=qo,t.set=wr,t.setDate=Va,t.toggle=gi;function n(){t.utils={getDaysInMonth:function(E,$){return E===void 0&&(E=t.currentMonth),$===void 0&&($=t.currentYear),E===1&&($%4===0&&$%100!==0||$%400===0)?29:t.l10n.daysInMonth[E]}}}function r(){t.element=t.input=i,t.isOpen=!1,qe(),ei(),Ua(),Ko(),n(),t.isMobile||k(),v(),(t.selectedDates.length||t.config.noCalendar)&&(t.config.enableTime&&f(t.config.noCalendar?t.latestSelectedDateObj:void 0),Oi(!1)),l();var E=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!t.isMobile&&E&&ti(),pt("onReady")}function s(){var E;return((E=t.calendarContainer)===null||E===void 0?void 0:E.getRootNode()).activeElement||document.activeElement}function o(E){return E.bind(t)}function l(){var E=t.config;E.weekNumbers===!1&&E.showMonths===1||E.noCalendar!==!0&&window.requestAnimationFrame(function(){if(t.calendarContainer!==void 0&&(t.calendarContainer.style.visibility="hidden",t.calendarContainer.style.display="block"),t.daysContainer!==void 0){var $=(t.days.offsetWidth+1)*E.showMonths;t.daysContainer.style.width=$+"px",t.calendarContainer.style.width=$+(t.weekWrapper!==void 0?t.weekWrapper.offsetWidth:0)+"px",t.calendarContainer.style.removeProperty("visibility"),t.calendarContainer.style.removeProperty("display")}})}function a(E){if(t.selectedDates.length===0){var $=t.config.minDate===void 0||Yn(new Date,t.config.minDate)>=0?new Date:new Date(t.config.minDate.getTime()),F=qh(t.config);$.setHours(F.hours,F.minutes,F.seconds,$.getMilliseconds()),t.selectedDates=[$],t.latestSelectedDateObj=$}E!==void 0&&E.type!=="blur"&&Ah(E);var j=t._input.value;h(),Oi(),t._input.value!==j&&t._debouncedChange()}function c(E,$){return E%12+12*ni($===t.l10n.amPM[1])}function u(E){switch(E%24){case 0:case 12:return 12;default:return E%12}}function h(){if(!(t.hourElement===void 0||t.minuteElement===void 0)){var E=(parseInt(t.hourElement.value.slice(-2),10)||0)%24,$=(parseInt(t.minuteElement.value,10)||0)%60,F=t.secondElement!==void 0?(parseInt(t.secondElement.value,10)||0)%60:0;t.amPM!==void 0&&(E=c(E,t.amPM.textContent));var j=t.config.minTime!==void 0||t.config.minDate&&t.minDateHasTime&&t.latestSelectedDateObj&&Yn(t.latestSelectedDateObj,t.config.minDate,!0)===0,ce=t.config.maxTime!==void 0||t.config.maxDate&&t.maxDateHasTime&&t.latestSelectedDateObj&&Yn(t.latestSelectedDateObj,t.config.maxDate,!0)===0;if(t.config.maxTime!==void 0&&t.config.minTime!==void 0&&t.config.minTime>t.config.maxTime){var ge=jh(t.config.minTime.getHours(),t.config.minTime.getMinutes(),t.config.minTime.getSeconds()),We=jh(t.config.maxTime.getHours(),t.config.maxTime.getMinutes(),t.config.maxTime.getSeconds()),we=jh(E,$,F);if(we>We&&we<ge){var Ne=PE(ge);E=Ne[0],$=Ne[1],F=Ne[2]}}else{if(ce){var Se=t.config.maxTime!==void 0?t.config.maxTime:t.config.maxDate;E=Math.min(E,Se.getHours()),E===Se.getHours()&&($=Math.min($,Se.getMinutes())),$===Se.getMinutes()&&(F=Math.min(F,Se.getSeconds()))}if(j){var Me=t.config.minTime!==void 0?t.config.minTime:t.config.minDate;E=Math.max(E,Me.getHours()),E===Me.getHours()&&$<Me.getMinutes()&&($=Me.getMinutes()),$===Me.getMinutes()&&(F=Math.max(F,Me.getSeconds()))}}d(E,$,F)}}function f(E){var $=E||t.latestSelectedDateObj;$&&$ instanceof Date&&d($.getHours(),$.getMinutes(),$.getSeconds())}function d(E,$,F){t.latestSelectedDateObj!==void 0&&t.latestSelectedDateObj.setHours(E%24,$,F||0,0),!(!t.hourElement||!t.minuteElement||t.isMobile)&&(t.hourElement.value=Mn(t.config.time_24hr?E:(12+E)%12+12*ni(E%12===0)),t.minuteElement.value=Mn($),t.amPM!==void 0&&(t.amPM.textContent=t.l10n.amPM[ni(E>=12)]),t.secondElement!==void 0&&(t.secondElement.value=Mn(F)))}function m(E){var $=Zn(E),F=parseInt($.value)+(E.delta||0);(F/1e3>1||E.key==="Enter"&&!/[^\d]/.test(F.toString()))&&Pe(F)}function p(E,$,F,j){if($ instanceof Array)return $.forEach(function(ce){return p(E,ce,F,j)});if(E instanceof Array)return E.forEach(function(ce){return p(ce,$,F,j)});E.addEventListener($,F,j),t._handlers.push({remove:function(){return E.removeEventListener($,F,j)}})}function g(){pt("onChange")}function v(){if(t.config.wrap&&["open","close","toggle","clear"].forEach(function(F){Array.prototype.forEach.call(t.element.querySelectorAll("[data-"+F+"]"),function(j){return p(j,"click",t[F])})}),t.isMobile){Ys();return}var E=y1(He,50);if(t._debouncedChange=y1(g,xE),t.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&p(t.daysContainer,"mouseover",function(F){t.config.mode==="range"&&Qt(Zn(F))}),p(t._input,"keydown",wt),t.calendarContainer!==void 0&&p(t.calendarContainer,"keydown",wt),!t.config.inline&&!t.config.static&&p(window,"resize",E),window.ontouchstart!==void 0?p(window.document,"touchstart",H):p(window.document,"mousedown",H),p(window.document,"focus",H,{capture:!0}),t.config.clickOpens===!0&&(p(t._input,"focus",t.open),p(t._input,"click",t.open)),t.daysContainer!==void 0&&(p(t.monthNav,"click",os),p(t.monthNav,["keyup","increment"],m),p(t.daysContainer,"click",vr)),t.timeContainer!==void 0&&t.minuteElement!==void 0&&t.hourElement!==void 0){var $=function(F){return Zn(F).select()};p(t.timeContainer,["increment"],a),p(t.timeContainer,"blur",a,{capture:!0}),p(t.timeContainer,"click",S),p([t.hourElement,t.minuteElement],["focus","click"],$),t.secondElement!==void 0&&p(t.secondElement,"focus",function(){return t.secondElement&&t.secondElement.select()}),t.amPM!==void 0&&p(t.amPM,"click",function(F){a(F)})}t.config.allowInput&&p(t._input,"blur",yt)}function w(E,$){var F=E!==void 0?t.parseDate(E):t.latestSelectedDateObj||(t.config.minDate&&t.config.minDate>t.now?t.config.minDate:t.config.maxDate&&t.config.maxDate<t.now?t.config.maxDate:t.now),j=t.currentYear,ce=t.currentMonth;try{F!==void 0&&(t.currentYear=F.getFullYear(),t.currentMonth=F.getMonth())}catch(ge){ge.message="Invalid date supplied: "+F,t.config.errorHandler(ge)}$&&t.currentYear!==j&&(pt("onYearChange"),J()),$&&(t.currentYear!==j||t.currentMonth!==ce)&&pt("onMonthChange"),t.redraw()}function S(E){var $=Zn(E);~$.className.indexOf("arrow")&&_(E,$.classList.contains("arrowUp")?1:-1)}function _(E,$,F){var j=E&&Zn(E),ce=F||j&&j.parentNode&&j.parentNode.firstChild,ge=rs("increment");ge.delta=$,ce&&ce.dispatchEvent(ge)}function k(){var E=window.document.createDocumentFragment();if(t.calendarContainer=dt("div","flatpickr-calendar"),t.calendarContainer.tabIndex=-1,!t.config.noCalendar){if(E.appendChild(ae()),t.innerContainer=dt("div","flatpickr-innerContainer"),t.config.weekNumbers){var $=ve(),F=$.weekWrapper,j=$.weekNumbers;t.innerContainer.appendChild(F),t.weekNumbers=j,t.weekWrapper=F}t.rContainer=dt("div","flatpickr-rContainer"),t.rContainer.appendChild(ee()),t.daysContainer||(t.daysContainer=dt("div","flatpickr-days"),t.daysContainer.tabIndex=-1),B(),t.rContainer.appendChild(t.daysContainer),t.innerContainer.appendChild(t.rContainer),E.appendChild(t.innerContainer)}t.config.enableTime&&E.appendChild(X()),vn(t.calendarContainer,"rangeMode",t.config.mode==="range"),vn(t.calendarContainer,"animate",t.config.animate===!0),vn(t.calendarContainer,"multiMonth",t.config.showMonths>1),t.calendarContainer.appendChild(E);var ce=t.config.appendTo!==void 0&&t.config.appendTo.nodeType!==void 0;if((t.config.inline||t.config.static)&&(t.calendarContainer.classList.add(t.config.inline?"inline":"static"),t.config.inline&&(!ce&&t.element.parentNode?t.element.parentNode.insertBefore(t.calendarContainer,t._input.nextSibling):t.config.appendTo!==void 0&&t.config.appendTo.appendChild(t.calendarContainer)),t.config.static)){var ge=dt("div","flatpickr-wrapper");t.element.parentNode&&t.element.parentNode.insertBefore(ge,t.element),ge.appendChild(t.element),t.altInput&&ge.appendChild(t.altInput),ge.appendChild(t.calendarContainer)}!t.config.static&&!t.config.inline&&(t.config.appendTo!==void 0?t.config.appendTo:window.document.body).appendChild(t.calendarContainer)}function A(E,$,F,j){var ce=Ye($,!0),ge=dt("span",E,$.getDate().toString());return ge.dateObj=$,ge.$i=j,ge.setAttribute("aria-label",t.formatDate($,t.config.ariaDateFormat)),E.indexOf("hidden")===-1&&Yn($,t.now)===0&&(t.todayDateElem=ge,ge.classList.add("today"),ge.setAttribute("aria-current","date")),ce?(ge.tabIndex=-1,ss($)&&(ge.classList.add("selected"),t.selectedDateElem=ge,t.config.mode==="range"&&(vn(ge,"startRange",t.selectedDates[0]&&Yn($,t.selectedDates[0],!0)===0),vn(ge,"endRange",t.selectedDates[1]&&Yn($,t.selectedDates[1],!0)===0),E==="nextMonthDay"&&ge.classList.add("inRange")))):ge.classList.add("flatpickr-disabled"),t.config.mode==="range"&&Ph($)&&!ss($)&&ge.classList.add("inRange"),t.weekNumbers&&t.config.showMonths===1&&E!=="prevMonthDay"&&j%7===6&&t.weekNumbers.insertAdjacentHTML("beforeend","<span class='flatpickr-day'>"+t.config.getWeek($)+"</span>"),pt("onDayCreate",ge),ge}function C(E){E.focus(),t.config.mode==="range"&&Qt(E)}function Q(E){for(var $=E>0?0:t.config.showMonths-1,F=E>0?t.config.showMonths:-1,j=$;j!=F;j+=E)for(var ce=t.daysContainer.children[j],ge=E>0?0:ce.children.length-1,We=E>0?ce.children.length:-1,we=ge;we!=We;we+=E){var Ne=ce.children[we];if(Ne.className.indexOf("hidden")===-1&&Ye(Ne.dateObj))return Ne}}function M(E,$){for(var F=E.className.indexOf("Month")===-1?E.dateObj.getMonth():t.currentMonth,j=$>0?t.config.showMonths:-1,ce=$>0?1:-1,ge=F-t.currentMonth;ge!=j;ge+=ce)for(var We=t.daysContainer.children[ge],we=F-t.currentMonth===ge?E.$i+$:$<0?We.children.length-1:0,Ne=We.children.length,Se=we;Se>=0&&Se<Ne&&Se!=($>0?Ne:-1);Se+=ce){var Me=We.children[Se];if(Me.className.indexOf("hidden")===-1&&Ye(Me.dateObj)&&Math.abs(E.$i-Se)>=Math.abs($))return C(Me)}t.changeMonth(ce),L(Q(ce),0)}function L(E,$){var F=s(),j=Tt(F||document.body),ce=E!==void 0?E:j?F:t.selectedDateElem!==void 0&&Tt(t.selectedDateElem)?t.selectedDateElem:t.todayDateElem!==void 0&&Tt(t.todayDateElem)?t.todayDateElem:Q($>0?1:-1);ce===void 0?t._input.focus():j?M(ce,$):C(ce)}function N(E,$){for(var F=(new Date(E,$,1).getDay()-t.l10n.firstDayOfWeek+7)%7,j=t.utils.getDaysInMonth(($-1+12)%12,E),ce=t.utils.getDaysInMonth($,E),ge=window.document.createDocumentFragment(),We=t.config.showMonths>1,we=We?"prevMonthDay hidden":"prevMonthDay",Ne=We?"nextMonthDay hidden":"nextMonthDay",Se=j+1-F,Me=0;Se<=j;Se++,Me++)ge.appendChild(A("flatpickr-day "+we,new Date(E,$-1,Se),Se,Me));for(Se=1;Se<=ce;Se++,Me++)ge.appendChild(A("flatpickr-day",new Date(E,$,Se),Se,Me));for(var ft=ce+1;ft<=42-F&&(t.config.showMonths===1||Me%7!==0);ft++,Me++)ge.appendChild(A("flatpickr-day "+Ne,new Date(E,$+1,ft%ce),ft,Me));var Nn=dt("div","dayContainer");return Nn.appendChild(ge),Nn}function B(){if(t.daysContainer!==void 0){nc(t.daysContainer),t.weekNumbers&&nc(t.weekNumbers);for(var E=document.createDocumentFragment(),$=0;$<t.config.showMonths;$++){var F=new Date(t.currentYear,t.currentMonth,1);F.setMonth(t.currentMonth+$),E.appendChild(N(F.getFullYear(),F.getMonth()))}t.daysContainer.appendChild(E),t.days=t.daysContainer.firstChild,t.config.mode==="range"&&t.selectedDates.length===1&&Qt()}}function J(){if(!(t.config.showMonths>1||t.config.monthSelectorType!=="dropdown")){var E=function(j){return t.config.minDate!==void 0&&t.currentYear===t.config.minDate.getFullYear()&&j<t.config.minDate.getMonth()?!1:!(t.config.maxDate!==void 0&&t.currentYear===t.config.maxDate.getFullYear()&&j>t.config.maxDate.getMonth())};t.monthsDropdownContainer.tabIndex=-1,t.monthsDropdownContainer.innerHTML="";for(var $=0;$<12;$++)if(E($)){var F=dt("option","flatpickr-monthDropdown-month");F.value=new Date(t.currentYear,$).getMonth().toString(),F.textContent=bu($,t.config.shorthandCurrentMonth,t.l10n),F.tabIndex=-1,t.currentMonth===$&&(F.selected=!0),t.monthsDropdownContainer.appendChild(F)}}}function te(){var E=dt("div","flatpickr-month"),$=window.document.createDocumentFragment(),F;t.config.showMonths>1||t.config.monthSelectorType==="static"?F=dt("span","cur-month"):(t.monthsDropdownContainer=dt("select","flatpickr-monthDropdown-months"),t.monthsDropdownContainer.setAttribute("aria-label",t.l10n.monthAriaLabel),p(t.monthsDropdownContainer,"change",function(We){var we=Zn(We),Ne=parseInt(we.value,10);t.changeMonth(Ne-t.currentMonth),pt("onMonthChange")}),J(),F=t.monthsDropdownContainer);var j=ic("cur-year",{tabindex:"-1"}),ce=j.getElementsByTagName("input")[0];ce.setAttribute("aria-label",t.l10n.yearAriaLabel),t.config.minDate&&ce.setAttribute("min",t.config.minDate.getFullYear().toString()),t.config.maxDate&&(ce.setAttribute("max",t.config.maxDate.getFullYear().toString()),ce.disabled=!!t.config.minDate&&t.config.minDate.getFullYear()===t.config.maxDate.getFullYear());var ge=dt("div","flatpickr-current-month");return ge.appendChild(F),ge.appendChild(j),$.appendChild(ge),E.appendChild($),{container:E,yearElement:ce,monthElement:F}}function ie(){nc(t.monthNav),t.monthNav.appendChild(t.prevMonthNav),t.config.showMonths&&(t.yearElements=[],t.monthElements=[]);for(var E=t.config.showMonths;E--;){var $=te();t.yearElements.push($.yearElement),t.monthElements.push($.monthElement),t.monthNav.appendChild($.container)}t.monthNav.appendChild(t.nextMonthNav)}function ae(){return t.monthNav=dt("div","flatpickr-months"),t.yearElements=[],t.monthElements=[],t.prevMonthNav=dt("span","flatpickr-prev-month"),t.prevMonthNav.innerHTML=t.config.prevArrow,t.nextMonthNav=dt("span","flatpickr-next-month"),t.nextMonthNav.innerHTML=t.config.nextArrow,ie(),Object.defineProperty(t,"_hidePrevMonthArrow",{get:function(){return t.__hidePrevMonthArrow},set:function(E){t.__hidePrevMonthArrow!==E&&(vn(t.prevMonthNav,"flatpickr-disabled",E),t.__hidePrevMonthArrow=E)}}),Object.defineProperty(t,"_hideNextMonthArrow",{get:function(){return t.__hideNextMonthArrow},set:function(E){t.__hideNextMonthArrow!==E&&(vn(t.nextMonthNav,"flatpickr-disabled",E),t.__hideNextMonthArrow=E)}}),t.currentYearElement=t.yearElements[0],er(),t.monthNav}function X(){t.calendarContainer.classList.add("hasTime"),t.config.noCalendar&&t.calendarContainer.classList.add("noCalendar");var E=qh(t.config);t.timeContainer=dt("div","flatpickr-time"),t.timeContainer.tabIndex=-1;var $=dt("span","flatpickr-time-separator",":"),F=ic("flatpickr-hour",{"aria-label":t.l10n.hourAriaLabel});t.hourElement=F.getElementsByTagName("input")[0];var j=ic("flatpickr-minute",{"aria-label":t.l10n.minuteAriaLabel});if(t.minuteElement=j.getElementsByTagName("input")[0],t.hourElement.tabIndex=t.minuteElement.tabIndex=-1,t.hourElement.value=Mn(t.latestSelectedDateObj?t.latestSelectedDateObj.getHours():t.config.time_24hr?E.hours:u(E.hours)),t.minuteElement.value=Mn(t.latestSelectedDateObj?t.latestSelectedDateObj.getMinutes():E.minutes),t.hourElement.setAttribute("step",t.config.hourIncrement.toString()),t.minuteElement.setAttribute("step",t.config.minuteIncrement.toString()),t.hourElement.setAttribute("min",t.config.time_24hr?"0":"1"),t.hourElement.setAttribute("max",t.config.time_24hr?"23":"12"),t.hourElement.setAttribute("maxlength","2"),t.minuteElement.setAttribute("min","0"),t.minuteElement.setAttribute("max","59"),t.minuteElement.setAttribute("maxlength","2"),t.timeContainer.appendChild(F),t.timeContainer.appendChild($),t.timeContainer.appendChild(j),t.config.time_24hr&&t.timeContainer.classList.add("time24hr"),t.config.enableSeconds){t.timeContainer.classList.add("hasSeconds");var ce=ic("flatpickr-second");t.secondElement=ce.getElementsByTagName("input")[0],t.secondElement.value=Mn(t.latestSelectedDateObj?t.latestSelectedDateObj.getSeconds():E.seconds),t.secondElement.setAttribute("step",t.minuteElement.getAttribute("step")),t.secondElement.setAttribute("min","0"),t.secondElement.setAttribute("max","59"),t.secondElement.setAttribute("maxlength","2"),t.timeContainer.appendChild(dt("span","flatpickr-time-separator",":")),t.timeContainer.appendChild(ce)}return t.config.time_24hr||(t.amPM=dt("span","flatpickr-am-pm",t.l10n.amPM[ni((t.latestSelectedDateObj?t.hourElement.value:t.config.defaultHour)>11)]),t.amPM.title=t.l10n.toggleTitle,t.amPM.tabIndex=-1,t.timeContainer.appendChild(t.amPM)),t.timeContainer}function ee(){t.weekdayContainer?nc(t.weekdayContainer):t.weekdayContainer=dt("div","flatpickr-weekdays");for(var E=t.config.showMonths;E--;){var $=dt("div","flatpickr-weekdaycontainer");t.weekdayContainer.appendChild($)}return Te(),t.weekdayContainer}function Te(){if(t.weekdayContainer){var E=t.l10n.firstDayOfWeek,$=k1(t.l10n.weekdays.shorthand);E>0&&E<$.length&&($=k1($.splice(E,$.length),$.splice(0,E)));for(var F=t.config.showMonths;F--;)t.weekdayContainer.children[F].innerHTML=`
<span class='flatpickr-weekday'>
`+$.join("</span><span class='flatpickr-weekday'>")+`
</span>
`}}function ve(){t.calendarContainer.classList.add("hasWeeks");var E=dt("div","flatpickr-weekwrapper");E.appendChild(dt("span","flatpickr-weekday",t.l10n.weekAbbreviation));var $=dt("div","flatpickr-weeks");return E.appendChild($),{weekWrapper:E,weekNumbers:$}}function je(E,$){$===void 0&&($=!0);var F=$?E:E-t.currentMonth;F<0&&t._hidePrevMonthArrow===!0||F>0&&t._hideNextMonthArrow===!0||(t.currentMonth+=F,(t.currentMonth<0||t.currentMonth>11)&&(t.currentYear+=t.currentMonth>11?1:-1,t.currentMonth=(t.currentMonth+12)%12,pt("onYearChange"),J()),B(),pt("onMonthChange"),er())}function ne(E,$){if(E===void 0&&(E=!0),$===void 0&&($=!0),t.input.value="",t.altInput!==void 0&&(t.altInput.value=""),t.mobileInput!==void 0&&(t.mobileInput.value=""),t.selectedDates=[],t.latestSelectedDateObj=void 0,$===!0&&(t.currentYear=t._initialDate.getFullYear(),t.currentMonth=t._initialDate.getMonth()),t.config.enableTime===!0){var F=qh(t.config),j=F.hours,ce=F.minutes,ge=F.seconds;d(j,ce,ge)}t.redraw(),E&&pt("onChange")}function Ee(){t.isOpen=!1,t.isMobile||(t.calendarContainer!==void 0&&t.calendarContainer.classList.remove("open"),t._input!==void 0&&t._input.classList.remove("active")),pt("onClose")}function Re(){t.config!==void 0&&pt("onDestroy");for(var E=t._handlers.length;E--;)t._handlers[E].remove();if(t._handlers=[],t.mobileInput)t.mobileInput.parentNode&&t.mobileInput.parentNode.removeChild(t.mobileInput),t.mobileInput=void 0;else if(t.calendarContainer&&t.calendarContainer.parentNode)if(t.config.static&&t.calendarContainer.parentNode){var $=t.calendarContainer.parentNode;if($.lastChild&&$.removeChild($.lastChild),$.parentNode){for(;$.firstChild;)$.parentNode.insertBefore($.firstChild,$);$.parentNode.removeChild($)}}else t.calendarContainer.parentNode.removeChild(t.calendarContainer);t.altInput&&(t.input.type="text",t.altInput.parentNode&&t.altInput.parentNode.removeChild(t.altInput),delete t.altInput),t.input&&(t.input.type=t.input._type,t.input.classList.remove("flatpickr-input"),t.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(F){try{delete t[F]}catch{}})}function xt(E){return t.calendarContainer.contains(E)}function H(E){if(t.isOpen&&!t.config.inline){var $=Zn(E),F=xt($),j=$===t.input||$===t.altInput||t.element.contains($)||E.path&&E.path.indexOf&&(~E.path.indexOf(t.input)||~E.path.indexOf(t.altInput)),ce=!j&&!F&&!xt(E.relatedTarget),ge=!t.config.ignoredFocusElements.some(function(We){return We.contains($)});ce&&ge&&(t.config.allowInput&&t.setDate(t._input.value,!1,t.config.altInput?t.config.altFormat:t.config.dateFormat),t.timeContainer!==void 0&&t.minuteElement!==void 0&&t.hourElement!==void 0&&t.input.value!==""&&t.input.value!==void 0&&a(),t.close(),t.config&&t.config.mode==="range"&&t.selectedDates.length===1&&t.clear(!1))}}function Pe(E){if(!(!E||t.config.minDate&&E<t.config.minDate.getFullYear()||t.config.maxDate&&E>t.config.maxDate.getFullYear())){var $=E,F=t.currentYear!==$;t.currentYear=$||t.currentYear,t.config.maxDate&&t.currentYear===t.config.maxDate.getFullYear()?t.currentMonth=Math.min(t.config.maxDate.getMonth(),t.currentMonth):t.config.minDate&&t.currentYear===t.config.minDate.getFullYear()&&(t.currentMonth=Math.max(t.config.minDate.getMonth(),t.currentMonth)),F&&(t.redraw(),pt("onYearChange"),J())}}function Ye(E,$){var F;$===void 0&&($=!0);var j=t.parseDate(E,void 0,$);if(t.config.minDate&&j&&Yn(j,t.config.minDate,$!==void 0?$:!t.minDateHasTime)<0||t.config.maxDate&&j&&Yn(j,t.config.maxDate,$!==void 0?$:!t.maxDateHasTime)>0)return!1;if(!t.config.enable&&t.config.disable.length===0)return!0;if(j===void 0)return!1;for(var ce=!!t.config.enable,ge=(F=t.config.enable)!==null&&F!==void 0?F:t.config.disable,We=0,we=void 0;We<ge.length;We++){if(we=ge[We],typeof we=="function"&&we(j))return ce;if(we instanceof Date&&j!==void 0&&we.getTime()===j.getTime())return ce;if(typeof we=="string"){var Ne=t.parseDate(we,void 0,!0);return Ne&&Ne.getTime()===j.getTime()?ce:!ce}else if(typeof we=="object"&&j!==void 0&&we.from&&we.to&&j.getTime()>=we.from.getTime()&&j.getTime()<=we.to.getTime())return ce}return!ce}function Tt(E){return t.daysContainer!==void 0?E.className.indexOf("hidden")===-1&&E.className.indexOf("flatpickr-disabled")===-1&&t.daysContainer.contains(E):!1}function yt(E){var $=E.target===t._input,F=t._input.value.trimEnd()!==yr();$&&F&&!(E.relatedTarget&&xt(E.relatedTarget))&&t.setDate(t._input.value,!0,E.target===t.altInput?t.config.altFormat:t.config.dateFormat)}function wt(E){var $=Zn(E),F=t.config.wrap?i.contains($):$===t._input,j=t.config.allowInput,ce=t.isOpen&&(!j||!F),ge=t.config.inline&&F&&!j;if(E.keyCode===13&&F){if(j)return t.setDate(t._input.value,!0,$===t.altInput?t.config.altFormat:t.config.dateFormat),t.close(),$.blur();t.open()}else if(xt($)||ce||ge){var We=!!t.timeContainer&&t.timeContainer.contains($);switch(E.keyCode){case 13:We?(E.preventDefault(),a(),ns()):vr(E);break;case 27:E.preventDefault(),ns();break;case 8:case 46:F&&!t.config.allowInput&&(E.preventDefault(),t.clear());break;case 37:case 39:if(!We&&!F){E.preventDefault();var we=s();if(t.daysContainer!==void 0&&(j===!1||we&&Tt(we))){var Ne=E.keyCode===39?1:-1;E.ctrlKey?(E.stopPropagation(),je(Ne),L(Q(1),0)):L(void 0,Ne)}}else t.hourElement&&t.hourElement.focus();break;case 38:case 40:E.preventDefault();var Se=E.keyCode===40?1:-1;t.daysContainer&&$.$i!==void 0||$===t.input||$===t.altInput?E.ctrlKey?(E.stopPropagation(),Pe(t.currentYear-Se),L(Q(1),0)):We||L(void 0,Se*7):$===t.currentYearElement?Pe(t.currentYear-Se):t.config.enableTime&&(!We&&t.hourElement&&t.hourElement.focus(),a(E),t._debouncedChange());break;case 9:if(We){var Me=[t.hourElement,t.minuteElement,t.secondElement,t.amPM].concat(t.pluginElements).filter(function(Lt){return Lt}),ft=Me.indexOf($);if(ft!==-1){var Nn=Me[ft+(E.shiftKey?-1:1)];E.preventDefault(),(Nn||t._input).focus()}}else!t.config.noCalendar&&t.daysContainer&&t.daysContainer.contains($)&&E.shiftKey&&(E.preventDefault(),t._input.focus());break}}if(t.amPM!==void 0&&$===t.amPM)switch(E.key){case t.l10n.amPM[0].charAt(0):case t.l10n.amPM[0].charAt(0).toLowerCase():t.amPM.textContent=t.l10n.amPM[0],h(),Oi();break;case t.l10n.amPM[1].charAt(0):case t.l10n.amPM[1].charAt(0).toLowerCase():t.amPM.textContent=t.l10n.amPM[1],h(),Oi();break}(F||xt($))&&pt("onKeyDown",E)}function Qt(E,$){if($===void 0&&($="flatpickr-day"),!(t.selectedDates.length!==1||E&&(!E.classList.contains($)||E.classList.contains("flatpickr-disabled")))){for(var F=E?E.dateObj.getTime():t.days.firstElementChild.dateObj.getTime(),j=t.parseDate(t.selectedDates[0],void 0,!0).getTime(),ce=Math.min(F,t.selectedDates[0].getTime()),ge=Math.max(F,t.selectedDates[0].getTime()),We=!1,we=0,Ne=0,Se=ce;Se<ge;Se+=AE.DAY)Ye(new Date(Se),!0)||(We=We||Se>ce&&Se<ge,Se<j&&(!we||Se>we)?we=Se:Se>j&&(!Ne||Se<Ne)&&(Ne=Se));var Me=Array.from(t.rContainer.querySelectorAll("*:nth-child(-n+"+t.config.showMonths+") > ."+$));Me.forEach(function(ft){var Nn=ft.dateObj,Lt=Nn.getTime(),kr=we>0&&Lt<we||Ne>0&&Lt>Ne;if(kr){ft.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(tr){ft.classList.remove(tr)});return}else if(We&&!kr)return;["startRange","inRange","endRange","notAllowed"].forEach(function(tr){ft.classList.remove(tr)}),E!==void 0&&(E.classList.add(F<=t.selectedDates[0].getTime()?"startRange":"endRange"),j<F&&Lt===j?ft.classList.add("startRange"):j>F&&Lt===j&&ft.classList.add("endRange"),Lt>=we&&(Ne===0||Lt<=Ne)&&CE(Lt,j,F)&&ft.classList.add("inRange"))})}}function He(){t.isOpen&&!t.config.static&&!t.config.inline&&ti()}function Ut(E,$){if($===void 0&&($=t._positionElement),t.isMobile===!0){if(E){E.preventDefault();var F=Zn(E);F&&F.blur()}t.mobileInput!==void 0&&(t.mobileInput.focus(),t.mobileInput.click()),pt("onOpen");return}else if(t._input.disabled||t.config.inline)return;var j=t.isOpen;t.isOpen=!0,j||(t.calendarContainer.classList.add("open"),t._input.classList.add("active"),pt("onOpen"),ti($)),t.config.enableTime===!0&&t.config.noCalendar===!0&&t.config.allowInput===!1&&(E===void 0||!t.timeContainer.contains(E.relatedTarget))&&setTimeout(function(){return t.hourElement.select()},50)}function ct(E){return function($){var F=t.config["_"+E+"Date"]=t.parseDate($,t.config.dateFormat),j=t.config["_"+(E==="min"?"max":"min")+"Date"];F!==void 0&&(t[E==="min"?"minDateHasTime":"maxDateHasTime"]=F.getHours()>0||F.getMinutes()>0||F.getSeconds()>0),t.selectedDates&&(t.selectedDates=t.selectedDates.filter(function(ce){return Ye(ce)}),!t.selectedDates.length&&E==="min"&&f(F),Oi()),t.daysContainer&&(qo(),F!==void 0?t.currentYearElement[E]=F.getFullYear().toString():t.currentYearElement.removeAttribute(E),t.currentYearElement.disabled=!!j&&F!==void 0&&j.getFullYear()===F.getFullYear())}}function qe(){var E=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],$=dn(dn({},JSON.parse(JSON.stringify(i.dataset||{}))),e),F={};t.config.parseDate=$.parseDate,t.config.formatDate=$.formatDate,Object.defineProperty(t.config,"enable",{get:function(){return t.config._enable},set:function(Me){t.config._enable=Ho(Me)}}),Object.defineProperty(t.config,"disable",{get:function(){return t.config._disable},set:function(Me){t.config._disable=Ho(Me)}});var j=$.mode==="time";if(!$.dateFormat&&($.enableTime||j)){var ce=Yt.defaultConfig.dateFormat||uo.dateFormat;F.dateFormat=$.noCalendar||j?"H:i"+($.enableSeconds?":S":""):ce+" H:i"+($.enableSeconds?":S":"")}if($.altInput&&($.enableTime||j)&&!$.altFormat){var ge=Yt.defaultConfig.altFormat||uo.altFormat;F.altFormat=$.noCalendar||j?"h:i"+($.enableSeconds?":S K":" K"):ge+(" h:i"+($.enableSeconds?":S":"")+" K")}Object.defineProperty(t.config,"minDate",{get:function(){return t.config._minDate},set:ct("min")}),Object.defineProperty(t.config,"maxDate",{get:function(){return t.config._maxDate},set:ct("max")});var We=function(Me){return function(ft){t.config[Me==="min"?"_minTime":"_maxTime"]=t.parseDate(ft,"H:i:S")}};Object.defineProperty(t.config,"minTime",{get:function(){return t.config._minTime},set:We("min")}),Object.defineProperty(t.config,"maxTime",{get:function(){return t.config._maxTime},set:We("max")}),$.mode==="time"&&(t.config.noCalendar=!0,t.config.enableTime=!0),Object.assign(t.config,F,$);for(var we=0;we<E.length;we++)t.config[E[we]]=t.config[E[we]]===!0||t.config[E[we]]==="true";zh.filter(function(Me){return t.config[Me]!==void 0}).forEach(function(Me){t.config[Me]=Vh(t.config[Me]||[]).map(o)}),t.isMobile=!t.config.disableMobile&&!t.config.inline&&t.config.mode==="single"&&!t.config.disable.length&&!t.config.enable&&!t.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);for(var we=0;we<t.config.plugins.length;we++){var Ne=t.config.plugins[we](t)||{};for(var Se in Ne)zh.indexOf(Se)>-1?t.config[Se]=Vh(Ne[Se]).map(o).concat(t.config[Se]):typeof $[Se]>"u"&&(t.config[Se]=Ne[Se])}$.altInputClass||(t.config.altInputClass=Mt().className+" "+t.config.altInputClass),pt("onParseConfig")}function Mt(){return t.config.wrap?i.querySelector("[data-input]"):i}function ei(){typeof t.config.locale!="object"&&typeof Yt.l10ns[t.config.locale]>"u"&&t.config.errorHandler(new Error("flatpickr: invalid locale "+t.config.locale)),t.l10n=dn(dn({},Yt.l10ns.default),typeof t.config.locale=="object"?t.config.locale:t.config.locale!=="default"?Yt.l10ns[t.config.locale]:void 0),ps.D="("+t.l10n.weekdays.shorthand.join("|")+")",ps.l="("+t.l10n.weekdays.longhand.join("|")+")",ps.M="("+t.l10n.months.shorthand.join("|")+")",ps.F="("+t.l10n.months.longhand.join("|")+")",ps.K="("+t.l10n.amPM[0]+"|"+t.l10n.amPM[1]+"|"+t.l10n.amPM[0].toLowerCase()+"|"+t.l10n.amPM[1].toLowerCase()+")";var E=dn(dn({},e),JSON.parse(JSON.stringify(i.dataset||{})));E.time_24hr===void 0&&Yt.defaultConfig.time_24hr===void 0&&(t.config.time_24hr=t.l10n.time_24hr),t.formatDate=zy(t),t.parseDate=yd({config:t.config,l10n:t.l10n})}function ti(E){if(typeof t.config.position=="function")return void t.config.position(t,E);if(t.calendarContainer!==void 0){pt("onPreCalendarPosition");var $=E||t._positionElement,F=Array.prototype.reduce.call(t.calendarContainer.children,function(ze,Wt){return ze+Wt.offsetHeight},0),j=t.calendarContainer.offsetWidth,ce=t.config.position.split(" "),ge=ce[0],We=ce.length>1?ce[1]:null,we=$.getBoundingClientRect(),Ne=window.innerHeight-we.bottom,Se=ge==="above"||ge!=="below"&&Ne<F&&we.top>F,Me=window.pageYOffset+we.top+(Se?-F-2:$.offsetHeight+2);if(vn(t.calendarContainer,"arrowTop",!Se),vn(t.calendarContainer,"arrowBottom",Se),!t.config.inline){var ft=window.pageXOffset+we.left,Nn=!1,Lt=!1;We==="center"?(ft-=(j-we.width)/2,Nn=!0):We==="right"&&(ft-=j-we.width,Lt=!0),vn(t.calendarContainer,"arrowLeft",!Nn&&!Lt),vn(t.calendarContainer,"arrowCenter",Nn),vn(t.calendarContainer,"arrowRight",Lt);var kr=window.document.body.offsetWidth-(window.pageXOffset+we.right),tr=ft+j>window.document.body.offsetWidth,ja=kr+j>window.document.body.offsetWidth;if(vn(t.calendarContainer,"rightMost",tr),!t.config.static)if(t.calendarContainer.style.top=Me+"px",!tr)t.calendarContainer.style.left=ft+"px",t.calendarContainer.style.right="auto";else if(!ja)t.calendarContainer.style.left="auto",t.calendarContainer.style.right=kr+"px";else{var zs=Ri();if(zs===void 0)return;var xh=window.document.body.offsetWidth,Z=Math.max(0,xh/2-j/2),_e=".flatpickr-calendar.centerMost:before",me=".flatpickr-calendar.centerMost:after",Ke=zs.cssRules.length,ot="{left:"+we.left+"px;right:auto;}";vn(t.calendarContainer,"rightMost",!1),vn(t.calendarContainer,"centerMost",!0),zs.insertRule(_e+","+me+ot,Ke),t.calendarContainer.style.left=Z+"px",t.calendarContainer.style.right="auto"}}}}function Ri(){for(var E=null,$=0;$<document.styleSheets.length;$++){var F=document.styleSheets[$];if(F.cssRules){try{F.cssRules}catch{continue}E=F;break}}return E??za()}function za(){var E=document.createElement("style");return document.head.appendChild(E),E.sheet}function qo(){t.config.noCalendar||t.isMobile||(J(),er(),B())}function ns(){t._input.focus(),window.navigator.userAgent.indexOf("MSIE")!==-1||navigator.msMaxTouchPoints!==void 0?setTimeout(t.close,0):t.close()}function vr(E){E.preventDefault(),E.stopPropagation();var $=function(Me){return Me.classList&&Me.classList.contains("flatpickr-day")&&!Me.classList.contains("flatpickr-disabled")&&!Me.classList.contains("notAllowed")},F=Yy(Zn(E),$);if(F!==void 0){var j=F,ce=t.latestSelectedDateObj=new Date(j.dateObj.getTime()),ge=(ce.getMonth()<t.currentMonth||ce.getMonth()>t.currentMonth+t.config.showMonths-1)&&t.config.mode!=="range";if(t.selectedDateElem=j,t.config.mode==="single")t.selectedDates=[ce];else if(t.config.mode==="multiple"){var We=ss(ce);We?t.selectedDates.splice(parseInt(We),1):t.selectedDates.push(ce)}else t.config.mode==="range"&&(t.selectedDates.length===2&&t.clear(!1,!1),t.latestSelectedDateObj=ce,t.selectedDates.push(ce),Yn(ce,t.selectedDates[0],!0)!==0&&t.selectedDates.sort(function(Me,ft){return Me.getTime()-ft.getTime()}));if(h(),ge){var we=t.currentYear!==ce.getFullYear();t.currentYear=ce.getFullYear(),t.currentMonth=ce.getMonth(),we&&(pt("onYearChange"),J()),pt("onMonthChange")}if(er(),B(),Oi(),!ge&&t.config.mode!=="range"&&t.config.showMonths===1?C(j):t.selectedDateElem!==void 0&&t.hourElement===void 0&&t.selectedDateElem&&t.selectedDateElem.focus(),t.hourElement!==void 0&&t.hourElement!==void 0&&t.hourElement.focus(),t.config.closeOnSelect){var Ne=t.config.mode==="single"&&!t.config.enableTime,Se=t.config.mode==="range"&&t.selectedDates.length===2&&!t.config.enableTime;(Ne||Se)&&ns()}g()}}var pi={locale:[ei,Te],showMonths:[ie,l,ee],minDate:[w],maxDate:[w],positionElement:[is],clickOpens:[function(){t.config.clickOpens===!0?(p(t._input,"focus",t.open),p(t._input,"click",t.open)):(t._input.removeEventListener("focus",t.open),t._input.removeEventListener("click",t.open))}]};function wr(E,$){if(E!==null&&typeof E=="object"){Object.assign(t.config,E);for(var F in E)pi[F]!==void 0&&pi[F].forEach(function(j){return j()})}else t.config[E]=$,pi[E]!==void 0?pi[E].forEach(function(j){return j()}):zh.indexOf(E)>-1&&(t.config[E]=Vh($));t.redraw(),Oi(!0)}function Go(E,$){var F=[];if(E instanceof Array)F=E.map(function(j){return t.parseDate(j,$)});else if(E instanceof Date||typeof E=="number")F=[t.parseDate(E,$)];else if(typeof E=="string")switch(t.config.mode){case"single":case"time":F=[t.parseDate(E,$)];break;case"multiple":F=E.split(t.config.conjunction).map(function(j){return t.parseDate(j,$)});break;case"range":F=E.split(t.l10n.rangeSeparator).map(function(j){return t.parseDate(j,$)});break}else t.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(E)));t.selectedDates=t.config.allowInvalidPreload?F:F.filter(function(j){return j instanceof Date&&Ye(j,!1)}),t.config.mode==="range"&&t.selectedDates.sort(function(j,ce){return j.getTime()-ce.getTime()})}function Va(E,$,F){if($===void 0&&($=!1),F===void 0&&(F=t.config.dateFormat),E!==0&&!E||E instanceof Array&&E.length===0)return t.clear($);Go(E,F),t.latestSelectedDateObj=t.selectedDates[t.selectedDates.length-1],t.redraw(),w(void 0,$),f(),t.selectedDates.length===0&&t.clear(!1),Oi($),$&&pt("onChange")}function Ho(E){return E.slice().map(function($){return typeof $=="string"||typeof $=="number"||$ instanceof Date?t.parseDate($,void 0,!0):$&&typeof $=="object"&&$.from&&$.to?{from:t.parseDate($.from,void 0),to:t.parseDate($.to,void 0)}:$}).filter(function($){return $})}function Ko(){t.selectedDates=[],t.now=t.parseDate(t.config.now)||new Date;var E=t.config.defaultDate||((t.input.nodeName==="INPUT"||t.input.nodeName==="TEXTAREA")&&t.input.placeholder&&t.input.value===t.input.placeholder?null:t.input.value);E&&Go(E,t.config.dateFormat),t._initialDate=t.selectedDates.length>0?t.selectedDates[0]:t.config.minDate&&t.config.minDate.getTime()>t.now.getTime()?t.config.minDate:t.config.maxDate&&t.config.maxDate.getTime()<t.now.getTime()?t.config.maxDate:t.now,t.currentYear=t._initialDate.getFullYear(),t.currentMonth=t._initialDate.getMonth(),t.selectedDates.length>0&&(t.latestSelectedDateObj=t.selectedDates[0]),t.config.minTime!==void 0&&(t.config.minTime=t.parseDate(t.config.minTime,"H:i")),t.config.maxTime!==void 0&&(t.config.maxTime=t.parseDate(t.config.maxTime,"H:i")),t.minDateHasTime=!!t.config.minDate&&(t.config.minDate.getHours()>0||t.config.minDate.getMinutes()>0||t.config.minDate.getSeconds()>0),t.maxDateHasTime=!!t.config.maxDate&&(t.config.maxDate.getHours()>0||t.config.maxDate.getMinutes()>0||t.config.maxDate.getSeconds()>0)}function Ua(){if(t.input=Mt(),!t.input){t.config.errorHandler(new Error("Invalid input element specified"));return}t.input._type=t.input.type,t.input.type="text",t.input.classList.add("flatpickr-input"),t._input=t.input,t.config.altInput&&(t.altInput=dt(t.input.nodeName,t.config.altInputClass),t._input=t.altInput,t.altInput.placeholder=t.input.placeholder,t.altInput.disabled=t.input.disabled,t.altInput.required=t.input.required,t.altInput.tabIndex=t.input.tabIndex,t.altInput.type="text",t.input.setAttribute("type","hidden"),!t.config.static&&t.input.parentNode&&t.input.parentNode.insertBefore(t.altInput,t.input.nextSibling)),t.config.allowInput||t._input.setAttribute("readonly","readonly"),is()}function is(){t._positionElement=t.config.positionElement||t._input}function Ys(){var E=t.config.enableTime?t.config.noCalendar?"time":"datetime-local":"date";t.mobileInput=dt("input",t.input.className+" flatpickr-mobile"),t.mobileInput.tabIndex=1,t.mobileInput.type=E,t.mobileInput.disabled=t.input.disabled,t.mobileInput.required=t.input.required,t.mobileInput.placeholder=t.input.placeholder,t.mobileFormatStr=E==="datetime-local"?"Y-m-d\\TH:i:S":E==="date"?"Y-m-d":"H:i:S",t.selectedDates.length>0&&(t.mobileInput.defaultValue=t.mobileInput.value=t.formatDate(t.selectedDates[0],t.mobileFormatStr)),t.config.minDate&&(t.mobileInput.min=t.formatDate(t.config.minDate,"Y-m-d")),t.config.maxDate&&(t.mobileInput.max=t.formatDate(t.config.maxDate,"Y-m-d")),t.input.getAttribute("step")&&(t.mobileInput.step=String(t.input.getAttribute("step"))),t.input.type="hidden",t.altInput!==void 0&&(t.altInput.type="hidden");try{t.input.parentNode&&t.input.parentNode.insertBefore(t.mobileInput,t.input.nextSibling)}catch{}p(t.mobileInput,"change",function($){t.setDate(Zn($).value,!1,t.mobileFormatStr),pt("onChange"),pt("onClose")})}function gi(E){if(t.isOpen===!0)return t.close();t.open(E)}function pt(E,$){if(t.config!==void 0){var F=t.config[E];if(F!==void 0&&F.length>0)for(var j=0;F[j]&&j<F.length;j++)F[j](t.selectedDates,t.input.value,t,$);E==="onChange"&&(t.input.dispatchEvent(rs("change")),t.input.dispatchEvent(rs("input")))}}function rs(E){var $=document.createEvent("Event");return $.initEvent(E,!0,!0),$}function ss(E){for(var $=0;$<t.selectedDates.length;$++){var F=t.selectedDates[$];if(F instanceof Date&&Yn(F,E)===0)return""+$}return!1}function Ph(E){return t.config.mode!=="range"||t.selectedDates.length<2?!1:Yn(E,t.selectedDates[0])>=0&&Yn(E,t.selectedDates[1])<=0}function er(){t.config.noCalendar||t.isMobile||!t.monthNav||(t.yearElements.forEach(function(E,$){var F=new Date(t.currentYear,t.currentMonth,1);F.setMonth(t.currentMonth+$),t.config.showMonths>1||t.config.monthSelectorType==="static"?t.monthElements[$].textContent=bu(F.getMonth(),t.config.shorthandCurrentMonth,t.l10n)+" ":t.monthsDropdownContainer.value=F.getMonth().toString(),E.value=F.getFullYear().toString()}),t._hidePrevMonthArrow=t.config.minDate!==void 0&&(t.currentYear===t.config.minDate.getFullYear()?t.currentMonth<=t.config.minDate.getMonth():t.currentYear<t.config.minDate.getFullYear()),t._hideNextMonthArrow=t.config.maxDate!==void 0&&(t.currentYear===t.config.maxDate.getFullYear()?t.currentMonth+1>t.config.maxDate.getMonth():t.currentYear>t.config.maxDate.getFullYear()))}function yr(E){var $=E||(t.config.altInput?t.config.altFormat:t.config.dateFormat);return t.selectedDates.map(function(F){return t.formatDate(F,$)}).filter(function(F,j,ce){return t.config.mode!=="range"||t.config.enableTime||ce.indexOf(F)===j}).join(t.config.mode!=="range"?t.config.conjunction:t.l10n.rangeSeparator)}function Oi(E){E===void 0&&(E=!0),t.mobileInput!==void 0&&t.mobileFormatStr&&(t.mobileInput.value=t.latestSelectedDateObj!==void 0?t.formatDate(t.latestSelectedDateObj,t.mobileFormatStr):""),t.input.value=yr(t.config.dateFormat),t.altInput!==void 0&&(t.altInput.value=yr(t.config.altFormat)),E!==!1&&pt("onValueUpdate")}function os(E){var $=Zn(E),F=t.prevMonthNav.contains($),j=t.nextMonthNav.contains($);F||j?je(F?-1:1):t.yearElements.indexOf($)>=0?$.select():$.classList.contains("arrowUp")?t.changeYear(t.currentYear+1):$.classList.contains("arrowDown")&&t.changeYear(t.currentYear-1)}function Ah(E){E.preventDefault();var $=E.type==="keydown",F=Zn(E),j=F;t.amPM!==void 0&&F===t.amPM&&(t.amPM.textContent=t.l10n.amPM[ni(t.amPM.textContent===t.l10n.amPM[0])]);var ce=parseFloat(j.getAttribute("min")),ge=parseFloat(j.getAttribute("max")),We=parseFloat(j.getAttribute("step")),we=parseInt(j.value,10),Ne=E.delta||($?E.which===38?1:-1:0),Se=we+We*Ne;if(typeof j.value<"u"&&j.value.length===2){var Me=j===t.hourElement,ft=j===t.minuteElement;Se<ce?(Se=ge+Se+ni(!Me)+(ni(Me)&&ni(!t.amPM)),ft&&_(void 0,-1,t.hourElement)):Se>ge&&(Se=j===t.hourElement?Se-ge-ni(!t.amPM):ce,ft&&_(void 0,1,t.hourElement)),t.amPM&&Me&&(We===1?Se+we===23:Math.abs(Se-we)>We)&&(t.amPM.textContent=t.l10n.amPM[ni(t.amPM.textContent===t.l10n.amPM[0])]),j.value=Mn(Se)}}return r(),t}function ho(i,e){for(var t=Array.prototype.slice.call(i).filter(function(o){return o instanceof HTMLElement}),n=[],r=0;r<t.length;r++){var s=t[r];try{if(s.getAttribute("data-fp-omit")!==null)continue;s._flatpickr!==void 0&&(s._flatpickr.destroy(),s._flatpickr=void 0),s._flatpickr=TE(s,e||{}),n.push(s._flatpickr)}catch(o){console.error(o)}}return n.length===1?n[0]:n}typeof HTMLElement<"u"&&typeof HTMLCollection<"u"&&typeof NodeList<"u"&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(i){return ho(this,i)},HTMLElement.prototype.flatpickr=function(i){return ho([this],i)});var Yt=function(i,e){return typeof i=="string"?ho(window.document.querySelectorAll(i),e):i instanceof Node?ho([i],e):ho(i,e)};Yt.defaultConfig={};Yt.l10ns={en:dn({},ra),default:dn({},ra)};Yt.localize=function(i){Yt.l10ns.default=dn(dn({},Yt.l10ns.default),i)};Yt.setDefaults=function(i){Yt.defaultConfig=dn(dn({},Yt.defaultConfig),i)};Yt.parseDate=yd({});Yt.formatDate=zy({});Yt.compareDates=Yn;typeof jQuery<"u"&&typeof jQuery.fn<"u"&&(jQuery.fn.flatpickr=function(i){return ho(this,i)});Date.prototype.fp_incr=function(i){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+(typeof i=="string"?parseInt(i,10):i))};typeof window<"u"&&(window.flatpickr=Yt);function S1(i){let e,t;return{c(){e=y("div"),t=W(i[5]),O(e,"class","invalid-feedback d-block")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&32&&K(t,n[5])},d(n){n&&P(e)}}}function QE(i){let e,t,n,r,s,o,l=i[5]&&S1(i);return{c(){e=y("div"),t=y("input"),r=D(),l&&l.c(),O(t,"type","text"),O(t,"id",i[2]),O(t,"class","form-control"),O(t,"autocomplete","off"),t.readOnly=n=i[1].readonly&&!i[3],Ae(t,"is-invalid",i[5]),O(e,"class","mb-0")},m(a,c){x(a,e,c),b(e,t),Le(t,i[0]),i[8](t),b(e,r),l&&l.m(e,null),s||(o=G(t,"input",i[7]),s=!0)},p(a,[c]){c&4&&O(t,"id",a[2]),c&10&&n!==(n=a[1].readonly&&!a[3])&&(t.readOnly=n),c&1&&t.value!==a[0]&&Le(t,a[0]),c&32&&Ae(t,"is-invalid",a[5]),a[5]?l?l.p(a,c):(l=S1(a),l.c(),l.m(e,null)):l&&(l.d(1),l=null)},i:U,o:U,d(a){a&&P(e),i[8](null),l&&l.d(),s=!1,o()}}}function ME(i,e,t){let n,{field:r}=e,{value:s}=e,{id:o}=e,{isCreateMode:l}=e,{validationErrors:a}=e,c,u={enableTime:!1,allowInput:!0,dateFormat:"Y-m-d"};r.min&&(u.minDate=r.min),r.max&&(u.maxDate=r.max),xi(()=>{(!r.readonly||l)&&Yt(c,u)});function h(){s=this.value,t(0,s)}function f(d){Ce[d?"unshift":"push"](()=>{c=d,t(4,c)})}return i.$$set=d=>{"field"in d&&t(1,r=d.field),"value"in d&&t(0,s=d.value),"id"in d&&t(2,o=d.id),"isCreateMode"in d&&t(3,l=d.isCreateMode),"validationErrors"in d&&t(6,a=d.validationErrors)},i.$$.update=()=>{i.$$.dirty&66&&t(5,n=In(a,r.name))},[s,r,o,l,c,n,a,h,f]}let EE=class extends oe{constructor(e){super(),se(this,e,ME,QE,re,{field:1,value:0,id:2,isCreateMode:3,validationErrors:6})}};function RE(i){let e,t,n,r,s;return t=new ut({props:{icon:"dice"}}),{c(){e=y("button"),V(t.$$.fragment),O(e,"class","btn btn-primary ms-2"),O(e,"title","Generate a new UUIDv4")},m(o,l){x(o,e,l),Y(t,e,null),n=!0,r||(s=G(e,"click",i[4]),r=!0)},p:U,i(o){n||(T(t.$$.fragment,o),n=!0)},o(o){R(t.$$.fragment,o),n=!1},d(o){o&&P(e),z(t),r=!1,s()}}}function _1(i){let e,t;return{c(){e=y("div"),t=W(i[2]),O(e,"class","invalid-feedback d-block")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&4&&K(t,n[2])},d(n){n&&P(e)}}}function DE(i){let e,t,n,r,s,o,l,a,c=!i[3]&&RE(i),u=i[2]&&_1(i);return{c(){e=y("div"),t=y("div"),n=y("input"),r=D(),c&&c.c(),s=D(),u&&u.c(),O(n,"type","text"),O(n,"id",i[1]),O(n,"class","form-control"),O(n,"autocomplete","off"),n.readOnly=i[3],Ae(n,"is-invalid",i[2]),O(t,"class","d-flex justify-content-between"),O(e,"class","mb-0")},m(h,f){x(h,e,f),b(e,t),b(t,n),Le(n,i[0]),b(t,r),c&&c.m(t,null),b(e,s),u&&u.m(e,null),o=!0,l||(a=G(n,"input",i[8]),l=!0)},p(h,[f]){(!o||f&2)&&O(n,"id",h[1]),f&1&&n.value!==h[0]&&Le(n,h[0]),(!o||f&4)&&Ae(n,"is-invalid",h[2]),h[3]||c.p(h,f),h[2]?u?u.p(h,f):(u=_1(h),u.c(),u.m(e,null)):u&&(u.d(1),u=null)},i(h){o||(T(c),o=!0)},o(h){R(c),o=!1},d(h){h&&P(e),c&&c.d(),u&&u.d(),l=!1,a()}}}function $E(i,e,t){let n;Ue("channelurl");let{validationErrors:r}=e,{field:s}=e,{value:o}=e,{id:l}=e,{isCreateMode:a}=e,c=s.readonly&&!a;function u(f){f.preventDefault(),t(0,o=self.crypto.randomUUID())}function h(){o=this.value,t(0,o)}return i.$$set=f=>{"validationErrors"in f&&t(5,r=f.validationErrors),"field"in f&&t(6,s=f.field),"value"in f&&t(0,o=f.value),"id"in f&&t(1,l=f.id),"isCreateMode"in f&&t(7,a=f.isCreateMode)},i.$$.update=()=>{i.$$.dirty&96&&t(2,n=In(r,s.name))},[o,l,n,c,u,r,s,a,h]}class LE extends oe{constructor(e){super(),se(this,e,$E,DE,re,{validationErrors:5,field:6,value:0,id:1,isCreateMode:7})}}function C1(i){let e,t,n,r,s,o;return n=new ut({props:{icon:"trash-can"}}),{c(){e=y("div"),t=y("button"),V(n.$$.fragment),O(t,"class","button"),O(e,"class","reference-action")},m(l,a){x(l,e,a),b(e,t),Y(n,t,null),r=!0,s||(o=G(t,"click",i[2]),s=!0)},p:U,i(l){r||(T(n.$$.fragment,l),r=!0)},o(l){R(n.$$.fragment,l),r=!1},d(l){l&&P(e),z(n),s=!1,o()}}}function IE(i){let e,t,n,r,s,o,l,a=i[0].filename+"",c,u,h,f;r=new Xo({props:{file:i[0],size:"small"}});let d=i[1]&&C1(i);return{c(){e=y("div"),t=y("div"),n=y("div"),V(r.$$.fragment),s=D(),o=y("div"),l=y("div"),c=W(a),u=D(),h=y("div"),d&&d.c(),O(n,"class","image"),O(o,"class","title"),le(t,"display","flex"),le(t,"align-items","center"),le(t,"gap","10px"),le(h,"display","flex"),le(h,"gap","4px"),le(h,"align-items","center"),le(h,"margin-right","10px"),O(e,"class","preview-file")},m(m,p){x(m,e,p),b(e,t),b(t,n),Y(r,n,null),b(t,s),b(t,o),b(o,l),b(l,c),b(e,u),b(e,h),d&&d.m(h,null),f=!0},p(m,[p]){const g={};p&1&&(g.file=m[0]),r.$set(g),(!f||p&1)&&a!==(a=m[0].filename+"")&&K(c,a),m[1]?d?(d.p(m,p),p&2&&T(d,1)):(d=C1(m),d.c(),T(d,1),d.m(h,null)):d&&(Oe(),R(d,1,1,()=>{d=null}),be())},i(m){f||(T(r.$$.fragment,m),T(d),f=!0)},o(m){R(r.$$.fragment,m),R(d),f=!1},d(m){m&&P(e),z(r),d&&d.d()}}}function NE(i,e,t){const n=nn();let{file:r}=e,{hasDelete:s=!1}=e;function o(l){l.preventDefault(),n("remove_file",r.id)}return i.$$set=l=>{"file"in l&&t(0,r=l.file),"hasDelete"in l&&t(1,s=l.hasDelete)},[r,s,o]}class Vy extends oe{constructor(e){super(),se(this,e,NE,IE,re,{file:0,hasDelete:1})}}function P1(i,e,t){const n=i.slice();return n[10]=e[t],n}function A1(i){let e,t,n;return t=new rh({props:{value:"",indeterminate:i[0].length>0&&i[0].length<i[1].length,checked:i[0].length===i[1].length}}),t.$on("change",i[4]),{c(){e=y("th"),V(t.$$.fragment)},m(r,s){x(r,e,s),Y(t,e,null),n=!0},p(r,s){const o={};s&3&&(o.indeterminate=r[0].length>0&&r[0].length<r[1].length),s&3&&(o.checked=r[0].length===r[1].length),t.$set(o)},i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){R(t.$$.fragment,r),n=!1},d(r){r&&P(e),z(t)}}}function x1(i){let e,t;function n(...s){return i[8](i[10],...s)}function r(){return i[9](i[10])}return e=new rh({props:{checked:i[0].find(n),value:i[10]}}),e.$on("change",r),{c(){V(e.$$.fragment)},m(s,o){Y(e,s,o),t=!0},p(s,o){i=s;const l={};o&3&&(l.checked=i[0].find(n)),o&2&&(l.value=i[10]),e.$set(l)},i(s){t||(T(e.$$.fragment,s),t=!0)},o(s){R(e.$$.fragment,s),t=!1},d(s){z(e,s)}}}function T1(i){let e,t=i[10].width+"x"+i[10].height,n;return{c(){e=y("span"),n=W(t)},m(r,s){x(r,e,s),b(e,n)},p(r,s){s&2&&t!==(t=r[10].width+"x"+r[10].height)&&K(n,t)},d(r){r&&P(e)}}}function Q1(i,e){let t,n,r,s,o,l,a,c,u=e[10].filename+"",h,f,d,m=(e[10].size/1024).toFixed(1)+"",p,g,v,w,S,_,k,A,C,Q=e[2]&&x1(e);l=new Xo({props:{file:e[10],size:e[10].width>0?"medium":"small"}});let M=e[10].width>0&&T1(e);return{key:i,first:null,c(){t=y("tr"),n=y("td"),r=y("div"),Q&&Q.c(),s=D(),o=y("div"),V(l.$$.fragment),a=D(),c=y("div"),h=W(u),f=D(),d=y("span"),p=W(m),g=W("kB"),v=D(),M&&M.c(),w=D(),S=y("a"),_=W("Download"),A=D(),O(S,"href",k=Gi(e[3],e[10])),O(S,"target","_blank"),O(o,"class","file-table-row"),O(r,"class","title-td-contents"),O(n,"class","title-td"),this.first=t},m(L,N){x(L,t,N),b(t,n),b(n,r),Q&&Q.m(r,null),b(r,s),b(r,o),Y(l,o,null),b(o,a),b(o,c),b(c,h),b(c,f),b(c,d),b(d,p),b(d,g),b(c,v),M&&M.m(c,null),b(c,w),b(c,S),b(S,_),b(t,A),C=!0},p(L,N){e=L,e[2]?Q?(Q.p(e,N),N&4&&T(Q,1)):(Q=x1(e),Q.c(),T(Q,1),Q.m(r,s)):Q&&(Oe(),R(Q,1,1,()=>{Q=null}),be());const B={};N&2&&(B.file=e[10]),N&2&&(B.size=e[10].width>0?"medium":"small"),l.$set(B),(!C||N&2)&&u!==(u=e[10].filename+"")&&K(h,u),(!C||N&2)&&m!==(m=(e[10].size/1024).toFixed(1)+"")&&K(p,m),e[10].width>0?M?M.p(e,N):(M=T1(e),M.c(),M.m(c,w)):M&&(M.d(1),M=null),(!C||N&2&&k!==(k=Gi(e[3],e[10])))&&O(S,"href",k)},i(L){C||(T(Q),T(l.$$.fragment,L),C=!0)},o(L){R(Q),R(l.$$.fragment,L),C=!1},d(L){L&&P(t),Q&&Q.d(),z(l),M&&M.d()}}}function ZE(i){let e,t,n,r,s,o,l,a,c=[],u=new Map,h,f=i[2]&&A1(i),d=fe(i[1]);const m=p=>p[10].id;for(let p=0;p<d.length;p+=1){let g=P1(i,d,p),v=m(g);u.set(v,c[p]=Q1(v,g))}return{c(){e=y("div"),t=y("table"),n=y("thead"),r=y("tr"),f&&f.c(),s=D(),o=y("th"),l=D(),a=y("tbody");for(let p=0;p<c.length;p+=1)c[p].c();O(e,"class","table mt-5")},m(p,g){x(p,e,g),b(e,t),b(t,n),b(n,r),f&&f.m(r,null),b(r,s),b(r,o),b(t,l),b(t,a);for(let v=0;v<c.length;v+=1)c[v]&&c[v].m(a,null);h=!0},p(p,[g]){p[2]?f?(f.p(p,g),g&4&&T(f,1)):(f=A1(p),f.c(),T(f,1),f.m(r,s)):f&&(Oe(),R(f,1,1,()=>{f=null}),be()),g&47&&(d=fe(p[1]),Oe(),c=Ti(c,g,m,1,p,d,u,a,Jr,Q1,null,P1),be())},i(p){if(!h){T(f);for(let g=0;g<d.length;g+=1)T(c[g]);h=!0}},o(p){R(f);for(let g=0;g<c.length;g+=1)R(c[g]);h=!1},d(p){p&&P(e),f&&f.d();for(let g=0;g<c.length;g+=1)c[g].d()}}}function BE(i,e,t){const n=Ue("channel");let{files:r=[]}=e,{selected:s=[]}=e,{isWritable:o=!0}=e;function l(d){t(0,s=c(d,r,s))}function a(d){t(0,s=u(d,s))}const c=(d,m,p)=>p.length===m.length?[]:(d.currentTarget.checked=p.length>0,m),u=(d,m)=>m.find(g=>g.id===d.id)?m.filter(g=>g.id!==d.id):[...m,d],h=(d,m)=>m.id===d.id,f=d=>a(d);return i.$$set=d=>{"files"in d&&t(1,r=d.files),"selected"in d&&t(0,s=d.selected),"isWritable"in d&&t(2,o=d.isWritable)},[s,r,o,n,l,a,c,u,h,f]}class WE extends oe{constructor(e){super(),se(this,e,BE,ZE,re,{files:1,selected:0,isWritable:2,toggleAll:6,selectFile:7})}get toggleAll(){return this.$$.ctx[6]}get selectFile(){return this.$$.ctx[7]}}function M1(i,e,t){const n=i.slice();return n[14]=e[t],n}function XE(i){let e,t,n,r,s,o,l,a,c;return{c(){e=y("button"),t=W("Insert"),r=D(),s=y("button"),o=W("Replace"),O(e,"type","button"),O(e,"class","button"),e.disabled=n=i[3].length===0,O(s,"type","button"),O(s,"class","button"),s.disabled=l=i[3].length===0},m(u,h){x(u,e,h),b(e,t),x(u,r,h),x(u,s,h),b(s,o),a||(c=[G(e,"click",i[6]),G(s,"click",i[7])],a=!0)},p(u,h){h&8&&n!==(n=u[3].length===0)&&(e.disabled=n),h&8&&l!==(l=u[3].length===0)&&(s.disabled=l)},i:U,o:U,d(u){u&&(P(e),P(r),P(s)),a=!1,ht(c)}}}function FE(i){let e,t;return e=new ur({props:{$$slots:{button:[zE],default:[YE]},$$scope:{ctx:i}}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&131072&&(s.$$scope={dirty:r,ctx:n}),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function E1(i){let e,t,n;function r(...s){return i[9](i[14],...s)}return{c(){e=y("button"),e.textContent=`${i[14].name}`,O(e,"class","dropdown-item button")},m(s,o){x(s,e,o),t||(n=G(e,"click",r),t=!0)},p(s,o){i=s},d(s){s&&P(e),t=!1,n()}}}function YE(i){let e,t=fe(i[5].imagePresets),n=[];for(let r=0;r<t.length;r+=1)n[r]=E1(M1(i,t,r));return{c(){for(let r=0;r<n.length;r+=1)n[r].c();e=Ie()},m(r,s){for(let o=0;o<n.length;o+=1)n[o]&&n[o].m(r,s);x(r,e,s)},p(r,s){if(s&96){t=fe(r[5].imagePresets);let o;for(o=0;o<t.length;o+=1){const l=M1(r,t,o);n[o]?n[o].p(l,s):(n[o]=E1(l),n[o].c(),n[o].m(e.parentNode,e))}for(;o<n.length;o+=1)n[o].d(1);n.length=t.length}},d(r){r&&P(e),Ot(n,r)}}}function zE(i){let e;return{c(){e=y("div"),e.textContent="Insert Preset",O(e,"slot","button")},m(t,n){x(t,e,n)},p:U,d(t){t&&P(e)}}}function R1(i){let e,t=i[3].length+"",n,r;return{c(){e=y("span"),n=W(t),r=W(" records selected"),O(e,"class","")},m(s,o){x(s,e,o),b(e,n),b(e,r)},p(s,o){o&8&&t!==(t=s[3].length+"")&&K(n,t)},d(s){s&&P(e)}}}function VE(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p;const g=[FE,XE],v=[];function w(A,C){return A[0]?0:1}n=w(i),r=v[n]=g[n](i);let S=i[3].length>0&&R1(i);a=new ut({props:{icon:"close"}});function _(A){i[10](A)}let k={files:i[4]};return i[3]!==void 0&&(k.selected=i[3]),h=new WE({props:k}),Ce.push(()=>nt(h,"selected",_)),{c(){e=y("dialog"),t=y("div"),r.c(),s=D(),S&&S.c(),o=D(),l=y("button"),V(a.$$.fragment),c=D(),u=y("div"),V(h.$$.fragment),O(l,"type","button"),O(l,"class","button close"),O(l,"aria-label","Close"),O(t,"class","dialog-header"),O(u,"class","dialog-body")},m(A,C){x(A,e,C),b(e,t),v[n].m(t,null),b(t,s),S&&S.m(t,null),b(t,o),b(t,l),Y(a,l,null),b(e,c),b(e,u),Y(h,u,null),i[11](e),d=!0,m||(p=G(l,"click",Ln(i[1])),m=!0)},p(A,[C]){let Q=n;n=w(A),n===Q?v[n].p(A,C):(Oe(),R(v[Q],1,1,()=>{v[Q]=null}),be(),r=v[n],r?r.p(A,C):(r=v[n]=g[n](A),r.c()),T(r,1),r.m(t,s)),A[3].length>0?S?S.p(A,C):(S=R1(A),S.c(),S.m(t,o)):S&&(S.d(1),S=null);const M={};C&16&&(M.files=A[4]),!f&&C&8&&(f=!0,M.selected=A[3],st(()=>f=!1)),h.$set(M)},i(A){d||(T(r),T(a.$$.fragment,A),T(h.$$.fragment,A),d=!0)},o(A){R(r),R(a.$$.fragment,A),R(h.$$.fragment,A),d=!1},d(A){A&&P(e),v[n].d(),S&&S.d(),z(a),z(h),i[11](null),m=!1,p()}}}function UE(i,e,t){let n,r,s,{presetMode:o=!1}=e;const l=nn(),a=Ue("channel");function c(v){v&&v.preventDefault(),s.close(),t(3,r=[])}function u(v){fetch(a.lucentUrl+"/records/files/?recordId="+v).then(w=>w.json()).then(w=>{t(4,n=w)}).catch(w=>console.log(w))}function h(v,w){v.preventDefault(),l("insert_files",{files:r,preset:w})}function f(v){v.preventDefault(),l("replace_files",r)}function d(v){s.showModal(),u(v)}const m=(v,w)=>h(w,v);function p(v){r=v,t(3,r)}function g(v){Ce[v?"unshift":"push"](()=>{s=v,t(2,s)})}return i.$$set=v=>{"presetMode"in v&&t(0,o=v.presetMode)},t(4,n=[]),t(3,r=[]),[o,c,s,r,n,a,h,f,d,m,p,g]}class Uy extends oe{constructor(e){super(),se(this,e,UE,VE,re,{presetMode:0,close:1,open:8})}get close(){return this.$$.ctx[1]}get open(){return this.$$.ctx[8]}}function jE(i){let e,t,n,r,s,o,l,a,c,u;return n=new ut({props:{icon:"upload"}}),{c(){e=y("fieldset"),t=y("label"),V(n.$$.fragment),r=D(),s=y("span"),o=W(`
Upload file
`),l=y("input"),O(s,"class","spinner-border spinner-border-sm"),O(s,"role","status"),O(s,"aria-hidden","true"),O(l,"class","form-control"),O(l,"type","file"),O(l,"id","formFile"),l.multiple=!0,O(l,"accept",qE),l.disabled=i[0],l.hidden=!0,O(t,"class","button primary btn-spinner"),O(e,"class","upload-button"),e.disabled=i[0]},m(h,f){x(h,e,f),b(e,t),Y(n,t,null),b(t,r),b(t,s),b(t,o),b(t,l),a=!0,c||(u=G(l,"input",i[1]),c=!0)},p(h,[f]){(!a||f&1)&&(l.disabled=h[0]),(!a||f&1)&&(e.disabled=h[0])},i(h){a||(T(n.$$.fragment,h),a=!0)},o(h){R(n.$$.fragment,h),a=!1},d(h){h&&P(e),z(n),c=!1,u()}}}let qE="";function GE(i,e,t){const n=nn(),r=Ue("channel");let{recordId:s}=e,o=[],l=!1;function a(c){t(0,l=!0),o=c.target.files?[...c.target.files]:[];let u=new FormData;u.append("recordId",s),Array.from(o).forEach(function(h){u.append("files[]",h)}),n("beforeUpload",o),fetch(r.lucentUrl+"/files/upload",{method:"POST",body:u,headers:{"X-CSRF-TOKEN":document.querySelector('meta[name="csrf-token"]').content}}).then(h=>h.json()).then(h=>{h.error?n("uploadError",h.error):n("uploadComplete",h),t(0,l=!1)})}return i.$$set=c=>{"recordId"in c&&t(2,s=c.recordId)},[l,a,s]}class jy extends oe{constructor(e){super(),se(this,e,GE,jE,re,{recordId:2})}}function D1(i,e,t){const n=i.slice();return n[11]=e[t],n}function $1(i){let e,t;return e=new Xy({props:{sortableClass:"mt-3",$$slots:{default:[HE]},$$scope:{ctx:i}}}),e.$on("update",i[4]),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&16385&&(s.$$scope={dirty:r,ctx:n}),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function L1(i,e){let t,n,r,s;return n=new Vy({props:{file:e[11],hasDelete:!0}}),n.$on("remove_file",e[3]),{key:i,first:null,c(){t=y("div"),V(n.$$.fragment),r=D(),this.first=t},m(o,l){x(o,t,l),Y(n,t,null),b(t,r),s=!0},p(o,l){e=o;const a={};l&1&&(a.file=e[11]),n.$set(a)},i(o){s||(T(n.$$.fragment,o),s=!0)},o(o){R(n.$$.fragment,o),s=!1},d(o){o&&P(t),z(n)}}}function HE(i){let e=[],t=new Map,n,r,s=fe(i[0]??[]);const o=l=>l[11].id;for(let l=0;l<s.length;l+=1){let a=D1(i,s,l),c=o(a);t.set(c,e[l]=L1(c,a))}return{c(){for(let l=0;l<e.length;l+=1)e[l].c();n=Ie()},m(l,a){for(let c=0;c<e.length;c+=1)e[c]&&e[c].m(l,a);x(l,n,a),r=!0},p(l,a){a&9&&(s=fe(l[0]??[]),Oe(),e=Ti(e,a,o,1,l,s,t,n.parentNode,Jr,L1,n,D1),be())},i(l){if(!r){for(let a=0;a<s.length;a+=1)T(e[a]);r=!0}},o(l){for(let a=0;a<e.length;a+=1)R(e[a]);r=!1},d(l){l&&P(n);for(let a=0;a<e.length;a+=1)e[a].d(l)}}}function KE(i){let e,t,n,r,s,o,l,a,c,u,h,f;n=new ut({props:{icon:"photo-film"}}),o=new jy({props:{recordId:i[1].id}}),o.$on("uploadComplete",i[7]);let d=i[0].length>0&&$1(i),m={};return c=new Uy({props:m}),i[10](c),c.$on("insert_files",i[5]),c.$on("replace_files",i[6]),{c(){e=y("div"),t=y("button"),V(n.$$.fragment),r=W(" Browse"),s=D(),V(o.$$.fragment),l=D(),d&&d.c(),a=D(),V(c.$$.fragment),O(t,"class","button"),O(e,"class","mb-0"),le(e,"display","flex"),le(e,"align-items","start"),le(e,"justify-content","start"),le(e,"gap","6px")},m(p,g){x(p,e,g),b(e,t),Y(n,t,null),b(t,r),b(e,s),Y(o,e,null),x(p,l,g),d&&d.m(p,g),x(p,a,g),Y(c,p,g),u=!0,h||(f=G(t,"click",i[8]),h=!0)},p(p,[g]){const v={};g&2&&(v.recordId=p[1].id),o.$set(v),p[0].length>0?d?(d.p(p,g),g&1&&T(d,1)):(d=$1(p),d.c(),T(d,1),d.m(a.parentNode,a)):d&&(Oe(),R(d,1,1,()=>{d=null}),be());const w={};c.$set(w)},i(p){u||(T(n.$$.fragment,p),T(o.$$.fragment,p),T(d),T(c.$$.fragment,p),u=!0)},o(p){R(n.$$.fragment,p),R(o.$$.fragment,p),R(d),R(c.$$.fragment,p),u=!1},d(p){p&&(P(e),P(l),P(a)),z(n),z(o),d&&d.d(p),i[10](null),z(c,p),h=!1,f()}}}function JE(i,e,t){let{field:n}=e,{record:r}=e,{value:s=[]}=e,o;function l(m){m.preventDefault(),t(0,s=s.filter(p=>p.id!==m.detail))}async function a(m){t(0,s=await Sy(s,m.detail.source,m.detail.target))}function c(m){m.preventDefault(),o.close(),t(0,s=[...s??[],...m.detail.files??[]])}function u(m){m.preventDefault(),o.close(),t(0,s=m.detail??[])}function h(m){t(0,s=[...s,...m.detail])}function f(m){m.preventDefault(),o.open(r.id)}function d(m){Ce[m?"unshift":"push"](()=>{o=m,t(2,o)})}return i.$$set=m=>{"field"in m&&t(9,n=m.field),"record"in m&&t(1,r=m.record),"value"in m&&t(0,s=m.value)},[s,r,o,l,a,c,u,h,f,n,d]}class eR extends oe{constructor(e){super(),se(this,e,JE,KE,re,{field:9,record:1,value:0})}}function I1(i){let e,t;return{c(){e=y("div"),t=W(i[5]),O(e,"class","invalid-feedback d-block")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&32&&K(t,n[5])},d(n){n&&P(e)}}}function tR(i){let e,t,n,r,s,o,l=i[5]&&I1(i);return{c(){e=y("div"),t=y("textarea"),r=D(),l&&l.c(),O(t,"id",i[3]),O(t,"class","form-control svelte-1er4ovm"),O(t,"rows","2"),t.readOnly=n=i[1].readonly&&!i[2],Ae(t,"is-invalid",i[5]),O(e,"class","mb-0")},m(a,c){x(a,e,c),b(e,t),Le(t,i[0]),i[8](t),b(e,r),l&&l.m(e,null),s||(o=[G(t,"input",i[7]),G(t,"input",kd),G(t,"focus",kd)],s=!0)},p(a,[c]){c&8&&O(t,"id",a[3]),c&6&&n!==(n=a[1].readonly&&!a[2])&&(t.readOnly=n),c&1&&Le(t,a[0]),c&32&&Ae(t,"is-invalid",a[5]),a[5]?l?l.p(a,c):(l=I1(a),l.c(),l.m(e,null)):l&&(l.d(1),l=null)},i:U,o:U,d(a){a&&P(e),i[8](null),l&&l.d(),s=!1,ht(o)}}}function kd(i){let e;i.target?e=i.target:e=i,e.style.overflow="hidden",e.style.height="1px",e.style.height=+e.scrollHeight+"px"}function nR(i,e,t){let n,{field:r}=e,{value:s}=e,{isCreateMode:o}=e,{validationErrors:l}=e,a,{id:c}=e;xi(()=>{kd(a)});function u(){s=this.value,t(0,s)}function h(f){Ce[f?"unshift":"push"](()=>{a=f,t(4,a)})}return i.$$set=f=>{"field"in f&&t(1,r=f.field),"value"in f&&t(0,s=f.value),"isCreateMode"in f&&t(2,o=f.isCreateMode),"validationErrors"in f&&t(6,l=f.validationErrors),"id"in f&&t(3,c=f.id)},i.$$.update=()=>{i.$$.dirty&66&&t(5,n=In(l,r.name))},[s,r,o,c,a,n,l,u,h]}class qy extends oe{constructor(e){super(),se(this,e,nR,tR,re,{field:1,value:0,isCreateMode:2,validationErrors:6,id:3})}}function N1(i){let e,t;return{c(){e=y("div"),t=W(i[6]),O(e,"class","invalid-feedback d-block")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&64&&K(t,n[6])},d(n){n&&P(e)}}}function iR(i){let e,t,n,r,s,o,l,a,c=i[6]&&N1(i);return{c(){e=y("div"),t=y("input"),r=D(),s=y("span"),s.textContent=`Dates are displayed according to your timezone: ${i[7]}`,o=D(),c&&c.c(),O(t,"type","text"),O(t,"id",i[3]),O(t,"class","form-control"),O(t,"autocomplete","off"),t.readOnly=n=i[1].readonly&&!i[2],Ae(t,"is-invalid",i[6]),O(s,"class","system-help-text"),O(e,"class","mb-0")},m(u,h){x(u,e,h),b(e,t),Le(t,i[0]),i[10](t),b(e,r),b(e,s),b(e,o),c&&c.m(e,null),i[11](e),l||(a=G(t,"input",i[9]),l=!0)},p(u,[h]){h&8&&O(t,"id",u[3]),h&6&&n!==(n=u[1].readonly&&!u[2])&&(t.readOnly=n),h&1&&t.value!==u[0]&&Le(t,u[0]),h&64&&Ae(t,"is-invalid",u[6]),u[6]?c?c.p(u,h):(c=N1(u),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i:U,o:U,d(u){u&&P(e),i[10](null),c&&c.d(),i[11](null),l=!1,a()}}}function rR(i,e,t){let n,{field:r}=e,{value:s}=e,{isCreateMode:o}=e,{validationErrors:l}=e;const a=Intl.DateTimeFormat().resolvedOptions().timeZone;let{id:c}=e,u,h,f={appendTo:u,static:!0,allowInput:!0,altInput:!0,altFormat:"Y-m-d H:i:S",dateFormat:"Z",enableTime:!0,time_24hr:!0,enableSeconds:!0};r.min&&(f.minDate=r.min),r.max&&(f.maxDate=r.max),xi(()=>{(!r.readonly||o)&&Yt(h,f)});function d(){s=this.value,t(0,s)}function m(g){Ce[g?"unshift":"push"](()=>{h=g,t(5,h)})}function p(g){Ce[g?"unshift":"push"](()=>{u=g,t(4,u)})}return i.$$set=g=>{"field"in g&&t(1,r=g.field),"value"in g&&t(0,s=g.value),"isCreateMode"in g&&t(2,o=g.isCreateMode),"validationErrors"in g&&t(8,l=g.validationErrors),"id"in g&&t(3,c=g.id)},i.$$.update=()=>{i.$$.dirty&258&&t(6,n=In(l,r.name))},[s,r,o,c,u,h,n,a,l,d,m,p]}class sR extends oe{constructor(e){super(),se(this,e,rR,iR,re,{field:1,value:0,isCreateMode:2,validationErrors:8,id:3})}}function oR(i){let e,t,n,r,s,o,l,a,c,u,h;n=new ut({props:{icon:"photo-film"}}),o=new jy({props:{recordId:i[0].id}}),o.$on("uploadComplete",lR);let f={presetMode:!0};return a=new Uy({props:f}),i[7](a),a.$on("insert_files",i[3]),a.$on("replace_files",i[4]),{c(){e=y("div"),t=y("button"),V(n.$$.fragment),r=W(" Browse"),s=D(),V(o.$$.fragment),l=D(),V(a.$$.fragment),O(t,"class","button"),O(e,"class","mb-0"),le(e,"display","flex"),le(e,"align-items","start"),le(e,"justify-content","start"),le(e,"gap","6px")},m(d,m){x(d,e,m),b(e,t),Y(n,t,null),b(t,r),b(e,s),Y(o,e,null),x(d,l,m),Y(a,d,m),c=!0,u||(h=G(t,"click",i[2]),u=!0)},p(d,[m]){const p={};m&1&&(p.recordId=d[0].id),o.$set(p);const g={};a.$set(g)},i(d){c||(T(n.$$.fragment,d),T(o.$$.fragment,d),T(a.$$.fragment,d),c=!0)},o(d){R(n.$$.fragment,d),R(o.$$.fragment,d),R(a.$$.fragment,d),c=!1},d(d){d&&(P(e),P(l)),z(n),z(o),i[7](null),z(a,d),u=!1,h()}}}function lR(i){}function aR(i,e,t){Ue("channel");let{field:n}=e,{record:r}=e,{onFilesInserted:s}=e,o;function l(h){h.preventDefault(),o.open(r.id)}function a(h){h.preventDefault(),s(h),o.close()}function c(h){h.preventDefault(),o.close()}function u(h){Ce[h?"unshift":"push"](()=>{o=h,t(1,o)})}return i.$$set=h=>{"field"in h&&t(5,n=h.field),"record"in h&&t(0,r=h.record),"onFilesInserted"in h&&t(6,s=h.onFilesInserted)},[r,o,l,a,c,n,s,u]}class Gy extends oe{constructor(e){super(),se(this,e,aR,oR,re,{field:5,record:0,onFilesInserted:6})}}var cR="2.1.18";const _s="[data-trix-attachment]",jm={preview:{presentation:"gallery",caption:{name:!0,size:!0}},file:{caption:{size:!0}}},Sn={default:{tagName:"div",parse:!1},quote:{tagName:"blockquote",nestable:!0},heading1:{tagName:"h1",terminal:!0,breakOnReturn:!0,group:!1},code:{tagName:"pre",terminal:!0,htmlAttributes:["language"],text:{plaintext:!0}},bulletList:{tagName:"ul",parse:!1},bullet:{tagName:"li",listAttribute:"bulletList",group:!1,nestable:!0,test(i){return Z1(i.parentNode)===Sn[this.listAttribute].tagName}},numberList:{tagName:"ol",parse:!1},number:{tagName:"li",listAttribute:"numberList",group:!1,nestable:!0,test(i){return Z1(i.parentNode)===Sn[this.listAttribute].tagName}},attachmentGallery:{tagName:"div",exclusive:!0,terminal:!0,parse:!1,group:!1}},Z1=i=>{var e;return i==null||(e=i.tagName)===null||e===void 0?void 0:e.toLowerCase()},B1=navigator.userAgent.match(/android\s([0-9]+.*Chrome)/i),Gh=B1&&parseInt(B1[1]);var Da={composesExistingText:/Android.*Chrome/.test(navigator.userAgent),recentAndroid:Gh&&Gh>12,samsungAndroid:Gh&&navigator.userAgent.match(/Android.*SM-/),forcesObjectResizing:/Trident.*rv:11/.test(navigator.userAgent),supportsInputEvents:typeof InputEvent<"u"&&["data","getTargetRanges","inputType"].every(i=>i in InputEvent.prototype)},Hy={ADD_ATTR:["language"],SAFE_FOR_XML:!1,RETURN_DOM:!0},Ve={attachFiles:"Attach Files",bold:"Bold",bullets:"Bullets",byte:"Byte",bytes:"Bytes",captionPlaceholder:"Add a caption…",code:"Code",heading1:"Heading",indent:"Increase Level",italic:"Italic",link:"Link",numbers:"Numbers",outdent:"Decrease Level",quote:"Quote",redo:"Redo",remove:"Remove",strike:"Strikethrough",undo:"Undo",unlink:"Unlink",url:"URL",urlPlaceholder:"Enter a URL…",GB:"GB",KB:"KB",MB:"MB",PB:"PB",TB:"TB"};const uR=[Ve.bytes,Ve.KB,Ve.MB,Ve.GB,Ve.TB,Ve.PB];var Ky={prefix:"IEC",precision:2,formatter(i){switch(i){case 0:return"0 ".concat(Ve.bytes);case 1:return"1 ".concat(Ve.byte);default:let e;this.prefix==="SI"?e=1e3:this.prefix==="IEC"&&(e=1024);const t=Math.floor(Math.log(i)/Math.log(e)),n=(i/Math.pow(e,t)).toFixed(this.precision).replace(/0*$/,"").replace(/\.$/,"");return"".concat(n," ").concat(uR[t])}}};const oh="\uFEFF",Rr=" ",Jy=function(i){for(const e in i){const t=i[e];this[e]=t}return this},qm=document.documentElement,hR=qm.matches,Zt=function(i){let{onElement:e,matchingSelector:t,withCallback:n,inPhase:r,preventDefault:s,times:o}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const l=e||qm,a=t,c=r==="capturing",u=function(h){o!=null&&--o==0&&u.destroy();const f=Yr(h.target,{matchingSelector:a});f!=null&&(n==null||n.call(f,h,f),s&&h.preventDefault())};return u.destroy=()=>l.removeEventListener(i,u,c),l.addEventListener(i,u,c),u},ek=function(i){let{bubbles:e,cancelable:t,attributes:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};e=e!==!1,t=t!==!1;const r=document.createEvent("Events");return r.initEvent(i,e,t),n!=null&&Jy.call(r,n),r},Il=function(i){let{onElement:e,bubbles:t,cancelable:n,attributes:r}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const s=e??qm,o=ek(i,{bubbles:t,cancelable:n,attributes:r});return s.dispatchEvent(o)},tk=function(i,e){if((i==null?void 0:i.nodeType)===1)return hR.call(i,e)},Yr=function(i){let{matchingSelector:e,untilNode:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};for(;i&&i.nodeType!==Node.ELEMENT_NODE;)i=i.parentNode;if(i!=null){if(e==null)return i;if(i.closest&&t==null)return i.closest(e);for(;i&&i!==t;){if(tk(i,e))return i;i=i.parentNode}}},Gm=i=>document.activeElement!==i&&ws(i,document.activeElement),ws=function(i,e){if(i&&e)for(;e;){if(e===i)return!0;e=e.parentNode}},Hh=function(i){var e;if((e=i)===null||e===void 0||!e.parentNode)return;let t=0;for(i=i.previousSibling;i;)t++,i=i.previousSibling;return t},zr=i=>{var e;return i==null||(e=i.parentNode)===null||e===void 0?void 0:e.removeChild(i)},vu=function(i){let{onlyNodesOfType:e,usingFilter:t,expandEntityReferences:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=(()=>{switch(e){case"element":return NodeFilter.SHOW_ELEMENT;case"text":return NodeFilter.SHOW_TEXT;case"comment":return NodeFilter.SHOW_COMMENT;default:return NodeFilter.SHOW_ALL}})();return document.createTreeWalker(i,r,t??null,n===!0)},kn=i=>{var e;return i==null||(e=i.tagName)===null||e===void 0?void 0:e.toLowerCase()},Ge=function(i){let e,t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof i=="object"?(n=i,i=n.tagName):n={attributes:n};const r=document.createElement(i);if(n.editable!=null&&(n.attributes==null&&(n.attributes={}),n.attributes.contenteditable=n.editable),n.attributes)for(e in n.attributes)t=n.attributes[e],r.setAttribute(e,t);if(n.style)for(e in n.style)t=n.style[e],r.style[e]=t;if(n.data)for(e in n.data)t=n.data[e],r.dataset[e]=t;return n.className&&n.className.split(" ").forEach(s=>{r.classList.add(s)}),n.textContent&&(r.textContent=n.textContent),n.childNodes&&[].concat(n.childNodes).forEach(s=>{r.appendChild(s)}),r};let il;const Nl=function(){if(il!=null)return il;il=[];for(const i in Sn){const e=Sn[i];e.tagName&&il.push(e.tagName)}return il},Kh=i=>fo(i==null?void 0:i.firstChild),Jh=function(i){let{strict:e}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{strict:!0};return e?fo(i):fo(i)||!fo(i.firstChild)&&function(t){return Nl().includes(kn(t))&&!Nl().includes(kn(t.firstChild))}(i)},fo=i=>fR(i)&&(i==null?void 0:i.data)==="block",fR=i=>(i==null?void 0:i.nodeType)===Node.COMMENT_NODE,mo=function(i){let{name:e}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(i)return Zl(i)?i.data===oh?!e||i.parentNode.dataset.trixCursorTarget===e:void 0:mo(i.firstChild)},Cs=i=>tk(i,_s),nk=i=>Zl(i)&&(i==null?void 0:i.data)==="",Zl=i=>(i==null?void 0:i.nodeType)===Node.TEXT_NODE,Hm={level2Enabled:!0,getLevel(){return this.level2Enabled&&Da.supportsInputEvents?2:0},pickFiles(i){const e=Ge("input",{type:"file",multiple:!0,hidden:!0,id:this.fileInputId});e.addEventListener("change",()=>{i(e.files),zr(e)}),zr(document.getElementById(this.fileInputId)),document.body.appendChild(e),e.click()}};var Fc={removeBlankTableCells:!1,tableCellSeparator:" | ",tableRowSeparator:`
`},xs={bold:{tagName:"strong",inheritable:!0,parser(i){const e=window.getComputedStyle(i);return e.fontWeight==="bold"||e.fontWeight>=600}},italic:{tagName:"em",inheritable:!0,parser:i=>window.getComputedStyle(i).fontStyle==="italic"},href:{groupTagName:"a",parser(i){const e="a:not(".concat(_s,")"),t=i.closest(e);if(t)return t.getAttribute("href")}},strike:{tagName:"del",inheritable:!0},frozen:{style:{backgroundColor:"highlight"}}},ik={getDefaultHTML:()=>`<div class="trix-button-row">
<span class="trix-button-group trix-button-group--text-tools" data-trix-button-group="text-tools">
<button type="button" class="trix-button trix-button--icon trix-button--icon-bold" data-trix-attribute="bold" data-trix-key="b" title="`.concat(Ve.bold,'" tabindex="-1">').concat(Ve.bold,`</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-italic" data-trix-attribute="italic" data-trix-key="i" title="`).concat(Ve.italic,'" tabindex="-1">').concat(Ve.italic,`</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-strike" data-trix-attribute="strike" title="`).concat(Ve.strike,'" tabindex="-1">').concat(Ve.strike,`</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-link" data-trix-attribute="href" data-trix-action="link" data-trix-key="k" title="`).concat(Ve.link,'" tabindex="-1">').concat(Ve.link,`</button>
</span>
<span class="trix-button-group trix-button-group--block-tools" data-trix-button-group="block-tools">
<button type="button" class="trix-button trix-button--icon trix-button--icon-heading-1" data-trix-attribute="heading1" title="`).concat(Ve.heading1,'" tabindex="-1">').concat(Ve.heading1,`</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-quote" data-trix-attribute="quote" title="`).concat(Ve.quote,'" tabindex="-1">').concat(Ve.quote,`</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-code" data-trix-attribute="code" title="`).concat(Ve.code,'" tabindex="-1">').concat(Ve.code,`</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-bullet-list" data-trix-attribute="bullet" title="`).concat(Ve.bullets,'" tabindex="-1">').concat(Ve.bullets,`</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-number-list" data-trix-attribute="number" title="`).concat(Ve.numbers,'" tabindex="-1">').concat(Ve.numbers,`</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-decrease-nesting-level" data-trix-action="decreaseNestingLevel" title="`).concat(Ve.outdent,'" tabindex="-1">').concat(Ve.outdent,`</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-increase-nesting-level" data-trix-action="increaseNestingLevel" title="`).concat(Ve.indent,'" tabindex="-1">').concat(Ve.indent,`</button>
</span>
<span class="trix-button-group trix-button-group--file-tools" data-trix-button-group="file-tools">
<button type="button" class="trix-button trix-button--icon trix-button--icon-attach" data-trix-action="attachFiles" title="`).concat(Ve.attachFiles,'" tabindex="-1">').concat(Ve.attachFiles,`</button>
</span>
<span class="trix-button-group-spacer"></span>
<span class="trix-button-group trix-button-group--history-tools" data-trix-button-group="history-tools">
<button type="button" class="trix-button trix-button--icon trix-button--icon-undo" data-trix-action="undo" data-trix-key="z" title="`).concat(Ve.undo,'" tabindex="-1">').concat(Ve.undo,`</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-redo" data-trix-action="redo" data-trix-key="shift+z" title="`).concat(Ve.redo,'" tabindex="-1">').concat(Ve.redo,`</button>
</span>
</div>
<div class="trix-dialogs" data-trix-dialogs>
<div class="trix-dialog trix-dialog--link" data-trix-dialog="href" data-trix-dialog-attribute="href">
<div class="trix-dialog__link-fields">
<input type="url" name="href" class="trix-input trix-input--dialog" placeholder="`).concat(Ve.urlPlaceholder,'" aria-label="').concat(Ve.url,`" data-trix-validate-href required data-trix-input>
<div class="trix-button-group">
<input type="button" class="trix-button trix-button--dialog" value="`).concat(Ve.link,`" data-trix-method="setAttribute">
<input type="button" class="trix-button trix-button--dialog" value="`).concat(Ve.unlink,`" data-trix-method="removeAttribute">
</div>
</div>
</div>
</div>`)};const Sd={interval:5e3};var $a=Object.freeze({__proto__:null,attachments:jm,blockAttributes:Sn,browser:Da,css:{attachment:"attachment",attachmentCaption:"attachment__caption",attachmentCaptionEditor:"attachment__caption-editor",attachmentMetadata:"attachment__metadata",attachmentMetadataContainer:"attachment__metadata-container",attachmentName:"attachment__name",attachmentProgress:"attachment__progress",attachmentSize:"attachment__size",attachmentToolbar:"attachment__toolbar",attachmentGallery:"attachment-gallery"},dompurify:Hy,fileSize:Ky,input:Hm,keyNames:{8:"backspace",9:"tab",13:"return",27:"escape",37:"left",39:"right",46:"delete",68:"d",72:"h",79:"o"},lang:Ve,parser:Fc,textAttributes:xs,toolbar:ik,undo:Sd});class Kt{static proxyMethod(e){const{name:t,toMethod:n,toProperty:r,optional:s}=dR(e);this.prototype[t]=function(){let o,l;var a,c;return n?l=s?(a=this[n])===null||a===void 0?void 0:a.call(this):this[n]():r&&(l=this[r]),s?(o=(c=l)===null||c===void 0?void 0:c[t],o?W1.call(o,l,arguments):void 0):(o=l[t],W1.call(o,l,arguments))}}}const dR=function(i){const e=i.match(mR);if(!e)throw new Error("can't parse @proxyMethod expression: ".concat(i));const t={name:e[4]};return e[2]!=null?t.toMethod=e[1]:t.toProperty=e[1],e[3]!=null&&(t.optional=!0),t},{apply:W1}=Function.prototype,mR=new RegExp("^(.+?)(\\(\\))?(\\?)?\\.(.+?)$");var ef,tf,nf;class sa extends Kt{static box(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return e instanceof this?e:this.fromUCS2String(e==null?void 0:e.toString())}static fromUCS2String(e){return new this(e,_d(e))}static fromCodepoints(e){return new this(Cd(e),e)}constructor(e,t){super(...arguments),this.ucs2String=e,this.codepoints=t,this.length=this.codepoints.length,this.ucs2Length=this.ucs2String.length}offsetToUCS2Offset(e){return Cd(this.codepoints.slice(0,Math.max(0,e))).length}offsetFromUCS2Offset(e){return _d(this.ucs2String.slice(0,Math.max(0,e))).length}slice(){return this.constructor.fromCodepoints(this.codepoints.slice(...arguments))}charAt(e){return this.slice(e,e+1)}isEqualTo(e){return this.constructor.box(e).ucs2String===this.ucs2String}toJSON(){return this.ucs2String}getCacheKey(){return this.ucs2String}toString(){return this.ucs2String}}const pR=((ef=Array.from)===null||ef===void 0?void 0:ef.call(Array,"👼").length)===1,gR=((tf=" ".codePointAt)===null||tf===void 0?void 0:tf.call(" ",0))!=null,OR=((nf=String.fromCodePoint)===null||nf===void 0?void 0:nf.call(String,32,128124))===" 👼";let _d,Cd;_d=pR&&gR?i=>Array.from(i).map(e=>e.codePointAt(0)):function(i){const e=[];let t=0;const{length:n}=i;for(;t<n;){let r=i.charCodeAt(t++);if(55296<=r&&r<=56319&&t<n){const s=i.charCodeAt(t++);(64512&s)==56320?r=((1023&r)<<10)+(1023&s)+65536:t--}e.push(r)}return e},Cd=OR?i=>String.fromCodePoint(...Array.from(i||[])):function(i){return(()=>{const e=[];return Array.from(i).forEach(t=>{let n="";t>65535&&(t-=65536,n+=String.fromCharCode(t>>>10&1023|55296),t=56320|1023&t),e.push(n+String.fromCharCode(t))}),e})().join("")};let bR=0;class Ns extends Kt{static fromJSONString(e){return this.fromJSON(JSON.parse(e))}constructor(){super(...arguments),this.id=++bR}hasSameConstructorAs(e){return this.constructor===(e==null?void 0:e.constructor)}isEqualTo(e){return this===e}inspect(){const e=[],t=this.contentsForInspection()||{};for(const n in t){const r=t[n];e.push("".concat(n,"=").concat(r))}return"#<".concat(this.constructor.name,":").concat(this.id).concat(e.length?" ".concat(e.join(", ")):"",">")}contentsForInspection(){}toJSONString(){return JSON.stringify(this)}toUTF16String(){return sa.box(this)}getCacheKey(){return this.id.toString()}}const Ts=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(i.length!==e.length)return!1;for(let t=0;t<i.length;t++)if(i[t]!==e[t])return!1;return!0},Km=function(i){const e=i.slice(0);for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.splice(...n),e},vR=/[\u05BE\u05C0\u05C3\u05D0-\u05EA\u05F0-\u05F4\u061B\u061F\u0621-\u063A\u0640-\u064A\u066D\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D5\u06E5\u06E6\u200F\u202B\u202E\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE72\uFE74\uFE76-\uFEFC]/,wR=function(){const i=Ge("input",{dir:"auto",name:"x",dirName:"x.dir"}),e=Ge("textarea",{dir:"auto",name:"y",dirName:"y.dir"}),t=Ge("form");t.appendChild(i),t.appendChild(e);const n=function(){try{return new FormData(t).has(e.dirName)}catch{return!1}}(),r=function(){try{return i.matches(":dir(ltr),:dir(rtl)")}catch{return!1}}();return n?function(s){return e.value=s,new FormData(t).get(e.dirName)}:r?function(s){return i.value=s,i.matches(":dir(rtl)")?"rtl":"ltr"}:function(s){const o=s.trim().charAt(0);return vR.test(o)?"rtl":"ltr"}}();let rf=null,sf=null,of=null,rc=null;const Pd=()=>(rf||(rf=kR().concat(yR())),rf),zt=i=>Sn[i],yR=()=>(sf||(sf=Object.keys(Sn)),sf),Ad=i=>xs[i],kR=()=>(of||(of=Object.keys(xs)),of),rk=function(i,e){SR(i).textContent=e.replace(/%t/g,i)},SR=function(i){const e=document.createElement("style");e.setAttribute("type","text/css"),e.setAttribute("data-tag-name",i.toLowerCase());const t=_R();return t&&e.setAttribute("nonce",t),document.head.insertBefore(e,document.head.firstChild),e},_R=function(){const i=X1("trix-csp-nonce")||X1("csp-nonce");if(i){const{nonce:e,content:t}=i;return e==""?t:e}},X1=i=>document.head.querySelector("meta[name=".concat(i,"]")),F1={"application/x-trix-feature-detection":"test"},sk=function(i){const e=i.getData("text/plain"),t=i.getData("text/html");if(!e||!t)return e==null?void 0:e.length;{const{body:n}=new DOMParser().parseFromString(t,"text/html");if(n.textContent===e)return!n.querySelector("*")}},ok=/Mac|^iP/.test(navigator.platform)?i=>i.metaKey:i=>i.ctrlKey,Jm=i=>setTimeout(i,1),lk=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const e={};for(const t in i){const n=i[t];e[t]=n}return e},Fo=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Object.keys(i).length!==Object.keys(e).length)return!1;for(const t in i)if(i[t]!==e[t])return!1;return!0},bt=function(i){if(i!=null)return Array.isArray(i)||(i=[i,i]),[Y1(i[0]),Y1(i[1]!=null?i[1]:i[0])]},or=function(i){if(i==null)return;const[e,t]=bt(i);return xd(e,t)},wu=function(i,e){if(i==null||e==null)return;const[t,n]=bt(i),[r,s]=bt(e);return xd(t,r)&&xd(n,s)},Y1=function(i){return typeof i=="number"?i:lk(i)},xd=function(i,e){return typeof i=="number"?i===e:Fo(i,e)};class ak extends Kt{constructor(){super(...arguments),this.update=this.update.bind(this),this.selectionManagers=[]}start(){this.started||(this.started=!0,document.addEventListener("selectionchange",this.update,!0))}stop(){if(this.started)return this.started=!1,document.removeEventListener("selectionchange",this.update,!0)}registerSelectionManager(e){if(!this.selectionManagers.includes(e))return this.selectionManagers.push(e),this.start()}unregisterSelectionManager(e){if(this.selectionManagers=this.selectionManagers.filter(t=>t!==e),this.selectionManagers.length===0)return this.stop()}notifySelectionManagersOfSelectionChange(){return this.selectionManagers.map(e=>e.selectionDidChange())}update(){this.notifySelectionManagersOfSelectionChange()}reset(){this.update()}}const Qs=new ak,ck=function(){const i=window.getSelection();if(i.rangeCount>0)return i},Bl=function(){var i;const e=(i=ck())===null||i===void 0?void 0:i.getRangeAt(0);if(e&&!CR(e))return e},uk=function(i){const e=window.getSelection();return e.removeAllRanges(),e.addRange(i),Qs.update()},CR=i=>z1(i.startContainer)||z1(i.endContainer),z1=i=>!Object.getPrototypeOf(i),kl=i=>i.replace(new RegExp("".concat(oh),"g"),"").replace(new RegExp("".concat(Rr),"g")," "),ep=new RegExp("[^\\S".concat(Rr,"]")),tp=i=>i.replace(new RegExp("".concat(ep.source),"g")," ").replace(/\ {2,}/g," "),V1=function(i,e){if(i.isEqualTo(e))return["",""];const t=lf(i,e),{length:n}=t.utf16String;let r;if(n){const{offset:s}=t,o=i.codepoints.slice(0,s).concat(i.codepoints.slice(s+n));r=lf(e,sa.fromCodepoints(o))}else r=lf(e,i);return[t.utf16String.toString(),r.utf16String.toString()]},lf=function(i,e){let t=0,n=i.length,r=e.length;for(;t<n&&i.charAt(t).isEqualTo(e.charAt(t));)t++;for(;n>t+1&&i.charAt(n-1).isEqualTo(e.charAt(r-1));)n--,r--;return{utf16String:i.slice(t,n),offset:t}};class Kn extends Ns{static fromCommonAttributesOfObjects(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];if(!e.length)return new this;let t=rl(e[0]),n=t.getKeys();return e.slice(1).forEach(r=>{n=t.getKeysCommonToHash(rl(r)),t=t.slice(n)}),t}static box(e){return rl(e)}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(...arguments),this.values=Yc(e)}add(e,t){return this.merge(PR(e,t))}remove(e){return new Kn(Yc(this.values,e))}get(e){return this.values[e]}has(e){return e in this.values}merge(e){return new Kn(AR(this.values,xR(e)))}slice(e){const t={};return Array.from(e).forEach(n=>{this.has(n)&&(t[n]=this.values[n])}),new Kn(t)}getKeys(){return Object.keys(this.values)}getKeysCommonToHash(e){return e=rl(e),this.getKeys().filter(t=>this.values[t]===e.values[t])}isEqualTo(e){return Ts(this.toArray(),rl(e).toArray())}isEmpty(){return this.getKeys().length===0}toArray(){if(!this.array){const e=[];for(const t in this.values){const n=this.values[t];e.push(e.push(t,n))}this.array=e.slice(0)}return this.array}toObject(){return Yc(this.values)}toJSON(){return this.toObject()}contentsForInspection(){return{values:JSON.stringify(this.values)}}}const PR=function(i,e){const t={};return t[i]=e,t},AR=function(i,e){const t=Yc(i);for(const n in e){const r=e[n];t[n]=r}return t},Yc=function(i,e){const t={};return Object.keys(i).sort().forEach(n=>{n!==e&&(t[n]=i[n])}),t},rl=function(i){return i instanceof Kn?i:new Kn(i)},xR=function(i){return i instanceof Kn?i.values:i};class np{static groupObjects(){let e,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],{depth:n,asTree:r}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};r&&n==null&&(n=0);const s=[];return Array.from(t).forEach(o=>{var l;if(e){var a,c,u;if((a=o.canBeGrouped)!==null&&a!==void 0&&a.call(o,n)&&(c=(u=e[e.length-1]).canBeGroupedWith)!==null&&c!==void 0&&c.call(u,o,n))return void e.push(o);s.push(new this(e,{depth:n,asTree:r})),e=null}(l=o.canBeGrouped)!==null&&l!==void 0&&l.call(o,n)?e=[o]:s.push(o)}),e&&s.push(new this(e,{depth:n,asTree:r})),s}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],{depth:t,asTree:n}=arguments.length>1?arguments[1]:void 0;this.objects=e,n&&(this.depth=t,this.objects=this.constructor.groupObjects(this.objects,{asTree:n,depth:this.depth+1}))}getObjects(){return this.objects}getDepth(){return this.depth}getCacheKey(){const e=["objectGroup"];return Array.from(this.getObjects()).forEach(t=>{e.push(t.getCacheKey())}),e.join("/")}}class TR extends Kt{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),this.objects={},Array.from(e).forEach(t=>{const n=JSON.stringify(t);this.objects[n]==null&&(this.objects[n]=t)})}find(e){const t=JSON.stringify(e);return this.objects[t]}}class QR{constructor(e){this.reset(e)}add(e){const t=U1(e);this.elements[t]=e}remove(e){const t=U1(e),n=this.elements[t];if(n)return delete this.elements[t],n}reset(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return this.elements={},Array.from(e).forEach(t=>{this.add(t)}),e}}const U1=i=>i.dataset.trixStoreKey;let yu=class extends Kt{isPerforming(){return this.performing===!0}hasPerformed(){return this.performed===!0}hasSucceeded(){return this.performed&&this.succeeded}hasFailed(){return this.performed&&!this.succeeded}getPromise(){return this.promise||(this.promise=new Promise((e,t)=>(this.performing=!0,this.perform((n,r)=>{this.succeeded=n,this.performing=!1,this.performed=!0,this.succeeded?e(r):t(r)})))),this.promise}perform(e){return e(!1)}release(){var e,t;(e=this.promise)===null||e===void 0||(t=e.cancel)===null||t===void 0||t.call(e),this.promise=null,this.performing=null,this.performed=null,this.succeeded=null}};yu.proxyMethod("getPromise().then"),yu.proxyMethod("getPromise().catch");class Zs extends Kt{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(...arguments),this.object=e,this.options=t,this.childViews=[],this.rootView=this}getNodes(){return this.nodes||(this.nodes=this.createNodes()),this.nodes.map(e=>e.cloneNode(!0))}invalidate(){var e;return this.nodes=null,this.childViews=[],(e=this.parentView)===null||e===void 0?void 0:e.invalidate()}invalidateViewForObject(e){var t;return(t=this.findViewForObject(e))===null||t===void 0?void 0:t.invalidate()}findOrCreateCachedChildView(e,t,n){let r=this.getCachedViewForObject(t);return r?this.recordChildView(r):(r=this.createChildView(...arguments),this.cacheViewForObject(r,t)),r}createChildView(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};t instanceof np&&(n.viewClass=e,e=MR);const r=new e(t,n);return this.recordChildView(r)}recordChildView(e){return e.parentView=this,e.rootView=this.rootView,this.childViews.push(e),e}getAllChildViews(){let e=[];return this.childViews.forEach(t=>{e.push(t),e=e.concat(t.getAllChildViews())}),e}findElement(){return this.findElementForObject(this.object)}findElementForObject(e){const t=e==null?void 0:e.id;if(t)return this.rootView.element.querySelector("[data-trix-id='".concat(t,"']"))}findViewForObject(e){for(const t of this.getAllChildViews())if(t.object===e)return t}getViewCache(){return this.rootView!==this?this.rootView.getViewCache():this.isViewCachingEnabled()?(this.viewCache||(this.viewCache={}),this.viewCache):void 0}isViewCachingEnabled(){return this.shouldCacheViews!==!1}enableViewCaching(){this.shouldCacheViews=!0}disableViewCaching(){this.shouldCacheViews=!1}getCachedViewForObject(e){var t;return(t=this.getViewCache())===null||t===void 0?void 0:t[e.getCacheKey()]}cacheViewForObject(e,t){const n=this.getViewCache();n&&(n[t.getCacheKey()]=e)}garbageCollectCachedViews(){const e=this.getViewCache();if(e){const t=this.getAllChildViews().concat(this).map(n=>n.object.getCacheKey());for(const n in e)t.includes(n)||delete e[n]}}}class MR extends Zs{constructor(){super(...arguments),this.objectGroup=this.object,this.viewClass=this.options.viewClass,delete this.options.viewClass}getChildViews(){return this.childViews.length||Array.from(this.objectGroup.getObjects()).forEach(e=>{this.findOrCreateCachedChildView(this.viewClass,e,this.options)}),this.childViews}createNodes(){const e=this.createContainerElement();return this.getChildViews().forEach(t=>{Array.from(t.getNodes()).forEach(n=>{e.appendChild(n)})}),[e]}createContainerElement(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.objectGroup.getDepth();return this.getChildViews()[0].createContainerElement(e)}}/*! @license DOMPurify 3.2.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.7/LICENSE */const{entries:hk,setPrototypeOf:j1,isFrozen:ER,getPrototypeOf:RR,getOwnPropertyDescriptor:DR}=Object;let{freeze:An,seal:hi,create:fk}=Object,{apply:Td,construct:Qd}=typeof Reflect<"u"&&Reflect;An||(An=function(i){return i}),hi||(hi=function(i){return i}),Td||(Td=function(i,e){for(var t=arguments.length,n=new Array(t>2?t-2:0),r=2;r<t;r++)n[r-2]=arguments[r];return i.apply(e,n)}),Qd||(Qd=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return new i(...t)});const sc=xn(Array.prototype.forEach),$R=xn(Array.prototype.lastIndexOf),q1=xn(Array.prototype.pop),sl=xn(Array.prototype.push),LR=xn(Array.prototype.splice),zc=xn(String.prototype.toLowerCase),af=xn(String.prototype.toString),cf=xn(String.prototype.match),ol=xn(String.prototype.replace),IR=xn(String.prototype.indexOf),NR=xn(String.prototype.trim),yi=xn(Object.prototype.hasOwnProperty),wn=xn(RegExp.prototype.test),ll=(G1=TypeError,function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return Qd(G1,e)});var G1;function xn(i){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Td(i,e,n)}}function Je(i,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:zc;j1&&j1(i,null);let n=e.length;for(;n--;){let r=e[n];if(typeof r=="string"){const s=t(r);s!==r&&(ER(e)||(e[n]=s),r=s)}i[r]=!0}return i}function ZR(i){for(let e=0;e<i.length;e++)yi(i,e)||(i[e]=null);return i}function nr(i){const e=fk(null);for(const[t,n]of hk(i))yi(i,t)&&(Array.isArray(n)?e[t]=ZR(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=nr(n):e[t]=n);return e}function al(i,e){for(;i!==null;){const t=DR(i,e);if(t){if(t.get)return xn(t.get);if(typeof t.value=="function")return xn(t.value)}i=RR(i)}return function(){return null}}const H1=An(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),uf=An(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","slot","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),hf=An(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),BR=An(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),ff=An(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),WR=An(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),K1=An(["#text"]),J1=An(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),df=An(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),e0=An(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),oc=An(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),XR=hi(/\{\{[\w\W]*|[\w\W]*\}\}/gm),FR=hi(/<%[\w\W]*|[\w\W]*%>/gm),YR=hi(/\$\{[\w\W]*/gm),zR=hi(/^data-[\-\w.\u00B7-\uFFFF]+$/),VR=hi(/^aria-[\-\w]+$/),dk=hi(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),UR=hi(/^(?:\w+script|data):/i),jR=hi(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),mk=hi(/^html$/i),qR=hi(/^[a-z][.\w]*(-[.\w]+)+$/i);var t0=Object.freeze({__proto__:null,ARIA_ATTR:VR,ATTR_WHITESPACE:jR,CUSTOM_ELEMENT:qR,DATA_ATTR:zR,DOCTYPE_NAME:mk,ERB_EXPR:FR,IS_ALLOWED_URI:dk,IS_SCRIPT_OR_DATA:UR,MUSTACHE_EXPR:XR,TMPLIT_EXPR:YR});const GR=1,HR=3,KR=7,JR=8,e4=9,t4=function(){return typeof window>"u"?null:window};var Ao=function i(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:t4();const t=Z=>i(Z);if(t.version="3.2.7",t.removed=[],!e||!e.document||e.document.nodeType!==e4||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,s=r.currentScript,{DocumentFragment:o,HTMLTemplateElement:l,Node:a,Element:c,NodeFilter:u,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:d,trustedTypes:m}=e,p=c.prototype,g=al(p,"cloneNode"),v=al(p,"remove"),w=al(p,"nextSibling"),S=al(p,"childNodes"),_=al(p,"parentNode");if(typeof l=="function"){const Z=n.createElement("template");Z.content&&Z.content.ownerDocument&&(n=Z.content.ownerDocument)}let k,A="";const{implementation:C,createNodeIterator:Q,createDocumentFragment:M,getElementsByTagName:L}=n,{importNode:N}=r;let B={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};t.isSupported=typeof hk=="function"&&typeof _=="function"&&C&&C.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:J,ERB_EXPR:te,TMPLIT_EXPR:ie,DATA_ATTR:ae,ARIA_ATTR:X,IS_SCRIPT_OR_DATA:ee,ATTR_WHITESPACE:Te,CUSTOM_ELEMENT:ve}=t0;let{IS_ALLOWED_URI:je}=t0,ne=null;const Ee=Je({},[...H1,...uf,...hf,...ff,...K1]);let Re=null;const xt=Je({},[...J1,...df,...e0,...oc]);let H=Object.seal(fk(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Pe=null,Ye=null,Tt=!0,yt=!0,wt=!1,Qt=!0,He=!1,Ut=!0,ct=!1,qe=!1,Mt=!1,ei=!1,ti=!1,Ri=!1,za=!0,qo=!1,ns=!0,vr=!1,pi={},wr=null;const Go=Je({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Va=null;const Ho=Je({},["audio","video","img","source","image","track"]);let Ko=null;const Ua=Je({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),is="http://www.w3.org/1998/Math/MathML",Ys="http://www.w3.org/2000/svg",gi="http://www.w3.org/1999/xhtml";let pt=gi,rs=!1,ss=null;const Ph=Je({},[is,Ys,gi],af);let er=Je({},["mi","mo","mn","ms","mtext"]),yr=Je({},["annotation-xml"]);const Oi=Je({},["title","style","font","a","script"]);let os=null;const Ah=["application/xhtml+xml","text/html"];let E=null,$=null;const F=n.createElement("form"),j=function(Z){return Z instanceof RegExp||Z instanceof Function},ce=function(){let Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!$||$!==Z){if(Z&&typeof Z=="object"||(Z={}),Z=nr(Z),os=Ah.indexOf(Z.PARSER_MEDIA_TYPE)===-1?"text/html":Z.PARSER_MEDIA_TYPE,E=os==="application/xhtml+xml"?af:zc,ne=yi(Z,"ALLOWED_TAGS")?Je({},Z.ALLOWED_TAGS,E):Ee,Re=yi(Z,"ALLOWED_ATTR")?Je({},Z.ALLOWED_ATTR,E):xt,ss=yi(Z,"ALLOWED_NAMESPACES")?Je({},Z.ALLOWED_NAMESPACES,af):Ph,Ko=yi(Z,"ADD_URI_SAFE_ATTR")?Je(nr(Ua),Z.ADD_URI_SAFE_ATTR,E):Ua,Va=yi(Z,"ADD_DATA_URI_TAGS")?Je(nr(Ho),Z.ADD_DATA_URI_TAGS,E):Ho,wr=yi(Z,"FORBID_CONTENTS")?Je({},Z.FORBID_CONTENTS,E):Go,Pe=yi(Z,"FORBID_TAGS")?Je({},Z.FORBID_TAGS,E):nr({}),Ye=yi(Z,"FORBID_ATTR")?Je({},Z.FORBID_ATTR,E):nr({}),pi=!!yi(Z,"USE_PROFILES")&&Z.USE_PROFILES,Tt=Z.ALLOW_ARIA_ATTR!==!1,yt=Z.ALLOW_DATA_ATTR!==!1,wt=Z.ALLOW_UNKNOWN_PROTOCOLS||!1,Qt=Z.ALLOW_SELF_CLOSE_IN_ATTR!==!1,He=Z.SAFE_FOR_TEMPLATES||!1,Ut=Z.SAFE_FOR_XML!==!1,ct=Z.WHOLE_DOCUMENT||!1,ei=Z.RETURN_DOM||!1,ti=Z.RETURN_DOM_FRAGMENT||!1,Ri=Z.RETURN_TRUSTED_TYPE||!1,Mt=Z.FORCE_BODY||!1,za=Z.SANITIZE_DOM!==!1,qo=Z.SANITIZE_NAMED_PROPS||!1,ns=Z.KEEP_CONTENT!==!1,vr=Z.IN_PLACE||!1,je=Z.ALLOWED_URI_REGEXP||dk,pt=Z.NAMESPACE||gi,er=Z.MATHML_TEXT_INTEGRATION_POINTS||er,yr=Z.HTML_INTEGRATION_POINTS||yr,H=Z.CUSTOM_ELEMENT_HANDLING||{},Z.CUSTOM_ELEMENT_HANDLING&&j(Z.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=Z.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Z.CUSTOM_ELEMENT_HANDLING&&j(Z.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=Z.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Z.CUSTOM_ELEMENT_HANDLING&&typeof Z.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(H.allowCustomizedBuiltInElements=Z.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),He&&(yt=!1),ti&&(ei=!0),pi&&(ne=Je({},K1),Re=[],pi.html===!0&&(Je(ne,H1),Je(Re,J1)),pi.svg===!0&&(Je(ne,uf),Je(Re,df),Je(Re,oc)),pi.svgFilters===!0&&(Je(ne,hf),Je(Re,df),Je(Re,oc)),pi.mathMl===!0&&(Je(ne,ff),Je(Re,e0),Je(Re,oc))),Z.ADD_TAGS&&(ne===Ee&&(ne=nr(ne)),Je(ne,Z.ADD_TAGS,E)),Z.ADD_ATTR&&(Re===xt&&(Re=nr(Re)),Je(Re,Z.ADD_ATTR,E)),Z.ADD_URI_SAFE_ATTR&&Je(Ko,Z.ADD_URI_SAFE_ATTR,E),Z.FORBID_CONTENTS&&(wr===Go&&(wr=nr(wr)),Je(wr,Z.FORBID_CONTENTS,E)),ns&&(ne["#text"]=!0),ct&&Je(ne,["html","head","body"]),ne.table&&(Je(ne,["tbody"]),delete Pe.tbody),Z.TRUSTED_TYPES_POLICY){if(typeof Z.TRUSTED_TYPES_POLICY.createHTML!="function")throw ll('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Z.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ll('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=Z.TRUSTED_TYPES_POLICY,A=k.createHTML("")}else k===void 0&&(k=function(_e,me){if(typeof _e!="object"||typeof _e.createPolicy!="function")return null;let Ke=null;const ot="data-tt-policy-suffix";me&&me.hasAttribute(ot)&&(Ke=me.getAttribute(ot));const ze="dompurify"+(Ke?"#"+Ke:"");try{return _e.createPolicy(ze,{createHTML:Wt=>Wt,createScriptURL:Wt=>Wt})}catch{return console.warn("TrustedTypes policy "+ze+" could not be created."),null}}(m,s)),k!==null&&typeof A=="string"&&(A=k.createHTML(""));An&&An(Z),$=Z}},ge=Je({},[...uf,...hf,...BR]),We=Je({},[...ff,...WR]),we=function(Z){sl(t.removed,{element:Z});try{_(Z).removeChild(Z)}catch{v(Z)}},Ne=function(Z,_e){try{sl(t.removed,{attribute:_e.getAttributeNode(Z),from:_e})}catch{sl(t.removed,{attribute:null,from:_e})}if(_e.removeAttribute(Z),Z==="is")if(ei||ti)try{we(_e)}catch{}else try{_e.setAttribute(Z,"")}catch{}},Se=function(Z){let _e=null,me=null;if(Mt)Z="<remove></remove>"+Z;else{const ze=cf(Z,/^[\r\n\t ]+/);me=ze&&ze[0]}os==="application/xhtml+xml"&&pt===gi&&(Z='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Z+"</body></html>");const Ke=k?k.createHTML(Z):Z;if(pt===gi)try{_e=new d().parseFromString(Ke,os)}catch{}if(!_e||!_e.documentElement){_e=C.createDocument(pt,"template",null);try{_e.documentElement.innerHTML=rs?A:Ke}catch{}}const ot=_e.body||_e.documentElement;return Z&&me&&ot.insertBefore(n.createTextNode(me),ot.childNodes[0]||null),pt===gi?L.call(_e,ct?"html":"body")[0]:ct?_e.documentElement:ot},Me=function(Z){return Q.call(Z.ownerDocument||Z,Z,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},ft=function(Z){return Z instanceof f&&(typeof Z.nodeName!="string"||typeof Z.textContent!="string"||typeof Z.removeChild!="function"||!(Z.attributes instanceof h)||typeof Z.removeAttribute!="function"||typeof Z.setAttribute!="function"||typeof Z.namespaceURI!="string"||typeof Z.insertBefore!="function"||typeof Z.hasChildNodes!="function")},Nn=function(Z){return typeof a=="function"&&Z instanceof a};function Lt(Z,_e,me){sc(Z,Ke=>{Ke.call(t,_e,me,$)})}const kr=function(Z){let _e=null;if(Lt(B.beforeSanitizeElements,Z,null),ft(Z))return we(Z),!0;const me=E(Z.nodeName);if(Lt(B.uponSanitizeElement,Z,{tagName:me,allowedTags:ne}),Ut&&Z.hasChildNodes()&&!Nn(Z.firstElementChild)&&wn(/<[/\w!]/g,Z.innerHTML)&&wn(/<[/\w!]/g,Z.textContent)||Z.nodeType===KR||Ut&&Z.nodeType===JR&&wn(/<[/\w]/g,Z.data))return we(Z),!0;if(!ne[me]||Pe[me]){if(!Pe[me]&&ja(me)&&(H.tagNameCheck instanceof RegExp&&wn(H.tagNameCheck,me)||H.tagNameCheck instanceof Function&&H.tagNameCheck(me)))return!1;if(ns&&!wr[me]){const Ke=_(Z)||Z.parentNode,ot=S(Z)||Z.childNodes;if(ot&&Ke)for(let ze=ot.length-1;ze>=0;--ze){const Wt=g(ot[ze],!0);Wt.__removalCount=(Z.__removalCount||0)+1,Ke.insertBefore(Wt,w(Z))}}return we(Z),!0}return Z instanceof c&&!function(Ke){let ot=_(Ke);ot&&ot.tagName||(ot={namespaceURI:pt,tagName:"template"});const ze=zc(Ke.tagName),Wt=zc(ot.tagName);return!!ss[Ke.namespaceURI]&&(Ke.namespaceURI===Ys?ot.namespaceURI===gi?ze==="svg":ot.namespaceURI===is?ze==="svg"&&(Wt==="annotation-xml"||er[Wt]):!!ge[ze]:Ke.namespaceURI===is?ot.namespaceURI===gi?ze==="math":ot.namespaceURI===Ys?ze==="math"&&yr[Wt]:!!We[ze]:Ke.namespaceURI===gi?!(ot.namespaceURI===Ys&&!yr[Wt])&&!(ot.namespaceURI===is&&!er[Wt])&&!We[ze]&&(Oi[ze]||!ge[ze]):!(os!=="application/xhtml+xml"||!ss[Ke.namespaceURI]))}(Z)?(we(Z),!0):me!=="noscript"&&me!=="noembed"&&me!=="noframes"||!wn(/<\/no(script|embed|frames)/i,Z.innerHTML)?(He&&Z.nodeType===HR&&(_e=Z.textContent,sc([J,te,ie],Ke=>{_e=ol(_e,Ke," ")}),Z.textContent!==_e&&(sl(t.removed,{element:Z.cloneNode()}),Z.textContent=_e)),Lt(B.afterSanitizeElements,Z,null),!1):(we(Z),!0)},tr=function(Z,_e,me){if(za&&(_e==="id"||_e==="name")&&(me in n||me in F))return!1;if(!(yt&&!Ye[_e]&&wn(ae,_e))){if(!(Tt&&wn(X,_e))){if(!Re[_e]||Ye[_e]){if(!(ja(Z)&&(H.tagNameCheck instanceof RegExp&&wn(H.tagNameCheck,Z)||H.tagNameCheck instanceof Function&&H.tagNameCheck(Z))&&(H.attributeNameCheck instanceof RegExp&&wn(H.attributeNameCheck,_e)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(_e,Z))||_e==="is"&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&wn(H.tagNameCheck,me)||H.tagNameCheck instanceof Function&&H.tagNameCheck(me))))return!1}else if(!Ko[_e]){if(!wn(je,ol(me,Te,""))){if((_e!=="src"&&_e!=="xlink:href"&&_e!=="href"||Z==="script"||IR(me,"data:")!==0||!Va[Z])&&!(wt&&!wn(ee,ol(me,Te,"")))){if(me)return!1}}}}}return!0},ja=function(Z){return Z!=="annotation-xml"&&cf(Z,ve)},zs=function(Z){Lt(B.beforeSanitizeAttributes,Z,null);const{attributes:_e}=Z;if(!_e||ft(Z))return;const me={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Re,forceKeepAttr:void 0};let Ke=_e.length;for(;Ke--;){const ot=_e[Ke],{name:ze,namespaceURI:Wt,value:Sr}=ot,bi=E(ze),Th=Sr;let rn=ze==="value"?Th:NR(Th);if(me.attrName=bi,me.attrValue=rn,me.keepAttr=!0,me.forceKeepAttr=void 0,Lt(B.uponSanitizeAttribute,Z,me),rn=me.attrValue,!qo||bi!=="id"&&bi!=="name"||(Ne(ze,Z),rn="user-content-"+rn),Ut&&wn(/((--!?|])>)|<\/(style|title|textarea)/i,rn)){Ne(ze,Z);continue}if(bi==="attributename"&&cf(rn,"href")){Ne(ze,Z);continue}if(me.forceKeepAttr)continue;if(!me.keepAttr){Ne(ze,Z);continue}if(!Qt&&wn(/\/>/i,rn)){Ne(ze,Z);continue}He&&sc([J,te,ie],Kp=>{rn=ol(rn,Kp," ")});const Hp=E(Z.nodeName);if(tr(Hp,bi,rn)){if(k&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!Wt)switch(m.getAttributeType(Hp,bi)){case"TrustedHTML":rn=k.createHTML(rn);break;case"TrustedScriptURL":rn=k.createScriptURL(rn)}if(rn!==Th)try{Wt?Z.setAttributeNS(Wt,ze,rn):Z.setAttribute(ze,rn),ft(Z)?we(Z):q1(t.removed)}catch{Ne(ze,Z)}}else Ne(ze,Z)}Lt(B.afterSanitizeAttributes,Z,null)},xh=function Z(_e){let me=null;const Ke=Me(_e);for(Lt(B.beforeSanitizeShadowDOM,_e,null);me=Ke.nextNode();)Lt(B.uponSanitizeShadowNode,me,null),kr(me),zs(me),me.content instanceof o&&Z(me.content);Lt(B.afterSanitizeShadowDOM,_e,null)};return t.sanitize=function(Z){let _e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},me=null,Ke=null,ot=null,ze=null;if(rs=!Z,rs&&(Z="<!-->"),typeof Z!="string"&&!Nn(Z)){if(typeof Z.toString!="function")throw ll("toString is not a function");if(typeof(Z=Z.toString())!="string")throw ll("dirty is not a string, aborting")}if(!t.isSupported)return Z;if(qe||ce(_e),t.removed=[],typeof Z=="string"&&(vr=!1),vr){if(Z.nodeName){const bi=E(Z.nodeName);if(!ne[bi]||Pe[bi])throw ll("root node is forbidden and cannot be sanitized in-place")}}else if(Z instanceof a)me=Se("<!---->"),Ke=me.ownerDocument.importNode(Z,!0),Ke.nodeType===GR&&Ke.nodeName==="BODY"||Ke.nodeName==="HTML"?me=Ke:me.appendChild(Ke);else{if(!ei&&!He&&!ct&&Z.indexOf("<")===-1)return k&&Ri?k.createHTML(Z):Z;if(me=Se(Z),!me)return ei?null:Ri?A:""}me&&Mt&&we(me.firstChild);const Wt=Me(vr?Z:me);for(;ot=Wt.nextNode();)kr(ot),zs(ot),ot.content instanceof o&&xh(ot.content);if(vr)return Z;if(ei){if(ti)for(ze=M.call(me.ownerDocument);me.firstChild;)ze.appendChild(me.firstChild);else ze=me;return(Re.shadowroot||Re.shadowrootmode)&&(ze=N.call(r,ze,!0)),ze}let Sr=ct?me.outerHTML:me.innerHTML;return ct&&ne["!doctype"]&&me.ownerDocument&&me.ownerDocument.doctype&&me.ownerDocument.doctype.name&&wn(mk,me.ownerDocument.doctype.name)&&(Sr="<!DOCTYPE "+me.ownerDocument.doctype.name+`>
`+Sr),He&&sc([J,te,ie],bi=>{Sr=ol(Sr,bi," ")}),k&&Ri?k.createHTML(Sr):Sr},t.setConfig=function(){ce(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),qe=!0},t.clearConfig=function(){$=null,qe=!1},t.isValidAttribute=function(Z,_e,me){$||ce({});const Ke=E(Z),ot=E(_e);return tr(Ke,ot,me)},t.addHook=function(Z,_e){typeof _e=="function"&&sl(B[Z],_e)},t.removeHook=function(Z,_e){if(_e!==void 0){const me=$R(B[Z],_e);return me===-1?void 0:LR(B[Z],me,1)[0]}return q1(B[Z])},t.removeHooks=function(Z){B[Z]=[]},t.removeAllHooks=function(){B={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},t}();Ao.addHook("uponSanitizeAttribute",function(i,e){if(e.attrName==="data-trix-serialized-attributes")return void(e.keepAttr=!1);/^data-trix-/.test(e.attrName)&&(e.forceKeepAttr=!0)});const n4="style href src width height language class".split(" "),i4="javascript:".split(" "),r4="script iframe form noscript".split(" ");class lh extends Kt{static setHTML(e,t,n){const r=new this(t,n).sanitize(),s=r.getHTML?r.getHTML():r.outerHTML;e.innerHTML=s}static sanitize(e,t){const n=new this(e,t);return n.sanitize(),n}constructor(e){let{allowedAttributes:t,forbiddenProtocols:n,forbiddenElements:r,purifyOptions:s}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(...arguments),this.allowedAttributes=t||n4,this.forbiddenProtocols=n||i4,this.forbiddenElements=r||r4,this.purifyOptions=s||{},this.body=s4(e)}sanitize(){this.sanitizeElements(),this.normalizeListElementNesting();const e=Object.assign({},Hy,this.purifyOptions);return Ao.setConfig(e),this.body=Ao.sanitize(this.body),this.body}getHTML(){return this.body.innerHTML}getBody(){return this.body}sanitizeElements(){const e=vu(this.body),t=[];for(;e.nextNode();){const n=e.currentNode;switch(n.nodeType){case Node.ELEMENT_NODE:this.elementIsRemovable(n)?t.push(n):this.sanitizeElement(n);break;case Node.COMMENT_NODE:t.push(n)}}return t.forEach(n=>zr(n)),this.body}sanitizeElement(e){return e.hasAttribute("href")&&this.forbiddenProtocols.includes(e.protocol)&&e.removeAttribute("href"),Array.from(e.attributes).forEach(t=>{let{name:n}=t;this.allowedAttributes.includes(n)||n.indexOf("data-trix")===0||e.removeAttribute(n)}),e}normalizeListElementNesting(){return Array.from(this.body.querySelectorAll("ul,ol")).forEach(e=>{const t=e.previousElementSibling;t&&kn(t)==="li"&&t.appendChild(e)}),this.body}elementIsRemovable(e){if((e==null?void 0:e.nodeType)===Node.ELEMENT_NODE)return this.elementIsForbidden(e)||this.elementIsntSerializable(e)}elementIsForbidden(e){return this.forbiddenElements.includes(kn(e))}elementIsntSerializable(e){return e.getAttribute("data-trix-serialize")==="false"&&!Cs(e)}}const s4=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";i=i.replace(/<\/html[^>]*>[^]*$/i,"</html>");const e=document.implementation.createHTMLDocument("");return e.documentElement.innerHTML=i,Array.from(e.head.querySelectorAll("style")).forEach(t=>{e.body.appendChild(t)}),e.body},{css:Cr}=$a;class ip extends Zs{constructor(){super(...arguments),this.attachment=this.object,this.attachment.uploadProgressDelegate=this,this.attachmentPiece=this.options.piece}createContentNodes(){return[]}createNodes(){let e;const t=e=Ge({tagName:"figure",className:this.getClassName(),data:this.getData(),editable:!1}),n=this.getHref();return n&&(e=Ge({tagName:"a",editable:!1,attributes:{href:n,tabindex:-1}}),t.appendChild(e)),this.attachment.hasContent()?lh.setHTML(e,this.attachment.getContent()):this.createContentNodes().forEach(r=>{e.appendChild(r)}),e.appendChild(this.createCaptionElement()),this.attachment.isPending()&&(this.progressElement=Ge({tagName:"progress",attributes:{class:Cr.attachmentProgress,value:this.attachment.getUploadProgress(),max:100},data:{trixMutable:!0,trixStoreKey:["progressElement",this.attachment.id].join("/")}}),t.appendChild(this.progressElement)),[n0("left"),t,n0("right")]}createCaptionElement(){const e=Ge({tagName:"figcaption",className:Cr.attachmentCaption}),t=this.attachmentPiece.getCaption();if(t)e.classList.add("".concat(Cr.attachmentCaption,"--edited")),e.textContent=t;else{let n,r;const s=this.getCaptionConfig();if(s.name&&(n=this.attachment.getFilename()),s.size&&(r=this.attachment.getFormattedFilesize()),n){const o=Ge({tagName:"span",className:Cr.attachmentName,textContent:n});e.appendChild(o)}if(r){n&&e.appendChild(document.createTextNode(" "));const o=Ge({tagName:"span",className:Cr.attachmentSize,textContent:r});e.appendChild(o)}}return e}getClassName(){const e=[Cr.attachment,"".concat(Cr.attachment,"--").concat(this.attachment.getType())],t=this.attachment.getExtension();return t&&e.push("".concat(Cr.attachment,"--").concat(t)),e.join(" ")}getData(){const e={trixAttachment:JSON.stringify(this.attachment),trixContentType:this.attachment.getContentType(),trixId:this.attachment.id},{attributes:t}=this.attachmentPiece;return t.isEmpty()||(e.trixAttributes=JSON.stringify(t)),this.attachment.isPending()&&(e.trixSerialize=!1),e}getHref(){if(!o4(this.attachment.getContent(),"a")){const e=this.attachment.getHref();if(e&&Ao.isValidAttribute("a","href",e))return e}}getCaptionConfig(){var e;const t=this.attachment.getType(),n=lk((e=jm[t])===null||e===void 0?void 0:e.caption);return t==="file"&&(n.name=!0),n}findProgressElement(){var e;return(e=this.findElement())===null||e===void 0?void 0:e.querySelector("progress")}attachmentDidChangeUploadProgress(){const e=this.attachment.getUploadProgress(),t=this.findProgressElement();t&&(t.value=e)}}const n0=i=>Ge({tagName:"span",textContent:oh,data:{trixCursorTarget:i,trixSerialize:!1}}),o4=function(i,e){const t=Ge("div");return lh.setHTML(t,i||""),t.querySelector(e)};class pk extends ip{constructor(){super(...arguments),this.attachment.previewDelegate=this}createContentNodes(){return this.image=Ge({tagName:"img",attributes:{src:""},data:{trixMutable:!0}}),this.refresh(this.image),[this.image]}createCaptionElement(){const e=super.createCaptionElement(...arguments);return e.textContent||e.setAttribute("data-trix-placeholder",Ve.captionPlaceholder),e}refresh(e){var t;if(e||(e=(t=this.findElement())===null||t===void 0?void 0:t.querySelector("img")),e)return this.updateAttributesForImage(e)}updateAttributesForImage(e){const t=this.attachment.getURL(),n=this.attachment.getPreviewURL();if(e.src=n||t,n===t)e.removeAttribute("data-trix-serialized-attributes");else{const a=JSON.stringify({src:t});e.setAttribute("data-trix-serialized-attributes",a)}const r=this.attachment.getWidth(),s=this.attachment.getHeight(),o=this.attachment.getAttribute("alt");r!=null&&(e.width=r),s!=null&&(e.height=s),o!=null&&(e.alt=o);const l=["imageElement",this.attachment.id,e.src,e.width,e.height].join("/");e.dataset.trixStoreKey=l}attachmentDidChangeAttributes(){return this.refresh(this.image),this.refresh()}}class gk extends Zs{constructor(){super(...arguments),this.piece=this.object,this.attributes=this.piece.getAttributes(),this.textConfig=this.options.textConfig,this.context=this.options.context,this.piece.attachment?this.attachment=this.piece.attachment:this.string=this.piece.toString()}createNodes(){let e=this.attachment?this.createAttachmentNodes():this.createStringNodes();const t=this.createElement();if(t){const n=function(r){for(;(s=r)!==null&&s!==void 0&&s.firstElementChild;){var s;r=r.firstElementChild}return r}(t);Array.from(e).forEach(r=>{n.appendChild(r)}),e=[t]}return e}createAttachmentNodes(){const e=this.attachment.isPreviewable()?pk:ip;return this.createChildView(e,this.piece.attachment,{piece:this.piece}).getNodes()}createStringNodes(){var e;if((e=this.textConfig)!==null&&e!==void 0&&e.plaintext)return[document.createTextNode(this.string)];{const t=[],n=this.string.split(`
`);for(let r=0;r<n.length;r++){const s=n[r];if(r>0){const o=Ge("br");t.push(o)}if(s.length){const o=document.createTextNode(this.preserveSpaces(s));t.push(o)}}return t}}createElement(){let e,t,n;const r={};for(t in this.attributes){n=this.attributes[t];const o=Ad(t);if(o){if(o.tagName){var s;const l=Ge(o.tagName);s?(s.appendChild(l),s=l):e=s=l}if(o.styleProperty&&(r[o.styleProperty]=n),o.style)for(t in o.style)n=o.style[t],r[t]=n}}if(Object.keys(r).length)for(t in e||(e=Ge("span")),r)n=r[t],e.style[t]=n;return e}createContainerElement(){for(const e in this.attributes){const t=this.attributes[e],n=Ad(e);if(n&&n.groupTagName){const r={};return r[e]=t,Ge(n.groupTagName,r)}}}preserveSpaces(e){return this.context.isLast&&(e=e.replace(/\ $/,Rr)),e=e.replace(/(\S)\ {3}(\S)/g,"$1 ".concat(Rr," $2")).replace(/\ {2}/g,"".concat(Rr," ")).replace(/\ {2}/g," ".concat(Rr)),(this.context.isFirst||this.context.followsWhitespace)&&(e=e.replace(/^\ /,Rr)),e}}class Ok extends Zs{constructor(){super(...arguments),this.text=this.object,this.textConfig=this.options.textConfig}createNodes(){const e=[],t=np.groupObjects(this.getPieces()),n=t.length-1;for(let s=0;s<t.length;s++){const o=t[s],l={};s===0&&(l.isFirst=!0),s===n&&(l.isLast=!0),l4(r)&&(l.followsWhitespace=!0);const a=this.findOrCreateCachedChildView(gk,o,{textConfig:this.textConfig,context:l});e.push(...Array.from(a.getNodes()||[]));var r=o}return e}getPieces(){return Array.from(this.text.getPieces()).filter(e=>!e.hasAttribute("blockBreak"))}}const l4=i=>/\s$/.test(i==null?void 0:i.toString()),{css:i0}=$a;class bk extends Zs{constructor(){super(...arguments),this.block=this.object,this.attributes=this.block.getAttributes()}createNodes(){const e=[document.createComment("block")];if(this.block.isEmpty())e.push(Ge("br"));else{var t;const n=(t=zt(this.block.getLastAttribute()))===null||t===void 0?void 0:t.text,r=this.findOrCreateCachedChildView(Ok,this.block.text,{textConfig:n});e.push(...Array.from(r.getNodes()||[])),this.shouldAddExtraNewlineElement()&&e.push(Ge("br"))}if(this.attributes.length)return e;{let n;const{tagName:r}=Sn.default;this.block.isRTL()&&(n={dir:"rtl"});const s=Ge({tagName:r,attributes:n});return e.forEach(o=>s.appendChild(o)),[s]}}createContainerElement(e){const t={};let n;const r=this.attributes[e],{tagName:s,htmlAttributes:o=[]}=zt(r);if(e===0&&this.block.isRTL()&&Object.assign(t,{dir:"rtl"}),r==="attachmentGallery"){const l=this.block.getBlockBreakPosition();n="".concat(i0.attachmentGallery," ").concat(i0.attachmentGallery,"--").concat(l)}return Object.entries(this.block.htmlAttributes).forEach(l=>{let[a,c]=l;o.includes(a)&&(t[a]=c)}),Ge({tagName:s,className:n,attributes:t})}shouldAddExtraNewlineElement(){return/\n\n$/.test(this.block.toString())}}class ah extends Zs{static render(e){const t=Ge("div"),n=new this(e,{element:t});return n.render(),n.sync(),t}constructor(){super(...arguments),this.element=this.options.element,this.elementStore=new QR,this.setDocument(this.object)}setDocument(e){e.isEqualTo(this.document)||(this.document=this.object=e)}render(){if(this.childViews=[],this.shadowElement=Ge("div"),!this.document.isEmpty()){const e=np.groupObjects(this.document.getBlocks(),{asTree:!0});Array.from(e).forEach(t=>{const n=this.findOrCreateCachedChildView(bk,t);Array.from(n.getNodes()).map(r=>this.shadowElement.appendChild(r))})}}isSynced(){return a4(this.shadowElement,this.element)}sync(){const e=ek("trix-before-render",{cancelable:!1,attributes:{render:(n,r)=>{for(;n.lastChild;)n.removeChild(n.lastChild);n.appendChild(r)}}});this.element.dispatchEvent(e);const t=this.createDocumentFragmentForSync();return e.render(this.element,t),this.didSync()}didSync(){return this.elementStore.reset(r0(this.element)),Jm(()=>this.garbageCollectCachedViews())}createDocumentFragmentForSync(){const e=document.createDocumentFragment();return Array.from(this.shadowElement.childNodes).forEach(t=>{e.appendChild(t.cloneNode(!0))}),Array.from(r0(e)).forEach(t=>{const n=this.elementStore.remove(t);n&&t.parentNode.replaceChild(n,t)}),e}}const r0=i=>i.querySelectorAll("[data-trix-store-key]"),a4=(i,e)=>s0(i.innerHTML)===s0(e.innerHTML),s0=i=>i.replace(/&nbsp;/g," ");function c4(i){var e=function(t,n){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var s=r.call(t,n);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(t)}(i,"string");return typeof e=="symbol"?e:String(e)}function gn(i,e,t){return(e=c4(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function it(i,e){return u4(i,vk(i,e,"get"))}function Wl(i,e,t){return h4(i,vk(i,e,"set"),t),t}function vk(i,e,t){if(!e.has(i))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(i)}function u4(i,e){return e.get?e.get.call(i):e.value}function h4(i,e,t){if(e.set)e.set.call(i,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}function lc(i,e,t){if(!e.has(i))throw new TypeError("attempted to get private field on non-instance");return t}function wk(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function po(i,e,t){wk(i,e),e.set(i,t)}class Bs extends Ns{static registerType(e,t){t.type=e,this.types[e]=t}static fromJSON(e){const t=this.types[e.type];if(t)return t.fromJSON(e)}constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(...arguments),this.attributes=Kn.box(t)}copyWithAttributes(e){return new this.constructor(this.getValue(),e)}copyWithAdditionalAttributes(e){return this.copyWithAttributes(this.attributes.merge(e))}copyWithoutAttribute(e){return this.copyWithAttributes(this.attributes.remove(e))}copy(){return this.copyWithAttributes(this.attributes)}getAttribute(e){return this.attributes.get(e)}getAttributesHash(){return this.attributes}getAttributes(){return this.attributes.toObject()}hasAttribute(e){return this.attributes.has(e)}hasSameStringValueAsPiece(e){return e&&this.toString()===e.toString()}hasSameAttributesAsPiece(e){return e&&(this.attributes===e.attributes||this.attributes.isEqualTo(e.attributes))}isBlockBreak(){return!1}isEqualTo(e){return super.isEqualTo(...arguments)||this.hasSameConstructorAs(e)&&this.hasSameStringValueAsPiece(e)&&this.hasSameAttributesAsPiece(e)}isEmpty(){return this.length===0}isSerializable(){return!0}toJSON(){return{type:this.constructor.type,attributes:this.getAttributes()}}contentsForInspection(){return{type:this.constructor.type,attributes:this.attributes.inspect()}}canBeGrouped(){return this.hasAttribute("href")}canBeGroupedWith(e){return this.getAttribute("href")===e.getAttribute("href")}getLength(){return this.length}canBeConsolidatedWith(e){return!1}}gn(Bs,"types",{});class yk extends yu{constructor(e){super(...arguments),this.url=e}perform(e){const t=new Image;t.onload=()=>(t.width=this.width=t.naturalWidth,t.height=this.height=t.naturalHeight,e(!0,t)),t.onerror=()=>e(!1),t.src=this.url}}class Yo extends Ns{static attachmentForFile(e){const t=new this(this.attributesForFile(e));return t.setFile(e),t}static attributesForFile(e){return new Kn({filename:e.name,filesize:e.size,contentType:e.type})}static fromJSON(e){return new this(e)}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(e),this.releaseFile=this.releaseFile.bind(this),this.attributes=Kn.box(e),this.didChangeAttributes()}setAttribute(e,t){this.setAttributes({[e]:t})}getAttribute(e){return this.attributes.get(e)}hasAttribute(e){return this.attributes.has(e)}getAttributes(){return this.attributes.toObject()}setAttributes(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const t=this.attributes.merge(e);var n,r,s,o;if(!this.attributes.isEqualTo(t))return this.attributes=t,this.didChangeAttributes(),(n=this.previewDelegate)===null||n===void 0||(r=n.attachmentDidChangeAttributes)===null||r===void 0||r.call(n,this),(s=this.delegate)===null||s===void 0||(o=s.attachmentDidChangeAttributes)===null||o===void 0?void 0:o.call(s,this)}didChangeAttributes(){if(this.isPreviewable())return this.preloadURL()}isPending(){return this.file!=null&&!(this.getURL()||this.getHref())}isPreviewable(){return this.attributes.has("previewable")?this.attributes.get("previewable"):Yo.previewablePattern.test(this.getContentType())}getType(){return this.hasContent()?"content":this.isPreviewable()?"preview":"file"}getURL(){return this.attributes.get("url")}getHref(){return this.attributes.get("href")}getFilename(){return this.attributes.get("filename")||""}getFilesize(){return this.attributes.get("filesize")}getFormattedFilesize(){const e=this.attributes.get("filesize");return typeof e=="number"?Ky.formatter(e):""}getExtension(){var e;return(e=this.getFilename().match(/\.(\w+)$/))===null||e===void 0?void 0:e[1].toLowerCase()}getContentType(){return this.attributes.get("contentType")}hasContent(){return this.attributes.has("content")}getContent(){return this.attributes.get("content")}getWidth(){return this.attributes.get("width")}getHeight(){return this.attributes.get("height")}getFile(){return this.file}setFile(e){if(this.file=e,this.isPreviewable())return this.preloadFile()}releaseFile(){this.releasePreloadedFile(),this.file=null}getUploadProgress(){return this.uploadProgress!=null?this.uploadProgress:0}setUploadProgress(e){var t,n;if(this.uploadProgress!==e)return this.uploadProgress=e,(t=this.uploadProgressDelegate)===null||t===void 0||(n=t.attachmentDidChangeUploadProgress)===null||n===void 0?void 0:n.call(t,this)}toJSON(){return this.getAttributes()}getCacheKey(){return[super.getCacheKey(...arguments),this.attributes.getCacheKey(),this.getPreviewURL()].join("/")}getPreviewURL(){return this.previewURL||this.preloadingURL}setPreviewURL(e){var t,n,r,s;if(e!==this.getPreviewURL())return this.previewURL=e,(t=this.previewDelegate)===null||t===void 0||(n=t.attachmentDidChangeAttributes)===null||n===void 0||n.call(t,this),(r=this.delegate)===null||r===void 0||(s=r.attachmentDidChangePreviewURL)===null||s===void 0?void 0:s.call(r,this)}preloadURL(){return this.preload(this.getURL(),this.releaseFile)}preloadFile(){if(this.file)return this.fileObjectURL=URL.createObjectURL(this.file),this.preload(this.fileObjectURL)}releasePreloadedFile(){this.fileObjectURL&&(URL.revokeObjectURL(this.fileObjectURL),this.fileObjectURL=null)}preload(e,t){if(e&&e!==this.getPreviewURL())return this.preloadingURL=e,new yk(e).then(n=>{let{width:r,height:s}=n;return this.getWidth()&&this.getHeight()||this.setAttributes({width:r,height:s}),this.preloadingURL=null,this.setPreviewURL(e),t==null?void 0:t()}).catch(()=>(this.preloadingURL=null,t==null?void 0:t()))}}gn(Yo,"previewablePattern",/^image(\/(gif|png|webp|jpe?g)|$)/);class xo extends Bs{static fromJSON(e){return new this(Yo.fromJSON(e.attachment),e.attributes)}constructor(e){super(...arguments),this.attachment=e,this.length=1,this.ensureAttachmentExclusivelyHasAttribute("href"),this.attachment.hasContent()||this.removeProhibitedAttributes()}ensureAttachmentExclusivelyHasAttribute(e){this.hasAttribute(e)&&(this.attachment.hasAttribute(e)||this.attachment.setAttributes(this.attributes.slice([e])),this.attributes=this.attributes.remove(e))}removeProhibitedAttributes(){const e=this.attributes.slice(xo.permittedAttributes);e.isEqualTo(this.attributes)||(this.attributes=e)}getValue(){return this.attachment}isSerializable(){return!this.attachment.isPending()}getCaption(){return this.attributes.get("caption")||""}isEqualTo(e){var t;return super.isEqualTo(e)&&this.attachment.id===(e==null||(t=e.attachment)===null||t===void 0?void 0:t.id)}toString(){return""}toJSON(){const e=super.toJSON(...arguments);return e.attachment=this.attachment,e}getCacheKey(){return[super.getCacheKey(...arguments),this.attachment.getCacheKey()].join("/")}toConsole(){return JSON.stringify(this.toString())}}gn(xo,"permittedAttributes",["caption","presentation"]),Bs.registerType("attachment",xo);class rp extends Bs{static fromJSON(e){const t={...e.attributes};return t.href&&!Ao.isValidAttribute("a","href",t.href)&&delete t.href,new this(e.string,t)}constructor(e){super(...arguments),this.string=(t=>t.replace(/\r\n?/g,`
`))(e),this.length=this.string.length}getValue(){return this.string}toString(){return this.string.toString()}isBlockBreak(){return this.toString()===`
`&&this.getAttribute("blockBreak")===!0}toJSON(){const e=super.toJSON(...arguments);return e.string=this.string,e}canBeConsolidatedWith(e){return e&&this.hasSameConstructorAs(e)&&this.hasSameAttributesAsPiece(e)}consolidateWith(e){return new this.constructor(this.toString()+e.toString(),this.attributes)}splitAtOffset(e){let t,n;return e===0?(t=null,n=this):e===this.length?(t=this,n=null):(t=new this.constructor(this.string.slice(0,e),this.attributes),n=new this.constructor(this.string.slice(e),this.attributes)),[t,n]}toConsole(){let{string:e}=this;return e.length>15&&(e=e.slice(0,14)+"…"),JSON.stringify(e.toString())}}Bs.registerType("string",rp);class ku extends Ns{static box(e){return e instanceof this?e:new this(e)}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),this.objects=e.slice(0),this.length=this.objects.length}indexOf(e){return this.objects.indexOf(e)}splice(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new this.constructor(Km(this.objects,...t))}eachObject(e){return this.objects.map((t,n)=>e(t,n))}insertObjectAtIndex(e,t){return this.splice(t,0,e)}insertSplittableListAtIndex(e,t){return this.splice(t,0,...e.objects)}insertSplittableListAtPosition(e,t){const[n,r]=this.splitObjectAtPosition(t);return new this.constructor(n).insertSplittableListAtIndex(e,r)}editObjectAtIndex(e,t){return this.replaceObjectAtIndex(t(this.objects[e]),e)}replaceObjectAtIndex(e,t){return this.splice(t,1,e)}removeObjectAtIndex(e){return this.splice(e,1)}getObjectAtIndex(e){return this.objects[e]}getSplittableListInRange(e){const[t,n,r]=this.splitObjectsAtRange(e);return new this.constructor(t.slice(n,r+1))}selectSplittableList(e){const t=this.objects.filter(n=>e(n));return new this.constructor(t)}removeObjectsInRange(e){const[t,n,r]=this.splitObjectsAtRange(e);return new this.constructor(t).splice(n,r-n+1)}transformObjectsInRange(e,t){const[n,r,s]=this.splitObjectsAtRange(e),o=n.map((l,a)=>r<=a&&a<=s?t(l):l);return new this.constructor(o)}splitObjectsAtRange(e){let t,[n,r,s]=this.splitObjectAtPosition(d4(e));return[n,t]=new this.constructor(n).splitObjectAtPosition(m4(e)+s),[n,r,t-1]}getObjectAtPosition(e){const{index:t}=this.findIndexAndOffsetAtPosition(e);return this.objects[t]}splitObjectAtPosition(e){let t,n;const{index:r,offset:s}=this.findIndexAndOffsetAtPosition(e),o=this.objects.slice(0);if(r!=null)if(s===0)t=r,n=0;else{const l=this.getObjectAtIndex(r),[a,c]=l.splitAtOffset(s);o.splice(r,1,a,c),t=r+1,n=a.getLength()-s}else t=o.length,n=0;return[o,t,n]}consolidate(){const e=[];let t=this.objects[0];return this.objects.slice(1).forEach(n=>{var r,s;(r=(s=t).canBeConsolidatedWith)!==null&&r!==void 0&&r.call(s,n)?t=t.consolidateWith(n):(e.push(t),t=n)}),t&&e.push(t),new this.constructor(e)}consolidateFromIndexToIndex(e,t){const n=this.objects.slice(0).slice(e,t+1),r=new this.constructor(n).consolidate().toArray();return this.splice(e,n.length,...r)}findIndexAndOffsetAtPosition(e){let t,n=0;for(t=0;t<this.objects.length;t++){const r=n+this.objects[t].getLength();if(n<=e&&e<r)return{index:t,offset:e-n};n=r}return{index:null,offset:null}}findPositionAtIndexAndOffset(e,t){let n=0;for(let r=0;r<this.objects.length;r++){const s=this.objects[r];if(r<e)n+=s.getLength();else if(r===e){n+=t;break}}return n}getEndPosition(){return this.endPosition==null&&(this.endPosition=0,this.objects.forEach(e=>this.endPosition+=e.getLength())),this.endPosition}toString(){return this.objects.join("")}toArray(){return this.objects.slice(0)}toJSON(){return this.toArray()}isEqualTo(e){return super.isEqualTo(...arguments)||f4(this.objects,e==null?void 0:e.objects)}contentsForInspection(){return{objects:"[".concat(this.objects.map(e=>e.inspect()).join(", "),"]")}}}const f4=function(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(i.length!==e.length)return!1;let t=!0;for(let n=0;n<i.length;n++){const r=i[n];t&&!r.isEqualTo(e[n])&&(t=!1)}return t},d4=i=>i[0],m4=i=>i[1];class Si extends Ns{static textForAttachmentWithAttributes(e,t){return new this([new xo(e,t)])}static textForStringWithAttributes(e,t){return new this([new rp(e,t)])}static fromJSON(e){return new this(Array.from(e).map(t=>Bs.fromJSON(t)))}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments);const t=e.filter(n=>!n.isEmpty());this.pieceList=new ku(t)}copy(){return this.copyWithPieceList(this.pieceList)}copyWithPieceList(e){return new this.constructor(e.consolidate().toArray())}copyUsingObjectMap(e){const t=this.getPieces().map(n=>e.find(n)||n);return new this.constructor(t)}appendText(e){return this.insertTextAtPosition(e,this.getLength())}insertTextAtPosition(e,t){return this.copyWithPieceList(this.pieceList.insertSplittableListAtPosition(e.pieceList,t))}removeTextAtRange(e){return this.copyWithPieceList(this.pieceList.removeObjectsInRange(e))}replaceTextAtRange(e,t){return this.removeTextAtRange(t).insertTextAtPosition(e,t[0])}moveTextFromRangeToPosition(e,t){if(e[0]<=t&&t<=e[1])return;const n=this.getTextAtRange(e),r=n.getLength();return e[0]<t&&(t-=r),this.removeTextAtRange(e).insertTextAtPosition(n,t)}addAttributeAtRange(e,t,n){const r={};return r[e]=t,this.addAttributesAtRange(r,n)}addAttributesAtRange(e,t){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(t,n=>n.copyWithAdditionalAttributes(e)))}removeAttributeAtRange(e,t){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(t,n=>n.copyWithoutAttribute(e)))}setAttributesAtRange(e,t){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(t,n=>n.copyWithAttributes(e)))}getAttributesAtPosition(e){var t;return((t=this.pieceList.getObjectAtPosition(e))===null||t===void 0?void 0:t.getAttributes())||{}}getCommonAttributes(){const e=Array.from(this.pieceList.toArray()).map(t=>t.getAttributes());return Kn.fromCommonAttributesOfObjects(e).toObject()}getCommonAttributesAtRange(e){return this.getTextAtRange(e).getCommonAttributes()||{}}getExpandedRangeForAttributeAtOffset(e,t){let n,r=n=t;const s=this.getLength();for(;r>0&&this.getCommonAttributesAtRange([r-1,n])[e];)r--;for(;n<s&&this.getCommonAttributesAtRange([t,n+1])[e];)n++;return[r,n]}getTextAtRange(e){return this.copyWithPieceList(this.pieceList.getSplittableListInRange(e))}getStringAtRange(e){return this.pieceList.getSplittableListInRange(e).toString()}getStringAtPosition(e){return this.getStringAtRange([e,e+1])}startsWithString(e){return this.getStringAtRange([0,e.length])===e}endsWithString(e){const t=this.getLength();return this.getStringAtRange([t-e.length,t])===e}getAttachmentPieces(){return this.pieceList.toArray().filter(e=>!!e.attachment)}getAttachments(){return this.getAttachmentPieces().map(e=>e.attachment)}getAttachmentAndPositionById(e){let t=0;for(const r of this.pieceList.toArray()){var n;if(((n=r.attachment)===null||n===void 0?void 0:n.id)===e)return{attachment:r.attachment,position:t};t+=r.length}return{attachment:null,position:null}}getAttachmentById(e){const{attachment:t}=this.getAttachmentAndPositionById(e);return t}getRangeOfAttachment(e){const t=this.getAttachmentAndPositionById(e.id),n=t.position;if(e=t.attachment)return[n,n+1]}updateAttributesForAttachment(e,t){const n=this.getRangeOfAttachment(t);return n?this.addAttributesAtRange(e,n):this}getLength(){return this.pieceList.getEndPosition()}isEmpty(){return this.getLength()===0}isEqualTo(e){var t;return super.isEqualTo(e)||(e==null||(t=e.pieceList)===null||t===void 0?void 0:t.isEqualTo(this.pieceList))}isBlockBreak(){return this.getLength()===1&&this.pieceList.getObjectAtIndex(0).isBlockBreak()}eachPiece(e){return this.pieceList.eachObject(e)}getPieces(){return this.pieceList.toArray()}getPieceAtPosition(e){return this.pieceList.getObjectAtPosition(e)}contentsForInspection(){return{pieceList:this.pieceList.inspect()}}toSerializableText(){const e=this.pieceList.selectSplittableList(t=>t.isSerializable());return this.copyWithPieceList(e)}toString(){return this.pieceList.toString()}toJSON(){return this.pieceList.toJSON()}toConsole(){return JSON.stringify(this.pieceList.toArray().map(e=>JSON.parse(e.toConsole())))}getDirection(){return wR(this.toString())}isRTL(){return this.getDirection()==="rtl"}}class Xi extends Ns{static fromJSON(e){return new this(Si.fromJSON(e.text),e.attributes,e.htmlAttributes)}constructor(e,t,n){super(...arguments),this.text=p4(e||new Si),this.attributes=t||[],this.htmlAttributes=n||{}}isEmpty(){return this.text.isBlockBreak()}isEqualTo(e){return!!super.isEqualTo(e)||this.text.isEqualTo(e==null?void 0:e.text)&&Ts(this.attributes,e==null?void 0:e.attributes)&&Fo(this.htmlAttributes,e==null?void 0:e.htmlAttributes)}copyWithText(e){return new Xi(e,this.attributes,this.htmlAttributes)}copyWithoutText(){return this.copyWithText(null)}copyWithAttributes(e){return new Xi(this.text,e,this.htmlAttributes)}copyWithoutAttributes(){return this.copyWithAttributes(null)}copyUsingObjectMap(e){const t=e.find(this.text);return t?this.copyWithText(t):this.copyWithText(this.text.copyUsingObjectMap(e))}addAttribute(e){const t=this.attributes.concat(o0(e));return this.copyWithAttributes(t)}addHTMLAttribute(e,t){const n=Object.assign({},this.htmlAttributes,{[e]:t});return new Xi(this.text,this.attributes,n)}removeAttribute(e){const{listAttribute:t}=zt(e),n=a0(a0(this.attributes,e),t);return this.copyWithAttributes(n)}removeLastAttribute(){return this.removeAttribute(this.getLastAttribute())}getLastAttribute(){return l0(this.attributes)}getAttributes(){return this.attributes.slice(0)}getAttributeLevel(){return this.attributes.length}getAttributeAtLevel(e){return this.attributes[e-1]}hasAttribute(e){return this.attributes.includes(e)}hasAttributes(){return this.getAttributeLevel()>0}getLastNestableAttribute(){return l0(this.getNestableAttributes())}getNestableAttributes(){return this.attributes.filter(e=>zt(e).nestable)}getNestingLevel(){return this.getNestableAttributes().length}decreaseNestingLevel(){const e=this.getLastNestableAttribute();return e?this.removeAttribute(e):this}increaseNestingLevel(){const e=this.getLastNestableAttribute();if(e){const t=this.attributes.lastIndexOf(e),n=Km(this.attributes,t+1,0,...o0(e));return this.copyWithAttributes(n)}return this}getListItemAttributes(){return this.attributes.filter(e=>zt(e).listAttribute)}isListItem(){var e;return(e=zt(this.getLastAttribute()))===null||e===void 0?void 0:e.listAttribute}isTerminalBlock(){var e;return(e=zt(this.getLastAttribute()))===null||e===void 0?void 0:e.terminal}breaksOnReturn(){var e;return(e=zt(this.getLastAttribute()))===null||e===void 0?void 0:e.breakOnReturn}findLineBreakInDirectionFromPosition(e,t){const n=this.toString();let r;switch(e){case"forward":r=n.indexOf(`
`,t);break;case"backward":r=n.slice(0,t).lastIndexOf(`
`)}if(r!==-1)return r}contentsForInspection(){return{text:this.text.inspect(),attributes:this.attributes}}toString(){return this.text.toString()}toJSON(){return{text:this.text,attributes:this.attributes,htmlAttributes:this.htmlAttributes}}getDirection(){return this.text.getDirection()}isRTL(){return this.text.isRTL()}getLength(){return this.text.getLength()}canBeConsolidatedWith(e){return!this.hasAttributes()&&!e.hasAttributes()&&this.getDirection()===e.getDirection()}consolidateWith(e){const t=Si.textForStringWithAttributes(`
`),n=this.getTextWithoutBlockBreak().appendText(t);return this.copyWithText(n.appendText(e.text))}splitAtOffset(e){let t,n;return e===0?(t=null,n=this):e===this.getLength()?(t=this,n=null):(t=this.copyWithText(this.text.getTextAtRange([0,e])),n=this.copyWithText(this.text.getTextAtRange([e,this.getLength()]))),[t,n]}getBlockBreakPosition(){return this.text.getLength()-1}getTextWithoutBlockBreak(){return kk(this.text)?this.text.getTextAtRange([0,this.getBlockBreakPosition()]):this.text.copy()}canBeGrouped(e){return this.attributes[e]}canBeGroupedWith(e,t){const n=e.getAttributes(),r=n[t],s=this.attributes[t];return s===r&&!(zt(s).group===!1&&!(()=>{if(!rc){rc=[];for(const o in Sn){const{listAttribute:l}=Sn[o];l!=null&&rc.push(l)}}return rc})().includes(n[t+1]))&&(this.getDirection()===e.getDirection()||e.isEmpty())}}const p4=function(i){return i=g4(i),i=b4(i)},g4=function(i){let e=!1;const t=i.getPieces();let n=t.slice(0,t.length-1);const r=t[t.length-1];return r?(n=n.map(s=>s.isBlockBreak()?(e=!0,v4(s)):s),e?new Si([...n,r]):i):i},O4=Si.textForStringWithAttributes(`
`,{blockBreak:!0}),b4=function(i){return kk(i)?i:i.appendText(O4)},kk=function(i){const e=i.getLength();return e===0?!1:i.getTextAtRange([e-1,e]).isBlockBreak()},v4=i=>i.copyWithoutAttribute("blockBreak"),o0=function(i){const{listAttribute:e}=zt(i);return e?[e,i]:[i]},l0=i=>i.slice(-1)[0],a0=function(i,e){const t=i.lastIndexOf(e);return t===-1?i:Km(i,t,1)};class si extends Ns{static fromJSON(e){return new this(Array.from(e).map(t=>Xi.fromJSON(t)))}static fromString(e,t){const n=Si.textForStringWithAttributes(e,t);return new this([new Xi(n)])}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),e.length===0&&(e=[new Xi]),this.blockList=ku.box(e)}isEmpty(){const e=this.getBlockAtIndex(0);return this.blockList.length===1&&e.isEmpty()&&!e.hasAttributes()}copy(){const e=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).consolidateBlocks?this.blockList.consolidate().toArray():this.blockList.toArray();return new this.constructor(e)}copyUsingObjectsFromDocument(e){const t=new TR(e.getObjects());return this.copyUsingObjectMap(t)}copyUsingObjectMap(e){const t=this.getBlocks().map(n=>e.find(n)||n.copyUsingObjectMap(e));return new this.constructor(t)}copyWithBaseBlockAttributes(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];const t=this.getBlocks().map(n=>{const r=e.concat(n.getAttributes());return n.copyWithAttributes(r)});return new this.constructor(t)}replaceBlock(e,t){const n=this.blockList.indexOf(e);return n===-1?this:new this.constructor(this.blockList.replaceObjectAtIndex(t,n))}insertDocumentAtRange(e,t){const{blockList:n}=e;t=bt(t);let[r]=t;const{index:s,offset:o}=this.locationFromPosition(r);let l=this;const a=this.getBlockAtPosition(r);return or(t)&&a.isEmpty()&&!a.hasAttributes()?l=new this.constructor(l.blockList.removeObjectAtIndex(s)):a.getBlockBreakPosition()===o&&r++,l=l.removeTextAtRange(t),new this.constructor(l.blockList.insertSplittableListAtPosition(n,r))}mergeDocumentAtRange(e,t){let n,r;t=bt(t);const[s]=t,o=this.locationFromPosition(s),l=this.getBlockAtIndex(o.index).getAttributes(),a=e.getBaseBlockAttributes(),c=l.slice(-a.length);if(Ts(a,c)){const f=l.slice(0,-a.length);n=e.copyWithBaseBlockAttributes(f)}else n=e.copy({consolidateBlocks:!0}).copyWithBaseBlockAttributes(l);const u=n.getBlockCount(),h=n.getBlockAtIndex(0);if(Ts(l,h.getAttributes())){const f=h.getTextWithoutBlockBreak();if(r=this.insertTextAtRange(f,t),u>1){n=new this.constructor(n.getBlocks().slice(1));const d=s+f.getLength();r=r.insertDocumentAtRange(n,d)}}else r=this.insertDocumentAtRange(n,t);return r}insertTextAtRange(e,t){t=bt(t);const[n]=t,{index:r,offset:s}=this.locationFromPosition(n),o=this.removeTextAtRange(t);return new this.constructor(o.blockList.editObjectAtIndex(r,l=>l.copyWithText(l.text.insertTextAtPosition(e,s))))}removeTextAtRange(e){let t;e=bt(e);const[n,r]=e;if(or(e))return this;const[s,o]=Array.from(this.locationRangeFromRange(e)),l=s.index,a=s.offset,c=this.getBlockAtIndex(l),u=o.index,h=o.offset,f=this.getBlockAtIndex(u);if(r-n==1&&c.getBlockBreakPosition()===a&&f.getBlockBreakPosition()!==h&&f.text.getStringAtPosition(h)===`
`)t=this.blockList.editObjectAtIndex(u,d=>d.copyWithText(d.text.removeTextAtRange([h,h+1])));else{let d;const m=c.text.getTextAtRange([0,a]),p=f.text.getTextAtRange([h,f.getLength()]),g=m.appendText(p);d=l!==u&&a===0&&c.getAttributeLevel()>=f.getAttributeLevel()?f.copyWithText(g):c.copyWithText(g);const v=u+1-l;t=this.blockList.splice(l,v,d)}return new this.constructor(t)}moveTextFromRangeToPosition(e,t){let n;e=bt(e);const[r,s]=e;if(r<=t&&t<=s)return this;let o=this.getDocumentAtRange(e),l=this.removeTextAtRange(e);const a=r<t;a&&(t-=o.getLength());const[c,...u]=o.getBlocks();return u.length===0?(n=c.getTextWithoutBlockBreak(),a&&(t+=1)):n=c.text,l=l.insertTextAtRange(n,t),u.length===0?l:(o=new this.constructor(u),t+=n.getLength(),l.insertDocumentAtRange(o,t))}addAttributeAtRange(e,t,n){let{blockList:r}=this;return this.eachBlockAtRange(n,(s,o,l)=>r=r.editObjectAtIndex(l,function(){return zt(e)?s.addAttribute(e,t):o[0]===o[1]?s:s.copyWithText(s.text.addAttributeAtRange(e,t,o))})),new this.constructor(r)}addAttribute(e,t){let{blockList:n}=this;return this.eachBlock((r,s)=>n=n.editObjectAtIndex(s,()=>r.addAttribute(e,t))),new this.constructor(n)}removeAttributeAtRange(e,t){let{blockList:n}=this;return this.eachBlockAtRange(t,function(r,s,o){zt(e)?n=n.editObjectAtIndex(o,()=>r.removeAttribute(e)):s[0]!==s[1]&&(n=n.editObjectAtIndex(o,()=>r.copyWithText(r.text.removeAttributeAtRange(e,s))))}),new this.constructor(n)}updateAttributesForAttachment(e,t){const n=this.getRangeOfAttachment(t),[r]=Array.from(n),{index:s}=this.locationFromPosition(r),o=this.getTextAtIndex(s);return new this.constructor(this.blockList.editObjectAtIndex(s,l=>l.copyWithText(o.updateAttributesForAttachment(e,t))))}removeAttributeForAttachment(e,t){const n=this.getRangeOfAttachment(t);return this.removeAttributeAtRange(e,n)}setHTMLAttributeAtPosition(e,t,n){const r=this.getBlockAtPosition(e),s=r.addHTMLAttribute(t,n);return this.replaceBlock(r,s)}insertBlockBreakAtRange(e){let t;e=bt(e);const[n]=e,{offset:r}=this.locationFromPosition(n),s=this.removeTextAtRange(e);return r===0&&(t=[new Xi]),new this.constructor(s.blockList.insertSplittableListAtPosition(new ku(t),n))}applyBlockAttributeAtRange(e,t,n){const r=this.expandRangeToLineBreaksAndSplitBlocks(n);let s=r.document;n=r.range;const o=zt(e);if(o.listAttribute){s=s.removeLastListAttributeAtRange(n,{exceptAttributeName:e});const l=s.convertLineBreaksToBlockBreaksInRange(n);s=l.document,n=l.range}else s=o.exclusive?s.removeBlockAttributesAtRange(n):o.terminal?s.removeLastTerminalAttributeAtRange(n):s.consolidateBlocksAtRange(n);return s.addAttributeAtRange(e,t,n)}removeLastListAttributeAtRange(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{blockList:n}=this;return this.eachBlockAtRange(e,function(r,s,o){const l=r.getLastAttribute();l&&zt(l).listAttribute&&l!==t.exceptAttributeName&&(n=n.editObjectAtIndex(o,()=>r.removeAttribute(l)))}),new this.constructor(n)}removeLastTerminalAttributeAtRange(e){let{blockList:t}=this;return this.eachBlockAtRange(e,function(n,r,s){const o=n.getLastAttribute();o&&zt(o).terminal&&(t=t.editObjectAtIndex(s,()=>n.removeAttribute(o)))}),new this.constructor(t)}removeBlockAttributesAtRange(e){let{blockList:t}=this;return this.eachBlockAtRange(e,function(n,r,s){n.hasAttributes()&&(t=t.editObjectAtIndex(s,()=>n.copyWithoutAttributes()))}),new this.constructor(t)}expandRangeToLineBreaksAndSplitBlocks(e){let t;e=bt(e);let[n,r]=e;const s=this.locationFromPosition(n),o=this.locationFromPosition(r);let l=this;const a=l.getBlockAtIndex(s.index);if(s.offset=a.findLineBreakInDirectionFromPosition("backward",s.offset),s.offset!=null&&(t=l.positionFromLocation(s),l=l.insertBlockBreakAtRange([t,t+1]),o.index+=1,o.offset-=l.getBlockAtIndex(s.index).getLength(),s.index+=1),s.offset=0,o.offset===0&&o.index>s.index)o.index-=1,o.offset=l.getBlockAtIndex(o.index).getBlockBreakPosition();else{const c=l.getBlockAtIndex(o.index);c.text.getStringAtRange([o.offset-1,o.offset])===`
`?o.offset-=1:o.offset=c.findLineBreakInDirectionFromPosition("forward",o.offset),o.offset!==c.getBlockBreakPosition()&&(t=l.positionFromLocation(o),l=l.insertBlockBreakAtRange([t,t+1]))}return n=l.positionFromLocation(s),r=l.positionFromLocation(o),{document:l,range:e=bt([n,r])}}convertLineBreaksToBlockBreaksInRange(e){e=bt(e);let[t]=e;const n=this.getStringAtRange(e).slice(0,-1);let r=this;return n.replace(/.*?\n/g,function(s){t+=s.length,r=r.insertBlockBreakAtRange([t-1,t])}),{document:r,range:e}}consolidateBlocksAtRange(e){e=bt(e);const[t,n]=e,r=this.locationFromPosition(t).index,s=this.locationFromPosition(n).index;return new this.constructor(this.blockList.consolidateFromIndexToIndex(r,s))}getDocumentAtRange(e){e=bt(e);const t=this.blockList.getSplittableListInRange(e).toArray();return new this.constructor(t)}getStringAtRange(e){let t;const n=e=bt(e);return n[n.length-1]!==this.getLength()&&(t=-1),this.getDocumentAtRange(e).toString().slice(0,t)}getBlockAtIndex(e){return this.blockList.getObjectAtIndex(e)}getBlockAtPosition(e){const{index:t}=this.locationFromPosition(e);return this.getBlockAtIndex(t)}getTextAtIndex(e){var t;return(t=this.getBlockAtIndex(e))===null||t===void 0?void 0:t.text}getTextAtPosition(e){const{index:t}=this.locationFromPosition(e);return this.getTextAtIndex(t)}getPieceAtPosition(e){const{index:t,offset:n}=this.locationFromPosition(e);return this.getTextAtIndex(t).getPieceAtPosition(n)}getCharacterAtPosition(e){const{index:t,offset:n}=this.locationFromPosition(e);return this.getTextAtIndex(t).getStringAtRange([n,n+1])}getLength(){return this.blockList.getEndPosition()}getBlocks(){return this.blockList.toArray()}getBlockCount(){return this.blockList.length}getEditCount(){return this.editCount}eachBlock(e){return this.blockList.eachObject(e)}eachBlockAtRange(e,t){let n,r;e=bt(e);const[s,o]=e,l=this.locationFromPosition(s),a=this.locationFromPosition(o);if(l.index===a.index)return n=this.getBlockAtIndex(l.index),r=[l.offset,a.offset],t(n,r,l.index);for(let c=l.index;c<=a.index;c++)if(n=this.getBlockAtIndex(c),n){switch(c){case l.index:r=[l.offset,n.text.getLength()];break;case a.index:r=[0,a.offset];break;default:r=[0,n.text.getLength()]}t(n,r,c)}}getCommonAttributesAtRange(e){e=bt(e);const[t]=e;if(or(e))return this.getCommonAttributesAtPosition(t);{const n=[],r=[];return this.eachBlockAtRange(e,function(s,o){if(o[0]!==o[1])return n.push(s.text.getCommonAttributesAtRange(o)),r.push(c0(s))}),Kn.fromCommonAttributesOfObjects(n).merge(Kn.fromCommonAttributesOfObjects(r)).toObject()}}getCommonAttributesAtPosition(e){let t,n;const{index:r,offset:s}=this.locationFromPosition(e),o=this.getBlockAtIndex(r);if(!o)return{};const l=c0(o),a=o.text.getAttributesAtPosition(s),c=o.text.getAttributesAtPosition(s-1),u=Object.keys(xs).filter(h=>xs[h].inheritable);for(t in c)n=c[t],(n===a[t]||u.includes(t))&&(l[t]=n);return l}getRangeOfCommonAttributeAtPosition(e,t){const{index:n,offset:r}=this.locationFromPosition(t),s=this.getTextAtIndex(n),[o,l]=Array.from(s.getExpandedRangeForAttributeAtOffset(e,r)),a=this.positionFromLocation({index:n,offset:o}),c=this.positionFromLocation({index:n,offset:l});return bt([a,c])}getBaseBlockAttributes(){let e=this.getBlockAtIndex(0).getAttributes();for(let t=1;t<this.getBlockCount();t++){const n=this.getBlockAtIndex(t).getAttributes(),r=Math.min(e.length,n.length);e=(()=>{const s=[];for(let o=0;o<r&&n[o]===e[o];o++)s.push(n[o]);return s})()}return e}getAttachmentById(e){for(const t of this.getAttachments())if(t.id===e)return t}getAttachmentPieces(){let e=[];return this.blockList.eachObject(t=>{let{text:n}=t;return e=e.concat(n.getAttachmentPieces())}),e}getAttachments(){return this.getAttachmentPieces().map(e=>e.attachment)}getRangeOfAttachment(e){let t=0;const n=this.blockList.toArray();for(let r=0;r<n.length;r++){const{text:s}=n[r],o=s.getRangeOfAttachment(e);if(o)return bt([t+o[0],t+o[1]]);t+=s.getLength()}}getLocationRangeOfAttachment(e){const t=this.getRangeOfAttachment(e);return this.locationRangeFromRange(t)}getAttachmentPieceForAttachment(e){for(const t of this.getAttachmentPieces())if(t.attachment===e)return t}findRangesForBlockAttribute(e){let t=0;const n=[];return this.getBlocks().forEach(r=>{const s=r.getLength();r.hasAttribute(e)&&n.push([t,t+s]),t+=s}),n}findRangesForTextAttribute(e){let{withValue:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=0,r=[];const s=[];return this.getPieces().forEach(o=>{const l=o.getLength();(function(a){return t?a.getAttribute(e)===t:a.hasAttribute(e)})(o)&&(r[1]===n?r[1]=n+l:s.push(r=[n,n+l])),n+=l}),s}locationFromPosition(e){const t=this.blockList.findIndexAndOffsetAtPosition(Math.max(0,e));if(t.index!=null)return t;{const n=this.getBlocks();return{index:n.length-1,offset:n[n.length-1].getLength()}}}positionFromLocation(e){return this.blockList.findPositionAtIndexAndOffset(e.index,e.offset)}locationRangeFromPosition(e){return bt(this.locationFromPosition(e))}locationRangeFromRange(e){if(!(e=bt(e)))return;const[t,n]=Array.from(e),r=this.locationFromPosition(t),s=this.locationFromPosition(n);return bt([r,s])}rangeFromLocationRange(e){let t;e=bt(e);const n=this.positionFromLocation(e[0]);return or(e)||(t=this.positionFromLocation(e[1])),bt([n,t])}isEqualTo(e){return this.blockList.isEqualTo(e==null?void 0:e.blockList)}getTexts(){return this.getBlocks().map(e=>e.text)}getPieces(){const e=[];return Array.from(this.getTexts()).forEach(t=>{e.push(...Array.from(t.getPieces()||[]))}),e}getObjects(){return this.getBlocks().concat(this.getTexts()).concat(this.getPieces())}toSerializableDocument(){const e=[];return this.blockList.eachObject(t=>e.push(t.copyWithText(t.text.toSerializableText()))),new this.constructor(e)}toString(){return this.blockList.toString()}toJSON(){return this.blockList.toJSON()}toConsole(){return JSON.stringify(this.blockList.toArray().map(e=>JSON.parse(e.text.toConsole())))}}const c0=function(i){const e={},t=i.getLastAttribute();return t&&(e[t]=!0),e},mf=function(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return{string:i=kl(i),attributes:e,type:"string"}},u0=(i,e)=>{try{return JSON.parse(i.getAttribute("data-trix-".concat(e)))}catch{return{}}};class oa extends Kt{static parse(e,t){const n=new this(e,t);return n.parse(),n}constructor(e){let{referenceElement:t,purifyOptions:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(...arguments),this.html=e,this.referenceElement=t,this.purifyOptions=n,this.blocks=[],this.blockElements=[],this.processedElements=[]}getDocument(){return si.fromJSON(this.blocks)}parse(){try{this.createHiddenContainer(),lh.setHTML(this.containerElement,this.html,{purifyOptions:this.purifyOptions});const e=vu(this.containerElement,{usingFilter:y4});for(;e.nextNode();)this.processNode(e.currentNode);return this.translateBlockElementMarginsToNewlines()}finally{this.removeHiddenContainer()}}createHiddenContainer(){return this.referenceElement?(this.containerElement=this.referenceElement.cloneNode(!1),this.containerElement.removeAttribute("id"),this.containerElement.setAttribute("data-trix-internal",""),this.containerElement.style.display="none",this.referenceElement.parentNode.insertBefore(this.containerElement,this.referenceElement.nextSibling)):(this.containerElement=Ge({tagName:"div",style:{display:"none"}}),document.body.appendChild(this.containerElement))}removeHiddenContainer(){return zr(this.containerElement)}processNode(e){switch(e.nodeType){case Node.TEXT_NODE:if(!this.isInsignificantTextNode(e))return this.appendBlockForTextNode(e),this.processTextNode(e);break;case Node.ELEMENT_NODE:return this.appendBlockForElement(e),this.processElement(e)}}appendBlockForTextNode(e){const t=e.parentNode;if(t===this.currentBlockElement&&this.isBlockElement(e.previousSibling))return this.appendStringWithAttributes(`
`);if(t===this.containerElement||this.isBlockElement(t)){var n;const r=this.getBlockAttributes(t),s=this.getBlockHTMLAttributes(t);Ts(r,(n=this.currentBlock)===null||n===void 0?void 0:n.attributes)||(this.currentBlock=this.appendBlockForAttributesWithElement(r,t,s),this.currentBlockElement=t)}}appendBlockForElement(e){const t=this.isBlockElement(e),n=ws(this.currentBlockElement,e);if(t&&!this.isBlockElement(e.firstChild)){if(!this.isInsignificantTextNode(e.firstChild)||!this.isBlockElement(e.firstElementChild)){const r=this.getBlockAttributes(e),s=this.getBlockHTMLAttributes(e);if(e.firstChild){if(n&&Ts(r,this.currentBlock.attributes))return this.appendStringWithAttributes(`
`);this.currentBlock=this.appendBlockForAttributesWithElement(r,e,s),this.currentBlockElement=e}}}else if(this.currentBlockElement&&!n&&!t){const r=this.findParentBlockElement(e);if(r)return this.appendBlockForElement(r);this.currentBlock=this.appendEmptyBlock(),this.currentBlockElement=null}}findParentBlockElement(e){let{parentElement:t}=e;for(;t&&t!==this.containerElement;){if(this.isBlockElement(t)&&this.blockElements.includes(t))return t;t=t.parentElement}return null}processTextNode(e){let t=e.data;var n;return h0(e.parentNode)||(t=tp(t),Sk((n=e.previousSibling)===null||n===void 0?void 0:n.textContent)&&(t=k4(t))),this.appendStringWithAttributes(t,this.getTextAttributes(e.parentNode))}processElement(e){let t;if(Cs(e)){if(t=u0(e,"attachment"),Object.keys(t).length){const n=this.getTextAttributes(e);this.appendAttachmentWithAttributes(t,n),e.innerHTML=""}return this.processedElements.push(e)}switch(kn(e)){case"br":return this.isExtraBR(e)||this.isBlockElement(e.nextSibling)||this.appendStringWithAttributes(`
`,this.getTextAttributes(e)),this.processedElements.push(e);case"img":t={url:e.getAttribute("src"),contentType:"image"};const n=(r=>{const s=r.getAttribute("width"),o=r.getAttribute("height"),l={};return s&&(l.width=parseInt(s,10)),o&&(l.height=parseInt(o,10)),l})(e);for(const r in n){const s=n[r];t[r]=s}return this.appendAttachmentWithAttributes(t,this.getTextAttributes(e)),this.processedElements.push(e);case"tr":if(this.needsTableSeparator(e))return this.appendStringWithAttributes(Fc.tableRowSeparator);break;case"td":if(this.needsTableSeparator(e))return this.appendStringWithAttributes(Fc.tableCellSeparator)}}appendBlockForAttributesWithElement(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.blockElements.push(t);const r=function(){return{text:[],attributes:arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},htmlAttributes:arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}}}(e,n);return this.blocks.push(r),r}appendEmptyBlock(){return this.appendBlockForAttributesWithElement([],null)}appendStringWithAttributes(e,t){return this.appendPiece(mf(e,t))}appendAttachmentWithAttributes(e,t){return this.appendPiece(function(n){return{attachment:n,attributes:arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},type:"attachment"}}(e,t))}appendPiece(e){return this.blocks.length===0&&this.appendEmptyBlock(),this.blocks[this.blocks.length-1].text.push(e)}appendStringToTextAtIndex(e,t){const{text:n}=this.blocks[t],r=n[n.length-1];if((r==null?void 0:r.type)!=="string")return n.push(mf(e));r.string+=e}prependStringToTextAtIndex(e,t){const{text:n}=this.blocks[t],r=n[0];if((r==null?void 0:r.type)!=="string")return n.unshift(mf(e));r.string=e+r.string}getTextAttributes(e){let t;const n={};for(const r in xs){const s=xs[r];if(s.tagName&&Yr(e,{matchingSelector:s.tagName,untilNode:this.containerElement}))n[r]=!0;else if(s.parser){if(t=s.parser(e),t){let o=!1;for(const l of this.findBlockElementAncestors(e))if(s.parser(l)===t){o=!0;break}o||(n[r]=t)}}else s.styleProperty&&(t=e.style[s.styleProperty],t&&(n[r]=t))}if(Cs(e)){const r=u0(e,"attributes");for(const s in r)t=r[s],n[s]=t}return n}getBlockAttributes(e){const t=[];for(;e&&e!==this.containerElement;){for(const r in Sn){const s=Sn[r];var n;s.parse!==!1&&kn(e)===s.tagName&&((n=s.test)!==null&&n!==void 0&&n.call(s,e)||!s.test)&&(t.push(r),s.listAttribute&&t.push(s.listAttribute))}e=e.parentNode}return t.reverse()}getBlockHTMLAttributes(e){const t={},n=Object.values(Sn).find(r=>r.tagName===kn(e));return((n==null?void 0:n.htmlAttributes)||[]).forEach(r=>{e.hasAttribute(r)&&(t[r]=e.getAttribute(r))}),t}findBlockElementAncestors(e){const t=[];for(;e&&e!==this.containerElement;){const n=kn(e);Nl().includes(n)&&t.push(e),e=e.parentNode}return t}isBlockElement(e){if((e==null?void 0:e.nodeType)===Node.ELEMENT_NODE&&!Cs(e)&&!Yr(e,{matchingSelector:"td",untilNode:this.containerElement}))return Nl().includes(kn(e))||window.getComputedStyle(e).display==="block"}isInsignificantTextNode(e){if((e==null?void 0:e.nodeType)!==Node.TEXT_NODE||!S4(e.data))return;const{parentNode:t,previousSibling:n,nextSibling:r}=e;return w4(t.previousSibling)&&!this.isBlockElement(t.previousSibling)||h0(t)?void 0:!n||this.isBlockElement(n)||!r||this.isBlockElement(r)}isExtraBR(e){return kn(e)==="br"&&this.isBlockElement(e.parentNode)&&e.parentNode.lastChild===e}needsTableSeparator(e){if(Fc.removeBlankTableCells){var t;const n=(t=e.previousSibling)===null||t===void 0?void 0:t.textContent;return n&&/\S/.test(n)}return e.previousSibling}translateBlockElementMarginsToNewlines(){const e=this.getMarginOfDefaultBlockElement();for(let t=0;t<this.blocks.length;t++){const n=this.getMarginOfBlockElementAtIndex(t);n&&(n.top>2*e.top&&this.prependStringToTextAtIndex(`
`,t),n.bottom>2*e.bottom&&this.appendStringToTextAtIndex(`
`,t))}}getMarginOfBlockElementAtIndex(e){const t=this.blockElements[e];if(t&&t.textContent&&!Nl().includes(kn(t))&&!this.processedElements.includes(t))return f0(t)}getMarginOfDefaultBlockElement(){const e=Ge(Sn.default.tagName);return this.containerElement.appendChild(e),f0(e)}}const h0=function(i){const{whiteSpace:e}=window.getComputedStyle(i);return["pre","pre-wrap","pre-line"].includes(e)},w4=i=>i&&!Sk(i.textContent),f0=function(i){const e=window.getComputedStyle(i);if(e.display==="block")return{top:parseInt(e.marginTop),bottom:parseInt(e.marginBottom)}},y4=function(i){return kn(i)==="style"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},k4=i=>i.replace(new RegExp("^".concat(ep.source,"+")),""),S4=i=>new RegExp("^".concat(ep.source,"*$")).test(i),Sk=i=>/\s$/.test(i),_4=["contenteditable","data-trix-id","data-trix-store-key","data-trix-mutable","data-trix-placeholder","tabindex"],Md="data-trix-serialized-attributes",C4="[".concat(Md,"]"),P4=new RegExp("<!--block-->","g"),A4={"application/json":function(i){let e;if(i instanceof si)e=i;else{if(!(i instanceof HTMLElement))throw new Error("unserializable object");e=oa.parse(i.innerHTML).getDocument()}return e.toSerializableDocument().toJSONString()},"text/html":function(i){let e;if(i instanceof si)e=ah.render(i);else{if(!(i instanceof HTMLElement))throw new Error("unserializable object");e=i.cloneNode(!0)}return Array.from(e.querySelectorAll("[data-trix-serialize=false]")).forEach(t=>{zr(t)}),_4.forEach(t=>{Array.from(e.querySelectorAll("[".concat(t,"]"))).forEach(n=>{n.removeAttribute(t)})}),Array.from(e.querySelectorAll(C4)).forEach(t=>{try{const n=JSON.parse(t.getAttribute(Md));t.removeAttribute(Md);for(const r in n){const s=n[r];t.setAttribute(r,s)}}catch{}}),e.innerHTML.replace(P4,"")}};var x4=Object.freeze({__proto__:null});class Nt extends Kt{constructor(e,t){super(...arguments),this.attachmentManager=e,this.attachment=t,this.id=this.attachment.id,this.file=this.attachment.file}remove(){return this.attachmentManager.requestRemovalOfAttachment(this.attachment)}}Nt.proxyMethod("attachment.getAttribute"),Nt.proxyMethod("attachment.hasAttribute"),Nt.proxyMethod("attachment.setAttribute"),Nt.proxyMethod("attachment.getAttributes"),Nt.proxyMethod("attachment.setAttributes"),Nt.proxyMethod("attachment.isPending"),Nt.proxyMethod("attachment.isPreviewable"),Nt.proxyMethod("attachment.getURL"),Nt.proxyMethod("attachment.getPreviewURL"),Nt.proxyMethod("attachment.setPreviewURL"),Nt.proxyMethod("attachment.getHref"),Nt.proxyMethod("attachment.getFilename"),Nt.proxyMethod("attachment.getFilesize"),Nt.proxyMethod("attachment.getFormattedFilesize"),Nt.proxyMethod("attachment.getExtension"),Nt.proxyMethod("attachment.getContentType"),Nt.proxyMethod("attachment.getFile"),Nt.proxyMethod("attachment.setFile"),Nt.proxyMethod("attachment.releaseFile"),Nt.proxyMethod("attachment.getUploadProgress"),Nt.proxyMethod("attachment.setUploadProgress");class _k extends Kt{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),this.managedAttachments={},Array.from(e).forEach(t=>{this.manageAttachment(t)})}getAttachments(){const e=[];for(const t in this.managedAttachments){const n=this.managedAttachments[t];e.push(n)}return e}manageAttachment(e){return this.managedAttachments[e.id]||(this.managedAttachments[e.id]=new Nt(this,e)),this.managedAttachments[e.id]}attachmentIsManaged(e){return e.id in this.managedAttachments}requestRemovalOfAttachment(e){var t,n;if(this.attachmentIsManaged(e))return(t=this.delegate)===null||t===void 0||(n=t.attachmentManagerDidRequestRemovalOfAttachment)===null||n===void 0?void 0:n.call(t,e)}unmanageAttachment(e){const t=this.managedAttachments[e.id];return delete this.managedAttachments[e.id],t}}class Ck{constructor(e){this.composition=e,this.document=this.composition.document;const t=this.composition.getSelectedRange();this.startPosition=t[0],this.endPosition=t[1],this.startLocation=this.document.locationFromPosition(this.startPosition),this.endLocation=this.document.locationFromPosition(this.endPosition),this.block=this.document.getBlockAtIndex(this.endLocation.index),this.breaksOnReturn=this.block.breaksOnReturn(),this.previousCharacter=this.block.text.getStringAtPosition(this.endLocation.offset-1),this.nextCharacter=this.block.text.getStringAtPosition(this.endLocation.offset)}shouldInsertBlockBreak(){return this.block.hasAttributes()&&this.block.isListItem()&&!this.block.isEmpty()?this.startLocation.offset!==0:this.breaksOnReturn&&this.nextCharacter!==`
`}shouldBreakFormattedBlock(){return this.block.hasAttributes()&&!this.block.isListItem()&&(this.breaksOnReturn&&this.nextCharacter===`
`||this.previousCharacter===`
`)}shouldDecreaseListLevel(){return this.block.hasAttributes()&&this.block.isListItem()&&this.block.isEmpty()}shouldPrependListItem(){return this.block.isListItem()&&this.startLocation.offset===0&&!this.block.isEmpty()}shouldRemoveLastBlockAttribute(){return this.block.hasAttributes()&&!this.block.isListItem()&&this.block.isEmpty()}}class Tr extends Kt{constructor(){super(...arguments),this.document=new si,this.attachments=[],this.currentAttributes={},this.revision=0}setDocument(e){var t,n;if(!e.isEqualTo(this.document))return this.document=e,this.refreshAttachments(),this.revision++,(t=this.delegate)===null||t===void 0||(n=t.compositionDidChangeDocument)===null||n===void 0?void 0:n.call(t,e)}getSnapshot(){return{document:this.document,selectedRange:this.getSelectedRange()}}loadSnapshot(e){var t,n,r,s;let{document:o,selectedRange:l}=e;return(t=this.delegate)===null||t===void 0||(n=t.compositionWillLoadSnapshot)===null||n===void 0||n.call(t),this.setDocument(o??new si),this.setSelection(l??[0,0]),(r=this.delegate)===null||r===void 0||(s=r.compositionDidLoadSnapshot)===null||s===void 0?void 0:s.call(r)}insertText(e){let{updatePosition:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{updatePosition:!0};const n=this.getSelectedRange();this.setDocument(this.document.insertTextAtRange(e,n));const r=n[0],s=r+e.getLength();return t&&this.setSelection(s),this.notifyDelegateOfInsertionAtRange([r,s])}insertBlock(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Xi;const t=new si([e]);return this.insertDocument(t)}insertDocument(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new si;const t=this.getSelectedRange();this.setDocument(this.document.insertDocumentAtRange(e,t));const n=t[0],r=n+e.getLength();return this.setSelection(r),this.notifyDelegateOfInsertionAtRange([n,r])}insertString(e,t){const n=this.getCurrentTextAttributes(),r=Si.textForStringWithAttributes(e,n);return this.insertText(r,t)}insertBlockBreak(){const e=this.getSelectedRange();this.setDocument(this.document.insertBlockBreakAtRange(e));const t=e[0],n=t+1;return this.setSelection(n),this.notifyDelegateOfInsertionAtRange([t,n])}insertLineBreak(){const e=new Ck(this);if(e.shouldDecreaseListLevel())return this.decreaseListLevel(),this.setSelection(e.startPosition);if(e.shouldPrependListItem()){const t=new si([e.block.copyWithoutText()]);return this.insertDocument(t)}return e.shouldInsertBlockBreak()?this.insertBlockBreak():e.shouldRemoveLastBlockAttribute()?this.removeLastBlockAttribute():e.shouldBreakFormattedBlock()?this.breakFormattedBlock(e):this.insertString(`
`)}insertHTML(e){const t=oa.parse(e,{purifyOptions:{SAFE_FOR_XML:!0}}).getDocument(),n=this.getSelectedRange();this.setDocument(this.document.mergeDocumentAtRange(t,n));const r=n[0],s=r+t.getLength()-1;return this.setSelection(s),this.notifyDelegateOfInsertionAtRange([r,s])}replaceHTML(e){const t=oa.parse(e).getDocument().copyUsingObjectsFromDocument(this.document),n=this.getLocationRange({strict:!1}),r=this.document.rangeFromLocationRange(n);return this.setDocument(t),this.setSelection(r)}insertFile(e){return this.insertFiles([e])}insertFiles(e){const t=[];return Array.from(e).forEach(n=>{var r;if((r=this.delegate)!==null&&r!==void 0&&r.compositionShouldAcceptFile(n)){const s=Yo.attachmentForFile(n);t.push(s)}}),this.insertAttachments(t)}insertAttachment(e){return this.insertAttachments([e])}insertAttachments(e){let t=new Si;return Array.from(e).forEach(n=>{var r;const s=n.getType(),o=(r=jm[s])===null||r===void 0?void 0:r.presentation,l=this.getCurrentTextAttributes();o&&(l.presentation=o);const a=Si.textForAttachmentWithAttributes(n,l);t=t.appendText(a)}),this.insertText(t)}shouldManageDeletingInDirection(e){const t=this.getLocationRange();if(or(t)){if(e==="backward"&&t[0].offset===0||this.shouldManageMovingCursorInDirection(e))return!0}else if(t[0].index!==t[1].index)return!0;return!1}deleteInDirection(e){let t,n,r,{length:s}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const o=this.getLocationRange();let l=this.getSelectedRange();const a=or(l);if(a?n=e==="backward"&&o[0].offset===0:r=o[0].index!==o[1].index,n&&this.canDecreaseBlockAttributeLevel()){const c=this.getBlock();if(c.isListItem()?this.decreaseListLevel():this.decreaseBlockAttributeLevel(),this.setSelection(l[0]),c.isEmpty())return!1}return a&&(l=this.getExpandedRangeInDirection(e,{length:s}),e==="backward"&&(t=this.getAttachmentAtRange(l))),t?(this.editAttachment(t),!1):(this.setDocument(this.document.removeTextAtRange(l)),this.setSelection(l[0]),!n&&!r&&void 0)}moveTextFromRange(e){const[t]=Array.from(this.getSelectedRange());return this.setDocument(this.document.moveTextFromRangeToPosition(e,t)),this.setSelection(t)}removeAttachment(e){const t=this.document.getRangeOfAttachment(e);if(t)return this.stopEditingAttachment(),this.setDocument(this.document.removeTextAtRange(t)),this.setSelection(t[0])}removeLastBlockAttribute(){const[e,t]=Array.from(this.getSelectedRange()),n=this.document.getBlockAtPosition(t);return this.removeCurrentAttribute(n.getLastAttribute()),this.setSelection(e)}insertPlaceholder(){return this.placeholderPosition=this.getPosition(),this.insertString(" ")}selectPlaceholder(){if(this.placeholderPosition!=null)return this.setSelectedRange([this.placeholderPosition,this.placeholderPosition+1]),this.getSelectedRange()}forgetPlaceholder(){this.placeholderPosition=null}hasCurrentAttribute(e){const t=this.currentAttributes[e];return t!=null&&t!==!1}toggleCurrentAttribute(e){const t=!this.currentAttributes[e];return t?this.setCurrentAttribute(e,t):this.removeCurrentAttribute(e)}canSetCurrentAttribute(e){return zt(e)?this.canSetCurrentBlockAttribute(e):this.canSetCurrentTextAttribute(e)}canSetCurrentTextAttribute(e){const t=this.getSelectedDocument();if(t){for(const n of Array.from(t.getAttachments()))if(!n.hasContent())return!1;return!0}}canSetCurrentBlockAttribute(e){const t=this.getBlock();if(t)return!t.isTerminalBlock()}setCurrentAttribute(e,t){return zt(e)?this.setBlockAttribute(e,t):(this.setTextAttribute(e,t),this.currentAttributes[e]=t,this.notifyDelegateOfCurrentAttributesChange())}setHTMLAtributeAtPosition(e,t,n){var r;const s=this.document.getBlockAtPosition(e),o=(r=zt(s.getLastAttribute()))===null||r===void 0?void 0:r.htmlAttributes;if(s&&o!=null&&o.includes(t)){const l=this.document.setHTMLAttributeAtPosition(e,t,n);this.setDocument(l)}}setTextAttribute(e,t){const n=this.getSelectedRange();if(!n)return;const[r,s]=Array.from(n);if(r!==s)return this.setDocument(this.document.addAttributeAtRange(e,t,n));if(e==="href"){const o=Si.textForStringWithAttributes(t,{href:t});return this.insertText(o)}}setBlockAttribute(e,t){const n=this.getSelectedRange();if(this.canSetCurrentAttribute(e))return this.setDocument(this.document.applyBlockAttributeAtRange(e,t,n)),this.setSelection(n)}removeCurrentAttribute(e){return zt(e)?(this.removeBlockAttribute(e),this.updateCurrentAttributes()):(this.removeTextAttribute(e),delete this.currentAttributes[e],this.notifyDelegateOfCurrentAttributesChange())}removeTextAttribute(e){const t=this.getSelectedRange();if(t)return this.setDocument(this.document.removeAttributeAtRange(e,t))}removeBlockAttribute(e){const t=this.getSelectedRange();if(t)return this.setDocument(this.document.removeAttributeAtRange(e,t))}canDecreaseNestingLevel(){var e;return((e=this.getBlock())===null||e===void 0?void 0:e.getNestingLevel())>0}canIncreaseNestingLevel(){var e;const t=this.getBlock();if(t){if((e=zt(t.getLastNestableAttribute()))===null||e===void 0||!e.listAttribute)return t.getNestingLevel()>0;{const n=this.getPreviousBlock();if(n)return function(){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return Ts((arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).slice(0,r.length),r)}(n.getListItemAttributes(),t.getListItemAttributes())}}}decreaseNestingLevel(){const e=this.getBlock();if(e)return this.setDocument(this.document.replaceBlock(e,e.decreaseNestingLevel()))}increaseNestingLevel(){const e=this.getBlock();if(e)return this.setDocument(this.document.replaceBlock(e,e.increaseNestingLevel()))}canDecreaseBlockAttributeLevel(){var e;return((e=this.getBlock())===null||e===void 0?void 0:e.getAttributeLevel())>0}decreaseBlockAttributeLevel(){var e;const t=(e=this.getBlock())===null||e===void 0?void 0:e.getLastAttribute();if(t)return this.removeCurrentAttribute(t)}decreaseListLevel(){let[e]=Array.from(this.getSelectedRange());const{index:t}=this.document.locationFromPosition(e);let n=t;const r=this.getBlock().getAttributeLevel();let s=this.document.getBlockAtIndex(n+1);for(;s&&s.isListItem()&&!(s.getAttributeLevel()<=r);)n++,s=this.document.getBlockAtIndex(n+1);e=this.document.positionFromLocation({index:t,offset:0});const o=this.document.positionFromLocation({index:n,offset:0});return this.setDocument(this.document.removeLastListAttributeAtRange([e,o]))}updateCurrentAttributes(){const e=this.getSelectedRange({ignoreLock:!0});if(e){const t=this.document.getCommonAttributesAtRange(e);if(Array.from(Pd()).forEach(n=>{t[n]||this.canSetCurrentAttribute(n)||(t[n]=!1)}),!Fo(t,this.currentAttributes))return this.currentAttributes=t,this.notifyDelegateOfCurrentAttributesChange()}}getCurrentAttributes(){return Jy.call({},this.currentAttributes)}getCurrentTextAttributes(){const e={};for(const t in this.currentAttributes){const n=this.currentAttributes[t];n!==!1&&Ad(t)&&(e[t]=n)}return e}freezeSelection(){return this.setCurrentAttribute("frozen",!0)}thawSelection(){return this.removeCurrentAttribute("frozen")}hasFrozenSelection(){return this.hasCurrentAttribute("frozen")}setSelection(e){var t;const n=this.document.locationRangeFromRange(e);return(t=this.delegate)===null||t===void 0?void 0:t.compositionDidRequestChangingSelectionToLocationRange(n)}getSelectedRange(){const e=this.getLocationRange();if(e)return this.document.rangeFromLocationRange(e)}setSelectedRange(e){const t=this.document.locationRangeFromRange(e);return this.getSelectionManager().setLocationRange(t)}getPosition(){const e=this.getLocationRange();if(e)return this.document.positionFromLocation(e[0])}getLocationRange(e){return this.targetLocationRange?this.targetLocationRange:this.getSelectionManager().getLocationRange(e)||bt({index:0,offset:0})}withTargetLocationRange(e,t){let n;this.targetLocationRange=e;try{n=t()}finally{this.targetLocationRange=null}return n}withTargetRange(e,t){const n=this.document.locationRangeFromRange(e);return this.withTargetLocationRange(n,t)}withTargetDOMRange(e,t){const n=this.createLocationRangeFromDOMRange(e,{strict:!1});return this.withTargetLocationRange(n,t)}getExpandedRangeInDirection(e){let{length:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},[n,r]=Array.from(this.getSelectedRange());return e==="backward"?t?n-=t:n=this.translateUTF16PositionFromOffset(n,-1):t?r+=t:r=this.translateUTF16PositionFromOffset(r,1),bt([n,r])}shouldManageMovingCursorInDirection(e){if(this.editingAttachment)return!0;const t=this.getExpandedRangeInDirection(e);return this.getAttachmentAtRange(t)!=null}moveCursorInDirection(e){let t,n;if(this.editingAttachment)n=this.document.getRangeOfAttachment(this.editingAttachment);else{const r=this.getSelectedRange();n=this.getExpandedRangeInDirection(e),t=!wu(r,n)}if(e==="backward"?this.setSelectedRange(n[0]):this.setSelectedRange(n[1]),t){const r=this.getAttachmentAtRange(n);if(r)return this.editAttachment(r)}}expandSelectionInDirection(e){let{length:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const n=this.getExpandedRangeInDirection(e,{length:t});return this.setSelectedRange(n)}expandSelectionForEditing(){if(this.hasCurrentAttribute("href"))return this.expandSelectionAroundCommonAttribute("href")}expandSelectionAroundCommonAttribute(e){const t=this.getPosition(),n=this.document.getRangeOfCommonAttributeAtPosition(e,t);return this.setSelectedRange(n)}selectionContainsAttachments(){var e;return((e=this.getSelectedAttachments())===null||e===void 0?void 0:e.length)>0}selectionIsInCursorTarget(){return this.editingAttachment||this.positionIsCursorTarget(this.getPosition())}positionIsCursorTarget(e){const t=this.document.locationFromPosition(e);if(t)return this.locationIsCursorTarget(t)}positionIsBlockBreak(e){var t;return(t=this.document.getPieceAtPosition(e))===null||t===void 0?void 0:t.isBlockBreak()}getSelectedDocument(){const e=this.getSelectedRange();if(e)return this.document.getDocumentAtRange(e)}getSelectedAttachments(){var e;return(e=this.getSelectedDocument())===null||e===void 0?void 0:e.getAttachments()}getAttachments(){return this.attachments.slice(0)}refreshAttachments(){const e=this.document.getAttachments(),{added:t,removed:n}=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const o=[],l=[],a=new Set;r.forEach(u=>{a.add(u)});const c=new Set;return s.forEach(u=>{c.add(u),a.has(u)||o.push(u)}),r.forEach(u=>{c.has(u)||l.push(u)}),{added:o,removed:l}}(this.attachments,e);return this.attachments=e,Array.from(n).forEach(r=>{var s,o;r.delegate=null,(s=this.delegate)===null||s===void 0||(o=s.compositionDidRemoveAttachment)===null||o===void 0||o.call(s,r)}),(()=>{const r=[];return Array.from(t).forEach(s=>{var o,l;s.delegate=this,r.push((o=this.delegate)===null||o===void 0||(l=o.compositionDidAddAttachment)===null||l===void 0?void 0:l.call(o,s))}),r})()}attachmentDidChangeAttributes(e){var t,n;return this.revision++,(t=this.delegate)===null||t===void 0||(n=t.compositionDidEditAttachment)===null||n===void 0?void 0:n.call(t,e)}attachmentDidChangePreviewURL(e){var t,n;return this.revision++,(t=this.delegate)===null||t===void 0||(n=t.compositionDidChangeAttachmentPreviewURL)===null||n===void 0?void 0:n.call(t,e)}editAttachment(e,t){var n,r;if(e!==this.editingAttachment)return this.stopEditingAttachment(),this.editingAttachment=e,(n=this.delegate)===null||n===void 0||(r=n.compositionDidStartEditingAttachment)===null||r===void 0?void 0:r.call(n,this.editingAttachment,t)}stopEditingAttachment(){var e,t;this.editingAttachment&&((e=this.delegate)===null||e===void 0||(t=e.compositionDidStopEditingAttachment)===null||t===void 0||t.call(e,this.editingAttachment),this.editingAttachment=null)}updateAttributesForAttachment(e,t){return this.setDocument(this.document.updateAttributesForAttachment(e,t))}removeAttributeForAttachment(e,t){return this.setDocument(this.document.removeAttributeForAttachment(e,t))}breakFormattedBlock(e){let{document:t}=e;const{block:n}=e;let r=e.startPosition,s=[r-1,r];n.getBlockBreakPosition()===e.startLocation.offset?(n.breaksOnReturn()&&e.nextCharacter===`
`?r+=1:t=t.removeTextAtRange(s),s=[r,r]):e.nextCharacter===`
`?e.previousCharacter===`
`?s=[r-1,r+1]:(s=[r,r+1],r+=1):e.startLocation.offset-1!=0&&(r+=1);const o=new si([n.removeLastAttribute().copyWithoutText()]);return this.setDocument(t.insertDocumentAtRange(o,s)),this.setSelection(r)}getPreviousBlock(){const e=this.getLocationRange();if(e){const{index:t}=e[0];if(t>0)return this.document.getBlockAtIndex(t-1)}}getBlock(){const e=this.getLocationRange();if(e)return this.document.getBlockAtIndex(e[0].index)}getAttachmentAtRange(e){const t=this.document.getDocumentAtRange(e);if(t.toString()==="".concat("",`
`))return t.getAttachments()[0]}notifyDelegateOfCurrentAttributesChange(){var e,t;return(e=this.delegate)===null||e===void 0||(t=e.compositionDidChangeCurrentAttributes)===null||t===void 0?void 0:t.call(e,this.currentAttributes)}notifyDelegateOfInsertionAtRange(e){var t,n;return(t=this.delegate)===null||t===void 0||(n=t.compositionDidPerformInsertionAtRange)===null||n===void 0?void 0:n.call(t,e)}translateUTF16PositionFromOffset(e,t){const n=this.document.toUTF16String(),r=n.offsetFromUCS2Offset(e);return n.offsetToUCS2Offset(r+t)}}Tr.proxyMethod("getSelectionManager().getPointRange"),Tr.proxyMethod("getSelectionManager().setLocationRangeFromPointRange"),Tr.proxyMethod("getSelectionManager().createLocationRangeFromDOMRange"),Tr.proxyMethod("getSelectionManager().locationIsCursorTarget"),Tr.proxyMethod("getSelectionManager().selectionIsExpanded"),Tr.proxyMethod("delegate?.getSelectionManager");class Ed extends Kt{constructor(e){super(...arguments),this.composition=e,this.undoEntries=[],this.redoEntries=[]}recordUndoEntry(e){let{context:t,consolidatable:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.undoEntries.slice(-1)[0];if(!n||!T4(r,e,t)){const s=this.createEntry({description:e,context:t});this.undoEntries.push(s),this.redoEntries=[]}}undo(){const e=this.undoEntries.pop();if(e){const t=this.createEntry(e);return this.redoEntries.push(t),this.composition.loadSnapshot(e.snapshot)}}redo(){const e=this.redoEntries.pop();if(e){const t=this.createEntry(e);return this.undoEntries.push(t),this.composition.loadSnapshot(e.snapshot)}}canUndo(){return this.undoEntries.length>0}canRedo(){return this.redoEntries.length>0}createEntry(){let{description:e,context:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{description:e==null?void 0:e.toString(),context:JSON.stringify(t),snapshot:this.composition.getSnapshot()}}}const T4=(i,e,t)=>(i==null?void 0:i.description)===(e==null?void 0:e.toString())&&(i==null?void 0:i.context)===JSON.stringify(t),pf="attachmentGallery";class Pk{constructor(e){this.document=e.document,this.selectedRange=e.selectedRange}perform(){return this.removeBlockAttribute(),this.applyBlockAttribute()}getSnapshot(){return{document:this.document,selectedRange:this.selectedRange}}removeBlockAttribute(){return this.findRangesOfBlocks().map(e=>this.document=this.document.removeAttributeAtRange(pf,e))}applyBlockAttribute(){let e=0;this.findRangesOfPieces().forEach(t=>{t[1]-t[0]>1&&(t[0]+=e,t[1]+=e,this.document.getCharacterAtPosition(t[1])!==`
`&&(this.document=this.document.insertBlockBreakAtRange(t[1]),t[1]<this.selectedRange[1]&&this.moveSelectedRangeForward(),t[1]++,e++),t[0]!==0&&this.document.getCharacterAtPosition(t[0]-1)!==`
`&&(this.document=this.document.insertBlockBreakAtRange(t[0]),t[0]<this.selectedRange[0]&&this.moveSelectedRangeForward(),t[0]++,e++),this.document=this.document.applyBlockAttributeAtRange(pf,!0,t))})}findRangesOfBlocks(){return this.document.findRangesForBlockAttribute(pf)}findRangesOfPieces(){return this.document.findRangesForTextAttribute("presentation",{withValue:"gallery"})}moveSelectedRangeForward(){this.selectedRange[0]+=1,this.selectedRange[1]+=1}}const Ak=function(i){const e=new Pk(i);return e.perform(),e.getSnapshot()},Q4=[Ak];class xk{constructor(e,t,n){this.insertFiles=this.insertFiles.bind(this),this.composition=e,this.selectionManager=t,this.element=n,this.undoManager=new Ed(this.composition),this.filters=Q4.slice(0)}loadDocument(e){return this.loadSnapshot({document:e,selectedRange:[0,0]})}loadHTML(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";const t=oa.parse(e,{referenceElement:this.element}).getDocument();return this.loadDocument(t)}loadJSON(e){let{document:t,selectedRange:n}=e;return t=si.fromJSON(t),this.loadSnapshot({document:t,selectedRange:n})}loadSnapshot(e){return this.undoManager=new Ed(this.composition),this.composition.loadSnapshot(e)}getDocument(){return this.composition.document}getSelectedDocument(){return this.composition.getSelectedDocument()}getSnapshot(){return this.composition.getSnapshot()}toJSON(){return this.getSnapshot()}deleteInDirection(e){return this.composition.deleteInDirection(e)}insertAttachment(e){return this.composition.insertAttachment(e)}insertAttachments(e){return this.composition.insertAttachments(e)}insertDocument(e){return this.composition.insertDocument(e)}insertFile(e){return this.composition.insertFile(e)}insertFiles(e){return this.composition.insertFiles(e)}insertHTML(e){return this.composition.insertHTML(e)}insertString(e){return this.composition.insertString(e)}insertText(e){return this.composition.insertText(e)}insertLineBreak(){return this.composition.insertLineBreak()}getSelectedRange(){return this.composition.getSelectedRange()}getPosition(){return this.composition.getPosition()}getClientRectAtPosition(e){const t=this.getDocument().locationRangeFromRange([e,e+1]);return this.selectionManager.getClientRectAtLocationRange(t)}expandSelectionInDirection(e){return this.composition.expandSelectionInDirection(e)}moveCursorInDirection(e){return this.composition.moveCursorInDirection(e)}setSelectedRange(e){return this.composition.setSelectedRange(e)}activateAttribute(e){let t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return this.composition.setCurrentAttribute(e,t)}attributeIsActive(e){return this.composition.hasCurrentAttribute(e)}canActivateAttribute(e){return this.composition.canSetCurrentAttribute(e)}deactivateAttribute(e){return this.composition.removeCurrentAttribute(e)}setHTMLAtributeAtPosition(e,t,n){this.composition.setHTMLAtributeAtPosition(e,t,n)}canDecreaseNestingLevel(){return this.composition.canDecreaseNestingLevel()}canIncreaseNestingLevel(){return this.composition.canIncreaseNestingLevel()}decreaseNestingLevel(){if(this.canDecreaseNestingLevel())return this.composition.decreaseNestingLevel()}increaseNestingLevel(){if(this.canIncreaseNestingLevel())return this.composition.increaseNestingLevel()}canRedo(){return this.undoManager.canRedo()}canUndo(){return this.undoManager.canUndo()}recordUndoEntry(e){let{context:t,consolidatable:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.undoManager.recordUndoEntry(e,{context:t,consolidatable:n})}redo(){if(this.canRedo())return this.undoManager.redo()}undo(){if(this.canUndo())return this.undoManager.undo()}}class Tk{constructor(e){this.element=e}findLocationFromContainerAndOffset(e,t){let{strict:n}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{strict:!0},r=0,s=!1;const o={index:0,offset:0},l=this.findAttachmentElementParentForNode(e);l&&(e=l.parentNode,t=Hh(l));const a=vu(this.element,{usingFilter:Qk});for(;a.nextNode();){const c=a.currentNode;if(c===e&&Zl(e)){mo(c)||(o.offset+=t);break}if(c.parentNode===e){if(r++===t){!n&&Jh(c,{strict:n})&&(s&&o.index++,o.offset=0,s=!0);break}}else if(!ws(e,c)&&r>0)break;Jh(c,{strict:n})?(s&&o.index++,o.offset=0,s=!0):o.offset+=gf(c)}return o}findContainerAndOffsetFromLocation(e){let t,n;if(e.index===0&&e.offset===0){for(t=this.element,n=0;t.firstChild;)if(t=t.firstChild,Kh(t)){n=1;break}return[t,n]}let[r,s]=this.findNodeAndOffsetFromLocation(e);if(r){if(Zl(r))gf(r)===0?(t=r.parentNode.parentNode,n=Hh(r.parentNode),mo(r,{name:"right"})&&n++):(t=r,n=e.offset-s);else{if(t=r.parentNode,!Jh(r.previousSibling)&&!Kh(t))for(;r===t.lastChild&&(r=t,t=t.parentNode,!Kh(t)););n=Hh(r),e.offset!==0&&n++}return[t,n]}}findNodeAndOffsetFromLocation(e){let t,n,r=0;for(const s of this.getSignificantNodesForIndex(e.index)){const o=gf(s);if(e.offset<=r+o)if(Zl(s)){if(t=s,n=r,e.offset===n&&mo(t))break}else t||(t=s,n=r);if(r+=o,r>e.offset)break}return[t,n]}findAttachmentElementParentForNode(e){for(;e&&e!==this.element;){if(Cs(e))return e;e=e.parentNode}}getSignificantNodesForIndex(e){const t=[],n=vu(this.element,{usingFilter:M4});let r=!1;for(;n.nextNode();){const o=n.currentNode;var s;if(fo(o)){if(s!=null?s++:s=0,s===e)r=!0;else if(r)break}else r&&t.push(o)}return t}}const gf=function(i){return i.nodeType===Node.TEXT_NODE?mo(i)?0:i.textContent.length:kn(i)==="br"||Cs(i)?1:0},M4=function(i){return E4(i)===NodeFilter.FILTER_ACCEPT?Qk(i):NodeFilter.FILTER_REJECT},E4=function(i){return nk(i)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},Qk=function(i){return Cs(i.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT};class Mk{createDOMRangeFromPoint(e){let t,{x:n,y:r}=e;if(document.caretPositionFromPoint){const{offsetNode:s,offset:o}=document.caretPositionFromPoint(n,r);return t=document.createRange(),t.setStart(s,o),t}if(document.caretRangeFromPoint)return document.caretRangeFromPoint(n,r);if(document.body.createTextRange){const s=Bl();try{const o=document.body.createTextRange();o.moveToPoint(n,r),o.select()}catch{}return t=Bl(),uk(s),t}}getClientRectsForDOMRange(e){const t=Array.from(e.getClientRects());return[t[0],t[t.length-1]]}}class gs extends Kt{constructor(e){super(...arguments),this.didMouseDown=this.didMouseDown.bind(this),this.selectionDidChange=this.selectionDidChange.bind(this),this.element=e,this.locationMapper=new Tk(this.element),this.pointMapper=new Mk,this.lockCount=0,Zt("mousedown",{onElement:this.element,withCallback:this.didMouseDown})}getLocationRange(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return e.strict===!1?this.createLocationRangeFromDOMRange(Bl()):e.ignoreLock?this.currentLocationRange:this.lockedLocationRange?this.lockedLocationRange:this.currentLocationRange}setLocationRange(e){if(this.lockedLocationRange)return;e=bt(e);const t=this.createDOMRangeFromLocationRange(e);t&&(uk(t),this.updateCurrentLocationRange(e))}setLocationRangeFromPointRange(e){e=bt(e);const t=this.getLocationAtPoint(e[0]),n=this.getLocationAtPoint(e[1]);this.setLocationRange([t,n])}getClientRectAtLocationRange(e){const t=this.createDOMRangeFromLocationRange(e);if(t)return this.getClientRectsForDOMRange(t)[1]}locationIsCursorTarget(e){const t=Array.from(this.findNodeAndOffsetFromLocation(e))[0];return mo(t)}lock(){this.lockCount++==0&&(this.updateCurrentLocationRange(),this.lockedLocationRange=this.getLocationRange())}unlock(){if(--this.lockCount==0){const{lockedLocationRange:e}=this;if(this.lockedLocationRange=null,e!=null)return this.setLocationRange(e)}}clearSelection(){var e;return(e=ck())===null||e===void 0?void 0:e.removeAllRanges()}selectionIsCollapsed(){var e;return((e=Bl())===null||e===void 0?void 0:e.collapsed)===!0}selectionIsExpanded(){return!this.selectionIsCollapsed()}createLocationRangeFromDOMRange(e,t){if(e==null||!this.domRangeWithinElement(e))return;const n=this.findLocationFromContainerAndOffset(e.startContainer,e.startOffset,t);if(!n)return;const r=e.collapsed?void 0:this.findLocationFromContainerAndOffset(e.endContainer,e.endOffset,t);return bt([n,r])}didMouseDown(){return this.pauseTemporarily()}pauseTemporarily(){let e;this.paused=!0;const t=()=>{if(this.paused=!1,clearTimeout(n),Array.from(e).forEach(r=>{r.destroy()}),ws(document,this.element))return this.selectionDidChange()},n=setTimeout(t,200);e=["mousemove","keydown"].map(r=>Zt(r,{onElement:document,withCallback:t}))}selectionDidChange(){if(!this.paused&&!Gm(this.element))return this.updateCurrentLocationRange()}updateCurrentLocationRange(e){var t,n;if((e??(e=this.createLocationRangeFromDOMRange(Bl())))&&!wu(e,this.currentLocationRange))return this.currentLocationRange=e,(t=this.delegate)===null||t===void 0||(n=t.locationRangeDidChange)===null||n===void 0?void 0:n.call(t,this.currentLocationRange.slice(0))}createDOMRangeFromLocationRange(e){const t=this.findContainerAndOffsetFromLocation(e[0]),n=or(e)?t:this.findContainerAndOffsetFromLocation(e[1])||t;if(t!=null&&n!=null){const r=document.createRange();return r.setStart(...Array.from(t||[])),r.setEnd(...Array.from(n||[])),r}}getLocationAtPoint(e){const t=this.createDOMRangeFromPoint(e);var n;if(t)return(n=this.createLocationRangeFromDOMRange(t))===null||n===void 0?void 0:n[0]}domRangeWithinElement(e){return e.collapsed?ws(this.element,e.startContainer):ws(this.element,e.startContainer)&&ws(this.element,e.endContainer)}}gs.proxyMethod("locationMapper.findLocationFromContainerAndOffset"),gs.proxyMethod("locationMapper.findContainerAndOffsetFromLocation"),gs.proxyMethod("locationMapper.findNodeAndOffsetFromLocation"),gs.proxyMethod("pointMapper.createDOMRangeFromPoint"),gs.proxyMethod("pointMapper.getClientRectsForDOMRange");var Ek=Object.freeze({__proto__:null,Attachment:Yo,AttachmentManager:_k,AttachmentPiece:xo,Block:Xi,Composition:Tr,Document:si,Editor:xk,HTMLParser:oa,HTMLSanitizer:lh,LineBreakInsertion:Ck,LocationMapper:Tk,ManagedAttachment:Nt,Piece:Bs,PointMapper:Mk,SelectionManager:gs,SplittableList:ku,StringPiece:rp,Text:Si,UndoManager:Ed}),R4=Object.freeze({__proto__:null,ObjectView:Zs,AttachmentView:ip,BlockView:bk,DocumentView:ah,PieceView:gk,PreviewableAttachmentView:pk,TextView:Ok});const{lang:Of,css:cs,keyNames:D4}=$a,bf=function(i){return function(){const e=i.apply(this,arguments);e.do(),this.undos||(this.undos=[]),this.undos.push(e.undo)}};class Rk extends Kt{constructor(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(...arguments),gn(this,"makeElementMutable",bf(()=>({do:()=>{this.element.dataset.trixMutable=!0},undo:()=>delete this.element.dataset.trixMutable}))),gn(this,"addToolbar",bf(()=>{const s=Ge({tagName:"div",className:cs.attachmentToolbar,data:{trixMutable:!0},childNodes:Ge({tagName:"div",className:"trix-button-row",childNodes:Ge({tagName:"span",className:"trix-button-group trix-button-group--actions",childNodes:Ge({tagName:"button",className:"trix-button trix-button--remove",textContent:Of.remove,attributes:{title:Of.remove},data:{trixAction:"remove"}})})})});return this.attachment.isPreviewable()&&s.appendChild(Ge({tagName:"div",className:cs.attachmentMetadataContainer,childNodes:Ge({tagName:"span",className:cs.attachmentMetadata,childNodes:[Ge({tagName:"span",className:cs.attachmentName,textContent:this.attachment.getFilename(),attributes:{title:this.attachment.getFilename()}}),Ge({tagName:"span",className:cs.attachmentSize,textContent:this.attachment.getFormattedFilesize()})]})})),Zt("click",{onElement:s,withCallback:this.didClickToolbar}),Zt("click",{onElement:s,matchingSelector:"[data-trix-action]",withCallback:this.didClickActionButton}),Il("trix-attachment-before-toolbar",{onElement:this.element,attributes:{toolbar:s,attachment:this.attachment}}),{do:()=>this.element.appendChild(s),undo:()=>zr(s)}})),gn(this,"installCaptionEditor",bf(()=>{const s=Ge({tagName:"textarea",className:cs.attachmentCaptionEditor,attributes:{placeholder:Of.captionPlaceholder},data:{trixMutable:!0}});s.value=this.attachmentPiece.getCaption();const o=s.cloneNode();o.classList.add("trix-autoresize-clone"),o.tabIndex=-1;const l=function(){o.value=s.value,s.style.height=o.scrollHeight+"px"};Zt("input",{onElement:s,withCallback:l}),Zt("input",{onElement:s,withCallback:this.didInputCaption}),Zt("keydown",{onElement:s,withCallback:this.didKeyDownCaption}),Zt("change",{onElement:s,withCallback:this.didChangeCaption}),Zt("blur",{onElement:s,withCallback:this.didBlurCaption});const a=this.element.querySelector("figcaption"),c=a.cloneNode();return{do:()=>{if(a.style.display="none",c.appendChild(s),c.appendChild(o),c.classList.add("".concat(cs.attachmentCaption,"--editing")),a.parentElement.insertBefore(c,a),l(),this.options.editCaption)return Jm(()=>s.focus())},undo(){zr(c),a.style.display=null}}})),this.didClickToolbar=this.didClickToolbar.bind(this),this.didClickActionButton=this.didClickActionButton.bind(this),this.didKeyDownCaption=this.didKeyDownCaption.bind(this),this.didInputCaption=this.didInputCaption.bind(this),this.didChangeCaption=this.didChangeCaption.bind(this),this.didBlurCaption=this.didBlurCaption.bind(this),this.attachmentPiece=e,this.element=t,this.container=n,this.options=r,this.attachment=this.attachmentPiece.attachment,kn(this.element)==="a"&&(this.element=this.element.firstChild),this.install()}install(){this.makeElementMutable(),this.addToolbar(),this.attachment.isPreviewable()&&this.installCaptionEditor()}uninstall(){var e;let t=this.undos.pop();for(this.savePendingCaption();t;)t(),t=this.undos.pop();(e=this.delegate)===null||e===void 0||e.didUninstallAttachmentEditor(this)}savePendingCaption(){if(this.pendingCaption!=null){const s=this.pendingCaption;var e,t,n,r;this.pendingCaption=null,s?(e=this.delegate)===null||e===void 0||(t=e.attachmentEditorDidRequestUpdatingAttributesForAttachment)===null||t===void 0||t.call(e,{caption:s},this.attachment):(n=this.delegate)===null||n===void 0||(r=n.attachmentEditorDidRequestRemovingAttributeForAttachment)===null||r===void 0||r.call(n,"caption",this.attachment)}}didClickToolbar(e){return e.preventDefault(),e.stopPropagation()}didClickActionButton(e){var t;if(e.target.getAttribute("data-trix-action")==="remove")return(t=this.delegate)===null||t===void 0?void 0:t.attachmentEditorDidRequestRemovalOfAttachment(this.attachment)}didKeyDownCaption(e){var t,n;if(D4[e.keyCode]==="return")return e.preventDefault(),this.savePendingCaption(),(t=this.delegate)===null||t===void 0||(n=t.attachmentEditorDidRequestDeselectingAttachment)===null||n===void 0?void 0:n.call(t,this.attachment)}didInputCaption(e){this.pendingCaption=e.target.value.replace(/\s/g," ").trim()}didChangeCaption(e){return this.savePendingCaption()}didBlurCaption(e){return this.savePendingCaption()}}class Dk extends Kt{constructor(e,t){super(...arguments),this.didFocus=this.didFocus.bind(this),this.didBlur=this.didBlur.bind(this),this.didClickAttachment=this.didClickAttachment.bind(this),this.element=e,this.composition=t,this.documentView=new ah(this.composition.document,{element:this.element}),Zt("focus",{onElement:this.element,withCallback:this.didFocus}),Zt("blur",{onElement:this.element,withCallback:this.didBlur}),Zt("click",{onElement:this.element,matchingSelector:"a[contenteditable=false]",preventDefault:!0}),Zt("mousedown",{onElement:this.element,matchingSelector:_s,withCallback:this.didClickAttachment}),Zt("click",{onElement:this.element,matchingSelector:"a".concat(_s),preventDefault:!0})}didFocus(e){var t;const n=()=>{var r,s;if(!this.focused)return this.focused=!0,(r=this.delegate)===null||r===void 0||(s=r.compositionControllerDidFocus)===null||s===void 0?void 0:s.call(r)};return((t=this.blurPromise)===null||t===void 0?void 0:t.then(n))||n()}didBlur(e){this.blurPromise=new Promise(t=>Jm(()=>{var n,r;return Gm(this.element)||(this.focused=null,(n=this.delegate)===null||n===void 0||(r=n.compositionControllerDidBlur)===null||r===void 0||r.call(n)),this.blurPromise=null,t()}))}didClickAttachment(e,t){var n,r;const s=this.findAttachmentForElement(t),o=!!Yr(e.target,{matchingSelector:"figcaption"});return(n=this.delegate)===null||n===void 0||(r=n.compositionControllerDidSelectAttachment)===null||r===void 0?void 0:r.call(n,s,{editCaption:o})}getSerializableElement(){return this.isEditingAttachment()?this.documentView.shadowElement:this.element}render(){var e,t,n,r,s,o;return this.revision!==this.composition.revision&&(this.documentView.setDocument(this.composition.document),this.documentView.render(),this.revision=this.composition.revision),this.canSyncDocumentView()&&!this.documentView.isSynced()&&((n=this.delegate)===null||n===void 0||(r=n.compositionControllerWillSyncDocumentView)===null||r===void 0||r.call(n),this.documentView.sync(),(s=this.delegate)===null||s===void 0||(o=s.compositionControllerDidSyncDocumentView)===null||o===void 0||o.call(s)),(e=this.delegate)===null||e===void 0||(t=e.compositionControllerDidRender)===null||t===void 0?void 0:t.call(e)}rerenderViewForObject(e){return this.invalidateViewForObject(e),this.render()}invalidateViewForObject(e){return this.documentView.invalidateViewForObject(e)}isViewCachingEnabled(){return this.documentView.isViewCachingEnabled()}enableViewCaching(){return this.documentView.enableViewCaching()}disableViewCaching(){return this.documentView.disableViewCaching()}refreshViewCache(){return this.documentView.garbageCollectCachedViews()}isEditingAttachment(){return!!this.attachmentEditor}installAttachmentEditorForAttachment(e,t){var n;if(((n=this.attachmentEditor)===null||n===void 0?void 0:n.attachment)===e)return;const r=this.documentView.findElementForObject(e);if(!r)return;this.uninstallAttachmentEditor();const s=this.composition.document.getAttachmentPieceForAttachment(e);this.attachmentEditor=new Rk(s,r,this.element,t),this.attachmentEditor.delegate=this}uninstallAttachmentEditor(){var e;return(e=this.attachmentEditor)===null||e===void 0?void 0:e.uninstall()}didUninstallAttachmentEditor(){return this.attachmentEditor=null,this.render()}attachmentEditorDidRequestUpdatingAttributesForAttachment(e,t){var n,r;return(n=this.delegate)===null||n===void 0||(r=n.compositionControllerWillUpdateAttachment)===null||r===void 0||r.call(n,t),this.composition.updateAttributesForAttachment(e,t)}attachmentEditorDidRequestRemovingAttributeForAttachment(e,t){var n,r;return(n=this.delegate)===null||n===void 0||(r=n.compositionControllerWillUpdateAttachment)===null||r===void 0||r.call(n,t),this.composition.removeAttributeForAttachment(e,t)}attachmentEditorDidRequestRemovalOfAttachment(e){var t,n;return(t=this.delegate)===null||t===void 0||(n=t.compositionControllerDidRequestRemovalOfAttachment)===null||n===void 0?void 0:n.call(t,e)}attachmentEditorDidRequestDeselectingAttachment(e){var t,n;return(t=this.delegate)===null||t===void 0||(n=t.compositionControllerDidRequestDeselectingAttachment)===null||n===void 0?void 0:n.call(t,e)}canSyncDocumentView(){return!this.isEditingAttachment()}findAttachmentForElement(e){return this.composition.document.getAttachmentById(parseInt(e.dataset.trixId,10))}}class $k extends Kt{}const Lk="data-trix-mutable",$4="[".concat(Lk,"]"),L4={attributes:!0,childList:!0,characterData:!0,characterDataOldValue:!0,subtree:!0};class Ik extends Kt{constructor(e){super(e),this.didMutate=this.didMutate.bind(this),this.element=e,this.observer=new window.MutationObserver(this.didMutate),this.start()}start(){return this.reset(),this.observer.observe(this.element,L4)}stop(){return this.observer.disconnect()}didMutate(e){var t,n;if(this.mutations.push(...Array.from(this.findSignificantMutations(e)||[])),this.mutations.length)return(t=this.delegate)===null||t===void 0||(n=t.elementDidMutate)===null||n===void 0||n.call(t,this.getMutationSummary()),this.reset()}reset(){this.mutations=[]}findSignificantMutations(e){return e.filter(t=>this.mutationIsSignificant(t))}mutationIsSignificant(e){if(this.nodeIsMutable(e.target))return!1;for(const t of Array.from(this.nodesModifiedByMutation(e)))if(this.nodeIsSignificant(t))return!0;return!1}nodeIsSignificant(e){return e!==this.element&&!this.nodeIsMutable(e)&&!nk(e)}nodeIsMutable(e){return Yr(e,{matchingSelector:$4})}nodesModifiedByMutation(e){const t=[];switch(e.type){case"attributes":e.attributeName!==Lk&&t.push(e.target);break;case"characterData":t.push(e.target.parentNode),t.push(e.target);break;case"childList":t.push(...Array.from(e.addedNodes||[])),t.push(...Array.from(e.removedNodes||[]))}return t}getMutationSummary(){return this.getTextMutationSummary()}getTextMutationSummary(){const{additions:e,deletions:t}=this.getTextChangesFromCharacterData(),n=this.getTextChangesFromChildList();Array.from(n.additions).forEach(l=>{Array.from(e).includes(l)||e.push(l)}),t.push(...Array.from(n.deletions||[]));const r={},s=e.join("");s&&(r.textAdded=s);const o=t.join("");return o&&(r.textDeleted=o),r}getMutationsByType(e){return Array.from(this.mutations).filter(t=>t.type===e)}getTextChangesFromChildList(){let e,t;const n=[],r=[];Array.from(this.getMutationsByType("childList")).forEach(l=>{n.push(...Array.from(l.addedNodes||[])),r.push(...Array.from(l.removedNodes||[]))}),n.length===0&&r.length===1&&fo(r[0])?(e=[],t=[`
`]):(e=Rd(n),t=Rd(r));const s=e.filter((l,a)=>l!==t[a]).map(kl),o=t.filter((l,a)=>l!==e[a]).map(kl);return{additions:s,deletions:o}}getTextChangesFromCharacterData(){let e,t;const n=this.getMutationsByType("characterData");if(n.length){const r=n[0],s=n[n.length-1],o=function(l,a){let c,u;return l=sa.box(l),(a=sa.box(a)).length<l.length?[u,c]=V1(l,a):[c,u]=V1(a,l),{added:c,removed:u}}(kl(r.oldValue),kl(s.target.data));e=o.added,t=o.removed}return{additions:e?[e]:[],deletions:t?[t]:[]}}}const Rd=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];const e=[];for(const t of Array.from(i))switch(t.nodeType){case Node.TEXT_NODE:e.push(t.data);break;case Node.ELEMENT_NODE:kn(t)==="br"?e.push(`
`):e.push(...Array.from(Rd(t.childNodes)||[]))}return e};class Nk extends yu{constructor(e){super(...arguments),this.file=e}perform(e){const t=new FileReader;return t.onerror=()=>e(!1),t.onload=()=>{t.onerror=null;try{t.abort()}catch{}return e(!0,this.file)},t.readAsArrayBuffer(this.file)}}class I4{constructor(e){this.element=e}shouldIgnore(e){return!!Da.samsungAndroid&&(this.previousEvent=this.event,this.event=e,this.checkSamsungKeyboardBuggyModeStart(),this.checkSamsungKeyboardBuggyModeEnd(),this.buggyMode)}checkSamsungKeyboardBuggyModeStart(){this.insertingLongTextAfterUnidentifiedChar()&&N4(this.element.innerText,this.event.data)&&(this.buggyMode=!0,this.event.preventDefault())}checkSamsungKeyboardBuggyModeEnd(){this.buggyMode&&this.event.inputType!=="insertText"&&(this.buggyMode=!1)}insertingLongTextAfterUnidentifiedChar(){var e;return this.isBeforeInputInsertText()&&this.previousEventWasUnidentifiedKeydown()&&((e=this.event.data)===null||e===void 0?void 0:e.length)>50}isBeforeInputInsertText(){return this.event.type==="beforeinput"&&this.event.inputType==="insertText"}previousEventWasUnidentifiedKeydown(){var e,t;return((e=this.previousEvent)===null||e===void 0?void 0:e.type)==="keydown"&&((t=this.previousEvent)===null||t===void 0?void 0:t.key)==="Unidentified"}}const N4=(i,e)=>d0(i)===d0(e),Z4=new RegExp("(".concat("","|").concat(oh,"|").concat(Rr,"|\\s)+"),"g"),d0=i=>i.replace(Z4," ").trim();class ch extends Kt{constructor(e){super(...arguments),this.element=e,this.mutationObserver=new Ik(this.element),this.mutationObserver.delegate=this,this.flakyKeyboardDetector=new I4(this.element);for(const t in this.constructor.events)Zt(t,{onElement:this.element,withCallback:this.handlerFor(t)})}elementDidMutate(e){}editorWillSyncDocumentView(){return this.mutationObserver.stop()}editorDidSyncDocumentView(){return this.mutationObserver.start()}requestRender(){var e,t;return(e=this.delegate)===null||e===void 0||(t=e.inputControllerDidRequestRender)===null||t===void 0?void 0:t.call(e)}requestReparse(){var e,t;return(e=this.delegate)===null||e===void 0||(t=e.inputControllerDidRequestReparse)===null||t===void 0||t.call(e),this.requestRender()}attachFiles(e){const t=Array.from(e).map(n=>new Nk(n));return Promise.all(t).then(n=>{this.handleInput(function(){var r,s;return(r=this.delegate)===null||r===void 0||r.inputControllerWillAttachFiles(),(s=this.responder)===null||s===void 0||s.insertFiles(n),this.requestRender()})})}handlerFor(e){return t=>{t.defaultPrevented||this.handleInput(()=>{if(!Gm(this.element)){if(this.flakyKeyboardDetector.shouldIgnore(t))return;this.eventName=e,this.constructor.events[e].call(this,t)}})}}handleInput(e){try{var t;(t=this.delegate)===null||t===void 0||t.inputControllerWillHandleInput(),e.call(this)}finally{var n;(n=this.delegate)===null||n===void 0||n.inputControllerDidHandleInput()}}createLinkHTML(e,t){const n=document.createElement("a");return n.href=e,n.textContent=t||e,n.outerHTML}}var vf;gn(ch,"events",{});const{browser:B4,keyNames:Zk}=$a;let W4=0;class ir extends ch{constructor(){super(...arguments),this.resetInputSummary()}setInputSummary(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.inputSummary.eventName=this.eventName;for(const t in e){const n=e[t];this.inputSummary[t]=n}return this.inputSummary}resetInputSummary(){this.inputSummary={}}reset(){return this.resetInputSummary(),Qs.reset()}elementDidMutate(e){var t,n;return this.isComposing()?(t=this.delegate)===null||t===void 0||(n=t.inputControllerDidAllowUnhandledInput)===null||n===void 0?void 0:n.call(t):this.handleInput(function(){return this.mutationIsSignificant(e)&&(this.mutationIsExpected(e)?this.requestRender():this.requestReparse()),this.reset()})}mutationIsExpected(e){let{textAdded:t,textDeleted:n}=e;if(this.inputSummary.preferDocument)return!0;const r=t!=null?t===this.inputSummary.textAdded:!this.inputSummary.textAdded,s=n!=null?this.inputSummary.didDelete:!this.inputSummary.didDelete,o=[`
`,`
`].includes(t)&&!r,l=n===`
`&&!s;if(o&&!l||l&&!o){const c=this.getSelectedRange();if(c){var a;const u=o?t.replace(/\n$/,"").length||-1:(t==null?void 0:t.length)||1;if((a=this.responder)!==null&&a!==void 0&&a.positionIsBlockBreak(c[1]+u))return!0}}return r&&s}mutationIsSignificant(e){var t;const n=Object.keys(e).length>0,r=((t=this.compositionInput)===null||t===void 0?void 0:t.getEndData())==="";return n||!r}getCompositionInput(){if(this.isComposing())return this.compositionInput;this.compositionInput=new Ar(this)}isComposing(){return this.compositionInput&&!this.compositionInput.isEnded()}deleteInDirection(e,t){var n;return((n=this.responder)===null||n===void 0?void 0:n.deleteInDirection(e))!==!1?this.setInputSummary({didDelete:!0}):t?(t.preventDefault(),this.requestRender()):void 0}serializeSelectionToDataTransfer(e){var t;if(!function(r){if(r==null||!r.setData)return!1;for(const s in F1){const o=F1[s];try{if(r.setData(s,o),!r.getData(s)===o)return!1}catch{return!1}}return!0}(e))return;const n=(t=this.responder)===null||t===void 0?void 0:t.getSelectedDocument().toSerializableDocument();return e.setData("application/x-trix-document",JSON.stringify(n)),e.setData("text/html",ah.render(n).innerHTML),e.setData("text/plain",n.toString().replace(/\n$/,"")),!0}canAcceptDataTransfer(e){const t={};return Array.from((e==null?void 0:e.types)||[]).forEach(n=>{t[n]=!0}),t.Files||t["application/x-trix-document"]||t["text/html"]||t["text/plain"]}getPastedHTMLUsingHiddenElement(e){const t=this.getSelectedRange(),n={position:"absolute",left:"".concat(window.pageXOffset,"px"),top:"".concat(window.pageYOffset,"px"),opacity:0},r=Ge({style:n,tagName:"div",editable:!0});return document.body.appendChild(r),r.focus(),requestAnimationFrame(()=>{const s=r.innerHTML;return zr(r),this.setSelectedRange(t),e(s)})}}gn(ir,"events",{keydown(i){this.isComposing()||this.resetInputSummary(),this.inputSummary.didInput=!0;const e=Zk[i.keyCode];if(e){var t;let r=this.keys;["ctrl","alt","shift","meta"].forEach(s=>{var o;i["".concat(s,"Key")]&&(s==="ctrl"&&(s="control"),r=(o=r)===null||o===void 0?void 0:o[s])}),((t=r)===null||t===void 0?void 0:t[e])!=null&&(this.setInputSummary({keyName:e}),Qs.reset(),r[e].call(this,i))}if(ok(i)){const r=String.fromCharCode(i.keyCode).toLowerCase();if(r){var n;const s=["alt","shift"].map(o=>{if(i["".concat(o,"Key")])return o}).filter(o=>o);s.push(r),(n=this.delegate)!==null&&n!==void 0&&n.inputControllerDidReceiveKeyboardCommand(s)&&i.preventDefault()}}},keypress(i){if(this.inputSummary.eventName!=null||i.metaKey||i.ctrlKey&&!i.altKey)return;const e=Y4(i);var t,n;return e?((t=this.delegate)===null||t===void 0||t.inputControllerWillPerformTyping(),(n=this.responder)===null||n===void 0||n.insertString(e),this.setInputSummary({textAdded:e,didDelete:this.selectionIsExpanded()})):void 0},textInput(i){const{data:e}=i,{textAdded:t}=this.inputSummary;if(t&&t!==e&&t.toUpperCase()===e){var n;const r=this.getSelectedRange();return this.setSelectedRange([r[0],r[1]+t.length]),(n=this.responder)===null||n===void 0||n.insertString(e),this.setInputSummary({textAdded:e}),this.setSelectedRange(r)}},dragenter(i){i.preventDefault()},dragstart(i){var e,t;return this.serializeSelectionToDataTransfer(i.dataTransfer),this.draggedRange=this.getSelectedRange(),(e=this.delegate)===null||e===void 0||(t=e.inputControllerDidStartDrag)===null||t===void 0?void 0:t.call(e)},dragover(i){if(this.draggedRange||this.canAcceptDataTransfer(i.dataTransfer)){i.preventDefault();const n={x:i.clientX,y:i.clientY};var e,t;if(!Fo(n,this.draggingPoint))return this.draggingPoint=n,(e=this.delegate)===null||e===void 0||(t=e.inputControllerDidReceiveDragOverPoint)===null||t===void 0?void 0:t.call(e,this.draggingPoint)}},dragend(i){var e,t;(e=this.delegate)===null||e===void 0||(t=e.inputControllerDidCancelDrag)===null||t===void 0||t.call(e),this.draggedRange=null,this.draggingPoint=null},drop(i){var e,t;i.preventDefault();const n=(e=i.dataTransfer)===null||e===void 0?void 0:e.files,r=i.dataTransfer.getData("application/x-trix-document"),s={x:i.clientX,y:i.clientY};if((t=this.responder)===null||t===void 0||t.setLocationRangeFromPointRange(s),n!=null&&n.length)this.attachFiles(n);else if(this.draggedRange){var o,l;(o=this.delegate)===null||o===void 0||o.inputControllerWillMoveText(),(l=this.responder)===null||l===void 0||l.moveTextFromRange(this.draggedRange),this.draggedRange=null,this.requestRender()}else if(r){var a;const c=si.fromJSONString(r);(a=this.responder)===null||a===void 0||a.insertDocument(c),this.requestRender()}this.draggedRange=null,this.draggingPoint=null},cut(i){var e,t;if((e=this.responder)!==null&&e!==void 0&&e.selectionIsExpanded()&&(this.serializeSelectionToDataTransfer(i.clipboardData)&&i.preventDefault(),(t=this.delegate)===null||t===void 0||t.inputControllerWillCutText(),this.deleteInDirection("backward"),i.defaultPrevented))return this.requestRender()},copy(i){var e;(e=this.responder)!==null&&e!==void 0&&e.selectionIsExpanded()&&this.serializeSelectionToDataTransfer(i.clipboardData)&&i.preventDefault()},paste(i){const e=i.clipboardData||i.testClipboardData,t={clipboard:e};if(!e||z4(i))return void this.getPastedHTMLUsingHiddenElement(_=>{var k,A,C;return t.type="text/html",t.html=_,(k=this.delegate)===null||k===void 0||k.inputControllerWillPaste(t),(A=this.responder)===null||A===void 0||A.insertHTML(t.html),this.requestRender(),(C=this.delegate)===null||C===void 0?void 0:C.inputControllerDidPaste(t)});const n=e.getData("URL"),r=e.getData("text/html"),s=e.getData("public.url-name");if(n){var o,l,a;let _;t.type="text/html",_=s?tp(s).trim():n,t.html=this.createLinkHTML(n,_),(o=this.delegate)===null||o===void 0||o.inputControllerWillPaste(t),this.setInputSummary({textAdded:_,didDelete:this.selectionIsExpanded()}),(l=this.responder)===null||l===void 0||l.insertHTML(t.html),this.requestRender(),(a=this.delegate)===null||a===void 0||a.inputControllerDidPaste(t)}else if(sk(e)){var c,u,h;t.type="text/plain",t.string=e.getData("text/plain"),(c=this.delegate)===null||c===void 0||c.inputControllerWillPaste(t),this.setInputSummary({textAdded:t.string,didDelete:this.selectionIsExpanded()}),(u=this.responder)===null||u===void 0||u.insertString(t.string),this.requestRender(),(h=this.delegate)===null||h===void 0||h.inputControllerDidPaste(t)}else if(r){var f,d,m;t.type="text/html",t.html=r,(f=this.delegate)===null||f===void 0||f.inputControllerWillPaste(t),(d=this.responder)===null||d===void 0||d.insertHTML(t.html),this.requestRender(),(m=this.delegate)===null||m===void 0||m.inputControllerDidPaste(t)}else if(Array.from(e.types).includes("Files")){var p,g;const _=(p=e.items)===null||p===void 0||(p=p[0])===null||p===void 0||(g=p.getAsFile)===null||g===void 0?void 0:g.call(p);if(_){var v,w,S;const k=X4(_);!_.name&&k&&(_.name="pasted-file-".concat(++W4,".").concat(k)),t.type="File",t.file=_,(v=this.delegate)===null||v===void 0||v.inputControllerWillAttachFiles(),(w=this.responder)===null||w===void 0||w.insertFile(t.file),this.requestRender(),(S=this.delegate)===null||S===void 0||S.inputControllerDidPaste(t)}}i.preventDefault()},compositionstart(i){return this.getCompositionInput().start(i.data)},compositionupdate(i){return this.getCompositionInput().update(i.data)},compositionend(i){return this.getCompositionInput().end(i.data)},beforeinput(i){this.inputSummary.didInput=!0},input(i){return this.inputSummary.didInput=!0,i.stopPropagation()}}),gn(ir,"keys",{backspace(i){var e;return(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),this.deleteInDirection("backward",i)},delete(i){var e;return(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),this.deleteInDirection("forward",i)},return(i){var e,t;return this.setInputSummary({preferDocument:!0}),(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),(t=this.responder)===null||t===void 0?void 0:t.insertLineBreak()},tab(i){var e,t;(e=this.responder)!==null&&e!==void 0&&e.canIncreaseNestingLevel()&&((t=this.responder)===null||t===void 0||t.increaseNestingLevel(),this.requestRender(),i.preventDefault())},left(i){var e;if(this.selectionIsInCursorTarget())return i.preventDefault(),(e=this.responder)===null||e===void 0?void 0:e.moveCursorInDirection("backward")},right(i){var e;if(this.selectionIsInCursorTarget())return i.preventDefault(),(e=this.responder)===null||e===void 0?void 0:e.moveCursorInDirection("forward")},control:{d(i){var e;return(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),this.deleteInDirection("forward",i)},h(i){var e;return(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),this.deleteInDirection("backward",i)},o(i){var e,t;return i.preventDefault(),(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),(t=this.responder)===null||t===void 0||t.insertString(`
`,{updatePosition:!1}),this.requestRender()}},shift:{return(i){var e,t;(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),(t=this.responder)===null||t===void 0||t.insertString(`
`),this.requestRender(),i.preventDefault()},tab(i){var e,t;(e=this.responder)!==null&&e!==void 0&&e.canDecreaseNestingLevel()&&((t=this.responder)===null||t===void 0||t.decreaseNestingLevel(),this.requestRender(),i.preventDefault())},left(i){if(this.selectionIsInCursorTarget())return i.preventDefault(),this.expandSelectionInDirection("backward")},right(i){if(this.selectionIsInCursorTarget())return i.preventDefault(),this.expandSelectionInDirection("forward")}},alt:{backspace(i){var e;return this.setInputSummary({preferDocument:!1}),(e=this.delegate)===null||e===void 0?void 0:e.inputControllerWillPerformTyping()}},meta:{backspace(i){var e;return this.setInputSummary({preferDocument:!1}),(e=this.delegate)===null||e===void 0?void 0:e.inputControllerWillPerformTyping()}}}),ir.proxyMethod("responder?.getSelectedRange"),ir.proxyMethod("responder?.setSelectedRange"),ir.proxyMethod("responder?.expandSelectionInDirection"),ir.proxyMethod("responder?.selectionIsInCursorTarget"),ir.proxyMethod("responder?.selectionIsExpanded");const X4=i=>{var e;return(e=i.type)===null||e===void 0||(e=e.match(/\/(\w+)$/))===null||e===void 0?void 0:e[1]},F4=!((vf=" ".codePointAt)===null||vf===void 0||!vf.call(" ",0)),Y4=function(i){if(i.key&&F4&&i.key.codePointAt(0)===i.keyCode)return i.key;{let e;if(i.which===null?e=i.keyCode:i.which!==0&&i.charCode!==0&&(e=i.charCode),e!=null&&Zk[e]!=="escape")return sa.fromCodepoints([e]).toString()}},z4=function(i){const e=i.clipboardData;if(e){if(e.types.includes("text/html")){for(const t of e.types){const n=/^CorePasteboardFlavorType/.test(t),r=/^dyn\./.test(t)&&e.getData(t);if(n||r)return!0}return!1}{const t=e.types.includes("com.apple.webarchive"),n=e.types.includes("com.apple.flat-rtfd");return t||n}}};class Ar extends Kt{constructor(e){super(...arguments),this.inputController=e,this.responder=this.inputController.responder,this.delegate=this.inputController.delegate,this.inputSummary=this.inputController.inputSummary,this.data={}}start(e){if(this.data.start=e,this.isSignificant()){var t,n;this.inputSummary.eventName==="keypress"&&this.inputSummary.textAdded&&((n=this.responder)===null||n===void 0||n.deleteInDirection("left")),this.selectionIsExpanded()||(this.insertPlaceholder(),this.requestRender()),this.range=(t=this.responder)===null||t===void 0?void 0:t.getSelectedRange()}}update(e){if(this.data.update=e,this.isSignificant()){const t=this.selectPlaceholder();t&&(this.forgetPlaceholder(),this.range=t)}}end(e){return this.data.end=e,this.isSignificant()?(this.forgetPlaceholder(),this.canApplyToDocument()?(this.setInputSummary({preferDocument:!0,didInput:!1}),(t=this.delegate)===null||t===void 0||t.inputControllerWillPerformTyping(),(n=this.responder)===null||n===void 0||n.setSelectedRange(this.range),(r=this.responder)===null||r===void 0||r.insertString(this.data.end),(s=this.responder)===null||s===void 0?void 0:s.setSelectedRange(this.range[0]+this.data.end.length)):this.data.start!=null||this.data.update!=null?(this.requestReparse(),this.inputController.reset()):void 0):this.inputController.reset();var t,n,r,s}getEndData(){return this.data.end}isEnded(){return this.getEndData()!=null}isSignificant(){return!B4.composesExistingText||this.inputSummary.didInput}canApplyToDocument(){var e,t;return((e=this.data.start)===null||e===void 0?void 0:e.length)===0&&((t=this.data.end)===null||t===void 0?void 0:t.length)>0&&this.range}}Ar.proxyMethod("inputController.setInputSummary"),Ar.proxyMethod("inputController.requestRender"),Ar.proxyMethod("inputController.requestReparse"),Ar.proxyMethod("responder?.selectionIsExpanded"),Ar.proxyMethod("responder?.insertPlaceholder"),Ar.proxyMethod("responder?.selectPlaceholder"),Ar.proxyMethod("responder?.forgetPlaceholder");class Xl extends ch{constructor(){super(...arguments),this.render=this.render.bind(this)}elementDidMutate(){return this.scheduledRender?this.composing?(e=this.delegate)===null||e===void 0||(t=e.inputControllerDidAllowUnhandledInput)===null||t===void 0?void 0:t.call(e):void 0:this.reparse();var e,t}scheduleRender(){return this.scheduledRender?this.scheduledRender:this.scheduledRender=requestAnimationFrame(this.render)}render(){var e,t;cancelAnimationFrame(this.scheduledRender),this.scheduledRender=null,this.composing||(t=this.delegate)===null||t===void 0||t.render(),(e=this.afterRender)===null||e===void 0||e.call(this),this.afterRender=null}reparse(){var e;return(e=this.delegate)===null||e===void 0?void 0:e.reparse()}insertString(){var e;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0;return(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),this.withTargetDOMRange(function(){var r;return(r=this.responder)===null||r===void 0?void 0:r.insertString(t,n)})}toggleAttributeIfSupported(e){var t;if(Pd().includes(e))return(t=this.delegate)===null||t===void 0||t.inputControllerWillPerformFormatting(e),this.withTargetDOMRange(function(){var n;return(n=this.responder)===null||n===void 0?void 0:n.toggleCurrentAttribute(e)})}activateAttributeIfSupported(e,t){var n;if(Pd().includes(e))return(n=this.delegate)===null||n===void 0||n.inputControllerWillPerformFormatting(e),this.withTargetDOMRange(function(){var r;return(r=this.responder)===null||r===void 0?void 0:r.setCurrentAttribute(e,t)})}deleteInDirection(e){let{recordUndoEntry:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{recordUndoEntry:!0};var n;t&&((n=this.delegate)===null||n===void 0||n.inputControllerWillPerformTyping());const r=()=>{var o;return(o=this.responder)===null||o===void 0?void 0:o.deleteInDirection(e)},s=this.getTargetDOMRange({minLength:this.composing?1:2});return s?this.withTargetDOMRange(s,r):r()}withTargetDOMRange(e,t){var n;return typeof e=="function"&&(t=e,e=this.getTargetDOMRange()),e?(n=this.responder)===null||n===void 0?void 0:n.withTargetDOMRange(e,t.bind(this)):(Qs.reset(),t.call(this))}getTargetDOMRange(){var e,t;let{minLength:n}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{minLength:0};const r=(e=(t=this.event).getTargetRanges)===null||e===void 0?void 0:e.call(t);if(r&&r.length){const s=V4(r[0]);if(n===0||s.toString().length>=n)return s}}withEvent(e,t){let n;this.event=e;try{n=t.call(this)}finally{this.event=null}return n}}gn(Xl,"events",{keydown(i){if(ok(i)){var e;const t=q4(i);(e=this.delegate)!==null&&e!==void 0&&e.inputControllerDidReceiveKeyboardCommand(t)&&i.preventDefault()}else{let t=i.key;i.altKey&&(t+="+Alt"),i.shiftKey&&(t+="+Shift");const n=this.constructor.keys[t];if(n)return this.withEvent(i,n)}},paste(i){var e;let t;const n=(e=i.clipboardData)===null||e===void 0?void 0:e.getData("URL");return Bk(i)?(i.preventDefault(),this.attachFiles(i.clipboardData.files)):j4(i)?(i.preventDefault(),t={type:"text/plain",string:i.clipboardData.getData("text/plain")},(r=this.delegate)===null||r===void 0||r.inputControllerWillPaste(t),(s=this.responder)===null||s===void 0||s.insertString(t.string),this.render(),(o=this.delegate)===null||o===void 0?void 0:o.inputControllerDidPaste(t)):n?(i.preventDefault(),t={type:"text/html",html:this.createLinkHTML(n)},(l=this.delegate)===null||l===void 0||l.inputControllerWillPaste(t),(a=this.responder)===null||a===void 0||a.insertHTML(t.html),this.render(),(c=this.delegate)===null||c===void 0?void 0:c.inputControllerDidPaste(t)):void 0;var r,s,o,l,a,c},beforeinput(i){const e=this.constructor.inputTypes[i.inputType],t=(n=i,!(!/iPhone|iPad/.test(navigator.userAgent)||n.inputType&&n.inputType!=="insertParagraph"));var n;e&&(this.withEvent(i,e),t||this.scheduleRender()),t&&this.render()},input(i){Qs.reset()},dragstart(i){var e,t;(e=this.responder)!==null&&e!==void 0&&e.selectionContainsAttachments()&&(i.dataTransfer.setData("application/x-trix-dragging",!0),this.dragging={range:(t=this.responder)===null||t===void 0?void 0:t.getSelectedRange(),point:yf(i)})},dragenter(i){wf(i)&&i.preventDefault()},dragover(i){if(this.dragging){i.preventDefault();const t=yf(i);var e;if(!Fo(t,this.dragging.point))return this.dragging.point=t,(e=this.responder)===null||e===void 0?void 0:e.setLocationRangeFromPointRange(t)}else wf(i)&&i.preventDefault()},drop(i){var e,t;if(this.dragging)return i.preventDefault(),(e=this.delegate)===null||e===void 0||e.inputControllerWillMoveText(),(t=this.responder)===null||t===void 0||t.moveTextFromRange(this.dragging.range),this.dragging=null,this.scheduleRender();if(wf(i)){var n;i.preventDefault();const r=yf(i);return(n=this.responder)===null||n===void 0||n.setLocationRangeFromPointRange(r),this.attachFiles(i.dataTransfer.files)}},dragend(){var i;this.dragging&&((i=this.responder)===null||i===void 0||i.setSelectedRange(this.dragging.range),this.dragging=null)},compositionend(i){this.composing&&(this.composing=!1,Da.recentAndroid||this.scheduleRender())}}),gn(Xl,"keys",{ArrowLeft(){var i,e;if((i=this.responder)!==null&&i!==void 0&&i.shouldManageMovingCursorInDirection("backward"))return this.event.preventDefault(),(e=this.responder)===null||e===void 0?void 0:e.moveCursorInDirection("backward")},ArrowRight(){var i,e;if((i=this.responder)!==null&&i!==void 0&&i.shouldManageMovingCursorInDirection("forward"))return this.event.preventDefault(),(e=this.responder)===null||e===void 0?void 0:e.moveCursorInDirection("forward")},Backspace(){var i,e,t;if((i=this.responder)!==null&&i!==void 0&&i.shouldManageDeletingInDirection("backward"))return this.event.preventDefault(),(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),(t=this.responder)===null||t===void 0||t.deleteInDirection("backward"),this.render()},Tab(){var i,e;if((i=this.responder)!==null&&i!==void 0&&i.canIncreaseNestingLevel())return this.event.preventDefault(),(e=this.responder)===null||e===void 0||e.increaseNestingLevel(),this.render()},"Tab+Shift"(){var i,e;if((i=this.responder)!==null&&i!==void 0&&i.canDecreaseNestingLevel())return this.event.preventDefault(),(e=this.responder)===null||e===void 0||e.decreaseNestingLevel(),this.render()}}),gn(Xl,"inputTypes",{deleteByComposition(){return this.deleteInDirection("backward",{recordUndoEntry:!1})},deleteByCut(){return this.deleteInDirection("backward")},deleteByDrag(){return this.event.preventDefault(),this.withTargetDOMRange(function(){var i;this.deleteByDragRange=(i=this.responder)===null||i===void 0?void 0:i.getSelectedRange()})},deleteCompositionText(){return this.deleteInDirection("backward",{recordUndoEntry:!1})},deleteContent(){return this.deleteInDirection("backward")},deleteContentBackward(){return this.deleteInDirection("backward")},deleteContentForward(){return this.deleteInDirection("forward")},deleteEntireSoftLine(){return this.deleteInDirection("forward")},deleteHardLineBackward(){return this.deleteInDirection("backward")},deleteHardLineForward(){return this.deleteInDirection("forward")},deleteSoftLineBackward(){return this.deleteInDirection("backward")},deleteSoftLineForward(){return this.deleteInDirection("forward")},deleteWordBackward(){return this.deleteInDirection("backward")},deleteWordForward(){return this.deleteInDirection("forward")},formatBackColor(){return this.activateAttributeIfSupported("backgroundColor",this.event.data)},formatBold(){return this.toggleAttributeIfSupported("bold")},formatFontColor(){return this.activateAttributeIfSupported("color",this.event.data)},formatFontName(){return this.activateAttributeIfSupported("font",this.event.data)},formatIndent(){var i;if((i=this.responder)!==null&&i!==void 0&&i.canIncreaseNestingLevel())return this.withTargetDOMRange(function(){var e;return(e=this.responder)===null||e===void 0?void 0:e.increaseNestingLevel()})},formatItalic(){return this.toggleAttributeIfSupported("italic")},formatJustifyCenter(){return this.toggleAttributeIfSupported("justifyCenter")},formatJustifyFull(){return this.toggleAttributeIfSupported("justifyFull")},formatJustifyLeft(){return this.toggleAttributeIfSupported("justifyLeft")},formatJustifyRight(){return this.toggleAttributeIfSupported("justifyRight")},formatOutdent(){var i;if((i=this.responder)!==null&&i!==void 0&&i.canDecreaseNestingLevel())return this.withTargetDOMRange(function(){var e;return(e=this.responder)===null||e===void 0?void 0:e.decreaseNestingLevel()})},formatRemove(){this.withTargetDOMRange(function(){for(const t in(i=this.responder)===null||i===void 0?void 0:i.getCurrentAttributes()){var i,e;(e=this.responder)===null||e===void 0||e.removeCurrentAttribute(t)}})},formatSetBlockTextDirection(){return this.activateAttributeIfSupported("blockDir",this.event.data)},formatSetInlineTextDirection(){return this.activateAttributeIfSupported("textDir",this.event.data)},formatStrikeThrough(){return this.toggleAttributeIfSupported("strike")},formatSubscript(){return this.toggleAttributeIfSupported("sub")},formatSuperscript(){return this.toggleAttributeIfSupported("sup")},formatUnderline(){return this.toggleAttributeIfSupported("underline")},historyRedo(){var i;return(i=this.delegate)===null||i===void 0?void 0:i.inputControllerWillPerformRedo()},historyUndo(){var i;return(i=this.delegate)===null||i===void 0?void 0:i.inputControllerWillPerformUndo()},insertCompositionText(){return this.composing=!0,this.insertString(this.event.data)},insertFromComposition(){return this.composing=!1,this.insertString(this.event.data)},insertFromDrop(){const i=this.deleteByDragRange;var e;if(i)return this.deleteByDragRange=null,(e=this.delegate)===null||e===void 0||e.inputControllerWillMoveText(),this.withTargetDOMRange(function(){var t;return(t=this.responder)===null||t===void 0?void 0:t.moveTextFromRange(i)})},insertFromPaste(){const{dataTransfer:i}=this.event,e={dataTransfer:i},t=i.getData("URL"),n=i.getData("text/html");if(t){var r;let a;this.event.preventDefault(),e.type="text/html";const c=i.getData("public.url-name");a=c?tp(c).trim():t,e.html=this.createLinkHTML(t,a),(r=this.delegate)===null||r===void 0||r.inputControllerWillPaste(e),this.withTargetDOMRange(function(){var u;return(u=this.responder)===null||u===void 0?void 0:u.insertHTML(e.html)}),this.afterRender=()=>{var u;return(u=this.delegate)===null||u===void 0?void 0:u.inputControllerDidPaste(e)}}else if(sk(i)){var s;e.type="text/plain",e.string=i.getData("text/plain"),(s=this.delegate)===null||s===void 0||s.inputControllerWillPaste(e),this.withTargetDOMRange(function(){var a;return(a=this.responder)===null||a===void 0?void 0:a.insertString(e.string)}),this.afterRender=()=>{var a;return(a=this.delegate)===null||a===void 0?void 0:a.inputControllerDidPaste(e)}}else if(U4(this.event)){var o;e.type="File",e.file=i.files[0],(o=this.delegate)===null||o===void 0||o.inputControllerWillPaste(e),this.withTargetDOMRange(function(){var a;return(a=this.responder)===null||a===void 0?void 0:a.insertFile(e.file)}),this.afterRender=()=>{var a;return(a=this.delegate)===null||a===void 0?void 0:a.inputControllerDidPaste(e)}}else if(n){var l;this.event.preventDefault(),e.type="text/html",e.html=n,(l=this.delegate)===null||l===void 0||l.inputControllerWillPaste(e),this.withTargetDOMRange(function(){var a;return(a=this.responder)===null||a===void 0?void 0:a.insertHTML(e.html)}),this.afterRender=()=>{var a;return(a=this.delegate)===null||a===void 0?void 0:a.inputControllerDidPaste(e)}}},insertFromYank(){return this.insertString(this.event.data)},insertLineBreak(){return this.insertString(`
`)},insertLink(){return this.activateAttributeIfSupported("href",this.event.data)},insertOrderedList(){return this.toggleAttributeIfSupported("number")},insertParagraph(){var i;return(i=this.delegate)===null||i===void 0||i.inputControllerWillPerformTyping(),this.withTargetDOMRange(function(){var e;return(e=this.responder)===null||e===void 0?void 0:e.insertLineBreak()})},insertReplacementText(){const i=this.event.dataTransfer.getData("text/plain"),e=this.event.getTargetRanges()[0];this.withTargetDOMRange(e,()=>{this.insertString(i,{updatePosition:!1})})},insertText(){var i;return this.insertString(this.event.data||((i=this.event.dataTransfer)===null||i===void 0?void 0:i.getData("text/plain")))},insertTranspose(){return this.insertString(this.event.data)},insertUnorderedList(){return this.toggleAttributeIfSupported("bullet")}});const V4=function(i){const e=document.createRange();return e.setStart(i.startContainer,i.startOffset),e.setEnd(i.endContainer,i.endOffset),e},wf=i=>{var e;return Array.from(((e=i.dataTransfer)===null||e===void 0?void 0:e.types)||[]).includes("Files")},U4=i=>{var e;return((e=i.dataTransfer.files)===null||e===void 0?void 0:e[0])&&!Bk(i)&&!(t=>{let{dataTransfer:n}=t;return n.types.includes("Files")&&n.types.includes("text/html")&&n.getData("text/html").includes("urn:schemas-microsoft-com:office:office")})(i)},Bk=function(i){const e=i.clipboardData;if(e)return Array.from(e.types).filter(t=>t.match(/file/i)).length===e.types.length&&e.files.length>=1},j4=function(i){const e=i.clipboardData;if(e)return e.types.includes("text/plain")&&e.types.length===1},q4=function(i){const e=[];return i.altKey&&e.push("alt"),i.shiftKey&&e.push("shift"),e.push(i.key),e},yf=i=>({x:i.clientX,y:i.clientY}),Dd="[data-trix-attribute]",$d="[data-trix-action]",G4="".concat(Dd,", ").concat($d),uh="[data-trix-dialog]",H4="".concat(uh,"[data-trix-active]"),K4="".concat(uh," [data-trix-method]"),m0="".concat(uh," [data-trix-input]"),p0=(i,e)=>(e||(e=Js(i)),i.querySelector("[data-trix-input][name='".concat(e,"']"))),g0=i=>i.getAttribute("data-trix-action"),Js=i=>i.getAttribute("data-trix-attribute")||i.getAttribute("data-trix-dialog-attribute");class Wk extends Kt{constructor(e){super(e),this.didClickActionButton=this.didClickActionButton.bind(this),this.didClickAttributeButton=this.didClickAttributeButton.bind(this),this.didClickDialogButton=this.didClickDialogButton.bind(this),this.didKeyDownDialogInput=this.didKeyDownDialogInput.bind(this),this.element=e,this.attributes={},this.actions={},this.resetDialogInputs(),Zt("mousedown",{onElement:this.element,matchingSelector:$d,withCallback:this.didClickActionButton}),Zt("mousedown",{onElement:this.element,matchingSelector:Dd,withCallback:this.didClickAttributeButton}),Zt("click",{onElement:this.element,matchingSelector:G4,preventDefault:!0}),Zt("click",{onElement:this.element,matchingSelector:K4,withCallback:this.didClickDialogButton}),Zt("keydown",{onElement:this.element,matchingSelector:m0,withCallback:this.didKeyDownDialogInput})}didClickActionButton(e,t){var n;(n=this.delegate)===null||n===void 0||n.toolbarDidClickButton(),e.preventDefault();const r=g0(t);return this.getDialog(r)?this.toggleDialog(r):(s=this.delegate)===null||s===void 0?void 0:s.toolbarDidInvokeAction(r,t);var s}didClickAttributeButton(e,t){var n;(n=this.delegate)===null||n===void 0||n.toolbarDidClickButton(),e.preventDefault();const r=Js(t);var s;return this.getDialog(r)?this.toggleDialog(r):(s=this.delegate)===null||s===void 0||s.toolbarDidToggleAttribute(r),this.refreshAttributeButtons()}didClickDialogButton(e,t){const n=Yr(t,{matchingSelector:uh});return this[t.getAttribute("data-trix-method")].call(this,n)}didKeyDownDialogInput(e,t){if(e.keyCode===13){e.preventDefault();const n=t.getAttribute("name"),r=this.getDialog(n);this.setAttribute(r)}if(e.keyCode===27)return e.preventDefault(),this.hideDialog()}updateActions(e){return this.actions=e,this.refreshActionButtons()}refreshActionButtons(){return this.eachActionButton((e,t)=>{e.disabled=this.actions[t]===!1})}eachActionButton(e){return Array.from(this.element.querySelectorAll($d)).map(t=>e(t,g0(t)))}updateAttributes(e){return this.attributes=e,this.refreshAttributeButtons()}refreshAttributeButtons(){return this.eachAttributeButton((e,t)=>(e.disabled=this.attributes[t]===!1,this.attributes[t]||this.dialogIsVisible(t)?(e.setAttribute("data-trix-active",""),e.classList.add("trix-active")):(e.removeAttribute("data-trix-active"),e.classList.remove("trix-active"))))}eachAttributeButton(e){return Array.from(this.element.querySelectorAll(Dd)).map(t=>e(t,Js(t)))}applyKeyboardCommand(e){const t=JSON.stringify(e.sort());for(const n of Array.from(this.element.querySelectorAll("[data-trix-key]"))){const r=n.getAttribute("data-trix-key").split("+");if(JSON.stringify(r.sort())===t)return Il("mousedown",{onElement:n}),!0}return!1}dialogIsVisible(e){const t=this.getDialog(e);if(t)return t.hasAttribute("data-trix-active")}toggleDialog(e){return this.dialogIsVisible(e)?this.hideDialog():this.showDialog(e)}showDialog(e){var t,n;this.hideDialog(),(t=this.delegate)===null||t===void 0||t.toolbarWillShowDialog();const r=this.getDialog(e);r.setAttribute("data-trix-active",""),r.classList.add("trix-active"),Array.from(r.querySelectorAll("input[disabled]")).forEach(o=>{o.removeAttribute("disabled")});const s=Js(r);if(s){const o=p0(r,e);o&&(o.value=this.attributes[s]||"",o.select())}return(n=this.delegate)===null||n===void 0?void 0:n.toolbarDidShowDialog(e)}setAttribute(e){var t;const n=Js(e),r=p0(e,n);return!r.willValidate||(r.setCustomValidity(""),r.checkValidity()&&this.isSafeAttribute(r))?((t=this.delegate)===null||t===void 0||t.toolbarDidUpdateAttribute(n,r.value),this.hideDialog()):(r.setCustomValidity("Invalid value"),r.setAttribute("data-trix-validate",""),r.classList.add("trix-validate"),r.focus())}isSafeAttribute(e){return!e.hasAttribute("data-trix-validate-href")||Ao.isValidAttribute("a","href",e.value)}removeAttribute(e){var t;const n=Js(e);return(t=this.delegate)===null||t===void 0||t.toolbarDidRemoveAttribute(n),this.hideDialog()}hideDialog(){const e=this.element.querySelector(H4);var t;if(e)return e.removeAttribute("data-trix-active"),e.classList.remove("trix-active"),this.resetDialogInputs(),(t=this.delegate)===null||t===void 0?void 0:t.toolbarDidHideDialog((n=>n.getAttribute("data-trix-dialog"))(e))}resetDialogInputs(){Array.from(this.element.querySelectorAll(m0)).forEach(e=>{e.setAttribute("disabled","disabled"),e.removeAttribute("data-trix-validate"),e.classList.remove("trix-validate")})}getDialog(e){return this.element.querySelector("[data-trix-dialog=".concat(e,"]"))}}class Fl extends $k{constructor(e){let{editorElement:t,document:n,html:r}=e;super(...arguments),this.editorElement=t,this.selectionManager=new gs(this.editorElement),this.selectionManager.delegate=this,this.composition=new Tr,this.composition.delegate=this,this.attachmentManager=new _k(this.composition.getAttachments()),this.attachmentManager.delegate=this,this.inputController=Hm.getLevel()===2?new Xl(this.editorElement):new ir(this.editorElement),this.inputController.delegate=this,this.inputController.responder=this.composition,this.compositionController=new Dk(this.editorElement,this.composition),this.compositionController.delegate=this,this.toolbarController=new Wk(this.editorElement.toolbarElement),this.toolbarController.delegate=this,this.editor=new xk(this.composition,this.selectionManager,this.editorElement),n?this.editor.loadDocument(n):this.editor.loadHTML(r)}registerSelectionManager(){return Qs.registerSelectionManager(this.selectionManager)}unregisterSelectionManager(){return Qs.unregisterSelectionManager(this.selectionManager)}render(){return this.compositionController.render()}reparse(){return this.composition.replaceHTML(this.editorElement.innerHTML)}compositionDidChangeDocument(e){if(this.notifyEditorElement("document-change"),!this.handlingInput)return this.render()}compositionDidChangeCurrentAttributes(e){return this.currentAttributes=e,this.toolbarController.updateAttributes(this.currentAttributes),this.updateCurrentActions(),this.notifyEditorElement("attributes-change",{attributes:this.currentAttributes})}compositionDidPerformInsertionAtRange(e){this.pasting&&(this.pastedRange=e)}compositionShouldAcceptFile(e){return this.notifyEditorElement("file-accept",{file:e})}compositionDidAddAttachment(e){const t=this.attachmentManager.manageAttachment(e);return this.notifyEditorElement("attachment-add",{attachment:t})}compositionDidEditAttachment(e){this.compositionController.rerenderViewForObject(e);const t=this.attachmentManager.manageAttachment(e);return this.notifyEditorElement("attachment-edit",{attachment:t}),this.notifyEditorElement("change")}compositionDidChangeAttachmentPreviewURL(e){return this.compositionController.invalidateViewForObject(e),this.notifyEditorElement("change")}compositionDidRemoveAttachment(e){const t=this.attachmentManager.unmanageAttachment(e);return this.notifyEditorElement("attachment-remove",{attachment:t})}compositionDidStartEditingAttachment(e,t){return this.attachmentLocationRange=this.composition.document.getLocationRangeOfAttachment(e),this.compositionController.installAttachmentEditorForAttachment(e,t),this.selectionManager.setLocationRange(this.attachmentLocationRange)}compositionDidStopEditingAttachment(e){this.compositionController.uninstallAttachmentEditor(),this.attachmentLocationRange=null}compositionDidRequestChangingSelectionToLocationRange(e){if(!this.loadingSnapshot||this.isFocused())return this.requestedLocationRange=e,this.compositionRevisionWhenLocationRangeRequested=this.composition.revision,this.handlingInput?void 0:this.render()}compositionWillLoadSnapshot(){this.loadingSnapshot=!0}compositionDidLoadSnapshot(){this.compositionController.refreshViewCache(),this.render(),this.loadingSnapshot=!1}getSelectionManager(){return this.selectionManager}attachmentManagerDidRequestRemovalOfAttachment(e){return this.removeAttachment(e)}compositionControllerWillSyncDocumentView(){return this.inputController.editorWillSyncDocumentView(),this.selectionManager.lock(),this.selectionManager.clearSelection()}compositionControllerDidSyncDocumentView(){return this.inputController.editorDidSyncDocumentView(),this.selectionManager.unlock(),this.updateCurrentActions(),this.notifyEditorElement("sync")}compositionControllerDidRender(){this.requestedLocationRange&&(this.compositionRevisionWhenLocationRangeRequested===this.composition.revision&&this.selectionManager.setLocationRange(this.requestedLocationRange),this.requestedLocationRange=null,this.compositionRevisionWhenLocationRangeRequested=null),this.renderedCompositionRevision!==this.composition.revision&&(this.runEditorFilters(),this.composition.updateCurrentAttributes(),this.notifyEditorElement("render")),this.renderedCompositionRevision=this.composition.revision}compositionControllerDidFocus(){return this.isFocusedInvisibly()&&this.setLocationRange({index:0,offset:0}),this.toolbarController.hideDialog(),this.notifyEditorElement("focus")}compositionControllerDidBlur(){return this.notifyEditorElement("blur")}compositionControllerDidSelectAttachment(e,t){return this.toolbarController.hideDialog(),this.composition.editAttachment(e,t)}compositionControllerDidRequestDeselectingAttachment(e){const t=this.attachmentLocationRange||this.composition.document.getLocationRangeOfAttachment(e);return this.selectionManager.setLocationRange(t[1])}compositionControllerWillUpdateAttachment(e){return this.editor.recordUndoEntry("Edit Attachment",{context:e.id,consolidatable:!0})}compositionControllerDidRequestRemovalOfAttachment(e){return this.removeAttachment(e)}inputControllerWillHandleInput(){this.handlingInput=!0,this.requestedRender=!1}inputControllerDidRequestRender(){this.requestedRender=!0}inputControllerDidHandleInput(){if(this.handlingInput=!1,this.requestedRender)return this.requestedRender=!1,this.render()}inputControllerDidAllowUnhandledInput(){return this.notifyEditorElement("change")}inputControllerDidRequestReparse(){return this.reparse()}inputControllerWillPerformTyping(){return this.recordTypingUndoEntry()}inputControllerWillPerformFormatting(e){return this.recordFormattingUndoEntry(e)}inputControllerWillCutText(){return this.editor.recordUndoEntry("Cut")}inputControllerWillPaste(e){return this.editor.recordUndoEntry("Paste"),this.pasting=!0,this.notifyEditorElement("before-paste",{paste:e})}inputControllerDidPaste(e){return e.range=this.pastedRange,this.pastedRange=null,this.pasting=null,this.notifyEditorElement("paste",{paste:e})}inputControllerWillMoveText(){return this.editor.recordUndoEntry("Move")}inputControllerWillAttachFiles(){return this.editor.recordUndoEntry("Drop Files")}inputControllerWillPerformUndo(){return this.editor.undo()}inputControllerWillPerformRedo(){return this.editor.redo()}inputControllerDidReceiveKeyboardCommand(e){return this.toolbarController.applyKeyboardCommand(e)}inputControllerDidStartDrag(){this.locationRangeBeforeDrag=this.selectionManager.getLocationRange()}inputControllerDidReceiveDragOverPoint(e){return this.selectionManager.setLocationRangeFromPointRange(e)}inputControllerDidCancelDrag(){this.selectionManager.setLocationRange(this.locationRangeBeforeDrag),this.locationRangeBeforeDrag=null}locationRangeDidChange(e){return this.composition.updateCurrentAttributes(),this.updateCurrentActions(),this.attachmentLocationRange&&!wu(this.attachmentLocationRange,e)&&this.composition.stopEditingAttachment(),this.notifyEditorElement("selection-change")}toolbarDidClickButton(){if(!this.getLocationRange())return this.setLocationRange({index:0,offset:0})}toolbarDidInvokeAction(e,t){return this.invokeAction(e,t)}toolbarDidToggleAttribute(e){if(this.recordFormattingUndoEntry(e),this.composition.toggleCurrentAttribute(e),this.render(),!this.selectionFrozen)return this.editorElement.focus()}toolbarDidUpdateAttribute(e,t){if(this.recordFormattingUndoEntry(e),this.composition.setCurrentAttribute(e,t),this.render(),!this.selectionFrozen)return this.editorElement.focus()}toolbarDidRemoveAttribute(e){if(this.recordFormattingUndoEntry(e),this.composition.removeCurrentAttribute(e),this.render(),!this.selectionFrozen)return this.editorElement.focus()}toolbarWillShowDialog(e){return this.composition.expandSelectionForEditing(),this.freezeSelection()}toolbarDidShowDialog(e){return this.notifyEditorElement("toolbar-dialog-show",{dialogName:e})}toolbarDidHideDialog(e){return this.thawSelection(),this.editorElement.focus(),this.notifyEditorElement("toolbar-dialog-hide",{dialogName:e})}freezeSelection(){if(!this.selectionFrozen)return this.selectionManager.lock(),this.composition.freezeSelection(),this.selectionFrozen=!0,this.render()}thawSelection(){if(this.selectionFrozen)return this.composition.thawSelection(),this.selectionManager.unlock(),this.selectionFrozen=!1,this.render()}canInvokeAction(e){return!!this.actionIsExternal(e)||!((t=this.actions[e])===null||t===void 0||(t=t.test)===null||t===void 0||!t.call(this));var t}invokeAction(e,t){return this.actionIsExternal(e)?this.notifyEditorElement("action-invoke",{actionName:e,invokingElement:t}):(n=this.actions[e])===null||n===void 0||(n=n.perform)===null||n===void 0?void 0:n.call(this);var n}actionIsExternal(e){return/^x-./.test(e)}getCurrentActions(){const e={};for(const t in this.actions)e[t]=this.canInvokeAction(t);return e}updateCurrentActions(){const e=this.getCurrentActions();if(!Fo(e,this.currentActions))return this.currentActions=e,this.toolbarController.updateActions(this.currentActions),this.notifyEditorElement("actions-change",{actions:this.currentActions})}runEditorFilters(){let e=this.composition.getSnapshot();if(Array.from(this.editor.filters).forEach(r=>{const{document:s,selectedRange:o}=e;e=r.call(this.editor,e)||{},e.document||(e.document=s),e.selectedRange||(e.selectedRange=o)}),t=e,n=this.composition.getSnapshot(),!wu(t.selectedRange,n.selectedRange)||!t.document.isEqualTo(n.document))return this.composition.loadSnapshot(e);var t,n}updateInputElement(){const e=function(t,n){const r=A4[n];if(r)return r(t);throw new Error("unknown content type: ".concat(n))}(this.compositionController.getSerializableElement(),"text/html");return this.editorElement.setFormValue(e)}notifyEditorElement(e,t){switch(e){case"document-change":this.documentChangedSinceLastRender=!0;break;case"render":this.documentChangedSinceLastRender&&(this.documentChangedSinceLastRender=!1,this.notifyEditorElement("change"));break;case"change":case"attachment-add":case"attachment-edit":case"attachment-remove":this.updateInputElement()}return this.editorElement.notify(e,t)}removeAttachment(e){return this.editor.recordUndoEntry("Delete Attachment"),this.composition.removeAttachment(e),this.render()}recordFormattingUndoEntry(e){const t=zt(e),n=this.selectionManager.getLocationRange();if(t||!or(n))return this.editor.recordUndoEntry("Formatting",{context:this.getUndoContext(),consolidatable:!0})}recordTypingUndoEntry(){return this.editor.recordUndoEntry("Typing",{context:this.getUndoContext(this.currentAttributes),consolidatable:!0})}getUndoContext(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return[this.getLocationContext(),this.getTimeContext(),...Array.from(t)]}getLocationContext(){const e=this.selectionManager.getLocationRange();return or(e)?e[0].index:e}getTimeContext(){return Sd.interval>0?Math.floor(new Date().getTime()/Sd.interval):0}isFocused(){var e;return this.editorElement===((e=this.editorElement.ownerDocument)===null||e===void 0?void 0:e.activeElement)}isFocusedInvisibly(){return this.isFocused()&&!this.getLocationRange()}get actions(){return this.constructor.actions}}gn(Fl,"actions",{undo:{test(){return this.editor.canUndo()},perform(){return this.editor.undo()}},redo:{test(){return this.editor.canRedo()},perform(){return this.editor.redo()}},link:{test(){return this.editor.canActivateAttribute("href")}},increaseNestingLevel:{test(){return this.editor.canIncreaseNestingLevel()},perform(){return this.editor.increaseNestingLevel()&&this.render()}},decreaseNestingLevel:{test(){return this.editor.canDecreaseNestingLevel()},perform(){return this.editor.decreaseNestingLevel()&&this.render()}},attachFiles:{test:()=>!0,perform(){return Hm.pickFiles(this.editor.insertFiles)}}}),Fl.proxyMethod("getSelectionManager().setLocationRange"),Fl.proxyMethod("getSelectionManager().getLocationRange");var J4=Object.freeze({__proto__:null,AttachmentEditorController:Rk,CompositionController:Dk,Controller:$k,EditorController:Fl,InputController:ch,Level0InputController:ir,Level2InputController:Xl,ToolbarController:Wk}),eD=Object.freeze({__proto__:null,MutationObserver:Ik,SelectionChangeObserver:ak}),tD=Object.freeze({__proto__:null,FileVerificationOperation:Nk,ImagePreloadOperation:yk});rk("trix-toolbar",`%t {
display: block;
}
%t {
white-space: nowrap;
}
%t [data-trix-dialog] {
display: none;
}
%t [data-trix-dialog][data-trix-active] {
display: block;
}
%t [data-trix-dialog] [data-trix-validate]:invalid {
background-color: #ffdddd;
}`);class Xk extends HTMLElement{connectedCallback(){this.innerHTML===""&&(this.innerHTML=ik.getDefaultHTML())}get editorElements(){if(this.id){var e;const t=(e=this.ownerDocument)===null||e===void 0?void 0:e.querySelectorAll('trix-editor[toolbar="'.concat(this.id,'"]'));return Array.from(t)}return[]}get editorElement(){const[e]=this.editorElements;return e}}let nD=0;const iD=function(i){if(!i.hasAttribute("contenteditable"))return i.toggleAttribute("contenteditable",!i.disabled),function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return t.times=1,Zt(e,t)}("focus",{onElement:i,withCallback:()=>rD(i)})},rD=function(i){return sD(i),oD()},sD=function(i){var e,t;if((e=(t=document).queryCommandSupported)!==null&&e!==void 0&&e.call(t,"enableObjectResizing"))return document.execCommand("enableObjectResizing",!1,!1),Zt("mscontrolselect",{onElement:i,preventDefault:!0})},oD=function(i){var e,t;if((e=(t=document).queryCommandSupported)!==null&&e!==void 0&&e.call(t,"DefaultParagraphSeparator")){const{tagName:n}=Sn.default;if(["div","p"].includes(n))return document.execCommand("DefaultParagraphSeparator",!1,n)}},O0=Da.forcesObjectResizing?{display:"inline",width:"auto"}:{display:"inline-block",width:"1px"};rk("trix-editor",`%t {
display: block;
}
%t:empty::before {
content: attr(placeholder);
color: graytext;
cursor: text;
pointer-events: none;
white-space: pre-line;
}
%t a[contenteditable=false] {
cursor: text;
}
%t img {
max-width: 100%;
height: auto;
}
%t `.concat(_s,` figcaption textarea {
resize: none;
}
%t `).concat(_s,` figcaption textarea.trix-autoresize-clone {
position: absolute;
left: -9999px;
max-height: 0px;
}
%t `).concat(_s,` figcaption[data-trix-placeholder]:empty::before {
content: attr(data-trix-placeholder);
color: graytext;
}
%t [data-trix-cursor-target] {
display: `).concat(O0.display,` !important;
width: `).concat(O0.width,` !important;
padding: 0 !important;
margin: 0 !important;
border: none !important;
}
%t [data-trix-cursor-target=left] {
vertical-align: top !important;
margin-left: -1px !important;
}
%t [data-trix-cursor-target=right] {
vertical-align: bottom !important;
margin-right: -1px !important;
}`));var wi=new WeakMap,ac=new WeakMap,cl=new WeakSet;class lD{constructor(e){var t,n;wk(t=this,n=cl),n.add(t),gn(this,"value",""),po(this,wi,{writable:!0,value:void 0}),po(this,ac,{writable:!0,value:void 0}),this.element=e,Wl(this,wi,e.attachInternals()),Wl(this,ac,!1)}connectedCallback(){lc(this,cl,cc).call(this)}disconnectedCallback(){}get form(){return it(this,wi).form}get name(){return this.element.getAttribute("name")}set name(e){this.element.setAttribute("name",e)}get labels(){return it(this,wi).labels}get disabled(){return it(this,ac)||this.element.hasAttribute("disabled")}set disabled(e){this.element.toggleAttribute("disabled",e)}get required(){return this.element.hasAttribute("required")}set required(e){this.element.toggleAttribute("required",e),lc(this,cl,cc).call(this)}get validity(){return it(this,wi).validity}get validationMessage(){return it(this,wi).validationMessage}get willValidate(){return it(this,wi).willValidate}formDisabledCallback(e){Wl(this,ac,e)}setFormValue(e){this.value=e,lc(this,cl,cc).call(this),it(this,wi).setFormValue(this.element.disabled?void 0:this.value)}checkValidity(){return it(this,wi).checkValidity()}reportValidity(){return it(this,wi).reportValidity()}setCustomValidity(e){lc(this,cl,cc).call(this,e)}}function cc(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";const{required:e,value:t}=this.element,n=e&&!t,r=!!i,s=Ge("input",{required:e}),o=i||s.validationMessage;it(this,wi).setValidity({valueMissing:n,customError:r},o)}var kf=new WeakMap,Sf=new WeakMap,_f=new WeakMap;class aD{constructor(e){po(this,kf,{writable:!0,value:void 0}),po(this,Sf,{writable:!0,value:t=>{t.defaultPrevented||t.target===this.element.form&&this.element.reset()}}),po(this,_f,{writable:!0,value:t=>{if(t.defaultPrevented||this.element.contains(t.target))return;const n=Yr(t.target,{matchingSelector:"label"});n&&Array.from(this.labels).includes(n)&&this.element.focus()}}),this.element=e}connectedCallback(){Wl(this,kf,function(e){if(e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby"))return;const t=function(){const n=Array.from(e.labels).map(s=>{if(!s.contains(e))return s.textContent}).filter(s=>s),r=n.join(" ");return r?e.setAttribute("aria-label",r):e.removeAttribute("aria-label")};return t(),Zt("focus",{onElement:e,withCallback:t})}(this.element)),window.addEventListener("reset",it(this,Sf),!1),window.addEventListener("click",it(this,_f),!1)}disconnectedCallback(){var e;(e=it(this,kf))===null||e===void 0||e.destroy(),window.removeEventListener("reset",it(this,Sf),!1),window.removeEventListener("click",it(this,_f),!1)}get labels(){const e=[];this.element.id&&this.element.ownerDocument&&e.push(...Array.from(this.element.ownerDocument.querySelectorAll("label[for='".concat(this.element.id,"']"))||[]));const t=Yr(this.element,{matchingSelector:"label"});return t&&[this.element,null].includes(t.control)&&e.push(t),e}get form(){return console.warn("This browser does not support the .form property for trix-editor elements."),null}get name(){return console.warn("This browser does not support the .name property for trix-editor elements."),null}set name(e){console.warn("This browser does not support the .name property for trix-editor elements.")}get disabled(){return console.warn("This browser does not support the [disabled] attribute for trix-editor elements."),!1}set disabled(e){console.warn("This browser does not support the [disabled] attribute for trix-editor elements.")}get required(){return console.warn("This browser does not support the [required] attribute for trix-editor elements."),!1}set required(e){console.warn("This browser does not support the [required] attribute for trix-editor elements.")}get validity(){return console.warn("This browser does not support the validity property for trix-editor elements."),null}get validationMessage(){return console.warn("This browser does not support the validationMessage property for trix-editor elements."),""}get willValidate(){return console.warn("This browser does not support the willValidate property for trix-editor elements."),!1}formDisabledCallback(e){}setFormValue(e){}checkValidity(){return console.warn("This browser does not support checkValidity() for trix-editor elements."),!0}reportValidity(){return console.warn("This browser does not support reportValidity() for trix-editor elements."),!0}setCustomValidity(e){console.warn("This browser does not support setCustomValidity(validationMessage) for trix-editor elements.")}}var Xt=new WeakMap;class Su extends HTMLElement{constructor(){super(),po(this,Xt,{writable:!0,value:void 0}),this.willCreateInput=!0,Wl(this,Xt,this.constructor.formAssociated?new lD(this):new aD(this))}get trixId(){return this.hasAttribute("trix-id")?this.getAttribute("trix-id"):(this.setAttribute("trix-id",++nD),this.trixId)}get labels(){return it(this,Xt).labels}get disabled(){const{inputElement:e}=this;return e?e.disabled:it(this,Xt).disabled}set disabled(e){const{inputElement:t}=this;t&&(t.disabled=e),it(this,Xt).disabled=e}get required(){return it(this,Xt).required}set required(e){it(this,Xt).required=e}get validity(){return it(this,Xt).validity}get validationMessage(){return it(this,Xt).validationMessage}get willValidate(){return it(this,Xt).willValidate}get type(){return this.localName}get toolbarElement(){var e;if(this.hasAttribute("toolbar"))return(e=this.ownerDocument)===null||e===void 0?void 0:e.getElementById(this.getAttribute("toolbar"));if(this.parentNode){const t="trix-toolbar-".concat(this.trixId);return this.setAttribute("toolbar",t),this.internalToolbar=Ge("trix-toolbar",{id:t}),this.parentNode.insertBefore(this.internalToolbar,this),this.internalToolbar}}get form(){const{inputElement:e}=this;return e?e.form:it(this,Xt).form}get inputElement(){var e;return this.hasAttribute("input")?(e=this.ownerDocument)===null||e===void 0?void 0:e.getElementById(this.getAttribute("input")):void 0}get editor(){var e;return(e=this.editorController)===null||e===void 0?void 0:e.editor}get name(){const{inputElement:e}=this;return e?e.name:it(this,Xt).name}set name(e){const{inputElement:t}=this;t?t.name=e:it(this,Xt).name=e}get value(){const{inputElement:e}=this;return e?e.value:it(this,Xt).value}set value(e){var t;this.defaultValue=e,(t=this.editor)===null||t===void 0||t.loadHTML(this.defaultValue)}attributeChangedCallback(e,t,n){e==="connected"&&this.isConnected&&t!=null&&t!==n&&requestAnimationFrame(()=>this.reconnect())}notify(e,t){if(this.editorController)return Il("trix-".concat(e),{onElement:this,attributes:t})}setFormValue(e){const{inputElement:t}=this;t&&(t.value=e),it(this,Xt).setFormValue(e)}connectedCallback(){if(!this.hasAttribute("data-trix-internal")){if(iD(this),function(e){e.hasAttribute("role")||e.setAttribute("role","textbox")}(this),!this.editorController){if(Il("trix-before-initialize",{onElement:this}),this.defaultValue=this.inputElement?this.inputElement.value:this.innerHTML,!this.hasAttribute("input")&&this.parentNode&&this.willCreateInput){const e="trix-input-".concat(this.trixId);this.setAttribute("input",e);const t=Ge("input",{type:"hidden",id:e});this.parentNode.insertBefore(t,this.nextElementSibling)}this.editorController=new Fl({editorElement:this,html:this.defaultValue}),requestAnimationFrame(()=>Il("trix-initialize",{onElement:this}))}this.editorController.registerSelectionManager(),it(this,Xt).connectedCallback(),this.toggleAttribute("connected",!0),function(e){!document.querySelector(":focus")&&e.hasAttribute("autofocus")&&document.querySelector("[autofocus]")===e&&e.focus()}(this)}}disconnectedCallback(){var e;(e=this.editorController)===null||e===void 0||e.unregisterSelectionManager(),it(this,Xt).disconnectedCallback(),this.toggleAttribute("connected",!1)}reconnect(){this.removeInternalToolbar(),this.disconnectedCallback(),this.connectedCallback()}removeInternalToolbar(){var e;(e=this.internalToolbar)===null||e===void 0||e.remove(),this.internalToolbar=null}checkValidity(){return it(this,Xt).checkValidity()}reportValidity(){return it(this,Xt).reportValidity()}setCustomValidity(e){it(this,Xt).setCustomValidity(e)}formDisabledCallback(e){const{inputElement:t}=this;t&&(t.disabled=e),this.toggleAttribute("contenteditable",!e),it(this,Xt).formDisabledCallback(e)}formResetCallback(){this.reset()}reset(){this.value=this.defaultValue}}gn(Su,"formAssociated","ElementInternals"in window),gn(Su,"observedAttributes",["connected"]);const ro={VERSION:cR,config:$a,core:x4,models:Ek,views:R4,controllers:J4,observers:eD,operations:tD,elements:Object.freeze({__proto__:null,TrixEditorElement:Su,TrixToolbarElement:Xk}),filters:Object.freeze({__proto__:null,Filter:Pk,attachmentGalleryFilter:Ak})};Object.assign(ro,Ek),window.Trix=ro,setTimeout(function(){customElements.get("trix-toolbar")||customElements.define("trix-toolbar",Xk),customElements.get("trix-editor")||customElements.define("trix-editor",Su)},0);function cD(i){let e,t,n,r,s,o,l,a;return{c(){e=y("div"),t=y("input"),r=D(),s=y("trix-editor"),O(t,"id",n="x-"+i[1].name),t.value=i[0],O(t,"type","hidden"),Jo(s,"class","content"),Jo(s,"input",o="x-"+i[1].name),Jo(s,"role","textbox"),Jo(s,"tabindex","0"),O(e,"class","tox-wrapper")},m(c,u){x(c,e,u),b(e,t),b(e,r),b(e,s),i[5](s),l||(a=G(s,"trix-change",i[3]),l=!0)},p(c,[u]){u&2&&n!==(n="x-"+c[1].name)&&O(t,"id",n),u&1&&(t.value=c[0]),u&2&&o!==(o="x-"+c[1].name)&&Jo(s,"input",o)},i:U,o:U,d(c){c&&P(e),i[5](null),l=!1,a()}}}function uD(i,e,t){let{value:n=""}=e,{field:r}=e,s;function o(c){t(0,n=c.target.value)}function l(c){console.log({html:c});var u=new ro.Attachment({content:c});s.editor.insertAttachment(u)}xi(()=>{s.addEventListener("trix-file-accept",c=>{c.preventDefault()}),s.addEventListener("trix-before-initialize",c=>{ro.config.blockAttributes.heading1.tagName="h2";const{toolbarElement:u}=c.target;u.querySelector("[data-trix-attribute=heading1]").insertAdjacentHTML("afterend",'<button style="text-indent: initial;padding: 14px 10px !important;" type="button" class="trix-button trix-button--icon" data-trix-attribute="heading3" title="Heading 3" tabindex="-1" data-trix-active="">H3</button>')})}),ro.config.blockAttributes.default.breakOnReturn=!1,ro.config.blockAttributes.heading3={tagName:"h3",terminal:!0,breakOnReturn:!0,group:!1};function a(c){Ce[c?"unshift":"push"](()=>{s=c,t(2,s)})}return i.$$set=c=>{"value"in c&&t(0,n=c.value),"field"in c&&t(1,r=c.field)},[n,r,s,o,l,a]}class hD extends oe{constructor(e){super(),se(this,e,uD,cD,re,{value:0,field:1,insertMedia:4})}get insertMedia(){return this.$$.ctx[4]}}function b0(i){let e,t;return{c(){e=y("div"),t=W(i[4]),O(e,"class","invalid-feedback d-block")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&16&&K(t,n[4])},d(n){n&&P(e)}}}function fD(i){let e,t,n,r,s,o,l;function a(h){i[8](h)}let c={field:i[1]};i[0]!==void 0&&(c.value=i[0]),t=new hD({props:c}),i[7](t),Ce.push(()=>nt(t,"value",a)),s=new Gy({props:{record:i[2],field:i[1],onFilesInserted:i[5]}});let u=i[4]&&b0(i);return{c(){e=y("div"),V(t.$$.fragment),r=D(),V(s.$$.fragment),o=D(),u&&u.c(),O(e,"class","mb-0")},m(h,f){x(h,e,f),Y(t,e,null),b(e,r),Y(s,e,null),b(e,o),u&&u.m(e,null),l=!0},p(h,[f]){const d={};f&2&&(d.field=h[1]),!n&&f&1&&(n=!0,d.value=h[0],st(()=>n=!1)),t.$set(d);const m={};f&4&&(m.record=h[2]),f&2&&(m.field=h[1]),s.$set(m),h[4]?u?u.p(h,f):(u=b0(h),u.c(),u.m(e,null)):u&&(u.d(1),u=null)},i(h){l||(T(t.$$.fragment,h),T(s.$$.fragment,h),l=!0)},o(h){R(t.$$.fragment,h),R(s.$$.fragment,h),l=!1},d(h){h&&P(e),i[7](null),z(t),z(s),u&&u.d()}}}function dD(i,e,t){let n;const r=Ue("channel");let{value:s}=e,{field:o}=e,{record:l}=e,{validationErrors:a}=e,c;function u(d){const m=d.detail.preset.path;d.detail.files.map(p=>{const g=iT(r,p,m);c.insertMedia(g)})}function h(d){Ce[d?"unshift":"push"](()=>{c=d,t(3,c)})}function f(d){s=d,t(0,s)}return i.$$set=d=>{"value"in d&&t(0,s=d.value),"field"in d&&t(1,o=d.field),"record"in d&&t(2,l=d.record),"validationErrors"in d&&t(6,a=d.validationErrors)},i.$$.update=()=>{i.$$.dirty&66&&t(4,n=In(a,o.name))},[s,o,l,c,n,u,a,h,f]}class Fk extends oe{constructor(e){super(),se(this,e,dD,fD,re,{value:0,field:1,record:2,validationErrors:6})}}class at{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=To(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),Ni.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=To(this,e,t);let n=[];return this.decompose(e,t,n,0),Ni.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new Yl(this),s=new Yl(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=n)return!0}}iter(e=1){return new Yl(this,e)}iterRange(e,t=this.length){return new Yk(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new zk(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?at.empty:e.length<=32?new Ft(e):Ni.from(Ft.split(e,[]))}}class Ft extends at{constructor(e,t=mD(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?n:l)>=e)return new pD(r,l,n,o);r=l+1,n++}}decompose(e,t,n,r){let s=e<=0&&t>=this.length?this:new Ft(v0(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=n.pop(),l=Vc(s.text,o.text.slice(),0,s.length);if(l.length<=32)n.push(new Ft(l,o.length+s.length));else{let a=l.length>>1;n.push(new Ft(l.slice(0,a)),new Ft(l.slice(a)))}}else n.push(s)}replace(e,t,n){if(!(n instanceof Ft))return super.replace(e,t,n);[e,t]=To(this,e,t);let r=Vc(this.text,Vc(n.text,v0(this.text,0,e)),t),s=this.length+n.length-(t-e);return r.length<=32?new Ft(r,s):Ni.from(Ft.split(r,[]),s)}sliceString(e,t=this.length,n=`
`){[e,t]=To(this,e,t);let r="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(r+=n),e<a&&t>s&&(r+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],r=-1;for(let s of e)n.push(s),r+=s.length+1,n.length==32&&(t.push(new Ft(n,r)),n=[],r=-1);return r>-1&&t.push(new Ft(n,r)),t}}class Ni extends at{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=n+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,n,r);r=l+1,n=a+1}}decompose(e,t,n,r){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&t>=o){let c=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!c?n.push(l):l.decompose(e-o,t-o,n,c)}o=a+1}}replace(e,t,n){if([e,t]=To(this,e,t),n.lines<this.lines)for(let r=0,s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e>=s&&t<=l){let a=o.replace(e-s,t-s,n),c=this.lines-o.lines+a.lines;if(a.lines<c>>4&&a.lines>c>>6){let u=this.children.slice();return u[r]=a,new Ni(u,this.length-(t-e)+n.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
`){[e,t]=To(this,e,t);let r="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(r+=n),e<a&&t>o&&(r+=l.sliceString(e-o,t-o,n)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ni))return 0;let n=0,[r,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,s+=t){if(r==o||s==l)return n;let a=this.children[r],c=e.children[s];if(a!=c)return n+a.scanIdentical(c,t);n+=a.length+1}}static from(e,t=e.reduce((n,r)=>n+r.length+1,-1)){let n=0;for(let d of e)n+=d.lines;if(n<32){let d=[];for(let m of e)m.flatten(d);return new Ft(d,t)}let r=Math.max(32,n>>5),s=r<<1,o=r>>1,l=[],a=0,c=-1,u=[];function h(d){let m;if(d.lines>s&&d instanceof Ni)for(let p of d.children)h(p);else d.lines>o&&(a>o||!a)?(f(),l.push(d)):d instanceof Ft&&a&&(m=u[u.length-1])instanceof Ft&&d.lines+m.lines<=32?(a+=d.lines,c+=d.length+1,u[u.length-1]=new Ft(m.text.concat(d.text),m.length+1+d.length)):(a+d.lines>r&&f(),a+=d.lines,c+=d.length+1,u.push(d))}function f(){a!=0&&(l.push(u.length==1?u[0]:Ni.from(u,c)),c=-1,a=u.length=0)}for(let d of e)h(d);return f(),l.length==1?l[0]:new Ni(l,t)}}at.empty=new Ft([""],0);function mD(i){let e=-1;for(let t of i)e+=t.length+1;return e}function Vc(i,e,t=0,n=1e9){for(let r=0,s=0,o=!0;s<i.length&&r<=n;s++){let l=i[s],a=r+l.length;a>=t&&(a>n&&(l=l.slice(0,n-r)),r<t&&(l=l.slice(t-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=a+1}return e}function v0(i,e,t){return Vc(i,[""],e,t)}class Yl{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Ft?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],s=this.offsets[n],o=s>>1,l=r instanceof Ft?r.text.length:r.children.length;if(o==(t>0?l:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
`,this;e--}else if(r instanceof Ft){let a=r.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof Ft?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Yk{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Yl(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class zk{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(at.prototype[Symbol.iterator]=function(){return this.iter()},Yl.prototype[Symbol.iterator]=Yk.prototype[Symbol.iterator]=zk.prototype[Symbol.iterator]=function(){return this});let pD=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function To(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max(e,Math.min(i.length,t))]}let go="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,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,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(i=>i?parseInt(i,36):1);for(let i=1;i<go.length;i++)go[i]+=go[i-1];function gD(i){for(let e=1;e<go.length;e+=2)if(go[e]>i)return go[e-1]<=i;return!1}function w0(i){return i>=127462&&i<=127487}const y0=8205;function hn(i,e,t=!0,n=!0){return(t?Vk:OD)(i,e,n)}function Vk(i,e,t){if(e==i.length)return e;e&&Uk(i.charCodeAt(e))&&jk(i.charCodeAt(e-1))&&e--;let n=ln(i,e);for(e+=oi(n);e<i.length;){let r=ln(i,e);if(n==y0||r==y0||t&&gD(r))e+=oi(r),n=r;else if(w0(r)){let s=0,o=e-2;for(;o>=0&&w0(ln(i,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function OD(i,e,t){for(;e>0;){let n=Vk(i,e-2,t);if(n<e)return n;e--}return 0}function Uk(i){return i>=56320&&i<57344}function jk(i){return i>=55296&&i<56320}function ln(i,e){let t=i.charCodeAt(e);if(!jk(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return Uk(n)?(t-55296<<10)+(n-56320)+65536:t}function sp(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function oi(i){return i<65536?1:2}const Ld=/\r\n?|\n/;var cn=function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i}(cn||(cn={}));class ji{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(n,r,s),r+=s):r+=o,n+=s}}iterChangedRanges(e,t=!1){Id(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];r<0?e.push(n,r):e.push(r,n)}return new ji(e)}composeDesc(e){return this.empty?e:e.empty?this:qk(this,e)}mapDesc(e,t=!1){return e.empty?this:Nd(this,e,t)}mapPos(e,t=-1,n=cn.Simple){let r=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],c=r+l;if(a<0){if(c>e)return s+(e-r);s+=l}else{if(n!=cn.Simple&&c>=e&&(n==cn.TrackDel&&r<e&&c>e||n==cn.TrackBefore&&r<e||n==cn.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!l)return e==r||t<0?s:s+a;s+=a}r=c}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let s=this.sections[n++],o=this.sections[n++],l=r+s;if(o>=0&&r<=t&&l>=e)return r<e&&l>t?"cover":!0;r=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+n+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ji(e)}static create(e){return new ji(e)}}class en extends ji{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Id(this,(t,n,r,s,o)=>e=e.replace(r,r+(n-t),o),!1),e}mapDesc(e,t=!1){return Nd(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let r=0,s=0;r<t.length;r+=2){let o=t[r],l=t[r+1];if(l>=0){t[r]=l,t[r+1]=o;let a=r>>1;for(;n.length<a;)n.push(at.empty);n.push(o?e.slice(s,s+o):at.empty)}s+=o}return new en(t,n)}compose(e){return this.empty?e:e.empty?this:qk(this,e,!0)}map(e,t=!1){return e.empty?this:Nd(this,e,t,!0)}iterChanges(e,t=!1){Id(this,e,t)}get desc(){return ji.create(this.sections)}filter(e){let t=[],n=[],r=[],s=new la(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&s.len==0;){if(s.done)break e;let u=Math.min(s.len,a-l);mn(r,u,-1);let h=s.ins==-1?-1:s.off==0?s.ins:0;mn(t,u,h),h>0&&Ir(n,t,s.text),s.forward(u),l+=u}let c=e[o++];for(;l<c;){if(s.done)break e;let u=Math.min(s.len,c-l);mn(t,u,-1),mn(r,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),l+=u}}return{changes:new en(t,n),filtered:ji.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],r=this.sections[t+1];r<0?e.push(n):r==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let r=[],s=[],o=0,l=null;function a(u=!1){if(!u&&!r.length)return;o<t&&mn(r,t-o,-1);let h=new en(r,s);l=l?l.compose(h.map(l)):h,r=[],s=[],o=0}function c(u){if(Array.isArray(u))for(let h of u)c(h);else if(u instanceof en){if(u.length!=t)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${t})`);a(),l=l?l.compose(u.map(l)):u}else{let{from:h,to:f=h,insert:d}=u;if(h>f||h<0||f>t)throw new RangeError(`Invalid change range ${h} to ${f} (in doc of length ${t})`);let m=d?typeof d=="string"?at.of(d.split(n||Ld)):d:at.empty,p=m.length;if(h==f&&p==0)return;h<o&&a(),h>o&&mn(r,h-o,-1),mn(r,f-h,p),Ir(s,r,m),o=f}}return c(e),a(!l),l}static empty(e){return new en(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let r=0;r<e.length;r++){let s=e[r];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;n.length<r;)n.push(at.empty);n[r]=at.of(s.slice(1)),t.push(s[0],n[r].length)}}}return new en(t,n)}static createSet(e,t){return new en(e,t)}}function mn(i,e,t,n=!1){if(e==0&&t<=0)return;let r=i.length-2;r>=0&&t<=0&&t==i[r+1]?i[r]+=e:e==0&&i[r]==0?i[r+1]+=t:n?(i[r]+=e,i[r+1]+=t):i.push(e,t)}function Ir(i,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n<i.length)i[i.length-1]=i[i.length-1].append(t);else{for(;i.length<n;)i.push(at.empty);i.push(t)}}function Id(i,e,t){let n=i.inserted;for(let r=0,s=0,o=0;o<i.sections.length;){let l=i.sections[o++],a=i.sections[o++];if(a<0)r+=l,s+=l;else{let c=r,u=s,h=at.empty;for(;c+=l,u+=a,a&&n&&(h=h.append(n[o-2>>1])),!(t||o==i.sections.length||i.sections[o+1]<0);)l=i.sections[o++],a=i.sections[o++];e(r,c,s,u,h),r=c,s=u}}}function Nd(i,e,t,n=!1){let r=[],s=n?[]:null,o=new la(i),l=new la(e);for(let a=-1;;)if(o.ins==-1&&l.ins==-1){let c=Math.min(o.len,l.len);mn(r,c,-1),o.forward(c),l.forward(c)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!t))){let c=l.len;for(mn(r,l.ins,-1);c;){let u=Math.min(o.len,c);o.ins>=0&&a<o.i&&o.len<=u&&(mn(r,0,o.ins),s&&Ir(s,r,o.text),a=o.i),o.forward(u),c-=u}l.next()}else if(o.ins>=0){let c=0,u=o.len;for(;u;)if(l.ins==-1){let h=Math.min(u,l.len);c+=h,u-=h,l.forward(h)}else if(l.ins==0&&l.len<u)u-=l.len,l.next();else break;mn(r,c,a<o.i?o.ins:0),s&&a<o.i&&Ir(s,r,o.text),a=o.i,o.forward(o.len-u)}else{if(o.done&&l.done)return s?en.createSet(r,s):ji.create(r);throw new Error("Mismatched change set lengths")}}function qk(i,e,t=!1){let n=[],r=t?[]:null,s=new la(i),o=new la(e);for(let l=!1;;){if(s.done&&o.done)return r?en.createSet(n,r):ji.create(n);if(s.ins==0)mn(n,s.len,0,l),s.next();else if(o.len==0&&!o.done)mn(n,0,o.ins,l),r&&Ir(r,n,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(s.len2,o.len),c=n.length;if(s.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;mn(n,a,u,l),r&&u&&Ir(r,n,o.text)}else o.ins==-1?(mn(n,s.off?0:s.len,a,l),r&&Ir(r,n,s.textBit(a))):(mn(n,s.off?0:s.len,o.off?0:o.ins,l),r&&!o.off&&Ir(r,n,o.text));l=(s.ins>a||o.ins>=0&&o.len>a)&&(l||n.length>c),s.forward2(a),o.forward(a)}}}}class la{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?at.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?at.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class ys{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let n,r;return this.empty?n=r=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new ys(n,r,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return q.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return q.range(this.anchor,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return q.range(e.anchor,e.head)}static create(e,t,n){return new ys(e,t,n)}}class q{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:q.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new q([this.main],0)}addRange(e,t=!0){return q.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,q.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new q(e.ranges.map(t=>ys.fromJSON(t)),e.main)}static single(e,t=e){return new q([q.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,r=0;r<e.length;r++){let s=e[r];if(s.empty?s.from<=n:s.from<n)return q.normalized(e.slice(),t);n=s.to}return new q(e,t)}static cursor(e,t=0,n,r){return ys.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n))|(r??16777215)<<6)}static range(e,t,n,r){let s=(n??16777215)<<6|(r==null?7:Math.min(6,r));return t<e?ys.create(t,e,48|s):ys.create(e,t,(t>e?8:0)|s)}static normalized(e,t=0){let n=e[t];e.sort((r,s)=>r.from-s.from),t=e.indexOf(n);for(let r=1;r<e.length;r++){let s=e[r],o=e[r-1];if(s.empty?s.from<=o.to:s.from<o.to){let l=o.from,a=Math.max(s.to,o.to);r<=t&&t--,e.splice(--r,2,s.anchor>s.head?q.range(a,l):q.range(l,a))}}return new q(e,t)}}function Gk(i,e){for(let t of i.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let op=0;class ye{constructor(e,t,n,r,s){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=op++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new ye(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:lp),!!e.static,e.enables)}of(e){return new Uc([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Uc(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Uc(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function lp(i,e){return i==e||i.length==e.length&&i.every((t,n)=>t===e[n])}class Uc{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=op++}dynamicSlot(e){var t;let n=this.value,r=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,c=!1,u=[];for(let h of this.dependencies)h=="doc"?a=!0:h=="selection"?c=!0:((t=e[h.id])!==null&&t!==void 0?t:1)&1||u.push(e[h.id]);return{create(h){return h.values[o]=n(h),1},update(h,f){if(a&&f.docChanged||c&&(f.docChanged||f.selection)||Zd(h,u)){let d=n(h);if(l?!k0(d,h.values[o],r):!r(d,h.values[o]))return h.values[o]=d,1}return 0},reconfigure:(h,f)=>{let d,m=f.config.address[s];if(m!=null){let p=Cu(f,m);if(this.dependencies.every(g=>g instanceof ye?f.facet(g)===h.facet(g):g instanceof Jt?f.field(g,!1)==h.field(g,!1):!0)||(l?k0(d=n(h),p,r):r(d=n(h),p)))return h.values[o]=p,0}else d=n(h);return h.values[o]=d,1}}}}function k0(i,e,t){if(i.length!=e.length)return!1;for(let n=0;n<i.length;n++)if(!t(i[n],e[n]))return!1;return!0}function Zd(i,e){let t=!1;for(let n of e)zl(i,n)&1&&(t=!0);return t}function bD(i,e,t){let n=t.map(a=>i[a.id]),r=t.map(a=>a.type),s=n.filter(a=>!(a&1)),o=i[e.id]>>1;function l(a){let c=[];for(let u=0;u<n.length;u++){let h=Cu(a,n[u]);if(r[u]==2)for(let f of h)c.push(f);else c.push(h)}return e.combine(c)}return{create(a){for(let c of n)zl(a,c);return a.values[o]=l(a),1},update(a,c){if(!Zd(a,s))return 0;let u=l(a);return e.compare(u,a.values[o])?0:(a.values[o]=u,1)},reconfigure(a,c){let u=Zd(a,n),h=c.config.facets[e.id],f=c.facet(e);if(h&&!u&&lp(t,h))return a.values[o]=f,0;let d=l(a);return e.compare(d,f)?(a.values[o]=f,0):(a.values[o]=d,1)}}}const S0=ye.define({static:!0});class Jt{constructor(e,t,n,r,s){this.id=e,this.createF=t,this.updateF=n,this.compareF=r,this.spec=s,this.provides=void 0}static define(e){let t=new Jt(op++,e.create,e.update,e.compare||((n,r)=>n===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(S0).find(n=>n.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:n=>(n.values[t]=this.create(n),1),update:(n,r)=>{let s=n.values[t],o=this.updateF(s,r);return this.compareF(s,o)?0:(n.values[t]=o,1)},reconfigure:(n,r)=>r.config.address[this.id]!=null?(n.values[t]=r.field(this),0):(n.values[t]=this.create(n),1)}}init(e){return[this,S0.of({field:this,create:e})]}get extension(){return this}}const Os={lowest:4,low:3,default:2,high:1,highest:0};function ul(i){return e=>new Hk(e,i)}const gr={highest:ul(Os.highest),high:ul(Os.high),default:ul(Os.default),low:ul(Os.low),lowest:ul(Os.lowest)};class Hk{constructor(e,t){this.inner=e,this.prec=t}}class Vr{of(e){return new Bd(this,e)}reconfigure(e){return Vr.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Bd{constructor(e,t){this.compartment=e,this.inner=t}}class _u{constructor(e,t,n,r,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let r=[],s=Object.create(null),o=new Map;for(let f of vD(e,t,o))f instanceof Jt?r.push(f):(s[f.facet.id]||(s[f.facet.id]=[])).push(f);let l=Object.create(null),a=[],c=[];for(let f of r)l[f.id]=c.length<<1,c.push(d=>f.slot(d));let u=n==null?void 0:n.config.facets;for(let f in s){let d=s[f],m=d[0].facet,p=u&&u[f]||[];if(d.every(g=>g.type==0))if(l[m.id]=a.length<<1|1,lp(p,d))a.push(n.facet(m));else{let g=m.combine(d.map(v=>v.value));a.push(n&&m.compare(g,n.facet(m))?n.facet(m):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=c.length<<1,c.push(v=>g.dynamicSlot(v)));l[m.id]=c.length<<1,c.push(g=>bD(g,m,d))}}let h=c.map(f=>f(l));return new _u(e,o,h,l,a,s)}}function vD(i,e,t){let n=[[],[],[],[],[]],r=new Map;function s(o,l){let a=r.get(o);if(a!=null){if(a<=l)return;let c=n[a].indexOf(o);c>-1&&n[a].splice(c,1),o instanceof Bd&&t.delete(o.compartment)}if(r.set(o,l),Array.isArray(o))for(let c of o)s(c,l);else if(o instanceof Bd){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;t.set(o.compartment,c),s(c,l)}else if(o instanceof Hk)s(o.inner,o.prec);else if(o instanceof Jt)n[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof Uc)n[l].push(o),o.facet.extensions&&s(o.facet.extensions,Os.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(c,l)}}return s(i,Os.default),n.reduce((o,l)=>o.concat(l))}function zl(i,e){if(e&1)return 2;let t=e>>1,n=i.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;i.status[t]=4;let r=i.computeSlot(i,i.config.dynamicSlots[t]);return i.status[t]=2|r}function Cu(i,e){return e&1?i.config.staticValues[e>>1]:i.values[e>>1]}const Kk=ye.define(),Wd=ye.define({combine:i=>i.some(e=>e),static:!0}),Jk=ye.define({combine:i=>i.length?i[0]:void 0,static:!0}),eS=ye.define(),tS=ye.define(),nS=ye.define(),iS=ye.define({combine:i=>i.length?i[0]:!1});class Or{constructor(e,t){this.type=e,this.value=t}static define(){return new wD}}class wD{of(e){return new Or(this,e)}}class yD{constructor(e){this.map=e}of(e){return new Fe(this,e)}}class Fe{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new Fe(this.type,t)}is(e){return this.type==e}static define(e={}){return new yD(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let s=r.map(t);s&&n.push(s)}return n}}Fe.reconfigure=Fe.define();Fe.appendConfig=Fe.define();class Ht{constructor(e,t,n,r,s,o){this.startState=e,this.changes=t,this.selection=n,this.effects=r,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,n&&Gk(n,t.newLength),s.some(l=>l.type==Ht.time)||(this.annotations=s.concat(Ht.time.of(Date.now())))}static create(e,t,n,r,s,o){return new Ht(e,t,n,r,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(Ht.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Ht.time=Or.define();Ht.userEvent=Or.define();Ht.addToHistory=Or.define();Ht.remote=Or.define();function kD(i,e){let t=[];for(let n=0,r=0;;){let s,o;if(n<i.length&&(r==e.length||e[r]>=i[n]))s=i[n++],o=i[n++];else if(r<e.length)s=e[r++],o=e[r++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function rS(i,e,t){var n;let r,s,o;return t?(r=e.changes,s=en.empty(e.changes.length),o=i.changes.compose(e.changes)):(r=e.changes.map(i.changes),s=i.changes.mapDesc(e.changes,!0),o=i.changes.compose(r)),{changes:o,selection:e.selection?e.selection.map(s):(n=i.selection)===null||n===void 0?void 0:n.map(r),effects:Fe.mapEffects(i.effects,r).concat(Fe.mapEffects(e.effects,s)),annotations:i.annotations.length?i.annotations.concat(e.annotations):e.annotations,scrollIntoView:i.scrollIntoView||e.scrollIntoView}}function Xd(i,e,t){let n=e.selection,r=Oo(e.annotations);return e.userEvent&&(r=r.concat(Ht.userEvent.of(e.userEvent))),{changes:e.changes instanceof en?e.changes:en.of(e.changes||[],t,i.facet(Jk)),selection:n&&(n instanceof q?n:q.single(n.anchor,n.head)),effects:Oo(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function sS(i,e,t){let n=Xd(i,e.length?e[0]:{},i.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;n=rS(n,Xd(i,e[s],o?n.changes.newLength:i.doc.length),o)}let r=Ht.create(i,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return _D(t?SD(r):r)}function SD(i){let e=i.startState,t=!0;for(let r of e.facet(eS)){let s=r(i);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:kD(t,s))}if(t!==!0){let r,s;if(t===!1)s=i.changes.invertedDesc,r=en.empty(e.doc.length);else{let o=i.changes.filter(t);r=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}i=Ht.create(e,r,i.selection&&i.selection.map(s),Fe.mapEffects(i.effects,s),i.annotations,i.scrollIntoView)}let n=e.facet(tS);for(let r=n.length-1;r>=0;r--){let s=n[r](i);s instanceof Ht?i=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Ht?i=s[0]:i=sS(e,Oo(s),!1)}return i}function _D(i){let e=i.startState,t=e.facet(nS),n=i;for(let r=t.length-1;r>=0;r--){let s=t[r](i);s&&Object.keys(s).length&&(n=rS(n,Xd(e,s,i.changes.newLength),!0))}return n==i?i:Ht.create(e,i.changes,i.selection,n.effects,n.annotations,n.scrollIntoView)}const CD=[];function Oo(i){return i==null?CD:Array.isArray(i)?i:[i]}var $t=function(i){return i[i.Word=0]="Word",i[i.Space=1]="Space",i[i.Other=2]="Other",i}($t||($t={}));const PD=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Fd;try{Fd=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function AD(i){if(Fd)return Fd.test(i);for(let e=0;e<i.length;e++){let t=i[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||PD.test(t)))return!0}return!1}function xD(i){return e=>{if(!/\S/.test(e))return $t.Space;if(AD(e))return $t.Word;for(let t=0;t<i.length;t++)if(e.indexOf(i[t])>-1)return $t.Word;return $t.Other}}class et{constructor(e,t,n,r,s,o){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)zl(this,l<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw new RangeError("Field is not present in this state");return}return zl(this,n),Cu(this,n)}update(...e){return sS(this,e,!0)}applyTransaction(e){let t=this.config,{base:n,compartments:r}=t;for(let l of e.effects)l.is(Vr.reconfigure)?(t&&(r=new Map,t.compartments.forEach((a,c)=>r.set(c,a)),t=null),r.set(l.value.compartment,l.value.extension)):l.is(Fe.reconfigure)?(t=null,n=l.value):l.is(Fe.appendConfig)&&(t=null,n=Oo(n).concat(l.value));let s;t?s=e.startState.values.slice():(t=_u.resolve(n,r,this),s=new et(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,c)=>c.reconfigure(a,this),null).values);let o=e.startState.facet(Wd)?e.newSelection:e.newSelection.asSingle();new et(t,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:q.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),s=[n.range],o=Oo(n.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),c=this.changes(a.changes),u=c.map(r);for(let f=0;f<l;f++)s[f]=s[f].map(u);let h=r.mapDesc(c,!0);s.push(a.range.map(h)),r=r.compose(u),o=Fe.mapEffects(o,u).concat(Fe.mapEffects(Oo(a.effects),h))}return{changes:r,selection:q.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof en?e:en.of(e,this.doc.length,this.facet(et.lineSeparator))}toText(e){return at.of(e.split(this.facet(et.lineSeparator)||Ld))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(zl(this,t),Cu(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof Jt&&this.config.address[r.id]!=null&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(n){for(let s in n)if(Object.prototype.hasOwnProperty.call(e,s)){let o=n[s],l=e[s];r.push(o.init(a=>o.spec.fromJSON(l,a)))}}return et.create({doc:e.doc,selection:q.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=_u.resolve(e.extensions||[],new Map),n=e.doc instanceof at?e.doc:at.of((e.doc||"").split(t.staticFacet(et.lineSeparator)||Ld)),r=e.selection?e.selection instanceof q?e.selection:q.single(e.selection.anchor,e.selection.head):q.single(0);return Gk(r,n.length),t.staticFacet(Wd)||(r=r.asSingle()),new et(t,n,r,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(et.tabSize)}get lineBreak(){return this.facet(et.lineSeparator)||`
`}get readOnly(){return this.facet(iS)}phrase(e,...t){for(let n of this.facet(et.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,r)=>{if(r=="$")return"$";let s=+(r||1);return!s||s>t.length?n:t[s-1]})),e}languageDataAt(e,t,n=-1){let r=[];for(let s of this.facet(Kk))for(let o of s(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){return xD(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-n,l=e-n;for(;o>0;){let a=hn(t,o,!1);if(s(t.slice(a,o))!=$t.Word)break;o=a}for(;l<r;){let a=hn(t,l);if(s(t.slice(l,a))!=$t.Word)break;l=a}return o==l?null:q.range(o+n,l+n)}}et.allowMultipleSelections=Wd;et.tabSize=ye.define({combine:i=>i.length?i[0]:4});et.lineSeparator=Jk;et.readOnly=iS;et.phrases=ye.define({compare(i,e){let t=Object.keys(i),n=Object.keys(e);return t.length==n.length&&t.every(r=>i[r]==e[r])}});et.languageData=Kk;et.changeFilter=eS;et.transactionFilter=tS;et.transactionExtender=nS;Vr.reconfigure=Fe.define();function Qi(i,e,t={}){let n={};for(let r of i)for(let s of Object.keys(r)){let o=r[s],l=n[s];if(l===void 0)n[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,s))n[s]=t[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let r in e)n[r]===void 0&&(n[r]=e[r]);return n}class Ms{eq(e){return this==e}range(e,t=e){return Yd.create(e,t,this)}}Ms.prototype.startSide=Ms.prototype.endSide=0;Ms.prototype.point=!1;Ms.prototype.mapMode=cn.TrackDel;let Yd=class oS{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new oS(e,t,n)}};function zd(i,e){return i.from-e.from||i.value.startSide-e.value.startSide}class ap{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,r=0){let s=n?this.to:this.from;for(let o=r,l=s.length;;){if(o==l)return o;let a=o+l>>1,c=s[a]-e||(n?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return c>=0?o:l;c>=0?l=a:o=a+1}}between(e,t,n,r){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,s);s<o;s++)if(r(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let n=[],r=[],s=[],o=-1,l=-1;for(let a=0;a<this.value.length;a++){let c=this.value[a],u=this.from[a]+e,h=this.to[a]+e,f,d;if(u==h){let m=t.mapPos(u,c.startSide,c.mapMode);if(m==null||(f=d=m,c.startSide!=c.endSide&&(d=t.mapPos(u,c.endSide),d<f)))continue}else if(f=t.mapPos(u,c.startSide),d=t.mapPos(h,c.endSide),f>d||f==d&&c.startSide>0&&c.endSide<=0)continue;(d-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(l=Math.max(l,d-f)),n.push(c),r.push(f-o),s.push(d-o))}return{mapped:n.length?new ap(r,s,n,l):null,pos:o}}}class tt{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(e,t,n,r){return new tt(e,t,n,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:r=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(n&&(t=t.slice().sort(zd)),this.isEmpty)return t.length?tt.of(t):this;let l=new lS(this,null,-1).goto(0),a=0,c=[],u=new Ur;for(;l.value||a<t.length;)if(a<t.length&&(l.from-t[a].from||l.startSide-t[a].value.startSide)>=0){let h=t[a++];u.addInner(h.from,h.to,h.value)||c.push(h)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(l.chunkIndex)<t[a].from)&&(!o||r>this.chunkEnd(l.chunkIndex)||s<this.chunkPos[l.chunkIndex])&&u.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||r>l.to||s<l.from||o(l.from,l.to,l.value))&&(u.addInner(l.from,l.to,l.value)||c.push(Yd.create(l.from,l.to,l.value))),l.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?tt.empty:this.nextLayer.update({add:c,filter:o,filterFrom:r,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],r=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],a=this.chunk[o],c=e.touchesRange(l,l+a.length);if(c===!1)r=Math.max(r,a.maxPoint),t.push(a),n.push(e.mapPos(l));else if(c===!0){let{mapped:u,pos:h}=a.map(l,e);u&&(r=Math.max(r,u.maxPoint),t.push(u),n.push(h))}}let s=this.nextLayer.map(e);return t.length==0?s:new tt(n,t,s||tt.empty,r)}between(e,t,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let s=this.chunkPos[r],o=this.chunk[r];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return aa.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return aa.from(e).goto(t)}static compare(e,t,n,r,s=-1){let o=e.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),l=t.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),a=_0(o,l,n),c=new hl(o,a,s),u=new hl(l,a,s);n.iterGaps((h,f,d)=>C0(c,h,u,f,d,r)),n.empty&&n.length==0&&C0(c,0,u,0,0,r)}static eq(e,t,n=0,r){r==null&&(r=999999999);let s=e.filter(u=>!u.isEmpty&&t.indexOf(u)<0),o=t.filter(u=>!u.isEmpty&&e.indexOf(u)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=_0(s,o),a=new hl(s,l,0).goto(n),c=new hl(o,l,0).goto(n);for(;;){if(a.to!=c.to||!Vd(a.active,c.active)||a.point&&(!c.point||!a.point.eq(c.point)))return!1;if(a.to>r)return!0;a.next(),c.next()}}static spans(e,t,n,r,s=-1){let o=new hl(e,null,s).goto(t),l=t,a=o.openStart;for(;;){let c=Math.min(o.to,n);if(o.point){let u=o.activeForPoint(o.to),h=o.pointFrom<t?u.length+1:o.point.startSide<0?u.length:Math.min(u.length,a);r.point(l,c,o.point,u,h,o.pointRank),a=Math.min(o.openEnd(c),u.length)}else c>l&&(r.span(l,c,o.active,a),a=o.openEnd(c));if(o.to>n)return a+(o.point&&o.to>n?1:0);l=o.to,o.next()}}static of(e,t=!1){let n=new Ur;for(let r of e instanceof Yd?[e]:t?TD(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(e){if(!e.length)return tt.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let r=e[n];r!=tt.empty;r=r.nextLayer)t=new tt(r.chunkPos,r.chunk,t,Math.max(r.maxPoint,t.maxPoint));return t}}tt.empty=new tt([],[],null,-1);function TD(i){if(i.length>1)for(let e=i[0],t=1;t<i.length;t++){let n=i[t];if(zd(e,n)>0)return i.slice().sort(zd);e=n}return i}tt.empty.nextLayer=tt.empty;class Ur{finishChunk(e){this.chunks.push(new ap(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new Ur)).add(e,t,n)}addInner(e,t,n){let r=e-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(tt.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=tt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function _0(i,e,t){let n=new Map;for(let s of i)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&n.set(s.chunk[o],s.chunkPos[o]);let r=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let l=n.get(s.chunk[o]);l!=null&&(t?t.mapPos(l):l)==s.chunkPos[o]&&!(t!=null&&t.touchesRange(l,l+s.chunk[o].length))&&r.add(s.chunk[o])}return r}class lS{constructor(e,t,n,r=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let r=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<e||r.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class aa{constructor(e){this.heap=e}static from(e,t=null,n=-1){let r=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&r.push(new lS(o,t,n,s));return r.length==1?r[0]:new aa(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let n=this.heap.length>>1;n>=0;n--)Cf(this.heap,n);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let n=this.heap.length>>1;n>=0;n--)Cf(this.heap,n);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Cf(this.heap,0)}}}function Cf(i,e){for(let t=i[e];;){let n=(e<<1)+1;if(n>=i.length)break;let r=i[n];if(n+1<i.length&&r.compare(i[n+1])>=0&&(r=i[n+1],n++),t.compare(r)<0)break;i[n]=t,i[e]=r,e=n}}class hl{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=aa.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){uc(this.active,e),uc(this.activeTo,e),uc(this.activeRank,e),this.minActive=P0(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||r-this.activeTo[t])>0;)t++;hc(this.active,t,n),hc(this.activeTo,t,r),hc(this.activeRank,t,s),e&&hc(e,t,this.cursor.from),this.minActive=P0(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&uc(n,r)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let r=n.length-1;r>=0&&n[r]<e;r--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function C0(i,e,t,n,r,s){i.goto(e),t.goto(n);let o=n+r,l=n,a=n-e;for(;;){let c=i.to+a-t.to||i.endSide-t.endSide,u=c<0?i.to+a:t.to,h=Math.min(u,o);if(i.point||t.point?i.point&&t.point&&(i.point==t.point||i.point.eq(t.point))&&Vd(i.activeForPoint(i.to),t.activeForPoint(t.to))||s.comparePoint(l,h,i.point,t.point):h>l&&!Vd(i.active,t.active)&&s.compareRange(l,h,i.active,t.active),u>o)break;l=u,c<=0&&i.next(),c>=0&&t.next()}}function Vd(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++)if(i[t]!=e[t]&&!i[t].eq(e[t]))return!1;return!0}function uc(i,e){for(let t=e,n=i.length-1;t<n;t++)i[t]=i[t+1];i.pop()}function hc(i,e,t){for(let n=i.length-1;n>=e;n--)i[n+1]=i[n];i[e]=t}function P0(i,e){let t=-1,n=1e9;for(let r=0;r<e.length;r++)(e[r]-n||i[r].endSide-i[t].endSide)<0&&(t=r,n=e[r]);return t}function Ci(i,e,t=i.length){let n=0;for(let r=0;r<t;)i.charCodeAt(r)==9?(n+=e-n%e,r++):(n++,r=hn(i,r));return n}function Ud(i,e,t,n){for(let r=0,s=0;;){if(s>=e)return r;if(r==i.length)break;s+=i.charCodeAt(r)==9?t-s%t:1,r=hn(i,r)}return n===!0?-1:i.length}const jd="ͼ",A0=typeof Symbol>"u"?"__"+jd:Symbol.for(jd),qd=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),x0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class jr{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,l,a,c){let u=[],h=/^@(\w+)\b/.exec(o[0]),f=h&&h[1]=="keyframes";if(h&&l==null)return a.push(o[0]+";");for(let d in l){let m=l[d];if(/&/.test(d))s(d.split(/,\s*/).map(p=>o.map(g=>p.replace(/&/,g))).reduce((p,g)=>p.concat(g)),m,a);else if(m&&typeof m=="object"){if(!h)throw new RangeError("The value of a property ("+d+") should be a primitive value.");s(r(d),m,u,f)}else m!=null&&u.push(d.replace(/_.*/,"").replace(/[A-Z]/g,p=>"-"+p.toLowerCase())+": "+m+";")}(u.length||f)&&a.push((n&&!h&&!c?o.map(n):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in e)s(r(o),e[o],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let e=x0[A0]||1;return x0[A0]=e+1,jd+e.toString(36)}static mount(e,t,n){let r=e[qd],s=n&&n.nonce;r?s&&r.setNonce(s):r=new QD(e,s),r.mount(Array.isArray(t)?t:[t],e)}}let T0=new Map;class QD{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let s=T0.get(n);if(s)return e[qd]=s;this.sheet=new r.CSSStyleSheet,T0.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[qd]=this}mount(e,t){let n=this.sheet,r=0,s=0;for(let o=0;o<e.length;o++){let l=e[o],a=this.modules.indexOf(l);if(a<s&&a>-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,l),n)for(let c=0;c<l.rules.length;c++)n.insertRule(l.rules[c],r++)}else{for(;s<a;)r+=this.modules[s++].rules.length;r+=l.rules.length,s++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let a=0;a<this.modules.length;a++)o+=this.modules[a].getRules()+`
`;this.styleTag.textContent=o;let l=t.head||t;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var qr={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:"'"},ca={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},MD=typeof navigator<"u"&&/Mac/.test(navigator.platform),ED=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var an=0;an<10;an++)qr[48+an]=qr[96+an]=String(an);for(var an=1;an<=24;an++)qr[an+111]="F"+an;for(var an=65;an<=90;an++)qr[an]=String.fromCharCode(an+32),ca[an]=String.fromCharCode(an);for(var Pf in qr)ca.hasOwnProperty(Pf)||(ca[Pf]=qr[Pf]);function RD(i){var e=MD&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||ED&&i.shiftKey&&i.key&&i.key.length==1||i.key=="Unidentified",t=!e&&i.key||(i.shiftKey?ca:qr)[i.keyCode]||i.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function ua(i){let e;return i.nodeType==11?e=i.getSelection?i:i.ownerDocument:e=i,e.getSelection()}function Gd(i,e){return e?i==e||i.contains(e.nodeType!=1?e.parentNode:e):!1}function DD(i){let e=i.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function jc(i,e){if(!e.anchorNode)return!1;try{return Gd(i,e.anchorNode)}catch{return!1}}function ha(i){return i.nodeType==3?Rs(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function Vl(i,e,t,n){return t?Q0(i,e,t,n,-1)||Q0(i,e,t,n,1):!1}function Es(i){for(var e=0;;e++)if(i=i.previousSibling,!i)return e}function Pu(i){return i.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(i.nodeName)}function Q0(i,e,t,n,r){for(;;){if(i==t&&e==n)return!0;if(e==(r<0?0:dr(i))){if(i.nodeName=="DIV")return!1;let s=i.parentNode;if(!s||s.nodeType!=1)return!1;e=Es(i)+(r<0?0:1),i=s}else if(i.nodeType==1){if(i=i.childNodes[e+(r<0?-1:0)],i.nodeType==1&&i.contentEditable=="false")return!1;e=r<0?dr(i):0}else return!1}}function dr(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function hh(i,e){let t=e?i.left:i.right;return{left:t,right:t,top:i.top,bottom:i.bottom}}function $D(i){let e=i.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function aS(i,e){let t=e.width/i.offsetWidth,n=e.height/i.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-i.offsetWidth)<1)&&(t=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-i.offsetHeight)<1)&&(n=1),{scaleX:t,scaleY:n}}function LD(i,e,t,n,r,s,o,l){let a=i.ownerDocument,c=a.defaultView||window;for(let u=i,h=!1;u&&!h;)if(u.nodeType==1){let f,d=u==a.body,m=1,p=1;if(d)f=$D(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(h=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let w=u.getBoundingClientRect();({scaleX:m,scaleY:p}=aS(u,w)),f={left:w.left,right:w.left+u.clientWidth*m,top:w.top,bottom:w.top+u.clientHeight*p}}let g=0,v=0;if(r=="nearest")e.top<f.top?(v=-(f.top-e.top+o),t>0&&e.bottom>f.bottom+v&&(v=e.bottom-f.bottom+v+o)):e.bottom>f.bottom&&(v=e.bottom-f.bottom+o,t<0&&e.top-v<f.top&&(v=-(f.top+v-e.top+o)));else{let w=e.bottom-e.top,S=f.bottom-f.top;v=(r=="center"&&w<=S?e.top+w/2-S/2:r=="start"||r=="center"&&t<0?e.top-o:e.bottom-S+o)-f.top}if(n=="nearest"?e.left<f.left?(g=-(f.left-e.left+s),t>0&&e.right>f.right+g&&(g=e.right-f.right+g+s)):e.right>f.right&&(g=e.right-f.right+s,t<0&&e.left<f.left+g&&(g=-(f.left+g-e.left+s))):g=(n=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:n=="start"==l?e.left-s:e.right-(f.right-f.left)+s)-f.left,g||v)if(d)c.scrollBy(g,v);else{let w=0,S=0;if(v){let _=u.scrollTop;u.scrollTop+=v/p,S=(u.scrollTop-_)*p}if(g){let _=u.scrollLeft;u.scrollLeft+=g/m,w=(u.scrollLeft-_)*m}e={left:e.left-w,top:e.top-S,right:e.right-w,bottom:e.bottom-S},w&&Math.abs(w-g)<1&&(n="nearest"),S&&Math.abs(S-v)<1&&(r="nearest")}if(d)break;u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function ID(i){let e=i.ownerDocument,t,n;for(let r=i.parentNode;r&&!(r==e.body||t&&n);)if(r.nodeType==1)!n&&r.scrollHeight>r.clientHeight&&(n=r),!t&&r.scrollWidth>r.clientWidth&&(t=r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;return{x:t,y:n}}class ND{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?dr(t):0),n,Math.min(e.focusOffset,n?dr(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}}let Gs=null;function cS(i){if(i.setActive)return i.setActive();if(Gs)return i.focus(Gs);let e=[];for(let t=i;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(i.focus(Gs==null?{get preventScroll(){return Gs={preventScroll:!0},!0}}:void 0),!Gs){Gs=!1;for(let t=0;t<e.length;){let n=e[t++],r=e[t++],s=e[t++];n.scrollTop!=r&&(n.scrollTop=r),n.scrollLeft!=s&&(n.scrollLeft=s)}}}let M0;function Rs(i,e,t=e){let n=M0||(M0=document.createRange());return n.setEnd(i,t),n.setStart(i,e),n}function bo(i,e,t,n){let r={key:e,code:e,keyCode:t,which:t,cancelable:!0};n&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=n);let s=new KeyboardEvent("keydown",r);s.synthetic=!0,i.dispatchEvent(s);let o=new KeyboardEvent("keyup",r);return o.synthetic=!0,i.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function ZD(i){for(;i;){if(i&&(i.nodeType==9||i.nodeType==11&&i.host))return i;i=i.assignedSlot||i.parentNode}return null}function uS(i){for(;i.attributes.length;)i.removeAttributeNode(i.attributes[0])}function BD(i,e){let t=e.focusNode,n=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=n)return!1;for(n=Math.min(n,dr(t));;)if(n){if(t.nodeType!=1)return!1;let r=t.childNodes[n-1];r.contentEditable=="false"?n--:(t=r,n=dr(t))}else{if(t==i)return!0;n=Es(t),t=t.parentNode}}function hS(i){return i.scrollTop>Math.max(1,i.scrollHeight-i.clientHeight-4)}function fS(i,e){for(let t=i,n=e;;){if(t.nodeType==3&&n>0)return{node:t,offset:n};if(t.nodeType==1&&n>0){if(t.contentEditable=="false")return null;t=t.childNodes[n-1],n=dr(t)}else if(t.parentNode&&!Pu(t))n=Es(t),t=t.parentNode;else return null}}function dS(i,e){for(let t=i,n=e;;){if(t.nodeType==3&&n<t.nodeValue.length)return{node:t,offset:n};if(t.nodeType==1&&n<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[n],n=0}else if(t.parentNode&&!Pu(t))n=Es(t)+1,t=t.parentNode;else return null}}class pn{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new pn(e.parentNode,Es(e),t)}static after(e,t){return new pn(e.parentNode,Es(e)+1,t)}}const cp=[];class St{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let n of this.children){if(n==e)return t;t+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let n=this.dom,r=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=r?r.nextSibling:n.firstChild)){let l=St.get(s);(!l||!l.parent&&l.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(e,t),o.flags&=-8}if(s=r?r.nextSibling:n.firstChild,t&&!t.written&&t.node==n&&s!=o.dom&&(t.written=!0),o.dom.parentNode==n)for(;s&&s!=o.dom;)s=E0(s);else n.insertBefore(o.dom,s);r=o.dom}for(s=r?r.nextSibling:n.firstChild,s&&t&&t.node==n&&(t.written=!0);s;)s=E0(s)}else if(this.flags&1)for(let n of this.children)n.flags&7&&(n.sync(e,t),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let n;if(e==this.dom)n=this.dom.childNodes[t];else{let r=dr(e)==0?0:t==0?-1:1;for(;;){let s=e.parentNode;if(s==this.dom)break;r==0&&s.firstChild!=s.lastChild&&(e==s.firstChild?r=-1:r=1),e=s}r<0?n=e:n=e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!St.get(n);)n=n.nextSibling;if(!n)return this.length;for(let r=0,s=0;;r++){let o=this.children[r];if(o.dom==n)return s;s+=o.length+o.breakAfter}}domBoundsAround(e,t,n=0){let r=-1,s=-1,o=-1,l=-1;for(let a=0,c=n,u=n;a<this.children.length;a++){let h=this.children[a],f=c+h.length;if(c<e&&f>t)return h.domBoundsAround(e,t,c);if(f>=e&&r==-1&&(r=a,s=c),c>t&&h.dom.parentNode==this.dom){o=a,l=u;break}u=f,c=f+h.breakAfter}return{from:s,to:l<0?n+this.length:l,startDOM:(r?this.children[r-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,n=cp){this.markDirty();for(let r=e;r<t;r++){let s=this.children[r];s.parent==this&&n.indexOf(s)<0&&s.destroy()}this.children.splice(e,t-e,...n);for(let r=0;r<n.length;r++)n[r].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new mS(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,n,r,s,o){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}St.prototype.breakAfter=0;function E0(i){let e=i.nextSibling;return i.parentNode.removeChild(i),e}class mS{constructor(e,t,n){this.children=e,this.pos=t,this.i=n,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function pS(i,e,t,n,r,s,o,l,a){let{children:c}=i,u=c.length?c[e]:null,h=s.length?s[s.length-1]:null,f=h?h.breakAfter:o;if(!(e==n&&u&&!o&&!f&&s.length<2&&u.merge(t,r,s.length?h:null,t==0,l,a))){if(n<c.length){let d=c[n];d&&(r<d.length||d.breakAfter&&(h!=null&&h.breakAfter))?(e==n&&(d=d.split(r),r=0),!f&&h&&d.merge(0,r,h,!0,0,a)?s[s.length-1]=d:((r||d.children.length&&!d.children[0].length)&&d.merge(0,r,null,!1,0,a),s.push(d))):d!=null&&d.breakAfter&&(h?h.breakAfter=1:o=1),n++}for(u&&(u.breakAfter=o,t>0&&(!o&&s.length&&u.merge(t,u.length,s[0],!1,l,0)?u.breakAfter=s.shift().breakAfter:(t<u.length||u.children.length&&u.children[u.children.length-1].length==0)&&u.merge(t,u.length,null,!1,l,0),e++));e<n&&s.length;)if(c[n-1].become(s[s.length-1]))n--,s.pop(),a=s.length?0:l;else if(c[e].become(s[0]))e++,s.shift(),l=s.length?0:a;else break;!s.length&&e&&n<c.length&&!c[e-1].breakAfter&&c[n].merge(0,0,c[e-1],!1,l,a)&&e--,(e<n||s.length)&&i.replaceChildren(e,n,s)}}function gS(i,e,t,n,r,s){let o=i.childCursor(),{i:l,off:a}=o.findPos(t,1),{i:c,off:u}=o.findPos(e,-1),h=e-t;for(let f of n)h+=f.length;i.length+=h,pS(i,c,u,l,a,n,0,r,s)}let En=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Hd=typeof document<"u"?document:{documentElement:{style:{}}};const Kd=/Edge\/(\d+)/.exec(En.userAgent),OS=/MSIE \d/.test(En.userAgent),Jd=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(En.userAgent),fh=!!(OS||Jd||Kd),R0=!fh&&/gecko\/(\d+)/i.test(En.userAgent),Af=!fh&&/Chrome\/(\d+)/.exec(En.userAgent),WD="webkitFontSmoothing"in Hd.documentElement.style,bS=!fh&&/Apple Computer/.test(En.vendor),D0=bS&&(/Mobile\/\w+/.test(En.userAgent)||En.maxTouchPoints>2);var ke={mac:D0||/Mac/.test(En.platform),windows:/Win/.test(En.platform),linux:/Linux|X11/.test(En.platform),ie:fh,ie_version:OS?Hd.documentMode||6:Jd?+Jd[1]:Kd?+Kd[1]:0,gecko:R0,gecko_version:R0?+(/Firefox\/(\d+)/.exec(En.userAgent)||[0,0])[1]:0,chrome:!!Af,chrome_version:Af?+Af[1]:0,ios:D0,android:/Android\b/.test(En.userAgent),safari:bS,webkit_version:WD?+(/\bAppleWebKit\/(\d+)/.exec(En.userAgent)||[0,0])[1]:0,tabSize:Hd.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const XD=256;class Pi extends St{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,n){return this.flags&8||n&&(!(n instanceof Pi)||this.length-(t-e)+n.length>XD||n.flags&8)?!1:(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new Pi(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new pn(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return FD(this.dom,e,t)}}class mr extends St{constructor(e,t=[],n=0){super(),this.mark=e,this.children=t,this.length=n;for(let r of t)r.setParent(this)}setAttrs(e){if(uS(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,n,r,s,o){return n&&(!(n instanceof mr&&n.mark.eq(this.mark))||e&&s<=0||t<this.length&&o<=0)?!1:(gS(this,e,t,n?n.children.slice():[],s-1,o-1),this.markDirty(),!0)}split(e){let t=[],n=0,r=-1,s=0;for(let l of this.children){let a=n+l.length;a>e&&t.push(n<e?l.split(e-n):l),r<0&&n>=e&&(r=s),n=a,s++}let o=this.length-e;return this.length=e,r>-1&&(this.children.length=r,this.markDirty()),new mr(this.mark,t,o)}domAtPos(e){return vS(this,e)}coordsAt(e,t){return yS(this,e,t)}}function FD(i,e,t){let n=i.nodeValue.length;e>n&&(e=n);let r=e,s=e,o=0;e==0&&t<0||e==n&&t>=0?ke.chrome||ke.gecko||(e?(r--,o=1):s<n&&(s++,o=-1)):t<0?r--:s<n&&s++;let l=Rs(i,r,s).getClientRects();if(!l.length)return null;let a=l[(o?o<0:t>=0)?0:l.length-1];return ke.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,c=>c.width)||a),o?hh(a,o<0):a||null}class Nr extends St{static create(e,t,n){return new Nr(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=Nr.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,n,r,s,o){return n&&(!(n instanceof Nr)||!this.widget.compare(n.widget)||e>0&&s<=0||t<this.length&&o<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-t),!0)}become(e){return e instanceof Nr&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return at.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,n=t&&t.state.doc,r=this.posAtStart;return n?n.slice(r,r+this.length):at.empty}domAtPos(e){return(this.length?e==0:this.side>0)?pn.before(this.dom):pn.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;let r=this.dom.getClientRects(),s=null;if(!r.length)return null;let o=this.side?this.side<0:e>0;for(let l=o?r.length-1:0;s=r[l],!(e>0?l==0:l==r.length-1||s.top<s.bottom);l+=o?-1:1);return hh(s,!o)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Qo extends St{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof Qo&&e.side==this.side}split(){return new Qo(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?pn.before(this.dom):pn.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return at.empty}get isHidden(){return!0}}Pi.prototype.children=Nr.prototype.children=Qo.prototype.children=cp;function vS(i,e){let t=i.dom,{children:n}=i,r=0;for(let s=0;r<n.length;r++){let o=n[r],l=s+o.length;if(!(l==s&&o.getSide()<=0)){if(e>s&&e<l&&o.dom.parentNode==t)return o.domAtPos(e-s);if(e<=s)break;s=l}}for(let s=r;s>0;s--){let o=n[s-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let s=r;s<n.length;s++){let o=n[s];if(o.dom.parentNode==t)return o.domAtPos(0)}return new pn(t,0)}function wS(i,e,t){let n,{children:r}=i;t>0&&e instanceof mr&&r.length&&(n=r[r.length-1])instanceof mr&&n.mark.eq(e.mark)?wS(n,e.children[0],t-1):(r.push(e),e.setParent(i)),i.length+=e.length}function yS(i,e,t){let n=null,r=-1,s=null,o=-1;function l(c,u){for(let h=0,f=0;h<c.children.length&&f<=u;h++){let d=c.children[h],m=f+d.length;m>=u&&(d.children.length?l(d,u-f):(!s||s.isHidden&&t>0)&&(m>u||f==m&&d.getSide()>0)?(s=d,o=u-f):(f<u||f==m&&d.getSide()<0&&!d.isHidden)&&(n=d,r=u-f)),f=m}}l(i,e);let a=(t<0?n:s)||n||s;return a?a.coordsAt(Math.max(0,a==n?r:o),t):YD(i)}function YD(i){let e=i.dom.lastChild;if(!e)return i.dom.getBoundingClientRect();let t=ha(e);return t[t.length-1]||null}function em(i,e){for(let t in i)t=="class"&&e.class?e.class+=" "+i.class:t=="style"&&e.style?e.style+=";"+i.style:e[t]=i[t];return e}const $0=Object.create(null);function Au(i,e,t){if(i==e)return!0;i||(i=$0),e||(e=$0);let n=Object.keys(i),r=Object.keys(e);if(n.length-(t&&n.indexOf(t)>-1?1:0)!=r.length-(t&&r.indexOf(t)>-1?1:0))return!1;for(let s of n)if(s!=t&&(r.indexOf(s)==-1||i[s]!==e[s]))return!1;return!0}function tm(i,e,t){let n=!1;if(e)for(let r in e)t&&r in t||(n=!0,r=="style"?i.style.cssText="":i.removeAttribute(r));if(t)for(let r in t)e&&e[r]==t[r]||(n=!0,r=="style"?i.style.cssText=t[r]:i.setAttribute(r,t[r]));return n}function zD(i){let e=Object.create(null);for(let t=0;t<i.attributes.length;t++){let n=i.attributes[t];e[n.name]=n.value}return e}class br{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Cn=function(i){return i[i.Text=0]="Text",i[i.WidgetBefore=1]="WidgetBefore",i[i.WidgetAfter=2]="WidgetAfter",i[i.WidgetRange=3]="WidgetRange",i}(Cn||(Cn={}));class Qe extends Ms{constructor(e,t,n,r){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new La(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Gr(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,r;if(e.isBlockGap)n=-5e8,r=4e8;else{let{start:s,end:o}=kS(e,t);n=(s?t?-3e8:-1:5e8)-1,r=(o?t?2e8:1:-6e8)+1}return new Gr(e,n,r,t,e.widget||null,!0)}static line(e){return new Ia(e)}static set(e,t=!1){return tt.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Qe.none=tt.empty;class La extends Qe{constructor(e){let{start:t,end:n}=kS(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,n;return this==e||e instanceof La&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((n=e.attrs)===null||n===void 0?void 0:n.class))&&Au(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}La.prototype.point=!1;class Ia extends Qe{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Ia&&this.spec.class==e.spec.class&&Au(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Ia.prototype.mapMode=cn.TrackBefore;Ia.prototype.point=!0;class Gr extends Qe{constructor(e,t,n,r,s,o){super(t,n,s,e),this.block=r,this.isReplace=o,this.mapMode=r?t<=0?cn.TrackBefore:cn.TrackAfter:cn.TrackDel}get type(){return this.startSide!=this.endSide?Cn.WidgetRange:this.startSide<=0?Cn.WidgetBefore:Cn.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Gr&&VD(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Gr.prototype.point=!0;function kS(i,e=!1){let{inclusiveStart:t,inclusiveEnd:n}=i;return t==null&&(t=i.inclusive),n==null&&(n=i.inclusive),{start:t??e,end:n??e}}function VD(i,e){return i==e||!!(i&&e&&i.compare(e))}function nm(i,e,t,n=0){let r=t.length-1;r>=0&&t[r]+n>=i?t[r]=Math.max(t[r],e):t.push(i,e)}class qt extends St{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,n,r,s,o){if(n){if(!(n instanceof qt))return!1;this.dom||n.transferDOM(this)}return r&&this.setDeco(n?n.attrs:null),gS(this,e,t,n?n.children.slice():[],s,o),!0}split(e){let t=new qt;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i:n,off:r}=this.childPos(e);r&&(t.append(this.children[n].split(r),0),this.children[n].merge(r,this.children[n].length,null,!1,0,0),n++);for(let s=n;s<this.children.length;s++)t.append(this.children[s],0);for(;n>0&&this.children[n-1].length==0;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Au(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){wS(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=em(t,this.attrs||{})),n&&(this.attrs=em({class:n},this.attrs||{}))}domAtPos(e){return vS(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?this.flags&4&&(uS(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(tm(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let r=this.dom.lastChild;for(;r&&St.get(r)instanceof mr;)r=r.lastChild;if(!r||!this.length||r.nodeName!="BR"&&((n=St.get(r))===null||n===void 0?void 0:n.isEditable)==!1&&(!ke.ios||!this.children.some(s=>s instanceof Pi))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let n of this.children){if(!(n instanceof Pi)||/[^ -~]/.test(n.text))return null;let r=ha(n.dom);if(r.length!=1)return null;e+=r[0].width,t=r[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let n=yS(this,e,t);if(!this.children.length&&n&&this.parent){let{heightOracle:r}=this.parent.view.viewState,s=n.bottom-n.top;if(Math.abs(s-r.lineHeight)<2&&r.textHeight<s){let o=(s-r.textHeight)/2;return{top:n.top+o,bottom:n.bottom-o,left:n.left,right:n.left}}}return n}become(e){return e instanceof qt&&this.children.length==0&&e.children.length==0&&Au(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let n=0,r=0;n<e.children.length;n++){let s=e.children[n],o=r+s.length;if(o>=t){if(s instanceof qt)return s;if(o>t)break}r=o+s.breakAfter}return null}}class ar extends St{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,t,n,r,s,o){return n&&(!(n instanceof ar)||!this.widget.compare(n.widget)||e>0&&s<=0||t<this.length&&o<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?pn.before(this.dom):pn.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let n=new ar(this.widget,t,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return cp}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):at.empty}domBoundsAround(){return null}become(e){return e instanceof ar&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);return n||(this.widget instanceof im?null:hh(this.dom.getBoundingClientRect(),this.length?e==0:t<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:n}=this.deco;return t==n?!1:e<0?t<0:n>0}}class im extends br{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class Ul{constructor(e,t,n,r){this.doc=e,this.pos=t,this.end=n,this.disallowBlockEffectsFor=r,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof ar&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new qt),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(fc(new Qo(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof ar)&&this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=s,this.textOff=0}let r=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(fc(new Pi(this.text.slice(this.textOff,this.textOff+r)),t),n),this.atCursorPos=!0,this.textOff+=r,e-=r,n=0}}span(e,t,n,r){this.buildText(t-e,n,r),this.pos=t,this.openStart<0&&(this.openStart=r)}point(e,t,n,r,s,o){if(this.disallowBlockEffectsFor[o]&&n instanceof Gr){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=t-e;if(n instanceof Gr)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ar(n.widget||Mo.block,l,n));else{let a=Nr.create(n.widget||Mo.inline,l,l?0:n.startSide),c=this.atCursorPos&&!a.isEditable&&s<=r.length&&(e<t||n.startSide>0),u=!a.isEditable&&(e<t||s>r.length||n.startSide<=0),h=this.getLine();this.pendingBuffer==2&&!c&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(r),c&&(h.append(fc(new Qo(1),r),s),s=r.length+Math.max(0,s-r.length)),h.append(fc(a,r),s),this.atCursorPos=u,this.pendingBuffer=u?e<t||s>r.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=r.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=s)}static build(e,t,n,r,s){let o=new Ul(e,t,n,s);return o.openEnd=tt.spans(r,t,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function fc(i,e){for(let t of e)i=new mr(t,[i],i.length);return i}class Mo extends br{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Mo.inline=new Mo("span");Mo.block=new Mo("div");var Rt=function(i){return i[i.LTR=0]="LTR",i[i.RTL=1]="RTL",i}(Rt||(Rt={}));const Ds=Rt.LTR,up=Rt.RTL;function SS(i){let e=[];for(let t=0;t<i.length;t++)e.push(1<<+i[t]);return e}const UD=SS("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),jD=SS("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),rm=Object.create(null),Di=[];for(let i of["()","[]","{}"]){let e=i.charCodeAt(0),t=i.charCodeAt(1);rm[e]=t,rm[t]=-e}function _S(i){return i<=247?UD[i]:1424<=i&&i<=1524?2:1536<=i&&i<=1785?jD[i-1536]:1774<=i&&i<=2220?4:8192<=i&&i<=8204?256:64336<=i&&i<=65023?4:1}const qD=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Zr{get dir(){return this.level%2?up:Ds}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,r){let s=-1;for(let o=0;o<e.length;o++){let l=e[o];if(l.from<=t&&l.to>=t){if(l.level==n)return o;(s<0||(r!=0?r<0?l.from<t:l.to>t:e[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function CS(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++){let n=i[t],r=e[t];if(n.from!=r.from||n.to!=r.to||n.direction!=r.direction||!CS(n.inner,r.inner))return!1}return!0}const kt=[];function GD(i,e,t,n,r){for(let s=0;s<=n.length;s++){let o=s?n[s-1].to:e,l=s<n.length?n[s].from:t,a=s?256:r;for(let c=o,u=a,h=a;c<l;c++){let f=_S(i.charCodeAt(c));f==512?f=u:f==8&&h==4&&(f=16),kt[c]=f==4?2:f,f&7&&(h=f),u=f}for(let c=o,u=a,h=a;c<l;c++){let f=kt[c];if(f==128)c<l-1&&u==kt[c+1]&&u&24?f=kt[c]=u:kt[c]=256;else if(f==64){let d=c+1;for(;d<l&&kt[d]==64;)d++;let m=c&&u==8||d<t&&kt[d]==8?h==1?1:8:256;for(let p=c;p<d;p++)kt[p]=m;c=d-1}else f==8&&h==1&&(kt[c]=1);u=f,f&7&&(h=f)}}}function HD(i,e,t,n,r){let s=r==1?2:1;for(let o=0,l=0,a=0;o<=n.length;o++){let c=o?n[o-1].to:e,u=o<n.length?n[o].from:t;for(let h=c,f,d,m;h<u;h++)if(d=rm[f=i.charCodeAt(h)])if(d<0){for(let p=l-3;p>=0;p-=3)if(Di[p+1]==-d){let g=Di[p+2],v=g&2?r:g&4?g&1?s:r:0;v&&(kt[h]=kt[Di[p]]=v),l=p;break}}else{if(Di.length==189)break;Di[l++]=h,Di[l++]=f,Di[l++]=a}else if((m=kt[h])==2||m==1){let p=m==r;a=p?0:1;for(let g=l-3;g>=0;g-=3){let v=Di[g+2];if(v&2)break;if(p)Di[g+2]|=2;else{if(v&4)break;Di[g+2]|=4}}}}}function KD(i,e,t,n){for(let r=0,s=n;r<=t.length;r++){let o=r?t[r-1].to:i,l=r<t.length?t[r].from:e;for(let a=o;a<l;){let c=kt[a];if(c==256){let u=a+1;for(;;)if(u==l){if(r==t.length)break;u=t[r++].to,l=r<t.length?t[r].from:e}else if(kt[u]==256)u++;else break;let h=s==1,f=(u<e?kt[u]:n)==1,d=h==f?h?1:2:n;for(let m=u,p=r,g=p?t[p-1].to:i;m>a;)m==g&&(m=t[--p].from,g=p?t[p-1].to:i),kt[--m]=d;a=u}else s=c,a++}}}function sm(i,e,t,n,r,s,o){let l=n%2?2:1;if(n%2==r%2)for(let a=e,c=0;a<t;){let u=!0,h=!1;if(c==s.length||a<s[c].from){let p=kt[a];p!=l&&(u=!1,h=p==16)}let f=!u&&l==1?[]:null,d=u?n:n+1,m=a;e:for(;;)if(c<s.length&&m==s[c].from){if(h)break e;let p=s[c];if(!u)for(let g=p.to,v=c+1;;){if(g==t)break e;if(v<s.length&&s[v].from==g)g=s[v++].to;else{if(kt[g]==l)break e;break}}if(c++,f)f.push(p);else{p.from>a&&o.push(new Zr(a,p.from,d));let g=p.direction==Ds!=!(d%2);om(i,g?n+1:n,r,p.inner,p.from,p.to,o),a=p.to}m=p.to}else{if(m==t||(u?kt[m]!=l:kt[m]==l))break;m++}f?sm(i,a,m,n+1,r,f,o):a<m&&o.push(new Zr(a,m,d)),a=m}else for(let a=t,c=s.length;a>e;){let u=!0,h=!1;if(!c||a>s[c-1].to){let p=kt[a-1];p!=l&&(u=!1,h=p==16)}let f=!u&&l==1?[]:null,d=u?n:n+1,m=a;e:for(;;)if(c&&m==s[c-1].to){if(h)break e;let p=s[--c];if(!u)for(let g=p.from,v=c;;){if(g==e)break e;if(v&&s[v-1].to==g)g=s[--v].from;else{if(kt[g-1]==l)break e;break}}if(f)f.push(p);else{p.to<a&&o.push(new Zr(p.to,a,d));let g=p.direction==Ds!=!(d%2);om(i,g?n+1:n,r,p.inner,p.from,p.to,o),a=p.from}m=p.from}else{if(m==e||(u?kt[m-1]!=l:kt[m-1]==l))break;m--}f?sm(i,m,a,n+1,r,f,o):m<a&&o.push(new Zr(m,a,d)),a=m}}function om(i,e,t,n,r,s,o){let l=e%2?2:1;GD(i,r,s,n,l),HD(i,r,s,n,l),KD(r,s,n,l),sm(i,r,s,e,t,n,o)}function JD(i,e,t){if(!i)return[new Zr(0,0,e==up?1:0)];if(e==Ds&&!t.length&&!qD.test(i))return PS(i.length);if(t.length)for(;i.length>kt.length;)kt[kt.length]=256;let n=[],r=e==Ds?0:1;return om(i,r,r,t,0,i.length,n),n}function PS(i){return[new Zr(0,i,0)]}let AS="";function e5(i,e,t,n,r){var s;let o=n.head-i.from,l=Zr.find(e,o,(s=n.bidiLevel)!==null&&s!==void 0?s:-1,n.assoc),a=e[l],c=a.side(r,t);if(o==c){let f=l+=r?1:-1;if(f<0||f>=e.length)return null;a=e[l=f],o=a.side(!r,t),c=a.side(r,t)}let u=hn(i.text,o,a.forward(r,t));(u<a.from||u>a.to)&&(u=c),AS=i.text.slice(Math.min(o,u),Math.max(o,u));let h=l==(r?e.length-1:0)?null:e[l+(r?1:-1)];return h&&u==c&&h.level+(r?0:1)<a.level?q.cursor(h.side(!r,t)+i.from,h.forward(r,t)?1:-1,h.level):q.cursor(u+i.from,a.forward(r,t)?-1:1,a.level)}function t5(i,e,t){for(let n=e;n<t;n++){let r=_S(i.charCodeAt(n));if(r==1)return Ds;if(r==2||r==4)return up}return Ds}const xS=ye.define(),TS=ye.define(),QS=ye.define(),MS=ye.define(),lm=ye.define(),ES=ye.define(),RS=ye.define(),DS=ye.define({combine:i=>i.some(e=>e)}),$S=ye.define({combine:i=>i.some(e=>e)}),LS=ye.define();class vo{constructor(e,t="nearest",n="nearest",r=5,s=5,o=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new vo(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new vo(q.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const dc=Fe.define({map:(i,e)=>i.map(e)}),IS=Fe.define();function _n(i,e,t){let n=i.facet(MS);n.length?n[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}const Dr=ye.define({combine:i=>i.length?i[0]:!0});let n5=0;const Sl=ye.define();class Vt{constructor(e,t,n,r,s){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=r,this.extension=s(this)}static define(e,t){const{eventHandlers:n,eventObservers:r,provide:s,decorations:o}=t||{};return new Vt(n5++,e,n,r,l=>{let a=[Sl.of(l)];return o&&a.push(fa.of(c=>{let u=c.plugin(l);return u?o(u):Qe.none})),s&&a.push(s(l)),a})}static fromClass(e,t){return Vt.define(n=>new e(n),t)}}class xf{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(n){if(_n(t.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){_n(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(n){_n(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const NS=ye.define(),hp=ye.define(),fa=ye.define(),ZS=ye.define(),fp=ye.define(),BS=ye.define();function L0(i,e){let t=i.state.facet(BS);if(!t.length)return t;let n=t.map(s=>s instanceof Function?s(i):s),r=[];return tt.spans(n,e.from,e.to,{point(){},span(s,o,l,a){let c=s-e.from,u=o-e.from,h=r;for(let f=l.length-1;f>=0;f--,a--){let d=l[f].spec.bidiIsolate,m;if(d==null&&(d=t5(e.text,c,u)),a>0&&h.length&&(m=h[h.length-1]).to==c&&m.direction==d)m.to=u,h=m.inner;else{let p={from:c,to:u,direction:d,inner:[]};h.push(p),h=p.inner}}}}),r}const WS=ye.define();function XS(i){let e=0,t=0,n=0,r=0;for(let s of i.state.facet(WS)){let o=s(i);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(n=Math.max(n,o.top)),o.bottom!=null&&(r=Math.max(r,o.bottom)))}return{left:e,right:t,top:n,bottom:r}}const _l=ye.define();class ui{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(e){return new ui(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(t.length==0)return e;let n=[];for(let r=0,s=0,o=0,l=0;;r++){let a=r==e.length?null:e[r],c=o-l,u=a?a.fromB:1e9;for(;s<t.length&&t[s]<u;){let h=t[s],f=t[s+1],d=Math.max(l,h),m=Math.min(u,f);if(d<=m&&new ui(d+c,m+c,d,m).addToSet(n),f>u)break;s+=2}if(!a)return n;new ui(a.fromA,a.toA,a.fromB,a.toB).addToSet(n),o=a.toA,l=a.toB}}}class xu{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=en.empty(this.startState.doc.length);for(let s of n)this.changes=this.changes.compose(s.changes);let r=[];this.changes.iterChangedRanges((s,o,l,a)=>r.push(new ui(s,o,l,a))),this.changedRanges=r}static create(e,t,n){return new xu(e,t,n)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class I0 extends St{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=Qe.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new qt],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new ui(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:c,toA:u})=>u<this.minWidthFrom||c>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?r=this.domChanged.newSel.head:!c5(e.changes,this.hasComposition)&&!e.selectionSet&&(r=e.state.selection.main.head));let s=r>-1?r5(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:c,to:u}=this.hasComposition;n=new ui(c,u,e.changes.mapPos(c,-1),e.changes.mapPos(u,1)).addToSet(n.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(ke.ie||ke.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.updateDeco(),a=l5(o,l,e.changes);return n=ui.extendWithRanges(n,a),!(this.flags&7)&&n.length==0?!1:(this.updateInner(n,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,n);let{observer:r}=this.view;r.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=ke.chrome||ke.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||r.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let o of this.children)o instanceof ar&&o.widget instanceof im&&s.push(o.dom);r.updateGaps(s)}updateChildren(e,t,n){let r=n?n.range.addToSet(e.slice()):e,s=this.childCursor(t);for(let o=r.length-1;;o--){let l=o>=0?r[o]:null;if(!l)break;let{fromA:a,toA:c,fromB:u,toB:h}=l,f,d,m,p;if(n&&n.range.fromB<h&&n.range.toB>u){let _=Ul.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),k=Ul.build(this.view.state.doc,n.range.toB,h,this.decorations,this.dynamicDecorationMap);d=_.breakAtStart,m=_.openStart,p=k.openEnd;let A=this.compositionView(n);k.breakAtStart?A.breakAfter=1:k.content.length&&A.merge(A.length,A.length,k.content[0],!1,k.openStart,0)&&(A.breakAfter=k.content[0].breakAfter,k.content.shift()),_.content.length&&A.merge(0,0,_.content[_.content.length-1],!0,0,_.openEnd)&&_.content.pop(),f=_.content.concat(A).concat(k.content)}else({content:f,breakAtStart:d,openStart:m,openEnd:p}=Ul.build(this.view.state.doc,u,h,this.decorations,this.dynamicDecorationMap));let{i:g,off:v}=s.findPos(c,1),{i:w,off:S}=s.findPos(a,-1);pS(this,w,S,g,v,f,d,m,p)}n&&this.fixCompositionDOM(n)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let n of t.effects)n.is(IS)&&(this.editContextFormatting=n.value)}compositionView(e){let t=new Pi(e.text.nodeValue);t.flags|=8;for(let{deco:r}of e.marks)t=new mr(r,[t],t.length);let n=new qt;return n.append(t,0),n}fixCompositionDOM(e){let t=(s,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0),this.markedForComposition.add(o);let l=St.get(s);l&&l!=o&&(l.dom=null),o.setDOM(s)},n=this.childPos(e.range.fromB,1),r=this.children[n.i];t(e.line,r);for(let s=e.marks.length-1;s>=-1;s--)n=r.childPos(n.off,1),r=r.children[n.i],t(s>=0?e.marks[s].node:e.text,r)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let n=this.view.root.activeElement,r=n==this.dom,s=!r&&jc(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(r||t||s))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),c=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(ke.gecko&&l.empty&&!this.hasComposition&&i5(a)){let h=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(h,a.node.childNodes[a.offset]||null)),a=c=new pn(h,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||(!Vl(a.node,a.offset,u.anchorNode,u.anchorOffset)||!Vl(c.node,c.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,l))&&(this.view.observer.ignore(()=>{ke.android&&ke.chrome&&this.dom.contains(u.focusNode)&&a5(u.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let h=ua(this.view.root);if(h)if(l.empty){if(ke.gecko){let f=s5(a.node,a.offset);if(f&&f!=3){let d=(f==1?fS:dS)(a.node,a.offset);d&&(a=new pn(d.node,d.offset))}}h.collapse(a.node,a.offset),l.bidiLevel!=null&&h.caretBidiLevel!==void 0&&(h.caretBidiLevel=l.bidiLevel)}else if(h.extend){h.collapse(a.node,a.offset);try{h.extend(c.node,c.offset)}catch{}}else{let f=document.createRange();l.anchor>l.head&&([a,c]=[c,a]),f.setEnd(c.node,c.offset),f.setStart(a.node,a.offset),h.removeAllRanges(),h.addRange(f)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(a,c)),this.impreciseAnchor=a.precise?null:new pn(u.anchorNode,u.anchorOffset),this.impreciseHead=c.precise?null:new pn(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Vl(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=ua(e.root),{anchorNode:r,anchorOffset:s}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let o=qt.find(this,t.head);if(!o)return;let l=o.posAtStart;if(t.head==l||t.head==l+o.length)return;let a=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!a||!c||a.bottom>c.top)return;let u=this.domAtPos(t.head+t.assoc);n.collapse(u.node,u.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&n.collapse(r,s)}moveToLine(e){let t=this.dom,n;if(e.node!=t)return e;for(let r=e.offset;!n&&r<t.childNodes.length;r++){let s=St.get(t.childNodes[r]);s instanceof qt&&(n=s.domAtPos(0))}for(let r=e.offset-1;!n&&r>=0;r--){let s=St.get(t.childNodes[r]);s instanceof qt&&(n=s.domAtPos(s.length))}return n?new pn(n.node,n.offset,!0):e}nearest(e){for(let t=e;t;){let n=St.get(t);if(n&&n.rootView==this)return n;t=t.parentNode}return null}posFromDOM(e,t){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,t)+n.posAtStart}domAtPos(e){let{i:t,off:n}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let r=this.children[t];if(n<r.length||r instanceof qt)break;t++,n=0}return this.children[t].domAtPos(n)}coordsAt(e,t){let n=null,r=0;for(let s=this.length,o=this.children.length-1;o>=0;o--){let l=this.children[o],a=s-l.breakAfter,c=a-l.length;if(a<e)break;if(c<=e&&(c<e||l.covers(-1))&&(a>e||l.covers(1))&&(!n||l instanceof qt&&!(n instanceof qt&&t>=0)))n=l,r=c;else if(n&&c==e&&a==e&&l instanceof ar&&Math.abs(t)<2){if(l.deco.startSide<0)break;o&&(n=null)}s=c}return n?n.coordsAt(e-r,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),r=this.children[t];if(!(r instanceof qt))return null;for(;r.children.length;){let{i:l,off:a}=r.childPos(n,1);for(;;l++){if(l==r.children.length)return null;if((r=r.children[l]).length)break}n=a}if(!(r instanceof Pi))return null;let s=hn(r.text,n);if(s==n)return null;let o=Rs(r.dom,n,s).getClientRects();for(let l=0;l<o.length;l++){let a=o[l];if(l==o.length-1||a.top<a.bottom&&a.left<a.right)return a}return null}measureVisibleLineHeights(e){let t=[],{from:n,to:r}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==Rt.LTR;for(let c=0,u=0;u<this.children.length;u++){let h=this.children[u],f=c+h.length;if(f>r)break;if(c>=n){let d=h.dom.getBoundingClientRect();if(t.push(d.height),o){let m=h.dom.lastChild,p=m?ha(m):[];if(p.length){let g=p[p.length-1],v=a?g.right-d.left:d.right-g.left;v>l&&(l=v,this.minWidth=s,this.minWidthFrom=c,this.minWidthTo=f)}}}c=f+h.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?Rt.RTL:Rt.LTR}measureTextSize(){for(let s of this.children)if(s instanceof qt){let o=s.measureTextSize();if(o)return o}let e=document.createElement("div"),t,n,r;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let s=ha(e.firstChild)[0];t=e.getBoundingClientRect().height,n=s?s.width/27:7,r=s?s.height:t,e.remove()}),{lineHeight:t,charWidth:n,textHeight:r}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new mS(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let s=r==t.viewports.length?null:t.viewports[r],o=s?s.from-1:this.length;if(o>n){let l=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(Qe.replace({widget:new im(l),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!s)break;n=s.to+1}return Qe.set(e)}updateDeco(){let e=1,t=this.view.state.facet(fa).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),n=!1,r=this.view.state.facet(ZS).map((s,o)=>{let l=typeof s=="function";return l&&(n=!0),l?s(this.view):s});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(tt.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let c of this.view.state.facet(LS))try{if(c(this.view,e.range,e))return!0}catch(u){_n(this.view.state,u,"scroll handler")}let{range:t}=e,n=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),r;if(!n)return;!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let s=XS(this.view),o={left:n.left-s.left,top:n.top-s.top,right:n.right+s.right,bottom:n.bottom+s.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;LD(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,l),-l),Math.max(Math.min(e.yMargin,a),-a),this.view.textDirection==Rt.LTR)}}function i5(i){return i.node.nodeType==1&&i.node.firstChild&&(i.offset==0||i.node.childNodes[i.offset-1].contentEditable=="false")&&(i.offset==i.node.childNodes.length||i.node.childNodes[i.offset].contentEditable=="false")}function FS(i,e){let t=i.observer.selectionRange;if(!t.focusNode)return null;let n=fS(t.focusNode,t.focusOffset),r=dS(t.focusNode,t.focusOffset),s=n||r;if(r&&n&&r.node!=n.node){let l=St.get(r.node);if(!l||l instanceof Pi&&l.text!=r.node.nodeValue)s=r;else if(i.docView.lastCompositionAfterCursor){let a=St.get(n.node);!a||a instanceof Pi&&a.text!=n.node.nodeValue||(s=r)}}if(i.docView.lastCompositionAfterCursor=s!=n,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function r5(i,e,t){let n=FS(i,t);if(!n)return null;let{node:r,from:s,to:o}=n,l=r.nodeValue;if(/[\n\r]/.test(l)||i.state.doc.sliceString(n.from,n.to)!=l)return null;let a=e.invertedDesc,c=new ui(a.mapPos(s),a.mapPos(o),s,o),u=[];for(let h=r.parentNode;;h=h.parentNode){let f=St.get(h);if(f instanceof mr)u.push({node:h,deco:f.mark});else{if(f instanceof qt||h.nodeName=="DIV"&&h.parentNode==i.contentDOM)return{range:c,text:r,marks:u,line:h};if(h!=i.contentDOM)u.push({node:h,deco:new La({inclusive:!0,attributes:zD(h),tagName:h.tagName.toLowerCase()})});else return null}}}function s5(i,e){return i.nodeType!=1?0:(e&&i.childNodes[e-1].contentEditable=="false"?1:0)|(e<i.childNodes.length&&i.childNodes[e].contentEditable=="false"?2:0)}let o5=class{constructor(){this.changes=[]}compareRange(e,t){nm(e,t,this.changes)}comparePoint(e,t){nm(e,t,this.changes)}};function l5(i,e,t){let n=new o5;return tt.compare(i,e,t,n),n.changes}function a5(i,e){for(let t=i;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function c5(i,e){let t=!1;return e&&i.iterChangedRanges((n,r)=>{n<e.to&&r>e.from&&(t=!0)}),t}function u5(i,e,t=1){let n=i.charCategorizer(e),r=i.doc.lineAt(e),s=e-r.from;if(r.length==0)return q.cursor(e);s==0?t=1:s==r.length&&(t=-1);let o=s,l=s;t<0?o=hn(r.text,s,!1):l=hn(r.text,s);let a=n(r.text.slice(o,l));for(;o>0;){let c=hn(r.text,o,!1);if(n(r.text.slice(c,o))!=a)break;o=c}for(;l<r.length;){let c=hn(r.text,l);if(n(r.text.slice(l,c))!=a)break;l=c}return q.range(o+r.from,l+r.from)}function h5(i,e){return e.left>i?e.left-i:Math.max(0,i-e.right)}function f5(i,e){return e.top>i?e.top-i:Math.max(0,i-e.bottom)}function Tf(i,e){return i.top<e.bottom-1&&i.bottom>e.top+1}function N0(i,e){return e<i.top?{top:e,left:i.left,right:i.right,bottom:i.bottom}:i}function Z0(i,e){return e>i.bottom?{top:i.top,left:i.left,right:i.right,bottom:e}:i}function am(i,e,t){let n,r,s,o,l=!1,a,c,u,h;for(let m=i.firstChild;m;m=m.nextSibling){let p=ha(m);for(let g=0;g<p.length;g++){let v=p[g];r&&Tf(r,v)&&(v=N0(Z0(v,r.bottom),r.top));let w=h5(e,v),S=f5(t,v);if(w==0&&S==0)return m.nodeType==3?B0(m,e,t):am(m,e,t);if(!n||o>S||o==S&&s>w){n=m,r=v,s=w,o=S;let _=S?t<v.top?-1:1:w?e<v.left?-1:1:0;l=!_||(_>0?g<p.length-1:g>0)}w==0?t>v.bottom&&(!u||u.bottom<v.bottom)?(a=m,u=v):t<v.top&&(!h||h.top>v.top)&&(c=m,h=v):u&&Tf(u,v)?u=Z0(u,v.bottom):h&&Tf(h,v)&&(h=N0(h,v.top))}}if(u&&u.bottom>=t?(n=a,r=u):h&&h.top<=t&&(n=c,r=h),!n)return{node:i,offset:0};let f=Math.max(r.left,Math.min(r.right,e));if(n.nodeType==3)return B0(n,f,t);if(l&&n.contentEditable!="false")return am(n,f,t);let d=Array.prototype.indexOf.call(i.childNodes,n)+(e>=(r.left+r.right)/2?1:0);return{node:i,offset:d}}function B0(i,e,t){let n=i.nodeValue.length,r=-1,s=1e9,o=0;for(let l=0;l<n;l++){let a=Rs(i,l,l+1).getClientRects();for(let c=0;c<a.length;c++){let u=a[c];if(u.top==u.bottom)continue;o||(o=e-u.left);let h=(u.top>t?u.top-t:t-u.bottom)-1;if(u.left-1<=e&&u.right+1>=e&&h<s){let f=e>=(u.left+u.right)/2,d=f;if((ke.chrome||ke.gecko)&&Rs(i,l).getBoundingClientRect().left==u.right&&(d=!f),h<=0)return{node:i,offset:l+(d?1:0)};r=l+(d?1:0),s=h}}}return{node:i,offset:r>-1?r:o>0?i.nodeValue.length:0}}function YS(i,e,t,n=-1){var r,s;let o=i.contentDOM.getBoundingClientRect(),l=o.top+i.viewState.paddingTop,a,{docHeight:c}=i.viewState,{x:u,y:h}=e,f=h-l;if(f<0)return 0;if(f>c)return i.state.doc.length;for(let _=i.viewState.heightOracle.textHeight/2,k=!1;a=i.elementAtHeight(f),a.type!=Cn.Text;)for(;f=n>0?a.bottom+_:a.top-_,!(f>=0&&f<=c);){if(k)return t?null:0;k=!0,n=-n}h=l+f;let d=a.from;if(d<i.viewport.from)return i.viewport.from==0?0:t?null:W0(i,o,a,u,h);if(d>i.viewport.to)return i.viewport.to==i.state.doc.length?i.state.doc.length:t?null:W0(i,o,a,u,h);let m=i.dom.ownerDocument,p=i.root.elementFromPoint?i.root:m,g=p.elementFromPoint(u,h);g&&!i.contentDOM.contains(g)&&(g=null),g||(u=Math.max(o.left+1,Math.min(o.right-1,u)),g=p.elementFromPoint(u,h),g&&!i.contentDOM.contains(g)&&(g=null));let v,w=-1;if(g&&((r=i.docView.nearest(g))===null||r===void 0?void 0:r.isEditable)!=!1){if(m.caretPositionFromPoint){let _=m.caretPositionFromPoint(u,h);_&&({offsetNode:v,offset:w}=_)}else if(m.caretRangeFromPoint){let _=m.caretRangeFromPoint(u,h);_&&({startContainer:v,startOffset:w}=_,(!i.contentDOM.contains(v)||ke.safari&&d5(v,w,u)||ke.chrome&&m5(v,w,u))&&(v=void 0))}}if(!v||!i.docView.dom.contains(v)){let _=qt.find(i.docView,d);if(!_)return f>a.top+a.height/2?a.to:a.from;({node:v,offset:w}=am(_.dom,u,h))}let S=i.docView.nearest(v);if(!S)return null;if(S.isWidget&&((s=S.dom)===null||s===void 0?void 0:s.nodeType)==1){let _=S.dom.getBoundingClientRect();return e.y<_.top||e.y<=_.bottom&&e.x<=(_.left+_.right)/2?S.posAtStart:S.posAtEnd}else return S.localPosFromDOM(v,w)+S.posAtStart}function W0(i,e,t,n,r){let s=Math.round((n-e.left)*i.defaultCharacterWidth);if(i.lineWrapping&&t.height>i.defaultLineHeight*1.5){let l=i.viewState.heightOracle.textHeight,a=Math.floor((r-t.top-(i.defaultLineHeight-l)*.5)/l);s+=a*i.viewState.heightOracle.lineLength}let o=i.state.sliceDoc(t.from,t.to);return t.from+Ud(o,s,i.state.tabSize)}function d5(i,e,t){let n;if(i.nodeType!=3||e!=(n=i.nodeValue.length))return!1;for(let r=i.nextSibling;r;r=r.nextSibling)if(r.nodeType!=1||r.nodeName!="BR")return!1;return Rs(i,n-1,n).getBoundingClientRect().left>t}function m5(i,e,t){if(e!=0)return!1;for(let r=i;;){let s=r.parentNode;if(!s||s.nodeType!=1||s.firstChild!=r)return!1;if(s.classList.contains("cm-line"))break;r=s}let n=i.nodeType==1?i.getBoundingClientRect():Rs(i,0,Math.max(i.nodeValue.length,1)).getBoundingClientRect();return t-n.left>5}function cm(i,e){let t=i.lineBlockAt(e);if(Array.isArray(t.type)){for(let n of t.type)if(n.to>e||n.to==e&&(n.to==t.to||n.type==Cn.Text))return n}return t}function p5(i,e,t,n){let r=cm(i,e.head),s=!n||r.type!=Cn.Text||!(i.lineWrapping||r.widgetLineBreaks)?null:i.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head);if(s){let o=i.dom.getBoundingClientRect(),l=i.textDirectionAt(r.from),a=i.posAtCoords({x:t==(l==Rt.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return q.cursor(a,t?-1:1)}return q.cursor(t?r.to:r.from,t?-1:1)}function X0(i,e,t,n){let r=i.state.doc.lineAt(e.head),s=i.bidiSpans(r),o=i.textDirectionAt(r.from);for(let l=e,a=null;;){let c=e5(r,s,o,l,t),u=AS;if(!c){if(r.number==(t?i.state.doc.lines:1))return l;u=`
`,r=i.state.doc.line(r.number+(t?1:-1)),s=i.bidiSpans(r),c=i.visualLineSide(r,!t)}if(a){if(!a(u))return l}else{if(!n)return c;a=n(u)}l=c}}function g5(i,e,t){let n=i.state.charCategorizer(e),r=n(t);return s=>{let o=n(s);return r==$t.Space&&(r=o),r==o}}function O5(i,e,t,n){let r=e.head,s=t?1:-1;if(r==(t?i.state.doc.length:0))return q.cursor(r,e.assoc);let o=e.goalColumn,l,a=i.contentDOM.getBoundingClientRect(),c=i.coordsAtPos(r,e.assoc||-1),u=i.documentTop;if(c)o==null&&(o=c.left-a.left),l=s<0?c.top:c.bottom;else{let d=i.viewState.lineBlockAt(r);o==null&&(o=Math.min(a.right-a.left,i.defaultCharacterWidth*(r-d.from))),l=(s<0?d.top:d.bottom)+u}let h=a.left+o,f=n??i.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let m=l+(f+d)*s,p=YS(i,{x:h,y:m},!1,s);if(m<a.top||m>a.bottom||(s<0?p<r:p>r)){let g=i.docView.coordsForChar(p),v=!g||m<g.top?-1:1;return q.cursor(p,v,void 0,o)}}}function qc(i,e,t){for(;;){let n=0;for(let r of i)r.between(e-1,e+1,(s,o,l)=>{if(e>s&&e<o){let a=n||t||(e-s<o-e?-1:1);e=a<0?s:o,n=a}});if(!n)return e}}function Qf(i,e,t){let n=qc(i.state.facet(fp).map(r=>r(i)),t.from,e.head>t.from?-1:1);return n==t.from?t:q.cursor(n,n<t.from?1:-1)}const Cl="￿";class b5{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(et.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Cl}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let s=this.text.length;this.readNode(r);let o=r.nextSibling;if(o==t)break;let l=St.get(r),a=St.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:Pu(r))||Pu(o)&&(r.nodeName!="BR"||r.cmIgnore)&&this.text.length>s)&&this.lineBreak(),r=o}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(l=r.exec(t))&&(s=l.index,o=l[0].length),this.append(t.slice(n,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);n=s+o}}readNode(e){if(e.cmIgnore)return;let t=St.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let r=n.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(v5(e,n.node,n.offset)?t:0))}}function v5(i,e,t){for(;;){if(!e||t<dr(e))return!1;if(e==i)return!0;t=Es(e)+1,e=e.parentNode}}class F0{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class w5{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,n,0))){let l=s||o?[]:S5(e),a=new b5(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=_5(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!Gd(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),c=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Gd(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),u=e.viewport;if((ke.ios||ke.chrome)&&e.state.selection.main.empty&&a!=c&&(u.from>0||u.to<e.state.doc.length)){let h=Math.min(a,c),f=Math.max(a,c),d=u.from-h,m=u.to-f;(d==0||d==1||h==0)&&(m==0||m==-1||f==e.state.doc.length)&&(a=0,c=e.state.doc.length)}this.newSel=q.single(c,a)}}}function zS(i,e){let t,{newSel:n}=e,r=i.state.selection.main,s=i.inputState.lastKeyTime>Date.now()-100?i.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=r.from,c=null;(s===8||ke.android&&e.text.length<l-o)&&(a=r.to,c="end");let u=k5(i.state.doc.sliceString(o,l,Cl),e.text,a-o,c);u&&(ke.chrome&&s==13&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==Cl+Cl&&u.toB--,t={from:o+u.from,to:o+u.toA,insert:at.of(e.text.slice(u.from,u.toB).split(Cl))})}else n&&(!i.hasFocus&&i.state.facet(Dr)||n.main.eq(r))&&(n=null);if(!t&&!n)return!1;if(!t&&e.typeOver&&!r.empty&&n&&n.main.empty?t={from:r.from,to:r.to,insert:i.state.doc.slice(r.from,r.to)}:t&&t.from>=r.from&&t.to<=r.to&&(t.from!=r.from||t.to!=r.to)&&r.to-r.from-(t.to-t.from)<=4?t={from:r.from,to:r.to,insert:i.state.doc.slice(r.from,t.from).append(t.insert).append(i.state.doc.slice(t.to,r.to))}:(ke.mac||ke.android)&&t&&t.from==t.to&&t.from==r.head-1&&/^\. ?$/.test(t.insert.toString())&&i.contentDOM.getAttribute("autocorrect")=="off"?(n&&t.insert.length==2&&(n=q.single(n.main.anchor-1,n.main.head-1)),t={from:r.from,to:r.to,insert:at.of([" "])}):ke.chrome&&t&&t.from==t.to&&t.from==r.head&&t.insert.toString()==`
`&&i.lineWrapping&&(n&&(n=q.single(n.main.anchor-1,n.main.head-1)),t={from:r.from,to:r.to,insert:at.of([" "])}),t)return dp(i,t,n,s);if(n&&!n.main.eq(r)){let o=!1,l="select";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin=="select"&&(o=!0),l=i.inputState.lastSelectionOrigin),i.dispatch({selection:n,scrollIntoView:o,userEvent:l}),!0}else return!1}function dp(i,e,t,n=-1){if(ke.ios&&i.inputState.flushIOSKey(e))return!0;let r=i.state.selection.main;if(ke.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&i.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&bo(i.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&bo(i.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&bo(i.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let o,l=()=>o||(o=y5(i,e,t));return i.state.facet(ES).some(a=>a(i,e.from,e.to,s,l))||i.dispatch(l()),!0}function y5(i,e,t){let n,r=i.state,s=r.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&i.inputState.composing<0){let l=s.from<e.from?r.sliceDoc(s.from,e.from):"",a=s.to>e.to?r.sliceDoc(e.to,s.to):"";n=r.replaceSelection(i.state.toText(l+e.insert.sliceString(0,void 0,i.state.lineBreak)+a))}else{let l=r.changes(e),a=t&&t.main.to<=l.newLength?t.main:void 0;if(r.selection.ranges.length>1&&i.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let c=i.state.sliceDoc(e.from,e.to),u,h=t&&FS(i,t.main.head);if(h){let m=e.insert.length-(e.to-e.from);u={from:h.from,to:h.to-m}}else u=i.state.doc.lineAt(s.head);let f=s.to-e.to,d=s.to-s.from;n=r.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:l,range:a||m.map(l)};let p=m.to-f,g=p-c.length;if(m.to-m.from!=d||i.state.sliceDoc(g,p)!=c||m.to>=u.from&&m.from<=u.to)return{range:m};let v=r.changes({from:g,to:p,insert:e.insert}),w=m.to-s.to;return{changes:v,range:a?q.range(Math.max(0,a.anchor+w),Math.max(0,a.head+w)):m.map(v)}})}else n={changes:l,selection:a&&r.selection.replaceRange(a)}}let o="input.type";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,o+=".compose",i.inputState.compositionFirstChange&&(o+=".start",i.inputState.compositionFirstChange=!1)),r.update(n,{userEvent:o,scrollIntoView:!0})}function k5(i,e,t,n){let r=Math.min(i.length,e.length),s=0;for(;s<r&&i.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==r&&i.length==e.length)return null;let o=i.length,l=e.length;for(;o>0&&l>0&&i.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(n=="end"){let a=Math.max(0,s-Math.min(o,l));t-=o+a-s}if(o<s&&i.length<e.length){let a=t<=s&&t>=o?s-t:0;s-=a,l=s+(l-o),o=s}else if(l<s){let a=t<=s&&t>=l?s-t:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function S5(i){let e=[];if(i.root.activeElement!=i.contentDOM)return e;let{anchorNode:t,anchorOffset:n,focusNode:r,focusOffset:s}=i.observer.selectionRange;return t&&(e.push(new F0(t,n)),(r!=t||s!=n)&&e.push(new F0(r,s))),e}function _5(i,e){if(i.length==0)return null;let t=i[0].pos,n=i.length==2?i[1].pos:t;return t>-1&&n>-1?q.single(t+e,n+e):null}class C5{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,ke.safari&&e.contentDOM.addEventListener("input",()=>null),ke.gecko&&W5(e.contentDOM.ownerDocument)}handleEvent(e){!R5(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,t){let n=this.handlers[e];if(n){for(let r of n.observers)r(this.view,t);for(let r of n.handlers){if(t.defaultPrevented)break;if(r(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=P5(e),n=this.handlers,r=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,l=n[s];l&&o!=!l.handlers.length&&(r.removeEventListener(s,this.handleEvent),l=null),l||r.addEventListener(s,this.handleEvent,{passive:o})}for(let s in n)s!="scroll"&&!t[s]&&r.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&US.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),ke.android&&ke.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return ke.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=VS.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||A5.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,bo(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:ke.safari&&!ke.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Y0(i,e){return(t,n)=>{try{return e.call(i,n,t)}catch(r){_n(t.state,r)}}}function P5(i){let e=Object.create(null);function t(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of i){let r=n.spec;if(r&&r.domEventHandlers)for(let s in r.domEventHandlers){let o=r.domEventHandlers[s];o&&t(s).handlers.push(Y0(n.value,o))}if(r&&r.domEventObservers)for(let s in r.domEventObservers){let o=r.domEventObservers[s];o&&t(s).observers.push(Y0(n.value,o))}}for(let n in Ai)t(n).handlers.push(Ai[n]);for(let n in fi)t(n).observers.push(fi[n]);return e}const VS=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],A5="dthko",US=[16,17,18,20,91,92,224,225],mc=6;function pc(i){return Math.max(0,i)*.7+8}function x5(i,e){return Math.max(Math.abs(i.clientX-e.clientX),Math.abs(i.clientY-e.clientY))}class T5{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=ID(e.contentDOM),this.atoms=e.state.facet(fp).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(et.allowMultipleSelections)&&Q5(e,t),this.dragging=E5(e,t)&&GS(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&x5(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,r=0,s=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=XS(this.view);e.clientX-a.left<=r+mc?t=-pc(r-e.clientX):e.clientX+a.right>=o-mc&&(t=pc(e.clientX-o)),e.clientY-a.top<=s+mc?n=-pc(s-e.clientY):e.clientY+a.bottom>=l-mc&&(n=pc(e.clientY-l)),this.setScrollSpeed(t,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let n=0;n<e.ranges.length;n++){let r=e.ranges[n],s=null;if(r.empty){let o=qc(this.atoms,r.from,0);o!=r.from&&(s=q.cursor(o,-1))}else{let o=qc(this.atoms,r.from,-1),l=qc(this.atoms,r.to,1);(o!=r.from||l!=r.to)&&(s=q.range(r.from==r.anchor?o:l,r.from==r.head?o:l))}s&&(t||(t=e.ranges.slice()),t[n]=s)}return t?q.create(t,e.mainIndex):e}select(e){let{view:t}=this,n=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Q5(i,e){let t=i.state.facet(xS);return t.length?t[0](e):ke.mac?e.metaKey:e.ctrlKey}function M5(i,e){let t=i.state.facet(TS);return t.length?t[0](e):ke.mac?!e.altKey:!e.ctrlKey}function E5(i,e){let{main:t}=i.state.selection;if(t.empty)return!1;let n=ua(i.root);if(!n||n.rangeCount==0)return!0;let r=n.getRangeAt(0).getClientRects();for(let s=0;s<r.length;s++){let o=r[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function R5(i,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,n;t!=i.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(n=St.get(t))&&n.ignoreEvent(e))return!1;return!0}const Ai=Object.create(null),fi=Object.create(null),jS=ke.ie&&ke.ie_version<15||ke.ios&&ke.webkit_version<604;function D5(i){let e=i.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{i.focus(),t.remove(),qS(i,t.value)},50)}function qS(i,e){let{state:t}=i,n,r=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(um!=null&&t.selection.ranges.every(a=>a.empty)&&um==s.toString()){let a=-1;n=t.changeByRange(c=>{let u=t.doc.lineAt(c.from);if(u.from==a)return{range:c};a=u.from;let h=t.toText((o?s.line(r++).text:e)+t.lineBreak);return{changes:{from:u.from,insert:h},range:q.cursor(c.from+h.length)}})}else o?n=t.changeByRange(a=>{let c=s.line(r++);return{changes:{from:a.from,to:a.to,insert:c.text},range:q.cursor(a.from+c.length)}}):n=t.replaceSelection(s);i.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}fi.scroll=i=>{i.inputState.lastScrollTop=i.scrollDOM.scrollTop,i.inputState.lastScrollLeft=i.scrollDOM.scrollLeft};Ai.keydown=(i,e)=>(i.inputState.setSelectionOrigin("select"),e.keyCode==27&&i.inputState.tabFocusMode!=0&&(i.inputState.tabFocusMode=Date.now()+2e3),!1);fi.touchstart=(i,e)=>{i.inputState.lastTouchTime=Date.now(),i.inputState.setSelectionOrigin("select.pointer")};fi.touchmove=i=>{i.inputState.setSelectionOrigin("select.pointer")};Ai.mousedown=(i,e)=>{if(i.observer.flush(),i.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let n of i.state.facet(QS))if(t=n(i,e),t)break;if(!t&&e.button==0&&(t=I5(i,e)),t){let n=!i.hasFocus;i.inputState.startMouseSelection(new T5(i,e,t,n)),n&&i.observer.ignore(()=>{cS(i.contentDOM);let s=i.root.activeElement;s&&!s.contains(i.contentDOM)&&s.blur()});let r=i.inputState.mouseSelection;if(r)return r.start(e),r.dragging===!1}return!1};function z0(i,e,t,n){if(n==1)return q.cursor(e,t);if(n==2)return u5(i.state,e,t);{let r=qt.find(i.docView,e),s=i.state.doc.lineAt(r?r.posAtEnd:e),o=r?r.posAtStart:s.from,l=r?r.posAtEnd:s.to;return l<i.state.doc.length&&l==s.to&&l++,q.range(o,l)}}let V0=(i,e,t)=>e>=t.top&&e<=t.bottom&&i>=t.left&&i<=t.right;function $5(i,e,t,n){let r=qt.find(i.docView,e);if(!r)return 1;let s=e-r.posAtStart;if(s==0)return 1;if(s==r.length)return-1;let o=r.coordsAt(s,-1);if(o&&V0(t,n,o))return-1;let l=r.coordsAt(s,1);return l&&V0(t,n,l)?1:o&&o.bottom>=n?-1:1}function U0(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:$5(i,t,e.clientX,e.clientY)}}const L5=ke.ie&&ke.ie_version<=11;let j0=null,q0=0,G0=0;function GS(i){if(!L5)return i.detail;let e=j0,t=G0;return j0=i,G0=Date.now(),q0=!e||t>Date.now()-400&&Math.abs(e.clientX-i.clientX)<2&&Math.abs(e.clientY-i.clientY)<2?(q0+1)%3:1}function I5(i,e){let t=U0(i,e),n=GS(e),r=i.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),r=r.map(s.changes))},get(s,o,l){let a=U0(i,s),c,u=z0(i,a.pos,a.bias,n);if(t.pos!=a.pos&&!o){let h=z0(i,t.pos,t.bias,n),f=Math.min(h.from,u.from),d=Math.max(h.to,u.to);u=f<u.from?q.range(f,d):q.range(d,f)}return o?r.replaceRange(r.main.extend(u.from,u.to)):l&&n==1&&r.ranges.length>1&&(c=N5(r,a.pos))?c:l?r.addRange(u):q.create([u])}}}function N5(i,e){for(let t=0;t<i.ranges.length;t++){let{from:n,to:r}=i.ranges[t];if(n<=e&&r>=e)return q.create(i.ranges.slice(0,t).concat(i.ranges.slice(t+1)),i.mainIndex==t?0:i.mainIndex-(i.mainIndex>t?1:0))}return null}Ai.dragstart=(i,e)=>{let{selection:{main:t}}=i.state;if(e.target.draggable){let r=i.docView.nearest(e.target);if(r&&r.isWidget){let s=r.posAtStart,o=s+r.length;(s>=t.to||o<=t.from)&&(t=q.range(s,o))}}let{inputState:n}=i;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",i.state.sliceDoc(t.from,t.to)),e.dataTransfer.effectAllowed="copyMove"),!1};Ai.dragend=i=>(i.inputState.draggedContent=null,!1);function H0(i,e,t,n){if(!t)return;let r=i.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=i.inputState,o=n&&s&&M5(i,e)?{from:s.from,to:s.to}:null,l={from:r,insert:t},a=i.state.changes(o?[o,l]:l);i.focus(),i.dispatch({changes:a,selection:{anchor:a.mapPos(r,-1),head:a.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),i.inputState.draggedContent=null}Ai.drop=(i,e)=>{if(!e.dataTransfer)return!1;if(i.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let n=Array(t.length),r=0,s=()=>{++r==t.length&&H0(i,e,n.filter(o=>o!=null).join(i.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let l=new FileReader;l.onerror=s,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(n[o]=l.result),s()},l.readAsText(t[o])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return H0(i,e,n,!0),!0}return!1};Ai.paste=(i,e)=>{if(i.state.readOnly)return!0;i.observer.flush();let t=jS?null:e.clipboardData;return t?(qS(i,t.getData("text/plain")||t.getData("text/uri-list")),!0):(D5(i),!1)};function Z5(i,e){let t=i.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),i.focus()},50)}function B5(i){let e=[],t=[],n=!1;for(let r of i.selection.ranges)r.empty||(e.push(i.sliceDoc(r.from,r.to)),t.push(r));if(!e.length){let r=-1;for(let{from:s}of i.selection.ranges){let o=i.doc.lineAt(s);o.number>r&&(e.push(o.text),t.push({from:o.from,to:Math.min(i.doc.length,o.to+1)})),r=o.number}n=!0}return{text:e.join(i.lineBreak),ranges:t,linewise:n}}let um=null;Ai.copy=Ai.cut=(i,e)=>{let{text:t,ranges:n,linewise:r}=B5(i.state);if(!t&&!r)return!1;um=r?t:null,e.type=="cut"&&!i.state.readOnly&&i.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let s=jS?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(Z5(i,t),!1)};const HS=Or.define();function KS(i,e){let t=[];for(let n of i.facet(RS)){let r=n(i,e);r&&t.push(r)}return t?i.update({effects:t,annotations:HS.of(!0)}):null}function JS(i){setTimeout(()=>{let e=i.hasFocus;if(e!=i.inputState.notifiedFocused){let t=KS(i.state,e);t?i.dispatch(t):i.update([])}},10)}fi.focus=i=>{i.inputState.lastFocusTime=Date.now(),!i.scrollDOM.scrollTop&&(i.inputState.lastScrollTop||i.inputState.lastScrollLeft)&&(i.scrollDOM.scrollTop=i.inputState.lastScrollTop,i.scrollDOM.scrollLeft=i.inputState.lastScrollLeft),JS(i)};fi.blur=i=>{i.observer.clearSelectionRange(),JS(i)};fi.compositionstart=fi.compositionupdate=i=>{i.observer.editContext||(i.inputState.compositionFirstChange==null&&(i.inputState.compositionFirstChange=!0),i.inputState.composing<0&&(i.inputState.composing=0))};fi.compositionend=i=>{i.observer.editContext||(i.inputState.composing=-1,i.inputState.compositionEndedAt=Date.now(),i.inputState.compositionPendingKey=!0,i.inputState.compositionPendingChange=i.observer.pendingRecords().length>0,i.inputState.compositionFirstChange=null,ke.chrome&&ke.android?i.observer.flushSoon():i.inputState.compositionPendingChange?Promise.resolve().then(()=>i.observer.flush()):setTimeout(()=>{i.inputState.composing<0&&i.docView.hasComposition&&i.update([])},50))};fi.contextmenu=i=>{i.inputState.lastContextMenu=Date.now()};Ai.beforeinput=(i,e)=>{var t,n;if(e.inputType=="insertReplacementText"&&i.observer.editContext){let s=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let l=o[0],a=i.posAtDOM(l.startContainer,l.startOffset),c=i.posAtDOM(l.endContainer,l.endOffset);return dp(i,{from:a,to:c,insert:i.state.toText(s)},null),!0}}let r;if(ke.chrome&&ke.android&&(r=VS.find(s=>s.inputType==e.inputType))&&(i.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let s=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&i.hasFocus&&(i.contentDOM.blur(),i.focus())},100)}return ke.ios&&e.inputType=="deleteContentForward"&&i.observer.flushSoon(),ke.safari&&e.inputType=="insertText"&&i.inputState.composing>=0&&setTimeout(()=>fi.compositionend(i,e),20),!1};const K0=new Set;function W5(i){K0.has(i)||(K0.add(i),i.addEventListener("copy",()=>{}),i.addEventListener("cut",()=>{}))}const J0=["pre-wrap","normal","pre-line","break-spaces"];let Eo=!1;function eb(){Eo=!1}class X5{constructor(e){this.lineWrapping=e,this.doc=at.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return J0.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(r*10)]||(t=!0,this.heightSamples[Math.floor(r*10)]=!0)}return t}refresh(e,t,n,r,s,o){let l=J0.indexOf(e)>-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=s,a){this.heightSamples={};for(let c=0;c<o.length;c++){let u=o[c];u<0?c++:this.heightSamples[Math.floor(u*10)]=!0}}return a}}class F5{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class Zi{constructor(e,t,n,r,s){this.from=e,this.length=t,this.top=n,this.height=r,this._content=s}get type(){return typeof this._content=="number"?Cn.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Gr?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Zi(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Et=function(i){return i[i.ByPos=0]="ByPos",i[i.ByHeight=1]="ByHeight",i[i.ByPosNoHeight=2]="ByPosNoHeight",i}(Et||(Et={}));const Gc=.001;class Pn{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Gc&&(Eo=!0),this.height=e)}replace(e,t,n){return Pn.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let s=this,o=n.doc;for(let l=r.length-1;l>=0;l--){let{fromA:a,toA:c,fromB:u,toB:h}=r[l],f=s.lineAt(a,Et.ByPosNoHeight,n.setDoc(t),0,0),d=f.to>=c?f:s.lineAt(c,Et.ByPosNoHeight,n,0,0);for(h+=d.to-c,c=d.to;l>0&&f.from<=r[l-1].toA;)a=r[l-1].fromA,u=r[l-1].fromB,l--,a<f.from&&(f=s.lineAt(a,Et.ByPosNoHeight,n,0,0));u+=f.from-a,a=f.from;let m=mp.build(n.setDoc(o),e,u,h);s=Tu(s,s.replace(a,c,m))}return s.updateHeight(n,0)}static empty(){return new Vn(0,0)}static of(e){if(e.length==1)return e[0];let t=0,n=e.length,r=0,s=0;for(;;)if(t==n)if(r>s*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),n+=1+l.break,r-=l.size}else if(s>r*2){let l=e[n];l.break?e.splice(n,1,l.left,null,l.right):e.splice(n,1,l.left,l.right),n+=2+l.break,s-=l.size}else break;else if(r<s){let l=e[t++];l&&(r+=l.size)}else{let l=e[--n];l&&(s+=l.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,n++),new Y5(Pn.of(e.slice(0,t)),o,Pn.of(e.slice(n)))}}function Tu(i,e){return i==e?i:(i.constructor!=e.constructor&&(Eo=!0),e)}Pn.prototype.size=1;class e2 extends Pn{constructor(e,t,n){super(e,t),this.deco=n}blockAt(e,t,n,r){return new Zi(r,this.length,n,this.height,this.deco||0)}lineAt(e,t,n,r,s){return this.blockAt(0,n,r,s)}forEachLine(e,t,n,r,s,o){e<=s+this.length&&t>=s&&o(this.blockAt(0,n,r,s))}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setHeight(r.heights[r.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Vn extends e2{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,r){return new Zi(r,this.length,n,this.height,this.breaks)}replace(e,t,n){let r=n[0];return n.length==1&&(r instanceof Vn||r instanceof on&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof on?r=new Vn(r.length,this.height):r.height=this.height,this.outdated||(r.outdated=!1),r):Pn.of(n)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setHeight(r.heights[r.index++]):(n||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class on extends Pn{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,s=r-n+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:n,lastLine:r,perLine:o,perChar:l}}blockAt(e,t,n,r){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,r);if(t.lineWrapping){let c=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),u=t.doc.lineAt(c),h=l+u.length*a,f=Math.max(n,e-h/2);return new Zi(u.from,u.length,f,h,0)}else{let c=Math.max(0,Math.min(o-s,Math.floor((e-n)/l))),{from:u,length:h}=t.doc.line(s+c);return new Zi(u,h,n+l*c,l,0)}}lineAt(e,t,n,r,s){if(t==Et.ByHeight)return this.blockAt(e,n,r,s);if(t==Et.ByPosNoHeight){let{from:d,to:m}=n.doc.lineAt(e);return new Zi(d,m-d,0,0,0)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(n,s),c=n.doc.lineAt(e),u=l+c.length*a,h=c.number-o,f=r+l*h+a*(c.from-s-h);return new Zi(c.from,c.length,Math.max(r,Math.min(f,r+this.height-u)),u,0)}forEachLine(e,t,n,r,s,o){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:l,perLine:a,perChar:c}=this.heightMetrics(n,s);for(let u=e,h=r;u<=t;){let f=n.doc.lineAt(u);if(u==e){let m=f.number-l;h+=a*m+c*(e-s-m)}let d=a+c*f.length;o(new Zi(f.from,f.length,h,d,0)),h+=d,u=f.to+1}}replace(e,t,n){let r=this.length-t;if(r>0){let s=n[n.length-1];s instanceof on?n[n.length-1]=new on(s.length+r):n.push(null,new on(r-1))}if(e>0){let s=n[0];s instanceof on?n[0]=new on(e+s.length):n.unshift(new on(e-1),null)}return Pn.of(n)}decomposeLeft(e,t){t.push(new on(e-1),null)}decomposeRight(e,t){t.push(null,new on(this.length-e-1))}updateHeight(e,t=0,n=!1,r){let s=t+this.length;if(r&&r.from<=t+this.length&&r.more){let o=[],l=Math.max(t,r.from),a=-1;for(r.from>t&&o.push(new on(r.from-t-1).updateHeight(e,t));l<=s&&r.more;){let u=e.doc.lineAt(l).length;o.length&&o.push(null);let h=r.heights[r.index++];a==-1?a=h:Math.abs(h-a)>=Gc&&(a=-2);let f=new Vn(u,h);f.outdated=!1,o.push(f),l+=u+1}l<=s&&o.push(null,new on(s-l).updateHeight(e,l));let c=Pn.of(o);return(a<0||Math.abs(c.height-this.height)>=Gc||Math.abs(a-this.heightMetrics(e,t).perLine)>=Gc)&&(Eo=!0),Tu(this,c)}else(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Y5 extends Pn{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,r){let s=n+this.left.height;return e<s?this.left.blockAt(e,t,n,r):this.right.blockAt(e,t,s,r+this.left.length+this.break)}lineAt(e,t,n,r,s){let o=r+this.left.height,l=s+this.left.length+this.break,a=t==Et.ByHeight?e<o:e<l,c=a?this.left.lineAt(e,t,n,r,s):this.right.lineAt(e,t,n,o,l);if(this.break||(a?c.to<l:c.from>l))return c;let u=t==Et.ByPosNoHeight?Et.ByPosNoHeight:Et.ByPos;return a?c.join(this.right.lineAt(l,u,n,o,l)):this.left.lineAt(l,u,n,r,s).join(c)}forEachLine(e,t,n,r,s,o){let l=r+this.left.height,a=s+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,n,r,s,o),t>=a&&this.right.forEachLine(e,t,n,l,a,o);else{let c=this.lineAt(a,Et.ByPos,n,r,s);e<c.from&&this.left.forEachLine(e,c.from-1,n,r,s,o),c.to>=e&&c.from<=t&&o(c),t>c.to&&this.right.forEachLine(c.to+1,t,n,l,a,o)}}replace(e,t,n){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let l of n)s.push(l);if(e>0&&tb(s,o-1),t<this.length){let l=s.length;this.decomposeRight(t,s),tb(s,l)}return Pn.of(s)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Pn.of(this.break?[e,null,t]:[e,t]):(this.left=Tu(this.left,e),this.right=Tu(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,r){let{left:s,right:o}=this,l=t+s.length+this.break,a=null;return r&&r.from<=t+s.length&&r.more?a=s=s.updateHeight(e,t,n,r):s.updateHeight(e,t,n),r&&r.from<=l+o.length&&r.more?a=o=o.updateHeight(e,l,n,r):o.updateHeight(e,l,n),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function tb(i,e){let t,n;i[e]==null&&(t=i[e-1])instanceof on&&(n=i[e+1])instanceof on&&i.splice(e-1,3,new on(t.length+1+n.length))}const z5=5;class mp{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let n=Math.min(t,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof Vn?r.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Vn(n-this.pos,-1)),this.writtenTo=n,t>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,s=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let o=t-e;n.block?this.addBlock(new e2(o,r,n)):(o||s||r>=z5)&&this.addLineDeco(r,s,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Vn(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new on(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Vn)return e;let t=new Vn(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Vn)&&!this.isCovered?this.nodes.push(new Vn(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let r of this.nodes)r instanceof Vn&&r.updateHeight(this.oracle,n),n+=r?r.length:1;return this.nodes}static build(e,t,n,r){let s=new mp(n,e);return tt.spans(t,n,r,s,0),s.finish(n)}}function V5(i,e,t){let n=new U5;return tt.compare(i,e,t,n,0),n.changes}class U5{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&nm(e,t,this.changes,5)}}function j5(i,e){let t=i.getBoundingClientRect(),n=i.ownerDocument,r=n.defaultView||window,s=Math.max(0,t.left),o=Math.min(r.innerWidth,t.right),l=Math.max(0,t.top),a=Math.min(r.innerHeight,t.bottom);for(let c=i.parentNode;c&&c!=n.body;)if(c.nodeType==1){let u=c,h=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&h.overflow!="visible"){let f=u.getBoundingClientRect();s=Math.max(s,f.left),o=Math.min(o,f.right),l=Math.max(l,f.top),a=Math.min(c==i.parentNode?r.innerHeight:a,f.bottom)}c=h.position=="absolute"||h.position=="fixed"?u.offsetParent:u.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:s-t.left,right:Math.max(s,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function q5(i,e){let t=i.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Mf{constructor(e,t,n){this.from=e,this.to=t,this.size=n}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],s=t[n];if(r.from!=s.from||r.to!=s.to||r.size!=s.size)return!1}return!0}draw(e,t){return Qe.replace({widget:new G5(this.size*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class G5 extends br{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class nb{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=ib,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Rt.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(hp).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new X5(t),this.stateDeco=e.facet(fa).filter(n=>typeof n!="function"),this.heightMap=Pn.empty().applyChanges(this.stateDeco,at.empty,this.heightOracle.setDoc(e.doc),[new ui(0,0,0,e.doc.length)]);for(let n=0;n<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());n++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Qe.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:s,to:o})=>r>=s&&r<=o)){let{from:s,to:o}=this.lineBlockAt(r);e.push(new gc(s,o))}}return this.viewports=e.sort((n,r)=>n.from-r.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?ib:new pp(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Pl(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(fa).filter(u=>typeof u!="function");let r=e.changedRanges,s=ui.extendWithRanges(r,V5(n,this.stateDeco,e?e.changes:en.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);eb(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||Eo)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<a.from||t.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let c=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet($S)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,s=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?Rt.RTL:Rt.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let c=0,u=0;if(l.width&&l.height){let{scaleX:_,scaleY:k}=aS(t,l);(_>.005&&Math.abs(this.scaleX-_)>.005||k>.005&&Math.abs(this.scaleY-k)>.005)&&(this.scaleX=_,this.scaleY=k,c|=8,o=a=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,f=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=f)&&(this.paddingTop=h,this.paddingBottom=f,c|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=8);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=hS(e.scrollDOM);let m=(this.printing?q5:j5)(t,this.paddingTop),p=m.top-this.pixelViewport.top,g=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let w=l.width;if((this.contentDOMWidth!=w||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,c|=8),a){let _=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(_)&&(o=!0),o||r.lineWrapping&&Math.abs(w-this.contentDOMWidth)>r.charWidth){let{lineHeight:k,charWidth:A,textHeight:C}=e.docView.measureTextSize();o=k>0&&r.refresh(s,k,A,C,w/A,_),o&&(e.docView.minWidth=0,c|=8)}p>0&&g>0?u=Math.max(p,g):p<0&&g<0&&(u=Math.min(p,g)),eb();for(let k of this.viewports){let A=k.from==this.viewport.from?_:e.docView.measureVisibleLineHeights(k);this.heightMap=(o?Pn.empty().applyChanges(this.stateDeco,at.empty,this.heightOracle,[new ui(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new F5(k.from,A))}Eo&&(c|=2)}let S=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return S&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(u,this.scrollTarget),c|=this.updateForViewport()),(c&2||S)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new gc(r.lineAt(o-n*1e3,Et.ByHeight,s,0,0).from,r.lineAt(l+(1-n)*1e3,Et.ByHeight,s,0,0).to);if(t){let{head:c}=t.range;if(c<a.from||c>a.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=r.lineAt(c,Et.ByPos,s,0,0),f;t.y=="center"?f=(h.top+h.bottom)/2-u/2:t.y=="start"||t.y=="nearest"&&c<a.from?f=h.top:f=h.bottom-u,a=new gc(r.lineAt(f-1e3/2,Et.ByHeight,s,0,0).from,r.lineAt(f+u+1e3/2,Et.ByHeight,s,0,0).to)}}return a}mapViewport(e,t){let n=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new gc(this.heightMap.lineAt(n,Et.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,Et.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,Et.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,Et.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:l}=this;return(e==0||r<=o-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||s>=l+Math.max(10,Math.min(n,250)))&&r>o-2*1e3&&s<l+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let r of e)t.touchesRange(r.from,r.to)||n.push(new Mf(t.mapPos(r.from),t.mapPos(r.to),r.size));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,s=r>>1,o=r<<1;if(this.defaultTextDirection!=Rt.LTR&&!n)return[];let l=[],a=(u,h,f,d)=>{if(h-u<s)return;let m=this.state.selection.main,p=[m.from];m.empty||p.push(m.to);for(let v of p)if(v>u&&v<h){a(u,v-10,f,d),a(v+10,h,f,d);return}let g=K5(e,v=>v.from>=f.from&&v.to<=f.to&&Math.abs(v.from-u)<s&&Math.abs(v.to-h)<s&&!p.some(w=>v.from<w&&v.to>w));if(!g){if(h<f.to&&t&&n&&t.visibleRanges.some(v=>v.from<=h&&v.to>=h)){let v=t.moveToLineBoundary(q.cursor(h),!1,!0).head;v>u&&(h=v)}g=new Mf(u,h,this.gapSize(f,u,h,d))}l.push(g)},c=u=>{if(u.length<o||u.type!=Cn.Text)return;let h=H5(u.from,u.to,this.stateDeco);if(h.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,d,m;if(n){let p=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,g,v;if(f!=null){let w=bc(h,f),S=((this.visibleBottom-this.visibleTop)/2+p)/u.height;g=w-S,v=w+S}else g=(this.visibleTop-u.top-p)/u.height,v=(this.visibleBottom-u.top+p)/u.height;d=Oc(h,g),m=Oc(h,v)}else{let p=h.total*this.heightOracle.charWidth,g=r*this.heightOracle.charWidth,v,w;if(f!=null){let S=bc(h,f),_=((this.pixelViewport.right-this.pixelViewport.left)/2+g)/p;v=S-_,w=S+_}else v=(this.pixelViewport.left-g)/p,w=(this.pixelViewport.right+g)/p;d=Oc(h,v),m=Oc(h,w)}d>u.from&&a(u.from,d,u,h),m<u.to&&a(m,u.to,u,h)};for(let u of this.viewportLines)Array.isArray(u.type)?u.type.forEach(c):c(u);return l}gapSize(e,t,n,r){let s=bc(r,n)-bc(r,t);return this.heightOracle.lineWrapping?e.height*s:r.total*this.heightOracle.charWidth*s}updateLineGaps(e){Mf.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Qe.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];tt.spans(e,this.viewport.from,this.viewport.to,{span(r,s){t.push({from:r,to:s})},point(){}},20);let n=t.length!=this.visibleRanges.length||this.visibleRanges.some((r,s)=>r.from!=t[s].from||r.to!=t[s].to);return this.visibleRanges=t,n?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Pl(this.heightMap.lineAt(e,Et.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Pl(this.heightMap.lineAt(this.scaler.fromDOM(e),Et.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Pl(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class gc{constructor(e,t){this.from=e,this.to=t}}function H5(i,e,t){let n=[],r=i,s=0;return tt.spans(t,i,e,{span(){},point(o,l){o>r&&(n.push({from:r,to:o}),s+=o-r),r=l}},20),r<e&&(n.push({from:r,to:e}),s+=e-r),{total:s,ranges:n}}function Oc({total:i,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let n=Math.floor(i*t);for(let r=0;;r++){let{from:s,to:o}=e[r],l=o-s;if(n<=l)return s+n;n-=l}}function bc(i,e){let t=0;for(let{from:n,to:r}of i.ranges){if(e<=r){t+=e-n;break}t+=r-n}return t/i.total}function K5(i,e){for(let t of i)if(e(t))return t}const ib={toDOM(i){return i},fromDOM(i){return i},scale:1,eq(i){return i==this}};class pp{constructor(e,t,n){let r=0,s=0,o=0;this.viewports=n.map(({from:l,to:a})=>{let c=t.lineAt(l,Et.ByPos,e,0,0).top,u=t.lineAt(a,Et.ByPos,e,0,0).bottom;return r+=u-c,{from:l,to:a,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(e){for(let t=0,n=0,r=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return r+(e-n)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);n=s.bottom,r=s.domBottom}}fromDOM(e){for(let t=0,n=0,r=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return n+(e-r)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);n=s.bottom,r=s.domBottom}}eq(e){return e instanceof pp?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to):!1}}function Pl(i,e){if(e.scale==1)return i;let t=e.toDOM(i.top),n=e.toDOM(i.bottom);return new Zi(i.from,i.length,t,n-t,Array.isArray(i._content)?i._content.map(r=>Pl(r,e)):i._content)}const vc=ye.define({combine:i=>i.join(" ")}),hm=ye.define({combine:i=>i.indexOf(!0)>-1}),fm=jr.newName(),t2=jr.newName(),n2=jr.newName(),i2={"&light":"."+t2,"&dark":"."+n2};function dm(i,e,t){return new jr(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,r=>{if(r=="&")return i;if(!t||!t[r])throw new RangeError(`Unsupported selector: ${r}`);return t[r]}):i+" "+n}})}const J5=dm("."+fm,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},i2),e$={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Ef=ke.ie&&ke.ie_version<=11;class t${constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new ND,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let n of t)this.queue.push(n);(ke.ie&&ke.ie_version<=11||ke.ios&&e.composing)&&t.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&e.constructor.EDIT_CONTEXT!==!1&&!(ke.chrome&&ke.chrome_version<126)&&(this.editContext=new i$(e),e.state.facet(Dr)&&(e.contentDOM.editContext=this.editContext.editContext)),Ef&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(Dr)?n.root.activeElement!=this.dom:!jc(n.dom,r))return;let s=r.anchorNode&&n.docView.nearest(r.anchorNode);if(s&&s.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(ke.ie&&ke.ie_version<=11||ke.android&&ke.chrome)&&!n.state.selection.main.empty&&r.focusNode&&Vl(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=ua(e.root);if(!t)return!1;let n=ke.safari&&e.root.nodeType==11&&DD(this.dom.ownerDocument)==this.dom&&n$(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=jc(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&BD(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(n.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=t)n.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,e$),Ef&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Ef&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let r=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&bo(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,r=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(r=!0),t==-1?{from:t,to:n}=o:(t=Math.min(o.from,t),n=Math.max(o.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&jc(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new w5(this.view,e,t,n);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,r=zS(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),r}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let n=rb(t,e.previousSibling||e.target.previousSibling,-1),r=rb(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Dr)!=e.state.facet(Dr)&&(e.view.contentDOM.editContext=e.state.facet(Dr)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function rb(i,e,t){for(;e;){let n=St.get(e);if(n&&n.parent==i)return n;let r=e.parentNode;e=r!=i.dom?r:t>0?e.nextSibling:e.previousSibling}return null}function sb(i,e){let t=e.startContainer,n=e.startOffset,r=e.endContainer,s=e.endOffset,o=i.docView.domAtPos(i.state.selection.main.anchor);return Vl(o.node,o.offset,r,s)&&([t,n,r,s]=[r,s,t,n]),{anchorNode:t,anchorOffset:n,focusNode:r,focusOffset:s}}function n$(i,e){if(e.getComposedRanges){let r=e.getComposedRanges(i.root)[0];if(r)return sb(i,r)}let t=null;function n(r){r.preventDefault(),r.stopImmediatePropagation(),t=r.getTargetRanges()[0]}return i.contentDOM.addEventListener("beforeinput",n,!0),i.dom.ownerDocument.execCommand("indent"),i.contentDOM.removeEventListener("beforeinput",n,!0),t?sb(i,t):null}class i${constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let{anchor:r}=e.state.selection.main,s={from:this.toEditorPos(n.updateRangeStart),to:this.toEditorPos(n.updateRangeEnd),insert:at.of(n.text.split(`
`))};s.from==this.from&&r<this.from?s.from=r:s.to==this.to&&r>this.to&&(s.to=r),!(s.from==s.to&&!s.insert.length)&&(this.pendingContextChange=s,e.state.readOnly||dp(e,s,q.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd))),this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)))},this.handlers.characterboundsupdate=n=>{let r=[],s=null;for(let o=this.toEditorPos(n.rangeStart),l=this.toEditorPos(n.rangeEnd);o<l;o++){let a=e.coordsForChar(o);s=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||s||new DOMRect,r.push(s)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=n=>{let r=[];for(let s of n.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(o!="None"&&l!="None"){let a=`text-decoration: underline ${o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${l=="Thin"?1:2}px`;r.push(Qe.mark({attributes:{style:a}}).range(this.toEditorPos(s.rangeStart),this.toEditorPos(s.rangeEnd)))}}e.dispatch({effects:IS.of(Qe.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{e.inputState.composing=-1,e.inputState.compositionFirstChange=null};for(let n in this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let r=ua(n.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,c)=>{if(n)return;let u=c.length-(o-s);if(r&&o>=r.to)if(r.from==s&&r.to==o&&r.insert.eq(c)){r=this.pendingContextChange=null,t+=u,this.to+=u;return}else r=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=u,this.to+=u;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+c.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),c.toString()),this.to+=u}t+=u}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange;!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.resetRange(e.state),this.editContext.updateText(0,this.editContext.text.length,e.state.doc.sliceString(this.from,this.to)),this.setSelection(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e){return e+this.from}toContextPos(e){return e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class pe{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(r=>r.forEach(s=>n(s,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||ZD(e.parent)||document,this.viewState=new nb(e.state||et.create(e)),e.scrollTo&&e.scrollTo.is(dc)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Sl).map(r=>new xf(r));for(let r of this.plugins)r.update(this);this.observer=new t$(this),this.inputState=new C5(this),this.inputState.ensureHandlers(this.plugins),this.docView=new I0(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof Ht?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,n=!1,r,s=this.state;for(let f of e){if(f.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=f.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,a=null;e.some(f=>f.annotation(HS))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=KS(s,o),a||(l=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(u=null)):this.observer.clear(),s.facet(et.phrases)!=this.state.facet(et.phrases))return this.setState(s);r=xu.create(this,s,e),r.flags|=l;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let f of e){if(h&&(h=h.map(f.changes)),f.scrollIntoView){let{main:d}=f.state.selection;h=new vo(d.empty?d:q.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of f.effects)d.is(dc)&&(h=d.value.clip(this.state))}this.viewState.update(r,h),this.bidiCache=Qu.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),t=this.docView.update(r),this.state.facet(_l)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(vc)!=r.state.facet(vc)&&(this.viewState.mustMeasureContent=!0),(t||n||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!r.empty)for(let f of this.state.facet(lm))try{f(r)}catch(d){_n(this.state,d,"update listener")}(a||u)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),u&&!zS(this,u)&&c.force&&bo(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new nb(e),this.plugins=e.facet(Sl).map(n=>new xf(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new I0(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Sl),n=e.state.facet(Sl);if(t!=n){let r=[];for(let s of n){let o=t.indexOf(s);if(o<0)r.push(new xf(s));else{let l=this.plugins[o];l.mustUpdate=e,r.push(l)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=e;for(let r=0;r<this.plugins.length;r++)this.plugins[r].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(n){_n(this.state,n,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,r=n.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(hS(n))s=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(r);s=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];a&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(d=>{try{return d.read(this)}catch(m){return _n(this.state,m),ob}}),h=xu.create(this,this.state,[]),f=!1;h.flags|=a,t?t.flags|=a:t=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),f=this.docView.update(h),f&&this.docViewUpdate());for(let d=0;d<c.length;d++)if(u[d]!=ob)try{let m=c[d];m.write&&m.write(u[d],this)}catch(m){_n(this.state,m)}if(f&&this.docView.updateSelection(!0),!h.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let m=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o;if(m>1||m<-1){r=r+m,n.scrollTop=r/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(lm))l(t)}get themeClasses(){return fm+" "+(this.state.facet(hm)?n2:t2)+" "+this.state.facet(vc)}updateAttrs(){let e=lb(this,NS,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Dr)?"true":"false",class:"cm-content",style:`${ke.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),lb(this,hp,t);let n=this.observer.ignore(()=>{let r=tm(this.contentDOM,this.contentAttrs,t),s=tm(this.dom,this.editorAttrs,e);return r||s});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let r of n.effects)if(r.is(pe.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(_l);let e=this.state.facet(pe.cspNonce);jr.mount(this.root,this.styleModules.concat(J5).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.spec!=e)&&this.pluginMap.set(e,t=this.plugins.find(n=>n.spec==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return Qf(this,e,X0(this,e,t,n))}moveByGroup(e,t){return Qf(this,e,X0(this,e,t,n=>g5(this,e.head,n)))}visualLineSide(e,t){let n=this.bidiSpans(e),r=this.textDirectionAt(e.from),s=n[t?n.length-1:0];return q.cursor(s.side(t,r)+e.from,s.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,n=!0){return p5(this,e,t,n)}moveVertically(e,t,n){return Qf(this,e,O5(this,e,t,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),YS(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let r=this.state.doc.lineAt(e),s=this.bidiSpans(r),o=s[Zr.find(s,e-r.from,-1,t)];return hh(n,o.dir==Rt.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(DS)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>r$)return PS(e.length);let t=this.textDirectionAt(e.from),n;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||CS(s.isolates,n=L0(this,e))))return s.order;n||(n=L0(this,e));let r=JD(e.text,t,n);return this.bidiCache.push(new Qu(e.from,e.to,t,n,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||ke.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{cS(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return dc.of(new vo(typeof e=="number"?q.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return dc.of(new vo(q.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Vt.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Vt.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=jr.newName(),r=[vc.of(n),_l.of(dm(`.${n}`,e))];return t&&t.dark&&r.push(hm.of(!0)),r}static baseTheme(e){return gr.lowest(_l.of(dm("."+fm,e,i2)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),r=n&&St.get(n)||St.get(e);return((t=r==null?void 0:r.rootView)===null||t===void 0?void 0:t.view)||null}}pe.styleModule=_l;pe.inputHandler=ES;pe.scrollHandler=LS;pe.focusChangeEffect=RS;pe.perLineTextDirection=DS;pe.exceptionSink=MS;pe.updateListener=lm;pe.editable=Dr;pe.mouseSelectionStyle=QS;pe.dragMovesSelection=TS;pe.clickAddsSelectionRange=xS;pe.decorations=fa;pe.outerDecorations=ZS;pe.atomicRanges=fp;pe.bidiIsolatedRanges=BS;pe.scrollMargins=WS;pe.darkTheme=hm;pe.cspNonce=ye.define({combine:i=>i.length?i[0]:""});pe.contentAttributes=hp;pe.editorAttributes=NS;pe.lineWrapping=pe.contentAttributes.of({class:"cm-lineWrapping"});pe.announce=Fe.define();const r$=4096,ob={};class Qu{constructor(e,t,n,r,s,o){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=s,this.order=o}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let n=[],r=e.length?e[e.length-1].dir:Rt.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==r&&!t.touchesRange(o.from,o.to)&&n.push(new Qu(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function lb(i,e,t){for(let n=i.state.facet(e),r=n.length-1;r>=0;r--){let s=n[r],o=typeof s=="function"?s(i):s;o&&em(o,t)}return t}const s$=ke.mac?"mac":ke.windows?"win":ke.linux?"linux":"key";function o$(i,e){const t=i.split(/-(?!$)/);let n=t[t.length-1];n=="Space"&&(n=" ");let r,s,o,l;for(let a=0;a<t.length-1;++a){const c=t[a];if(/^(cmd|meta|m)$/i.test(c))l=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?l=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),l&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function wc(i,e,t){return e.altKey&&(i="Alt-"+i),e.ctrlKey&&(i="Ctrl-"+i),e.metaKey&&(i="Meta-"+i),t!==!1&&e.shiftKey&&(i="Shift-"+i),i}const l$=gr.default(pe.domEventHandlers({keydown(i,e){return s2(r2(e.state),i,e,"editor")}})),Ws=ye.define({enables:l$}),ab=new WeakMap;function r2(i){let e=i.facet(Ws),t=ab.get(e);return t||ab.set(e,t=u$(e.reduce((n,r)=>n.concat(r),[]))),t}function a$(i,e,t){return s2(r2(i.state),e,i,t)}let $r=null;const c$=4e3;function u$(i,e=s$){let t=Object.create(null),n=Object.create(null),r=(o,l)=>{let a=n[o];if(a==null)n[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,l,a,c,u)=>{var h,f;let d=t[o]||(t[o]=Object.create(null)),m=l.split(/ (?!$)/).map(v=>o$(v,e));for(let v=1;v<m.length;v++){let w=m.slice(0,v).join(" ");r(w,!0),d[w]||(d[w]={preventDefault:!0,stopPropagation:!1,run:[S=>{let _=$r={view:S,prefix:w,scope:o};return setTimeout(()=>{$r==_&&($r=null)},c$),!0}]})}let p=m.join(" ");r(p,!1);let g=d[p]||(d[p]={preventDefault:!1,stopPropagation:!1,run:((f=(h=d._any)===null||h===void 0?void 0:h.run)===null||f===void 0?void 0:f.slice())||[]});a&&g.run.push(a),c&&(g.preventDefault=!0),u&&(g.stopPropagation=!0)};for(let o of i){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of l){let u=t[c]||(t[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:h}=o;for(let f in u)u[f].run.push(d=>h(d,mm))}let a=o[e]||o.key;if(a)for(let c of l)s(c,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(c,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return t}let mm=null;function s2(i,e,t,n){mm=e;let r=RD(e),s=ln(r,0),o=oi(s)==r.length&&r!=" ",l="",a=!1,c=!1,u=!1;$r&&$r.view==t&&$r.scope==n&&(l=$r.prefix+" ",US.indexOf(e.keyCode)<0&&(c=!0,$r=null));let h=new Set,f=g=>{if(g){for(let v of g.run)if(!h.has(v)&&(h.add(v),v(t)))return g.stopPropagation&&(u=!0),!0;g.preventDefault&&(g.stopPropagation&&(u=!0),c=!0)}return!1},d=i[n],m,p;return d&&(f(d[l+wc(r,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(ke.windows&&e.ctrlKey&&e.altKey)&&(m=qr[e.keyCode])&&m!=r?(f(d[l+wc(m,e,!0)])||e.shiftKey&&(p=ca[e.keyCode])!=r&&p!=m&&f(d[l+wc(p,e,!1)]))&&(a=!0):o&&e.shiftKey&&f(d[l+wc(r,e,!0)])&&(a=!0),!a&&f(d._any)&&(a=!0)),c&&(a=!0),a&&u&&e.stopPropagation(),mm=null,a}class Na{constructor(e,t,n,r,s){this.className=e,this.left=t,this.top=n,this.width=r,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(n.empty){let r=e.coordsAtPos(n.head,n.assoc||1);if(!r)return[];let s=o2(e);return[new Na(t,r.left-s.left,r.top-s.top,null,r.bottom-r.top)]}else return h$(e,t,n)}}function o2(i){let e=i.scrollDOM.getBoundingClientRect();return{left:(i.textDirection==Rt.LTR?e.left:e.right-i.scrollDOM.clientWidth*i.scaleX)-i.scrollDOM.scrollLeft*i.scaleX,top:e.top-i.scrollDOM.scrollTop*i.scaleY}}function cb(i,e,t,n){let r=i.coordsAtPos(e,t*2);if(!r)return n;let s=i.dom.getBoundingClientRect(),o=(r.top+r.bottom)/2,l=i.posAtCoords({x:s.left+1,y:o}),a=i.posAtCoords({x:s.right-1,y:o});return l==null||a==null?n:{from:Math.max(n.from,Math.min(l,a)),to:Math.min(n.to,Math.max(l,a))}}function h$(i,e,t){if(t.to<=i.viewport.from||t.from>=i.viewport.to)return[];let n=Math.max(t.from,i.viewport.from),r=Math.min(t.to,i.viewport.to),s=i.textDirection==Rt.LTR,o=i.contentDOM,l=o.getBoundingClientRect(),a=o2(i),c=o.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),h=l.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),f=l.right-(u?parseInt(u.paddingRight):0),d=cm(i,n),m=cm(i,r),p=d.type==Cn.Text?d:null,g=m.type==Cn.Text?m:null;if(p&&(i.lineWrapping||d.widgetLineBreaks)&&(p=cb(i,n,1,p)),g&&(i.lineWrapping||m.widgetLineBreaks)&&(g=cb(i,r,-1,g)),p&&g&&p.from==g.from&&p.to==g.to)return w(S(t.from,t.to,p));{let k=p?S(t.from,null,p):_(d,!1),A=g?S(null,t.to,g):_(m,!0),C=[];return(p||d).to<(g||m).from-(p&&g?1:0)||d.widgetLineBreaks>1&&k.bottom+i.defaultLineHeight/2<A.top?C.push(v(h,k.bottom,f,A.top)):k.bottom<A.top&&i.elementAtHeight((k.bottom+A.top)/2).type==Cn.Text&&(k.bottom=A.top=(k.bottom+A.top)/2),w(k).concat(C).concat(w(A))}function v(k,A,C,Q){return new Na(e,k-a.left,A-a.top-.01,C-k,Q-A+.01)}function w({top:k,bottom:A,horizontal:C}){let Q=[];for(let M=0;M<C.length;M+=2)Q.push(v(C[M],k,C[M+1],A));return Q}function S(k,A,C){let Q=1e9,M=-1e9,L=[];function N(te,ie,ae,X,ee){let Te=i.coordsAtPos(te,te==C.to?-2:2),ve=i.coordsAtPos(ae,ae==C.from?2:-2);!Te||!ve||(Q=Math.min(Te.top,ve.top,Q),M=Math.max(Te.bottom,ve.bottom,M),ee==Rt.LTR?L.push(s&&ie?h:Te.left,s&&X?f:ve.right):L.push(!s&&X?h:ve.left,!s&&ie?f:Te.right))}let B=k??C.from,J=A??C.to;for(let te of i.visibleRanges)if(te.to>B&&te.from<J)for(let ie=Math.max(te.from,B),ae=Math.min(te.to,J);;){let X=i.state.doc.lineAt(ie);for(let ee of i.bidiSpans(X)){let Te=ee.from+X.from,ve=ee.to+X.from;if(Te>=ae)break;ve>ie&&N(Math.max(Te,ie),k==null&&Te<=B,Math.min(ve,ae),A==null&&ve>=J,ee.dir)}if(ie=X.to+1,ie>=ae)break}return L.length==0&&N(B,k==null,J,A==null,i.textDirection),{top:Q,bottom:M,horizontal:L}}function _(k,A){let C=l.top+(A?k.top:k.bottom);return{top:C,bottom:C,horizontal:[]}}}function f$(i,e){return i.constructor==e.constructor&&i.eq(e)}class d${constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Hc)!=e.state.facet(Hc)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(Hc);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,n)=>!f$(t,this.drawn[n]))){let t=this.dom.firstChild,n=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[n].constructor&&r.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(r.draw(),t);for(;t;){let r=t.nextSibling;t.remove(),t=r}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Hc=ye.define();function l2(i){return[Vt.define(e=>new d$(e,i)),Hc.of(i)]}const a2=!ke.ios,da=ye.define({combine(i){return Qi(i,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function m$(i={}){return[da.of(i),p$,g$,O$,$S.of(!0)]}function c2(i){return i.startState.facet(da)!=i.state.facet(da)}const p$=l2({above:!0,markers(i){let{state:e}=i,t=e.facet(da),n=[];for(let r of e.selection.ranges){let s=r==e.selection.main;if(r.empty?!s||a2:t.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=r.empty?r:q.cursor(r.head,r.head>r.anchor?-1:1);for(let a of Na.forRange(i,o,l))n.push(a)}}return n},update(i,e){i.transactions.some(n=>n.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=c2(i);return t&&ub(i.state,e),i.docChanged||i.selectionSet||t},mount(i,e){ub(e.state,i)},class:"cm-cursorLayer"});function ub(i,e){e.style.animationDuration=i.facet(da).cursorBlinkRate+"ms"}const g$=l2({above:!1,markers(i){return i.state.selection.ranges.map(e=>e.empty?[]:Na.forRange(i,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(i,e){return i.docChanged||i.selectionSet||i.viewportChanged||c2(i)},class:"cm-selectionLayer"}),pm={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};a2&&(pm[".cm-line"].caretColor=pm[".cm-content"].caretColor="transparent !important");const O$=gr.highest(pe.theme(pm)),u2=Fe.define({map(i,e){return i==null?null:e.mapPos(i)}}),Al=Jt.define({create(){return null},update(i,e){return i!=null&&(i=e.changes.mapPos(i)),e.effects.reduce((t,n)=>n.is(u2)?n.value:t,i)}}),b$=Vt.fromClass(class{constructor(i){this.view=i,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(i){var e;let t=i.state.field(Al);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(i.startState.field(Al)!=t||i.docChanged||i.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:i}=this,e=i.state.field(Al),t=e!=null&&i.coordsAtPos(e);if(!t)return null;let n=i.scrollDOM.getBoundingClientRect();return{left:t.left-n.left+i.scrollDOM.scrollLeft*i.scaleX,top:t.top-n.top+i.scrollDOM.scrollTop*i.scaleY,height:t.bottom-t.top}}drawCursor(i){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;i?(this.cursor.style.left=i.left/e+"px",this.cursor.style.top=i.top/t+"px",this.cursor.style.height=i.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(i){this.view.state.field(Al)!=i&&this.view.dispatch({effects:u2.of(i)})}},{eventObservers:{dragover(i){this.setDropPos(this.view.posAtCoords({x:i.clientX,y:i.clientY}))},dragleave(i){(i.target==this.view.contentDOM||!this.view.contentDOM.contains(i.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function v$(){return[Al,b$]}function hb(i,e,t,n,r){e.lastIndex=0;for(let s=i.iterRange(t,n),o=t,l;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;l=e.exec(s.value);)r(o+l.index,l)}function w$(i,e){let t=i.visibleRanges;if(t.length==1&&t[0].from==i.viewport.from&&t[0].to==i.viewport.to)return t;let n=[];for(let{from:r,to:s}of t)r=Math.max(i.state.doc.lineAt(r).from,r-e),s=Math.min(i.state.doc.lineAt(s).to,s+e),n.length&&n[n.length-1].to>=r?n[n.length-1].to=s:n.push({from:r,to:s});return n}class y${constructor(e){const{regexp:t,decoration:n,decorate:r,boundary:s,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,r)this.addMatch=(l,a,c,u)=>r(u,c,c+l[0].length,l,a);else if(typeof n=="function")this.addMatch=(l,a,c,u)=>{let h=n(l,a,c);h&&u(c,c+l[0].length,h)};else if(n)this.addMatch=(l,a,c,u)=>u(c,c+l[0].length,n);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let t=new Ur,n=t.add.bind(t);for(let{from:r,to:s}of w$(e,this.maxLength))hb(e.state.doc,this.regexp,r,s,(o,l)=>this.addMatch(l,e,o,n));return t.finish()}updateDeco(e,t){let n=1e9,r=-1;return e.docChanged&&e.changes.iterChanges((s,o,l,a)=>{a>e.view.viewport.from&&l<e.view.viewport.to&&(n=Math.min(l,n),r=Math.max(a,r))}),e.viewportChanged||r-n>1e3?this.createDeco(e.view):r>-1?this.updateRange(e.view,t.map(e.changes),n,r):t}updateRange(e,t,n,r){for(let s of e.visibleRanges){let o=Math.max(s.from,n),l=Math.min(s.to,r);if(l>o){let a=e.state.doc.lineAt(o),c=a.to<l?e.state.doc.lineAt(l):a,u=Math.max(s.from,a.from),h=Math.min(s.to,c.to);if(this.boundary){for(;o>a.from;o--)if(this.boundary.test(a.text[o-1-a.from])){u=o;break}for(;l<c.to;l++)if(this.boundary.test(c.text[l-c.from])){h=l;break}}let f=[],d,m=(p,g,v)=>f.push(v.range(p,g));if(a==c)for(this.regexp.lastIndex=u-a.from;(d=this.regexp.exec(a.text))&&d.index<h-a.from;)this.addMatch(d,e,d.index+a.from,m);else hb(e.state.doc,this.regexp,u,h,(p,g)=>this.addMatch(g,e,p,m));t=t.update({filterFrom:u,filterTo:h,filter:(p,g)=>p<u||g>h,add:f})}}return t}}const gm=/x/.unicode!=null?"gu":"g",k$=new RegExp(`[\0-\b
--Ÿ­؜\u2028\u2029\uFEFF-]`,gm),S$={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Rf=null;function _$(){var i;if(Rf==null&&typeof document<"u"&&document.body){let e=document.body.style;Rf=((i=e.tabSize)!==null&&i!==void 0?i:e.MozTabSize)!=null}return Rf||!1}const Kc=ye.define({combine(i){let e=Qi(i,{render:null,specialChars:k$,addSpecialChars:null});return(e.replaceTabs=!_$())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,gm)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,gm)),e}});function C$(i={}){return[Kc.of(i),P$()]}let fb=null;function P$(){return fb||(fb=Vt.fromClass(class{constructor(i){this.view=i,this.decorations=Qe.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(i.state.facet(Kc)),this.decorations=this.decorator.createDeco(i)}makeDecorator(i){return new y$({regexp:i.specialChars,decoration:(e,t,n)=>{let{doc:r}=t.state,s=ln(e[0],0);if(s==9){let o=r.lineAt(n),l=t.state.tabSize,a=Ci(o.text,l,n-o.from);return Qe.replace({widget:new Q$((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Qe.replace({widget:new T$(i,s)}))},boundary:i.replaceTabs?void 0:/[^]/})}update(i){let e=i.state.facet(Kc);i.startState.facet(Kc)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(i.view)):this.decorations=this.decorator.updateDeco(i,this.decorations)}},{decorations:i=>i.decorations}))}const A$="•";function x$(i){return i>=32?A$:i==10?"␤":String.fromCharCode(9216+i)}class T$ extends br{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=x$(this.code),n=e.state.phrase("Control character")+" "+(S$[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,t);if(r)return r;let s=document.createElement("span");return s.textContent=t,s.title=n,s.setAttribute("aria-label",n),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class Q$ extends br{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function M$(){return R$}const E$=Qe.line({class:"cm-activeLine"}),R$=Vt.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.docChanged||i.selectionSet)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=-1,t=[];for(let n of i.state.selection.ranges){let r=i.lineBlockAt(n.head);r.from>e&&(t.push(E$.range(r.from)),e=r.from)}return Qe.set(t)}},{decorations:i=>i.decorations}),Om=2e3;function D$(i,e,t){let n=Math.min(e.line,t.line),r=Math.max(e.line,t.line),s=[];if(e.off>Om||t.off>Om||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let a=n;a<=r;a++){let c=i.doc.line(a);c.length<=l&&s.push(q.range(c.from+o,c.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let a=n;a<=r;a++){let c=i.doc.line(a),u=Ud(c.text,o,i.tabSize,!0);if(u<0)s.push(q.cursor(c.to));else{let h=Ud(c.text,l,i.tabSize);s.push(q.range(c.from+u,c.from+h))}}}return s}function $$(i,e){let t=i.coordsAtPos(i.viewport.from);return t?Math.round(Math.abs((t.left-e)/i.defaultCharacterWidth)):-1}function db(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},!1),n=i.state.doc.lineAt(t),r=t-n.from,s=r>Om?-1:r==n.length?$$(i,e.clientX):Ci(n.text,i.state.tabSize,t-n.from);return{line:n.number,col:s,off:r}}function L$(i,e){let t=db(i,e),n=i.state.selection;return t?{update(r){if(r.docChanged){let s=r.changes.mapPos(r.startState.doc.line(t.line).from),o=r.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},n=n.map(r.changes)}},get(r,s,o){let l=db(i,r);if(!l)return n;let a=D$(i.state,t,l);return a.length?o?q.create(a.concat(n.ranges)):q.create(a):n}}:null}function I$(i){let e=t=>t.altKey&&t.button==0;return pe.mouseSelectionStyle.of((t,n)=>e(n)?L$(t,n):null)}const N$={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},Z$={style:"cursor: crosshair"};function B$(i={}){let[e,t]=N$[i.key||"Alt"],n=Vt.fromClass(class{constructor(r){this.view=r,this.isDown=!1}set(r){this.isDown!=r&&(this.isDown=r,this.view.update([]))}},{eventObservers:{keydown(r){this.set(r.keyCode==e||t(r))},keyup(r){(r.keyCode==e||!t(r))&&this.set(!1)},mousemove(r){this.set(t(r))}}});return[n,pe.contentAttributes.of(r=>{var s;return!((s=r.plugin(n))===null||s===void 0)&&s.isDown?Z$:null})]}const fl="-10000px";class h2{constructor(e,t,n,r){this.facet=t,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=n(o,s))}update(e,t){var n;let r=e.state.facet(this.facet),s=r.filter(a=>a);if(r===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=t?[]:null;for(let a=0;a<s.length;a++){let c=s[a],u=-1;if(c){for(let h=0;h<this.tooltips.length;h++){let f=this.tooltips[h];f&&f.create==c.create&&(u=h)}if(u<0)o[a]=this.createTooltipView(c,a?o[a-1]:null),l&&(l[a]=!!c.above);else{let h=o[a]=this.tooltipViews[u];l&&(l[a]=t[u]),h.update&&h.update(e)}}}for(let a of this.tooltipViews)o.indexOf(a)<0&&(this.removeTooltipView(a),(n=a.destroy)===null||n===void 0||n.call(a));return t&&(l.forEach((a,c)=>t[c]=a),t.length=l.length),this.input=r,this.tooltips=s,this.tooltipViews=o,!0}}function W$(i){let{win:e}=i;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const Df=ye.define({combine:i=>{var e,t,n;return{position:ke.ios?"absolute":((e=i.find(r=>r.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=i.find(r=>r.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((n=i.find(r=>r.tooltipSpace))===null||n===void 0?void 0:n.tooltipSpace)||W$}}}),mb=new WeakMap,gp=Vt.fromClass(class{constructor(i){this.view=i,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=i.state.facet(Df);this.position=e.position,this.parent=e.parent,this.classes=i.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new h2(i,dh,(t,n)=>this.createTooltip(t,n),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),i.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let i of this.manager.tooltipViews)this.intersectionObserver.observe(i.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(i){i.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(i,this.above);e&&this.observeIntersection();let t=e||i.geometryChanged,n=i.state.facet(Df);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;t=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(i,e){let t=i.create(this.view),n=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),i.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",t.dom.appendChild(r)}return t.dom.style.position=this.position,t.dom.style.top=fl,t.dom.style.left="0px",this.container.insertBefore(t.dom,n),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var i,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let n of this.manager.tooltipViews)n.dom.remove(),(i=n.destroy)===null||i===void 0||i.call(n);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let i=this.view.dom.getBoundingClientRect(),e=1,t=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:r}=this.manager.tooltipViews[0];if(ke.gecko)n=r.offsetParent!=this.container.ownerDocument.body;else if(r.style.top==fl&&r.style.left=="0px"){let s=r.getBoundingClientRect();n=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}}if(n||this.position=="absolute")if(this.parent){let r=this.parent.getBoundingClientRect();r.width&&r.height&&(e=r.width/this.parent.offsetWidth,t=r.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);return{editor:i,parent:this.parent?this.container.getBoundingClientRect():i,pos:this.manager.tooltips.map((r,s)=>{let o=this.manager.tooltipViews[s];return o.getCoords?o.getCoords(r.pos):this.view.coordsAtPos(r.pos)}),size:this.manager.tooltipViews.map(({dom:r})=>r.getBoundingClientRect()),space:this.view.state.facet(Df).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(i){var e;if(i.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{editor:t,space:n,scaleX:r,scaleY:s}=i,o=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],c=this.manager.tooltipViews[l],{dom:u}=c,h=i.pos[l],f=i.size[l];if(!h||h.bottom<=Math.max(t.top,n.top)||h.top>=Math.min(t.bottom,n.bottom)||h.right<Math.max(t.left,n.left)-.1||h.left>Math.min(t.right,n.right)+.1){u.style.top=fl;continue}let d=a.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,m=d?7:0,p=f.right-f.left,g=(e=mb.get(c))!==null&&e!==void 0?e:f.bottom-f.top,v=c.offset||F$,w=this.view.textDirection==Rt.LTR,S=f.width>n.right-n.left?w?n.left:n.right-f.width:w?Math.max(n.left,Math.min(h.left-(d?14:0)+v.x,n.right-p)):Math.min(Math.max(n.left,h.left-p+(d?14:0)-v.x),n.right-p),_=this.above[l];!a.strictSide&&(_?h.top-(f.bottom-f.top)-v.y<n.top:h.bottom+(f.bottom-f.top)+v.y>n.bottom)&&_==n.bottom-h.bottom>h.top-n.top&&(_=this.above[l]=!_);let k=(_?h.top-n.top:n.bottom-h.bottom)-m;if(k<g&&c.resize!==!1){if(k<this.view.defaultLineHeight){u.style.top=fl;continue}mb.set(c,g),u.style.height=(g=k)/s+"px"}else u.style.height&&(u.style.height="");let A=_?h.top-g-m-v.y:h.bottom+m+v.y,C=S+p;if(c.overlap!==!0)for(let Q of o)Q.left<C&&Q.right>S&&Q.top<A+g&&Q.bottom>A&&(A=_?Q.top-g-2-m:Q.bottom+m+2);if(this.position=="absolute"?(u.style.top=(A-i.parent.top)/s+"px",u.style.left=(S-i.parent.left)/r+"px"):(u.style.top=A/s+"px",u.style.left=S/r+"px"),d){let Q=h.left+(w?v.x:-v.x)-(S+14-7);d.style.left=Q/r+"px"}c.overlap!==!0&&o.push({left:S,top:A,right:C,bottom:A+g}),u.classList.toggle("cm-tooltip-above",_),u.classList.toggle("cm-tooltip-below",!_),c.positioned&&c.positioned(i.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let i of this.manager.tooltipViews)i.dom.style.top=fl}},{eventObservers:{scroll(){this.maybeMeasure()}}}),X$=pe.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),F$={x:0,y:0},dh=ye.define({enables:[gp,X$]}),Mu=ye.define({combine:i=>i.reduce((e,t)=>e.concat(t),[])});class mh{static create(e){return new mh(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new h2(e,Mu,(t,n)=>this.createHostedView(t,n),t=>t.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let r=n[e];if(r!==void 0){if(t===void 0)t=r;else if(t!==r)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const Y$=dh.compute([Mu],i=>{let e=i.facet(Mu);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var n;return(n=t.end)!==null&&n!==void 0?n:t.pos})),create:mh.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class z${constructor(e,t,n,r,s){this.view=e,this.source=t,this.field=n,this.setHover=r,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.nearest(t.target);if(!n)return;let r,s=1;if(n instanceof Nr)r=n.posAtStart;else{if(r=e.posAtCoords(t),r==null)return;let l=e.coordsAtPos(r);if(!l||t.y<l.top||t.y>l.bottom||t.x<l.left-e.defaultCharacterWidth||t.x>l.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(r)).find(u=>u.from<=r&&u.to>=r),c=a&&a.dir==Rt.RTL?-1:1;s=t.x<l.left?-c:c}let o=this.source(e,r,s);if(o!=null&&o.then){let l=this.pending={pos:r};o.then(a=>{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>_n(e.state,a,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(gp),t=e?e.manager.tooltips.findIndex(n=>n.create==mh.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:r,tooltip:s}=this;if(r.length&&s&&!V$(s.dom,e)||this.pending){let{pos:o}=r[0]||this.pending,l=(n=(t=r[0])===null||t===void 0?void 0:t.end)!==null&&n!==void 0?n:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!U$(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:n}=this;n&&n.dom.contains(e.relatedTarget)?this.watchTooltipLeave(n.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const yc=4;function V$(i,e){let t=i.getBoundingClientRect();return e.clientX>=t.left-yc&&e.clientX<=t.right+yc&&e.clientY>=t.top-yc&&e.clientY<=t.bottom+yc}function U$(i,e,t,n,r,s){let o=i.scrollDOM.getBoundingClientRect(),l=i.documentTop+i.documentPadding.top+i.contentHeight;if(o.left>n||o.right<n||o.top>r||Math.min(o.bottom,l)<r)return!1;let a=i.posAtCoords({x:n,y:r},!1);return a>=e&&a<=t}function j$(i,e={}){let t=Fe.define(),n=Jt.define({create(){return[]},update(r,s){if(r.length&&(e.hideOnChange&&(s.docChanged||s.selection)?r=[]:e.hideOn&&(r=r.filter(o=>!e.hideOn(s,o))),s.docChanged)){let o=[];for(let l of r){let a=s.changes.mapPos(l.pos,-1,cn.TrackDel);if(a!=null){let c=Object.assign(Object.create(null),l);c.pos=a,c.end!=null&&(c.end=s.changes.mapPos(c.end)),o.push(c)}}r=o}for(let o of s.effects)o.is(t)&&(r=o.value),o.is(q$)&&(r=[]);return r},provide:r=>Mu.from(r)});return{active:n,extension:[n,Vt.define(r=>new z$(r,i,n,t,e.hoverTime||300)),Y$]}}function f2(i,e){let t=i.plugin(gp);if(!t)return null;let n=t.manager.tooltips.indexOf(e);return n<0?null:t.manager.tooltipViews[n]}const q$=Fe.define(),pb=ye.define({combine(i){let e,t;for(let n of i)e=e||n.topContainer,t=t||n.bottomContainer;return{topContainer:e,bottomContainer:t}}});function ma(i,e){let t=i.plugin(d2),n=t?t.specs.indexOf(e):-1;return n>-1?t.panels[n]:null}const d2=Vt.fromClass(class{constructor(i){this.input=i.state.facet(pa),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(i));let e=i.state.facet(pb);this.top=new kc(i,!0,e.topContainer),this.bottom=new kc(i,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(i){let e=i.state.facet(pb);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new kc(i.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new kc(i.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=i.state.facet(pa);if(t!=this.input){let n=t.filter(a=>a),r=[],s=[],o=[],l=[];for(let a of n){let c=this.specs.indexOf(a),u;c<0?(u=a(i.view),l.push(u)):(u=this.panels[c],u.update&&u.update(i)),r.push(u),(u.top?s:o).push(u)}this.specs=n,this.panels=r,this.top.sync(s),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let n of this.panels)n.update&&n.update(i)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:i=>pe.scrollMargins.of(e=>{let t=e.plugin(i);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class kc{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=gb(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=gb(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function gb(i){let e=i.nextSibling;return i.remove(),e}const pa=ye.define({enables:d2});class Ki extends Ms{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Ki.prototype.elementClass="";Ki.prototype.toDOM=void 0;Ki.prototype.mapMode=cn.TrackBefore;Ki.prototype.startSide=Ki.prototype.endSide=-1;Ki.prototype.point=!0;const Jc=ye.define(),G$=ye.define(),H$={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>tt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},jl=ye.define();function m2(i){return[p2(),jl.of(Object.assign(Object.assign({},H$),i))]}const Ob=ye.define({combine:i=>i.some(e=>e)});function p2(i){return[K$]}const K$=Vt.fromClass(class{constructor(i){this.view=i,this.prevViewport=i.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=i.state.facet(jl).map(e=>new vb(i,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!i.state.facet(Ob),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),i.scrollDOM.insertBefore(this.dom,i.contentDOM)}update(i){if(this.updateGutters(i)){let e=this.prevViewport,t=i.view.viewport,n=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(n<(t.to-t.from)*.8)}i.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(Ob)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=i.view.viewport}syncGutters(i){let e=this.dom.nextSibling;i&&this.dom.remove();let t=tt.iter(this.view.state.facet(Jc),this.view.viewport.from),n=[],r=this.gutters.map(s=>new J$(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(s.type)){let o=!0;for(let l of s.type)if(l.type==Cn.Text&&o){bm(t,n,l.from);for(let a of r)a.line(this.view,l,n);o=!1}else if(l.widget)for(let a of r)a.widget(this.view,l)}else if(s.type==Cn.Text){bm(t,n,s.from);for(let o of r)o.line(this.view,s,n)}else if(s.widget)for(let o of r)o.widget(this.view,s);for(let s of r)s.finish();i&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(i){let e=i.startState.facet(jl),t=i.state.facet(jl),n=i.docChanged||i.heightChanged||i.viewportChanged||!tt.eq(i.startState.facet(Jc),i.state.facet(Jc),i.view.viewport.from,i.view.viewport.to);if(e==t)for(let r of this.gutters)r.update(i)&&(n=!0);else{n=!0;let r=[];for(let s of t){let o=e.indexOf(s);o<0?r.push(new vb(this.view,s)):(this.gutters[o].update(i),r.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),r.indexOf(s)<0&&s.destroy();for(let s of r)this.dom.appendChild(s.dom);this.gutters=r}return n}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove()}},{provide:i=>pe.scrollMargins.of(e=>{let t=e.plugin(i);return!t||t.gutters.length==0||!t.fixed?null:e.textDirection==Rt.LTR?{left:t.dom.offsetWidth*e.scaleX}:{right:t.dom.offsetWidth*e.scaleX}})});function bb(i){return Array.isArray(i)?i:[i]}function bm(i,e,t){for(;i.value&&i.from<=t;)i.from==t&&e.push(i.value),i.next()}class J${constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=tt.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:r}=this,s=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==r.elements.length){let l=new g2(e,o,s,n);r.elements.push(l),r.dom.appendChild(l.dom)}else r.elements[this.i].update(e,o,s,n);this.height=t.bottom,this.i++}line(e,t,n){let r=[];bm(this.cursor,r,t.from),n.length&&(r=r.concat(n));let s=this.gutter.config.lineMarker(e,t,r);s&&r.unshift(s);let o=this.gutter;r.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,r)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),r=n?[n]:null;for(let s of e.state.facet(G$)){let o=s(e,t.widget,t);o&&(r||(r=[])).push(o)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class vb{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,r=>{let s=r.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let a=s.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=r.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[n](e,l,r)&&r.preventDefault()});this.markers=bb(t.markers(e)),t.initialSpacer&&(this.spacer=new g2(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=bb(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],e);r!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[r])}let n=e.view.viewport;return!tt.eq(this.markers,t,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class g2{constructor(e,t,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,r)}update(e,t,n,r){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),eL(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,t){let n="cm-gutterElement",r=this.dom.firstChild;for(let s=0,o=0;;){let l=o,a=s<t.length?t[s++]:null,c=!1;if(a){let u=a.elementClass;u&&(n+=" "+u);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(a)){l=h,c=!0;break}}else l=this.markers.length;for(;o<l;){let u=this.markers[o++];if(u.toDOM){u.destroy(r);let h=r.nextSibling;r.remove(),r=h}}if(!a)break;a.toDOM&&(c?r=r.nextSibling:this.dom.insertBefore(a.toDOM(e),r)),c&&o++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}function eL(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++)if(!i[t].compare(e[t]))return!1;return!0}const tL=ye.define(),nL=ye.define(),so=ye.define({combine(i){return Qi(i,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let r in t){let s=n[r],o=t[r];n[r]=s?(l,a,c)=>s(l,a,c)||o(l,a,c):o}return n}})}});class $f extends Ki{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Lf(i,e){return i.state.facet(so).formatNumber(e,i.state)}const iL=jl.compute([so],i=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(tL)},lineMarker(e,t,n){return n.some(r=>r.toDOM)?null:new $f(Lf(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,n)=>{for(let r of e.state.facet(nL)){let s=r(e,t,n);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(so)!=e.state.facet(so),initialSpacer(e){return new $f(Lf(e,wb(e.state.doc.lines)))},updateSpacer(e,t){let n=Lf(t.view,wb(t.view.state.doc.lines));return n==e.number?e:new $f(n)},domEventHandlers:i.facet(so).domEventHandlers}));function rL(i={}){return[so.of(i),p2(),iL]}function wb(i){let e=9;for(;e<i;)e=e*10+9;return e}const sL=new class extends Ki{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},oL=Jc.compute(["selection"],i=>{let e=[],t=-1;for(let n of i.selection.ranges){let r=i.doc.lineAt(n.head).from;r>t&&(t=r,e.push(sL.range(r)))}return tt.of(e)});function lL(){return oL}const O2=1024;let aL=0;class li{constructor(e,t){this.from=e,this.to=t}}class Ze{constructor(e={}){this.id=aL++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=tn.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}Ze.closedBy=new Ze({deserialize:i=>i.split(" ")});Ze.openedBy=new Ze({deserialize:i=>i.split(" ")});Ze.group=new Ze({deserialize:i=>i.split(" ")});Ze.isolate=new Ze({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}});Ze.contextHash=new Ze({perNode:!0});Ze.lookAhead=new Ze({perNode:!0});Ze.mounted=new Ze({perNode:!0});class ga{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[Ze.mounted.id]}}const cL=Object.create(null);class tn{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):cL,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new tn(e.name||"",t,e.id,n);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(r)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(Ze.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return n=>{for(let r=n.prop(Ze.group),s=-1;s<(r?r.length:0);s++){let o=t[s<0?n.name:r[s]];if(o)return o}}}}tn.none=new tn("",Object.create(null),0,8);class Za{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let r=null;for(let s of e){let o=s(n);o&&(r||(r=Object.assign({},n.props)),r[o[0].id]=o[1])}t.push(r?new tn(n.name,r,n.id,n.flags):n)}return new Za(t)}}const Sc=new WeakMap,yb=new WeakMap;var Pt;(function(i){i[i.ExcludeBuffers=1]="ExcludeBuffers",i[i.IncludeAnonymous=2]="IncludeAnonymous",i[i.IgnoreMounts=4]="IgnoreMounts",i[i.IgnoreOverlays=8]="IgnoreOverlays"})(Pt||(Pt={}));class gt{constructor(e,t,n,r,s){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,l]of s)this.props[typeof o=="number"?o:o.id]=l}}toString(){let e=ga.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let r=n.toString();r&&(t&&(t+=","),t+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new Eu(this.topNode,e)}cursorAt(e,t=0,n=0){let r=Sc.get(this)||this.topNode,s=new Eu(r);return s.moveTo(e,t),Sc.set(this,s._tree),s}get topNode(){return new On(this,0,0,null)}resolve(e,t=0){let n=Oa(Sc.get(this)||this.topNode,e,t,!1);return Sc.set(this,n),n}resolveInner(e,t=0){let n=Oa(yb.get(this)||this.topNode,e,t,!0);return yb.set(this,n),n}resolveStack(e,t=0){return fL(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:s=this.length}=e,o=e.mode||0,l=(o&Pt.IncludeAnonymous)>0;for(let a=this.cursor(o|Pt.IncludeAnonymous);;){let c=!1;if(a.from<=s&&a.to>=r&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;c=!0}for(;c&&n&&(l||!a.type.isAnonymous)&&n(a),!a.nextSibling();){if(!a.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:vp(tn.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new gt(this.type,t,n,r,this.propValues),e.makeTree||((t,n,r)=>new gt(tn.none,t,n,r)))}static build(e){return dL(e)}}gt.empty=new gt(tn.none,[],[],0);class Op{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Op(this.buffer,this.index)}}class Hr{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return tn.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],r=this.set.types[t],s=r.name;if(/\W/.test(s)&&!r.isError&&(s=JSON.stringify(s)),e+=4,n==e)return s;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,n,r,s){let{buffer:o}=this,l=-1;for(let a=e;a!=t&&!(b2(s,r,o[a+1],o[a+2])&&(l=a,n>0));a=o[a+3]);return l}slice(e,t,n){let r=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l<t;){s[a++]=r[l++],s[a++]=r[l++]-n;let c=s[a++]=r[l++]-n;s[a++]=r[l++]-e,o=Math.max(o,c)}return new Hr(s,o,this.set)}}function b2(i,e,t,n){switch(i){case-2:return t<e;case-1:return n>=e&&t<e;case 0:return t<e&&n>e;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function Oa(i,e,t,n){for(var r;i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to<e);){let o=!n&&i instanceof On&&i.index<0?null:i.parent;if(!o)return i;i=o}let s=n?0:Pt.IgnoreOverlays;if(n)for(let o=i,l=o.parent;l;o=l,l=o.parent)o instanceof On&&o.index<0&&((r=l.enter(e,t,s))===null||r===void 0?void 0:r.from)!=o.from&&(i=l);for(;;){let o=i.enter(e,t,s);if(!o)return i;i=o}}class v2{cursor(e=0){return new Eu(this,e)}getChild(e,t=null,n=null){let r=kb(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return kb(this,e,t,n)}resolve(e,t=0){return Oa(this,e,t,!1)}resolveInner(e,t=0){return Oa(this,e,t,!0)}matchContext(e){return vm(this,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let r=t.lastChild;if(!r||r.to!=t.to)break;r.type.isError&&r.from==r.to?(n=t,t=r.prevSibling):t=r}return n}get node(){return this}get next(){return this.parent}}class On extends v2{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,r,s=0){for(let o=this;;){for(let{children:l,positions:a}=o._tree,c=t>0?l.length:-1;e!=c;e+=t){let u=l[e],h=a[e]+o.from;if(b2(r,n,h,h+u.length)){if(u instanceof Hr){if(s&Pt.ExcludeBuffers)continue;let f=u.findChild(0,u.buffer.length,t,n-h,r);if(f>-1)return new Fi(new uL(o,u,e,h),null,f)}else if(s&Pt.IncludeAnonymous||!u.type.isAnonymous||bp(u)){let f;if(!(s&Pt.IgnoreMounts)&&(f=ga.get(u))&&!f.overlay)return new On(f.tree,h,e,o);let d=new On(u,h,e,o);return s&Pt.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?u.children.length-1:0,t,n,r)}}}if(s&Pt.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,n=0){let r;if(!(n&Pt.IgnoreOverlays)&&(r=ga.get(this._tree))&&r.overlay){let s=e-this.from;for(let{from:o,to:l}of r.overlay)if((t>0?o<=s:o<s)&&(t<0?l>=s:l>s))return new On(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function kb(i,e,t,n){let r=i.cursor(),s=[];if(!r.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=r.type.is(t),!r.nextSibling())return s}for(;;){if(n!=null&&r.type.is(n))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return n==null?s:[]}}function vm(i,e,t=e.length-1){for(let n=i.parent;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class uL{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class Fi extends v2{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new Fi(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,n=0){if(n&Pt.ExcludeBuffers)return null;let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new Fi(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Fi(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Fi(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,s=n.buffer[this.index+3];if(s>r){let o=n.buffer[this.index+1];e.push(n.slice(r,s,o)),t.push(0)}return new gt(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function w2(i){if(!i.length)return null;let e=0,t=i[0];for(let s=1;s<i.length;s++){let o=i[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let n=t instanceof On&&t.index<0?null:t.parent,r=i.slice();return n?r[e]=n:r.splice(e,1),new hL(r,t)}class hL{constructor(e,t){this.heads=e,this.node=t}get next(){return w2(this.heads)}}function fL(i,e,t){let n=i.resolveInner(e,t),r=null;for(let s=n instanceof On?n:n.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(r||(r=[n])).push(o.resolve(e,t)),s=o}else{let o=ga.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let l=new On(o.tree,o.overlay[0].from+s.from,-1,s);(r||(r=[n])).push(Oa(l,e,t,!1))}}return r?w2(r):n}class Eu{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof On)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof On?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&Pt.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Pt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Pt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(r.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let s=t+e,o=e<0?-1:n._tree.children.length;s!=o;s+=e){let l=n._tree.children[s];if(this.mode&Pt.IncludeAnonymous||l instanceof Hr||!l.type.isAnonymous||bp(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let r=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=s+1;break e}r=this.stack[--s]}for(let r=n;r<this.stack.length;r++)t=new Fi(this.buffer,t,this.stack[r]);return this.bufferNode=new Fi(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;r&&t&&t(this),r=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return vm(this.node,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,s=this.stack.length-1;r>=0;s--){if(s<0)return vm(this.node,e,r);let o=n[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function bp(i){return i.children.some(e=>e instanceof Hr||!e.type.isAnonymous||bp(e))}function dL(i){var e;let{buffer:t,nodeSet:n,maxBufferLength:r=O2,reused:s=[],minRepeatType:o=n.types.length}=i,l=Array.isArray(t)?new Op(t,t.length):t,a=n.types,c=0,u=0;function h(k,A,C,Q,M,L){let{id:N,start:B,end:J,size:te}=l,ie=u;for(;te<0;)if(l.next(),te==-1){let ve=s[N];C.push(ve),Q.push(B-k);return}else if(te==-3){c=N;return}else if(te==-4){u=N;return}else throw new RangeError(`Unrecognized record size: ${te}`);let ae=a[N],X,ee,Te=B-k;if(J-B<=r&&(ee=g(l.pos-A,M))){let ve=new Uint16Array(ee.size-ee.skip),je=l.pos-ee.size,ne=ve.length;for(;l.pos>je;)ne=v(ee.start,ve,ne);X=new Hr(ve,J-ee.start,n),Te=ee.start-k}else{let ve=l.pos-te;l.next();let je=[],ne=[],Ee=N>=o?N:-1,Re=0,xt=J;for(;l.pos>ve;)Ee>=0&&l.id==Ee&&l.size>=0?(l.end<=xt-r&&(m(je,ne,B,Re,l.end,xt,Ee,ie),Re=je.length,xt=l.end),l.next()):L>2500?f(B,ve,je,ne):h(B,ve,je,ne,Ee,L+1);if(Ee>=0&&Re>0&&Re<je.length&&m(je,ne,B,Re,B,xt,Ee,ie),je.reverse(),ne.reverse(),Ee>-1&&Re>0){let H=d(ae);X=vp(ae,je,ne,0,je.length,0,J-B,H,H)}else X=p(ae,je,ne,J-B,ie-J)}C.push(X),Q.push(Te)}function f(k,A,C,Q){let M=[],L=0,N=-1;for(;l.pos>A;){let{id:B,start:J,end:te,size:ie}=l;if(ie>4)l.next();else{if(N>-1&&J<N)break;N<0&&(N=te-r),M.push(B,J,te),L++,l.next()}}if(L){let B=new Uint16Array(L*4),J=M[M.length-2];for(let te=M.length-3,ie=0;te>=0;te-=3)B[ie++]=M[te],B[ie++]=M[te+1]-J,B[ie++]=M[te+2]-J,B[ie++]=ie;C.push(new Hr(B,M[2]-J,n)),Q.push(J-k)}}function d(k){return(A,C,Q)=>{let M=0,L=A.length-1,N,B;if(L>=0&&(N=A[L])instanceof gt){if(!L&&N.type==k&&N.length==Q)return N;(B=N.prop(Ze.lookAhead))&&(M=C[L]+N.length+B)}return p(k,A,C,Q,M)}}function m(k,A,C,Q,M,L,N,B){let J=[],te=[];for(;k.length>Q;)J.push(k.pop()),te.push(A.pop()+C-M);k.push(p(n.types[N],J,te,L-M,B-L)),A.push(M-C)}function p(k,A,C,Q,M=0,L){if(c){let N=[Ze.contextHash,c];L=L?[N].concat(L):[N]}if(M>25){let N=[Ze.lookAhead,M];L=L?[N].concat(L):[N]}return new gt(k,A,C,Q,L)}function g(k,A){let C=l.fork(),Q=0,M=0,L=0,N=C.end-r,B={size:0,start:0,skip:0};e:for(let J=C.pos-k;C.pos>J;){let te=C.size;if(C.id==A&&te>=0){B.size=Q,B.start=M,B.skip=L,L+=4,Q+=4,C.next();continue}let ie=C.pos-te;if(te<0||ie<J||C.start<N)break;let ae=C.id>=o?4:0,X=C.start;for(C.next();C.pos>ie;){if(C.size<0)if(C.size==-3)ae+=4;else break e;else C.id>=o&&(ae+=4);C.next()}M=X,Q+=te,L+=ae}return(A<0||Q==k)&&(B.size=Q,B.start=M,B.skip=L),B.size>4?B:void 0}function v(k,A,C){let{id:Q,start:M,end:L,size:N}=l;if(l.next(),N>=0&&Q<o){let B=C;if(N>4){let J=l.pos-(N-4);for(;l.pos>J;)C=v(k,A,C)}A[--C]=B,A[--C]=L-k,A[--C]=M-k,A[--C]=Q}else N==-3?c=Q:N==-4&&(u=Q);return C}let w=[],S=[];for(;l.pos>0;)h(i.start||0,i.bufferStart||0,w,S,-1,0);let _=(e=i.length)!==null&&e!==void 0?e:w.length?S[0]+w[0].length:0;return new gt(a[i.topID],w.reverse(),S.reverse(),_)}const Sb=new WeakMap;function eu(i,e){if(!i.isAnonymous||e instanceof Hr||e.type!=i)return 1;let t=Sb.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=i||!(n instanceof gt)){t=1;break}t+=eu(i,n)}Sb.set(e,t)}return t}function vp(i,e,t,n,r,s,o,l,a){let c=0;for(let m=n;m<r;m++)c+=eu(i,e[m]);let u=Math.ceil(c*1.5/8),h=[],f=[];function d(m,p,g,v,w){for(let S=g;S<v;){let _=S,k=p[S],A=eu(i,m[S]);for(S++;S<v;S++){let C=eu(i,m[S]);if(A+C>=u)break;A+=C}if(S==_+1){if(A>u){let C=m[_];d(C.children,C.positions,0,C.children.length,p[_]+w);continue}h.push(m[_])}else{let C=p[S-1]+m[S-1].length-k;h.push(vp(i,m,p,_,S,k,C,null,a))}f.push(k+w-s)}}return d(e,t,n,r,0),(l||a)(h,f,o)}class y2{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof Fi?this.setBuffer(e.context.buffer,e.index,t):e instanceof On&&this.map.set(e.tree,t)}get(e){return e instanceof Fi?this.getBuffer(e.context.buffer,e.index):e instanceof On?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class cr{constructor(e,t,n,r,s=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let r=[new cr(0,e.length,e,0,!1,n)];for(let s of t)s.to>e.length&&r.push(s);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,c=0;;l++){let u=l<t.length?t[l]:null,h=u?u.fromA:1e9;if(h-a>=n)for(;o&&o.from<h;){let f=o;if(a>=f.from||h<=f.to||c){let d=Math.max(f.from,a)-c,m=Math.min(f.to,h)-c;f=d>=m?null:new cr(d,m,f.tree,f.offset+c,l>0,!!u)}if(f&&r.push(f),o.to>h)break;o=s<e.length?e[s++]:null}if(!u)break;a=u.toA,c=u.toA-u.toB}return r}}class wp{startParse(e,t,n){return typeof e=="string"&&(e=new mL(e)),n=n?n.length?n.map(r=>new li(r.from,r.to)):[new li(0,0)]:[new li(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let s=r.advance();if(s)return s}}}class mL{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function k2(i){return(e,t,n,r)=>new gL(e,i,t,n,r)}class _b{constructor(e,t,n,r,s){this.parser=e,this.parse=t,this.overlay=n,this.target=r,this.from=s}}function Cb(i){if(!i.length||i.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(i))}class pL{constructor(e,t,n,r,s,o,l){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=s,this.target=o,this.prev=l,this.depth=0,this.ranges=[]}}const wm=new Ze({perNode:!0});class gL{constructor(e,t,n,r,s){this.nest=t,this.input=n,this.fragments=r,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let n=this.baseParse.advance();if(!n)return null;if(this.baseParse=null,this.baseTree=n,this.startInner(),this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let n=this.baseTree;return this.stoppedAt!=null&&(n=new gt(n.type,n.children,n.positions,n.length,n.propValues.concat([[wm,this.stoppedAt]]))),n}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[Ze.mounted.id]=new ga(t,e.overlay,e.parser),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new vL(this.fragments),t=null,n=null,r=new Eu(new On(this.baseTree,this.ranges[0].from,0,null),Pt.IncludeAnonymous|Pt.IgnoreMounts);e:for(let s,o;;){let l=!0,a;if(this.stoppedAt!=null&&r.from>=this.stoppedAt)l=!1;else if(e.hasNode(r)){if(t){let c=t.mounts.find(u=>u.frag.from<=r.from&&u.frag.to>=r.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let h=u.from+c.pos,f=u.to+c.pos;h>=r.from&&f<=r.to&&!t.ranges.some(d=>d.from<f&&d.to>h)&&t.ranges.push({from:h,to:f})}}l=!1}else if(n&&(o=OL(n.ranges,r.from,r.to)))l=o!=2;else if(!r.type.isAnonymous&&(s=this.nest(r,this.input))&&(r.from<r.to||!s.overlay)){r.tree||bL(r);let c=e.findMounts(r.from,s.parser);if(typeof s.overlay=="function")t=new pL(s.parser,s.overlay,c,this.inner.length,r.from,r.tree,t);else{let u=xb(this.ranges,s.overlay||(r.from<r.to?[new li(r.from,r.to)]:[]));u.length&&Cb(u),(u.length||!s.overlay)&&this.inner.push(new _b(s.parser,u.length?s.parser.startParse(this.input,Tb(c,u),u):s.parser.startParse(""),s.overlay?s.overlay.map(h=>new li(h.from-r.from,h.to-r.from)):null,r.tree,u.length?u[0].from:r.from)),s.overlay?u.length&&(n={ranges:u,depth:0,prev:n}):l=!1}}else t&&(a=t.predicate(r))&&(a===!0&&(a=new li(r.from,r.to)),a.from<a.to&&t.ranges.push(a));if(l&&r.firstChild())t&&t.depth++,n&&n.depth++;else for(;!r.nextSibling();){if(!r.parent())break e;if(t&&!--t.depth){let c=xb(this.ranges,t.ranges);c.length&&(Cb(c),this.inner.splice(t.index,0,new _b(t.parser,t.parser.startParse(this.input,Tb(t.mounts,c),c),t.ranges.map(u=>new li(u.from-t.start,u.to-t.start)),t.target,c[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}}function OL(i,e,t){for(let n of i){if(n.from>=t)break;if(n.to>e)return n.from<=e&&n.to>=t?2:1}return 0}function Pb(i,e,t,n,r,s){if(e<t){let o=i.buffer[e+1];n.push(i.slice(e,t,o)),r.push(o-s)}}function bL(i){let{node:e}=i,t=[],n=e.context.buffer;do t.push(i.index),i.parent();while(!i.tree);let r=i.tree,s=r.children.indexOf(n),o=r.children[s],l=o.buffer,a=[s];function c(u,h,f,d,m,p){let g=t[p],v=[],w=[];Pb(o,u,g,v,w,d);let S=l[g+1],_=l[g+2];a.push(v.length);let k=p?c(g+4,l[g+3],o.set.types[l[g]],S,_-S,p-1):e.toTree();return v.push(k),w.push(S-d),Pb(o,l[g+3],h,v,w,d),new gt(f,v,w,m)}r.children[s]=c(0,l.length,tn.none,0,o.length,t.length-1);for(let u of a){let h=i.tree.children[u],f=i.tree.positions[u];i.yield(new On(h,f+i.from,u,i._tree))}}class Ab{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(Pt.IncludeAnonymous|Pt.IgnoreMounts)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)t.to>=e&&t.enter(n,1,Pt.IgnoreOverlays|Pt.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof gt)t=t.children[0];else break}return!1}}let vL=class{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=(t=n.tree.prop(wm))!==null&&t!==void 0?t:n.to,this.inner=new Ab(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(wm))!==null&&e!==void 0?e:t.to,this.inner=new Ab(t.tree,-t.offset)}}findMounts(e,t){var n;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(n=s.tree)===null||n===void 0?void 0:n.prop(Ze.mounted);if(o&&o.parser==t)for(let l=this.fragI;l<this.fragments.length;l++){let a=this.fragments[l];if(a.from>=s.to)break;a.tree==this.curFrag.tree&&r.push({frag:a,pos:s.from-a.offset,mount:o})}}}return r}};function xb(i,e){let t=null,n=e;for(let r=1,s=0;r<i.length;r++){let o=i[r-1].to,l=i[r].from;for(;s<n.length;s++){let a=n[s];if(a.from>=l)break;a.to<=o||(t||(n=t=e.slice()),a.from<o?(t[s]=new li(a.from,o),a.to>l&&t.splice(s+1,0,new li(l,a.to))):a.to>l?t[s--]=new li(l,a.to):t.splice(s--,1))}}return n}function wL(i,e,t,n){let r=0,s=0,o=!1,l=!1,a=-1e9,c=[];for(;;){let u=r==i.length?1e9:o?i[r].to:i[r].from,h=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let f=Math.max(a,t),d=Math.min(u,h,n);f<d&&c.push(new li(f,d))}if(a=Math.min(u,h),a==1e9)break;u==a&&(o?(o=!1,r++):o=!0),h==a&&(l?(l=!1,s++):l=!0)}return c}function Tb(i,e){let t=[];for(let{pos:n,mount:r,frag:s}of i){let o=n+(r.overlay?r.overlay[0].from:0),l=o+r.tree.length,a=Math.max(s.from,o),c=Math.min(s.to,l);if(r.overlay){let u=r.overlay.map(f=>new li(f.from+n,f.to+n)),h=wL(e,u,a,c);for(let f=0,d=a;;f++){let m=f==h.length,p=m?c:h[f].from;if(p>d&&t.push(new cr(d,p,r.tree,-o,s.from>=d||s.openStart,s.to<=p||s.openEnd)),m)break;d=h[f].to}}else t.push(new cr(a,c,r.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}let yL=0;class jn{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=yL++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof jn&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let r=new jn(n,[],null,[]);if(r.set.push(r),t)for(let s of t.set)r.set.push(s);return r}static defineModifier(e){let t=new Ru(e);return n=>n.modified.indexOf(t)>-1?n:Ru.get(n.base||n,n.modified.concat(t).sort((r,s)=>r.id-s.id))}}let kL=0;class Ru{constructor(e){this.name=e,this.instances=[],this.id=kL++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(l=>l.base==e&&SL(t,l.modified));if(n)return n;let r=[],s=new jn(e.name,r,e,t);for(let l of t)l.instances.push(s);let o=_L(t);for(let l of e.set)if(!l.modified.length)for(let a of o)r.push(Ru.get(l,a));return s}}function SL(i,e){return i.length==e.length&&i.every((t,n)=>t==e[n])}function _L(i){let e=[[]];for(let t=0;t<i.length;t++)for(let n=0,r=e.length;n<r;n++)e.push(e[n].concat(i[t]));return e.sort((t,n)=>n.length-t.length)}function Xs(i){let e=Object.create(null);for(let t in i){let n=i[t];Array.isArray(n)||(n=[n]);for(let r of t.split(" "))if(r){let s=[],o=2,l=r;for(let h=0;;){if(l=="..."&&h>0&&h+3==r.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+r);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),h+=f[0].length,h==r.length)break;let d=r[h++];if(h==r.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+r);l=r.slice(h)}let a=s.length-1,c=s[a];if(!c)throw new RangeError("Invalid path: "+r);let u=new Du(n,o,a>0?s.slice(0,a):null);e[c]=u.sort(e[c])}}return S2.add(e)}const S2=new Ze;class Du{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Du.empty=new Du([],2,null);function _2(i,e){let t=Object.create(null);for(let s of i)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let o of s.tag)t[o.id]=s.class;let{scope:n,all:r=null}=e||{};return{style:s=>{let o=r;for(let l of s)for(let a of l.set){let c=t[a.id];if(c){o=o?o+" "+c:c;break}}return o},scope:n}}function CL(i,e){let t=null;for(let n of i){let r=n.style(e);r&&(t=t?t+" "+r:r)}return t}function PL(i,e,t,n=0,r=i.length){let s=new AL(n,Array.isArray(e)?e:[e],t);s.highlightRange(i.cursor(),n,r,"",s.highlighters),s.flush(r)}class AL{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,s){let{type:o,from:l,to:a}=e;if(l>=n||a<=t)return;o.isTop&&(s=this.highlighters.filter(d=>!d.scope||d.scope(o)));let c=r,u=xL(e)||Du.empty,h=CL(s,u.tags);if(h&&(c&&(c+=" "),c+=h,u.mode==1&&(r+=(r?" ":"")+h)),this.startSpan(Math.max(t,l),c),u.opaque)return;let f=e.tree&&e.tree.prop(Ze.mounted);if(f&&f.overlay){let d=e.node.enter(f.overlay[0].from+l,1),m=this.highlighters.filter(g=>!g.scope||g.scope(f.tree.type)),p=e.firstChild();for(let g=0,v=l;;g++){let w=g<f.overlay.length?f.overlay[g]:null,S=w?w.from+l:a,_=Math.max(t,v),k=Math.min(n,S);if(_<k&&p)for(;e.from<k&&(this.highlightRange(e,_,k,r,s),this.startSpan(Math.min(k,e.to),c),!(e.to>=S||!e.nextSibling())););if(!w||S>n)break;v=w.to+l,v>t&&(this.highlightRange(d.cursor(),Math.max(t,w.from+l),Math.min(n,v),"",m),this.startSpan(Math.min(n,v),c))}p&&e.parent()}else if(e.firstChild()){f&&(r="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,s),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}}function xL(i){let e=i.type.prop(S2);for(;e&&e.context&&!i.matchContext(e.context);)e=e.next;return e||null}const de=jn.define,_c=de(),Qr=de(),Qb=de(Qr),Mb=de(Qr),Mr=de(),Cc=de(Mr),If=de(Mr),Ii=de(),us=de(Ii),$i=de(),Li=de(),ym=de(),dl=de(ym),Pc=de(),I={comment:_c,lineComment:de(_c),blockComment:de(_c),docComment:de(_c),name:Qr,variableName:de(Qr),typeName:Qb,tagName:de(Qb),propertyName:Mb,attributeName:de(Mb),className:de(Qr),labelName:de(Qr),namespace:de(Qr),macroName:de(Qr),literal:Mr,string:Cc,docString:de(Cc),character:de(Cc),attributeValue:de(Cc),number:If,integer:de(If),float:de(If),bool:de(Mr),regexp:de(Mr),escape:de(Mr),color:de(Mr),url:de(Mr),keyword:$i,self:de($i),null:de($i),atom:de($i),unit:de($i),modifier:de($i),operatorKeyword:de($i),controlKeyword:de($i),definitionKeyword:de($i),moduleKeyword:de($i),operator:Li,derefOperator:de(Li),arithmeticOperator:de(Li),logicOperator:de(Li),bitwiseOperator:de(Li),compareOperator:de(Li),updateOperator:de(Li),definitionOperator:de(Li),typeOperator:de(Li),controlOperator:de(Li),punctuation:ym,separator:de(ym),bracket:dl,angleBracket:de(dl),squareBracket:de(dl),paren:de(dl),brace:de(dl),content:Ii,heading:us,heading1:de(us),heading2:de(us),heading3:de(us),heading4:de(us),heading5:de(us),heading6:de(us),contentSeparator:de(Ii),list:de(Ii),quote:de(Ii),emphasis:de(Ii),strong:de(Ii),link:de(Ii),monospace:de(Ii),strikethrough:de(Ii),inserted:de(),deleted:de(),changed:de(),invalid:de(),meta:Pc,documentMeta:de(Pc),annotation:de(Pc),processingInstruction:de(Pc),definition:jn.defineModifier("definition"),constant:jn.defineModifier("constant"),function:jn.defineModifier("function"),standard:jn.defineModifier("standard"),local:jn.defineModifier("local"),special:jn.defineModifier("special")};for(let i in I){let e=I[i];e instanceof jn&&(e.name=i)}_2([{tag:I.link,class:"tok-link"},{tag:I.heading,class:"tok-heading"},{tag:I.emphasis,class:"tok-emphasis"},{tag:I.strong,class:"tok-strong"},{tag:I.keyword,class:"tok-keyword"},{tag:I.atom,class:"tok-atom"},{tag:I.bool,class:"tok-bool"},{tag:I.url,class:"tok-url"},{tag:I.labelName,class:"tok-labelName"},{tag:I.inserted,class:"tok-inserted"},{tag:I.deleted,class:"tok-deleted"},{tag:I.literal,class:"tok-literal"},{tag:I.string,class:"tok-string"},{tag:I.number,class:"tok-number"},{tag:[I.regexp,I.escape,I.special(I.string)],class:"tok-string2"},{tag:I.variableName,class:"tok-variableName"},{tag:I.local(I.variableName),class:"tok-variableName tok-local"},{tag:I.definition(I.variableName),class:"tok-variableName tok-definition"},{tag:I.special(I.variableName),class:"tok-variableName2"},{tag:I.definition(I.propertyName),class:"tok-propertyName tok-definition"},{tag:I.typeName,class:"tok-typeName"},{tag:I.namespace,class:"tok-namespace"},{tag:I.className,class:"tok-className"},{tag:I.macroName,class:"tok-macroName"},{tag:I.propertyName,class:"tok-propertyName"},{tag:I.operator,class:"tok-operator"},{tag:I.comment,class:"tok-comment"},{tag:I.meta,class:"tok-meta"},{tag:I.invalid,class:"tok-invalid"},{tag:I.punctuation,class:"tok-punctuation"}]);var Nf;const ks=new Ze;function yp(i){return ye.define({combine:i?e=>e.concat(i):void 0})}const kp=new Ze;class ai{constructor(e,t,n=[],r=""){this.data=e,this.name=r,et.prototype.hasOwnProperty("tree")||Object.defineProperty(et.prototype,"tree",{get(){return At(this)}}),this.parser=t,this.extension=[Kr.of(this),et.languageData.of((s,o,l)=>{let a=Eb(s,o,l),c=a.type.prop(ks);if(!c)return[];let u=s.facet(c),h=a.type.prop(kp);if(h){let f=a.resolve(o-a.from,l);for(let d of h)if(d.test(f,s)){let m=s.facet(d.facet);return d.type=="replace"?m:m.concat(u)}}return u})].concat(n)}isActiveAt(e,t,n=-1){return Eb(e,t,n).type.prop(ks)==this.data}findRegions(e){let t=e.facet(Kr);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(s,o)=>{if(s.prop(ks)==this.data){n.push({from:o,to:o+s.length});return}let l=s.prop(Ze.mounted);if(l){if(l.tree.prop(ks)==this.data){if(l.overlay)for(let a of l.overlay)n.push({from:a.from+o,to:a.to+o});else n.push({from:o,to:o+s.length});return}else if(l.overlay){let a=n.length;if(r(l.tree,l.overlay[0].from+o),n.length>a)return}}for(let a=0;a<s.children.length;a++){let c=s.children[a];c instanceof gt&&r(c,s.positions[a]+o)}};return r(At(e),0),n}get allowsNesting(){return!0}}ai.setState=Fe.define();function Eb(i,e,t){let n=i.facet(Kr),r=At(i).topNode;if(!n||n.allowsNesting)for(let s=r;s;s=s.enter(e,t,Pt.ExcludeBuffers))s.type.isTop&&(r=s);return r}class $s extends ai{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=yp(e.languageData);return new $s(t,e.parser.configure({props:[ks.add(n=>n.isTop?t:void 0)]}),e.name)}configure(e,t){return new $s(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function At(i){let e=i.field(ai.state,!1);return e?e.tree:gt.empty}class TL{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let ml=null;class ba{constructor(e,t,n=[],r,s,o,l,a){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new ba(e,t,[],gt.empty,0,n,[],null)}startParse(){return this.parser.startParse(new TL(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=gt.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let r=Date.now()+e;e=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let r=this.parse.advance();if(r)if(this.fragments=this.withoutTempSkipped(cr.addTree(r,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=r,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(cr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=ml;ml=this;try{return e()}finally{ml=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Rb(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:r,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((c,u,h,f)=>a.push({fromA:c,toA:u,fromB:h,toB:f})),n=cr.applyChanges(n,a),r=gt.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),h=e.mapPos(c.to,-1);u<h&&l.push({from:u,to:h})}}}return new ba(this.parser,t,n,r,s,o,l,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:r,to:s}=this.skipped[n];r<e.to&&s>e.from&&(this.fragments=Rb(this.fragments,r,s),this.skipped.splice(n--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends wp{createParse(t,n,r){let s=r[0].from,o=r[r.length-1].to;return{parsedPos:s,advance(){let a=ml;if(a){for(let c of r)a.tempSkipped.push(c);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new gt(tn.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return ml}}function Rb(i,e,t){return cr.applyChanges(i,[{fromA:e,toA:t,fromB:e,toB:t}])}class Ro{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new Ro(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=ba.create(e.facet(Kr).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new Ro(n)}}ai.state=Jt.define({create:Ro.init,update(i,e){for(let t of e.effects)if(t.is(ai.setState))return t.value;return e.startState.facet(Kr)!=e.state.facet(Kr)?Ro.init(e.state):i.apply(e)}});let C2=i=>{let e=setTimeout(()=>i(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(C2=i=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(i,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Zf=typeof navigator<"u"&&(!((Nf=navigator.scheduling)===null||Nf===void 0)&&Nf.isInputPending)?()=>navigator.scheduling.isInputPending():null,QL=Vt.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(ai.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(ai.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=C2(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,s=n.field(ai.state);if(s.tree==s.context.tree&&s.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Zf?Math.max(25,e.timeRemaining()-5):1e9),l=s.context.treeLen<r&&n.doc.length>r+1e3,a=s.context.work(()=>Zf&&Zf()||Date.now()>o,r+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:ai.setState.of(new Ro(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>_n(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Kr=ye.define({combine(i){return i.length?i[0]:null},enables:i=>[ai.state,QL,pe.contentAttributes.compute([i],e=>{let t=e.facet(i);return t&&t.name?{"data-language":t.name}:{}})]});class Do{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class $u{constructor(e,t,n,r,s,o=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=r,this.loadFunc=s,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:n}=e;if(!t){if(!n)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(n)}return new $u(e.name,(e.alias||[]).concat(e.name).map(r=>r.toLowerCase()),e.extensions||[],e.filename,t,n)}static matchFilename(e,t){for(let r of e)if(r.filename&&r.filename.test(t))return r;let n=/\.([^.]+)$/.exec(t);if(n){for(let r of e)if(r.extensions.indexOf(n[1])>-1)return r}return null}static matchLanguageName(e,t,n=!0){t=t.toLowerCase();for(let r of e)if(r.alias.some(s=>s==t))return r;if(n)for(let r of e)for(let s of r.alias){let o=t.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(t[o-1])&&!/\w/.test(t[o+s.length])))return r}return null}}const ML=ye.define(),Ba=ye.define({combine:i=>{if(!i.length)return" ";let e=i[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(i[0]));return e}});function Lu(i){let e=i.facet(Ba);return e.charCodeAt(0)==9?i.tabSize*e.length:e.length}function va(i,e){let t="",n=i.tabSize,r=i.facet(Ba)[0];if(r==" "){for(;e>=n;)t+=" ",e-=n;r=" "}for(let s=0;s<e;s++)t+=r;return t}function Sp(i,e){i instanceof et&&(i=new ph(i));for(let n of i.state.facet(ML)){let r=n(i,e);if(r!==void 0)return r}let t=At(i.state);return t.length>=e?EL(i,t,e):null}class ph{constructor(e,t={}){this.state=e,this.options=t,this.unit=Lu(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:s}=this.options;return r!=null&&r>=n.from&&r<=n.to?s&&r==e?{text:"",from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),s=this.countColumn(n,e-r),o=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return o>-1&&(s+=o-this.countColumn(n,n.search(/\S|$/))),s}countColumn(e,t=e.length){return Ci(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let o=s(r);if(o>-1)return o}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const zo=new Ze;function EL(i,e,t){let n=e.resolveStack(t),r=n.node.enterUnfinishedNodesBefore(t);if(r!=n.node){let s=[];for(let o=r;o!=n.node;o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)n={node:s[o],next:n}}return P2(n,i,t)}function P2(i,e,t){for(let n=i;n;n=n.next){let r=DL(n.node);if(r)return r(_p.create(e,t,n))}return 0}function RL(i){return i.pos==i.options.simulateBreak&&i.options.simulateDoubleBreak}function DL(i){let e=i.type.prop(zo);if(e)return e;let t=i.firstChild,n;if(t&&(n=t.type.prop(Ze.closedBy))){let r=i.lastChild,s=r&&n.indexOf(r.name)>-1;return o=>A2(o,!0,1,void 0,s&&!RL(o)?r.from:void 0)}return i.parent==null?$L:null}function $L(){return 0}class _p extends ph{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new _p(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(LL(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return P2(this.context.next,this.base,this.pos)}}function LL(i,e){for(let t=e;t;t=t.parent)if(i==t)return!0;return!1}function IL(i){let e=i.node,t=e.childAfter(e.from),n=e.lastChild;if(!t)return null;let r=i.options.simulateBreak,s=i.state.doc.lineAt(t.from),o=r==null||r<=s.from?s.to:Math.min(s.to,r);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==n)return null;if(!a.type.isSkipped)return a.from<o?t:null;l=a.to}}function NL({closing:i,align:e=!0,units:t=1}){return n=>A2(n,e,t,i)}function A2(i,e,t,n,r){let s=i.textAfter,o=s.match(/^\s*/)[0].length,l=n&&s.slice(o,o+n.length)==n||r==i.pos+o,a=e?IL(i):null;return a?l?i.column(a.from):i.column(a.to):i.baseIndent+(l?0:i.unit*t)}const ZL=i=>i.baseIndent;function wo({except:i,units:e=1}={}){return t=>{let n=i&&i.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}const BL=200;function WL(){return et.transactionFilter.of(i=>{if(!i.docChanged||!i.isUserEvent("input.type")&&!i.isUserEvent("input.complete"))return i;let e=i.startState.languageDataAt("indentOnInput",i.startState.selection.main.head);if(!e.length)return i;let t=i.newDoc,{head:n}=i.newSelection.main,r=t.lineAt(n);if(n>r.from+BL)return i;let s=t.sliceString(r.from,n);if(!e.some(c=>c.test(s)))return i;let{state:o}=i,l=-1,a=[];for(let{head:c}of o.selection.ranges){let u=o.doc.lineAt(c);if(u.from==l)continue;l=u.from;let h=Sp(o,u.from);if(h==null)continue;let f=/^\s*/.exec(u.text)[0],d=va(o,h);f!=d&&a.push({from:u.from,to:u.from+f.length,insert:d})}return a.length?[i,{changes:a,sequential:!0}]:i})}const x2=ye.define(),Fs=new Ze;function Cp(i){let e=i.firstChild,t=i.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?i.to:t.from}:null}function XL(i,e,t){let n=At(i);if(n.length<t)return null;let r=n.resolveStack(t,1),s=null;for(let o=r;o;o=o.next){let l=o.node;if(l.to<=t||l.from>t)continue;if(s&&l.from<e)break;let a=l.type.prop(Fs);if(a&&(l.to<n.length-50||n.length==i.doc.length||!FL(l))){let c=a(l,i);c&&c.from<=t&&c.from>=e&&c.to>t&&(s=c)}}return s}function FL(i){let e=i.lastChild;return e&&e.to==i.to&&e.type.isError}function Iu(i,e,t){for(let n of i.facet(x2)){let r=n(i,e,t);if(r)return r}return XL(i,e,t)}function T2(i,e){let t=e.mapPos(i.from,1),n=e.mapPos(i.to,-1);return t>=n?void 0:{from:t,to:n}}const gh=Fe.define({map:T2}),Wa=Fe.define({map:T2});function Q2(i){let e=[];for(let{head:t}of i.state.selection.ranges)e.some(n=>n.from<=t&&n.to>=t)||e.push(i.lineBlockAt(t));return e}const Ls=Jt.define({create(){return Qe.none},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(gh)&&!YL(i,t.value.from,t.value.to)){let{preparePlaceholder:n}=e.state.facet(R2),r=n?Qe.replace({widget:new HL(n(e.state,t.value))}):Db;i=i.update({add:[r.range(t.value.from,t.value.to)]})}else t.is(Wa)&&(i=i.update({filter:(n,r)=>t.value.from!=n||t.value.to!=r,filterFrom:t.value.from,filterTo:t.value.to}));if(e.selection){let t=!1,{head:n}=e.selection.main;i.between(n,n,(r,s)=>{r<n&&s>n&&(t=!0)}),t&&(i=i.update({filterFrom:n,filterTo:n,filter:(r,s)=>s<=n||r>=n}))}return i},provide:i=>pe.decorations.from(i),toJSON(i,e){let t=[];return i.between(0,e.doc.length,(n,r)=>{t.push(n,r)}),t},fromJSON(i){if(!Array.isArray(i)||i.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<i.length;){let n=i[t++],r=i[t++];if(typeof n!="number"||typeof r!="number")throw new RangeError("Invalid JSON for fold state");e.push(Db.range(n,r))}return Qe.set(e,!0)}});function Nu(i,e,t){var n;let r=null;return(n=i.field(Ls,!1))===null||n===void 0||n.between(e,t,(s,o)=>{(!r||r.from>s)&&(r={from:s,to:o})}),r}function YL(i,e,t){let n=!1;return i.between(e,e,(r,s)=>{r==e&&s==t&&(n=!0)}),n}function M2(i,e){return i.field(Ls,!1)?e:e.concat(Fe.appendConfig.of(D2()))}const zL=i=>{for(let e of Q2(i)){let t=Iu(i.state,e.from,e.to);if(t)return i.dispatch({effects:M2(i.state,[gh.of(t),E2(i,t)])}),!0}return!1},VL=i=>{if(!i.state.field(Ls,!1))return!1;let e=[];for(let t of Q2(i)){let n=Nu(i.state,t.from,t.to);n&&e.push(Wa.of(n),E2(i,n,!1))}return e.length&&i.dispatch({effects:e}),e.length>0};function E2(i,e,t=!0){let n=i.state.doc.lineAt(e.from).number,r=i.state.doc.lineAt(e.to).number;return pe.announce.of(`${i.state.phrase(t?"Folded lines":"Unfolded lines")} ${n} ${i.state.phrase("to")} ${r}.`)}const UL=i=>{let{state:e}=i,t=[];for(let n=0;n<e.doc.length;){let r=i.lineBlockAt(n),s=Iu(e,r.from,r.to);s&&t.push(gh.of(s)),n=(s?i.lineBlockAt(s.to):r).to+1}return t.length&&i.dispatch({effects:M2(i.state,t)}),!!t.length},jL=i=>{let e=i.state.field(Ls,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,i.state.doc.length,(n,r)=>{t.push(Wa.of({from:n,to:r}))}),i.dispatch({effects:t}),!0},qL=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:zL},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:VL},{key:"Ctrl-Alt-[",run:UL},{key:"Ctrl-Alt-]",run:jL}],GL={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},R2=ye.define({combine(i){return Qi(i,GL)}});function D2(i){return[Ls,e6]}function $2(i,e){let{state:t}=i,n=t.facet(R2),r=o=>{let l=i.lineBlockAt(i.posAtDOM(o.target)),a=Nu(i.state,l.from,l.to);a&&i.dispatch({effects:Wa.of(a)}),o.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(i,r,e);let s=document.createElement("span");return s.textContent=n.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=r,s}const Db=Qe.replace({widget:new class extends br{toDOM(i){return $2(i,null)}}});class HL extends br{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return $2(e,this.value)}}const KL={openText:"⌄",closedText:"",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Bf extends Ki{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function JL(i={}){let e=Object.assign(Object.assign({},KL),i),t=new Bf(e,!0),n=new Bf(e,!1),r=Vt.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Kr)!=o.state.facet(Kr)||o.startState.field(Ls,!1)!=o.state.field(Ls,!1)||At(o.startState)!=At(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new Ur;for(let a of o.viewportLineBlocks){let c=Nu(o.state,a.from,a.to)?n:Iu(o.state,a.from,a.to)?t:null;c&&l.add(a.from,a.from,c)}return l.finish()}}),{domEventHandlers:s}=e;return[r,m2({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(r))===null||l===void 0?void 0:l.markers)||tt.empty},initialSpacer(){return new Bf(e,!1)},domEventHandlers:Object.assign(Object.assign({},s),{click:(o,l,a)=>{if(s.click&&s.click(o,l,a))return!0;let c=Nu(o.state,l.from,l.to);if(c)return o.dispatch({effects:Wa.of(c)}),!0;let u=Iu(o.state,l.from,l.to);return u?(o.dispatch({effects:gh.of(u)}),!0):!1}})}),D2()]}const e6=pe.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Oh{constructor(e,t){this.specs=e;let n;function r(l){let a=jr.newName();return(n||(n=Object.create(null)))["."+a]=l,a}const s=typeof t.all=="string"?t.all:t.all?r(t.all):void 0,o=t.scope;this.scope=o instanceof ai?l=>l.prop(ks)==o.data:o?l=>l==o:void 0,this.style=_2(e.map(l=>({tag:l.tag,class:l.class||r(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=n?new jr(n):null,this.themeType=t.themeType}static define(e,t){return new Oh(e,t||{})}}const km=ye.define(),L2=ye.define({combine(i){return i.length?[i[0]]:null}});function Wf(i){let e=i.facet(km);return e.length?e:i.facet(L2)}function t6(i,e){let t=[i6],n;return i instanceof Oh&&(i.module&&t.push(pe.styleModule.of(i.module)),n=i.themeType),e!=null&&e.fallback?t.push(L2.of(i)):n?t.push(km.computeN([pe.darkTheme],r=>r.facet(pe.darkTheme)==(n=="dark")?[i]:[])):t.push(km.of(i)),t}class n6{constructor(e){this.markCache=Object.create(null),this.tree=At(e.state),this.decorations=this.buildDeco(e,Wf(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=At(e.state),n=Wf(e.state),r=n!=Wf(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!r&&t.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return Qe.none;let n=new Ur;for(let{from:r,to:s}of e.visibleRanges)PL(this.tree,t,(o,l,a)=>{n.add(o,l,this.markCache[a]||(this.markCache[a]=Qe.mark({class:a})))},r,s);return n.finish()}}const i6=gr.high(Vt.fromClass(n6,{decorations:i=>i.decorations})),r6=Oh.define([{tag:I.meta,color:"#404740"},{tag:I.link,textDecoration:"underline"},{tag:I.heading,textDecoration:"underline",fontWeight:"bold"},{tag:I.emphasis,fontStyle:"italic"},{tag:I.strong,fontWeight:"bold"},{tag:I.strikethrough,textDecoration:"line-through"},{tag:I.keyword,color:"#708"},{tag:[I.atom,I.bool,I.url,I.contentSeparator,I.labelName],color:"#219"},{tag:[I.literal,I.inserted],color:"#164"},{tag:[I.string,I.deleted],color:"#a11"},{tag:[I.regexp,I.escape,I.special(I.string)],color:"#e40"},{tag:I.definition(I.variableName),color:"#00f"},{tag:I.local(I.variableName),color:"#30a"},{tag:[I.typeName,I.namespace],color:"#085"},{tag:I.className,color:"#167"},{tag:[I.special(I.variableName),I.macroName],color:"#256"},{tag:I.definition(I.propertyName),color:"#00c"},{tag:I.comment,color:"#940"},{tag:I.invalid,color:"#f00"}]),s6=pe.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),I2=1e4,N2="()[]{}",Z2=ye.define({combine(i){return Qi(i,{afterCursor:!0,brackets:N2,maxScanDistance:I2,renderMatch:a6})}}),o6=Qe.mark({class:"cm-matchingBracket"}),l6=Qe.mark({class:"cm-nonmatchingBracket"});function a6(i){let e=[],t=i.matched?o6:l6;return e.push(t.range(i.start.from,i.start.to)),i.end&&e.push(t.range(i.end.from,i.end.to)),e}const c6=Jt.define({create(){return Qe.none},update(i,e){if(!e.docChanged&&!e.selection)return i;let t=[],n=e.state.facet(Z2);for(let r of e.state.selection.ranges){if(!r.empty)continue;let s=Yi(e.state,r.head,-1,n)||r.head>0&&Yi(e.state,r.head-1,1,n)||n.afterCursor&&(Yi(e.state,r.head,1,n)||r.head<e.state.doc.length&&Yi(e.state,r.head+1,-1,n));s&&(t=t.concat(n.renderMatch(s,e.state)))}return Qe.set(t,!0)},provide:i=>pe.decorations.from(i)}),u6=[c6,s6];function h6(i={}){return[Z2.of(i),u6]}const B2=new Ze;function Sm(i,e,t){let n=i.prop(e<0?Ze.openedBy:Ze.closedBy);if(n)return n;if(i.name.length==1){let r=t.indexOf(i.name);if(r>-1&&r%2==(e<0?1:0))return[t[r+e]]}return null}function _m(i){let e=i.type.prop(B2);return e?e(i.node):i}function Yi(i,e,t,n={}){let r=n.maxScanDistance||I2,s=n.brackets||N2,o=At(i),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let c=Sm(a.type,t,s);if(c&&a.from<a.to){let u=_m(a);if(u&&(t>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return f6(i,e,t,a,u,c,s)}}return d6(i,e,t,o,l.type,r,s)}function f6(i,e,t,n,r,s,o){let l=n.parent,a={from:r.from,to:r.to},c=0,u=l==null?void 0:l.cursor();if(u&&(t<0?u.childBefore(n.from):u.childAfter(n.to)))do if(t<0?u.to<=n.from:u.from>=n.to){if(c==0&&s.indexOf(u.type.name)>-1&&u.from<u.to){let h=_m(u);return{start:a,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(Sm(u.type,t,o))c++;else if(Sm(u.type,-t,o)){if(c==0){let h=_m(u);return{start:a,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}c--}}while(t<0?u.prevSibling():u.nextSibling());return{start:a,matched:!1}}function d6(i,e,t,n,r,s,o){let l=t<0?i.sliceDoc(e-1,e):i.sliceDoc(e,e+1),a=o.indexOf(l);if(a<0||a%2==0!=t>0)return null;let c={from:t<0?e-1:e,to:t>0?e+1:e},u=i.doc.iterRange(e,t>0?i.doc.length:0),h=0;for(let f=0;!u.next().done&&f<=s;){let d=u.value;t<0&&(f+=d.length);let m=e+f*t;for(let p=t>0?0:d.length-1,g=t>0?d.length:-1;p!=g;p+=t){let v=o.indexOf(d[p]);if(!(v<0||n.resolveInner(m+p,1).type!=r))if(v%2==0==t>0)h++;else{if(h==1)return{start:c,end:{from:m+p,to:m+p+1},matched:v>>1==a>>1};h--}}t>0&&(f+=d.length)}return u.done?{start:c,matched:!1}:null}const m6=Object.create(null),$b=[tn.none],Lb=[],Ib=Object.create(null),p6=Object.create(null);for(let[i,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])p6[i]=g6(m6,e);function Xf(i,e){Lb.indexOf(i)>-1||(Lb.push(i),console.warn(e))}function g6(i,e){let t=[];for(let l of e.split(" ")){let a=[];for(let c of l.split(".")){let u=i[c]||I[c];u?typeof u=="function"?a.length?a=a.map(u):Xf(c,`Modifier ${c} used at start of tag`):a.length?Xf(c,`Tag ${c} used as modifier`):a=Array.isArray(u)?u:[u]:Xf(c,`Unknown highlighting tag ${c}`)}for(let c of a)t.push(c)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),r=n+" "+t.map(l=>l.id),s=Ib[r];if(s)return s.id;let o=Ib[r]=tn.define({id:$b.length,name:n,props:[Xs({[n]:t})]});return $b.push(o),o.id}Rt.RTL,Rt.LTR;const O6=i=>{let{state:e}=i,t=e.doc.lineAt(e.selection.main.from),n=Ap(i.state,t.from);return n.line?b6(i):n.block?w6(i):!1};function Pp(i,e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=i(e,t);return r?(n(t.update(r)),!0):!1}}const b6=Pp(S6,0),v6=Pp(W2,0),w6=Pp((i,e)=>W2(i,e,k6(e)),0);function Ap(i,e){let t=i.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const pl=50;function y6(i,{open:e,close:t},n,r){let s=i.sliceDoc(n-pl,n),o=i.sliceDoc(r,r+pl),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,c=s.length-l;if(s.slice(c-e.length,c)==e&&o.slice(a,a+t.length)==t)return{open:{pos:n-l,margin:l&&1},close:{pos:r+a,margin:a&&1}};let u,h;r-n<=2*pl?u=h=i.sliceDoc(n,r):(u=i.sliceDoc(n,n+pl),h=i.sliceDoc(r-pl,r));let f=/^\s*/.exec(u)[0].length,d=/\s*$/.exec(h)[0].length,m=h.length-d-t.length;return u.slice(f,f+e.length)==e&&h.slice(m,m+t.length)==t?{open:{pos:n+f+e.length,margin:/\s/.test(u.charAt(f+e.length))?1:0},close:{pos:r-d-t.length,margin:/\s/.test(h.charAt(m-1))?1:0}}:null}function k6(i){let e=[];for(let t of i.selection.ranges){let n=i.doc.lineAt(t.from),r=t.to<=n.to?n:i.doc.lineAt(t.to),s=e.length-1;s>=0&&e[s].to>n.from?e[s].to=r.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:r.to})}return e}function W2(i,e,t=e.selection.ranges){let n=t.map(s=>Ap(e,s.from).block);if(!n.every(s=>s))return null;let r=t.map((s,o)=>y6(e,n[o],s.from,s.to));if(i!=2&&!r.every(s=>s))return{changes:e.changes(t.map((s,o)=>r[o]?[]:[{from:s.from,insert:n[o].open+" "},{from:s.to,insert:" "+n[o].close}]))};if(i!=1&&r.some(s=>s)){let s=[];for(let o=0,l;o<r.length;o++)if(l=r[o]){let a=n[o],{open:c,close:u}=l;s.push({from:c.pos-a.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+a.close.length})}return{changes:s}}return null}function S6(i,e,t=e.selection.ranges){let n=[],r=-1;for(let{from:s,to:o}of t){let l=n.length,a=1e9,c=Ap(e,s).line;if(c){for(let u=s;u<=o;){let h=e.doc.lineAt(u);if(h.from>r&&(s==o||o>h.from)){r=h.from;let f=/^\s*/.exec(h.text)[0].length,d=f==h.length,m=h.text.slice(f,f+c.length)==c?f:-1;f<h.text.length&&f<a&&(a=f),n.push({line:h,comment:m,token:c,indent:f,empty:d,single:!1})}u=h.to+1}if(a<1e9)for(let u=l;u<n.length;u++)n[u].indent<n[u].line.text.length&&(n[u].indent=a);n.length==l+1&&(n[l].single=!0)}}if(i!=2&&n.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:c,empty:u,single:h}of n)(h||!u)&&s.push({from:l.from+c,insert:a+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(i!=1&&n.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:a}of n)if(l>=0){let c=o.from+l,u=c+a.length;o.text[u-o.from]==" "&&u++,s.push({from:c,to:u})}return{changes:s}}return null}const Cm=Or.define(),_6=Or.define(),C6=ye.define(),X2=ye.define({combine(i){return Qi(i,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),F2=Jt.define({create(){return zi.empty},update(i,e){let t=e.state.facet(X2),n=e.annotation(Cm);if(n){let a=$n.fromTransaction(e,n.selection),c=n.side,u=c==0?i.undone:i.done;return a?u=Zu(u,u.length,t.minDepth,a):u=V2(u,e.startState.selection),new zi(c==0?n.rest:u,c==0?u:n.rest)}let r=e.annotation(_6);if((r=="full"||r=="before")&&(i=i.isolate()),e.annotation(Ht.addToHistory)===!1)return e.changes.empty?i:i.addMapping(e.changes.desc);let s=$n.fromTransaction(e),o=e.annotation(Ht.time),l=e.annotation(Ht.userEvent);return s?i=i.addChanges(s,o,l,t,e):e.selection&&(i=i.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(r=="full"||r=="after")&&(i=i.isolate()),i},toJSON(i){return{done:i.done.map(e=>e.toJSON()),undone:i.undone.map(e=>e.toJSON())}},fromJSON(i){return new zi(i.done.map($n.fromJSON),i.undone.map($n.fromJSON))}});function P6(i={}){return[F2,X2.of(i),pe.domEventHandlers({beforeinput(e,t){let n=e.inputType=="historyUndo"?Y2:e.inputType=="historyRedo"?Pm:null;return n?(e.preventDefault(),n(t)):!1}})]}function bh(i,e){return function({state:t,dispatch:n}){if(!e&&t.readOnly)return!1;let r=t.field(F2,!1);if(!r)return!1;let s=r.pop(i,t,e);return s?(n(s),!0):!1}}const Y2=bh(0,!1),Pm=bh(1,!1),A6=bh(0,!0),x6=bh(1,!0);class $n{constructor(e,t,n,r,s){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=s}setSelAfter(e){return new $n(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new $n(e.changes&&en.fromJSON(e.changes),[],e.mapped&&ji.fromJSON(e.mapped),e.startSelection&&q.fromJSON(e.startSelection),e.selectionsAfter.map(q.fromJSON))}static fromTransaction(e,t){let n=ci;for(let r of e.startState.facet(C6)){let s=r(e);s.length&&(n=n.concat(s))}return!n.length&&e.changes.empty?null:new $n(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,ci)}static selection(e){return new $n(void 0,ci,void 0,void 0,e)}}function Zu(i,e,t,n){let r=e+1>t+20?e-t-1:0,s=i.slice(r,e);return s.push(n),s}function T6(i,e){let t=[],n=!1;return i.iterChangedRanges((r,s)=>t.push(r,s)),e.iterChangedRanges((r,s,o,l)=>{for(let a=0;a<t.length;){let c=t[a++],u=t[a++];l>=c&&o<=u&&(n=!0)}}),n}function Q6(i,e){return i.ranges.length==e.ranges.length&&i.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length===0}function z2(i,e){return i.length?e.length?i.concat(e):i:e}const ci=[],M6=200;function V2(i,e){if(i.length){let t=i[i.length-1],n=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-M6));return n.length&&n[n.length-1].eq(e)?i:(n.push(e),Zu(i,i.length-1,1e9,t.setSelAfter(n)))}else return[$n.selection([e])]}function E6(i){let e=i[i.length-1],t=i.slice();return t[i.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Ff(i,e){if(!i.length)return i;let t=i.length,n=ci;for(;t;){let r=R6(i[t-1],e,n);if(r.changes&&!r.changes.empty||r.effects.length){let s=i.slice(0,t);return s[t-1]=r,s}else e=r.mapped,t--,n=r.selectionsAfter}return n.length?[$n.selection(n)]:ci}function R6(i,e,t){let n=z2(i.selectionsAfter.length?i.selectionsAfter.map(l=>l.map(e)):ci,t);if(!i.changes)return $n.selection(n);let r=i.changes.map(e),s=e.mapDesc(i.changes,!0),o=i.mapped?i.mapped.composeDesc(s):s;return new $n(r,Fe.mapEffects(i.effects,e),o,i.startSelection.map(s),n)}const D6=/^(input\.type|delete)($|\.)/;class zi{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new zi(this.done,this.undone):this}addChanges(e,t,n,r,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!n||D6.test(n))&&(!l.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(s,T6(l.changes,e.changes))||n=="input.type.compose")?o=Zu(o,o.length-1,r.minDepth,new $n(e.changes.compose(l.changes),z2(e.effects,l.effects),l.mapped,l.startSelection,ci)):o=Zu(o,o.length,r.minDepth,e),new zi(o,ci,t,n)}addSelection(e,t,n,r){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:ci;return s.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&Q6(s[s.length-1],e)?this:new zi(V2(this.done,e),this.undone,t,n)}addMapping(e){return new zi(Ff(this.done,e),Ff(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let s=r[r.length-1],o=s.selectionsAfter[0]||t.selection;if(n&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:Cm.of({side:e,rest:E6(r),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let l=r.length==1?ci:r.slice(0,r.length-1);return s.mapped&&(l=Ff(l,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:Cm.of({side:e,rest:l,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}zi.empty=new zi(ci,ci);const $6=[{key:"Mod-z",run:Y2,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Pm,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Pm,preventDefault:!0},{key:"Mod-u",run:A6,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:x6,preventDefault:!0}];function Vo(i,e){return q.create(i.ranges.map(e),i.mainIndex)}function Ji(i,e){return i.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Mi({state:i,dispatch:e},t){let n=Vo(i.selection,t);return n.eq(i.selection,!0)?!1:(e(Ji(i,n)),!0)}function vh(i,e){return q.cursor(e?i.to:i.from)}function U2(i,e){return Mi(i,t=>t.empty?i.moveByChar(t,e):vh(t,e))}function bn(i){return i.textDirectionAt(i.state.selection.main.head)==Rt.LTR}const j2=i=>U2(i,!bn(i)),q2=i=>U2(i,bn(i));function G2(i,e){return Mi(i,t=>t.empty?i.moveByGroup(t,e):vh(t,e))}const L6=i=>G2(i,!bn(i)),I6=i=>G2(i,bn(i));function N6(i,e,t){if(e.type.prop(t))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(i.sliceDoc(e.from,e.to)))||e.firstChild}function wh(i,e,t){let n=At(i).resolveInner(e.head),r=t?Ze.closedBy:Ze.openedBy;for(let a=e.head;;){let c=t?n.childAfter(a):n.childBefore(a);if(!c)break;N6(i,c,r)?n=c:a=t?c.to:c.from}let s=n.type.prop(r),o,l;return s&&(o=t?Yi(i,n.from,1):Yi(i,n.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?n.to:n.from,q.cursor(l,t?-1:1)}const Z6=i=>Mi(i,e=>wh(i.state,e,!bn(i))),B6=i=>Mi(i,e=>wh(i.state,e,bn(i)));function H2(i,e){return Mi(i,t=>{if(!t.empty)return vh(t,e);let n=i.moveVertically(t,e);return n.head!=t.head?n:i.moveToLineBoundary(t,e)})}const K2=i=>H2(i,!1),J2=i=>H2(i,!0);function e_(i){let e=i.scrollDOM.clientHeight<i.scrollDOM.scrollHeight-2,t=0,n=0,r;if(e){for(let s of i.state.facet(pe.scrollMargins)){let o=s(i);o!=null&&o.top&&(t=Math.max(o==null?void 0:o.top,t)),o!=null&&o.bottom&&(n=Math.max(o==null?void 0:o.bottom,n))}r=i.scrollDOM.clientHeight-t-n}else r=(i.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:n,selfScroll:e,height:Math.max(i.defaultLineHeight,r-5)}}function t_(i,e){let t=e_(i),{state:n}=i,r=Vo(n.selection,o=>o.empty?i.moveVertically(o,e,t.height):vh(o,e));if(r.eq(n.selection))return!1;let s;if(t.selfScroll){let o=i.coordsAtPos(n.selection.main.head),l=i.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,c=l.bottom-t.marginBottom;o&&o.top>a&&o.bottom<c&&(s=pe.scrollIntoView(r.main.head,{y:"start",yMargin:o.top-a}))}return i.dispatch(Ji(n,r),{effects:s}),!0}const Nb=i=>t_(i,!1),Am=i=>t_(i,!0);function ts(i,e,t){let n=i.lineBlockAt(e.head),r=i.moveToLineBoundary(e,t);if(r.head==e.head&&r.head!=(t?n.to:n.from)&&(r=i.moveToLineBoundary(e,t,!1)),!t&&r.head==n.from&&n.length){let s=/^\s*/.exec(i.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;s&&e.head!=n.from+s&&(r=q.cursor(n.from+s))}return r}const W6=i=>Mi(i,e=>ts(i,e,!0)),X6=i=>Mi(i,e=>ts(i,e,!1)),F6=i=>Mi(i,e=>ts(i,e,!bn(i))),Y6=i=>Mi(i,e=>ts(i,e,bn(i))),z6=i=>Mi(i,e=>q.cursor(i.lineBlockAt(e.head).from,1)),V6=i=>Mi(i,e=>q.cursor(i.lineBlockAt(e.head).to,-1));function U6(i,e,t){let n=!1,r=Vo(i.selection,s=>{let o=Yi(i,s.head,-1)||Yi(i,s.head,1)||s.head>0&&Yi(i,s.head-1,1)||s.head<i.doc.length&&Yi(i,s.head+1,-1);if(!o||!o.end)return s;n=!0;let l=o.start.from==s.head?o.end.to:o.end.from;return q.cursor(l)});return n?(e(Ji(i,r)),!0):!1}const j6=({state:i,dispatch:e})=>U6(i,e);function di(i,e){let t=Vo(i.state.selection,n=>{let r=e(n);return q.range(n.anchor,r.head,r.goalColumn,r.bidiLevel||void 0)});return t.eq(i.state.selection)?!1:(i.dispatch(Ji(i.state,t)),!0)}function n_(i,e){return di(i,t=>i.moveByChar(t,e))}const i_=i=>n_(i,!bn(i)),r_=i=>n_(i,bn(i));function s_(i,e){return di(i,t=>i.moveByGroup(t,e))}const q6=i=>s_(i,!bn(i)),G6=i=>s_(i,bn(i)),H6=i=>di(i,e=>wh(i.state,e,!bn(i))),K6=i=>di(i,e=>wh(i.state,e,bn(i)));function o_(i,e){return di(i,t=>i.moveVertically(t,e))}const l_=i=>o_(i,!1),a_=i=>o_(i,!0);function c_(i,e){return di(i,t=>i.moveVertically(t,e,e_(i).height))}const Zb=i=>c_(i,!1),Bb=i=>c_(i,!0),J6=i=>di(i,e=>ts(i,e,!0)),e7=i=>di(i,e=>ts(i,e,!1)),t7=i=>di(i,e=>ts(i,e,!bn(i))),n7=i=>di(i,e=>ts(i,e,bn(i))),i7=i=>di(i,e=>q.cursor(i.lineBlockAt(e.head).from)),r7=i=>di(i,e=>q.cursor(i.lineBlockAt(e.head).to)),Wb=({state:i,dispatch:e})=>(e(Ji(i,{anchor:0})),!0),Xb=({state:i,dispatch:e})=>(e(Ji(i,{anchor:i.doc.length})),!0),Fb=({state:i,dispatch:e})=>(e(Ji(i,{anchor:i.selection.main.anchor,head:0})),!0),Yb=({state:i,dispatch:e})=>(e(Ji(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0),s7=({state:i,dispatch:e})=>(e(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"})),!0),o7=({state:i,dispatch:e})=>{let t=yh(i).map(({from:n,to:r})=>q.range(n,Math.min(r+1,i.doc.length)));return e(i.update({selection:q.create(t),userEvent:"select"})),!0},l7=({state:i,dispatch:e})=>{let t=Vo(i.selection,n=>{var r;let s=At(i).resolveStack(n.from,1);for(let o=s;o;o=o.next){let{node:l}=o;if((l.from<n.from&&l.to>=n.to||l.to>n.to&&l.from<=n.from)&&(!((r=l.parent)===null||r===void 0)&&r.parent))return q.range(l.to,l.from)}return n});return e(Ji(i,t)),!0},a7=({state:i,dispatch:e})=>{let t=i.selection,n=null;return t.ranges.length>1?n=q.create([t.main]):t.main.empty||(n=q.create([q.cursor(t.main.head)])),n?(e(Ji(i,n)),!0):!1};function Xa(i,e){if(i.state.readOnly)return!1;let t="delete.selection",{state:n}=i,r=n.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=e(s);a<o?(t="delete.backward",a=Ac(i,a,!1)):a>o&&(t="delete.forward",a=Ac(i,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=Ac(i,o,!1),l=Ac(i,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:q.cursor(o,o<s.head?-1:1)}});return r.changes.empty?!1:(i.dispatch(n.update(r,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?pe.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function Ac(i,e,t){if(i instanceof pe)for(let n of i.state.facet(pe.atomicRanges).map(r=>r(i)))n.between(e,e,(r,s)=>{r<e&&s>e&&(e=t?s:r)});return e}const u_=(i,e,t)=>Xa(i,n=>{let r=n.from,{state:s}=i,o=s.doc.lineAt(r),l,a;if(t&&!e&&r>o.from&&r<o.from+200&&!/[^ \t]/.test(l=o.text.slice(0,r-o.from))){if(l[l.length-1]==" ")return r-1;let c=Ci(l,s.tabSize),u=c%Lu(s)||Lu(s);for(let h=0;h<u&&l[l.length-1-h]==" ";h++)r--;a=r}else a=hn(o.text,r-o.from,e,e)+o.from,a==r&&o.number!=(e?s.doc.lines:1)?a+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(a-o.from,r-o.from))&&(a=hn(o.text,a-o.from,!1,!1)+o.from);return a}),xm=i=>u_(i,!1,!0),h_=i=>u_(i,!0,!1),f_=(i,e)=>Xa(i,t=>{let n=t.head,{state:r}=i,s=r.doc.lineAt(n),o=r.charCategorizer(n);for(let l=null;;){if(n==(e?s.to:s.from)){n==t.head&&s.number!=(e?r.doc.lines:1)&&(n+=e?1:-1);break}let a=hn(s.text,n-s.from,e)+s.from,c=s.text.slice(Math.min(n,a)-s.from,Math.max(n,a)-s.from),u=o(c);if(l!=null&&u!=l)break;(c!=" "||n!=t.head)&&(l=u),n=a}return n}),d_=i=>f_(i,!1),c7=i=>f_(i,!0),u7=i=>Xa(i,e=>{let t=i.lineBlockAt(e.head).to;return e.head<t?t:Math.min(i.state.doc.length,e.head+1)}),h7=i=>Xa(i,e=>{let t=i.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),f7=i=>Xa(i,e=>{let t=i.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(i.state.doc.length,e.head+1)}),d7=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=i.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:at.of(["",""])},range:q.cursor(n.from)}));return e(i.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},m7=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=i.changeByRange(n=>{if(!n.empty||n.from==0||n.from==i.doc.length)return{range:n};let r=n.from,s=i.doc.lineAt(r),o=r==s.from?r-1:hn(s.text,r-s.from,!1)+s.from,l=r==s.to?r+1:hn(s.text,r-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:i.doc.slice(r,l).append(i.doc.slice(o,r))},range:q.cursor(l)}});return t.changes.empty?!1:(e(i.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function yh(i){let e=[],t=-1;for(let n of i.selection.ranges){let r=i.doc.lineAt(n.from),s=i.doc.lineAt(n.to);if(!n.empty&&n.to==s.from&&(s=i.doc.lineAt(n.to-1)),t>=r.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(n)}else e.push({from:r.from,to:s.to,ranges:[n]});t=s.number+1}return e}function m_(i,e,t){if(i.readOnly)return!1;let n=[],r=[];for(let s of yh(i)){if(t?s.to==i.doc.length:s.from==0)continue;let o=i.doc.lineAt(t?s.to+1:s.from-1),l=o.length+1;if(t){n.push({from:s.to,to:o.to},{from:s.from,insert:o.text+i.lineBreak});for(let a of s.ranges)r.push(q.range(Math.min(i.doc.length,a.anchor+l),Math.min(i.doc.length,a.head+l)))}else{n.push({from:o.from,to:s.from},{from:s.to,insert:i.lineBreak+o.text});for(let a of s.ranges)r.push(q.range(a.anchor-l,a.head-l))}}return n.length?(e(i.update({changes:n,scrollIntoView:!0,selection:q.create(r,i.selection.mainIndex),userEvent:"move.line"})),!0):!1}const p7=({state:i,dispatch:e})=>m_(i,e,!1),g7=({state:i,dispatch:e})=>m_(i,e,!0);function p_(i,e,t){if(i.readOnly)return!1;let n=[];for(let r of yh(i))t?n.push({from:r.from,insert:i.doc.slice(r.from,r.to)+i.lineBreak}):n.push({from:r.to,insert:i.lineBreak+i.doc.slice(r.from,r.to)});return e(i.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const O7=({state:i,dispatch:e})=>p_(i,e,!1),b7=({state:i,dispatch:e})=>p_(i,e,!0),v7=i=>{if(i.state.readOnly)return!1;let{state:e}=i,t=e.changes(yh(e).map(({from:r,to:s})=>(r>0?r--:s<e.doc.length&&s++,{from:r,to:s}))),n=Vo(e.selection,r=>{let s;if(i.lineWrapping){let o=i.lineBlockAt(r.head),l=i.coordsAtPos(r.head,r.assoc||1);l&&(s=o.bottom+i.documentTop-l.bottom+i.defaultLineHeight/2)}return i.moveVertically(r,!0,s)}).map(t);return i.dispatch({changes:t,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function w7(i,e){if(/\(\)|\[\]|\{\}/.test(i.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=At(i).resolveInner(e),n=t.childBefore(e),r=t.childAfter(e),s;return n&&r&&n.to<=e&&r.from>=e&&(s=n.type.prop(Ze.closedBy))&&s.indexOf(r.name)>-1&&i.doc.lineAt(n.to).from==i.doc.lineAt(r.from).from&&!/\S/.test(i.sliceDoc(n.to,r.from))?{from:n.to,to:r.from}:null}const y7=g_(!1),k7=g_(!0);function g_(i){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{let{from:s,to:o}=r,l=e.doc.lineAt(s),a=!i&&s==o&&w7(e,s);i&&(s=o=(o<=l.to?l:e.doc.lineAt(o)).to);let c=new ph(e,{simulateBreak:s,simulateDoubleBreak:!!a}),u=Sp(c,s);for(u==null&&(u=Ci(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<l.to&&/\s/.test(l.text[o-l.from]);)o++;a?{from:s,to:o}=a:s>l.from&&s<l.from+100&&!/\S/.test(l.text.slice(0,s))&&(s=l.from);let h=["",va(e,u)];return a&&h.push(va(e,c.lineIndent(l.from,-1))),{changes:{from:s,to:o,insert:at.of(h)},range:q.cursor(s+1+h[1].length)}});return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function xp(i,e){let t=-1;return i.changeByRange(n=>{let r=[];for(let o=n.from;o<=n.to;){let l=i.doc.lineAt(o);l.number>t&&(n.empty||n.to>l.from)&&(e(l,r,n),t=l.number),o=l.to+1}let s=i.changes(r);return{changes:r,range:q.range(s.mapPos(n.anchor,1),s.mapPos(n.head,1))}})}const S7=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=Object.create(null),n=new ph(i,{overrideIndentation:s=>{let o=t[s];return o??-1}}),r=xp(i,(s,o,l)=>{let a=Sp(n,s.from);if(a==null)return;/\S/.test(s.text)||(a=0);let c=/^\s*/.exec(s.text)[0],u=va(i,a);(c!=u||l.from<s.from+c.length)&&(t[s.from]=a,o.push({from:s.from,to:s.from+c.length,insert:u}))});return r.changes.empty||e(i.update(r,{userEvent:"indent"})),!0},O_=({state:i,dispatch:e})=>i.readOnly?!1:(e(i.update(xp(i,(t,n)=>{n.push({from:t.from,insert:i.facet(Ba)})}),{userEvent:"input.indent"})),!0),b_=({state:i,dispatch:e})=>i.readOnly?!1:(e(i.update(xp(i,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let s=Ci(r,i.tabSize),o=0,l=va(i,Math.max(0,s-Lu(i)));for(;o<r.length&&o<l.length&&r.charCodeAt(o)==l.charCodeAt(o);)o++;n.push({from:t.from+o,to:t.from+r.length,insert:l.slice(o)})}),{userEvent:"delete.dedent"})),!0),_7=i=>(i.setTabFocusMode(),!0),C7=[{key:"Ctrl-b",run:j2,shift:i_,preventDefault:!0},{key:"Ctrl-f",run:q2,shift:r_},{key:"Ctrl-p",run:K2,shift:l_},{key:"Ctrl-n",run:J2,shift:a_},{key:"Ctrl-a",run:z6,shift:i7},{key:"Ctrl-e",run:V6,shift:r7},{key:"Ctrl-d",run:h_},{key:"Ctrl-h",run:xm},{key:"Ctrl-k",run:u7},{key:"Ctrl-Alt-h",run:d_},{key:"Ctrl-o",run:d7},{key:"Ctrl-t",run:m7},{key:"Ctrl-v",run:Am}],P7=[{key:"ArrowLeft",run:j2,shift:i_,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:L6,shift:q6,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:F6,shift:t7,preventDefault:!0},{key:"ArrowRight",run:q2,shift:r_,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:I6,shift:G6,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Y6,shift:n7,preventDefault:!0},{key:"ArrowUp",run:K2,shift:l_,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Wb,shift:Fb},{mac:"Ctrl-ArrowUp",run:Nb,shift:Zb},{key:"ArrowDown",run:J2,shift:a_,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Xb,shift:Yb},{mac:"Ctrl-ArrowDown",run:Am,shift:Bb},{key:"PageUp",run:Nb,shift:Zb},{key:"PageDown",run:Am,shift:Bb},{key:"Home",run:X6,shift:e7,preventDefault:!0},{key:"Mod-Home",run:Wb,shift:Fb},{key:"End",run:W6,shift:J6,preventDefault:!0},{key:"Mod-End",run:Xb,shift:Yb},{key:"Enter",run:y7},{key:"Mod-a",run:s7},{key:"Backspace",run:xm,shift:xm},{key:"Delete",run:h_},{key:"Mod-Backspace",mac:"Alt-Backspace",run:d_},{key:"Mod-Delete",mac:"Alt-Delete",run:c7},{mac:"Mod-Backspace",run:h7},{mac:"Mod-Delete",run:f7}].concat(C7.map(i=>({mac:i.key,run:i.run,shift:i.shift}))),A7=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Z6,shift:H6},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:B6,shift:K6},{key:"Alt-ArrowUp",run:p7},{key:"Shift-Alt-ArrowUp",run:O7},{key:"Alt-ArrowDown",run:g7},{key:"Shift-Alt-ArrowDown",run:b7},{key:"Escape",run:a7},{key:"Mod-Enter",run:k7},{key:"Alt-l",mac:"Ctrl-l",run:o7},{key:"Mod-i",run:l7,preventDefault:!0},{key:"Mod-[",run:b_},{key:"Mod-]",run:O_},{key:"Mod-Alt-\\",run:S7},{key:"Shift-Mod-k",run:v7},{key:"Shift-Mod-\\",run:j6},{key:"Mod-/",run:O6},{key:"Alt-A",run:v6},{key:"Ctrl-m",mac:"Shift-Alt-m",run:_7}].concat(P7),v_={key:"Tab",run:O_,shift:b_};function Ct(){var i=arguments[0];typeof i=="string"&&(i=document.createElement(i));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];typeof r=="string"?i.setAttribute(n,r):r!=null&&(i[n]=r)}e++}for(;e<arguments.length;e++)w_(i,arguments[e]);return i}function w_(i,e){if(typeof e=="string")i.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)i.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)w_(i,e[t]);else throw new RangeError("Unsupported child node: "+e)}const zb=typeof String.prototype.normalize=="function"?i=>i.normalize("NFKD"):i=>i;class $o{constructor(e,t,n=0,r=e.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=s?l=>s(zb(l)):zb,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return ln(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=sp(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=oi(e);let r=this.normalize(t);for(let s=0,o=n;;s++){let l=r.charCodeAt(s),a=this.match(l,o,this.bufferPos+this.bufferStart);if(s==r.length-1){if(a)return this.value=a,this;break}o==n&&s<t.length&&t.charCodeAt(s)==l&&o++}}}match(e,t,n){let r=null;for(let s=0;s<this.matches.length;s+=2){let o=this.matches[s],l=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?r={from:this.matches[s+1],to:n}:(this.matches[s]++,l=!0)),l||(this.matches.splice(s,2),s-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}}typeof Symbol<"u"&&($o.prototype[Symbol.iterator]=function(){return this});const y_={from:-1,to:-1,match:/.*/.exec("")},Tp="gm"+(/x/.unicode==null?"":"u");class k_{constructor(e,t,n,r=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=y_,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new S_(e,t,n,r,s);this.re=new RegExp(t,Tp+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.iter=e.iter();let o=e.lineAt(r);this.curLineStart=o.from,this.matchPos=Bu(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=Bu(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const Yf=new WeakMap;class yo{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let r=Yf.get(e);if(!r||r.from>=n||r.to<=t){let l=new yo(t,e.sliceString(t,n));return Yf.set(e,l),l}if(r.from==t&&r.to==n)return r;let{text:s,from:o}=r;return o>t&&(s=e.sliceString(t,o)+s,o=t),r.to<n&&(s+=e.sliceString(r.to,n)),Yf.set(e,new yo(o,s)),new yo(t,s.slice(t-o,n-o))}}class S_{constructor(e,t,n,r,s){this.text=e,this.to=s,this.done=!1,this.value=y_,this.matchPos=Bu(e,r),this.re=new RegExp(t,Tp+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.flat=yo.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let n=this.flat.from+t.index,r=n+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this.matchPos=Bu(this.text,r+(n==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=yo.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(k_.prototype[Symbol.iterator]=S_.prototype[Symbol.iterator]=function(){return this});function x7(i){try{return new RegExp(i,Tp),!0}catch{return!1}}function Bu(i,e){if(e>=i.length)return e;let t=i.lineAt(e),n;for(;e<t.to&&(n=t.text.charCodeAt(e-t.from))>=56320&&n<57344;)e++;return e}function Tm(i){let e=String(i.state.doc.lineAt(i.state.selection.main.head).number),t=Ct("input",{class:"cm-textfield",name:"line",value:e}),n=Ct("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),i.dispatch({effects:Wu.of(!1)}),i.focus()):s.keyCode==13&&(s.preventDefault(),r())},onsubmit:s=>{s.preventDefault(),r()}},Ct("label",i.state.phrase("Go to line"),": ",t)," ",Ct("button",{class:"cm-button",type:"submit"},i.state.phrase("go")));function r(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!s)return;let{state:o}=i,l=o.doc.lineAt(o.selection.main.head),[,a,c,u,h]=s,f=u?+u.slice(1):0,d=c?+c:l.number;if(c&&h){let g=d/100;a&&(g=g*(a=="-"?-1:1)+l.number/o.doc.lines),d=Math.round(o.doc.lines*g)}else c&&a&&(d=d*(a=="-"?-1:1)+l.number);let m=o.doc.line(Math.max(1,Math.min(o.doc.lines,d))),p=q.cursor(m.from+Math.max(0,Math.min(f,m.length)));i.dispatch({effects:[Wu.of(!1),pe.scrollIntoView(p.from,{y:"center"})],selection:p}),i.focus()}return{dom:n}}const Wu=Fe.define(),Vb=Jt.define({create(){return!0},update(i,e){for(let t of e.effects)t.is(Wu)&&(i=t.value);return i},provide:i=>pa.from(i,e=>e?Tm:null)}),T7=i=>{let e=ma(i,Tm);if(!e){let t=[Wu.of(!0)];i.state.field(Vb,!1)==null&&t.push(Fe.appendConfig.of([Vb,Q7])),i.dispatch({effects:t}),e=ma(i,Tm)}return e&&e.dom.querySelector("input").select(),!0},Q7=pe.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),M7={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},E7=ye.define({combine(i){return Qi(i,M7,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function R7(i){return[N7,I7]}const D7=Qe.mark({class:"cm-selectionMatch"}),$7=Qe.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Ub(i,e,t,n){return(t==0||i(e.sliceDoc(t-1,t))!=$t.Word)&&(n==e.doc.length||i(e.sliceDoc(n,n+1))!=$t.Word)}function L7(i,e,t,n){return i(e.sliceDoc(t,t+1))==$t.Word&&i(e.sliceDoc(n-1,n))==$t.Word}const I7=Vt.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.selectionSet||i.docChanged||i.viewportChanged)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=i.state.facet(E7),{state:t}=i,n=t.selection;if(n.ranges.length>1)return Qe.none;let r=n.main,s,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return Qe.none;let a=t.wordAt(r.head);if(!a)return Qe.none;o=t.charCategorizer(r.head),s=t.sliceDoc(a.from,a.to)}else{let a=r.to-r.from;if(a<e.minSelectionLength||a>200)return Qe.none;if(e.wholeWords){if(s=t.sliceDoc(r.from,r.to),o=t.charCategorizer(r.head),!(Ub(o,t,r.from,r.to)&&L7(o,t,r.from,r.to)))return Qe.none}else if(s=t.sliceDoc(r.from,r.to),!s)return Qe.none}let l=[];for(let a of i.visibleRanges){let c=new $o(t.doc,s,a.from,a.to);for(;!c.next().done;){let{from:u,to:h}=c.value;if((!o||Ub(o,t,u,h))&&(r.empty&&u<=r.from&&h>=r.to?l.push($7.range(u,h)):(u>=r.to||h<=r.from)&&l.push(D7.range(u,h)),l.length>e.maxMatches))return Qe.none}}return Qe.set(l)}},{decorations:i=>i.decorations}),N7=pe.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Z7=({state:i,dispatch:e})=>{let{selection:t}=i,n=q.create(t.ranges.map(r=>i.wordAt(r.head)||q.cursor(r.head)),t.mainIndex);return n.eq(t)?!1:(e(i.update({selection:n})),!0)};function B7(i,e){let{main:t,ranges:n}=i.selection,r=i.wordAt(t.head),s=r&&r.from==t.from&&r.to==t.to;for(let o=!1,l=new $o(i.doc,e,n[n.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new $o(i.doc,e,0,Math.max(0,n[n.length-1].from-1)),o=!0}else{if(o&&n.some(a=>a.from==l.value.from))continue;if(s){let a=i.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const W7=({state:i,dispatch:e})=>{let{ranges:t}=i.selection;if(t.some(s=>s.from===s.to))return Z7({state:i,dispatch:e});let n=i.sliceDoc(t[0].from,t[0].to);if(i.selection.ranges.some(s=>i.sliceDoc(s.from,s.to)!=n))return!1;let r=B7(i,n);return r?(e(i.update({selection:i.selection.addRange(q.range(r.from,r.to),!1),effects:pe.scrollIntoView(r.to)})),!0):!1},Uo=ye.define({combine(i){return Qi(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new J7(e),scrollToMatch:e=>pe.scrollIntoView(e)})}});class __{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||x7(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,n)=>n=="n"?`
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new z7(this):new F7(this)}getCursor(e,t=0,n){let r=e.doc?e:et.create({doc:e});return n==null&&(n=r.doc.length),this.regexp?to(this,r,t,n):eo(this,r,t,n)}}class C_{constructor(e){this.spec=e}}function eo(i,e,t,n){return new $o(e.doc,i.unquoted,t,n,i.caseSensitive?void 0:r=>r.toLowerCase(),i.wholeWord?X7(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function X7(i,e){return(t,n,r,s)=>((s>t||s+r.length<n)&&(s=Math.max(0,t-2),r=i.sliceString(s,Math.min(i.length,n+2))),(e(Xu(r,t-s))!=$t.Word||e(Fu(r,t-s))!=$t.Word)&&(e(Fu(r,n-s))!=$t.Word||e(Xu(r,n-s))!=$t.Word))}class F7 extends C_{constructor(e){super(e)}nextMatch(e,t,n){let r=eo(this.spec,e,n,e.doc.length).nextOverlapping();return r.done&&(r=eo(this.spec,e,0,t).nextOverlapping()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let s=Math.max(t,r-1e4-this.spec.unquoted.length),o=eo(this.spec,e,s,r),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(s==t)return null;r-=1e4}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=eo(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let s=eo(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}}function to(i,e,t,n){return new k_(e.doc,i.search,{ignoreCase:!i.caseSensitive,test:i.wholeWord?Y7(e.charCategorizer(e.selection.main.head)):void 0},t,n)}function Xu(i,e){return i.slice(hn(i,e,!1),e)}function Fu(i,e){return i.slice(e,hn(i,e))}function Y7(i){return(e,t,n)=>!n[0].length||(i(Xu(n.input,n.index))!=$t.Word||i(Fu(n.input,n.index))!=$t.Word)&&(i(Fu(n.input,n.index+n[0].length))!=$t.Word||i(Xu(n.input,n.index+n[0].length))!=$t.Word)}class z7 extends C_{nextMatch(e,t,n){let r=to(this.spec,e,n,e.doc.length).next();return r.done&&(r=to(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let s=Math.max(t,n-r*1e4),o=to(this.spec,e,s,n),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==t||l.from>s+10))return l;if(s==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(t,n)=>n=="$"?"$":n=="&"?e.match[0]:n!="0"&&+n<e.match.length?e.match[n]:t)}matchAll(e,t){let n=to(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let s=to(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}}const wa=Fe.define(),Qp=Fe.define(),Br=Jt.define({create(i){return new zf(Qm(i).create(),null)},update(i,e){for(let t of e.effects)t.is(wa)?i=new zf(t.value.create(),i.panel):t.is(Qp)&&(i=new zf(i.query,t.value?Mp:null));return i},provide:i=>pa.from(i,e=>e.panel)});class zf{constructor(e,t){this.query=e,this.panel=t}}const V7=Qe.mark({class:"cm-searchMatch"}),U7=Qe.mark({class:"cm-searchMatch cm-searchMatch-selected"}),j7=Vt.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(Br))}update(i){let e=i.state.field(Br);(e!=i.startState.field(Br)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:i,panel:e}){if(!e||!i.spec.valid)return Qe.none;let{view:t}=this,n=new Ur;for(let r=0,s=t.visibleRanges,o=s.length;r<o;r++){let{from:l,to:a}=s[r];for(;r<o-1&&a>s[r+1].from-2*250;)a=s[++r].to;i.highlight(t.state,l,a,(c,u)=>{let h=t.state.selection.ranges.some(f=>f.from==c&&f.to==u);n.add(c,u,h?U7:V7)})}return n.finish()}},{decorations:i=>i.decorations});function Fa(i){return e=>{let t=e.state.field(Br,!1);return t&&t.query.spec.valid?i(e,t):x_(e)}}const Yu=Fa((i,{query:e})=>{let{to:t}=i.state.selection.main,n=e.nextMatch(i.state,t,t);if(!n)return!1;let r=q.single(n.from,n.to),s=i.state.facet(Uo);return i.dispatch({selection:r,effects:[Ep(i,n),s.scrollToMatch(r.main,i)],userEvent:"select.search"}),A_(i),!0}),zu=Fa((i,{query:e})=>{let{state:t}=i,{from:n}=t.selection.main,r=e.prevMatch(t,n,n);if(!r)return!1;let s=q.single(r.from,r.to),o=i.state.facet(Uo);return i.dispatch({selection:s,effects:[Ep(i,r),o.scrollToMatch(s.main,i)],userEvent:"select.search"}),A_(i),!0}),q7=Fa((i,{query:e})=>{let t=e.matchAll(i.state,1e3);return!t||!t.length?!1:(i.dispatch({selection:q.create(t.map(n=>q.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),G7=({state:i,dispatch:e})=>{let t=i.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:n,to:r}=t.main,s=[],o=0;for(let l=new $o(i.doc,i.sliceDoc(n,r));!l.next().done;){if(s.length>1e3)return!1;l.value.from==n&&(o=s.length),s.push(q.range(l.value.from,l.value.to))}return e(i.update({selection:q.create(s,o),userEvent:"select.search.matches"})),!0},jb=Fa((i,{query:e})=>{let{state:t}=i,{from:n,to:r}=t.selection.main;if(t.readOnly)return!1;let s=e.nextMatch(t,n,n);if(!s)return!1;let o=[],l,a,c=[];if(s.from==n&&s.to==r&&(a=t.toText(e.getReplacement(s)),o.push({from:s.from,to:s.to,insert:a}),s=e.nextMatch(t,s.from,s.to),c.push(pe.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(n).number)+"."))),s){let u=o.length==0||o[0].from>=s.to?0:s.to-s.from-a.length;l=q.single(s.from-u,s.to-u),c.push(Ep(i,s)),c.push(t.facet(Uo).scrollToMatch(l.main,i))}return i.dispatch({changes:o,selection:l,effects:c,userEvent:"input.replace"}),!0}),H7=Fa((i,{query:e})=>{if(i.state.readOnly)return!1;let t=e.matchAll(i.state,1e9).map(r=>{let{from:s,to:o}=r;return{from:s,to:o,insert:e.getReplacement(r)}});if(!t.length)return!1;let n=i.state.phrase("replaced $ matches",t.length)+".";return i.dispatch({changes:t,effects:pe.announce.of(n),userEvent:"input.replace.all"}),!0});function Mp(i){return i.state.facet(Uo).createPanel(i)}function Qm(i,e){var t,n,r,s,o;let l=i.selection.main,a=l.empty||l.to>l.from+100?"":i.sliceDoc(l.from,l.to);if(e&&!a)return e;let c=i.facet(Uo);return new __({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:c.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(n=e==null?void 0:e.caseSensitive)!==null&&n!==void 0?n:c.caseSensitive,literal:(r=e==null?void 0:e.literal)!==null&&r!==void 0?r:c.literal,regexp:(s=e==null?void 0:e.regexp)!==null&&s!==void 0?s:c.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function P_(i){let e=ma(i,Mp);return e&&e.dom.querySelector("[main-field]")}function A_(i){let e=P_(i);e&&e==i.root.activeElement&&e.select()}const x_=i=>{let e=i.state.field(Br,!1);if(e&&e.panel){let t=P_(i);if(t&&t!=i.root.activeElement){let n=Qm(i.state,e.query.spec);n.valid&&i.dispatch({effects:wa.of(n)}),t.focus(),t.select()}}else i.dispatch({effects:[Qp.of(!0),e?wa.of(Qm(i.state,e.query.spec)):Fe.appendConfig.of(tI)]});return!0},T_=i=>{let e=i.state.field(Br,!1);if(!e||!e.panel)return!1;let t=ma(i,Mp);return t&&t.dom.contains(i.root.activeElement)&&i.focus(),i.dispatch({effects:Qp.of(!1)}),!0},K7=[{key:"Mod-f",run:x_,scope:"editor search-panel"},{key:"F3",run:Yu,shift:zu,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Yu,shift:zu,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:T_,scope:"editor search-panel"},{key:"Mod-Shift-l",run:G7},{key:"Mod-Alt-g",run:T7},{key:"Mod-d",run:W7,preventDefault:!0}];class J7{constructor(e){this.view=e;let t=this.query=e.state.field(Br).query.spec;this.commit=this.commit.bind(this),this.searchField=Ct("input",{value:t.search,placeholder:Bn(e,"Find"),"aria-label":Bn(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ct("input",{value:t.replace,placeholder:Bn(e,"Replace"),"aria-label":Bn(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ct("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Ct("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Ct("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(r,s,o){return Ct("button",{class:"cm-button",name:r,onclick:s,type:"button"},o)}this.dom=Ct("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,n("next",()=>Yu(e),[Bn(e,"next")]),n("prev",()=>zu(e),[Bn(e,"previous")]),n("select",()=>q7(e),[Bn(e,"all")]),Ct("label",null,[this.caseField,Bn(e,"match case")]),Ct("label",null,[this.reField,Bn(e,"regexp")]),Ct("label",null,[this.wordField,Bn(e,"by word")]),...e.state.readOnly?[]:[Ct("br"),this.replaceField,n("replace",()=>jb(e),[Bn(e,"replace")]),n("replaceAll",()=>H7(e),[Bn(e,"replace all")])],Ct("button",{name:"close",onclick:()=>T_(e),"aria-label":Bn(e,"close"),type:"button"},["×"])])}commit(){let e=new __({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:wa.of(e)}))}keydown(e){a$(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?zu:Yu)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),jb(this.view))}update(e){for(let t of e.transactions)for(let n of t.effects)n.is(wa)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Uo).top}}function Bn(i,e){return i.state.phrase(e)}const xc=30,Tc=/[\s\.,:;?!]/;function Ep(i,{from:e,to:t}){let n=i.state.doc.lineAt(e),r=i.state.doc.lineAt(t).to,s=Math.max(n.from,e-xc),o=Math.min(r,t+xc),l=i.state.sliceDoc(s,o);if(s!=n.from){for(let a=0;a<xc;a++)if(!Tc.test(l[a+1])&&Tc.test(l[a])){l=l.slice(a);break}}if(o!=r){for(let a=l.length-1;a>l.length-xc;a--)if(!Tc.test(l[a-1])&&Tc.test(l[a])){l=l.slice(0,a);break}}return pe.announce.of(`${i.state.phrase("current match")}. ${l} ${i.state.phrase("on line")} ${n.number}.`)}const eI=pe.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),tI=[Br,gr.low(j7),eI];class Rp{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=At(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),s=r.search(M_(e,!1));return s<0?null:{from:n+s,to:this.pos,text:r.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function qb(i){let e=Object.keys(i).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function nI(i){let e=Object.create(null),t=Object.create(null);for(let{label:r}of i){e[r[0]]=!0;for(let s=1;s<r.length;s++)t[r[s]]=!0}let n=qb(e)+qb(t)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function Q_(i){let e=i.map(r=>typeof r=="string"?{label:r}:r),[t,n]=e.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:nI(e);return r=>{let s=r.matchBefore(n);return s||r.explicit?{from:s?s.from:r.pos,options:e,validFor:t}:null}}function iI(i,e){return t=>{for(let n=At(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(i.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(t)}}class Gb{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}}function Wr(i){return i.selection.main.from}function M_(i,e){var t;let{source:n}=i,r=e&&n[0]!="^",s=n[n.length-1]!="$";return!r&&!s?i:new RegExp(`${r?"^":""}(?:${n})${s?"$":""}`,(t=i.flags)!==null&&t!==void 0?t:i.ignoreCase?"i":"")}const Dp=Or.define();function rI(i,e,t,n){let{main:r}=i.selection,s=t-r.from,o=n-r.from;return Object.assign(Object.assign({},i.changeByRange(l=>l!=r&&t!=n&&i.sliceDoc(l.from+s,l.from+o)!=i.sliceDoc(t,n)?{range:l}:{changes:{from:l.from+s,to:n==r.from?l.to:l.from+o,insert:e},range:q.cursor(l.from+s+e.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}const Hb=new WeakMap;function sI(i){if(!Array.isArray(i))return i;let e=Hb.get(i);return e||Hb.set(i,e=Q_(i)),e}const Vu=Fe.define(),ya=Fe.define();class oI{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=ln(e,t),r=oi(n);this.chars.push(n);let s=e.slice(t,t+r),o=s.toUpperCase();this.folded.push(ln(o==s?s.toLowerCase():o,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:s,byWord:o}=this;if(t.length==1){let w=ln(e,0),S=oi(w),_=S==e.length?0:-100;if(w!=t[0])if(w==n[0])_+=-200;else return null;return this.ret(_,[0,S])}let l=e.indexOf(this.pattern);if(l==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=t.length,c=0;if(l<0){for(let w=0,S=Math.min(e.length,200);w<S&&c<a;){let _=ln(e,w);(_==t[c]||_==n[c])&&(r[c++]=w),w+=oi(_)}if(c<a)return null}let u=0,h=0,f=!1,d=0,m=-1,p=-1,g=/[a-z]/.test(e),v=!0;for(let w=0,S=Math.min(e.length,200),_=0;w<S&&h<a;){let k=ln(e,w);l<0&&(u<a&&k==t[u]&&(s[u++]=w),d<a&&(k==t[d]||k==n[d]?(d==0&&(m=w),p=w+1,d++):d=0));let A,C=k<255?k>=48&&k<=57||k>=97&&k<=122?2:k>=65&&k<=90?1:0:(A=sp(k))!=A.toLowerCase()?1:A!=A.toUpperCase()?2:0;(!w||C==1&&g||_==0&&C!=0)&&(t[h]==k||n[h]==k&&(f=!0)?o[h++]=w:o.length&&(v=!1)),_=C,w+=oi(k)}return h==a&&o[0]==0&&v?this.result(-100+(f?-200:0),o,e):d==a&&m==0?this.ret(-200-e.length+(p==e.length?0:-100),[0,p]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[m,p]):h==a?this.result(-100+(f?-200:0)+-700+(v?0:-1100),o,e):t.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,n){let r=[],s=0;for(let o of t){let l=o+(this.astral?oi(ln(n,o)):1);s&&r[s-1]==o?r[s-1]=l:(r[s++]=o,r[s++]=l)}return this.ret(e-n.length,r)}}class lI{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const un=ye.define({combine(i){return Qi(i,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:aI,filterStrict:!1,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>Kb(e(n),t(n)),optionClass:(e,t)=>n=>Kb(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Kb(i,e){return i?e?i+" "+e:i:e}function aI(i,e,t,n,r,s){let o=i.textDirection==Rt.RTL,l=o,a=!1,c="top",u,h,f=e.left-r.left,d=r.right-e.right,m=n.right-n.left,p=n.bottom-n.top;if(l&&f<Math.min(m,d)?l=!1:!l&&d<Math.min(m,f)&&(l=!0),m<=(l?f:d))u=Math.max(r.top,Math.min(t.top,r.bottom-p))-e.top,h=Math.min(400,l?f:d);else{a=!0,h=Math.min(400,(o?e.right:r.right-e.left)-30);let w=r.bottom-e.bottom;w>=p||w>e.top?u=t.bottom-e.top:(c="bottom",u=e.bottom-t.top)}let g=(e.bottom-e.top)/s.offsetHeight,v=(e.right-e.left)/s.offsetWidth;return{style:`${c}: ${u/g}px; max-width: ${h/v}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}function cI(i){let e=i.addToOptions.slice();return i.icons&&e.push({render(t){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),t.type&&n.classList.add(...t.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(t,n,r,s){let o=document.createElement("span");o.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let c=0;c<s.length;){let u=s[c++],h=s[c++];u>a&&o.appendChild(document.createTextNode(l.slice(a,u)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(l.slice(u,h))),f.className="cm-completionMatchedText",a=h}return a<l.length&&o.appendChild(document.createTextNode(l.slice(a))),o},position:50},{render(t){if(!t.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=t.detail,n},position:80}),e.sort((t,n)=>t.position-n.position).map(t=>t.render)}function Vf(i,e,t){if(i<=t)return{from:0,to:i};if(e<0&&(e=0),e<=i>>1){let r=Math.floor(e/t);return{from:r*t,to:(r+1)*t}}let n=Math.floor((i-e)/t);return{from:i-(n+1)*t,to:i-n*t}}class uI{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let r=e.state.field(t),{options:s,selected:o}=r.open,l=e.state.facet(un);this.optionContent=cI(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=Vf(s.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:c}=e.state.field(t).open;for(let u=a.target,h;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(h=/-(\d+)$/.exec(u.id))&&+h[1]<c.length){this.applyCompletion(e,c[+h[1]]),a.preventDefault();return}}),this.dom.addEventListener("focusout",a=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(un).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:ya.of(null)})}),this.showOptions(s,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=r){let{options:s,selected:o,disabled:l}=n.open;(!r.open||r.open.options!=s)&&(this.range=Vf(s.length,o,e.state.facet(un).maxRenderedOptions),this.showOptions(s,n.id)),this.updateSel(),l!=((t=r.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of t.split(" "))n&&this.dom.classList.add(n);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=Vf(t.options.length,t.selected,this.view.state.facet(un).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:n}=t.options[t.selected],{info:r}=n;if(!r)return;let s=typeof r=="string"?document.createTextNode(r):r(n);if(!s)return;"then"in s?s.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,n)}).catch(o=>_n(this.view.state,o,"completion info")):this.addInfoPane(s,n)}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:r,destroy:s}=e;n.appendChild(r),this.infoDestroy=s||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!="LI"||!n.id?r--:r==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected");return t&&fI(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return r.top>Math.min(s.bottom,t.bottom)-10||r.bottom<Math.max(s.top,t.top)+10?null:this.view.state.facet(un).positionInfo(this.view,t,r,n,s,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){const r=document.createElement("ul");r.id=t,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions"));let s=null;for(let o=n.from;o<n.to;o++){let{completion:l,match:a}=e[o],{section:c}=l;if(c){let f=typeof c=="string"?c:c.name;if(f!=s&&(o>n.from||n.from==0))if(s=f,typeof c!="string"&&c.header)r.appendChild(c.header(c));else{let d=r.appendChild(document.createElement("completion-section"));d.textContent=f}}const u=r.appendChild(document.createElement("li"));u.id=t+"-"+o,u.setAttribute("role","option");let h=this.optionClass(l);h&&(u.className=h);for(let f of this.optionContent){let d=f(l,this.view.state,this.view,a);d&&u.appendChild(d)}}return n.from&&r.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&r.classList.add("cm-completionListIncompleteBottom"),r}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function hI(i,e){return t=>new uI(t,i,e)}function fI(i,e){let t=i.getBoundingClientRect(),n=e.getBoundingClientRect(),r=t.height/i.offsetHeight;n.top<t.top?i.scrollTop-=(t.top-n.top)/r:n.bottom>t.bottom&&(i.scrollTop+=(n.bottom-t.bottom)/r)}function Jb(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function dI(i,e){let t=[],n=null,r=c=>{t.push(c);let{section:u}=c.completion;if(u){n||(n=[]);let h=typeof u=="string"?u:u.name;n.some(f=>f.name==h)||n.push(typeof u=="string"?{name:h}:u)}},s=e.facet(un);for(let c of i)if(c.hasResult()){let u=c.result.getMatch;if(c.result.filter===!1)for(let h of c.result.options)r(new Gb(h,c.source,u?u(h):[],1e9-t.length));else{let h=e.sliceDoc(c.from,c.to),f,d=s.filterStrict?new lI(h):new oI(h);for(let m of c.result.options)if(f=d.match(m.label)){let p=m.displayLabel?u?u(m,f.matched):[]:f.matched;r(new Gb(m,c.source,p,f.score+(m.boost||0)))}}}if(n){let c=Object.create(null),u=0,h=(f,d)=>{var m,p;return((m=f.rank)!==null&&m!==void 0?m:1e9)-((p=d.rank)!==null&&p!==void 0?p:1e9)||(f.name<d.name?-1:1)};for(let f of n.sort(h))u-=1e5,c[f.name]=u;for(let f of t){let{section:d}=f.completion;d&&(f.score+=c[typeof d=="string"?d:d.name])}}let o=[],l=null,a=s.compareCompletions;for(let c of t.sort((u,h)=>h.score-u.score||a(u.completion,h.completion))){let u=c.completion;!l||l.label!=u.label||l.detail!=u.detail||l.type!=null&&u.type!=null&&l.type!=u.type||l.apply!=u.apply||l.boost!=u.boost?o.push(c):Jb(c.completion)>Jb(l)&&(o[o.length-1]=c),l=c.completion}return o}class oo{constructor(e,t,n,r,s,o){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=s,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new oo(this.options,ev(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,r,s){let o=dI(e,t);if(!o.length)return r&&e.some(a=>a.state==1)?new oo(r.options,r.attrs,r.tooltip,r.timestamp,r.selected,!0):null;let l=t.facet(un).selectOnOpen?0:-1;if(r&&r.selected!=l&&r.selected!=-1){let a=r.options[r.selected].completion;for(let c=0;c<o.length;c++)if(o[c].completion==a){l=c;break}}return new oo(o,ev(n,l),{pos:e.reduce((a,c)=>c.hasResult()?Math.min(a,c.from):a,1e8),create:vI,above:s.aboveCursor},r?r.timestamp:Date.now(),l,!1)}map(e){return new oo(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class Uu{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new Uu(OI,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(un),s=(n.override||t.languageDataAt("autocomplete",Wr(t)).map(sI)).map(l=>(this.active.find(c=>c.source==l)||new Gn(l,this.active.some(c=>c.state!=0)?1:0)).update(e,n));s.length==this.active.length&&s.every((l,a)=>l==this.active[a])&&(s=this.active);let o=this.open;o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!mI(s,this.active)?o=oo.build(s,t,this.id,o,n):o&&o.disabled&&!s.some(l=>l.state==1)&&(o=null),!o&&s.every(l=>l.state!=1)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new Gn(l.source,0):l));for(let l of e.effects)l.is(D_)&&(o=o&&o.setSelected(l.value,this.id));return s==this.active&&o==this.open?this:new Uu(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?pI:gI}}function mI(i,e){if(i==e)return!0;for(let t=0,n=0;;){for(;t<i.length&&!i[t].hasResult;)t++;for(;n<e.length&&!e[n].hasResult;)n++;let r=t==i.length,s=n==e.length;if(r||s)return r==s;if(i[t++].result!=e[n++].result)return!1}}const pI={"aria-autocomplete":"list"},gI={};function ev(i,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":i};return e>-1&&(t["aria-activedescendant"]=i+"-"+e),t}const OI=[];function E_(i,e){if(i.isUserEvent("input.complete")){let n=i.annotation(Dp);if(n&&e.activateOnCompletion(n))return 12}let t=i.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:i.isUserEvent("delete.backward")?2:i.selection?8:i.docChanged?16:0}class Gn{constructor(e,t,n=-1){this.source=e,this.state=t,this.explicitPos=n}hasResult(){return!1}update(e,t){let n=E_(e,t),r=this;(n&8||n&16&&this.touches(e))&&(r=new Gn(r.source,0)),n&4&&r.state==0&&(r=new Gn(this.source,1)),r=r.updateFor(e,n);for(let s of e.effects)if(s.is(Vu))r=new Gn(r.source,1,s.value?Wr(e.state):-1);else if(s.is(ya))r=new Gn(r.source,0);else if(s.is(R_))for(let o of s.value)o.source==r.source&&(r=o);return r}updateFor(e,t){return this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new Gn(this.source,this.state,e.mapPos(this.explicitPos))}touches(e){return e.changes.touchesRange(Wr(e.state))}}class ko extends Gn{constructor(e,t,n,r,s){super(e,2,t),this.result=n,this.from=r,this.to=s}hasResult(){return!0}updateFor(e,t){var n;if(!(t&3))return this.map(e.changes);let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=Wr(e.state);if((this.explicitPos<0?l<=s:l<this.from)||l>o||!r||t&2&&Wr(e.startState)==this.from)return new Gn(this.source,t&4?1:0);let a=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos);return bI(r.validFor,e.state,s,o)?new ko(this.source,a,r,s,o):r.update&&(r=r.update(r,s,o,new Rp(e.state,l,a>=0)))?new ko(this.source,a,r,r.from,(n=r.to)!==null&&n!==void 0?n:Wr(e.state)):new Gn(this.source,1,a)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new ko(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Gn(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function bI(i,e,t,n){if(!i)return!1;let r=e.sliceDoc(t,n);return typeof i=="function"?i(r,t,n,e):M_(i,!0).test(r)}const R_=Fe.define({map(i,e){return i.map(t=>t.map(e))}}),D_=Fe.define(),Rn=Jt.define({create(){return Uu.start()},update(i,e){return i.update(e)},provide:i=>[dh.from(i,e=>e.tooltip),pe.contentAttributes.from(i,e=>e.attrs)]});function $p(i,e){const t=e.completion.apply||e.completion.label;let n=i.state.field(Rn).active.find(r=>r.source==e.source);return n instanceof ko?(typeof t=="string"?i.dispatch(Object.assign(Object.assign({},rI(i.state,t,n.from,n.to)),{annotations:Dp.of(e.completion)})):t(i,e.completion,n.from,n.to),!0):!1}const vI=hI(Rn,$p);function Qc(i,e="option"){return t=>{let n=t.state.field(Rn,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<t.state.facet(un).interactionDelay)return!1;let r=1,s;e=="page"&&(s=f2(t,n.open.tooltip))&&(r=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=n.open.options,l=n.open.selected>-1?n.open.selected+r*(i?1:-1):i?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:D_.of(l)}),!0}}const wI=i=>{let e=i.state.field(Rn,!1);return i.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<i.state.facet(un).interactionDelay?!1:$p(i,e.open.options[e.open.selected])},yI=i=>i.state.field(Rn,!1)?(i.dispatch({effects:Vu.of(!0)}),!0):!1,kI=i=>{let e=i.state.field(Rn,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(i.dispatch({effects:ya.of(null)}),!0)};class SI{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const _I=50,CI=1e3,PI=Vt.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of i.state.field(Rn).active)e.state==1&&this.startQuery(e)}update(i){let e=i.state.field(Rn),t=i.state.facet(un);if(!i.selectionSet&&!i.docChanged&&i.startState.field(Rn)==e)return;let n=i.transactions.some(s=>{let o=E_(s,t);return o&8||(s.selection||s.docChanged)&&!(o&3)});for(let s=0;s<this.running.length;s++){let o=this.running[s];if(n||o.context.abortOnDocChange&&i.docChanged||o.updates.length+i.transactions.length>_I&&Date.now()-o.time>CI){for(let l of o.context.abortListeners)try{l()}catch(a){_n(this.view.state,a)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...i.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),i.transactions.some(s=>s.effects.some(o=>o.is(Vu)))&&(this.pendingStart=!0);let r=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.state==1&&!this.running.some(o=>o.active.source==s.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let s of i.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:i}=this.view,e=i.field(Rn);for(let t of e.active)t.state==1&&!this.running.some(n=>n.active.source==t.source)&&this.startQuery(t)}startQuery(i){let{state:e}=this.view,t=Wr(e),n=new Rp(e,t,i.explicitPos==t,this.view),r=new SI(i,n);this.running.push(r),Promise.resolve(i.source(n)).then(s=>{r.context.aborted||(r.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:ya.of(null)}),_n(this.view.state,s)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(un).updateSyncTime))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(un);for(let n=0;n<this.running.length;n++){let r=this.running[n];if(r.done===void 0)continue;if(this.running.splice(n--,1),r.done){let o=new ko(r.active.source,r.active.explicitPos,r.done,r.done.from,(i=r.done.to)!==null&&i!==void 0?i:Wr(r.updates.length?r.updates[0].startState:this.view.state));for(let l of r.updates)o=o.update(l,t);if(o.hasResult()){e.push(o);continue}}let s=this.view.state.field(Rn).active.find(o=>o.source==r.active.source);if(s&&s.state==1)if(r.done==null){let o=new Gn(r.active.source,0);for(let l of r.updates)o=o.update(l,t);o.state!=1&&e.push(o)}else this.startQuery(s)}e.length&&this.view.dispatch({effects:R_.of(e)})}},{eventHandlers:{blur(i){let e=this.view.state.field(Rn,!1);if(e&&e.tooltip&&this.view.state.facet(un).closeOnBlur){let t=e.open&&f2(this.view,e.open.tooltip);(!t||!t.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:ya.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Vu.of(!1)}),20),this.composing=0}}}),AI=typeof navigator=="object"&&/Win/.test(navigator.platform),xI=gr.highest(pe.domEventHandlers({keydown(i,e){let t=e.state.field(Rn,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||i.key.length>1||i.ctrlKey&&!(AI&&i.altKey)||i.metaKey)return!1;let n=t.open.options[t.open.selected],r=t.active.find(o=>o.source==n.source),s=n.completion.commitCharacters||r.result.commitCharacters;return s&&s.indexOf(i.key)>-1&&$p(e,n),!1}})),$_=pe.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"''"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class TI{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}}class Lp{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,cn.TrackDel),n=e.mapPos(this.to,1,cn.TrackDel);return t==null||n==null?null:new Lp(this.field,t,n)}}class Ip{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],s=e.doc.lineAt(t),o=/^\s*/.exec(s.text)[0];for(let a of this.lines){if(n.length){let c=o,u=/^\t*/.exec(a)[0].length;for(let h=0;h<u;h++)c+=e.facet(Ba);r.push(t+c.length-u),a=c+a.slice(u)}n.push(a),t+=a.length+1}let l=this.fieldPositions.map(a=>new Lp(a.field,r[a.line]+a.from,r[a.line]+a.to));return{text:n,ranges:l}}static parse(e){let t=[],n=[],r=[],s;for(let o of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^}]*))?|((?:\\[{}]|[^}])*))\}/.exec(o);){let l=s[1]?+s[1]:null,a=s[2]||s[3]||"",c=-1,u=a.replace(/\\[{}]/g,h=>h[1]);for(let h=0;h<t.length;h++)(l!=null?t[h].seq==l:u&&t[h].name==u)&&(c=h);if(c<0){let h=0;for(;h<t.length&&(l==null||t[h].seq!=null&&t[h].seq<l);)h++;t.splice(h,0,{seq:l,name:u}),c=h;for(let f of r)f.field>=c&&f.field++}r.push(new TI(c,n.length,s.index,s.index+u.length)),o=o.slice(0,s.index)+a+o.slice(s.index+s[0].length)}o=o.replace(/\\([{}])/g,(l,a,c)=>{for(let u of r)u.line==n.length&&u.from>c&&(u.from--,u.to--);return a}),n.push(o)}return new Ip(n,r)}}let QI=Qe.widget({widget:new class extends br{toDOM(){let i=document.createElement("span");return i.className="cm-snippetFieldPosition",i}ignoreEvent(){return!1}}}),MI=Qe.mark({class:"cm-snippetField"});class jo{constructor(e,t){this.ranges=e,this.active=t,this.deco=Qe.set(e.map(n=>(n.from==n.to?QI:MI).range(n.from,n.to)))}map(e){let t=[];for(let n of this.ranges){let r=n.map(e);if(!r)return null;t.push(r)}return new jo(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(n=>n.field==this.active&&n.from<=t.from&&n.to>=t.to))}}const Ya=Fe.define({map(i,e){return i&&i.map(e)}}),EI=Fe.define(),ka=Jt.define({create(){return null},update(i,e){for(let t of e.effects){if(t.is(Ya))return t.value;if(t.is(EI)&&i)return new jo(i.ranges,t.value)}return i&&e.docChanged&&(i=i.map(e.changes)),i&&e.selection&&!i.selectionInsideField(e.selection)&&(i=null),i},provide:i=>pe.decorations.from(i,e=>e?e.deco:Qe.none)});function Np(i,e){return q.create(i.filter(t=>t.field==e).map(t=>q.range(t.from,t.to)))}function RI(i){let e=Ip.parse(i);return(t,n,r,s)=>{let{text:o,ranges:l}=e.instantiate(t.state,r),a={changes:{from:r,to:s,insert:at.of(o)},scrollIntoView:!0,annotations:n?[Dp.of(n),Ht.userEvent.of("input.complete")]:void 0};if(l.length&&(a.selection=Np(l,0)),l.some(c=>c.field>0)){let c=new jo(l,0),u=a.effects=[Ya.of(c)];t.state.field(ka,!1)===void 0&&u.push(Fe.appendConfig.of([ka,NI,ZI,$_]))}t.dispatch(t.state.update(a))}}function L_(i){return({state:e,dispatch:t})=>{let n=e.field(ka,!1);if(!n||i<0&&n.active==0)return!1;let r=n.active+i,s=i>0&&!n.ranges.some(o=>o.field==r+i);return t(e.update({selection:Np(n.ranges,r),effects:Ya.of(s?null:new jo(n.ranges,r)),scrollIntoView:!0})),!0}}const DI=({state:i,dispatch:e})=>i.field(ka,!1)?(e(i.update({effects:Ya.of(null)})),!0):!1,$I=L_(1),LI=L_(-1),II=[{key:"Tab",run:$I,shift:LI},{key:"Escape",run:DI}],tv=ye.define({combine(i){return i.length?i[0]:II}}),NI=gr.highest(Ws.compute([tv],i=>i.facet(tv)));function Qn(i,e){return Object.assign(Object.assign({},e),{apply:RI(i)})}const ZI=pe.domEventHandlers({mousedown(i,e){let t=e.state.field(ka,!1),n;if(!t||(n=e.posAtCoords({x:i.clientX,y:i.clientY}))==null)return!1;let r=t.ranges.find(s=>s.from<=n&&s.to>=n);return!r||r.field==t.active?!1:(e.dispatch({selection:Np(t.ranges,r.field),effects:Ya.of(t.ranges.some(s=>s.field>r.field)?new jo(t.ranges,r.field):null),scrollIntoView:!0}),!0)}}),Sa={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ss=Fe.define({map(i,e){let t=e.mapPos(i,-1,cn.TrackAfter);return t??void 0}}),Zp=new class extends Ms{};Zp.startSide=1;Zp.endSide=-1;const I_=Jt.define({create(){return tt.empty},update(i,e){if(i=i.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);i=i.update({filter:n=>n>=t.from&&n<=t.to})}for(let t of e.effects)t.is(Ss)&&(i=i.update({add:[Zp.range(t.value,t.value+1)]}));return i}});function BI(){return[XI,I_]}const Uf="()[]{}<>";function N_(i){for(let e=0;e<Uf.length;e+=2)if(Uf.charCodeAt(e)==i)return Uf.charAt(e+1);return sp(i<128?i:i+1)}function Z_(i,e){return i.languageDataAt("closeBrackets",e)[0]||Sa}const WI=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),XI=pe.inputHandler.of((i,e,t,n)=>{if((WI?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let r=i.state.selection.main;if(n.length>2||n.length==2&&oi(ln(n,0))==1||e!=r.from||t!=r.to)return!1;let s=zI(i.state,n);return s?(i.dispatch(s),!0):!1}),FI=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let n=Z_(i,i.selection.main.head).brackets||Sa.brackets,r=null,s=i.changeByRange(o=>{if(o.empty){let l=VI(i.doc,o.head);for(let a of n)if(a==l&&kh(i.doc,o.head)==N_(ln(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:q.cursor(o.head-a.length)}}return{range:r=o}});return r||e(i.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},YI=[{key:"Backspace",run:FI}];function zI(i,e){let t=Z_(i,i.selection.main.head),n=t.brackets||Sa.brackets;for(let r of n){let s=N_(ln(r,0));if(e==r)return s==r?qI(i,r,n.indexOf(r+r+r)>-1,t):UI(i,r,s,t.before||Sa.before);if(e==s&&B_(i,i.selection.main.from))return jI(i,r,s)}return null}function B_(i,e){let t=!1;return i.field(I_).between(0,i.doc.length,n=>{n==e&&(t=!0)}),t}function kh(i,e){let t=i.sliceString(e,e+2);return t.slice(0,oi(ln(t,0)))}function VI(i,e){let t=i.sliceString(e-2,e);return oi(ln(t,0))==t.length?t:t.slice(1)}function UI(i,e,t,n){let r=null,s=i.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:Ss.of(o.to+e.length),range:q.range(o.anchor+e.length,o.head+e.length)};let l=kh(i.doc,o.head);return!l||/\s/.test(l)||n.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:Ss.of(o.head+e.length),range:q.cursor(o.head+e.length)}:{range:r=o}});return r?null:i.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function jI(i,e,t){let n=null,r=i.changeByRange(s=>s.empty&&kh(i.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:q.cursor(s.head+t.length)}:n={range:s});return n?null:i.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function qI(i,e,t,n){let r=n.stringPrefixes||Sa.stringPrefixes,s=null,o=i.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:Ss.of(l.to+e.length),range:q.range(l.anchor+e.length,l.head+e.length)};let a=l.head,c=kh(i.doc,a),u;if(c==e){if(nv(i,a))return{changes:{insert:e+e,from:a},effects:Ss.of(a+e.length),range:q.cursor(a+e.length)};if(B_(i,a)){let f=t&&i.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+f.length,insert:f},range:q.cursor(a+f.length)}}}else{if(t&&i.sliceDoc(a-2*e.length,a)==e+e&&(u=iv(i,a-2*e.length,r))>-1&&nv(i,u))return{changes:{insert:e+e+e+e,from:a},effects:Ss.of(a+e.length),range:q.cursor(a+e.length)};if(i.charCategorizer(a)(c)!=$t.Word&&iv(i,a,r)>-1&&!GI(i,a,e,r))return{changes:{insert:e+e,from:a},effects:Ss.of(a+e.length),range:q.cursor(a+e.length)}}return{range:s=l}});return s?null:i.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function nv(i,e){let t=At(i).resolveInner(e+1);return t.parent&&t.from==e}function GI(i,e,t,n){let r=At(i).resolveInner(e,-1),s=n.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=i.sliceDoc(r.from,Math.min(r.to,r.from+t.length+s)),a=l.indexOf(t);if(!a||a>-1&&n.indexOf(l.slice(0,a))>-1){let u=r.firstChild;for(;u&&u.from==r.from&&u.to-u.from>t.length+a;){if(i.sliceDoc(u.to-t.length,u.to)==t)return!1;u=u.firstChild}return!0}let c=r.to==e&&r.parent;if(!c)break;r=c}return!1}function iv(i,e,t){let n=i.charCategorizer(e);if(n(i.sliceDoc(e-1,e))!=$t.Word)return e;for(let r of t){let s=e-r.length;if(i.sliceDoc(s,e)==r&&n(i.sliceDoc(s-1,s))!=$t.Word)return s}return-1}function W_(i={}){return[xI,Rn,un.of(i),PI,HI,$_]}const Bp=[{key:"Ctrl-Space",run:yI},{key:"Escape",run:kI},{key:"ArrowDown",run:Qc(!0)},{key:"ArrowUp",run:Qc(!1)},{key:"PageDown",run:Qc(!0,"page")},{key:"PageUp",run:Qc(!1,"page")},{key:"Enter",run:wI}],HI=gr.highest(Ws.computeN([un],i=>i.facet(un).defaultKeymap?[Bp]:[]));class KI{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class bs{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let r=e,s=n.facet(Vi).markerFilter;s&&(r=s(r,n));let o=Qe.set(r.map(l=>l.from==l.to||l.from==l.to-1&&n.doc.lineAt(l.from).to==l.from?Qe.widget({widget:new oN(l),diagnostic:l}).range(l.from):Qe.mark({attributes:{class:"cm-lintRange cm-lintRange-"+l.severity+(l.markClass?" "+l.markClass:"")},diagnostic:l}).range(l.from,l.to)),!0);return new bs(o,t,Lo(o))}}function Lo(i,e=null,t=0){let n=null;return i.between(t,1e9,(r,s,{spec:o})=>{if(!(e&&o.diagnostic!=e))return n=new KI(r,s,o.diagnostic),!1}),n}function X_(i,e){let t=e.pos,n=e.end||t,r=i.state.facet(Vi).hideOn(i,t,n);if(r!=null)return r;let s=i.startState.doc.lineAt(e.pos);return!!(i.effects.some(o=>o.is(Sh))||i.changes.touchesRange(s.from,Math.max(s.to,n)))}function F_(i,e){return i.field(Hn,!1)?e:e.concat(Fe.appendConfig.of(H_))}function JI(i,e){return{effects:F_(i,[Sh.of(e)])}}const Sh=Fe.define(),Wp=Fe.define(),Y_=Fe.define(),Hn=Jt.define({create(){return new bs(Qe.none,null,null)},update(i,e){if(e.docChanged&&i.diagnostics.size){let t=i.diagnostics.map(e.changes),n=null,r=i.panel;if(i.selected){let s=e.changes.mapPos(i.selected.from,1);n=Lo(t,i.selected.diagnostic,s)||Lo(t,null,s)}!t.size&&r&&e.state.facet(Vi).autoPanel&&(r=null),i=new bs(t,r,n)}for(let t of e.effects)if(t.is(Sh)){let n=e.state.facet(Vi).autoPanel?t.value.length?_a.open:null:i.panel;i=bs.init(t.value,n,e.state)}else t.is(Wp)?i=new bs(i.diagnostics,t.value?_a.open:null,i.selected):t.is(Y_)&&(i=new bs(i.diagnostics,i.panel,t.value));return i},provide:i=>[pa.from(i,e=>e.panel),pe.decorations.from(i,e=>e.diagnostics)]}),eN=Qe.mark({class:"cm-lintRange cm-lintRange-active"});function tN(i,e,t){let{diagnostics:n}=i.state.field(Hn),r=[],s=2e8,o=0;n.between(e-(t<0?1:0),e+(t>0?1:0),(a,c,{spec:u})=>{e>=a&&e<=c&&(a==c||(e>a||t>0)&&(e<c||t<0))&&(r.push(u.diagnostic),s=Math.min(a,s),o=Math.max(c,o))});let l=i.state.facet(Vi).tooltipFilter;return l&&(r=l(r,i.state)),r.length?{pos:s,end:o,above:i.state.doc.lineAt(s).to<o,create(){return{dom:z_(i,r)}}}:null}function z_(i,e){return Ct("ul",{class:"cm-tooltip-lint"},e.map(t=>j_(i,t,!1)))}const nN=i=>{let e=i.state.field(Hn,!1);(!e||!e.panel)&&i.dispatch({effects:F_(i.state,[Wp.of(!0)])});let t=ma(i,_a.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},rv=i=>{let e=i.state.field(Hn,!1);return!e||!e.panel?!1:(i.dispatch({effects:Wp.of(!1)}),!0)},iN=i=>{let e=i.state.field(Hn,!1);if(!e)return!1;let t=i.state.selection.main,n=e.diagnostics.iter(t.to+1);return!n.value&&(n=e.diagnostics.iter(0),!n.value||n.from==t.from&&n.to==t.to)?!1:(i.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)},V_=[{key:"Mod-Shift-m",run:nN,preventDefault:!0},{key:"F8",run:iN}],rN=Vt.fromClass(class{constructor(i){this.view=i,this.timeout=-1,this.set=!0;let{delay:e}=i.state.facet(Vi);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){clearTimeout(this.timeout);let i=Date.now();if(i<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-i);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet(Vi);t.length&&Promise.all(t.map(n=>Promise.resolve(n(this.view)))).then(n=>{let r=n.reduce((s,o)=>s.concat(o));this.view.state.doc==e.doc&&this.view.dispatch(JI(this.view.state,r))},n=>{_n(this.view.state,n)})}}update(i){let e=i.state.facet(Vi);(i.docChanged||e!=i.startState.facet(Vi)||e.needsRefresh&&e.needsRefresh(i))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),Vi=ye.define({combine(i){return Object.assign({sources:i.map(e=>e.source).filter(e=>e!=null)},Qi(i.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t}))}});function sN(i,e={}){return[Vi.of({source:i,config:e}),rN,H_]}function U_(i){let e=[];if(i)e:for(let{name:t}of i){for(let n=0;n<t.length;n++){let r=t[n];if(/[a-zA-Z]/.test(r)&&!e.some(s=>s.toLowerCase()==r.toLowerCase())){e.push(r);continue e}}e.push("")}return e}function j_(i,e,t){var n;let r=t?U_(e.actions):[];return Ct("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Ct("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(i):e.message),(n=e.actions)===null||n===void 0?void 0:n.map((s,o)=>{let l=!1,a=f=>{if(f.preventDefault(),l)return;l=!0;let d=Lo(i.state.field(Hn).diagnostics,e);d&&s.apply(i,d.from,d.to)},{name:c}=s,u=r[o]?c.indexOf(r[o]):-1,h=u<0?c:[c.slice(0,u),Ct("u",c.slice(u,u+1)),c.slice(u+1)];return Ct("button",{type:"button",class:"cm-diagnosticAction",onclick:a,onmousedown:a,"aria-label":` Action: ${c}${u<0?"":` (access key "${r[o]})"`}.`},h)}),e.source&&Ct("div",{class:"cm-diagnosticSource"},e.source))}class oN extends br{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return Ct("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class sv{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=j_(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class _a{constructor(e){this.view=e,this.items=[];let t=r=>{if(r.keyCode==27)rv(this.view),this.view.focus();else if(r.keyCode==38||r.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(r.keyCode==40||r.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(r.keyCode==36)this.moveSelection(0);else if(r.keyCode==35)this.moveSelection(this.items.length-1);else if(r.keyCode==13)this.view.focus();else if(r.keyCode>=65&&r.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=U_(s.actions);for(let l=0;l<o.length;l++)if(o[l].toUpperCase().charCodeAt(0)==r.keyCode){let a=Lo(this.view.state.field(Hn).diagnostics,s);a&&s.actions[l].apply(e,a.from,a.to)}}else return;r.preventDefault()},n=r=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(r.target)&&this.moveSelection(s)};this.list=Ct("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:n}),this.dom=Ct("div",{class:"cm-panel-lint"},this.list,Ct("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>rv(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Hn).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(Hn),n=0,r=!1,s=null;for(e.between(0,this.view.state.doc.length,(o,l,{spec:a})=>{let c=-1,u;for(let h=n;h<this.items.length;h++)if(this.items[h].diagnostic==a.diagnostic){c=h;break}c<0?(u=new sv(this.view,a.diagnostic),this.items.splice(n,0,u),r=!0):(u=this.items[c],c>n&&(this.items.splice(n,c-n),r=!0)),t&&u.diagnostic==t.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),s=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),n++});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new sv(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:l})=>{let a=l.height/this.list.offsetHeight;o.top<l.top?this.list.scrollTop-=(l.top-o.top)/a:o.bottom>l.bottom&&(this.list.scrollTop+=(o.bottom-l.bottom)/a)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Hn),n=Lo(t.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:Y_.of(n)})}static open(e){return new _a(e)}}function tu(i,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(i)}</svg>')`}function Mc(i){return tu(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${i}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const lN=pe.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Mc("#d11")},".cm-lintRange-warning":{backgroundImage:Mc("orange")},".cm-lintRange-info":{backgroundImage:Mc("#999")},".cm-lintRange-hint":{backgroundImage:Mc("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function ov(i){return i=="error"?4:i=="warning"?3:i=="info"?2:1}class aN extends Ki{constructor(e){super(),this.diagnostics=e,this.severity=e.reduce((t,n)=>ov(t)<ov(n.severity)?n.severity:t,"hint")}toDOM(e){let t=document.createElement("div");t.className="cm-lint-marker cm-lint-marker-"+this.severity;let n=this.diagnostics,r=e.state.facet(_h).tooltipFilter;return r&&(n=r(n,e.state)),n.length&&(t.onmouseover=()=>uN(e,t,n)),t}}function cN(i,e){let t=n=>{let r=e.getBoundingClientRect();if(!(n.clientX>r.left-10&&n.clientX<r.right+10&&n.clientY>r.top-10&&n.clientY<r.bottom+10)){for(let s=n.target;s;s=s.parentNode)if(s.nodeType==1&&s.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",t),i.state.field(G_)&&i.dispatch({effects:Xp.of(null)})}};window.addEventListener("mousemove",t)}function uN(i,e,t){function n(){let o=i.elementAtHeight(e.getBoundingClientRect().top+5-i.documentTop);i.coordsAtPos(o.from)&&i.dispatch({effects:Xp.of({pos:o.from,above:!1,create(){return{dom:z_(i,t),getCoords:()=>e.getBoundingClientRect()}}})}),e.onmouseout=e.onmousemove=null,cN(i,e)}let{hoverTime:r}=i.state.facet(_h),s=setTimeout(n,r);e.onmouseout=()=>{clearTimeout(s),e.onmouseout=e.onmousemove=null},e.onmousemove=()=>{clearTimeout(s),s=setTimeout(n,r)}}function hN(i,e){let t=Object.create(null);for(let r of e){let s=i.lineAt(r.from);(t[s.from]||(t[s.from]=[])).push(r)}let n=[];for(let r in t)n.push(new aN(t[r]).range(+r));return tt.of(n,!0)}const fN=m2({class:"cm-gutter-lint",markers:i=>i.state.field(q_)}),q_=Jt.define({create(){return tt.empty},update(i,e){i=i.map(e.changes);let t=e.state.facet(_h).markerFilter;for(let n of e.effects)if(n.is(Sh)){let r=n.value;t&&(r=t(r||[],e.state)),i=hN(e.state.doc,r.slice(0))}return i}}),Xp=Fe.define(),G_=Jt.define({create(){return null},update(i,e){return i&&e.docChanged&&(i=X_(e,i)?null:Object.assign(Object.assign({},i),{pos:e.changes.mapPos(i.pos)})),e.effects.reduce((t,n)=>n.is(Xp)?n.value:t,i)},provide:i=>dh.from(i)}),dN=pe.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:tu('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:tu('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:tu('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),H_=[Hn,pe.decorations.compute([Hn],i=>{let{selected:e,panel:t}=i.field(Hn);return!e||!t||e.from==e.to?Qe.none:Qe.set([eN.range(e.from,e.to)])}),j$(tN,{hideOn:X_}),lN],_h=ye.define({combine(i){return Qi(i,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function mN(i={}){return[_h.of(i),q_,fN,dN,G_]}const ju=[rL(),lL(),C$(),P6(),JL(),m$(),v$(),et.allowMultipleSelections.of(!0),WL(),t6(r6,{fallback:!0}),h6(),BI(),W_(),I$(),B$(),M$(),R7(),Ws.of([...YI,...A7,...K7,...$6,...qL,...Bp,...V_])];var lv={};class qu{constructor(e,t,n,r,s,o,l,a,c,u=0,h){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=c,this.lookAhead=u,this.parent=h}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let r=e.parser.context;return new qu(e,[],t,n,n,0,[],0,r?new av(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,r=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25;o&&this.setLookAhead(this.pos);let l=s.dynamicPrecedence(r);if(l&&(this.score+=l),n==0){this.pushState(s.getGoto(this.state,r,!0),this.reducePos),r<s.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(r,this.reducePos);return}let a=this.stack.length-(n-1)*3-(e&262144?6:0),c=a?this.stack[a-2]:this.p.ranges[0].from,u=this.reducePos-c;u>=2e3&&!(!((t=this.p.parser.nodeSet.types[r])===null||t===void 0)&&t.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=u));let h=a?this.stack[a-1]:0,f=this.bufferBase+this.buffer.length-h;if(r<s.minRepeatTerm||e&131072){let d=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,c,d,f+4,!0)}if(e&262144)this.state=this.stack[a];else{let d=this.stack[a-3];this.state=s.getGoto(d,r,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(r,c)}storeNode(e,t,n,r=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,l=this.buffer.length;if(l==0&&o.parent&&(l=o.bufferBase-o.parent.bufferBase,o=o.parent),l>0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(t==n)return;if(o.buffer[l-2]>=t){o.buffer[l-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,t,n,r);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>n;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,r>4&&(r-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let s=e,{parser:o}=this.p;(r>this.pos||t<=o.maxNode)&&(this.pos=r,o.stateFlag(s,1)||(this.reducePos=r)),this.pushState(s,n),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new qu(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new pN(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let r=[];for(let s=0,o;s<t.length;s+=2)(o=t[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&r.push(t[s],o);if(this.stack.length<120)for(let s=0;r.length<8&&s<t.length;s+=2){let o=t[s+1];r.some((l,a)=>a&1&&l==o)||r.push(t[s],o)}t=r}let n=[];for(let r=0;r<t.length&&n.length<4;r+=2){let s=t[r+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[r],this.pos),o.reducePos=this.pos,o.score-=200,n.push(o)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=t&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,s)=>{if(!t.includes(r))return t.push(r),e.allActions(r,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,c=this.stack.length-l*3;if(c>=0&&e.getGoto(this.stack[c],a,!1)>=0)return l<<19|65536|a}}else{let l=n(o,s+1);if(l!=null)return l}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new av(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class av{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class pN{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}}class Gu{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Gu(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Gu(this.stack,this.pos,this.index)}}function xl(i,e=Uint16Array){if(typeof i!="string")return i;let t=null;for(let n=0,r=0;n<i.length;){let s=0;for(;;){let o=i.charCodeAt(n++),l=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}t?t[r++]=s:t=new e(s)}return t}class nu{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const cv=new nu;class gN{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=cv,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,s=this.pos+e;for(;s<n.from;){if(!r)return null;let o=this.ranges[--r];s-=n.from-o.to,n=o}for(;t<0?s>n.to:s>=n.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];s+=o.from-n.to,n=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(n=s,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let o=this.rangeIndex,l=this.range;for(;l.to<=n;)l=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>l.to&&(this.chunk2=this.chunk2.slice(0,l.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=cv,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}}class So{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;K_(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}So.prototype.contextual=So.prototype.fallback=So.prototype.extend=!1;class Hu{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?xl(e):e}token(e,t){let n=e.pos,r=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(K_(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||r++,o==null)break;e.reset(o,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}}Hu.prototype.contextual=So.prototype.fallback=So.prototype.extend=!1;class Ei{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function K_(i,e,t,n,r,s){let o=0,l=1<<n,{dialect:a}=t.p.parser;e:for(;l&i[o];){let c=i[o+1];for(let d=o+3;d<c;d+=2)if((i[d+1]&l)>0){let m=i[d];if(a.allows(m)&&(e.token.value==-1||e.token.value==m||ON(m,e.token.value,r,s))){e.acceptToken(m);break}}let u=e.next,h=0,f=i[o+2];if(e.next<0&&f>h&&i[c+f*3-3]==65535){o=i[c+f*3-1];continue e}for(;h<f;){let d=h+f>>1,m=c+d+(d<<1),p=i[m],g=i[m+1]||65536;if(u<p)f=d;else if(u>=g)h=d+1;else{o=i[m+2],e.advance();continue e}}break}}function uv(i,e,t){for(let n=e,r;(r=i[n])!=65535;n++)if(r==t)return n-e;return-1}function ON(i,e,t,n){let r=uv(t,n,e);return r<0||uv(t,n,i)<r}const Wn=typeof process<"u"&&lv&&/\bparse\b/.test(lv.LOG);let jf=null;function hv(i,e,t){let n=i.cursor(Pt.IncludeAnonymous);for(n.moveTo(e);;)if(!(t<0?n.childBefore(e):n.childAfter(e)))for(;;){if((t<0?n.to<e:n.from>e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(i.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:i.length}}let bN=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?hv(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?hv(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],r=this.index[t];if(r==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=n.children[r],o=this.start[t]+n.positions[r];if(o>e)return this.nextStart=o,null;if(s instanceof gt){if(o==e){if(o<this.safeFrom)return null;let l=o+s.length;if(l<=this.safeTo){let a=s.prop(Ze.lookAhead);if(!a||l+a<this.fragment.to)return s}}this.index[t]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}};class vN{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new nu)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:s}=r,o=r.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let c=0;c<s.length;c++){if(!(1<<c&o))continue;let u=s[c],h=this.tokens[c];if(!(n&&!u.fallback)&&((u.contextual||h.start!=e.pos||h.mask!=o||h.context!=l)&&(this.updateCachedToken(h,u,e),h.mask=o,h.context=l),h.lookAhead>h.end+25&&(a=Math.max(h.lookAhead,a)),h.value!=0)){let f=t;if(h.extended>-1&&(t=this.addActions(e,h.extended,h.end,t)),t=this.addActions(e,h.value,h.end,t),!u.extend&&(n=h,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!n&&e.pos==this.stream.end&&(n=new nu,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new nu,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:s}=n.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let l=s.specializers[o](this.stream.read(e.start,e.end),n);if(l>=0&&n.p.parser.dialect.allows(l>>1)){l&1?e.extended=l>>1:e.value=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let s=0;s<r;s+=3)if(this.actions[s]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:s}=e,{parser:o}=e.p,{data:l}=o;for(let a=0;a<2;a++)for(let c=o.stateSlot(s,a?2:1);;c+=3){if(l[c]==65535)if(l[c+1]==1)c=rr(l,c+2);else{r==0&&l[c+1]==2&&(r=this.putAction(rr(l,c+2),t,n,r));break}l[c]==t&&(r=this.putAction(rr(l,c+1),t,n,r))}return r}}class wN{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new gN(t,r),this.tokens=new vN(e,this.stream),this.topTerm=e.top[1];let{from:s}=r[0];this.stacks=[qu.start(this,e.top[0],s)],this.fragments=n.length&&this.stream.end-s>e.bufferLength*4?new bN(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let l=e[o];for(;;){if(this.tokens.mainToken=null,l.pos>t)n.push(l);else{if(this.advanceStack(l,n,e))continue;{r||(r=[],s=[]),r.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!n.length){let o=r&&kN(r);if(o)return Wn&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Wn&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,s,n);if(o)return Wn&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((l,a)=>a.score-l.score);n.length>o;)n.pop();n.some(l=>l.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let o=0;o<n.length-1;o++){let l=n[o];for(let a=o+1;a<n.length;a++){let c=n[a];if(l.sameState(c)||l.buffer.length>500&&c.buffer.length>500)if((l.score-c.score||l.buffer.length-c.buffer.length)>0)n.splice(a--,1);else{n.splice(o--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let o=1;o<n.length;o++)n[o].pos<this.minStackPos&&(this.minStackPos=n[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let r=e.pos,{parser:s}=this,o=Wn?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let h=this.fragments.nodeAt(r);h;){let f=this.parser.nodeSet.types[h.type.id]==h.type?s.getGoto(e.state,h.type.id):-1;if(f>-1&&h.length&&(!c||(h.prop(Ze.contextHash)||0)==u))return e.useNode(h,f),Wn&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(h.type.id)})`),!0;if(!(h instanceof gt)||h.children.length==0||h.positions[0]>0)break;let d=h.children[0];if(d instanceof gt&&h.positions[0]==0)h=d;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),Wn&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let c=0;c<a.length;){let u=a[c++],h=a[c++],f=a[c++],d=c==a.length||!n,m=d?e:e.split(),p=this.tokens.mainToken;if(m.apply(u,h,p?p.start:m.pos,f),Wn&&console.log(o+this.stackID(m)+` (via ${u&65536?`reduce of ${s.getName(u&65535)}`:"shift"} for ${s.getName(h)} @ ${r}${m==e?"":", split"})`),d)return!0;m.pos>r?t.push(m):n.push(m)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return fv(e,t),!0}}runRecovery(e,t,n){let r=null,s=!1;for(let o=0;o<e.length;o++){let l=e[o],a=t[o<<1],c=t[(o<<1)+1],u=Wn?this.stackID(l)+" -> ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),Wn&&console.log(u+this.stackID(l)+" (restarted)"),this.advanceFully(l,n))))continue;let h=l.split(),f=u;for(let d=0;h.forceReduce()&&d<10&&(Wn&&console.log(f+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,n));d++)Wn&&(f=this.stackID(h)+" -> ");for(let d of l.recoverByInsert(a))Wn&&console.log(u+this.stackID(d)+" (via recover-insert)"),this.advanceFully(d,n);this.stream.end>l.pos?(c==l.pos&&(c++,a=0),l.recoverByDelete(a,c),Wn&&console.log(u+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),fv(l,n)):(!r||r.score<l.score)&&(r=l)}return r}stackToTree(e){return e.close(),gt.build({buffer:Gu.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(jf||(jf=new WeakMap)).get(e);return t||jf.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function fv(i,e){for(let t=0;t<e.length;t++){let n=e[t];if(n.pos==i.pos&&n.sameState(i)){e[t].score<i.score&&(e[t]=i);return}}e.push(i)}class yN{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}const qf=i=>i;class J_{constructor(e){this.start=e.start,this.shift=e.shift||qf,this.reduce=e.reduce||qf,this.reuse=e.reuse||qf,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Is extends wp{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;l<e.repeatNodeCount;l++)t.push("");let n=Object.keys(e.topRules).map(l=>e.topRules[l][1]),r=[];for(let l=0;l<t.length;l++)r.push([]);function s(l,a,c){r[l].push([a,a.deserialize(String(c))])}if(e.nodeProps)for(let l of e.nodeProps){let a=l[0];typeof a=="string"&&(a=Ze[a]);for(let c=1;c<l.length;){let u=l[c++];if(u>=0)s(u,a,l[c++]);else{let h=l[c+-u];for(let f=-u;f>0;f--)s(l[c++],a,h);c++}}}this.nodeSet=new Za(t.map((l,a)=>tn.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:r[a],top:n.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=O2;let o=xl(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;l<this.specializerSpecs.length;l++)this.specialized[l]=this.specializerSpecs[l].term;this.specializers=this.specializerSpecs.map(dv),this.states=xl(e.states,Uint32Array),this.data=xl(e.stateData),this.goto=xl(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(l=>typeof l=="number"?new So(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new wN(this,e,t,n);for(let s of this.wrappers)r=s(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let s=r[t+1];;){let o=r[s++],l=o&1,a=r[s++];if(l&&n)return a;for(let c=s+(o>>1);s<c;s++)if(r[s]==e)return a;if(l)return-1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let s=this.stateSlot(e,r?2:1),o;;s+=3){if((o=n[s])==65535)if(n[s+1]==1)o=n[s=rr(n,s+2)];else{if(n[s+1]==2)return rr(n,s+2);break}if(o==t||o==0)return rr(n,s+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let s=this.stateSlot(e,1);r==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=rr(this.data,s+2);else break;r=t(rr(this.data,s+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=rr(this.data,n+2);else break;if(!(this.data[n+2]&1)){let r=this.data[n+1];t.some((s,o)=>o&1&&s==r)||t.push(this.data[n],r)}}return t}configure(e){let t=Object.assign(Object.create(Is.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let r=e.tokenizers.find(s=>s.from==n);return r?r.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,r)=>{let s=e.specializers.find(l=>l.from==n.external);if(!s)return n;let o=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[r]=dv(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(n[o]=!0)}let r=null;for(let s=0;s<t.length;s++)if(!n[s])for(let o=this.dialects[t[s]],l;(l=this.data[o++])!=65535;)(r||(r=new Uint8Array(this.maxTerm+1)))[l]=1;return new yN(e,n,r)}static deserialize(e){return new Is(e)}}function rr(i,e){return i[e]|i[e+1]<<16}function kN(i){let e=null;for(let t of i){let n=t.p.stoppedAt;(t.pos==t.p.stream.end||n!=null&&t.pos>n)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function dv(i){if(i.external){let e=i.extend?1:0;return(t,n)=>i.external(t,n)<<1|e}return i.get}const SN=Xs({String:I.string,Number:I.number,"True False":I.bool,PropertyName:I.propertyName,Null:I.null,",":I.separator,"[ ]":I.squareBracket,"{ }":I.brace}),_N=Is.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[SN],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),CN=()=>i=>{try{JSON.parse(i.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const t=PN(e,i.state.doc);return[{from:t,message:e.message,severity:"error",to:t}]}return[]};function PN(i,e){let t;return(t=i.message.match(/at position (\d+)/))?Math.min(+t[1],e.length):(t=i.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+t[1]).from+ +t[2]-1,e.length):0}const AN=$s.define({name:"json",parser:_N.configure({props:[zo.add({Object:wo({except:/^\s*\}/}),Array:wo({except:/^\s*\]/})}),Fs.add({"Object Array":Cp})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function mv(){return new Do(AN)}function xN(i){let e,t;return{c(){e=y("div"),O(e,"class",t="is-editable-"+i[0])},m(n,r){x(n,e,r),i[3](e)},p(n,[r]){r&1&&t!==(t="is-editable-"+n[0])&&O(e,"class",t)},i:U,o:U,d(n){n&&P(e),i[3](null)}}}function TN(i,e,t){let n,r,{value:s}=e,{editable:o=!0}=e;xi(()=>{let a=new Vr,c=new Vr,u=et.create({doc:JSON.stringify(s,null,4),extensions:[ju,Ws.of([v_]),a.of(mv()),mv(),c.of(et.tabSize.of(4)),mN(),ju,pe.editable.of(o),pe.updateListener.of(function(h){h.docChanged&&t(2,s=h.state.doc.toString())}),sN(CN())]});r=new pe({state:u,parent:n})}),Jw(()=>{r&&r.destroy()});function l(a){Ce[a?"unshift":"push"](()=>{n=a,t(1,n)})}return i.$$set=a=>{"value"in a&&t(2,s=a.value),"editable"in a&&t(0,o=a.editable)},[o,n,s,l]}class QN extends oe{constructor(e){super(),se(this,e,TN,xN,re,{value:2,editable:0})}}function pv(i){let e,t;return{c(){e=y("div"),t=W(i[3]),O(e,"class","invalid-feedback d-block")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&8&&K(t,n[3])},d(n){n&&P(e)}}}function MN(i){let e,t,n,r,s;function o(c){i[5](c)}let l={editable:!i[1].readonly||i[2]};i[0]!==void 0&&(l.value=i[0]),t=new QN({props:l}),Ce.push(()=>nt(t,"value",o));let a=i[3]&&pv(i);return{c(){e=y("div"),V(t.$$.fragment),r=D(),a&&a.c(),O(e,"class","mb-3")},m(c,u){x(c,e,u),Y(t,e,null),b(e,r),a&&a.m(e,null),s=!0},p(c,[u]){const h={};u&6&&(h.editable=!c[1].readonly||c[2]),!n&&u&1&&(n=!0,h.value=c[0],st(()=>n=!1)),t.$set(h),c[3]?a?a.p(c,u):(a=pv(c),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i(c){s||(T(t.$$.fragment,c),s=!0)},o(c){R(t.$$.fragment,c),s=!1},d(c){c&&P(e),z(t),a&&a.d()}}}function EN(i,e,t){let n,{value:r}=e,{field:s}=e,{isCreateMode:o}=e,{validationErrors:l}=e;function a(c){r=c,t(0,r)}return i.$$set=c=>{"value"in c&&t(0,r=c.value),"field"in c&&t(1,s=c.field),"isCreateMode"in c&&t(2,o=c.isCreateMode),"validationErrors"in c&&t(4,l=c.validationErrors)},i.$$.update=()=>{i.$$.dirty&18&&t(3,n=In(l,s.name))},[r,s,o,n,l,a]}let RN=class extends oe{constructor(e){super(),se(this,e,EN,MN,re,{value:0,field:1,isCreateMode:2,validationErrors:4})}};class Ku{static create(e,t,n,r,s){let o=r+(r<<8)+e+(t<<4)|0;return new Ku(e,t,n,o,s,[],[])}constructor(e,t,n,r,s,o,l){this.type=e,this.value=t,this.from=n,this.hash=r,this.end=s,this.children=o,this.positions=l,this.hashProp=[[Ze.contextHash,r]]}addChild(e,t){e.prop(Ze.contextHash)!=this.hash&&(e=new gt(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(t)}toTree(e,t=this.end){let n=this.children.length-1;return n>=0&&(t=Math.max(t,this.positions[n]+this.children[n].length+this.from)),new gt(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(r,s,o)=>new gt(tn.none,r,s,o,this.hashProp)})}}var ue;(function(i){i[i.Document=1]="Document",i[i.CodeBlock=2]="CodeBlock",i[i.FencedCode=3]="FencedCode",i[i.Blockquote=4]="Blockquote",i[i.HorizontalRule=5]="HorizontalRule",i[i.BulletList=6]="BulletList",i[i.OrderedList=7]="OrderedList",i[i.ListItem=8]="ListItem",i[i.ATXHeading1=9]="ATXHeading1",i[i.ATXHeading2=10]="ATXHeading2",i[i.ATXHeading3=11]="ATXHeading3",i[i.ATXHeading4=12]="ATXHeading4",i[i.ATXHeading5=13]="ATXHeading5",i[i.ATXHeading6=14]="ATXHeading6",i[i.SetextHeading1=15]="SetextHeading1",i[i.SetextHeading2=16]="SetextHeading2",i[i.HTMLBlock=17]="HTMLBlock",i[i.LinkReference=18]="LinkReference",i[i.Paragraph=19]="Paragraph",i[i.CommentBlock=20]="CommentBlock",i[i.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",i[i.Escape=22]="Escape",i[i.Entity=23]="Entity",i[i.HardBreak=24]="HardBreak",i[i.Emphasis=25]="Emphasis",i[i.StrongEmphasis=26]="StrongEmphasis",i[i.Link=27]="Link",i[i.Image=28]="Image",i[i.InlineCode=29]="InlineCode",i[i.HTMLTag=30]="HTMLTag",i[i.Comment=31]="Comment",i[i.ProcessingInstruction=32]="ProcessingInstruction",i[i.Autolink=33]="Autolink",i[i.HeaderMark=34]="HeaderMark",i[i.QuoteMark=35]="QuoteMark",i[i.ListMark=36]="ListMark",i[i.LinkMark=37]="LinkMark",i[i.EmphasisMark=38]="EmphasisMark",i[i.CodeMark=39]="CodeMark",i[i.CodeText=40]="CodeText",i[i.CodeInfo=41]="CodeInfo",i[i.LinkTitle=42]="LinkTitle",i[i.LinkLabel=43]="LinkLabel",i[i.URL=44]="URL"})(ue||(ue={}));class DN{constructor(e,t){this.start=e,this.content=t,this.marks=[],this.parsers=[]}}class $N{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return ql(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,n=0){for(let r=t;r<e;r++)n+=this.text.charCodeAt(r)==9?4-n%4:1;return n}findColumn(e){let t=0;for(let n=0;t<this.text.length&&n<e;t++)n+=this.text.charCodeAt(t)==9?4-n%4:1;return t}scrub(){if(!this.baseIndent)return this.text;let e="";for(let t=0;t<this.basePos;t++)e+=" ";return e+this.text.slice(this.basePos)}}function gv(i,e,t){if(t.pos==t.text.length||i!=e.block&&t.indent>=e.stack[t.depth+1].value+t.baseIndent)return!0;if(t.indent>=t.baseIndent+4)return!1;let n=(i.type==ue.OrderedList?zp:Yp)(t,e,!1);return n>0&&(i.type!=ue.BulletList||Fp(t,e,!1)<0)&&t.text.charCodeAt(t.pos+n-1)==i.value}const eC={[ue.Blockquote](i,e,t){return t.next!=62?!1:(t.markers.push(rt(ue.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1)),t.moveBase(t.pos+(mi(t.text.charCodeAt(t.pos+1))?2:1)),i.end=e.lineStart+t.text.length,!0)},[ue.ListItem](i,e,t){return t.indent<t.baseIndent+i.value&&t.next>-1?!1:(t.moveBaseColumn(t.baseIndent+i.value),!0)},[ue.OrderedList]:gv,[ue.BulletList]:gv,[ue.Document](){return!0}};function mi(i){return i==32||i==9||i==10||i==13}function ql(i,e=0){for(;e<i.length&&mi(i.charCodeAt(e));)e++;return e}function Ov(i,e,t){for(;e>t&&mi(i.charCodeAt(e-1));)e--;return e}function tC(i){if(i.next!=96&&i.next!=126)return-1;let e=i.pos+1;for(;e<i.text.length&&i.text.charCodeAt(e)==i.next;)e++;if(e<i.pos+3)return-1;if(i.next==96){for(let t=e;t<i.text.length;t++)if(i.text.charCodeAt(t)==96)return-1}return e}function nC(i){return i.next!=62?-1:i.text.charCodeAt(i.pos+1)==32?2:1}function Fp(i,e,t){if(i.next!=42&&i.next!=45&&i.next!=95)return-1;let n=1;for(let r=i.pos+1;r<i.text.length;r++){let s=i.text.charCodeAt(r);if(s==i.next)n++;else if(!mi(s))return-1}return t&&i.next==45&&sC(i)>-1&&i.depth==e.stack.length||n<3?-1:1}function iC(i,e){for(let t=i.stack.length-1;t>=0;t--)if(i.stack[t].type==e)return!0;return!1}function Yp(i,e,t){return(i.next==45||i.next==43||i.next==42)&&(i.pos==i.text.length-1||mi(i.text.charCodeAt(i.pos+1)))&&(!t||iC(e,ue.BulletList)||i.skipSpace(i.pos+2)<i.text.length)?1:-1}function zp(i,e,t){let n=i.pos,r=i.next;for(;r>=48&&r<=57;){n++;if(n==i.text.length)return-1;r=i.text.charCodeAt(n)}return n==i.pos||n>i.pos+9||r!=46&&r!=41||n<i.text.length-1&&!mi(i.text.charCodeAt(n+1))||t&&!iC(e,ue.OrderedList)&&(i.skipSpace(n+1)==i.text.length||n>i.pos+1||i.next!=49)?-1:n+1-i.pos}function rC(i){if(i.next!=35)return-1;let e=i.pos+1;for(;e<i.text.length&&i.text.charCodeAt(e)==35;)e++;if(e<i.text.length&&i.text.charCodeAt(e)!=32)return-1;let t=e-i.pos;return t>6?-1:t}function sC(i){if(i.next!=45&&i.next!=61||i.indent>=i.baseIndent+4)return-1;let e=i.pos+1;for(;e<i.text.length&&i.text.charCodeAt(e)==i.next;)e++;let t=e;for(;e<i.text.length&&mi(i.text.charCodeAt(e));)e++;return e==i.text.length?t:-1}const Mm=/^[ \t]*$/,oC=/-->/,lC=/\?>/,Em=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,oC],[/^\s*<\?/,lC],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,Mm],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,Mm]];function aC(i,e,t){if(i.next!=60)return-1;let n=i.text.slice(i.pos);for(let r=0,s=Em.length-(t?1:0);r<s;r++)if(Em[r][0].test(n))return r;return-1}function bv(i,e){let t=i.countIndent(e,i.pos,i.indent),n=i.countIndent(i.skipSpace(e),e,t);return n>=t+5?t+1:n}function hs(i,e,t){let n=i.length-1;n>=0&&i[n].to==e&&i[n].type==ue.CodeText?i[n].to=t:i.push(rt(ue.CodeText,e,t))}const Ec={LinkReference:void 0,IndentedCode(i,e){let t=e.baseIndent+4;if(e.indent<t)return!1;let n=e.findColumn(t),r=i.lineStart+n,s=i.lineStart+e.text.length,o=[],l=[];for(hs(o,r,s);i.nextLine()&&e.depth>=i.stack.length;)if(e.pos==e.text.length){hs(l,i.lineStart-1,i.lineStart);for(let a of e.markers)l.push(a)}else{if(e.indent<t)break;{if(l.length){for(let c of l)c.type==ue.CodeText?hs(o,c.from,c.to):o.push(c);l=[]}hs(o,i.lineStart-1,i.lineStart);for(let c of e.markers)o.push(c);s=i.lineStart+e.text.length;let a=i.lineStart+e.findColumn(e.baseIndent+4);a<s&&hs(o,a,s)}}return l.length&&(l=l.filter(a=>a.type!=ue.CodeText),l.length&&(e.markers=l.concat(e.markers))),i.addNode(i.buffer.writeElements(o,-r).finish(ue.CodeBlock,s-r),r),!0},FencedCode(i,e){let t=tC(e);if(t<0)return!1;let n=i.lineStart+e.pos,r=e.next,s=t-e.pos,o=e.skipSpace(t),l=Ov(e.text,e.text.length,o),a=[rt(ue.CodeMark,n,n+s)];o<l&&a.push(rt(ue.CodeInfo,i.lineStart+o,i.lineStart+l));for(let c=!0;i.nextLine()&&e.depth>=i.stack.length;c=!1){let u=e.pos;if(e.indent-e.baseIndent<4)for(;u<e.text.length&&e.text.charCodeAt(u)==r;)u++;if(u-e.pos>=s&&e.skipSpace(u)==e.text.length){for(let h of e.markers)a.push(h);a.push(rt(ue.CodeMark,i.lineStart+e.pos,i.lineStart+u)),i.nextLine();break}else{c||hs(a,i.lineStart-1,i.lineStart);for(let d of e.markers)a.push(d);let h=i.lineStart+e.basePos,f=i.lineStart+e.text.length;h<f&&hs(a,h,f)}}return i.addNode(i.buffer.writeElements(a,-n).finish(ue.FencedCode,i.prevLineEnd()-n),n),!0},Blockquote(i,e){let t=nC(e);return t<0?!1:(i.startContext(ue.Blockquote,e.pos),i.addNode(ue.QuoteMark,i.lineStart+e.pos,i.lineStart+e.pos+1),e.moveBase(e.pos+t),null)},HorizontalRule(i,e){if(Fp(e,i,!1)<0)return!1;let t=i.lineStart+e.pos;return i.nextLine(),i.addNode(ue.HorizontalRule,t),!0},BulletList(i,e){let t=Yp(e,i,!1);if(t<0)return!1;i.block.type!=ue.BulletList&&i.startContext(ue.BulletList,e.basePos,e.next);let n=bv(e,e.pos+1);return i.startContext(ue.ListItem,e.basePos,n-e.baseIndent),i.addNode(ue.ListMark,i.lineStart+e.pos,i.lineStart+e.pos+t),e.moveBaseColumn(n),null},OrderedList(i,e){let t=zp(e,i,!1);if(t<0)return!1;i.block.type!=ue.OrderedList&&i.startContext(ue.OrderedList,e.basePos,e.text.charCodeAt(e.pos+t-1));let n=bv(e,e.pos+t);return i.startContext(ue.ListItem,e.basePos,n-e.baseIndent),i.addNode(ue.ListMark,i.lineStart+e.pos,i.lineStart+e.pos+t),e.moveBaseColumn(n),null},ATXHeading(i,e){let t=rC(e);if(t<0)return!1;let n=e.pos,r=i.lineStart+n,s=Ov(e.text,e.text.length,n),o=s;for(;o>n&&e.text.charCodeAt(o-1)==e.next;)o--;(o==s||o==n||!mi(e.text.charCodeAt(o-1)))&&(o=e.text.length);let l=i.buffer.write(ue.HeaderMark,0,t).writeElements(i.parser.parseInline(e.text.slice(n+t+1,o),r+t+1),-r);o<e.text.length&&l.write(ue.HeaderMark,o-n,s-n);let a=l.finish(ue.ATXHeading1-1+t,e.text.length-n);return i.nextLine(),i.addNode(a,r),!0},HTMLBlock(i,e){let t=aC(e,i,!1);if(t<0)return!1;let n=i.lineStart+e.pos,r=Em[t][1],s=[],o=r!=Mm;for(;!r.test(e.text)&&i.nextLine();){if(e.depth<i.stack.length){o=!1;break}for(let c of e.markers)s.push(c)}o&&i.nextLine();let l=r==oC?ue.CommentBlock:r==lC?ue.ProcessingInstructionBlock:ue.HTMLBlock,a=i.prevLineEnd();return i.addNode(i.buffer.writeElements(s,-n).finish(l,a-n),n),!0},SetextHeading:void 0};class LN{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,t,n){if(this.stage==-1)return!1;let r=n.content+`
`+t.scrub(),s=this.advance(r);return s>-1&&s<r.length?this.complete(e,n,s):!1}finish(e,t){return(this.stage==2||this.stage==3)&&ql(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,n){return e.addLeafElement(t,rt(ue.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(OC(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(rt(ue.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(pC(e,ql(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=ql(e,this.pos),n=0;if(t>this.pos){let r=gC(e,t,this.start);if(r){let s=Gf(e,r.to-this.start);s>0&&(this.nextStage(r),n=s)}}return n||(n=Gf(e,this.pos)),n>0&&n<e.length?n:-1}else return Gf(e,this.pos)}}}function Gf(i,e){for(;e<i.length;e++){let t=i.charCodeAt(e);if(t==10)break;if(!mi(t))return-1}return e}class IN{nextLine(e,t,n){let r=t.depth<e.stack.length?-1:sC(t),s=t.next;if(r<0)return!1;let o=rt(ue.HeaderMark,e.lineStart+t.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(n,rt(s==61?ue.SetextHeading1:ue.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),o])),!0}finish(){return!1}}const NN={LinkReference(i,e){return e.content.charCodeAt(0)==91?new LN(e):null},SetextHeading(){return new IN}},ZN=[(i,e)=>rC(e)>=0,(i,e)=>tC(e)>=0,(i,e)=>nC(e)>=0,(i,e)=>Yp(e,i,!0)>=0,(i,e)=>zp(e,i,!0)>=0,(i,e)=>Fp(e,i,!0)>=0,(i,e)=>aC(e,i,!0)>=0],BN={text:"",end:0};class WN{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.line=new $N,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=r[r.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=r[0].from,this.block=Ku.create(ue.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new zN(n,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let n=0;;){let r=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;n<e.markers.length&&(!r||e.markers[n].from<r.end);){let s=e.markers[n++];this.addNode(s.type,s.from,s.to)}if(!r)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let n of this.parser.blockParsers)if(n){let r=n(this,e);if(r!=!1){if(r==!0)return null;e.forward();continue e}}break}let t=new DN(this.lineStart+e.pos,e.text.slice(e.pos));for(let n of this.parser.leafBlockParsers)if(n){let r=n(this,t);r&&t.parsers.push(r)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,t))break e}for(let n of t.parsers)if(n.nextLine(this,e,t))return null;t.content+=`
`+e.scrub();for(let n of e.markers)t.marks.push(n)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=bC(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=BN;if(t.end=e,e>=this.to)t.text="";else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let n=this.absoluteLineStart,r=this.rangeI;for(;this.ranges[r].to<t.end;){r++;let s=this.ranges[r].from,o=this.lineChunkAt(s);t.end=s+o.length,t.text=t.text.slice(0,this.ranges[r-1].to-n)+o,n=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(t);e.depth<this.stack.length;e.depth++){let r=this.stack[e.depth],s=this.parser.skipContextMarkup[r.type];if(!s)throw new Error("Unhandled block context "+ue[r.type]);if(!s(r,this,e))break;e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),n;if(this.input.lineChunks)n=t==`
`?"":t;else{let r=t.indexOf(`
`);n=r<0?t:t.slice(0,r)}return e+n.length>this.to?n.slice(0,this.to-e):n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,n=0){this.block=Ku.create(e,n,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,n=0){this.startContext(this.parser.getNodeType(e),t,n)}addNode(e,t,n){typeof e=="number"&&(e=new gt(this.parser.nodeSet.types[e],Io,Io,(n??this.prevLineEnd())-t)),this.block.addChild(e,t-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,t){this.addNode(this.buffer.writeElements($m(t.children,e.marks),-t.from).finish(t.type,t.to-t.from),t.from)}finishContext(){let e=this.stack.pop(),t=this.stack[this.stack.length-1];t.addChild(e.toTree(this.parser.nodeSet),e.from-t.from),this.block=t}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?cC(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let n of e.parsers)if(n.finish(this,e))return;let t=$m(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(ue.Paragraph,e.content.length),e.start)}elt(e,t,n,r){return typeof e=="string"?rt(this.parser.getNodeType(e),t,n,r):new fC(e,t)}get buffer(){return new hC(this.parser.nodeSet)}}function cC(i,e,t,n,r){let s=i[e].to,o=[],l=[],a=t.from+n;function c(u,h){for(;h?u>=s:u>s;){let f=i[e+1].from-s;n+=f,u+=f,e++,s=i[e].to}}for(let u=t.firstChild;u;u=u.nextSibling){c(u.from+n,!0);let h=u.from+n,f,d=r.get(u.tree);d?f=d:u.to+n>s?(f=cC(i,e,u,n,r),c(u.to+n,!1)):f=u.toTree(),o.push(f),l.push(h-a)}return c(t.to+n,!1),new gt(t.type,o,l,t.to+n-a,t.tree?t.tree.propValues:void 0)}class Ch extends wp{constructor(e,t,n,r,s,o,l,a,c){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=n,this.blockNames=r,this.endLeafBlock=s,this.skipContextMarkup=o,this.inlineParsers=l,this.inlineNames=a,this.wrappers=c,this.nodeTypes=Object.create(null);for(let u of e.types)this.nodeTypes[u.name]=u.id}createParse(e,t,n){let r=new WN(this,e,t,n);for(let s of this.wrappers)r=s(r,e,t,n);return r}configure(e){let t=Rm(e);if(!t)return this;let{nodeSet:n,skipContextMarkup:r}=this,s=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),l=this.blockNames.slice(),a=this.inlineParsers.slice(),c=this.inlineNames.slice(),u=this.endLeafBlock.slice(),h=this.wrappers;if(gl(t.defineNodes)){r=Object.assign({},r);let f=n.types.slice(),d;for(let m of t.defineNodes){let{name:p,block:g,composite:v,style:w}=typeof m=="string"?{name:m}:m;if(f.some(k=>k.name==p))continue;v&&(r[f.length]=(k,A,C)=>v(A,C,k.value));let S=f.length,_=v?["Block","BlockContext"]:g?S>=ue.ATXHeading1&&S<=ue.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;f.push(tn.define({id:S,name:p,props:_&&[[Ze.group,_]]})),w&&(d||(d={}),Array.isArray(w)||w instanceof jn?d[p]=w:Object.assign(d,w))}n=new Za(f),d&&(n=n.extend(Xs(d)))}if(gl(t.props)&&(n=n.extend(...t.props)),gl(t.remove))for(let f of t.remove){let d=this.blockNames.indexOf(f),m=this.inlineNames.indexOf(f);d>-1&&(s[d]=o[d]=void 0),m>-1&&(a[m]=void 0)}if(gl(t.parseBlock))for(let f of t.parseBlock){let d=l.indexOf(f.name);if(d>-1)s[d]=f.parse,o[d]=f.leaf;else{let m=f.before?Rc(l,f.before):f.after?Rc(l,f.after)+1:l.length-1;s.splice(m,0,f.parse),o.splice(m,0,f.leaf),l.splice(m,0,f.name)}f.endLeaf&&u.push(f.endLeaf)}if(gl(t.parseInline))for(let f of t.parseInline){let d=c.indexOf(f.name);if(d>-1)a[d]=f.parse;else{let m=f.before?Rc(c,f.before):f.after?Rc(c,f.after)+1:c.length-1;a.splice(m,0,f.parse),c.splice(m,0,f.name)}}return t.wrap&&(h=h.concat(t.wrap)),new Ch(n,s,o,l,u,r,a,c,h)}getNodeType(e){let t=this.nodeTypes[e];if(t==null)throw new RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let n=new FN(this,e,t);e:for(let r=t;r<n.end;){let s=n.char(r);for(let o of this.inlineParsers)if(o){let l=o(n,s,r);if(l>=0){r=l;continue e}}r++}return n.resolveMarkers(0)}}function gl(i){return i!=null&&i.length>0}function Rm(i){if(!Array.isArray(i))return i;if(i.length==0)return null;let e=Rm(i[0]);if(i.length==1)return e;let t=Rm(i.slice(1));if(!t||!e)return e||t;let n=(o,l)=>(o||Io).concat(l||Io),r=e.wrap,s=t.wrap;return{props:n(e.props,t.props),defineNodes:n(e.defineNodes,t.defineNodes),parseBlock:n(e.parseBlock,t.parseBlock),parseInline:n(e.parseInline,t.parseInline),remove:n(e.remove,t.remove),wrap:r?s?(o,l,a,c)=>r(s(o,l,a,c),l,a,c):r:s}}function Rc(i,e){let t=i.indexOf(e);if(t<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return t}let uC=[tn.none];for(let i=1,e;e=ue[i];i++)uC[i]=tn.define({id:i,name:e,props:i>=ue.Escape?[]:[[Ze.group,i in eC?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});const Io=[];class hC{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,t,n,r=0){return this.content.push(e,t,n,4+r*4),this}writeElements(e,t=0){for(let n of e)n.writeTo(this,t);return this}finish(e,t){return gt.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:e,length:t})}}let Ca=class{constructor(e,t,n,r=Io){this.type=e,this.from=t,this.to=n,this.children=r}writeTo(e,t){let n=e.content.length;e.writeElements(this.children,t),e.content.push(this.type,this.from+t,this.to+t,e.content.length+4-n)}toTree(e){return new hC(e).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}};class fC{constructor(e,t){this.tree=e,this.from=t}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return Io}writeTo(e,t){e.nodes.push(this.tree),e.content.push(e.nodes.length-1,this.from+t,this.to+t,-1)}toTree(){return this.tree}}function rt(i,e,t,n){return new Ca(i,e,t,n)}const dC={resolve:"Emphasis",mark:"EmphasisMark"},mC={resolve:"Emphasis",mark:"EmphasisMark"},no={},Dm={};class ri{constructor(e,t,n,r){this.type=e,this.from=t,this.to=n,this.side=r}}const vv="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";let Pa=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{Pa=new RegExp("[\\p{Pc}|\\p{Pd}|\\p{Pe}|\\p{Pf}|\\p{Pi}|\\p{Po}|\\p{Ps}]","u")}catch{}const Hf={Escape(i,e,t){if(e!=92||t==i.end-1)return-1;let n=i.char(t+1);for(let r=0;r<vv.length;r++)if(vv.charCodeAt(r)==n)return i.append(rt(ue.Escape,t,t+2));return-1},Entity(i,e,t){if(e!=38)return-1;let n=/^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(i.slice(t+1,t+31));return n?i.append(rt(ue.Entity,t,t+1+n[0].length)):-1},InlineCode(i,e,t){if(e!=96||t&&i.char(t-1)==96)return-1;let n=t+1;for(;n<i.end&&i.char(n)==96;)n++;let r=n-t,s=0;for(;n<i.end;n++)if(i.char(n)==96){if(s++,s==r&&i.char(n+1)!=96)return i.append(rt(ue.InlineCode,t,n+1,[rt(ue.CodeMark,t,t+r),rt(ue.CodeMark,n+1-r,n+1)]))}else s=0;return-1},HTMLTag(i,e,t){if(e!=60||t==i.end-1)return-1;let n=i.slice(t+1,i.end),r=/^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(n);if(r)return i.append(rt(ue.Autolink,t,t+1+r[0].length,[rt(ue.LinkMark,t,t+1),rt(ue.URL,t+1,t+r[0].length),rt(ue.LinkMark,t+r[0].length,t+1+r[0].length)]));let s=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(n);if(s)return i.append(rt(ue.Comment,t,t+1+s[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return i.append(rt(ue.ProcessingInstruction,t,t+1+o[0].length));let l=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return l?i.append(rt(ue.HTMLTag,t,t+1+l[0].length)):-1},Emphasis(i,e,t){if(e!=95&&e!=42)return-1;let n=t+1;for(;i.char(n)==e;)n++;let r=i.slice(t-1,t),s=i.slice(n,n+1),o=Pa.test(r),l=Pa.test(s),a=/\s|^$/.test(r),c=/\s|^$/.test(s),u=!c&&(!l||a||o),h=!a&&(!o||c||l),f=u&&(e==42||!h||o),d=h&&(e==42||!u||l);return i.append(new ri(e==95?dC:mC,t,n,(f?1:0)|(d?2:0)))},HardBreak(i,e,t){if(e==92&&i.char(t+1)==10)return i.append(rt(ue.HardBreak,t,t+2));if(e==32){let n=t+1;for(;i.char(n)==32;)n++;if(i.char(n)==10&&n>=t+2)return i.append(rt(ue.HardBreak,t,n+1))}return-1},Link(i,e,t){return e==91?i.append(new ri(no,t,t+1,1)):-1},Image(i,e,t){return e==33&&i.char(t+1)==91?i.append(new ri(Dm,t,t+2,1)):-1},LinkEnd(i,e,t){if(e!=93)return-1;for(let n=i.parts.length-1;n>=0;n--){let r=i.parts[n];if(r instanceof ri&&(r.type==no||r.type==Dm)){if(!r.side||i.skipSpace(r.to)==t&&!/[(\[]/.test(i.slice(t+1,t+2)))return i.parts[n]=null,-1;let s=i.takeContent(n),o=i.parts[n]=XN(i,s,r.type==no?ue.Link:ue.Image,r.from,t+1);if(r.type==no)for(let l=0;l<n;l++){let a=i.parts[l];a instanceof ri&&a.type==no&&(a.side=0)}return o.to}}return-1}};function XN(i,e,t,n,r){let{text:s}=i,o=i.char(r),l=r;if(e.unshift(rt(ue.LinkMark,n,n+(t==ue.Image?2:1))),e.push(rt(ue.LinkMark,r-1,r)),o==40){let a=i.skipSpace(r+1),c=pC(s,a-i.offset,i.offset),u;c&&(a=i.skipSpace(c.to),a!=c.to&&(u=gC(s,a-i.offset,i.offset),u&&(a=i.skipSpace(u.to)))),i.char(a)==41&&(e.push(rt(ue.LinkMark,r,r+1)),l=a+1,c&&e.push(c),u&&e.push(u),e.push(rt(ue.LinkMark,a,l)))}else if(o==91){let a=OC(s,r-i.offset,i.offset,!1);a&&(e.push(a),l=a.to)}return rt(t,n,l,e)}function pC(i,e,t){if(i.charCodeAt(e)==60){for(let r=e+1;r<i.length;r++){let s=i.charCodeAt(r);if(s==62)return rt(ue.URL,e+t,r+1+t);if(s==60||s==10)return!1}return null}else{let r=0,s=e;for(let o=!1;s<i.length;s++){let l=i.charCodeAt(s);if(mi(l))break;if(o)o=!1;else if(l==40)r++;else if(l==41){if(!r)break;r--}else l==92&&(o=!0)}return s>e?rt(ue.URL,e+t,s+t):s==i.length?null:!1}}function gC(i,e,t){let n=i.charCodeAt(e);if(n!=39&&n!=34&&n!=40)return!1;let r=n==40?41:n;for(let s=e+1,o=!1;s<i.length;s++){let l=i.charCodeAt(s);if(o)o=!1;else{if(l==r)return rt(ue.LinkTitle,e+t,s+1+t);l==92&&(o=!0)}}return null}function OC(i,e,t,n){for(let r=!1,s=e+1,o=Math.min(i.length,s+999);s<o;s++){let l=i.charCodeAt(s);if(r)r=!1;else{if(l==93)return n?!1:rt(ue.LinkLabel,e+t,s+1+t);if(n&&!mi(l)&&(n=!1),l==91)return!1;l==92&&(r=!0)}}return null}class FN{constructor(e,t,n){this.parser=e,this.text=t,this.offset=n,this.parts=[]}char(e){return e>=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,t){return this.text.slice(e-this.offset,t-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,t,n,r,s){return this.append(new ri(e,t,n,(r?1:0)|(s?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let t=this.parts[e];if(t instanceof ri&&(t.type==no||t.type==Dm))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let n=e;n<this.parts.length;n++){let r=this.parts[n];if(!(r instanceof ri&&r.type.resolve&&r.side&2))continue;let s=r.type==dC||r.type==mC,o=r.to-r.from,l,a=n-1;for(;a>=e;a--){let p=this.parts[a];if(p instanceof ri&&p.side&1&&p.type==r.type&&!(s&&(r.side&1||p.side&2)&&(p.to-p.from+o)%3==0&&((p.to-p.from)%3||o%3))){l=p;break}}if(!l)continue;let c=r.type.resolve,u=[],h=l.from,f=r.to;if(s){let p=Math.min(2,l.to-l.from,o);h=l.to-p,f=r.from+p,c=p==1?"Emphasis":"StrongEmphasis"}l.type.mark&&u.push(this.elt(l.type.mark,h,l.to));for(let p=a+1;p<n;p++)this.parts[p]instanceof Ca&&u.push(this.parts[p]),this.parts[p]=null;r.type.mark&&u.push(this.elt(r.type.mark,r.from,f));let d=this.elt(c,h,f,u);this.parts[a]=s&&l.from!=h?new ri(l.type,l.from,h,l.side):null,(this.parts[n]=s&&r.to!=f?new ri(r.type,f,r.to,r.side):null)?this.parts.splice(n,0,d):this.parts[n]=d}let t=[];for(let n=e;n<this.parts.length;n++){let r=this.parts[n];r instanceof Ca&&t.push(r)}return t}findOpeningDelimiter(e){for(let t=this.parts.length-1;t>=0;t--){let n=this.parts[t];if(n instanceof ri&&n.type==e)return t}return null}takeContent(e){let t=this.resolveMarkers(e);return this.parts.length=e,t}skipSpace(e){return ql(this.text,e-this.offset)+this.offset}elt(e,t,n,r){return typeof e=="string"?rt(this.parser.getNodeType(e),t,n,r):new fC(e,t)}}function $m(i,e){if(!e.length)return i;if(!i.length)return e;let t=i.slice(),n=0;for(let r of e){for(;n<t.length&&t[n].to<r.to;)n++;if(n<t.length&&t[n].from<r.from){let s=t[n];s instanceof Ca&&(t[n]=new Ca(s.type,s.from,s.to,$m(s.children,[r])))}else t.splice(n++,0,r)}return t}const YN=[ue.CodeBlock,ue.ListItem,ue.OrderedList,ue.BulletList];class zN{constructor(e,t){this.fragments=e,this.input=t,this.i=0,this.fragment=null,this.fragmentEnd=-1,this.cursor=null,e.length&&(this.fragment=e[this.i++])}nextFragment(){this.fragment=this.i<this.fragments.length?this.fragments[this.i++]:null,this.cursor=null,this.fragmentEnd=-1}moveTo(e,t){for(;this.fragment&&this.fragment.to<=e;)this.nextFragment();if(!this.fragment||this.fragment.from>(e?e-1:0))return!1;if(this.fragmentEnd<0){let s=this.fragment.to;for(;s>0&&this.input.read(s-1,s)!=`
`;)s--;this.fragmentEnd=s?s-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let r=e+this.fragment.offset;for(;n.to<=r;)if(!n.parent())return!1;for(;;){if(n.from>=r)return this.fragment.from<=t;if(!n.childAfter(r))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(Ze.contextHash)==e}takeNodes(e){let t=this.cursor,n=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,l=e.block.children.length,a=o,c=l;for(;;){if(t.to-n>r){if(t.type.isAnonymous&&t.firstChild())continue;break}let u=bC(t.from-n,e.ranges);if(t.to-n<=e.ranges[e.rangeI].to)e.addNode(t.tree,u);else{let h=new gt(e.parser.nodeSet.types[ue.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(h,t.tree),e.addNode(h,u)}if(t.type.is("Block")&&(YN.indexOf(t.type.id)<0?(o=t.to-n,l=e.block.children.length):(o=a,l=c,a=t.to-n,c=e.block.children.length)),!t.nextSibling())break}for(;e.block.children.length>l;)e.block.children.pop(),e.block.positions.pop();return o-s}}function bC(i,e){let t=i;for(let n=1;n<e.length;n++){let r=e[n-1].to,s=e[n].from;r<i&&(t-=s-r)}return t}const VN=Xs({"Blockquote/...":I.quote,HorizontalRule:I.contentSeparator,"ATXHeading1/... SetextHeading1/...":I.heading1,"ATXHeading2/... SetextHeading2/...":I.heading2,"ATXHeading3/...":I.heading3,"ATXHeading4/...":I.heading4,"ATXHeading5/...":I.heading5,"ATXHeading6/...":I.heading6,"Comment CommentBlock":I.comment,Escape:I.escape,Entity:I.character,"Emphasis/...":I.emphasis,"StrongEmphasis/...":I.strong,"Link/... Image/...":I.link,"OrderedList/... BulletList/...":I.list,"BlockQuote/...":I.quote,"InlineCode CodeText":I.monospace,"URL Autolink":I.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":I.processingInstruction,"CodeInfo LinkLabel":I.labelName,LinkTitle:I.string,Paragraph:I.content}),UN=new Ch(new Za(uC).extend(VN),Object.keys(Ec).map(i=>Ec[i]),Object.keys(Ec).map(i=>NN[i]),Object.keys(Ec),ZN,eC,Object.keys(Hf).map(i=>Hf[i]),Object.keys(Hf),[]);function jN(i,e,t){let n=[];for(let r=i.firstChild,s=e;;r=r.nextSibling){let o=r?r.from:t;if(o>s&&n.push({from:s,to:o}),!r)break;s=r.to}return n}function qN(i){let{codeParser:e,htmlParser:t}=i;return{wrap:k2((r,s)=>{let o=r.type.id;if(e&&(o==ue.CodeBlock||o==ue.FencedCode)){let l="";if(o==ue.FencedCode){let c=r.node.getChild(ue.CodeInfo);c&&(l=s.read(c.from,c.to))}let a=e(l);if(a)return{parser:a,overlay:c=>c.type.id==ue.CodeText}}else if(t&&(o==ue.HTMLBlock||o==ue.HTMLTag))return{parser:t,overlay:jN(r.node,r.from,r.to)};return null})}}const GN={resolve:"Strikethrough",mark:"StrikethroughMark"},HN={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":I.strikethrough}},{name:"StrikethroughMark",style:I.processingInstruction}],parseInline:[{name:"Strikethrough",parse(i,e,t){if(e!=126||i.char(t+1)!=126||i.char(t+2)==126)return-1;let n=i.slice(t-1,t),r=i.slice(t+2,t+3),s=/\s|^$/.test(n),o=/\s|^$/.test(r),l=Pa.test(n),a=Pa.test(r);return i.addDelimiter(GN,t,t+2,!o&&(!a||s||l),!s&&(!l||o||a))},after:"Emphasis"}]};function Gl(i,e,t=0,n,r=0){let s=0,o=!0,l=-1,a=-1,c=!1,u=()=>{n.push(i.elt("TableCell",r+l,r+a,i.parser.parseInline(e.slice(l,a),r+l)))};for(let h=t;h<e.length;h++){let f=e.charCodeAt(h);f==124&&!c?((!o||l>-1)&&s++,o=!1,n&&(l>-1&&u(),n.push(i.elt("TableDelimiter",h+r,h+r+1))),l=a=-1):(c||f!=32&&f!=9)&&(l<0&&(l=h),a=h+1),c=!c&&f==92}return l>-1&&(s++,n&&u()),s}function wv(i,e){for(let t=e;t<i.length;t++){let n=i.charCodeAt(t);if(n==124)return!0;n==92&&t++}return!1}const vC=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class yv{constructor(){this.rows=null}nextLine(e,t,n){if(this.rows==null){this.rows=!1;let r;if((t.next==45||t.next==58||t.next==124)&&vC.test(r=t.text.slice(t.pos))){let s=[];Gl(e,n.content,0,s,n.start)==Gl(e,r,t.pos)&&(this.rows=[e.elt("TableHeader",n.start,n.start+n.content.length,s),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let r=[];Gl(e,t.text,t.pos,r,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,r))}return!1}finish(e,t){return this.rows?(e.addLeafElement(t,e.elt("Table",t.start,t.start+t.content.length,this.rows)),!0):!1}}const KN={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":I.heading}},"TableRow",{name:"TableCell",style:I.content},{name:"TableDelimiter",style:I.processingInstruction}],parseBlock:[{name:"Table",leaf(i,e){return wv(e.content,0)?new yv:null},endLeaf(i,e,t){if(t.parsers.some(r=>r instanceof yv)||!wv(e.text,e.basePos))return!1;let n=i.scanLine(i.absoluteLineEnd+1).text;return vC.test(n)&&Gl(i,e.text,e.basePos)==Gl(i,n,e.basePos)},before:"SetextHeading"}]};class JN{nextLine(){return!1}finish(e,t){return e.addLeafElement(t,e.elt("Task",t.start,t.start+t.content.length,[e.elt("TaskMarker",t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)])),!0}}const eZ={defineNodes:[{name:"Task",block:!0,style:I.list},{name:"TaskMarker",style:I.atom}],parseBlock:[{name:"TaskList",leaf(i,e){return/^\[[ xX]\][ \t]/.test(e.content)&&i.parentType().name=="ListItem"?new JN:null},after:"SetextHeading"}]},kv=/(www\.)|(https?:\/\/)|([\w.+-]+@)|(mailto:|xmpp:)/gy,Sv=/[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy,tZ=/[\w-]+\.[\w-]+($|\/)/,_v=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,Cv=/\/[a-zA-Z\d@.]+/gy;function Pv(i,e,t,n){let r=0;for(let s=e;s<t;s++)i[s]==n&&r++;return r}function nZ(i,e){Sv.lastIndex=e;let t=Sv.exec(i);if(!t||tZ.exec(t[0])[0].indexOf("_")>-1)return-1;let n=e+t[0].length;for(;;){let r=i[n-1],s;if(/[?!.,:*_~]/.test(r)||r==")"&&Pv(i,e,n,")")>Pv(i,e,n,"("))n--;else if(r==";"&&(s=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(i.slice(e,n))))n=e+s.index;else break}return n}function Av(i,e){_v.lastIndex=e;let t=_v.exec(i);if(!t)return-1;let n=t[0][t[0].length-1];return n=="_"||n=="-"?-1:e+t[0].length-(n=="."?1:0)}const iZ={parseInline:[{name:"Autolink",parse(i,e,t){let n=t-i.offset;kv.lastIndex=n;let r=kv.exec(i.text),s=-1;if(!r)return-1;if(r[1]||r[2]){if(s=nZ(i.text,n+r[0].length),s>-1&&i.hasOpenLink){let o=/([^\[\]]|\[[^\]]*\])*/.exec(i.text.slice(n,s));s=n+o[0].length}}else r[3]?s=Av(i.text,n):(s=Av(i.text,n+r[0].length),s>-1&&r[0]=="xmpp:"&&(Cv.lastIndex=s,r=Cv.exec(i.text),r&&(s=r.index+r[0].length)));return s<0?-1:(i.addElement(i.elt("URL",t,s+i.offset)),s+i.offset)}}]},rZ=[KN,eZ,HN,iZ];function wC(i,e,t){return(n,r,s)=>{if(r!=i||n.char(s+1)==i)return-1;let o=[n.elt(t,s,s+1)];for(let l=s+1;l<n.end;l++){let a=n.char(l);if(a==i)return n.addElement(n.elt(e,s,l+1,o.concat(n.elt(t,l,l+1))));if(a==92&&o.push(n.elt("Escape",l,l+++2)),mi(a))break}return-1}}const sZ={defineNodes:[{name:"Superscript",style:I.special(I.content)},{name:"SuperscriptMark",style:I.processingInstruction}],parseInline:[{name:"Superscript",parse:wC(94,"Superscript","SuperscriptMark")}]},oZ={defineNodes:[{name:"Subscript",style:I.special(I.content)},{name:"SubscriptMark",style:I.processingInstruction}],parseInline:[{name:"Subscript",parse:wC(126,"Subscript","SubscriptMark")}]},lZ={defineNodes:[{name:"Emoji",style:I.character}],parseInline:[{name:"Emoji",parse(i,e,t){let n;return e!=58||!(n=/^[a-zA-Z_0-9]+:/.exec(i.slice(t+1,i.end)))?-1:i.addElement(i.elt("Emoji",t,t+1+n[0].length))}}]},aZ=54,cZ=1,uZ=55,hZ=2,fZ=56,dZ=3,xv=4,mZ=5,Ju=6,yC=7,kC=8,SC=9,_C=10,pZ=11,gZ=12,OZ=13,Kf=57,bZ=14,Tv=58,CC=20,vZ=22,PC=23,wZ=24,Lm=26,AC=27,yZ=28,kZ=31,SZ=34,_Z=36,CZ=37,PZ=0,AZ=1,xZ={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},TZ={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},Qv={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function QZ(i){return i==45||i==46||i==58||i>=65&&i<=90||i==95||i>=97&&i<=122||i>=161}function xC(i){return i==9||i==10||i==13||i==32}let Mv=null,Ev=null,Rv=0;function Im(i,e){let t=i.pos+e;if(Rv==t&&Ev==i)return Mv;let n=i.peek(e);for(;xC(n);)n=i.peek(++e);let r="";for(;QZ(n);)r+=String.fromCharCode(n),n=i.peek(++e);return Ev=i,Rv=t,Mv=r?r.toLowerCase():n==MZ||n==EZ?void 0:null}const TC=60,eh=62,Vp=47,MZ=63,EZ=33,RZ=45;function Dv(i,e){this.name=i,this.parent=e}const DZ=[Ju,_C,yC,kC,SC],$Z=new J_({start:null,shift(i,e,t,n){return DZ.indexOf(e)>-1?new Dv(Im(n,1)||"",i):i},reduce(i,e){return e==CC&&i?i.parent:i},reuse(i,e,t,n){let r=e.type.id;return r==Ju||r==_Z?new Dv(Im(n,1)||"",i):i},strict:!1}),LZ=new Ei((i,e)=>{if(i.next!=TC){i.next<0&&e.context&&i.acceptToken(Kf);return}i.advance();let t=i.next==Vp;t&&i.advance();let n=Im(i,0);if(n===void 0)return;if(!n)return i.acceptToken(t?bZ:Ju);let r=e.context?e.context.name:null;if(t){if(n==r)return i.acceptToken(pZ);if(r&&TZ[r])return i.acceptToken(Kf,-2);if(e.dialectEnabled(PZ))return i.acceptToken(gZ);for(let s=e.context;s;s=s.parent)if(s.name==n)return;i.acceptToken(OZ)}else{if(n=="script")return i.acceptToken(yC);if(n=="style")return i.acceptToken(kC);if(n=="textarea")return i.acceptToken(SC);if(xZ.hasOwnProperty(n))return i.acceptToken(_C);r&&Qv[r]&&Qv[r][n]?i.acceptToken(Kf,-1):i.acceptToken(Ju)}},{contextual:!0}),IZ=new Ei(i=>{for(let e=0,t=0;;t++){if(i.next<0){t&&i.acceptToken(Tv);break}if(i.next==RZ)e++;else if(i.next==eh&&e>=2){t>=3&&i.acceptToken(Tv,-2);break}else e=0;i.advance()}});function NZ(i){for(;i;i=i.parent)if(i.name=="svg"||i.name=="math")return!0;return!1}const ZZ=new Ei((i,e)=>{if(i.next==Vp&&i.peek(1)==eh){let t=e.dialectEnabled(AZ)||NZ(e.context);i.acceptToken(t?mZ:xv,2)}else i.next==eh&&i.acceptToken(xv,1)});function Up(i,e,t){let n=2+i.length;return new Ei(r=>{for(let s=0,o=0,l=0;;l++){if(r.next<0){l&&r.acceptToken(e);break}if(s==0&&r.next==TC||s==1&&r.next==Vp||s>=2&&s<n&&r.next==i.charCodeAt(s-2))s++,o++;else if((s==2||s==n)&&xC(r.next))o++;else if(s==n&&r.next==eh){l>o?r.acceptToken(e,-o):r.acceptToken(t,-(o-2));break}else if((r.next==10||r.next==13)&&l){r.acceptToken(e,1);break}else s=o=0;r.advance()}})}const BZ=Up("script",aZ,cZ),WZ=Up("style",uZ,hZ),XZ=Up("textarea",fZ,dZ),FZ=Xs({"Text RawText":I.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":I.angleBracket,TagName:I.tagName,"MismatchedCloseTag/TagName":[I.tagName,I.invalid],AttributeName:I.attributeName,"AttributeValue UnquotedAttributeValue":I.attributeValue,Is:I.definitionOperator,"EntityReference CharacterReference":I.character,Comment:I.blockComment,ProcessingInst:I.processingInstruction,DoctypeDecl:I.documentMeta}),YZ=Is.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%OQ&rO,59]O%ZQ&rO,59fO%fQ&rO,59iO%qQ&rO,59lO%|Q&rO,59nOOOa'#D^'#D^O&XOaO'#CxO&dOaO,59[OOOb'#D_'#D_O&lObO'#C{O&wObO,59[OOOd'#D`'#D`O'POdO'#DOO'[OdO,59[OOO`'#Da'#DaO'dO!rO,59[O'kQ#tO'#DROOO`,59[,59[OOOp'#Db'#DbO'pO$fO,59oOOO`,59o,59oO'xQ#|O,59qO'}Q#|O,59rOOO`-E7W-E7WO(SQ&rO'#CsOOQW'#DZ'#DZO(bQ&rO1G.wOOOa1G.w1G.wOOO`1G/Y1G/YO(mQ&rO1G/QOOOb1G/Q1G/QO(xQ&rO1G/TOOOd1G/T1G/TO)TQ&rO1G/WOOO`1G/W1G/WO)`Q&rO1G/YOOO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uOc!uO!`!{O!a!uO~Oa!xOb!xOc!xO!b!{O!c!xO~OT~bac!dx{!d~",goto:"%p!`PPPPPPPPPPPPPPPPPPPP!a!gP!mPP!yP!|#P#S#Y#]#`#f#i#l#r#x!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:$Z,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"],["isolate",-11,21,29,30,32,33,35,36,37,38,41,42,"ltr",-3,26,27,39,""]],propSources:[FZ],skippedNodes:[0],repeatNodeCount:9,tokenData:"!<p!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs3_sv-_vw3}wxHYx}-_}!OH{!O!P-_!P!Q$q!Q![-_![!]Mz!]!^-_!^!_!$S!_!`!;x!`!a&X!a!c-_!c!}Mz!}#R-_#R#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Or!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!a`!cpxPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!<TXiS`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[BZ,WZ,XZ,ZZ,LZ,IZ,0,1,2,3,4,5],topRules:{Document:[0,15]},dialects:{noMatch:0,selfClosing:509},tokenPrec:511});function QC(i,e){let t=Object.create(null);for(let n of i.getChildren(PC)){let r=n.getChild(wZ),s=n.getChild(Lm)||n.getChild(AC);r&&(t[e.read(r.from,r.to)]=s?s.type.id==Lm?e.read(s.from+1,s.to-1):e.read(s.from,s.to):"")}return t}function $v(i,e){let t=i.getChild(vZ);return t?e.read(t.from,t.to):" "}function Jf(i,e,t){let n;for(let r of t)if(!r.attrs||r.attrs(n||(n=QC(i.node.parent.firstChild,e))))return{parser:r.parser};return null}function MC(i=[],e=[]){let t=[],n=[],r=[],s=[];for(let l of i)(l.tag=="script"?t:l.tag=="style"?n:l.tag=="textarea"?r:s).push(l);let o=e.length?Object.create(null):null;for(let l of e)(o[l.name]||(o[l.name]=[])).push(l);return k2((l,a)=>{let c=l.type.id;if(c==yZ)return Jf(l,a,t);if(c==kZ)return Jf(l,a,n);if(c==SZ)return Jf(l,a,r);if(c==CC&&s.length){let u=l.node,h=u.firstChild,f=h&&$v(h,a),d;if(f){for(let m of s)if(m.tag==f&&(!m.attrs||m.attrs(d||(d=QC(h,a))))){let p=u.lastChild,g=p.type.id==CZ?p.from:u.to;if(g>h.to)return{parser:m.parser,overlay:[{from:h.to,to:g}]}}}}if(o&&c==PC){let u=l.node,h;if(h=u.firstChild){let f=o[a.read(h.from,h.to)];if(f)for(let d of f){if(d.tagName&&d.tagName!=$v(u.parent,a))continue;let m=u.lastChild;if(m.type.id==Lm){let p=m.from+1,g=m.lastChild,v=m.to-(g&&g.isError?0:1);if(v>p)return{parser:d.parser,overlay:[{from:p,to:v}]}}else if(m.type.id==AC)return{parser:d.parser,overlay:[{from:m.from,to:m.to}]}}}}return null})}const zZ=99,Lv=1,VZ=100,UZ=101,Iv=2,EC=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],jZ=58,qZ=40,RC=95,GZ=91,iu=45,HZ=46,KZ=35,JZ=37,e8=38,t8=92,n8=10;function Aa(i){return i>=65&&i<=90||i>=97&&i<=122||i>=161}function DC(i){return i>=48&&i<=57}const i8=new Ei((i,e)=>{for(let t=!1,n=0,r=0;;r++){let{next:s}=i;if(Aa(s)||s==iu||s==RC||t&&DC(s))!t&&(s!=iu||r>0)&&(t=!0),n===r&&s==iu&&n++,i.advance();else if(s==t8&&i.peek(1)!=n8)i.advance(),i.next>-1&&i.advance(),t=!0;else{t&&i.acceptToken(s==qZ?VZ:n==2&&e.canShift(Iv)?Iv:UZ);break}}}),r8=new Ei(i=>{if(EC.includes(i.peek(-1))){let{next:e}=i;(Aa(e)||e==RC||e==KZ||e==HZ||e==GZ||e==jZ&&Aa(i.peek(1))||e==iu||e==e8)&&i.acceptToken(zZ)}}),s8=new Ei(i=>{if(!EC.includes(i.peek(-1))){let{next:e}=i;if(e==JZ&&(i.advance(),i.acceptToken(Lv)),Aa(e)){do i.advance();while(Aa(i.next)||DC(i.next));i.acceptToken(Lv)}}}),o8=Xs({"AtKeyword import charset namespace keyframes media supports":I.definitionKeyword,"from to selector":I.keyword,NamespaceName:I.namespace,KeyframeName:I.labelName,KeyframeRangeName:I.operatorKeyword,TagName:I.tagName,ClassName:I.className,PseudoClassName:I.constant(I.className),IdName:I.labelName,"FeatureName PropertyName":I.propertyName,AttributeName:I.attributeName,NumberLiteral:I.number,KeywordQuery:I.keyword,UnaryQueryOp:I.operatorKeyword,"CallTag ValueName":I.atom,VariableName:I.variableName,Callee:I.operatorKeyword,Unit:I.unit,"UniversalSelector NestingSelector":I.definitionOperator,MatchOp:I.compareOperator,"ChildOp SiblingOp, LogicOp":I.logicOperator,BinOp:I.arithmeticOperator,Important:I.modifier,Comment:I.blockComment,ColorLiteral:I.color,"ParenthesizedContent StringLiteral":I.string,":":I.punctuation,"PseudoOp #":I.derefOperator,"; ,":I.separator,"( )":I.paren,"[ ]":I.squareBracket,"{ }":I.brace}),l8={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:138},a8={__proto__:null,"@import":118,"@media":142,"@charset":146,"@namespace":150,"@keyframes":156,"@supports":168},c8={__proto__:null,not:132,only:132},u8=Is.deserialize({version:14,states:":^QYQ[OOO#_Q[OOP#fOWOOOOQP'#Cd'#CdOOQP'#Cc'#CcO#kQ[O'#CfO$_QXO'#CaO$fQ[O'#ChO$qQ[O'#DTO$vQ[O'#DWOOQP'#Em'#EmO${QdO'#DgO%jQ[O'#DtO${QdO'#DvO%{Q[O'#DxO&WQ[O'#D{O&`Q[O'#ERO&nQ[O'#ETOOQS'#El'#ElOOQS'#EW'#EWQYQ[OOO&uQXO'#CdO'jQWO'#DcO'oQWO'#EsO'zQ[O'#EsQOQWOOP(UO#tO'#C_POOO)C@[)C@[OOQP'#Cg'#CgOOQP,59Q,59QO#kQ[O,59QO(aQ[O'#E[O({QWO,58{O)TQ[O,59SO$qQ[O,59oO$vQ[O,59rO(aQ[O,59uO(aQ[O,59wO(aQ[O,59xO)`Q[O'#DbOOQS,58{,58{OOQP'#Ck'#CkOOQO'#DR'#DROOQP,59S,59SO)gQWO,59SO)lQWO,59SOOQP'#DV'#DVOOQP,59o,59oOOQO'#DX'#DXO)qQ`O,59rOOQS'#Cp'#CpO${QdO'#CqO)yQvO'#CsO+ZQtO,5:ROOQO'#Cx'#CxO)lQWO'#CwO+oQWO'#CyO+tQ[O'#DOOOQS'#Ep'#EpOOQO'#Dj'#DjO+|Q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#Y!VU!_[a!VQ!j`Q#c!^Q#g!`Q$[#dR$]#e",nodeNames:"⚠ Unit VariableName Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NestingSelector ClassSelector ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee CallLiteral CallTag ParenthesizedContent ] [ LineNames LineName , PseudoClassName ArgList IdSelector # IdName AttributeSelector AttributeName MatchOp ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp } { Block Declaration PropertyName Important ; ImportStatement AtKeyword import KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList KeyframeSelector KeyframeRangeName SupportsStatement supports AtRule Styles",maxTerm:117,nodeProps:[["isolate",-2,3,24,""],["openedBy",17,"(",32,"[",50,"{"],["closedBy",18,")",33,"]",51,"}"]],propSources:[o8],skippedNodes:[0,3,87],repeatNodeCount:11,tokenData:"J^~R!^OX$}X^%u^p$}pq%uqr)Xrs.Rst/utu6duv$}vw7^wx7oxy9^yz9oz{9t{|:_|}?Q}!O?c!O!P@Q!P!Q@i!Q![Ab![!]B]!]!^CX!^!_$}!_!`Cj!`!aC{!a!b$}!b!cDw!c!}$}!}#OFa#O#P$}#P#QFr#Q#R6d#R#T$}#T#UGT#U#c$}#c#dHf#d#o$}#o#pH{#p#q6d#q#rI^#r#sIo#s#y$}#y#z%u#z$f$}$f$g%u$g#BY$}#BY#BZ%u#BZ$IS$}$IS$I_%u$I_$I|$}$I|$JO%u$JO$JT$}$JT$JU%u$JU$KV$}$KV$KW%u$KW&FU$}&FU&FV%u&FV;'S$};'S;=`JW<%lO$}`%QSOy%^z;'S%^;'S;=`%o<%lO%^`%cSo`Oy%^z;'S%^;'S;=`%o<%lO%^`%rP;=`<%l%^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%lO%^fIQS!TUOy%^z;'S%^;'S;=`%o<%lO%^nIcS!S^Oy%^z;'S%^;'S;=`%o<%lO%^fItU!RQOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^`JZP;=`<%l$}",tokenizers:[r8,s8,i8,1,2,3,4,new Hu("m~RRYZ[z{a~~g~aO#^~~dP!P!Qg~lO#_~~",28,105)],topRules:{StyleSheet:[0,4],Styles:[1,86]},specialized:[{term:100,get:i=>l8[i]||-1},{term:58,get:i=>a8[i]||-1},{term:101,get:i=>c8[i]||-1}],tokenPrec:1200});let ed=null;function td(){if(!ed&&typeof document=="object"&&document.body){let{style:i}=document.body,e=[],t=new Set;for(let n in i)n!="cssText"&&n!="cssFloat"&&typeof i[n]=="string"&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,r=>"-"+r.toLowerCase())),t.has(n)||(e.push(n),t.add(n)));ed=e.sort().map(n=>({type:"property",label:n}))}return ed||[]}const Nv=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(i=>({type:"class",label:i})),Zv=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(i=>({type:"keyword",label:i})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(i=>({type:"constant",label:i}))),h8=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(i=>({type:"type",label:i})),Pr=/^(\w[\w-]*|-\w[\w-]*|)$/,f8=/^-(-[\w-]*)?$/;function d8(i,e){var t;if((i.name=="("||i.type.isError)&&(i=i.parent||i),i.name!="ArgList")return!1;let n=(t=i.parent)===null||t===void 0?void 0:t.firstChild;return(n==null?void 0:n.name)!="Callee"?!1:e.sliceString(n.from,n.to)=="var"}const Bv=new y2,m8=["Declaration"];function p8(i){for(let e=i;;){if(e.type.isTop)return e;if(!(e=e.parent))return i}}function $C(i,e,t){if(e.to-e.from>4096){let n=Bv.get(e);if(n)return n;let r=[],s=new Set,o=e.cursor(Pt.IncludeAnonymous);if(o.firstChild())do for(let l of $C(i,o.node,t))s.has(l.label)||(s.add(l.label),r.push(l));while(o.nextSibling());return Bv.set(e,r),r}else{let n=[],r=new Set;return e.cursor().iterate(s=>{var o;if(t(s)&&s.matchContext(m8)&&((o=s.node.nextSibling)===null||o===void 0?void 0:o.name)==":"){let l=i.sliceString(s.from,s.to);r.has(l)||(r.add(l),n.push({label:l,type:"variable"}))}}),n}}const g8=i=>e=>{let{state:t,pos:n}=e,r=At(t).resolveInner(n,-1),s=r.type.isError&&r.from==r.to-1&&t.doc.sliceString(r.from,r.to)=="-";if(r.name=="PropertyName"||(s||r.name=="TagName")&&/^(Block|Styles)$/.test(r.resolve(r.to).name))return{from:r.from,options:td(),validFor:Pr};if(r.name=="ValueName")return{from:r.from,options:Zv,validFor:Pr};if(r.name=="PseudoClassName")return{from:r.from,options:Nv,validFor:Pr};if(i(r)||(e.explicit||s)&&d8(r,t.doc))return{from:i(r)||s?r.from:n,options:$C(t.doc,p8(r),i),validFor:f8};if(r.name=="TagName"){for(let{parent:a}=r;a;a=a.parent)if(a.name=="Block")return{from:r.from,options:td(),validFor:Pr};return{from:r.from,options:h8,validFor:Pr}}if(!e.explicit)return null;let o=r.resolve(n),l=o.childBefore(n);return l&&l.name==":"&&o.name=="PseudoClassSelector"?{from:n,options:Nv,validFor:Pr}:l&&l.name==":"&&o.name=="Declaration"||o.name=="ArgList"?{from:n,options:Zv,validFor:Pr}:o.name=="Block"||o.name=="Styles"?{from:n,options:td(),validFor:Pr}:null},O8=g8(i=>i.name=="VariableName"),th=$s.define({name:"css",parser:u8.configure({props:[zo.add({Declaration:wo()}),Fs.add({"Block KeyframeList":Cp})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function b8(){return new Do(th,th.data.of({autocomplete:O8}))}const v8=312,Wv=1,w8=2,y8=3,k8=4,S8=313,_8=315,C8=316,P8=5,A8=6,x8=0,Nm=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],LC=125,T8=59,Zm=47,Q8=42,M8=43,E8=45,R8=60,D8=44,$8=63,L8=46,I8=new J_({start:!1,shift(i,e){return e==P8||e==A8||e==_8?i:e==C8},strict:!1}),N8=new Ei((i,e)=>{let{next:t}=i;(t==LC||t==-1||e.context)&&i.acceptToken(S8)},{contextual:!0,fallback:!0}),Z8=new Ei((i,e)=>{let{next:t}=i,n;Nm.indexOf(t)>-1||t==Zm&&((n=i.peek(1))==Zm||n==Q8)||t!=LC&&t!=T8&&t!=-1&&!e.context&&i.acceptToken(v8)},{contextual:!0}),B8=new Ei((i,e)=>{let{next:t}=i;if(t==M8||t==E8){if(i.advance(),t==i.next){i.advance();let n=!e.context&&e.canShift(Wv);i.acceptToken(n?Wv:w8)}}else t==$8&&i.peek(1)==L8&&(i.advance(),i.advance(),(i.next<48||i.next>57)&&i.acceptToken(y8))},{contextual:!0});function nd(i,e){return i>=65&&i<=90||i>=97&&i<=122||i==95||i>=192||!e&&i>=48&&i<=57}const W8=new Ei((i,e)=>{if(i.next!=R8||!e.dialectEnabled(x8)||(i.advance(),i.next==Zm))return;let t=0;for(;Nm.indexOf(i.next)>-1;)i.advance(),t++;if(nd(i.next,!0)){for(i.advance(),t++;nd(i.next,!1);)i.advance(),t++;for(;Nm.indexOf(i.next)>-1;)i.advance(),t++;if(i.next==D8)return;for(let n=0;;n++){if(n==7){if(!nd(i.next,!0))return;break}if(i.next!="extends".charCodeAt(n))break;i.advance(),t++}}i.acceptToken(k8,-t)}),X8=Xs({"get set async static":I.modifier,"for while do if else switch try catch finally return throw break continue default case":I.controlKeyword,"in of await yield void typeof delete instanceof":I.operatorKeyword,"let var const using function class extends":I.definitionKeyword,"import export from":I.moduleKeyword,"with debugger as new":I.keyword,TemplateString:I.special(I.string),super:I.atom,BooleanLiteral:I.bool,this:I.self,null:I.null,Star:I.modifier,VariableName:I.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":I.function(I.variableName),VariableDefinition:I.definition(I.variableName),Label:I.labelName,PropertyName:I.propertyName,PrivatePropertyName:I.special(I.propertyName),"CallExpression/MemberExpression/PropertyName":I.function(I.propertyName),"FunctionDeclaration/VariableDefinition":I.function(I.definition(I.variableName)),"ClassDeclaration/VariableDefinition":I.definition(I.className),PropertyDefinition:I.definition(I.propertyName),PrivatePropertyDefinition:I.definition(I.special(I.propertyName)),UpdateOp:I.updateOperator,"LineComment Hashbang":I.lineComment,BlockComment:I.blockComment,Number:I.number,String:I.string,Escape:I.escape,ArithOp:I.arithmeticOperator,LogicOp:I.logicOperator,BitOp:I.bitwiseOperator,CompareOp:I.compareOperator,RegExp:I.regexp,Equals:I.definitionOperator,Arrow:I.function(I.punctuation),": Spread":I.punctuation,"( )":I.paren,"[ ]":I.squareBracket,"{ }":I.brace,"InterpolationStart InterpolationEnd":I.special(I.brace),".":I.derefOperator,", ;":I.separator,"@":I.meta,TypeName:I.typeName,TypeDefinition:I.definition(I.typeName),"type enum interface implements namespace module declare":I.definitionKeyword,"abstract global Privacy readonly override":I.modifier,"is keyof unique infer":I.operatorKeyword,JSXAttributeValue:I.attributeValue,JSXText:I.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":I.angleBracket,"JSXIdentifier JSXNameSpacedName":I.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":I.attributeName,"JSXBuiltin/JSXIdentifier":I.standard(I.tagName)}),F8={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,extends:54,this:58,true:66,false:66,null:78,void:82,typeof:86,super:102,new:136,delete:148,yield:157,await:161,class:166,public:229,private:229,protected:229,readonly:231,instanceof:250,satisfies:253,in:254,const:256,import:290,keyof:345,unique:349,infer:355,is:391,abstract:411,implements:413,type:415,let:418,var:420,using:423,interface:429,enum:433,namespace:439,module:441,declare:445,global:449,for:468,of:477,while:480,with:484,do:488,if:492,else:494,switch:498,case:504,try:510,catch:514,finally:518,return:522,throw:526,break:530,continue:534,debugger:538},Y8={__proto__:null,async:123,get:125,set:127,declare:189,public:191,private:191,protected:191,static:193,abstract:195,override:197,readonly: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8k6[T<g'U+UV#aW%f*UU#`W%f*US(Q#W(YU(V#Z+T/eS-S'U+UT-v(P-{V'Z!e%g*VQ$lfR)t$qT)i$l)jR3w.|T*Z$x*]T*c${*UQ0l+`Q3P.^Q5i1cQ6q3TQ8V5lQ8v6pQ9j8UQ9|8uQ:b9lQ:j:OQ:r:cR:u:knqOXst!Z#d%k&o&q&r&t,k,p1|2PQ&i!VR,`&ftmOXst!U!V!Z#d%k&f&o&q&r&t,k,p1|2PR,g&lT%jm,gR1],PR,_&dQ&S|R+w&TR+m%}T&m!W&pT&n!W&pT2O,p2P",nodeNames:"⚠ ArithOp ArithOp ?. JSXStartTag LineComment BlockComment Script Hashbang ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > < TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:376,context:I8,nodeProps:[["isolate",-8,5,6,14,34,36,48,50,52,""],["group",-26,9,17,19,65,204,208,212,213,215,218,221,231,233,239,241,243,245,248,254,260,262,264,266,268,270,271,"Statement",-34,13,14,29,32,33,39,48,51,52,54,59,67,69,73,77,79,81,82,107,108,117,118,135,138,140,141,142,143,144,146,147,166,167,169,"Expression",-23,28,30,34,38,40,42,171,173,175,176,178,179,180,182,183,184,186,187,188,198,200,202,203,"Type",-3,85,100,106,"ClassItem"],["openedBy",23,"<",35,"InterpolationStart",53,"[",57,"{",70,"(",159,"JSXStartCloseTag"],["closedBy",24,">",37,"InterpolationEnd",47,"]",58,"}",71,")",164,"JSXEndTag"]],propSources:[X8],skippedNodes:[0,5,6,274],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+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okenPrec:14749}),IC=[Qn("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),Qn("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),Qn("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Qn("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Qn("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),Qn(`try {
\${}
} catch (\${error}) {
\${}
}`,{label:"try",detail:"/ catch block",type:"keyword"}),Qn("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),Qn(`if (\${}) {
\${}
} else {
\${}
}`,{label:"if",detail:"/ else block",type:"keyword"}),Qn(`class \${name} {
constructor(\${params}) {
\${}
}
}`,{label:"class",detail:"definition",type:"keyword"}),Qn('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Qn('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],U8=IC.concat([Qn("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Qn("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Qn("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),Xv=new y2,NC=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ol(i){return(e,t)=>{let n=e.node.getChild("VariableDefinition");return n&&t(n,i),!0}}const j8=["FunctionDeclaration"],q8={FunctionDeclaration:Ol("function"),ClassDeclaration:Ol("class"),ClassExpression:()=>!0,EnumDeclaration:Ol("constant"),TypeAliasDeclaration:Ol("type"),NamespaceDeclaration:Ol("namespace"),VariableDefinition(i,e){i.matchContext(j8)||e(i,"variable")},TypeDefinition(i,e){e(i,"type")},__proto__:null};function ZC(i,e){let t=Xv.get(e);if(t)return t;let n=[],r=!0;function s(o,l){let a=i.sliceString(o.from,o.to);n.push({label:a,type:l})}return e.cursor(Pt.IncludeAnonymous).iterate(o=>{if(r)r=!1;else if(o.name){let l=q8[o.name];if(l&&l(o,s)||NC.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of ZC(i,o.node))n.push(l);return!1}}),Xv.set(e,n),n}const Fv=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,BC=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function G8(i){let e=At(i.state).resolveInner(i.pos,-1);if(BC.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&Fv.test(i.state.sliceDoc(e.from,e.to));if(!t&&!i.explicit)return null;let n=[];for(let r=e;r;r=r.parent)NC.has(r.name)&&(n=n.concat(ZC(i.state.doc,r)));return{options:n,from:t?e.from:i.pos,validFor:Fv}}const qi=$s.define({name:"javascript",parser:V8.configure({props:[zo.add({IfStatement:wo({except:/^\s*({|else\b)/}),TryStatement:wo({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:ZL,SwitchBody:i=>{let e=i.textAfter,t=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return i.baseIndent+(t?0:n?1:2)*i.unit},Block:NL({closing:"}"}),ArrowFunction:i=>i.baseIndent+i.unit,"TemplateString BlockComment":()=>null,"Statement Property":wo({except:/^{/}),JSXElement(i){let e=/^\s*<\//.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},JSXEscape(i){let e=/\s*\}/.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},"JSXOpenTag JSXSelfClosingTag"(i){return i.column(i.node.from)+i.unit}}),Fs.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Cp,BlockComment(i){return{from:i.from+2,to:i.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),WC={test:i=>/^JSX/.test(i.name),facet:yp({commentTokens:{block:{open:"{/*",close:"*/}"}}})},XC=qi.configure({dialect:"ts"},"typescript"),FC=qi.configure({dialect:"jsx",props:[kp.add(i=>i.isTop?[WC]:void 0)]}),YC=qi.configure({dialect:"jsx ts",props:[kp.add(i=>i.isTop?[WC]:void 0)]},"typescript");let zC=i=>({label:i,type:"keyword"});const VC="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(zC),H8=VC.concat(["declare","implements","private","protected","public"].map(zC));function K8(i={}){let e=i.jsx?i.typescript?YC:FC:i.typescript?XC:qi,t=i.typescript?U8.concat(H8):IC.concat(VC);return new Do(e,[qi.data.of({autocomplete:iI(BC,Q_(t))}),qi.data.of({autocomplete:G8}),i.jsx?tB:[]])}function J8(i){for(;;){if(i.name=="JSXOpenTag"||i.name=="JSXSelfClosingTag"||i.name=="JSXFragmentTag")return i;if(i.name=="JSXEscape"||!i.parent)return null;i=i.parent}}function Yv(i,e,t=i.length){for(let n=e==null?void 0:e.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return i.sliceString(n.from,Math.min(n.to,t));return""}const eB=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),tB=pe.inputHandler.of((i,e,t,n,r)=>{if((eB?i.composing:i.compositionStarted)||i.state.readOnly||e!=t||n!=">"&&n!="/"||!qi.isActiveAt(i.state,e,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange(a=>{var c;let{head:u}=a,h=At(o).resolveInner(u-1,-1),f;if(h.name=="JSXStartTag"&&(h=h.parent),!(o.doc.sliceString(u-1,u)!=n||h.name=="JSXAttributeValue"&&h.to>u)){if(n==">"&&h.name=="JSXFragmentTag")return{range:a,changes:{from:u,insert:"</>"}};if(n=="/"&&h.name=="JSXStartCloseTag"){let d=h.parent,m=d.parent;if(m&&d.from==u-2&&((f=Yv(o.doc,m.firstChild,u))||((c=m.firstChild)===null||c===void 0?void 0:c.name)=="JSXFragmentTag")){let p=`${f}>`;return{range:q.cursor(u+p.length,-1),changes:{from:u,insert:p}}}}else if(n==">"){let d=J8(h);if(d&&d.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(u,u+2))&&(f=Yv(o.doc,d,u)))return{range:a,changes:{from:u,insert:`</${f}>`}}}}return{range:a}});return l.changes.empty?!1:(i.dispatch([s,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),bl=["_blank","_self","_top","_parent"],id=["ascii","utf-8","utf-16","latin1","latin1"],rd=["get","post","put","delete"],sd=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Xn=["true","false"],xe={},nB={a:{attrs:{href:null,ping:null,type:null,media:null,target:bl,hreflang:null}},abbr:xe,address:xe,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:xe,aside:xe,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:xe,base:{attrs:{href:null,target:bl}},bdi:xe,bdo:xe,blockquote:{attrs:{cite:null}},body:xe,br:xe,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:sd,formmethod:rd,formnovalidate:["novalidate"],formtarget:bl,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:xe,center:xe,cite:xe,code:xe,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:xe,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:xe,div:xe,dl:xe,dt:xe,em:xe,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:xe,figure:xe,footer:xe,form:{attrs:{action:null,name:null,"accept-charset":id,autocomplete:["on","off"],enctype:sd,method:rd,novalidate:["novalidate"],target:bl}},h1:xe,h2:xe,h3:xe,h4:xe,h5:xe,h6:xe,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:xe,hgroup:xe,hr:xe,html:{attrs:{manifest:null}},i:xe,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:sd,formmethod:rd,formnovalidate:["novalidate"],formtarget:bl,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:xe,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:xe,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:xe,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:id,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:xe,noscript:xe,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:xe,param:{attrs:{name:null,value:null}},pre:xe,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:xe,rt:xe,ruby:xe,samp:xe,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:id}},section:xe,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:xe,source:{attrs:{src:null,type:null,media:null}},span:xe,strong:xe,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:xe,summary:xe,sup:xe,table:xe,tbody:xe,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:xe,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:xe,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:xe,time:{attrs:{datetime:null}},title:xe,tr:xe,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:xe,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:xe},UC={accesskey:null,class:null,contenteditable:Xn,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Xn,autocorrect:Xn,autocapitalize:Xn,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Xn,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Xn,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Xn,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Xn,"aria-hidden":Xn,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Xn,"aria-multiselectable":Xn,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Xn,"aria-relevant":null,"aria-required":Xn,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},jC="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(i=>"on"+i);for(let i of jC)UC[i]=null;class xa{constructor(e,t){this.tags=Object.assign(Object.assign({},nB),e),this.globalAttrs=Object.assign(Object.assign({},UC),t),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}xa.default=new xa;function No(i,e,t=i.length){if(!e)return"";let n=e.firstChild,r=n&&n.getChild("TagName");return r?i.sliceString(r.from,Math.min(r.to,t)):""}function Zo(i,e=!1){for(;i;i=i.parent)if(i.name=="Element")if(e)e=!1;else return i;return null}function qC(i,e,t){let n=t.tags[No(i,Zo(e))];return(n==null?void 0:n.children)||t.allTags}function jp(i,e){let t=[];for(let n=Zo(e);n&&!n.type.isTop;n=Zo(n.parent)){let r=No(i,n);if(r&&n.lastChild.name=="CloseTag")break;r&&t.indexOf(r)<0&&(e.name=="EndTag"||e.from>=n.firstChild.to)&&t.push(r)}return t}const GC=/^[:\-\.\w\u00b7-\uffff]*$/;function zv(i,e,t,n,r){let s=/\s*>/.test(i.sliceDoc(r,r+5))?"":">",o=Zo(t,!0);return{from:n,to:r,options:qC(i.doc,o,e).map(l=>({label:l,type:"type"})).concat(jp(i.doc,t).map((l,a)=>({label:"/"+l,apply:"/"+l+s,type:"type",boost:99-a}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function Vv(i,e,t,n){let r=/\s*>/.test(i.sliceDoc(n,n+5))?"":">";return{from:t,to:n,options:jp(i.doc,e).map((s,o)=>({label:s,apply:s+r,type:"type",boost:99-o})),validFor:GC}}function iB(i,e,t,n){let r=[],s=0;for(let o of qC(i.doc,t,e))r.push({label:"<"+o,type:"type"});for(let o of jp(i.doc,t))r.push({label:"</"+o+">",type:"type",boost:99-s++});return{from:n,to:n,options:r,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function rB(i,e,t,n,r){let s=Zo(t),o=s?e.tags[No(i.doc,s)]:null,l=o&&o.attrs?Object.keys(o.attrs):[],a=o&&o.globalAttrs===!1?l:l.length?l.concat(e.globalAttrNames):e.globalAttrNames;return{from:n,to:r,options:a.map(c=>({label:c,type:"property"})),validFor:GC}}function sB(i,e,t,n,r){var s;let o=(s=t.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),l=[],a;if(o){let c=i.sliceDoc(o.from,o.to),u=e.globalAttrs[c];if(!u){let h=Zo(t),f=h?e.tags[No(i.doc,h)]:null;u=(f==null?void 0:f.attrs)&&f.attrs[c]}if(u){let h=i.sliceDoc(n,r).toLowerCase(),f='"',d='"';/^['"]/.test(h)?(a=h[0]=='"'?/^[^"]*$/:/^[^']*$/,f="",d=i.sliceDoc(r,r+1)==h[0]?"":h[0],h=h.slice(1),n++):a=/^[^\s<>='"]*$/;for(let m of u)l.push({label:m,apply:f+m+d,type:"constant"})}}return{from:n,to:r,options:l,validFor:a}}function HC(i,e){let{state:t,pos:n}=e,r=At(t).resolveInner(n,-1),s=r.resolve(n);for(let o=n,l;s==r&&(l=r.childBefore(o));){let a=l.lastChild;if(!a||!a.type.isError||a.from<a.to)break;s=r=l,o=a.from}return r.name=="TagName"?r.parent&&/CloseTag$/.test(r.parent.name)?Vv(t,r,r.from,n):zv(t,i,r,r.from,n):r.name=="StartTag"?zv(t,i,r,n,n):r.name=="StartCloseTag"||r.name=="IncompleteCloseTag"?Vv(t,r,n,n):r.name=="OpenTag"||r.name=="SelfClosingTag"||r.name=="AttributeName"?rB(t,i,r,r.name=="AttributeName"?r.from:n,n):r.name=="Is"||r.name=="AttributeValue"||r.name=="UnquotedAttributeValue"?sB(t,i,r,r.name=="Is"?n:r.from,n):e.explicit&&(s.name=="Element"||s.name=="Text"||s.name=="Document")?iB(t,i,r,n):null}function oB(i){return HC(xa.default,i)}function lB(i){let{extraTags:e,extraGlobalAttributes:t}=i,n=t||e?new xa(e,t):xa.default;return r=>HC(n,r)}const aB=qi.parser.configure({top:"SingleExpression"}),KC=[{tag:"script",attrs:i=>i.type=="text/typescript"||i.lang=="ts",parser:XC.parser},{tag:"script",attrs:i=>i.type=="text/babel"||i.type=="text/jsx",parser:FC.parser},{tag:"script",attrs:i=>i.type=="text/typescript-jsx",parser:YC.parser},{tag:"script",attrs(i){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(i.type)},parser:aB},{tag:"script",attrs(i){return!i.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(i.type)},parser:qi.parser},{tag:"style",attrs(i){return(!i.lang||i.lang=="css")&&(!i.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(i.type))},parser:th.parser}],JC=[{name:"style",parser:th.parser.configure({top:"Styles"})}].concat(jC.map(i=>({name:i,parser:qi.parser}))),eP=$s.define({name:"html",parser:YZ.configure({props:[zo.add({Element(i){let e=/^(\s*)(<\/)?/.exec(i.textAfter);return i.node.to<=i.pos+e[0].length?i.continue():i.lineIndent(i.node.from)+(e[2]?0:i.unit)},"OpenTag CloseTag SelfClosingTag"(i){return i.column(i.node.from)+i.unit},Document(i){if(i.pos+/\s*/.exec(i.textAfter)[0].length<i.node.to)return i.continue();let e=null,t;for(let n=i.node;;){let r=n.lastChild;if(!r||r.name!="Element"||r.to!=n.to)break;e=n=r}return e&&!((t=e.lastChild)&&(t.name=="CloseTag"||t.name=="SelfClosingTag"))?i.lineIndent(e.from)+i.unit:null}}),Fs.add({Element(i){let e=i.firstChild,t=i.lastChild;return!e||e.name!="OpenTag"?null:{from:e.to,to:t.name=="CloseTag"?t.from:i.to}}}),B2.add({"OpenTag CloseTag":i=>i.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}}),ru=eP.configure({wrap:MC(KC,JC)});function cB(i={}){let e="",t;i.matchClosingTags===!1&&(e="noMatch"),i.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(i.nestedLanguages&&i.nestedLanguages.length||i.nestedAttributes&&i.nestedAttributes.length)&&(t=MC((i.nestedLanguages||[]).concat(KC),(i.nestedAttributes||[]).concat(JC)));let n=t?eP.configure({wrap:t,dialect:e}):e?ru.configure({dialect:e}):ru;return new Do(n,[ru.data.of({autocomplete:lB(i)}),i.autoCloseTags!==!1?uB:[],K8().support,b8().support])}const Uv=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),uB=pe.inputHandler.of((i,e,t,n,r)=>{if(i.composing||i.state.readOnly||e!=t||n!=">"&&n!="/"||!ru.isActiveAt(i.state,e,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange(a=>{var c,u,h;let f=o.doc.sliceString(a.from-1,a.to)==n,{head:d}=a,m=At(o).resolveInner(d,-1),p;if(f&&n==">"&&m.name=="EndTag"){let g=m.parent;if(((u=(c=g.parent)===null||c===void 0?void 0:c.lastChild)===null||u===void 0?void 0:u.name)!="CloseTag"&&(p=No(o.doc,g.parent,d))&&!Uv.has(p)){let v=d+(o.doc.sliceString(d,d+1)===">"?1:0),w=`</${p}>`;return{range:a,changes:{from:d,to:v,insert:w}}}}else if(f&&n=="/"&&m.name=="IncompleteCloseTag"){let g=m.parent;if(m.from==d-2&&((h=g.lastChild)===null||h===void 0?void 0:h.name)!="CloseTag"&&(p=No(o.doc,g,d))&&!Uv.has(p)){let v=d+(o.doc.sliceString(d,d+1)===">"?1:0),w=`${p}>`;return{range:q.cursor(d+w.length,-1),changes:{from:d,to:v,insert:w}}}}return{range:a}});return l.changes.empty?!1:(i.dispatch([s,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),tP=yp({commentTokens:{block:{open:"<!--",close:"-->"}}}),nP=new Ze,iP=UN.configure({props:[Fs.add(i=>!i.is("Block")||i.is("Document")||Bm(i)!=null||hB(i)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),nP.add(Bm),zo.add({Document:()=>null}),ks.add({Document:tP})]});function Bm(i){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(i.name);return e?+e[1]:void 0}function hB(i){return i.name=="OrderedList"||i.name=="BulletList"}function fB(i,e){let t=i;for(;;){let n=t.nextSibling,r;if(!n||(r=Bm(n.type))!=null&&r<=e)break;t=n}return t.to}const dB=x2.of((i,e,t)=>{for(let n=At(i).resolveInner(t,-1);n&&!(n.from<e);n=n.parent){let r=n.type.prop(nP);if(r==null)continue;let s=fB(n,r);if(s>t)return{from:t,to:s}}return null});function qp(i){return new ai(tP,i,[dB],"markdown")}const mB=qp(iP),pB=iP.configure([rZ,oZ,sZ,lZ,{props:[Fs.add({Table:(i,e)=>({from:e.doc.lineAt(i.from).to,to:i.to})})]}]),rP=qp(pB);function gB(i,e){return t=>{if(t&&i){let n=null;if(t=/\S*/.exec(t)[0],typeof i=="function"?n=i(t):n=$u.matchLanguageName(i,t,!0),n instanceof $u)return n.support?n.support.language.parser:ba.getSkippingParser(n.load());if(n)return n.parser}return e?e.parser:null}}class Dc{constructor(e,t,n,r,s,o,l){this.node=e,this.from=t,this.to=n,this.spaceBefore=r,this.spaceAfter=s,this.type=o,this.item=l}blank(e,t=!0){let n=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;n.length<e;)n+=" ";return n}else{for(let r=this.to-this.from-n.length-this.spaceAfter.length;r>0;r--)n+=" ";return n+(t?this.spaceAfter:"")}}marker(e,t){let n=this.node.name=="OrderedList"?String(+oP(this.item,e)[2]+t):"";return this.spaceBefore+n+this.type+this.spaceAfter}}function sP(i,e){let t=[];for(let r=i;r&&r.name!="Document";r=r.parent)(r.name=="ListItem"||r.name=="Blockquote"||r.name=="FencedCode")&&t.push(r);let n=[];for(let r=t.length-1;r>=0;r--){let s=t[r],o,l=e.lineAt(s.from),a=s.from-l.from;if(s.name=="FencedCode")n.push(new Dc(s,a,a,"","","",null));else if(s.name=="Blockquote"&&(o=/^ *>( ?)/.exec(l.text.slice(a))))n.push(new Dc(s,a,a+o[0].length,"",o[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(l.text.slice(a)))){let c=o[3],u=o[0].length;c.length>=4&&(c=c.slice(0,c.length-4),u-=4),n.push(new Dc(s.parent,a,a+u,o[1],c,o[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(a)))){let c=o[4],u=o[0].length;c.length>4&&(c=c.slice(0,c.length-4),u-=4);let h=o[2];o[3]&&(h+=o[3].replace(/[xX]/," ")),n.push(new Dc(s.parent,a,a+u,o[1],c,h,s))}}return n}function oP(i,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(i.from,i.from+10))}function od(i,e,t,n=0){for(let r=-1,s=i;;){if(s.name=="ListItem"){let l=oP(s,e),a=+l[2];if(r>=0){if(a!=r+1)return;t.push({from:s.from+l[1].length,to:s.from+l[0].length,insert:String(r+2+n)})}r=a}let o=s.nextSibling;if(!o)break;s=o}}function Gp(i,e){let t=/^[ \t]*/.exec(i)[0].length;if(!t||e.facet(Ba)!=" ")return i;let n=Ci(i,4,t),r="";for(let s=n;s>0;)s>=4?(r+=" ",s-=4):(r+=" ",s--);return r+i.slice(t)}const OB=({state:i,dispatch:e})=>{let t=At(i),{doc:n}=i,r=null,s=i.changeByRange(o=>{if(!o.empty||!rP.isActiveAt(i,o.from))return r={range:o};let l=o.from,a=n.lineAt(l),c=sP(t.resolveInner(l,-1),n);for(;c.length&&c[c.length-1].from>l-a.from;)c.pop();if(!c.length)return r={range:o};let u=c[c.length-1];if(u.to-u.spaceAfter.length>l-a.from)return r={range:o};let h=l>=u.to-u.spaceAfter.length&&!/\S/.test(a.text.slice(u.to));if(u.item&&h){let g=u.node.firstChild,v=u.node.getChild("ListItem","ListItem");if(g.to>=l||v&&v.to<l||a.from>0&&!/[^\s>]/.test(n.lineAt(a.from-1).text)){let w=c.length>1?c[c.length-2]:null,S,_="";w&&w.item?(S=a.from+w.from,_=w.marker(n,1)):S=a.from+(w?w.to:0);let k=[{from:S,to:l,insert:_}];return u.node.name=="OrderedList"&&od(u.item,n,k,-2),w&&w.node.name=="OrderedList"&&od(w.item,n,k),{range:q.cursor(S+_.length),changes:k}}else{let w=qv(c,i,a);return{range:q.cursor(l+w.length+1),changes:{from:a.from,insert:w+i.lineBreak}}}}if(u.node.name=="Blockquote"&&h&&a.from){let g=n.lineAt(a.from-1),v=/>\s*$/.exec(g.text);if(v&&v.index==u.from){let w=i.changes([{from:g.from+v.index,to:g.to},{from:a.from+u.from,to:a.to}]);return{range:o.map(w),changes:w}}}let f=[];u.node.name=="OrderedList"&&od(u.item,n,f);let d=u.item&&u.item.from<a.from,m="";if(!d||/^[\s\d.)\-+*>]*/.exec(a.text)[0].length>=u.to)for(let g=0,v=c.length-1;g<=v;g++)m+=g==v&&!d?c[g].marker(n,1):c[g].blank(g<v?Ci(a.text,4,c[g+1].from)-m.length:null);let p=l;for(;p>a.from&&/\s/.test(a.text.charAt(p-a.from-1));)p--;return m=Gp(m,i),bB(u.node,i.doc)&&(m=qv(c,i,a)+i.lineBreak+m),f.push({from:p,to:l,insert:i.lineBreak+m}),{range:q.cursor(p+m.length+1),changes:f}});return r?!1:(e(i.update(s,{scrollIntoView:!0,userEvent:"input"})),!0)};function jv(i){return i.name=="QuoteMark"||i.name=="ListMark"}function bB(i,e){if(i.name!="OrderedList"&&i.name!="BulletList")return!1;let t=i.firstChild,n=i.getChild("ListItem","ListItem");if(!n)return!1;let r=e.lineAt(t.to),s=e.lineAt(n.from),o=/^[\s>]*$/.test(r.text);return r.number+(o?0:1)<s.number}function qv(i,e,t){let n="";for(let r=0,s=i.length-2;r<=s;r++)n+=i[r].blank(r<s?Ci(t.text,4,i[r+1].from)-n.length:null,r<s);return Gp(n,e)}function vB(i,e){let t=i.resolveInner(e,-1),n=e;jv(t)&&(n=t.from,t=t.parent);for(let r;r=t.childBefore(n);)if(jv(r))n=r.from;else if(r.name=="OrderedList"||r.name=="BulletList")t=r.lastChild,n=t.to;else break;return t}const wB=({state:i,dispatch:e})=>{let t=At(i),n=null,r=i.changeByRange(s=>{let o=s.from,{doc:l}=i;if(s.empty&&rP.isActiveAt(i,s.from)){let a=l.lineAt(o),c=sP(vB(t,o),l);if(c.length){let u=c[c.length-1],h=u.to-u.spaceAfter.length+(u.spaceAfter?1:0);if(o-a.from>h&&!/\S/.test(a.text.slice(h,o-a.from)))return{range:q.cursor(a.from+h),changes:{from:a.from+h,to:o}};if(o-a.from==h&&(!u.item||a.from<=u.item.from||!/\S/.test(a.text.slice(0,u.to)))){let f=a.from+u.from;if(u.item&&u.node.from<u.item.from&&/\S/.test(a.text.slice(u.from,u.to))){let d=u.blank(Ci(a.text,4,u.to)-Ci(a.text,4,u.from));return f==a.from&&(d=Gp(d,i)),{range:q.cursor(f+d.length),changes:{from:f,to:a.from+u.to,insert:d}}}if(f<o)return{range:q.cursor(f),changes:{from:f,to:o}}}}}return n={range:s}});return n?!1:(e(i.update(r,{scrollIntoView:!0,userEvent:"delete"})),!0)},yB=[{key:"Enter",run:OB},{key:"Backspace",run:wB}],Wm=cB({matchClosingTags:!1});function Gv(i={}){let{codeLanguages:e,defaultCodeLanguage:t,addKeymap:n=!0,base:{parser:r}=mB,completeHTMLTags:s=!0}=i;if(!(r instanceof Ch))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let o=i.extensions?[i.extensions]:[],l=[Wm.support],a;t instanceof Do?(l.push(t.support),a=t.language):t&&(a=t);let c=e||a?gB(e,a):void 0;o.push(qN({codeParser:c,htmlParser:Wm.language.parser})),n&&l.push(gr.high(Ws.of(yB)));let u=qp(r.configure(o));return s&&l.push(u.data.of({autocomplete:kB})),new Do(u,l)}function kB(i){let{state:e,pos:t}=i,n=/<[:\-\.\w\u00b7-\uffff]*$/.exec(e.sliceDoc(t-25,t));if(!n)return null;let r=At(e).resolveInner(t,-1);for(;r&&!r.type.isTop;){if(r.name=="CodeBlock"||r.name=="FencedCode"||r.name=="ProcessingInstructionBlock"||r.name=="CommentBlock"||r.name=="Link"||r.name=="Image")return null;r=r.parent}return{from:t-n[0].length,to:t,options:SB(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let ld=null;function SB(){if(ld)return ld;let i=oB(new Rp(et.create({extensions:Wm}),0,!0));return ld=i?i.options:[]}function _B(i){let e,t;return{c(){e=y("div"),O(e,"class",t="is-editable-"+i[0])},m(n,r){x(n,e,r),i[4](e)},p(n,[r]){r&1&&t!==(t="is-editable-"+n[0])&&O(e,"class",t)},i:U,o:U,d(n){n&&P(e),i[4](null)}}}function CB(i,e,t){let n,r,{value:s}=e,{editable:o=!0}=e;function l(c,u,h){const f=u.reduce((p,g)=>{const v=g.width>0?nT(c,g,h):Gi(c,g);let w=`![${g.filename}](${v})`;return p+`
`+w},""),d=r.state.selection.main.head,m=r.state.update({changes:{from:d,insert:f},selection:{anchor:d+1},scrollIntoView:!0});m&&r.dispatch(m)}xi(()=>{let c=new Vr,u=new Vr,h=et.create({doc:s,extensions:[ju,Ws.of([v_,...V_,...Bp]),c.of(Gv()),Gv(),W_(),u.of(et.tabSize.of(4)),ju,pe.editable.of(o),pe.updateListener.of(function(f){f.docChanged&&t(2,s=f.state.doc.toString())}),pe.lineWrapping,pe.contentAttributes.of({spellcheck:"true"})]});r=new pe({state:h,parent:n})}),Jw(()=>{r&&r.destroy()});function a(c){Ce[c?"unshift":"push"](()=>{n=c,t(1,n)})}return i.$$set=c=>{"value"in c&&t(2,s=c.value),"editable"in c&&t(0,o=c.editable)},[o,n,s,l,a]}class PB extends oe{constructor(e){super(),se(this,e,CB,_B,re,{value:2,editable:0,insertMedia:3})}get insertMedia(){return this.$$.ctx[3]}}function Hv(i){let e,t;return{c(){e=y("div"),t=W(i[6]),O(e,"class","invalid-feedback d-block")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&64&&K(t,n[6])},d(n){n&&P(e)}}}function AB(i){let e,t,n,r,s,o,l;t=new Gy({props:{record:i[2],field:i[1],validationErrors:i[4],onFilesInserted:i[7]}});function a(h){i[9](h)}let c={editable:!i[1].readonly||i[3]};i[0]!==void 0&&(c.value=i[0]),r=new PB({props:c}),i[8](r),Ce.push(()=>nt(r,"value",a));let u=i[6]&&Hv(i);return{c(){e=y("div"),V(t.$$.fragment),n=D(),V(r.$$.fragment),o=D(),u&&u.c(),O(e,"class","mb-3")},m(h,f){x(h,e,f),Y(t,e,null),b(e,n),Y(r,e,null),b(e,o),u&&u.m(e,null),l=!0},p(h,[f]){const d={};f&4&&(d.record=h[2]),f&2&&(d.field=h[1]),f&16&&(d.validationErrors=h[4]),t.$set(d);const m={};f&10&&(m.editable=!h[1].readonly||h[3]),!s&&f&1&&(s=!0,m.value=h[0],st(()=>s=!1)),r.$set(m),h[6]?u?u.p(h,f):(u=Hv(h),u.c(),u.m(e,null)):u&&(u.d(1),u=null)},i(h){l||(T(t.$$.fragment,h),T(r.$$.fragment,h),l=!0)},o(h){R(t.$$.fragment,h),R(r.$$.fragment,h),l=!1},d(h){h&&P(e),z(t),i[8](null),z(r),u&&u.d()}}}function xB(i,e,t){let n;const r=Ue("channel");let{value:s}=e,{field:o}=e,{record:l}=e,{isCreateMode:a}=e,{validationErrors:c}=e,u;function h(m){const p=m.detail.preset.path;u.insertMedia(r,m.detail.files,p)}function f(m){Ce[m?"unshift":"push"](()=>{u=m,t(5,u)})}function d(m){s=m,t(0,s)}return i.$$set=m=>{"value"in m&&t(0,s=m.value),"field"in m&&t(1,o=m.field),"record"in m&&t(2,l=m.record),"isCreateMode"in m&&t(3,a=m.isCreateMode),"validationErrors"in m&&t(4,c=m.validationErrors)},i.$$.update=()=>{i.$$.dirty&18&&t(6,n=In(c,o.name))},[s,o,l,a,c,u,n,h,f,d]}class lP extends oe{constructor(e){super(),se(this,e,xB,AB,re,{value:0,field:1,record:2,isCreateMode:3,validationErrors:4})}}function Kv(i){let e,t=i[0].help+"",n;return{c(){e=y("small"),n=W(t),O(e,"class","help-text light-text")},m(r,s){x(r,e,s),b(e,n)},p(r,s){s&1&&t!==(t=r[0].help+"")&&K(n,t)},d(r){r&&P(e)}}}function TB(i){let e,t,n,r,s=i[0].label+"",o,l,a,c,u,h=i[0].name+"",f,d=i[0].help&&Kv(i);return{c(){e=y("div"),t=y("div"),n=y("div"),r=y("label"),o=W(s),l=D(),d&&d.c(),a=D(),c=y("span"),u=y("code"),f=W(h),O(r,"for",i[1]),O(n,"class","label-and-help"),O(u,"class","field-id"),O(c,"tabindex","-1"),O(c,"class","text-decoration-none"),O(t,"class","labels"),O(e,"class","field-header")},m(m,p){x(m,e,p),b(e,t),b(t,n),b(n,r),b(r,o),b(n,l),d&&d.m(n,null),b(t,a),b(t,c),b(c,u),b(u,f)},p(m,[p]){p&1&&s!==(s=m[0].label+"")&&K(o,s),p&2&&O(r,"for",m[1]),m[0].help?d?d.p(m,p):(d=Kv(m),d.c(),d.m(n,null)):d&&(d.d(1),d=null),p&1&&h!==(h=m[0].name+"")&&K(f,h)},i:U,o:U,d(m){m&&P(e),d&&d.d()}}}function QB(i,e,t){let{field:n}=e,{id:r}=e;return i.$$set=s=>{"field"in s&&t(0,n=s.field),"id"in s&&t(1,r=s.id)},[n,r]}class MB extends oe{constructor(e){super(),se(this,e,QB,TB,re,{field:0,id:1})}}function Jv(i,e,t){const n=i.slice();return n[2]=e[t],n}function ew(i,e,t){const n=i.slice();return n[24]=e[t],n}function tw(i){let e,t;return{c(){e=y("div"),t=W(i[7]),O(e,"class","invalid-feedback d-block mb-3")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&128&&K(t,n[7])},d(n){n&&P(e)}}}function nw(i){let e=[],t=new Map,n,r=fe(i[5]);const s=l=>l[24].id;for(let l=0;l<r.length;l+=1){let a=ew(i,r,l),c=s(a);t.set(c,e[l]=rw(c,a))}let o=null;return r.length||(o=iw()),{c(){for(let l=0;l<e.length;l+=1)e[l].c();n=Ie(),o&&o.c()},m(l,a){for(let c=0;c<e.length;c+=1)e[c]&&e[c].m(l,a);x(l,n,a),o&&o.m(l,a)},p(l,a){a&2080&&(r=fe(l[5]),e=Ti(e,a,s,1,l,r,t,n.parentNode,Fm,rw,n,ew),!r.length&&o?o.p(l,a):r.length?o&&(o.d(1),o=null):(o=iw(),o.c(),o.m(n.parentNode,n)))},d(l){l&&P(n);for(let a=0;a<e.length;a+=1)e[a].d(l);o&&o.d(l)}}}function iw(i){let e;return{c(){e=y("div"),e.textContent="Start typing...",O(e,"class","start-typing")},m(t,n){x(t,e,n)},p:U,d(t){t&&P(e)}}}function rw(i,e){let t,n=e[24].data.name+"",r,s,o,l;function a(...u){return e[17](e[24],...u)}function c(...u){return e[18](e[24],...u)}return{key:i,first:null,c(){t=y("div"),r=W(n),s=D(),O(t,"class","reference-tags-option"),O(t,"role","button"),O(t,"tabindex","0"),this.first=t},m(u,h){x(u,t,h),b(t,r),b(t,s),o||(l=[G(t,"click",a),G(t,"keypress",c)],o=!0)},p(u,h){e=u,h&32&&n!==(n=e[24].data.name+"")&&K(r,n)},d(u){u&&P(t),o=!1,ht(l)}}}function sw(i){let e,t,n,r,s,o;return{c(){e=y("div"),t=W('Add "'),n=W(i[4]),r=W('"'),O(e,"class","reference-tags-option"),O(e,"role","button"),O(e,"tabindex","0")},m(l,a){x(l,e,a),b(e,t),b(e,n),b(e,r),s||(o=[G(e,"click",i[19]),G(e,"keypress",i[20])],s=!0)},p(l,a){a&16&&K(n,l[4])},d(l){l&&P(e),s=!1,ht(o)}}}function ow(i){let e,t=[],n=new Map,r,s=fe(i[6]);const o=l=>l[2].id;for(let l=0;l<s.length;l+=1){let a=Jv(i,s,l),c=o(a);n.set(c,t[l]=lw(c,a))}return{c(){e=y("div");for(let l=0;l<t.length;l+=1)t[l].c();le(e,"display","flex"),le(e,"align-items","center"),le(e,"gap","4px")},m(l,a){x(l,e,a);for(let c=0;c<t.length;c+=1)t[c]&&t[c].m(e,null);r=!0},p(l,a){a&832&&(s=fe(l[6]),Oe(),t=Ti(t,a,o,1,l,s,n,e,Jr,lw,null,Jv),be())},i(l){if(!r){for(let a=0;a<s.length;a+=1)T(t[a]);r=!0}},o(l){for(let a=0;a<t.length;a+=1)R(t[a]);r=!1},d(l){l&&P(e);for(let a=0;a<t.length;a+=1)t[a].d()}}}function lw(i,e){let t,n,r=e[2].data.name+"",s,o,l,a,c,u,h,f,d;c=new ut({props:{width:12,height:12,icon:"close"}});function m(...p){return e[21](e[2],...p)}return{key:i,first:null,c(){t=y("span"),n=y("a"),s=W(r),l=D(),a=y("button"),V(c.$$.fragment),u=D(),O(n,"class","record-title"),O(n,"href",o=e[8].lucentUrl+"/records/"+e[2].id),O(a,"type","button"),O(a,"class","button-text"),O(a,"aria-label","Close"),O(t,"class","reference-tags-selected-value"),this.first=t},m(p,g){x(p,t,g),b(t,n),b(n,s),b(t,l),b(t,a),Y(c,a,null),b(t,u),h=!0,f||(d=G(a,"click",Ln(m)),f=!0)},p(p,g){e=p,(!h||g&64)&&r!==(r=e[2].data.name+"")&&K(s,r),(!h||g&64&&o!==(o=e[8].lucentUrl+"/records/"+e[2].id))&&O(n,"href",o)},i(p){h||(T(c.$$.fragment,p),h=!0)},o(p){R(c.$$.fragment,p),h=!1},d(p){p&&P(t),z(c),f=!1,d()}}}function EB(i){let e,t,n,r,s,o,l,a,c,u,h,f,d=i[7]&&tw(i),m=i[5]&&nw(i),p=i[4]&&sw(i),g=i[6].length>0&&ow(i);return{c(){e=y("div"),d&&d.c(),t=D(),n=y("input"),s=D(),o=y("div"),m&&m.c(),l=D(),p&&p.c(),a=D(),g&&g.c(),c=Ie(),O(n,"type","search"),O(n,"id",i[1]),O(n,"placeholder",r="Search for "+i[0].label),O(n,"autocomplete","off"),Ae(n,"is-invalid",i[7]),O(o,"class","reference-tags-results"),O(e,"class","reference-tags")},m(v,w){x(v,e,w),d&&d.m(e,null),b(e,t),b(e,n),i[15](n),Le(n,i[4]),b(e,s),b(e,o),m&&m.m(o,null),b(o,l),p&&p.m(o,null),x(v,a,w),g&&g.m(v,w),x(v,c,w),u=!0,h||(f=[G(n,"keyup",i[12]),G(n,"input",i[16])],h=!0)},p(v,[w]){v[7]?d?d.p(v,w):(d=tw(v),d.c(),d.m(e,t)):d&&(d.d(1),d=null),(!u||w&2)&&O(n,"id",v[1]),(!u||w&1&&r!==(r="Search for "+v[0].label))&&O(n,"placeholder",r),w&16&&n.value!==v[4]&&Le(n,v[4]),(!u||w&128)&&Ae(n,"is-invalid",v[7]),v[5]?m?m.p(v,w):(m=nw(v),m.c(),m.m(o,l)):m&&(m.d(1),m=null),v[4]?p?p.p(v,w):(p=sw(v),p.c(),p.m(o,null)):p&&(p.d(1),p=null),v[6].length>0?g?(g.p(v,w),w&64&&T(g,1)):(g=ow(v),g.c(),T(g,1),g.m(c.parentNode,c)):g&&(Oe(),R(g,1,1,()=>{g=null}),be())},i(v){u||(T(g),u=!0)},o(v){R(g),u=!1},d(v){v&&(P(e),P(a),P(c)),d&&d.d(),i[15](null),m&&m.d(),p&&p.d(),g&&g.d(v),h=!1,ht(f)}}}function RB(i,e,t){let n,r,s;const o=Ue("channel");let{field:l}=e,{id:a}=e,{record:c}=e,{graph:u}=e,h,{validationErrors:f}=e,d="";function m(M,L){M.preventDefault(),t(13,u.edges=u.edges.filter(N=>!(N.target===L&&N.field===l.name)),u)}function p(M,L){M.preventDefault(),axios.post(o.lucentUrl+"/records",{isCreateMode:!0,record:{schema:l.collections[0],status:"published",data:{[l.searchField]:L}}}).then(N=>{t(5,s=[]),g(M,N.data.records[0]),console.log(N)}).catch(N=>{t(5,s=[]),console.log(N)})}function g(M,L){M.preventDefault(),t(13,u=ky(u,c,[L],l.name,M.detail.action)),t(4,d=""),h.focus(),h.blur()}const v=debounce(M=>{axios.get(o.lucentUrl+"/records/suggestions",{params:{schema:l.collections[0],field:l.searchField,value:d,ui:"text"}}).then(L=>{t(5,s=L.data)}).catch(L=>{t(5,s=[]),console.log(L)})},500);function w(M){Ce[M?"unshift":"push"](()=>{h=M,t(3,h)})}function S(){d=this.value,t(4,d)}const _=(M,L)=>g(L,M),k=(M,L)=>g(L,M),A=M=>p(M,d),C=M=>p(M,d),Q=(M,L)=>m(L,M.id);return i.$$set=M=>{"field"in M&&t(0,l=M.field),"id"in M&&t(1,a=M.id),"record"in M&&t(2,c=M.record),"graph"in M&&t(13,u=M.graph),"validationErrors"in M&&t(14,f=M.validationErrors)},i.$$.update=()=>{i.$$.dirty&16385&&t(7,n=In(f,l.name)),i.$$.dirty&8197&&t(6,r=u.edges.filter(M=>M.field===l.name).map(M=>u.records.find(L=>L.id==M.target&&c.id==M.source)).filter(M=>!!(M!=null&&M.id))??[])},t(5,s=[]),[l,a,c,h,d,s,r,n,o,m,p,g,v,u,f,w,S,_,k,A,C,Q]}class DB extends oe{constructor(e){super(),se(this,e,RB,EB,re,{field:0,id:1,record:2,graph:13,validationErrors:14})}}function $B(i){let e,t,n,r;function s(a){i[18](a)}var o=i[7];function l(a,c){let u={schema:a[3],field:a[2],validationErrors:a[5],isCreateMode:a[6],id:a[8]};return a[0][a[2].name]!==void 0&&(u.value=a[0][a[2].name]),{props:u}}return o&&(e=Xr(o,l(i)),Ce.push(()=>nt(e,"value",s))),{c(){e&&V(e.$$.fragment),n=Ie()},m(a,c){e&&Y(e,a,c),x(a,n,c),r=!0},p(a,c){if(o!==(o=a[7])){if(e){Oe();const u=e;R(u.$$.fragment,1,0,()=>{z(u,1)}),be()}o?(e=Xr(o,l(a)),Ce.push(()=>nt(e,"value",s)),V(e.$$.fragment),T(e.$$.fragment,1),Y(e,n.parentNode,n)):e=null}else if(o){const u={};c&8&&(u.schema=a[3]),c&4&&(u.field=a[2]),c&32&&(u.validationErrors=a[5]),c&64&&(u.isCreateMode=a[6]),!t&&c&5&&(t=!0,u.value=a[0][a[2].name],st(()=>t=!1)),e.$set(u)}},i(a){r||(e&&T(e.$$.fragment,a),r=!0)},o(a){e&&R(e.$$.fragment,a),r=!1},d(a){a&&P(n),e&&z(e,a)}}}function LB(i){let e,t,n,r;function s(a){i[16](a)}function o(a){i[17](a)}let l={schema:i[3],field:i[2],validationErrors:i[5],isCreateMode:i[6],record:i[4]};return i[0][i[2].name]!==void 0&&(l.value=i[0][i[2].name]),i[1]!==void 0&&(l.graph=i[1]),e=new lP({props:l}),Ce.push(()=>nt(e,"value",s)),Ce.push(()=>nt(e,"graph",o)),{c(){V(e.$$.fragment)},m(a,c){Y(e,a,c),r=!0},p(a,c){const u={};c&8&&(u.schema=a[3]),c&4&&(u.field=a[2]),c&32&&(u.validationErrors=a[5]),c&64&&(u.isCreateMode=a[6]),c&16&&(u.record=a[4]),!t&&c&5&&(t=!0,u.value=a[0][a[2].name],st(()=>t=!1)),!n&&c&2&&(n=!0,u.graph=a[1],st(()=>n=!1)),e.$set(u)},i(a){r||(T(e.$$.fragment,a),r=!0)},o(a){R(e.$$.fragment,a),r=!1},d(a){z(e,a)}}}function IB(i){let e,t,n;function r(o){i[15](o)}let s={field:i[2],validationErrors:i[5],record:i[4]};return i[0][i[2].name]!==void 0&&(s.value=i[0][i[2].name]),e=new Fk({props:s}),Ce.push(()=>nt(e,"value",r)),{c(){V(e.$$.fragment)},m(o,l){Y(e,o,l),n=!0},p(o,l){const a={};l&4&&(a.field=o[2]),l&32&&(a.validationErrors=o[5]),l&16&&(a.record=o[4]),!t&&l&5&&(t=!0,a.value=o[0][o[2].name],st(()=>t=!1)),e.$set(a)},i(o){n||(T(e.$$.fragment,o),n=!0)},o(o){R(e.$$.fragment,o),n=!1},d(o){z(e,o)}}}function NB(i){let e,t,n;function r(o){i[14](o)}let s={field:i[2],validationErrors:i[5],isCreateMode:i[6],id:i[8]};return i[0][i[2].name]!==void 0&&(s.value=i[0][i[2].name]),e=new qy({props:s}),Ce.push(()=>nt(e,"value",r)),{c(){V(e.$$.fragment)},m(o,l){Y(e,o,l),n=!0},p(o,l){const a={};l&4&&(a.field=o[2]),l&32&&(a.validationErrors=o[5]),l&64&&(a.isCreateMode=o[6]),!t&&l&5&&(t=!0,a.value=o[0][o[2].name],st(()=>t=!1)),e.$set(a)},i(o){n||(T(e.$$.fragment,o),n=!0)},o(o){R(e.$$.fragment,o),n=!1},d(o){z(e,o)}}}function ZB(i){let e,t,n;function r(o){i[13](o)}let s={field:i[2],id:i[8],validationErrors:i[5],isCreateMode:i[6]};return i[0][i[2].name]!==void 0&&(s.value=i[0][i[2].name]),e=new yy({props:s}),Ce.push(()=>nt(e,"value",r)),{c(){V(e.$$.fragment)},m(o,l){Y(e,o,l),n=!0},p(o,l){const a={};l&4&&(a.field=o[2]),l&32&&(a.validationErrors=o[5]),l&64&&(a.isCreateMode=o[6]),!t&&l&5&&(t=!0,a.value=o[0][o[2].name],st(()=>t=!1)),e.$set(a)},i(o){n||(T(e.$$.fragment,o),n=!0)},o(o){R(e.$$.fragment,o),n=!1},d(o){z(e,o)}}}function BB(i){let e,t,n;function r(o){i[12](o)}let s={field:i[2],id:i[8],validationErrors:i[5],isCreateMode:i[6]};return i[0][i[2].name]!==void 0&&(s.value=i[0][i[2].name]),e=new wy({props:s}),Ce.push(()=>nt(e,"value",r)),{c(){V(e.$$.fragment)},m(o,l){Y(e,o,l),n=!0},p(o,l){const a={};l&4&&(a.field=o[2]),l&32&&(a.validationErrors=o[5]),l&64&&(a.isCreateMode=o[6]),!t&&l&5&&(t=!0,a.value=o[0][o[2].name],st(()=>t=!1)),e.$set(a)},i(o){n||(T(e.$$.fragment,o),n=!0)},o(o){R(e.$$.fragment,o),n=!1},d(o){z(e,o)}}}function WB(i){let e,t,n;function r(o){i[11](o)}let s={record:i[4],id:i[8],field:i[2],validationErrors:i[5]};return i[0][i[2].name]!==void 0&&(s.value=i[0][i[2].name]),e=new eR({props:s}),Ce.push(()=>nt(e,"value",r)),{c(){V(e.$$.fragment)},m(o,l){Y(e,o,l),n=!0},p(o,l){const a={};l&16&&(a.record=o[4]),l&4&&(a.field=o[2]),l&32&&(a.validationErrors=o[5]),!t&&l&5&&(t=!0,a.value=o[0][o[2].name],st(()=>t=!1)),e.$set(a)},i(o){n||(T(e.$$.fragment,o),n=!0)},o(o){R(e.$$.fragment,o),n=!1},d(o){z(e,o)}}}function XB(i){let e,t,n;function r(o){i[10](o)}let s={id:i[8],record:i[4],field:i[2],validationErrors:i[5]};return i[1]!==void 0&&(s.graph=i[1]),e=new hE({props:s}),Ce.push(()=>nt(e,"graph",r)),{c(){V(e.$$.fragment)},m(o,l){Y(e,o,l),n=!0},p(o,l){const a={};l&16&&(a.record=o[4]),l&4&&(a.field=o[2]),l&32&&(a.validationErrors=o[5]),!t&&l&2&&(t=!0,a.graph=o[1],st(()=>t=!1)),e.$set(a)},i(o){n||(T(e.$$.fragment,o),n=!0)},o(o){R(e.$$.fragment,o),n=!1},d(o){z(e,o)}}}function FB(i){let e,t,n;function r(o){i[9](o)}let s={id:i[8],record:i[4],field:i[2],validationErrors:i[5]};return i[1]!==void 0&&(s.graph=i[1]),e=new DB({props:s}),Ce.push(()=>nt(e,"graph",r)),{c(){V(e.$$.fragment)},m(o,l){Y(e,o,l),n=!0},p(o,l){const a={};l&16&&(a.record=o[4]),l&4&&(a.field=o[2]),l&32&&(a.validationErrors=o[5]),!t&&l&2&&(t=!0,a.graph=o[1],st(()=>t=!1)),e.$set(a)},i(o){n||(T(e.$$.fragment,o),n=!0)},o(o){R(e.$$.fragment,o),n=!1},d(o){z(e,o)}}}function YB(i){let e,t,n,r,s,o;t=new MB({props:{field:i[2],id:i[8]}});const l=[FB,XB,WB,BB,ZB,NB,IB,LB,$B],a=[];function c(u,h){return u[2].info.name==="reference"&&u[2].layout==="tags"?0:u[2].info.name==="reference"?1:u[2].info.name==="file"?2:u[2].info.name==="text"?3:u[2].info.name==="slug"?4:u[2].info.name==="textarea"?5:u[2].info.name==="rich"?6:u[2].info.name==="markdown"?7:8}return r=c(i),s=a[r]=l[r](i),{c(){e=y("div"),V(t.$$.fragment),n=D(),s.c(),O(e,"class","editor-field")},m(u,h){x(u,e,h),Y(t,e,null),b(e,n),a[r].m(e,null),o=!0},p(u,[h]){const f={};h&4&&(f.field=u[2]),t.$set(f);let d=r;r=c(u),r===d?a[r].p(u,h):(Oe(),R(a[d],1,1,()=>{a[d]=null}),be(),s=a[r],s?s.p(u,h):(s=a[r]=l[r](u),s.c()),T(s,1),s.m(e,null))},i(u){o||(T(t.$$.fragment,u),T(s),o=!0)},o(u){R(t.$$.fragment,u),R(s),o=!1},d(u){u&&P(e),z(t),a[r].d()}}}function zB(i,e,t){const n={text:wy,slug:yy,textarea:qy,rich:Fk,color:mE,checkbox:OE,number:wE,url:SE,date:EE,datetime:sR,uuid:LE,json:RN,markdown:lP};let{field:r}=e,{data:s}=e,{schema:o}=e,{record:l}=e,{graph:a}=e,{validationErrors:c}=e,{isCreateMode:u}=e,h=n[r.info.name];const f=`field-${r.name}-${l.id}`;function d(C){a=C,t(1,a)}function m(C){a=C,t(1,a)}function p(C){i.$$.not_equal(s[r.name],C)&&(s[r.name]=C,t(0,s))}function g(C){i.$$.not_equal(s[r.name],C)&&(s[r.name]=C,t(0,s))}function v(C){i.$$.not_equal(s[r.name],C)&&(s[r.name]=C,t(0,s))}function w(C){i.$$.not_equal(s[r.name],C)&&(s[r.name]=C,t(0,s))}function S(C){i.$$.not_equal(s[r.name],C)&&(s[r.name]=C,t(0,s))}function _(C){i.$$.not_equal(s[r.name],C)&&(s[r.name]=C,t(0,s))}function k(C){a=C,t(1,a)}function A(C){i.$$.not_equal(s[r.name],C)&&(s[r.name]=C,t(0,s))}return i.$$set=C=>{"field"in C&&t(2,r=C.field),"data"in C&&t(0,s=C.data),"schema"in C&&t(3,o=C.schema),"record"in C&&t(4,l=C.record),"graph"in C&&t(1,a=C.graph),"validationErrors"in C&&t(5,c=C.validationErrors),"isCreateMode"in C&&t(6,u=C.isCreateMode)},[s,a,r,o,l,c,u,h,f,d,m,p,g,v,w,S,_,k,A]}class aP extends oe{constructor(e){super(),se(this,e,zB,YB,re,{field:2,data:0,schema:3,record:4,graph:1,validationErrors:5,isCreateMode:6})}}function aw(i,e,t){const n=i.slice();return n[3]=e[t],n}function cw(i){let e;return{c(){e=W("Nothing links to this record")},m(t,n){x(t,e,n)},d(t){t&&P(e)}}}function uw(i){let e,t,n,r,s,o,l,a,c;return l=new Fy({props:{record:i[3].record,hasDelete:!1,graph:i[0]}}),{c(){e=y("div"),t=y("span"),n=W("In "),r=y("i"),r.textContent=`${i[3].field}`,s=W(" of"),o=D(),V(l.$$.fragment),a=D(),le(t,"font-size","14px"),le(t,"margin-bottom","5px"),le(t,"display","block"),le(e,"margin","0 0 15px"),le(e,"position","relative")},m(u,h){x(u,e,h),b(e,t),b(t,n),b(t,r),b(t,s),b(e,o),Y(l,e,null),b(e,a),c=!0},p(u,h){const f={};h&1&&(f.graph=u[0]),l.$set(f)},i(u){c||(T(l.$$.fragment,u),c=!0)},o(u){R(l.$$.fragment,u),c=!1},d(u){u&&P(e),z(l)}}}function VB(i){let e,t,n=fe(i[1]),r=[];for(let l=0;l<n.length;l+=1)r[l]=uw(aw(i,n,l));const s=l=>R(r[l],1,1,()=>{r[l]=null});let o=null;return n.length||(o=cw()),{c(){e=y("div");for(let l=0;l<r.length;l+=1)r[l].c();o&&o.c(),O(e,"class","editor-field")},m(l,a){x(l,e,a);for(let c=0;c<r.length;c+=1)r[c]&&r[c].m(e,null);o&&o.m(e,null),t=!0},p(l,[a]){if(a&3){n=fe(l[1]);let c;for(c=0;c<n.length;c+=1){const u=aw(l,n,c);r[c]?(r[c].p(u,a),T(r[c],1)):(r[c]=uw(u),r[c].c(),T(r[c],1),r[c].m(e,null))}for(Oe(),c=n.length;c<r.length;c+=1)s(c);be(),n.length?o&&(o.d(1),o=null):o||(o=cw(),o.c(),o.m(e,null))}},i(l){if(!t){for(let a=0;a<n.length;a+=1)T(r[a]);t=!0}},o(l){r=r.filter(Boolean);for(let a=0;a<r.length;a+=1)R(r[a]);t=!1},d(l){l&&P(e),Ot(r,l),o&&o.d()}}}function UB(i,e){return e.includes(":")&&(e=e.split(":")[0]),i.fields.find(t=>t.name===e)}function jB(i,e,t){const n=Ue("channel");let{graph:r}=e,s=r.parentEdges.map(o=>{let l=n.schemas.find(c=>c.name===o.sourceSchema),a=UB(l,o.field);return a?{field:a.label,record:r.records.find(c=>c.id===o.source)}:null}).filter(o=>!!o);return i.$$set=o=>{"graph"in o&&t(0,r=o.graph)},[r,s]}class qB extends oe{constructor(e){super(),se(this,e,jB,VB,re,{graph:0})}}function hw(i,e,t){const n=i.slice();return n[7]=e[t],n}function fw(i,e,t){const n=i.slice();return n[4]=e[t],n}function GB(i){let e,t=(JSON.stringify(i[1])??"")+"",n,r;return{c(){e=y("div"),n=W(t),O(e,"class",r=i[3]+" field-content svelte-s7tjhg")},m(s,o){x(s,e,o),b(e,n)},p(s,o){o&2&&t!==(t=(JSON.stringify(s[1])??"")+"")&&K(n,t),o&8&&r!==(r=s[3]+" field-content svelte-s7tjhg")&&O(e,"class",r)},i:U,o:U,d(s){s&&P(e)}}}function HB(i){let e,t=(i[1]??"")+"",n;return{c(){e=y("div"),O(e,"class",n=i[3]+" field-content svelte-s7tjhg")},m(r,s){x(r,e,s),e.innerHTML=t},p(r,s){s&2&&t!==(t=(r[1]??"")+"")&&(e.innerHTML=t),s&8&&n!==(n=r[3]+" field-content svelte-s7tjhg")&&O(e,"class",n)},i:U,o:U,d(r){r&&P(e)}}}function KB(i){let e,t=(JSON.stringify(i[1],null,2)??"")+"",n,r;return{c(){e=y("div"),n=W(t),O(e,"class",r=i[3]+" field-content svelte-s7tjhg"),le(e,"white-space","break-spaces")},m(s,o){x(s,e,o),b(e,n)},p(s,o){o&2&&t!==(t=(JSON.stringify(s[1],null,2)??"")+"")&&K(n,t),o&8&&r!==(r=s[3]+" field-content svelte-s7tjhg")&&O(e,"class",r)},i:U,o:U,d(s){s&&P(e)}}}function JB(i){let e,t,n,r,s=fe(i[1]),o=[];for(let a=0;a<s.length;a+=1)o[a]=dw(hw(i,s,a));const l=a=>R(o[a],1,1,()=>{o[a]=null});return{c(){e=y("div"),t=y("div");for(let a=0;a<o.length;a+=1)o[a].c();O(t,"class","d-flex align-items-center text-center flex-wrap"),O(e,"class",n=i[3]+" field-content svelte-s7tjhg")},m(a,c){x(a,e,c),b(e,t);for(let u=0;u<o.length;u+=1)o[u]&&o[u].m(t,null);r=!0},p(a,c){if(c&2){s=fe(a[1]);let u;for(u=0;u<s.length;u+=1){const h=hw(a,s,u);o[u]?(o[u].p(h,c),T(o[u],1)):(o[u]=dw(h),o[u].c(),T(o[u],1),o[u].m(t,null))}for(Oe(),u=s.length;u<o.length;u+=1)l(u);be()}(!r||c&8&&n!==(n=a[3]+" field-content svelte-s7tjhg"))&&O(e,"class",n)},i(a){if(!r){for(let c=0;c<s.length;c+=1)T(o[c]);r=!0}},o(a){o=o.filter(Boolean);for(let c=0;c<o.length;c+=1)R(o[c]);r=!1},d(a){a&&P(e),Ot(o,a)}}}function eW(i){let e,t,n,r,s=fe(i[2][i[0].name]),o=[];for(let a=0;a<s.length;a+=1)o[a]=mw(fw(i,s,a));const l=a=>R(o[a],1,1,()=>{o[a]=null});return{c(){e=y("div"),t=y("div");for(let a=0;a<o.length;a+=1)o[a].c();O(t,"class","d-flex align-items-center text-center flex-wrap"),O(e,"class",n=i[3]+" field-content svelte-s7tjhg")},m(a,c){x(a,e,c),b(e,t);for(let u=0;u<o.length;u+=1)o[u]&&o[u].m(t,null);r=!0},p(a,c){if(c&5){s=fe(a[2][a[0].name]);let u;for(u=0;u<s.length;u+=1){const h=fw(a,s,u);o[u]?(o[u].p(h,c),T(o[u],1)):(o[u]=mw(h),o[u].c(),T(o[u],1),o[u].m(t,null))}for(Oe(),u=s.length;u<o.length;u+=1)l(u);be()}(!r||c&8&&n!==(n=a[3]+" field-content svelte-s7tjhg"))&&O(e,"class",n)},i(a){if(!r){for(let c=0;c<s.length;c+=1)T(o[c]);r=!0}},o(a){o=o.filter(Boolean);for(let c=0;c<o.length;c+=1)R(o[c]);r=!1},d(a){a&&P(e),Ot(o,a)}}}function dw(i){let e,t,n,r;return t=new Vy({props:{file:i[7]}}),{c(){e=y("div"),V(t.$$.fragment),n=D(),O(e,"class","ms-2")},m(s,o){x(s,e,o),Y(t,e,null),b(e,n),r=!0},p(s,o){const l={};o&2&&(l.file=s[7]),t.$set(l)},i(s){r||(T(t.$$.fragment,s),r=!0)},o(s){R(t.$$.fragment,s),r=!1},d(s){s&&P(e),z(t)}}}function mw(i){let e,t,n,r;return t=new Cy({props:{record:i[4]}}),{c(){e=y("div"),V(t.$$.fragment),n=D(),O(e,"class","ms-2")},m(s,o){x(s,e,o),Y(t,e,null),b(e,n),r=!0},p(s,o){const l={};o&5&&(l.record=s[4]),t.$set(l)},i(s){r||(T(t.$$.fragment,s),r=!0)},o(s){R(t.$$.fragment,s),r=!1},d(s){s&&P(e),z(t)}}}function tW(i){let e,t,n,r,s,o,l;const a=[eW,JB,KB,HB,GB],c=[];function u(h,f){return f&1&&(e=null),f&1&&(t=null),f&1&&(n=null),e==null&&(e=!!["reference"].includes(h[0].info.name)),e?0:(t==null&&(t=!!["file"].includes(h[0].info.name)),t?1:(n==null&&(n=!!["json","block"].includes(h[0].info.name)),n?2:h[0].info.name==="rich"?3:4))}return r=u(i,-1),s=c[r]=a[r](i),{c(){s.c(),o=Ie()},m(h,f){c[r].m(h,f),x(h,o,f),l=!0},p(h,[f]){let d=r;r=u(h,f),r===d?c[r].p(h,f):(Oe(),R(c[d],1,1,()=>{c[d]=null}),be(),s=c[r],s?s.p(h,f):(s=c[r]=a[r](h),s.c()),T(s,1),s.m(o.parentNode,o))},i(h){l||(T(s),l=!0)},o(h){R(s),l=!1},d(h){h&&P(o),c[r].d(h)}}}function nW(i,e,t){let{field:n}=e,{side:r}=e,{edges:s}=e,{colorClass:o}=e;return i.$$set=l=>{"field"in l&&t(0,n=l.field),"side"in l&&t(1,r=l.side),"edges"in l&&t(2,s=l.edges),"colorClass"in l&&t(3,o=l.colorClass)},[n,r,s,o]}class pw extends oe{constructor(e){super(),se(this,e,nW,tW,re,{field:0,side:1,edges:2,colorClass:3})}}function iW(i){let e,t,n,r=i[0].rank+"",s,o,l,a,c,u=i[0].target+"",h,f;return{c(){e=y("div"),t=y("span"),n=W("Rank: "),s=W(r),o=D(),l=y("span"),l.textContent="id:",a=D(),c=y("a"),h=W(u),O(t,"class","me-3"),O(c,"href",f=i[1].lucentUrl+"/records/"+i[0].target),O(c,"target","_blank")},m(d,m){x(d,e,m),b(e,t),b(t,n),b(t,s),b(e,o),b(e,l),b(e,a),b(e,c),b(c,h)},p(d,[m]){m&1&&r!==(r=d[0].rank+"")&&K(s,r),m&1&&u!==(u=d[0].target+"")&&K(h,u),m&1&&f!==(f=d[1].lucentUrl+"/records/"+d[0].target)&&O(c,"href",f)},i:U,o:U,d(d){d&&P(e)}}}function rW(i,e,t){const n=Ue("channel");let{edge:r}=e;return i.$$set=s=>{"edge"in s&&t(0,r=s.edge)},[r,n]}class cP extends oe{constructor(e){super(),se(this,e,rW,iW,re,{edge:0})}}function gw(i,e,t){const n=i.slice();return n[16]=e[t][0],n[17]=e[t][1],n}function Ow(i,e,t){const n=i.slice();return n[20]=e[t],n}function bw(i,e,t){const n=i.slice();return n[20]=e[t],n}function vw(i,e,t){const n=i.slice();return n[16]=e[t],n}function ww(i,e,t){const n=i.slice();return n[27]=e[t],n}function sW(i){let e;return{c(){e=y("div"),e.innerHTML="<span>Revisions are not enabled for this Schema</span>",O(e,"class","card-body")},m(t,n){x(t,e,n)},p:U,i:U,o:U,d(t){t&&P(e)}}}function oW(i){let e,t,n,r,s=fe(i[8]),o=[];for(let a=0;a<s.length;a+=1)o[a]=kw(ww(i,s,a));const l=a=>R(o[a],1,1,()=>{o[a]=null});return{c(){e=y("div"),e.textContent="Revisions",t=D();for(let a=0;a<o.length;a+=1)o[a].c();n=Ie(),O(e,"class","header-small mb-3")},m(a,c){x(a,e,c),x(a,t,c);for(let u=0;u<o.length;u+=1)o[u]&&o[u].m(a,c);x(a,n,c),r=!0},p(a,c){if(c&803){s=fe(a[8]);let u;for(u=0;u<s.length;u+=1){const h=ww(a,s,u);o[u]?(o[u].p(h,c),T(o[u],1)):(o[u]=kw(h),o[u].c(),T(o[u],1),o[u].m(n.parentNode,n))}for(Oe(),u=s.length;u<o.length;u+=1)l(u);be()}},i(a){if(!r){for(let c=0;c<s.length;c+=1)T(o[c]);r=!0}},o(a){o=o.filter(Boolean);for(let c=0;c<o.length;c+=1)R(o[c]);r=!1},d(a){a&&(P(e),P(t),P(n)),Ot(o,a)}}}function yw(i){let e,t,n,r,s=i[27].version+"",o,l,a,c,u=Bi(i[27].updatedAt)+"",h,f,d,m,p,g,v,w,S,_;a=new _i({props:{name:Dn(i[1],i[27].updatedBy),side:24}});function k(...A){return i[12](i[27],...A)}return{c(){var A,C;e=y("div"),t=y("div"),n=y("span"),r=W("version "),o=W(s),l=D(),V(a.$$.fragment),c=D(),h=W(u),f=D(),d=y("div"),m=y("button"),p=W("Compare"),v=D(),O(t,"class","version"),m.disabled=g=i[27].version===((A=i[5])==null?void 0:A.version),O(m,"class","button"),O(d,"class","col-3 text-center"),O(e,"class","revision"),Ae(e,"active",i[27].version===((C=i[5])==null?void 0:C.version))},m(A,C){x(A,e,C),b(e,t),b(t,n),b(n,r),b(n,o),b(t,l),Y(a,t,null),b(t,c),b(t,h),b(e,f),b(e,d),b(d,m),b(m,p),b(e,v),w=!0,S||(_=G(m,"click",k),S=!0)},p(A,C){var M,L;i=A,(!w||C&256)&&s!==(s=i[27].version+"")&&K(o,s);const Q={};C&258&&(Q.name=Dn(i[1],i[27].updatedBy)),a.$set(Q),(!w||C&256)&&u!==(u=Bi(i[27].updatedAt)+"")&&K(h,u),(!w||C&288&&g!==(g=i[27].version===((M=i[5])==null?void 0:M.version)))&&(m.disabled=g),(!w||C&288)&&Ae(e,"active",i[27].version===((L=i[5])==null?void 0:L.version))},i(A){w||(T(a.$$.fragment,A),w=!0)},o(A){R(a.$$.fragment,A),w=!1},d(A){A&&P(e),z(a),S=!1,_()}}}function kw(i){let e,t,n=i[27].version!==i[0].version&&yw(i);return{c(){n&&n.c(),e=Ie()},m(r,s){n&&n.m(r,s),x(r,e,s),t=!0},p(r,s){r[27].version!==r[0].version?n?(n.p(r,s),s&257&&T(n,1)):(n=yw(r),n.c(),T(n,1),n.m(e.parentNode,e)):n&&(Oe(),R(n,1,1,()=>{n=null}),be())},i(r){t||(T(n),t=!0)},o(r){R(n),t=!1},d(r){r&&P(e),n&&n.d(r)}}}function Sw(i){let e,t,n,r,s,o,l,a;const c=[aW,lW],u=[];function h(p,g){return p[6].length>0?0:1}t=h(i),n=u[t]=c[t](i);let f=fe(Object.entries(i[7])),d=[];for(let p=0;p<f.length;p+=1)d[p]=Qw(gw(i,f,p));const m=p=>R(d[p],1,1,()=>{d[p]=null});return{c(){e=y("div"),n.c(),r=D(),s=y("div"),o=y("p"),o.textContent="Record References",l=D();for(let p=0;p<d.length;p+=1)d[p].c();O(o,"class","text-center fw-bold mb-3 mt-5"),O(s,"class","mt-3"),O(e,"class","selected-revision")},m(p,g){x(p,e,g),u[t].m(e,null),b(e,r),b(e,s),b(s,o),b(s,l);for(let v=0;v<d.length;v+=1)d[v]&&d[v].m(s,null);a=!0},p(p,g){let v=t;if(t=h(p),t===v?u[t].p(p,g):(Oe(),R(u[v],1,1,()=>{u[v]=null}),be(),n=u[t],n?n.p(p,g):(n=u[t]=c[t](p),n.c()),T(n,1),n.m(e,r)),g&128){f=fe(Object.entries(p[7]));let w;for(w=0;w<f.length;w+=1){const S=gw(p,f,w);d[w]?(d[w].p(S,g),T(d[w],1)):(d[w]=Qw(S),d[w].c(),T(d[w],1),d[w].m(s,null))}for(Oe(),w=f.length;w<d.length;w+=1)m(w);be()}},i(p){if(!a){T(n);for(let g=0;g<f.length;g+=1)T(d[g]);a=!0}},o(p){R(n),d=d.filter(Boolean);for(let g=0;g<d.length;g+=1)R(d[g]);a=!1},d(p){p&&P(e),u[t].d(),Ot(d,p)}}}function lW(i){let e;return{c(){e=y("div"),e.innerHTML="<span>Nothing will change</span>",O(e,"class","lx-card text-center")},m(t,n){x(t,e,n)},p:U,i:U,o:U,d(t){t&&P(e)}}}function aW(i){let e,t,n,r,s=i[5].version+"",o,l,a,c,u,h,f,d=i[4]&&_w(i),m=fe(i[6]),p=[];for(let v=0;v<m.length;v+=1)p[v]=Cw(vw(i,m,v));const g=v=>R(p[v],1,1,()=>{p[v]=null});return{c(){e=y("p"),e.textContent="If you choose to rollback to this revision",t=D(),n=y("button"),r=W("Rollback to version "),o=W(s),l=D(),d&&d.c(),a=D(),c=y("div");for(let v=0;v<p.length;v+=1)p[v].c();O(e,"class","text-center fw-bold mb-3 mt-5"),O(n,"class","button"),O(c,"class","mt-3")},m(v,w){x(v,e,w),x(v,t,w),x(v,n,w),b(n,r),b(n,o),x(v,l,w),d&&d.m(v,w),x(v,a,w),x(v,c,w);for(let S=0;S<p.length;S+=1)p[S]&&p[S].m(c,null);u=!0,h||(f=G(n,"click",i[10]),h=!0)},p(v,w){if((!u||w&32)&&s!==(s=v[5].version+"")&&K(o,s),v[4]?d?d.p(v,w):(d=_w(v),d.c(),d.m(a.parentNode,a)):d&&(d.d(1),d=null),w&97){m=fe(v[6]);let S;for(S=0;S<m.length;S+=1){const _=vw(v,m,S);p[S]?(p[S].p(_,w),T(p[S],1)):(p[S]=Cw(_),p[S].c(),T(p[S],1),p[S].m(c,null))}for(Oe(),S=m.length;S<p.length;S+=1)g(S);be()}},i(v){if(!u){for(let w=0;w<m.length;w+=1)T(p[w]);u=!0}},o(v){p=p.filter(Boolean);for(let w=0;w<p.length;w+=1)R(p[w]);u=!1},d(v){v&&(P(e),P(t),P(n),P(l),P(a),P(c)),d&&d.d(v),Ot(p,v),h=!1,f()}}}function _w(i){let e,t;return{c(){e=y("span"),t=W(i[4]),O(e,"class","d-block text-danger mt-3")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&16&&K(t,n[4])},d(n){n&&P(e)}}}function Cw(i){let e,t,n,r,s,o,l=i[16].label+"",a,c,u,h,f,d,m,p;return n=new pw({props:{field:i[16],side:i[0].data[i[16].name],colorClass:"text-danger"}}),u=new ut({props:{icon:"angle-right",width:"12",height:"12"}}),d=new pw({props:{edges:i[5]._edges,field:i[16],side:i[5].data[i[16].name],colorClass:"text-success"}}),{c(){e=y("div"),t=y("div"),V(n.$$.fragment),r=D(),s=y("div"),o=y("span"),a=W(l),c=D(),V(u.$$.fragment),h=D(),f=y("div"),V(d.$$.fragment),m=D(),O(t,"class","compare-left"),O(o,"class","me-1"),O(s,"class","compare-center"),O(f,"class","compare-right"),O(e,"class","revision-field"),le(e,"overflow","hidden")},m(g,v){x(g,e,v),b(e,t),Y(n,t,null),b(e,r),b(e,s),b(s,o),b(o,a),b(s,c),Y(u,s,null),b(e,h),b(e,f),Y(d,f,null),x(g,m,v),p=!0},p(g,v){const w={};v&64&&(w.field=g[16]),v&65&&(w.side=g[0].data[g[16].name]),n.$set(w),(!p||v&64)&&l!==(l=g[16].label+"")&&K(a,l);const S={};v&32&&(S.edges=g[5]._edges),v&64&&(S.field=g[16]),v&96&&(S.side=g[5].data[g[16].name]),d.$set(S)},i(g){p||(T(n.$$.fragment,g),T(u.$$.fragment,g),T(d.$$.fragment,g),p=!0)},o(g){R(n.$$.fragment,g),R(u.$$.fragment,g),R(d.$$.fragment,g),p=!1},d(g){g&&(P(e),P(m)),z(n),z(u),z(d)}}}function Pw(i){let e;return{c(){e=y("p"),e.textContent="No references"},m(t,n){x(t,e,n)},p:U,d(t){t&&P(e)}}}function Aw(i){let e,t;return e=new cP({props:{edge:i[20]}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&128&&(s.edge=n[20]),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function xw(i){let e;return{c(){e=y("p"),e.textContent="No references"},m(t,n){x(t,e,n)},p:U,d(t){t&&P(e)}}}function Tw(i){let e,t;return e=new cP({props:{edge:i[20]}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&128&&(s.edge=n[20]),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function Qw(i){let e,t,n=i[16]+"",r,s,o,l,a,c,u,h,f,d,m,p,g=fe(i[17].record),v=[];for(let Q=0;Q<g.length;Q+=1)v[Q]=Aw(bw(i,g,Q));const w=Q=>R(v[Q],1,1,()=>{v[Q]=null});let S=null;g.length||(S=Pw());let _=fe(i[17].revision),k=[];for(let Q=0;Q<_.length;Q+=1)k[Q]=Tw(Ow(i,_,Q));const A=Q=>R(k[Q],1,1,()=>{k[Q]=null});let C=null;return _.length||(C=xw()),{c(){e=y("div"),t=y("div"),r=W(n),s=W(":"),o=D(),l=y("div"),a=y("p"),a.textContent="Record",c=D();for(let Q=0;Q<v.length;Q+=1)v[Q].c();S&&S.c(),u=D(),h=y("div"),f=y("p"),f.textContent="Revision",d=D();for(let Q=0;Q<k.length;Q+=1)k[Q].c();C&&C.c(),m=D(),O(t,"class","reference-field"),O(a,"class",""),O(l,"class","reference-compare"),O(f,"class","text-success"),O(h,"class","reference-compare"),O(e,"class","revision-references"),le(e,"overflow","hidden")},m(Q,M){x(Q,e,M),b(e,t),b(t,r),b(t,s),b(e,o),b(e,l),b(l,a),b(l,c);for(let L=0;L<v.length;L+=1)v[L]&&v[L].m(l,null);S&&S.m(l,null),b(e,u),b(e,h),b(h,f),b(h,d);for(let L=0;L<k.length;L+=1)k[L]&&k[L].m(h,null);C&&C.m(h,null),b(e,m),p=!0},p(Q,M){if((!p||M&128)&&n!==(n=Q[16]+"")&&K(r,n),M&128){g=fe(Q[17].record);let L;for(L=0;L<g.length;L+=1){const N=bw(Q,g,L);v[L]?(v[L].p(N,M),T(v[L],1)):(v[L]=Aw(N),v[L].c(),T(v[L],1),v[L].m(l,null))}for(Oe(),L=g.length;L<v.length;L+=1)w(L);be(),!g.length&&S?S.p(Q,M):g.length?S&&(S.d(1),S=null):(S=Pw(),S.c(),S.m(l,null))}if(M&128){_=fe(Q[17].revision);let L;for(L=0;L<_.length;L+=1){const N=Ow(Q,_,L);k[L]?(k[L].p(N,M),T(k[L],1)):(k[L]=Tw(N),k[L].c(),T(k[L],1),k[L].m(h,null))}for(Oe(),L=_.length;L<k.length;L+=1)A(L);be(),!_.length&&C?C.p(Q,M):_.length?C&&(C.d(1),C=null):(C=xw(),C.c(),C.m(h,null))}},i(Q){if(!p){for(let M=0;M<g.length;M+=1)T(v[M]);for(let M=0;M<_.length;M+=1)T(k[M]);p=!0}},o(Q){v=v.filter(Boolean);for(let M=0;M<v.length;M+=1)R(v[M]);k=k.filter(Boolean);for(let M=0;M<k.length;M+=1)R(k[M]);p=!1},d(Q){Q&&P(e),Ot(v,Q),S&&S.d(),Ot(k,Q),C&&C.d()}}}function cW(i){let e,t,n,r,s,o,l,a=i[0].id+"",c,u,h,f,d,m=i[0].version+"",p,g,v,w,S,_,k,A=Bi(i[0].createdAt)+"",C,Q,M,L,N,B,J,te=Bi(i[0].updatedAt)+"",ie,ae,X,ee,Te,ve,je,ne=i[2].revisions+"",Ee,Re,xt,H,Pe,Ye,Tt,yt,wt;_=new _i({props:{name:Dn(i[1],i[0].createdBy),side:24}}),B=new _i({props:{name:Dn(i[1],i[0].updatedBy),side:24}});const Qt=[oW,sW],He=[];function Ut(qe,Mt){return qe[2].revisions>0?0:1}Pe=Ut(i),Ye=He[Pe]=Qt[Pe](i);let ct=i[5]&&Sw(i);return{c(){e=y("div"),t=y("div"),n=y("div"),r=y("div"),s=y("span"),s.textContent="record id",o=D(),l=y("small"),c=W(a),u=D(),h=y("div"),f=y("span"),f.textContent="current version",d=D(),p=W(m),g=D(),v=y("div"),w=y("span"),w.textContent="created",S=D(),V(_.$$.fragment),k=D(),C=W(A),Q=D(),M=y("div"),L=y("span"),L.textContent="updated",N=D(),V(B.$$.fragment),J=D(),ie=W(te),ae=D(),X=y("div"),ee=y("span"),ee.textContent="Rules for this schema",Te=D(),ve=y("small"),je=W("Each record maintains the last "),Ee=W(ne),Re=W(`
versions`),xt=D(),H=y("div"),Ye.c(),Tt=D(),yt=y("div"),ct&&ct.c(),O(s,"class","label text-end text-muted"),O(f,"class","label text-end text-muted"),O(w,"class","label text-end text-muted"),O(L,"class","label text-end text-muted"),O(n,"class","col-8"),O(ee,"class","label d-block text-muted"),O(X,"class","col-4"),O(t,"class","row"),O(e,"class","lx-card"),O(H,"class","revisions")},m(qe,Mt){x(qe,e,Mt),b(e,t),b(t,n),b(n,r),b(r,s),b(r,o),b(r,l),b(l,c),b(n,u),b(n,h),b(h,f),b(h,d),b(h,p),b(n,g),b(n,v),b(v,w),b(v,S),Y(_,v,null),b(v,k),b(v,C),b(n,Q),b(n,M),b(M,L),b(M,N),Y(B,M,null),b(M,J),b(M,ie),b(t,ae),b(t,X),b(X,ee),b(X,Te),b(X,ve),b(ve,je),b(ve,Ee),b(ve,Re),x(qe,xt,Mt),x(qe,H,Mt),He[Pe].m(H,null),x(qe,Tt,Mt),x(qe,yt,Mt),ct&&ct.m(yt,null),i[13](yt),wt=!0},p(qe,[Mt]){(!wt||Mt&1)&&a!==(a=qe[0].id+"")&&K(c,a),(!wt||Mt&1)&&m!==(m=qe[0].version+"")&&K(p,m);const ei={};Mt&3&&(ei.name=Dn(qe[1],qe[0].createdBy)),_.$set(ei),(!wt||Mt&1)&&A!==(A=Bi(qe[0].createdAt)+"")&&K(C,A);const ti={};Mt&3&&(ti.name=Dn(qe[1],qe[0].updatedBy)),B.$set(ti),(!wt||Mt&1)&&te!==(te=Bi(qe[0].updatedAt)+"")&&K(ie,te),(!wt||Mt&4)&&ne!==(ne=qe[2].revisions+"")&&K(Ee,ne);let Ri=Pe;Pe=Ut(qe),Pe===Ri?He[Pe].p(qe,Mt):(Oe(),R(He[Ri],1,1,()=>{He[Ri]=null}),be(),Ye=He[Pe],Ye?Ye.p(qe,Mt):(Ye=He[Pe]=Qt[Pe](qe),Ye.c()),T(Ye,1),Ye.m(H,null)),qe[5]?ct?(ct.p(qe,Mt),Mt&32&&T(ct,1)):(ct=Sw(qe),ct.c(),T(ct,1),ct.m(yt,null)):ct&&(Oe(),R(ct,1,1,()=>{ct=null}),be())},i(qe){wt||(T(_.$$.fragment,qe),T(B.$$.fragment,qe),T(Ye),T(ct),wt=!0)},o(qe){R(_.$$.fragment,qe),R(B.$$.fragment,qe),R(Ye),R(ct),wt=!1},d(qe){qe&&(P(e),P(xt),P(H),P(Tt),P(yt)),z(_),z(B),He[Pe].d(),ct&&ct.d(),i[13](null)}}}function uW(i,e,t){let n,r,s,o;const l=Ue("channel");let{record:a}=e,{graph:c}=e,{users:u}=e,{schema:h}=e,f,d="";axios.get(`${l.lucentUrl}/records/${a.id}/revisions`).then(S=>{t(8,n=S.data)}).catch(S=>{console.log(S)});function m(S,_){t(7,o=c.edges.filter(k=>k.depth===1).reduce((k,A)=>(k[A.field]||(k[A.field]={record:[],revision:[]}),k[A.field].record.push(A),k),{})),t(7,o=_._edges.reduce((k,A)=>(k[A.field]||(k[A.field]={record:[],revision:[]}),k[A.field].revision.push(A),k),o))}function p(S,_){S.preventDefault(),t(5,s=_),t(6,r=h.fields.filter(k=>!ia(s.data[k.name],a.data[k.name]))),m(r,_),f.scrollIntoView()}function g(S){S.preventDefault(),t(4,d=""),axios.post(`${l.lucentUrl}/records/${a.id}/rollback/${s.version}`).then(_=>{window.location.reload()}).catch(_=>{const k=_.response.data.error;t(4,d=k.fieldLabel+": "+k.message)})}const v=(S,_)=>p(_,S);function w(S){Ce[S?"unshift":"push"](()=>{f=S,t(3,f)})}return i.$$set=S=>{"record"in S&&t(0,a=S.record),"graph"in S&&t(11,c=S.graph),"users"in S&&t(1,u=S.users),"schema"in S&&t(2,h=S.schema)},t(8,n=[]),t(6,r=[]),t(5,s=null),t(7,o={}),[a,u,h,f,d,s,r,o,n,p,g,c,v,w]}class hW extends oe{constructor(e){super(),se(this,e,uW,cW,re,{record:0,graph:11,users:1,schema:2})}}const{window:fW}=OP;function Mw(i,e,t){const n=i.slice();return n[21]=e[t],n}function dW(i){let e,t,n;return{c(){e=y("button"),e.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
Save`,O(e,"type","button"),O(e,"class","button primary ms-2 btn btn-primary btn-spinner")},m(r,s){x(r,e,s),t||(n=G(e,"click",i[11]),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function mW(i){let e,t,n;return{c(){e=y("button"),e.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
Create`,O(e,"class","button primary btn-spinner")},m(r,s){x(r,e,s),t||(n=G(e,"click",i[11]),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function pW(i){let e,t;return e=new hW({props:{record:i[0],graph:i[1],users:i[4],schema:i[2]}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&1&&(s.record=n[0]),r&2&&(s.graph=n[1]),r&16&&(s.users=n[4]),r&4&&(s.schema=n[2]),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function gW(i){let e,t;return e=new qB({props:{graph:i[1],record:i[0]}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&2&&(s.graph=n[1]),r&1&&(s.record=n[0]),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function OW(i){let e=[],t=new Map,n,r,s=fe(i[9]);const o=l=>l[21].name;for(let l=0;l<s.length;l+=1){let a=Mw(i,s,l),c=o(a);t.set(c,e[l]=Rw(c,a))}return{c(){for(let l=0;l<e.length;l+=1)e[l].c();n=Ie()},m(l,a){for(let c=0;c<e.length;c+=1)e[c]&&e[c].m(l,a);x(l,n,a),r=!0},p(l,a){a&623&&(s=fe(l[9]),Oe(),e=Ti(e,a,o,1,l,s,t,n.parentNode,Jr,Rw,n,Mw),be())},i(l){if(!r){for(let a=0;a<s.length;a+=1)T(e[a]);r=!0}},o(l){for(let a=0;a<e.length;a+=1)R(e[a]);r=!1},d(l){l&&P(n);for(let a=0;a<e.length;a+=1)e[a].d(l)}}}function Ew(i){let e,t,n,r;function s(a){i[15](a)}function o(a){i[16](a)}let l={field:i[21],schema:i[2],record:i[0],validationErrors:i[5],isCreateMode:i[3]};return i[0].data!==void 0&&(l.data=i[0].data),i[1]!==void 0&&(l.graph=i[1]),e=new aP({props:l}),Ce.push(()=>nt(e,"data",s)),Ce.push(()=>nt(e,"graph",o)),{c(){V(e.$$.fragment)},m(a,c){Y(e,a,c),r=!0},p(a,c){const u={};c&4&&(u.schema=a[2]),c&1&&(u.record=a[0]),c&32&&(u.validationErrors=a[5]),c&8&&(u.isCreateMode=a[3]),!t&&c&1&&(t=!0,u.data=a[0].data,st(()=>t=!1)),!n&&c&2&&(n=!0,u.graph=a[1],st(()=>n=!1)),e.$set(u)},i(a){r||(T(e.$$.fragment,a),r=!0)},o(a){R(e.$$.fragment,a),r=!1},d(a){z(e,a)}}}function Rw(i,e){let t,n,r,s=e[6]===e[21].group&&Ew(e);return{key:i,first:null,c(){t=Ie(),s&&s.c(),n=Ie(),this.first=t},m(o,l){x(o,t,l),s&&s.m(o,l),x(o,n,l),r=!0},p(o,l){e=o,e[6]===e[21].group?s?(s.p(e,l),l&64&&T(s,1)):(s=Ew(e),s.c(),T(s,1),s.m(n.parentNode,n)):s&&(Oe(),R(s,1,1,()=>{s=null}),be())},i(o){r||(T(s),r=!0)},o(o){R(s),r=!1},d(o){o&&(P(t),P(n)),s&&s.d(o)}}}function bW(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,v,w,S,_,k;function A(X){i[12](X)}function C(X){i[13](X)}let Q={schema:i[2],isCreateMode:i[3]};i[0]!==void 0&&(Q.record=i[0]),i[6]!==void 0&&(Q.activeContentTab=i[6]),n=new cy({props:Q}),Ce.push(()=>nt(n,"record",A)),Ce.push(()=>nt(n,"activeContentTab",C));function M(X,ee){if(X[3])return mW;if(X[8])return dW}let L=M(i),N=L&&L(i);a=new _y({props:{schema:i[2],record:i[0],isCreateMode:i[3]}}),u=new Ma({props:{message:i[7]}});function B(X){i[14](X)}let J={schema:i[2],isCreateMode:i[3]};i[6]!==void 0&&(J.active=i[6]),d=new uy({props:J}),Ce.push(()=>nt(d,"active",B));const te=[OW,gW,pW],ie=[];function ae(X,ee){return ee&64&&(g=null),g==null&&(g=!["_graph","_info"].includes(X[6])),g?0:X[6]==="_graph"?1:X[6]==="_info"?2:-1}return~(v=ae(i,-1))&&(w=ie[v]=te[v](i)),{c(){e=y("div"),t=y("div"),V(n.$$.fragment),o=D(),N&&N.c(),l=D(),V(a.$$.fragment),c=D(),V(u.$$.fragment),h=D(),f=y("div"),V(d.$$.fragment),p=D(),w&&w.c(),O(t,"class","tools-header"),O(f,"class","mt-4"),le(f,"margin-bottom","150px"),le(f,"position","relative"),O(e,"class","record-edit")},m(X,ee){x(X,e,ee),b(e,t),Y(n,t,null),b(t,o),N&&N.m(t,null),b(e,l),Y(a,e,null),b(e,c),Y(u,e,null),b(e,h),b(e,f),Y(d,f,null),b(f,p),~v&&ie[v].m(f,null),S=!0,_||(k=G(fW,"beforeunload",i[10]),_=!0)},p(X,[ee]){const Te={};ee&4&&(Te.schema=X[2]),ee&8&&(Te.isCreateMode=X[3]),!r&&ee&1&&(r=!0,Te.record=X[0],st(()=>r=!1)),!s&&ee&64&&(s=!0,Te.activeContentTab=X[6],st(()=>s=!1)),n.$set(Te),L===(L=M(X))&&N?N.p(X,ee):(N&&N.d(1),N=L&&L(X),N&&(N.c(),N.m(t,null)));const ve={};ee&4&&(ve.schema=X[2]),ee&1&&(ve.record=X[0]),ee&8&&(ve.isCreateMode=X[3]),a.$set(ve);const je={};ee&128&&(je.message=X[7]),u.$set(je);const ne={};ee&4&&(ne.schema=X[2]),ee&8&&(ne.isCreateMode=X[3]),!m&&ee&64&&(m=!0,ne.active=X[6],st(()=>m=!1)),d.$set(ne);let Ee=v;v=ae(X,ee),v===Ee?~v&&ie[v].p(X,ee):(w&&(Oe(),R(ie[Ee],1,1,()=>{ie[Ee]=null}),be()),~v?(w=ie[v],w?w.p(X,ee):(w=ie[v]=te[v](X),w.c()),T(w,1),w.m(f,null)):w=null)},i(X){S||(T(n.$$.fragment,X),T(a.$$.fragment,X),T(u.$$.fragment,X),T(d.$$.fragment,X),T(w),S=!0)},o(X){R(n.$$.fragment,X),R(a.$$.fragment,X),R(u.$$.fragment,X),R(d.$$.fragment,X),R(w),S=!1},d(X){X&&P(e),z(n),N&&N.d(),z(a),z(u),z(d),~v&&ie[v].d(),_=!1,k()}}}function vW(i,e,t){let n,r,s;const o=Ue("channel");let{schema:l}=e,{record:a}=e,{graph:c={records:[],edges:[]}}=e,{isCreateMode:u}=e,{users:h}=e,f,d="",m=l.fields.filter(Q=>Q.name!=="id");xi(()=>{p()});function p(){f={data:JSON.parse(JSON.stringify(a.data)),status:a.status,edges:JSON.parse(JSON.stringify(c.edges))}}Kw(()=>{t(8,n=v())});function g(Q){return n?Q.returnValue="You have unsaved changes. Are you sure you want to exit?":(delete Q.returnValue,"...")}function v(){return u?!1:!ia(f,{data:a.data,status:a.status,edges:c.edges})}function w(Q){return Q.preventDefault(),console.log("SAVE: Attempt"),t(5,r=null),t(7,s=""),new Promise(function(M,L){var N;if(!n&&!u){M(null);return}if(!a){M(null);return}t(1,c.edges=(N=c.edges)==null?void 0:N.filter(B=>!B._isTrashed&&B.source===a.id),c),Jn(o.lucentUrl+"/records",{record:a,edges:c.edges,isCreateMode:u}).then(function(B){if(console.log("SAVE: SAVED"),u)window.location=o.lucentUrl+"/records/"+a.id;else{if(t(0,a=B.records[0]??null),!a){t(8,n=!1),window.location=o.lucentUrl;return}t(1,c=B),p()}M(null)}).catch(function(B){B.response&&(typeof B.response.data.error=="string"?t(7,s=B.response.data.error):(t(5,r=B.response.data.error),console.log(r))),M(null)})})}function S(Q){a=Q,t(0,a)}function _(Q){d=Q,t(6,d)}function k(Q){d=Q,t(6,d)}function A(Q){i.$$.not_equal(a.data,Q)&&(a.data=Q,t(0,a))}function C(Q){c=Q,t(1,c)}return i.$$set=Q=>{"schema"in Q&&t(2,l=Q.schema),"record"in Q&&t(0,a=Q.record),"graph"in Q&&t(1,c=Q.graph),"isCreateMode"in Q&&t(3,u=Q.isCreateMode),"users"in Q&&t(4,h=Q.users)},i.$$.update=()=>{i.$$.dirty&32&&t(7,s=r?`Record submission failed. ${Object.entries(r).length} error(s)`:null)},t(8,n=!1),t(5,r=null),[a,c,l,u,h,r,d,s,n,m,g,w,S,_,k,A,C]}class wW extends oe{constructor(e){super(),se(this,e,vW,bW,re,{schema:2,record:0,graph:1,isCreateMode:3,users:4})}}function Dw(i,e,t){const n=i.slice();return n[3]=e[t],n}function $w(i){let e,t=i[3].label+"",n;return{c(){var r;e=y("a"),n=W(t),O(e,"class","sidebar-item"),O(e,"aria-current","page"),O(e,"href",i[1].lucentUrl+"/content/"+i[3].name),Ae(e,"active",i[3].name===((r=i[0])==null?void 0:r.name))},m(r,s){x(r,e,s),b(e,n)},p(r,s){var o;s&5&&Ae(e,"active",r[3].name===((o=r[0])==null?void 0:o.name))},d(r){r&&P(e)}}}function yW(i){let e,t,n=i[1].name+"",r,s,o,l=fe(i[2]),a=[];for(let c=0;c<l.length;c+=1)a[c]=$w(Dw(i,l,c));return{c(){e=y("div"),t=y("a"),r=W(n),s=D(),o=y("div");for(let c=0;c<a.length;c+=1)a[c].c();O(t,"class","logo"),O(t,"href",i[1].lucentUrl),O(e,"class","sidebar-top"),O(o,"class","sidebar")},m(c,u){x(c,e,u),b(e,t),b(t,r),x(c,s,u),x(c,o,u);for(let h=0;h<a.length;h+=1)a[h]&&a[h].m(o,null)},p(c,[u]){if(u&7){l=fe(c[2]);let h;for(h=0;h<l.length;h+=1){const f=Dw(c,l,h);a[h]?a[h].p(f,u):(a[h]=$w(f),a[h].c(),a[h].m(o,null))}for(;h<a.length;h+=1)a[h].d(1);a.length=l.length}},i:U,o:U,d(c){c&&(P(e),P(s),P(o)),Ot(a,c)}}}function kW(i,e,t){let{schema:n}=e;const r=Ue("channel"),s=Ue("readableSchemas");return i.$$set=o=>{"schema"in o&&t(0,n=o.schema)},[n,r,s]}class SW extends oe{constructor(e){super(),se(this,e,kW,yW,re,{schema:0})}}function Lw(i){let e;return{c(){e=y("span"),e.textContent="DRAFT",O(e,"class","status")},m(t,n){x(t,e,n)},d(t){t&&P(e)}}}function _W(i){let e,t=i[1].data.name+"",n,r;return{c(){e=y("a"),n=W(t),O(e,"href",r=i[2].lucentUrl+"/records/"+i[1].id)},m(s,o){x(s,e,o),b(e,n)},p(s,o){o&2&&t!==(t=s[1].data.name+"")&&K(n,t),o&2&&r!==(r=s[2].lucentUrl+"/records/"+s[1].id)&&O(e,"href",r)},i:U,o:U,d(s){s&&P(e)}}}function CW(i){let e,t;return e=new Xo({props:{record:i[1],size:"tiny",showFilename:!0}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&2&&(s.record=n[1]),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function PW(i){let e,t,n,r,s,o,l,a,c=i[3].label+"",u,h,f,d,m,p,g,v,w=i[1].status==="draft"&&Lw();const S=[CW,_W],_=[];function k(A,C){return A[3].type==="files"?0:1}return r=k(i),s=_[r]=S[r](i),m=new _i({props:{name:Dn(i[0],i[1].updatedBy),side:24}}),{c(){e=y("td"),t=y("div"),w&&w.c(),n=D(),s.c(),o=D(),l=y("td"),a=y("a"),u=W(c),h=D(),f=y("td"),d=y("div"),V(m.$$.fragment),p=D(),g=y("div"),g.textContent=`${i[4]}`,O(t,"class","row-name"),O(a,"href",i[2].lucentUrl+"/content/"+i[3].name),O(g,"class","ms-2"),le(d,"display","flex"),le(d,"gap","14px")},m(A,C){x(A,e,C),b(e,t),w&&w.m(t,null),b(t,n),_[r].m(t,null),x(A,o,C),x(A,l,C),b(l,a),b(a,u),x(A,h,C),x(A,f,C),b(f,d),Y(m,d,null),b(d,p),b(d,g),v=!0},p(A,[C]){A[1].status==="draft"?w||(w=Lw(),w.c(),w.m(t,n)):w&&(w.d(1),w=null),s.p(A,C);const Q={};C&3&&(Q.name=Dn(A[0],A[1].updatedBy)),m.$set(Q)},i(A){v||(T(s),T(m.$$.fragment,A),v=!0)},o(A){R(s),R(m.$$.fragment,A),v=!1},d(A){A&&(P(e),P(o),P(l),P(h),P(f)),w&&w.d(),_[r].d(),z(m)}}}function AW(i,e,t){const n=Ue("channel");let{users:r}=e,{record:s}=e,o=n.schemas.find(a=>a.name===s.schema),l=ly(ih(s.updatedAt),{addSuffix:!0});return i.$$set=a=>{"users"in a&&t(0,r=a.users),"record"in a&&t(1,s=a.record)},[r,s,n,o,l]}class xW extends oe{constructor(e){super(),se(this,e,AW,PW,re,{users:0,record:1})}}function Iw(i,e,t){const n=i.slice();return n[3]=e[t],n}function Nw(i){let e,t,n,r=[],s=new Map,o,l=fe(i[0]);const a=c=>c[3].id;for(let c=0;c<l.length;c+=1){let u=Iw(i,l,c),h=a(u);s.set(h,r[c]=Zw(h,u))}return{c(){e=y("div"),t=y("table"),n=y("tbody");for(let c=0;c<r.length;c+=1)r[c].c();O(t,"class",""),O(e,"class","table")},m(c,u){x(c,e,u),b(e,t),b(t,n);for(let h=0;h<r.length;h+=1)r[h]&&r[h].m(n,null);o=!0},p(c,u){u&3&&(l=fe(c[0]),Oe(),r=Ti(r,u,a,1,c,l,s,n,Jr,Zw,null,Iw),be())},i(c){if(!o){for(let u=0;u<l.length;u+=1)T(r[u]);o=!0}},o(c){for(let u=0;u<r.length;u+=1)R(r[u]);o=!1},d(c){c&&P(e);for(let u=0;u<r.length;u+=1)r[u].d()}}}function Zw(i,e){let t,n,r,s;return n=new xW({props:{record:e[3],users:e[1]}}),{key:i,first:null,c(){t=y("tr"),V(n.$$.fragment),r=D(),this.first=t},m(o,l){x(o,t,l),Y(n,t,null),b(t,r),s=!0},p(o,l){e=o;const a={};l&1&&(a.record=e[3]),l&2&&(a.users=e[1]),n.$set(a)},i(o){s||(T(n.$$.fragment,o),s=!0)},o(o){R(n.$$.fragment,o),s=!1},d(o){o&&P(t),z(n)}}}function TW(i){let e,t,n,r,s=i[0].length>0&&Nw(i);return{c(){e=y("h3"),e.textContent="Latest Content changes",t=D(),s&&s.c(),n=Ie(),O(e,"class","header-small mb-4 mt-5")},m(o,l){x(o,e,l),x(o,t,l),s&&s.m(o,l),x(o,n,l),r=!0},p(o,[l]){o[0].length>0?s?(s.p(o,l),l&1&&T(s,1)):(s=Nw(o),s.c(),T(s,1),s.m(n.parentNode,n)):s&&(Oe(),R(s,1,1,()=>{s=null}),be())},i(o){r||(T(s),r=!0)},o(o){R(s),r=!1},d(o){o&&(P(e),P(t),P(n)),s&&s.d(o)}}}function QW(i,e,t){const n=Ue("channel");let r=[],s=[];return xi(()=>{Qa(n.lucentUrl+"/home/records").then(o=>{t(0,r=o.records),t(1,s=o.users)}).catch(o=>{console.log(o)})}),[r,s]}class MW extends oe{constructor(e){super(),se(this,e,QW,TW,re,{})}}function Bw(i){let e;return{c(){e=y("span"),e.textContent="Action in progress",O(e,"class","badge text-bg-warning")},m(t,n){x(t,e,n)},d(t){t&&P(e)}}}function Ww(i){let e;return{c(){e=y("span"),e.textContent="Action completed",O(e,"class","badge text-bg-info")},m(t,n){x(t,e,n)},d(t){t&&P(e)}}}function EW(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,v,w,S=i[2]&&Bw(),_=!i[2]&&i[3]&&Ww();return{c(){e=y("div"),t=y("div"),n=y("h3"),r=W(i[0]),s=D(),o=y("button"),l=W("Start"),a=D(),c=y("div"),S&&S.c(),u=D(),_&&_.c(),h=D(),f=y("pre"),d=W(i[3]),m=W(`
`),p=y("div"),p.textContent=" ",g=W(`
`),O(n,"class","header-small mb-5"),O(o,"class","button primary mb-3"),o.disabled=i[2],O(c,"class","mb-3"),O(f,"class","logs svelte-16mig2w"),O(t,"class","lx-card mt-5"),O(e,"class","common-wrapper")},m(k,A){x(k,e,A),b(e,t),b(t,n),b(n,r),b(t,s),b(t,o),b(o,l),b(t,a),b(t,c),S&&S.m(c,null),b(c,u),_&&_.m(c,null),b(t,h),b(t,f),b(f,d),b(f,m),b(f,p),i[6](p),b(f,g),v||(w=G(o,"click",i[4]),v=!0)},p(k,[A]){A&1&&K(r,k[0]),A&4&&(o.disabled=k[2]),k[2]?S||(S=Bw(),S.c(),S.m(c,u)):S&&(S.d(1),S=null),!k[2]&&k[3]?_||(_=Ww(),_.c(),_.m(c,null)):_&&(_.d(1),_=null),A&8&&K(d,k[3])},i:U,o:U,d(k){k&&P(e),S&&S.d(),_&&_.d(),i[6](null),v=!1,w()}}}function RW(i,e,t){let n;const r=Ue("channel");let{title:s}=e,{command:o}=e,l,a=!1;function c(){const f=new EventSource(r.lucentUrl+"/command-report-source/"+o.signature);f.onmessage=function(d){t(2,a=!0);const m=JSON.parse(d.data);m.date,t(3,n=m.logs),l.scrollIntoView()},f.onerror=d=>{console.log(d),f.close(),t(2,a=!1)}}function u(f){f.preventDefault(),t(2,a=!0),Jn(r.lucentUrl+"/command/"+o.signature).then(d=>{c()})}xi(()=>{c()});function h(f){Ce[f?"unshift":"push"](()=>{l=f,t(1,l)})}return i.$$set=f=>{"title"in f&&t(0,s=f.title),"command"in f&&t(5,o=f.command)},t(3,n=""),[s,l,a,n,u,o,h]}class DW extends oe{constructor(e){super(),se(this,e,RW,EW,re,{title:0,command:5})}}function Xw(i,e,t){const n=i.slice();return n[2]=e[t],n}function $W(i){let e;return{c(){e=y("a"),e.textContent="Store admin",O(e,"href","/lunar")},m(t,n){x(t,e,n)},p:U,d(t){t&&P(e)}}}function LW(i){let e,t;return{c(){e=y("a"),t=W("Members"),O(e,"class","top-nav-item"),O(e,"href",i[0].lucentUrl+"/members")},m(n,r){x(n,e,r),b(e,t)},p:U,d(n){n&&P(e)}}}function IW(i){let e,t;return e=new ur({props:{$$slots:{button:[ZW],default:[NW]},$$scope:{ctx:i}}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&32&&(s.$$scope={dirty:r,ctx:n}),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function Fw(i){let e,t=i[2].name+"",n;return{c(){e=y("a"),n=W(t),O(e,"href",i[0].lucentUrl+"/command-report/"+i[2].signature),O(e,"class","top-nav-item")},m(r,s){x(r,e,s),b(e,n)},p:U,d(r){r&&P(e)}}}function NW(i){let e,t=fe(i[0].commands),n=[];for(let r=0;r<t.length;r+=1)n[r]=Fw(Xw(i,t,r));return{c(){for(let r=0;r<n.length;r+=1)n[r].c();e=Ie()},m(r,s){for(let o=0;o<n.length;o+=1)n[o]&&n[o].m(r,s);x(r,e,s)},p(r,s){if(s&1){t=fe(r[0].commands);let o;for(o=0;o<t.length;o+=1){const l=Xw(r,t,o);n[o]?n[o].p(l,s):(n[o]=Fw(l),n[o].c(),n[o].m(e.parentNode,e))}for(;o<n.length;o+=1)n[o].d(1);n.length=t.length}},d(r){r&&P(e),Ot(n,r)}}}function ZW(i){let e;return{c(){e=y("div"),e.textContent="Actions",O(e,"slot","button")},m(t,n){x(t,e,n)},p:U,d(t){t&&P(e)}}}function BW(i){let e,t;return e=new _i({props:{side:"28",name:i[1].name}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p:U,i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function WW(i){let e,t,n;return t=new _i({props:{side:"28",name:i[1].name}}),{c(){e=y("a"),V(t.$$.fragment),O(e,"href",i[0].lucentUrl+"/profile")},m(r,s){x(r,e,s),Y(t,e,null),n=!0},p:U,i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){R(t.$$.fragment,r),n=!1},d(r){r&&P(e),z(t)}}}function XW(i){let e,t,n,r,s,o;function l(m,p){return m[0].auth=="lucent"?LW:$W}let c=l(i)(i),u=i[0].commands.length>0&&IW(i);const h=[WW,BW],f=[];function d(m,p){return m[0].auth=="lucent"?0:1}return r=d(i),s=f[r]=h[r](i),{c(){e=y("div"),c.c(),t=D(),u&&u.c(),n=D(),s.c(),O(e,"class","top-nav")},m(m,p){x(m,e,p),c.m(e,null),b(e,t),u&&u.m(e,null),b(e,n),f[r].m(e,null),o=!0},p(m,[p]){c.p(m,p),m[0].commands.length>0&&u.p(m,p),s.p(m,p)},i(m){o||(T(u),T(s),o=!0)},o(m){R(u),R(s),o=!1},d(m){m&&P(e),c.d(),u&&u.d(),f[r].d()}}}function FW(i){const e=Ue("channel"),t=Ue("user");return[e,t]}class YW extends oe{constructor(e){super(),se(this,e,FW,XW,re,{})}}function zW(i){let e,t,n,r,s,o,l,a,c;n=new SW({props:{schema:i[2].schema}}),o=new YW({});const u=[{title:i[0]},i[2]];var h=i[3][i[1]];function f(d,m){let p={};for(let g=0;g<u.length;g+=1)p=Ps(p,u[g]);return m!==void 0&&m&5&&(p=Ps(p,_o(u,[m&1&&{title:d[0]},m&4&&Co(d[2])]))),{props:p}}return h&&(a=Xr(h,f(i))),{c(){e=y("div"),t=y("div"),V(n.$$.fragment),r=D(),s=y("div"),V(o.$$.fragment),l=D(),a&&V(a.$$.fragment),O(t,"class","sidebar-content"),O(s,"class","main-content"),O(e,"class","main-wrapper")},m(d,m){x(d,e,m),b(e,t),Y(n,t,null),b(e,r),b(e,s),Y(o,s,null),b(s,l),a&&Y(a,s,null),c=!0},p(d,[m]){const p={};if(m&4&&(p.schema=d[2].schema),n.$set(p),m&2&&h!==(h=d[3][d[1]])){if(a){Oe();const g=a;R(g.$$.fragment,1,0,()=>{z(g,1)}),be()}h?(a=Xr(h,f(d,m)),V(a.$$.fragment),T(a.$$.fragment,1),Y(a,s,null)):a=null}else if(h){const g=m&5?_o(u,[m&1&&{title:d[0]},m&4&&Co(d[2])]):{};a.$set(g)}},i(d){c||(T(n.$$.fragment,d),T(o.$$.fragment,d),a&&T(a.$$.fragment,d),c=!0)},o(d){R(n.$$.fragment,d),R(o.$$.fragment,d),a&&R(a.$$.fragment,d),c=!1},d(d){d&&P(e),z(n),z(o),a&&z(a)}}}function VW(i,e,t){const n={members:Dx,recordEdit:wW,recordNotFound:Ix,contentIndex:Ay,homeIndex:MW,buildReport:DW};let{title:r}=e,{view:s}=e,{user:o}=e,{data:l}=e,{channel:a}=e,{readableSchemas:c}=e;return Ql("channel",a),Ql("readableSchemas",a.schemas.filter(u=>c.includes(u.name))),Ql("user",o),i.$$set=u=>{"title"in u&&t(0,r=u.title),"view"in u&&t(1,s=u.view),"user"in u&&t(4,o=u.user),"data"in u&&t(2,l=u.data),"channel"in u&&t(5,a=u.channel),"readableSchemas"in u&&t(6,c=u.readableSchemas)},[r,s,l,n,o,a,c]}class UW extends oe{constructor(e){super(),se(this,e,VW,zW,re,{title:0,view:1,user:4,data:2,channel:5,readableSchemas:6})}}const jW={account:kx,channel:UW};let $c=[],qW=function(){$c.map(t=>t.$destroy()),$c=[];const i=document.body.querySelectorAll(".lucent-component");if(i.length===0)return;const e=function(t){const n=t.attributes["data-layout"].value,[r,s]=Object.entries(jW).find(([c,u])=>n===c);if(!s)return[];const o=document.getElementById("json-"+n).innerHTML,l=JSON.parse(o),a={target:t,props:l};$c=[...$c,new s(a)]};Array.from(i).map(e)};document.addEventListener("DOMContentLoaded",qW);