@htmlbricks/hb-stylus-notebook 0.60.3 → 0.60.5

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/main.iife.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(xt){"use strict";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add("5");const Pr=2,Ir="[",Mr="]",Ne={},N=Symbol(),Lr="http://www.w3.org/1999/xhtml",Ot=!1;var kt=Array.isArray,jr=Array.prototype.indexOf,Dr=Array.from,Le=Object.keys,_e=Object.defineProperty,he=Object.getOwnPropertyDescriptor,Fr=Object.getOwnPropertyDescriptors,qr=Object.prototype,Ur=Array.prototype,Rt=Object.getPrototypeOf,At=Object.isExtensible;function Ct(e){for(var t=0;t<e.length;t++)e[t]()}function Yr(){var e,t,r=new Promise((n,i)=>{e=n,t=i});return{promise:r,resolve:e,reject:t}}const P=2,et=4,tt=8,Te=16,K=32,z=64,Pt=128,D=256,je=512,k=1024,Y=2048,Z=4096,ve=8192,ne=16384,rt=32768,Br=65536,It=1<<17,Hr=1<<18,pe=1<<19,Gr=1<<20,nt=1<<21,it=1<<22,ie=1<<23,st=Symbol("$state"),Jr=Symbol("legacy props"),Vr=Symbol(""),lt=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Wr=3,Mt=8;function Xr(){throw new Error("https://svelte.dev/e/await_outside_boundary")}function Kr(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function zr(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Zr(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Qr(e){throw new Error("https://svelte.dev/e/effect_orphan")}function en(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function tn(){throw new Error("https://svelte.dev/e/hydration_failed")}function rn(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function nn(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function sn(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function at(e){console.warn("https://svelte.dev/e/hydration_mismatch")}let T=!1;function ge(e){T=e}let x;function we(e){if(e===null)throw at(),Ne;return x=e}function Lt(){return we(ye(x))}function jt(e){if(T){if(ye(x)!==null)throw at(),Ne;x=e}}function Dt(e){return e===this.v}function ln(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function an(e){return!ln(e,this.v)}let on=!1,B=null;function De(e){B=e}function Ft(e,t=!1,r){B={p:B,c:null,e:null,s:e,x:null,l:null}}function qt(e){var t=B,r=t.e;if(r!==null){t.e=null;for(var n of r)ir(n)}return e!==void 0&&(t.x=e),B=t.p,e??{}}function Ut(){return!0}const un=new WeakMap;function fn(e){var t=w;if(t===null)return m.f|=ie,e;if((t.f&rt)===0){if((t.f&Pt)===0)throw!t.parent&&e instanceof Error&&Yt(e),e;t.b.error(e)}else ot(e,t)}function ot(e,t){for(;t!==null;){if((t.f&Pt)!==0)try{t.b.error(e);return}catch(r){e=r}t=t.parent}throw e instanceof Error&&Yt(e),e}function Yt(e){const t=un.get(e);t&&(_e(e,"message",{value:t.message}),_e(e,"stack",{value:t.stack}))}let xe=[],ut=[];function Bt(){var e=xe;xe=[],Ct(e)}function cn(){var e=ut;ut=[],Ct(e)}function dn(e){xe.length===0&&queueMicrotask(Bt),xe.push(e)}function _n(){xe.length>0&&Bt(),ut.length>0&&cn()}function hn(){const e=w.b;return e===null&&Xr(),e}function Ht(e){var t=P|Y,r=m!==null&&(m.f&P)!==0?m:null;return w===null||r!==null&&(r.f&D)!==0?t|=D:w.f|=pe,{ctx:B,deps:null,effects:null,equals:Dt,f:t,fn:e,reactions:null,rv:0,v:N,wv:0,parent:r??w,ac:null}}function vn(e,t){let r=w;r===null&&Kr();var n=r.b,i=void 0,s=ht(N),a=null,o=!m;return An(()=>{try{var l=e();a&&Promise.resolve(l).catch(()=>{})}catch(h){l=Promise.reject(h)}var u=()=>l;i=a?.then(u,u)??Promise.resolve(l),a=i;var f=O,d=n.is_pending();o&&(n.update_pending_count(1),d||f.increment());const _=(h,v=void 0)=>{a=null,d||f.activate(),v?v!==lt&&(s.f|=ie,vt(s,v)):((s.f&ie)!==0&&(s.f^=ie),vt(s,h)),o&&(n.update_pending_count(-1),d||f.decrement()),Vt()};if(i.then(_,h=>_(null,h||"unknown")),f)return()=>{queueMicrotask(()=>f.neuter())}}),new Promise(l=>{function u(f){function d(){f===i?l(s):u(i)}f.then(d,d)}u(i)})}function Gt(e){var t=e.effects;if(t!==null){e.effects=null;for(var r=0;r<t.length;r+=1)ee(t[r])}}function pn(e){for(var t=e.parent;t!==null;){if((t.f&P)===0)return t;t=t.parent}return null}function ft(e){var t,r=w;G(pn(e));try{Gt(e),t=vr(e)}finally{G(r)}return t}function Jt(e){var t=ft(e);if(e.equals(t)||(e.v=t,e.wv=_r()),!ue){var r=(te||(e.f&D)!==0)&&e.deps!==null?Z:k;M(e,r)}}function gn(e,t,r){const n=Ht;if(t.length===0){r(e.map(n));return}var i=O,s=w,a=wn(),o=hn();Promise.all(t.map(l=>vn(l))).then(l=>{i?.activate(),a();try{r([...e.map(n),...l])}catch(u){(s.f&ne)===0&&ot(u,s)}i?.deactivate(),Vt()}).catch(l=>{o.error(l)})}function wn(){var e=w,t=m,r=B,n=O;return function(){G(e),F(t),De(r),n?.activate()}}function Vt(){G(null),F(null),De(null)}const ct=new Set;let O=null,Wt=new Set,Fe=[];function Xt(){const e=Fe.shift();Fe.length>0&&queueMicrotask(Xt),e()}let se=[],qe=null,dt=!1,Ue=!1;class le{current=new Map;#t=new Map;#e=new Set;#r=0;#u=null;#f=!1;#i=[];#l=[];#s=[];#n=[];#a=[];#c=[];#d=[];skipped_effects=new Set;process(t){se=[];for(const i of t)this.#h(i);if(this.#i.length===0&&this.#r===0){this.#_();var r=this.#s,n=this.#n;this.#s=[],this.#n=[],this.#a=[],O=null,zt(r),zt(n),O===null?O=this:ct.delete(this),this.#u?.resolve()}else this.#o(this.#s),this.#o(this.#n),this.#o(this.#a);for(const i of this.#i)be(i);for(const i of this.#l)be(i);this.#i=[],this.#l=[]}#h(t){t.f^=k;for(var r=t.first;r!==null;){var n=r.f,i=(n&(K|z))!==0,s=i&&(n&k)!==0,a=s||(n&ve)!==0||this.skipped_effects.has(r);if(!a&&r.fn!==null){if(i)r.f^=k;else if((n&et)!==0)this.#n.push(r);else if((n&k)===0)if((n&it)!==0){var o=r.b?.is_pending()?this.#l:this.#i;o.push(r)}else Ye(r)&&((r.f&Te)!==0&&this.#a.push(r),be(r));var l=r.first;if(l!==null){r=l;continue}}var u=r.parent;for(r=r.next;r===null&&u!==null;)r=u.next,u=u.parent}}#o(t){for(const r of t)((r.f&Y)!==0?this.#c:this.#d).push(r),M(r,k);t.length=0}capture(t,r){this.#t.has(t)||this.#t.set(t,r),this.current.set(t,t.v)}activate(){O=this}deactivate(){O=null;for(const t of Wt)if(Wt.delete(t),t(),O!==null)break}neuter(){this.#f=!0}flush(){se.length>0?Kt():this.#_(),O===this&&(this.#r===0&&ct.delete(this),this.deactivate())}#_(){if(!this.#f)for(const t of this.#e)t();this.#e.clear()}increment(){this.#r+=1}decrement(){if(this.#r-=1,this.#r===0){for(const t of this.#c)M(t,Y),Oe(t);for(const t of this.#d)M(t,Z),Oe(t);this.#s=[],this.#n=[],this.flush()}else this.deactivate()}add_callback(t){this.#e.add(t)}settled(){return(this.#u??=Yr()).promise}static ensure(){if(O===null){const t=O=new le;ct.add(O),Ue||le.enqueue(()=>{O===t&&t.flush()})}return O}static enqueue(t){Fe.length===0&&queueMicrotask(Xt),Fe.unshift(t)}}function _t(e){var t=Ue;Ue=!0;try{for(var r;;){if(_n(),se.length===0&&(O?.flush(),se.length===0))return qe=null,r;Kt()}}finally{Ue=t}}function Kt(){var e=$e;dt=!0;try{var t=0;for(ur(!0);se.length>0;){var r=le.ensure();if(t++>1e3){var n,i;mn()}r.process(se),Q.clear()}}finally{dt=!1,ur(e),qe=null}}function mn(){try{en()}catch(e){ot(e,qe)}}let ae=null;function zt(e){var t=e.length;if(t!==0){for(var r=0;r<t;){var n=e[r++];if((n.f&(ne|ve))===0&&Ye(n)&&(ae=[],be(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null&&n.ac===null?ar(n):n.fn=null),ae?.length>0)){Q.clear();for(const i of ae)be(i);ae=[]}}ae=null}}function Oe(e){for(var t=qe=e;t.parent!==null;){t=t.parent;var r=t.f;if(dt&&t===w&&(r&Te)!==0)return;if((r&(z|K))!==0){if((r&k)===0)return;t.f^=k}}se.push(t)}const Q=new Map;function ht(e,t){var r={f:0,v:e,reactions:null,equals:Dt,rv:0,wv:0};return r}function E(e,t){const r=ht(e);return Dn(r),r}function yn(e,t=!1,r=!0){const n=ht(e);return t||(n.equals=an),n}function b(e,t,r=!1){m!==null&&(!fe||(m.f&It)!==0)&&Ut()&&(m.f&(P|Te|it|It))!==0&&!W?.includes(e)&&sn();let n=r?me(t):t;return vt(e,n)}function vt(e,t){if(!e.equals(t)){var r=e.v;ue?Q.set(e,t):Q.set(e,r),e.v=t;var n=le.ensure();n.capture(e,r),(e.f&P)!==0&&((e.f&Y)!==0&&ft(e),M(e,(e.f&D)===0?k:Z)),e.wv=_r(),Zt(e,Y),w!==null&&(w.f&k)!==0&&(w.f&(K|z))===0&&(q===null?Fn([e]):q.push(e))}return t}function $n(e,t=1){var r=c(e),n=t===1?r++:r--;return b(e,r),n}function pt(e){b(e,e.v+1)}function Zt(e,t){var r=e.reactions;if(r!==null)for(var n=r.length,i=0;i<n;i++){var s=r[i],a=s.f,o=(a&Y)===0;o&&M(s,t),(a&P)!==0?Zt(s,Z):o&&((a&Te)!==0&&ae!==null&&ae.push(s),Oe(s))}}function me(e){if(typeof e!="object"||e===null||st in e)return e;const t=Rt(e);if(t!==qr&&t!==Ur)return e;var r=new Map,n=kt(e),i=E(0),s=ce,a=o=>{if(ce===s)return o();var l=m,u=ce;F(null),dr(s);var f=o();return F(l),dr(u),f};return n&&r.set("length",E(e.length)),new Proxy(e,{defineProperty(o,l,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&rn();var f=r.get(l);return f===void 0?f=a(()=>{var d=E(u.value);return r.set(l,d),d}):b(f,u.value,!0),!0},deleteProperty(o,l){var u=r.get(l);if(u===void 0){if(l in o){const f=a(()=>E(N));r.set(l,f),pt(i)}}else b(u,N),pt(i);return!0},get(o,l,u){if(l===st)return e;var f=r.get(l),d=l in o;if(f===void 0&&(!d||he(o,l)?.writable)&&(f=a(()=>{var h=me(d?o[l]:N),v=E(h);return v}),r.set(l,f)),f!==void 0){var _=c(f);return _===N?void 0:_}return Reflect.get(o,l,u)},getOwnPropertyDescriptor(o,l){var u=Reflect.getOwnPropertyDescriptor(o,l);if(u&&"value"in u){var f=r.get(l);f&&(u.value=c(f))}else if(u===void 0){var d=r.get(l),_=d?.v;if(d!==void 0&&_!==N)return{enumerable:!0,configurable:!0,value:_,writable:!0}}return u},has(o,l){if(l===st)return!0;var u=r.get(l),f=u!==void 0&&u.v!==N||Reflect.has(o,l);if(u!==void 0||w!==null&&(!f||he(o,l)?.writable)){u===void 0&&(u=a(()=>{var _=f?me(o[l]):N,h=E(_);return h}),r.set(l,u));var d=c(u);if(d===N)return!1}return f},set(o,l,u,f){var d=r.get(l),_=l in o;if(n&&l==="length")for(var h=u;h<d.v;h+=1){var v=r.get(h+"");v!==void 0?b(v,N):h in o&&(v=a(()=>E(N)),r.set(h+"",v))}if(d===void 0)(!_||he(o,l)?.writable)&&(d=a(()=>E(void 0)),b(d,me(u)),r.set(l,d));else{_=d.v!==N;var g=a(()=>me(u));b(d,g)}var L=Reflect.getOwnPropertyDescriptor(o,l);if(L?.set&&L.set.call(f,u),!_){if(n&&typeof l=="string"){var C=r.get("length"),S=Number(l);Number.isInteger(S)&&S>=C.v&&b(C,S+1)}pt(i)}return!0},ownKeys(o){c(i);var l=Reflect.ownKeys(o).filter(d=>{var _=r.get(d);return _===void 0||_.v!==N});for(var[u,f]of r)f.v!==N&&!(u in o)&&l.push(u);return l},setPrototypeOf(){nn()}})}var Qt,er,tr,rr;function gt(){if(Qt===void 0){Qt=window,er=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,r=Text.prototype;tr=he(t,"firstChild").get,rr=he(t,"nextSibling").get,At(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),At(r)&&(r.__t=void 0)}}function wt(e=""){return document.createTextNode(e)}function ke(e){return tr.call(e)}function ye(e){return rr.call(e)}function nr(e,t){if(!T)return ke(e);var r=ke(x);return r===null&&(r=x.appendChild(wt())),we(r),r}function bn(e,t){if(!T){var r=ke(e);return r instanceof Comment&&r.data===""?ye(r):r}return x}function J(e,t=1,r=!1){let n=T?x:e;for(var i;t--;)i=n,n=ye(n);if(!T)return n;if(r&&n?.nodeType!==Wr){var s=wt();return n===null?i?.after(s):n.before(s),we(s),s}return we(n),n}function En(e){e.textContent=""}function mt(e){var t=m,r=w;F(null),G(null);try{return e()}finally{F(t),G(r)}}function Sn(e){w===null&&m===null&&Qr(),m!==null&&(m.f&D)!==0&&w===null&&Zr(),ue&&zr()}function Nn(e,t){var r=t.last;r===null?t.last=t.first=e:(r.next=e,e.prev=r,t.last=e)}function V(e,t,r,n=!0){var i=w;i!==null&&(i.f&ve)!==0&&(e|=ve);var s={ctx:B,deps:null,nodes_start:null,nodes_end:null,f:e|Y,first:null,fn:t,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(r)try{be(s),s.f|=rt}catch(l){throw ee(s),l}else t!==null&&Oe(s);if(n){var a=s;if(r&&a.deps===null&&a.teardown===null&&a.nodes_start===null&&a.first===a.last&&(a.f&pe)===0&&(a=a.first),a!==null&&(a.parent=i,i!==null&&Nn(a,i),m!==null&&(m.f&P)!==0&&(e&z)===0)){var o=m;(o.effects??=[]).push(a)}}return s}function Tn(e){const t=V(tt,null,!1);return M(t,k),t.teardown=e,t}function xn(e){Sn();var t=w.f,r=!m&&(t&K)!==0&&(t&rt)===0;if(r){var n=B;(n.e??=[]).push(e)}else return ir(e)}function ir(e){return V(et|Gr,e,!1)}function On(e){le.ensure();const t=V(z|pe,e,!0);return()=>{ee(t)}}function kn(e){le.ensure();const t=V(z|pe,e,!0);return(r={})=>new Promise(n=>{r.outro?Ln(t,()=>{ee(t),n(void 0)}):(ee(t),n(void 0))})}function Rn(e){return V(et,e,!1)}function An(e){return V(it|pe,e,!0)}function Cn(e,t=0){return V(tt|t,e,!0)}function oe(e,t=[],r=[]){gn(t,r,n=>{V(tt,()=>e(...n.map(c)),!0)})}function Pn(e,t=!0){return V(K|pe,e,!0,t)}function sr(e){var t=e.teardown;if(t!==null){const r=ue,n=m;fr(!0),F(null);try{t.call(null)}finally{fr(r),F(n)}}}function lr(e,t=!1){var r=e.first;for(e.first=e.last=null;r!==null;){const i=r.ac;i!==null&&mt(()=>{i.abort(lt)});var n=r.next;(r.f&z)!==0?r.parent=null:ee(r,t),r=n}}function In(e){for(var t=e.first;t!==null;){var r=t.next;(t.f&K)===0&&ee(t),t=r}}function ee(e,t=!0){var r=!1;(t||(e.f&Hr)!==0)&&e.nodes_start!==null&&e.nodes_end!==null&&(Mn(e.nodes_start,e.nodes_end),r=!0),lr(e,t&&!r),Be(e,0),M(e,ne);var n=e.transitions;if(n!==null)for(const s of n)s.stop();sr(e);var i=e.parent;i!==null&&i.first!==null&&ar(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=e.ac=null}function Mn(e,t){for(;e!==null;){var r=e===t?null:ye(e);e.remove(),e=r}}function ar(e){var t=e.parent,r=e.prev,n=e.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),t!==null&&(t.first===e&&(t.first=n),t.last===e&&(t.last=r))}function Ln(e,t){var r=[];or(e,r,!0),jn(r,()=>{ee(e),t&&t()})}function jn(e,t){var r=e.length;if(r>0){var n=()=>--r||t();for(var i of e)i.out(n)}else t()}function or(e,t,r){if((e.f&ve)===0){if(e.f^=ve,e.transitions!==null)for(const a of e.transitions)(a.is_global||r)&&t.push(a);for(var n=e.first;n!==null;){var i=n.next,s=(n.f&Br)!==0||(n.f&K)!==0;or(n,t,s?r:!1),n=i}}}let $e=!1;function ur(e){$e=e}let ue=!1;function fr(e){ue=e}let m=null,fe=!1;function F(e){m=e}let w=null;function G(e){w=e}let W=null;function Dn(e){m!==null&&(W===null?W=[e]:W.push(e))}let R=null,I=0,q=null;function Fn(e){q=e}let cr=1,Re=0,ce=Re;function dr(e){ce=e}let te=!1;function _r(){return++cr}function Ye(e){var t=e.f;if((t&Y)!==0)return!0;if((t&Z)!==0){var r=e.deps,n=(t&D)!==0;if(r!==null){var i,s,a=(t&je)!==0,o=n&&w!==null&&!te,l=r.length;if((a||o)&&(w===null||(w.f&ne)===0)){var u=e,f=u.parent;for(i=0;i<l;i++)s=r[i],(a||!s?.reactions?.includes(u))&&(s.reactions??=[]).push(u);a&&(u.f^=je),o&&f!==null&&(f.f&D)===0&&(u.f^=D)}for(i=0;i<l;i++)if(s=r[i],Ye(s)&&Jt(s),s.wv>e.wv)return!0}(!n||w!==null&&!te)&&M(e,k)}return!1}function hr(e,t,r=!0){var n=e.reactions;if(n!==null&&!W?.includes(e))for(var i=0;i<n.length;i++){var s=n[i];(s.f&P)!==0?hr(s,t,!1):t===s&&(r?M(s,Y):(s.f&k)!==0&&M(s,Z),Oe(s))}}function vr(e){var t=R,r=I,n=q,i=m,s=te,a=W,o=B,l=fe,u=ce,f=e.f;R=null,I=0,q=null,te=(f&D)!==0&&(fe||!$e||m===null),m=(f&(K|z))===0?e:null,W=null,De(e.ctx),fe=!1,ce=++Re,e.ac!==null&&(mt(()=>{e.ac.abort(lt)}),e.ac=null);try{e.f|=nt;var d=e.fn,_=d(),h=e.deps;if(R!==null){var v;if(Be(e,I),h!==null&&I>0)for(h.length=I+R.length,v=0;v<R.length;v++)h[I+v]=R[v];else e.deps=h=R;if(!te||(f&P)!==0&&e.reactions!==null)for(v=I;v<h.length;v++)(h[v].reactions??=[]).push(e)}else h!==null&&I<h.length&&(Be(e,I),h.length=I);if(Ut()&&q!==null&&!fe&&h!==null&&(e.f&(P|Z|Y))===0)for(v=0;v<q.length;v++)hr(q[v],e);return i!==null&&i!==e&&(Re++,q!==null&&(n===null?n=q:n.push(...q))),(e.f&ie)!==0&&(e.f^=ie),_}catch(g){return fn(g)}finally{e.f^=nt,R=t,I=r,q=n,m=i,te=s,W=a,De(o),fe=l,ce=u}}function qn(e,t){let r=t.reactions;if(r!==null){var n=jr.call(r,e);if(n!==-1){var i=r.length-1;i===0?r=t.reactions=null:(r[n]=r[i],r.pop())}}r===null&&(t.f&P)!==0&&(R===null||!R.includes(t))&&(M(t,Z),(t.f&(D|je))===0&&(t.f^=je),Gt(t),Be(t,0))}function Be(e,t){var r=e.deps;if(r!==null)for(var n=t;n<r.length;n++)qn(e,r[n])}function be(e){var t=e.f;if((t&ne)===0){M(e,k);var r=w,n=$e;w=e,$e=!0;try{(t&Te)!==0?In(e):lr(e),sr(e);var i=vr(e);e.teardown=typeof i=="function"?i:null,e.wv=cr;var s;Ot&&on&&(e.f&Y)!==0&&e.deps}finally{$e=n,w=r}}}function c(e){var t=e.f,r=(t&P)!==0;if(m!==null&&!fe){var n=w!==null&&(w.f&ne)!==0;if(!n&&!W?.includes(e)){var i=m.deps;if((m.f&nt)!==0)e.rv<Re&&(e.rv=Re,R===null&&i!==null&&i[I]===e?I++:R===null?R=[e]:(!te||!R.includes(e))&&R.push(e));else{(m.deps??=[]).push(e);var s=e.reactions;s===null?e.reactions=[m]:s.includes(m)||s.push(m)}}}else if(r&&e.deps===null&&e.effects===null){var a=e,o=a.parent;o!==null&&(o.f&D)===0&&(a.f^=D)}if(ue){if(Q.has(e))return Q.get(e);if(r){a=e;var l=a.v;return((a.f&k)===0&&a.reactions!==null||pr(a))&&(l=ft(a)),Q.set(a,l),l}}else r&&(a=e,Ye(a)&&Jt(a));if((e.f&ie)!==0)throw e.v;return e.v}function pr(e){if(e.v===N)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(Q.has(t)||(t.f&P)!==0&&pr(t))return!0;return!1}const Un=-7169;function M(e,t){e.f=e.f&Un|t}const gr=new Set,yt=new Set;function Yn(e,t,r,n={}){function i(s){if(n.capture||Ae.call(t,s),!s.cancelBubble)return mt(()=>r?.call(this,s))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?dn(()=>{t.addEventListener(e,i,n)}):t.addEventListener(e,i,n),i}function He(e,t,r,n,i){var s={capture:n,passive:i},a=Yn(e,t,r,s);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Tn(()=>{t.removeEventListener(e,a,s)})}function Bn(e){for(var t=0;t<e.length;t++)gr.add(e[t]);for(var r of yt)r(e)}let wr=null;function Ae(e){var t=this,r=t.ownerDocument,n=e.type,i=e.composedPath?.()||[],s=i[0]||e.target;wr=e;var a=0,o=wr===e&&e.__root;if(o){var l=i.indexOf(o);if(l!==-1&&(t===document||t===window)){e.__root=t;return}var u=i.indexOf(t);if(u===-1)return;l<=u&&(a=l)}if(s=i[a]||e.target,s!==t){_e(e,"currentTarget",{configurable:!0,get(){return s||r}});var f=m,d=w;F(null),G(null);try{for(var _,h=[];s!==null;){var v=s.assignedSlot||s.parentNode||s.host||null;try{var g=s["__"+n];if(g!=null&&(!s.disabled||e.target===s))if(kt(g)){var[L,...C]=g;L.apply(s,[e,...C])}else g.call(s,e)}catch(S){_?h.push(S):_=S}if(e.cancelBubble||v===t||v===null)break;s=v}if(_){for(let S of h)queueMicrotask(()=>{throw S});throw _}}finally{e.__root=t,delete e.currentTarget,F(f),G(d)}}}function Hn(e){var t=document.createElement("template");return t.innerHTML=e.replaceAll("<!>","<!---->"),t.content}function $t(e,t){var r=w;r.nodes_start===null&&(r.nodes_start=e,r.nodes_end=t)}function Gn(e,t){var r=(t&Pr)!==0,n,i=!e.startsWith("<!>");return()=>{if(T)return $t(x,null),x;n===void 0&&(n=Hn(i?e:"<!>"+e));var s=r||er?document.importNode(n,!0):n.cloneNode(!0);{var a=ke(s),o=s.lastChild;$t(a,o)}return s}}function mr(e,t){if(T){w.nodes_end=x,Lt();return}e!==null&&e.before(t)}const Jn=["touchstart","touchmove"];function Vn(e){return Jn.includes(e)}function yr(e,t){return $r(e,t)}function Wn(e,t){gt(),t.intro=t.intro??!1;const r=t.target,n=T,i=x;try{for(var s=ke(r);s&&(s.nodeType!==Mt||s.data!==Ir);)s=ye(s);if(!s)throw Ne;ge(!0),we(s),Lt();const a=$r(e,{...t,anchor:s});if(x===null||x.nodeType!==Mt||x.data!==Mr)throw at(),Ne;return ge(!1),a}catch(a){if(a instanceof Error&&a.message.split(`
2
- `).some(o=>o.startsWith("https://svelte.dev/e/")))throw a;return a!==Ne&&console.warn("Failed to hydrate: ",a),t.recover===!1&&tn(),gt(),En(r),ge(!1),yr(e,t)}finally{ge(n),we(i)}}const Ee=new Map;function $r(e,{target:t,anchor:r,props:n={},events:i,context:s,intro:a=!0}){gt();var o=new Set,l=d=>{for(var _=0;_<d.length;_++){var h=d[_];if(!o.has(h)){o.add(h);var v=Vn(h);t.addEventListener(h,Ae,{passive:v});var g=Ee.get(h);g===void 0?(document.addEventListener(h,Ae,{passive:v}),Ee.set(h,1)):Ee.set(h,g+1)}}};l(Dr(gr)),yt.add(l);var u=void 0,f=kn(()=>{var d=r??t.appendChild(wt());return Pn(()=>{if(s){Ft({});var _=B;_.c=s}i&&(n.$$events=i),T&&$t(d,null),u=e(d,n)||{},T&&(w.nodes_end=x),s&&qt()}),()=>{for(var _ of o){t.removeEventListener(_,Ae);var h=Ee.get(_);--h===0?(document.removeEventListener(_,Ae),Ee.delete(_)):Ee.set(_,h)}yt.delete(l),d!==r&&d.parentNode?.removeChild(d)}});return bt.set(u,f),u}let bt=new WeakMap;function Xn(e,t){const r=bt.get(e);return r?(bt.delete(e),r(t)):Promise.resolve()}function Kn(e,t){Rn(()=>{var r=e.getRootNode(),n=r.host?r:r.head??r.ownerDocument.head;if(!n.querySelector("#"+t.hash)){const i=document.createElement("style");i.id=t.hash,i.textContent=t.code,n.appendChild(i)}})}function zn(e,t){return e==null?null:String(e)}function Et(e,t,r,n){var i=e.__style;if(T||i!==t){var s=zn(t);(!T||s!==e.getAttribute("style"))&&(s==null?e.removeAttribute("style"):e.style.cssText=s),e.__style=t}return n}const Zn=Symbol("is custom element"),Qn=Symbol("is html");function ei(e,t,r,n){var i=ti(e);T&&(i[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")||i[t]!==(i[t]=r)&&(t==="loading"&&(e[Vr]=r),r==null?e.removeAttribute(t):typeof r!="string"&&br(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function U(e,t,r){var n=m,i=w;let s=T;T&&ge(!1),F(null),G(null);try{t!=="style"&&(St.has(e.getAttribute("is")||e.nodeName)||!customElements||customElements.get(e.getAttribute("is")||e.tagName.toLowerCase())?br(e).includes(t):r&&typeof r=="object")?e[t]=r:ei(e,t,r==null?r:String(r))}finally{F(n),G(i),s&&ge(!0)}}function ti(e){return e.__attributes??={[Zn]:e.nodeName.includes("-"),[Qn]:e.namespaceURI===Lr}}var St=new Map;function br(e){var t=e.getAttribute("is")||e.nodeName,r=St.get(t);if(r)return r;St.set(t,r=[]);for(var n,i=e,s=Element.prototype;s!==i;){n=Fr(i);for(var a in n)n[a].set&&r.push(a);i=Rt(i)}return r}function Er(e,t,r,n){var i=n,s=!0,a=()=>(s&&(s=!1,i=n),i),o;o=e[t],o===void 0&&n!==void 0&&(o=a());var l;l=()=>{var _=e[t];return _===void 0?a():(s=!0,_)};var u=!1,f=Ht(()=>(u=!1,l())),d=w;return(function(_,h){if(arguments.length>0){const v=h?c(f):_;return b(f,v),u=!0,i!==void 0&&(i=v),_}return ue&&u||(d.f&ne)!==0?f.v:c(f)})}function ri(e){return new ni(e)}class ni{#t;#e;constructor(t){var r=new Map,n=(s,a)=>{var o=yn(a,!1,!1);return r.set(s,o),o};const i=new Proxy({...t.props||{},$$events:{}},{get(s,a){return c(r.get(a)??n(a,Reflect.get(s,a)))},has(s,a){return a===Jr?!0:(c(r.get(a)??n(a,Reflect.get(s,a))),Reflect.has(s,a))},set(s,a,o){return b(r.get(a)??n(a,o),o),Reflect.set(s,a,o)}});this.#e=(t.hydrate?Wn:yr)(t.component,{target:t.target,anchor:t.anchor,props:i,context:t.context,intro:t.intro??!1,recover:t.recover}),(!t?.props?.$$host||t.sync===!1)&&_t(),this.#t=i.$$events;for(const s of Object.keys(this.#e))s==="$set"||s==="$destroy"||s==="$on"||_e(this,s,{get(){return this.#e[s]},set(a){this.#e[s]=a},enumerable:!0});this.#e.$set=s=>{Object.assign(i,s)},this.#e.$destroy=()=>{Xn(this.#e)}}$set(t){this.#e.$set(t)}$on(t,r){this.#t[t]=this.#t[t]||[];const n=(...i)=>r.call(this,...i);return this.#t[t].push(n),()=>{this.#t[t]=this.#t[t].filter(i=>i!==n)}}$destroy(){this.#e.$destroy()}}let Sr;typeof HTMLElement=="function"&&(Sr=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;constructor(e,t,r){super(),this.$$ctor=e,this.$$s=t,r&&this.attachShadow({mode:"open"})}addEventListener(e,t,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const n=this.$$c.$on(e,t);this.$$l_u.set(t,n)}super.addEventListener(e,t,r)}removeEventListener(e,t,r){if(super.removeEventListener(e,t,r),this.$$c){const n=this.$$l_u.get(t);n&&(n(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(n){return i=>{const s=document.createElement("slot");n!=="default"&&(s.name=n),mr(i,s)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},r=ii(this);for(const n of this.$$s)n in r&&(n==="default"&&!this.$$d.children?(this.$$d.children=e(n),t.default=!0):t[n]=e(n));for(const n of this.attributes){const i=this.$$g_p(n.name);i in this.$$d||(this.$$d[i]=Ge(i,n.value,this.$$p_d,"toProp"))}for(const n in this.$$p_d)!(n in this.$$d)&&this[n]!==void 0&&(this.$$d[n]=this[n],delete this[n]);this.$$c=ri({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=On(()=>{Cn(()=>{this.$$r=!0;for(const n of Le(this.$$c)){if(!this.$$p_d[n]?.reflect)continue;this.$$d[n]=this.$$c[n];const i=Ge(n,this.$$d[n],this.$$p_d,"toAttribute");i==null?this.removeAttribute(this.$$p_d[n].attribute||n):this.setAttribute(this.$$p_d[n].attribute||n,i)}this.$$r=!1})});for(const n in this.$$l)for(const i of this.$$l[n]){const s=this.$$c.$on(n,i);this.$$l_u.set(i,s)}this.$$l={}}}attributeChangedCallback(e,t,r){this.$$r||(e=this.$$g_p(e),this.$$d[e]=Ge(e,r,this.$$p_d,"toProp"),this.$$c?.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return Le(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function Ge(e,t,r,n){const i=r[e]?.type;if(t=i==="Boolean"&&typeof t!="boolean"?t!=null:t,!n||!r[e])return t;if(n==="toAttribute")switch(i){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t??null;default:return t}else switch(i){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function ii(e){const t={};return e.childNodes.forEach(r=>{t[r.slot||"default"]=!0}),t}function si(e,t,r,n,i,s){let a=class extends Sr{constructor(){super(e,r,i),this.$$p_d=t}static get observedAttributes(){return Le(t).map(o=>(t[o].attribute||o).toLowerCase())}};return Le(t).forEach(o=>{_e(a.prototype,o,{get(){return this.$$c&&o in this.$$c?this.$$c[o]:this.$$d[o]},set(l){l=Ge(o,l,t),this.$$d[o]=l;var u=this.$$c;if(u){var f=he(u,o)?.get;f?u[o]=l:u.$set({[o]:l})}}})}),n.forEach(o=>{_e(a.prototype,o,{get(){return this.$$c?.[o]}})}),e.element=a,a}const Nr={version:"0.60.3"};function li(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Se={},Nt,Tr;function ai(){if(Tr)return Nt;Tr=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,o=/^\s+|\s+$/g,l=`
3
- `,u="/",f="*",d="",_="comment",h="declaration";Nt=function(g,L){if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];L=L||{};var C=1,S=1;function Je($){var p=$.match(t);p&&(C+=p.length);var A=$.lastIndexOf(l);S=~A?$.length-A:S+$.length}function Ve(){var $={line:C,column:S};return function(p){return p.position=new We($),Ke(),p}}function We($){this.start=$,this.end={line:C,column:S},this.source=L.source}We.prototype.content=g;function Xe($){var p=new Error(L.source+":"+C+":"+S+": "+$);if(p.reason=$,p.filename=L.source,p.line=C,p.column=S,p.source=g,!L.silent)throw p}function de($){var p=$.exec(g);if(p){var A=p[0];return Je(A),g=g.slice(A.length),p}}function Ke(){de(r)}function ze($){var p;for($=$||[];p=Ce();)p!==!1&&$.push(p);return $}function Ce(){var $=Ve();if(!(u!=g.charAt(0)||f!=g.charAt(1))){for(var p=2;d!=g.charAt(p)&&(f!=g.charAt(p)||u!=g.charAt(p+1));)++p;if(p+=2,d===g.charAt(p-1))return Xe("End of comment missing");var A=g.slice(2,p-2);return S+=2,Je(A),g=g.slice(p),S+=2,$({type:_,comment:A})}}function Pe(){var $=Ve(),p=de(n);if(p){if(Ce(),!de(i))return Xe("property missing ':'");var A=de(s),Ie=$({type:h,property:v(p[0].replace(e,d)),value:A?v(A[0].replace(e,d)):d});return de(a),Ie}}function Ze(){var $=[];ze($);for(var p;p=Pe();)p!==!1&&($.push(p),ze($));return $}return Ke(),Ze()};function v(g){return g?g.replace(o,d):d}return Nt}var xr;function oi(){if(xr)return Se;xr=1;var e=Se&&Se.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Se,"__esModule",{value:!0}),Se.default=r;var t=e(ai());function r(n,i){var s=null;if(!n||typeof n!="string")return s;var a=(0,t.default)(n),o=typeof i=="function";return a.forEach(function(l){if(l.type==="declaration"){var u=l.property,f=l.value;o?i(u,f,l):f&&(s=s||{},s[u]=f)}}),s}return Se}var ui=oi();const Or=li(ui);Or.default;function kr(e){const t=e?.repoName.split("/")?.[1]||e?.repoName;if(!t)throw new Error("wrong componentPath "+e?.repoName);if(!e?.version)throw new Error("wrong version "+e?.version);const r=e?.iifePath||"main.iife.js";if(!document.getElementById(t+"-script"))try{const n=document.createElement("script");if(n.id=t+"-script",n.src=`https://cdn.jsdelivr.net/npm/${e.repoName}@${e.version}/${r}`,e?.local)n.src=`${e.local}`;else if(location.href.includes("localhost:6006")){const i=t.split("-")[0];n.src=`http://localhost:6006/webcomponents/${t.replace(i+"-","")}/${r}`}document.head.appendChild(n)}catch(n){console.warn(n)}}var fi=(e,t)=>t("eraser"),ci=(e,t)=>t("select"),di=(e,t)=>t("draw"),_i=(e,t)=>t(),hi=(e,t)=>t(),vi=(e,t)=>t(),pi=Gn('<div part="controller" id="controller" class="svelte-14wiqdf"><button>clear</button> <button>select</button> <button>draw</button> <button>undo</button> <button>redo</button> <button>save</button> <button>brush</button> <br/>load:<hb-input-file></hb-input-file> insert:<hb-input-file></hb-input-file></div> <div part="paper-container" id="paper-container" style="position:relative" class="svelte-14wiqdf"><hb-stylus-paper></hb-stylus-paper></div>',3);const gi={hash:"svelte-14wiqdf",code:'@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");:host {font-family:"Roboto", sans-serif;position:absolute;width:100%;height:100%;display:block;display:grid;grid-template-areas:"header" "paper";grid-template-columns:1fr;grid-template-rows:auto 1fr;}#controller.svelte-14wiqdf {grid-area:header;}#paper-container.svelte-14wiqdf {grid-area:paper;background:green;}'};function Rr(e,t){Ft(t,!0),Kn(e,gi);let r=Er(t,"id",7,""),n=Er(t,"load_draw"),i=E("draw");me({});let s=E(""),a=E(""),o=E(0),l=E(void 0),u=E(!1),f=E(!1),d=E(!1),_=E(void 0),h=E(void 0),v=E(void 0),g;xn(()=>{if((c(l)===0||c(l))&&c(l)<c(o)?b(f,!0):b(f,!1),(c(o)||c(o)===0)&&c(d)&&(!c(l)||c(l)!==-1)&&(!g||g<c(o)&&(!c(l)||c(l)<g))?b(u,!0):b(u,!1),typeof n()=="string"&&n()?.length)try{n(JSON.parse(n()))}catch(y){console.error("error parsing json",y)}}),kr({repoName:"@htmlbricks/hb-stylus-paper",version:Nr.version}),kr({repoName:"@htmlbricks/hb-input-file",version:Nr.version});function L(y,re){var X="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(y)),j=document.createElement("a");j.setAttribute("href",X),j.setAttribute("download",re),document.body.appendChild(j),j.click(),j.remove()}function C(y){b(i,y,!0)}function S(){console.log("ch",c(o),c(l)),c(o)>=0&&(!c(l)||c(l)>-1)&&(b(l,c(l)||c(l)===0?c(l)-1:c(o)-1,!0),console.log("undo",c(o),c(l)))}function Je(){console.log(c(o),c(l)),(c(l)||c(l)===0)&&c(l)<=c(o)&&($n(l),console.log("redo",c(o),c(l)))}function Ve(y){c(d)||b(d,!0),console.log("h",y),b(o,y.index-1),y.start_index&&(g=y.start_index),b(l,void 0)}function We(){b(_,{name:"test",type:"json"},!0)}function Xe(y){const re=y.value?.name;if(re){const X=new FileReader;X.readAsDataURL(y.value),X.onload=function(j){try{if(console.log("insert file",j.target,j.target?.result),j.target?.result){const mi=j.target.result.toString().split(";")[0].split("/")[1];b(h,{base64:j.target.result.toString(),type:mi,name:re},!0)}}catch{console.error("error loading file")}},X.onerror=function(j){console.error("error reading file")}}}function de(y){console.log("save",y),b(_,void 0),L(y,y.name+".json")}function Ke(y){if(console.log("file",y),y.value.name){const re=new FileReader;re.readAsText(y.value,"UTF-8"),re.onload=function(X){if(X?.target?.result?.toString())try{n(JSON.parse(X.target.result.toString()))}catch{console.error("error loading file")}},re.onerror=function(X){console.error("error reading file")}}}var ze={get id(){return r()},set id(y=""){r(y),_t()},get load_draw(){return n()},set load_draw(y){n(y),_t()}},Ce=pi(),Pe=bn(Ce),Ze=nr(Pe);Ze.__click=[fi,C];var $=J(Ze,2);$.__click=[ci,C];var p=J($,2);p.__click=[di,C];var A=J(p,2);A.__click=[_i,S];var Ie=J(A,2);Ie.__click=[hi,Je];var Tt=J(Ie,2);Tt.__click=[vi,We];var Ar=J(Tt,2),Me=J(Ar,4);U(Me,"id","loadfile"),Et(Me,c(a)),U(Me,"schemaentry",JSON.stringify({label:"ciao",id:"xxxxxxx"}));var Qe=J(Me,2);U(Qe,"id","insertfile"),Et(Qe,c(a)),U(Qe,"schemaentry",JSON.stringify({label:"ciao"})),jt(Pe);var Cr=J(Pe,2),H=nr(Cr);return U(H,"id","stylus-paper"),oe(()=>U(H,"goto",c(l))),Et(H,c(s)),U(H,"background_color","green"),oe(()=>U(H,"mode",c(i))),oe(()=>U(H,"save_as",c(_)?JSON.stringify(c(_)):"")),oe(()=>U(H,"load_draw",n()?JSON.stringify(n()):null)),oe(()=>U(H,"insert_image",c(h)?JSON.stringify(c(h)):null)),oe(()=>U(H,"insert_text",c(v)?JSON.stringify(c(v)):null)),jt(Cr),oe(()=>{A.disabled=!c(u),Ie.disabled=!c(f),Tt.disabled=!c(u),Ar.disabled=c(i)!=="draw"}),He("setVal",Me,y=>Ke(y.detail)),He("setVal",Qe,y=>Xe(y.detail)),He("historyIndex",H,y=>Ve(y.detail)),He("save",H,y=>de(y.detail)),mr(e,Ce),qt(ze)}Bn(["click"]),customElements.define("hb-stylus-notebook",si(Rr,{id:{},load_draw:{}},[],[],!0)),xt.Component=Rr,Object.defineProperty(xt,Symbol.toStringTag,{value:"Module"})})(this["stylus-notebook"]=this["stylus-notebook"]||{});
1
+ (function(Oe){"use strict";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add("5");const Mr=2,Lr="[",jr="]",Nt={},N=Symbol(),Dr="http://www.w3.org/1999/xhtml",ke=!1;var Re=Array.isArray,Fr=Array.prototype.indexOf,qr=Array.from,Lt=Object.keys,_t=Object.defineProperty,ht=Object.getOwnPropertyDescriptor,Ur=Object.getOwnPropertyDescriptors,Yr=Object.prototype,Br=Array.prototype,Ae=Object.getPrototypeOf,Ce=Object.isExtensible;function Pe(t){for(var e=0;e<t.length;e++)t[e]()}function Hr(){var t,e,r=new Promise((n,i)=>{t=n,e=i});return{promise:r,resolve:t,reject:e}}const P=2,te=4,ee=8,Tt=16,K=32,z=64,Ie=128,D=256,jt=512,k=1024,Y=2048,Z=4096,vt=8192,nt=16384,re=32768,Gr=65536,Me=1<<17,Jr=1<<18,pt=1<<19,Vr=1<<20,ne=1<<21,ie=1<<22,it=1<<23,se=Symbol("$state"),Wr=Symbol("legacy props"),Xr=Symbol(""),le=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Kr=3,Le=8;function zr(){throw new Error("https://svelte.dev/e/await_outside_boundary")}function Zr(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Qr(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function tn(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function en(t){throw new Error("https://svelte.dev/e/effect_orphan")}function rn(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function nn(){throw new Error("https://svelte.dev/e/hydration_failed")}function sn(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function ln(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function an(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function ae(t){console.warn("https://svelte.dev/e/hydration_mismatch")}let T=!1;function gt(t){T=t}let x;function wt(t){if(t===null)throw ae(),Nt;return x=t}function je(){return wt(yt(x))}function De(t){if(T){if(yt(x)!==null)throw ae(),Nt;x=t}}function Fe(t){return t===this.v}function on(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function un(t){return!on(t,this.v)}let fn=!1,B=null;function Dt(t){B=t}function qe(t,e=!1,r){B={p:B,c:null,e:null,s:t,x:null,l:null}}function Ue(t){var e=B,r=e.e;if(r!==null){e.e=null;for(var n of r)sr(n)}return t!==void 0&&(e.x=t),B=e.p,t??{}}function Ye(){return!0}const cn=new WeakMap;function dn(t){var e=g;if(e===null)return w.f|=it,t;if((e.f&re)===0){if((e.f&Ie)===0)throw!e.parent&&t instanceof Error&&Be(t),t;e.b.error(t)}else oe(t,e)}function oe(t,e){for(;e!==null;){if((e.f&Ie)!==0)try{e.b.error(t);return}catch(r){t=r}e=e.parent}throw t instanceof Error&&Be(t),t}function Be(t){const e=cn.get(t);e&&(_t(t,"message",{value:e.message}),_t(t,"stack",{value:e.stack}))}let xt=[],ue=[];function He(){var t=xt;xt=[],Pe(t)}function _n(){var t=ue;ue=[],Pe(t)}function hn(t){xt.length===0&&queueMicrotask(He),xt.push(t)}function vn(){xt.length>0&&He(),ue.length>0&&_n()}function pn(){const t=g.b;return t===null&&zr(),t}function fe(t){var e=P|Y,r=w!==null&&(w.f&P)!==0?w:null;return g===null||r!==null&&(r.f&D)!==0?e|=D:g.f|=pt,{ctx:B,deps:null,effects:null,equals:Fe,f:e,fn:t,reactions:null,rv:0,v:N,wv:0,parent:r??g,ac:null}}function gn(t,e){let r=g;r===null&&Zr();var n=r.b,i=void 0,s=ve(N),a=null,o=!w;return Pn(()=>{try{var l=t();a&&Promise.resolve(l).catch(()=>{})}catch(_){l=Promise.reject(_)}var u=()=>l;i=a?.then(u,u)??Promise.resolve(l),a=i;var f=O,d=n.is_pending();o&&(n.update_pending_count(1),d||f.increment());const h=(_,v=void 0)=>{a=null,d||f.activate(),v?v!==le&&(s.f|=it,pe(s,v)):((s.f&it)!==0&&(s.f^=it),pe(s,_)),o&&(n.update_pending_count(-1),d||f.decrement()),We()};if(i.then(h,_=>h(null,_||"unknown")),f)return()=>{queueMicrotask(()=>f.neuter())}}),new Promise(l=>{function u(f){function d(){f===i?l(s):u(i)}f.then(d,d)}u(i)})}function Ge(t){const e=fe(t);return dr(e),e}function Je(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;r<e.length;r+=1)tt(e[r])}}function wn(t){for(var e=t.parent;e!==null;){if((e.f&P)===0)return e;e=e.parent}return null}function ce(t){var e,r=g;G(wn(t));try{Je(t),e=gr(t)}finally{G(r)}return e}function Ve(t){var e=ce(t);if(t.equals(e)||(t.v=e,t.wv=vr()),!ut){var r=(et||(t.f&D)!==0)&&t.deps!==null?Z:k;M(t,r)}}function mn(t,e,r){const n=fe;if(e.length===0){r(t.map(n));return}var i=O,s=g,a=yn(),o=pn();Promise.all(e.map(l=>gn(l))).then(l=>{i?.activate(),a();try{r([...t.map(n),...l])}catch(u){(s.f&nt)===0&&oe(u,s)}i?.deactivate(),We()}).catch(l=>{o.error(l)})}function yn(){var t=g,e=w,r=B,n=O;return function(){G(t),F(e),Dt(r),n?.activate()}}function We(){G(null),F(null),Dt(null)}const de=new Set;let O=null,Xe=new Set,Ft=[];function Ke(){const t=Ft.shift();Ft.length>0&&queueMicrotask(Ke),t()}let st=[],qt=null,_e=!1,Ut=!1;class lt{current=new Map;#e=new Map;#t=new Set;#r=0;#u=null;#f=!1;#i=[];#l=[];#s=[];#n=[];#a=[];#c=[];#d=[];skipped_effects=new Set;process(e){st=[];for(const i of e)this.#h(i);if(this.#i.length===0&&this.#r===0){this.#_();var r=this.#s,n=this.#n;this.#s=[],this.#n=[],this.#a=[],O=null,Ze(r),Ze(n),O===null?O=this:de.delete(this),this.#u?.resolve()}else this.#o(this.#s),this.#o(this.#n),this.#o(this.#a);for(const i of this.#i)bt(i);for(const i of this.#l)bt(i);this.#i=[],this.#l=[]}#h(e){e.f^=k;for(var r=e.first;r!==null;){var n=r.f,i=(n&(K|z))!==0,s=i&&(n&k)!==0,a=s||(n&vt)!==0||this.skipped_effects.has(r);if(!a&&r.fn!==null){if(i)r.f^=k;else if((n&te)!==0)this.#n.push(r);else if((n&k)===0)if((n&ie)!==0){var o=r.b?.is_pending()?this.#l:this.#i;o.push(r)}else Yt(r)&&((r.f&Tt)!==0&&this.#a.push(r),bt(r));var l=r.first;if(l!==null){r=l;continue}}var u=r.parent;for(r=r.next;r===null&&u!==null;)r=u.next,u=u.parent}}#o(e){for(const r of e)((r.f&Y)!==0?this.#c:this.#d).push(r),M(r,k);e.length=0}capture(e,r){this.#e.has(e)||this.#e.set(e,r),this.current.set(e,e.v)}activate(){O=this}deactivate(){O=null;for(const e of Xe)if(Xe.delete(e),e(),O!==null)break}neuter(){this.#f=!0}flush(){st.length>0?ze():this.#_(),O===this&&(this.#r===0&&de.delete(this),this.deactivate())}#_(){if(!this.#f)for(const e of this.#t)e();this.#t.clear()}increment(){this.#r+=1}decrement(){if(this.#r-=1,this.#r===0){for(const e of this.#c)M(e,Y),Ot(e);for(const e of this.#d)M(e,Z),Ot(e);this.#s=[],this.#n=[],this.flush()}else this.deactivate()}add_callback(e){this.#t.add(e)}settled(){return(this.#u??=Hr()).promise}static ensure(){if(O===null){const e=O=new lt;de.add(O),Ut||lt.enqueue(()=>{O===e&&e.flush()})}return O}static enqueue(e){Ft.length===0&&queueMicrotask(Ke),Ft.unshift(e)}}function he(t){var e=Ut;Ut=!0;try{for(var r;;){if(vn(),st.length===0&&(O?.flush(),st.length===0))return qt=null,r;ze()}}finally{Ut=e}}function ze(){var t=$t;_e=!0;try{var e=0;for(fr(!0);st.length>0;){var r=lt.ensure();if(e++>1e3){var n,i;$n()}r.process(st),Q.clear()}}finally{_e=!1,fr(t),qt=null}}function $n(){try{rn()}catch(t){oe(t,qt)}}let at=null;function Ze(t){var e=t.length;if(e!==0){for(var r=0;r<e;){var n=t[r++];if((n.f&(nt|vt))===0&&Yt(n)&&(at=[],bt(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null&&n.ac===null?or(n):n.fn=null),at?.length>0)){Q.clear();for(const i of at)bt(i);at=[]}}at=null}}function Ot(t){for(var e=qt=t;e.parent!==null;){e=e.parent;var r=e.f;if(_e&&e===g&&(r&Tt)!==0)return;if((r&(z|K))!==0){if((r&k)===0)return;e.f^=k}}st.push(e)}const Q=new Map;function ve(t,e){var r={f:0,v:t,reactions:null,equals:Fe,rv:0,wv:0};return r}function b(t,e){const r=ve(t);return dr(r),r}function bn(t,e=!1,r=!0){const n=ve(t);return e||(n.equals=un),n}function E(t,e,r=!1){w!==null&&(!ft||(w.f&Me)!==0)&&Ye()&&(w.f&(P|Tt|ie|Me))!==0&&!W?.includes(t)&&an();let n=r?mt(e):e;return pe(t,n)}function pe(t,e){if(!t.equals(e)){var r=t.v;ut?Q.set(t,e):Q.set(t,r),t.v=e;var n=lt.ensure();n.capture(t,r),(t.f&P)!==0&&((t.f&Y)!==0&&ce(t),M(t,(t.f&D)===0?k:Z)),t.wv=vr(),Qe(t,Y),g!==null&&(g.f&k)!==0&&(g.f&(K|z))===0&&(q===null?qn([t]):q.push(t))}return e}function En(t,e=1){var r=c(t),n=e===1?r++:r--;return E(t,r),n}function ge(t){E(t,t.v+1)}function Qe(t,e){var r=t.reactions;if(r!==null)for(var n=r.length,i=0;i<n;i++){var s=r[i],a=s.f,o=(a&Y)===0;o&&M(s,e),(a&P)!==0?Qe(s,Z):o&&((a&Tt)!==0&&at!==null&&at.push(s),Ot(s))}}function mt(t){if(typeof t!="object"||t===null||se in t)return t;const e=Ae(t);if(e!==Yr&&e!==Br)return t;var r=new Map,n=Re(t),i=b(0),s=ct,a=o=>{if(ct===s)return o();var l=w,u=ct;F(null),hr(s);var f=o();return F(l),hr(u),f};return n&&r.set("length",b(t.length)),new Proxy(t,{defineProperty(o,l,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&sn();var f=r.get(l);return f===void 0?f=a(()=>{var d=b(u.value);return r.set(l,d),d}):E(f,u.value,!0),!0},deleteProperty(o,l){var u=r.get(l);if(u===void 0){if(l in o){const f=a(()=>b(N));r.set(l,f),ge(i)}}else E(u,N),ge(i);return!0},get(o,l,u){if(l===se)return t;var f=r.get(l),d=l in o;if(f===void 0&&(!d||ht(o,l)?.writable)&&(f=a(()=>{var _=mt(d?o[l]:N),v=b(_);return v}),r.set(l,f)),f!==void 0){var h=c(f);return h===N?void 0:h}return Reflect.get(o,l,u)},getOwnPropertyDescriptor(o,l){var u=Reflect.getOwnPropertyDescriptor(o,l);if(u&&"value"in u){var f=r.get(l);f&&(u.value=c(f))}else if(u===void 0){var d=r.get(l),h=d?.v;if(d!==void 0&&h!==N)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return u},has(o,l){if(l===se)return!0;var u=r.get(l),f=u!==void 0&&u.v!==N||Reflect.has(o,l);if(u!==void 0||g!==null&&(!f||ht(o,l)?.writable)){u===void 0&&(u=a(()=>{var h=f?mt(o[l]):N,_=b(h);return _}),r.set(l,u));var d=c(u);if(d===N)return!1}return f},set(o,l,u,f){var d=r.get(l),h=l in o;if(n&&l==="length")for(var _=u;_<d.v;_+=1){var v=r.get(_+"");v!==void 0?E(v,N):_ in o&&(v=a(()=>b(N)),r.set(_+"",v))}if(d===void 0)(!h||ht(o,l)?.writable)&&(d=a(()=>b(void 0)),E(d,mt(u)),r.set(l,d));else{h=d.v!==N;var m=a(()=>mt(u));E(d,m)}var L=Reflect.getOwnPropertyDescriptor(o,l);if(L?.set&&L.set.call(f,u),!h){if(n&&typeof l=="string"){var C=r.get("length"),S=Number(l);Number.isInteger(S)&&S>=C.v&&E(C,S+1)}ge(i)}return!0},ownKeys(o){c(i);var l=Reflect.ownKeys(o).filter(d=>{var h=r.get(d);return h===void 0||h.v!==N});for(var[u,f]of r)f.v!==N&&!(u in o)&&l.push(u);return l},setPrototypeOf(){ln()}})}var tr,er,rr,nr;function we(){if(tr===void 0){tr=window,er=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,r=Text.prototype;rr=ht(e,"firstChild").get,nr=ht(e,"nextSibling").get,Ce(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),Ce(r)&&(r.__t=void 0)}}function me(t=""){return document.createTextNode(t)}function kt(t){return rr.call(t)}function yt(t){return nr.call(t)}function ir(t,e){if(!T)return kt(t);var r=kt(x);return r===null&&(r=x.appendChild(me())),wt(r),r}function Sn(t,e){if(!T){var r=kt(t);return r instanceof Comment&&r.data===""?yt(r):r}return x}function J(t,e=1,r=!1){let n=T?x:t;for(var i;e--;)i=n,n=yt(n);if(!T)return n;if(r&&n?.nodeType!==Kr){var s=me();return n===null?i?.after(s):n.before(s),wt(s),s}return wt(n),n}function Nn(t){t.textContent=""}function ye(t){var e=w,r=g;F(null),G(null);try{return t()}finally{F(e),G(r)}}function Tn(t){g===null&&w===null&&en(),w!==null&&(w.f&D)!==0&&g===null&&tn(),ut&&Qr()}function xn(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function V(t,e,r,n=!0){var i=g;i!==null&&(i.f&vt)!==0&&(t|=vt);var s={ctx:B,deps:null,nodes_start:null,nodes_end:null,f:t|Y,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(r)try{bt(s),s.f|=re}catch(l){throw tt(s),l}else e!==null&&Ot(s);if(n){var a=s;if(r&&a.deps===null&&a.teardown===null&&a.nodes_start===null&&a.first===a.last&&(a.f&pt)===0&&(a=a.first),a!==null&&(a.parent=i,i!==null&&xn(a,i),w!==null&&(w.f&P)!==0&&(t&z)===0)){var o=w;(o.effects??=[]).push(a)}}return s}function On(t){const e=V(ee,null,!1);return M(e,k),e.teardown=t,e}function kn(t){Tn();var e=g.f,r=!w&&(e&K)!==0&&(e&re)===0;if(r){var n=B;(n.e??=[]).push(t)}else return sr(t)}function sr(t){return V(te|Vr,t,!1)}function Rn(t){lt.ensure();const e=V(z|pt,t,!0);return()=>{tt(e)}}function An(t){lt.ensure();const e=V(z|pt,t,!0);return(r={})=>new Promise(n=>{r.outro?Dn(e,()=>{tt(e),n(void 0)}):(tt(e),n(void 0))})}function Cn(t){return V(te,t,!1)}function Pn(t){return V(ie|pt,t,!0)}function In(t,e=0){return V(ee|e,t,!0)}function ot(t,e=[],r=[]){mn(e,r,n=>{V(ee,()=>t(...n.map(c)),!0)})}function Mn(t,e=!0){return V(K|pt,t,!0,e)}function lr(t){var e=t.teardown;if(e!==null){const r=ut,n=w;cr(!0),F(null);try{e.call(null)}finally{cr(r),F(n)}}}function ar(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){const i=r.ac;i!==null&&ye(()=>{i.abort(le)});var n=r.next;(r.f&z)!==0?r.parent=null:tt(r,e),r=n}}function Ln(t){for(var e=t.first;e!==null;){var r=e.next;(e.f&K)===0&&tt(e),e=r}}function tt(t,e=!0){var r=!1;(e||(t.f&Jr)!==0)&&t.nodes_start!==null&&t.nodes_end!==null&&(jn(t.nodes_start,t.nodes_end),r=!0),ar(t,e&&!r),Bt(t,0),M(t,nt);var n=t.transitions;if(n!==null)for(const s of n)s.stop();lr(t);var i=t.parent;i!==null&&i.first!==null&&or(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=t.ac=null}function jn(t,e){for(;t!==null;){var r=t===e?null:yt(t);t.remove(),t=r}}function or(t){var e=t.parent,r=t.prev,n=t.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),e!==null&&(e.first===t&&(e.first=n),e.last===t&&(e.last=r))}function Dn(t,e){var r=[];ur(t,r,!0),Fn(r,()=>{tt(t),e&&e()})}function Fn(t,e){var r=t.length;if(r>0){var n=()=>--r||e();for(var i of t)i.out(n)}else e()}function ur(t,e,r){if((t.f&vt)===0){if(t.f^=vt,t.transitions!==null)for(const a of t.transitions)(a.is_global||r)&&e.push(a);for(var n=t.first;n!==null;){var i=n.next,s=(n.f&Gr)!==0||(n.f&K)!==0;ur(n,e,s?r:!1),n=i}}}let $t=!1;function fr(t){$t=t}let ut=!1;function cr(t){ut=t}let w=null,ft=!1;function F(t){w=t}let g=null;function G(t){g=t}let W=null;function dr(t){w!==null&&(W===null?W=[t]:W.push(t))}let R=null,I=0,q=null;function qn(t){q=t}let _r=1,Rt=0,ct=Rt;function hr(t){ct=t}let et=!1;function vr(){return++_r}function Yt(t){var e=t.f;if((e&Y)!==0)return!0;if((e&Z)!==0){var r=t.deps,n=(e&D)!==0;if(r!==null){var i,s,a=(e&jt)!==0,o=n&&g!==null&&!et,l=r.length;if((a||o)&&(g===null||(g.f&nt)===0)){var u=t,f=u.parent;for(i=0;i<l;i++)s=r[i],(a||!s?.reactions?.includes(u))&&(s.reactions??=[]).push(u);a&&(u.f^=jt),o&&f!==null&&(f.f&D)===0&&(u.f^=D)}for(i=0;i<l;i++)if(s=r[i],Yt(s)&&Ve(s),s.wv>t.wv)return!0}(!n||g!==null&&!et)&&M(t,k)}return!1}function pr(t,e,r=!0){var n=t.reactions;if(n!==null&&!W?.includes(t))for(var i=0;i<n.length;i++){var s=n[i];(s.f&P)!==0?pr(s,e,!1):e===s&&(r?M(s,Y):(s.f&k)!==0&&M(s,Z),Ot(s))}}function gr(t){var e=R,r=I,n=q,i=w,s=et,a=W,o=B,l=ft,u=ct,f=t.f;R=null,I=0,q=null,et=(f&D)!==0&&(ft||!$t||w===null),w=(f&(K|z))===0?t:null,W=null,Dt(t.ctx),ft=!1,ct=++Rt,t.ac!==null&&(ye(()=>{t.ac.abort(le)}),t.ac=null);try{t.f|=ne;var d=t.fn,h=d(),_=t.deps;if(R!==null){var v;if(Bt(t,I),_!==null&&I>0)for(_.length=I+R.length,v=0;v<R.length;v++)_[I+v]=R[v];else t.deps=_=R;if(!et||(f&P)!==0&&t.reactions!==null)for(v=I;v<_.length;v++)(_[v].reactions??=[]).push(t)}else _!==null&&I<_.length&&(Bt(t,I),_.length=I);if(Ye()&&q!==null&&!ft&&_!==null&&(t.f&(P|Z|Y))===0)for(v=0;v<q.length;v++)pr(q[v],t);return i!==null&&i!==t&&(Rt++,q!==null&&(n===null?n=q:n.push(...q))),(t.f&it)!==0&&(t.f^=it),h}catch(m){return dn(m)}finally{t.f^=ne,R=e,I=r,q=n,w=i,et=s,W=a,Dt(o),ft=l,ct=u}}function Un(t,e){let r=e.reactions;if(r!==null){var n=Fr.call(r,t);if(n!==-1){var i=r.length-1;i===0?r=e.reactions=null:(r[n]=r[i],r.pop())}}r===null&&(e.f&P)!==0&&(R===null||!R.includes(e))&&(M(e,Z),(e.f&(D|jt))===0&&(e.f^=jt),Je(e),Bt(e,0))}function Bt(t,e){var r=t.deps;if(r!==null)for(var n=e;n<r.length;n++)Un(t,r[n])}function bt(t){var e=t.f;if((e&nt)===0){M(t,k);var r=g,n=$t;g=t,$t=!0;try{(e&Tt)!==0?Ln(t):ar(t),lr(t);var i=gr(t);t.teardown=typeof i=="function"?i:null,t.wv=_r;var s;ke&&fn&&(t.f&Y)!==0&&t.deps}finally{$t=n,g=r}}}function c(t){var e=t.f,r=(e&P)!==0;if(w!==null&&!ft){var n=g!==null&&(g.f&nt)!==0;if(!n&&!W?.includes(t)){var i=w.deps;if((w.f&ne)!==0)t.rv<Rt&&(t.rv=Rt,R===null&&i!==null&&i[I]===t?I++:R===null?R=[t]:(!et||!R.includes(t))&&R.push(t));else{(w.deps??=[]).push(t);var s=t.reactions;s===null?t.reactions=[w]:s.includes(w)||s.push(w)}}}else if(r&&t.deps===null&&t.effects===null){var a=t,o=a.parent;o!==null&&(o.f&D)===0&&(a.f^=D)}if(ut){if(Q.has(t))return Q.get(t);if(r){a=t;var l=a.v;return((a.f&k)===0&&a.reactions!==null||wr(a))&&(l=ce(a)),Q.set(a,l),l}}else r&&(a=t,Yt(a)&&Ve(a));if((t.f&it)!==0)throw t.v;return t.v}function wr(t){if(t.v===N)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(Q.has(e)||(e.f&P)!==0&&wr(e))return!0;return!1}const Yn=-7169;function M(t,e){t.f=t.f&Yn|e}const mr=new Set,$e=new Set;function Bn(t,e,r,n={}){function i(s){if(n.capture||At.call(e,s),!s.cancelBubble)return ye(()=>r?.call(this,s))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?hn(()=>{e.addEventListener(t,i,n)}):e.addEventListener(t,i,n),i}function Ht(t,e,r,n,i){var s={capture:n,passive:i},a=Bn(t,e,r,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&On(()=>{e.removeEventListener(t,a,s)})}function Hn(t){for(var e=0;e<t.length;e++)mr.add(t[e]);for(var r of $e)r(t)}let yr=null;function At(t){var e=this,r=e.ownerDocument,n=t.type,i=t.composedPath?.()||[],s=i[0]||t.target;yr=t;var a=0,o=yr===t&&t.__root;if(o){var l=i.indexOf(o);if(l!==-1&&(e===document||e===window)){t.__root=e;return}var u=i.indexOf(e);if(u===-1)return;l<=u&&(a=l)}if(s=i[a]||t.target,s!==e){_t(t,"currentTarget",{configurable:!0,get(){return s||r}});var f=w,d=g;F(null),G(null);try{for(var h,_=[];s!==null;){var v=s.assignedSlot||s.parentNode||s.host||null;try{var m=s["__"+n];if(m!=null&&(!s.disabled||t.target===s))if(Re(m)){var[L,...C]=m;L.apply(s,[t,...C])}else m.call(s,t)}catch(S){h?_.push(S):h=S}if(t.cancelBubble||v===e||v===null)break;s=v}if(h){for(let S of _)queueMicrotask(()=>{throw S});throw h}}finally{t.__root=e,delete t.currentTarget,F(f),G(d)}}}function Gn(t){var e=document.createElement("template");return e.innerHTML=t.replaceAll("<!>","<!---->"),e.content}function be(t,e){var r=g;r.nodes_start===null&&(r.nodes_start=t,r.nodes_end=e)}function Jn(t,e){var r=(e&Mr)!==0,n,i=!t.startsWith("<!>");return()=>{if(T)return be(x,null),x;n===void 0&&(n=Gn(i?t:"<!>"+t));var s=r||er?document.importNode(n,!0):n.cloneNode(!0);{var a=kt(s),o=s.lastChild;be(a,o)}return s}}function $r(t,e){if(T){g.nodes_end=x,je();return}t!==null&&t.before(e)}const Vn=["touchstart","touchmove"];function Wn(t){return Vn.includes(t)}function br(t,e){return Er(t,e)}function Xn(t,e){we(),e.intro=e.intro??!1;const r=e.target,n=T,i=x;try{for(var s=kt(r);s&&(s.nodeType!==Le||s.data!==Lr);)s=yt(s);if(!s)throw Nt;gt(!0),wt(s),je();const a=Er(t,{...e,anchor:s});if(x===null||x.nodeType!==Le||x.data!==jr)throw ae(),Nt;return gt(!1),a}catch(a){if(a instanceof Error&&a.message.split(`
2
+ `).some(o=>o.startsWith("https://svelte.dev/e/")))throw a;return a!==Nt&&console.warn("Failed to hydrate: ",a),e.recover===!1&&nn(),we(),Nn(r),gt(!1),br(t,e)}finally{gt(n),wt(i)}}const Et=new Map;function Er(t,{target:e,anchor:r,props:n={},events:i,context:s,intro:a=!0}){we();var o=new Set,l=d=>{for(var h=0;h<d.length;h++){var _=d[h];if(!o.has(_)){o.add(_);var v=Wn(_);e.addEventListener(_,At,{passive:v});var m=Et.get(_);m===void 0?(document.addEventListener(_,At,{passive:v}),Et.set(_,1)):Et.set(_,m+1)}}};l(qr(mr)),$e.add(l);var u=void 0,f=An(()=>{var d=r??e.appendChild(me());return Mn(()=>{if(s){qe({});var h=B;h.c=s}i&&(n.$$events=i),T&&be(d,null),u=t(d,n)||{},T&&(g.nodes_end=x),s&&Ue()}),()=>{for(var h of o){e.removeEventListener(h,At);var _=Et.get(h);--_===0?(document.removeEventListener(h,At),Et.delete(h)):Et.set(h,_)}$e.delete(l),d!==r&&d.parentNode?.removeChild(d)}});return Ee.set(u,f),u}let Ee=new WeakMap;function Kn(t,e){const r=Ee.get(t);return r?(Ee.delete(t),r(e)):Promise.resolve()}function zn(t,e){Cn(()=>{var r=t.getRootNode(),n=r.host?r:r.head??r.ownerDocument.head;if(!n.querySelector("#"+e.hash)){const i=document.createElement("style");i.id=e.hash,i.textContent=e.code,n.appendChild(i)}})}function Zn(t,e){return t==null?null:String(t)}function Se(t,e,r,n){var i=t.__style;if(T||i!==e){var s=Zn(e);(!T||s!==t.getAttribute("style"))&&(s==null?t.removeAttribute("style"):t.style.cssText=s),t.__style=e}return n}const Qn=Symbol("is custom element"),ti=Symbol("is html");function ei(t,e,r,n){var i=ri(t);T&&(i[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName==="LINK")||i[e]!==(i[e]=r)&&(e==="loading"&&(t[Xr]=r),r==null?t.removeAttribute(e):typeof r!="string"&&Sr(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function U(t,e,r){var n=w,i=g;let s=T;T&&gt(!1),F(null),G(null);try{e!=="style"&&(Ne.has(t.getAttribute("is")||t.nodeName)||!customElements||customElements.get(t.getAttribute("is")||t.tagName.toLowerCase())?Sr(t).includes(e):r&&typeof r=="object")?t[e]=r:ei(t,e,r==null?r:String(r))}finally{F(n),G(i),s&&gt(!0)}}function ri(t){return t.__attributes??={[Qn]:t.nodeName.includes("-"),[ti]:t.namespaceURI===Dr}}var Ne=new Map;function Sr(t){var e=t.getAttribute("is")||t.nodeName,r=Ne.get(e);if(r)return r;Ne.set(e,r=[]);for(var n,i=t,s=Element.prototype;s!==i;){n=Ur(i);for(var a in n)n[a].set&&r.push(a);i=Ae(i)}return r}function Nr(t,e,r,n){var i=n,s=!0,a=()=>(s&&(s=!1,i=n),i),o;o=t[e],o===void 0&&n!==void 0&&(o=a());var l;l=()=>{var h=t[e];return h===void 0?a():(s=!0,h)};var u=!1,f=fe(()=>(u=!1,l())),d=g;return(function(h,_){if(arguments.length>0){const v=_?c(f):h;return E(f,v),u=!0,i!==void 0&&(i=v),h}return ut&&u||(d.f&nt)!==0?f.v:c(f)})}function ni(t){return new ii(t)}class ii{#e;#t;constructor(e){var r=new Map,n=(s,a)=>{var o=bn(a,!1,!1);return r.set(s,o),o};const i=new Proxy({...e.props||{},$$events:{}},{get(s,a){return c(r.get(a)??n(a,Reflect.get(s,a)))},has(s,a){return a===Wr?!0:(c(r.get(a)??n(a,Reflect.get(s,a))),Reflect.has(s,a))},set(s,a,o){return E(r.get(a)??n(a,o),o),Reflect.set(s,a,o)}});this.#t=(e.hydrate?Xn:br)(e.component,{target:e.target,anchor:e.anchor,props:i,context:e.context,intro:e.intro??!1,recover:e.recover}),(!e?.props?.$$host||e.sync===!1)&&he(),this.#e=i.$$events;for(const s of Object.keys(this.#t))s==="$set"||s==="$destroy"||s==="$on"||_t(this,s,{get(){return this.#t[s]},set(a){this.#t[s]=a},enumerable:!0});this.#t.$set=s=>{Object.assign(i,s)},this.#t.$destroy=()=>{Kn(this.#t)}}$set(e){this.#t.$set(e)}$on(e,r){this.#e[e]=this.#e[e]||[];const n=(...i)=>r.call(this,...i);return this.#e[e].push(n),()=>{this.#e[e]=this.#e[e].filter(i=>i!==n)}}$destroy(){this.#t.$destroy()}}let Tr;typeof HTMLElement=="function"&&(Tr=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;constructor(t,e,r){super(),this.$$ctor=t,this.$$s=e,r&&this.attachShadow({mode:"open"})}addEventListener(t,e,r){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){const n=this.$$c.$on(t,e);this.$$l_u.set(e,n)}super.addEventListener(t,e,r)}removeEventListener(t,e,r){if(super.removeEventListener(t,e,r),this.$$c){const n=this.$$l_u.get(e);n&&(n(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(n){return i=>{const s=document.createElement("slot");n!=="default"&&(s.name=n),$r(i,s)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const e={},r=si(this);for(const n of this.$$s)n in r&&(n==="default"&&!this.$$d.children?(this.$$d.children=t(n),e.default=!0):e[n]=t(n));for(const n of this.attributes){const i=this.$$g_p(n.name);i in this.$$d||(this.$$d[i]=Gt(i,n.value,this.$$p_d,"toProp"))}for(const n in this.$$p_d)!(n in this.$$d)&&this[n]!==void 0&&(this.$$d[n]=this[n],delete this[n]);this.$$c=ni({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$host:this}}),this.$$me=Rn(()=>{In(()=>{this.$$r=!0;for(const n of Lt(this.$$c)){if(!this.$$p_d[n]?.reflect)continue;this.$$d[n]=this.$$c[n];const i=Gt(n,this.$$d[n],this.$$p_d,"toAttribute");i==null?this.removeAttribute(this.$$p_d[n].attribute||n):this.setAttribute(this.$$p_d[n].attribute||n,i)}this.$$r=!1})});for(const n in this.$$l)for(const i of this.$$l[n]){const s=this.$$c.$on(n,i);this.$$l_u.set(i,s)}this.$$l={}}}attributeChangedCallback(t,e,r){this.$$r||(t=this.$$g_p(t),this.$$d[t]=Gt(t,r,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(t){return Lt(this.$$p_d).find(e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t)||t}});function Gt(t,e,r,n){const i=r[t]?.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!r[t])return e;if(n==="toAttribute")switch(i){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(i){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function si(t){const e={};return t.childNodes.forEach(r=>{e[r.slot||"default"]=!0}),e}function li(t,e,r,n,i,s){let a=class extends Tr{constructor(){super(t,r,i),this.$$p_d=e}static get observedAttributes(){return Lt(e).map(o=>(e[o].attribute||o).toLowerCase())}};return Lt(e).forEach(o=>{_t(a.prototype,o,{get(){return this.$$c&&o in this.$$c?this.$$c[o]:this.$$d[o]},set(l){l=Gt(o,l,e),this.$$d[o]=l;var u=this.$$c;if(u){var f=ht(u,o)?.get;f?u[o]=l:u.$set({[o]:l})}}})}),n.forEach(o=>{_t(a.prototype,o,{get(){return this.$$c?.[o]}})}),t.element=a,a}const xr={version:"0.60.5"};function ai(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var St={},Te,Or;function oi(){if(Or)return Te;Or=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,o=/^\s+|\s+$/g,l=`
3
+ `,u="/",f="*",d="",h="comment",_="declaration";Te=function(m,L){if(typeof m!="string")throw new TypeError("First argument must be a string");if(!m)return[];L=L||{};var C=1,S=1;function Jt($){var p=$.match(e);p&&(C+=p.length);var A=$.lastIndexOf(l);S=~A?$.length-A:S+$.length}function Vt(){var $={line:C,column:S};return function(p){return p.position=new Wt($),Kt(),p}}function Wt($){this.start=$,this.end={line:C,column:S},this.source=L.source}Wt.prototype.content=m;function Xt($){var p=new Error(L.source+":"+C+":"+S+": "+$);if(p.reason=$,p.filename=L.source,p.line=C,p.column=S,p.source=m,!L.silent)throw p}function dt($){var p=$.exec(m);if(p){var A=p[0];return Jt(A),m=m.slice(A.length),p}}function Kt(){dt(r)}function zt($){var p;for($=$||[];p=Ct();)p!==!1&&$.push(p);return $}function Ct(){var $=Vt();if(!(u!=m.charAt(0)||f!=m.charAt(1))){for(var p=2;d!=m.charAt(p)&&(f!=m.charAt(p)||u!=m.charAt(p+1));)++p;if(p+=2,d===m.charAt(p-1))return Xt("End of comment missing");var A=m.slice(2,p-2);return S+=2,Jt(A),m=m.slice(p),S+=2,$({type:h,comment:A})}}function Pt(){var $=Vt(),p=dt(n);if(p){if(Ct(),!dt(i))return Xt("property missing ':'");var A=dt(s),It=$({type:_,property:v(p[0].replace(t,d)),value:A?v(A[0].replace(t,d)):d});return dt(a),It}}function Zt(){var $=[];zt($);for(var p;p=Pt();)p!==!1&&($.push(p),zt($));return $}return Kt(),Zt()};function v(m){return m?m.replace(o,d):d}return Te}var kr;function ui(){if(kr)return St;kr=1;var t=St&&St.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(St,"__esModule",{value:!0}),St.default=r;var e=t(oi());function r(n,i){var s=null;if(!n||typeof n!="string")return s;var a=(0,e.default)(n),o=typeof i=="function";return a.forEach(function(l){if(l.type==="declaration"){var u=l.property,f=l.value;o?i(u,f,l):f&&(s=s||{},s[u]=f)}}),s}return St}var fi=ui();const Rr=ai(fi);Rr.default;function Ar(t){const e=t?.repoName.split("/")?.[1]||t?.repoName;if(!e)throw new Error("wrong componentPath "+t?.repoName);if(!t?.version)throw new Error("wrong version "+t?.version);const r=t?.iifePath||"main.iife.js";if(!document.getElementById(e+"-script"))try{const n=document.createElement("script");if(n.id=e+"-script",n.src=`https://cdn.jsdelivr.net/npm/${t.repoName}@${t.version}/${r}`,t?.local)n.src=`${t.local}`;else if(location.href.includes("localhost:6006")){const i=e.split("-")[0];n.src=`http://localhost:6006/webcomponents/${e.replace(i+"-","")}/${r}`}document.head.appendChild(n)}catch(n){console.warn(n)}}var ci=(t,e)=>e("eraser"),di=(t,e)=>e("select"),_i=(t,e)=>e("draw"),hi=(t,e)=>e(),vi=(t,e)=>e(),pi=(t,e)=>e(),gi=Jn('<div part="controller" id="controller" class="svelte-14wiqdf"><button>clear</button> <button>select</button> <button>draw</button> <button>undo</button> <button>redo</button> <button>save</button> <button>brush</button> <br/>load:<hb-input-file></hb-input-file> insert:<hb-input-file></hb-input-file></div> <div part="paper-container" id="paper-container" style="position:relative" class="svelte-14wiqdf"><hb-stylus-paper></hb-stylus-paper></div>',3);const wi={hash:"svelte-14wiqdf",code:'@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");:host {font-family:"Roboto", sans-serif;position:absolute;width:100%;height:100%;display:block;display:grid;grid-template-areas:"header" "paper";grid-template-columns:1fr;grid-template-rows:auto 1fr;}#controller.svelte-14wiqdf {grid-area:header;}#paper-container.svelte-14wiqdf {grid-area:paper;background:green;}'};function Cr(t,e){qe(e,!0),zn(t,wi);let r=Nr(e,"id",7,""),n=Nr(e,"load_draw"),i=b("draw");mt({});let s=b(""),a=b(""),o=b(0),l=b(void 0),u=b(!1),f=b(void 0),d=b(void 0),h=b(void 0),_=b(void 0),v=Ge(()=>(c(l)===0||c(l))&&c(l)<c(o)),m=Ge(()=>(c(o)||c(o)===0)&&c(u)&&(!c(l)||c(l)!==-1)&&(!c(_)||c(_)<c(o)&&(!c(l)||c(l)<c(_))));kn(()=>{if(typeof n()=="string"&&n()?.length)try{n(JSON.parse(n()))}catch(y){console.error("error parsing json",y)}}),Ar({repoName:"@htmlbricks/hb-stylus-paper",version:xr.version}),Ar({repoName:"@htmlbricks/hb-input-file",version:xr.version});function L(y,rt){var X="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(y)),j=document.createElement("a");j.setAttribute("href",X),j.setAttribute("download",rt),document.body.appendChild(j),j.click(),j.remove()}function C(y){E(i,y,!0)}function S(){console.log("ch",c(o),c(l)),c(o)>=0&&(!c(l)||c(l)>-1)&&(E(l,c(l)||c(l)===0?c(l)-1:c(o)-1,!0),console.log("undo",c(o),c(l)))}function Jt(){console.log(c(o),c(l)),(c(l)||c(l)===0)&&c(l)<=c(o)&&(En(l),console.log("redo",c(o),c(l)))}function Vt(y){c(u)||E(u,!0),console.log("h",y),E(o,y.index-1),y.start_index&&E(_,y.start_index,!0),E(l,void 0)}function Wt(){E(f,{name:"test",type:"json"},!0)}function Xt(y){const rt=y.value?.name;if(rt){const X=new FileReader;X.readAsDataURL(y.value),X.onload=function(j){try{if(console.log("insert file",j.target,j.target?.result),j.target?.result){const yi=j.target.result.toString().split(";")[0].split("/")[1];E(d,{base64:j.target.result.toString(),type:yi,name:rt},!0)}}catch{console.error("error loading file")}},X.onerror=function(j){console.error("error reading file")}}}function dt(y){console.log("save",y),E(f,void 0),L(y,y?.name+".json")}function Kt(y){if(console.log("file",y),y.value?.name){const rt=new FileReader;rt.readAsText(y.value,"UTF-8"),rt.onload=function(X){if(X?.target?.result?.toString())try{n(JSON.parse(X.target.result.toString()))}catch{console.error("error loading file")}},rt.onerror=function(X){console.error("error reading file")}}}var zt={get id(){return r()},set id(y=""){r(y),he()},get load_draw(){return n()},set load_draw(y){n(y),he()}},Ct=gi(),Pt=Sn(Ct),Zt=ir(Pt);Zt.__click=[ci,C];var $=J(Zt,2);$.__click=[di,C];var p=J($,2);p.__click=[_i,C];var A=J(p,2);A.__click=[hi,S];var It=J(A,2);It.__click=[vi,Jt];var xe=J(It,2);xe.__click=[pi,Wt];var Pr=J(xe,2),Mt=J(Pr,4);U(Mt,"id","loadfile"),Se(Mt,c(a)),U(Mt,"schemaentry",JSON.stringify({label:"ciao",id:"xxxxxxx"}));var Qt=J(Mt,2);U(Qt,"id","insertfile"),Se(Qt,c(a)),U(Qt,"schemaentry",JSON.stringify({label:"ciao"})),De(Pt);var Ir=J(Pt,2),H=ir(Ir);return U(H,"id","stylus-paper"),ot(()=>U(H,"goto",c(l))),Se(H,c(s)),U(H,"background_color","green"),ot(()=>U(H,"mode",c(i))),ot(()=>U(H,"save_as",c(f)?JSON.stringify(c(f)):"")),ot(()=>U(H,"load_draw",n()?JSON.stringify(n()):null)),ot(()=>U(H,"insert_image",c(d)?JSON.stringify(c(d)):null)),ot(()=>U(H,"insert_text",c(h)?JSON.stringify(c(h)):null)),De(Ir),ot(()=>{A.disabled=!c(m),It.disabled=!c(v),xe.disabled=!c(m),Pr.disabled=c(i)!=="draw"}),Ht("setVal",Mt,y=>Kt(y.detail)),Ht("setVal",Qt,y=>Xt(y.detail)),Ht("historyIndex",H,y=>Vt(y.detail)),Ht("save",H,y=>dt(y.detail)),$r(t,Ct),Ue(zt)}Hn(["click"]),customElements.define("hb-stylus-notebook",li(Cr,{id:{},load_draw:{}},[],[],!0)),Oe.Component=Cr,Object.defineProperty(Oe,Symbol.toStringTag,{value:"Module"})})(this["stylus-notebook"]=this["stylus-notebook"]||{});
4
4
  //# sourceMappingURL=main.iife.js.map