snow-cms 1.4.1 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index-browser.es.js +1 -1
- package/dist/index-browser.es2.js +1 -1
- package/dist/index.es.js +2 -2
- package/dist/index.es2.js +1 -1
- package/dist/index.es4.js +1 -1
- package/dist/index.js +35 -35
- package/dist/milkdown.js +14 -14
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import{g as ws,c as _s,I as bs,S as Xc,s as eu,P as Sn,a as Mn,p as xr,E as tu,b as Fr,e as Hr,D as nu,d as ru,f as Qn,h as iu,i as au,j as ou,C as su,k as ae,m as lu,n as ho,l as cu,r as mo,o as ks,q as go,K as uu,t as fu,u as vo,F as _e,R as Wi,v as Ki,w as du,N as pu,x as hu,y as mu,z as Xn,A as yo,B as zi,G as Vn,H as tn,J as Gi,L as xs,T as Pr,M as gu,O as vu,Q as yu,U as wu,V as _u,W as bu,X as ku,Y as wo,Z as _o,_ as Br,$ as As,a0 as Zi,a1 as Es,a2 as xu,a3 as Au,a4 as Eu,a5 as Cu,a6 as Su}from"./milkdown.js";const xi=!1;var Ji=Array.isArray,Mu=Array.prototype.indexOf,jr=Array.from,Cs=Object.defineProperty,Tt=Object.getOwnPropertyDescriptor,Iu=Object.getOwnPropertyDescriptors,Ss=Object.prototype,Lu=Array.prototype,Qi=Object.getPrototypeOf,bo=Object.isExtensible;function Dn(e){return typeof e=="function"}const Ot=()=>{};function Nu(e){return typeof e?.then=="function"}function Ms(e){for(var t=0;t<e.length;t++)e[t]()}function Is(){var e,t,n=new Promise((r,i)=>{e=r,t=i});return{promise:n,resolve:e,reject:t}}const ye=2,Xi=4,ea=8,Tu=1<<24,Et=16,Ct=32,nn=64,qr=128,et=512,ke=1024,Fe=2048,ft=4096,Pe=8192,wt=16384,ta=32768,Jt=65536,ko=1<<17,Ls=1<<18,In=1<<19,Ou=1<<20,yt=1<<25,Qt=32768,Ai=1<<21,na=1<<22,$t=1<<23,wn=Symbol("$state"),Ns=Symbol("legacy props"),$u=Symbol(""),mn=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"};function Ts(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Du(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Ru(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Fu(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Hu(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Pu(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Bu(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function ju(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function qu(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Vu(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Uu(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const Yu=1,Wu=2,Os=4,Ku=8,zu=16,Gu=1,Zu=4,Ju=8,Qu=16,Xu=1,ef=2,ge=Symbol(),tf="http://www.w3.org/1999/xhtml";function nf(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function $s(e){return e===this.v}function Ds(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Rs(e){return!Ds(e,this.v)}let rf=!1;const af=[];function Ei(e,t=!1,n=!1){return mr(e,new Map,"",af,null,n)}function mr(e,t,n,r,i=null,a=!1){if(typeof e=="object"&&e!==null){var o=t.get(e);if(o!==void 0)return o;if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(Ji(e)){var s=Array(e.length);t.set(e,s),i!==null&&t.set(i,s);for(var l=0;l<e.length;l+=1){var c=e[l];l in e&&(s[l]=mr(c,t,n,r,null,a))}return s}if(Qi(e)===Ss){s={},t.set(e,s),i!==null&&t.set(i,s);for(var f in e)s[f]=mr(e[f],t,n,r,null,a);return s}if(e instanceof Date)return structuredClone(e);if(typeof e.toJSON=="function"&&!a)return mr(e.toJSON(),t,n,r,e)}if(e instanceof EventTarget)return e;try{return structuredClone(e)}catch{return e}}let xe=null;function kn(e){xe=e}function Ar(e){return Hs().get(e)}function Er(e,t){return Hs().set(e,t),t}function se(e,t=!1,n){xe={p:xe,i:!1,c:null,e:null,s:e,x:null,l:null}}function le(e){var t=xe,n=t.e;if(n!==null){t.e=null;for(var r of n)rl(r)}return e!==void 0&&(t.x=e),t.i=!0,xe=t.p,e??{}}function Fs(){return!0}function Hs(e){return xe===null&&Ts(),xe.c??=new Map(of(xe)||void 0)}function of(e){let t=e.p;for(;t!==null;){const n=t.c;if(n!==null)return n;t=t.p}return null}let Ut=[];function Ps(){var e=Ut;Ut=[],Ms(e)}function rn(e){if(Ut.length===0&&!_n){var t=Ut;queueMicrotask(()=>{t===Ut&&Ps()})}Ut.push(e)}function sf(){for(;Ut.length>0;)Ps()}function Bs(e){var t=te;if(t===null)return X.f|=$t,e;if((t.f&ta)===0){if((t.f&qr)===0)throw e;t.b.error(e)}else xn(e,t)}function xn(e,t){for(;t!==null;){if((t.f&qr)!==0)try{t.b.error(e);return}catch(n){e=n}t=t.parent}throw e}const dr=new Set;let ne=null,gr=null,ze=null,We=[],Vr=null,Ci=!1,_n=!1;class Je{committed=!1;current=new Map;previous=new Map;#e=new Set;#t=new Set;#r=0;#n=0;#l=null;#a=new Set;#i=new Set;skipped_effects=new Set;is_fork=!1;is_deferred(){return this.is_fork||this.#n>0}process(t){We=[],gr=null,this.apply();var n={parent:null,effect:null,effects:[],render_effects:[]};for(const r of t)this.#o(r,n);this.is_fork||this.#u(),this.is_deferred()?(this.#s(n.effects),this.#s(n.render_effects)):(gr=this,ne=null,xo(n.render_effects),xo(n.effects),gr=null,this.#l?.resolve()),ze=null}#o(t,n){t.f^=ke;for(var r=t.first;r!==null;){var i=r.f,a=(i&(Ct|nn))!==0,o=a&&(i&ke)!==0,s=o||(i&Pe)!==0||this.skipped_effects.has(r);if((r.f&qr)!==0&&r.b?.is_pending()&&(n={parent:n,effect:r,effects:[],render_effects:[]}),!s&&r.fn!==null){a?r.f^=ke:(i&Xi)!==0?n.effects.push(r):nr(r)&&((r.f&Et)!==0&&this.#a.add(r),Kn(r));var l=r.first;if(l!==null){r=l;continue}}var c=r.parent;for(r=r.next;r===null&&c!==null;)c===n.effect&&(this.#s(n.effects),this.#s(n.render_effects),n=n.parent),r=c.next,c=c.parent}}#s(t){for(const n of t)(n.f&Fe)!==0?this.#a.add(n):(n.f&ft)!==0&&this.#i.add(n),this.#c(n.deps),Ae(n,ke)}#c(t){if(t!==null)for(const n of t)(n.f&ye)===0||(n.f&Qt)===0||(n.f^=Qt,this.#c(n.deps))}capture(t,n){this.previous.has(t)||this.previous.set(t,n),(t.f&$t)===0&&(this.current.set(t,t.v),ze?.set(t,t.v))}activate(){ne=this,this.apply()}deactivate(){ne===this&&(ne=null,ze=null)}flush(){if(this.activate(),We.length>0){if(qs(),ne!==null&&ne!==this)return}else this.#r===0&&this.process([]);this.deactivate()}discard(){for(const t of this.#t)t(this);this.#t.clear()}#u(){if(this.#n===0){for(const t of this.#e)t();this.#e.clear()}this.#r===0&&this.#f()}#f(){if(dr.size>1){this.previous.clear();var t=ze,n=!0,r={parent:null,effect:null,effects:[],render_effects:[]};for(const a of dr){if(a===this){n=!1;continue}const o=[];for(const[l,c]of this.current){if(a.current.has(l))if(n&&c!==a.current.get(l))a.current.set(l,c);else continue;o.push(l)}if(o.length===0)continue;const s=[...a.current.keys()].filter(l=>!this.current.has(l));if(s.length>0){var i=We;We=[];const l=new Set,c=new Map;for(const f of o)Vs(f,s,l,c);if(We.length>0){ne=a,a.apply();for(const f of We)a.#o(f,r);a.deactivate()}We=i}}ne=null,ze=t}this.committed=!0,dr.delete(this)}increment(t){this.#r+=1,t&&(this.#n+=1)}decrement(t){this.#r-=1,t&&(this.#n-=1),this.revive()}revive(){for(const t of this.#a)this.#i.delete(t),Ae(t,Fe),Xt(t);for(const t of this.#i)Ae(t,ft),Xt(t);this.flush()}oncommit(t){this.#e.add(t)}ondiscard(t){this.#t.add(t)}settled(){return(this.#l??=Is()).promise}static ensure(){if(ne===null){const t=ne=new Je;dr.add(ne),_n||Je.enqueue(()=>{ne===t&&t.flush()})}return ne}static enqueue(t){rn(t)}apply(){}}function js(e){var t=_n;_n=!0;try{for(var n;;){if(sf(),We.length===0&&(ne?.flush(),We.length===0))return Vr=null,n;qs()}}finally{_n=t}}function qs(){var e=Wt;Ci=!0;var t=null;try{var n=0;for(Cr(!0);We.length>0;){var r=Je.ensure();if(n++>1e3){var i,a;lf()}r.process(We),Dt.clear()}}finally{Ci=!1,Cr(e),Vr=null}}function lf(){try{Pu()}catch(e){xn(e,Vr)}}let gt=null;function xo(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if((r.f&(wt|Pe))===0&&nr(r)&&(gt=new Set,Kn(r),r.deps===null&&r.first===null&&r.nodes===null&&(r.teardown===null&&r.ac===null?ll(r):r.fn=null),gt?.size>0)){Dt.clear();for(const i of gt){if((i.f&(wt|Pe))!==0)continue;const a=[i];let o=i.parent;for(;o!==null;)gt.has(o)&&(gt.delete(o),a.push(o)),o=o.parent;for(let s=a.length-1;s>=0;s--){const l=a[s];(l.f&(wt|Pe))===0&&Kn(l)}}gt.clear()}}gt=null}}function Vs(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const i of e.reactions){const a=i.f;(a&ye)!==0?Vs(i,t,n,r):(a&(na|Et))!==0&&(a&Fe)===0&&Us(i,t,r)&&(Ae(i,Fe),Xt(i))}}function Us(e,t,n){const r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const i of e.deps){if(t.includes(i))return!0;if((i.f&ye)!==0&&Us(i,t,n))return n.set(i,!0),!0}return n.set(e,!1),!1}function Xt(e){for(var t=Vr=e;t.parent!==null;){t=t.parent;var n=t.f;if(Ci&&t===te&&(n&Et)!==0&&(n&Ls)===0)return;if((n&(nn|Ct))!==0){if((n&ke)===0)return;t.f^=ke}}We.push(t)}function cf(e){let t=0,n=xt(0),r;return()=>{Yn()&&(y(n),Kr(()=>(t===0&&(r=jt(()=>e(()=>jn(n)))),t+=1,()=>{rn(()=>{t-=1,t===0&&(r?.(),r=void 0,jn(n))})})))}}var uf=Jt|In|qr;function ff(e,t,n){new df(e,t,n)}class df{parent;#e=!1;#t;#r=null;#n;#l;#a;#i=null;#o=null;#s=null;#c=null;#u=null;#f=0;#d=0;#h=!1;#p=null;#w=cf(()=>(this.#p=xt(this.#f),()=>{this.#p=null}));constructor(t,n,r){this.#t=t,this.#n=n,this.#l=r,this.parent=te.b,this.#e=!!this.#n.pending,this.#a=tr(()=>{te.b=this;{var i=this.#v();try{this.#i=Ke(()=>r(i))}catch(a){this.error(a)}this.#d>0?this.#g():this.#e=!1}return()=>{this.#u?.remove()}},uf)}#_(){try{this.#i=Ke(()=>this.#l(this.#t))}catch(t){this.error(t)}this.#e=!1}#b(){const t=this.#n.pending;t&&(this.#o=Ke(()=>t(this.#t)),Je.enqueue(()=>{var n=this.#v();this.#i=this.#m(()=>(Je.ensure(),Ke(()=>this.#l(n)))),this.#d>0?this.#g():(Yt(this.#o,()=>{this.#o=null}),this.#e=!1)}))}#v(){var t=this.#t;return this.#e&&(this.#u=Rt(),this.#t.before(this.#u),t=this.#u),t}is_pending(){return this.#e||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!this.#n.pending}#m(t){var n=te,r=X,i=xe;pt(this.#a),$e(this.#a),kn(this.#a.ctx);try{return t()}catch(a){return Bs(a),null}finally{pt(n),$e(r),kn(i)}}#g(){const t=this.#n.pending;this.#i!==null&&(this.#c=document.createDocumentFragment(),this.#c.append(this.#u),fl(this.#i,this.#c)),this.#o===null&&(this.#o=Ke(()=>t(this.#t)))}#y(t){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(t);return}this.#d+=t,this.#d===0&&(this.#e=!1,this.#o&&Yt(this.#o,()=>{this.#o=null}),this.#c&&(this.#t.before(this.#c),this.#c=null))}update_pending_count(t){this.#y(t),this.#f+=t,this.#p&&_t(this.#p,this.#f)}get_effect_pending(){return this.#w(),y(this.#p)}error(t){var n=this.#n.onerror;let r=this.#n.failed;if(this.#h||!n&&!r)throw t;this.#i&&(Re(this.#i),this.#i=null),this.#o&&(Re(this.#o),this.#o=null),this.#s&&(Re(this.#s),this.#s=null);var i=!1,a=!1;const o=()=>{if(i){nf();return}i=!0,a&&Uu(),Je.ensure(),this.#f=0,this.#s!==null&&Yt(this.#s,()=>{this.#s=null}),this.#e=this.has_pending_snippet(),this.#i=this.#m(()=>(this.#h=!1,Ke(()=>this.#l(this.#t)))),this.#d>0?this.#g():this.#e=!1};var s=X;try{$e(null),a=!0,n?.(t,o),a=!1}catch(l){xn(l,this.#a&&this.#a.parent)}finally{$e(s)}r&&rn(()=>{this.#s=this.#m(()=>{Je.ensure(),this.#h=!0;try{return Ke(()=>{r(this.#t,()=>t,()=>o)})}catch(l){return xn(l,this.#a.parent),null}finally{this.#h=!1}})})}}function pf(e,t,n,r){const i=Ur;if(n.length===0&&e.length===0){r(t.map(i));return}var a=ne,o=te,s=Ys();function l(){Promise.all(n.map(c=>hf(c))).then(c=>{s();try{r([...t.map(i),...c])}catch(f){(o.f&wt)===0&&xn(f,o)}a?.deactivate(),Un()}).catch(c=>{xn(c,o)})}e.length>0?Promise.all(e).then(()=>{s();try{return l()}finally{a?.deactivate(),Un()}}):l()}function Ys(){var e=te,t=X,n=xe,r=ne;return function(a=!0){pt(e),$e(t),kn(n),a&&r?.activate()}}function Un(){pt(null),$e(null),kn(null)}function Ur(e){var t=ye|Fe,n=X!==null&&(X.f&ye)!==0?X:null;return te!==null&&(te.f|=In),{ctx:xe,deps:null,effects:null,equals:$s,f:t,fn:e,reactions:null,rv:0,v:ge,wv:0,parent:n??te,ac:null}}function hf(e,t){let n=te;n===null&&Du();var r=n.b,i=void 0,a=xt(ge),o=!X,s=new Map;return Af(()=>{var l=Is();i=l.promise;try{Promise.resolve(e()).then(l.resolve,l.reject).then(()=>{c===ne&&c.committed&&c.deactivate(),Un()})}catch(p){l.reject(p),Un()}var c=ne;if(o){var f=!r.is_pending();r.update_pending_count(1),c.increment(f),s.get(c)?.reject(mn),s.delete(c),s.set(c,l)}const u=(p,d=void 0)=>{if(c.activate(),d)d!==mn&&(a.f|=$t,_t(a,d));else{(a.f&$t)!==0&&(a.f^=$t),_t(a,p);for(const[m,g]of s){if(s.delete(m),m===c)break;g.reject(mn)}}o&&(r.update_pending_count(-1),c.decrement(f))};l.promise.then(u,p=>u(null,p||"unknown"))}),ia(()=>{for(const l of s.values())l.reject(mn)}),new Promise(l=>{function c(f){function u(){f===i?l(a):c(i)}f.then(u,u)}c(i)})}function ct(e){const t=Ur(e);return dl(t),t}function Ws(e){const t=Ur(e);return t.equals=Rs,t}function Ks(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)Re(t[n])}}function mf(e){for(var t=e.parent;t!==null;){if((t.f&ye)===0)return(t.f&wt)===0?t:null;t=t.parent}return null}function ra(e){var t,n=te;pt(mf(e));try{e.f&=~Qt,Ks(e),t=gl(e)}finally{pt(n)}return t}function zs(e){var t=ra(e);if(e.equals(t)||(ne?.is_fork||(e.v=t),e.wv=hl()),!an)if(ze!==null)(Yn()||ne?.is_fork)&&ze.set(e,t);else{var n=(e.f&et)===0?ft:ke;Ae(e,n)}}let Si=new Set;const Dt=new Map;let Gs=!1;function xt(e,t){var n={f:0,v:e,reactions:null,equals:$s,rv:0,wv:0};return n}function K(e,t){const n=xt(e);return dl(n),n}function Zs(e,t=!1,n=!0){const r=xt(e);return t||(r.equals=Rs),r}function U(e,t,n=!1){X!==null&&(!lt||(X.f&ko)!==0)&&Fs()&&(X.f&(ye|Et|na|ko))!==0&&!bt?.includes(e)&&Vu();let r=n?Qe(t):t;return _t(e,r)}function _t(e,t){if(!e.equals(t)){var n=e.v;an?Dt.set(e,t):Dt.set(e,n),e.v=t;var r=Je.ensure();r.capture(e,n),(e.f&ye)!==0&&((e.f&Fe)!==0&&ra(e),Ae(e,(e.f&et)!==0?ke:ft)),e.wv=hl(),Js(e,Fe),te!==null&&(te.f&ke)!==0&&(te.f&(Ct|nn))===0&&(Ye===null?Cf([e]):Ye.push(e)),!r.is_fork&&Si.size>0&&!Gs&&gf()}return t}function gf(){Gs=!1;var e=Wt;Cr(!0);const t=Array.from(Si);try{for(const n of t)(n.f&ke)!==0&&Ae(n,ft),nr(n)&&Kn(n)}finally{Cr(e)}Si.clear()}function vf(e,t=1){var n=y(e),r=t===1?n++:n--;return U(e,n),r}function jn(e){U(e,e.v+1)}function Js(e,t){var n=e.reactions;if(n!==null)for(var r=n.length,i=0;i<r;i++){var a=n[i],o=a.f,s=(o&Fe)===0;if(s&&Ae(a,t),(o&ye)!==0){var l=a;ze?.delete(l),(o&Qt)===0&&(o&et&&(a.f|=Qt),Js(l,ft))}else s&&((o&Et)!==0&>!==null&>.add(a),Xt(a))}}function Qe(e){if(typeof e!="object"||e===null||wn in e)return e;const t=Qi(e);if(t!==Ss&&t!==Lu)return e;var n=new Map,r=Ji(e),i=K(0),a=Kt,o=s=>{if(Kt===a)return s();var l=X,c=Kt;$e(null),Co(a);var f=s();return $e(l),Co(c),f};return r&&n.set("length",K(e.length)),new Proxy(e,{defineProperty(s,l,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&ju();var f=n.get(l);return f===void 0?f=o(()=>{var u=K(c.value);return n.set(l,u),u}):U(f,c.value,!0),!0},deleteProperty(s,l){var c=n.get(l);if(c===void 0){if(l in s){const f=o(()=>K(ge));n.set(l,f),jn(i)}}else U(c,ge),jn(i);return!0},get(s,l,c){if(l===wn)return e;var f=n.get(l),u=l in s;if(f===void 0&&(!u||Tt(s,l)?.writable)&&(f=o(()=>{var d=Qe(u?s[l]:ge),m=K(d);return m}),n.set(l,f)),f!==void 0){var p=y(f);return p===ge?void 0:p}return Reflect.get(s,l,c)},getOwnPropertyDescriptor(s,l){var c=Reflect.getOwnPropertyDescriptor(s,l);if(c&&"value"in c){var f=n.get(l);f&&(c.value=y(f))}else if(c===void 0){var u=n.get(l),p=u?.v;if(u!==void 0&&p!==ge)return{enumerable:!0,configurable:!0,value:p,writable:!0}}return c},has(s,l){if(l===wn)return!0;var c=n.get(l),f=c!==void 0&&c.v!==ge||Reflect.has(s,l);if(c!==void 0||te!==null&&(!f||Tt(s,l)?.writable)){c===void 0&&(c=o(()=>{var p=f?Qe(s[l]):ge,d=K(p);return d}),n.set(l,c));var u=y(c);if(u===ge)return!1}return f},set(s,l,c,f){var u=n.get(l),p=l in s;if(r&&l==="length")for(var d=c;d<u.v;d+=1){var m=n.get(d+"");m!==void 0?U(m,ge):d in s&&(m=o(()=>K(ge)),n.set(d+"",m))}if(u===void 0)(!p||Tt(s,l)?.writable)&&(u=o(()=>K(void 0)),U(u,Qe(c)),n.set(l,u));else{p=u.v!==ge;var g=o(()=>Qe(c));U(u,g)}var h=Reflect.getOwnPropertyDescriptor(s,l);if(h?.set&&h.set.call(f,c),!p){if(r&&typeof l=="string"){var v=n.get("length"),w=Number(l);Number.isInteger(w)&&w>=v.v&&U(v,w+1)}jn(i)}return!0},ownKeys(s){y(i);var l=Reflect.ownKeys(s).filter(u=>{var p=n.get(u);return p===void 0||p.v!==ge});for(var[c,f]of n)f.v!==ge&&!(c in s)&&l.push(c);return l},setPrototypeOf(){qu()}})}var Mi,Yr,Qs,Xs,el;function yf(){if(Mi===void 0){Mi=window,Yr=document,Qs=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Xs=Tt(t,"firstChild").get,el=Tt(t,"nextSibling").get,bo(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),bo(n)&&(n.__t=void 0)}}function Rt(e=""){return document.createTextNode(e)}function Lt(e){return Xs.call(e)}function er(e){return el.call(e)}function I(e,t){return Lt(e)}function be(e,t=!1){{var n=Lt(e);return n instanceof Comment&&n.data===""?er(n):n}}function R(e,t=1,n=!1){let r=e;for(;t--;)r=er(r);return r}function wf(e){e.textContent=""}function tl(){return!1}let Ao=!1;function _f(){Ao||(Ao=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(const t of e.target.elements)t.__on_r?.()})},{capture:!0}))}function Wr(e){var t=X,n=te;$e(null),pt(null);try{return e()}finally{$e(t),pt(n)}}function nl(e,t,n,r=n){e.addEventListener(t,()=>Wr(n));const i=e.__on_r;i?e.__on_r=()=>{i(),r(!0)}:e.__on_r=()=>r(!0),_f()}function bf(e){te===null&&(X===null&&Hu(),Fu()),an&&Ru()}function kf(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function St(e,t,n){var r=te;r!==null&&(r.f&Pe)!==0&&(e|=Pe);var i={ctx:xe,deps:null,nodes:null,f:e|Fe|et,first:null,fn:t,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};if(n)try{Kn(i),i.f|=ta}catch(s){throw Re(i),s}else t!==null&&Xt(i);var a=i;if(n&&a.deps===null&&a.teardown===null&&a.nodes===null&&a.first===a.last&&(a.f&In)===0&&(a=a.first,(e&Et)!==0&&(e&Jt)!==0&&a!==null&&(a.f|=Jt)),a!==null&&(a.parent=r,r!==null&&kf(a,r),X!==null&&(X.f&ye)!==0&&(e&nn)===0)){var o=X;(o.effects??=[]).push(a)}return i}function Yn(){return X!==null&&!lt}function ia(e){const t=St(ea,null,!1);return Ae(t,ke),t.teardown=e,t}function dt(e){bf();var t=te.f,n=!X&&(t&Ct)!==0&&(t&ta)===0;if(n){var r=xe;(r.e??=[]).push(e)}else return rl(e)}function rl(e){return St(Xi|Ou,e,!1)}function xf(e){Je.ensure();const t=St(nn|In,e,!0);return(n={})=>new Promise(r=>{n.outro?Yt(t,()=>{Re(t),r(void 0)}):(Re(t),r(void 0))})}function il(e){return St(Xi,e,!1)}function Af(e){return St(na|In,e,!0)}function Kr(e,t=0){return St(ea|t,e,!0)}function ee(e,t=[],n=[],r=[]){pf(r,t,n,i=>{St(ea,()=>e(...i.map(y)),!0)})}function tr(e,t=0){var n=St(Et|t,e,!0);return n}function Ke(e){return St(Ct|In,e,!0)}function al(e){var t=e.teardown;if(t!==null){const n=an,r=X;Eo(!0),$e(null);try{t.call(null)}finally{Eo(n),$e(r)}}}function ol(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const i=n.ac;i!==null&&Wr(()=>{i.abort(mn)});var r=n.next;(n.f&nn)!==0?n.parent=null:Re(n,t),n=r}}function Ef(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&Ct)===0&&Re(t),t=n}}function Re(e,t=!0){var n=!1;(t||(e.f&Ls)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(sl(e.nodes.start,e.nodes.end),n=!0),ol(e,t&&!n),Sr(e,0),Ae(e,wt);var r=e.nodes&&e.nodes.t;if(r!==null)for(const a of r)a.stop();al(e);var i=e.parent;i!==null&&i.first!==null&&ll(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function sl(e,t){for(;e!==null;){var n=e===t?null:er(e);e.remove(),e=n}}function ll(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Yt(e,t,n=!0){var r=[];cl(e,r,!0);var i=()=>{n&&Re(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function cl(e,t,n){if((e.f&Pe)===0){e.f^=Pe;var r=e.nodes&&e.nodes.t;if(r!==null)for(const s of r)(s.is_global||n)&&t.push(s);for(var i=e.first;i!==null;){var a=i.next,o=(i.f&Jt)!==0||(i.f&Ct)!==0&&(e.f&Et)!==0;cl(i,t,o?n:!1),i=a}}}function aa(e){ul(e,!0)}function ul(e,t){if((e.f&Pe)!==0){e.f^=Pe,(e.f&ke)===0&&(Ae(e,Fe),Xt(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&Jt)!==0||(n.f&Ct)!==0;ul(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(const o of a)(o.is_global||t)&&o.in()}}function fl(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:er(n);t.append(n),n=i}}let Wt=!1;function Cr(e){Wt=e}let an=!1;function Eo(e){an=e}let X=null,lt=!1;function $e(e){X=e}let te=null;function pt(e){te=e}let bt=null;function dl(e){X!==null&&(bt===null?bt=[e]:bt.push(e))}let Ie=null,He=0,Ye=null;function Cf(e){Ye=e}let pl=1,Wn=0,Kt=Wn;function Co(e){Kt=e}function hl(){return++pl}function nr(e){var t=e.f;if((t&Fe)!==0)return!0;if(t&ye&&(e.f&=~Qt),(t&ft)!==0){var n=e.deps;if(n!==null)for(var r=n.length,i=0;i<r;i++){var a=n[i];if(nr(a)&&zs(a),a.wv>e.wv)return!0}(t&et)!==0&&ze===null&&Ae(e,ke)}return!1}function ml(e,t,n=!0){var r=e.reactions;if(r!==null&&!bt?.includes(e))for(var i=0;i<r.length;i++){var a=r[i];(a.f&ye)!==0?ml(a,t,!1):t===a&&(n?Ae(a,Fe):(a.f&ke)!==0&&Ae(a,ft),Xt(a))}}function gl(e){var t=Ie,n=He,r=Ye,i=X,a=bt,o=xe,s=lt,l=Kt,c=e.f;Ie=null,He=0,Ye=null,X=(c&(Ct|nn))===0?e:null,bt=null,kn(e.ctx),lt=!1,Kt=++Wn,e.ac!==null&&(Wr(()=>{e.ac.abort(mn)}),e.ac=null);try{e.f|=Ai;var f=e.fn,u=f(),p=e.deps;if(Ie!==null){var d;if(Sr(e,He),p!==null&&He>0)for(p.length=He+Ie.length,d=0;d<Ie.length;d++)p[He+d]=Ie[d];else e.deps=p=Ie;if(Yn()&&(e.f&et)!==0)for(d=He;d<p.length;d++)(p[d].reactions??=[]).push(e)}else p!==null&&He<p.length&&(Sr(e,He),p.length=He);if(Fs()&&Ye!==null&&!lt&&p!==null&&(e.f&(ye|ft|Fe))===0)for(d=0;d<Ye.length;d++)ml(Ye[d],e);return i!==null&&i!==e&&(Wn++,Ye!==null&&(r===null?r=Ye:r.push(...Ye))),(e.f&$t)!==0&&(e.f^=$t),u}catch(m){return Bs(m)}finally{e.f^=Ai,Ie=t,He=n,Ye=r,X=i,bt=a,kn(o),lt=s,Kt=l}}function Sf(e,t){let n=t.reactions;if(n!==null){var r=Mu.call(n,e);if(r!==-1){var i=n.length-1;i===0?n=t.reactions=null:(n[r]=n[i],n.pop())}}n===null&&(t.f&ye)!==0&&(Ie===null||!Ie.includes(t))&&(Ae(t,ft),(t.f&et)!==0&&(t.f^=et,t.f&=~Qt),Ks(t),Sr(t,0))}function Sr(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Sf(e,n[r])}function Kn(e){var t=e.f;if((t&wt)===0){Ae(e,ke);var n=te,r=Wt;te=e,Wt=!0;try{(t&(Et|Tu))!==0?Ef(e):ol(e),al(e);var i=gl(e);e.teardown=typeof i=="function"?i:null,e.wv=pl;var a;xi&&rf&&(e.f&Fe)!==0&&e.deps}finally{Wt=r,te=n}}}async function Mf(){await Promise.resolve(),js()}function y(e){var t=e.f,n=(t&ye)!==0;if(X!==null&&!lt){var r=te!==null&&(te.f&wt)!==0;if(!r&&!bt?.includes(e)){var i=X.deps;if((X.f&Ai)!==0)e.rv<Wn&&(e.rv=Wn,Ie===null&&i!==null&&i[He]===e?He++:Ie===null?Ie=[e]:Ie.includes(e)||Ie.push(e));else{(X.deps??=[]).push(e);var a=e.reactions;a===null?e.reactions=[X]:a.includes(X)||a.push(X)}}}if(an){if(Dt.has(e))return Dt.get(e);if(n){var o=e,s=o.v;return((o.f&ke)===0&&o.reactions!==null||yl(o))&&(s=ra(o)),Dt.set(o,s),s}}else n&&(!ze?.has(e)||ne?.is_fork&&!Yn())&&(o=e,nr(o)&&zs(o),Wt&&Yn()&&(o.f&et)===0&&vl(o));if(ze?.has(e))return ze.get(e);if((e.f&$t)!==0)throw e.v;return e.v}function vl(e){if(e.deps!==null){e.f^=et;for(const t of e.deps)(t.reactions??=[]).push(e),(t.f&ye)!==0&&(t.f&et)===0&&vl(t)}}function yl(e){if(e.v===ge)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(Dt.has(t)||(t.f&ye)!==0&&yl(t))return!0;return!1}function jt(e){var t=lt;try{return lt=!0,e()}finally{lt=t}}const If=-7169;function Ae(e,t){e.f=e.f&If|t}const Lf=["touchstart","touchmove"];function Nf(e){return Lf.includes(e)}const wl=new Set,Ii=new Set;function Tf(e,t,n,r={}){function i(a){if(r.capture||Hn.call(t,a),!a.cancelBubble)return Wr(()=>n?.call(this,a))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?rn(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function on(e,t,n,r,i){var a={capture:r,passive:i},o=Tf(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&ia(()=>{t.removeEventListener(e,o,a)})}function Ve(e){for(var t=0;t<e.length;t++)wl.add(e[t]);for(var n of Ii)n(e)}let So=null;function Hn(e){var t=this,n=t.ownerDocument,r=e.type,i=e.composedPath?.()||[],a=i[0]||e.target;So=e;var o=0,s=So===e&&e.__root;if(s){var l=i.indexOf(s);if(l!==-1&&(t===document||t===window)){e.__root=t;return}var c=i.indexOf(t);if(c===-1)return;l<=c&&(o=l)}if(a=i[o]||e.target,a!==t){Cs(e,"currentTarget",{configurable:!0,get(){return a||n}});var f=X,u=te;$e(null),pt(null);try{for(var p,d=[];a!==null;){var m=a.assignedSlot||a.parentNode||a.host||null;try{var g=a["__"+r];g!=null&&(!a.disabled||e.target===a)&&g.call(a,e)}catch(h){p?d.push(h):p=h}if(e.cancelBubble||m===t||m===null)break;a=m}if(p){for(let h of d)queueMicrotask(()=>{throw h});throw p}}finally{e.__root=t,delete e.currentTarget,$e(f),pt(u)}}}function _l(e){var t=document.createElement("template");return t.innerHTML=e.replaceAll("<!>","<!---->"),t.content}function Mr(e,t){var n=te;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function z(e,t){var n=(t&Xu)!==0,r=(t&ef)!==0,i,a=!e.startsWith("<!>");return()=>{i===void 0&&(i=_l(a?e:"<!>"+e),n||(i=Lt(i)));var o=r||Qs?document.importNode(i,!0):i.cloneNode(!0);if(n){var s=Lt(o),l=o.lastChild;Mr(s,l)}else Mr(o,o);return o}}function st(){var e=document.createDocumentFragment(),t=document.createComment(""),n=Rt();return e.append(t,n),Mr(t,n),e}function q(e,t){e!==null&&e.before(t)}function ce(e,t){var n=t==null?"":typeof t=="object"?t+"":t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=n+"")}function Of(e,t){return $f(e,t)}const cn=new Map;function $f(e,{target:t,anchor:n,props:r={},events:i,context:a,intro:o=!0}){yf();var s=new Set,l=u=>{for(var p=0;p<u.length;p++){var d=u[p];if(!s.has(d)){s.add(d);var m=Nf(d);t.addEventListener(d,Hn,{passive:m});var g=cn.get(d);g===void 0?(document.addEventListener(d,Hn,{passive:m}),cn.set(d,1)):cn.set(d,g+1)}}};l(jr(wl)),Ii.add(l);var c=void 0,f=xf(()=>{var u=n??t.appendChild(Rt());return ff(u,{pending:()=>{}},p=>{if(a){se({});var d=xe;d.c=a}i&&(r.$$events=i),c=e(p,r)||{},a&&le()}),()=>{for(var p of s){t.removeEventListener(p,Hn);var d=cn.get(p);--d===0?(document.removeEventListener(p,Hn),cn.delete(p)):cn.set(p,d)}Ii.delete(l),u!==n&&u.parentNode?.removeChild(u)}});return Df.set(c,f),c}let Df=new WeakMap;class oa{anchor;#e=new Map;#t=new Map;#r=new Map;#n=new Set;#l=!0;constructor(t,n=!0){this.anchor=t,this.#l=n}#a=()=>{var t=ne;if(this.#e.has(t)){var n=this.#e.get(t),r=this.#t.get(n);if(r)aa(r),this.#n.delete(n);else{var i=this.#r.get(n);i&&(this.#t.set(n,i.effect),this.#r.delete(n),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),r=i.effect)}for(const[a,o]of this.#e){if(this.#e.delete(a),a===t)break;const s=this.#r.get(o);s&&(Re(s.effect),this.#r.delete(o))}for(const[a,o]of this.#t){if(a===n||this.#n.has(a))continue;const s=()=>{if(Array.from(this.#e.values()).includes(a)){var c=document.createDocumentFragment();fl(o,c),c.append(Rt()),this.#r.set(a,{effect:o,fragment:c})}else Re(o);this.#n.delete(a),this.#t.delete(a)};this.#l||!r?(this.#n.add(a),Yt(o,s,!1)):s()}}};#i=t=>{this.#e.delete(t);const n=Array.from(this.#e.values());for(const[r,i]of this.#r)n.includes(r)||(Re(i.effect),this.#r.delete(r))};ensure(t,n){var r=ne,i=tl();if(n&&!this.#t.has(t)&&!this.#r.has(t))if(i){var a=document.createDocumentFragment(),o=Rt();a.append(o),this.#r.set(t,{effect:Ke(()=>n(o)),fragment:a})}else this.#t.set(t,Ke(()=>n(this.anchor)));if(this.#e.set(r,t),i){for(const[s,l]of this.#t)s===t?r.skipped_effects.delete(l):r.skipped_effects.add(l);for(const[s,l]of this.#r)s===t?r.skipped_effects.delete(l.effect):r.skipped_effects.add(l.effect);r.oncommit(this.#a),r.ondiscard(this.#i)}else this.#a()}}const Rf=0,fi=1;function Xe(e,t,n,r,i){var a=ge,o=xt(a),s=xt(a),l=new oa(e);tr(()=>{var c=t(),f=!1;if(Nu(c)){var u=Ys(),p=!1;const d=m=>{if(!f){p=!0,u(!1),Je.ensure();try{m()}finally{Un(),_n||js()}}};c.then(m=>{d(()=>{_t(o,m),l.ensure(fi,r&&(g=>r(g,o)))})},m=>{d(()=>{if(_t(s,m),l.ensure(fi,i&&(g=>i(g,s))),!i)throw s.v})}),rn(()=>{p||d(()=>{l.ensure(Rf,n)})})}else _t(o,c),l.ensure(fi,r&&(d=>r(d,o)));return()=>{f=!0}})}function Ne(e,t,n=!1){var r=new oa(e),i=n?Jt:0;function a(o,s){r.ensure(o,s)}tr(()=>{var o=!1;t((s,l=!0)=>{o=!0,a(l,s)}),o||a(!1,null)},i)}function Li(e,t){return t}function Ff(e,t,n){for(var r=[],i=t.length,a,o=t.length,s=0;s<i;s++){let u=t[s];Yt(u,()=>{if(a){if(a.pending.delete(u),a.done.add(u),a.pending.size===0){var p=e.outrogroups;Ni(jr(a.done)),p.delete(a),p.size===0&&(e.outrogroups=null)}}else o-=1},!1)}if(o===0){var l=r.length===0&&n!==null;if(l){var c=n,f=c.parentNode;wf(f),f.append(c),e.items.clear()}Ni(t,!l)}else a={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(a)}function Ni(e,t=!0){for(var n=0;n<e.length;n++)Re(e[n],t)}var Mo;function Pt(e,t,n,r,i,a=null){var o=e,s=new Map,l=(t&Os)!==0;if(l){var c=e;o=c.appendChild(Rt())}var f=null,u=Ws(()=>{var v=n();return Ji(v)?v:v==null?[]:jr(v)}),p,d=!0;function m(){h.fallback=f,Hf(h,p,o,t,r),f!==null&&(p.length===0?(f.f&yt)===0?aa(f):(f.f^=yt,Pn(f,null,o)):Yt(f,()=>{f=null}))}var g=tr(()=>{p=y(u);for(var v=p.length,w=new Set,k=ne,L=tl(),$=0;$<v;$+=1){var N=p[$],E=r(N,$),P=d?null:s.get(E);P?(P.v&&_t(P.v,N),P.i&&_t(P.i,$),L&&k.skipped_effects.delete(P.e)):(P=Pf(s,d?o:Mo??=Rt(),N,E,$,i,t,n),d||(P.e.f|=yt),s.set(E,P)),w.add(E)}if(v===0&&a&&!f&&(d?f=Ke(()=>a(o)):(f=Ke(()=>a(Mo??=Rt())),f.f|=yt)),!d)if(L){for(const[G,V]of s)w.has(G)||k.skipped_effects.add(V.e);k.oncommit(m),k.ondiscard(()=>{})}else m();y(u)}),h={effect:g,items:s,outrogroups:null,fallback:f};d=!1}function Hf(e,t,n,r,i){var a=(r&Ku)!==0,o=t.length,s=e.items,l=e.effect.first,c,f=null,u,p=[],d=[],m,g,h,v;if(a)for(v=0;v<o;v+=1)m=t[v],g=i(m,v),h=s.get(g).e,(h.f&yt)===0&&(h.nodes?.a?.measure(),(u??=new Set).add(h));for(v=0;v<o;v+=1){if(m=t[v],g=i(m,v),h=s.get(g).e,e.outrogroups!==null)for(const V of e.outrogroups)V.pending.delete(h),V.done.delete(h);if((h.f&yt)!==0)if(h.f^=yt,h===l)Pn(h,null,n);else{var w=f?f.next:l;h===e.effect.last&&(e.effect.last=h.prev),h.prev&&(h.prev.next=h.next),h.next&&(h.next.prev=h.prev),It(e,f,h),It(e,h,w),Pn(h,w,n),f=h,p=[],d=[],l=f.next;continue}if((h.f&Pe)!==0&&(aa(h),a&&(h.nodes?.a?.unfix(),(u??=new Set).delete(h))),h!==l){if(c!==void 0&&c.has(h)){if(p.length<d.length){var k=d[0],L;f=k.prev;var $=p[0],N=p[p.length-1];for(L=0;L<p.length;L+=1)Pn(p[L],k,n);for(L=0;L<d.length;L+=1)c.delete(d[L]);It(e,$.prev,N.next),It(e,f,$),It(e,N,k),l=k,f=N,v-=1,p=[],d=[]}else c.delete(h),Pn(h,l,n),It(e,h.prev,h.next),It(e,h,f===null?e.effect.first:f.next),It(e,f,h),f=h;continue}for(p=[],d=[];l!==null&&l!==h;)(c??=new Set).add(l),d.push(l),l=l.next;if(l===null)continue}(h.f&yt)===0&&p.push(h),f=h,l=h.next}if(e.outrogroups!==null){for(const V of e.outrogroups)V.pending.size===0&&(Ni(jr(V.done)),e.outrogroups?.delete(V));e.outrogroups.size===0&&(e.outrogroups=null)}if(l!==null||c!==void 0){var E=[];if(c!==void 0)for(h of c)(h.f&Pe)===0&&E.push(h);for(;l!==null;)(l.f&Pe)===0&&l!==e.fallback&&E.push(l),l=l.next;var P=E.length;if(P>0){var G=(r&Os)!==0&&o===0?n:null;if(a){for(v=0;v<P;v+=1)E[v].nodes?.a?.measure();for(v=0;v<P;v+=1)E[v].nodes?.a?.fix()}Ff(e,E,G)}}a&&rn(()=>{if(u!==void 0)for(h of u)h.nodes?.a?.apply()})}function Pf(e,t,n,r,i,a,o,s){var l=(o&Yu)!==0?(o&zu)===0?Zs(n,!1,!1):xt(n):null,c=(o&Wu)!==0?xt(i):null;return{v:l,i:c,e:Ke(()=>(a(t,l??n,c??i,s),()=>{e.delete(r)}))}}function Pn(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&(t.f&yt)===0?t.nodes.start:n;r!==null;){var o=er(r);if(a.before(r),r===i)return;r=o}}function It(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Be(e,t,n=!1,r=!1,i=!1){var a=e,o="";ee(()=>{var s=te;if(o!==(o=t()??"")&&(s.nodes!==null&&(sl(s.nodes.start,s.nodes.end),s.nodes=null),o!=="")){var l=o+"";n?l=`<svg>${l}</svg>`:r&&(l=`<math>${l}</math>`);var c=_l(l);if((n||r)&&(c=Lt(c)),Mr(Lt(c),c.lastChild),n||r)for(;Lt(c);)a.before(Lt(c));else a.before(c)}})}function vr(e,t,n){var r=new oa(e);tr(()=>{var i=t()??null;r.ensure(i,i&&(a=>n(a,i)))},Jt)}function Bf(e,t,n){il(()=>{var r=jt(()=>t(e,n?.())||{});if(r?.destroy)return()=>r.destroy()})}const Io=[...`
|
|
2
|
-
\r\f \v\uFEFF`];function
|
|
1
|
+
import{g as Es,c as Cs,I as Ss,S as lu,s as cu,P as In,a as Nn,p as Mr,E as uu,b as jr,e as qr,D as fu,d as du,f as nr,h as pu,i as hu,C as mu,j as ae,k as gu,m as vu,l as yu,r as yo,n as wo,o as Ms,q as bo,K as wu,t as bu,u as _o,F as ke,R as Zi,v as Ji,w as _u,N as ku,x as xu,y as Au,z as rr,A as ko,B as Qi,G as Gn,H as Xi,J as Ls,L as sn,T as Vr,M as Eu,O as Cu,Q as Su,U as Mu,V as Lu,W as Iu,X as Nu,Y as xo,Z as Ao,_ as Ur,$ as Is,a0 as ea,a1 as Ns,a2 as Tu,a3 as Ou,a4 as $u,a5 as Du,a6 as Ru}from"./milkdown.js";const Ei=!1;var ta=Array.isArray,Fu=Array.prototype.indexOf,xn=Array.prototype.includes,Yr=Array.from,Ts=Object.defineProperty,$t=Object.getOwnPropertyDescriptor,Hu=Object.getOwnPropertyDescriptors,Os=Object.prototype,Pu=Array.prototype,na=Object.getPrototypeOf,Eo=Object.isExtensible;function Bn(e){return typeof e=="function"}const kt=()=>{};function Bu(e){return typeof e?.then=="function"}function $s(e){for(var t=0;t<e.length;t++)e[t]()}function Ds(){var e,t,n=new Promise((r,i)=>{e=r,t=i});return{promise:n,resolve:e,reject:t}}const be=2,Tn=4,Zn=8,Rs=1<<24,Vt=16,ot=32,ln=64,Ci=128,We=512,ye=1024,_e=2048,rt=4096,Fe=8192,xt=16384,On=32768,rn=65536,Co=1<<17,ju=1<<18,$n=1<<19,qu=1<<20,_t=1<<25,an=65536,Si=1<<21,ra=1<<22,Dt=1<<23,bn=Symbol("$state"),Fs=Symbol("legacy props"),Vu=Symbol(""),zt=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Uu=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml");function Hs(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Yu(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Wu(e,t,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Ku(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function zu(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Gu(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Zu(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Ju(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function Qu(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Xu(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function ef(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function tf(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const nf=1,rf=2,Ps=4,af=8,of=16,sf=1,lf=4,cf=8,uf=16,ff=1,df=2,ve=Symbol(),Bs="http://www.w3.org/1999/xhtml",pf="http://www.w3.org/2000/svg",hf="http://www.w3.org/1998/Math/MathML";function mf(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function js(e){return e===this.v}function qs(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Vs(e){return!qs(e,this.v)}let gf=!1;const vf=[];function Mi(e,t=!1,n=!1){return br(e,new Map,"",vf,null,n)}function br(e,t,n,r,i=null,a=!1){if(typeof e=="object"&&e!==null){var o=t.get(e);if(o!==void 0)return o;if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(ta(e)){var s=Array(e.length);t.set(e,s),i!==null&&t.set(i,s);for(var l=0;l<e.length;l+=1){var c=e[l];l in e&&(s[l]=br(c,t,n,r,null,a))}return s}if(na(e)===Os){s={},t.set(e,s),i!==null&&t.set(i,s);for(var f of Object.keys(e))s[f]=br(e[f],t,n,r,null,a);return s}if(e instanceof Date)return structuredClone(e);if(typeof e.toJSON=="function"&&!a)return br(e.toJSON(),t,n,r,e)}if(e instanceof EventTarget)return e;try{return structuredClone(e)}catch{return e}}let xe=null;function An(e){xe=e}function Lr(e){return Ys().get(e)}function Ir(e,t){return Ys().set(e,t),t}function le(e,t=!1,n){xe={p:xe,i:!1,c:null,e:null,s:e,x:null,l:null}}function ce(e){var t=xe,n=t.e;if(n!==null){t.e=null;for(var r of n)hl(r)}return e!==void 0&&(t.x=e),t.i=!0,xe=t.p,e??{}}function Us(){return!0}function Ys(e){return xe===null&&Hs(),xe.c??=new Map(yf(xe)||void 0)}function yf(e){let t=e.p;for(;t!==null;){const n=t.c;if(n!==null)return n;t=t.p}return null}let Gt=[];function Ws(){var e=Gt;Gt=[],$s(e)}function ft(e){if(Gt.length===0&&!_n){var t=Gt;queueMicrotask(()=>{t===Gt&&Ws()})}Gt.push(e)}function wf(){for(;Gt.length>0;)Ws()}function Ks(e){var t=ee;if(t===null)return X.f|=Dt,e;if((t.f&On)===0&&(t.f&Tn)===0)throw e;Tt(e,t)}function Tt(e,t){for(;t!==null;){if((t.f&Ci)!==0){if((t.f&On)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}const bf=-7169;function ue(e,t){e.f=e.f&bf|t}function ia(e){(e.f&We)!==0||e.deps===null?ue(e,ye):ue(e,rt)}function zs(e){if(e!==null)for(const t of e)(t.f&be)===0||(t.f&an)===0||(t.f^=an,zs(t.deps))}function Gs(e,t,n){(e.f&_e)!==0?t.add(e):(e.f&rt)!==0&&n.add(e),zs(e.deps),ue(e,ye)}const gr=new Set;let ne=null,Li=null,Qe=null,Ie=[],Wr=null,_n=!1,En=null;class At{current=new Map;previous=new Map;#e=new Set;#s=new Set;#t=0;#o=0;#n=null;#a=new Set;#r=new Set;#i=new Map;is_fork=!1;#l=!1;#u(){return this.is_fork||this.#o>0}skip_effect(t){this.#i.has(t)||this.#i.set(t,{d:[],m:[]})}unskip_effect(t){var n=this.#i.get(t);if(n){this.#i.delete(t);for(var r of n.d)ue(r,_e),Xe(r);for(r of n.m)ue(r,rt),Xe(r)}}process(t){Ie=[],this.apply();var n=En=[],r=[];for(const i of t)this.#c(i,n,r);if(En=null,this.#u()){this.#f(r),this.#f(n);for(const[i,a]of this.#i)el(i,a)}else{Li=this,ne=null;for(const i of this.#e)i(this);this.#e.clear(),this.#t===0&&this.#d(),So(r),So(n),this.#a.clear(),this.#r.clear(),Li=null,this.#n?.resolve()}Qe=null}#c(t,n,r){t.f^=ye;for(var i=t.first;i!==null;){var a=i.f,o=(a&(ot|ln))!==0,s=o&&(a&ye)!==0,l=s||(a&Fe)!==0||this.#i.has(i);if(!l&&i.fn!==null){o?i.f^=ye:(a&Tn)!==0?n.push(i):or(i)&&((a&Vt)!==0&&this.#r.add(i),Cn(i));var c=i.first;if(c!==null){i=c;continue}}for(;i!==null;){var f=i.next;if(f!==null){i=f;break}i=i.parent}}}#f(t){for(var n=0;n<t.length;n+=1)Gs(t[n],this.#a,this.#r)}capture(t,n){n!==ve&&!this.previous.has(t)&&this.previous.set(t,n),(t.f&Dt)===0&&(this.current.set(t,t.v),Qe?.set(t,t.v))}activate(){ne=this,this.apply()}deactivate(){ne===this&&(ne=null,Qe=null)}flush(){if(Ie.length>0)ne=this,Js();else if(this.#t===0&&!this.is_fork){for(const t of this.#e)t(this);this.#e.clear(),this.#d(),this.#n?.resolve()}this.deactivate()}discard(){for(const t of this.#s)t(this);this.#s.clear()}#d(){if(gr.size>1){this.previous.clear();var t=ne,n=Qe,r=!0;for(const a of gr){if(a===this){r=!1;continue}const o=[];for(const[l,c]of this.current){if(a.current.has(l))if(r&&c!==a.current.get(l))a.current.set(l,c);else continue;o.push(l)}if(o.length===0)continue;const s=[...a.current.keys()].filter(l=>!this.current.has(l));if(s.length>0){var i=Ie;Ie=[];const l=new Set,c=new Map;for(const f of o)Qs(f,s,l,c);if(Ie.length>0){ne=a,a.apply();for(const f of Ie)a.#c(f,[],[]);a.deactivate()}Ie=i}}ne=t,Qe=n}this.#i.clear(),gr.delete(this)}increment(t){this.#t+=1,t&&(this.#o+=1)}decrement(t){this.#t-=1,t&&(this.#o-=1),!this.#l&&(this.#l=!0,ft(()=>{this.#l=!1,this.#u()?Ie.length>0&&this.flush():this.revive()}))}revive(){for(const t of this.#a)this.#r.delete(t),ue(t,_e),Xe(t);for(const t of this.#r)ue(t,rt),Xe(t);this.flush()}oncommit(t){this.#e.add(t)}ondiscard(t){this.#s.add(t)}settled(){return(this.#n??=Ds()).promise}static ensure(){if(ne===null){const t=ne=new At;gr.add(ne),_n||ft(()=>{ne===t&&t.flush()})}return ne}apply(){}}function Zs(e){var t=_n;_n=!0;try{for(var n;;){if(wf(),Ie.length===0&&(ne?.flush(),Ie.length===0))return Wr=null,n;Js()}}finally{_n=t}}function Js(){var e=null;try{for(var t=0;Ie.length>0;){var n=At.ensure();if(t++>1e3){var r,i;_f()}n.process(Ie),Rt.clear()}}finally{Ie=[],Wr=null,En=null}}function _f(){try{Zu()}catch(e){Tt(e,Wr)}}let wt=null;function So(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if((r.f&(xt|Fe))===0&&or(r)&&(wt=new Set,Cn(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&yl(r),wt?.size>0)){Rt.clear();for(const i of wt){if((i.f&(xt|Fe))!==0)continue;const a=[i];let o=i.parent;for(;o!==null;)wt.has(o)&&(wt.delete(o),a.push(o)),o=o.parent;for(let s=a.length-1;s>=0;s--){const l=a[s];(l.f&(xt|Fe))===0&&Cn(l)}}wt.clear()}}wt=null}}function Qs(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const i of e.reactions){const a=i.f;(a&be)!==0?Qs(i,t,n,r):(a&(ra|Vt))!==0&&(a&_e)===0&&Xs(i,t,r)&&(ue(i,_e),Xe(i))}}function Xs(e,t,n){const r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const i of e.deps){if(xn.call(t,i))return!0;if((i.f&be)!==0&&Xs(i,t,n))return n.set(i,!0),!0}return n.set(e,!1),!1}function Xe(e){var t=Wr=e,n=t.b;if(n?.is_pending&&(e.f&(Tn|Zn|Rs))!==0&&(e.f&On)===0){n.defer_effect(e);return}for(;t.parent!==null;){t=t.parent;var r=t.f;if(En!==null&&t===ee&&(e.f&Zn)===0)return;if((r&(ln|ot))!==0){if((r&ye)===0)return;t.f^=ye}}Ie.push(t)}function el(e,t){if(!((e.f&ot)!==0&&(e.f&ye)!==0)){(e.f&_e)!==0?t.d.push(e):(e.f&rt)!==0&&t.m.push(e),ue(e,ye);for(var n=e.first;n!==null;)el(n,t),n=n.next}}function kf(e){let t=0,n=St(0),r;return()=>{oa()&&(y(n),Zr(()=>(t===0&&(r=Ut(()=>e(()=>Kn(n)))),t+=1,()=>{ft(()=>{t-=1,t===0&&(r?.(),r=void 0,Kn(n))})})))}}var xf=rn|$n;function Af(e,t,n,r){new Ef(e,t,n,r)}class Ef{parent;is_pending=!1;transform_error;#e;#s=null;#t;#o;#n;#a=null;#r=null;#i=null;#l=null;#u=0;#c=0;#f=!1;#d=new Set;#h=new Set;#p=null;#w=kf(()=>(this.#p=St(this.#u),()=>{this.#p=null}));constructor(t,n,r,i){this.#e=t,this.#t=n,this.#o=a=>{var o=ee;o.b=this,o.f|=Ci,r(a)},this.parent=ee.b,this.transform_error=i??this.parent?.transform_error??(a=>a),this.#n=ar(()=>{this.#v()},xf)}#b(){try{this.#a=Ye(()=>this.#o(this.#e))}catch(t){this.error(t)}}#_(t){const n=this.#t.failed;n&&(this.#i=Ye(()=>{n(this.#e,()=>t,()=>()=>{})}))}#k(){const t=this.#t.pending;t&&(this.is_pending=!0,this.#r=Ye(()=>t(this.#e)),ft(()=>{var n=this.#l=document.createDocumentFragment(),r=Ft();n.append(r),this.#a=this.#g(()=>(At.ensure(),Ye(()=>this.#o(r)))),this.#c===0&&(this.#e.before(n),this.#l=null,Qt(this.#r,()=>{this.#r=null}),this.#m())}))}#v(){try{if(this.is_pending=this.has_pending_snippet(),this.#c=0,this.#u=0,this.#a=Ye(()=>{this.#o(this.#e)}),this.#c>0){var t=this.#l=document.createDocumentFragment();_l(this.#a,t);const n=this.#t.pending;this.#r=Ye(()=>n(this.#e))}else this.#m()}catch(n){this.error(n)}}#m(){this.is_pending=!1;for(const t of this.#d)ue(t,_e),Xe(t);for(const t of this.#h)ue(t,rt),Xe(t);this.#d.clear(),this.#h.clear()}defer_effect(t){Gs(t,this.#d,this.#h)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#t.pending}#g(t){var n=ee,r=X,i=xe;mt(this.#n),ze(this.#n),An(this.#n.ctx);try{return t()}catch(a){return Ks(a),null}finally{mt(n),ze(r),An(i)}}#y(t){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(t);return}this.#c+=t,this.#c===0&&(this.#m(),this.#r&&Qt(this.#r,()=>{this.#r=null}),this.#l&&(this.#e.before(this.#l),this.#l=null))}update_pending_count(t){this.#y(t),this.#u+=t,!(!this.#p||this.#f)&&(this.#f=!0,ft(()=>{this.#f=!1,this.#p&&Et(this.#p,this.#u)}))}get_effect_pending(){return this.#w(),y(this.#p)}error(t){var n=this.#t.onerror;let r=this.#t.failed;if(!n&&!r)throw t;this.#a&&($e(this.#a),this.#a=null),this.#r&&($e(this.#r),this.#r=null),this.#i&&($e(this.#i),this.#i=null);var i=!1,a=!1;const o=()=>{if(i){mf();return}i=!0,a&&tf(),this.#i!==null&&Qt(this.#i,()=>{this.#i=null}),this.#g(()=>{At.ensure(),this.#v()})},s=l=>{try{a=!0,n?.(l,o),a=!1}catch(c){Tt(c,this.#n&&this.#n.parent)}r&&(this.#i=this.#g(()=>{At.ensure();try{return Ye(()=>{var c=ee;c.b=this,c.f|=Ci,r(this.#e,()=>l,()=>o)})}catch(c){return Tt(c,this.#n.parent),null}}))};ft(()=>{var l;try{l=this.transform_error(t)}catch(c){Tt(c,this.#n&&this.#n.parent);return}l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(s,c=>Tt(c,this.#n&&this.#n.parent)):s(l)})}}function Cf(e,t,n,r){const i=Kr;var a=e.filter(u=>!u.settled);if(n.length===0&&a.length===0){r(t.map(i));return}var o=ee,s=tl(),l=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(u=>u.promise)):null;function c(u){s();try{r(u)}catch(p){(o.f&xt)===0&&Tt(p,o)}Nr()}if(n.length===0){l.then(()=>c(t.map(i)));return}function f(){s(),Promise.all(n.map(u=>Mf(u))).then(u=>c([...t.map(i),...u])).catch(u=>Tt(u,o))}l?l.then(f):f()}function tl(){var e=ee,t=X,n=xe,r=ne;return function(a=!0){mt(e),ze(t),An(n),a&&r?.activate()}}function Nr(e=!0){mt(null),ze(null),An(null),e&&ne?.deactivate()}function Sf(){var e=ee.b,t=ne,n=e.is_rendered();return e.update_pending_count(1),t.increment(n),()=>{e.update_pending_count(-1),t.decrement(n)}}function Kr(e){var t=be|_e,n=X!==null&&(X.f&be)!==0?X:null;return ee!==null&&(ee.f|=$n),{ctx:xe,deps:null,effects:null,equals:js,f:t,fn:e,reactions:null,rv:0,v:ve,wv:0,parent:n??ee,ac:null}}function Mf(e,t,n){ee===null&&Yu();var i=void 0,a=St(ve),o=!X,s=new Map;return Bf(()=>{var l=Ds();i=l.promise;try{Promise.resolve(e()).then(l.resolve,l.reject).finally(Nr)}catch(p){l.reject(p),Nr()}var c=ne;if(o){var f=Sf();s.get(c)?.reject(zt),s.delete(c),s.set(c,l)}const u=(p,d=void 0)=>{if(c.activate(),d)d!==zt&&(a.f|=Dt,Et(a,d));else{(a.f&Dt)!==0&&(a.f^=Dt),Et(a,p);for(const[h,g]of s){if(s.delete(h),h===c)break;g.reject(zt)}}f&&f()};l.promise.then(u,p=>u(null,p||"unknown"))}),sa(()=>{for(const l of s.values())l.reject(zt)}),new Promise(l=>{function c(f){function u(){f===i?l(a):c(i)}f.then(u,u)}c(i)})}function dt(e){const t=Kr(e);return kl(t),t}function nl(e){const t=Kr(e);return t.equals=Vs,t}function Lf(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)$e(t[n])}}function If(e){for(var t=e.parent;t!==null;){if((t.f&be)===0)return(t.f&xt)===0?t:null;t=t.parent}return null}function aa(e){var t,n=ee;mt(If(e));try{e.f&=~an,Lf(e),t=Cl(e)}finally{mt(n)}return t}function rl(e){var t=aa(e);if(!e.equals(t)&&(e.wv=Al(),(!ne?.is_fork||e.deps===null)&&(e.v=t,e.deps===null))){ue(e,ye);return}Bt||(Qe!==null?(oa()||ne?.is_fork)&&Qe.set(e,t):ia(e))}function Nf(e){if(e.effects!==null)for(const t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(zt),t.teardown=kt,t.ac=null,Jn(t,0),la(t))}function il(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&Cn(t)}let Ii=new Set;const Rt=new Map;let al=!1;function St(e,t){var n={f:0,v:e,reactions:null,equals:js,rv:0,wv:0};return n}function K(e,t){const n=St(e);return kl(n),n}function ol(e,t=!1,n=!0){const r=St(e);return t||(r.equals=Vs),r}function V(e,t,n=!1){X!==null&&(!tt||(X.f&Co)!==0)&&Us()&&(X.f&(be|Vt|ra|Co))!==0&&(Ke===null||!xn.call(Ke,e))&&ef();let r=n?et(t):t;return Et(e,r)}function Et(e,t){if(!e.equals(t)){var n=e.v;Bt?Rt.set(e,t):Rt.set(e,n),e.v=t;var r=At.ensure();if(r.capture(e,n),(e.f&be)!==0){const i=e;(e.f&_e)!==0&&aa(i),ia(i)}e.wv=Al(),sl(e,_e),ee!==null&&(ee.f&ye)!==0&&(ee.f&(ot|ln))===0&&(Ue===null?qf([e]):Ue.push(e)),!r.is_fork&&Ii.size>0&&!al&&Tf()}return t}function Tf(){al=!1;for(const e of Ii)(e.f&ye)!==0&&ue(e,rt),or(e)&&Cn(e);Ii.clear()}function Of(e,t=1){var n=y(e),r=t===1?n++:n--;return V(e,n),r}function Kn(e){V(e,e.v+1)}function sl(e,t){var n=e.reactions;if(n!==null)for(var r=n.length,i=0;i<r;i++){var a=n[i],o=a.f,s=(o&_e)===0;if(s&&ue(a,t),(o&be)!==0){var l=a;Qe?.delete(l),(o&an)===0&&(o&We&&(a.f|=an),sl(l,rt))}else s&&((o&Vt)!==0&&wt!==null&&wt.add(a),Xe(a))}}function et(e){if(typeof e!="object"||e===null||bn in e)return e;const t=na(e);if(t!==Os&&t!==Pu)return e;var n=new Map,r=ta(e),i=K(0),a=Xt,o=s=>{if(Xt===a)return s();var l=X,c=Xt;ze(null),Io(a);var f=s();return ze(l),Io(c),f};return r&&n.set("length",K(e.length)),new Proxy(e,{defineProperty(s,l,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&Qu();var f=n.get(l);return f===void 0?o(()=>{var u=K(c.value);return n.set(l,u),u}):V(f,c.value,!0),!0},deleteProperty(s,l){var c=n.get(l);if(c===void 0){if(l in s){const f=o(()=>K(ve));n.set(l,f),Kn(i)}}else V(c,ve),Kn(i);return!0},get(s,l,c){if(l===bn)return e;var f=n.get(l),u=l in s;if(f===void 0&&(!u||$t(s,l)?.writable)&&(f=o(()=>{var d=et(u?s[l]:ve),h=K(d);return h}),n.set(l,f)),f!==void 0){var p=y(f);return p===ve?void 0:p}return Reflect.get(s,l,c)},getOwnPropertyDescriptor(s,l){var c=Reflect.getOwnPropertyDescriptor(s,l);if(c&&"value"in c){var f=n.get(l);f&&(c.value=y(f))}else if(c===void 0){var u=n.get(l),p=u?.v;if(u!==void 0&&p!==ve)return{enumerable:!0,configurable:!0,value:p,writable:!0}}return c},has(s,l){if(l===bn)return!0;var c=n.get(l),f=c!==void 0&&c.v!==ve||Reflect.has(s,l);if(c!==void 0||ee!==null&&(!f||$t(s,l)?.writable)){c===void 0&&(c=o(()=>{var p=f?et(s[l]):ve,d=K(p);return d}),n.set(l,c));var u=y(c);if(u===ve)return!1}return f},set(s,l,c,f){var u=n.get(l),p=l in s;if(r&&l==="length")for(var d=c;d<u.v;d+=1){var h=n.get(d+"");h!==void 0?V(h,ve):d in s&&(h=o(()=>K(ve)),n.set(d+"",h))}if(u===void 0)(!p||$t(s,l)?.writable)&&(u=o(()=>K(void 0)),V(u,et(c)),n.set(l,u));else{p=u.v!==ve;var g=o(()=>et(c));V(u,g)}var m=Reflect.getOwnPropertyDescriptor(s,l);if(m?.set&&m.set.call(f,c),!p){if(r&&typeof l=="string"){var v=n.get("length"),w=Number(l);Number.isInteger(w)&&w>=v.v&&V(v,w+1)}Kn(i)}return!0},ownKeys(s){y(i);var l=Reflect.ownKeys(s).filter(u=>{var p=n.get(u);return p===void 0||p.v!==ve});for(var[c,f]of n)f.v!==ve&&!(c in s)&&l.push(c);return l},setPrototypeOf(){Xu()}})}var Ni,zr,ll,cl,ul;function $f(){if(Ni===void 0){Ni=window,zr=document,ll=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;cl=$t(t,"firstChild").get,ul=$t(t,"nextSibling").get,Eo(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Eo(n)&&(n.__t=void 0)}}function Ft(e=""){return document.createTextNode(e)}function Jt(e){return cl.call(e)}function ir(e){return ul.call(e)}function M(e,t){return Jt(e)}function Re(e,t=!1){{var n=Jt(e);return n instanceof Comment&&n.data===""?ir(n):n}}function F(e,t=1,n=!1){let r=e;for(;t--;)r=ir(r);return r}function Df(e){e.textContent=""}function fl(){return!1}function dl(e,t,n){return document.createElementNS(t??Bs,e,void 0)}let Mo=!1;function Rf(){Mo||(Mo=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(const t of e.target.elements)t.__on_r?.()})},{capture:!0}))}function Gr(e){var t=X,n=ee;ze(null),mt(null);try{return e()}finally{ze(t),mt(n)}}function pl(e,t,n,r=n){e.addEventListener(t,()=>Gr(n));const i=e.__on_r;i?e.__on_r=()=>{i(),r(!0)}:e.__on_r=()=>r(!0),Rf()}function Ff(e){ee===null&&(X===null&&Gu(),zu()),Bt&&Ku()}function Hf(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function Lt(e,t){var n=ee;n!==null&&(n.f&Fe)!==0&&(e|=Fe);var r={ctx:xe,deps:null,nodes:null,f:e|_e|We,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null},i=r;if((e&Tn)!==0)En!==null?En.push(r):Xe(r);else if(t!==null){try{Cn(r)}catch(o){throw $e(r),o}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&(i.f&$n)===0&&(i=i.first,(e&Vt)!==0&&(e&rn)!==0&&i!==null&&(i.f|=rn))}if(i!==null&&(i.parent=n,n!==null&&Hf(i,n),X!==null&&(X.f&be)!==0&&(e&ln)===0)){var a=X;(a.effects??=[]).push(i)}return r}function oa(){return X!==null&&!tt}function sa(e){const t=Lt(Zn,null);return ue(t,ye),t.teardown=e,t}function ht(e){Ff();var t=ee.f,n=!X&&(t&ot)!==0&&(t&On)===0;if(n){var r=xe;(r.e??=[]).push(e)}else return hl(e)}function hl(e){return Lt(Tn|qu,e)}function Pf(e){At.ensure();const t=Lt(ln|$n,e);return(n={})=>new Promise(r=>{n.outro?Qt(t,()=>{$e(t),r(void 0)}):($e(t),r(void 0))})}function ml(e){return Lt(Tn,e)}function Bf(e){return Lt(ra|$n,e)}function Zr(e,t=0){return Lt(Zn|t,e)}function te(e,t=[],n=[],r=[]){Cf(r,t,n,i=>{Lt(Zn,()=>e(...i.map(y)))})}function ar(e,t=0){var n=Lt(Vt|t,e);return n}function Ye(e){return Lt(ot|$n,e)}function gl(e){var t=e.teardown;if(t!==null){const n=Bt,r=X;Lo(!0),ze(null);try{t.call(null)}finally{Lo(n),ze(r)}}}function la(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const i=n.ac;i!==null&&Gr(()=>{i.abort(zt)});var r=n.next;(n.f&ln)!==0?n.parent=null:$e(n,t),n=r}}function jf(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&ot)===0&&$e(t),t=n}}function $e(e,t=!0){var n=!1;(t||(e.f&ju)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(vl(e.nodes.start,e.nodes.end),n=!0),la(e,t&&!n),Jn(e,0),ue(e,xt);var r=e.nodes&&e.nodes.t;if(r!==null)for(const a of r)a.stop();gl(e);var i=e.parent;i!==null&&i.first!==null&&yl(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function vl(e,t){for(;e!==null;){var n=e===t?null:ir(e);e.remove(),e=n}}function yl(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Qt(e,t,n=!0){var r=[];wl(e,r,!0);var i=()=>{n&&$e(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function wl(e,t,n){if((e.f&Fe)===0){e.f^=Fe;var r=e.nodes&&e.nodes.t;if(r!==null)for(const s of r)(s.is_global||n)&&t.push(s);for(var i=e.first;i!==null;){var a=i.next,o=(i.f&rn)!==0||(i.f&ot)!==0&&(e.f&Vt)!==0;wl(i,t,o?n:!1),i=a}}}function ca(e){bl(e,!0)}function bl(e,t){if((e.f&Fe)!==0){e.f^=Fe,(e.f&ye)===0&&(ue(e,_e),Xe(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&rn)!==0||(n.f&ot)!==0;bl(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(const o of a)(o.is_global||t)&&o.in()}}function _l(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:ir(n);t.append(n),n=i}}let _r=!1,Bt=!1;function Lo(e){Bt=e}let X=null,tt=!1;function ze(e){X=e}let ee=null;function mt(e){ee=e}let Ke=null;function kl(e){X!==null&&(Ke===null?Ke=[e]:Ke.push(e))}let Ne=null,De=0,Ue=null;function qf(e){Ue=e}let xl=1,Zt=0,Xt=Zt;function Io(e){Xt=e}function Al(){return++xl}function or(e){var t=e.f;if((t&_e)!==0)return!0;if(t&be&&(e.f&=~an),(t&rt)!==0){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(or(a)&&rl(a),a.wv>e.wv)return!0}(t&We)!==0&&Qe===null&&ue(e,ye)}return!1}function El(e,t,n=!0){var r=e.reactions;if(r!==null&&!(Ke!==null&&xn.call(Ke,e)))for(var i=0;i<r.length;i++){var a=r[i];(a.f&be)!==0?El(a,t,!1):t===a&&(n?ue(a,_e):(a.f&ye)!==0&&ue(a,rt),Xe(a))}}function Cl(e){var t=Ne,n=De,r=Ue,i=X,a=Ke,o=xe,s=tt,l=Xt,c=e.f;Ne=null,De=0,Ue=null,X=(c&(ot|ln))===0?e:null,Ke=null,An(e.ctx),tt=!1,Xt=++Zt,e.ac!==null&&(Gr(()=>{e.ac.abort(zt)}),e.ac=null);try{e.f|=Si;var f=e.fn,u=f();e.f|=On;var p=e.deps,d=ne?.is_fork;if(Ne!==null){var h;if(d||Jn(e,De),p!==null&&De>0)for(p.length=De+Ne.length,h=0;h<Ne.length;h++)p[De+h]=Ne[h];else e.deps=p=Ne;if(oa()&&(e.f&We)!==0)for(h=De;h<p.length;h++)(p[h].reactions??=[]).push(e)}else!d&&p!==null&&De<p.length&&(Jn(e,De),p.length=De);if(Us()&&Ue!==null&&!tt&&p!==null&&(e.f&(be|rt|_e))===0)for(h=0;h<Ue.length;h++)El(Ue[h],e);if(i!==null&&i!==e){if(Zt++,i.deps!==null)for(let g=0;g<n;g+=1)i.deps[g].rv=Zt;if(t!==null)for(const g of t)g.rv=Zt;Ue!==null&&(r===null?r=Ue:r.push(...Ue))}return(e.f&Dt)!==0&&(e.f^=Dt),u}catch(g){return Ks(g)}finally{e.f^=Si,Ne=t,De=n,Ue=r,X=i,Ke=a,An(o),tt=s,Xt=l}}function Vf(e,t){let n=t.reactions;if(n!==null){var r=Fu.call(n,e);if(r!==-1){var i=n.length-1;i===0?n=t.reactions=null:(n[r]=n[i],n.pop())}}if(n===null&&(t.f&be)!==0&&(Ne===null||!xn.call(Ne,t))){var a=t;(a.f&We)!==0&&(a.f^=We,a.f&=~an),ia(a),Nf(a),Jn(a,0)}}function Jn(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Vf(e,n[r])}function Cn(e){var t=e.f;if((t&xt)===0){ue(e,ye);var n=ee,r=_r;ee=e,_r=!0;try{(t&(Vt|Rs))!==0?jf(e):la(e),gl(e);var i=Cl(e);e.teardown=typeof i=="function"?i:null,e.wv=xl;var a;Ei&&gf&&(e.f&_e)!==0&&e.deps}finally{_r=r,ee=n}}}async function Uf(){await Promise.resolve(),Zs()}function y(e){var t=e.f,n=(t&be)!==0;if(X!==null&&!tt){var r=ee!==null&&(ee.f&xt)!==0;if(!r&&(Ke===null||!xn.call(Ke,e))){var i=X.deps;if((X.f&Si)!==0)e.rv<Zt&&(e.rv=Zt,Ne===null&&i!==null&&i[De]===e?De++:Ne===null?Ne=[e]:Ne.push(e));else{(X.deps??=[]).push(e);var a=e.reactions;a===null?e.reactions=[X]:xn.call(a,X)||a.push(X)}}}if(Bt&&Rt.has(e))return Rt.get(e);if(n){var o=e;if(Bt){var s=o.v;return((o.f&ye)===0&&o.reactions!==null||Ml(o))&&(s=aa(o)),Rt.set(o,s),s}var l=(o.f&We)===0&&!tt&&X!==null&&(_r||(X.f&We)!==0),c=(o.f&On)===0;or(o)&&(l&&(o.f|=We),rl(o)),l&&!c&&(il(o),Sl(o))}if(Qe?.has(e))return Qe.get(e);if((e.f&Dt)!==0)throw e.v;return e.v}function Sl(e){if(e.f|=We,e.deps!==null)for(const t of e.deps)(t.reactions??=[]).push(e),(t.f&be)!==0&&(t.f&We)===0&&(il(t),Sl(t))}function Ml(e){if(e.v===ve)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(Rt.has(t)||(t.f&be)!==0&&Ml(t))return!0;return!1}function Ut(e){var t=tt;try{return tt=!0,e()}finally{tt=t}}const Yf=["touchstart","touchmove"];function Wf(e){return Yf.includes(e)}const Un=Symbol("events"),Ll=new Set,Ti=new Set;function Kf(e,t,n,r={}){function i(a){if(r.capture||Oi.call(t,a),!a.cancelBubble)return Gr(()=>n?.call(this,a))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?ft(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function cn(e,t,n,r,i){var a={capture:r,passive:i},o=Kf(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&sa(()=>{t.removeEventListener(e,o,a)})}function oe(e,t,n){(t[Un]??={})[e]=n}function je(e){for(var t=0;t<e.length;t++)Ll.add(e[t]);for(var n of Ti)n(e)}let No=null;function Oi(e){var t=this,n=t.ownerDocument,r=e.type,i=e.composedPath?.()||[],a=i[0]||e.target;No=e;var o=0,s=No===e&&e[Un];if(s){var l=i.indexOf(s);if(l!==-1&&(t===document||t===window)){e[Un]=t;return}var c=i.indexOf(t);if(c===-1)return;l<=c&&(o=l)}if(a=i[o]||e.target,a!==t){Ts(e,"currentTarget",{configurable:!0,get(){return a||n}});var f=X,u=ee;ze(null),mt(null);try{for(var p,d=[];a!==null;){var h=a.assignedSlot||a.parentNode||a.host||null;try{var g=a[Un]?.[r];g!=null&&(!a.disabled||e.target===a)&&g.call(a,e)}catch(m){p?d.push(m):p=m}if(e.cancelBubble||h===t||h===null)break;a=h}if(p){for(let m of d)queueMicrotask(()=>{throw m});throw p}}finally{e[Un]=t,delete e.currentTarget,ze(f),mt(u)}}}const zf=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function Gf(e){return zf?.createHTML(e)??e}function Zf(e){var t=dl("template");return t.innerHTML=Gf(e.replaceAll("<!>","<!---->")),t.content}function Tr(e,t){var n=ee;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function z(e,t){var n=(t&ff)!==0,r=(t&df)!==0,i,a=!e.startsWith("<!>");return()=>{i===void 0&&(i=Zf(a?e:"<!>"+e),n||(i=Jt(i)));var o=r||ll?document.importNode(i,!0):i.cloneNode(!0);if(n){var s=Jt(o),l=o.lastChild;Tr(s,l)}else Tr(o,o);return o}}function Kt(){var e=document.createDocumentFragment(),t=document.createComment(""),n=Ft();return e.append(t,n),Tr(t,n),e}function W(e,t){e!==null&&e.before(t)}function fe(e,t){var n=t==null?"":typeof t=="object"?`${t}`:t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=`${n}`)}function Jf(e,t){return Qf(e,t)}const vr=new Map;function Qf(e,{target:t,anchor:n,props:r={},events:i,context:a,intro:o=!0,transformError:s}){$f();var l=void 0,c=Pf(()=>{var f=n??t.appendChild(Ft());Af(f,{pending:()=>{}},d=>{le({});var h=xe;a&&(h.c=a),i&&(r.$$events=i),l=e(d,r)||{},ce()},s);var u=new Set,p=d=>{for(var h=0;h<d.length;h++){var g=d[h];if(!u.has(g)){u.add(g);var m=Wf(g);for(const b of[t,document]){var v=vr.get(b);v===void 0&&(v=new Map,vr.set(b,v));var w=v.get(g);w===void 0?(b.addEventListener(g,Oi,{passive:m}),v.set(g,1)):v.set(g,w+1)}}}};return p(Yr(Ll)),Ti.add(p),()=>{for(var d of u)for(const m of[t,document]){var h=vr.get(m),g=h.get(d);--g==0?(m.removeEventListener(d,Oi),h.delete(d),h.size===0&&vr.delete(m)):h.set(d,g)}Ti.delete(p),f!==n&&f.parentNode?.removeChild(f)}});return Xf.set(l,c),l}let Xf=new WeakMap;class ua{anchor;#e=new Map;#s=new Map;#t=new Map;#o=new Set;#n=!0;constructor(t,n=!0){this.anchor=t,this.#n=n}#a=t=>{if(this.#e.has(t)){var n=this.#e.get(t),r=this.#s.get(n);if(r)ca(r),this.#o.delete(n);else{var i=this.#t.get(n);i&&(this.#s.set(n,i.effect),this.#t.delete(n),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),r=i.effect)}for(const[a,o]of this.#e){if(this.#e.delete(a),a===t)break;const s=this.#t.get(o);s&&($e(s.effect),this.#t.delete(o))}for(const[a,o]of this.#s){if(a===n||this.#o.has(a))continue;const s=()=>{if(Array.from(this.#e.values()).includes(a)){var c=document.createDocumentFragment();_l(o,c),c.append(Ft()),this.#t.set(a,{effect:o,fragment:c})}else $e(o);this.#o.delete(a),this.#s.delete(a)};this.#n||!r?(this.#o.add(a),Qt(o,s,!1)):s()}}};#r=t=>{this.#e.delete(t);const n=Array.from(this.#e.values());for(const[r,i]of this.#t)n.includes(r)||($e(i.effect),this.#t.delete(r))};ensure(t,n){var r=ne,i=fl();if(n&&!this.#s.has(t)&&!this.#t.has(t))if(i){var a=document.createDocumentFragment(),o=Ft();a.append(o),this.#t.set(t,{effect:Ye(()=>n(o)),fragment:a})}else this.#s.set(t,Ye(()=>n(this.anchor)));if(this.#e.set(r,t),i){for(const[s,l]of this.#s)s===t?r.unskip_effect(l):r.skip_effect(l);for(const[s,l]of this.#t)s===t?r.unskip_effect(l.effect):r.skip_effect(l.effect);r.oncommit(this.#a),r.ondiscard(this.#r)}else this.#a(r)}}const ed=0,To=1,td=2;function nt(e,t,n,r,i){var a=ve,o=St(a),s=St(a),l=new ua(e);ar(()=>{var c=t(),f=!1;if(Bu(c)){var u=tl(),p=!1;const d=h=>{if(!f){p=!0,u(!1),At.ensure();try{h()}finally{Nr(!1),_n||Zs()}}};c.then(h=>{d(()=>{Et(o,h),l.ensure(To,r&&(g=>r(g,o)))})},h=>{d(()=>{if(Et(s,h),l.ensure(td,i&&(g=>i(g,s))),!i)throw s.v})}),ft(()=>{p||d(()=>{l.ensure(ed,n)})})}else Et(o,c),l.ensure(To,r&&(d=>r(d,o)));return()=>{f=!0}})}function Ge(e,t,n=!1){var r=new ua(e),i=n?rn:0;function a(o,s){r.ensure(o,s)}ar(()=>{var o=!1;t((s,l=0)=>{o=!0,a(l,s)}),o||a(!1,null)},i)}function $i(e,t){return t}function nd(e,t,n){for(var r=[],i=t.length,a,o=t.length,s=0;s<i;s++){let u=t[s];Qt(u,()=>{if(a){if(a.pending.delete(u),a.done.add(u),a.pending.size===0){var p=e.outrogroups;Di(Yr(a.done)),p.delete(a),p.size===0&&(e.outrogroups=null)}}else o-=1},!1)}if(o===0){var l=r.length===0&&n!==null;if(l){var c=n,f=c.parentNode;Df(f),f.append(c),e.items.clear()}Di(t,!l)}else a={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(a)}function Di(e,t=!0){for(var n=0;n<e.length;n++)$e(e[n],t)}var Oo;function jt(e,t,n,r,i,a=null){var o=e,s=new Map,l=(t&Ps)!==0;if(l){var c=e;o=c.appendChild(Ft())}var f=null,u=nl(()=>{var v=n();return ta(v)?v:v==null?[]:Yr(v)}),p,d=!0;function h(){m.fallback=f,rd(m,p,o,t,r),f!==null&&(p.length===0?(f.f&_t)===0?ca(f):(f.f^=_t,Yn(f,null,o)):Qt(f,()=>{f=null}))}var g=ar(()=>{p=y(u);for(var v=p.length,w=new Set,b=ne,L=fl(),D=0;D<v;D+=1){var O=p[D],I=r(O,D),B=d?null:s.get(I);B?(B.v&&Et(B.v,O),B.i&&Et(B.i,D),L&&b.unskip_effect(B.e)):(B=id(s,d?o:Oo??=Ft(),O,I,D,i,t,n),d||(B.e.f|=_t),s.set(I,B)),w.add(I)}if(v===0&&a&&!f&&(d?f=Ye(()=>a(o)):(f=Ye(()=>a(Oo??=Ft())),f.f|=_t)),v>w.size&&Wu(),!d)if(L){for(const[G,q]of s)w.has(G)||b.skip_effect(q.e);b.oncommit(h),b.ondiscard(()=>{})}else h();y(u)}),m={effect:g,items:s,outrogroups:null,fallback:f};d=!1}function jn(e){for(;e!==null&&(e.f&ot)===0;)e=e.next;return e}function rd(e,t,n,r,i){var a=(r&af)!==0,o=t.length,s=e.items,l=jn(e.effect.first),c,f=null,u,p=[],d=[],h,g,m,v;if(a)for(v=0;v<o;v+=1)h=t[v],g=i(h,v),m=s.get(g).e,(m.f&_t)===0&&(m.nodes?.a?.measure(),(u??=new Set).add(m));for(v=0;v<o;v+=1){if(h=t[v],g=i(h,v),m=s.get(g).e,e.outrogroups!==null)for(const q of e.outrogroups)q.pending.delete(m),q.done.delete(m);if((m.f&_t)!==0)if(m.f^=_t,m===l)Yn(m,null,n);else{var w=f?f.next:l;m===e.effect.last&&(e.effect.last=m.prev),m.prev&&(m.prev.next=m.next),m.next&&(m.next.prev=m.prev),Nt(e,f,m),Nt(e,m,w),Yn(m,w,n),f=m,p=[],d=[],l=jn(f.next);continue}if((m.f&Fe)!==0&&(ca(m),a&&(m.nodes?.a?.unfix(),(u??=new Set).delete(m))),m!==l){if(c!==void 0&&c.has(m)){if(p.length<d.length){var b=d[0],L;f=b.prev;var D=p[0],O=p[p.length-1];for(L=0;L<p.length;L+=1)Yn(p[L],b,n);for(L=0;L<d.length;L+=1)c.delete(d[L]);Nt(e,D.prev,O.next),Nt(e,f,D),Nt(e,O,b),l=b,f=O,v-=1,p=[],d=[]}else c.delete(m),Yn(m,l,n),Nt(e,m.prev,m.next),Nt(e,m,f===null?e.effect.first:f.next),Nt(e,f,m),f=m;continue}for(p=[],d=[];l!==null&&l!==m;)(c??=new Set).add(l),d.push(l),l=jn(l.next);if(l===null)continue}(m.f&_t)===0&&p.push(m),f=m,l=jn(m.next)}if(e.outrogroups!==null){for(const q of e.outrogroups)q.pending.size===0&&(Di(Yr(q.done)),e.outrogroups?.delete(q));e.outrogroups.size===0&&(e.outrogroups=null)}if(l!==null||c!==void 0){var I=[];if(c!==void 0)for(m of c)(m.f&Fe)===0&&I.push(m);for(;l!==null;)(l.f&Fe)===0&&l!==e.fallback&&I.push(l),l=jn(l.next);var B=I.length;if(B>0){var G=(r&Ps)!==0&&o===0?n:null;if(a){for(v=0;v<B;v+=1)I[v].nodes?.a?.measure();for(v=0;v<B;v+=1)I[v].nodes?.a?.fix()}nd(e,I,G)}}a&&ft(()=>{if(u!==void 0)for(m of u)m.nodes?.a?.apply()})}function id(e,t,n,r,i,a,o,s){var l=(o&nf)!==0?(o&of)===0?ol(n,!1,!1):St(n):null,c=(o&rf)!==0?St(i):null;return{v:l,i:c,e:Ye(()=>(a(t,l??n,c??i,s),()=>{e.delete(r)}))}}function Yn(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&(t.f&_t)===0?t.nodes.start:n;r!==null;){var o=ir(r);if(a.before(r),r===i)return;r=o}}function Nt(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function He(e,t,n=!1,r=!1,i=!1){var a=e,o="";te(()=>{var s=ee;if(o!==(o=t()??"")&&(s.nodes!==null&&(vl(s.nodes.start,s.nodes.end),s.nodes=null),o!=="")){var l=n?pf:r?hf:void 0,c=dl(n?"svg":r?"math":"template",l);c.innerHTML=o;var f=n||r?c:c.content;if(Tr(Jt(f),f.lastChild),n||r)for(;Jt(f);)a.before(Jt(f));else a.before(f)}})}function kr(e,t,n){var r=new ua(e);ar(()=>{var i=t()??null;r.ensure(i,i&&(a=>n(a,i)))},rn)}function ad(e,t,n){ml(()=>{var r=Ut(()=>t(e,n?.())||{});if(r?.destroy)return()=>r.destroy()})}const $o=[...`
|
|
2
|
+
\r\f \v\uFEFF`];function od(e,t,n){var r=e==null?"":""+e;if(n){for(var i of Object.keys(n))if(n[i])r=r?r+" "+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||$o.includes(r[o-1]))&&(s===r.length||$o.includes(r[s]))?r=(o===0?"":r.substring(0,o))+r.substring(s+1):o=s}}return r===""?null:r}function Do(e,t=!1){var n=t?" !important;":";",r="";for(var i of Object.keys(e)){var a=e[i];a!=null&&a!==""&&(r+=" "+i+": "+a+n)}return r}function sd(e,t){if(t){var n="",r,i;return Array.isArray(t)?(r=t[0],i=t[1]):r=t,r&&(n+=Do(r)),i&&(n+=Do(i,!0)),n=n.trim(),n===""?null:n}return String(e)}function Il(e,t,n,r,i,a){var o=e.__className;if(o!==n||o===void 0){var s=od(n,r,a);s==null?e.removeAttribute("class"):e.className=s,e.__className=n}else if(a&&i!==a)for(var l in a){var c=!!a[l];(i==null||c!==!!i[l])&&e.classList.toggle(l,c)}return a}function hi(e,t={},n,r){for(var i in n){var a=n[i];t[i]!==a&&(n[i]==null?e.style.removeProperty(i):e.style.setProperty(i,a,r))}}function ld(e,t,n,r){var i=e.__style;if(i!==t){var a=sd(t,r);a==null?e.removeAttribute("style"):e.style.cssText=a,e.__style=t}else r&&(Array.isArray(r)?(hi(e,n?.[0],r[0]),hi(e,n?.[1],r[1],"important")):hi(e,n,r));return r}const cd=Symbol("is custom element"),ud=Symbol("is html"),fd=Uu?"progress":"PROGRESS";function dd(e,t){var n=Nl(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==fd)||(e.value=t??"")}function J(e,t,n,r){var i=Nl(e);i[t]!==(i[t]=n)&&(t==="loading"&&(e[Vu]=n),n==null?e.removeAttribute(t):typeof n!="string"&&pd(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function Nl(e){return e.__attributes??={[cd]:e.nodeName.includes("-"),[ud]:e.namespaceURI===Bs}}var Ro=new Map;function pd(e){var t=e.getAttribute("is")||e.nodeName,n=Ro.get(t);if(n)return n;Ro.set(t,n=[]);for(var r,i=e,a=Element.prototype;a!==i;){r=Hu(i);for(var o in r)r[o].set&&n.push(o);i=na(i)}return n}function Ht(e,t,n=t){var r=new WeakSet;pl(e,"input",async i=>{var a=i?e.defaultValue:e.value;if(a=mi(e)?gi(a):a,n(a),ne!==null&&r.add(ne),await Uf(),a!==(a=t())){var o=e.selectionStart,s=e.selectionEnd,l=e.value.length;if(e.value=a??"",s!==null){var c=e.value.length;o===s&&s===l&&c>l?(e.selectionStart=c,e.selectionEnd=c):(e.selectionStart=o,e.selectionEnd=Math.min(s,c))}}}),Ut(t)==null&&e.value&&(n(mi(e)?gi(e.value):e.value),ne!==null&&r.add(ne)),Zr(()=>{var i=t();if(e===document.activeElement){var a=Li??ne;if(r.has(a))return}mi(e)&&i===gi(e.value)||e.type==="date"&&!i&&!e.value||i!==e.value&&(e.value=i??"")})}function hd(e,t,n=t){pl(e,"change",r=>{var i=r?e.defaultChecked:e.checked;n(i)}),Ut(t)==null&&n(e.checked),Zr(()=>{var r=t();e.checked=!!r})}function mi(e){var t=e.type;return t==="number"||t==="range"}function gi(e){return e===""?null:+e}function Fo(e,t){return e===t||e?.[bn]===t}function Sn(e={},t,n,r){return ml(()=>{var i,a;return Zr(()=>{i=a,a=[],Ut(()=>{e!==n(...a)&&(t(e,...a),i&&Fo(n(...i),e)&&t(null,...i))})}),()=>{ft(()=>{a&&Fo(n(...a),e)&&t(null,...a)})}}),e}function fa(e,t,n){if(e==null)return t(void 0),n&&n(void 0),kt;const r=Ut(()=>e.subscribe(t,n));return r.unsubscribe?()=>r.unsubscribe():r}const dn=[];function Tl(e,t){return{subscribe:gt(e,t).subscribe}}function gt(e,t=kt){let n=null;const r=new Set;function i(s){if(qs(e,s)&&(e=s,n)){const l=!dn.length;for(const c of r)c[1](),dn.push(c,e);if(l){for(let c=0;c<dn.length;c+=2)dn[c][0](dn[c+1]);dn.length=0}}}function a(s){i(s(e))}function o(s,l=kt){const c=[s,l];return r.add(c),r.size===1&&(n=t(i,a)||kt),s(e),()=>{r.delete(c),r.size===0&&n&&(n(),n=null)}}return{set:i,update:a,subscribe:o}}function md(e,t,n){const r=!Array.isArray(e),i=r?[e]:e;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const a=t.length<2;return Tl(n,(o,s)=>{let l=!1;const c=[];let f=0,u=kt;const p=()=>{if(f)return;u();const h=t(r?c[0]:c,o,s);a?o(h):u=typeof h=="function"?h:kt},d=i.map((h,g)=>fa(h,m=>{c[g]=m,f&=~(1<<g),l&&p()},()=>{f|=1<<g}));return l=!0,p(),function(){$s(d),u(),l=!1}})}function Be(e){let t;return fa(e,n=>t=n)(),t}let yr=!1,Ri=Symbol();function P(e,t,n){const r=n[t]??={store:null,source:ol(void 0),unsubscribe:kt};if(r.store!==e&&!(Ri in n))if(r.unsubscribe(),r.store=e??null,e==null)r.source.v=void 0,r.unsubscribe=kt;else{var i=!0;r.unsubscribe=fa(e,a=>{i?r.source.v=a:V(r.source,a)}),i=!1}return e&&Ri in n?Be(e):y(r.source)}function re(e,t){return e.set(t),t}function me(){const e={};function t(){sa(()=>{for(var n in e)e[n].unsubscribe();Ts(e,Ri,{enumerable:!1,value:!0})})}return[e,t]}function gd(e){var t=yr;try{return yr=!1,[e(),yr]}finally{yr=t}}const vd={get(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(Bn(r)&&(r=r()),typeof r=="object"&&r!==null&&t in r)return r[t]}},set(e,t,n){let r=e.props.length;for(;r--;){let i=e.props[r];Bn(i)&&(i=i());const a=$t(i,t);if(a&&a.set)return a.set(n),!0}return!1},getOwnPropertyDescriptor(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(Bn(r)&&(r=r()),typeof r=="object"&&r!==null&&t in r){const i=$t(r,t);return i&&!i.configurable&&(i.configurable=!0),i}}},has(e,t){if(t===bn||t===Fs)return!1;for(let n of e.props)if(Bn(n)&&(n=n()),n!=null&&t in n)return!0;return!1},ownKeys(e){const t=[];for(let n of e.props)if(Bn(n)&&(n=n()),!!n){for(const r in n)t.includes(r)||t.push(r);for(const r of Object.getOwnPropertySymbols(n))t.includes(r)||t.push(r)}return t}};function xr(...e){return new Proxy({props:e},vd)}function Pe(e,t,n,r){var i=(n&cf)!==0,a=(n&uf)!==0,o=r,s=!0,l=()=>(s&&(s=!1,o=a?Ut(r):r),o),c;if(i){var f=bn in e||Fs in e;c=$t(e,t)?.set??(f&&t in e?w=>e[t]=w:void 0)}var u,p=!1;i?[u,p]=gd(()=>e[t]):u=e[t],u===void 0&&r!==void 0&&(u=l(),c&&(Ju(),c(u)));var d;if(d=()=>{var w=e[t];return w===void 0?l():(s=!0,w)},(n&lf)===0)return d;if(c){var h=e.$$legacy;return(function(w,b){return arguments.length>0?((!b||h||p)&&c(b?d():w),w):d()})}var g=!1,m=((n&sf)!==0?Kr:nl)(()=>(g=!1,d()));i&&y(m);var v=ee;return(function(w,b){if(arguments.length>0){const L=b?y(m):i?et(w):w;return V(m,L),g=!0,o!==void 0&&(o=L),w}return Bt&&g||(v.f&xt)!==0?m.v:y(m)})}function qe(e){xe===null&&Hs(),ht(()=>{const t=Ut(e);if(typeof t=="function")return t})}const yd="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(yd);const wd='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>text-box-multiple</title><path d="M16,15H9V13H16M19,11H9V9H19M19,7H9V5H19M21,1H7C5.89,1 5,1.89 5,3V17C5,18.11 5.9,19 7,19H21C22.11,19 23,18.11 23,17V3C23,1.89 22.1,1 21,1M3,5V21H19V23H3A2,2 0 0,1 1,21V5H3Z" /></svg>',bd='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>folder-multiple-image</title><path d="M7,15L11.5,9L15,13.5L17.5,10.5L21,15M22,4H14L12,2H6A2,2 0 0,0 4,4V16A2,2 0 0,0 6,18H22A2,2 0 0,0 24,16V6A2,2 0 0,0 22,4M2,6H0V11H0V20A2,2 0 0,0 2,22H20V20H2V6Z" /></svg>',_d='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>logout</title><path d="M16,17V14H9V10H16V7L21,12L16,17M14,2A2,2 0 0,1 16,4V6H14V4H5V20H14V18H16V20A2,2 0 0,1 14,22H5A2,2 0 0,1 3,20V4A2,2 0 0,1 5,2H14Z" /></svg>';function Ol(e){return typeof e>"u"||e===null}function kd(e){return typeof e=="object"&&e!==null}function xd(e){return Array.isArray(e)?e:Ol(e)?[]:[e]}function Ad(e,t){var n,r,i,a;if(t)for(a=Object.keys(t),n=0,r=a.length;n<r;n+=1)i=a[n],e[i]=t[i];return e}function Ed(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function Cd(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var Sd=Ol,Md=kd,Ld=xd,Id=Ed,Nd=Cd,Td=Ad,he={isNothing:Sd,isObject:Md,toArray:Ld,repeat:Id,isNegativeZero:Nd,extend:Td};function $l(e,t){var n="",r=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+=`
|
|
3
3
|
|
|
4
|
-
`+e.mark.snippet),r+" "+n):r}function
|
|
5
|
-
`+s;for(c=
|
|
6
|
-
`,s+=
|
|
7
|
-
`,l=1;l<=t.linesAfter&&!(o+l>=i.length);l++)c=
|
|
8
|
-
`;return s.replace(/\n$/,"")}var
|
|
9
|
-
\r`;function
|
|
10
|
-
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"
":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}function
|
|
11
|
-
`,t-1))}function
|
|
12
|
-
`,a?1+l:l):i===
|
|
13
|
-
`);break}for(r?
|
|
14
|
-
`,a?1+l:l)):c?(c=!1,e.result+=
|
|
15
|
-
`,l+1)):l===0?a&&(e.result+=" "):e.result+=
|
|
16
|
-
`,l):e.result+=
|
|
17
|
-
`,a?1+l:l),a=!0,o=!0,l=0,n=e.position;!
|
|
18
|
-
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new
|
|
4
|
+
`+e.mark.snippet),r+" "+n):r}function Qn(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=$l(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Qn.prototype=Object.create(Error.prototype);Qn.prototype.constructor=Qn;Qn.prototype.toString=function(t){return this.name+": "+$l(this,t)};var Se=Qn;function vi(e,t,n,r,i){var a="",o="",s=Math.floor(i/2)-1;return r-t>s&&(a=" ... ",t=r-s+a.length),n-r>s&&(o=" ...",n=r+s-o.length),{str:a+e.slice(t,n).replace(/\t/g,"→")+o,pos:r-t+a.length}}function yi(e,t){return he.repeat(" ",t-e.length)+e}function Od(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var n=/\r?\n|\r|\0/g,r=[0],i=[],a,o=-1;a=n.exec(e.buffer);)i.push(a.index),r.push(a.index+a[0].length),e.position<=a.index&&o<0&&(o=r.length-2);o<0&&(o=r.length-1);var s="",l,c,f=Math.min(e.line+t.linesAfter,i.length).toString().length,u=t.maxLength-(t.indent+f+3);for(l=1;l<=t.linesBefore&&!(o-l<0);l++)c=vi(e.buffer,r[o-l],i[o-l],e.position-(r[o]-r[o-l]),u),s=he.repeat(" ",t.indent)+yi((e.line-l+1).toString(),f)+" | "+c.str+`
|
|
5
|
+
`+s;for(c=vi(e.buffer,r[o],i[o],e.position,u),s+=he.repeat(" ",t.indent)+yi((e.line+1).toString(),f)+" | "+c.str+`
|
|
6
|
+
`,s+=he.repeat("-",t.indent+f+3+c.pos)+`^
|
|
7
|
+
`,l=1;l<=t.linesAfter&&!(o+l>=i.length);l++)c=vi(e.buffer,r[o+l],i[o+l],e.position-(r[o]-r[o+l]),u),s+=he.repeat(" ",t.indent)+yi((e.line+l+1).toString(),f)+" | "+c.str+`
|
|
8
|
+
`;return s.replace(/\n$/,"")}var $d=Od,Dd=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Rd=["scalar","sequence","mapping"];function Fd(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function Hd(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(Dd.indexOf(n)===-1)throw new Se('Unknown option "'+n+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(n){return n},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=Fd(t.styleAliases||null),Rd.indexOf(this.kind)===-1)throw new Se('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var we=Hd;function Ho(e,t){var n=[];return e[t].forEach(function(r){var i=n.length;n.forEach(function(a,o){a.tag===r.tag&&a.kind===r.kind&&a.multi===r.multi&&(i=o)}),n[i]=r}),n}function Pd(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,n;function r(i){i.multi?(e.multi[i.kind].push(i),e.multi.fallback.push(i)):e[i.kind][i.tag]=e.fallback[i.tag]=i}for(t=0,n=arguments.length;t<n;t+=1)arguments[t].forEach(r);return e}function Fi(e){return this.extend(e)}Fi.prototype.extend=function(t){var n=[],r=[];if(t instanceof we)r.push(t);else if(Array.isArray(t))r=r.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(n=n.concat(t.implicit)),t.explicit&&(r=r.concat(t.explicit));else throw new Se("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(a){if(!(a instanceof we))throw new Se("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(a.loadKind&&a.loadKind!=="scalar")throw new Se("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(a.multi)throw new Se("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(a){if(!(a instanceof we))throw new Se("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(Fi.prototype);return i.implicit=(this.implicit||[]).concat(n),i.explicit=(this.explicit||[]).concat(r),i.compiledImplicit=Ho(i,"implicit"),i.compiledExplicit=Ho(i,"explicit"),i.compiledTypeMap=Pd(i.compiledImplicit,i.compiledExplicit),i};var Dl=Fi,Rl=new we("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),Fl=new we("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Hl=new we("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Pl=new Dl({explicit:[Rl,Fl,Hl]});function Bd(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function jd(){return null}function qd(e){return e===null}var Bl=new we("tag:yaml.org,2002:null",{kind:"scalar",resolve:Bd,construct:jd,predicate:qd,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Vd(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function Ud(e){return e==="true"||e==="True"||e==="TRUE"}function Yd(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var jl=new we("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Vd,construct:Ud,predicate:Yd,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function Wd(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function Kd(e){return 48<=e&&e<=55}function zd(e){return 48<=e&&e<=57}function Gd(e){if(e===null)return!1;var t=e.length,n=0,r=!1,i;if(!t)return!1;if(i=e[n],(i==="-"||i==="+")&&(i=e[++n]),i==="0"){if(n+1===t)return!0;if(i=e[++n],i==="b"){for(n++;n<t;n++)if(i=e[n],i!=="_"){if(i!=="0"&&i!=="1")return!1;r=!0}return r&&i!=="_"}if(i==="x"){for(n++;n<t;n++)if(i=e[n],i!=="_"){if(!Wd(e.charCodeAt(n)))return!1;r=!0}return r&&i!=="_"}if(i==="o"){for(n++;n<t;n++)if(i=e[n],i!=="_"){if(!Kd(e.charCodeAt(n)))return!1;r=!0}return r&&i!=="_"}}if(i==="_")return!1;for(;n<t;n++)if(i=e[n],i!=="_"){if(!zd(e.charCodeAt(n)))return!1;r=!0}return!(!r||i==="_")}function Zd(e){var t=e,n=1,r;if(t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),r=t[0],(r==="-"||r==="+")&&(r==="-"&&(n=-1),t=t.slice(1),r=t[0]),t==="0")return 0;if(r==="0"){if(t[1]==="b")return n*parseInt(t.slice(2),2);if(t[1]==="x")return n*parseInt(t.slice(2),16);if(t[1]==="o")return n*parseInt(t.slice(2),8)}return n*parseInt(t,10)}function Jd(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!he.isNegativeZero(e)}var ql=new we("tag:yaml.org,2002:int",{kind:"scalar",resolve:Gd,construct:Zd,predicate:Jd,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Qd=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Xd(e){return!(e===null||!Qd.test(e)||e[e.length-1]==="_")}function ep(e){var t,n;return t=e.replace(/_/g,"").toLowerCase(),n=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:n*parseFloat(t,10)}var tp=/^[-+]?[0-9]+e/;function np(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(he.isNegativeZero(e))return"-0.0";return n=e.toString(10),tp.test(n)?n.replace("e",".e"):n}function rp(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||he.isNegativeZero(e))}var Vl=new we("tag:yaml.org,2002:float",{kind:"scalar",resolve:Xd,construct:ep,predicate:rp,represent:np,defaultStyle:"lowercase"}),Ul=Pl.extend({implicit:[Bl,jl,ql,Vl]}),Yl=Ul,Wl=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Kl=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function ip(e){return e===null?!1:Wl.exec(e)!==null||Kl.exec(e)!==null}function ap(e){var t,n,r,i,a,o,s,l=0,c=null,f,u,p;if(t=Wl.exec(e),t===null&&(t=Kl.exec(e)),t===null)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,r,i));if(a=+t[4],o=+t[5],s=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(f=+t[10],u=+(t[11]||0),c=(f*60+u)*6e4,t[9]==="-"&&(c=-c)),p=new Date(Date.UTC(n,r,i,a,o,s,l)),c&&p.setTime(p.getTime()-c),p}function op(e){return e.toISOString()}var zl=new we("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:ip,construct:ap,instanceOf:Date,represent:op});function sp(e){return e==="<<"||e===null}var Gl=new we("tag:yaml.org,2002:merge",{kind:"scalar",resolve:sp}),da=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
9
|
+
\r`;function lp(e){if(e===null)return!1;var t,n,r=0,i=e.length,a=da;for(n=0;n<i;n++)if(t=a.indexOf(e.charAt(n)),!(t>64)){if(t<0)return!1;r+=6}return r%8===0}function cp(e){var t,n,r=e.replace(/[\r\n=]/g,""),i=r.length,a=da,o=0,s=[];for(t=0;t<i;t++)t%4===0&&t&&(s.push(o>>16&255),s.push(o>>8&255),s.push(o&255)),o=o<<6|a.indexOf(r.charAt(t));return n=i%4*6,n===0?(s.push(o>>16&255),s.push(o>>8&255),s.push(o&255)):n===18?(s.push(o>>10&255),s.push(o>>2&255)):n===12&&s.push(o>>4&255),new Uint8Array(s)}function up(e){var t="",n=0,r,i,a=e.length,o=da;for(r=0;r<a;r++)r%3===0&&r&&(t+=o[n>>18&63],t+=o[n>>12&63],t+=o[n>>6&63],t+=o[n&63]),n=(n<<8)+e[r];return i=a%3,i===0?(t+=o[n>>18&63],t+=o[n>>12&63],t+=o[n>>6&63],t+=o[n&63]):i===2?(t+=o[n>>10&63],t+=o[n>>4&63],t+=o[n<<2&63],t+=o[64]):i===1&&(t+=o[n>>2&63],t+=o[n<<4&63],t+=o[64],t+=o[64]),t}function fp(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var Zl=new we("tag:yaml.org,2002:binary",{kind:"scalar",resolve:lp,construct:cp,predicate:fp,represent:up}),dp=Object.prototype.hasOwnProperty,pp=Object.prototype.toString;function hp(e){if(e===null)return!0;var t=[],n,r,i,a,o,s=e;for(n=0,r=s.length;n<r;n+=1){if(i=s[n],o=!1,pp.call(i)!=="[object Object]")return!1;for(a in i)if(dp.call(i,a))if(!o)o=!0;else return!1;if(!o)return!1;if(t.indexOf(a)===-1)t.push(a);else return!1}return!0}function mp(e){return e!==null?e:[]}var Jl=new we("tag:yaml.org,2002:omap",{kind:"sequence",resolve:hp,construct:mp}),gp=Object.prototype.toString;function vp(e){if(e===null)return!0;var t,n,r,i,a,o=e;for(a=new Array(o.length),t=0,n=o.length;t<n;t+=1){if(r=o[t],gp.call(r)!=="[object Object]"||(i=Object.keys(r),i.length!==1))return!1;a[t]=[i[0],r[i[0]]]}return!0}function yp(e){if(e===null)return[];var t,n,r,i,a,o=e;for(a=new Array(o.length),t=0,n=o.length;t<n;t+=1)r=o[t],i=Object.keys(r),a[t]=[i[0],r[i[0]]];return a}var Ql=new we("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:vp,construct:yp}),wp=Object.prototype.hasOwnProperty;function bp(e){if(e===null)return!0;var t,n=e;for(t in n)if(wp.call(n,t)&&n[t]!==null)return!1;return!0}function _p(e){return e!==null?e:{}}var Xl=new we("tag:yaml.org,2002:set",{kind:"mapping",resolve:bp,construct:_p}),pa=Yl.extend({implicit:[zl,Gl],explicit:[Zl,Jl,Ql,Xl]}),qt=Object.prototype.hasOwnProperty,Or=1,ec=2,tc=3,$r=4,wi=1,kp=2,Po=3,xp=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Ap=/[\x85\u2028\u2029]/,Ep=/[,\[\]\{\}]/,nc=/^(?:!|!!|![a-z\-]+!)$/i,rc=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Bo(e){return Object.prototype.toString.call(e)}function pt(e){return e===10||e===13}function en(e){return e===9||e===32}function Oe(e){return e===9||e===32||e===10||e===13}function vn(e){return e===44||e===91||e===93||e===123||e===125}function Cp(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function Sp(e){return e===120?2:e===117?4:e===85?8:0}function Mp(e){return 48<=e&&e<=57?e-48:-1}function jo(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
|
|
10
|
+
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"
":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}function Lp(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function ic(e,t,n){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}var ac=new Array(256),oc=new Array(256);for(var pn=0;pn<256;pn++)ac[pn]=jo(pn)?1:0,oc[pn]=jo(pn);function Ip(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||pa,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function sc(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=$d(n),new Se(t,n)}function H(e,t){throw sc(e,t)}function Dr(e,t){e.onWarning&&e.onWarning.call(null,sc(e,t))}var qo={YAML:function(t,n,r){var i,a,o;t.version!==null&&H(t,"duplication of %YAML directive"),r.length!==1&&H(t,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),i===null&&H(t,"ill-formed argument of the YAML directive"),a=parseInt(i[1],10),o=parseInt(i[2],10),a!==1&&H(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=o<2,o!==1&&o!==2&&Dr(t,"unsupported YAML version of the document")},TAG:function(t,n,r){var i,a;r.length!==2&&H(t,"TAG directive accepts exactly two arguments"),i=r[0],a=r[1],nc.test(i)||H(t,"ill-formed tag handle (first argument) of the TAG directive"),qt.call(t.tagMap,i)&&H(t,'there is a previously declared suffix for "'+i+'" tag handle'),rc.test(a)||H(t,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch{H(t,"tag prefix is malformed: "+a)}t.tagMap[i]=a}};function Pt(e,t,n,r){var i,a,o,s;if(t<n){if(s=e.input.slice(t,n),r)for(i=0,a=s.length;i<a;i+=1)o=s.charCodeAt(i),o===9||32<=o&&o<=1114111||H(e,"expected valid JSON character");else xp.test(s)&&H(e,"the stream contains non-printable characters");e.result+=s}}function Vo(e,t,n,r){var i,a,o,s;for(he.isObject(n)||H(e,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(n),o=0,s=i.length;o<s;o+=1)a=i[o],qt.call(t,a)||(ic(t,a,n[a]),r[a]=!0)}function yn(e,t,n,r,i,a,o,s,l){var c,f;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),c=0,f=i.length;c<f;c+=1)Array.isArray(i[c])&&H(e,"nested arrays are not supported inside keys"),typeof i=="object"&&Bo(i[c])==="[object Object]"&&(i[c]="[object Object]");if(typeof i=="object"&&Bo(i)==="[object Object]"&&(i="[object Object]"),i=String(i),t===null&&(t={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(a))for(c=0,f=a.length;c<f;c+=1)Vo(e,t,a[c],n);else Vo(e,t,a,n);else!e.json&&!qt.call(n,i)&&qt.call(t,i)&&(e.line=o||e.line,e.lineStart=s||e.lineStart,e.position=l||e.position,H(e,"duplicated mapping key")),ic(t,i,a),delete n[i];return t}function ha(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):H(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function de(e,t,n){for(var r=0,i=e.input.charCodeAt(e.position);i!==0;){for(;en(i);)i===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(t&&i===35)do i=e.input.charCodeAt(++e.position);while(i!==10&&i!==13&&i!==0);if(pt(i))for(ha(e),i=e.input.charCodeAt(e.position),r++,e.lineIndent=0;i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position);else break}return n!==-1&&r!==0&&e.lineIndent<n&&Dr(e,"deficient indentation"),r}function Jr(e){var t=e.position,n;return n=e.input.charCodeAt(t),!!((n===45||n===46)&&n===e.input.charCodeAt(t+1)&&n===e.input.charCodeAt(t+2)&&(t+=3,n=e.input.charCodeAt(t),n===0||Oe(n)))}function ma(e,t){t===1?e.result+=" ":t>1&&(e.result+=he.repeat(`
|
|
11
|
+
`,t-1))}function Np(e,t,n){var r,i,a,o,s,l,c,f,u=e.kind,p=e.result,d;if(d=e.input.charCodeAt(e.position),Oe(d)||vn(d)||d===35||d===38||d===42||d===33||d===124||d===62||d===39||d===34||d===37||d===64||d===96||(d===63||d===45)&&(i=e.input.charCodeAt(e.position+1),Oe(i)||n&&vn(i)))return!1;for(e.kind="scalar",e.result="",a=o=e.position,s=!1;d!==0;){if(d===58){if(i=e.input.charCodeAt(e.position+1),Oe(i)||n&&vn(i))break}else if(d===35){if(r=e.input.charCodeAt(e.position-1),Oe(r))break}else{if(e.position===e.lineStart&&Jr(e)||n&&vn(d))break;if(pt(d))if(l=e.line,c=e.lineStart,f=e.lineIndent,de(e,!1,-1),e.lineIndent>=t){s=!0,d=e.input.charCodeAt(e.position);continue}else{e.position=o,e.line=l,e.lineStart=c,e.lineIndent=f;break}}s&&(Pt(e,a,o,!1),ma(e,e.line-l),a=o=e.position,s=!1),en(d)||(o=e.position+1),d=e.input.charCodeAt(++e.position)}return Pt(e,a,o,!1),e.result?!0:(e.kind=u,e.result=p,!1)}function Tp(e,t){var n,r,i;if(n=e.input.charCodeAt(e.position),n!==39)return!1;for(e.kind="scalar",e.result="",e.position++,r=i=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(Pt(e,r,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)r=e.position,e.position++,i=e.position;else return!0;else pt(n)?(Pt(e,r,i,!0),ma(e,de(e,!1,t)),r=i=e.position):e.position===e.lineStart&&Jr(e)?H(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);H(e,"unexpected end of the stream within a single quoted scalar")}function Op(e,t){var n,r,i,a,o,s;if(s=e.input.charCodeAt(e.position),s!==34)return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;(s=e.input.charCodeAt(e.position))!==0;){if(s===34)return Pt(e,n,e.position,!0),e.position++,!0;if(s===92){if(Pt(e,n,e.position,!0),s=e.input.charCodeAt(++e.position),pt(s))de(e,!1,t);else if(s<256&&ac[s])e.result+=oc[s],e.position++;else if((o=Sp(s))>0){for(i=o,a=0;i>0;i--)s=e.input.charCodeAt(++e.position),(o=Cp(s))>=0?a=(a<<4)+o:H(e,"expected hexadecimal character");e.result+=Lp(a),e.position++}else H(e,"unknown escape sequence");n=r=e.position}else pt(s)?(Pt(e,n,r,!0),ma(e,de(e,!1,t)),n=r=e.position):e.position===e.lineStart&&Jr(e)?H(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}H(e,"unexpected end of the stream within a double quoted scalar")}function $p(e,t){var n=!0,r,i,a,o=e.tag,s,l=e.anchor,c,f,u,p,d,h=Object.create(null),g,m,v,w;if(w=e.input.charCodeAt(e.position),w===91)f=93,d=!1,s=[];else if(w===123)f=125,d=!0,s={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=s),w=e.input.charCodeAt(++e.position);w!==0;){if(de(e,!0,t),w=e.input.charCodeAt(e.position),w===f)return e.position++,e.tag=o,e.anchor=l,e.kind=d?"mapping":"sequence",e.result=s,!0;n?w===44&&H(e,"expected the node content, but found ','"):H(e,"missed comma between flow collection entries"),m=g=v=null,u=p=!1,w===63&&(c=e.input.charCodeAt(e.position+1),Oe(c)&&(u=p=!0,e.position++,de(e,!0,t))),r=e.line,i=e.lineStart,a=e.position,Mn(e,t,Or,!1,!0),m=e.tag,g=e.result,de(e,!0,t),w=e.input.charCodeAt(e.position),(p||e.line===r)&&w===58&&(u=!0,w=e.input.charCodeAt(++e.position),de(e,!0,t),Mn(e,t,Or,!1,!0),v=e.result),d?yn(e,s,h,m,g,v,r,i,a):u?s.push(yn(e,null,h,m,g,v,r,i,a)):s.push(g),de(e,!0,t),w=e.input.charCodeAt(e.position),w===44?(n=!0,w=e.input.charCodeAt(++e.position)):n=!1}H(e,"unexpected end of the stream within a flow collection")}function Dp(e,t){var n,r,i=wi,a=!1,o=!1,s=t,l=0,c=!1,f,u;if(u=e.input.charCodeAt(e.position),u===124)r=!1;else if(u===62)r=!0;else return!1;for(e.kind="scalar",e.result="";u!==0;)if(u=e.input.charCodeAt(++e.position),u===43||u===45)wi===i?i=u===43?Po:kp:H(e,"repeat of a chomping mode identifier");else if((f=Mp(u))>=0)f===0?H(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?H(e,"repeat of an indentation width identifier"):(s=t+f-1,o=!0);else break;if(en(u)){do u=e.input.charCodeAt(++e.position);while(en(u));if(u===35)do u=e.input.charCodeAt(++e.position);while(!pt(u)&&u!==0)}for(;u!==0;){for(ha(e),e.lineIndent=0,u=e.input.charCodeAt(e.position);(!o||e.lineIndent<s)&&u===32;)e.lineIndent++,u=e.input.charCodeAt(++e.position);if(!o&&e.lineIndent>s&&(s=e.lineIndent),pt(u)){l++;continue}if(e.lineIndent<s){i===Po?e.result+=he.repeat(`
|
|
12
|
+
`,a?1+l:l):i===wi&&a&&(e.result+=`
|
|
13
|
+
`);break}for(r?en(u)?(c=!0,e.result+=he.repeat(`
|
|
14
|
+
`,a?1+l:l)):c?(c=!1,e.result+=he.repeat(`
|
|
15
|
+
`,l+1)):l===0?a&&(e.result+=" "):e.result+=he.repeat(`
|
|
16
|
+
`,l):e.result+=he.repeat(`
|
|
17
|
+
`,a?1+l:l),a=!0,o=!0,l=0,n=e.position;!pt(u)&&u!==0;)u=e.input.charCodeAt(++e.position);Pt(e,n,e.position,!1)}return!0}function Uo(e,t){var n,r=e.tag,i=e.anchor,a=[],o,s=!1,l;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),l=e.input.charCodeAt(e.position);l!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,H(e,"tab characters must not be used in indentation")),!(l!==45||(o=e.input.charCodeAt(e.position+1),!Oe(o))));){if(s=!0,e.position++,de(e,!0,-1)&&e.lineIndent<=t){a.push(null),l=e.input.charCodeAt(e.position);continue}if(n=e.line,Mn(e,t,tc,!1,!0),a.push(e.result),de(e,!0,-1),l=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&l!==0)H(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return s?(e.tag=r,e.anchor=i,e.kind="sequence",e.result=a,!0):!1}function Rp(e,t,n){var r,i,a,o,s,l,c=e.tag,f=e.anchor,u={},p=Object.create(null),d=null,h=null,g=null,m=!1,v=!1,w;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=u),w=e.input.charCodeAt(e.position);w!==0;){if(!m&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,H(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),a=e.line,(w===63||w===58)&&Oe(r))w===63?(m&&(yn(e,u,p,d,h,null,o,s,l),d=h=g=null),v=!0,m=!0,i=!0):m?(m=!1,i=!0):H(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,w=r;else{if(o=e.line,s=e.lineStart,l=e.position,!Mn(e,n,ec,!1,!0))break;if(e.line===a){for(w=e.input.charCodeAt(e.position);en(w);)w=e.input.charCodeAt(++e.position);if(w===58)w=e.input.charCodeAt(++e.position),Oe(w)||H(e,"a whitespace character is expected after the key-value separator within a block mapping"),m&&(yn(e,u,p,d,h,null,o,s,l),d=h=g=null),v=!0,m=!1,i=!1,d=e.tag,h=e.result;else if(v)H(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=c,e.anchor=f,!0}else if(v)H(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=c,e.anchor=f,!0}if((e.line===a||e.lineIndent>t)&&(m&&(o=e.line,s=e.lineStart,l=e.position),Mn(e,t,$r,!0,i)&&(m?h=e.result:g=e.result),m||(yn(e,u,p,d,h,g,o,s,l),d=h=g=null),de(e,!0,-1),w=e.input.charCodeAt(e.position)),(e.line===a||e.lineIndent>t)&&w!==0)H(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return m&&yn(e,u,p,d,h,null,o,s,l),v&&(e.tag=c,e.anchor=f,e.kind="mapping",e.result=u),v}function Fp(e){var t,n=!1,r=!1,i,a,o;if(o=e.input.charCodeAt(e.position),o!==33)return!1;if(e.tag!==null&&H(e,"duplication of a tag property"),o=e.input.charCodeAt(++e.position),o===60?(n=!0,o=e.input.charCodeAt(++e.position)):o===33?(r=!0,i="!!",o=e.input.charCodeAt(++e.position)):i="!",t=e.position,n){do o=e.input.charCodeAt(++e.position);while(o!==0&&o!==62);e.position<e.length?(a=e.input.slice(t,e.position),o=e.input.charCodeAt(++e.position)):H(e,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!Oe(o);)o===33&&(r?H(e,"tag suffix cannot contain exclamation marks"):(i=e.input.slice(t-1,e.position+1),nc.test(i)||H(e,"named tag handle cannot contain such characters"),r=!0,t=e.position+1)),o=e.input.charCodeAt(++e.position);a=e.input.slice(t,e.position),Ep.test(a)&&H(e,"tag suffix cannot contain flow indicator characters")}a&&!rc.test(a)&&H(e,"tag name cannot contain such characters: "+a);try{a=decodeURIComponent(a)}catch{H(e,"tag name is malformed: "+a)}return n?e.tag=a:qt.call(e.tagMap,i)?e.tag=e.tagMap[i]+a:i==="!"?e.tag="!"+a:i==="!!"?e.tag="tag:yaml.org,2002:"+a:H(e,'undeclared tag handle "'+i+'"'),!0}function Hp(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&H(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!Oe(n)&&!vn(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&H(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function Pp(e){var t,n,r;if(r=e.input.charCodeAt(e.position),r!==42)return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!Oe(r)&&!vn(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&H(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),qt.call(e.anchorMap,n)||H(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],de(e,!0,-1),!0}function Mn(e,t,n,r,i){var a,o,s,l=1,c=!1,f=!1,u,p,d,h,g,m;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,a=o=s=$r===n||tc===n,r&&de(e,!0,-1)&&(c=!0,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)),l===1)for(;Fp(e)||Hp(e);)de(e,!0,-1)?(c=!0,s=a,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)):s=!1;if(s&&(s=c||i),(l===1||$r===n)&&(Or===n||ec===n?g=t:g=t+1,m=e.position-e.lineStart,l===1?s&&(Uo(e,m)||Rp(e,m,g))||$p(e,g)?f=!0:(o&&Dp(e,g)||Tp(e,g)||Op(e,g)?f=!0:Pp(e)?(f=!0,(e.tag!==null||e.anchor!==null)&&H(e,"alias node should not have any properties")):Np(e,g,Or===n)&&(f=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):l===0&&(f=s&&Uo(e,m))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&H(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),u=0,p=e.implicitTypes.length;u<p;u+=1)if(h=e.implicitTypes[u],h.resolve(e.result)){e.result=h.construct(e.result),e.tag=h.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(qt.call(e.typeMap[e.kind||"fallback"],e.tag))h=e.typeMap[e.kind||"fallback"][e.tag];else for(h=null,d=e.typeMap.multi[e.kind||"fallback"],u=0,p=d.length;u<p;u+=1)if(e.tag.slice(0,d[u].tag.length)===d[u].tag){h=d[u];break}h||H(e,"unknown tag !<"+e.tag+">"),e.result!==null&&h.kind!==e.kind&&H(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+h.kind+'", not "'+e.kind+'"'),h.resolve(e.result,e.tag)?(e.result=h.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):H(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||f}function Bp(e){var t=e.position,n,r,i,a=!1,o;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(o=e.input.charCodeAt(e.position))!==0&&(de(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||o!==37));){for(a=!0,o=e.input.charCodeAt(++e.position),n=e.position;o!==0&&!Oe(o);)o=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),i=[],r.length<1&&H(e,"directive name must not be less than one character in length");o!==0;){for(;en(o);)o=e.input.charCodeAt(++e.position);if(o===35){do o=e.input.charCodeAt(++e.position);while(o!==0&&!pt(o));break}if(pt(o))break;for(n=e.position;o!==0&&!Oe(o);)o=e.input.charCodeAt(++e.position);i.push(e.input.slice(n,e.position))}o!==0&&ha(e),qt.call(qo,r)?qo[r](e,r,i):Dr(e,'unknown document directive "'+r+'"')}if(de(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,de(e,!0,-1)):a&&H(e,"directives end mark is expected"),Mn(e,e.lineIndent-1,$r,!1,!0),de(e,!0,-1),e.checkLineBreaks&&Ap.test(e.input.slice(t,e.position))&&Dr(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Jr(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,de(e,!0,-1));return}if(e.position<e.length-1)H(e,"end of the stream or a document separator is expected");else return}function lc(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
18
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new Ip(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,H(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)Bp(n);return n.documents}function jp(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var r=lc(e,n);if(typeof t!="function")return r;for(var i=0,a=r.length;i<a;i+=1)t(r[i])}function qp(e,t){var n=lc(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new Se("expected a single document in the stream, but found more")}}var Vp=jp,Up=qp,cc={loadAll:Vp,load:Up},uc=Object.prototype.toString,fc=Object.prototype.hasOwnProperty,ga=65279,Yp=9,Xn=10,Wp=13,Kp=32,zp=33,Gp=34,Hi=35,Zp=37,Jp=38,Qp=39,Xp=42,dc=44,eh=45,Rr=58,th=61,nh=62,rh=63,ih=64,pc=91,hc=93,ah=96,mc=123,oh=124,gc=125,Ce={};Ce[0]="\\0";Ce[7]="\\a";Ce[8]="\\b";Ce[9]="\\t";Ce[10]="\\n";Ce[11]="\\v";Ce[12]="\\f";Ce[13]="\\r";Ce[27]="\\e";Ce[34]='\\"';Ce[92]="\\\\";Ce[133]="\\N";Ce[160]="\\_";Ce[8232]="\\L";Ce[8233]="\\P";var sh=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],lh=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function ch(e,t){var n,r,i,a,o,s,l;if(t===null)return{};for(n={},r=Object.keys(t),i=0,a=r.length;i<a;i+=1)o=r[i],s=String(t[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),l=e.compiledTypeMap.fallback[o],l&&fc.call(l.styleAliases,s)&&(s=l.styleAliases[s]),n[o]=s;return n}function uh(e){var t,n,r;if(t=e.toString(16).toUpperCase(),e<=255)n="x",r=2;else if(e<=65535)n="u",r=4;else if(e<=4294967295)n="U",r=8;else throw new Se("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+he.repeat("0",r-t.length)+t}var fh=1,er=2;function dh(e){this.schema=e.schema||pa,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=he.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=ch(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?er:fh,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Yo(e,t){for(var n=he.repeat(" ",t),r=0,i=-1,a="",o,s=e.length;r<s;)i=e.indexOf(`
|
|
19
19
|
`,r),i===-1?(o=e.slice(r),r=s):(o=e.slice(r,i+1),r=i+1),o.length&&o!==`
|
|
20
|
-
`&&(a+=n),a+=o;return a}function
|
|
21
|
-
`+
|
|
20
|
+
`&&(a+=n),a+=o;return a}function Pi(e,t){return`
|
|
21
|
+
`+he.repeat(" ",e.indent*t)}function ph(e,t){var n,r,i;for(n=0,r=e.implicitTypes.length;n<r;n+=1)if(i=e.implicitTypes[n],i.resolve(t))return!0;return!1}function Fr(e){return e===Kp||e===Yp}function tr(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==ga||65536<=e&&e<=1114111}function Wo(e){return tr(e)&&e!==ga&&e!==Wp&&e!==Xn}function Ko(e,t,n){var r=Wo(e),i=r&&!Fr(e);return(n?r:r&&e!==dc&&e!==pc&&e!==hc&&e!==mc&&e!==gc)&&e!==Hi&&!(t===Rr&&!i)||Wo(t)&&!Fr(t)&&e===Hi||t===Rr&&i}function hh(e){return tr(e)&&e!==ga&&!Fr(e)&&e!==eh&&e!==rh&&e!==Rr&&e!==dc&&e!==pc&&e!==hc&&e!==mc&&e!==gc&&e!==Hi&&e!==Jp&&e!==Xp&&e!==zp&&e!==oh&&e!==th&&e!==nh&&e!==Qp&&e!==Gp&&e!==Zp&&e!==ih&&e!==ah}function mh(e){return!Fr(e)&&e!==Rr}function Wn(e,t){var n=e.charCodeAt(t),r;return n>=55296&&n<=56319&&t+1<e.length&&(r=e.charCodeAt(t+1),r>=56320&&r<=57343)?(n-55296)*1024+r-56320+65536:n}function vc(e){var t=/^\n* /;return t.test(e)}var yc=1,Bi=2,wc=3,bc=4,gn=5;function gh(e,t,n,r,i,a,o,s){var l,c=0,f=null,u=!1,p=!1,d=r!==-1,h=-1,g=hh(Wn(e,0))&&mh(Wn(e,e.length-1));if(t||o)for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=Wn(e,l),!tr(c))return gn;g=g&&Ko(c,f,s),f=c}else{for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=Wn(e,l),c===Xn)u=!0,d&&(p=p||l-h-1>r&&e[h+1]!==" ",h=l);else if(!tr(c))return gn;g=g&&Ko(c,f,s),f=c}p=p||d&&l-h-1>r&&e[h+1]!==" "}return!u&&!p?g&&!o&&!i(e)?yc:a===er?gn:Bi:n>9&&vc(e)?gn:o?a===er?gn:Bi:p?bc:wc}function vh(e,t,n,r,i){e.dump=(function(){if(t.length===0)return e.quotingType===er?'""':"''";if(!e.noCompatMode&&(sh.indexOf(t)!==-1||lh.test(t)))return e.quotingType===er?'"'+t+'"':"'"+t+"'";var a=e.indent*Math.max(1,n),o=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),s=r||e.flowLevel>-1&&n>=e.flowLevel;function l(c){return ph(e,c)}switch(gh(t,s,e.indent,o,l,e.quotingType,e.forceQuotes&&!r,i)){case yc:return t;case Bi:return"'"+t.replace(/'/g,"''")+"'";case wc:return"|"+zo(t,e.indent)+Go(Yo(t,a));case bc:return">"+zo(t,e.indent)+Go(Yo(yh(t,o),a));case gn:return'"'+wh(t)+'"';default:throw new Se("impossible error: invalid scalar style")}})()}function zo(e,t){var n=vc(e)?String(t):"",r=e[e.length-1]===`
|
|
22
22
|
`,i=r&&(e[e.length-2]===`
|
|
23
23
|
`||e===`
|
|
24
24
|
`),a=i?"+":r?"":"-";return n+a+`
|
|
25
|
-
`}function
|
|
26
|
-
`?e.slice(0,-1):e}function
|
|
27
|
-
`);return c=c!==-1?c:e.length,n.lastIndex=c,
|
|
25
|
+
`}function Go(e){return e[e.length-1]===`
|
|
26
|
+
`?e.slice(0,-1):e}function yh(e,t){for(var n=/(\n+)([^\n]*)/g,r=(function(){var c=e.indexOf(`
|
|
27
|
+
`);return c=c!==-1?c:e.length,n.lastIndex=c,Zo(e.slice(0,c),t)})(),i=e[0]===`
|
|
28
28
|
`||e[0]===" ",a,o;o=n.exec(e);){var s=o[1],l=o[2];a=l[0]===" ",r+=s+(!i&&!a&&l!==""?`
|
|
29
|
-
`:"")+
|
|
29
|
+
`:"")+Zo(l,t),i=a}return r}function Zo(e,t){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,r,i=0,a,o=0,s=0,l="";r=n.exec(e);)s=r.index,s-i>t&&(a=o>i?o:s,l+=`
|
|
30
30
|
`+e.slice(i,a),i=a+1),o=s;return l+=`
|
|
31
31
|
`,e.length-i>t&&o>i?l+=e.slice(i,o)+`
|
|
32
|
-
`+e.slice(o+1):l+=e.slice(i),l.slice(1)}function
|
|
33
|
-
`:""}var ah=ih,oh={dump:ah};function pa(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var sh=ve,lh=Cl,ch=Ll,uh=Dl,fh=Rl,dh=ca,ph=ec.load,hh=ec.loadAll,mh=oh.dump,gh=Le,vh={binary:jl,float:$l,map:Il,null:Nl,pairs:Vl,set:Ul,timestamp:Pl,bool:Tl,int:Ol,merge:Bl,omap:ql,seq:Ml,str:Sl},yh=pa("safeLoad","load"),wh=pa("safeLoadAll","loadAll"),_h=pa("safeDump","dump"),Gr={Type:sh,Schema:lh,FAILSAFE_SCHEMA:ch,JSON_SCHEMA:uh,CORE_SCHEMA:fh,DEFAULT_SCHEMA:dh,load:ph,loadAll:hh,dump:mh,YAMLException:gh,types:vh,safeLoad:yh,safeLoadAll:wh,safeDump:_h};const tt=ht(),nt=ht(),Ee=ht({}),ha=ht(-1),Te=ht(0),rt=ht(),Ce=xl(null,e=>(bh().then(e).catch(t=>console.error("Failed to load config.",t)),()=>{})),ma=Gf(Ce,(e,t)=>{const n=e?.custom_actions;return n?(kh(n).then(t).catch(r=>console.error("Failed to load cms actions.",r)),()=>{}):null});async function bh(){const e=new URL("../../cms-config/config.yml",window.location.href).href,t=await fetch(e);if(!t.ok)throw new Error(`Unable to fetch file ${e}`);return Gr.load(await t.text())}async function kh(e){const t=`../../cms-config/${e}`;return(await import(new URL(t,window.location.href).href)).default}var xh=z('<nav><ul><li><a href="##posts" data-tooltip="Posts" data-placement="bottom"><!></a></li> <li><a href="##media" data-tooltip="Media Files" data-placement="bottom"><!></a></li></ul> <ul><li><a href="##exit" class="secondary" data-tooltip="Exit" data-placement="bottom"><!></a></li></ul></nav>');function Ah(e,t){se(t,!0);const n=()=>H(ma,"$cmsActions",i),r=()=>H(rt,"$backend",i),[i,a]=he();function o(L){L.preventDefault();const $=new URL(L.currentTarget.href).hash.replaceAll("#","");t.onselectview($),L.currentTarget.blur()}async function s(L){L.preventDefault(),n()?.onLogout&&await n().onLogout(),r()?.logout?await r().logout():history.back()}var l=xh(),c=I(l),f=I(c),u=I(f);u.__click=o;var p=I(u);Be(p,()=>Xf);var d=R(f,2),m=I(d);m.__click=o;var g=I(m);Be(g,()=>ed);var h=R(c,2),v=I(h),w=I(v);w.__click=s;var k=I(w);Be(k,()=>td),q(e,l),le(),a()}Ve(["click"]);const Eh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>text-box-edit</title><path d="M10 19.11L12.11 17H7V15H14V15.12L16.12 13H7V11H17V12.12L18.24 10.89C18.72 10.41 19.35 10.14 20.04 10.14C20.37 10.14 20.7 10.21 21 10.33V5C21 3.89 20.1 3 19 3H5C3.89 3 3 3.89 3 5V19C3 20.11 3.9 21 5 21H10V19.11M7 7H17V9H7V7M21.7 14.35L20.7 15.35L18.65 13.3L19.65 12.3C19.86 12.09 20.21 12.09 20.42 12.3L21.7 13.58C21.91 13.79 21.91 14.14 21.7 14.35M12 19.94L18.06 13.88L20.11 15.93L14.06 22H12V19.94Z" /></svg>';var Ch=z('<li class="svelte-s7v0ur"><a href="##select"><!> </a></li>');function Sh(e,t){se(t,!0);const n=()=>H(tt,"$selectedCollection",i),r=()=>H(Ce,"$config",i),[i,a]=he();let o=ct(()=>n()?.name===t.name?"selected":"");function s(d){d.preventDefault(),re(tt,r().collections.find(m=>m.name===t.name))}var l=Ch(),c=I(l);let f;c.__click=s;var u=I(c);Be(u,()=>Eh);var p=R(u,1,!0);ee(()=>{f=bl(c,1,"collectionNav svelte-s7v0ur",null,f,{selected:y(o)}),ce(p,t.label)}),q(e,l),le(),a()}Ve(["click"]);var wr={exports:{}},Mh=wr.exports,zo;function Ih(){return zo||(zo=1,(function(e,t){(function(n,r){e.exports=r()})(Mh,(function(){var n=1e3,r=6e4,i=36e5,a="millisecond",o="second",s="minute",l="hour",c="day",f="week",u="month",p="quarter",d="year",m="date",g="Invalid Date",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,w={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(C){var x=["th","st","nd","rd"],b=C%100;return"["+C+(x[(b-20)%10]||x[b]||x[0])+"]"}},k=function(C,x,b){var S=String(C);return!S||S.length>=x?C:""+Array(x+1-S.length).join(b)+C},L={s:k,z:function(C){var x=-C.utcOffset(),b=Math.abs(x),S=Math.floor(b/60),A=b%60;return(x<=0?"+":"-")+k(S,2,"0")+":"+k(A,2,"0")},m:function C(x,b){if(x.date()<b.date())return-C(b,x);var S=12*(b.year()-x.year())+(b.month()-x.month()),A=x.clone().add(S,u),O=b-A<0,D=x.clone().add(S+(O?-1:1),u);return+(-(S+(b-A)/(O?A-D:D-A))||0)},a:function(C){return C<0?Math.ceil(C)||0:Math.floor(C)},p:function(C){return{M:u,y:d,w:f,d:c,D:m,h:l,m:s,s:o,ms:a,Q:p}[C]||String(C||"").toLowerCase().replace(/s$/,"")},u:function(C){return C===void 0}},$="en",N={};N[$]=w;var E="$isDayjsObject",P=function(C){return C instanceof Y||!(!C||!C[E])},G=function C(x,b,S){var A;if(!x)return $;if(typeof x=="string"){var O=x.toLowerCase();N[O]&&(A=O),b&&(N[O]=b,A=O);var D=x.split("-");if(!A&&D.length>1)return C(D[0])}else{var W=x.name;N[W]=x,A=W}return!S&&A&&($=A),A||!S&&$},V=function(C,x){if(P(C))return C.clone();var b=typeof x=="object"?x:{};return b.date=C,b.args=arguments,new Y(b)},T=L;T.l=G,T.i=P,T.w=function(C,x){return V(C,{locale:x.$L,utc:x.$u,x:x.$x,$offset:x.$offset})};var Y=(function(){function C(b){this.$L=G(b.locale,null,!0),this.parse(b),this.$x=this.$x||b.x||{},this[E]=!0}var x=C.prototype;return x.parse=function(b){this.$d=(function(S){var A=S.date,O=S.utc;if(A===null)return new Date(NaN);if(T.u(A))return new Date;if(A instanceof Date)return new Date(A);if(typeof A=="string"&&!/Z$/i.test(A)){var D=A.match(h);if(D){var W=D[2]-1||0,Z=(D[7]||"0").substring(0,3);return O?new Date(Date.UTC(D[1],W,D[3]||1,D[4]||0,D[5]||0,D[6]||0,Z)):new Date(D[1],W,D[3]||1,D[4]||0,D[5]||0,D[6]||0,Z)}}return new Date(A)})(b),this.init()},x.init=function(){var b=this.$d;this.$y=b.getFullYear(),this.$M=b.getMonth(),this.$D=b.getDate(),this.$W=b.getDay(),this.$H=b.getHours(),this.$m=b.getMinutes(),this.$s=b.getSeconds(),this.$ms=b.getMilliseconds()},x.$utils=function(){return T},x.isValid=function(){return this.$d.toString()!==g},x.isSame=function(b,S){var A=V(b);return this.startOf(S)<=A&&A<=this.endOf(S)},x.isAfter=function(b,S){return V(b)<this.startOf(S)},x.isBefore=function(b,S){return this.endOf(S)<V(b)},x.$g=function(b,S,A){return T.u(b)?this[S]:this.set(A,b)},x.unix=function(){return Math.floor(this.valueOf()/1e3)},x.valueOf=function(){return this.$d.getTime()},x.startOf=function(b,S){var A=this,O=!!T.u(S)||S,D=T.p(b),W=function(we,oe){var me=T.w(A.$u?Date.UTC(A.$y,oe,we):new Date(A.$y,oe,we),A);return O?me:me.endOf(c)},Z=function(we,oe){return T.w(A.toDate()[we].apply(A.toDate("s"),(O?[0,0,0,0]:[23,59,59,999]).slice(oe)),A)},M=this.$W,j=this.$M,J=this.$D,ue="set"+(this.$u?"UTC":"");switch(D){case d:return O?W(1,0):W(31,11);case u:return O?W(1,j):W(0,j+1);case f:var de=this.$locale().weekStart||0,Me=(M<de?M+7:M)-de;return W(O?J-Me:J+(6-Me),j);case c:case m:return Z(ue+"Hours",0);case l:return Z(ue+"Minutes",1);case s:return Z(ue+"Seconds",2);case o:return Z(ue+"Milliseconds",3);default:return this.clone()}},x.endOf=function(b){return this.startOf(b,!1)},x.$set=function(b,S){var A,O=T.p(b),D="set"+(this.$u?"UTC":""),W=(A={},A[c]=D+"Date",A[m]=D+"Date",A[u]=D+"Month",A[d]=D+"FullYear",A[l]=D+"Hours",A[s]=D+"Minutes",A[o]=D+"Seconds",A[a]=D+"Milliseconds",A)[O],Z=O===c?this.$D+(S-this.$W):S;if(O===u||O===d){var M=this.clone().set(m,1);M.$d[W](Z),M.init(),this.$d=M.set(m,Math.min(this.$D,M.daysInMonth())).$d}else W&&this.$d[W](Z);return this.init(),this},x.set=function(b,S){return this.clone().$set(b,S)},x.get=function(b){return this[T.p(b)]()},x.add=function(b,S){var A,O=this;b=Number(b);var D=T.p(S),W=function(j){var J=V(O);return T.w(J.date(J.date()+Math.round(j*b)),O)};if(D===u)return this.set(u,this.$M+b);if(D===d)return this.set(d,this.$y+b);if(D===c)return W(1);if(D===f)return W(7);var Z=(A={},A[s]=r,A[l]=i,A[o]=n,A)[D]||1,M=this.$d.getTime()+b*Z;return T.w(M,this)},x.subtract=function(b,S){return this.add(-1*b,S)},x.format=function(b){var S=this,A=this.$locale();if(!this.isValid())return A.invalidDate||g;var O=b||"YYYY-MM-DDTHH:mm:ssZ",D=T.z(this),W=this.$H,Z=this.$m,M=this.$M,j=A.weekdays,J=A.months,ue=A.meridiem,de=function(oe,me,Ze,Mt){return oe&&(oe[me]||oe(S,O))||Ze[me].slice(0,Mt)},Me=function(oe){return T.s(W%12||12,oe,"0")},we=ue||function(oe,me,Ze){var Mt=oe<12?"AM":"PM";return Ze?Mt.toLowerCase():Mt};return O.replace(v,(function(oe,me){return me||(function(Ze){switch(Ze){case"YY":return String(S.$y).slice(-2);case"YYYY":return T.s(S.$y,4,"0");case"M":return M+1;case"MM":return T.s(M+1,2,"0");case"MMM":return de(A.monthsShort,M,J,3);case"MMMM":return de(J,M);case"D":return S.$D;case"DD":return T.s(S.$D,2,"0");case"d":return String(S.$W);case"dd":return de(A.weekdaysMin,S.$W,j,2);case"ddd":return de(A.weekdaysShort,S.$W,j,3);case"dddd":return j[S.$W];case"H":return String(W);case"HH":return T.s(W,2,"0");case"h":return Me(1);case"hh":return Me(2);case"a":return we(W,Z,!0);case"A":return we(W,Z,!1);case"m":return String(Z);case"mm":return T.s(Z,2,"0");case"s":return String(S.$s);case"ss":return T.s(S.$s,2,"0");case"SSS":return T.s(S.$ms,3,"0");case"Z":return D}return null})(oe)||D.replace(":","")}))},x.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},x.diff=function(b,S,A){var O,D=this,W=T.p(S),Z=V(b),M=(Z.utcOffset()-this.utcOffset())*r,j=this-Z,J=function(){return T.m(D,Z)};switch(W){case d:O=J()/12;break;case u:O=J();break;case p:O=J()/3;break;case f:O=(j-M)/6048e5;break;case c:O=(j-M)/864e5;break;case l:O=j/i;break;case s:O=j/r;break;case o:O=j/n;break;default:O=j}return A?O:T.a(O)},x.daysInMonth=function(){return this.endOf(u).$D},x.$locale=function(){return N[this.$L]},x.locale=function(b,S){if(!b)return this.$L;var A=this.clone(),O=G(b,S,!0);return O&&(A.$L=O),A},x.clone=function(){return T.w(this.$d,this)},x.toDate=function(){return new Date(this.valueOf())},x.toJSON=function(){return this.isValid()?this.toISOString():null},x.toISOString=function(){return this.$d.toISOString()},x.toString=function(){return this.$d.toUTCString()},C})(),B=Y.prototype;return V.prototype=B,[["$ms",a],["$s",o],["$m",s],["$H",l],["$W",c],["$M",u],["$y",d],["$D",m]].forEach((function(C){B[C[1]]=function(x){return this.$g(x,C[0],C[1])}})),V.extend=function(C,x){return C.$i||(C(x,Y,V),C.$i=!0),V},V.locale=G,V.isDayjs=P,V.unix=function(C){return V(1e3*C)},V.en=N[$],V.Ls=N,V.p={},V}))})(wr)),wr.exports}var Lh=Ih();const Oe=ws(Lh);var Nh=z('<div class="item svelte-i3qvht"><input type="checkbox" name="entry-select"/> <a href="#editor" class="entry-info svelte-i3qvht"><div class="entry-name svelte-i3qvht"> </div> <div class="entry-status svelte-i3qvht"> </div> <div class="entry-date svelte-i3qvht"> </div></a></div>');function Th(e,t){se(t,!0);const n=()=>H(s,"$selectedEntries",r),[r,i]=he();let a=t.entry.fields.draft?"draft":"published",o=Oe(t.entry.fields.date).format("MM/DD/YY");const s=Ar("selectedEntries");function l(k){k.target.checked?re(s,[...n(),t.entry]):re(s,n().filter(L=>L!==t.entry))}function c(){re(Ee,{}),re(nt,t.entry)}var f=Nh(),u=I(f);u.__change=l;var p=R(u,2);p.__click=c;var d=I(p),m=I(d),g=R(d,2),h=I(g),v=R(g,2),w=I(v);ee(()=>{ce(m,t.entry.fields.title),ce(h,a),ce(w,o)}),q(e,f),le(),i()}Ve(["change","click"]);var Oh=z("<div> </div>"),$h=z('<div class="toast"><div aria-busy="true"></div> <!></div>');function Zr(e,t){var n=$h(),r=R(I(n),2);{var i=a=>{var o=Oh(),s=I(o);ee(()=>ce(s,t.msg)),q(a,o)};Ne(r,a=>{t.msg&&a(i)})}q(e,n)}const Dh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>alert</title><path d="M13 14H11V9H13M13 18H11V16H13M1 21H23L12 2L1 21Z" /></svg>';var Rh=z('<div class="toast warning"><!> <details class="svelte-bipkou"><summary> </summary> </details></div>');function kt(e,t){var n=Rh(),r=I(n);Be(r,()=>Dh);var i=R(r,2),a=I(i),o=I(a),s=R(a);ee(()=>{ce(o,t.msg),ce(s,` ${t.details??""}`)}),q(e,n)}const dc='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>trash-can-outline</title><path d="M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z" /></svg>',Go='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>pencil</title><path d="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z" /></svg>';var Fh=z('<div id="empty" class="svelte-vl570e"><p>This collection has no entries.</p> <button class="svelte-vl570e"><!>Create New Entry</button></div>'),Hh=z('<div id="items" class="svelte-vl570e"></div>'),Ph=z('<main class="svelte-vl570e"><header class="svelte-vl570e"> <div id="listActions" class="svelte-vl570e"><button class="outline svelte-vl570e"><!>Delete</button> <button class="svelte-vl570e"><!>New</button></div></header> <!> <!> <!></main>');function Bh(e,t){se(t,!0);const n=()=>H(tt,"$selectedCollection",o),r=()=>H(rt,"$backend",o),i=()=>H(l,"$selectedEntries",o),a=()=>H(ma,"$cmsActions",o),[o,s]=he(),l=ht([]);Er("selectedEntries",l);let c=K(void 0),f=K(void 0),u=K(Qe([])),p=K(void 0);dt(()=>{y(p)!==n()?.name&&d()});async function d(){try{if(!r()||!n().name)return;U(p,n().name,!0),U(c,r().getFiles(n().name),!0),U(u,await y(c)||[],!0)}catch{}}function m(){re(nt,null),re(Ee,{}),window.location.hash="#/editor"}async function g(){try{await r().deleteFiles(i()),a()?.onDelete&&(U(f,a().onDelete(i()),!0),await y(f)),re(l,[]),d()}catch(B){console.error("Error deleting files",B)}}var h=Ph(),v=I(h),w=I(v),k=R(w),L=I(k);L.__click=g;var $=I(L);Be($,()=>dc);var N=R(L,2);N.__click=m;var E=I(N);Be(E,()=>Go);var P=R(v,2);{var G=B=>{var C=Fh(),x=R(I(C),2);x.__click=m;var b=I(x);Be(b,()=>Go),q(B,C)},V=B=>{var C=Hh();Pt(C,21,()=>y(u),x=>x.name,(x,b)=>{Th(x,{get entry(){return y(b)}})}),q(B,C)};Ne(P,B=>{y(u).length===0?B(G):B(V,!1)})}var T=R(P,2);Xe(T,()=>y(c),B=>{Zr(B,{msg:"Loading"})},void 0,(B,C)=>{kt(B,{msg:"Error getting entries",get details(){return y(C).message}})});var Y=R(T,2);Xe(Y,()=>y(f),null,void 0,(B,C)=>{kt(B,{msg:"'On delete' event action failed",get details(){return y(C).message}})}),ee(()=>{ce(w,`${(n()?.label||"")??""} `),L.disabled=i().length===0}),q(e,h),le(),s()}Ve(["click"]);var jh=z('<div class="svelte-1vgyypt"><input type="checkbox" name="media-select" class="svelte-1vgyypt"/> <img loading="lazy" crossorigin="use-credentials" class="svelte-1vgyypt"/> <small class="svelte-1vgyypt"> </small></div>');function qh(e,t){se(t,!0);const n=()=>H(a,"$selectedMediaFiles",r),[r,i]=he(),a=Ar("selectedMediaFiles");function o(p){p.target.checked?re(a,[...n(),t.media]):re(a,n().filter(d=>d!==t.media))}var s=jh(),l=I(s);l.__change=o;var c=R(l,2),f=R(c,2),u=I(f);ee(()=>{Q(c,"src",t.media.url_preview),Q(c,"alt",t.media.alt),ce(u,t.media.name)}),q(e,s),le(),i()}Ve(["change"]);const Zo='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>file-upload</title><path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M13.5,16V19H10.5V16H8L12,12L16,16H13.5M13,9V3.5L18.5,9H13Z" /></svg>';var Vh=z('<div id="empty" class="svelte-1gxvaku"><p>No files found.</p> <button class="svelte-1gxvaku"><!>Upload a File</button></div>'),Uh=z('<div id="items" class="svelte-1gxvaku"></div>'),Yh=z('<main class="svelte-1gxvaku"><header class="svelte-1gxvaku">Media Files <div id="listActions" class="svelte-1gxvaku"><button class="outline svelte-1gxvaku"><!>Delete</button> <button class="svelte-1gxvaku"><!>Upload</button></div></header> <!> <!></main>');function Wh(e,t){se(t,!0);const n=()=>H(rt,"$backend",i),r=()=>H(o,"$selectedMediaFiles",i),[i,a]=he(),o=ht([]);Er("selectedMediaFiles",o);let s=K(void 0),l=K(Qe([]));async function c(){try{U(s,n()?.getMediaFiles(),!0),U(l,await y(s)||[],!0)}catch{}}async function f(){await n().uploadMediaFile(),c()}async function u(){try{await n().deleteFiles(r()),re(o,[]),c()}catch(E){console.error("Error deleting files",E)}}Ue(()=>{c()});var p=Yh(),d=I(p),m=R(I(d)),g=I(m);g.__click=u;var h=I(g);Be(h,()=>dc);var v=R(g,2);v.__click=f;var w=I(v);Be(w,()=>Zo);var k=R(d,2);{var L=E=>{var P=Vh(),G=R(I(P),2);G.__click=f;var V=I(G);Be(V,()=>Zo),q(E,P)},$=E=>{var P=Uh();Pt(P,21,()=>y(l),G=>G.name,(G,V)=>{qh(G,{get media(){return y(V)}})}),q(E,P)};Ne(k,E=>{y(l).length===0?E(L):E($,!1)})}var N=R(k,2);Xe(N,()=>y(s),E=>{Zr(E,{msg:"Loading"})},void 0,(E,P)=>{kt(E,{msg:"Error getting entries",get details(){return y(P).message}})}),ee(()=>g.disabled=r().length===0),q(e,p),le(),a()}Ve(["click"]);var Kh=z('<aside class="svelte-bdf84k"><ul class="svelte-bdf84k"><!></ul></aside> <!>',1),zh=z('<!> <div id="dash" class="page svelte-bdf84k"><!></div>',1);function Gh(e,t){se(t,!0);const n=()=>H(Ce,"$config",i),r=()=>H(tt,"$selectedCollection",i),[i,a]=he();let o=K("posts"),s=ct(()=>n()?.collections);dt(()=>{r()||re(tt,y(s)?.[0])});function l(g){U(o,g,!0)}var c=zh(),f=be(c);Ah(f,{onselectview:l});var u=R(f,2),p=I(u);{var d=g=>{var h=Kh(),v=be(h),w=I(v),k=I(w);{var L=N=>{var E=st(),P=be(E);Pt(P,17,()=>y(s),Li,(G,V)=>{Sh(G,yr(()=>y(V)))}),q(N,E)};Ne(k,N=>{y(s)&&N(L)})}var $=R(v,2);Bh($,{}),q(g,h)},m=g=>{var h=st(),v=be(h);{var w=k=>{Wh(k,{})};Ne(v,k=>{y(o)==="media"&&k(w)},!0)}q(g,h)};Ne(p,g=>{y(o)==="posts"?g(d):g(m,!1)})}q(e,c),le(),a()}const Zh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>arrow-left</title><path d="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z" /></svg>',ga=(()=>{if(typeof self>"u")return!1;if("top"in self&&self!==top)try{top.window.document._=0}catch{return!1}return"showOpenFilePicker"in self})(),Jh=ga?Promise.resolve().then(function(){return rm}):Promise.resolve().then(function(){return cm});async function va(...e){return(await Jh).default(...e)}const Qh=ga?Promise.resolve().then(function(){return am}):Promise.resolve().then(function(){return fm});async function Xh(...e){return(await Qh).default(...e)}const em=ga?Promise.resolve().then(function(){return sm}):Promise.resolve().then(function(){return pm});async function Hi(...e){return(await em).default(...e)}const tm=async e=>{const t=await e.getFile();return t.handle=e,t};var nm=async(e=[{}])=>{Array.isArray(e)||(e=[e]);const t=[];e.forEach((i,a)=>{t[a]={description:i.description||"Files",accept:{}},i.mimeTypes?i.mimeTypes.map(o=>{t[a].accept[o]=i.extensions||[]}):t[a].accept["*/*"]=i.extensions||[]});const n=await window.showOpenFilePicker({id:e[0].id,startIn:e[0].startIn,types:t,multiple:e[0].multiple||!1,excludeAcceptAllOption:e[0].excludeAcceptAllOption||!1}),r=await Promise.all(n.map(tm));return e[0].multiple?r:r[0]},rm={__proto__:null,default:nm};function _r(e){function t(n){if(Object(n)!==n)return Promise.reject(new TypeError(n+" is not an object."));var r=n.done;return Promise.resolve(n.value).then(function(i){return{value:i,done:r}})}return _r=function(n){this.s=n,this.n=n.next},_r.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(n){var r=this.s.return;return r===void 0?Promise.resolve({value:n,done:!0}):t(r.apply(this.s,arguments))},throw:function(n){var r=this.s.return;return r===void 0?Promise.reject(n):t(r.apply(this.s,arguments))}},new _r(e)}const pc=async(e,t,n=e.name,r)=>{const i=[],a=[];var o,s=!1,l=!1;try{for(var c,f=(function(u){var p,d,m,g=2;for(typeof Symbol<"u"&&(d=Symbol.asyncIterator,m=Symbol.iterator);g--;){if(d&&(p=u[d])!=null)return p.call(u);if(m&&(p=u[m])!=null)return new _r(p.call(u));d="@@asyncIterator",m="@@iterator"}throw new TypeError("Object is not async iterable")})(e.values());s=!(c=await f.next()).done;s=!1){const u=c.value,p=`${n}/${u.name}`;u.kind==="file"?a.push(u.getFile().then(d=>(d.directoryHandle=e,d.handle=u,Object.defineProperty(d,"webkitRelativePath",{configurable:!0,enumerable:!0,get:()=>p})))):u.kind!=="directory"||!t||r&&r(u)||i.push(pc(u,t,p,r))}}catch(u){l=!0,o=u}finally{try{s&&f.return!=null&&await f.return()}finally{if(l)throw o}}return[...(await Promise.all(i)).flat(),...await Promise.all(a)]};var im=async(e={})=>{e.recursive=e.recursive||!1,e.mode=e.mode||"read";const t=await window.showDirectoryPicker({id:e.id,startIn:e.startIn,mode:e.mode});return(await(await t.values()).next()).done?[t]:pc(t,e.recursive,void 0,e.skipDirectory)},am={__proto__:null,default:im},om=async(e,t=[{}],n=null,r=!1,i=null)=>{Array.isArray(t)||(t=[t]),t[0].fileName=t[0].fileName||"Untitled";const a=[];let o=null;if(e instanceof Blob&&e.type?o=e.type:e.headers&&e.headers.get("content-type")&&(o=e.headers.get("content-type")),t.forEach((c,f)=>{a[f]={description:c.description||"Files",accept:{}},c.mimeTypes?(f===0&&o&&c.mimeTypes.push(o),c.mimeTypes.map(u=>{a[f].accept[u]=c.extensions||[]})):o?a[f].accept[o]=c.extensions||[]:a[f].accept["*/*"]=c.extensions||[]}),n)try{await n.getFile()}catch(c){if(n=null,r)throw c}const s=n||await window.showSaveFilePicker({suggestedName:t[0].fileName,id:t[0].id,startIn:t[0].startIn,types:a,excludeAcceptAllOption:t[0].excludeAcceptAllOption||!1});!n&&i&&i(s);const l=await s.createWritable();return"stream"in e?(await e.stream().pipeTo(l),s):"body"in e?(await e.body.pipeTo(l),s):(await l.write(await e),await l.close(),s)},sm={__proto__:null,default:om},lm=async(e=[{}])=>(Array.isArray(e)||(e=[e]),new Promise((t,n)=>{const r=document.createElement("input");r.type="file";const i=[...e.map(a=>a.mimeTypes||[]),...e.map(a=>a.extensions||[])].join();r.multiple=e[0].multiple||!1,r.accept=i||"",r.style.display="none",document.body.append(r),r.addEventListener("cancel",()=>{r.remove(),n(new DOMException("The user aborted a request.","AbortError"))}),r.addEventListener("change",()=>{r.remove(),t(r.multiple?Array.from(r.files):r.files[0])}),"showPicker"in HTMLInputElement.prototype?r.showPicker():r.click()})),cm={__proto__:null,default:lm},um=async(e=[{}])=>(Array.isArray(e)||(e=[e]),e[0].recursive=e[0].recursive||!1,new Promise((t,n)=>{const r=document.createElement("input");r.type="file",r.webkitdirectory=!0,r.style.display="none",document.body.append(r),r.addEventListener("cancel",()=>{r.remove(),n(new DOMException("The user aborted a request.","AbortError"))}),r.addEventListener("change",()=>{r.remove();let i=Array.from(r.files);e[0].recursive?e[0].recursive&&e[0].skipDirectory&&(i=i.filter(a=>a.webkitRelativePath.split("/").every(o=>!e[0].skipDirectory({name:o,kind:"directory"})))):i=i.filter(a=>a.webkitRelativePath.split("/").length===2),t(i)}),"showPicker"in HTMLInputElement.prototype?r.showPicker():r.click()})),fm={__proto__:null,default:um},dm=async(e,t={})=>{Array.isArray(t)&&(t=t[0]);const n=document.createElement("a");let r=e;"body"in e&&(r=await(async function(o,s){const l=o.getReader(),c=new ReadableStream({start:p=>(async function d(){return l.read().then(({done:m,value:g})=>{if(!m)return p.enqueue(g),d();p.close()})})()}),f=new Response(c),u=await f.blob();return l.releaseLock(),new Blob([u],{type:s})})(e.body,e.headers.get("content-type"))),n.download=t.fileName||"Untitled",n.href=URL.createObjectURL(await r);const i=()=>{typeof a=="function"&&a()},a=t.legacySetup&&t.legacySetup(i,()=>a(),n);return n.addEventListener("click",()=>{setTimeout(()=>URL.revokeObjectURL(n.href),3e4),i()}),n.click(),null},pm={__proto__:null,default:dm},br={exports:{}},hm=br.exports,Jo;function mm(){return Jo||(Jo=1,(function(e,t){(function(n,r){e.exports=r()})(hm,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,i=/\d/,a=/\d\d/,o=/\d\d?/,s=/\d*[^-_:/,()\s\d]+/,l={},c=function(h){return(h=+h)+(h>68?1900:2e3)},f=function(h){return function(v){this[h]=+v}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(h){(this.zone||(this.zone={})).offset=(function(v){if(!v||v==="Z")return 0;var w=v.match(/([+-]|\d\d)/g),k=60*w[1]+(+w[2]||0);return k===0?0:w[0]==="+"?-k:k})(h)}],p=function(h){var v=l[h];return v&&(v.indexOf?v:v.s.concat(v.f))},d=function(h,v){var w,k=l.meridiem;if(k){for(var L=1;L<=24;L+=1)if(h.indexOf(k(L,0,v))>-1){w=L>12;break}}else w=h===(v?"pm":"PM");return w},m={A:[s,function(h){this.afternoon=d(h,!1)}],a:[s,function(h){this.afternoon=d(h,!0)}],Q:[i,function(h){this.month=3*(h-1)+1}],S:[i,function(h){this.milliseconds=100*+h}],SS:[a,function(h){this.milliseconds=10*+h}],SSS:[/\d{3}/,function(h){this.milliseconds=+h}],s:[o,f("seconds")],ss:[o,f("seconds")],m:[o,f("minutes")],mm:[o,f("minutes")],H:[o,f("hours")],h:[o,f("hours")],HH:[o,f("hours")],hh:[o,f("hours")],D:[o,f("day")],DD:[a,f("day")],Do:[s,function(h){var v=l.ordinal,w=h.match(/\d+/);if(this.day=w[0],v)for(var k=1;k<=31;k+=1)v(k).replace(/\[|\]/g,"")===h&&(this.day=k)}],w:[o,f("week")],ww:[a,f("week")],M:[o,f("month")],MM:[a,f("month")],MMM:[s,function(h){var v=p("months"),w=(p("monthsShort")||v.map((function(k){return k.slice(0,3)}))).indexOf(h)+1;if(w<1)throw new Error;this.month=w%12||w}],MMMM:[s,function(h){var v=p("months").indexOf(h)+1;if(v<1)throw new Error;this.month=v%12||v}],Y:[/[+-]?\d+/,f("year")],YY:[a,function(h){this.year=c(h)}],YYYY:[/\d{4}/,f("year")],Z:u,ZZ:u};function g(h){var v,w;v=h,w=l&&l.formats;for(var k=(h=v.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(V,T,Y){var B=Y&&Y.toUpperCase();return T||w[Y]||n[Y]||w[B].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(C,x,b){return x||b.slice(1)}))}))).match(r),L=k.length,$=0;$<L;$+=1){var N=k[$],E=m[N],P=E&&E[0],G=E&&E[1];k[$]=G?{regex:P,parser:G}:N.replace(/^\[|\]$/g,"")}return function(V){for(var T={},Y=0,B=0;Y<L;Y+=1){var C=k[Y];if(typeof C=="string")B+=C.length;else{var x=C.regex,b=C.parser,S=V.slice(B),A=x.exec(S)[0];b.call(T,A),V=V.replace(A,"")}}return(function(O){var D=O.afternoon;if(D!==void 0){var W=O.hours;D?W<12&&(O.hours+=12):W===12&&(O.hours=0),delete O.afternoon}})(T),T}}return function(h,v,w){w.p.customParseFormat=!0,h&&h.parseTwoDigitYear&&(c=h.parseTwoDigitYear);var k=v.prototype,L=k.parse;k.parse=function($){var N=$.date,E=$.utc,P=$.args;this.$u=E;var G=P[1];if(typeof G=="string"){var V=P[2]===!0,T=P[3]===!0,Y=V||T,B=P[2];T&&(B=P[2]),l=this.$locale(),!V&&B&&(l=w.Ls[B]),this.$d=(function(S,A,O,D){try{if(["x","X"].indexOf(A)>-1)return new Date((A==="X"?1e3:1)*S);var W=g(A)(S),Z=W.year,M=W.month,j=W.day,J=W.hours,ue=W.minutes,de=W.seconds,Me=W.milliseconds,we=W.zone,oe=W.week,me=new Date,Ze=j||(Z||M?1:me.getDate()),Mt=Z||me.getFullYear(),ur=0;Z&&!M||(ur=M>0?M-1:me.getMonth());var fr,si=J||0,li=ue||0,ci=de||0,ui=Me||0;return we?new Date(Date.UTC(Mt,ur,Ze,si,li,ci,ui+60*we.offset*1e3)):O?new Date(Date.UTC(Mt,ur,Ze,si,li,ci,ui)):(fr=new Date(Mt,ur,Ze,si,li,ci,ui),oe&&(fr=D(fr).week(oe).toDate()),fr)}catch{return new Date("")}})(N,G,E,w),this.init(),B&&B!==!0&&(this.$L=this.locale(B).$L),Y&&N!=this.format(G)&&(this.$d=new Date("")),l={}}else if(G instanceof Array)for(var C=G.length,x=1;x<=C;x+=1){P[1]=G[x-1];var b=w.apply(this,P);if(b.isValid()){this.$d=b.$d,this.$L=b.$L,this.init();break}x===C&&(this.$d=new Date(""))}else L.call(this,$)}}}))})(br)),br.exports}var gm=mm();const hc=ws(gm);Oe.extend(hc);const ya="../../cms-config/",Qo=`Unable to parse markdown entry. Backend must implement 'replacePreviewLinks()'
|
|
34
|
-
and return a valid string.`;function
|
|
35
|
-
`)}async function
|
|
32
|
+
`+e.slice(o+1):l+=e.slice(i),l.slice(1)}function wh(e){for(var t="",n=0,r,i=0;i<e.length;n>=65536?i+=2:i++)n=Wn(e,i),r=Ce[n],!r&&tr(n)?(t+=e[i],n>=65536&&(t+=e[i+1])):t+=r||uh(n);return t}function bh(e,t,n){var r="",i=e.tag,a,o,s;for(a=0,o=n.length;a<o;a+=1)s=n[a],e.replacer&&(s=e.replacer.call(n,String(a),s)),(Mt(e,t,s,!1,!1)||typeof s>"u"&&Mt(e,t,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=i,e.dump="["+r+"]"}function Jo(e,t,n,r){var i="",a=e.tag,o,s,l;for(o=0,s=n.length;o<s;o+=1)l=n[o],e.replacer&&(l=e.replacer.call(n,String(o),l)),(Mt(e,t+1,l,!0,!0,!1,!0)||typeof l>"u"&&Mt(e,t+1,null,!0,!0,!1,!0))&&((!r||i!=="")&&(i+=Pi(e,t)),e.dump&&Xn===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=a,e.dump=i||"[]"}function _h(e,t,n){var r="",i=e.tag,a=Object.keys(n),o,s,l,c,f;for(o=0,s=a.length;o<s;o+=1)f="",r!==""&&(f+=", "),e.condenseFlow&&(f+='"'),l=a[o],c=n[l],e.replacer&&(c=e.replacer.call(n,l,c)),Mt(e,t,l,!1,!1)&&(e.dump.length>1024&&(f+="? "),f+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Mt(e,t,c,!1,!1)&&(f+=e.dump,r+=f));e.tag=i,e.dump="{"+r+"}"}function kh(e,t,n,r){var i="",a=e.tag,o=Object.keys(n),s,l,c,f,u,p;if(e.sortKeys===!0)o.sort();else if(typeof e.sortKeys=="function")o.sort(e.sortKeys);else if(e.sortKeys)throw new Se("sortKeys must be a boolean or a function");for(s=0,l=o.length;s<l;s+=1)p="",(!r||i!=="")&&(p+=Pi(e,t)),c=o[s],f=n[c],e.replacer&&(f=e.replacer.call(n,c,f)),Mt(e,t+1,c,!0,!0,!0)&&(u=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,u&&(e.dump&&Xn===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,u&&(p+=Pi(e,t)),Mt(e,t+1,f,!0,u)&&(e.dump&&Xn===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,i+=p));e.tag=a,e.dump=i||"{}"}function Qo(e,t,n){var r,i,a,o,s,l;for(i=n?e.explicitTypes:e.implicitTypes,a=0,o=i.length;a<o;a+=1)if(s=i[a],(s.instanceOf||s.predicate)&&(!s.instanceOf||typeof t=="object"&&t instanceof s.instanceOf)&&(!s.predicate||s.predicate(t))){if(n?s.multi&&s.representName?e.tag=s.representName(t):e.tag=s.tag:e.tag="?",s.represent){if(l=e.styleMap[s.tag]||s.defaultStyle,uc.call(s.represent)==="[object Function]")r=s.represent(t,l);else if(fc.call(s.represent,l))r=s.represent[l](t,l);else throw new Se("!<"+s.tag+'> tag resolver accepts not "'+l+'" style');e.dump=r}return!0}return!1}function Mt(e,t,n,r,i,a,o){e.tag=null,e.dump=n,Qo(e,n,!1)||Qo(e,n,!0);var s=uc.call(e.dump),l=r,c;r&&(r=e.flowLevel<0||e.flowLevel>t);var f=s==="[object Object]"||s==="[object Array]",u,p;if(f&&(u=e.duplicates.indexOf(n),p=u!==-1),(e.tag!==null&&e.tag!=="?"||p||e.indent!==2&&t>0)&&(i=!1),p&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(f&&p&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),s==="[object Object]")r&&Object.keys(e.dump).length!==0?(kh(e,t,e.dump,i),p&&(e.dump="&ref_"+u+e.dump)):(_h(e,t,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if(s==="[object Array]")r&&e.dump.length!==0?(e.noArrayIndent&&!o&&t>0?Jo(e,t-1,e.dump,i):Jo(e,t,e.dump,i),p&&(e.dump="&ref_"+u+e.dump)):(bh(e,t,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if(s==="[object String]")e.tag!=="?"&&vh(e,e.dump,t,a,l);else{if(s==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new Se("unacceptable kind of an object to dump "+s)}e.tag!==null&&e.tag!=="?"&&(c=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",e.dump=c+" "+e.dump)}return!0}function xh(e,t){var n=[],r=[],i,a;for(ji(e,n,r),i=0,a=r.length;i<a;i+=1)t.duplicates.push(n[r[i]]);t.usedDuplicates=new Array(a)}function ji(e,t,n){var r,i,a;if(e!==null&&typeof e=="object")if(i=t.indexOf(e),i!==-1)n.indexOf(i)===-1&&n.push(i);else if(t.push(e),Array.isArray(e))for(i=0,a=e.length;i<a;i+=1)ji(e[i],t,n);else for(r=Object.keys(e),i=0,a=r.length;i<a;i+=1)ji(e[r[i]],t,n)}function Ah(e,t){t=t||{};var n=new dh(t);n.noRefs||xh(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),Mt(n,0,r,!0,!0)?n.dump+`
|
|
33
|
+
`:""}var Eh=Ah,Ch={dump:Eh};function va(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var Sh=we,Mh=Dl,Lh=Pl,Ih=Ul,Nh=Yl,Th=pa,Oh=cc.load,$h=cc.loadAll,Dh=Ch.dump,Rh=Se,Fh={binary:Zl,float:Vl,map:Hl,null:Bl,pairs:Ql,set:Xl,timestamp:zl,bool:jl,int:ql,merge:Gl,omap:Jl,seq:Fl,str:Rl},Hh=va("safeLoad","load"),Ph=va("safeLoadAll","loadAll"),Bh=va("safeDump","dump"),Qr={Type:Sh,Schema:Mh,FAILSAFE_SCHEMA:Lh,JSON_SCHEMA:Ih,CORE_SCHEMA:Nh,DEFAULT_SCHEMA:Th,load:Oh,loadAll:$h,dump:Dh,YAMLException:Rh,types:Fh,safeLoad:Hh,safeLoadAll:Ph,safeDump:Bh};const it=gt(),at=gt(),Ae=gt({}),ya=gt(-1),Me=gt(0),st=gt(),Ee=Tl(null,e=>(jh().then(e).catch(t=>console.error("Failed to load config.",t)),()=>{})),wa=md(Ee,(e,t)=>{const n=e?.custom_actions;return n?(qh(n).then(t).catch(r=>console.error("Failed to load cms actions.",r)),()=>{}):null});async function jh(){const e=new URL("../../cms-config/config.yml",window.location.href).href,t=await fetch(e);if(!t.ok)throw new Error(`Unable to fetch file ${e}`);return Qr.load(await t.text())}async function qh(e){const t=`../../cms-config/${e}`;return(await import(new URL(t,window.location.href).href)).default}var Vh=z('<nav><ul><li><a href="##posts" data-tooltip="Posts" data-placement="bottom"><!></a></li> <li><a href="##media" data-tooltip="Media Files" data-placement="bottom"><!></a></li></ul> <ul><li><a href="##exit" class="secondary" data-tooltip="Exit" data-placement="bottom"><!></a></li></ul></nav>');function Uh(e,t){le(t,!0);const n=()=>P(wa,"$cmsActions",i),r=()=>P(st,"$backend",i),[i,a]=me();function o(L){L.preventDefault();const D=new URL(L.currentTarget.href).hash.replaceAll("#","");t.onselectview(D),L.currentTarget.blur()}async function s(L){L.preventDefault(),n()?.onLogout&&await n().onLogout(),r()?.logout?await r().logout():history.back()}var l=Vh(),c=M(l),f=M(c),u=M(f),p=M(u);He(p,()=>wd);var d=F(f,2),h=M(d),g=M(h);He(g,()=>bd);var m=F(c,2),v=M(m),w=M(v),b=M(w);He(b,()=>_d),oe("click",u,o),oe("click",h,o),oe("click",w,s),W(e,l),ce(),a()}je(["click"]);const Yh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>text-box-edit</title><path d="M10 19.11L12.11 17H7V15H14V15.12L16.12 13H7V11H17V12.12L18.24 10.89C18.72 10.41 19.35 10.14 20.04 10.14C20.37 10.14 20.7 10.21 21 10.33V5C21 3.89 20.1 3 19 3H5C3.89 3 3 3.89 3 5V19C3 20.11 3.9 21 5 21H10V19.11M7 7H17V9H7V7M21.7 14.35L20.7 15.35L18.65 13.3L19.65 12.3C19.86 12.09 20.21 12.09 20.42 12.3L21.7 13.58C21.91 13.79 21.91 14.14 21.7 14.35M12 19.94L18.06 13.88L20.11 15.93L14.06 22H12V19.94Z" /></svg>';var Wh=z('<li class="svelte-s7v0ur"><a href="##select"><!> </a></li>');function Kh(e,t){le(t,!0);const n=()=>P(it,"$selectedCollection",i),r=()=>P(Ee,"$config",i),[i,a]=me();let o=dt(()=>n()?.name===t.name?"selected":"");function s(d){d.preventDefault(),re(it,r().collections.find(h=>h.name===t.name))}var l=Wh(),c=M(l);let f;var u=M(c);He(u,()=>Yh);var p=F(u,1,!0);te(()=>{f=Il(c,1,"collectionNav svelte-s7v0ur",null,f,{selected:y(o)}),fe(p,t.label)}),oe("click",c,s),W(e,l),ce(),a()}je(["click"]);var Ar={exports:{}},zh=Ar.exports,Xo;function Gh(){return Xo||(Xo=1,(function(e,t){(function(n,r){e.exports=r()})(zh,(function(){var n=1e3,r=6e4,i=36e5,a="millisecond",o="second",s="minute",l="hour",c="day",f="week",u="month",p="quarter",d="year",h="date",g="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,w={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(E){var x=["th","st","nd","rd"],k=E%100;return"["+E+(x[(k-20)%10]||x[k]||x[0])+"]"}},b=function(E,x,k){var S=String(E);return!S||S.length>=x?E:""+Array(x+1-S.length).join(k)+E},L={s:b,z:function(E){var x=-E.utcOffset(),k=Math.abs(x),S=Math.floor(k/60),A=k%60;return(x<=0?"+":"-")+b(S,2,"0")+":"+b(A,2,"0")},m:function E(x,k){if(x.date()<k.date())return-E(k,x);var S=12*(k.year()-x.year())+(k.month()-x.month()),A=x.clone().add(S,u),T=k-A<0,$=x.clone().add(S+(T?-1:1),u);return+(-(S+(k-A)/(T?A-$:$-A))||0)},a:function(E){return E<0?Math.ceil(E)||0:Math.floor(E)},p:function(E){return{M:u,y:d,w:f,d:c,D:h,h:l,m:s,s:o,ms:a,Q:p}[E]||String(E||"").toLowerCase().replace(/s$/,"")},u:function(E){return E===void 0}},D="en",O={};O[D]=w;var I="$isDayjsObject",B=function(E){return E instanceof U||!(!E||!E[I])},G=function E(x,k,S){var A;if(!x)return D;if(typeof x=="string"){var T=x.toLowerCase();O[T]&&(A=T),k&&(O[T]=k,A=T);var $=x.split("-");if(!A&&$.length>1)return E($[0])}else{var Y=x.name;O[Y]=x,A=Y}return!S&&A&&(D=A),A||!S&&D},q=function(E,x){if(B(E))return E.clone();var k=typeof x=="object"?x:{};return k.date=E,k.args=arguments,new U(k)},N=L;N.l=G,N.i=B,N.w=function(E,x){return q(E,{locale:x.$L,utc:x.$u,x:x.$x,$offset:x.$offset})};var U=(function(){function E(k){this.$L=G(k.locale,null,!0),this.parse(k),this.$x=this.$x||k.x||{},this[I]=!0}var x=E.prototype;return x.parse=function(k){this.$d=(function(S){var A=S.date,T=S.utc;if(A===null)return new Date(NaN);if(N.u(A))return new Date;if(A instanceof Date)return new Date(A);if(typeof A=="string"&&!/Z$/i.test(A)){var $=A.match(m);if($){var Y=$[2]-1||0,Q=($[7]||"0").substring(0,3);return T?new Date(Date.UTC($[1],Y,$[3]||1,$[4]||0,$[5]||0,$[6]||0,Q)):new Date($[1],Y,$[3]||1,$[4]||0,$[5]||0,$[6]||0,Q)}}return new Date(A)})(k),this.init()},x.init=function(){var k=this.$d;this.$y=k.getFullYear(),this.$M=k.getMonth(),this.$D=k.getDate(),this.$W=k.getDay(),this.$H=k.getHours(),this.$m=k.getMinutes(),this.$s=k.getSeconds(),this.$ms=k.getMilliseconds()},x.$utils=function(){return N},x.isValid=function(){return this.$d.toString()!==g},x.isSame=function(k,S){var A=q(k);return this.startOf(S)<=A&&A<=this.endOf(S)},x.isAfter=function(k,S){return q(k)<this.startOf(S)},x.isBefore=function(k,S){return this.endOf(S)<q(k)},x.$g=function(k,S,A){return N.u(k)?this[S]:this.set(A,k)},x.unix=function(){return Math.floor(this.valueOf()/1e3)},x.valueOf=function(){return this.$d.getTime()},x.startOf=function(k,S){var A=this,T=!!N.u(S)||S,$=N.p(k),Y=function(Ve,pe){var Le=N.w(A.$u?Date.UTC(A.$y,pe,Ve):new Date(A.$y,pe,Ve),A);return T?Le:Le.endOf(c)},Q=function(Ve,pe){return N.w(A.toDate()[Ve].apply(A.toDate("s"),(T?[0,0,0,0]:[23,59,59,999]).slice(pe)),A)},C=this.$W,R=this.$M,Z=this.$D,se="set"+(this.$u?"UTC":"");switch($){case d:return T?Y(1,0):Y(31,11);case u:return T?Y(1,R):Y(0,R+1);case f:var ge=this.$locale().weekStart||0,yt=(C<ge?C+7:C)-ge;return Y(T?Z-yt:Z+(6-yt),R);case c:case h:return Q(se+"Hours",0);case l:return Q(se+"Minutes",1);case s:return Q(se+"Seconds",2);case o:return Q(se+"Milliseconds",3);default:return this.clone()}},x.endOf=function(k){return this.startOf(k,!1)},x.$set=function(k,S){var A,T=N.p(k),$="set"+(this.$u?"UTC":""),Y=(A={},A[c]=$+"Date",A[h]=$+"Date",A[u]=$+"Month",A[d]=$+"FullYear",A[l]=$+"Hours",A[s]=$+"Minutes",A[o]=$+"Seconds",A[a]=$+"Milliseconds",A)[T],Q=T===c?this.$D+(S-this.$W):S;if(T===u||T===d){var C=this.clone().set(h,1);C.$d[Y](Q),C.init(),this.$d=C.set(h,Math.min(this.$D,C.daysInMonth())).$d}else Y&&this.$d[Y](Q);return this.init(),this},x.set=function(k,S){return this.clone().$set(k,S)},x.get=function(k){return this[N.p(k)]()},x.add=function(k,S){var A,T=this;k=Number(k);var $=N.p(S),Y=function(R){var Z=q(T);return N.w(Z.date(Z.date()+Math.round(R*k)),T)};if($===u)return this.set(u,this.$M+k);if($===d)return this.set(d,this.$y+k);if($===c)return Y(1);if($===f)return Y(7);var Q=(A={},A[s]=r,A[l]=i,A[o]=n,A)[$]||1,C=this.$d.getTime()+k*Q;return N.w(C,this)},x.subtract=function(k,S){return this.add(-1*k,S)},x.format=function(k){var S=this,A=this.$locale();if(!this.isValid())return A.invalidDate||g;var T=k||"YYYY-MM-DDTHH:mm:ssZ",$=N.z(this),Y=this.$H,Q=this.$m,C=this.$M,R=A.weekdays,Z=A.months,se=A.meridiem,ge=function(pe,Le,Je,It){return pe&&(pe[Le]||pe(S,T))||Je[Le].slice(0,It)},yt=function(pe){return N.s(Y%12||12,pe,"0")},Ve=se||function(pe,Le,Je){var It=pe<12?"AM":"PM";return Je?It.toLowerCase():It};return T.replace(v,(function(pe,Le){return Le||(function(Je){switch(Je){case"YY":return String(S.$y).slice(-2);case"YYYY":return N.s(S.$y,4,"0");case"M":return C+1;case"MM":return N.s(C+1,2,"0");case"MMM":return ge(A.monthsShort,C,Z,3);case"MMMM":return ge(Z,C);case"D":return S.$D;case"DD":return N.s(S.$D,2,"0");case"d":return String(S.$W);case"dd":return ge(A.weekdaysMin,S.$W,R,2);case"ddd":return ge(A.weekdaysShort,S.$W,R,3);case"dddd":return R[S.$W];case"H":return String(Y);case"HH":return N.s(Y,2,"0");case"h":return yt(1);case"hh":return yt(2);case"a":return Ve(Y,Q,!0);case"A":return Ve(Y,Q,!1);case"m":return String(Q);case"mm":return N.s(Q,2,"0");case"s":return String(S.$s);case"ss":return N.s(S.$s,2,"0");case"SSS":return N.s(S.$ms,3,"0");case"Z":return $}return null})(pe)||$.replace(":","")}))},x.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},x.diff=function(k,S,A){var T,$=this,Y=N.p(S),Q=q(k),C=(Q.utcOffset()-this.utcOffset())*r,R=this-Q,Z=function(){return N.m($,Q)};switch(Y){case d:T=Z()/12;break;case u:T=Z();break;case p:T=Z()/3;break;case f:T=(R-C)/6048e5;break;case c:T=(R-C)/864e5;break;case l:T=R/i;break;case s:T=R/r;break;case o:T=R/n;break;default:T=R}return A?T:N.a(T)},x.daysInMonth=function(){return this.endOf(u).$D},x.$locale=function(){return O[this.$L]},x.locale=function(k,S){if(!k)return this.$L;var A=this.clone(),T=G(k,S,!0);return T&&(A.$L=T),A},x.clone=function(){return N.w(this.$d,this)},x.toDate=function(){return new Date(this.valueOf())},x.toJSON=function(){return this.isValid()?this.toISOString():null},x.toISOString=function(){return this.$d.toISOString()},x.toString=function(){return this.$d.toUTCString()},E})(),j=U.prototype;return q.prototype=j,[["$ms",a],["$s",o],["$m",s],["$H",l],["$W",c],["$M",u],["$y",d],["$D",h]].forEach((function(E){j[E[1]]=function(x){return this.$g(x,E[0],E[1])}})),q.extend=function(E,x){return E.$i||(E(x,U,q),E.$i=!0),q},q.locale=G,q.isDayjs=B,q.unix=function(E){return q(1e3*E)},q.en=O[D],q.Ls=O,q.p={},q}))})(Ar)),Ar.exports}var Zh=Gh();const Te=Es(Zh);var Jh=z('<div class="item svelte-i3qvht"><input type="checkbox" name="entry-select"/> <a href="#editor" class="entry-info svelte-i3qvht"><div class="entry-name svelte-i3qvht"> </div> <div class="entry-status svelte-i3qvht"> </div> <div class="entry-date svelte-i3qvht"> </div></a></div>');function Qh(e,t){le(t,!0);const n=()=>P(s,"$selectedEntries",r),[r,i]=me();let a=t.entry.fields.draft?"draft":"published",o=Te(t.entry.fields.date).format("MM/DD/YY");const s=Lr("selectedEntries");function l(b){b.target.checked?re(s,[...n(),t.entry]):re(s,n().filter(L=>L!==t.entry))}function c(){re(Ae,{}),re(at,t.entry)}var f=Jh(),u=M(f),p=F(u,2),d=M(p),h=M(d),g=F(d,2),m=M(g),v=F(g,2),w=M(v);te(()=>{fe(h,t.entry.fields.title),fe(m,a),fe(w,o)}),oe("change",u,l),oe("click",p,c),W(e,f),ce(),i()}je(["change","click"]);var Xh=z("<div> </div>"),em=z('<div class="toast"><div aria-busy="true"></div> <!></div>');function Xr(e,t){var n=em(),r=F(M(n),2);{var i=a=>{var o=Xh(),s=M(o);te(()=>fe(s,t.msg)),W(a,o)};Ge(r,a=>{t.msg&&a(i)})}W(e,n)}const tm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>alert</title><path d="M13 14H11V9H13M13 18H11V16H13M1 21H23L12 2L1 21Z" /></svg>';var nm=z('<div class="toast warning"><!> <details class="svelte-bipkou"><summary> </summary> </details></div>');function Ct(e,t){var n=nm(),r=M(n);He(r,()=>tm);var i=F(r,2),a=M(i),o=M(a),s=F(a);te(()=>{fe(o,t.msg),fe(s,` ${t.details??""}`)}),W(e,n)}const _c='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>trash-can-outline</title><path d="M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z" /></svg>',es='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>pencil</title><path d="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z" /></svg>';var rm=z('<div id="empty" class="svelte-vl570e"><p>This collection has no entries.</p> <button class="svelte-vl570e"><!>Create New Entry</button></div>'),im=z('<div id="items" class="svelte-vl570e"></div>'),am=z('<main class="svelte-vl570e"><header class="svelte-vl570e"> <div id="listActions" class="svelte-vl570e"><button class="outline svelte-vl570e"><!>Delete</button> <button class="svelte-vl570e"><!>New</button></div></header> <!> <!> <!></main>');function om(e,t){le(t,!0);const n=()=>P(it,"$selectedCollection",o),r=()=>P(st,"$backend",o),i=()=>P(l,"$selectedEntries",o),a=()=>P(wa,"$cmsActions",o),[o,s]=me(),l=gt([]);Ir("selectedEntries",l);let c=K(void 0),f=K(void 0),u=K(et([])),p=K(void 0);ht(()=>{y(p)!==n()?.name&&d()});async function d(){try{if(!r()||!n().name)return;V(p,n().name,!0),V(c,r().getFiles(n().name),!0),V(u,await y(c)||[],!0)}catch{}}function h(){re(at,null),re(Ae,{}),window.location.hash="#/editor"}async function g(){try{await r().deleteFiles(i()),a()?.onDelete&&(V(f,a().onDelete(i()),!0),await y(f)),re(l,[]),d()}catch(j){console.error("Error deleting files",j)}}var m=am(),v=M(m),w=M(v),b=F(w),L=M(b),D=M(L);He(D,()=>_c);var O=F(L,2),I=M(O);He(I,()=>es);var B=F(v,2);{var G=j=>{var E=rm(),x=F(M(E),2),k=M(x);He(k,()=>es),oe("click",x,h),W(j,E)},q=j=>{var E=im();jt(E,21,()=>y(u),x=>x.name,(x,k)=>{Qh(x,{get entry(){return y(k)}})}),W(j,E)};Ge(B,j=>{y(u).length===0?j(G):j(q,!1)})}var N=F(B,2);nt(N,()=>y(c),j=>{Xr(j,{msg:"Loading"})},void 0,(j,E)=>{Ct(j,{msg:"Error getting entries",get details(){return y(E).message}})});var U=F(N,2);nt(U,()=>y(f),null,void 0,(j,E)=>{Ct(j,{msg:"'On delete' event action failed",get details(){return y(E).message}})}),te(()=>{fe(w,`${(n()?.label||"")??""} `),L.disabled=i().length===0}),oe("click",L,g),oe("click",O,h),W(e,m),ce(),s()}je(["click"]);var sm=z('<div class="svelte-1vgyypt"><input type="checkbox" name="media-select" class="svelte-1vgyypt"/> <img loading="lazy" crossorigin="use-credentials" class="svelte-1vgyypt"/> <small class="svelte-1vgyypt"> </small></div>');function lm(e,t){le(t,!0);const n=()=>P(a,"$selectedMediaFiles",r),[r,i]=me(),a=Lr("selectedMediaFiles");function o(p){p.target.checked?re(a,[...n(),t.media]):re(a,n().filter(d=>d!==t.media))}var s=sm(),l=M(s),c=F(l,2),f=F(c,2),u=M(f);te(()=>{J(c,"src",t.media.url_preview),J(c,"alt",t.media.alt),fe(u,t.media.name)}),oe("change",l,o),W(e,s),ce(),i()}je(["change"]);const ts='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>file-upload</title><path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M13.5,16V19H10.5V16H8L12,12L16,16H13.5M13,9V3.5L18.5,9H13Z" /></svg>';var cm=z('<div id="empty" class="svelte-1gxvaku"><p>No files found.</p> <button class="svelte-1gxvaku"><!>Upload a File</button></div>'),um=z('<div id="items" class="svelte-1gxvaku"></div>'),fm=z('<main class="svelte-1gxvaku"><header class="svelte-1gxvaku">Media Files <div id="listActions" class="svelte-1gxvaku"><button class="outline svelte-1gxvaku"><!>Delete</button> <button class="svelte-1gxvaku"><!>Upload</button></div></header> <!> <!></main>');function dm(e,t){le(t,!0);const n=()=>P(st,"$backend",i),r=()=>P(o,"$selectedMediaFiles",i),[i,a]=me(),o=gt([]);Ir("selectedMediaFiles",o);let s=K(void 0),l=K(et([]));async function c(){try{V(s,n()?.getMediaFiles(),!0),V(l,await y(s)||[],!0)}catch{}}async function f(){await n().uploadMediaFile(),c()}async function u(){try{await n().deleteFiles(r()),re(o,[]),c()}catch(I){console.error("Error deleting files",I)}}qe(()=>{c()});var p=fm(),d=M(p),h=F(M(d)),g=M(h),m=M(g);He(m,()=>_c);var v=F(g,2),w=M(v);He(w,()=>ts);var b=F(d,2);{var L=I=>{var B=cm(),G=F(M(B),2),q=M(G);He(q,()=>ts),oe("click",G,f),W(I,B)},D=I=>{var B=um();jt(B,21,()=>y(l),G=>G.name,(G,q)=>{lm(G,{get media(){return y(q)}})}),W(I,B)};Ge(b,I=>{y(l).length===0?I(L):I(D,!1)})}var O=F(b,2);nt(O,()=>y(s),I=>{Xr(I,{msg:"Loading"})},void 0,(I,B)=>{Ct(I,{msg:"Error getting entries",get details(){return y(B).message}})}),te(()=>g.disabled=r().length===0),oe("click",g,u),oe("click",v,f),W(e,p),ce(),a()}je(["click"]);var pm=z('<aside class="svelte-bdf84k"><ul class="svelte-bdf84k"><!></ul></aside> <!>',1),hm=z('<!> <div id="dash" class="page svelte-bdf84k"><!></div>',1);function mm(e,t){le(t,!0);const n=()=>P(Ee,"$config",i),r=()=>P(it,"$selectedCollection",i),[i,a]=me();let o=K("posts"),s=dt(()=>n()?.collections);ht(()=>{r()||re(it,y(s)?.[0])});function l(g){V(o,g,!0)}var c=hm(),f=Re(c);Uh(f,{onselectview:l});var u=F(f,2),p=M(u);{var d=g=>{var m=pm(),v=Re(m),w=M(v),b=M(w);{var L=O=>{var I=Kt(),B=Re(I);jt(B,17,()=>y(s),$i,(G,q)=>{Kh(G,xr(()=>y(q)))}),W(O,I)};Ge(b,O=>{y(s)&&O(L)})}var D=F(v,2);om(D,{}),W(g,m)},h=g=>{dm(g,{})};Ge(p,g=>{y(o)==="posts"?g(d):y(o)==="media"&&g(h,1)})}W(e,c),ce(),a()}const gm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>arrow-left</title><path d="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z" /></svg>',ba=(()=>{if(typeof self>"u")return!1;if("top"in self&&self!==top)try{top.window.document._=0}catch{return!1}return"showOpenFilePicker"in self})(),vm=ba?Promise.resolve().then(function(){return xm}):Promise.resolve().then(function(){return Lm});async function _a(...e){return(await vm).default(...e)}const ym=ba?Promise.resolve().then(function(){return Em}):Promise.resolve().then(function(){return Nm});async function wm(...e){return(await ym).default(...e)}const bm=ba?Promise.resolve().then(function(){return Sm}):Promise.resolve().then(function(){return Om});async function qi(...e){return(await bm).default(...e)}const _m=async e=>{const t=await e.getFile();return t.handle=e,t};var km=async(e=[{}])=>{Array.isArray(e)||(e=[e]);const t=[];e.forEach((i,a)=>{t[a]={description:i.description||"Files",accept:{}},i.mimeTypes?i.mimeTypes.map(o=>{t[a].accept[o]=i.extensions||[]}):t[a].accept["*/*"]=i.extensions||[]});const n=await window.showOpenFilePicker({id:e[0].id,startIn:e[0].startIn,types:t,multiple:e[0].multiple||!1,excludeAcceptAllOption:e[0].excludeAcceptAllOption||!1}),r=await Promise.all(n.map(_m));return e[0].multiple?r:r[0]},xm={__proto__:null,default:km};function Er(e){function t(n){if(Object(n)!==n)return Promise.reject(new TypeError(n+" is not an object."));var r=n.done;return Promise.resolve(n.value).then(function(i){return{value:i,done:r}})}return Er=function(n){this.s=n,this.n=n.next},Er.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(n){var r=this.s.return;return r===void 0?Promise.resolve({value:n,done:!0}):t(r.apply(this.s,arguments))},throw:function(n){var r=this.s.return;return r===void 0?Promise.reject(n):t(r.apply(this.s,arguments))}},new Er(e)}const kc=async(e,t,n=e.name,r)=>{const i=[],a=[];var o,s=!1,l=!1;try{for(var c,f=(function(u){var p,d,h,g=2;for(typeof Symbol<"u"&&(d=Symbol.asyncIterator,h=Symbol.iterator);g--;){if(d&&(p=u[d])!=null)return p.call(u);if(h&&(p=u[h])!=null)return new Er(p.call(u));d="@@asyncIterator",h="@@iterator"}throw new TypeError("Object is not async iterable")})(e.values());s=!(c=await f.next()).done;s=!1){const u=c.value,p=`${n}/${u.name}`;u.kind==="file"?a.push(u.getFile().then(d=>(d.directoryHandle=e,d.handle=u,Object.defineProperty(d,"webkitRelativePath",{configurable:!0,enumerable:!0,get:()=>p})))):u.kind!=="directory"||!t||r&&r(u)||i.push(kc(u,t,p,r))}}catch(u){l=!0,o=u}finally{try{s&&f.return!=null&&await f.return()}finally{if(l)throw o}}return[...(await Promise.all(i)).flat(),...await Promise.all(a)]};var Am=async(e={})=>{e.recursive=e.recursive||!1,e.mode=e.mode||"read";const t=await window.showDirectoryPicker({id:e.id,startIn:e.startIn,mode:e.mode});return(await(await t.values()).next()).done?[t]:kc(t,e.recursive,void 0,e.skipDirectory)},Em={__proto__:null,default:Am},Cm=async(e,t=[{}],n=null,r=!1,i=null)=>{Array.isArray(t)||(t=[t]),t[0].fileName=t[0].fileName||"Untitled";const a=[];let o=null;if(e instanceof Blob&&e.type?o=e.type:e.headers&&e.headers.get("content-type")&&(o=e.headers.get("content-type")),t.forEach((c,f)=>{a[f]={description:c.description||"Files",accept:{}},c.mimeTypes?(f===0&&o&&c.mimeTypes.push(o),c.mimeTypes.map(u=>{a[f].accept[u]=c.extensions||[]})):o?a[f].accept[o]=c.extensions||[]:a[f].accept["*/*"]=c.extensions||[]}),n)try{await n.getFile()}catch(c){if(n=null,r)throw c}const s=n||await window.showSaveFilePicker({suggestedName:t[0].fileName,id:t[0].id,startIn:t[0].startIn,types:a,excludeAcceptAllOption:t[0].excludeAcceptAllOption||!1});!n&&i&&i(s);const l=await s.createWritable();return"stream"in e?(await e.stream().pipeTo(l),s):"body"in e?(await e.body.pipeTo(l),s):(await l.write(await e),await l.close(),s)},Sm={__proto__:null,default:Cm},Mm=async(e=[{}])=>(Array.isArray(e)||(e=[e]),new Promise((t,n)=>{const r=document.createElement("input");r.type="file";const i=[...e.map(a=>a.mimeTypes||[]),...e.map(a=>a.extensions||[])].join();r.multiple=e[0].multiple||!1,r.accept=i||"",r.style.display="none",document.body.append(r),r.addEventListener("cancel",()=>{r.remove(),n(new DOMException("The user aborted a request.","AbortError"))}),r.addEventListener("change",()=>{r.remove(),t(r.multiple?Array.from(r.files):r.files[0])}),"showPicker"in HTMLInputElement.prototype?r.showPicker():r.click()})),Lm={__proto__:null,default:Mm},Im=async(e=[{}])=>(Array.isArray(e)||(e=[e]),e[0].recursive=e[0].recursive||!1,new Promise((t,n)=>{const r=document.createElement("input");r.type="file",r.webkitdirectory=!0,r.style.display="none",document.body.append(r),r.addEventListener("cancel",()=>{r.remove(),n(new DOMException("The user aborted a request.","AbortError"))}),r.addEventListener("change",()=>{r.remove();let i=Array.from(r.files);e[0].recursive?e[0].recursive&&e[0].skipDirectory&&(i=i.filter(a=>a.webkitRelativePath.split("/").every(o=>!e[0].skipDirectory({name:o,kind:"directory"})))):i=i.filter(a=>a.webkitRelativePath.split("/").length===2),t(i)}),"showPicker"in HTMLInputElement.prototype?r.showPicker():r.click()})),Nm={__proto__:null,default:Im},Tm=async(e,t={})=>{Array.isArray(t)&&(t=t[0]);const n=document.createElement("a");let r=e;"body"in e&&(r=await(async function(o,s){const l=o.getReader(),c=new ReadableStream({start:p=>(async function d(){return l.read().then(({done:h,value:g})=>{if(!h)return p.enqueue(g),d();p.close()})})()}),f=new Response(c),u=await f.blob();return l.releaseLock(),new Blob([u],{type:s})})(e.body,e.headers.get("content-type"))),n.download=t.fileName||"Untitled",n.href=URL.createObjectURL(await r);const i=()=>{typeof a=="function"&&a()},a=t.legacySetup&&t.legacySetup(i,()=>a(),n);return n.addEventListener("click",()=>{setTimeout(()=>URL.revokeObjectURL(n.href),3e4),i()}),n.click(),null},Om={__proto__:null,default:Tm},Cr={exports:{}},$m=Cr.exports,ns;function Dm(){return ns||(ns=1,(function(e,t){(function(n,r){e.exports=r()})($m,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,i=/\d/,a=/\d\d/,o=/\d\d?/,s=/\d*[^-_:/,()\s\d]+/,l={},c=function(m){return(m=+m)+(m>68?1900:2e3)},f=function(m){return function(v){this[m]=+v}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(m){(this.zone||(this.zone={})).offset=(function(v){if(!v||v==="Z")return 0;var w=v.match(/([+-]|\d\d)/g),b=60*w[1]+(+w[2]||0);return b===0?0:w[0]==="+"?-b:b})(m)}],p=function(m){var v=l[m];return v&&(v.indexOf?v:v.s.concat(v.f))},d=function(m,v){var w,b=l.meridiem;if(b){for(var L=1;L<=24;L+=1)if(m.indexOf(b(L,0,v))>-1){w=L>12;break}}else w=m===(v?"pm":"PM");return w},h={A:[s,function(m){this.afternoon=d(m,!1)}],a:[s,function(m){this.afternoon=d(m,!0)}],Q:[i,function(m){this.month=3*(m-1)+1}],S:[i,function(m){this.milliseconds=100*+m}],SS:[a,function(m){this.milliseconds=10*+m}],SSS:[/\d{3}/,function(m){this.milliseconds=+m}],s:[o,f("seconds")],ss:[o,f("seconds")],m:[o,f("minutes")],mm:[o,f("minutes")],H:[o,f("hours")],h:[o,f("hours")],HH:[o,f("hours")],hh:[o,f("hours")],D:[o,f("day")],DD:[a,f("day")],Do:[s,function(m){var v=l.ordinal,w=m.match(/\d+/);if(this.day=w[0],v)for(var b=1;b<=31;b+=1)v(b).replace(/\[|\]/g,"")===m&&(this.day=b)}],w:[o,f("week")],ww:[a,f("week")],M:[o,f("month")],MM:[a,f("month")],MMM:[s,function(m){var v=p("months"),w=(p("monthsShort")||v.map((function(b){return b.slice(0,3)}))).indexOf(m)+1;if(w<1)throw new Error;this.month=w%12||w}],MMMM:[s,function(m){var v=p("months").indexOf(m)+1;if(v<1)throw new Error;this.month=v%12||v}],Y:[/[+-]?\d+/,f("year")],YY:[a,function(m){this.year=c(m)}],YYYY:[/\d{4}/,f("year")],Z:u,ZZ:u};function g(m){var v,w;v=m,w=l&&l.formats;for(var b=(m=v.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(q,N,U){var j=U&&U.toUpperCase();return N||w[U]||n[U]||w[j].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(E,x,k){return x||k.slice(1)}))}))).match(r),L=b.length,D=0;D<L;D+=1){var O=b[D],I=h[O],B=I&&I[0],G=I&&I[1];b[D]=G?{regex:B,parser:G}:O.replace(/^\[|\]$/g,"")}return function(q){for(var N={},U=0,j=0;U<L;U+=1){var E=b[U];if(typeof E=="string")j+=E.length;else{var x=E.regex,k=E.parser,S=q.slice(j),A=x.exec(S)[0];k.call(N,A),q=q.replace(A,"")}}return(function(T){var $=T.afternoon;if($!==void 0){var Y=T.hours;$?Y<12&&(T.hours+=12):Y===12&&(T.hours=0),delete T.afternoon}})(N),N}}return function(m,v,w){w.p.customParseFormat=!0,m&&m.parseTwoDigitYear&&(c=m.parseTwoDigitYear);var b=v.prototype,L=b.parse;b.parse=function(D){var O=D.date,I=D.utc,B=D.args;this.$u=I;var G=B[1];if(typeof G=="string"){var q=B[2]===!0,N=B[3]===!0,U=q||N,j=B[2];N&&(j=B[2]),l=this.$locale(),!q&&j&&(l=w.Ls[j]),this.$d=(function(S,A,T,$){try{if(["x","X"].indexOf(A)>-1)return new Date((A==="X"?1e3:1)*S);var Y=g(A)(S),Q=Y.year,C=Y.month,R=Y.day,Z=Y.hours,se=Y.minutes,ge=Y.seconds,yt=Y.milliseconds,Ve=Y.zone,pe=Y.week,Le=new Date,Je=R||(Q||C?1:Le.getDate()),It=Q||Le.getFullYear(),hr=0;Q&&!C||(hr=C>0?C-1:Le.getMonth());var mr,ui=Z||0,fi=se||0,di=ge||0,pi=yt||0;return Ve?new Date(Date.UTC(It,hr,Je,ui,fi,di,pi+60*Ve.offset*1e3)):T?new Date(Date.UTC(It,hr,Je,ui,fi,di,pi)):(mr=new Date(It,hr,Je,ui,fi,di,pi),pe&&(mr=$(mr).week(pe).toDate()),mr)}catch{return new Date("")}})(O,G,I,w),this.init(),j&&j!==!0&&(this.$L=this.locale(j).$L),U&&O!=this.format(G)&&(this.$d=new Date("")),l={}}else if(G instanceof Array)for(var E=G.length,x=1;x<=E;x+=1){B[1]=G[x-1];var k=w.apply(this,B);if(k.isValid()){this.$d=k.$d,this.$L=k.$L,this.init();break}x===E&&(this.$d=new Date(""))}else L.call(this,D)}}}))})(Cr)),Cr.exports}var Rm=Dm();const xc=Es(Rm);Te.extend(xc);const ka="../../cms-config/",rs=`Unable to parse markdown entry. Backend must implement 'replacePreviewLinks()'
|
|
34
|
+
and return a valid string.`;function Hr(e,t){let n=Te(t),r="";switch(e){case"datetime-local":r=n.format("YYYY-MM-DDTHH:mm");break;case"date":r=n.format("YYYY-MM-DD");break;case"time":r=n.format("HH:mm");break}return r}function Fm(e,t){const n=e?.previews.styles.find(i=>i.name===t)?.files;if(!n)return;const r=[];return n.forEach(i=>{const a=`${ka}${i}`;r.push(new URL(a,window.location.href).href)}),r.map(i=>`<link rel="stylesheet" href="${i}">`).join(`
|
|
35
|
+
`)}async function Hm(e,t){const n=e?.previews.templates.find(i=>i.name===t)?.template;if(!n)return;const r=new URL(`${ka}${n}`,window.location.href).href;try{const i=await fetch(r);if(!i.ok)throw new Error(`Unable to fetch file ${r}`);return await i.text()}catch(i){console.error(i);return}}function Pm(e,t){return e?.replace("{{styles}}",t).replaceAll("{{",'<span data-tag="').replaceAll("}}",'"></span>')}async function Ac(e,t,n){let r;switch(e.widget){case"markdown":if(!n?.replacePreviewLinks)throw new Error(rs);if(r=await n?.replacePreviewLinks(t),r==null)throw new Error(rs);break;case"datetime":let i;switch(e.type){case"time":i=Te(t.toString(),"hh:mm").toISOString();break;case"date":i=Te(t.toString(),"YYYY-MM-DD").toISOString();break;default:i=Te(t.toString(),"YYYY-MM-DDThh:mm").toISOString();break}r=new Date(i);break;case"boolean":r=t==="true";break;case"number":r=Number(t);break;case"hidden":switch(e.type){case"datetime-local":r=new Date(Te(t.toString(),"YYYY-MM-DDThh:mm").toISOString());break;case"time":r=new Date(Te(t.toString(),"hh:mm").toISOString());break;case"date":r=new Date(Te(t.toString(),"YYYY-MM-DD").toISOString());break;case"boolean":r=t==="true";break;case"number":r=Number(t);break;default:r=t;break}break;default:r=t;break}return r}function Bm(e,t){const{slug:n,extension:r}=e,{title:i,date:a}=t,o=i.toLowerCase().replaceAll(/\W+/g,"-"),s=Te(a);return`${n.replaceAll("{{slug}}",o).replaceAll("{{year}}",s.format("YYYY")).replaceAll("{{month}}",s.format("MM")).replaceAll("{{day}}",s.format("DD")).replaceAll("{{hour}}",s.format("HH")).replaceAll("{{minute}}",s.format("mm")).replaceAll("{{second}}",s.format("ss"))}.${r}`}function jm(e,t){const n={...t},{date:r,body:i}={...n.fields};delete n.fields.body;const a=Qr.dump(n.fields,{quotingType:'"',forceQuotes:!0});return n.date=r,n.body=i,n.collection=e.name,n.name||(n.name=Bm(e,n.fields)),n.raw=`---
|
|
36
36
|
${a}---
|
|
37
37
|
|
|
38
|
-
${n.body}`,n}function
|
|
38
|
+
${n.body}`,n}function xa(e){if(!/^---(\r?\n)/.test(e.trim()))return["date: 0001-01-01T12:00:00-00:00",e.trim()];const t="---",n="{#{br}#}";return e.trim().replace(t,n).replace(t,n).split(n).filter(a=>a.length>0).map(a=>a.trim())}function qm(e){switch(e){case".md":case".markdown":return"text/markdown";default:return"text/plain"}}function sr(e){const t=/!?\[.+\]\(.+\)/g,n=/!?\[.+\]\(/,r=/\)/;return e.match(t)?.map(a=>a.replace(n,"").replace(r,""))||[]}async function Vm(e,t){const{file:n}=Be(e).backend;if(!n)return;const i=await import(new URL(`${ka}${n}`,window.location.href).href),a={configStore:e,backendStore:t,getStoreValueFunc:Be,getContentsFunc:xa,parseLinksFunc:sr,fileOpenFunc:_a};return i.default.init(a)}var Um=z('<button form="entry-data">Save</button>'),Ym=z('<button form="entry-data">Save</button>'),Wm=z('<button form="entry-data" disabled="">Save</button>'),Km=z('<nav><ul><li><a href="##back" class="svelte-g1hcr7"><!></a></li></ul> <ul><li class="svelte-g1hcr7"> <span class="svelte-g1hcr7">/</span> </li></ul> <ul><li><!></li></ul></nav>');function zm(e,t){le(t,!0);const n=()=>P(at,"$editingEntry",c),r=()=>P(Me,"$loadedWidgets",c),i=()=>P(ya,"$loadingWidgets",c),a=()=>P(Ae,"$draftEntry",c),o=()=>P(it,"$selectedCollection",c),s=()=>P(st,"$backend",c),l=()=>P(p,"$submitted",c),[c,f]=me(),u=Lr("formState"),p=Lr("submitted");let d=K(!1),h=K(et(Mi(n()))),g=K(void 0),m=!1;ht(()=>{!m&&r()===i()&&(V(g,Mi(a()),!0),m=!0)}),ht(()=>{const k=JSON.stringify(n())!==JSON.stringify(y(h)),S=JSON.stringify(a())!==JSON.stringify(y(g));(k||S)&&v()});async function v(){const{entryForm:k}=u;k&&(V(d,!await w(k)),V(h,n(),!0),V(g,a(),!0))}async function w(k){if(!n())return!1;const S=new FormData(k);for(const[A,T]of S){const $=o().fields.find(Z=>Z.name===A),Y=n()?.fields[$.name]??n()[$.name],Q=await Ac($,T,s());let C,R;switch($.widget){case"datetime":C=new Date(Y).getTime(),R=Q.getTime();break;case"markdown":C=Y.trim().replaceAll(`\r
|
|
39
39
|
`,`
|
|
40
|
-
`),
|
|
40
|
+
`),R=Q.trim().replaceAll(`\r
|
|
41
41
|
`,`
|
|
42
|
-
`);break;case"hidden":switch(D.type){case"datetime-local":case"date":case"time":M=new Date(W).getTime(),j=Z.getTime();break;default:M=W,j=Z;break}break;default:M=W,j=Z;break}if(M!==j)return!1}return!0}function k(b){b.preventDefault(),history.back()}var L=Sm(),$=I(L),N=I($),E=I(N);E.__click=k;var P=I(E);Be(P,()=>Zh);var G=R($,2),V=I(G),T=I(V),Y=R(T,2),B=R(G,2),C=I(B),x=I(C);Xe(x,l,b=>{var S=Cm();q(b,S)},(b,S)=>{var A=Am();ee(()=>A.disabled=!y(d)),q(b,A)},(b,S)=>{var A=Em();ee(()=>A.disabled=!y(d)),q(b,A)}),ee(()=>{ce(T,`${o()?.label??""} `),ce(Y,` ${(n()?.fields.title||"New File")??""}`)}),q(e,L),le(),f()}Ve(["click"]);var Im=z('<label class="editorInput"> <input type="checkbox" role="switch" form="ignore"/> <input type="hidden"/></label>');function Lm(e,t){se(t,!0);const n=()=>H(Ee,"$draftEntry",o),r=()=>H(tt,"$selectedCollection",o),i=()=>H(nt,"$editingEntry",o),a=()=>H(Te,"$loadedWidgets",o),[o,s]=he();let l=je(t,"checked",7,!1),c=je(t,"required",3,!1);function f(){const h={...n()};l()==null?h[t.name]=r()?.fields.find(v=>v.name===t.name).default:h[t.name]=l(),re(Ee,h)}async function u(){i()&&l(i().fields[t.name]),f(),re(Te,a()+1)}Ue(()=>{u()});var p=Im(),d=I(p),m=R(d);m.__change=f;var g=R(m,2);ee(()=>{Q(p,"for",t.name),ce(d,`${t.label??""} `),Q(m,"id",t.name),Q(m,"name",t.name),m.required=c(),Q(g,"id",t.name),Q(g,"name",t.name),Wf(g,l()),g.required=c()}),zf(m,l),q(e,p),le(),s()}Ve(["change"]);var Nm=z('<input type="time"/>'),Tm=z('<input type="date"/>'),Om=z('<input type="datetime-local"/>'),$m=z('<label class="editorInput"> <!></label>');function Dm(e,t){se(t,!0);const n=()=>H(Ee,"$draftEntry",a),r=()=>H(nt,"$editingEntry",a),i=()=>H(Te,"$loadedWidgets",a),[a,o]=he();let s=je(t,"type",3,"datetime-local"),l=je(t,"value",23,()=>$r(s(),new Date)),c=je(t,"required",3,!0);function f(){const v={...n()};v[t.name]=l(),re(Ee,v)}async function u(){if(r()){const v=r().fields;l($r(s(),new Date(v[t.name])))}f(),re(Te,i()+1)}Ue(()=>{u()});var p=$m(),d=I(p),m=R(d);{var g=v=>{var w=Nm();w.__input=f,ee(()=>{Q(w,"id",t.name),Q(w,"name",t.name),w.required=c()}),Ft(w,l),q(v,w)},h=v=>{var w=st(),k=be(w);{var L=N=>{var E=Tm();E.__input=f,ee(()=>{Q(E,"id",t.name),Q(E,"name",t.name),E.required=c()}),Ft(E,l),q(N,E)},$=N=>{var E=Om();E.__input=f,ee(()=>{Q(E,"id",t.name),Q(E,"name",t.name),E.required=c()}),Ft(E,l),q(N,E)};Ne(k,N=>{s()==="date"?N(L):N($,!1)},!0)}q(v,w)};Ne(m,v=>{s()==="time"?v(g):v(h,!1)})}ee(()=>{Q(p,"for",t.name),ce(d,`${t.label??""} `)}),q(e,p),le(),o()}Ve(["input"]);var Rm=z('<input type="text"/>'),Fm=z("<textarea></textarea>"),Hm=z('<label class="editorInput"> <!></label>');function Xo(e,t){se(t,!0);const n=()=>H(Ee,"$draftEntry",o),r=()=>H(tt,"$selectedCollection",o),i=()=>H(nt,"$editingEntry",o),a=()=>H(Te,"$loadedWidgets",o),[o,s]=he();let l=je(t,"multiline",3,!1),c=je(t,"required",3,!0),f=je(t,"value",7,"");function u(){const w={...n()};f()?w[t.name]=f():w[t.name]=r()?.fields.find(k=>k.name===t.name).label,re(Ee,w)}async function p(){i()&&f(t.name==="body"?i().body:i().fields[t.name]),u(),re(Te,a()+1)}Ue(()=>{p()});var d=Hm(),m=I(d),g=R(m);{var h=w=>{var k=Rm();k.__input=u,ee(()=>{Q(k,"id",t.name),Q(k,"name",t.name),k.required=c()}),Ft(k,f),q(w,k)},v=w=>{var k=Fm();k.__input=u,ee(()=>{Q(k,"id",t.name),Q(k,"name",t.name),k.required=c()}),Ft(k,f),q(w,k)};Ne(g,w=>{l()?w(v,!1):w(h)})}ee(()=>{Q(d,"for",t.name),ce(m,`${t.label??""} `)}),q(e,d),le(),s()}Ve(["input"]);var Pm=z('<label class="editorInput"> <input type="number"/></label>');function Bm(e,t){se(t,!0);const n=()=>H(Ee,"$draftEntry",a),r=()=>H(nt,"$editingEntry",a),i=()=>H(Te,"$loadedWidgets",a),[a,o]=he();let s=je(t,"value",7),l=je(t,"required",3,!0);function c(){const m={...n()};m[t.name]=s(),re(Ee,m)}async function f(){r()&&s(r().fields[t.name]),c(),re(Te,i()+1)}Ue(()=>{f()});var u=Pm(),p=I(u),d=R(p);d.__input=c,ee(()=>{Q(u,"for",t.name),ce(p,`${t.label??""} `),Q(d,"id",t.name),Q(d,"name",t.name),Q(d,"step",t.step),Q(d,"min",t.min),Q(d,"max",t.max),d.required=l()}),Ft(d,s),q(e,u),le(),o()}Ve(["input"]);const jm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>format-bold</title><path d="M13.5,15.5H10V12.5H13.5A1.5,1.5 0 0,1 15,14A1.5,1.5 0 0,1 13.5,15.5M10,6.5H13A1.5,1.5 0 0,1 14.5,8A1.5,1.5 0 0,1 13,9.5H10M15.6,10.79C16.57,10.11 17.25,9 17.25,8C17.25,5.74 15.5,4 13.25,4H7V18H14.04C16.14,18 17.75,16.3 17.75,14.21C17.75,12.69 16.89,11.39 15.6,10.79Z" /></svg>',qm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>format-italic</title><path d="M10,4V7H12.21L8.79,15H6V18H14V15H11.79L15.21,7H18V4H10Z" /></svg>',Vm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>format-list-bulleted</title><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>',Um='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>format-list-numbered</title><path d="M7,13V11H21V13H7M7,19V17H21V19H7M7,7V5H21V7H7M3,8V5H2V4H4V8H3M2,17V16H5V20H2V19H4V18.5H3V17.5H4V17H2M4.25,10A0.75,0.75 0 0,1 5,10.75C5,10.95 4.92,11.14 4.79,11.27L3.12,13H5V14H2V13.08L4,11H2V10H4.25Z" /></svg>',Ym='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>horizontal-rule</title><path d="M19,13H5V11H19V13Z" /></svg>',Wm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>format-quote-close</title><path d="M14,17H17L19,13V7H13V13H16M6,17H9L11,13V7H5V13H8L6,17Z" /></svg>',Km='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>link</title><path d="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z" /></svg>',zm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>image</title><path d="M8.5,13.5L11,16.5L14.5,12L19,18H5M21,19V5C21,3.89 20.1,3 19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19Z" /></svg>';var Gm=z('<option class="svelte-8wonn1"> </option>'),Zm=z('<button class="secondary svelte-8wonn1"><!></button>'),Jm=z('<div class="editor-menu svelte-8wonn1"><select name="text-type" form="ignore" class="svelte-8wonn1"></select> <!></div>');function Qm(e,t){se(t,!0);let n=K(void 0),r=K(void 0);const i=c(),a=[{name:"bold",icon:jm},{name:"italic",icon:qm},{name:"listBulleted",icon:Vm},{name:"listNumbered",icon:Um},{name:"quote",icon:Wm},{name:"horizontalRule",icon:Ym},{name:"link",icon:Km},{name:"image",icon:zm}];function o(d){d.preventDefault();const{action:m}=d.currentTarget.dataset;t.onactionselect(m)}function s(d){const m=d.currentTarget.value;t.ontexttypeselect(m)}function l(){const m=document.getSelection().focusNode?.parentElement;if(!y(r).contains(m))return;const{localName:g}=m;switch(g){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":y(n).value=parseInt(g.split("").at(-1));break;default:y(n).value="p";break}}function c(){const d=[];for(let m=0;m<=6;m++){let g;m===0?g={title:"Normal",value:"p"}:g={title:`Heading ${m}`,value:m},d.push(g)}return d}Ue(()=>{U(r,document.querySelector("#md-editor"),!0)});var f=Jm();on("selectionchange",Yr,l);var u=I(f);u.__change=s,Pt(u,21,()=>i,Li,(d,m)=>{var g=Gm(),h=I(g),v={};ee(()=>{ce(h,y(m).title),v!==(v=y(m).value)&&(g.value=(g.__value=y(m).value)??"")}),q(d,g)}),An(u,d=>U(n,d),()=>y(n));var p=R(u,2);Pt(p,17,()=>a,Li,(d,m)=>{var g=Zm();g.__click=o;var h=I(g);Be(h,()=>y(m).icon),ee(()=>Q(g,"data-action",y(m).name)),q(d,g)}),q(e,f),le()}Ve(["change","click"]);var Xm=z('<div id="link-editor-container" class="svelte-1qtwn58"><div id="link-editor" class="svelte-1qtwn58"><div class="svelte-1qtwn58">Enter link:</div> <input form="md-link-editor" type="url" name="url" placeholder="https://example.com" required class="svelte-1qtwn58"/> <button class="secondary svelte-1qtwn58" form="md-link-editor" type="submit">Save</button></div></div>');function eg(e,t){se(t,!0);let n=K(!1),r=K(void 0),i=K(void 0);dt(()=>{y(n)&&y(i).focus()});function a(){const d=document.getSelection();if(d.focusNode.parentElement.localName==="a"){t.onsaveurl({});return}else if(y(n))U(n,!y(n)),y(i).value="";else{const{startOffset:m,endOffset:g}=d.getRangeAt(0);U(n,m!==g)}}function o(d){d.preventDefault();const m=y(i).value;y(i).value="",U(n,!1),t.onsaveurl({href:m})}function s(){if(!y(n))return;const m=document.getSelection().focusNode;y(r).contains(m)||(U(n,!1),y(i).value="",t.onsaveurl(null))}Ue(()=>{const d=document.querySelector("#md-link-editor");return d.addEventListener("submit",o),()=>{d.removeEventListener("submit",o)}});var l={toggleEditor:a},c=Xm();on("selectionchange",Yr,s);let f;var u=I(c),p=R(I(u),2);return An(p,d=>U(i,d),()=>y(i)),An(u,d=>U(r,d),()=>y(r)),ee(()=>f=Vf(c,"",f,{visibility:y(n)?"visible":"hidden"})),q(e,c),le(l)}var tg=z('<div><img alt="" loading="lazy" crossorigin="use-credentials" class="svelte-kkm0gm"/> <small class="svelte-kkm0gm"> </small></div>'),ng=z('<dialog open><article><header>Select Image</header> <div class="images svelte-kkm0gm"></div> <footer class="svelte-kkm0gm"><button class="secondary svelte-kkm0gm">Cancel</button> <button class="svelte-kkm0gm">Select</button></footer></article></dialog>');function rg(e,t){se(t,!0);const n=()=>H(rt,"$backend",r),[r,i]=he();let a=K(Qe([])),o=K(void 0);async function s(){const v=await n()?.getMediaFiles();U(a,v||[],!0)}function l(v){U(o,v,!0)}function c(v){v.preventDefault(),t.onselectimg(y(o))}function f(v){v.preventDefault(),v.currentTarget===v.target&&t.onselectimg(null)}Ue(()=>{s();const{body:v}=document;return v.classList.add("contain-scroll"),()=>{v.classList.remove("contain-scroll")}});var u=ng();u.__click=f;var p=I(u),d=R(I(p),2);Pt(d,21,()=>y(a),v=>v.name,(v,w)=>{var k=tg();let L;k.__click=()=>l(y(w));var $=I(k),N=R($,2),E=I(N);ee(()=>{L=bl(k,1,"img-container svelte-kkm0gm",null,L,{selected:y(o)===y(w)}),Q($,"src",y(w).url_preview),ce(E,y(w).name)}),q(v,k)});var m=R(d,2),g=I(m);g.__click=f;var h=R(g,2);h.__click=c,ee(()=>h.disabled=!y(o)),q(e,u),le(),i()}Ve(["click"]);var ig=typeof global=="object"&&global&&global.Object===Object&&global,ag=typeof self=="object"&&self&&self.Object===Object&&self,gc=ig||ag||Function("return this")(),Dr=gc.Symbol,vc=Object.prototype,og=vc.hasOwnProperty,sg=vc.toString,Rn=Dr?Dr.toStringTag:void 0;function lg(e){var t=og.call(e,Rn),n=e[Rn];try{e[Rn]=void 0;var r=!0}catch{}var i=sg.call(e);return r&&(t?e[Rn]=n:delete e[Rn]),i}var cg=Object.prototype,ug=cg.toString;function fg(e){return ug.call(e)}var dg="[object Null]",pg="[object Undefined]",es=Dr?Dr.toStringTag:void 0;function hg(e){return e==null?e===void 0?pg:dg:es&&es in Object(e)?lg(e):fg(e)}function mg(e){return e!=null&&typeof e=="object"}var gg="[object Symbol]";function vg(e){return typeof e=="symbol"||mg(e)&&hg(e)==gg}var yg=/\s/;function wg(e){for(var t=e.length;t--&&yg.test(e.charAt(t)););return t}var _g=/^\s+/;function bg(e){return e&&e.slice(0,wg(e)+1).replace(_g,"")}function Pi(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var ts=NaN,kg=/^[-+]0x[0-9a-f]+$/i,xg=/^0b[01]+$/i,Ag=/^0o[0-7]+$/i,Eg=parseInt;function ns(e){if(typeof e=="number")return e;if(vg(e))return ts;if(Pi(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Pi(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=bg(e);var n=xg.test(e);return n||Ag.test(e)?Eg(e.slice(2),n?2:8):kg.test(e)?ts:+e}var yi=function(){return gc.Date.now()},Cg="Expected a function",Sg=Math.max,Mg=Math.min;function Ig(e,t,n){var r,i,a,o,s,l,c=0,f=!1,u=!1,p=!0;if(typeof e!="function")throw new TypeError(Cg);t=ns(t)||0,Pi(n)&&(f=!!n.leading,u="maxWait"in n,a=u?Sg(ns(n.maxWait)||0,t):a,p="trailing"in n?!!n.trailing:p);function d(N){var E=r,P=i;return r=i=void 0,c=N,o=e.apply(P,E),o}function m(N){return c=N,s=setTimeout(v,t),f?d(N):o}function g(N){var E=N-l,P=N-c,G=t-E;return u?Mg(G,a-P):G}function h(N){var E=N-l,P=N-c;return l===void 0||E>=t||E<0||u&&P>=a}function v(){var N=yi();if(h(N))return w(N);s=setTimeout(v,g(N))}function w(N){return s=void 0,p&&r?d(N):(r=i=void 0,o)}function k(){s!==void 0&&clearTimeout(s),c=0,r=l=i=s=void 0}function L(){return s===void 0?o:w(yi())}function $(){var N=yi(),E=h(N);if(r=arguments,i=this,l=N,E){if(s===void 0)return m(l);if(u)return clearTimeout(s),s=setTimeout(v,t),d(l)}return s===void 0&&(s=setTimeout(v,t)),o}return $.cancel=k,$.flush=L,$}class yc{constructor(){this.beforeMountedListeners=[],this.mountedListeners=[],this.updatedListeners=[],this.selectionUpdatedListeners=[],this.markdownUpdatedListeners=[],this.blurListeners=[],this.focusListeners=[],this.destroyListeners=[],this.beforeMount=t=>(this.beforeMountedListeners.push(t),this),this.mounted=t=>(this.mountedListeners.push(t),this),this.updated=t=>(this.updatedListeners.push(t),this)}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners,selectionUpdated:this.selectionUpdatedListeners}}markdownUpdated(t){return this.markdownUpdatedListeners.push(t),this}blur(t){return this.blurListeners.push(t),this}focus(t){return this.focusListeners.push(t),this}destroy(t){return this.destroyListeners.push(t),this}selectionUpdated(t){return this.selectionUpdatedListeners.push(t),this}}const Bi=_s(new yc,"listener"),Lg=new Mn("MILKDOWN_LISTENER"),wc=e=>(e.inject(Bi,new yc),async()=>{await e.wait(bs);const t=e.get(Bi),{listeners:n}=t;n.beforeMount.forEach(l=>l(e)),await e.wait(Xc);const r=e.get(eu);let i=null,a=null,o=null;const s=new Sn({key:Lg,view:()=>({destroy:()=>{n.destroy.forEach(l=>l(e))}}),props:{handleDOMEvents:{focus:()=>(n.focus.forEach(l=>l(e)),!1),blur:()=>(n.blur.forEach(l=>l(e)),!1)}},state:{init:(l,c)=>{i=c.doc,a=r(c.doc)},apply:l=>{const c=l.selection;return(!o&&c||o&&!c.eq(o))&&(n.selectionUpdated.forEach(u=>{u(e,c,o)}),o=c),!(l.docChanged||l.storedMarksSet)||l.getMeta("addToHistory")===!1?void 0:Ig(()=>{const{doc:u}=l;if(n.updated.length>0&&i&&!i.eq(u)&&n.updated.forEach(p=>{p(e,u,i)}),n.markdownUpdated.length>0&&i&&!i.eq(u)){const p=r(u);n.markdownUpdated.forEach(d=>{d(e,p,a)}),a=p}i=u},200)()}}});e.update(xr,l=>l.concat(s)),await e.wait(tu),n.mounted.forEach(l=>l(e))});wc.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};function ie(e,t){const n=ou(e),r=i=>async()=>{r.key=n,await i.wait(su);const a=t(i);return i.get(ae).create(n,a),r.run=o=>i.get(ae).call(e,o),()=>{i.get(ae).remove(n)}};return r}function it(e){const t=n=>async()=>{await n.wait(ks);const r=e(n);return n.update(vo,i=>[...i,r]),t.inputRule=r,()=>{n.update(vo,i=>i.filter(a=>a!==r))}};return t}function Ng(e,t){const n=r=>async()=>{const i=t(r);return r.update(go,a=>[...a.filter(o=>o[0]!==e),[e,i]]),n.id=e,n.schema=i,()=>{r.update(go,a=>a.filter(([o])=>o!==e))}};return n.type=r=>{const i=r.get(Fr).marks[e];if(!i)throw cu(e);return i},n}function _a(e,t){const n=r=>async()=>{const i=t(r);return r.update(ho,a=>[...a.filter(o=>o[0]!==e),[e,i]]),n.id=e,n.schema=i,()=>{r.update(ho,a=>a.filter(([o])=>o!==e))}};return n.type=r=>{const i=r.get(Fr).nodes[e];if(!i)throw lu(e);return i},n}function ir(e){let t;const n=r=>async()=>(await r.wait(ks),t=e(r),r.update(xr,i=>[...i,t]),()=>{r.update(xr,i=>i.filter(a=>a!==t))});return n.plugin=()=>t,n.key=()=>t.spec.key,n}function Tg(e){const t=n=>async()=>{await n.wait(uu);const r=n.get(fu),i=e(n),a=r.addObjectKeymap(i);return t.keymap=i,()=>{a()}};return t}function qt(e,t){const n=_s(e,t),r=i=>(i.inject(n),()=>()=>{i.remove(n)});return r.key=n,r}function Ge(e,t){const n=qt(t,e),r=_a(e,a=>a.get(n.key)(a)),i=[n,r];return i.id=r.id,i.node=r,i.type=a=>r.type(a),i.ctx=n,i.key=n.key,i.extendSchema=a=>{const o=a(t);return Ge(e,o)},i}function ar(e,t){const n=qt(t,e),r=Ng(e,a=>a.get(n.key)(a)),i=[n,r];return i.id=r.id,i.mark=r,i.type=a=>r.type(a),i.ctx=n,i.key=n.key,i.extendSchema=a=>{const o=a(t);return ar(e,o)},i}function at(e,t){const n=Object.fromEntries(Object.entries(t).map(([o,{shortcuts:s,priority:l}])=>[o,{shortcuts:s,priority:l}])),r=qt(n,`${e}Keymap`),i=Tg(o=>{const s=o.get(r.key),l=Object.entries(t).flatMap(([c,{command:f}])=>{const u=s[c],p=[u.shortcuts].flat(),d=u.priority;return p.map(m=>[m,{key:m,onRun:f,priority:d}])});return Object.fromEntries(l)}),a=[r,i];return a.ctx=r,a.shortcuts=i,a.key=r.key,a.keymap=i.keymap,a}const ot=(e,t=()=>({}))=>qt(t,`${e}Attr`),Jr=(e,t=()=>({}))=>qt(t,`${e}Attr`);function Ln(e,t,n){const r=qt({},e),i=o=>async()=>{await o.wait(bs);const l={plugin:t(o),options:o.get(r.key)};return o.update(mo,c=>[...c,l]),()=>{o.update(mo,c=>c.filter(f=>f!==l))}},a=[r,i];return a.id=e,a.plugin=i,a.options=r,a}function Og(){return e=>{const t=document.createElement("div"),n=e.get(Fr),r=e.get(Hr),i=nu.fromSchema(n).serializeFragment(r.state.doc.content);return t.appendChild(i),t.innerHTML}}function rs(e,t=!1){return n=>{const r=n.get(Hr),a=n.get(ru)(e);if(!a)return;if(!t){const{state:f}=r;return r.dispatch(f.tr.replace(0,f.doc.content.size,new Qn(a.content,0,0)))}const o=n.get(Fr),s=n.get(iu),l=n.get(xr),c=au.create({schema:o,doc:a,plugins:l,...s});r.updateState(c)}}function $g(e,t){return function(n,r){let{$from:i,$to:a,node:o}=n.selection;if(o&&o.isBlock||i.depth<2||!i.sameParent(a))return!1;let s=i.node(-1);if(s.type!=e)return!1;if(i.parent.content.size==0&&i.node(-1).childCount==i.indexAfter(-1)){if(i.depth==3||i.node(-3).type!=e||i.index(-2)!=i.node(-2).childCount-1)return!1;if(r){let u=_e.empty,p=i.index(-1)?1:i.index(-2)?2:3;for(let v=i.depth-p;v>=i.depth-3;v--)u=_e.from(i.node(v).copy(u));let d=i.indexAfter(-1)<i.node(-2).childCount?1:i.indexAfter(-2)<i.node(-3).childCount?2:3;u=u.append(_e.from(e.createAndFill()));let m=i.before(i.depth-(p-1)),g=n.tr.replace(m,i.after(-d),new Qn(u,4-p,0)),h=-1;g.doc.nodesBetween(m,g.doc.content.size,(v,w)=>{if(h>-1)return!1;v.isTextblock&&v.content.size==0&&(h=w+1)}),h>-1&&g.setSelection(Ki.near(g.doc.resolve(h))),r(g.scrollIntoView())}return!0}let l=a.pos==i.end()?s.contentMatchAt(0).defaultType:null,c=n.tr.delete(i.pos,a.pos),f=l?[null,{type:l}]:void 0;return du(c.doc,i.pos,2,f)?(r&&r(c.split(i.pos,2,f).scrollIntoView()),!0):!1}}function Dg(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?Rg(t,n,e,a):Fg(t,n,a):!0:!1}}function Rg(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new Wi(a-1,o,a,o,new Qn(_e.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new pu(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const s=hu(r);if(s==null)return!1;i.lift(r,s);let l=i.doc.resolve(i.mapping.map(a,-1)-1);return mu(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),t(i.scrollIntoView()),!0}function Fg(e,t,n){let r=e.tr,i=n.parent;for(let d=n.end,m=n.endIndex-1,g=n.startIndex;m>g;m--)d-=i.child(m).nodeSize,r.delete(d-1,d+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,l=n.endIndex==i.childCount,c=a.node(-1),f=a.index(-1);if(!c.canReplace(f+(s?0:1),f+1,o.content.append(l?_e.empty:_e.from(i))))return!1;let u=a.pos,p=u+o.nodeSize;return r.step(new Wi(u-(s?1:0),p+(l?1:0),u+1,p-1,new Qn((s?_e.empty:_e.from(i.copy(_e.empty))).append(l?_e.empty:_e.from(i.copy(_e.empty))),s?0:1,l?0:1),s?0:1)),t(r.scrollIntoView()),!0}function Hg(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,l=s.child(o-1);if(l.type!=e)return!1;if(n){let c=l.lastChild&&l.lastChild.type==s.type,f=_e.from(c?e.create():null),u=new Qn(_e.from(e.create(null,_e.from(s.type.create(null,f)))),c?3:1,0),p=a.start,d=a.end;n(t.tr.step(new Wi(p-(c?3:1),d,p,d,u,1,!0)).scrollIntoView())}return!0}}function Pg(e){const t=new Map;if(!e||!e.type)throw new Error("mdast-util-definitions expected node");return Xn(e,"definition",function(r){const i=is(r.identifier);i&&!t.get(i)&&t.set(i,r)}),n;function n(r){const i=is(r);return t.get(i)}}function is(e){return String(e||"").toUpperCase()}function Bg(){return function(e){const t=Pg(e);Xn(e,function(n,r,i){if(n.type==="definition"&&i!==void 0&&typeof r=="number")return i.children.splice(r,1),[yo,r];if(n.type==="imageReference"||n.type==="linkReference"){const a=t(n.identifier);if(a&&i&&typeof r=="number")return i.children[r]=n.type==="imageReference"?{type:"image",url:a.url,title:a.title,alt:n.alt}:{type:"link",url:a.url,title:a.title,children:n.children},[yo,r]}})}}function _c(e,t){if(!(t.childCount>=1&&t.lastChild?.type.name==="hardbreak")){e.next(t.content);return}const r=[];t.content.forEach((i,a,o)=>{o!==t.childCount-1&&r.push(i)}),e.next(_e.fromArray(r))}function _(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-commonmark",...t}}),e}const ba=Jr("emphasis");_(ba,{displayName:"Attr<emphasis>",group:"Emphasis"});const Nn=ar("emphasis",e=>({attrs:{marker:{default:e.get(xs).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:t=>t==="italic"}],toDOM:t=>["em",e.get(ba.key)(t)],parseMarkdown:{match:t=>t.type==="emphasis",runner:(t,n,r)=>{t.openMark(r,{marker:n.marker}),t.next(n.children),t.closeMark(r)}},toMarkdown:{match:t=>t.type.name==="emphasis",runner:(t,n)=>{t.withMark(n,"emphasis",void 0,{marker:n.attrs.marker})}}}));_(Nn.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"});_(Nn.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});const Qr=ie("ToggleEmphasis",e=>()=>zi(Nn.type(e)));_(Qr,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});const bc=it(e=>Br(/(?:^|[^*])\*([^*]+)\*$/,Nn.type(e),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:t,start:n})=>t.startsWith("*")?{}:{fullMatch:t.slice(1),start:n+1}}));_(bc,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});const kc=it(e=>Br(/\b_(?![_\s])(.*?[^_\s])_\b/,Nn.type(e),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:t,start:n})=>t.startsWith("_")?{}:{fullMatch:t.slice(1),start:n+1}}));_(kc,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});const ka=at("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:e=>{const t=e.get(ae);return()=>t.call(Qr.key)}}});_(ka.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"});_(ka.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});const xa=Jr("strong");_(xa,{displayName:"Attr<strong>",group:"Strong"});const or=ar("strong",e=>({attrs:{marker:{default:e.get(xs).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:t=>t.style.fontWeight!="normal"&&null},{tag:"strong"},{style:"font-style",getAttrs:t=>t==="bold"},{style:"font-weight=400",clearMark:t=>t.type.name=="strong"},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM:t=>["strong",e.get(xa.key)(t)],parseMarkdown:{match:t=>t.type==="strong",runner:(t,n,r)=>{t.openMark(r,{marker:n.marker}),t.next(n.children),t.closeMark(r)}},toMarkdown:{match:t=>t.type.name==="strong",runner:(t,n)=>{t.withMark(n,"strong",void 0,{marker:n.attrs.marker})}}}));_(or.mark,{displayName:"MarkSchema<strong>",group:"Strong"});_(or.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});const Xr=ie("ToggleStrong",e=>()=>zi(or.type(e)));_(Xr,{displayName:"Command<toggleStrongCommand>",group:"Strong"});const xc=it(e=>Br(new RegExp("(?<![\\w:/])(?:\\*\\*|__)([^*_]+?)(?:\\*\\*|__)(?![\\w/])$"),or.type(e),{getAttr:t=>({marker:t[0].startsWith("*")?"*":"_"})}));_(xc,{displayName:"InputRule<strong>",group:"Strong"});const Aa=at("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:e=>{const t=e.get(ae);return()=>t.call(Xr.key)}}});_(Aa.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"});_(Aa.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});const Ea=Jr("inlineCode");_(Ea,{displayName:"Attr<inlineCode>",group:"InlineCode"});const Nt=ar("inlineCode",e=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:t=>["code",e.get(Ea.key)(t)],parseMarkdown:{match:t=>t.type==="inlineCode",runner:(t,n,r)=>{t.openMark(r),t.addText(n.value),t.closeMark(r)}},toMarkdown:{match:t=>t.type.name==="inlineCode",runner:(t,n,r)=>{t.withMark(n,"inlineCode",r.text||"")}}}));_(Nt.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"});_(Nt.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});const Ca=ie("ToggleInlineCode",e=>()=>(t,n)=>{const{selection:r,tr:i}=t;if(r.empty)return!1;const{from:a,to:o}=r;return t.doc.rangeHasMark(a,o,Nt.type(e))?(n?.(i.removeMark(a,o,Nt.type(e))),!0):(Object.keys(t.schema.marks).filter(c=>c!==Nt.type.name).map(c=>t.schema.marks[c]).forEach(c=>{i.removeMark(a,o,c)}),n?.(i.addMark(a,o,Nt.type(e).create())),!0)});_(Ca,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});const Ac=it(e=>Br(/(?:`)([^`]+)(?:`)$/,Nt.type(e)));_(Ac,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});const Sa=at("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:e=>{const t=e.get(ae);return()=>t.call(Ca.key)}}});_(Sa.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"});_(Sa.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});const Ma=Jr("link");_(Ma,{displayName:"Attr<link>",group:"Link"});const bn=ar("link",e=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:t=>{if(!(t instanceof HTMLElement))throw tn(t);return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM:t=>["a",{...e.get(Ma.key)(t),...t.attrs}],parseMarkdown:{match:t=>t.type==="link",runner:(t,n,r)=>{const i=n.url,a=n.title;t.openMark(r,{href:i,title:a}),t.next(n.children),t.closeMark(r)}},toMarkdown:{match:t=>t.type.name==="link",runner:(t,n)=>{t.withMark(n,"link",void 0,{title:n.attrs.title,url:n.attrs.href})}}}));_(bn.mark,{displayName:"MarkSchema<link>",group:"Link"});const Ia=ie("ToggleLink",e=>(t={})=>zi(bn.type(e),t));_(Ia,{displayName:"Command<toggleLinkCommand>",group:"Link"});const Ec=ie("UpdateLink",e=>(t={})=>(n,r)=>{if(!r)return!1;let i,a=-1;const{selection:o}=n,{from:s,to:l}=o;if(n.doc.nodesBetween(s,s===l?l+1:l,(m,g)=>{if(bn.type(e).isInSet(m.marks))return i=m,a=g,!1}),!i)return!1;const c=i.marks.find(({type:m})=>m===bn.type(e));if(!c)return!1;const f=a,u=a+i.nodeSize,{tr:p}=n,d=bn.type(e).create({...c.attrs,...t});return d?(r(p.removeMark(f,u,c).addMark(f,u,d).setSelection(new Pr(p.selection.$anchor)).scrollIntoView()),!0):!1});_(Ec,{displayName:"Command<updateLinkCommand>",group:"Link"});const Cc=_a("doc",()=>({content:"block+",parseMarkdown:{match:({type:e})=>e==="root",runner:(e,t,n)=>{e.injectRoot(t,n)}},toMarkdown:{match:e=>e.type.name==="doc",runner:(e,t)=>{e.openNode("root"),e.next(t.content)}}}));_(Cc,{displayName:"NodeSchema<doc>",group:"Doc"});function jg(e){return xu(e,t=>t.type==="html"&&["<br />","<br>","<br >","<br/>"].includes(t.value?.trim()),(t,n)=>{if(!n.length)return;const r=n[n.length-1];if(!r)return;const i=r.children.indexOf(t);i!==-1&&r.children.splice(i,1)},!0)}const ei=Ln("remark-preserve-empty-line",()=>()=>jg);_(ei.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"});_(ei.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});const La=ot("paragraph");_(La,{displayName:"Attr<paragraph>",group:"Paragraph"});const sn=Ge("paragraph",e=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:t=>["p",e.get(La.key)(t),0],parseMarkdown:{match:t=>t.type==="paragraph",runner:(t,n,r)=>{t.openNode(r),n.children?t.next(n.children):t.addText(n.value||""),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="paragraph",runner:(t,n)=>{const i=e.get(Hr).state?.doc.lastChild;t.openNode("paragraph"),(!n.content||n.content.size===0)&&n!==i&&qg(e)?t.addNode("html",void 0,"<br />"):_c(t,n),t.closeNode()}}}));function qg(e){let t=!1;try{e.get(ei.id),t=!0}catch{t=!1}return t}_(sn.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"});_(sn.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});const ti=ie("TurnIntoText",e=>()=>Vn(sn.type(e)));_(ti,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});const Na=at("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:e=>{const t=e.get(ae);return()=>t.call(ti.key)}}});_(Na.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"});_(Na.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});const Vg=Array(6).fill(0).map((e,t)=>t+1);function Ug(e){return e.textContent.toLowerCase().trim().replace(/\s+/g,"-")}const ni=qt(Ug,"headingIdGenerator");_(ni,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});const Ta=ot("heading");_(Ta,{displayName:"Attr<heading>",group:"Heading"});const ln=Ge("heading",e=>{const t=e.get(ni.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:Vg.map(n=>({tag:`h${n}`,getAttrs:r=>{if(!(r instanceof HTMLElement))throw tn(r);return{level:n,id:r.id}}})),toDOM:n=>[`h${n.attrs.level}`,{...e.get(Ta.key)(n),id:n.attrs.id||t(n)},0],parseMarkdown:{match:({type:n})=>n==="heading",runner:(n,r,i)=>{const a=r.depth;n.openNode(i,{level:a}),n.next(r.children),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="heading",runner:(n,r)=>{n.openNode("heading",void 0,{depth:r.attrs.level}),_c(n,r),n.closeNode()}}}});_(ln.node,{displayName:"NodeSchema<heading>",group:"Heading"});_(ln.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});const Sc=it(e=>As(/^(?<hashes>#+)\s$/,ln.type(e),t=>{const n=t.groups?.hashes?.length||0,r=e.get(Hr),{$from:i}=r.state.selection,a=i.node();if(a.type.name==="heading"){let o=Number(a.attrs.level)+Number(n);return o>6&&(o=6),{level:o}}return{level:n}}));_(Sc,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});const vt=ie("WrapInHeading",e=>t=>(t??=1,t<1?Vn(sn.type(e)):Vn(ln.type(e),{level:t})));_(vt,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});const Oa=ie("DowngradeHeading",e=>()=>(t,n,r)=>{const{$from:i}=t.selection,a=i.node();if(a.type!==ln.type(e)||!t.selection.empty||i.parentOffset!==0)return!1;const o=a.attrs.level-1;return o?(n?.(t.tr.setNodeMarkup(t.selection.$from.before(),void 0,{...a.attrs,level:o})),!0):Vn(sn.type(e))(t,n,r)});_(Oa,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});const $a=at("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:e=>{const t=e.get(ae);return()=>t.call(vt.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:e=>{const t=e.get(ae);return()=>t.call(vt.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:e=>{const t=e.get(ae);return()=>t.call(vt.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:e=>{const t=e.get(ae);return()=>t.call(vt.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:e=>{const t=e.get(ae);return()=>t.call(vt.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:e=>{const t=e.get(ae);return()=>t.call(vt.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:e=>{const t=e.get(ae);return()=>t.call(Oa.key)}}});_($a.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"});_($a.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});const Da=ot("blockquote");_(Da,{displayName:"Attr<blockquote>",group:"Blockquote"});const sr=Ge("blockquote",e=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:t=>["blockquote",e.get(Da.key)(t),0],parseMarkdown:{match:({type:t})=>t==="blockquote",runner:(t,n,r)=>{t.openNode(r).next(n.children).closeNode()}},toMarkdown:{match:t=>t.type.name==="blockquote",runner:(t,n)=>{t.openNode("blockquote").next(n.content).closeNode()}}}));_(sr.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"});_(sr.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});const Mc=it(e=>Zi(/^\s*>\s$/,sr.type(e)));_(Mc,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});const ri=ie("WrapInBlockquote",e=>()=>Gi(sr.type(e)));_(ri,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});const Ra=at("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:e=>{const t=e.get(ae);return()=>t.call(ri.key)}}});_(Ra.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"});_(Ra.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});const Fa=ot("codeBlock",()=>({pre:{},code:{}}));_(Fa,{displayName:"Attr<codeBlock>",group:"CodeBlock"});const lr=Ge("code_block",e=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:"",validate:"string"}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>{if(!(t instanceof HTMLElement))throw tn(t);return{language:t.dataset.language}}}],toDOM:t=>{const n=e.get(Fa.key)(t),r=t.attrs.language,i=r&&r.length>0?{"data-language":r}:void 0;return["pre",{...n.pre,...i},["code",n.code,0]]},parseMarkdown:{match:({type:t})=>t==="code",runner:(t,n,r)=>{const i=n.lang??"",a=n.value;t.openNode(r,{language:i}),a&&t.addText(a),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="code_block",runner:(t,n)=>{t.addNode("code",void 0,n.content.firstChild?.text||"",{lang:n.attrs.language})}}}));_(lr.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"});_(lr.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});const Ic=it(e=>As(/^```(?<language>[a-z]*)?[\s\n]$/,lr.type(e),t=>({language:t.groups?.language??""})));_(Ic,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});const Ha=ie("CreateCodeBlock",e=>(t="")=>Vn(lr.type(e),{language:t}));_(Ha,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"});const Yg=ie("UpdateCodeBlockLanguage",()=>({pos:e,language:t}={pos:-1,language:""})=>(n,r)=>e>=0?(r?.(n.tr.setNodeAttribute(e,"language",t)),!0):!1);_(Yg,{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});const Pa=at("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:e=>{const t=e.get(ae);return()=>t.call(Ha.key)}}});_(Pa.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"});_(Pa.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});const Ba=ot("image");_(Ba,{displayName:"Attr<image>",group:"Image"});const Tn=Ge("image",e=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:"",validate:"string"},alt:{default:"",validate:"string"},title:{default:"",validate:"string"}},parseDOM:[{tag:"img[src]",getAttrs:t=>{if(!(t instanceof HTMLElement))throw tn(t);return{src:t.getAttribute("src")||"",alt:t.getAttribute("alt")||"",title:t.getAttribute("title")||t.getAttribute("alt")||""}}}],toDOM:t=>["img",{...e.get(Ba.key)(t),...t.attrs}],parseMarkdown:{match:({type:t})=>t==="image",runner:(t,n,r)=>{const i=n.url,a=n.alt,o=n.title;t.addNode(r,{src:i,alt:a,title:o})}},toMarkdown:{match:t=>t.type.name==="image",runner:(t,n)=>{t.addNode("image",void 0,void 0,{title:n.attrs.title,url:n.attrs.src,alt:n.attrs.alt})}}}));_(Tn.node,{displayName:"NodeSchema<image>",group:"Image"});_(Tn.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});const ja=ie("InsertImage",e=>(t={})=>(n,r)=>{if(!r)return!0;const{src:i="",alt:a="",title:o=""}=t,s=Tn.type(e).create({src:i,alt:a,title:o});return s&&r(n.tr.replaceSelectionWith(s).scrollIntoView()),!0});_(ja,{displayName:"Command<insertImageCommand>",group:"Image"});const Lc=ie("UpdateImage",e=>(t={})=>(n,r)=>{const i=vu(n.selection,Tn.type(e));if(!i)return!1;const{node:a,pos:o}=i,s={...a.attrs},{src:l,alt:c,title:f}=t;return l!==void 0&&(s.src=l),c!==void 0&&(s.alt=c),f!==void 0&&(s.title=f),r?.(n.tr.setNodeMarkup(o,void 0,s).scrollIntoView()),!0});_(Lc,{displayName:"Command<updateImageCommand>",group:"Image"});const Wg=it(e=>new Es(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(t,n,r,i)=>{const[a,o,s="",l]=n;return a?t.tr.replaceWith(r,i,Tn.type(e).create({src:s,alt:o,title:l})):null}));_(Wg,{displayName:"InputRule<insertImageInputRule>",group:"Image"});const Rr=ot("hardbreak",e=>({"data-type":"hardbreak","data-is-inline":e.attrs.isInline}));_(Rr,{displayName:"Attr<hardbreak>",group:"Hardbreak"});const Gt=Ge("hardbreak",e=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:t=>t.attrs.isInline?["span",e.get(Rr.key)(t)," "]:["br",e.get(Rr.key)(t)],parseMarkdown:{match:({type:t})=>t==="break",runner:(t,n,r)=>{t.addNode(r,{isInline:!!n.data?.isInline})}},leafText:()=>`
|
|
42
|
+
`);break;case"hidden":switch($.type){case"datetime-local":case"date":case"time":C=new Date(Y).getTime(),R=Q.getTime();break;default:C=Y,R=Q;break}break;default:C=Y,R=Q;break}if(C!==R)return!1}return!0}function b(k){k.preventDefault(),history.back()}var L=Km(),D=M(L),O=M(D),I=M(O),B=M(I);He(B,()=>gm);var G=F(D,2),q=M(G),N=M(q),U=F(N,2),j=F(G,2),E=M(j),x=M(E);nt(x,l,k=>{var S=Wm();W(k,S)},(k,S)=>{var A=Um();te(()=>A.disabled=!y(d)),W(k,A)},(k,S)=>{var A=Ym();te(()=>A.disabled=!y(d)),W(k,A)}),te(()=>{fe(N,`${o()?.label??""} `),fe(U,` ${(n()?.fields.title||"New File")??""}`)}),oe("click",I,b),W(e,L),ce(),f()}je(["click"]);var Gm=z('<label class="editorInput"> <input type="checkbox" role="switch" form="ignore"/> <input type="hidden"/></label>');function Zm(e,t){le(t,!0);const n=()=>P(Ae,"$draftEntry",o),r=()=>P(it,"$selectedCollection",o),i=()=>P(at,"$editingEntry",o),a=()=>P(Me,"$loadedWidgets",o),[o,s]=me();let l=Pe(t,"checked",7,!1),c=Pe(t,"required",3,!1);function f(){const m={...n()};l()==null?m[t.name]=r()?.fields.find(v=>v.name===t.name).default:m[t.name]=l(),re(Ae,m)}async function u(){i()&&l(i().fields[t.name]),f(),re(Me,a()+1)}qe(()=>{u()});var p=Gm(),d=M(p),h=F(d),g=F(h,2);te(()=>{J(p,"for",t.name),fe(d,`${t.label??""} `),J(h,"id",t.name),J(h,"name",t.name),h.required=c(),J(g,"id",t.name),J(g,"name",t.name),dd(g,l()),g.required=c()}),oe("change",h,f),hd(h,l),W(e,p),ce(),s()}je(["change"]);var Jm=z('<input type="time"/>'),Qm=z('<input type="date"/>'),Xm=z('<input type="datetime-local"/>'),eg=z('<label class="editorInput"> <!></label>');function tg(e,t){le(t,!0);const n=()=>P(Ae,"$draftEntry",a),r=()=>P(at,"$editingEntry",a),i=()=>P(Me,"$loadedWidgets",a),[a,o]=me();let s=Pe(t,"type",3,"datetime-local"),l=Pe(t,"value",23,()=>Hr(s(),new Date)),c=Pe(t,"required",3,!0);function f(){const w={...n()};w[t.name]=l(),re(Ae,w)}async function u(){if(r()){const w=r().fields;l(Hr(s(),new Date(w[t.name])))}f(),re(Me,i()+1)}qe(()=>{u()});var p=eg(),d=M(p),h=F(d);{var g=w=>{var b=Jm();te(()=>{J(b,"id",t.name),J(b,"name",t.name),b.required=c()}),oe("input",b,f),Ht(b,l),W(w,b)},m=w=>{var b=Qm();te(()=>{J(b,"id",t.name),J(b,"name",t.name),b.required=c()}),oe("input",b,f),Ht(b,l),W(w,b)},v=w=>{var b=Xm();te(()=>{J(b,"id",t.name),J(b,"name",t.name),b.required=c()}),oe("input",b,f),Ht(b,l),W(w,b)};Ge(h,w=>{s()==="time"?w(g):s()==="date"?w(m,1):w(v,!1)})}te(()=>{J(p,"for",t.name),fe(d,`${t.label??""} `)}),W(e,p),ce(),o()}je(["input"]);var ng=z('<input type="text"/>'),rg=z("<textarea></textarea>"),ig=z('<label class="editorInput"> <!></label>');function is(e,t){le(t,!0);const n=()=>P(Ae,"$draftEntry",o),r=()=>P(it,"$selectedCollection",o),i=()=>P(at,"$editingEntry",o),a=()=>P(Me,"$loadedWidgets",o),[o,s]=me();let l=Pe(t,"multiline",3,!1),c=Pe(t,"required",3,!0),f=Pe(t,"value",7,"");function u(){const w={...n()};f()?w[t.name]=f():w[t.name]=r()?.fields.find(b=>b.name===t.name).label,re(Ae,w)}async function p(){i()&&f(t.name==="body"?i().body:i().fields[t.name]),u(),re(Me,a()+1)}qe(()=>{p()});var d=ig(),h=M(d),g=F(h);{var m=w=>{var b=ng();te(()=>{J(b,"id",t.name),J(b,"name",t.name),b.required=c()}),oe("input",b,u),Ht(b,f),W(w,b)},v=w=>{var b=rg();te(()=>{J(b,"id",t.name),J(b,"name",t.name),b.required=c()}),oe("input",b,u),Ht(b,f),W(w,b)};Ge(g,w=>{l()?w(v,!1):w(m)})}te(()=>{J(d,"for",t.name),fe(h,`${t.label??""} `)}),W(e,d),ce(),s()}je(["input"]);var ag=z('<label class="editorInput"> <input type="number"/></label>');function og(e,t){le(t,!0);const n=()=>P(Ae,"$draftEntry",a),r=()=>P(at,"$editingEntry",a),i=()=>P(Me,"$loadedWidgets",a),[a,o]=me();let s=Pe(t,"value",7),l=Pe(t,"required",3,!0);function c(){const h={...n()};h[t.name]=s(),re(Ae,h)}async function f(){r()&&s(r().fields[t.name]),c(),re(Me,i()+1)}qe(()=>{f()});var u=ag(),p=M(u),d=F(p);te(()=>{J(u,"for",t.name),fe(p,`${t.label??""} `),J(d,"id",t.name),J(d,"name",t.name),J(d,"step",t.step),J(d,"min",t.min),J(d,"max",t.max),d.required=l()}),oe("input",d,c),Ht(d,s),W(e,u),ce(),o()}je(["input"]);const sg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>format-bold</title><path d="M13.5,15.5H10V12.5H13.5A1.5,1.5 0 0,1 15,14A1.5,1.5 0 0,1 13.5,15.5M10,6.5H13A1.5,1.5 0 0,1 14.5,8A1.5,1.5 0 0,1 13,9.5H10M15.6,10.79C16.57,10.11 17.25,9 17.25,8C17.25,5.74 15.5,4 13.25,4H7V18H14.04C16.14,18 17.75,16.3 17.75,14.21C17.75,12.69 16.89,11.39 15.6,10.79Z" /></svg>',lg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>format-italic</title><path d="M10,4V7H12.21L8.79,15H6V18H14V15H11.79L15.21,7H18V4H10Z" /></svg>',cg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>format-list-bulleted</title><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>',ug='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>format-list-numbered</title><path d="M7,13V11H21V13H7M7,19V17H21V19H7M7,7V5H21V7H7M3,8V5H2V4H4V8H3M2,17V16H5V20H2V19H4V18.5H3V17.5H4V17H2M4.25,10A0.75,0.75 0 0,1 5,10.75C5,10.95 4.92,11.14 4.79,11.27L3.12,13H5V14H2V13.08L4,11H2V10H4.25Z" /></svg>',fg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>horizontal-rule</title><path d="M19,13H5V11H19V13Z" /></svg>',dg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>format-quote-close</title><path d="M14,17H17L19,13V7H13V13H16M6,17H9L11,13V7H5V13H8L6,17Z" /></svg>',pg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>link</title><path d="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z" /></svg>',hg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>image</title><path d="M8.5,13.5L11,16.5L14.5,12L19,18H5M21,19V5C21,3.89 20.1,3 19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19Z" /></svg>';var mg=z('<option class="svelte-8wonn1"> </option>'),gg=z('<button class="secondary svelte-8wonn1"><!></button>'),vg=z('<div class="editor-menu svelte-8wonn1"><select name="text-type" form="ignore" class="svelte-8wonn1"></select> <!></div>');function yg(e,t){le(t,!0);let n=K(void 0),r=K(void 0);const i=c(),a=[{name:"bold",icon:sg},{name:"italic",icon:lg},{name:"listBulleted",icon:cg},{name:"listNumbered",icon:ug},{name:"quote",icon:dg},{name:"horizontalRule",icon:fg},{name:"link",icon:pg},{name:"image",icon:hg}];function o(d){d.preventDefault();const{action:h}=d.currentTarget.dataset;t.onactionselect(h)}function s(d){const h=d.currentTarget.value;t.ontexttypeselect(h)}function l(){const h=document.getSelection().focusNode?.parentElement;if(!y(r).contains(h))return;const{localName:g}=h;switch(g){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":y(n).value=parseInt(g.split("").at(-1));break;default:y(n).value="p";break}}function c(){const d=[];for(let h=0;h<=6;h++){let g;h===0?g={title:"Normal",value:"p"}:g={title:`Heading ${h}`,value:h},d.push(g)}return d}qe(()=>{V(r,document.querySelector("#md-editor"),!0)});var f=vg();cn("selectionchange",zr,l);var u=M(f);jt(u,21,()=>i,$i,(d,h)=>{var g=mg(),m=M(g),v={};te(()=>{fe(m,y(h).title),v!==(v=y(h).value)&&(g.value=(g.__value=y(h).value)??"")}),W(d,g)}),Sn(u,d=>V(n,d),()=>y(n));var p=F(u,2);jt(p,17,()=>a,$i,(d,h)=>{var g=gg(),m=M(g);He(m,()=>y(h).icon),te(()=>J(g,"data-action",y(h).name)),oe("click",g,o),W(d,g)}),oe("change",u,s),W(e,f),ce()}je(["change","click"]);var wg=z('<div id="link-editor-container" class="svelte-1qtwn58"><div id="link-editor" class="svelte-1qtwn58"><div class="svelte-1qtwn58">Enter link:</div> <input form="md-link-editor" type="url" name="url" placeholder="https://example.com" required="" class="svelte-1qtwn58"/> <button class="secondary svelte-1qtwn58" form="md-link-editor" type="submit">Save</button></div></div>');function bg(e,t){le(t,!0);let n=K(!1),r=K(void 0),i=K(void 0);ht(()=>{y(n)&&y(i).focus()});function a(){const d=document.getSelection();if(d.focusNode.parentElement.localName==="a"){t.onsaveurl({});return}else if(y(n))V(n,!y(n)),y(i).value="";else{const{startOffset:h,endOffset:g}=d.getRangeAt(0);V(n,h!==g)}}function o(d){d.preventDefault();const h=y(i).value;y(i).value="",V(n,!1),t.onsaveurl({href:h})}function s(){if(!y(n))return;const h=document.getSelection().focusNode;y(r).contains(h)||(V(n,!1),y(i).value="",t.onsaveurl(null))}qe(()=>{const d=document.querySelector("#md-link-editor");return d.addEventListener("submit",o),()=>{d.removeEventListener("submit",o)}});var l={toggleEditor:a},c=wg();cn("selectionchange",zr,s);let f;var u=M(c),p=F(M(u),2);return Sn(p,d=>V(i,d),()=>y(i)),Sn(u,d=>V(r,d),()=>y(r)),te(()=>f=ld(c,"",f,{visibility:y(n)?"visible":"hidden"})),W(e,c),ce(l)}var _g=z('<div><img alt="" loading="lazy" crossorigin="use-credentials" class="svelte-kkm0gm"/> <small class="svelte-kkm0gm"> </small></div>'),kg=z('<dialog open=""><article><header>Select Image</header> <div class="images svelte-kkm0gm"></div> <footer class="svelte-kkm0gm"><button class="secondary svelte-kkm0gm">Cancel</button> <button class="svelte-kkm0gm">Select</button></footer></article></dialog>');function xg(e,t){le(t,!0);const n=()=>P(st,"$backend",r),[r,i]=me();let a=K(et([])),o=K(void 0);async function s(){const v=await n()?.getMediaFiles();V(a,v||[],!0)}function l(v){V(o,v,!0)}function c(v){v.preventDefault(),t.onselectimg(y(o))}function f(v){v.preventDefault(),v.currentTarget===v.target&&t.onselectimg(null)}qe(()=>{s();const{body:v}=document;return v.classList.add("contain-scroll"),()=>{v.classList.remove("contain-scroll")}});var u=kg(),p=M(u),d=F(M(p),2);jt(d,21,()=>y(a),v=>v.name,(v,w)=>{var b=_g();let L;var D=M(b),O=F(D,2),I=M(O);te(()=>{L=Il(b,1,"img-container svelte-kkm0gm",null,L,{selected:y(o)===y(w)}),J(D,"src",y(w).url_preview),fe(I,y(w).name)}),oe("click",b,()=>l(y(w))),W(v,b)});var h=F(d,2),g=M(h),m=F(g,2);te(()=>m.disabled=!y(o)),oe("click",u,f),oe("click",g,f),oe("click",m,c),W(e,u),ce(),i()}je(["click"]);var Ag=typeof global=="object"&&global&&global.Object===Object&&global,Eg=typeof self=="object"&&self&&self.Object===Object&&self,Ec=Ag||Eg||Function("return this")(),Pr=Ec.Symbol,Cc=Object.prototype,Cg=Cc.hasOwnProperty,Sg=Cc.toString,qn=Pr?Pr.toStringTag:void 0;function Mg(e){var t=Cg.call(e,qn),n=e[qn];try{e[qn]=void 0;var r=!0}catch{}var i=Sg.call(e);return r&&(t?e[qn]=n:delete e[qn]),i}var Lg=Object.prototype,Ig=Lg.toString;function Ng(e){return Ig.call(e)}var Tg="[object Null]",Og="[object Undefined]",as=Pr?Pr.toStringTag:void 0;function $g(e){return e==null?e===void 0?Og:Tg:as&&as in Object(e)?Mg(e):Ng(e)}function Dg(e){return e!=null&&typeof e=="object"}var Rg="[object Symbol]";function Fg(e){return typeof e=="symbol"||Dg(e)&&$g(e)==Rg}var Hg=/\s/;function Pg(e){for(var t=e.length;t--&&Hg.test(e.charAt(t)););return t}var Bg=/^\s+/;function jg(e){return e&&e.slice(0,Pg(e)+1).replace(Bg,"")}function Vi(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var os=NaN,qg=/^[-+]0x[0-9a-f]+$/i,Vg=/^0b[01]+$/i,Ug=/^0o[0-7]+$/i,Yg=parseInt;function ss(e){if(typeof e=="number")return e;if(Fg(e))return os;if(Vi(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Vi(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=jg(e);var n=Vg.test(e);return n||Ug.test(e)?Yg(e.slice(2),n?2:8):qg.test(e)?os:+e}var bi=function(){return Ec.Date.now()},Wg="Expected a function",Kg=Math.max,zg=Math.min;function Gg(e,t,n){var r,i,a,o,s,l,c=0,f=!1,u=!1,p=!0;if(typeof e!="function")throw new TypeError(Wg);t=ss(t)||0,Vi(n)&&(f=!!n.leading,u="maxWait"in n,a=u?Kg(ss(n.maxWait)||0,t):a,p="trailing"in n?!!n.trailing:p);function d(O){var I=r,B=i;return r=i=void 0,c=O,o=e.apply(B,I),o}function h(O){return c=O,s=setTimeout(v,t),f?d(O):o}function g(O){var I=O-l,B=O-c,G=t-I;return u?zg(G,a-B):G}function m(O){var I=O-l,B=O-c;return l===void 0||I>=t||I<0||u&&B>=a}function v(){var O=bi();if(m(O))return w(O);s=setTimeout(v,g(O))}function w(O){return s=void 0,p&&r?d(O):(r=i=void 0,o)}function b(){s!==void 0&&clearTimeout(s),c=0,r=l=i=s=void 0}function L(){return s===void 0?o:w(bi())}function D(){var O=bi(),I=m(O);if(r=arguments,i=this,l=O,I){if(s===void 0)return h(l);if(u)return clearTimeout(s),s=setTimeout(v,t),d(l)}return s===void 0&&(s=setTimeout(v,t)),o}return D.cancel=b,D.flush=L,D}class Sc{constructor(){this.beforeMountedListeners=[],this.mountedListeners=[],this.updatedListeners=[],this.selectionUpdatedListeners=[],this.markdownUpdatedListeners=[],this.blurListeners=[],this.focusListeners=[],this.destroyListeners=[],this.beforeMount=t=>(this.beforeMountedListeners.push(t),this),this.mounted=t=>(this.mountedListeners.push(t),this),this.updated=t=>(this.updatedListeners.push(t),this)}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners,selectionUpdated:this.selectionUpdatedListeners}}markdownUpdated(t){return this.markdownUpdatedListeners.push(t),this}blur(t){return this.blurListeners.push(t),this}focus(t){return this.focusListeners.push(t),this}destroy(t){return this.destroyListeners.push(t),this}selectionUpdated(t){return this.selectionUpdatedListeners.push(t),this}}const Ui=Cs(new Sc,"listener"),Zg=new Nn("MILKDOWN_LISTENER"),Mc=e=>(e.inject(Ui,new Sc),async()=>{await e.wait(Ss);const t=e.get(Ui),{listeners:n}=t;n.beforeMount.forEach(l=>l(e)),await e.wait(lu);const r=e.get(cu);let i=null,a=null,o=null;const s=new In({key:Zg,view:()=>({destroy:()=>{n.destroy.forEach(l=>l(e))}}),props:{handleDOMEvents:{focus:()=>(n.focus.forEach(l=>l(e)),!1),blur:()=>(n.blur.forEach(l=>l(e)),!1)}},state:{init:(l,c)=>{i=c.doc,a=r(c.doc)},apply:l=>{const c=l.selection;return(!o&&c||o&&!c.eq(o))&&(n.selectionUpdated.forEach(u=>{u(e,c,o)}),o=c),!(l.docChanged||l.storedMarksSet)||l.getMeta("addToHistory")===!1?void 0:Gg(()=>{const{doc:u}=l;if(n.updated.length>0&&i&&!i.eq(u)&&n.updated.forEach(p=>{p(e,u,i)}),n.markdownUpdated.length>0&&i&&!i.eq(u)){const p=r(u);n.markdownUpdated.forEach(d=>{d(e,p,a)}),a=p}i=u},200)()}}});e.update(Mr,l=>l.concat(s)),await e.wait(uu),n.mounted.forEach(l=>l(e))});Mc.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};function ie(e,t){const n=gu(e),r=i=>async()=>{r.key=n,await i.wait(mu);const a=t(i);return i.get(ae).create(n,a),r.run=o=>i.get(ae).call(e,o),()=>{i.get(ae).remove(n)}};return r}function lt(e){const t=n=>async()=>{await n.wait(Ms);const r=e(n);return n.update(_o,i=>[...i,r]),t.inputRule=r,()=>{n.update(_o,i=>i.filter(a=>a!==r))}};return t}function Jg(e,t){const n=r=>async()=>{const i=t(r);return r.update(bo,a=>[...a.filter(o=>o[0]!==e),[e,i]]),n.id=e,n.schema=i,()=>{r.update(bo,a=>a.filter(([o])=>o!==e))}};return n.type=r=>{const i=r.get(jr).marks[e];if(!i)throw yu(e);return i},n}function Aa(e,t){const n=r=>async()=>{const i=t(r);return r.update(wo,a=>[...a.filter(o=>o[0]!==e),[e,i]]),n.id=e,n.schema=i,()=>{r.update(wo,a=>a.filter(([o])=>o!==e))}};return n.type=r=>{const i=r.get(jr).nodes[e];if(!i)throw vu(e);return i},n}function lr(e){let t;const n=r=>async()=>(await r.wait(Ms),t=e(r),r.update(Mr,i=>[...i,t]),()=>{r.update(Mr,i=>i.filter(a=>a!==t))});return n.plugin=()=>t,n.key=()=>t.spec.key,n}function Qg(e){const t=n=>async()=>{await n.wait(wu);const r=n.get(bu),i=e(n),a=r.addObjectKeymap(i);return t.keymap=i,()=>{a()}};return t}function Yt(e,t){const n=Cs(e,t),r=i=>(i.inject(n),()=>()=>{i.remove(n)});return r.key=n,r}function Ze(e,t){const n=Yt(t,e),r=Aa(e,a=>a.get(n.key)(a)),i=[n,r];return i.id=r.id,i.node=r,i.type=a=>r.type(a),i.ctx=n,i.key=n.key,i.extendSchema=a=>{const o=a(t);return Ze(e,o)},i}function cr(e,t){const n=Yt(t,e),r=Jg(e,a=>a.get(n.key)(a)),i=[n,r];return i.id=r.id,i.mark=r,i.type=a=>r.type(a),i.ctx=n,i.key=n.key,i.extendSchema=a=>{const o=a(t);return cr(e,o)},i}function ct(e,t){const n=Object.fromEntries(Object.entries(t).map(([o,{shortcuts:s,priority:l}])=>[o,{shortcuts:s,priority:l}])),r=Yt(n,`${e}Keymap`),i=Qg(o=>{const s=o.get(r.key),l=Object.entries(t).flatMap(([c,{command:f}])=>{const u=s[c],p=[u.shortcuts].flat(),d=u.priority;return p.map(h=>[h,{key:h,onRun:f,priority:d}])});return Object.fromEntries(l)}),a=[r,i];return a.ctx=r,a.shortcuts=i,a.key=r.key,a.keymap=i.keymap,a}const ut=(e,t=()=>({}))=>Yt(t,`${e}Attr`),ei=(e,t=()=>({}))=>Yt(t,`${e}Attr`);function Dn(e,t,n){const r=Yt({},e),i=o=>async()=>{await o.wait(Ss);const l={plugin:t(o),options:o.get(r.key)};return o.update(yo,c=>[...c,l]),()=>{o.update(yo,c=>c.filter(f=>f!==l))}},a=[r,i];return a.id=e,a.plugin=i,a.options=r,a}function Xg(){return e=>{const t=document.createElement("div"),n=e.get(jr),r=e.get(qr),i=fu.fromSchema(n).serializeFragment(r.state.doc.content);return t.appendChild(i),t.innerHTML}}function ls(e,t=!1){return n=>{const r=n.get(qr),a=n.get(du)(e);if(!a)return;if(!t){const{state:f}=r;return r.dispatch(f.tr.replace(0,f.doc.content.size,new nr(a.content,0,0)))}const o=n.get(jr),s=n.get(pu),l=n.get(Mr),c=hu.create({schema:o,doc:a,plugins:l,...s});r.updateState(c)}}function ev(e,t){return function(n,r){let{$from:i,$to:a,node:o}=n.selection;if(o&&o.isBlock||i.depth<2||!i.sameParent(a))return!1;let s=i.node(-1);if(s.type!=e)return!1;if(i.parent.content.size==0&&i.node(-1).childCount==i.indexAfter(-1)){if(i.depth==3||i.node(-3).type!=e||i.index(-2)!=i.node(-2).childCount-1)return!1;if(r){let u=ke.empty,p=i.index(-1)?1:i.index(-2)?2:3;for(let v=i.depth-p;v>=i.depth-3;v--)u=ke.from(i.node(v).copy(u));let d=i.indexAfter(-1)<i.node(-2).childCount?1:i.indexAfter(-2)<i.node(-3).childCount?2:3;u=u.append(ke.from(e.createAndFill()));let h=i.before(i.depth-(p-1)),g=n.tr.replace(h,i.after(-d),new nr(u,4-p,0)),m=-1;g.doc.nodesBetween(h,g.doc.content.size,(v,w)=>{if(m>-1)return!1;v.isTextblock&&v.content.size==0&&(m=w+1)}),m>-1&&g.setSelection(Ji.near(g.doc.resolve(m))),r(g.scrollIntoView())}return!0}let l=a.pos==i.end()?s.contentMatchAt(0).defaultType:null,c=n.tr.delete(i.pos,a.pos),f=l?[null,{type:l}]:void 0;return _u(c.doc,i.pos,2,f)?(r&&r(c.split(i.pos,2,f).scrollIntoView()),!0):!1}}function tv(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?nv(t,n,e,a):rv(t,n,a):!0:!1}}function nv(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new Zi(a-1,o,a,o,new nr(ke.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ku(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const s=xu(r);if(s==null)return!1;i.lift(r,s);let l=i.doc.resolve(i.mapping.map(a,-1)-1);return Au(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),t(i.scrollIntoView()),!0}function rv(e,t,n){let r=e.tr,i=n.parent;for(let d=n.end,h=n.endIndex-1,g=n.startIndex;h>g;h--)d-=i.child(h).nodeSize,r.delete(d-1,d+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,l=n.endIndex==i.childCount,c=a.node(-1),f=a.index(-1);if(!c.canReplace(f+(s?0:1),f+1,o.content.append(l?ke.empty:ke.from(i))))return!1;let u=a.pos,p=u+o.nodeSize;return r.step(new Zi(u-(s?1:0),p+(l?1:0),u+1,p-1,new nr((s?ke.empty:ke.from(i.copy(ke.empty))).append(l?ke.empty:ke.from(i.copy(ke.empty))),s?0:1,l?0:1),s?0:1)),t(r.scrollIntoView()),!0}function iv(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,l=s.child(o-1);if(l.type!=e)return!1;if(n){let c=l.lastChild&&l.lastChild.type==s.type,f=ke.from(c?e.create():null),u=new nr(ke.from(e.create(null,ke.from(s.type.create(null,f)))),c?3:1,0),p=a.start,d=a.end;n(t.tr.step(new Zi(p-(c?3:1),d,p,d,u,1,!0)).scrollIntoView())}return!0}}function av(e){const t=new Map;if(!e||!e.type)throw new Error("mdast-util-definitions expected node");return rr(e,"definition",function(r){const i=cs(r.identifier);i&&!t.get(i)&&t.set(i,r)}),n;function n(r){const i=cs(r);return t.get(i)}}function cs(e){return String(e||"").toUpperCase()}function ov(){return function(e){const t=av(e);rr(e,function(n,r,i){if(n.type==="definition"&&i!==void 0&&typeof r=="number")return i.children.splice(r,1),[ko,r];if(n.type==="imageReference"||n.type==="linkReference"){const a=t(n.identifier);if(a&&i&&typeof r=="number")return i.children[r]=n.type==="imageReference"?{type:"image",url:a.url,title:a.title,alt:n.alt}:{type:"link",url:a.url,title:a.title,children:n.children},[ko,r]}})}}function Lc(e,t){if(!(t.childCount>=1&&t.lastChild?.type.name==="hardbreak")){e.next(t.content);return}const r=[];t.content.forEach((i,a,o)=>{o!==t.childCount-1&&r.push(i)}),e.next(ke.fromArray(r))}function _(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-commonmark",...t}}),e}const Ea=ei("emphasis");_(Ea,{displayName:"Attr<emphasis>",group:"Emphasis"});const Rn=cr("emphasis",e=>({attrs:{marker:{default:e.get(Ls).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:t=>t==="italic"}],toDOM:t=>["em",e.get(Ea.key)(t)],parseMarkdown:{match:t=>t.type==="emphasis",runner:(t,n,r)=>{t.openMark(r,{marker:n.marker}),t.next(n.children),t.closeMark(r)}},toMarkdown:{match:t=>t.type.name==="emphasis",runner:(t,n)=>{t.withMark(n,"emphasis",void 0,{marker:n.attrs.marker})}}}));_(Rn.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"});_(Rn.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});const ti=ie("ToggleEmphasis",e=>()=>Qi(Rn.type(e)));_(ti,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});const Ic=lt(e=>Ur(/(?:^|[^*])\*([^*]+)\*$/,Rn.type(e),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:t,start:n})=>t.startsWith("*")?{}:{fullMatch:t.slice(1),start:n+1}}));_(Ic,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});const Nc=lt(e=>Ur(/\b_(?![_\s])(.*?[^_\s])_\b/,Rn.type(e),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:t,start:n})=>t.startsWith("_")?{}:{fullMatch:t.slice(1),start:n+1}}));_(Nc,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});const Ca=ct("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:e=>{const t=e.get(ae);return()=>t.call(ti.key)}}});_(Ca.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"});_(Ca.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});const Sa=ei("strong");_(Sa,{displayName:"Attr<strong>",group:"Strong"});const ur=cr("strong",e=>({attrs:{marker:{default:e.get(Ls).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:t=>t.style.fontWeight!="normal"&&null},{tag:"strong"},{style:"font-style",getAttrs:t=>t==="bold"},{style:"font-weight=400",clearMark:t=>t.type.name=="strong"},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM:t=>["strong",e.get(Sa.key)(t)],parseMarkdown:{match:t=>t.type==="strong",runner:(t,n,r)=>{t.openMark(r,{marker:n.marker}),t.next(n.children),t.closeMark(r)}},toMarkdown:{match:t=>t.type.name==="strong",runner:(t,n)=>{t.withMark(n,"strong",void 0,{marker:n.attrs.marker})}}}));_(ur.mark,{displayName:"MarkSchema<strong>",group:"Strong"});_(ur.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});const ni=ie("ToggleStrong",e=>()=>Qi(ur.type(e)));_(ni,{displayName:"Command<toggleStrongCommand>",group:"Strong"});const Tc=lt(e=>Ur(new RegExp("(?<![\\w:/])(?:\\*\\*|__)([^*_]+?)(?:\\*\\*|__)(?![\\w/])$"),ur.type(e),{getAttr:t=>({marker:t[0].startsWith("*")?"*":"_"})}));_(Tc,{displayName:"InputRule<strong>",group:"Strong"});const Ma=ct("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:e=>{const t=e.get(ae);return()=>t.call(ni.key)}}});_(Ma.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"});_(Ma.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});const La=ei("inlineCode");_(La,{displayName:"Attr<inlineCode>",group:"InlineCode"});const Ot=cr("inlineCode",e=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:t=>["code",e.get(La.key)(t)],parseMarkdown:{match:t=>t.type==="inlineCode",runner:(t,n,r)=>{t.openMark(r),t.addText(n.value),t.closeMark(r)}},toMarkdown:{match:t=>t.type.name==="inlineCode",runner:(t,n,r)=>{t.withMark(n,"inlineCode",r.text||"")}}}));_(Ot.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"});_(Ot.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});const Ia=ie("ToggleInlineCode",e=>()=>(t,n)=>{const{selection:r,tr:i}=t;if(r.empty)return!1;const{from:a,to:o}=r;return t.doc.rangeHasMark(a,o,Ot.type(e))?(n?.(i.removeMark(a,o,Ot.type(e))),!0):(Object.keys(t.schema.marks).filter(c=>c!==Ot.type.name).map(c=>t.schema.marks[c]).forEach(c=>{i.removeMark(a,o,c)}),n?.(i.addMark(a,o,Ot.type(e).create())),!0)});_(Ia,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});const Oc=lt(e=>Ur(/(?:`)([^`]+)(?:`)$/,Ot.type(e)));_(Oc,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});const Na=ct("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:e=>{const t=e.get(ae);return()=>t.call(Ia.key)}}});_(Na.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"});_(Na.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});const Ta=ei("link");_(Ta,{displayName:"Attr<link>",group:"Link"});const kn=cr("link",e=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:t=>{if(!(t instanceof HTMLElement))throw sn(t);return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM:t=>["a",{...e.get(Ta.key)(t),...t.attrs}],parseMarkdown:{match:t=>t.type==="link",runner:(t,n,r)=>{const i=n.url,a=n.title;t.openMark(r,{href:i,title:a}),t.next(n.children),t.closeMark(r)}},toMarkdown:{match:t=>t.type.name==="link",runner:(t,n)=>{t.withMark(n,"link",void 0,{title:n.attrs.title,url:n.attrs.href})}}}));_(kn.mark,{displayName:"MarkSchema<link>",group:"Link"});const Oa=ie("ToggleLink",e=>(t={})=>Qi(kn.type(e),t));_(Oa,{displayName:"Command<toggleLinkCommand>",group:"Link"});const $c=ie("UpdateLink",e=>(t={})=>(n,r)=>{if(!r)return!1;let i,a=-1;const{selection:o}=n,{from:s,to:l}=o;if(n.doc.nodesBetween(s,s===l?l+1:l,(h,g)=>{if(kn.type(e).isInSet(h.marks))return i=h,a=g,!1}),!i)return!1;const c=i.marks.find(({type:h})=>h===kn.type(e));if(!c)return!1;const f=a,u=a+i.nodeSize,{tr:p}=n,d=kn.type(e).create({...c.attrs,...t});return d?(r(p.removeMark(f,u,c).addMark(f,u,d).setSelection(new Vr(p.selection.$anchor)).scrollIntoView()),!0):!1});_($c,{displayName:"Command<updateLinkCommand>",group:"Link"});const Dc=Aa("doc",()=>({content:"block+",parseMarkdown:{match:({type:e})=>e==="root",runner:(e,t,n)=>{e.injectRoot(t,n)}},toMarkdown:{match:e=>e.type.name==="doc",runner:(e,t)=>{e.openNode("root"),e.next(t.content)}}}));_(Dc,{displayName:"NodeSchema<doc>",group:"Doc"});function sv(e){return Tu(e,t=>t.type==="html"&&["<br />","<br>","<br >","<br/>"].includes(t.value?.trim()),(t,n)=>{if(!n.length)return;const r=n[n.length-1];if(!r)return;const i=r.children.indexOf(t);i!==-1&&r.children.splice(i,1)},!0)}const ri=Dn("remark-preserve-empty-line",()=>()=>sv);_(ri.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"});_(ri.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});const $a=ut("paragraph");_($a,{displayName:"Attr<paragraph>",group:"Paragraph"});const un=Ze("paragraph",e=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:t=>["p",e.get($a.key)(t),0],parseMarkdown:{match:t=>t.type==="paragraph",runner:(t,n,r)=>{t.openNode(r),n.children?t.next(n.children):t.addText(n.value||""),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="paragraph",runner:(t,n)=>{const i=e.get(qr).state?.doc.lastChild;t.openNode("paragraph"),(!n.content||n.content.size===0)&&n!==i&&lv(e)?t.addNode("html",void 0,"<br />"):Lc(t,n),t.closeNode()}}}));function lv(e){let t=!1;try{e.get(ri.id),t=!0}catch{t=!1}return t}_(un.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"});_(un.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});const ii=ie("TurnIntoText",e=>()=>Gn(un.type(e)));_(ii,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});const Da=ct("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:e=>{const t=e.get(ae);return()=>t.call(ii.key)}}});_(Da.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"});_(Da.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});const cv=Array(6).fill(0).map((e,t)=>t+1);function uv(e){return e.textContent.toLowerCase().trim().replace(/\s+/g,"-")}const ai=Yt(uv,"headingIdGenerator");_(ai,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});const Ra=ut("heading");_(Ra,{displayName:"Attr<heading>",group:"Heading"});const fn=Ze("heading",e=>{const t=e.get(ai.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:cv.map(n=>({tag:`h${n}`,getAttrs:r=>{if(!(r instanceof HTMLElement))throw sn(r);return{level:n,id:r.id}}})),toDOM:n=>[`h${n.attrs.level}`,{...e.get(Ra.key)(n),id:n.attrs.id||t(n)},0],parseMarkdown:{match:({type:n})=>n==="heading",runner:(n,r,i)=>{const a=r.depth;n.openNode(i,{level:a}),n.next(r.children),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="heading",runner:(n,r)=>{n.openNode("heading",void 0,{depth:r.attrs.level}),Lc(n,r),n.closeNode()}}}});_(fn.node,{displayName:"NodeSchema<heading>",group:"Heading"});_(fn.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});const Rc=lt(e=>Is(/^(?<hashes>#+)\s$/,fn.type(e),t=>{const n=t.groups?.hashes?.length||0,r=e.get(qr),{$from:i}=r.state.selection,a=i.node();if(a.type.name==="heading"){let o=Number(a.attrs.level)+Number(n);return o>6&&(o=6),{level:o}}return{level:n}}));_(Rc,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});const bt=ie("WrapInHeading",e=>t=>(t??=1,t<1?Gn(un.type(e)):Gn(fn.type(e),{level:t})));_(bt,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});const Fa=ie("DowngradeHeading",e=>()=>(t,n,r)=>{const{$from:i}=t.selection,a=i.node();if(a.type!==fn.type(e)||!t.selection.empty||i.parentOffset!==0)return!1;const o=a.attrs.level-1;return o?(n?.(t.tr.setNodeMarkup(t.selection.$from.before(),void 0,{...a.attrs,level:o})),!0):Gn(un.type(e))(t,n,r)});_(Fa,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});const Ha=ct("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:e=>{const t=e.get(ae);return()=>t.call(bt.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:e=>{const t=e.get(ae);return()=>t.call(bt.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:e=>{const t=e.get(ae);return()=>t.call(bt.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:e=>{const t=e.get(ae);return()=>t.call(bt.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:e=>{const t=e.get(ae);return()=>t.call(bt.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:e=>{const t=e.get(ae);return()=>t.call(bt.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:e=>{const t=e.get(ae);return()=>t.call(Fa.key)}}});_(Ha.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"});_(Ha.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});const Pa=ut("blockquote");_(Pa,{displayName:"Attr<blockquote>",group:"Blockquote"});const fr=Ze("blockquote",e=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:t=>["blockquote",e.get(Pa.key)(t),0],parseMarkdown:{match:({type:t})=>t==="blockquote",runner:(t,n,r)=>{t.openNode(r).next(n.children).closeNode()}},toMarkdown:{match:t=>t.type.name==="blockquote",runner:(t,n)=>{t.openNode("blockquote").next(n.content).closeNode()}}}));_(fr.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"});_(fr.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});const Fc=lt(e=>ea(/^\s*>\s$/,fr.type(e)));_(Fc,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});const oi=ie("WrapInBlockquote",e=>()=>Xi(fr.type(e)));_(oi,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});const Ba=ct("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:e=>{const t=e.get(ae);return()=>t.call(oi.key)}}});_(Ba.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"});_(Ba.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});const ja=ut("codeBlock",()=>({pre:{},code:{}}));_(ja,{displayName:"Attr<codeBlock>",group:"CodeBlock"});const dr=Ze("code_block",e=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:"",validate:"string"}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>{if(!(t instanceof HTMLElement))throw sn(t);return{language:t.dataset.language}}}],toDOM:t=>{const n=e.get(ja.key)(t),r=t.attrs.language,i=r&&r.length>0?{"data-language":r}:void 0;return["pre",{...n.pre,...i},["code",n.code,0]]},parseMarkdown:{match:({type:t})=>t==="code",runner:(t,n,r)=>{const i=n.lang??"",a=n.value;t.openNode(r,{language:i}),a&&t.addText(a),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="code_block",runner:(t,n)=>{t.addNode("code",void 0,n.content.firstChild?.text||"",{lang:n.attrs.language})}}}));_(dr.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"});_(dr.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});const Hc=lt(e=>Is(/^```(?<language>[a-z]*)?[\s\n]$/,dr.type(e),t=>({language:t.groups?.language??""})));_(Hc,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});const qa=ie("CreateCodeBlock",e=>(t="")=>Gn(dr.type(e),{language:t}));_(qa,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"});const fv=ie("UpdateCodeBlockLanguage",()=>({pos:e,language:t}={pos:-1,language:""})=>(n,r)=>e>=0?(r?.(n.tr.setNodeAttribute(e,"language",t)),!0):!1);_(fv,{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});const Va=ct("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:e=>{const t=e.get(ae);return()=>t.call(qa.key)}}});_(Va.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"});_(Va.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});const Ua=ut("image");_(Ua,{displayName:"Attr<image>",group:"Image"});const Fn=Ze("image",e=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:"",validate:"string"},alt:{default:"",validate:"string"},title:{default:"",validate:"string"}},parseDOM:[{tag:"img[src]",getAttrs:t=>{if(!(t instanceof HTMLElement))throw sn(t);return{src:t.getAttribute("src")||"",alt:t.getAttribute("alt")||"",title:t.getAttribute("title")||t.getAttribute("alt")||""}}}],toDOM:t=>["img",{...e.get(Ua.key)(t),...t.attrs}],parseMarkdown:{match:({type:t})=>t==="image",runner:(t,n,r)=>{const i=n.url,a=n.alt,o=n.title;t.addNode(r,{src:i,alt:a,title:o})}},toMarkdown:{match:t=>t.type.name==="image",runner:(t,n)=>{t.addNode("image",void 0,void 0,{title:n.attrs.title,url:n.attrs.src,alt:n.attrs.alt})}}}));_(Fn.node,{displayName:"NodeSchema<image>",group:"Image"});_(Fn.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});const Ya=ie("InsertImage",e=>(t={})=>(n,r)=>{if(!r)return!0;const{src:i="",alt:a="",title:o=""}=t,s=Fn.type(e).create({src:i,alt:a,title:o});return s&&r(n.tr.replaceSelectionWith(s).scrollIntoView()),!0});_(Ya,{displayName:"Command<insertImageCommand>",group:"Image"});const Pc=ie("UpdateImage",e=>(t={})=>(n,r)=>{const i=Cu(n.selection,Fn.type(e));if(!i)return!1;const{node:a,pos:o}=i,s={...a.attrs},{src:l,alt:c,title:f}=t;return l!==void 0&&(s.src=l),c!==void 0&&(s.alt=c),f!==void 0&&(s.title=f),r?.(n.tr.setNodeMarkup(o,void 0,s).scrollIntoView()),!0});_(Pc,{displayName:"Command<updateImageCommand>",group:"Image"});const dv=lt(e=>new Ns(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(t,n,r,i)=>{const[a,o,s="",l]=n;return a?t.tr.replaceWith(r,i,Fn.type(e).create({src:s,alt:o,title:l})):null}));_(dv,{displayName:"InputRule<insertImageInputRule>",group:"Image"});const Br=ut("hardbreak",e=>({"data-type":"hardbreak","data-is-inline":e.attrs.isInline}));_(Br,{displayName:"Attr<hardbreak>",group:"Hardbreak"});const tn=Ze("hardbreak",e=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:t=>t.attrs.isInline?["span",e.get(Br.key)(t)," "]:["br",e.get(Br.key)(t)],parseMarkdown:{match:({type:t})=>t==="break",runner:(t,n,r)=>{t.addNode(r,{isInline:!!n.data?.isInline})}},leafText:()=>`
|
|
43
43
|
`,toMarkdown:{match:t=>t.type.name==="hardbreak",runner:(t,n)=>{n.attrs.isInline?t.addNode("text",void 0,`
|
|
44
|
-
`):t.addNode("break")}}}));_(Gt.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"});_(Gt.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});const qa=ie("InsertHardbreak",e=>()=>(t,n)=>{const{selection:r,tr:i}=t;if(!(r instanceof Pr))return!1;if(r.empty){const a=r.$from.node();if(a.childCount>0&&a.lastChild?.type.name==="hardbreak")return n?.(i.replaceRangeWith(r.to-1,r.to,t.schema.node("paragraph")).setSelection(Ki.near(i.doc.resolve(r.to))).scrollIntoView()),!0}return n?.(i.setMeta("hardbreak",!0).replaceSelectionWith(Gt.type(e).create()).scrollIntoView()),!0});_(qa,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});const Va=at("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:e=>{const t=e.get(ae);return()=>t.call(qa.key)}}});_(Va.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"});_(Va.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});const Ua=ot("hr");_(Ua,{displayName:"Attr<hr>",group:"Hr"});const cr=Ge("hr",e=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:t=>["hr",e.get(Ua.key)(t)],parseMarkdown:{match:({type:t})=>t==="thematicBreak",runner:(t,n,r)=>{t.addNode(r)}},toMarkdown:{match:t=>t.type.name==="hr",runner:t=>{t.addNode("thematicBreak")}}}));_(cr.node,{displayName:"NodeSchema<hr>",group:"Hr"});_(cr.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});const Nc=it(e=>new Es(/^(?:---|___\s|\*\*\*\s)$/,(t,n,r,i)=>{const{tr:a}=t;return n[0]&&a.replaceWith(r-1,i,cr.type(e).create()),a}));_(Nc,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});const Ya=ie("InsertHr",e=>()=>(t,n)=>{if(!n)return!0;const r=sn.node.type(e).create(),{tr:i,selection:a}=t,{from:o}=a,s=cr.type(e).create();if(!s)return!0;const l=i.replaceSelectionWith(s).insert(o,r),c=Ki.findFrom(l.doc.resolve(o),1,!0);return c&&n(l.setSelection(c).scrollIntoView()),!0});_(Ya,{displayName:"Command<insertHrCommand>",group:"Hr"});const Wa=ot("bulletList");_(Wa,{displayName:"Attr<bulletList>",group:"BulletList"});const On=Ge("bullet_list",e=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:t=>{if(!(t instanceof HTMLElement))throw tn(t);return{spread:t.dataset.spread==="true"}}}],toDOM:t=>["ul",{...e.get(Wa.key)(t),"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:t,ordered:n})=>t==="list"&&!n,runner:(t,n,r)=>{const i=n.spread!=null?`${n.spread}`:"false";t.openNode(r,{spread:i}).next(n.children).closeNode()}},toMarkdown:{match:t=>t.type.name==="bullet_list",runner:(t,n)=>{t.openNode("list",void 0,{ordered:!1,spread:n.attrs.spread}).next(n.content).closeNode()}}}));_(On.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"});_(On.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});const Tc=it(e=>Zi(/^\s*([-+*])\s$/,On.type(e)));_(Tc,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});const ii=ie("WrapInBulletList",e=>()=>Gi(On.type(e)));_(ii,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});const Ka=at("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:e=>{const t=e.get(ae);return()=>t.call(ii.key)}}});_(Ka.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"});_(Ka.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});const za=ot("orderedList");_(za,{displayName:"Attr<orderedList>",group:"OrderedList"});const $n=Ge("ordered_list",e=>({content:"listItem+",group:"block",attrs:{order:{default:1,validate:"number"},spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ol",getAttrs:t=>{if(!(t instanceof HTMLElement))throw tn(t);return{spread:t.dataset.spread,order:t.hasAttribute("start")?Number(t.getAttribute("start")):1}}}],toDOM:t=>["ol",{...e.get(za.key)(t),...t.attrs.order===1?{}:t.attrs.order,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:t,ordered:n})=>t==="list"&&!!n,runner:(t,n,r)=>{const i=n.spread!=null?`${n.spread}`:"true";t.openNode(r,{spread:i}).next(n.children).closeNode()}},toMarkdown:{match:t=>t.type.name==="ordered_list",runner:(t,n)=>{t.openNode("list",void 0,{ordered:!0,start:1,spread:n.attrs.spread==="true"}),t.next(n.content),t.closeNode()}}}));_($n.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"});_($n.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});const Oc=it(e=>Zi(/^\s*(\d+)\.\s$/,$n.type(e),t=>({order:Number(t[1])}),(t,n)=>n.childCount+n.attrs.order===Number(t[1])));_(Oc,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});const ai=ie("WrapInOrderedList",e=>()=>Gi($n.type(e)));_(ai,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});const Ga=at("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:e=>{const t=e.get(ae);return()=>t.call(ai.key)}}});_(Ga.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"});_(Ga.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});const Za=ot("listItem");_(Za,{displayName:"Attr<listItem>",group:"ListItem"});const Vt=Ge("list_item",e=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"•",validate:"string"},listType:{default:"bullet",validate:"string"},spread:{default:!0,validate:"boolean"}},defining:!0,parseDOM:[{tag:"li",getAttrs:t=>{if(!(t instanceof HTMLElement))throw tn(t);return{label:t.dataset.label,listType:t.dataset.listType,spread:t.dataset.spread==="true"}}}],toDOM:t=>["li",{...e.get(Za.key)(t),"data-label":t.attrs.label,"data-list-type":t.attrs.listType,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:t})=>t==="listItem",runner:(t,n,r)=>{const i=n.label!=null?`${n.label}.`:"•",a=n.label!=null?"ordered":"bullet",o=n.spread!=null?`${n.spread}`:"true";t.openNode(r,{label:i,listType:a,spread:o}),t.next(n.children),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="list_item",runner:(t,n)=>{t.openNode("listItem",void 0,{spread:n.attrs.spread}),t.next(n.content),t.closeNode()}}}));_(Vt.node,{displayName:"NodeSchema<listItem>",group:"ListItem"});_(Vt.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});const Ja=ie("SinkListItem",e=>()=>Hg(Vt.type(e)));_(Ja,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});const Qa=ie("LiftListItem",e=>()=>Dg(Vt.type(e)));_(Qa,{displayName:"Command<liftListItemCommand>",group:"ListItem"});const Xa=ie("SplitListItem",e=>()=>$g(Vt.type(e)));_(Xa,{displayName:"Command<splitListItemCommand>",group:"ListItem"});function Kg(e){return(t,n,r)=>{const{selection:i}=t;if(!(i instanceof Pr))return!1;const{empty:a,$from:o}=i;return!a||o.parentOffset!==0||o.node(-1).type!==Vt.type(e)?!1:gu(t,n,r)}}const eo=ie("LiftFirstListItem",e=>()=>Kg(e));_(eo,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});const to=at("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:e=>{const t=e.get(ae);return()=>t.call(Xa.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:e=>{const t=e.get(ae);return()=>t.call(Ja.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:e=>{const t=e.get(ae);return()=>t.call(Qa.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:e=>{const t=e.get(ae);return()=>t.call(eo.key)}}});_(to.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"});_(to.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});const $c=_a("text",()=>({group:"inline",parseMarkdown:{match:({type:e})=>e==="text",runner:(e,t)=>{e.addText(t.value)}},toMarkdown:{match:e=>e.type.name==="text",runner:(e,t)=>{e.addNode("text",void 0,t.text)}}}));_($c,{displayName:"NodeSchema<text>",group:"Text"});const no=ot("html");_(no,{displayName:"Attr<html>",group:"Html"});const ro=Ge("html",e=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:t=>{const n=document.createElement("span"),r={...e.get(no.key)(t),"data-value":t.attrs.value,"data-type":"html"};return n.textContent=t.attrs.value,["span",r,t.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:t=>({value:t.dataset.value??""})}],parseMarkdown:{match:({type:t})=>t==="html",runner:(t,n,r)=>{t.addNode(r,{value:n.value})}},toMarkdown:{match:t=>t.type.name==="html",runner:(t,n)=>{t.addNode("html",void 0,n.attrs.value)}}}));_(ro.node,{displayName:"NodeSchema<html>",group:"Html"});_(ro.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});const zg=[Cc,La,sn,ni,Ta,ln,Rr,Gt,Da,sr,Fa,lr,Ua,cr,Ba,Tn,Wa,On,za,$n,Za,Vt,ba,Nn,xa,or,Ea,Nt,Ma,bn,no,ro,$c].flat(),Gg=[Mc,Tc,Oc,Ic,Nc,Sc].flat(),Zg=[bc,kc,Ac,xc],Jg=ie("IsMarkSelected",()=>e=>t=>{if(!e)return!1;const{doc:n,selection:r}=t;return n.rangeHasMark(r.from,r.to,e)}),Qg=ie("IsNoteSelected",()=>e=>t=>e?yu(t,e).hasNode:!1),Xg=ie("ClearTextInCurrentBlock",()=>()=>(e,t)=>{let n=e.tr;const{$from:r,$to:i}=n.selection,{pos:a}=r,{pos:o}=i,s=a-r.node().content.size;return s<0?!1:(n=n.deleteRange(s,o),t?.(n),!0)}),ev=ie("SetBlockType",()=>e=>(t,n)=>{const{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;const a=t.tr,{from:o,to:s}=a.selection;try{a.setBlockType(o,s,r,i)}catch{return!1}return n?.(a),!0}),tv=ie("WrapInBlockType",()=>e=>(t,n)=>{const{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;let a=t.tr;try{const{$from:o,$to:s}=a.selection,l=o.blockRange(s),c=l&&wu(l,r,i);if(!c)return!1;a=a.wrap(l,c)}catch{return!1}return n?.(a),!0}),nv=ie("AddBlockType",()=>e=>(t,n)=>{const{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;const a=t.tr;try{const o=r instanceof _u?r:r.createAndFill(i);if(!o)return!1;a.replaceSelectionWith(o)}catch{return!1}return n?.(a),!0}),rv=ie("SelectTextNearPos",()=>e=>(t,n)=>{const{pos:r}=e??{};if(r==null)return!1;const i=(o,s,l)=>Math.min(Math.max(o,s),l),a=t.tr;try{const o=t.doc.resolve(i(r,0,t.doc.content.size));a.setSelection(Pr.near(o))}catch{return!1}return n?.(a.scrollIntoView()),!0}),iv=[ti,ri,vt,Oa,Ha,qa,Ya,ja,Lc,ai,ii,Ja,Xa,Qa,eo,Qr,Ca,Xr,Ia,Ec,Jg,Qg,Xg,ev,tv,nv,rv],av=[Ra,Pa,Va,$a,to,Ga,Ka,Na,ka,Sa,Aa].flat(),io=Ln("remarkAddOrderInList",()=>()=>e=>{Xn(e,"list",t=>{if(t.ordered){const n=t.start??1;t.children.forEach((r,i)=>{r.label=i+n})}})});_(io.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"});_(io.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});const ao=Ln("remarkLineBreak",()=>()=>e=>{const t=/[\t ]*(?:\r?\n|\r)/g;Xn(e,"text",(n,r,i)=>{if(!n.value||typeof n.value!="string")return;const a=[];let o=0;t.lastIndex=0;let s=t.exec(n.value);for(;s;){const c=s.index;o!==c&&a.push({type:"text",value:n.value.slice(o,c)}),a.push({type:"break",data:{isInline:!0}}),o=c+s[0].length,s=t.exec(n.value)}if(a.length>0&&i&&typeof r=="number")return o<n.value.length&&a.push({type:"text",value:n.value.slice(o)}),i.children.splice(r,1,...a),r+a.length})});_(ao.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"});_(ao.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});const oo=Ln("remarkInlineLink",()=>Bg);_(oo.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"});_(oo.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});const ov=e=>!!e.children,sv=e=>e.type==="html";function lv(e,t){return n(e,0,null)[0];function n(r,i,a){if(ov(r)){const o=[];for(let s=0,l=r.children.length;s<l;s++){const c=r.children[s];if(c){const f=n(c,s,r);if(f)for(let u=0,p=f.length;u<p;u++){const d=f[u];d&&o.push(d)}}}r.children=o}return t(r,i,a)}}const cv=["root","blockquote","listItem"],so=Ln("remarkHTMLTransformer",()=>()=>e=>{lv(e,(t,n,r)=>sv(t)?(r&&cv.includes(r.type)&&(t.children=[{...t}],delete t.value,t.type="paragraph"),[t]):[t])});_(so.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"});_(so.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});const lo=Ln("remarkMarker",()=>()=>(e,t)=>{const n=r=>t.value.charAt(r.position.start.offset);Xn(e,r=>["strong","emphasis"].includes(r.type),r=>{r.marker=n(r)})});_(lo.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"});_(lo.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});const Dc=ir(()=>{let e=!1;const t=new Mn("MILKDOWN_INLINE_NODES_CURSOR"),n=new Sn({key:t,state:{init(){return!1},apply(r){if(!r.selection.empty)return!1;const i=r.selection.$from,a=i.nodeBefore,o=i.nodeAfter;return!!(a&&o&&a.isInline&&!a.isText&&o.isInline&&!o.isText)}},props:{handleDOMEvents:{compositionend:(r,i)=>e?(e=!1,requestAnimationFrame(()=>{if(n.getState(r.state)){const o=r.state.selection.from;i.preventDefault(),r.dispatch(r.state.tr.insertText(i.data||"",o))}}),!0):!1,compositionstart:r=>(n.getState(r.state)&&(e=!0),!1),beforeinput:(r,i)=>{if(n.getState(r.state)&&i instanceof InputEvent&&i.data&&!e){const o=r.state.selection.from;return i.preventDefault(),r.dispatch(r.state.tr.insertText(i.data||"",o)),!0}return!1}},decorations(r){if(n.getState(r)){const o=r.selection.$from.pos,s=document.createElement("span"),l=wo.widget(o,s,{side:-1}),c=document.createElement("span"),f=wo.widget(o,c);return setTimeout(()=>{s.contentEditable="true",c.contentEditable="true"}),_o.create(r.doc,[l,f])}return _o.empty}}});return n});_(Dc,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});const Rc=ir(e=>new Sn({key:new Mn("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(t,n,r)=>{if(!t.length)return;const[i]=t;if(!i)return;const[a]=i.steps;if(i.getMeta("hardbreak")){if(!(a instanceof bu))return;const{from:l}=a;return r.tr.setNodeMarkup(l,Gt.type(e),void 0,[])}if(a instanceof ku){let l=r.tr;const{from:c,to:f}=a;return r.doc.nodesBetween(c,f,(u,p)=>{u.type===Gt.type(e)&&(l=l.setNodeMarkup(p,Gt.type(e),void 0,[]))}),l}}}));_(Rc,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});const co=qt(["table","code_block"],"hardbreakFilterNodes");_(co,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});const Fc=ir(e=>{const t=e.get(co.key);return new Sn({key:new Mn("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(n,r)=>{const i=n.getMeta("hardbreak"),[a]=n.steps;if(i&&a){const{from:o}=a,s=r.doc.resolve(o);let l=s.depth,c=!0;for(;l>0;)t.includes(s.node(l).type.name)&&(c=!1),l--;return c}return!0}})});_(Fc,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});const Hc=ir(e=>{const t=new Mn("MILKDOWN_HEADING_ID"),n=r=>{if(r.composing)return;const i=e.get(ni.key),a=r.state.tr.setMeta("addToHistory",!1);let o=!1;const s={};r.state.doc.descendants((l,c)=>{if(l.type===ln.type(e)){if(l.textContent.trim().length===0)return;const f=l.attrs;let u=i(l);s[u]?(s[u]+=1,u+=`-#${s[u]}`):s[u]=1,f.id!==u&&(o=!0,a.setMeta(t,!0).setNodeMarkup(c,void 0,{...f,id:u}))}}),o&&r.dispatch(a)};return new Sn({key:t,view:r=>(n(r),{update:(i,a)=>{i.state.doc.eq(a.doc)||n(i)}})})});_(Hc,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});const Pc=ir(e=>{const t=(n,r,i)=>{if(!i.selection||n.some(u=>u.getMeta("addToHistory")===!1||!u.isGeneric))return null;const a=$n.type(e),o=On.type(e),s=Vt.type(e),l=(u,p)=>{let d=!1;const m=`${p+1}.`;return u.label!==m&&(u.label=m,d=!0),d};let c=i.tr,f=!1;return i.doc.descendants((u,p,d,m)=>{if(u.type===o){const g=u.maybeChild(0);g?.type===s&&g.attrs.listType==="ordered"&&(f=!0,c.setNodeMarkup(p,a,{spread:"true"}),u.descendants((h,v,w,k)=>{if(h.type===s){const L={...h.attrs};l(L,k)&&(c=c.setNodeMarkup(v,void 0,L))}return!1}))}else if(u.type===s&&d?.type===a){const g={...u.attrs};let h=!1;g.listType!=="ordered"&&(g.listType="ordered",h=!0),d?.maybeChild(0)&&(h=l(g,m)),h&&(c=c.setNodeMarkup(p,void 0,g),f=!0)}}),f?c.setMeta("addToHistory",!1):null};return new Sn({key:new Mn("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:t})});_(Pc,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});const uv=[Rc,co,Fc,Dc,io,oo,ao,so,lo,ei,Hc,Pc].flat(),fv=[zg,Gg,Zg,iv,av,uv].flat();var dv=z('<label class="editorInput"> <div id="md-editor" class="svelte-g1hz34"><!> <div></div> <!></div> <input type="hidden" class="svelte-g1hz34"/></label> <!> <!>',1);function pv(e,t){se(t,!0);const n=()=>H(Ee,"$draftEntry",s),r=()=>H(tt,"$selectedCollection",s),i=()=>H(nt,"$editingEntry",s),a=()=>H(rt,"$backend",s),o=()=>H(Te,"$loadedWidgets",s),[s,l]=he();let c=je(t,"value",7,""),f=je(t,"required",3,!0),u=K(void 0),p=K(void 0),d=K(!1),m=K(void 0),g=K(void 0),h=K(void 0),v=K(void 0);dt(()=>{c()!==y(p)&&w(c())});function w(M){const j={...n()};M?y(h)&&(j[t.name]=Og()(y(h).ctx).replaceAll("<img ",'<img crossorigin="use-credentials" ')):j[t.name]=r()?.fields.find(J=>J.name===t.name).label,re(Ee,j),U(p,c(),!0)}function k(){if(!y(m))return;const M=document.getSelection();M.removeAllRanges();const j=document.createRange(),{startOffset:J,endOffset:ue}=y(m).range;j.setStart(y(m).node,J),j.setEnd(y(m).node,ue),M.addRange(j)}function L(M){U(d,!1),k(),M&&y(h).action(j=>{const J=j.get(ae),ue={alt:M.name,src:M.url_preview};J.call(ja.key,ue)})}function $(M){if(k(),!M)return;const{href:j}=M,J=document.getSelection(),{textContent:ue}=J.focusNode,{startOffset:de,endOffset:Me}=J.getRangeAt(0),we=ue.substring(de,Me);y(h).action(oe=>{const me=oe.get(ae),Ze={title:we,href:j};me.call(Ia.key,Ze)})}function N(M){y(h).action(j=>{const J=j.get(ae);M==="p"?J.call(ti.key):J.call(vt.key,M)})}function E(M){y(h).action(j=>{const J=j.get(ae);switch(M){case"bold":J.call(Xr.key);break;case"italic":J.call(Qr.key);break;case"listBulleted":J.call(ii.key);break;case"listNumbered":J.call(ai.key);break;case"quote":J.call(ri.key);break;case"horizontalRule":J.call(Ya.key);break;case"link":y(g).toggleEditor();break;case"image":y(m)&&U(d,!0);break}})}function P(){const M=document.getSelection(),j=M.focusNode;y(v)?.contains(j)&&U(m,{node:M.focusNode,range:M.getRangeAt(0)},!0)}function G(M){U(h,M,!0),U(v,document.querySelector(".milkdown .ProseMirror"),!0),rs(c())(y(h).ctx),w(c())}async function V(M){Au.make().config(j=>{j.set(Eu,M),j.set(Cu,c()),j.get(Bi).markdownUpdated((J,ue,de)=>{c(ue)})}).config(Su).use(fv).use(wc).create().then(G)}async function T(){if(i()){try{const M=t.name==="body"?i().body:i().fields[t.name];U(u,a().replacePublicLinks(M),!0),c(await y(u)),y(h)&&rs(c())(y(h).ctx)}catch{}re(Te,o()+1)}}Ue(()=>{T()});var Y=dv();on("selectionchange",Yr,P);var B=be(Y),C=I(B),x=R(C),b=I(x);Qm(b,{ontexttypeselect:N,onactionselect:E});var S=R(b,2);Bf(S,M=>V?.(M));var A=R(S,2);An(eg(A,{onsaveurl:$}),M=>U(g,M,!0),()=>y(g));var O=R(x,2),D=R(B,2);Xe(D,()=>y(u),M=>{Zr(M,{msg:"Loading"})},void 0,(M,j)=>{kt(M,{msg:"Unable to load",get details(){return y(j).message}})});var W=R(D,2);{var Z=M=>{rg(M,{onselectimg:L})};Ne(W,M=>{y(d)&&M(Z)})}ee(()=>{Q(B,"for",t.name),ce(C,`${t.label??""} `),Q(O,"id",t.name),Q(O,"name",t.name),O.required=f()}),Ft(O,c),q(e,Y),le(),l()}var hv=z('<input type="hidden"/>');function mv(e,t){se(t,!0);const n=()=>H(Ee,"$draftEntry",a),r=()=>H(nt,"$editingEntry",a),i=()=>H(Te,"$loadedWidgets",a),[a,o]=he();let s=je(t,"value",7);function l(){const u={...n()};u[t.name]=s(),re(Ee,u)}async function c(){if(r()?.fields[t.name])switch(t.type){case"datetime-local":case"date":case"time":s($r(t.type,new Date(r().fields[t.name])));break;default:s(r().fields[t.name]);break}else if(!s())switch(t.type){case"datetime-local":case"date":case"time":s($r(t.type,new Date));break;case"boolean":s("false");break}l(),re(Te,i()+1)}Ue(()=>{c()});var f=hv();ee(()=>{Q(f,"id",t.name),Q(f,"name",t.name)}),Ft(f,s),q(e,f),le(),o()}var gv=z('<iframe title="Preview" sandbox="allow-same-origin" class="svelte-8q9z6e"></iframe>');function vv(e,t){se(t,!0);const n=()=>H(tt,"$selectedCollection",s),r=()=>H(Ce,"$config",s),i=()=>H(Te,"$loadedWidgets",s),a=()=>H(ha,"$loadingWidgets",s),o=()=>H(Ee,"$draftEntry",s),[s,l]=he();Oe.extend(hc);let c=ct(()=>n()?.preview||r()?.previews.default),f=ct(()=>vm(r(),y(c))),u=K(void 0),p=ct(()=>wm(y(u),y(f))),d=K(void 0),m=K(void 0),g=!1;dt(()=>{!g&&i()===a()&&(U(m,Ei(o()),!0),g=!0)}),dt(()=>{JSON.stringify(o())!==JSON.stringify(y(m))&&v()});function h(){v()}function v(){if(y(d)?.contentDocument){for(const k in o()){const L=n()?.fields.find(E=>E.name===k);let $=o()[k];if(L.name==="date")switch(L?.type){case"time":$=Oe(o()[k],"hh:mm").format(L.time_format);break;case"date":$=Oe(o()[k],"YYYY-MM-DD").format(L.date_format);break;default:$=Oe(o()[k],"YYYY-MM-DDThh:mm").format(L.datetime_format)}y(d).contentDocument.querySelectorAll(`[data-tag="${k}"]`).forEach(E=>{E.innerHTML!==$&&(E.innerHTML=$)})}U(m,o(),!0)}}Ue(async()=>{U(u,await ym(r(),y(c)),!0)});var w=gv();An(w,k=>U(d,k),()=>y(d)),ee(()=>Q(w,"srcdoc",y(p))),on("load",w,h),q(e,w),le(),l()}var yv=z('<!> <div class="page svelte-1cczf35"><section id="inputArea" class="svelte-1cczf35"><header class="svelte-1cczf35">Edit</header> <form id="entry-data" class="svelte-1cczf35"><!></form> <form id="md-link-editor" class="svelte-1cczf35"></form> <form id="ignore" class="svelte-1cczf35"></form></section> <section id="previewArea" class="svelte-1cczf35"><header class="svelte-1cczf35">Preview</header> <!></section></div> <!> <!> <!>',1);function wv(e,t){se(t,!0);const n=()=>H(nt,"$editingEntry",s),r=()=>H(tt,"$selectedCollection",s),i=()=>H(rt,"$backend",s),a=()=>H(p,"$submitted",s),o=()=>H(ma,"$cmsActions",s),[s,l]=he();let c=K(void 0),f=K(void 0);const u=Qe({entryForm:null});Er("formState",u);const p=ht(null);Er("submitted",p);const d={string:Xo,text:Xo,datetime:Dm,boolean:Lm,number:Bm,markdown:pv,hidden:mv};async function m(T){T.preventDefault();const Y=n()?{...n()}:{fields:{}},B=new FormData(T.target);for(const[x,b]of B.entries()){const S=r().fields.find(A=>A.name===x);try{U(c,mc(S,b,i()),!0),Y.fields[x]=await y(c)}catch(A){console.error("Error parsing form entry.",A);return}}const C=bm(r(),Y);re(p,i().saveFile(r(),C));try{re(nt,await a()),o()?.onSave&&(U(f,o().onSave(n()),!0),await y(f))}catch(x){console.warn("Issue saving post.",x)}}Ue(()=>{re(Te,0),re(ha,r().fields.length)});var g=yv(),h=be(g);Mm(h,{});var v=R(h,2),w=I(v),k=R(I(w),2),L=I(k);{var $=T=>{var Y=st(),B=be(Y);Pt(B,1,()=>r().fields,C=>C.name,(C,x)=>{const b=ct(()=>d[y(x).widget]),S=ct(()=>y(x)?.default);var A=st(),O=be(A);{var D=Z=>{var M=st(),j=be(M);vr(j,()=>y(b),(J,ue)=>{ue(J,yr(()=>y(x),{get checked(){return y(S)}}))}),q(Z,M)},W=Z=>{var M=st(),j=be(M);{var J=de=>{var Me=st(),we=be(Me);vr(we,()=>y(b),(oe,me)=>{me(oe,yr(()=>y(x),{get value(){return y(S)},multiline:!0}))}),q(de,Me)},ue=de=>{var Me=st(),we=be(Me);vr(we,()=>y(b),(oe,me)=>{me(oe,yr(()=>y(x),{get value(){return y(S)}}))}),q(de,Me)};Ne(j,de=>{y(x).widget==="text"?de(J):de(ue,!1)},!0)}q(Z,M)};Ne(O,Z=>{y(x).widget==="boolean"?Z(D):Z(W,!1)})}q(C,A)}),q(T,Y)};Ne(L,T=>{r()&&T($)})}An(k,T=>u.entryForm=T,()=>u?.entryForm);var N=R(w,2),E=R(I(N),2);vv(E,{});var P=R(v,2);Xe(P,()=>y(c),null,void 0,(T,Y)=>{kt(T,{msg:"Unable to save",get details(){return y(Y).message}})});var G=R(P,2);Xe(G,a,T=>{Zr(T,{msg:"Saving"})},void 0,(T,Y)=>{kt(T,{msg:"Unable to save",get details(){return y(Y).message}})});var V=R(G,2);Xe(V,()=>y(f),null,void 0,(T,Y)=>{kt(T,{msg:"'On save' event action failed",get details(){return y(Y).message}})}),on("submit",k,m),q(e,g),le(),l()}const _v=(function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"})(),bv=function(e,t){return new URL(e,t).href},as={},wi=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let c=function(f){return Promise.all(f.map(u=>Promise.resolve(u).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};const o=document.getElementsByTagName("link"),s=document.querySelector("meta[property=csp-nonce]"),l=s?.nonce||s?.getAttribute("nonce");i=c(n.map(f=>{if(f=bv(f,r),f in as)return;as[f]=!0;const u=f.endsWith(".css"),p=u?'[rel="stylesheet"]':"";if(r)for(let m=o.length-1;m>=0;m--){const g=o[m];if(g.href===f&&(!u||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${p}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":_v,u||(d.as="script"),d.crossOrigin="",d.href=f,l&&d.setAttribute("nonce",l),document.head.appendChild(d),u)return new Promise((m,g)=>{d.addEventListener("load",m),d.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${f}`)))})}))}function a(o){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o}return i.then(o=>{for(const s of o||[])s.status==="rejected"&&a(s.reason);return t().catch(a)})};async function kv(e,t){let n;try{n=await t.text()}catch(s){console.error("Error constructing doc",s);return}const[r,i]=wa(n),a=Gr.load(r);return{_id:t.webkitRelativePath,name:t.name,collection:e,date:a.date,raw:n,fields:a,body:i,handle:t.handle,directoryHandle:t.directoryHandle}}function Bc(e,t){const n=t.lastModifiedDate,r=`${e.public_folder}/${t.name}`;return{_id:t.webkitRelativePath,name:t.name,date:n,asset:t.type,url:r,url_preview:r,handle:t.handle,directoryHandle:t.directoryHandle}}let kr,jc,qc,Zt,mt,qn;async function xv(){if(Zt=qe(Ce).repo_folder,!Zt){console.error("Missing 'repo_folder' config");return}return await Av(),kr.plugin(jc),kr.plugin(qc),mt=new kr(`${Zt}-local`,{adapter:"idb"}),[["name","collection"],["date","collection"],["asset"],["url"],["url_preview"]].map(t=>({index:{fields:t},ddoc:t.join("-")})).forEach(t=>Cv(t)),console.log("Using local CMS backend"),uo}async function Av(){kr=(await wi(async()=>{const{default:e}=await import("./index.es.js");return{default:e}},[],import.meta.url)).default,jc=(await wi(async()=>{const{default:e}=await import("./index.es2.js");return{default:e}},[],import.meta.url)).default,qc=(await wi(async()=>{const{default:e}=await import("./index-browser.es.js");return{default:e}},[],import.meta.url)).default}async function Ev(){return{title:"Local Backend Enabled",message:"Select the local project directory to continue.",button:"Select Project Directory",action:Mv}}async function Cv(e){try{const t=await mt.createIndex(e);console.log("Create index",e,t)}catch(t){console.error("Create index error",t)}}async function Sv(e){try{const t=await mt.get(e._id);e._rev=t._rev}catch(t){console.warn("Existing doc error",t)}}async function Mv(){if(!Zt)return;const e=[],t=qe(Ce);t.collections.forEach(c=>{const p=`\\/?${c.folder.split("/").join("\\/")}\\/[^_][\\w-]+\\.\\w+`;e.push({name:c.name,regex:new RegExp(p,"i")})});const a=`\\/?${t.media_folder.split("/").join("\\/")}\\/[^_][\\w-]+\\.\\w+`,o=new RegExp(a,"i"),s=["node_modules"],l={recursive:!0,id:`snow-cms-${Zt}`,skipDirectory:c=>c.name.startsWith(".")||s.includes(c.name)};try{const c=await Xh(l),f=[],u=[];c.forEach(g=>{if(!qn&&g.directoryHandle?.name===Zt&&(qn=g.directoryHandle),o.test(g.webkitRelativePath)){f.push(Bc(t,g));return}const v=e.find(({name:w,regex:k})=>k.test(g.webkitRelativePath));v&&u.push(kv(v.name,g))});const p=await Promise.all(u);p.push(...f);const d=[];p.forEach(g=>d.push(Sv(g))),await Promise.all(d);const m=await mt.bulkDocs(p);rt.set(uo)}catch(c){console.error("Open directory error",c)}}async function Iv(e){try{return(await mt.find({selector:{collection:e,date:{$gte:null}},sort:[{date:"desc"}],limit:200})).docs}catch(t){throw console.error("Error finding docs",t),t}}async function Lv(e,t){const n=qe(Ce).repo_folder;t._id||(t._id=[n,e.folder,t.name].join("/"));try{const r=`.${e.extension}`,i=`snow-cms-save-${n}-${e.folder.split(/[\/\\]/).at(-1)}`.substring(0,32),a={fileName:t.name,extensions:[r],id:i},o=new Blob([t.raw],{type:km(r)});if(t.handle)await Hi(o,a,t.handle,!0);else{let l=await Hi(o,a);t.handle=l}const s=await mt.put(t);return console.log(s),t._rev=s.rev,t}catch(r){throw console.error("Save file error",r),r}}async function Nv(e){try{e.forEach(r=>r._deleted=!0);const t=await mt.bulkDocs(e);console.log(t);const n=[];e.forEach(r=>{r.handle&&n.push(r.handle.remove())}),await Promise.all(n)}catch(t){throw console.error("Delete files error",t),t}}async function Tv(){try{return(await mt.find({selector:{asset:{$gt:""}},limit:200})).docs}catch(e){return console.error("Error finding docs",e),null}}async function Ov(){try{const t=await va({mimeTypes:["image/*"],description:"Image Files"}),n="."+t.name.split(".").at(-1),r={fileName:t.name,extensions:[n],id:`snow-cms-upload-${Zt}`},i=await Hi(t,r);if(!qn){console.warn("File not saved to db: No root dir handle found.");return}const a=await qn.resolve(i);a.unshift(qn.name);const o={name:i.name,lastModifiedDate:new Date,type:t.type,webkitRelativePath:a.join("/"),handle:i},s=Bc(qe(Ce),o),l=await mt.put(s);console.log(l)}catch(e){console.error("Upload file error",e)}}async function Vc(e,t){const n=[];t.forEach(a=>{const o={limit:200};e==="public"?o.selector={url:a}:o.selector={url_preview:a};const s=mt.find(o);n.push(s)});const r=await Promise.all(n),i=[];return r.forEach(a=>i.push(...a.docs)),i}async function $v(e){let t=e;try{const n=rr(t);return n.length===0?e:((await Vc("public",n)).forEach(i=>{t=t.replaceAll(i.url,i.url_preview)}),t)}catch(n){throw console.error("Error processing public links",n),n}}async function Dv(e){let t=e;try{const n=rr(t);return n.length===0?e:((await Vc("preview",n)).forEach(i=>{t=t.replaceAll(i.url_preview,i.url)}),t)}catch(n){throw console.error("Error processing preview links",n),n}}const uo={init:xv,getLoginConfig:Ev,getFiles:Iv,saveFile:Lv,deleteFiles:Nv,getMediaFiles:Tv,uploadMediaFile:Ov,replacePublicLinks:$v,replacePreviewLinks:Dv};function oi(){return typeof navigator=="object"&&"userAgent"in navigator?navigator.userAgent:typeof process=="object"&&process.version!==void 0?`Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`:"<environment undetectable>"}function Uc(e,t,n,r){if(typeof n!="function")throw new Error("method for before hook must be a function");return r||(r={}),Array.isArray(t)?t.reverse().reduce((i,a)=>Uc.bind(null,e,a,i,r),n)():Promise.resolve().then(()=>e.registry[t]?e.registry[t].reduce((i,a)=>a.hook.bind(null,i,r),n)():n(r))}function Rv(e,t,n,r){const i=r;e.registry[n]||(e.registry[n]=[]),t==="before"&&(r=(a,o)=>Promise.resolve().then(i.bind(null,o)).then(a.bind(null,o))),t==="after"&&(r=(a,o)=>{let s;return Promise.resolve().then(a.bind(null,o)).then(l=>(s=l,i(s,o))).then(()=>s)}),t==="error"&&(r=(a,o)=>Promise.resolve().then(a.bind(null,o)).catch(s=>i(s,o))),e.registry[n].push({hook:r,orig:i})}function Fv(e,t,n){if(!e.registry[t])return;const r=e.registry[t].map(i=>i.orig).indexOf(n);r!==-1&&e.registry[t].splice(r,1)}const os=Function.bind,ss=os.bind(os);function Hv(e,t,n){const r=ss(Fv,null).apply(null,[t]);e.api={remove:r},e.remove=r,["before","error","after","wrap"].forEach(i=>{const a=[t,i];e[i]=e.api[i]=ss(Rv,null).apply(null,a)})}function Pv(){const e={registry:{}},t=Uc.bind(null,e);return Hv(t,e),t}const Bv={Collection:Pv};var jv="0.0.0-development",qv=`octokit-endpoint.js/${jv} ${oi()}`,Vv={method:"GET",baseUrl:"https://api.github.com",headers:{accept:"application/vnd.github.v3+json","user-agent":qv},mediaType:{format:""}};function Uv(e){return e?Object.keys(e).reduce((t,n)=>(t[n.toLowerCase()]=e[n],t),{}):{}}function Yv(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Function.prototype.call(n)===Function.prototype.call(e)}function Yc(e,t){const n=Object.assign({},e);return Object.keys(t).forEach(r=>{Yv(t[r])?r in e?n[r]=Yc(e[r],t[r]):Object.assign(n,{[r]:t[r]}):Object.assign(n,{[r]:t[r]})}),n}function ls(e){for(const t in e)e[t]===void 0&&delete e[t];return e}function ji(e,t,n){if(typeof t=="string"){let[i,a]=t.split(" ");n=Object.assign(a?{method:i,url:a}:{url:i},n)}else n=Object.assign({},t);n.headers=Uv(n.headers),ls(n),ls(n.headers);const r=Yc(e||{},n);return n.url==="/graphql"&&(e&&e.mediaType.previews?.length&&(r.mediaType.previews=e.mediaType.previews.filter(i=>!r.mediaType.previews.includes(i)).concat(r.mediaType.previews)),r.mediaType.previews=(r.mediaType.previews||[]).map(i=>i.replace(/-preview/,""))),r}function Wv(e,t){const n=/\?/.test(e)?"&":"?",r=Object.keys(t);return r.length===0?e:e+n+r.map(i=>i==="q"?"q="+t.q.split("+").map(encodeURIComponent).join("+"):`${i}=${encodeURIComponent(t[i])}`).join("&")}var Kv=/\{[^{}}]+\}/g;function zv(e){return e.replace(new RegExp("(?:^\\W+)|(?:(?<!\\W)\\W+$)","g"),"").split(/,/)}function Gv(e){const t=e.match(Kv);return t?t.map(zv).reduce((n,r)=>n.concat(r),[]):[]}function cs(e,t){const n={__proto__:null};for(const r of Object.keys(e))t.indexOf(r)===-1&&(n[r]=e[r]);return n}function Wc(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map(function(t){return/%[0-9A-Fa-f]/.test(t)||(t=encodeURI(t).replace(/%5B/g,"[").replace(/%5D/g,"]")),t}).join("")}function yn(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function Fn(e,t,n){return t=e==="+"||e==="#"?Wc(t):yn(t),n?yn(n)+"="+t:t}function dn(e){return e!=null}function _i(e){return e===";"||e==="&"||e==="?"}function Zv(e,t,n,r){var i=e[n],a=[];if(dn(i)&&i!=="")if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")i=i.toString(),r&&r!=="*"&&(i=i.substring(0,parseInt(r,10))),a.push(Fn(t,i,_i(t)?n:""));else if(r==="*")Array.isArray(i)?i.filter(dn).forEach(function(o){a.push(Fn(t,o,_i(t)?n:""))}):Object.keys(i).forEach(function(o){dn(i[o])&&a.push(Fn(t,i[o],o))});else{const o=[];Array.isArray(i)?i.filter(dn).forEach(function(s){o.push(Fn(t,s))}):Object.keys(i).forEach(function(s){dn(i[s])&&(o.push(yn(s)),o.push(Fn(t,i[s].toString())))}),_i(t)?a.push(yn(n)+"="+o.join(",")):o.length!==0&&a.push(o.join(","))}else t===";"?dn(i)&&a.push(yn(n)):i===""&&(t==="&"||t==="?")?a.push(yn(n)+"="):i===""&&a.push("");return a}function Jv(e){return{expand:Qv.bind(null,e)}}function Qv(e,t){var n=["+","#",".","/",";","?","&"];return e=e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(r,i,a){if(i){let s="";const l=[];if(n.indexOf(i.charAt(0))!==-1&&(s=i.charAt(0),i=i.substr(1)),i.split(/,/g).forEach(function(c){var f=/([^:\*]*)(?::(\d+)|(\*))?/.exec(c);l.push(Zv(t,s,f[1],f[2]||f[3]))}),s&&s!=="+"){var o=",";return s==="?"?o="&":s!=="#"&&(o=s),(l.length!==0?s:"")+l.join(o)}else return l.join(",")}else return Wc(a)}),e==="/"?e:e.replace(/\/$/,"")}function Kc(e){let t=e.method.toUpperCase(),n=(e.url||"/").replace(/:([a-z]\w+)/g,"{$1}"),r=Object.assign({},e.headers),i,a=cs(e,["method","baseUrl","url","headers","request","mediaType"]);const o=Gv(n);n=Jv(n).expand(a),/^http/.test(n)||(n=e.baseUrl+n);const s=Object.keys(e).filter(f=>o.includes(f)).concat("baseUrl"),l=cs(a,s);if(!/application\/octet-stream/i.test(r.accept)&&(e.mediaType.format&&(r.accept=r.accept.split(/,/).map(f=>f.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,`application/vnd$1$2.${e.mediaType.format}`)).join(",")),n.endsWith("/graphql")&&e.mediaType.previews?.length)){const f=r.accept.match(new RegExp("(?<![\\w-])[\\w-]+(?=-preview)","g"))||[];r.accept=f.concat(e.mediaType.previews).map(u=>{const p=e.mediaType.format?`.${e.mediaType.format}`:"+json";return`application/vnd.github.${u}-preview${p}`}).join(",")}return["GET","HEAD"].includes(t)?n=Wv(n,l):"data"in l?i=l.data:Object.keys(l).length&&(i=l),!r["content-type"]&&typeof i<"u"&&(r["content-type"]="application/json; charset=utf-8"),["PATCH","PUT"].includes(t)&&typeof i>"u"&&(i=""),Object.assign({method:t,url:n,headers:r},typeof i<"u"?{body:i}:null,e.request?{request:e.request}:null)}function Xv(e,t,n){return Kc(ji(e,t,n))}function zc(e,t){const n=ji(e,t),r=Xv.bind(null,n);return Object.assign(r,{DEFAULTS:n,defaults:zc.bind(null,n),merge:ji.bind(null,n),parse:Kc})}var e0=zc(null,Vv),pn={},us;function t0(){if(us)return pn;us=1;const e=function(){};e.prototype=Object.create(null);const t=/; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu,n=/\\([\v\u0020-\u00ff])/gu,r=/^[!#$%&'*+.^\w|~-]+\/[!#$%&'*+.^\w|~-]+$/u,i={type:"",parameters:new e};Object.freeze(i.parameters),Object.freeze(i);function a(s){if(typeof s!="string")throw new TypeError("argument header is required and must be a string");let l=s.indexOf(";");const c=l!==-1?s.slice(0,l).trim():s.trim();if(r.test(c)===!1)throw new TypeError("invalid media type");const f={type:c.toLowerCase(),parameters:new e};if(l===-1)return f;let u,p,d;for(t.lastIndex=l;p=t.exec(s);){if(p.index!==l)throw new TypeError("invalid parameter format");l+=p[0].length,u=p[1].toLowerCase(),d=p[2],d[0]==='"'&&(d=d.slice(1,d.length-1),n.test(d)&&(d=d.replace(n,"$1"))),f.parameters[u]=d}if(l!==s.length)throw new TypeError("invalid parameter format");return f}function o(s){if(typeof s!="string")return i;let l=s.indexOf(";");const c=l!==-1?s.slice(0,l).trim():s.trim();if(r.test(c)===!1)return i;const f={type:c.toLowerCase(),parameters:new e};if(l===-1)return f;let u,p,d;for(t.lastIndex=l;p=t.exec(s);){if(p.index!==l)return i;l+=p[0].length,u=p[1].toLowerCase(),d=p[2],d[0]==='"'&&(d=d.slice(1,d.length-1),n.test(d)&&(d=d.replace(n,"$1"))),f.parameters[u]=d}return l!==s.length?i:f}return pn.default={parse:a,safeParse:o},pn.parse=a,pn.safeParse=o,pn.defaultContentType=i,pn}var n0=t0();class hr extends Error{name;status;request;response;constructor(t,n,r){super(t),this.name="HttpError",this.status=Number.parseInt(n),Number.isNaN(this.status)&&(this.status=0),"response"in r&&(this.response=r.response);const i=Object.assign({},r.request);r.request.headers.authorization&&(i.headers=Object.assign({},r.request.headers,{authorization:r.request.headers.authorization.replace(new RegExp("(?<! ) .*$")," [REDACTED]")})),i.url=i.url.replace(/\bclient_secret=\w+/g,"client_secret=[REDACTED]").replace(/\baccess_token=\w+/g,"access_token=[REDACTED]"),this.request=i}}var r0="10.0.6",i0={headers:{"user-agent":`octokit-request.js/${r0} ${oi()}`}};function a0(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Function.prototype.call(n)===Function.prototype.call(e)}async function fs(e){const t=e.request?.fetch||globalThis.fetch;if(!t)throw new Error("fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing");const n=e.request?.log||console,r=e.request?.parseSuccessResponseBody!==!1,i=a0(e.body)||Array.isArray(e.body)?JSON.stringify(e.body):e.body,a=Object.fromEntries(Object.entries(e.headers).map(([u,p])=>[u,String(p)]));let o;try{o=await t(e.url,{method:e.method,body:i,redirect:e.request?.redirect,headers:a,signal:e.request?.signal,...e.body&&{duplex:"half"}})}catch(u){let p="Unknown Error";if(u instanceof Error){if(u.name==="AbortError")throw u.status=500,u;p=u.message,u.name==="TypeError"&&"cause"in u&&(u.cause instanceof Error?p=u.cause.message:typeof u.cause=="string"&&(p=u.cause))}const d=new hr(p,500,{request:e});throw d.cause=u,d}const s=o.status,l=o.url,c={};for(const[u,p]of o.headers)c[u]=p;const f={url:l,status:s,headers:c,data:""};if("deprecation"in c){const u=c.link&&c.link.match(/<([^<>]+)>; rel="deprecation"/),p=u&&u.pop();n.warn(`[@octokit/request] "${e.method} ${e.url}" is deprecated. It is scheduled to be removed on ${c.sunset}${p?`. See ${p}`:""}`)}if(s===204||s===205)return f;if(e.method==="HEAD"){if(s<400)return f;throw new hr(o.statusText,s,{response:f,request:e})}if(s===304)throw f.data=await bi(o),new hr("Not modified",s,{response:f,request:e});if(s>=400)throw f.data=await bi(o),new hr(s0(f.data),s,{response:f,request:e});return f.data=r?await bi(o):o.body,f}async function bi(e){const t=e.headers.get("content-type");if(!t)return e.text().catch(()=>"");const n=n0.safeParse(t);if(o0(n)){let r="";try{return r=await e.text(),JSON.parse(r)}catch{return r}}else return n.type.startsWith("text/")||n.parameters.charset?.toLowerCase()==="utf-8"?e.text().catch(()=>""):e.arrayBuffer().catch(()=>new ArrayBuffer(0))}function o0(e){return e.type==="application/json"||e.type==="application/scim+json"}function s0(e){if(typeof e=="string")return e;if(e instanceof ArrayBuffer)return"Unknown error";if("message"in e){const t="documentation_url"in e?` - ${e.documentation_url}`:"";return Array.isArray(e.errors)?`${e.message}: ${e.errors.map(n=>JSON.stringify(n)).join(", ")}${t}`:`${e.message}${t}`}return`Unknown error: ${JSON.stringify(e)}`}function qi(e,t){const n=e.defaults(t);return Object.assign(function(i,a){const o=n.merge(i,a);if(!o.request||!o.request.hook)return fs(n.parse(o));const s=(l,c)=>fs(n.parse(n.merge(l,c)));return Object.assign(s,{endpoint:n,defaults:qi.bind(null,n)}),o.request.hook(s,o)},{endpoint:n,defaults:qi.bind(null,n)})}var Vi=qi(e0,i0),l0="0.0.0-development";function c0(e){return`Request failed due to following response errors:
|
|
44
|
+
`):t.addNode("break")}}}));_(tn.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"});_(tn.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});const Wa=ie("InsertHardbreak",e=>()=>(t,n)=>{const{selection:r,tr:i}=t;if(!(r instanceof Vr))return!1;if(r.empty){const a=r.$from.node();if(a.childCount>0&&a.lastChild?.type.name==="hardbreak")return n?.(i.replaceRangeWith(r.to-1,r.to,t.schema.node("paragraph")).setSelection(Ji.near(i.doc.resolve(r.to))).scrollIntoView()),!0}return n?.(i.setMeta("hardbreak",!0).replaceSelectionWith(tn.type(e).create()).scrollIntoView()),!0});_(Wa,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});const Ka=ct("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:e=>{const t=e.get(ae);return()=>t.call(Wa.key)}}});_(Ka.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"});_(Ka.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});const za=ut("hr");_(za,{displayName:"Attr<hr>",group:"Hr"});const pr=Ze("hr",e=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:t=>["hr",e.get(za.key)(t)],parseMarkdown:{match:({type:t})=>t==="thematicBreak",runner:(t,n,r)=>{t.addNode(r)}},toMarkdown:{match:t=>t.type.name==="hr",runner:t=>{t.addNode("thematicBreak")}}}));_(pr.node,{displayName:"NodeSchema<hr>",group:"Hr"});_(pr.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});const Bc=lt(e=>new Ns(/^(?:---|___\s|\*\*\*\s)$/,(t,n,r,i)=>{const{tr:a}=t;return n[0]&&a.replaceWith(r-1,i,pr.type(e).create()),a}));_(Bc,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});const Ga=ie("InsertHr",e=>()=>(t,n)=>{if(!n)return!0;const r=un.node.type(e).create(),{tr:i,selection:a}=t,{from:o}=a,s=pr.type(e).create();if(!s)return!0;const l=i.replaceSelectionWith(s).insert(o,r),c=Ji.findFrom(l.doc.resolve(o),1,!0);return c&&n(l.setSelection(c).scrollIntoView()),!0});_(Ga,{displayName:"Command<insertHrCommand>",group:"Hr"});const Za=ut("bulletList");_(Za,{displayName:"Attr<bulletList>",group:"BulletList"});const Hn=Ze("bullet_list",e=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:t=>{if(!(t instanceof HTMLElement))throw sn(t);return{spread:t.dataset.spread==="true"}}}],toDOM:t=>["ul",{...e.get(Za.key)(t),"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:t,ordered:n})=>t==="list"&&!n,runner:(t,n,r)=>{const i=n.spread!=null?`${n.spread}`:"false";t.openNode(r,{spread:i}).next(n.children).closeNode()}},toMarkdown:{match:t=>t.type.name==="bullet_list",runner:(t,n)=>{t.openNode("list",void 0,{ordered:!1,spread:n.attrs.spread}).next(n.content).closeNode()}}}));_(Hn.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"});_(Hn.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});const jc=lt(e=>ea(/^\s*([-+*])\s$/,Hn.type(e)));_(jc,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});const si=ie("WrapInBulletList",e=>()=>Xi(Hn.type(e)));_(si,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});const Ja=ct("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:e=>{const t=e.get(ae);return()=>t.call(si.key)}}});_(Ja.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"});_(Ja.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});const Qa=ut("orderedList");_(Qa,{displayName:"Attr<orderedList>",group:"OrderedList"});const Pn=Ze("ordered_list",e=>({content:"listItem+",group:"block",attrs:{order:{default:1,validate:"number"},spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ol",getAttrs:t=>{if(!(t instanceof HTMLElement))throw sn(t);return{spread:t.dataset.spread,order:t.hasAttribute("start")?Number(t.getAttribute("start")):1}}}],toDOM:t=>["ol",{...e.get(Qa.key)(t),...t.attrs.order===1?{}:t.attrs.order,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:t,ordered:n})=>t==="list"&&!!n,runner:(t,n,r)=>{const i=n.spread!=null?`${n.spread}`:"true";t.openNode(r,{spread:i}).next(n.children).closeNode()}},toMarkdown:{match:t=>t.type.name==="ordered_list",runner:(t,n)=>{t.openNode("list",void 0,{ordered:!0,start:1,spread:n.attrs.spread==="true"}),t.next(n.content),t.closeNode()}}}));_(Pn.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"});_(Pn.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});const qc=lt(e=>ea(/^\s*(\d+)\.\s$/,Pn.type(e),t=>({order:Number(t[1])}),(t,n)=>n.childCount+n.attrs.order===Number(t[1])));_(qc,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});const li=ie("WrapInOrderedList",e=>()=>Xi(Pn.type(e)));_(li,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});const Xa=ct("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:e=>{const t=e.get(ae);return()=>t.call(li.key)}}});_(Xa.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"});_(Xa.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});const eo=ut("listItem");_(eo,{displayName:"Attr<listItem>",group:"ListItem"});const Wt=Ze("list_item",e=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"•",validate:"string"},listType:{default:"bullet",validate:"string"},spread:{default:!0,validate:"boolean"}},defining:!0,parseDOM:[{tag:"li",getAttrs:t=>{if(!(t instanceof HTMLElement))throw sn(t);return{label:t.dataset.label,listType:t.dataset.listType,spread:t.dataset.spread==="true"}}}],toDOM:t=>["li",{...e.get(eo.key)(t),"data-label":t.attrs.label,"data-list-type":t.attrs.listType,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:t})=>t==="listItem",runner:(t,n,r)=>{const i=n.label!=null?`${n.label}.`:"•",a=n.label!=null?"ordered":"bullet",o=n.spread!=null?`${n.spread}`:"true";t.openNode(r,{label:i,listType:a,spread:o}),t.next(n.children),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="list_item",runner:(t,n)=>{t.openNode("listItem",void 0,{spread:n.attrs.spread}),t.next(n.content),t.closeNode()}}}));_(Wt.node,{displayName:"NodeSchema<listItem>",group:"ListItem"});_(Wt.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});const to=ie("SinkListItem",e=>()=>iv(Wt.type(e)));_(to,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});const no=ie("LiftListItem",e=>()=>tv(Wt.type(e)));_(no,{displayName:"Command<liftListItemCommand>",group:"ListItem"});const ro=ie("SplitListItem",e=>()=>ev(Wt.type(e)));_(ro,{displayName:"Command<splitListItemCommand>",group:"ListItem"});function pv(e){return(t,n,r)=>{const{selection:i}=t;if(!(i instanceof Vr))return!1;const{empty:a,$from:o}=i;return!a||o.parentOffset!==0||o.node(-1).type!==Wt.type(e)?!1:Eu(t,n,r)}}const io=ie("LiftFirstListItem",e=>()=>pv(e));_(io,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});const ao=ct("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:e=>{const t=e.get(ae);return()=>t.call(ro.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:e=>{const t=e.get(ae);return()=>t.call(to.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:e=>{const t=e.get(ae);return()=>t.call(no.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:e=>{const t=e.get(ae);return()=>t.call(io.key)}}});_(ao.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"});_(ao.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});const Vc=Aa("text",()=>({group:"inline",parseMarkdown:{match:({type:e})=>e==="text",runner:(e,t)=>{e.addText(t.value)}},toMarkdown:{match:e=>e.type.name==="text",runner:(e,t)=>{e.addNode("text",void 0,t.text)}}}));_(Vc,{displayName:"NodeSchema<text>",group:"Text"});const oo=ut("html");_(oo,{displayName:"Attr<html>",group:"Html"});const so=Ze("html",e=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:t=>{const n=document.createElement("span"),r={...e.get(oo.key)(t),"data-value":t.attrs.value,"data-type":"html"};return n.textContent=t.attrs.value,["span",r,t.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:t=>({value:t.dataset.value??""})}],parseMarkdown:{match:({type:t})=>t==="html",runner:(t,n,r)=>{t.addNode(r,{value:n.value})}},toMarkdown:{match:t=>t.type.name==="html",runner:(t,n)=>{t.addNode("html",void 0,n.attrs.value)}}}));_(so.node,{displayName:"NodeSchema<html>",group:"Html"});_(so.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});const hv=[Dc,$a,un,ai,Ra,fn,Br,tn,Pa,fr,ja,dr,za,pr,Ua,Fn,Za,Hn,Qa,Pn,eo,Wt,Ea,Rn,Sa,ur,La,Ot,Ta,kn,oo,so,Vc].flat(),mv=[Fc,jc,qc,Hc,Bc,Rc].flat(),gv=[Ic,Nc,Oc,Tc],vv=ie("IsMarkSelected",()=>e=>t=>{if(!e)return!1;const{doc:n,selection:r}=t;return n.rangeHasMark(r.from,r.to,e)}),yv=ie("IsNoteSelected",()=>e=>t=>e?Su(t,e).hasNode:!1),wv=ie("ClearTextInCurrentBlock",()=>()=>(e,t)=>{let n=e.tr;const{$from:r,$to:i}=n.selection,{pos:a}=r,{pos:o}=i,s=a-r.node().content.size;return s<0?!1:(n=n.deleteRange(s,o),t?.(n),!0)}),bv=ie("SetBlockType",()=>e=>(t,n)=>{const{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;const a=t.tr,{from:o,to:s}=a.selection;try{a.setBlockType(o,s,r,i)}catch{return!1}return n?.(a),!0}),_v=ie("WrapInBlockType",()=>e=>(t,n)=>{const{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;let a=t.tr;try{const{$from:o,$to:s}=a.selection,l=o.blockRange(s),c=l&&Mu(l,r,i);if(!c)return!1;a=a.wrap(l,c)}catch{return!1}return n?.(a),!0}),kv=ie("AddBlockType",()=>e=>(t,n)=>{const{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;const a=t.tr;try{const o=r instanceof Lu?r:r.createAndFill(i);if(!o)return!1;a.replaceSelectionWith(o)}catch{return!1}return n?.(a),!0}),xv=ie("SelectTextNearPos",()=>e=>(t,n)=>{const{pos:r}=e??{};if(r==null)return!1;const i=(o,s,l)=>Math.min(Math.max(o,s),l),a=t.tr;try{const o=t.doc.resolve(i(r,0,t.doc.content.size));a.setSelection(Vr.near(o))}catch{return!1}return n?.(a.scrollIntoView()),!0}),Av=[ii,oi,bt,Fa,qa,Wa,Ga,Ya,Pc,li,si,to,ro,no,io,ti,Ia,ni,Oa,$c,vv,yv,wv,bv,_v,kv,xv],Ev=[Ba,Va,Ka,Ha,ao,Xa,Ja,Da,Ca,Na,Ma].flat(),lo=Dn("remarkAddOrderInList",()=>()=>e=>{rr(e,"list",t=>{if(t.ordered){const n=t.start??1;t.children.forEach((r,i)=>{r.label=i+n})}})});_(lo.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"});_(lo.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});const co=Dn("remarkLineBreak",()=>()=>e=>{const t=/[\t ]*(?:\r?\n|\r)/g;rr(e,"text",(n,r,i)=>{if(!n.value||typeof n.value!="string")return;const a=[];let o=0;t.lastIndex=0;let s=t.exec(n.value);for(;s;){const c=s.index;o!==c&&a.push({type:"text",value:n.value.slice(o,c)}),a.push({type:"break",data:{isInline:!0}}),o=c+s[0].length,s=t.exec(n.value)}if(a.length>0&&i&&typeof r=="number")return o<n.value.length&&a.push({type:"text",value:n.value.slice(o)}),i.children.splice(r,1,...a),r+a.length})});_(co.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"});_(co.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});const uo=Dn("remarkInlineLink",()=>ov);_(uo.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"});_(uo.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});const Cv=e=>!!e.children,Sv=e=>e.type==="html";function Mv(e,t){return n(e,0,null)[0];function n(r,i,a){if(Cv(r)){const o=[];for(let s=0,l=r.children.length;s<l;s++){const c=r.children[s];if(c){const f=n(c,s,r);if(f)for(let u=0,p=f.length;u<p;u++){const d=f[u];d&&o.push(d)}}}r.children=o}return t(r,i,a)}}const Lv=["root","blockquote","listItem"],fo=Dn("remarkHTMLTransformer",()=>()=>e=>{Mv(e,(t,n,r)=>Sv(t)?(r&&Lv.includes(r.type)&&(t.children=[{...t}],delete t.value,t.type="paragraph"),[t]):[t])});_(fo.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"});_(fo.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});const po=Dn("remarkMarker",()=>()=>(e,t)=>{const n=r=>t.value.charAt(r.position.start.offset);rr(e,r=>["strong","emphasis"].includes(r.type),r=>{r.marker=n(r)})});_(po.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"});_(po.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});const Uc=lr(()=>{let e=!1;const t=new Nn("MILKDOWN_INLINE_NODES_CURSOR"),n=new In({key:t,state:{init(){return!1},apply(r){if(!r.selection.empty)return!1;const i=r.selection.$from,a=i.nodeBefore,o=i.nodeAfter;return!!(a&&o&&a.isInline&&!a.isText&&o.isInline&&!o.isText)}},props:{handleDOMEvents:{compositionend:(r,i)=>e?(e=!1,requestAnimationFrame(()=>{if(n.getState(r.state)){const o=r.state.selection.from;i.preventDefault(),r.dispatch(r.state.tr.insertText(i.data||"",o))}}),!0):!1,compositionstart:r=>(n.getState(r.state)&&(e=!0),!1),beforeinput:(r,i)=>{if(n.getState(r.state)&&i instanceof InputEvent&&i.data&&!e){const o=r.state.selection.from;return i.preventDefault(),r.dispatch(r.state.tr.insertText(i.data||"",o)),!0}return!1}},decorations(r){if(n.getState(r)){const o=r.selection.$from.pos,s=document.createElement("span"),l=xo.widget(o,s,{side:-1}),c=document.createElement("span"),f=xo.widget(o,c);return setTimeout(()=>{s.contentEditable="true",c.contentEditable="true"}),Ao.create(r.doc,[l,f])}return Ao.empty}}});return n});_(Uc,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});const Yc=lr(e=>new In({key:new Nn("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(t,n,r)=>{if(!t.length)return;const[i]=t;if(!i)return;const[a]=i.steps;if(i.getMeta("hardbreak")){if(!(a instanceof Iu))return;const{from:l}=a;return r.tr.setNodeMarkup(l,tn.type(e),void 0,[])}if(a instanceof Nu){let l=r.tr;const{from:c,to:f}=a;return r.doc.nodesBetween(c,f,(u,p)=>{u.type===tn.type(e)&&(l=l.setNodeMarkup(p,tn.type(e),void 0,[]))}),l}}}));_(Yc,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});const ho=Yt(["table","code_block"],"hardbreakFilterNodes");_(ho,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});const Wc=lr(e=>{const t=e.get(ho.key);return new In({key:new Nn("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(n,r)=>{const i=n.getMeta("hardbreak"),[a]=n.steps;if(i&&a){const{from:o}=a,s=r.doc.resolve(o);let l=s.depth,c=!0;for(;l>0;)t.includes(s.node(l).type.name)&&(c=!1),l--;return c}return!0}})});_(Wc,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});const Kc=lr(e=>{const t=new Nn("MILKDOWN_HEADING_ID"),n=r=>{if(r.composing)return;const i=e.get(ai.key),a=r.state.tr.setMeta("addToHistory",!1);let o=!1;const s={};r.state.doc.descendants((l,c)=>{if(l.type===fn.type(e)){if(l.textContent.trim().length===0)return;const f=l.attrs;let u=i(l);s[u]?(s[u]+=1,u+=`-#${s[u]}`):s[u]=1,f.id!==u&&(o=!0,a.setMeta(t,!0).setNodeMarkup(c,void 0,{...f,id:u}))}}),o&&r.dispatch(a)};return new In({key:t,view:r=>(n(r),{update:(i,a)=>{i.state.doc.eq(a.doc)||n(i)}})})});_(Kc,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});const zc=lr(e=>{const t=(n,r,i)=>{if(!i.selection||n.some(u=>u.getMeta("addToHistory")===!1||!u.isGeneric))return null;const a=Pn.type(e),o=Hn.type(e),s=Wt.type(e),l=(u,p)=>{let d=!1;const h=`${p+1}.`;return u.label!==h&&(u.label=h,d=!0),d};let c=i.tr,f=!1;return i.doc.descendants((u,p,d,h)=>{if(u.type===o){const g=u.maybeChild(0);g?.type===s&&g.attrs.listType==="ordered"&&(f=!0,c.setNodeMarkup(p,a,{spread:"true"}),u.descendants((m,v,w,b)=>{if(m.type===s){const L={...m.attrs};l(L,b)&&(c=c.setNodeMarkup(v,void 0,L))}return!1}))}else if(u.type===s&&d?.type===a){const g={...u.attrs};let m=!1;g.listType!=="ordered"&&(g.listType="ordered",m=!0),d?.maybeChild(0)&&(m=l(g,h)),m&&(c=c.setNodeMarkup(p,void 0,g),f=!0)}}),f?c.setMeta("addToHistory",!1):null};return new In({key:new Nn("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:t})});_(zc,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});const Iv=[Yc,ho,Wc,Uc,lo,uo,co,fo,po,ri,Kc,zc].flat(),Nv=[hv,mv,gv,Av,Ev,Iv].flat();var Tv=z('<label class="editorInput"> <div id="md-editor" class="svelte-g1hz34"><!> <div></div> <!></div> <input type="hidden" class="svelte-g1hz34"/></label> <!> <!>',1);function Ov(e,t){le(t,!0);const n=()=>P(Ae,"$draftEntry",s),r=()=>P(it,"$selectedCollection",s),i=()=>P(at,"$editingEntry",s),a=()=>P(st,"$backend",s),o=()=>P(Me,"$loadedWidgets",s),[s,l]=me();let c=Pe(t,"value",7,""),f=Pe(t,"required",3,!0),u=K(void 0),p=K(void 0),d=K(!1),h=K(void 0),g=K(void 0),m=K(void 0),v=K(void 0);ht(()=>{c()!==y(p)&&w(c())});function w(C){const R={...n()};C?y(m)&&(R[t.name]=Xg()(y(m).ctx).replaceAll("<img ",'<img crossorigin="use-credentials" ')):R[t.name]=r()?.fields.find(Z=>Z.name===t.name).label,re(Ae,R),V(p,c(),!0)}function b(){if(!y(h))return;const C=document.getSelection();C.removeAllRanges();const R=document.createRange(),{startOffset:Z,endOffset:se}=y(h).range;R.setStart(y(h).node,Z),R.setEnd(y(h).node,se),C.addRange(R)}function L(C){V(d,!1),b(),C&&y(m).action(R=>{const Z=R.get(ae),se={alt:C.name,src:C.url_preview};Z.call(Ya.key,se)})}function D(C){if(b(),!C)return;const{href:R}=C,Z=document.getSelection(),{textContent:se}=Z.focusNode,{startOffset:ge,endOffset:yt}=Z.getRangeAt(0),Ve=se.substring(ge,yt);y(m).action(pe=>{const Le=pe.get(ae),Je={title:Ve,href:R};Le.call(Oa.key,Je)})}function O(C){y(m).action(R=>{const Z=R.get(ae);C==="p"?Z.call(ii.key):Z.call(bt.key,C)})}function I(C){y(m).action(R=>{const Z=R.get(ae);switch(C){case"bold":Z.call(ni.key);break;case"italic":Z.call(ti.key);break;case"listBulleted":Z.call(si.key);break;case"listNumbered":Z.call(li.key);break;case"quote":Z.call(oi.key);break;case"horizontalRule":Z.call(Ga.key);break;case"link":y(g).toggleEditor();break;case"image":y(h)&&V(d,!0);break}})}function B(){const C=document.getSelection(),R=C.focusNode;y(v)?.contains(R)&&V(h,{node:C.focusNode,range:C.getRangeAt(0)},!0)}function G(C){V(m,C,!0),V(v,document.querySelector(".milkdown .ProseMirror"),!0),ls(c())(y(m).ctx),w(c())}async function q(C){Ou.make().config(R=>{R.set($u,C),R.set(Du,c()),R.get(Ui).markdownUpdated((Z,se,ge)=>{c(se)})}).config(Ru).use(Nv).use(Mc).create().then(G)}async function N(){if(i()){try{const C=t.name==="body"?i().body:i().fields[t.name];V(u,a().replacePublicLinks(C),!0),c(await y(u)),y(m)&&ls(c())(y(m).ctx)}catch{}re(Me,o()+1)}}qe(()=>{N()});var U=Tv();cn("selectionchange",zr,B);var j=Re(U),E=M(j),x=F(E),k=M(x);yg(k,{ontexttypeselect:O,onactionselect:I});var S=F(k,2);ad(S,C=>q?.(C));var A=F(S,2);Sn(bg(A,{onsaveurl:D}),C=>V(g,C,!0),()=>y(g));var T=F(x,2),$=F(j,2);nt($,()=>y(u),C=>{Xr(C,{msg:"Loading"})},void 0,(C,R)=>{Ct(C,{msg:"Unable to load",get details(){return y(R).message}})});var Y=F($,2);{var Q=C=>{xg(C,{onselectimg:L})};Ge(Y,C=>{y(d)&&C(Q)})}te(()=>{J(j,"for",t.name),fe(E,`${t.label??""} `),J(T,"id",t.name),J(T,"name",t.name),T.required=f()}),Ht(T,c),W(e,U),ce(),l()}var $v=z('<input type="hidden"/>');function Dv(e,t){le(t,!0);const n=()=>P(Ae,"$draftEntry",a),r=()=>P(at,"$editingEntry",a),i=()=>P(Me,"$loadedWidgets",a),[a,o]=me();let s=Pe(t,"value",7);function l(){const u={...n()};u[t.name]=s(),re(Ae,u)}async function c(){if(r()?.fields[t.name])switch(t.type){case"datetime-local":case"date":case"time":s(Hr(t.type,new Date(r().fields[t.name])));break;default:s(r().fields[t.name]);break}else if(!s())switch(t.type){case"datetime-local":case"date":case"time":s(Hr(t.type,new Date));break;case"boolean":s("false");break}l(),re(Me,i()+1)}qe(()=>{c()});var f=$v();te(()=>{J(f,"id",t.name),J(f,"name",t.name)}),Ht(f,s),W(e,f),ce(),o()}var Rv=z('<iframe title="Preview" sandbox="allow-same-origin" class="svelte-8q9z6e"></iframe>');function Fv(e,t){le(t,!0);const n=()=>P(it,"$selectedCollection",s),r=()=>P(Ee,"$config",s),i=()=>P(Me,"$loadedWidgets",s),a=()=>P(ya,"$loadingWidgets",s),o=()=>P(Ae,"$draftEntry",s),[s,l]=me();Te.extend(xc);let c=dt(()=>n()?.preview||r()?.previews.default),f=dt(()=>Fm(r(),y(c))),u=K(void 0),p=dt(()=>Pm(y(u),y(f))),d=K(void 0),h=K(void 0),g=!1;ht(()=>{!g&&i()===a()&&(V(h,Mi(o()),!0),g=!0)}),ht(()=>{JSON.stringify(o())!==JSON.stringify(y(h))&&v()});function m(){v()}function v(){if(y(d)?.contentDocument){for(const b in o()){const L=n()?.fields.find(I=>I.name===b);let D=o()[b];if(L.name==="date")switch(L?.type){case"time":D=Te(o()[b],"hh:mm").format(L.time_format);break;case"date":D=Te(o()[b],"YYYY-MM-DD").format(L.date_format);break;default:D=Te(o()[b],"YYYY-MM-DDThh:mm").format(L.datetime_format)}y(d).contentDocument.querySelectorAll(`[data-tag="${b}"]`).forEach(I=>{I.innerHTML!==D&&(I.innerHTML=D)})}V(h,o(),!0)}}qe(async()=>{V(u,await Hm(r(),y(c)),!0)});var w=Rv();Sn(w,b=>V(d,b),()=>y(d)),te(()=>J(w,"srcdoc",y(p))),cn("load",w,m),W(e,w),ce(),l()}var Hv=z('<!> <div class="page svelte-1cczf35"><section id="inputArea" class="svelte-1cczf35"><header class="svelte-1cczf35">Edit</header> <form id="entry-data" class="svelte-1cczf35"><!></form> <form id="md-link-editor" class="svelte-1cczf35"></form> <form id="ignore" class="svelte-1cczf35"></form></section> <section id="previewArea" class="svelte-1cczf35"><header class="svelte-1cczf35">Preview</header> <!></section></div> <!> <!> <!>',1);function Pv(e,t){le(t,!0);const n=()=>P(at,"$editingEntry",s),r=()=>P(it,"$selectedCollection",s),i=()=>P(st,"$backend",s),a=()=>P(p,"$submitted",s),o=()=>P(wa,"$cmsActions",s),[s,l]=me();let c=K(void 0),f=K(void 0);const u=et({entryForm:null});Ir("formState",u);const p=gt(null);Ir("submitted",p);const d={string:is,text:is,datetime:tg,boolean:Zm,number:og,markdown:Ov,hidden:Dv};async function h(N){N.preventDefault();const U=n()?{...n()}:{fields:{}},j=new FormData(N.target);for(const[x,k]of j.entries()){const S=r().fields.find(A=>A.name===x);try{V(c,Ac(S,k,i()),!0),U.fields[x]=await y(c)}catch(A){console.error("Error parsing form entry.",A);return}}const E=jm(r(),U);re(p,i().saveFile(r(),E));try{re(at,await a()),o()?.onSave&&(V(f,o().onSave(n()),!0),await y(f))}catch(x){console.warn("Issue saving post.",x)}}qe(()=>{re(Me,0),re(ya,r().fields.length)});var g=Hv(),m=Re(g);zm(m,{});var v=F(m,2),w=M(v),b=F(M(w),2),L=M(b);{var D=N=>{var U=Kt(),j=Re(U);jt(j,1,()=>r().fields,E=>E.name,(E,x)=>{const k=dt(()=>d[y(x).widget]),S=dt(()=>y(x)?.default);var A=Kt(),T=Re(A);{var $=C=>{var R=Kt(),Z=Re(R);kr(Z,()=>y(k),(se,ge)=>{ge(se,xr(()=>y(x),{get checked(){return y(S)}}))}),W(C,R)},Y=C=>{var R=Kt(),Z=Re(R);kr(Z,()=>y(k),(se,ge)=>{ge(se,xr(()=>y(x),{get value(){return y(S)},multiline:!0}))}),W(C,R)},Q=C=>{var R=Kt(),Z=Re(R);kr(Z,()=>y(k),(se,ge)=>{ge(se,xr(()=>y(x),{get value(){return y(S)}}))}),W(C,R)};Ge(T,C=>{y(x).widget==="boolean"?C($):y(x).widget==="text"?C(Y,1):C(Q,!1)})}W(E,A)}),W(N,U)};Ge(L,N=>{r()&&N(D)})}Sn(b,N=>u.entryForm=N,()=>u?.entryForm);var O=F(w,2),I=F(M(O),2);Fv(I,{});var B=F(v,2);nt(B,()=>y(c),null,void 0,(N,U)=>{Ct(N,{msg:"Unable to save",get details(){return y(U).message}})});var G=F(B,2);nt(G,a,N=>{Xr(N,{msg:"Saving"})},void 0,(N,U)=>{Ct(N,{msg:"Unable to save",get details(){return y(U).message}})});var q=F(G,2);nt(q,()=>y(f),null,void 0,(N,U)=>{Ct(N,{msg:"'On save' event action failed",get details(){return y(U).message}})}),cn("submit",b,h),W(e,g),ce(),l()}const Bv=(function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"})(),jv=function(e,t){return new URL(e,t).href},us={},_i=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let c=function(f){return Promise.all(f.map(u=>Promise.resolve(u).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};const o=document.getElementsByTagName("link"),s=document.querySelector("meta[property=csp-nonce]"),l=s?.nonce||s?.getAttribute("nonce");i=c(n.map(f=>{if(f=jv(f,r),f in us)return;us[f]=!0;const u=f.endsWith(".css"),p=u?'[rel="stylesheet"]':"";if(r)for(let h=o.length-1;h>=0;h--){const g=o[h];if(g.href===f&&(!u||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${p}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":Bv,u||(d.as="script"),d.crossOrigin="",d.href=f,l&&d.setAttribute("nonce",l),document.head.appendChild(d),u)return new Promise((h,g)=>{d.addEventListener("load",h),d.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${f}`)))})}))}function a(o){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o}return i.then(o=>{for(const s of o||[])s.status==="rejected"&&a(s.reason);return t().catch(a)})};async function qv(e,t){let n;try{n=await t.text()}catch(s){console.error("Error constructing doc",s);return}const[r,i]=xa(n),a=Qr.load(r);return{_id:t.webkitRelativePath,name:t.name,collection:e,date:a.date,raw:n,fields:a,body:i,handle:t.handle,directoryHandle:t.directoryHandle}}function Gc(e,t){const n=t.lastModifiedDate,r=`${e.public_folder}/${t.name}`;return{_id:t.webkitRelativePath,name:t.name,date:n,asset:t.type,url:r,url_preview:r,handle:t.handle,directoryHandle:t.directoryHandle}}let Sr,Zc,Jc,nn,vt,zn;async function Vv(){if(nn=Be(Ee).repo_folder,!nn){console.error("Missing 'repo_folder' config");return}return await Uv(),Sr.plugin(Zc),Sr.plugin(Jc),vt=new Sr(`${nn}-local`,{adapter:"idb"}),[["name","collection"],["date","collection"],["asset"],["url"],["url_preview"]].map(t=>({index:{fields:t},ddoc:t.join("-")})).forEach(t=>Wv(t)),console.log("Using local CMS backend"),mo}async function Uv(){Sr=(await _i(async()=>{const{default:e}=await import("./index.es.js");return{default:e}},[],import.meta.url)).default,Zc=(await _i(async()=>{const{default:e}=await import("./index.es2.js");return{default:e}},[],import.meta.url)).default,Jc=(await _i(async()=>{const{default:e}=await import("./index-browser.es.js");return{default:e}},[],import.meta.url)).default}async function Yv(){return{title:"Local Backend Enabled",message:"Select the local project directory to continue.",button:"Select Project Directory",action:zv}}async function Wv(e){try{const t=await vt.createIndex(e);console.log("Create index",e,t)}catch(t){console.error("Create index error",t)}}async function Kv(e){try{const t=await vt.get(e._id);e._rev=t._rev}catch(t){console.warn("Existing doc error",t)}}async function zv(){if(!nn)return;const e=[],t=Be(Ee);t.collections.forEach(c=>{const p=`\\/?${c.folder.split("/").join("\\/")}\\/[^_][\\w-]+\\.\\w+`;e.push({name:c.name,regex:new RegExp(p,"i")})});const a=`\\/?${t.media_folder.split("/").join("\\/")}\\/[^_][\\w-]+\\.\\w+`,o=new RegExp(a,"i"),s=["node_modules"],l={recursive:!0,id:`snow-cms-${nn}`,skipDirectory:c=>c.name.startsWith(".")||s.includes(c.name)};try{const c=await wm(l),f=[],u=[];c.forEach(g=>{if(!zn&&g.directoryHandle?.name===nn&&(zn=g.directoryHandle),o.test(g.webkitRelativePath)){f.push(Gc(t,g));return}const v=e.find(({name:w,regex:b})=>b.test(g.webkitRelativePath));v&&u.push(qv(v.name,g))});const p=await Promise.all(u);p.push(...f);const d=[];p.forEach(g=>d.push(Kv(g))),await Promise.all(d);const h=await vt.bulkDocs(p);st.set(mo)}catch(c){console.error("Open directory error",c)}}async function Gv(e){try{return(await vt.find({selector:{collection:e,date:{$gte:null}},sort:[{date:"desc"}],limit:200})).docs}catch(t){throw console.error("Error finding docs",t),t}}async function Zv(e,t){const n=Be(Ee).repo_folder;t._id||(t._id=[n,e.folder,t.name].join("/"));try{const r=`.${e.extension}`,i=`snow-cms-save-${n}-${e.folder.split(/[\/\\]/).at(-1)}`.substring(0,32),a={fileName:t.name,extensions:[r],id:i},o=new Blob([t.raw],{type:qm(r)});if(t.handle)await qi(o,a,t.handle,!0);else{let l=await qi(o,a);t.handle=l}const s=await vt.put(t);return console.log(s),t._rev=s.rev,t}catch(r){throw console.error("Save file error",r),r}}async function Jv(e){try{e.forEach(r=>r._deleted=!0);const t=await vt.bulkDocs(e);console.log(t);const n=[];e.forEach(r=>{r.handle&&n.push(r.handle.remove())}),await Promise.all(n)}catch(t){throw console.error("Delete files error",t),t}}async function Qv(){try{return(await vt.find({selector:{asset:{$gt:""}},limit:200})).docs}catch(e){return console.error("Error finding docs",e),null}}async function Xv(){try{const t=await _a({mimeTypes:["image/*"],description:"Image Files"}),n="."+t.name.split(".").at(-1),r={fileName:t.name,extensions:[n],id:`snow-cms-upload-${nn}`},i=await qi(t,r);if(!zn){console.warn("File not saved to db: No root dir handle found.");return}const a=await zn.resolve(i);a.unshift(zn.name);const o={name:i.name,lastModifiedDate:new Date,type:t.type,webkitRelativePath:a.join("/"),handle:i},s=Gc(Be(Ee),o),l=await vt.put(s);console.log(l)}catch(e){console.error("Upload file error",e)}}async function Qc(e,t){const n=[];t.forEach(a=>{const o={limit:200};e==="public"?o.selector={url:a}:o.selector={url_preview:a};const s=vt.find(o);n.push(s)});const r=await Promise.all(n),i=[];return r.forEach(a=>i.push(...a.docs)),i}async function e0(e){let t=e;try{const n=sr(t);return n.length===0?e:((await Qc("public",n)).forEach(i=>{t=t.replaceAll(i.url,i.url_preview)}),t)}catch(n){throw console.error("Error processing public links",n),n}}async function t0(e){let t=e;try{const n=sr(t);return n.length===0?e:((await Qc("preview",n)).forEach(i=>{t=t.replaceAll(i.url_preview,i.url)}),t)}catch(n){throw console.error("Error processing preview links",n),n}}const mo={init:Vv,getLoginConfig:Yv,getFiles:Gv,saveFile:Zv,deleteFiles:Jv,getMediaFiles:Qv,uploadMediaFile:Xv,replacePublicLinks:e0,replacePreviewLinks:t0};function ci(){return typeof navigator=="object"&&"userAgent"in navigator?navigator.userAgent:typeof process=="object"&&process.version!==void 0?`Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`:"<environment undetectable>"}function Xc(e,t,n,r){if(typeof n!="function")throw new Error("method for before hook must be a function");return r||(r={}),Array.isArray(t)?t.reverse().reduce((i,a)=>Xc.bind(null,e,a,i,r),n)():Promise.resolve().then(()=>e.registry[t]?e.registry[t].reduce((i,a)=>a.hook.bind(null,i,r),n)():n(r))}function n0(e,t,n,r){const i=r;e.registry[n]||(e.registry[n]=[]),t==="before"&&(r=(a,o)=>Promise.resolve().then(i.bind(null,o)).then(a.bind(null,o))),t==="after"&&(r=(a,o)=>{let s;return Promise.resolve().then(a.bind(null,o)).then(l=>(s=l,i(s,o))).then(()=>s)}),t==="error"&&(r=(a,o)=>Promise.resolve().then(a.bind(null,o)).catch(s=>i(s,o))),e.registry[n].push({hook:r,orig:i})}function r0(e,t,n){if(!e.registry[t])return;const r=e.registry[t].map(i=>i.orig).indexOf(n);r!==-1&&e.registry[t].splice(r,1)}const fs=Function.bind,ds=fs.bind(fs);function i0(e,t,n){const r=ds(r0,null).apply(null,[t]);e.api={remove:r},e.remove=r,["before","error","after","wrap"].forEach(i=>{const a=[t,i];e[i]=e.api[i]=ds(n0,null).apply(null,a)})}function a0(){const e={registry:{}},t=Xc.bind(null,e);return i0(t,e),t}const o0={Collection:a0};var s0="0.0.0-development",l0=`octokit-endpoint.js/${s0} ${ci()}`,c0={method:"GET",baseUrl:"https://api.github.com",headers:{accept:"application/vnd.github.v3+json","user-agent":l0},mediaType:{format:""}};function u0(e){return e?Object.keys(e).reduce((t,n)=>(t[n.toLowerCase()]=e[n],t),{}):{}}function f0(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Function.prototype.call(n)===Function.prototype.call(e)}function eu(e,t){const n=Object.assign({},e);return Object.keys(t).forEach(r=>{f0(t[r])?r in e?n[r]=eu(e[r],t[r]):Object.assign(n,{[r]:t[r]}):Object.assign(n,{[r]:t[r]})}),n}function ps(e){for(const t in e)e[t]===void 0&&delete e[t];return e}function Yi(e,t,n){if(typeof t=="string"){let[i,a]=t.split(" ");n=Object.assign(a?{method:i,url:a}:{url:i},n)}else n=Object.assign({},t);n.headers=u0(n.headers),ps(n),ps(n.headers);const r=eu(e||{},n);return n.url==="/graphql"&&(e&&e.mediaType.previews?.length&&(r.mediaType.previews=e.mediaType.previews.filter(i=>!r.mediaType.previews.includes(i)).concat(r.mediaType.previews)),r.mediaType.previews=(r.mediaType.previews||[]).map(i=>i.replace(/-preview/,""))),r}function d0(e,t){const n=/\?/.test(e)?"&":"?",r=Object.keys(t);return r.length===0?e:e+n+r.map(i=>i==="q"?"q="+t.q.split("+").map(encodeURIComponent).join("+"):`${i}=${encodeURIComponent(t[i])}`).join("&")}var p0=/\{[^{}}]+\}/g;function h0(e){return e.replace(new RegExp("(?:^\\W+)|(?:(?<!\\W)\\W+$)","g"),"").split(/,/)}function m0(e){const t=e.match(p0);return t?t.map(h0).reduce((n,r)=>n.concat(r),[]):[]}function hs(e,t){const n={__proto__:null};for(const r of Object.keys(e))t.indexOf(r)===-1&&(n[r]=e[r]);return n}function tu(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map(function(t){return/%[0-9A-Fa-f]/.test(t)||(t=encodeURI(t).replace(/%5B/g,"[").replace(/%5D/g,"]")),t}).join("")}function wn(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function Vn(e,t,n){return t=e==="+"||e==="#"?tu(t):wn(t),n?wn(n)+"="+t:t}function hn(e){return e!=null}function ki(e){return e===";"||e==="&"||e==="?"}function g0(e,t,n,r){var i=e[n],a=[];if(hn(i)&&i!=="")if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")i=i.toString(),r&&r!=="*"&&(i=i.substring(0,parseInt(r,10))),a.push(Vn(t,i,ki(t)?n:""));else if(r==="*")Array.isArray(i)?i.filter(hn).forEach(function(o){a.push(Vn(t,o,ki(t)?n:""))}):Object.keys(i).forEach(function(o){hn(i[o])&&a.push(Vn(t,i[o],o))});else{const o=[];Array.isArray(i)?i.filter(hn).forEach(function(s){o.push(Vn(t,s))}):Object.keys(i).forEach(function(s){hn(i[s])&&(o.push(wn(s)),o.push(Vn(t,i[s].toString())))}),ki(t)?a.push(wn(n)+"="+o.join(",")):o.length!==0&&a.push(o.join(","))}else t===";"?hn(i)&&a.push(wn(n)):i===""&&(t==="&"||t==="?")?a.push(wn(n)+"="):i===""&&a.push("");return a}function v0(e){return{expand:y0.bind(null,e)}}function y0(e,t){var n=["+","#",".","/",";","?","&"];return e=e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(r,i,a){if(i){let s="";const l=[];if(n.indexOf(i.charAt(0))!==-1&&(s=i.charAt(0),i=i.substr(1)),i.split(/,/g).forEach(function(c){var f=/([^:\*]*)(?::(\d+)|(\*))?/.exec(c);l.push(g0(t,s,f[1],f[2]||f[3]))}),s&&s!=="+"){var o=",";return s==="?"?o="&":s!=="#"&&(o=s),(l.length!==0?s:"")+l.join(o)}else return l.join(",")}else return tu(a)}),e==="/"?e:e.replace(/\/$/,"")}function nu(e){let t=e.method.toUpperCase(),n=(e.url||"/").replace(/:([a-z]\w+)/g,"{$1}"),r=Object.assign({},e.headers),i,a=hs(e,["method","baseUrl","url","headers","request","mediaType"]);const o=m0(n);n=v0(n).expand(a),/^http/.test(n)||(n=e.baseUrl+n);const s=Object.keys(e).filter(f=>o.includes(f)).concat("baseUrl"),l=hs(a,s);if(!/application\/octet-stream/i.test(r.accept)&&(e.mediaType.format&&(r.accept=r.accept.split(/,/).map(f=>f.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,`application/vnd$1$2.${e.mediaType.format}`)).join(",")),n.endsWith("/graphql")&&e.mediaType.previews?.length)){const f=r.accept.match(new RegExp("(?<![\\w-])[\\w-]+(?=-preview)","g"))||[];r.accept=f.concat(e.mediaType.previews).map(u=>{const p=e.mediaType.format?`.${e.mediaType.format}`:"+json";return`application/vnd.github.${u}-preview${p}`}).join(",")}return["GET","HEAD"].includes(t)?n=d0(n,l):"data"in l?i=l.data:Object.keys(l).length&&(i=l),!r["content-type"]&&typeof i<"u"&&(r["content-type"]="application/json; charset=utf-8"),["PATCH","PUT"].includes(t)&&typeof i>"u"&&(i=""),Object.assign({method:t,url:n,headers:r},typeof i<"u"?{body:i}:null,e.request?{request:e.request}:null)}function w0(e,t,n){return nu(Yi(e,t,n))}function ru(e,t){const n=Yi(e,t),r=w0.bind(null,n);return Object.assign(r,{DEFAULTS:n,defaults:ru.bind(null,n),merge:Yi.bind(null,n),parse:nu})}var b0=ru(null,c0),mn={},ms;function _0(){if(ms)return mn;ms=1;const e=function(){};e.prototype=Object.create(null);const t=/; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu,n=/\\([\v\u0020-\u00ff])/gu,r=/^[!#$%&'*+.^\w|~-]+\/[!#$%&'*+.^\w|~-]+$/u,i={type:"",parameters:new e};Object.freeze(i.parameters),Object.freeze(i);function a(s){if(typeof s!="string")throw new TypeError("argument header is required and must be a string");let l=s.indexOf(";");const c=l!==-1?s.slice(0,l).trim():s.trim();if(r.test(c)===!1)throw new TypeError("invalid media type");const f={type:c.toLowerCase(),parameters:new e};if(l===-1)return f;let u,p,d;for(t.lastIndex=l;p=t.exec(s);){if(p.index!==l)throw new TypeError("invalid parameter format");l+=p[0].length,u=p[1].toLowerCase(),d=p[2],d[0]==='"'&&(d=d.slice(1,d.length-1),n.test(d)&&(d=d.replace(n,"$1"))),f.parameters[u]=d}if(l!==s.length)throw new TypeError("invalid parameter format");return f}function o(s){if(typeof s!="string")return i;let l=s.indexOf(";");const c=l!==-1?s.slice(0,l).trim():s.trim();if(r.test(c)===!1)return i;const f={type:c.toLowerCase(),parameters:new e};if(l===-1)return f;let u,p,d;for(t.lastIndex=l;p=t.exec(s);){if(p.index!==l)return i;l+=p[0].length,u=p[1].toLowerCase(),d=p[2],d[0]==='"'&&(d=d.slice(1,d.length-1),n.test(d)&&(d=d.replace(n,"$1"))),f.parameters[u]=d}return l!==s.length?i:f}return mn.default={parse:a,safeParse:o},mn.parse=a,mn.safeParse=o,mn.defaultContentType=i,mn}var k0=_0();class wr extends Error{name;status;request;response;constructor(t,n,r){super(t,{cause:r.cause}),this.name="HttpError",this.status=Number.parseInt(n),Number.isNaN(this.status)&&(this.status=0);"response"in r&&(this.response=r.response);const i=Object.assign({},r.request);r.request.headers.authorization&&(i.headers=Object.assign({},r.request.headers,{authorization:r.request.headers.authorization.replace(new RegExp("(?<! ) .*$")," [REDACTED]")})),i.url=i.url.replace(/\bclient_secret=\w+/g,"client_secret=[REDACTED]").replace(/\baccess_token=\w+/g,"access_token=[REDACTED]"),this.request=i}}var x0="10.0.7",A0={headers:{"user-agent":`octokit-request.js/${x0} ${ci()}`}};function E0(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Function.prototype.call(n)===Function.prototype.call(e)}var gs=()=>"";async function vs(e){const t=e.request?.fetch||globalThis.fetch;if(!t)throw new Error("fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing");const n=e.request?.log||console,r=e.request?.parseSuccessResponseBody!==!1,i=E0(e.body)||Array.isArray(e.body)?JSON.stringify(e.body):e.body,a=Object.fromEntries(Object.entries(e.headers).map(([u,p])=>[u,String(p)]));let o;try{o=await t(e.url,{method:e.method,body:i,redirect:e.request?.redirect,headers:a,signal:e.request?.signal,...e.body&&{duplex:"half"}})}catch(u){let p="Unknown Error";if(u instanceof Error){if(u.name==="AbortError")throw u.status=500,u;p=u.message,u.name==="TypeError"&&"cause"in u&&(u.cause instanceof Error?p=u.cause.message:typeof u.cause=="string"&&(p=u.cause))}const d=new wr(p,500,{request:e});throw d.cause=u,d}const s=o.status,l=o.url,c={};for(const[u,p]of o.headers)c[u]=p;const f={url:l,status:s,headers:c,data:""};if("deprecation"in c){const u=c.link&&c.link.match(/<([^<>]+)>; rel="deprecation"/),p=u&&u.pop();n.warn(`[@octokit/request] "${e.method} ${e.url}" is deprecated. It is scheduled to be removed on ${c.sunset}${p?`. See ${p}`:""}`)}if(s===204||s===205)return f;if(e.method==="HEAD"){if(s<400)return f;throw new wr(o.statusText,s,{response:f,request:e})}if(s===304)throw f.data=await xi(o),new wr("Not modified",s,{response:f,request:e});if(s>=400)throw f.data=await xi(o),new wr(S0(f.data),s,{response:f,request:e});return f.data=r?await xi(o):o.body,f}async function xi(e){const t=e.headers.get("content-type");if(!t)return e.text().catch(gs);const n=k0.safeParse(t);if(C0(n)){let r="";try{return r=await e.text(),JSON.parse(r)}catch{return r}}else return n.type.startsWith("text/")||n.parameters.charset?.toLowerCase()==="utf-8"?e.text().catch(gs):e.arrayBuffer().catch(()=>new ArrayBuffer(0))}function C0(e){return e.type==="application/json"||e.type==="application/scim+json"}function S0(e){if(typeof e=="string")return e;if(e instanceof ArrayBuffer)return"Unknown error";if("message"in e){const t="documentation_url"in e?` - ${e.documentation_url}`:"";return Array.isArray(e.errors)?`${e.message}: ${e.errors.map(n=>JSON.stringify(n)).join(", ")}${t}`:`${e.message}${t}`}return`Unknown error: ${JSON.stringify(e)}`}function Wi(e,t){const n=e.defaults(t);return Object.assign(function(i,a){const o=n.merge(i,a);if(!o.request||!o.request.hook)return vs(n.parse(o));const s=(l,c)=>vs(n.parse(n.merge(l,c)));return Object.assign(s,{endpoint:n,defaults:Wi.bind(null,n)}),o.request.hook(s,o)},{endpoint:n,defaults:Wi.bind(null,n)})}var Ki=Wi(b0,A0);var M0="0.0.0-development";function L0(e){return`Request failed due to following response errors:
|
|
45
45
|
`+e.errors.map(t=>` - ${t.message}`).join(`
|
|
46
|
-
`)}var
|
|
46
|
+
`)}var I0=class extends Error{constructor(e,t,n){super(L0(n)),this.request=e,this.headers=t,this.response=n,this.errors=n.errors,this.data=n.data,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}name="GraphqlResponseError";errors;data},N0=["method","baseUrl","url","headers","request","query","mediaType","operationName"],T0=["query","method","url"],ys=/\/api\/v3\/?$/;function O0(e,t,n){if(n){if(typeof t=="string"&&"query"in n)return Promise.reject(new Error('[@octokit/graphql] "query" cannot be used as variable name'));for(const o in n)if(T0.includes(o))return Promise.reject(new Error(`[@octokit/graphql] "${o}" cannot be used as variable name`))}const r=typeof t=="string"?Object.assign({query:t},n):t,i=Object.keys(r).reduce((o,s)=>N0.includes(s)?(o[s]=r[s],o):(o.variables||(o.variables={}),o.variables[s]=r[s],o),{}),a=r.baseUrl||e.endpoint.DEFAULTS.baseUrl;return ys.test(a)&&(i.url=a.replace(ys,"/api/graphql")),e(i).then(o=>{if(o.data.errors){const s={};for(const l of Object.keys(o.headers))s[l]=o.headers[l];throw new I0(i,s,o.data)}return o.data.data})}function go(e,t){const n=e.defaults(t);return Object.assign((i,a)=>O0(n,i,a),{defaults:go.bind(null,n),endpoint:n.endpoint})}go(Ki,{headers:{"user-agent":`octokit-graphql.js/${M0} ${ci()}`},method:"POST",url:"/graphql"});function $0(e){return go(e,{method:"POST",url:"/graphql"})}var Ai="(?:[a-zA-Z0-9_-]+)",ws="\\.",bs=new RegExp(`^${Ai}${ws}${Ai}${ws}${Ai}$`),D0=bs.test.bind(bs);async function R0(e){const t=D0(e),n=e.startsWith("v1.")||e.startsWith("ghs_"),r=e.startsWith("ghu_");return{type:"token",token:e,tokenType:t?"app":n?"installation":r?"user-to-server":"oauth"}}function F0(e){return e.split(/\./).length===3?`bearer ${e}`:`token ${e}`}async function H0(e,t,n,r){const i=t.endpoint.merge(n,r);return i.headers.authorization=F0(e),t(i)}var P0=function(t){if(!t)throw new Error("[@octokit/auth-token] No token passed to createTokenAuth");if(typeof t!="string")throw new Error("[@octokit/auth-token] Token passed to createTokenAuth is not a string");return t=t.replace(/^(token|bearer) +/i,""),Object.assign(R0.bind(null,t),{hook:H0.bind(null,t)})};const iu="7.0.6",_s=()=>{},B0=console.warn.bind(console),j0=console.error.bind(console);function q0(e={}){return typeof e.debug!="function"&&(e.debug=_s),typeof e.info!="function"&&(e.info=_s),typeof e.warn!="function"&&(e.warn=B0),typeof e.error!="function"&&(e.error=j0),e}const ks=`octokit-core.js/${iu} ${ci()}`;class V0{static VERSION=iu;static defaults(t){return class extends this{constructor(...r){const i=r[0]||{};if(typeof t=="function"){super(t(i));return}super(Object.assign({},t,i,i.userAgent&&t.userAgent?{userAgent:`${i.userAgent} ${t.userAgent}`}:null))}}}static plugins=[];static plugin(...t){const n=this.plugins;return class extends this{static plugins=n.concat(t.filter(i=>!n.includes(i)))}}constructor(t={}){const n=new o0.Collection,r={baseUrl:Ki.endpoint.DEFAULTS.baseUrl,headers:{},request:Object.assign({},t.request,{hook:n.bind(null,"request")}),mediaType:{previews:[],format:""}};if(r.headers["user-agent"]=t.userAgent?`${t.userAgent} ${ks}`:ks,t.baseUrl&&(r.baseUrl=t.baseUrl),t.previews&&(r.mediaType.previews=t.previews),t.timeZone&&(r.headers["time-zone"]=t.timeZone),this.request=Ki.defaults(r),this.graphql=$0(this.request).defaults(r),this.log=q0(t.log),this.hook=n,t.authStrategy){const{authStrategy:a,...o}=t,s=a(Object.assign({request:this.request,log:this.log,octokit:this,octokitOptions:o},t.auth));n.wrap("request",s.hook),this.auth=s}else if(!t.auth)this.auth=async()=>({type:"unauthenticated"});else{const a=P0(t.auth);n.wrap("request",a.hook),this.auth=a}const i=this.constructor;for(let a=0;a<i.plugins.length;++a)Object.assign(this,i.plugins[a](this,t))}request;graphql;log;hook;auth}function au(e,t,n,r){return e.graphql(`
|
|
47
47
|
query GetRepoPath($repoOwner: String!, $repoName: String!, $path: String!) {
|
|
48
48
|
repository(owner: $repoOwner, name: $repoName) {
|
|
49
49
|
object(expression: $path) {
|
|
@@ -64,7 +64,7 @@ ${n.body}`,n}function wa(e){if(!/^---(\r?\n)/.test(e.trim()))return["date: 0001-
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
`,{repoOwner:t,repoName:n,path:r})}function
|
|
67
|
+
`,{repoOwner:t,repoName:n,path:r})}function U0(e,t,n,r){return e.request("GET /repos/{owner}/{repo}/git/blobs/{file_sha}",{owner:t,repo:n,file_sha:r,headers:{"X-GitHub-Api-Version":"2022-11-28"}})}function Y0(e,t,n,r){return e.graphql(`
|
|
68
68
|
query GetRefOid($owner: String!, $name: String!, $refName: String!) {
|
|
69
69
|
repository(owner: $owner, name: $name) {
|
|
70
70
|
id
|
|
@@ -75,7 +75,7 @@ ${n.body}`,n}function wa(e){if(!/^---(\r?\n)/.test(e.trim()))return["date: 0001-
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
`,{name:n,owner:t,refName:r})}function
|
|
78
|
+
`,{name:n,owner:t,refName:r})}function W0(e,t,n,r,i,a){return e.graphql(`
|
|
79
79
|
mutation CreateCommit($branchName: String!, $repoNameWithOwner: String!, $expectedHeadOid: GitObjectID!, $headline: String!, $changes: FileChanges!) {
|
|
80
80
|
createCommitOnBranch(input: {
|
|
81
81
|
branch: {repositoryNameWithOwner: $repoNameWithOwner, branchName: $branchName},
|
|
@@ -86,4 +86,4 @@ ${n.body}`,n}function wa(e){if(!/^---(\r?\n)/.test(e.trim()))return["date: 0001-
|
|
|
86
86
|
clientMutationId
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
`,{repoNameWithOwner:t,branchName:n,headline:r,expectedHeadOid:i,changes:a})}async function
|
|
89
|
+
`,{repoNameWithOwner:t,branchName:n,headline:r,expectedHeadOid:i,changes:a})}async function K0(e,t,n){return(await fetch(`data:${e};${t},${n}`)).blob()}function z0(e,t=!1){return new Promise((n,r)=>{const i=new FileReader;i.onerror=a=>r(a),i.onload=()=>{const{result:a}=i,o=t?a.replace(/^data:.+\/.+;base64,/,""):a;n(o)},i.readAsDataURL(e)})}function G0(e){const t=e.replace("^.","");let n;switch(t){case"apng":case"avif":case"bmp":case"gif":case"jpeg":case"png":case"tiff":case"webp":n=`image/${t}`;break;case"ico":n="image/vnd.microsoft.icon";break;case"jpg":n="image/jpeg";break;case"svg":n="image/svg+xml";break;case"tif":n="image/tiff";break;default:n="application/octet-stream"}return n}function Z0(e,t,n){const{id:r,text:i}=n.object,[a,o]=xa(i),s=Qr.load(a);return{_id:r,name:n.name,collection:e,path:t,date:s.date,raw:i,fields:s,body:o}}async function J0(e,t,n,r,i){const[a,o]=t.backend.repo.split("/"),{id:s,oid:l}=i.object,c=await U0(e,a,o,l),f=`${r}/${i.name}`;let u=f;if(c.status===200)try{const{content:d,encoding:h}=c.data,g=G0(i.extension),m=await K0(g,h,d);u=URL.createObjectURL(m)}catch(d){console.error("Error creating preview url.",d)}return{_id:s,name:i.name,path:n,url:f,url_preview:u}}let Ln=[];const ou=`${window.location.origin}${window.location.pathname}`,Q0="SNOW_CMS:",zi={state:`${Q0}:GH_AUTH:STATE`};let on;async function X0(){const e=Be(Ee).backend;if(!e.repo)throw new Error("Missing backend 'repo' config.");if(!e.app_name)throw new Error("Missing backend 'app_name' config.");const t=new URLSearchParams(window.location.search),n=t.get("setup_action"),r=t.get("code"),i=t.get("state"),a=localStorage.getItem(zi.state);if(n){su();return}if(r&&a)if(i===a){console.log("Valid auth state"),history.replaceState({},"",ou);const o=e.api_root??window.location.origin,s=e.auth_endpoint??"/api/github/oauth/token",l=`${o}${s}`,f={method:"post",headers:{"content-type":"application/json"},body:JSON.stringify({code:r})},u=await fetch(l,f),p=await u.json();if(!u.ok)throw new Error(p.error??"Token error");const{authentication:d}=p;on=new V0({auth:d.token});const{data:{total_count:h,installations:g}}=await on.request("GET /user/installations",{headers:{"X-GitHub-Api-Version":"2022-11-28"}}),m=e.app_name.replaceAll(" ","-").toLowerCase();if(h<=0){await xs(l,d.token),As(m);return}if(!g.find(w=>w.app_slug===m)){await xs(l,d.token),As(m);return}st.set(Gi)}else throw localStorage.removeItem(zi.state),new Error("Invalid auth state");return console.log("Using GitHub CMS backend"),Gi}async function xs(e,t){const n={method:"delete",headers:{Authorization:`token ${t}`}};if(!(await fetch(e,n)).ok)throw new Error("Delete token error")}function As(e){const t=new URL(`https://github.com/apps/${e}/installations/new`);window.location.assign(t.href)}async function ey(){return{title:"GitHub Log in",button:"Log in with GitHub",action:su}}async function su(e){const t=new URL("https://github.com/login/oauth/authorize"),n=Math.random().toString(36).substring(2),r=t.searchParams;r.set("client_id",Be(Ee).backend.client_id),r.set("redirect_uri",ou),r.set("state",n),localStorage.setItem(zi.state,n),window.location.assign(t.href)}async function ty(e){try{const t=Be(Ee),n=t.collections.find(f=>f.name===e),{repo:r,branch:i}=t.backend,[a,o]=r.split("/"),s=`${i}:${n.folder}`,{repository:l}=await au(on,a,o,s);if(!l)throw new Error("Error getting repo path");const c=[];return l.object?.entries.forEach(f=>{/^[\._]/.test(f.name)||c.push(Z0(e,n.folder,f))}),c.sort((f,u)=>u.date.getTime()-f.date.getTime()),c}catch(t){throw console.error("Error fetching files",t),t}}async function ny(e,t){try{const n=`Update ${t.name}`,r={additions:[{path:`${e.folder}/${t.name}`,contents:btoa(t.raw)}]};return await vo(n,r),t}catch(n){throw console.error("Error saving file.",n),n}}async function ry(e){try{const t=`Delete ${e.length} file(s)`,n={deletions:e.map(r=>({path:`${r.path}/${r.name}`}))};await vo(t,n),e.forEach(r=>{r.url_preview&&URL.revokeObjectURL(r.url_preview)}),Ln=[...Ln.filter(r=>e.every(i=>r.id!==i.id))]}catch(t){throw console.error("Error deleting files.",t),t}}async function iy(){try{const e=Be(Ee),{media_folder:t,public_folder:n}=e,{repo:r,branch:i}=e.backend,[a,o]=r.split("/"),s=`${i}:${e.media_folder}`,{repository:l}=await au(on,a,o,s);if(!l)throw new Error("Error getting repo path");const c=[];l.object?.entries.forEach(u=>{if(/^[\._]/.test(u.name))return;const p=J0(on,e,t,n,u);c.push(p)});const f=await Promise.all(c);return Ln.forEach(u=>{u.url_preview&&URL.revokeObjectURL(u.url_preview)}),Ln=f,f}catch(e){throw console.error("Error getting media files",e),e}}async function ay(){try{const e=Be(Ee).media_folder,n=await _a({mimeTypes:["image/*"],description:"Image Files"}),r=await z0(n,!0),i=`Update ${n.name}`,a={additions:[{path:`${e}/${n.name}`,contents:r}]};await vo(i,a)}catch(e){console.error("Upload file error",e)}}async function oy(e){let t=e;try{const n=sr(t);return n.length===0?e:(Ln.filter(i=>i.url&&n.includes(i.url)).forEach(i=>{t=t.replaceAll(i.url,i.url_preview)}),t)}catch(n){throw console.error("Error processing public links",n),n}}async function sy(e){let t=e;try{const n=sr(t);return n.length===0?e:(Ln.filter(i=>i.url_preview&&n.includes(i.url_preview)).forEach(i=>{t=t.replaceAll(i.url_preview,i.url)}),t)}catch(n){throw console.error("Error processing preview links",n),n}}async function vo(e,t){const n=Be(Ee),{repo:r,branch:i}=n.backend,[a,o]=r.split("/"),s=i,{repository:l}=await Y0(on,a,o,s);if(!l)throw new Error("Error getting oid");const{oid:c}=l.ref.target;if(!(await W0(on,r,i,e,c,t))?.createCommitOnBranch)throw new Error("Error creating commit")}const Gi={init:X0,getLoginConfig:ey,getFiles:ty,saveFile:ny,deleteFiles:ry,getMediaFiles:iy,uploadMediaFile:ay,replacePublicLinks:oy,replacePreviewLinks:sy};var ly=z('<input autocomplete="on" required=""/>'),cy=z('<button form="login"> </button>'),uy=z('<div aria-busy="true"></div>'),fy=z('<dialog open=""><article><header><h3> </h3></header> <p> </p> <form id="login"><!></form> <footer><!></footer></article></dialog> <!> <!>',1);function dy(e,t){le(t,!0);const n=()=>P(Ee,"$config",r),[r,i]=me();let a=dt(()=>n()?.local_backend?"local":n()?.backend?.name),o=K(void 0),s=K(void 0),l=K(void 0),c=K(null),f=K(2);ht(()=>{y(a)&&!y(o)&&p()});async function u(U){U.preventDefault();try{const j=new FormData(U.target);V(c,y(l).action(j),!0)}catch(j){console.error("Error logging in.",j)}}async function p(){try{if(y(f)<=0)return;if(!y(a))throw new Error("Missing backend name");switch(y(a)){case"local":V(o,mo.init(),!0);break;case"github":V(o,Gi.init(),!0);break;case"custom":V(o,Vm(Ee,st),!0);break;default:throw new Error(`Unsupported backend: ${y(a)}`)}V(s,await y(o),!0),y(s).getLoginConfig&&V(l,await y(s).getLoginConfig(),!0)}catch(U){console.error("Error initializing backend.",U),Of(f,-1),console.log("Re-trying init. Attempts left ",y(f)),p()}}var d=fy(),h=Re(d),g=M(h),m=M(g),v=M(m),w=M(v),b=F(m,2),L=M(b),D=F(b,2),O=M(D);{var I=U=>{const j=dt(()=>Object.entries(y(l).fields));var E=Kt(),x=Re(E);jt(x,17,()=>y(j),k=>k[0],(k,S)=>{const A=dt(()=>{const[$,Y]=y(S);return{name:$,type:Y}});var T=ly();te(()=>{J(T,"type",y(A).type),J(T,"name",y(A).name),J(T,"placeholder",y(A).name)}),W(k,T)}),W(U,E)};Ge(O,U=>{y(l)?.fields&&U(I)})}var B=F(D,2),G=M(B);nt(G,()=>y(c),U=>{var j=uy();W(U,j)},(U,j)=>{var E=cy(),x=M(E);te(()=>fe(x,y(l)?.button??"Log in")),W(U,E)});var q=F(h,2);nt(q,()=>y(o),null,void 0,(U,j)=>{Ct(U,{msg:"Error initializing backend.",get details(){return y(j).message}})});var N=F(q,2);nt(N,()=>y(c),null,void 0,(U,j)=>{Ct(U,{msg:"Error logging in.",get details(){return y(j).message}})}),te(()=>{fe(w,y(l)?.title??"Log in"),fe(L,y(l)?.message??"Log in to continue.")}),cn("submit",D,u),W(e,d),ce(),i()}var py=z("<!> <!>",1);function hy(e,t){le(t,!0);const n=()=>P(st,"$backend",r),[r,i]=me(),a={"":mm,editor:Pv};let o=K(void 0);function s(){const p=window.location.hash.replace(/#\/?/,""),d=a[p];d?V(o,d,!0):(console.warn(`Page not found: ${p}`),window.location.hash="")}qe(()=>{s()});var l=py();cn("hashchange",Ni,s);var c=Re(l);kr(c,()=>y(o),(p,d)=>{d(p,{})});var f=F(c,2);{var u=p=>{dy(p,{})};Ge(f,p=>{n()||p(u)})}W(e,l),ce(),i()}function my(){const e=document.getElementById("app");e.childElementCount>0||Jf(hy,{target:e})}my();
|