@htmlbricks/hb-stylus-paper 0.65.23 → 0.66.1
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 +2 -2
- package/main.iife.js.map +1 -1
- package/manifest.json +1 -1
- package/package.json +1 -1
package/main.iife.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(function($r){"use strict";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add("5");const Hi=1,Bi=2,Vi=16,Wi=1,Ui=4,Ji=8,Gi=16,Zi=2,Sr="[",Dn="[!",Un="]",Jt={},de=Symbol(),Ki="http://www.w3.org/1999/xhtml",Jn=!1;var Tr=Array.isArray,Qi=Array.prototype.indexOf,Gn=Array.from,An=Object.keys,In=Object.defineProperty,It=Object.getOwnPropertyDescriptor,es=Object.getOwnPropertyDescriptors,ts=Object.prototype,ns=Array.prototype,Dr=Object.getPrototypeOf,Ar=Object.isExtensible;function rs(e){for(var t=0;t<e.length;t++)e[t]()}function Ir(){var e,t,n=new Promise((i,s)=>{e=i,t=s});return{promise:n,resolve:e,reject:t}}const ae=2,Zn=4,Kn=8,ot=16,lt=32,yt=64,Mn=128,Be=512,he=1024,$e=2048,ft=4096,Ae=8192,ut=16384,On=32768,Gt=65536,Mr=1<<17,Or=1<<18,Mt=1<<19,is=1<<20,Ot=32768,Qn=1<<21,er=1<<22,bt=1<<23,kn=Symbol("$state"),kr=Symbol("legacy props"),ss=Symbol(""),Zt=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},tr=3,Kt=8;function as(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function os(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function ls(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function fs(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function us(e){throw new Error("https://svelte.dev/e/effect_orphan")}function cs(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function ds(){throw new Error("https://svelte.dev/e/hydration_failed")}function hs(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function vs(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function ps(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function _s(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function gs(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function Nn(e){console.warn("https://svelte.dev/e/hydration_mismatch")}function ms(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let H=!1;function ct(e){H=e}let L;function Ie(e){if(e===null)throw Nn(),Jt;return L=e}function Pn(){return Ie(et(L))}function xt(e){if(H){if(et(L)!==null)throw Nn(),Jt;L=e}}function ws(e=1){if(H){for(var t=e,n=L;t--;)n=et(n);L=n}}function Cn(e=!0){for(var t=0,n=L;;){if(n.nodeType===Kt){var i=n.data;if(i===Un){if(t===0)return n;t-=1}else(i===Sr||i===Dn)&&(t+=1)}var s=et(n);e&&n.remove(),n=s}}function Nr(e){if(!e||e.nodeType!==Kt)throw Nn(),Jt;return e.data}function Pr(e){return e===this.v}function ys(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Cr(e){return!ys(e,this.v)}let bs=!1,Me=null;function Qt(e){Me=e}function Rr(e,t=!1,n){Me={p:Me,i:!1,c:null,e:null,s:e,x:null,l:null}}function qr(e){var t=Me,n=t.e;if(n!==null){t.e=null;for(var i of n)oi(i)}return e!==void 0&&(t.x=e),t.i=!0,Me=t.p,e??{}}function Lr(){return!0}let kt=[];function jr(){var e=kt;kt=[],rs(e)}function nr(e){if(kt.length===0&&!fn){var t=kt;queueMicrotask(()=>{t===kt&&jr()})}kt.push(e)}function xs(){for(;kt.length>0;)jr()}function Yr(e){var t=Y;if(t===null)return q.f|=bt,e;if((t.f&On)===0){if((t.f&Mn)===0)throw e;t.b.error(e)}else en(e,t)}function en(e,t){for(;t!==null;){if((t.f&Mn)!==0)try{t.b.error(e);return}catch(n){e=n}t=t.parent}throw e}const Rn=new Set;let Z=null,Le=null,je=[],qn=null,rr=!1,fn=!1;class Ve{committed=!1;current=new Map;previous=new Map;#t=new Set;#e=new Set;#n=0;#r=0;#l=null;#s=[];#i=[];skipped_effects=new Set;is_fork=!1;is_deferred(){return this.is_fork||this.#r>0}process(t){je=[],this.apply();var n={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const i of t)this.#a(i,n);this.is_fork||this.#u(),this.is_deferred()?(this.#o(n.effects),this.#o(n.render_effects),this.#o(n.block_effects)):(Z=null,Xr(n.render_effects),Xr(n.effects),this.#l?.resolve()),Le=null}#a(t,n){t.f^=he;for(var i=t.first;i!==null;){var s=i.f,a=(s&(lt|yt))!==0,l=a&&(s&he)!==0,o=l||(s&Ae)!==0||this.skipped_effects.has(i);if((i.f&Mn)!==0&&i.b?.is_pending()&&(n={parent:n,effect:i,effects:[],render_effects:[],block_effects:[]}),!o&&i.fn!==null){a?i.f^=he:(s&Zn)!==0?n.effects.push(i):vn(i)&&((i.f&ot)!==0&&n.block_effects.push(i),pn(i));var f=i.first;if(f!==null){i=f;continue}}var c=i.parent;for(i=i.next;i===null&&c!==null;)c===n.effect&&(this.#o(n.effects),this.#o(n.render_effects),this.#o(n.block_effects),n=n.parent),i=c.next,c=c.parent}}#o(t){for(const n of t)((n.f&$e)!==0?this.#s:this.#i).push(n),this.#f(n.deps),pe(n,he)}#f(t){if(t!==null)for(const n of t)(n.f&ae)===0||(n.f&Ot)===0||(n.f^=Ot,this.#f(n.deps))}capture(t,n){this.previous.has(t)||this.previous.set(t,n),(t.f&bt)===0&&(this.current.set(t,t.v),Le?.set(t,t.v))}activate(){Z=this,this.apply()}deactivate(){Z===this&&(Z=null,Le=null)}flush(){if(this.activate(),je.length>0){if(Fr(),Z!==null&&Z!==this)return}else this.#n===0&&this.process([]);this.deactivate()}discard(){for(const t of this.#e)t(this);this.#e.clear()}#u(){if(this.#r===0){for(const t of this.#t)t();this.#t.clear()}this.#n===0&&this.#c()}#c(){if(Rn.size>1){this.previous.clear();var t=Le,n=!0,i={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const a of Rn){if(a===this){n=!1;continue}const l=[];for(const[f,c]of this.current){if(a.current.has(f))if(n&&c!==a.current.get(f))a.current.set(f,c);else continue;l.push(f)}if(l.length===0)continue;const o=[...a.current.keys()].filter(f=>!this.current.has(f));if(o.length>0){var s=je;je=[];const f=new Set,c=new Map;for(const h of l)zr(h,o,f,c);if(je.length>0){Z=a,a.apply();for(const h of je)a.#a(h,i);a.deactivate()}je=s}}Z=null,Le=t}this.committed=!0,Rn.delete(this)}increment(t){this.#n+=1,t&&(this.#r+=1)}decrement(t){this.#n-=1,t&&(this.#r-=1),this.revive()}revive(){for(const t of this.#s)pe(t,$e),Nt(t);for(const t of this.#i)pe(t,ft),Nt(t);this.#s=[],this.#i=[],this.flush()}oncommit(t){this.#t.add(t)}ondiscard(t){this.#e.add(t)}settled(){return(this.#l??=Ir()).promise}static ensure(){if(Z===null){const t=Z=new Ve;Rn.add(Z),fn||Ve.enqueue(()=>{Z===t&&t.flush()})}return Z}static enqueue(t){nr(t)}apply(){}}function ve(e){var t=fn;fn=!0;try{for(var n;;){if(xs(),je.length===0&&(Z?.flush(),je.length===0))return qn=null,n;Fr()}}finally{fn=t}}function Fr(){var e=St;rr=!0;var t=null;try{var n=0;for(Yn(!0);je.length>0;){var i=Ve.ensure();if(n++>1e3){var s,a;Es()}i.process(je),Et.clear()}}finally{rr=!1,Yn(e),qn=null}}function Es(){try{cs()}catch(e){en(e,qn)}}let dt=null;function Xr(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var i=e[n++];if((i.f&(ut|Ae))===0&&vn(i)&&(dt=new Set,pn(i),i.deps===null&&i.first===null&&i.nodes_start===null&&(i.teardown===null&&i.ac===null?ci(i):i.fn=null),dt?.size>0)){Et.clear();for(const s of dt){if((s.f&(ut|Ae))!==0)continue;const a=[s];let l=s.parent;for(;l!==null;)dt.has(l)&&(dt.delete(l),a.push(l)),l=l.parent;for(let o=a.length-1;o>=0;o--){const f=a[o];(f.f&(ut|Ae))===0&&pn(f)}}dt.clear()}}dt=null}}function zr(e,t,n,i){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const s of e.reactions){const a=s.f;(a&ae)!==0?zr(s,t,n,i):(a&(er|ot))!==0&&(a&$e)===0&&Hr(s,t,i)&&(pe(s,$e),Nt(s))}}function Hr(e,t,n){const i=n.get(e);if(i!==void 0)return i;if(e.deps!==null)for(const s of e.deps){if(t.includes(s))return!0;if((s.f&ae)!==0&&Hr(s,t,n))return n.set(s,!0),!0}return n.set(e,!1),!1}function Nt(e){for(var t=qn=e;t.parent!==null;){t=t.parent;var n=t.f;if(rr&&t===Y&&(n&ot)!==0&&(n&Or)===0)return;if((n&(yt|lt))!==0){if((n&he)===0)return;t.f^=he}}je.push(t)}function $s(e){let t=0,n=Pt(0),i;return()=>{jn()&&(r(n),li(()=>(t===0&&(i=dr(()=>e(()=>dn(n)))),t+=1,()=>{nr(()=>{t-=1,t===0&&(i?.(),i=void 0,dn(n))})})))}}var Ss=Gt|Mt|Mn;function Ts(e,t,n){new Ds(e,t,n)}class Ds{parent;#t=!1;#e;#n=H?L:null;#r;#l;#s;#i=null;#a=null;#o=null;#f=null;#u=null;#c=0;#d=0;#v=!1;#h=null;#w=$s(()=>(this.#h=Pt(this.#c),()=>{this.#h=null}));constructor(t,n,i){this.#e=t,this.#r=n,this.#l=i,this.parent=Y.b,this.#t=!!this.#r.pending,this.#s=fr(()=>{if(Y.b=this,H){const a=this.#n;Pn(),a.nodeType===Kt&&a.data===Dn?this.#b():this.#y()}else{var s=this.#g();try{this.#i=Ye(()=>i(s))}catch(a){this.error(a)}this.#d>0?this.#_():this.#t=!1}return()=>{this.#u?.remove()}},Ss),H&&(this.#e=L)}#y(){try{this.#i=Ye(()=>this.#l(this.#e))}catch(t){this.error(t)}this.#t=!1}#b(){const t=this.#r.pending;t&&(this.#a=Ye(()=>t(this.#e)),Ve.enqueue(()=>{var n=this.#g();this.#i=this.#p(()=>(Ve.ensure(),Ye(()=>this.#l(n)))),this.#d>0?this.#_():(tn(this.#a,()=>{this.#a=null}),this.#t=!1)}))}#g(){var t=this.#e;return this.#t&&(this.#u=We(),this.#e.before(this.#u),t=this.#u),t}is_pending(){return this.#t||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!this.#r.pending}#p(t){var n=Y,i=q,s=Me;rt(this.#s),Se(this.#s),Qt(this.#s.ctx);try{return t()}catch(a){return Yr(a),null}finally{rt(n),Se(i),Qt(s)}}#_(){const t=this.#r.pending;this.#i!==null&&(this.#f=document.createDocumentFragment(),this.#f.append(this.#u),vi(this.#i,this.#f)),this.#a===null&&(this.#a=Ye(()=>t(this.#e)))}#m(t){if(!this.has_pending_snippet()){this.parent&&this.parent.#m(t);return}this.#d+=t,this.#d===0&&(this.#t=!1,this.#a&&tn(this.#a,()=>{this.#a=null}),this.#f&&(this.#e.before(this.#f),this.#f=null))}update_pending_count(t){this.#m(t),this.#c+=t,this.#h&&un(this.#h,this.#c)}get_effect_pending(){return this.#w(),r(this.#h)}error(t){var n=this.#r.onerror;let i=this.#r.failed;if(this.#v||!n&&!i)throw t;this.#i&&(_e(this.#i),this.#i=null),this.#a&&(_e(this.#a),this.#a=null),this.#o&&(_e(this.#o),this.#o=null),H&&(Ie(this.#n),ws(),Ie(Cn()));var s=!1,a=!1;const l=()=>{if(s){ms();return}s=!0,a&&gs(),Ve.ensure(),this.#c=0,this.#o!==null&&tn(this.#o,()=>{this.#o=null}),this.#t=this.has_pending_snippet(),this.#i=this.#p(()=>(this.#v=!1,Ye(()=>this.#l(this.#e)))),this.#d>0?this.#_():this.#t=!1};var o=q;try{Se(null),a=!0,n?.(t,l),a=!1}catch(f){en(f,this.#s&&this.#s.parent)}finally{Se(o)}i&&nr(()=>{this.#o=this.#p(()=>{Ve.ensure(),this.#v=!0;try{return Ye(()=>{i(this.#e,()=>t,()=>l)})}catch(f){return en(f,this.#s.parent),null}finally{this.#v=!1}})})}}function As(e,t,n){for(var i=[],s=t.length,a=0;a<s;a++)ur(t[a].e,i,!0);di(i,()=>{var l=i.length===0&&n!==null;if(l){var o=n,f=o.parentNode;ri(f),f.append(o),e.items.clear(),Qe(e,t[0].prev,t[s-1].next)}for(var c=0;c<s;c++){var h=t[c];l||(e.items.delete(h.k),Qe(e,h.prev,h.next)),_e(h.e,!l)}e.first===t[0]&&(e.first=t[0].prev)})}function Br(e,t,n,i,s,a=null){var l=e,o=new Map,f=null;H&&Pn();var c=null,h=Vr(()=>{var x=n();return Tr(x)?x:x==null?[]:Gn(x)}),_,p=!0;function g(){Is(E,_,l,t,i),c!==null&&(_.length===0?(c.fragment?(l.before(c.fragment),c.fragment=null):cr(c.effect),v.first=c.effect):tn(c.effect,()=>{c=null}))}var v=fr(()=>{_=r(h);var x=_.length;let Q=!1;if(H){var D=Nr(l)===Dn;D!==(x===0)&&(l=Cn(),Ie(l),ct(!1),Q=!0)}for(var V=new Set,re=Z,P=null,ie=ii(),y=0;y<x;y+=1){H&&L.nodeType===Kt&&L.data===Un&&(l=L,Q=!0,ct(!1));var fe=_[y],Te=i(fe,y),z=p?null:o.get(Te);z?(un(z.v,fe),z.i=y,ie&&re.skipped_effects.delete(z.e)):(z=Ms(p?l:null,P,fe,Te,y,s,t,n),p&&(z.o=!0,P===null?f=z:P.next=z,P=z),o.set(Te,z)),V.add(Te)}if(x===0&&a&&!c)if(p)c={fragment:null,effect:Ye(()=>a(l))};else{var we=document.createDocumentFragment(),ze=We();we.append(ze),c={fragment:we,effect:Ye(()=>a(ze))}}if(H&&x>0&&Ie(Cn()),!p)if(ie){for(const[$,ye]of o)V.has($)||re.skipped_effects.add(ye.e);re.oncommit(g),re.ondiscard(()=>{})}else g();Q&&ct(!0),r(h)}),E={effect:v,items:o,first:f};p=!1,H&&(l=L)}function Is(e,t,n,i,s){var a=t.length,l=e.items,o=e.first,f,c=null,h=[],_=[],p,g,v,E;for(E=0;E<a;E+=1){if(p=t[E],g=s(p,E),v=l.get(g),e.first??=v,!v.o){v.o=!0;var x=c?c.next:o;Qe(e,c,v),Qe(e,v,x),ir(v,x,n),c=v,h=[],_=[],o=c.next;continue}if((v.e.f&Ae)!==0&&cr(v.e),v!==o){if(f!==void 0&&f.has(v)){if(h.length<_.length){var Q=_[0],D;c=Q.prev;var V=h[0],re=h[h.length-1];for(D=0;D<h.length;D+=1)ir(h[D],Q,n);for(D=0;D<_.length;D+=1)f.delete(_[D]);Qe(e,V.prev,re.next),Qe(e,c,V),Qe(e,re,Q),o=Q,c=re,E-=1,h=[],_=[]}else f.delete(v),ir(v,o,n),Qe(e,v.prev,v.next),Qe(e,v,c===null?e.first:c.next),Qe(e,c,v),c=v;continue}for(h=[],_=[];o!==null&&o.k!==g;)(o.e.f&Ae)===0&&(f??=new Set).add(o),_.push(o),o=o.next;if(o===null)continue;v=o}h.push(v),c=v,o=v.next}if(o!==null||f!==void 0){for(var P=f===void 0?[]:Gn(f);o!==null;)(o.e.f&Ae)===0&&P.push(o),o=o.next;var ie=P.length;if(ie>0){var y=null;As(e,P,y)}}}function Ms(e,t,n,i,s,a,l,o){var f=(l&Hi)!==0,c=(l&Vi)===0,h=f?c?Gr(n,!1,!1):Pt(n):n,_=(l&Bi)===0?s:Pt(s),p={i:_,v:h,k:i,a:null,e:null,o:!1,prev:t,next:null};try{if(e===null){var g=document.createDocumentFragment();g.append(e=We())}return p.e=Ye(()=>a(e,h,_,o)),t!==null&&(t.next=p),p}finally{}}function ir(e,t,n){for(var i=e.next?e.next.e.nodes_start:n,s=t?t.e.nodes_start:n,a=e.e.nodes_start;a!==null&&a!==i;){var l=et(a);s.before(a),a=l}}function Qe(e,t,n){t===null?(e.first=n,e.effect.first=n&&n.e):(t.e.next&&(t.e.next.prev=null),t.next=n,t.e.next=n&&n.e),n===null?e.effect.last=t&&t.e:(n.e.prev&&(n.e.prev.next=null),n.prev=t,n.e.prev=t&&t.e)}function Os(e,t,n,i){const s=sr;if(n.length===0&&e.length===0){i(t.map(s));return}var a=Z,l=Y,o=ks();function f(){Promise.all(n.map(c=>Ns(c))).then(c=>{o();try{i([...t.map(s),...c])}catch(h){(l.f&ut)===0&&en(h,l)}a?.deactivate(),Ln()}).catch(c=>{en(c,l)})}e.length>0?Promise.all(e).then(()=>{o();try{return f()}finally{a?.deactivate(),Ln()}}):f()}function ks(){var e=Y,t=q,n=Me,i=Z;return function(a=!0){rt(e),Se(t),Qt(n),a&&i?.activate()}}function Ln(){rt(null),Se(null),Qt(null)}function sr(e){var t=ae|$e,n=q!==null&&(q.f&ae)!==0?q:null;return Y!==null&&(Y.f|=Mt),{ctx:Me,deps:null,effects:null,equals:Pr,f:t,fn:e,reactions:null,rv:0,v:de,wv:0,parent:n??Y,ac:null}}function Ns(e,t){let n=Y;n===null&&os();var i=n.b,s=void 0,a=Pt(de),l=!q,o=new Map;return Xs(()=>{var f=Ir();s=f.promise;try{Promise.resolve(e()).then(f.resolve,f.reject).then(()=>{c===Z&&c.committed&&c.deactivate(),Ln()})}catch(p){f.reject(p),Ln()}var c=Z;if(l){var h=!i.is_pending();i.update_pending_count(1),c.increment(h),o.get(c)?.reject(Zt),o.delete(c),o.set(c,f)}const _=(p,g=void 0)=>{if(c.activate(),g)g!==Zt&&(a.f|=bt,un(a,g));else{(a.f&bt)!==0&&(a.f^=bt),un(a,p);for(const[v,E]of o){if(o.delete(v),v===c)break;E.reject(Zt)}}l&&(i.update_pending_count(-1),c.decrement(h))};f.promise.then(_,p=>_(null,p||"unknown"))}),Ls(()=>{for(const f of o.values())f.reject(Zt)}),new Promise(f=>{function c(h){function _(){h===s?f(a):c(s)}h.then(_,_)}c(s)})}function Vr(e){const t=sr(e);return t.equals=Cr,t}function Wr(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)_e(t[n])}}function Ps(e){for(var t=e.parent;t!==null;){if((t.f&ae)===0)return(t.f&ut)===0?t:null;t=t.parent}return null}function ar(e){var t,n=Y;rt(Ps(e));try{e.f&=~Ot,Wr(e),t=yi(e)}finally{rt(n)}return t}function Ur(e){var t=ar(e);if(e.equals(t)||(Z?.is_fork||(e.v=t),e.wv=mi()),!Rt)if(Le!==null)jn()&&Le.set(e,t);else{var n=(e.f&Be)===0?ft:he;pe(e,n)}}let or=new Set;const Et=new Map;let Jr=!1;function Pt(e,t){var n={f:0,v:e,reactions:null,equals:Pr,rv:0,wv:0};return n}function A(e,t){const n=Pt(e);return Bs(n),n}function Gr(e,t=!1,n=!0){const i=Pt(e);return t||(i.equals=Cr),i}function d(e,t,n=!1){q!==null&&(!nt||(q.f&Mr)!==0)&&Lr()&&(q.f&(ae|ot|er|Mr))!==0&&!vt?.includes(e)&&_s();let i=n?ht(t):t;return un(e,i)}function un(e,t){if(!e.equals(t)){var n=e.v;Rt?Et.set(e,t):Et.set(e,n),e.v=t;var i=Ve.ensure();i.capture(e,n),(e.f&ae)!==0&&((e.f&$e)!==0&&ar(e),pe(e,(e.f&Be)!==0?he:ft)),e.wv=mi(),Zr(e,$e),Y!==null&&(Y.f&he)!==0&&(Y.f&(lt|yt))===0&&(Fe===null?Vs([e]):Fe.push(e)),!i.is_fork&&or.size>0&&!Jr&&Cs()}return t}function Cs(){Jr=!1;var e=St;Yn(!0);const t=Array.from(or);try{for(const n of t)(n.f&he)!==0&&pe(n,ft),vn(n)&&pn(n)}finally{Yn(e)}or.clear()}function cn(e,t=1){var n=r(e),i=t===1?n++:n--;return d(e,n),i}function dn(e){d(e,e.v+1)}function Zr(e,t){var n=e.reactions;if(n!==null)for(var i=n.length,s=0;s<i;s++){var a=n[s],l=a.f,o=(l&$e)===0;if(o&&pe(a,t),(l&ae)!==0){var f=a;Le?.delete(f),(l&Ot)===0&&(l&Be&&(a.f|=Ot),Zr(f,ft))}else o&&((l&ot)!==0&&dt!==null&&dt.add(a),Nt(a))}}function ht(e){if(typeof e!="object"||e===null||kn in e)return e;const t=Dr(e);if(t!==ts&&t!==ns)return e;var n=new Map,i=Tr(e),s=A(0),a=qt,l=o=>{if(qt===a)return o();var f=q,c=qt;Se(null),gi(a);var h=o();return Se(f),gi(c),h};return i&&n.set("length",A(e.length)),new Proxy(e,{defineProperty(o,f,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&vs();var h=n.get(f);return h===void 0?h=l(()=>{var _=A(c.value);return n.set(f,_),_}):d(h,c.value,!0),!0},deleteProperty(o,f){var c=n.get(f);if(c===void 0){if(f in o){const h=l(()=>A(de));n.set(f,h),dn(s)}}else d(c,de),dn(s);return!0},get(o,f,c){if(f===kn)return e;var h=n.get(f),_=f in o;if(h===void 0&&(!_||It(o,f)?.writable)&&(h=l(()=>{var g=ht(_?o[f]:de),v=A(g);return v}),n.set(f,h)),h!==void 0){var p=r(h);return p===de?void 0:p}return Reflect.get(o,f,c)},getOwnPropertyDescriptor(o,f){var c=Reflect.getOwnPropertyDescriptor(o,f);if(c&&"value"in c){var h=n.get(f);h&&(c.value=r(h))}else if(c===void 0){var _=n.get(f),p=_?.v;if(_!==void 0&&p!==de)return{enumerable:!0,configurable:!0,value:p,writable:!0}}return c},has(o,f){if(f===kn)return!0;var c=n.get(f),h=c!==void 0&&c.v!==de||Reflect.has(o,f);if(c!==void 0||Y!==null&&(!h||It(o,f)?.writable)){c===void 0&&(c=l(()=>{var p=h?ht(o[f]):de,g=A(p);return g}),n.set(f,c));var _=r(c);if(_===de)return!1}return h},set(o,f,c,h){var _=n.get(f),p=f in o;if(i&&f==="length")for(var g=c;g<_.v;g+=1){var v=n.get(g+"");v!==void 0?d(v,de):g in o&&(v=l(()=>A(de)),n.set(g+"",v))}if(_===void 0)(!p||It(o,f)?.writable)&&(_=l(()=>A(void 0)),d(_,ht(c)),n.set(f,_));else{p=_.v!==de;var E=l(()=>ht(c));d(_,E)}var x=Reflect.getOwnPropertyDescriptor(o,f);if(x?.set&&x.set.call(h,c),!p){if(i&&typeof f=="string"){var Q=n.get("length"),D=Number(f);Number.isInteger(D)&&D>=Q.v&&d(Q,D+1)}dn(s)}return!0},ownKeys(o){r(s);var f=Reflect.ownKeys(o).filter(_=>{var p=n.get(_);return p===void 0||p.v!==de});for(var[c,h]of n)h.v!==de&&!(c in o)&&f.push(c);return f},setPrototypeOf(){ps()}})}var Kr,Qr,ei,ti;function lr(){if(Kr===void 0){Kr=window,Qr=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;ei=It(t,"firstChild").get,ti=It(t,"nextSibling").get,Ar(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Ar(n)&&(n.__t=void 0)}}function We(e=""){return document.createTextNode(e)}function Ct(e){return ei.call(e)}function et(e){return ti.call(e)}function $t(e,t){if(!H)return Ct(e);var n=Ct(L);if(n===null)n=L.appendChild(We());else if(t&&n.nodeType!==tr){var i=We();return n?.before(i),Ie(i),i}return Ie(n),n}function W(e,t=!1){if(!H){var n=Ct(e);return n instanceof Comment&&n.data===""?et(n):n}if(t&&L?.nodeType!==tr){var i=We();return L?.before(i),Ie(i),i}return L}function ni(e,t=1,n=!1){let i=H?L:e;for(var s;t--;)s=i,i=et(i);if(!H)return i;if(n&&i?.nodeType!==tr){var a=We();return i===null?s?.after(a):i.before(a),Ie(a),a}return Ie(i),i}function ri(e){e.textContent=""}function ii(){return!1}function si(e){var t=q,n=Y;Se(null),rt(null);try{return e()}finally{Se(t),rt(n)}}function Rs(e){Y===null&&(q===null&&us(),fs()),Rt&&ls()}function qs(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function tt(e,t,n){var i=Y;i!==null&&(i.f&Ae)!==0&&(e|=Ae);var s={ctx:Me,deps:null,nodes_start:null,nodes_end:null,f:e|$e|Be,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(n)try{pn(s),s.f|=On}catch(o){throw _e(s),o}else t!==null&&Nt(s);var a=s;if(n&&a.deps===null&&a.teardown===null&&a.nodes_start===null&&a.first===a.last&&(a.f&Mt)===0&&(a=a.first,(e&ot)!==0&&(e&Gt)!==0&&a!==null&&(a.f|=Gt)),a!==null&&(a.parent=i,i!==null&&qs(a,i),q!==null&&(q.f&ae)!==0&&(e&yt)===0)){var l=q;(l.effects??=[]).push(a)}return s}function jn(){return q!==null&&!nt}function Ls(e){const t=tt(Kn,null,!1);return pe(t,he),t.teardown=e,t}function ai(e){Rs();var t=Y.f,n=!q&&(t<)!==0&&(t&On)===0;if(n){var i=Me;(i.e??=[]).push(e)}else return oi(e)}function oi(e){return tt(Zn|is,e,!1)}function js(e){Ve.ensure();const t=tt(yt|Mt,e,!0);return()=>{_e(t)}}function Ys(e){Ve.ensure();const t=tt(yt|Mt,e,!0);return(n={})=>new Promise(i=>{n.outro?tn(t,()=>{_e(t),i(void 0)}):(_e(t),i(void 0))})}function Fs(e){return tt(Zn,e,!1)}function Xs(e){return tt(er|Mt,e,!0)}function li(e,t=0){return tt(Kn|t,e,!0)}function oe(e,t=[],n=[],i=[]){Os(i,t,n,s=>{tt(Kn,()=>e(...s.map(r)),!0)})}function fr(e,t=0){var n=tt(ot|t,e,!0);return n}function Ye(e){return tt(lt|Mt,e,!0)}function fi(e){var t=e.teardown;if(t!==null){const n=Rt,i=q;pi(!0),Se(null);try{t.call(null)}finally{pi(n),Se(i)}}}function ui(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const s=n.ac;s!==null&&si(()=>{s.abort(Zt)});var i=n.next;(n.f&yt)!==0?n.parent=null:_e(n,t),n=i}}function zs(e){for(var t=e.first;t!==null;){var n=t.next;(t.f<)===0&&_e(t),t=n}}function _e(e,t=!0){var n=!1;(t||(e.f&Or)!==0)&&e.nodes_start!==null&&e.nodes_end!==null&&(Hs(e.nodes_start,e.nodes_end),n=!0),ui(e,t&&!n),Fn(e,0),pe(e,ut);var i=e.transitions;if(i!==null)for(const a of i)a.stop();fi(e);var s=e.parent;s!==null&&s.first!==null&&ci(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=e.ac=null}function Hs(e,t){for(;e!==null;){var n=e===t?null:et(e);e.remove(),e=n}}function ci(e){var t=e.parent,n=e.prev,i=e.next;n!==null&&(n.next=i),i!==null&&(i.prev=n),t!==null&&(t.first===e&&(t.first=i),t.last===e&&(t.last=n))}function tn(e,t,n=!0){var i=[];ur(e,i,!0),di(i,()=>{n&&_e(e),t&&t()})}function di(e,t){var n=e.length;if(n>0){var i=()=>--n||t();for(var s of e)s.out(i)}else t()}function ur(e,t,n){if((e.f&Ae)===0){if(e.f^=Ae,e.transitions!==null)for(const l of e.transitions)(l.is_global||n)&&t.push(l);for(var i=e.first;i!==null;){var s=i.next,a=(i.f&Gt)!==0||(i.f<)!==0&&(e.f&ot)!==0;ur(i,t,a?n:!1),i=s}}}function cr(e){hi(e,!0)}function hi(e,t){if((e.f&Ae)!==0){e.f^=Ae,(e.f&he)===0&&(pe(e,$e),Nt(e));for(var n=e.first;n!==null;){var i=n.next,s=(n.f&Gt)!==0||(n.f<)!==0;hi(n,s?t:!1),n=i}if(e.transitions!==null)for(const a of e.transitions)(a.is_global||t)&&a.in()}}function vi(e,t){for(var n=e.nodes_start,i=e.nodes_end;n!==null;){var s=n===i?null:et(n);t.append(n),n=s}}let St=!1;function Yn(e){St=e}let Rt=!1;function pi(e){Rt=e}let q=null,nt=!1;function Se(e){q=e}let Y=null;function rt(e){Y=e}let vt=null;function Bs(e){q!==null&&(vt===null?vt=[e]:vt.push(e))}let ge=null,Oe=0,Fe=null;function Vs(e){Fe=e}let _i=1,hn=0,qt=hn;function gi(e){qt=e}function mi(){return++_i}function vn(e){var t=e.f;if((t&$e)!==0)return!0;if(t&ae&&(e.f&=~Ot),(t&ft)!==0){var n=e.deps;if(n!==null)for(var i=n.length,s=0;s<i;s++){var a=n[s];if(vn(a)&&Ur(a),a.wv>e.wv)return!0}(t&Be)!==0&&Le===null&&pe(e,he)}return!1}function wi(e,t,n=!0){var i=e.reactions;if(i!==null&&!vt?.includes(e))for(var s=0;s<i.length;s++){var a=i[s];(a.f&ae)!==0?wi(a,t,!1):t===a&&(n?pe(a,$e):(a.f&he)!==0&&pe(a,ft),Nt(a))}}function yi(e){var t=ge,n=Oe,i=Fe,s=q,a=vt,l=Me,o=nt,f=qt,c=e.f;ge=null,Oe=0,Fe=null,q=(c&(lt|yt))===0?e:null,vt=null,Qt(e.ctx),nt=!1,qt=++hn,e.ac!==null&&(si(()=>{e.ac.abort(Zt)}),e.ac=null);try{e.f|=Qn;var h=e.fn,_=h(),p=e.deps;if(ge!==null){var g;if(Fn(e,Oe),p!==null&&Oe>0)for(p.length=Oe+ge.length,g=0;g<ge.length;g++)p[Oe+g]=ge[g];else e.deps=p=ge;if(St&&jn()&&(e.f&Be)!==0)for(g=Oe;g<p.length;g++)(p[g].reactions??=[]).push(e)}else p!==null&&Oe<p.length&&(Fn(e,Oe),p.length=Oe);if(Lr()&&Fe!==null&&!nt&&p!==null&&(e.f&(ae|ft|$e))===0)for(g=0;g<Fe.length;g++)wi(Fe[g],e);return s!==null&&s!==e&&(hn++,Fe!==null&&(i===null?i=Fe:i.push(...Fe))),(e.f&bt)!==0&&(e.f^=bt),_}catch(v){return Yr(v)}finally{e.f^=Qn,ge=t,Oe=n,Fe=i,q=s,vt=a,Qt(l),nt=o,qt=f}}function Ws(e,t){let n=t.reactions;if(n!==null){var i=Qi.call(n,e);if(i!==-1){var s=n.length-1;s===0?n=t.reactions=null:(n[i]=n[s],n.pop())}}n===null&&(t.f&ae)!==0&&(ge===null||!ge.includes(t))&&(pe(t,ft),(t.f&Be)!==0&&(t.f^=Be,t.f&=~Ot),Wr(t),Fn(t,0))}function Fn(e,t){var n=e.deps;if(n!==null)for(var i=t;i<n.length;i++)Ws(e,n[i])}function pn(e){var t=e.f;if((t&ut)===0){pe(e,he);var n=Y,i=St;Y=e,St=!0;try{(t&ot)!==0?zs(e):ui(e),fi(e);var s=yi(e);e.teardown=typeof s=="function"?s:null,e.wv=_i;var a;Jn&&bs&&(e.f&$e)!==0&&e.deps}finally{St=i,Y=n}}}function r(e){var t=e.f,n=(t&ae)!==0;if(q!==null&&!nt){var i=Y!==null&&(Y.f&ut)!==0;if(!i&&!vt?.includes(e)){var s=q.deps;if((q.f&Qn)!==0)e.rv<hn&&(e.rv=hn,ge===null&&s!==null&&s[Oe]===e?Oe++:ge===null?ge=[e]:ge.includes(e)||ge.push(e));else{(q.deps??=[]).push(e);var a=e.reactions;a===null?e.reactions=[q]:a.includes(q)||a.push(q)}}}if(Rt){if(Et.has(e))return Et.get(e);if(n){var l=e,o=l.v;return((l.f&he)===0&&l.reactions!==null||xi(l))&&(o=ar(l)),Et.set(l,o),o}}else n&&!Le?.has(e)&&(l=e,vn(l)&&Ur(l),St&&jn()&&(l.f&Be)===0&&bi(l));if(Le?.has(e))return Le.get(e);if((e.f&bt)!==0)throw e.v;return e.v}function bi(e){if(e.deps!==null){e.f^=Be;for(const t of e.deps)(t.reactions??=[]).push(e),(t.f&ae)!==0&&(t.f&Be)===0&&bi(t)}}function xi(e){if(e.v===de)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(Et.has(t)||(t.f&ae)!==0&&xi(t))return!0;return!1}function dr(e){var t=nt;try{return nt=!0,e()}finally{nt=t}}const Us=-7169;function pe(e,t){e.f=e.f&Us|t}const Ei=new Set,hr=new Set;function Js(e){for(var t=0;t<e.length;t++)Ei.add(e[t]);for(var n of hr)n(e)}let $i=null;function Xn(e){var t=this,n=t.ownerDocument,i=e.type,s=e.composedPath?.()||[],a=s[0]||e.target;$i=e;var l=0,o=$i===e&&e.__root;if(o){var f=s.indexOf(o);if(f!==-1&&(t===document||t===window)){e.__root=t;return}var c=s.indexOf(t);if(c===-1)return;f<=c&&(l=f)}if(a=s[l]||e.target,a!==t){In(e,"currentTarget",{configurable:!0,get(){return a||n}});var h=q,_=Y;Se(null),rt(null);try{for(var p,g=[];a!==null;){var v=a.assignedSlot||a.parentNode||a.host||null;try{var E=a["__"+i];E!=null&&(!a.disabled||e.target===a)&&E.call(a,e)}catch(x){p?g.push(x):p=x}if(e.cancelBubble||v===t||v===null)break;a=v}if(p){for(let x of g)queueMicrotask(()=>{throw x});throw p}}finally{e.__root=t,delete e.currentTarget,Se(h),rt(_)}}}function Si(e){var t=document.createElement("template");return t.innerHTML=e.replaceAll("<!>","<!---->"),t.content}function Lt(e,t){var n=Y;n.nodes_start===null&&(n.nodes_start=e,n.nodes_end=t)}function Gs(e,t){var n=(t&Zi)!==0,i,s=!e.startsWith("<!>");return()=>{if(H)return Lt(L,null),L;i===void 0&&(i=Si(s?e:"<!>"+e));var a=n||Qr?document.importNode(i,!0):i.cloneNode(!0);{var l=Ct(a),o=a.lastChild;Lt(l,o)}return a}}function Zs(e,t,n="svg"){var i=!e.startsWith("<!>"),s=`<${n}>${i?e:"<!>"+e}</${n}>`,a;return()=>{if(H)return Lt(L,null),L;if(!a){var l=Si(s),o=Ct(l);a=Ct(o)}var f=a.cloneNode(!0);return Lt(f,f),f}}function le(e,t){return Zs(e,t,"svg")}function K(){if(H)return Lt(L,null),L;var e=document.createDocumentFragment(),t=document.createComment(""),n=We();return e.append(t,n),Lt(t,n),e}function I(e,t){if(H){var n=Y;((n.f&On)===0||n.nodes_end===null)&&(n.nodes_end=L),Pn();return}e!==null&&e.before(t)}const Ks=["touchstart","touchmove"];function Qs(e){return Ks.includes(e)}function _n(e,t){var n=t==null?"":typeof t=="object"?t+"":t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=n+"")}function Ti(e,t){return Di(e,t)}function ea(e,t){lr(),t.intro=t.intro??!1;const n=t.target,i=H,s=L;try{for(var a=Ct(n);a&&(a.nodeType!==Kt||a.data!==Sr);)a=et(a);if(!a)throw Jt;ct(!0),Ie(a);const l=Di(e,{...t,anchor:a});return ct(!1),l}catch(l){if(l instanceof Error&&l.message.split(`
|
|
2
|
-
`).some(o=>o.startsWith("https://svelte.dev/e/")))throw l;return l!==Jt&&console.warn("Failed to hydrate: ",l),t.recover===!1&&ds(),lr(),ri(n),ct(!1),Ti(e,t)}finally{ct(i),Ie(s)}}const nn=new Map;function Di(e,{target:t,anchor:n,props:i={},events:s,context:a,intro:l=!0}){lr();var o=new Set,f=_=>{for(var p=0;p<_.length;p++){var g=_[p];if(!o.has(g)){o.add(g);var v=Qs(g);t.addEventListener(g,Xn,{passive:v});var E=nn.get(g);E===void 0?(document.addEventListener(g,Xn,{passive:v}),nn.set(g,1)):nn.set(g,E+1)}}};f(Gn(Ei)),hr.add(f);var c=void 0,h=Ys(()=>{var _=n??t.appendChild(We());return Ts(_,{pending:()=>{}},p=>{if(a){Rr({});var g=Me;g.c=a}if(s&&(i.$$events=s),H&&Lt(p,null),c=e(p,i)||{},H&&(Y.nodes_end=L,L===null||L.nodeType!==Kt||L.data!==Un))throw Nn(),Jt;a&&qr()}),()=>{for(var p of o){t.removeEventListener(p,Xn);var g=nn.get(p);--g===0?(document.removeEventListener(p,Xn),nn.delete(p)):nn.set(p,g)}hr.delete(f),_!==n&&_.parentNode?.removeChild(_)}});return vr.set(c,h),c}let vr=new WeakMap;function ta(e,t){const n=vr.get(e);return n?(vr.delete(e),n(t)):Promise.resolve()}class na{anchor;#t=new Map;#e=new Map;#n=new Map;#r=new Set;#l=!0;constructor(t,n=!0){this.anchor=t,this.#l=n}#s=()=>{var t=Z;if(this.#t.has(t)){var n=this.#t.get(t),i=this.#e.get(n);if(i)cr(i),this.#r.delete(n);else{var s=this.#n.get(n);s&&(this.#e.set(n,s.effect),this.#n.delete(n),s.fragment.lastChild.remove(),this.anchor.before(s.fragment),i=s.effect)}for(const[a,l]of this.#t){if(this.#t.delete(a),a===t)break;const o=this.#n.get(l);o&&(_e(o.effect),this.#n.delete(l))}for(const[a,l]of this.#e){if(a===n||this.#r.has(a))continue;const o=()=>{if(Array.from(this.#t.values()).includes(a)){var c=document.createDocumentFragment();vi(l,c),c.append(We()),this.#n.set(a,{effect:l,fragment:c})}else _e(l);this.#r.delete(a),this.#e.delete(a)};this.#l||!i?(this.#r.add(a),tn(l,o,!1)):o()}}};#i=t=>{this.#t.delete(t);const n=Array.from(this.#t.values());for(const[i,s]of this.#n)n.includes(i)||(_e(s.effect),this.#n.delete(i))};ensure(t,n){var i=Z,s=ii();if(n&&!this.#e.has(t)&&!this.#n.has(t))if(s){var a=document.createDocumentFragment(),l=We();a.append(l),this.#n.set(t,{effect:Ye(()=>n(l)),fragment:a})}else this.#e.set(t,Ye(()=>n(this.anchor)));if(this.#t.set(i,t),s){for(const[o,f]of this.#e)o===t?i.skipped_effects.delete(f):i.skipped_effects.add(f);for(const[o,f]of this.#n)o===t?i.skipped_effects.delete(f.effect):i.skipped_effects.add(f.effect);i.oncommit(this.#s),i.ondiscard(this.#i)}else H&&(this.anchor=L),this.#s()}}function ra(e){Me===null&&as(),ai(()=>{const t=dr(e);if(typeof t=="function")return t})}function U(e,t,n=!1){H&&Pn();var i=new na(e),s=n?Gt:0;function a(l,o){if(H){const c=Nr(e)===Dn;if(l===c){var f=Cn();Ie(f),i.anchor=f,ct(!1),i.ensure(l,o),ct(!0);return}}i.ensure(l,o)}fr(()=>{var l=!1;t((o,f=!0)=>{l=!0,a(f,o)}),l||a(!1,null)},s)}function ia(e,t){Fs(()=>{var n=e.getRootNode(),i=n.host?n:n.head??n.ownerDocument.head;if(!i.querySelector("#"+t.hash)){const s=document.createElement("style");s.id=t.hash,s.textContent=t.code,i.appendChild(s)}})}function sa(e,t){return e==null?null:String(e)}function Ai(e,t,n,i){var s=e.__style;if(H||s!==t){var a=sa(t);(!H||a!==e.getAttribute("style"))&&(a==null?e.removeAttribute("style"):e.style.cssText=a),e.__style=t}return i}const aa=Symbol("is custom element"),oa=Symbol("is html");function T(e,t,n,i){var s=la(e);H&&(s[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")||s[t]!==(s[t]=n)&&(t==="loading"&&(e[ss]=n),n==null?e.removeAttribute(t):typeof n!="string"&&fa(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function la(e){return e.__attributes??={[aa]:e.nodeName.includes("-"),[oa]:e.namespaceURI===Ki}}var Ii=new Map;function fa(e){var t=e.getAttribute("is")||e.nodeName,n=Ii.get(t);if(n)return n;Ii.set(t,n=[]);for(var i,s=e,a=Element.prototype;a!==s;){i=es(s);for(var l in i)i[l].set&&n.push(l);s=Dr(s)}return n}let zn=!1;function ua(e){var t=zn;try{return zn=!1,[e(),zn]}finally{zn=t}}function me(e,t,n,i){var s=(n&Ji)!==0,a=(n&Gi)!==0,l=i,o=!0,f=()=>(o&&(o=!1,l=a?dr(i):i),l),c;if(s){var h=kn in e||kr in e;c=It(e,t)?.set??(h&&t in e?D=>e[t]=D:void 0)}var _,p=!1;s?[_,p]=ua(()=>e[t]):_=e[t],_===void 0&&i!==void 0&&(_=f(),c&&(hs(),c(_)));var g;if(g=()=>{var D=e[t];return D===void 0?f():(o=!0,D)},(n&Ui)===0)return g;if(c){var v=e.$$legacy;return(function(D,V){return arguments.length>0?((!V||v||p)&&c(V?g():D),D):g()})}var E=!1,x=((n&Wi)!==0?sr:Vr)(()=>(E=!1,g()));s&&r(x);var Q=Y;return(function(D,V){if(arguments.length>0){const re=V?r(x):s?ht(D):D;return d(x,re),E=!0,l!==void 0&&(l=re),D}return Rt&&E||(Q.f&ut)!==0?x.v:r(x)})}function ca(e){return new da(e)}class da{#t;#e;constructor(t){var n=new Map,i=(a,l)=>{var o=Gr(l,!1,!1);return n.set(a,o),o};const s=new Proxy({...t.props||{},$$events:{}},{get(a,l){return r(n.get(l)??i(l,Reflect.get(a,l)))},has(a,l){return l===kr?!0:(r(n.get(l)??i(l,Reflect.get(a,l))),Reflect.has(a,l))},set(a,l,o){return d(n.get(l)??i(l,o),o),Reflect.set(a,l,o)}});this.#e=(t.hydrate?ea:Ti)(t.component,{target:t.target,anchor:t.anchor,props:s,context:t.context,intro:t.intro??!1,recover:t.recover}),(!t?.props?.$$host||t.sync===!1)&&ve(),this.#t=s.$$events;for(const a of Object.keys(this.#e))a==="$set"||a==="$destroy"||a==="$on"||In(this,a,{get(){return this.#e[a]},set(l){this.#e[a]=l},enumerable:!0});this.#e.$set=a=>{Object.assign(s,a)},this.#e.$destroy=()=>{ta(this.#e)}}$set(t){this.#e.$set(t)}$on(t,n){this.#t[t]=this.#t[t]||[];const i=(...s)=>n.call(this,...s);return this.#t[t].push(i),()=>{this.#t[t]=this.#t[t].filter(s=>s!==i)}}$destroy(){this.#e.$destroy()}}let Mi;typeof HTMLElement=="function"&&(Mi=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;constructor(e,t,n){super(),this.$$ctor=e,this.$$s=t,n&&this.attachShadow({mode:"open"})}addEventListener(e,t,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const i=this.$$c.$on(e,t);this.$$l_u.set(t,i)}super.addEventListener(e,t,n)}removeEventListener(e,t,n){if(super.removeEventListener(e,t,n),this.$$c){const i=this.$$l_u.get(t);i&&(i(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(i){return s=>{const a=document.createElement("slot");i!=="default"&&(a.name=i),I(s,a)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},n=ha(this);for(const i of this.$$s)i in n&&(i==="default"&&!this.$$d.children?(this.$$d.children=e(i),t.default=!0):t[i]=e(i));for(const i of this.attributes){const s=this.$$g_p(i.name);s in this.$$d||(this.$$d[s]=Hn(s,i.value,this.$$p_d,"toProp"))}for(const i in this.$$p_d)!(i in this.$$d)&&this[i]!==void 0&&(this.$$d[i]=this[i],delete this[i]);this.$$c=ca({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=js(()=>{li(()=>{this.$$r=!0;for(const i of An(this.$$c)){if(!this.$$p_d[i]?.reflect)continue;this.$$d[i]=this.$$c[i];const s=Hn(i,this.$$d[i],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[i].attribute||i):this.setAttribute(this.$$p_d[i].attribute||i,s)}this.$$r=!1})});for(const i in this.$$l)for(const s of this.$$l[i]){const a=this.$$c.$on(i,s);this.$$l_u.set(s,a)}this.$$l={}}}attributeChangedCallback(e,t,n){this.$$r||(e=this.$$g_p(e),this.$$d[e]=Hn(e,n,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 An(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function Hn(e,t,n,i){const s=n[e]?.type;if(t=s==="Boolean"&&typeof t!="boolean"?t!=null:t,!i||!n[e])return t;if(i==="toAttribute")switch(s){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(s){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function ha(e){const t={};return e.childNodes.forEach(n=>{t[n.slot||"default"]=!0}),t}function va(e,t,n,i,s,a){let l=class extends Mi{constructor(){super(e,n,s),this.$$p_d=t}static get observedAttributes(){return An(t).map(o=>(t[o].attribute||o).toLowerCase())}};return An(t).forEach(o=>{In(l.prototype,o,{get(){return this.$$c&&o in this.$$c?this.$$c[o]:this.$$d[o]},set(f){f=Hn(o,f,t),this.$$d[o]=f;var c=this.$$c;if(c){var h=It(c,o)?.get;h?c[o]=f:c.$set({[o]:f})}}})}),i.forEach(o=>{In(l.prototype,o,{get(){return this.$$c?.[o]}})}),e.element=l,l}var jt={},Oi;function pa(){if(Oi)return jt;Oi=1,Object.defineProperty(jt,"__esModule",{value:!0}),jt.LanguageTranslator=void 0,jt.getChildStyleToPass=e,jt.addComponent=t;function e(i,s){var a,l,o="";try{if(i&&s?.length&&(!((a=Object.keys(i))===null||a===void 0)&&a.length)&&(!((l=s?.filter(function(p){return Object.keys(i).includes(p.name)}))===null||l===void 0)&&l.length))for(var f=function(p){var g=s?.filter(function(v){return v.name===p&&v.defaultValue!==i[p]});g&&(o+="".concat(p,":").concat(i[p],";"))},c=0,h=Object.keys(i);c<h.length;c++){var _=h[c];f(_)}}catch(p){console.error("error getting child style to pass",p)}finally{return o}}function t(i){var s,a=((s=i?.repoName.split("/"))===null||s===void 0?void 0:s[1])||i?.repoName;if(!a)throw new Error("wrong componentPath "+i?.repoName);if(!i?.version)throw new Error("wrong version "+i?.version);var l=i?.iifePath||"main.iife.js";if(!document.getElementById(a+"-script"))try{var o=document.createElement("script");if(o.id=a+"-script",o.src="https://cdn.jsdelivr.net/npm/".concat(i.repoName,"@").concat(i.version,"/").concat(l),i?.local)o.src="".concat(i.local);else if(location.href.includes("localhost:6006")){var f=a.split("-")[0];o.src="http://localhost:6006/webcomponents/".concat(a.replace(f+"-",""),"/").concat(l)}document.head.appendChild(o)}catch(c){console.warn(c)}}var n=(function(){function i(s){if(this.lang="",!s?.dictionary)throw new Error("no dictionary provided");this.dictionary=s.dictionary,this.setLang(s?.lang)}return i.prototype.setLang=function(s){s||(s=i.getDefaultLang()),this.lang=s},i.prototype.translateWord=function(s,a){return i.getDictionaryWord(s,this.dictionary,a||this.lang)},i.prototype.translateDate=function(s,a,l){return i.formatDate(s,a,l||this.lang)},i.getDefaultLang=function(){var s,a,l,o="en";return navigator?.languages&&(!((l=(a=(s=navigator.languages[0])===null||s===void 0?void 0:s.split("-")[0])===null||a===void 0?void 0:a.toLowerCase())===null||l===void 0)&&l.length)&&(o=navigator.languages[0].split("-")[0].toLowerCase()),o},i.getDictionaryWord=function(s,a,l){var o;if(!s)throw new Error("no wordKey provided");if(!a)throw new Error("no dictionary provided");if(l&&(!((o=a[l])===null||o===void 0)&&o[s]))return a[l][s];var f="",c=i.getDefaultLang();if(!l||c!==l){var h=a?.[c];h?.[s]&&(f=h[s])}return f},i.formatDate=function(s,a,l){if(!s)throw new Error("no date provided");if(typeof s.getMonth!="function")throw new Error("wrong date format");var o=new Intl.DateTimeFormat(l||i.getDefaultLang(),a);return o.format(s)},i})();return jt.LanguageTranslator=n,jt}pa();function ki(e,t,n,i=s=>s){return e*i(.5-t*(.5-n))}function _a(e){return[-e[0],-e[1]]}function Ue(e,t){return[e[0]+t[0],e[1]+t[1]]}function Xe(e,t){return[e[0]-t[0],e[1]-t[1]]}function Je(e,t){return[e[0]*t,e[1]*t]}function ga(e,t){return[e[0]/t,e[1]/t]}function gn(e){return[e[1],-e[0]]}function Ni(e,t){return e[0]*t[0]+e[1]*t[1]}function ma(e,t){return e[0]===t[0]&&e[1]===t[1]}function wa(e){return Math.hypot(e[0],e[1])}function ya(e){return e[0]*e[0]+e[1]*e[1]}function Pi(e,t){return ya(Xe(e,t))}function Ci(e){return ga(e,wa(e))}function ba(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function mn(e,t,n){let i=Math.sin(n),s=Math.cos(n),a=e[0]-t[0],l=e[1]-t[1],o=a*s-l*i,f=a*i+l*s;return[o+t[0],f+t[1]]}function pr(e,t,n){return Ue(e,Je(Xe(t,e),n))}function Ri(e,t,n){return Ue(e,Je(t,n))}var{min:rn,PI:xa}=Math,qi=.275,wn=xa+1e-4;function Ea(e,t={}){let{size:n=16,smoothing:i=.5,thinning:s=.5,simulatePressure:a=!0,easing:l=M=>M,start:o={},end:f={},last:c=!1}=t,{cap:h=!0,easing:_=M=>M*(2-M)}=o,{cap:p=!0,easing:g=M=>--M*M*M+1}=f;if(e.length===0||n<=0)return[];let v=e[e.length-1].runningLength,E=o.taper===!1?0:o.taper===!0?Math.max(n,v):o.taper,x=f.taper===!1?0:f.taper===!0?Math.max(n,v):f.taper,Q=Math.pow(n*i,2),D=[],V=[],re=e.slice(0,10).reduce((M,m)=>{let F=m.pressure;if(a){let j=rn(1,m.distance/n),Ne=rn(1,1-j);F=rn(1,M+(Ne-M)*(j*qi))}return(M+F)/2},e[0].pressure),P=ki(n,s,e[e.length-1].pressure,l),ie,y=e[0].vector,fe=e[0].point,Te=fe,z=fe,we=Te,ze=!1;for(let M=0;M<e.length;M++){let{pressure:m}=e[M],{point:F,vector:j,distance:Ne,runningLength:Tt}=e[M];if(M<e.length-1&&v-Tt<3)continue;if(s){if(a){let Ge=rn(1,Ne/n),Ze=rn(1,1-Ge);m=rn(1,re+(Ze-re)*(Ge*qi))}P=ki(n,s,m,l)}else P=n/2;ie===void 0&&(ie=P);let pt=Tt<E?_(Tt/E):1,yn=v-Tt<x?g((v-Tt)/x):1;P=Math.max(.01,P*Math.min(pt,yn));let sn=(M<e.length-1?e[M+1]:e[M]).vector,_t=M<e.length-1?Ni(j,sn):1,Bn=Ni(j,y)<0&&!ze,bn=_t!==null&&_t<0;if(Bn||bn){let Ge=Je(gn(y),P);for(let Ze=1/13,He=0;He<=1;He+=Ze)z=mn(Xe(F,Ge),F,wn*He),D.push(z),we=mn(Ue(F,Ge),F,wn*-He),V.push(we);fe=z,Te=we,bn&&(ze=!0);continue}if(ze=!1,M===e.length-1){let Ge=Je(gn(j),P);D.push(Xe(F,Ge)),V.push(Ue(F,Ge));continue}let xn=Je(gn(pr(sn,j,_t)),P);z=Xe(F,xn),(M<=1||Pi(fe,z)>Q)&&(D.push(z),fe=z),we=Ue(F,xn),(M<=1||Pi(Te,we)>Q)&&(V.push(we),Te=we),re=m,y=j}let $=e[0].point.slice(0,2),ye=e.length>1?e[e.length-1].point.slice(0,2):Ue(e[0].point,[1,1]),Yt=[],ke=[];if(e.length===1){if(!(E||x)||c){let M=Ri($,Ci(gn(Xe($,ye))),-(ie||P)),m=[];for(let F=1/13,j=F;j<=1;j+=F)m.push(mn(M,$,wn*2*j));return m}}else{if(!(E||x&&e.length===1))if(h)for(let m=1/13,F=m;F<=1;F+=m){let j=mn(V[0],$,wn*F);Yt.push(j)}else{let m=Xe(D[0],V[0]),F=Je(m,.5),j=Je(m,.51);Yt.push(Xe($,F),Xe($,j),Ue($,j),Ue($,F))}let M=gn(_a(e[e.length-1].vector));if(x||E&&e.length===1)ke.push(ye);else if(p){let m=Ri(ye,M,P);for(let F=1/29,j=F;j<1;j+=F)ke.push(mn(m,ye,wn*3*j))}else ke.push(Ue(ye,Je(M,P)),Ue(ye,Je(M,P*.99)),Xe(ye,Je(M,P*.99)),Xe(ye,Je(M,P)))}return D.concat(ke,V.reverse(),Yt)}function $a(e,t={}){var n;let{streamline:i=.5,size:s=16,last:a=!1}=t;if(e.length===0)return[];let l=.15+(1-i)*.85,o=Array.isArray(e[0])?e:e.map(({x:g,y:v,pressure:E=.5})=>[g,v,E]);if(o.length===2){let g=o[1];o=o.slice(0,-1);for(let v=1;v<5;v++)o.push(pr(o[0],g,v/4))}o.length===1&&(o=[...o,[...Ue(o[0],[1,1]),...o[0].slice(2)]]);let f=[{point:[o[0][0],o[0][1]],pressure:o[0][2]>=0?o[0][2]:.25,vector:[1,1],distance:0,runningLength:0}],c=!1,h=0,_=f[0],p=o.length-1;for(let g=1;g<o.length;g++){let v=a&&g===p?o[g].slice(0,2):pr(_.point,o[g],l);if(ma(_.point,v))continue;let E=ba(v,_.point);if(h+=E,g<p&&!c){if(h<s)continue;c=!0}_={point:v,pressure:o[g][2]>=0?o[g][2]:.5,vector:Ci(Xe(_.point,v)),distance:E,runningLength:h},f.push(_)}return f[0].vector=((n=f[1])==null?void 0:n.vector)||[0,0],f}function Li(e,t={}){return Ea($a(e,t),t)}var Sa=le('<path stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-1qsqiex"></path>'),Ta=le('<image stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-1qsqiex"></image>'),Da=le('<text stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-1qsqiex"> </text>'),Aa=le('<path class="svelte-1qsqiex"></path>'),Ia=le('<image class="svelte-1qsqiex"></image>'),Ma=le('<text class="svelte-1qsqiex"> </text>'),Oa=le('<path stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-1qsqiex"></path>'),ka=le('<image stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-1qsqiex"></image>'),Na=le('<text stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-1qsqiex"> </text>'),Pa=le('<path class="svelte-1qsqiex"></path>'),Ca=le('<image class="svelte-1qsqiex"></image>'),Ra=le('<text class="svelte-1qsqiex"> </text>'),qa=le('<rect id="selector" fill="none" stroke="red" stroke-width="1"></rect>'),La=le('<rect id="selector" fill="none" stroke="red" stroke-width="1"></rect>'),ja=le('<rect id="selector" fill="none" stroke="red" stroke-width="1"></rect>'),Ya=le('<rect id="selector" fill="none" stroke="red" stroke-width="1"></rect>'),Fa=le("<g><!><!></g>"),Xa=Gs('<div id="debug" class="svelte-1qsqiex"> </div> <div id="container"><svg class="svelte-1qsqiex"><!></svg></div>',1);const za={hash:"svelte-1qsqiex",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;}#debug.svelte-1qsqiex {position:absolute;width:100%;height:30px;top:0px;z-index:10;}svg.svelte-1qsqiex {position:absolute;top:0;left:0;width:100%;height:100%;touch-action:none;}'};function ji(e,t){Rr(t,!0),ia(e,za);function n(u,b){t.$$host.dispatchEvent(new CustomEvent(u,{detail:b}))}const i={size:6,thinning:.7,smoothing:.5,streamline:.5},s={paperSize:"A4"},a={zoom:{type:"fit",value:1},pan:{x:0,y:0},lockPan:!1,lockZoom:!1};let l=me(t,"id",7,""),o=me(t,"load_draw",7),f=me(t,"draw_id",23,()=>Math.random().toString(36)+Math.random().toString(36)+Date.now().toString()),c=me(t,"background_color",7,"rgb(255,255,255)"),h=me(t,"pen_color",7,"rgb(0,0,0)"),_=me(t,"insert_image",7,void 0),p=me(t,"insert_text",7),g=me(t,"pen_opacity",7,1),v=me(t,"options",7,i),E=me(t,"goto",7,void 0),x=me(t,"mode",7,"draw"),Q=me(t,"debug",7,"no"),D=me(t,"save_as",7,void 0),V=me(t,"size",23,()=>Object.assign({},s)),re=me(t,"view",23,()=>Object.assign({},a)),P,ie,y=A(0),fe=A(!1),Te=A(0),z=A(void 0),we=A(void 0),ze=A(""),$=A(ht({})),ye=A(0),Yt=A(void 0),ke=A(void 0),M=A(void 0),m=A(ht([])),F=A(!1),j=A("idle"),Ne=A(void 0),Tt=A(void 0),pt=A(void 0),yn=A(void 0),sn=A(void 0),_t=A(!1),Bn=A(void 0),bn=A(void 0),xn=A(void 0),Ge=A(void 0),Ze=A(0),He=A(0),Ft=A(0),Xt=A(0),ee=A(0),te=A(0),J=A(0),G=A(0);ht({});function Yi(u){if(!u.length)return"";const b=u.reduce((S,[B,C],X,w)=>{const[k,N]=w[(X+1)%w.length];return S.push(B,C,(B+k)/2,(C+N)/2),S},["M",...u[0],"Q"]);return b.push("Z"),b.join(" ")}function Ha(u){if(u)switch(u.type){case"json":const b=[];for(const S of r(m))if(S.visible){if(S.type==="stroke")S.actionIndex=0,b.push(S);else if(S.type==="multiplestroke")for(const B of S.multipath?.filter(C=>C.visible)||[])B.actionIndex=0,b.push(B)}return Va({type:"json",draw:b,id:l(),draw_id:f(),name:u.name,version:r(Te)+1,size:V()||s});default:return console.error("unknown save type")}}function Ba(u){n("drawLoaded",u)}function Va(u){n("save",u)}function En(u){n("historyIndex",u)}function Wa(u){n("changeIndex",u)}function Ua(u){n("selection",u)}function Fi(u){n("startStroke",u)}function Ja(u){n("endStroke",u)}function Ga(u){n("imageLoaded",u)}function Za(u){n("txtLoaded",u)}function Ka(){if(!r(z))return console.error("no svg dom found");if(!r(we))return console.error("no svg container found");switch(d($,r(z).getBoundingClientRect(),!0),P||(P={}),P.containerWidth=r(we).clientWidth,P.containerHeight=r(we).clientHeight,P.drawWidth=r(z).clientWidth,P.drawHeight=r(z).clientHeight,V()?.paperSize){case"A3":P.paperWidth=297,P.paperHeight=420;break;case"A4":default:P.paperWidth=210,P.paperHeight=297;break}}function Qa(){if(console.log("svgDom",r(z)),r($)||Ka(),o()&&typeof o()=="object"&&(!r(Te)||r(Te)<o().version||f()!==o().draw_id)&&(console.log("load_draw",o()),d(m,o().draw,!0),d(y,r(m).length,!0),f(o().draw_id),d(Te,o().version,!0),o(void 0),ie=r(m).length,En({index:r(y),draw_id:f(),id:l(),start_index:ie}),Ba({index:r(y),draw_id:f(),id:l(),start_index:ie})),r(m)?.length&&D()&&(console.log("save_as",D()),Ha(D())),r(m)||(console.log("draw is empty"),d(m,[],!0)),x()&&x()!=="select"&&r(Ne)){d(Ne,0);const u=[...r(m)];u.forEach(b=>{b.selected=!1,b.type==="multiplestroke"&&b.multipath?.forEach(S=>{S.selected=!1})}),d(m,[...u],!0)}if(x()!=="select"&&(d(J,0),d(G,0),d(ee,0),d(te,0)),typeof E()=="string"&&E(Number(E())),r(m).length||(d(y,0),E(void 0)),r(y)||d(y,0),E()&&E()<0?d(y,-1):(E()||E()===0)&&(ie&&E()>ie?E(ie):E()>r(m).length&&E(r(m).length),d(y,E()+0),E(void 0),Wa({index:r(y),draw_id:f(),id:l(),start_index:ie})),r(y)<0?(d(y,0),d(F,!0)):r(y)>=0&&d(F,!1),_()){console.info("inserting object");let u=!1;switch(_().type){case"jpg":case"jpeg":case"png":eo(_()),u=!0;break;case"svg":to(_()),u=!0;break;default:console.error("unknown insert_object type",_().type),u=!1}u&&Ga({ok:!0,draw_id:f(),id:l()})}p()&&(console.log("insert_text",p()),no(p()),Za({ok:!0,draw_id:f(),id:l()})),d(Tt,Li(r(m)[r(y)]?.path||[],Object.assign({simulatePressure:r(ze)!=="pen"},v())),!0),d(pt,Yi(r(Tt)),!0),console.log("set index to",r(y),"from goto",E(),"historyActions",r(m).length)}ai(()=>{console.log("recompute");let u=!1;if(typeof V()=="string")try{V(JSON.parse(V())),u=!0}catch(b){console.error("error parsing size json",b)}if(typeof re()=="string")try{re(JSON.parse(re())),u=!0}catch(b){console.error("error parsing view json",b)}if(typeof o()=="string"&&o()?.length)try{o(JSON.parse(o())),u=!0}catch(b){console.error("error parsing json",b)}else o()||o(void 0);if(typeof D()=="string"&&D()?.length)try{D(JSON.parse(D())),u=!0}catch(b){console.error("error parsing json",b)}if(Q()!=="yes"&&Q("no"),typeof g()=="string"&&g(Number(g())),typeof v()=="string"&&v()?.length)try{v(JSON.parse(v())),v()&&!v().size&&(v().size=i.size),v()&&!v().thinning&&(v().thinning=i.thinning),v()&&!v().smoothing&&(v().smoothing=i.smoothing),v()&&!v().streamline&&(v().streamline=i.streamline),u=!0}catch(b){console.error("error parsing json",b)}if(typeof _()=="string")try{_(JSON.parse(_())),u=!0}catch(b){console.error("error parsing insert_object json",b)}r(z)&&u&&Qa()});function eo(u){const b=[...r(m)],S={id:Date.now().toString(),type:"image",actionIndex:r(y),visible:!0,pathData:u?.base64};b.push(S),d(m,[...b],!0),cn(y)}function to(u){console.info(`inserting SVG ${u?.type}`)}function no(u){console.info(`inserting Text ${u?.content}`)}function _r(u){const b=u.target?.id?.split("_")?.[1];if(b){let S=[...r(m)],B=S.find(C=>C.id===b&&C.visible);if(!B)for(const C of S.filter(X=>X.type==="multiplestroke").sort((X,w)=>w.actionIndex-X.actionIndex)){const X=C?.multipath?.find(w=>w.id===b&&w.visible);if(X){B=X;break}}B&&(B.visible=!1,B.erasedAtIndex=r(y),console.info("erase stroke",B.id),S[S.length-1].type!=="eraser"?(S=S.slice(0,r(y)+1),S.push({type:"eraser",visible:!0,id:Math.random().toString(36)+Math.random().toString(36)+Date.now().toString(),actionIndex:r(m).length}),S.forEach((C,X)=>{!C.visible&&C.erasedAtIndex&&C.erasedAtIndex>r(y)&&(C.visible=!0,C.erasedAtIndex=void 0)}),d(m,[...S],!0),cn(y),En({index:r(y),draw_id:f(),id:l(),start_index:ie})):d(m,[...S],!0))}}function ro(u){if(console.log("handlePointerDown"),d(ze,u.pointerType,!0),d(ye,u.buttons,!0),x()==="draw"&&u.buttons===1&&!(u.pointerType==="pen"&&u.pressure===0)){if(d(j,"drawing"),r(y)!==r(m).length-1){const b=[...r(m)];b.forEach((S,B)=>{!S.visible&&S.erasedAtIndex&&S.erasedAtIndex>r(y)&&(S.visible=!0,S.erasedAtIndex=void 0)}),d(m,b,!0)}if(r(m)?.length&&r(y)<r(m).length)if(r(F))d(m,[],!0),d(F,!1);else{cn(y);const b=[...r(m)];d(m,b.slice(0,r(y)),!0)}En({index:r(y),draw_id:f(),id:l(),start_index:ie}),console.log("setup stroke"),d(M,new Date,!0),d(ke,Date.now().toString(),!0),d(Ze,u.pageX-r($).left),d(He,u.pageY-r($).top),d(Ft,u.pageX-r($).left),d(Xt,u.pageY-r($).top),r(Yt)||(d(Yt,r(M),!0),Fi({start:r(Yt),id:l(),draw_id:f(),stroke_id:r(ke),index:r(y)})),u.target.setPointerCapture(u.pointerId),r(m)?.length?(console.info("pushing draw"),d(m,[...r(m),{path:[[u.pageX-r($).left,u.pageY-r($).top,u.pressure]],color:h(),id:r(ke),pathData:r(pt),min:[r(Ze),r(He)],max:[r(Ft),r(Xt)],visible:!0,actionIndex:r(m).length,opacity:g(),type:"stroke"}],!0)):d(m,[{path:[[u.pageX-r($).left,u.pageY-r($).top,u.pressure]],color:h(),id:r(ke),pathData:r(pt),min:[r(Ze),r(He)],max:[r(Ft),r(Xt)],visible:!0,actionIndex:r(m).length,opacity:g(),type:"stroke"}],!0),Fi({start:r(M),stroke_id:r(ke),index:r(y),id:l(),draw_id:f()})}else if(x()==="eraser"||x()==="draw"&&(u.pointerType==="pen"&&u.pressure===0&&u.buttons===1||u.buttons===32))u.target.setPointerCapture(u.pointerId),d(j,"erasing"),console.log("eraser down"),_r(u);else if(x()==="select"&&r(m).length){let b=!1;const S=u.pageX-r($).left,B=u.pageY-r($).top;if(b=S>r(ee)&&S<r(J)&&B>r(te)&&B<r(G),d(ee,u.pageX-r($).left),d(te,u.pageY-r($).top),d(J,u.pageX-r($).left),d(G,u.pageY-r($).top),!r(_t)&&!r(Ne)&&b){d(j,"idle"),d(Ne,Date.now(),!0),console.info("set move mode");const C=[...r(m)];d(yn,u.pageX-r($).left),d(sn,u.pageY-r($).top),C.filter(k=>k.selected).forEach(k=>{k.visible=!1,k.erasedAtIndex=r(y)}),C.filter(k=>k.type==="multiplestroke").forEach(k=>{k.multipath?.filter(N=>N.selected).forEach(N=>{N.visible=!1,N.erasedAtIndex=r(y)})});const X=[];for(const k of C.filter(N=>N.type==="multiplestroke"))for(const N of k.multipath?.filter(O=>O.selected)||[])X.push(JSON.parse(JSON.stringify(N))),N.visible=!1;const w=JSON.parse(JSON.stringify(r(m).filter(k=>k.selected))).concat(X);w.forEach(k=>{k.visible=!0}),C.push({multipath:w,id:r(Ne).toString(),type:"multiplestroke",actionIndex:r(y),visible:!0,min:[r(ee),r(te)],max:[r(J),r(G)]}),r(m)[r(m).length-1].type==="multiplestroke"&&cn(y),d(m,[...C],!0),En({index:r(y),draw_id:f(),id:l(),start_index:ie}),d(_t,!0),d(Bn,r(ee),!0),d(bn,r(te),!0),d(xn,r(J),!0),d(Ge,r(G),!0)}else d(j,"selecting"),d(Ne,0)}}function io(u){if(d(ze,u.pointerType,!0),d(ye,u.buttons+" "+[u.pageX-r($).left,u.pageY-r($).top,u.pressure].toString()),x()==="draw"&&r(j)==="drawing"&&u.buttons===1&&!(u.pointerType==="pen"&&u.pressure===0))r(m)[r(y)].path=[...r(m)[r(y)].path||[],[u.pageX-r($).left,u.pageY-r($).top,u.pressure]],r(m)[r(y)].pathData=r(pt),u.pageX-r($).left<r(Ze)&&d(Ze,u.pageX-r($).left),u.pageY-r($).top<r(He)&&d(He,u.pageY-r($).top),u.pageX-r($).left>r(Ft)&&d(Ft,u.pageX-r($).left),u.pageY-r($).top>r(Xt)&&d(Xt,u.pageY-r($).top),r(m)[r(y)].min=[r(Ze),r(He)],r(m)[r(y)].max=[r(Ft),r(Xt)];else if(r(j)==="erasing"&&(x()==="eraser"||x()==="draw"&&(u.pointerType==="pen"&&u.pressure===0&&u.buttons===1||u.buttons===32)))console.log("eraser move"),_r(u);else if(x()==="select"&&r(j)==="selecting")d(J,u.pageX-r($).left),d(G,u.pageY-r($).top);else if(x()==="select"&&!r(_t)){const b=u.pageX-r($).left,S=u.pageY-r($).top,B=b>r(ee)&&b<r(J)&&S>r(te)&&S<r(G);B&&!r(fe)?(d(fe,!0),console.log("on select",r(fe))):!B&&r(fe)&&(d(fe,!1),console.log("off select",r(fe)))}else if(r(_t)&&r(m)[r(y)].type==="multiplestroke"&&r(Ne)&&r(Ne).toString()===r(m)[r(y)].id){const b=[...r(m)],S=u.pageX-r($).left,B=u.pageY-r($).top,C=S-(r(yn)||0),X=B-(r(sn)||0);console.info("move selected strokes on multistrokes",r(yn),r(sn),C,X),b[r(y)]?.multipath?.forEach(w=>{let k;for(const O of r(m).filter(ne=>ne.type==="multiplestroke").filter(ne=>ne.id!==r(m)[r(y)].id).sort((ne,De)=>De.actionIndex-ne.actionIndex)){const ne=O?.multipath?.find(De=>De.id===w.id);if(ne){k=ne;break}}k||(k=r(m).find(O=>O.id===w.id)),w.path?.forEach((O,ne)=>{ne===0&&console.log("debug path ",O[0],k?.path?.[ne][0],r(m)),k?.path&&(O[0]=k.path[ne][0]+C),k?.path&&(O[1]=k.path[ne][1]+X)}),k?.max&&(w.max=[k.max[0]+C,k.max[1]+X]),k?.min&&(w.min=[k.min[0]+C,k.min[1]+X]);const N=Li(w.path||[],Object.assign({simulatePressure:r(ze)!=="pen"},v()));w.pathData=Yi(N)}),d(ee,(r(Bn)||0)+C),d(te,(r(bn)||0)+X),d(J,(r(xn)||0)+C),d(G,(r(Ge)||0)+X),d(m,[...b],!0)}}function so(u){if(d(ye,u.buttons,!0),d(_t,!1),x()==="draw"&&r(j)==="drawing"){const b=new Date;if(!r(ke)||!r(M)||!r(pt))return console.error("no stroke id",r(ke),r(M),r(pt));Ja({end:b,stroke_id:r(ke),start:r(M),min:[r(Ze),r(He)],max:[r(Ft),r(Xt)],pathData:r(pt),pen_color:h(),index:r(y),id:l(),draw_id:f()}),cn(y),En({index:r(y),draw_id:f(),id:l(),start_index:ie})}else if(x()==="eraser"||x()==="draw"&&r(j)!=="drawing"&&(u.pointerType==="pen"&&u.pressure===0&&u.buttons===1||u.buttons===32))console.log("eraser up"),_r(u);else if(x()==="select"){const b=[...r(m)];b.forEach(N=>{N.selected=!1,N.type==="multiplestroke"&&N.multipath?.forEach(O=>{O.selected=!1})}),d(m,[...b],!0),d(Ne,0);const S=r(ee)<r(J)?r(ee):r(J),B=r(te)<r(G)?r(te):r(G),C=r(ee)>r(J)?r(ee):r(J),X=r(te)>r(G)?r(te):r(G),w=b.filter(N=>!!(N.visible&&N.type==="stroke"&&N.min&&N.max&&N.min[0]>S&&N.min[1]>B&&N.max[0]<C&&N.max[1]<X));let k=!1;for(const N of b.filter(O=>O.type==="multiplestroke"))for(const O of N.multipath||[])O.visible&&O.type==="stroke"&&O.min&&O.max&&O.min[0]>S&&O.min[1]>B&&O.max[0]<C&&O.max[1]<X&&(k=!0);if(w.length>0||k){for(const N of b.filter(O=>O.type==="multiplestroke"))for(const O of N?.multipath||[])O.visible&&O.min&&O.max&&O.min[0]>S&&O.min[1]>B&&O.max[0]<C&&O.max[1]<X&&(O.selected=!0);for(const N of w)N.selected=!0;d(m,[...b],!0),console.log(w),Ua({minX:r(ee),minY:r(te),maxX:r(J),maxY:r(G),strokes:w,id:l(),draw_id:f()})}else d(ee,0),d(te,0),d(J,0),d(G,0)}d(j,"idle"),u?.pointerId&&u.target?.releasePointerCapture?.(u.pointerId)}ra(()=>{d(z,t.$$host?.shadowRoot?.querySelector("svg"),!0),d(we,t.$$host?.shadowRoot?.querySelector("#container"),!0);let u=0;const b=setInterval(()=>{d(z,t.$$host?.shadowRoot?.querySelector("svg"),!0),r(z)?clearInterval(b):(u++,u>10?(clearInterval(b),console.warn("no canvas found on check "+u)):console.error("no canvas found on check "+u+" end"))},100);if(!r(z))return console.error("no canvas found on mount")});var ao={get id(){return l()},set id(u=""){l(u),ve()},get load_draw(){return o()},set load_draw(u){o(u),ve()},get draw_id(){return f()},set draw_id(u=Math.random().toString(36)+Math.random().toString(36)+Date.now().toString()){f(u),ve()},get background_color(){return c()},set background_color(u="rgb(255,255,255)"){c(u),ve()},get pen_color(){return h()},set pen_color(u="rgb(0,0,0)"){h(u),ve()},get insert_image(){return _()},set insert_image(u=void 0){_(u),ve()},get insert_text(){return p()},set insert_text(u){p(u),ve()},get pen_opacity(){return g()},set pen_opacity(u=1){g(u),ve()},get options(){return v()},set options(u=i){v(u),ve()},get goto(){return E()},set goto(u=void 0){E(u),ve()},get mode(){return x()},set mode(u="draw"){x(u),ve()},get debug(){return Q()},set debug(u="no"){Q(u),ve()},get save_as(){return D()},set save_as(u=void 0){D(u),ve()},get size(){return V()},set size(u=Object.assign({},s)){V(u),ve()},get view(){return re()},set view(u=Object.assign({},a)){re(u),ve()}},Xi=Xa(),Vn=W(Xi),oo=$t(Vn);xt(Vn);var zi=ni(Vn,2),an=$t(zi);an.__pointerdown=ro,an.__pointermove=io,an.__pointerup=so;var lo=$t(an);{var fo=u=>{var b=Fa(),S=$t(b);Br(S,17,()=>r(m),X=>X.id,(X,w,k,N)=>{var O=K(),ne=W(O);{var De=$n=>{var Wn=K(),gr=W(Wn);{var Dt=At=>{var zt=K(),Sn=W(zt);{var st=gt=>{var Ht=K(),Bt=W(Ht);{var R=be=>{var se=Sa();oe(()=>{T(se,"id","path_"+r(w).id),T(se,"d",r(w).pathData),T(se,"fill",r(w).color),T(se,"fill-opacity",r(w).opacity)}),I(be,se)},on=be=>{var se=K(),Vt=W(se);{var ln=xe=>{var Ee=Ta();oe(()=>{T(Ee,"id","path_"+r(w).id),T(Ee,"href",r(w).pathData)}),I(xe,Ee)},Tn=xe=>{var Ee=K(),at=W(Ee);{var mt=Ke=>{var Pe=Da(),Wt=$t(Pe,!0);xt(Pe),oe(()=>{T(Pe,"id","path_"+r(w).id),_n(Wt,r(w).pathData)}),I(Ke,Pe)};U(at,Ke=>{r(w).type==="text"&&Ke(mt)},!0)}I(xe,Ee)};U(Vt,xe=>{r(w).type==="image"?xe(ln):xe(Tn,!1)},!0)}I(be,se)};U(Bt,be=>{r(w).type==="stroke"?be(R):be(on,!1)})}I(gt,Ht)},ue=gt=>{var Ht=K(),Bt=W(Ht);{var R=be=>{var se=Aa();oe(()=>{T(se,"id","path_"+r(w).id),T(se,"d",r(w).pathData),T(se,"fill",r(w).color),T(se,"fill-opacity",r(w).opacity)}),I(be,se)},on=be=>{var se=K(),Vt=W(se);{var ln=xe=>{var Ee=Ia();oe(()=>{T(Ee,"id","path_"+r(w).id),T(Ee,"href",r(w).pathData)}),I(xe,Ee)},Tn=xe=>{var Ee=K(),at=W(Ee);{var mt=Ke=>{var Pe=Ma(),Wt=$t(Pe,!0);xt(Pe),oe(()=>{T(Pe,"id","path_"+r(w).id),_n(Wt,r(w).pathData)}),I(Ke,Pe)};U(at,Ke=>{!r(w).selected&&r(w).type==="text"&&Ke(mt)},!0)}I(xe,Ee)};U(Vt,xe=>{!r(w).selected&&r(w).type==="image"?xe(ln):xe(Tn,!1)},!0)}I(be,se)};U(Bt,be=>{!r(w).selected&&r(w).type==="stroke"?be(R):be(on,!1)},!0)}I(gt,Ht)};U(Sn,gt=>{r(w).selected?gt(st):gt(ue,!1)})}I(At,zt)},it=At=>{var zt=K(),Sn=W(zt);{var st=ue=>{var gt=K(),Ht=W(gt);Br(Ht,17,()=>r(w).multipath,Bt=>Bt.id+r(w).id,(Bt,R)=>{var on=K(),be=W(on);{var se=Vt=>{var ln=K(),Tn=W(ln);{var xe=at=>{var mt=K(),Ke=W(mt);{var Pe=Ce=>{var ce=Oa();oe(()=>{T(ce,"id","path_"+r(R).id+"_"+r(w).id),T(ce,"d",r(R).pathData),T(ce,"fill",r(R).color),T(ce,"fill-opacity",r(R).opacity)}),I(Ce,ce)},Wt=Ce=>{var ce=K(),mr=W(ce);{var wr=Re=>{var qe=ka();oe(()=>{T(qe,"id","path_"+r(R).id+"_"+r(w).id),T(qe,"href",r(R).pathData)}),I(Re,qe)},yr=Re=>{var qe=K(),br=W(qe);{var xr=Ut=>{var wt=Na(),Er=$t(wt,!0);xt(wt),oe(()=>{T(wt,"id","path_"+r(R).id+"_"+r(w).id),_n(Er,r(R).pathData)}),I(Ut,wt)};U(br,Ut=>{r(R).type==="text"&&Ut(xr)},!0)}I(Re,qe)};U(mr,Re=>{r(R).type==="image"?Re(wr):Re(yr,!1)},!0)}I(Ce,ce)};U(Ke,Ce=>{r(R).type==="stroke"?Ce(Pe):Ce(Wt,!1)})}I(at,mt)},Ee=at=>{var mt=K(),Ke=W(mt);{var Pe=Ce=>{var ce=Pa();oe(()=>{T(ce,"id","path_"+r(R).id+"_"+r(w).id),T(ce,"d",r(R).pathData),T(ce,"fill",r(R).color),T(ce,"fill-opacity",r(R).opacity)}),I(Ce,ce)},Wt=Ce=>{var ce=K(),mr=W(ce);{var wr=Re=>{var qe=Ca();oe(()=>{T(qe,"id","path_"+r(R).id+"_"+r(w).id),T(qe,"href",r(R).pathData)}),I(Re,qe)},yr=Re=>{var qe=K(),br=W(qe);{var xr=Ut=>{var wt=Ra(),Er=$t(wt,!0);xt(wt),oe(()=>{T(wt,"id","path_"+r(R).id+"_"+r(w).id),_n(Er,r(R).pathData)}),I(Ut,wt)};U(br,Ut=>{!r(R).selected&&r(R).type==="text"&&Ut(xr)},!0)}I(Re,qe)};U(mr,Re=>{!r(R).selected&&r(R).type==="image"?Re(wr):Re(yr,!1)},!0)}I(Ce,ce)};U(Ke,Ce=>{!r(R).selected&&r(R).type==="stroke"?Ce(Pe):Ce(Wt,!1)},!0)}I(at,mt)};U(Tn,at=>{r(R).selected?at(xe):at(Ee,!1)})}I(Vt,ln)};U(be,Vt=>{r(R).actionIndex<=r(y)&&!r(F)&&(r(R).visible||r(R).erasedAtIndex&&r(R).erasedAtIndex>r(y))&&Vt(se)})}I(Bt,on)}),I(ue,gt)};U(Sn,ue=>{r(w).type==="multiplestroke"&&r(w).multipath&&ue(st)},!0)}I(At,zt)};U(gr,At=>{r(w).type==="stroke"||r(w).type==="image"||r(w).type==="text"?At(Dt):At(it,!1)})}I($n,Wn)};U(ne,$n=>{r(w).actionIndex<=r(y)&&!r(F)&&(r(w).visible||r(w).erasedAtIndex&&r(w).erasedAtIndex>r(y))&&$n(De)})}I(X,O)});var B=ni(S);{var C=X=>{var w=K(),k=W(w);{var N=ne=>{var De=qa();oe(()=>{T(De,"x",r(ee)),T(De,"y",r(te)),T(De,"width",r(J)-r(ee)),T(De,"height",r(G)-r(te))}),I(ne,De)},O=ne=>{var De=K(),$n=W(De);{var Wn=Dt=>{var it=La();oe(()=>{T(it,"x",r(J)),T(it,"y",r(te)),T(it,"width",r(ee)-r(J)),T(it,"height",r(G)-r(te))}),I(Dt,it)},gr=Dt=>{var it=K(),At=W(it);{var zt=st=>{var ue=ja();oe(()=>{T(ue,"x",r(ee)),T(ue,"y",r(G)),T(ue,"width",r(J)-r(ee)),T(ue,"height",r(te)-r(G))}),I(st,ue)},Sn=st=>{var ue=Ya();oe(()=>{T(ue,"x",r(J)),T(ue,"y",r(G)),T(ue,"width",r(ee)-r(J)),T(ue,"height",r(te)-r(G))}),I(st,ue)};U(At,st=>{r(ee)<r(J)&&r(te)>r(G)?st(zt):st(Sn,!1)},!0)}I(Dt,it)};U($n,Dt=>{r(ee)>r(J)&&r(te)<r(G)?Dt(Wn):Dt(gr,!1)},!0)}I(ne,De)};U(k,ne=>{r(ee)<=r(J)&&r(te)<=r(G)?ne(N):ne(O,!1)})}I(X,w)};U(B,X=>{x()==="select"&&X(C)})}xt(b),I(u,b)};U(lo,u=>{r(z)&&u(fo)})}return xt(an),xt(zi),oe(()=>{Ai(Vn,`display:${Q()==="yes"?"block":"none"}`),_n(oo,`${r(ze)??""} b: ${r(ye)??""}`),Ai(an,`background-color:${c()??""};cursor:${r(fe)===!0?"move":"default"}`)}),I(e,Xi),qr(ao)}Js(["pointerdown","pointermove","pointerup"]),customElements.define("hb-stylus-paper",va(ji,{id:{},load_draw:{},draw_id:{},background_color:{},pen_color:{},insert_image:{},insert_text:{},pen_opacity:{},options:{},goto:{},mode:{},debug:{},save_as:{},size:{},view:{}},[],[],!0)),$r.Component=ji,Object.defineProperty($r,Symbol.toStringTag,{value:"Module"})})(this["stylus-paper"]=this["stylus-paper"]||{});
|
|
1
|
+
(function(wr){"use strict";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add("5");const ns=1,rs=2,is=16,ss=1,os=4,as=8,ls=16,fs=2,yr="[",Pn="[!",br="[?",Ln="]",Ft={},se=Symbol(),xr="http://www.w3.org/1999/xhtml",us=!1;var Er=Array.isArray,cs=Array.prototype.indexOf,Xt=Array.prototype.includes,mn=Array.from,wn=Object.keys,yn=Object.defineProperty,Et=Object.getOwnPropertyDescriptor,ds=Object.getOwnPropertyDescriptors,hs=Object.prototype,vs=Array.prototype,$r=Object.getPrototypeOf,Sr=Object.isExtensible;const ps=()=>{};function _s(e){for(var t=0;t<e.length;t++)e[t]()}function Tr(){var e,t,n=new Promise((r,s)=>{e=r,t=s});return{promise:n,resolve:e,reject:t}}const ie=2,zt=4,bn=8,Dr=1<<24,it=16,Le=32,st=64,qn=128,Me=512,re=1024,ce=2048,He=4096,Se=8192,ke=16384,ot=32768,Ar=1<<25,Ht=65536,Ir=1<<17,gs=1<<18,$t=1<<19,ms=1<<20,Ke=1<<25,St=65536,jn=1<<21,Yn=1<<22,at=1<<23,xn=Symbol("$state"),Mr=Symbol("legacy props"),ws=Symbol(""),Ze=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},ys=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml"),En=3,en=8;function bs(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function xs(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Es(e,t,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function $s(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Ss(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Ts(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Ds(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function As(){throw new Error("https://svelte.dev/e/hydration_failed")}function Is(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function Ms(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function ks(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Os(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Ns(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function $n(e){console.warn("https://svelte.dev/e/hydration_mismatch")}function Rs(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let Y=!1;function Qe(e){Y=e}let C;function Te(e){if(e===null)throw $n(),Ft;return C=e}function Sn(){return Te(Be(C))}function lt(e){if(Y){if(Be(C)!==null)throw $n(),Ft;C=e}}function Cs(e=1){if(Y){for(var t=e,n=C;t--;)n=Be(n);C=n}}function Tn(e=!0){for(var t=0,n=C;;){if(n.nodeType===en){var r=n.data;if(r===Ln){if(t===0)return n;t-=1}else(r===yr||r===Pn||r[0]==="["&&!isNaN(Number(r.slice(1))))&&(t+=1)}var s=Be(n);e&&n.remove(),n=s}}function kr(e){if(!e||e.nodeType!==en)throw $n(),Ft;return e.data}function Or(e){return e===this.v}function Ps(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Nr(e){return!Ps(e,this.v)}let Ls=!1,De=null;function Bt(e){De=e}function Rr(e,t=!1,n){De={p:De,i:!1,c:null,e:null,s:e,x:null,r:N,l:null}}function Cr(e){var t=De,n=t.e;if(n!==null){t.e=null;for(var r of n)fi(r)}return e!==void 0&&(t.x=e),t.i=!0,De=t.p,e??{}}function Pr(){return!0}let Tt=[];function Lr(){var e=Tt;Tt=[],_s(e)}function Vt(e){if(Tt.length===0&&!tn){var t=Tt;queueMicrotask(()=>{t===Tt&&Lr()})}Tt.push(e)}function qs(){for(;Tt.length>0;)Lr()}function qr(e){var t=N;if(t===null)return O.f|=at,e;if((t.f&ot)===0&&(t.f&zt)===0)throw e;ft(e,t)}function ft(e,t){for(;t!==null;){if((t.f&qn)!==0){if((t.f&ot)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}const js=-7169;function ee(e,t){e.f=e.f&js|t}function Fn(e){(e.f&Me)!==0||e.deps===null?ee(e,re):ee(e,He)}function jr(e){if(e!==null)for(const t of e)(t.f&ie)===0||(t.f&St)===0||(t.f^=St,jr(t.deps))}function Yr(e,t,n){(e.f&ce)!==0?t.add(e):(e.f&He)!==0&&n.add(e),jr(e.deps),ee(e,re)}let Dn=!1;function Ys(e){var t=Dn;try{return Dn=!1,[e(),Dn]}finally{Dn=t}}const ut=new Set;let V=null,qe=null,Xn=null,tn=!1,zn=!1,Wt=null,An=null;var Fr=0;let Fs=1;class et{id=Fs++;current=new Map;previous=new Map;#e=new Set;#n=new Set;#t=new Map;#i=new Map;#s=null;#r=[];#o=new Set;#a=new Set;#l=new Map;is_fork=!1;#c=!1;#f=new Set;#d(){return this.is_fork||this.#i.size>0}#v(){for(const r of this.#f)for(const s of r.#i.keys()){for(var t=!1,n=s;n.parent!==null;){if(this.#l.has(n)){t=!0;break}n=n.parent}if(!t)return!0}return!1}skip_effect(t){this.#l.has(t)||this.#l.set(t,{d:[],m:[]})}unskip_effect(t){var n=this.#l.get(t);if(n){this.#l.delete(t);for(var r of n.d)ee(r,ce),this.schedule(r);for(r of n.m)ee(r,He),this.schedule(r)}}#h(){if(Fr++>1e3&&(ut.delete(this),Xs()),!this.#d()){for(const a of this.#o)this.#a.delete(a),ee(a,ce),this.schedule(a);for(const a of this.#a)ee(a,He),this.schedule(a)}const t=this.#r;this.#r=[],this.apply();var n=Wt=[],r=[],s=An=[];for(const a of t)try{this.#u(a,n,r)}catch(f){throw Vr(a),f}if(V=null,s.length>0){var o=et.ensure();for(const a of s)o.schedule(a)}if(Wt=null,An=null,this.#d()||this.#v()){this.#p(r),this.#p(n);for(const[a,f]of this.#l)Br(a,f)}else{this.#t.size===0&&ut.delete(this),this.#o.clear(),this.#a.clear();for(const a of this.#e)a(this);this.#e.clear(),Xr(r),Xr(n),this.#s?.resolve()}var l=V;if(this.#r.length>0){const a=l??=this;a.#r.push(...this.#r.filter(f=>!a.#r.includes(f)))}l!==null&&(ut.add(l),l.#h()),ut.has(this)||this.#_()}#u(t,n,r){t.f^=re;for(var s=t.first;s!==null;){var o=s.f,l=(o&(Le|st))!==0,a=l&&(o&re)!==0,f=a||(o&Se)!==0||this.#l.has(s);if(!f&&s.fn!==null){l?s.f^=re:(o&zt)!==0?n.push(s):sn(s)&&((o&it)!==0&&this.#a.add(s),Jt(s));var c=s.first;if(c!==null){s=c;continue}}for(;s!==null;){var h=s.next;if(h!==null){s=h;break}s=s.parent}}}#p(t){for(var n=0;n<t.length;n+=1)Yr(t[n],this.#o,this.#a)}capture(t,n,r=!1){n!==se&&!this.previous.has(t)&&this.previous.set(t,n),(t.f&at)===0&&(this.current.set(t,[t.v,r]),qe?.set(t,t.v))}activate(){V=this}deactivate(){V=null,qe=null}flush(){try{zn=!0,V=this,this.#h()}finally{Fr=0,Xn=null,Wt=null,An=null,zn=!1,V=null,qe=null,ct.clear()}}discard(){for(const t of this.#n)t(this);this.#n.clear(),ut.delete(this)}#_(){for(const c of ut){var t=c.id<this.id,n=[];for(const[h,[_,v]]of this.current){if(c.current.has(h)){var r=c.current.get(h)[0];if(t&&_!==r)c.current.set(h,[_,v]);else continue}n.push(h)}var s=[...c.current.keys()].filter(h=>!this.current.has(h));if(s.length===0)t&&c.discard();else if(n.length>0){c.activate();var o=new Set,l=new Map;for(var a of n)zr(a,s,o,l);if(c.#r.length>0){c.apply();for(var f of c.#r)c.#u(f,[],[]);c.#r=[]}c.deactivate()}}for(const c of ut)c.#f.has(this)&&(c.#f.delete(this),c.#f.size===0&&!c.#d()&&(c.activate(),c.#h()))}increment(t,n){let r=this.#t.get(n)??0;if(this.#t.set(n,r+1),t){let s=this.#i.get(n)??0;this.#i.set(n,s+1)}}decrement(t,n,r){let s=this.#t.get(n)??0;if(s===1?this.#t.delete(n):this.#t.set(n,s-1),t){let o=this.#i.get(n)??0;o===1?this.#i.delete(n):this.#i.set(n,o-1)}this.#c||r||(this.#c=!0,Vt(()=>{this.#c=!1,this.flush()}))}transfer_effects(t,n){for(const r of t)this.#o.add(r);for(const r of n)this.#a.add(r);t.clear(),n.clear()}oncommit(t){this.#e.add(t)}ondiscard(t){this.#n.add(t)}settled(){return(this.#s??=Tr()).promise}static ensure(){if(V===null){const t=V=new et;zn||(ut.add(V),tn||Vt(()=>{V===t&&t.flush()}))}return V}apply(){{qe=null;return}}schedule(t){if(Xn=t,t.b?.is_pending&&(t.f&(zt|bn|Dr))!==0&&(t.f&ot)===0){t.b.defer_effect(t);return}for(var n=t;n.parent!==null;){n=n.parent;var r=n.f;if(Wt!==null&&n===N&&(O===null||(O.f&ie)===0))return;if((r&(st|Le))!==0){if((r&re)===0)return;n.f^=re}}this.#r.push(n)}}function de(e){var t=tn;tn=!0;try{for(var n;;){if(qs(),V===null)return n;V.flush()}}finally{tn=t}}function Xs(){try{Ds()}catch(e){ft(e,Xn)}}let tt=null;function Xr(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if((r.f&(ke|Se))===0&&sn(r)&&(tt=new Set,Jt(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&di(r),tt?.size>0)){ct.clear();for(const s of tt){if((s.f&(ke|Se))!==0)continue;const o=[s];let l=s.parent;for(;l!==null;)tt.has(l)&&(tt.delete(l),o.push(l)),l=l.parent;for(let a=o.length-1;a>=0;a--){const f=o[a];(f.f&(ke|Se))===0&&Jt(f)}}tt.clear()}}tt=null}}function zr(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const s of e.reactions){const o=s.f;(o&ie)!==0?zr(s,t,n,r):(o&(Yn|it))!==0&&(o&ce)===0&&Hr(s,t,r)&&(ee(s,ce),Hn(s))}}function Hr(e,t,n){const r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const s of e.deps){if(Xt.call(t,s))return!0;if((s.f&ie)!==0&&Hr(s,t,n))return n.set(s,!0),!0}return n.set(e,!1),!1}function Hn(e){V.schedule(e)}function Br(e,t){if(!((e.f&Le)!==0&&(e.f&re)!==0)){(e.f&ce)!==0?t.d.push(e):(e.f&He)!==0&&t.m.push(e),ee(e,re);for(var n=e.first;n!==null;)Br(n,t),n=n.next}}function Vr(e){ee(e,re);for(var t=e.first;t!==null;)Vr(t),t=t.next}function zs(e){let t=0,n=Dt(0),r;return()=>{Kn()&&(i(n),ui(()=>(t===0&&(r=nr(()=>e(()=>rn(n)))),t+=1,()=>{Vt(()=>{t-=1,t===0&&(r?.(),r=void 0,rn(n))})})))}}var Hs=Ht|$t;function Bs(e,t,n,r){new Vs(e,t,n,r)}class Vs{parent;is_pending=!1;transform_error;#e;#n=Y?C:null;#t;#i;#s;#r=null;#o=null;#a=null;#l=null;#c=0;#f=0;#d=!1;#v=new Set;#h=new Set;#u=null;#p=zs(()=>(this.#u=Dt(this.#c),()=>{this.#u=null}));constructor(t,n,r,s){this.#e=t,this.#t=n,this.#i=o=>{var l=N;l.b=this,l.f|=qn,r(o)},this.parent=N.b,this.transform_error=s??this.parent?.transform_error??(o=>o),this.#s=Zn(()=>{if(Y){const o=this.#n;Sn();const l=o.data===Pn;if(o.data.startsWith(br)){const f=JSON.parse(o.data.slice(br.length));this.#b(f)}else l?this.#x():this.#_()}else this.#w()},Hs),Y&&(this.#e=C)}#_(){try{this.#r=Oe(()=>this.#i(this.#e))}catch(t){this.error(t)}}#b(t){const n=this.#t.failed;n&&(this.#a=Oe(()=>{n(this.#e,()=>t,()=>()=>{})}))}#x(){const t=this.#t.pending;t&&(this.is_pending=!0,this.#o=Oe(()=>t(this.#e)),Vt(()=>{var n=this.#l=document.createDocumentFragment(),r=je();n.append(r),this.#r=this.#m(()=>Oe(()=>this.#i(r))),this.#f===0&&(this.#e.before(n),this.#l=null,It(this.#o,()=>{this.#o=null}),this.#g(V))}))}#w(){try{if(this.is_pending=this.has_pending_snippet(),this.#f=0,this.#c=0,this.#r=Oe(()=>{this.#i(this.#e)}),this.#f>0){var t=this.#l=document.createDocumentFragment();tr(this.#r,t);const n=this.#t.pending;this.#o=Oe(()=>n(this.#e))}else this.#g(V)}catch(n){this.error(n)}}#g(t){this.is_pending=!1,t.transfer_effects(this.#v,this.#h)}defer_effect(t){Yr(t,this.#v,this.#h)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#t.pending}#m(t){var n=N,r=O,s=De;Ue(this.#s),Ne(this.#s),Bt(this.#s.ctx);try{return et.ensure(),t()}catch(o){return qr(o),null}finally{Ue(n),Ne(r),Bt(s)}}#y(t,n){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(t,n);return}this.#f+=t,this.#f===0&&(this.#g(n),this.#o&&It(this.#o,()=>{this.#o=null}),this.#l&&(this.#e.before(this.#l),this.#l=null))}update_pending_count(t,n){this.#y(t,n),this.#c+=t,!(!this.#u||this.#d)&&(this.#d=!0,Vt(()=>{this.#d=!1,this.#u&&Ut(this.#u,this.#c)}))}get_effect_pending(){return this.#p(),i(this.#u)}error(t){var n=this.#t.onerror;let r=this.#t.failed;if(!n&&!r)throw t;this.#r&&(_e(this.#r),this.#r=null),this.#o&&(_e(this.#o),this.#o=null),this.#a&&(_e(this.#a),this.#a=null),Y&&(Te(this.#n),Cs(),Te(Tn()));var s=!1,o=!1;const l=()=>{if(s){Rs();return}s=!0,o&&Ns(),this.#a!==null&&It(this.#a,()=>{this.#a=null}),this.#m(()=>{this.#w()})},a=f=>{try{o=!0,n?.(f,l),o=!1}catch(c){ft(c,this.#s&&this.#s.parent)}r&&(this.#a=this.#m(()=>{try{return Oe(()=>{var c=N;c.b=this,c.f|=qn,r(this.#e,()=>f,()=>l)})}catch(c){return ft(c,this.#s.parent),null}}))};Vt(()=>{var f;try{f=this.transform_error(t)}catch(c){ft(c,this.#s&&this.#s.parent);return}f!==null&&typeof f=="object"&&typeof f.then=="function"?f.then(a,c=>ft(c,this.#s&&this.#s.parent)):a(f)})}}function Ws(e,t,n,r){const s=Bn;var o=e.filter(v=>!v.settled);if(n.length===0&&o.length===0){r(t.map(s));return}var l=N,a=Us(),f=o.length===1?o[0].promise:o.length>1?Promise.all(o.map(v=>v.promise)):null;function c(v){a();try{r(v)}catch(g){(l.f&ke)===0&&ft(g,l)}In()}if(n.length===0){f.then(()=>c(t.map(s)));return}var h=Wr();function _(){Promise.all(n.map(v=>Js(v))).then(v=>c([...t.map(s),...v])).catch(v=>ft(v,l)).finally(()=>h())}f?f.then(()=>{a(),_(),In()}):_()}function Us(){var e=N,t=O,n=De,r=V;return function(o=!0){Ue(e),Ne(t),Bt(n),o&&(e.f&ke)===0&&(r?.activate(),r?.apply())}}function In(e=!0){Ue(null),Ne(null),Bt(null),e&&V?.deactivate()}function Wr(){var e=N,t=e.b,n=V,r=t.is_rendered();return t.update_pending_count(1,n),n.increment(r,e),(s=!1)=>{t.update_pending_count(-1,n),n.decrement(r,e,s)}}function Bn(e){var t=ie|ce,n=O!==null&&(O.f&ie)!==0?O:null;return N!==null&&(N.f|=$t),{ctx:De,deps:null,effects:null,equals:Or,f:t,fn:e,reactions:null,rv:0,v:se,wv:0,parent:n??N,ac:null}}function Js(e,t,n){let r=N;r===null&&xs();var s=void 0,o=Dt(se),l=!O,a=new Map;return oo(()=>{var f=N,c=Tr();s=c.promise;try{Promise.resolve(e()).then(c.resolve,c.reject).finally(In)}catch(g){c.reject(g),In()}var h=V;if(l){if((f.f&ot)!==0)var _=Wr();if(r.b.is_rendered())a.get(h)?.reject(Ze),a.delete(h);else{for(const g of a.values())g.reject(Ze);a.clear()}a.set(h,c)}const v=(g,d=void 0)=>{if(_){var y=d===Ze;_(y)}if(!(d===Ze||(f.f&ke)!==0)){if(h.activate(),d)o.f|=at,Ut(o,d);else{(o.f&at)!==0&&(o.f^=at),Ut(o,g);for(const[E,D]of a){if(a.delete(E),E===h)break;D.reject(Ze)}}h.deactivate()}};c.promise.then(v,g=>v(null,g||"unknown"))}),no(()=>{for(const f of a.values())f.reject(Ze)}),new Promise(f=>{function c(h){function _(){h===s?f(o):c(s)}h.then(_,_)}c(s)})}function Ur(e){const t=Bn(e);return t.equals=Nr,t}function Gs(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)_e(t[n])}}function Ks(e){for(var t=e.parent;t!==null;){if((t.f&ie)===0)return(t.f&ke)===0?t:null;t=t.parent}return null}function Vn(e){var t,n=N;Ue(Ks(e));try{e.f&=~St,Gs(e),t=yi(e)}finally{Ue(n)}return t}function Jr(e){var t=e.v,n=Vn(e);if(!e.equals(n)&&(e.wv=mi(),(!V?.is_fork||e.deps===null)&&(e.v=n,V?.capture(e,t,!0),e.deps===null))){ee(e,re);return}vt||(qe!==null?(Kn()||V?.is_fork)&&qe.set(e,n):Fn(e))}function Zs(e){if(e.effects!==null)for(const t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(Ze),t.teardown=ps,t.ac=null,on(t,0),Qn(t))}function Gr(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&Jt(t)}let Wn=new Set;const ct=new Map;let Kr=!1;function Dt(e,t){var n={f:0,v:e,reactions:null,equals:Or,rv:0,wv:0};return n}function A(e,t){const n=Dt(e);return fo(n),n}function Zr(e,t=!1,n=!0){const r=Dt(e);return t||(r.equals=Nr),r}function p(e,t,n=!1){O!==null&&(!Ye||(O.f&Ir)!==0)&&Pr()&&(O.f&(ie|it|Yn|Ir))!==0&&(Re===null||!Xt.call(Re,e))&&Os();let r=n?dt(t):t;return Ut(e,r,An)}function Ut(e,t,n=null){if(!e.equals(t)){var r=e.v;vt?ct.set(e,t):ct.set(e,r),e.v=t;var s=et.ensure();if(s.capture(e,r),(e.f&ie)!==0){const o=e;(e.f&ce)!==0&&Vn(o),qe===null&&Fn(o)}e.wv=mi(),Qr(e,ce,n),N!==null&&(N.f&re)!==0&&(N.f&(Le|st))===0&&(Ce===null?uo([e]):Ce.push(e)),!s.is_fork&&Wn.size>0&&!Kr&&Qs()}return t}function Qs(){Kr=!1;for(const e of Wn)(e.f&re)!==0&&ee(e,He),sn(e)&&Jt(e);Wn.clear()}function nn(e,t=1){var n=i(e),r=t===1?n++:n--;return p(e,n),r}function rn(e){p(e,e.v+1)}function Qr(e,t,n){var r=e.reactions;if(r!==null)for(var s=r.length,o=0;o<s;o++){var l=r[o],a=l.f,f=(a&ce)===0;if(f&&ee(l,t),(a&ie)!==0){var c=l;qe?.delete(c),(a&St)===0&&(a&Me&&(l.f|=St),Qr(c,He,n))}else if(f){var h=l;(a&it)!==0&&tt!==null&&tt.add(h),n!==null?n.push(h):Hn(h)}}}function dt(e){if(typeof e!="object"||e===null||xn in e)return e;const t=$r(e);if(t!==hs&&t!==vs)return e;var n=new Map,r=Er(e),s=A(0),o=kt,l=a=>{if(kt===o)return a();var f=O,c=kt;Ne(null),gi(o);var h=a();return Ne(f),gi(c),h};return r&&n.set("length",A(e.length)),new Proxy(e,{defineProperty(a,f,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&Ms();var h=n.get(f);return h===void 0?l(()=>{var _=A(c.value);return n.set(f,_),_}):p(h,c.value,!0),!0},deleteProperty(a,f){var c=n.get(f);if(c===void 0){if(f in a){const h=l(()=>A(se));n.set(f,h),rn(s)}}else p(c,se),rn(s);return!0},get(a,f,c){if(f===xn)return e;var h=n.get(f),_=f in a;if(h===void 0&&(!_||Et(a,f)?.writable)&&(h=l(()=>{var g=dt(_?a[f]:se),d=A(g);return d}),n.set(f,h)),h!==void 0){var v=i(h);return v===se?void 0:v}return Reflect.get(a,f,c)},getOwnPropertyDescriptor(a,f){var c=Reflect.getOwnPropertyDescriptor(a,f);if(c&&"value"in c){var h=n.get(f);h&&(c.value=i(h))}else if(c===void 0){var _=n.get(f),v=_?.v;if(_!==void 0&&v!==se)return{enumerable:!0,configurable:!0,value:v,writable:!0}}return c},has(a,f){if(f===xn)return!0;var c=n.get(f),h=c!==void 0&&c.v!==se||Reflect.has(a,f);if(c!==void 0||N!==null&&(!h||Et(a,f)?.writable)){c===void 0&&(c=l(()=>{var v=h?dt(a[f]):se,g=A(v);return g}),n.set(f,c));var _=i(c);if(_===se)return!1}return h},set(a,f,c,h){var _=n.get(f),v=f in a;if(r&&f==="length")for(var g=c;g<_.v;g+=1){var d=n.get(g+"");d!==void 0?p(d,se):g in a&&(d=l(()=>A(se)),n.set(g+"",d))}if(_===void 0)(!v||Et(a,f)?.writable)&&(_=l(()=>A(void 0)),p(_,dt(c)),n.set(f,_));else{v=_.v!==se;var y=l(()=>dt(c));p(_,y)}var E=Reflect.getOwnPropertyDescriptor(a,f);if(E?.set&&E.set.call(h,c),!v){if(r&&typeof f=="string"){var D=n.get("length"),$=Number(f);Number.isInteger($)&&$>=D.v&&p(D,$+1)}rn(s)}return!0},ownKeys(a){i(s);var f=Reflect.ownKeys(a).filter(_=>{var v=n.get(_);return v===void 0||v.v!==se});for(var[c,h]of n)h.v!==se&&!(c in a)&&f.push(c);return f},setPrototypeOf(){ks()}})}var ei,ti,ni,ri;function Un(){if(ei===void 0){ei=window,ti=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;ni=Et(t,"firstChild").get,ri=Et(t,"nextSibling").get,Sr(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Sr(n)&&(n.__t=void 0)}}function je(e=""){return document.createTextNode(e)}function At(e){return ni.call(e)}function Be(e){return ri.call(e)}function ht(e,t){if(!Y)return At(e);var n=At(C);if(n===null)n=C.appendChild(je());else if(t&&n.nodeType!==En){var r=je();return n?.before(r),Te(r),r}return t&&Gn(n),Te(n),n}function Ve(e,t=!1){if(!Y){var n=At(e);return n instanceof Comment&&n.data===""?Be(n):n}if(t){if(C?.nodeType!==En){var r=je();return C?.before(r),Te(r),r}Gn(C)}return C}function ii(e,t=1,n=!1){let r=Y?C:e;for(var s;t--;)s=r,r=Be(r);if(!Y)return r;if(n){if(r?.nodeType!==En){var o=je();return r===null?s?.after(o):r.before(o),Te(o),o}Gn(r)}return Te(r),r}function si(e){e.textContent=""}function oi(){return!1}function Jn(e,t,n){return document.createElementNS(xr,e,void 0)}function Gn(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===En;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function ai(e){var t=O,n=N;Ne(null),Ue(null);try{return e()}finally{Ne(t),Ue(n)}}function eo(e){N===null&&(O===null&&Ts(),Ss()),vt&&$s()}function to(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function We(e,t){var n=N;n!==null&&(n.f&Se)!==0&&(e|=Se);var r={ctx:De,deps:null,nodes:null,f:e|ce|Me,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null},s=r;if((e&zt)!==0)Wt!==null?Wt.push(r):et.ensure().schedule(r);else if(t!==null){try{Jt(r)}catch(l){throw _e(r),l}s.deps===null&&s.teardown===null&&s.nodes===null&&s.first===s.last&&(s.f&$t)===0&&(s=s.first,(e&it)!==0&&(e&Ht)!==0&&s!==null&&(s.f|=Ht))}if(s!==null&&(s.parent=n,n!==null&&to(s,n),O!==null&&(O.f&ie)!==0&&(e&st)===0)){var o=O;(o.effects??=[]).push(s)}return r}function Kn(){return O!==null&&!Ye}function no(e){const t=We(bn,null);return ee(t,re),t.teardown=e,t}function li(e){eo();var t=N.f,n=!O&&(t&Le)!==0&&(t&ot)===0;if(n){var r=De;(r.e??=[]).push(e)}else return fi(e)}function fi(e){return We(zt|ms,e)}function ro(e){et.ensure();const t=We(st|$t,e);return()=>{_e(t)}}function io(e){et.ensure();const t=We(st|$t,e);return(n={})=>new Promise(r=>{n.outro?It(t,()=>{_e(t),r(void 0)}):(_e(t),r(void 0))})}function so(e){return We(zt,e)}function oo(e){return We(Yn|$t,e)}function ui(e,t=0){return We(bn|t,e)}function oe(e,t=[],n=[],r=[]){Ws(r,t,n,s=>{We(bn,()=>e(...s.map(i)))})}function Zn(e,t=0){var n=We(it|t,e);return n}function Oe(e){return We(Le|$t,e)}function ci(e){var t=e.teardown;if(t!==null){const n=vt,r=O;pi(!0),Ne(null);try{t.call(null)}finally{pi(n),Ne(r)}}}function Qn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const s=n.ac;s!==null&&ai(()=>{s.abort(Ze)});var r=n.next;(n.f&st)!==0?n.parent=null:_e(n,t),n=r}}function ao(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&Le)===0&&_e(t),t=n}}function _e(e,t=!0){var n=!1;(t||(e.f&gs)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(lo(e.nodes.start,e.nodes.end),n=!0),ee(e,Ar),Qn(e,t&&!n),on(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(const o of r)o.stop();ci(e),e.f^=Ar,e.f|=ke;var s=e.parent;s!==null&&s.first!==null&&di(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function lo(e,t){for(;e!==null;){var n=e===t?null:Be(e);e.remove(),e=n}}function di(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 It(e,t,n=!0){var r=[];hi(e,r,!0);var s=()=>{n&&_e(e),t&&t()},o=r.length;if(o>0){var l=()=>--o||s();for(var a of r)a.out(l)}else s()}function hi(e,t,n){if((e.f&Se)===0){e.f^=Se;var r=e.nodes&&e.nodes.t;if(r!==null)for(const a of r)(a.is_global||n)&&t.push(a);for(var s=e.first;s!==null;){var o=s.next,l=(s.f&Ht)!==0||(s.f&Le)!==0&&(e.f&it)!==0;hi(s,t,l?n:!1),s=o}}}function er(e){vi(e,!0)}function vi(e,t){if((e.f&Se)!==0){e.f^=Se,(e.f&re)===0&&(ee(e,ce),et.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,s=(n.f&Ht)!==0||(n.f&Le)!==0;vi(n,s?t:!1),n=r}var o=e.nodes&&e.nodes.t;if(o!==null)for(const l of o)(l.is_global||t)&&l.in()}}function tr(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var s=n===r?null:Be(n);t.append(n),n=s}}let Mn=!1,vt=!1;function pi(e){vt=e}let O=null,Ye=!1;function Ne(e){O=e}let N=null;function Ue(e){N=e}let Re=null;function fo(e){O!==null&&(Re===null?Re=[e]:Re.push(e))}let we=null,Ae=0,Ce=null;function uo(e){Ce=e}let _i=1,Mt=0,kt=Mt;function gi(e){kt=e}function mi(){return++_i}function sn(e){var t=e.f;if((t&ce)!==0)return!0;if(t&ie&&(e.f&=~St),(t&He)!==0){for(var n=e.deps,r=n.length,s=0;s<r;s++){var o=n[s];if(sn(o)&&Jr(o),o.wv>e.wv)return!0}(t&Me)!==0&&qe===null&&ee(e,re)}return!1}function wi(e,t,n=!0){var r=e.reactions;if(r!==null&&!(Re!==null&&Xt.call(Re,e)))for(var s=0;s<r.length;s++){var o=r[s];(o.f&ie)!==0?wi(o,t,!1):t===o&&(n?ee(o,ce):(o.f&re)!==0&&ee(o,He),Hn(o))}}function yi(e){var t=we,n=Ae,r=Ce,s=O,o=Re,l=De,a=Ye,f=kt,c=e.f;we=null,Ae=0,Ce=null,O=(c&(Le|st))===0?e:null,Re=null,Bt(e.ctx),Ye=!1,kt=++Mt,e.ac!==null&&(ai(()=>{e.ac.abort(Ze)}),e.ac=null);try{e.f|=jn;var h=e.fn,_=h();e.f|=ot;var v=e.deps,g=V?.is_fork;if(we!==null){var d;if(g||on(e,Ae),v!==null&&Ae>0)for(v.length=Ae+we.length,d=0;d<we.length;d++)v[Ae+d]=we[d];else e.deps=v=we;if(Kn()&&(e.f&Me)!==0)for(d=Ae;d<v.length;d++)(v[d].reactions??=[]).push(e)}else!g&&v!==null&&Ae<v.length&&(on(e,Ae),v.length=Ae);if(Pr()&&Ce!==null&&!Ye&&v!==null&&(e.f&(ie|He|ce))===0)for(d=0;d<Ce.length;d++)wi(Ce[d],e);if(s!==null&&s!==e){if(Mt++,s.deps!==null)for(let y=0;y<n;y+=1)s.deps[y].rv=Mt;if(t!==null)for(const y of t)y.rv=Mt;Ce!==null&&(r===null?r=Ce:r.push(...Ce))}return(e.f&at)!==0&&(e.f^=at),_}catch(y){return qr(y)}finally{e.f^=jn,we=t,Ae=n,Ce=r,O=s,Re=o,Bt(l),Ye=a,kt=f}}function co(e,t){let n=t.reactions;if(n!==null){var r=cs.call(n,e);if(r!==-1){var s=n.length-1;s===0?n=t.reactions=null:(n[r]=n[s],n.pop())}}if(n===null&&(t.f&ie)!==0&&(we===null||!Xt.call(we,t))){var o=t;(o.f&Me)!==0&&(o.f^=Me,o.f&=~St),Fn(o),Zs(o),on(o,0)}}function on(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)co(e,n[r])}function Jt(e){var t=e.f;if((t&ke)===0){ee(e,re);var n=N,r=Mn;N=e,Mn=!0;try{(t&(it|Dr))!==0?ao(e):Qn(e),ci(e);var s=yi(e);e.teardown=typeof s=="function"?s:null,e.wv=_i;var o;us&&Ls&&(e.f&ce)!==0&&e.deps}finally{Mn=r,N=n}}}function i(e){var t=e.f,n=(t&ie)!==0;if(O!==null&&!Ye){var r=N!==null&&(N.f&ke)!==0;if(!r&&(Re===null||!Xt.call(Re,e))){var s=O.deps;if((O.f&jn)!==0)e.rv<Mt&&(e.rv=Mt,we===null&&s!==null&&s[Ae]===e?Ae++:we===null?we=[e]:we.push(e));else{(O.deps??=[]).push(e);var o=e.reactions;o===null?e.reactions=[O]:Xt.call(o,O)||o.push(O)}}}if(vt&&ct.has(e))return ct.get(e);if(n){var l=e;if(vt){var a=l.v;return((l.f&re)===0&&l.reactions!==null||xi(l))&&(a=Vn(l)),ct.set(l,a),a}var f=(l.f&Me)===0&&!Ye&&O!==null&&(Mn||(O.f&Me)!==0),c=(l.f&ot)===0;sn(l)&&(f&&(l.f|=Me),Jr(l)),f&&!c&&(Gr(l),bi(l))}if(qe?.has(e))return qe.get(e);if((e.f&at)!==0)throw e.v;return e.v}function bi(e){if(e.f|=Me,e.deps!==null)for(const t of e.deps)(t.reactions??=[]).push(e),(t.f&ie)!==0&&(t.f&Me)===0&&(Gr(t),bi(t))}function xi(e){if(e.v===se)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(ct.has(t)||(t.f&ie)!==0&&xi(t))return!0;return!1}function nr(e){var t=Ye;try{return Ye=!0,e()}finally{Ye=t}}const an=Symbol("events"),Ei=new Set,rr=new Set;function ir(e,t,n){(t[an]??={})[e]=n}function ho(e){for(var t=0;t<e.length;t++)Ei.add(e[t]);for(var n of rr)n(e)}let $i=null;function Si(e){var t=this,n=t.ownerDocument,r=e.type,s=e.composedPath?.()||[],o=s[0]||e.target;$i=e;var l=0,a=$i===e&&e[an];if(a){var f=s.indexOf(a);if(f!==-1&&(t===document||t===window)){e[an]=t;return}var c=s.indexOf(t);if(c===-1)return;f<=c&&(l=f)}if(o=s[l]||e.target,o!==t){yn(e,"currentTarget",{configurable:!0,get(){return o||n}});var h=O,_=N;Ne(null),Ue(null);try{for(var v,g=[];o!==null;){var d=o.assignedSlot||o.parentNode||o.host||null;try{var y=o[an]?.[r];y!=null&&(!o.disabled||e.target===o)&&y.call(o,e)}catch(E){v?g.push(E):v=E}if(e.cancelBubble||d===t||d===null)break;o=d}if(v){for(let E of g)queueMicrotask(()=>{throw E});throw v}}finally{e[an]=t,delete e.currentTarget,Ne(h),Ue(_)}}}const vo=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function po(e){return vo?.createHTML(e)??e}function Ti(e){var t=Jn("template");return t.innerHTML=po(e.replaceAll("<!>","<!---->")),t.content}function Ot(e,t){var n=N;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function _o(e,t){var n=(t&fs)!==0,r,s=!e.startsWith("<!>");return()=>{if(Y)return Ot(C,null),C;r===void 0&&(r=Ti(s?e:"<!>"+e));var o=n||ti?document.importNode(r,!0):r.cloneNode(!0);{var l=At(o),a=o.lastChild;Ot(l,a)}return o}}function go(e,t,n="svg"){var r=!e.startsWith("<!>"),s=`<${n}>${r?e:"<!>"+e}</${n}>`,o;return()=>{if(Y)return Ot(C,null),C;if(!o){var l=Ti(s),a=At(l);o=At(a)}var f=o.cloneNode(!0);return Ot(f,f),f}}function ae(e,t){return go(e,t,"svg")}function nt(){if(Y)return Ot(C,null),C;var e=document.createDocumentFragment(),t=document.createComment(""),n=je();return e.append(t,n),Ot(t,n),e}function X(e,t){if(Y){var n=N;((n.f&ot)===0||n.nodes.end===null)&&(n.nodes.end=C),Sn();return}e!==null&&e.before(t)}const mo=["touchstart","touchmove"];function wo(e){return mo.includes(e)}function ln(e,t){var n=t==null?"":typeof t=="object"?`${t}`:t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=`${n}`)}function Di(e,t){return Ai(e,t)}function yo(e,t){Un(),t.intro=t.intro??!1;const n=t.target,r=Y,s=C;try{for(var o=At(n);o&&(o.nodeType!==en||o.data!==yr);)o=Be(o);if(!o)throw Ft;Qe(!0),Te(o);const l=Ai(e,{...t,anchor:o});return Qe(!1),l}catch(l){if(l instanceof Error&&l.message.split(`
|
|
2
|
+
`).some(a=>a.startsWith("https://svelte.dev/e/")))throw l;return l!==Ft&&console.warn("Failed to hydrate: ",l),t.recover===!1&&As(),Un(),si(n),Qe(!1),Di(e,t)}finally{Qe(r),Te(s)}}const kn=new Map;function Ai(e,{target:t,anchor:n,props:r={},events:s,context:o,intro:l=!0,transformError:a}){Un();var f=void 0,c=io(()=>{var h=n??t.appendChild(je());Bs(h,{pending:()=>{}},g=>{Rr({});var d=De;if(o&&(d.c=o),s&&(r.$$events=s),Y&&Ot(g,null),f=e(g,r)||{},Y&&(N.nodes.end=C,C===null||C.nodeType!==en||C.data!==Ln))throw $n(),Ft;Cr()},a);var _=new Set,v=g=>{for(var d=0;d<g.length;d++){var y=g[d];if(!_.has(y)){_.add(y);var E=wo(y);for(const z of[t,document]){var D=kn.get(z);D===void 0&&(D=new Map,kn.set(z,D));var $=D.get(y);$===void 0?(z.addEventListener(y,Si,{passive:E}),D.set(y,1)):D.set(y,$+1)}}}};return v(mn(Ei)),rr.add(v),()=>{for(var g of _)for(const E of[t,document]){var d=kn.get(E),y=d.get(g);--y==0?(E.removeEventListener(g,Si),d.delete(g),d.size===0&&kn.delete(E)):d.set(g,y)}rr.delete(v),h!==n&&h.parentNode?.removeChild(h)}});return sr.set(f,c),f}let sr=new WeakMap;function bo(e,t){const n=sr.get(e);return n?(sr.delete(e),n(t)):Promise.resolve()}class xo{anchor;#e=new Map;#n=new Map;#t=new Map;#i=new Set;#s=!0;constructor(t,n=!0){this.anchor=t,this.#s=n}#r=t=>{if(this.#e.has(t)){var n=this.#e.get(t),r=this.#n.get(n);if(r)er(r),this.#i.delete(n);else{var s=this.#t.get(n);s&&(this.#n.set(n,s.effect),this.#t.delete(n),s.fragment.lastChild.remove(),this.anchor.before(s.fragment),r=s.effect)}for(const[o,l]of this.#e){if(this.#e.delete(o),o===t)break;const a=this.#t.get(l);a&&(_e(a.effect),this.#t.delete(l))}for(const[o,l]of this.#n){if(o===n||this.#i.has(o))continue;const a=()=>{if(Array.from(this.#e.values()).includes(o)){var c=document.createDocumentFragment();tr(l,c),c.append(je()),this.#t.set(o,{effect:l,fragment:c})}else _e(l);this.#i.delete(o),this.#n.delete(o)};this.#s||!r?(this.#i.add(o),It(l,a,!1)):a()}}};#o=t=>{this.#e.delete(t);const n=Array.from(this.#e.values());for(const[r,s]of this.#t)n.includes(r)||(_e(s.effect),this.#t.delete(r))};ensure(t,n){var r=V,s=oi();if(n&&!this.#n.has(t)&&!this.#t.has(t))if(s){var o=document.createDocumentFragment(),l=je();o.append(l),this.#t.set(t,{effect:Oe(()=>n(l)),fragment:o})}else this.#n.set(t,Oe(()=>n(this.anchor)));if(this.#e.set(r,t),s){for(const[a,f]of this.#n)a===t?r.unskip_effect(f):r.skip_effect(f);for(const[a,f]of this.#t)a===t?r.unskip_effect(f.effect):r.skip_effect(f.effect);r.oncommit(this.#r),r.ondiscard(this.#o)}else Y&&(this.anchor=C),this.#r(r)}}function Eo(e){De===null&&bs(),li(()=>{const t=nr(e);if(typeof t=="function")return t})}function Je(e,t,n=!1){var r;Y&&(r=C,Sn());var s=new xo(e),o=n?Ht:0;function l(a,f){if(Y){var c=kr(r);if(a!==parseInt(c.substring(1))){var h=Tn();Te(h),s.anchor=h,Qe(!1),s.ensure(a,f),Qe(!0);return}}s.ensure(a,f)}Zn(()=>{var a=!1;t((f,c=0)=>{a=!0,l(c,f)}),a||l(-1,null)},o)}function $o(e,t,n){for(var r=[],s=t.length,o,l=t.length,a=0;a<s;a++){let _=t[a];It(_,()=>{if(o){if(o.pending.delete(_),o.done.add(_),o.pending.size===0){var v=e.outrogroups;or(e,mn(o.done)),v.delete(o),v.size===0&&(e.outrogroups=null)}}else l-=1},!1)}if(l===0){var f=r.length===0&&n!==null;if(f){var c=n,h=c.parentNode;si(h),h.append(c),e.items.clear()}or(e,t,!f)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function or(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(const l of e.pending.values())for(const a of l)r.add(e.items.get(a).e)}for(var s=0;s<t.length;s++){var o=t[s];if(r?.has(o)){o.f|=Ke;const l=document.createDocumentFragment();tr(o,l)}else _e(t[s],n)}}var Ii;function Mi(e,t,n,r,s,o=null){var l=e,a=new Map;Y&&Sn();var f=null,c=Ur(()=>{var D=n();return Er(D)?D:D==null?[]:mn(D)}),h,_=new Map,v=!0;function g(D){(E.effect.f&ke)===0&&(E.pending.delete(D),E.fallback=f,So(E,h,l,t,r),f!==null&&(h.length===0?(f.f&Ke)===0?er(f):(f.f^=Ke,un(f,null,l)):It(f,()=>{f=null})))}function d(D){E.pending.delete(D)}var y=Zn(()=>{h=i(c);var D=h.length;let $=!1;if(Y){var z=kr(l)===Pn;z!==(D===0)&&(l=Tn(),Te(l),Qe(!1),$=!0)}for(var te=new Set,P=V,ne=oi(),w=0;w<D;w+=1){Y&&C.nodeType===en&&C.data===Ln&&(l=C,$=!0,Qe(!1));var U=h[w],ye=r(U,w),F=v?null:a.get(ye);F?(F.v&&Ut(F.v,U),F.i&&Ut(F.i,w),ne&&P.unskip_effect(F.e)):(F=To(a,v?l:Ii??=je(),U,ye,w,s,t,n),v||(F.e.f|=Ke),a.set(ye,F)),te.add(ye)}if(D===0&&o&&!f&&(v?f=Oe(()=>o(l)):(f=Oe(()=>o(Ii??=je())),f.f|=Ke)),D>te.size&&Es(),Y&&D>0&&Te(Tn()),!v)if(_.set(P,te),ne){for(const[be,Fe]of a)te.has(be)||P.skip_effect(Fe.e);P.oncommit(g),P.ondiscard(d)}else g(P);$&&Qe(!0),i(c)}),E={effect:y,items:a,pending:_,outrogroups:null,fallback:f};v=!1,Y&&(l=C)}function fn(e){for(;e!==null&&(e.f&Le)===0;)e=e.next;return e}function So(e,t,n,r,s){var o=t.length,l=e.items,a=fn(e.effect.first),f,c=null,h=[],_=[],v,g,d,y;for(y=0;y<o;y+=1){if(v=t[y],g=s(v,y),d=l.get(g).e,e.outrogroups!==null)for(const U of e.outrogroups)U.pending.delete(d),U.done.delete(d);if((d.f&Se)!==0&&er(d),(d.f&Ke)!==0)if(d.f^=Ke,d===a)un(d,null,n);else{var E=c?c.next:a;d===e.effect.last&&(e.effect.last=d.prev),d.prev&&(d.prev.next=d.next),d.next&&(d.next.prev=d.prev),pt(e,c,d),pt(e,d,E),un(d,E,n),c=d,h=[],_=[],a=fn(c.next);continue}if(d!==a){if(f!==void 0&&f.has(d)){if(h.length<_.length){var D=_[0],$;c=D.prev;var z=h[0],te=h[h.length-1];for($=0;$<h.length;$+=1)un(h[$],D,n);for($=0;$<_.length;$+=1)f.delete(_[$]);pt(e,z.prev,te.next),pt(e,c,z),pt(e,te,D),a=D,c=te,y-=1,h=[],_=[]}else f.delete(d),un(d,a,n),pt(e,d.prev,d.next),pt(e,d,c===null?e.effect.first:c.next),pt(e,c,d),c=d;continue}for(h=[],_=[];a!==null&&a!==d;)(f??=new Set).add(a),_.push(a),a=fn(a.next);if(a===null)continue}(d.f&Ke)===0&&h.push(d),c=d,a=fn(d.next)}if(e.outrogroups!==null){for(const U of e.outrogroups)U.pending.size===0&&(or(e,mn(U.done)),e.outrogroups?.delete(U));e.outrogroups.size===0&&(e.outrogroups=null)}if(a!==null||f!==void 0){var P=[];if(f!==void 0)for(d of f)(d.f&Se)===0&&P.push(d);for(;a!==null;)(a.f&Se)===0&&a!==e.fallback&&P.push(a),a=fn(a.next);var ne=P.length;if(ne>0){var w=null;$o(e,P,w)}}}function To(e,t,n,r,s,o,l,a){var f=(l&ns)!==0?(l&is)===0?Zr(n,!1,!1):Dt(n):null,c=(l&rs)!==0?Dt(s):null;return{v:f,i:c,e:Oe(()=>(o(t,f??n,c??s,a),()=>{e.delete(r)}))}}function un(e,t,n){if(e.nodes)for(var r=e.nodes.start,s=e.nodes.end,o=t&&(t.f&Ke)===0?t.nodes.start:n;r!==null;){var l=Be(r);if(o.before(r),r===s)return;r=l}}function pt(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Do(e,t){so(()=>{var n=e.getRootNode(),r=n.host?n:n.head??n.ownerDocument.head;if(!r.querySelector("#"+t.hash)){const s=Jn("style");s.id=t.hash,s.textContent=t.code,r.appendChild(s)}})}function Ao(e,t){return e==null?null:String(e)}function ki(e,t,n,r){var s=e.__style;if(Y||s!==t){var o=Ao(t);(!Y||o!==e.getAttribute("style"))&&(o==null?e.removeAttribute("style"):e.style.cssText=o),e.__style=t}return r}const Io=Symbol("is custom element"),Mo=Symbol("is html"),ko=ys?"link":"LINK";function T(e,t,n,r){var s=Oo(e);Y&&(s[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName===ko)||s[t]!==(s[t]=n)&&(t==="loading"&&(e[ws]=n),n==null?e.removeAttribute(t):typeof n!="string"&&No(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function Oo(e){return e.__attributes??={[Io]:e.nodeName.includes("-"),[Mo]:e.namespaceURI===xr}}var Oi=new Map;function No(e){var t=e.getAttribute("is")||e.nodeName,n=Oi.get(t);if(n)return n;Oi.set(t,n=[]);for(var r,s=e,o=Element.prototype;o!==s;){r=ds(s);for(var l in r)r[l].set&&n.push(l);s=$r(s)}return n}function ge(e,t,n,r){var s=(n&as)!==0,o=(n&ls)!==0,l=r,a=!0,f=()=>(a&&(a=!1,l=o?nr(r):r),l);let c;if(s){var h=xn in e||Mr in e;c=Et(e,t)?.set??(h&&t in e?$=>e[t]=$:void 0)}var _,v=!1;s?[_,v]=Ys(()=>e[t]):_=e[t],_===void 0&&r!==void 0&&(_=f(),c&&(Is(),c(_)));var g;if(g=()=>{var $=e[t];return $===void 0?f():(a=!0,$)},(n&os)===0)return g;if(c){var d=e.$$legacy;return(function($,z){return arguments.length>0?((!z||d||v)&&c(z?g():$),$):g()})}var y=!1,E=((n&ss)!==0?Bn:Ur)(()=>(y=!1,g()));s&&i(E);var D=N;return(function($,z){if(arguments.length>0){const te=z?i(E):s?dt($):$;return p(E,te),y=!0,l!==void 0&&(l=te),$}return vt&&y||(D.f&ke)!==0?E.v:i(E)})}function Ro(e){return new Co(e)}class Co{#e;#n;constructor(t){var n=new Map,r=(o,l)=>{var a=Zr(l,!1,!1);return n.set(o,a),a};const s=new Proxy({...t.props||{},$$events:{}},{get(o,l){return i(n.get(l)??r(l,Reflect.get(o,l)))},has(o,l){return l===Mr?!0:(i(n.get(l)??r(l,Reflect.get(o,l))),Reflect.has(o,l))},set(o,l,a){return p(n.get(l)??r(l,a),a),Reflect.set(o,l,a)}});this.#n=(t.hydrate?yo:Di)(t.component,{target:t.target,anchor:t.anchor,props:s,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError}),(!t?.props?.$$host||t.sync===!1)&&de(),this.#e=s.$$events;for(const o of Object.keys(this.#n))o==="$set"||o==="$destroy"||o==="$on"||yn(this,o,{get(){return this.#n[o]},set(l){this.#n[o]=l},enumerable:!0});this.#n.$set=o=>{Object.assign(s,o)},this.#n.$destroy=()=>{bo(this.#n)}}$set(t){this.#n.$set(t)}$on(t,n){this.#e[t]=this.#e[t]||[];const r=(...s)=>n.call(this,...s);return this.#e[t].push(r),()=>{this.#e[t]=this.#e[t].filter(s=>s!==r)}}$destroy(){this.#n.$destroy()}}let Ni;typeof HTMLElement=="function"&&(Ni=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;$$shadowRoot=null;constructor(e,t,n){super(),this.$$ctor=e,this.$$s=t,n&&(this.$$shadowRoot=this.attachShadow(n))}addEventListener(e,t,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const r=this.$$c.$on(e,t);this.$$l_u.set(t,r)}super.addEventListener(e,t,n)}removeEventListener(e,t,n){if(super.removeEventListener(e,t,n),this.$$c){const r=this.$$l_u.get(t);r&&(r(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(r){return s=>{const o=Jn("slot");r!=="default"&&(o.name=r),X(s,o)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},n=Po(this);for(const r of this.$$s)r in n&&(r==="default"&&!this.$$d.children?(this.$$d.children=e(r),t.default=!0):t[r]=e(r));for(const r of this.attributes){const s=this.$$g_p(r.name);s in this.$$d||(this.$$d[s]=On(s,r.value,this.$$p_d,"toProp"))}for(const r in this.$$p_d)!(r in this.$$d)&&this[r]!==void 0&&(this.$$d[r]=this[r],delete this[r]);this.$$c=Ro({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=ro(()=>{ui(()=>{this.$$r=!0;for(const r of wn(this.$$c)){if(!this.$$p_d[r]?.reflect)continue;this.$$d[r]=this.$$c[r];const s=On(r,this.$$d[r],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[r].attribute||r):this.setAttribute(this.$$p_d[r].attribute||r,s)}this.$$r=!1})});for(const r in this.$$l)for(const s of this.$$l[r]){const o=this.$$c.$on(r,s);this.$$l_u.set(s,o)}this.$$l={}}}attributeChangedCallback(e,t,n){this.$$r||(e=this.$$g_p(e),this.$$d[e]=On(e,n,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 wn(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function On(e,t,n,r){const s=n[e]?.type;if(t=s==="Boolean"&&typeof t!="boolean"?t!=null:t,!r||!n[e])return t;if(r==="toAttribute")switch(s){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(s){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function Po(e){const t={};return e.childNodes.forEach(n=>{t[n.slot||"default"]=!0}),t}function Lo(e,t,n,r,s,o){let l=class extends Ni{constructor(){super(e,n,s),this.$$p_d=t}static get observedAttributes(){return wn(t).map(a=>(t[a].attribute||a).toLowerCase())}};return wn(t).forEach(a=>{yn(l.prototype,a,{get(){return this.$$c&&a in this.$$c?this.$$c[a]:this.$$d[a]},set(f){f=On(a,f,t),this.$$d[a]=f;var c=this.$$c;if(c){var h=Et(c,a)?.get;h?c[a]=f:c.$set({[a]:f})}}})}),r.forEach(a=>{yn(l.prototype,a,{get(){return this.$$c?.[a]}})}),e.element=l,l}var Nt={},Ri;function qo(){if(Ri)return Nt;Ri=1,Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.LanguageTranslator=void 0,Nt.getChildStyleToPass=e,Nt.addComponent=t;function e(r,s){var o,l,a="";try{if(r&&s?.length&&(!((o=Object.keys(r))===null||o===void 0)&&o.length)&&(!((l=s?.filter(function(v){return Object.keys(r).includes(v.name)}))===null||l===void 0)&&l.length))for(var f=function(v){var g=s?.filter(function(d){return d.name===v&&d.defaultValue!==r[v]});g&&(a+="".concat(v,":").concat(r[v],";"))},c=0,h=Object.keys(r);c<h.length;c++){var _=h[c];f(_)}}catch(v){console.error("error getting child style to pass",v)}finally{return a}}function t(r){var s,o=((s=r?.repoName.split("/"))===null||s===void 0?void 0:s[1])||r?.repoName;if(!o)throw new Error("wrong componentPath "+r?.repoName);if(!r?.version)throw new Error("wrong version "+r?.version);var l=r?.iifePath||"main.iife.js";if(!document.getElementById(o+"-script"))try{var a=document.createElement("script");if(a.id=o+"-script",a.src="https://cdn.jsdelivr.net/npm/".concat(r.repoName,"@").concat(r.version,"/").concat(l),r?.local)a.src="".concat(r.local);else if(location.href.includes("localhost:6006")){var f=o.split("-")[0];a.src="http://localhost:6006/webcomponents/".concat(o.replace(f+"-",""),"/").concat(l)}document.head.appendChild(a)}catch(c){console.warn(c)}}var n=(function(){function r(s){if(this.lang="",!s?.dictionary)throw new Error("no dictionary provided");this.dictionary=s.dictionary,this.setLang(s?.lang)}return r.prototype.setLang=function(s){s||(s=r.getDefaultLang()),this.lang=s},r.prototype.translateWord=function(s,o){return r.getDictionaryWord(s,this.dictionary,o||this.lang)},r.prototype.translateDate=function(s,o,l){return r.formatDate(s,o,l||this.lang)},r.getDefaultLang=function(){var s,o,l,a="en";return navigator?.languages&&(!((l=(o=(s=navigator.languages[0])===null||s===void 0?void 0:s.split("-")[0])===null||o===void 0?void 0:o.toLowerCase())===null||l===void 0)&&l.length)&&(a=navigator.languages[0].split("-")[0].toLowerCase()),a},r.getDictionaryWord=function(s,o,l){var a;if(!s)throw new Error("no wordKey provided");if(!o)throw new Error("no dictionary provided");if(l&&(!((a=o[l])===null||a===void 0)&&a[s]))return o[l][s];var f="",c=r.getDefaultLang();if(!l||c!==l){var h=o?.[c];h?.[s]&&(f=h[s])}return f},r.formatDate=function(s,o,l){if(!s)throw new Error("no date provided");if(typeof s.getMonth!="function")throw new Error("wrong date format");var a=new Intl.DateTimeFormat(l||r.getDefaultLang(),o);return a.format(s)},r})();return Nt.LanguageTranslator=n,Nt}qo();const{PI:jo}=Math,cn=jo+1e-4,Ci=.5,Pi=[1,1];function Li(e,t,n,r=s=>s){return e*r(.5-t*(.5-n))}const{min:ar}=Math;function qi(e,t,n){let r=ar(1,t/n);return ar(1,e+(ar(1,1-r)-e)*(r*.275))}function Yo(e){return[-e[0],-e[1]]}function Ge(e,t){return[e[0]+t[0],e[1]+t[1]]}function ji(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}function _t(e,t){return[e[0]-t[0],e[1]-t[1]]}function lr(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function gt(e,t){return[e[0]*t,e[1]*t]}function fr(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}function Fo(e,t){return[e[0]/t,e[1]/t]}function Yi(e){return[e[1],-e[0]]}function ur(e,t){let n=t[0];return e[0]=t[1],e[1]=-n,e}function Fi(e,t){return e[0]*t[0]+e[1]*t[1]}function Xo(e,t){return e[0]===t[0]&&e[1]===t[1]}function zo(e){return Math.hypot(e[0],e[1])}function Xi(e,t){let n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function zi(e){return Fo(e,zo(e))}function Ho(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function cr(e,t,n){let r=Math.sin(n),s=Math.cos(n),o=e[0]-t[0],l=e[1]-t[1],a=o*s-l*r,f=o*r+l*s;return[a+t[0],f+t[1]]}function Hi(e,t,n,r){let s=Math.sin(r),o=Math.cos(r),l=t[0]-n[0],a=t[1]-n[1],f=l*o-a*s,c=l*s+a*o;return e[0]=f+n[0],e[1]=c+n[1],e}function Bi(e,t,n){return Ge(e,gt(_t(t,e),n))}function Bo(e,t,n,r){let s=n[0]-t[0],o=n[1]-t[1];return e[0]=t[0]+s*r,e[1]=t[1]+o*r,e}function Vi(e,t,n){return Ge(e,gt(t,n))}const le=[0,0],mt=[0,0],wt=[0,0];function Vo(e,t){let n=Vi(e,zi(Yi(_t(e,Ge(e,[1,1])))),-t),r=[],s=1/13;for(let o=s;o<=1;o+=s)r.push(cr(n,e,cn*2*o));return r}function Wo(e,t,n){let r=[],s=1/n;for(let o=s;o<=1;o+=s)r.push(cr(t,e,cn*o));return r}function Uo(e,t,n){let r=_t(t,n),s=gt(r,.5),o=gt(r,.51);return[_t(e,s),_t(e,o),Ge(e,o),Ge(e,s)]}function Jo(e,t,n,r){let s=[],o=Vi(e,t,n),l=1/r;for(let a=l;a<1;a+=l)s.push(cr(o,e,cn*3*a));return s}function Go(e,t,n){return[Ge(e,gt(t,n)),Ge(e,gt(t,n*.99)),_t(e,gt(t,n*.99)),_t(e,gt(t,n))]}function Wi(e,t,n){return e===!1||e===void 0?0:e===!0?Math.max(t,n):e}function Ko(e,t,n){return e.slice(0,10).reduce((r,s)=>{let o=s.pressure;return t&&(o=qi(r,s.distance,n)),(r+o)/2},e[0].pressure)}function Zo(e,t={}){let{size:n=16,smoothing:r=.5,thinning:s=.5,simulatePressure:o=!0,easing:l=H=>H,start:a={},end:f={},last:c=!1}=t,{cap:h=!0,easing:_=H=>H*(2-H)}=a,{cap:v=!0,easing:g=H=>--H*H*H+1}=f;if(e.length===0||n<=0)return[];let d=e[e.length-1].runningLength,y=Wi(a.taper,n,d),E=Wi(f.taper,n,d),D=(n*r)**2,$=[],z=[],te=Ko(e,o,n),P=Li(n,s,e[e.length-1].pressure,l),ne,w=e[0].vector,U=e[0].point,ye=U,F=U,be=ye,Fe=!1;for(let H=0;H<e.length;H++){let{pressure:b}=e[H],{point:me,vector:he,distance:Xe,runningLength:bt}=e[H],Pe=H===e.length-1;if(!Pe&&d-bt<3)continue;s?(o&&(b=qi(te,Xe,n)),P=Li(n,s,b,l)):P=n/2,ne===void 0&&(ne=P);let dn=bt<y?_(bt/y):1,hn=d-bt<E?g((d-bt)/E):1;P=Math.max(.01,P*Math.min(dn,hn));let xt=(Pe?e[H]:e[H+1]).vector,Gt=Pe?1:Fi(he,xt),Nn=Fi(he,w)<0&&!Fe,vn=Gt!==null&&Gt<0;if(Nn||vn){ur(le,w),fr(le,le,P);for(let Ct=0;Ct<=1;Ct+=.07692307692307693)lr(mt,me,le),Hi(mt,mt,me,cn*Ct),F=[mt[0],mt[1]],$.push(F),ji(wt,me,le),Hi(wt,wt,me,cn*-Ct),be=[wt[0],wt[1]],z.push(be);U=F,ye=be,vn&&(Fe=!0);continue}if(Fe=!1,Pe){ur(le,he),fr(le,le,P),$.push(_t(me,le)),z.push(Ge(me,le));continue}Bo(le,xt,he,Gt),ur(le,le),fr(le,le,P),lr(mt,me,le),F=[mt[0],mt[1]],(H<=1||Xi(U,F)>D)&&($.push(F),U=F),ji(wt,me,le),be=[wt[0],wt[1]],(H<=1||Xi(ye,be)>D)&&(z.push(be),ye=be),te=b,w=he}let I=[e[0].point[0],e[0].point[1]],yt=e.length>1?[e[e.length-1].point[0],e[e.length-1].point[1]]:Ge(e[0].point,[1,1]),Rt=[],Ie=[];if(e.length===1){if(!(y||E)||c)return Vo(I,ne||P)}else{y||E&&e.length===1||(h?Rt.push(...Wo(I,z[0],13)):Rt.push(...Uo(I,$[0],z[0])));let H=Yi(Yo(e[e.length-1].vector));E||y&&e.length===1?Ie.push(yt):v?Ie.push(...Jo(yt,H,P,29)):Ie.push(...Go(yt,H,P))}return $.concat(Ie,z.reverse(),Rt)}const Ui=[0,0];function Ji(e){return e!=null&&e>=0}function Qo(e,t={}){let{streamline:n=.5,size:r=16,last:s=!1}=t;if(e.length===0)return[];let o=.15+(1-n)*.85,l=Array.isArray(e[0])?e:e.map(({x:v,y:g,pressure:d=Ci})=>[v,g,d]);if(l.length===2){let v=l[1];l=l.slice(0,-1);for(let g=1;g<5;g++)l.push(Bi(l[0],v,g/4))}l.length===1&&(l=[...l,[...Ge(l[0],Pi),...l[0].slice(2)]]);let a=[{point:[l[0][0],l[0][1]],pressure:Ji(l[0][2])?l[0][2]:.25,vector:[...Pi],distance:0,runningLength:0}],f=!1,c=0,h=a[0],_=l.length-1;for(let v=1;v<l.length;v++){let g=s&&v===_?[l[v][0],l[v][1]]:Bi(h.point,l[v],o);if(Xo(h.point,g))continue;let d=Ho(g,h.point);if(c+=d,v<_&&!f){if(c<r)continue;f=!0}lr(Ui,h.point,g),h={point:g,pressure:Ji(l[v][2])?l[v][2]:Ci,vector:zi(Ui),distance:d,runningLength:c},a.push(h)}return a[0].vector=a[1]?.vector||[0,0],a}function Gi(e,t={}){return Zo(Qo(e,t),t)}var ea=ae('<path stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-1qsqiex"></path>'),ta=ae('<image stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-1qsqiex"></image>'),na=ae('<text stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-1qsqiex"> </text>'),ra=ae('<path class="svelte-1qsqiex"></path>'),ia=ae('<image class="svelte-1qsqiex"></image>'),sa=ae('<text class="svelte-1qsqiex"> </text>'),oa=ae('<path stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-1qsqiex"></path>'),aa=ae('<image stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-1qsqiex"></image>'),la=ae('<text stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-1qsqiex"> </text>'),fa=ae('<path class="svelte-1qsqiex"></path>'),ua=ae('<image class="svelte-1qsqiex"></image>'),ca=ae('<text class="svelte-1qsqiex"> </text>'),da=ae('<rect id="selector" fill="none" stroke="red" stroke-width="1"></rect>'),ha=ae('<rect id="selector" fill="none" stroke="red" stroke-width="1"></rect>'),va=ae('<rect id="selector" fill="none" stroke="red" stroke-width="1"></rect>'),pa=ae('<rect id="selector" fill="none" stroke="red" stroke-width="1"></rect>'),_a=ae("<g><!><!></g>"),ga=_o('<div id="debug" class="svelte-1qsqiex"> </div> <div id="container"><svg class="svelte-1qsqiex"><!></svg></div>',1);const ma={hash:"svelte-1qsqiex",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;}#debug.svelte-1qsqiex {position:absolute;width:100%;height:30px;top:0px;z-index:10;}svg.svelte-1qsqiex {position:absolute;top:0;left:0;width:100%;height:100%;touch-action:none;}'};function Ki(e,t){Rr(t,!0),Do(e,ma);function n(u,x){t.$$host.dispatchEvent(new CustomEvent(u,{detail:x}))}const r={size:6,thinning:.7,smoothing:.5,streamline:.5},s={paperSize:"A4"},o={zoom:{type:"fit",value:1},pan:{x:0,y:0},lockPan:!1,lockZoom:!1};let l=ge(t,"id",7,""),a=ge(t,"load_draw",7),f=ge(t,"draw_id",23,()=>Math.random().toString(36)+Math.random().toString(36)+Date.now().toString()),c=ge(t,"background_color",7,"rgb(255,255,255)"),h=ge(t,"pen_color",7,"rgb(0,0,0)"),_=ge(t,"insert_image",7,void 0),v=ge(t,"insert_text",7),g=ge(t,"pen_opacity",7,1),d=ge(t,"options",7,r),y=ge(t,"goto",7,void 0),E=ge(t,"mode",7,"draw"),D=ge(t,"debug",7,"no"),$=ge(t,"save_as",7,void 0),z=ge(t,"size",23,()=>Object.assign({},s)),te=ge(t,"view",23,()=>Object.assign({},o)),P,ne,w=A(0),U=A(!1),ye=A(0),F=A(void 0),be=A(void 0),Fe=A(""),I=A(dt({})),yt=A(0),Rt=A(void 0),Ie=A(void 0),H=A(void 0),b=A(dt([])),me=A(!1),he=A("idle"),Xe=A(void 0),bt=A(void 0),Pe=A(void 0),dn=A(void 0),hn=A(void 0),xt=A(!1),Gt=A(void 0),Nn=A(void 0),vn=A(void 0),Ct=A(void 0),Pt=A(0),Lt=A(0),qt=A(0),jt=A(0),K=A(0),Z=A(0),J=A(0),G=A(0);function Zi(u){if(!u.length)return"";const x=u.reduce((S,[B,L],j,m)=>{const[k,R]=m[(j+1)%m.length];return S.push(B,L,(B+k)/2,(L+R)/2),S},["M",...u[0],"Q"]);return x.push("Z"),x.join(" ")}function wa(u){if(u)switch(u.type){case"json":const x=[];for(const S of i(b))if(S.visible){if(S.type==="stroke")S.actionIndex=0,x.push(S);else if(S.type==="multiplestroke")for(const B of S.multipath?.filter(L=>L.visible)||[])B.actionIndex=0,x.push(B)}return ba({type:"json",draw:x,id:l(),draw_id:f(),name:u.name,version:i(ye)+1,size:z()||s});default:return console.error("unknown save type")}}function ya(u){n("drawLoaded",u)}function ba(u){n("save",u)}function pn(u){n("historyIndex",u)}function xa(u){n("changeIndex",u)}function Ea(u){n("selection",u)}function Qi(u){n("startStroke",u)}function $a(u){n("endStroke",u)}function Sa(u){n("imageLoaded",u)}function Ta(u){n("txtLoaded",u)}function Da(){if(!i(F))return console.error("no svg dom found");if(!i(be))return console.error("no svg container found");p(I,i(F).getBoundingClientRect(),!0),P||(P={}),P.containerWidth=i(be).clientWidth,P.containerHeight=i(be).clientHeight,P.drawWidth=i(F).clientWidth,P.drawHeight=i(F).clientHeight,z()?.paperSize==="A3"?(P.paperWidth=297,P.paperHeight=420):(P.paperWidth=210,P.paperHeight=297)}function Aa(){if(console.log("svgDom",i(F)),i(I)||Da(),a()&&typeof a()=="object"&&(!i(ye)||i(ye)<a().version||f()!==a().draw_id)&&(console.log("load_draw",a()),p(b,a().draw,!0),p(w,i(b).length,!0),f(a().draw_id),p(ye,a().version,!0),a(void 0),ne=i(b).length,pn({index:i(w),draw_id:f(),id:l(),start_index:ne}),ya({index:i(w),draw_id:f(),id:l(),start_index:ne})),i(b)?.length&&$()&&(console.log("save_as",$()),wa($())),i(b)||(console.log("draw is empty"),p(b,[],!0)),E()&&E()!=="select"&&i(Xe)){p(Xe,0);const u=[...i(b)];u.forEach(x=>{x.selected=!1,x.type==="multiplestroke"&&x.multipath?.forEach(S=>{S.selected=!1})}),p(b,[...u],!0)}if(E()!=="select"&&(p(J,0),p(G,0),p(K,0),p(Z,0)),typeof y()=="string"&&y(Number(y())),i(b).length||(p(w,0),y(void 0)),i(w)||p(w,0),y()&&y()<0?p(w,-1):(y()||y()===0)&&(ne&&y()>ne?y(ne):y()>i(b).length&&y(i(b).length),p(w,y()+0),y(void 0),xa({index:i(w),draw_id:f(),id:l(),start_index:ne})),i(w)<0?(p(w,0),p(me,!0)):i(w)>=0&&p(me,!1),_()){console.info("inserting object");let u=!1;switch(_().type){case"jpg":case"jpeg":case"png":Ia(_()),u=!0;break;case"svg":Ma(_()),u=!0;break;default:console.error("unknown insert_object type",_().type),u=!1}u&&Sa({ok:!0,draw_id:f(),id:l()})}v()&&(console.log("insert_text",v()),ka(v()),Ta({ok:!0,draw_id:f(),id:l()})),p(bt,Gi(i(b)[i(w)]?.path||[],Object.assign({simulatePressure:i(Fe)!=="pen"},d())),!0),p(Pe,Zi(i(bt)),!0),console.log("set index to",i(w),"from goto",y(),"historyActions",i(b).length)}li(()=>{console.log("recompute");let u=!1;if(typeof z()=="string")try{z(JSON.parse(z())),u=!0}catch(x){console.error("error parsing size json",x)}if(typeof te()=="string")try{te(JSON.parse(te())),u=!0}catch(x){console.error("error parsing view json",x)}if(typeof a()=="string"&&a()?.length)try{a(JSON.parse(a())),u=!0}catch(x){console.error("error parsing json",x)}else a()||a(void 0);if(typeof $()=="string"&&$()?.length)try{$(JSON.parse($())),u=!0}catch(x){console.error("error parsing json",x)}if(D()!=="yes"&&D("no"),typeof g()=="string"&&g(Number(g())),typeof d()=="string"&&d()?.length)try{d(JSON.parse(d())),d()&&!d().size&&(d().size=r.size),d()&&!d().thinning&&(d().thinning=r.thinning),d()&&!d().smoothing&&(d().smoothing=r.smoothing),d()&&!d().streamline&&(d().streamline=r.streamline),u=!0}catch(x){console.error("error parsing json",x)}if(typeof _()=="string")try{_(JSON.parse(_())),u=!0}catch(x){console.error("error parsing insert_object json",x)}i(F)&&u&&Aa()});function Ia(u){const x=[...i(b)],S={id:Date.now().toString(),type:"image",actionIndex:i(w),visible:!0,pathData:u?.base64};x.push(S),p(b,[...x],!0),nn(w)}function Ma(u){console.info(`inserting SVG ${u?.type}`)}function ka(u){console.info(`inserting Text ${u?.content}`)}function dr(u){const x=u.target?.id?.split("_")?.[1];if(x){let S=[...i(b)],B=S.find(L=>L.id===x&&L.visible);if(!B)for(const L of S.filter(j=>j.type==="multiplestroke").sort((j,m)=>m.actionIndex-j.actionIndex)){const j=L?.multipath?.find(m=>m.id===x&&m.visible);if(j){B=j;break}}B&&(B.visible=!1,B.erasedAtIndex=i(w),console.info("erase stroke",B.id),S[S.length-1].type!=="eraser"?(S=S.slice(0,i(w)+1),S.push({type:"eraser",visible:!0,id:Math.random().toString(36)+Math.random().toString(36)+Date.now().toString(),actionIndex:i(b).length}),S.forEach((L,j)=>{!L.visible&&L.erasedAtIndex&&L.erasedAtIndex>i(w)&&(L.visible=!0,L.erasedAtIndex=void 0)}),p(b,[...S],!0),nn(w),pn({index:i(w),draw_id:f(),id:l(),start_index:ne})):p(b,[...S],!0))}}function Oa(u){if(console.log("handlePointerDown"),p(Fe,u.pointerType,!0),p(yt,u.buttons,!0),E()==="draw"&&u.buttons===1&&!(u.pointerType==="pen"&&u.pressure===0)){if(p(he,"drawing"),i(w)!==i(b).length-1){const x=[...i(b)];x.forEach((S,B)=>{!S.visible&&S.erasedAtIndex&&S.erasedAtIndex>i(w)&&(S.visible=!0,S.erasedAtIndex=void 0)}),p(b,x,!0)}if(i(b)?.length&&i(w)<i(b).length)if(i(me))p(b,[],!0),p(me,!1);else{nn(w);const x=[...i(b)];p(b,x.slice(0,i(w)),!0)}pn({index:i(w),draw_id:f(),id:l(),start_index:ne}),console.log("setup stroke"),p(H,new Date,!0),p(Ie,Date.now().toString(),!0),p(Pt,u.pageX-i(I).left),p(Lt,u.pageY-i(I).top),p(qt,u.pageX-i(I).left),p(jt,u.pageY-i(I).top),i(Rt)||(p(Rt,i(H),!0),Qi({start:i(Rt),id:l(),draw_id:f(),stroke_id:i(Ie),index:i(w)})),u.target.setPointerCapture(u.pointerId),i(b)?.length?(console.info("pushing draw"),p(b,[...i(b),{path:[[u.pageX-i(I).left,u.pageY-i(I).top,u.pressure]],color:h(),id:i(Ie),pathData:i(Pe),min:[i(Pt),i(Lt)],max:[i(qt),i(jt)],visible:!0,actionIndex:i(b).length,opacity:g(),type:"stroke"}],!0)):p(b,[{path:[[u.pageX-i(I).left,u.pageY-i(I).top,u.pressure]],color:h(),id:i(Ie),pathData:i(Pe),min:[i(Pt),i(Lt)],max:[i(qt),i(jt)],visible:!0,actionIndex:i(b).length,opacity:g(),type:"stroke"}],!0),Qi({start:i(H),stroke_id:i(Ie),index:i(w),id:l(),draw_id:f()})}else if(E()==="eraser"||E()==="draw"&&(u.pointerType==="pen"&&u.pressure===0&&u.buttons===1||u.buttons===32))u.target.setPointerCapture(u.pointerId),p(he,"erasing"),console.log("eraser down"),dr(u);else if(E()==="select"&&i(b).length){let x=!1;const S=u.pageX-i(I).left,B=u.pageY-i(I).top;if(x=S>i(K)&&S<i(J)&&B>i(Z)&&B<i(G),p(K,u.pageX-i(I).left),p(Z,u.pageY-i(I).top),p(J,u.pageX-i(I).left),p(G,u.pageY-i(I).top),!i(xt)&&!i(Xe)&&x){p(he,"idle"),p(Xe,Date.now(),!0),console.info("set move mode");const L=[...i(b)];p(dn,u.pageX-i(I).left),p(hn,u.pageY-i(I).top),L.filter(k=>k.selected).forEach(k=>{k.visible=!1,k.erasedAtIndex=i(w)}),L.filter(k=>k.type==="multiplestroke").forEach(k=>{k.multipath?.filter(R=>R.selected).forEach(R=>{R.visible=!1,R.erasedAtIndex=i(w)})});const j=[];for(const k of L.filter(R=>R.type==="multiplestroke"))for(const R of k.multipath?.filter(M=>M.selected)||[])j.push(JSON.parse(JSON.stringify(R))),R.visible=!1;const m=JSON.parse(JSON.stringify(i(b).filter(k=>k.selected))).concat(j);m.forEach(k=>{k.visible=!0}),L.push({multipath:m,id:i(Xe).toString(),type:"multiplestroke",actionIndex:i(w),visible:!0,min:[i(K),i(Z)],max:[i(J),i(G)]}),i(b)[i(b).length-1].type==="multiplestroke"&&nn(w),p(b,[...L],!0),pn({index:i(w),draw_id:f(),id:l(),start_index:ne}),p(xt,!0),p(Gt,i(K),!0),p(Nn,i(Z),!0),p(vn,i(J),!0),p(Ct,i(G),!0)}else p(he,"selecting"),p(Xe,0)}}function Na(u){if(p(Fe,u.pointerType,!0),p(yt,u.buttons+" "+[u.pageX-i(I).left,u.pageY-i(I).top,u.pressure].toString()),E()==="draw"&&i(he)==="drawing"&&u.buttons===1&&!(u.pointerType==="pen"&&u.pressure===0))i(b)[i(w)].path=[...i(b)[i(w)].path||[],[u.pageX-i(I).left,u.pageY-i(I).top,u.pressure]],i(b)[i(w)].pathData=i(Pe),u.pageX-i(I).left<i(Pt)&&p(Pt,u.pageX-i(I).left),u.pageY-i(I).top<i(Lt)&&p(Lt,u.pageY-i(I).top),u.pageX-i(I).left>i(qt)&&p(qt,u.pageX-i(I).left),u.pageY-i(I).top>i(jt)&&p(jt,u.pageY-i(I).top),i(b)[i(w)].min=[i(Pt),i(Lt)],i(b)[i(w)].max=[i(qt),i(jt)];else if(i(he)==="erasing"&&(E()==="eraser"||E()==="draw"&&(u.pointerType==="pen"&&u.pressure===0&&u.buttons===1||u.buttons===32)))console.log("eraser move"),dr(u);else if(E()==="select"&&i(he)==="selecting")p(J,u.pageX-i(I).left),p(G,u.pageY-i(I).top);else if(E()==="select"&&!i(xt)){const x=u.pageX-i(I).left,S=u.pageY-i(I).top,B=x>i(K)&&x<i(J)&&S>i(Z)&&S<i(G);B&&!i(U)?(p(U,!0),console.log("on select",i(U))):!B&&i(U)&&(p(U,!1),console.log("off select",i(U)))}else if(i(xt)&&i(b)[i(w)].type==="multiplestroke"&&i(Xe)&&i(Xe).toString()===i(b)[i(w)].id){const x=[...i(b)],S=u.pageX-i(I).left,B=u.pageY-i(I).top,L=S-(i(dn)||0),j=B-(i(hn)||0);console.info("move selected strokes on multistrokes",i(dn),i(hn),L,j),x[i(w)]?.multipath?.forEach(m=>{let k;for(const M of i(b).filter(fe=>fe.type==="multiplestroke").filter(fe=>fe.id!==i(b)[i(w)].id).sort((fe,Yt)=>Yt.actionIndex-fe.actionIndex)){const fe=M?.multipath?.find(Yt=>Yt.id===m.id);if(fe){k=fe;break}}k||(k=i(b).find(M=>M.id===m.id)),m.path?.forEach((M,fe)=>{fe===0&&console.log("debug path ",M[0],k?.path?.[fe][0],i(b)),k?.path&&(M[0]=k.path[fe][0]+L),k?.path&&(M[1]=k.path[fe][1]+j)}),k?.max&&(m.max=[k.max[0]+L,k.max[1]+j]),k?.min&&(m.min=[k.min[0]+L,k.min[1]+j]);const R=Gi(m.path||[],Object.assign({simulatePressure:i(Fe)!=="pen"},d()));m.pathData=Zi(R)}),p(K,(i(Gt)||0)+L),p(Z,(i(Nn)||0)+j),p(J,(i(vn)||0)+L),p(G,(i(Ct)||0)+j),p(b,[...x],!0)}}function Ra(u){if(p(yt,u.buttons,!0),p(xt,!1),E()==="draw"&&i(he)==="drawing"){const x=new Date;if(!i(Ie)||!i(H)||!i(Pe))return console.error("no stroke id",i(Ie),i(H),i(Pe));$a({end:x,stroke_id:i(Ie),start:i(H),min:[i(Pt),i(Lt)],max:[i(qt),i(jt)],pathData:i(Pe),pen_color:h(),index:i(w),id:l(),draw_id:f()}),nn(w),pn({index:i(w),draw_id:f(),id:l(),start_index:ne})}else if(E()==="eraser"||E()==="draw"&&i(he)!=="drawing"&&(u.pointerType==="pen"&&u.pressure===0&&u.buttons===1||u.buttons===32))console.log("eraser up"),dr(u);else if(E()==="select"){const x=[...i(b)];x.forEach(R=>{R.selected=!1,R.type==="multiplestroke"&&R.multipath?.forEach(M=>{M.selected=!1})}),p(b,[...x],!0),p(Xe,0);const S=i(K)<i(J)?i(K):i(J),B=i(Z)<i(G)?i(Z):i(G),L=i(K)>i(J)?i(K):i(J),j=i(Z)>i(G)?i(Z):i(G),m=x.filter(R=>!!(R.visible&&R.type==="stroke"&&R.min&&R.max&&R.min[0]>S&&R.min[1]>B&&R.max[0]<L&&R.max[1]<j));let k=!1;for(const R of x.filter(M=>M.type==="multiplestroke"))for(const M of R.multipath||[])M.visible&&M.type==="stroke"&&M.min&&M.max&&M.min[0]>S&&M.min[1]>B&&M.max[0]<L&&M.max[1]<j&&(k=!0);if(m.length>0||k){for(const R of x.filter(M=>M.type==="multiplestroke"))for(const M of R?.multipath||[])M.visible&&M.min&&M.max&&M.min[0]>S&&M.min[1]>B&&M.max[0]<L&&M.max[1]<j&&(M.selected=!0);for(const R of m)R.selected=!0;p(b,[...x],!0),console.log(m),Ea({minX:i(K),minY:i(Z),maxX:i(J),maxY:i(G),strokes:m,id:l(),draw_id:f()})}else p(K,0),p(Z,0),p(J,0),p(G,0)}p(he,"idle"),u?.pointerId&&u.target?.releasePointerCapture?.(u.pointerId)}Eo(()=>{p(F,t.$$host?.shadowRoot?.querySelector("svg"),!0),p(be,t.$$host?.shadowRoot?.querySelector("#container"),!0);let u=0;const x=setInterval(()=>{p(F,t.$$host?.shadowRoot?.querySelector("svg"),!0),i(F)?clearInterval(x):(u++,u>10?(clearInterval(x),console.warn("no canvas found on check "+u)):console.error("no canvas found on check "+u+" end"))},100);if(!i(F))return console.error("no canvas found on mount")});var Ca={get id(){return l()},set id(u=""){l(u),de()},get load_draw(){return a()},set load_draw(u){a(u),de()},get draw_id(){return f()},set draw_id(u=Math.random().toString(36)+Math.random().toString(36)+Date.now().toString()){f(u),de()},get background_color(){return c()},set background_color(u="rgb(255,255,255)"){c(u),de()},get pen_color(){return h()},set pen_color(u="rgb(0,0,0)"){h(u),de()},get insert_image(){return _()},set insert_image(u=void 0){_(u),de()},get insert_text(){return v()},set insert_text(u){v(u),de()},get pen_opacity(){return g()},set pen_opacity(u=1){g(u),de()},get options(){return d()},set options(u=r){d(u),de()},get goto(){return y()},set goto(u=void 0){y(u),de()},get mode(){return E()},set mode(u="draw"){E(u),de()},get debug(){return D()},set debug(u="no"){D(u),de()},get save_as(){return $()},set save_as(u=void 0){$(u),de()},get size(){return z()},set size(u=Object.assign({},s)){z(u),de()},get view(){return te()},set view(u=Object.assign({},o)){te(u),de()}},es=ga(),Rn=Ve(es),Pa=ht(Rn);lt(Rn);var ts=ii(Rn,2),Kt=ht(ts),La=ht(Kt);{var qa=u=>{var x=_a(),S=ht(x);Mi(S,17,()=>i(b),j=>j.id,(j,m,k,R)=>{var M=nt(),fe=Ve(M);{var Yt=ve=>{var W=nt(),ja=Ve(W);{var Ya=Zt=>{var _n=nt(),hr=Ve(_n);{var gn=xe=>{var Q=nt(),Qt=Ve(Q);{var pr=ze=>{var pe=ea();oe(()=>{T(pe,"id","path_"+i(m).id),T(pe,"d",i(m).pathData),T(pe,"fill",i(m).color),T(pe,"fill-opacity",i(m).opacity)}),X(ze,pe)},_r=ze=>{var pe=ta();oe(()=>{T(pe,"id","path_"+i(m).id),T(pe,"href",i(m).pathData)}),X(ze,pe)},gr=ze=>{var pe=na(),Ee=ht(pe,!0);lt(pe),oe(()=>{T(pe,"id","path_"+i(m).id),ln(Ee,i(m).pathData)}),X(ze,pe)};Je(Qt,ze=>{i(m).type==="stroke"?ze(pr):i(m).type==="image"?ze(_r,1):i(m).type==="text"&&ze(gr,2)})}X(xe,Q)},q=xe=>{var Q=ra();oe(()=>{T(Q,"id","path_"+i(m).id),T(Q,"d",i(m).pathData),T(Q,"fill",i(m).color),T(Q,"fill-opacity",i(m).opacity)}),X(xe,Q)},Cn=xe=>{var Q=ia();oe(()=>{T(Q,"id","path_"+i(m).id),T(Q,"href",i(m).pathData)}),X(xe,Q)},vr=xe=>{var Q=sa(),Qt=ht(Q,!0);lt(Q),oe(()=>{T(Q,"id","path_"+i(m).id),ln(Qt,i(m).pathData)}),X(xe,Q)};Je(hr,xe=>{i(m).selected?xe(gn):!i(m).selected&&i(m).type==="stroke"?xe(q,1):!i(m).selected&&i(m).type==="image"?xe(Cn,2):!i(m).selected&&i(m).type==="text"&&xe(vr,3)})}X(Zt,_n)},Fa=Zt=>{var _n=nt(),hr=Ve(_n);Mi(hr,17,()=>i(m).multipath,gn=>gn.id+i(m).id,(gn,q)=>{var Cn=nt(),vr=Ve(Cn);{var xe=Q=>{var Qt=nt(),pr=Ve(Qt);{var _r=Ee=>{var ue=nt(),mr=Ve(ue);{var Xa=rt=>{var $e=oa();oe(()=>{T($e,"id","path_"+i(q).id+"_"+i(m).id),T($e,"d",i(q).pathData),T($e,"fill",i(q).color),T($e,"fill-opacity",i(q).opacity)}),X(rt,$e)},za=rt=>{var $e=aa();oe(()=>{T($e,"id","path_"+i(q).id+"_"+i(m).id),T($e,"href",i(q).pathData)}),X(rt,$e)},Ha=rt=>{var $e=la(),Ba=ht($e,!0);lt($e),oe(()=>{T($e,"id","path_"+i(q).id+"_"+i(m).id),ln(Ba,i(q).pathData)}),X(rt,$e)};Je(mr,rt=>{i(q).type==="stroke"?rt(Xa):i(q).type==="image"?rt(za,1):i(q).type==="text"&&rt(Ha,2)})}X(Ee,ue)},gr=Ee=>{var ue=fa();oe(()=>{T(ue,"id","path_"+i(q).id+"_"+i(m).id),T(ue,"d",i(q).pathData),T(ue,"fill",i(q).color),T(ue,"fill-opacity",i(q).opacity)}),X(Ee,ue)},ze=Ee=>{var ue=ua();oe(()=>{T(ue,"id","path_"+i(q).id+"_"+i(m).id),T(ue,"href",i(q).pathData)}),X(Ee,ue)},pe=Ee=>{var ue=ca(),mr=ht(ue,!0);lt(ue),oe(()=>{T(ue,"id","path_"+i(q).id+"_"+i(m).id),ln(mr,i(q).pathData)}),X(Ee,ue)};Je(pr,Ee=>{i(q).selected?Ee(_r):!i(q).selected&&i(q).type==="stroke"?Ee(gr,1):!i(q).selected&&i(q).type==="image"?Ee(ze,2):!i(q).selected&&i(q).type==="text"&&Ee(pe,3)})}X(Q,Qt)};Je(vr,Q=>{i(q).actionIndex<=i(w)&&!i(me)&&(i(q).visible||i(q).erasedAtIndex&&i(q).erasedAtIndex>i(w))&&Q(xe)})}X(gn,Cn)}),X(Zt,_n)};Je(ja,Zt=>{i(m).type==="stroke"||i(m).type==="image"||i(m).type==="text"?Zt(Ya):i(m).type==="multiplestroke"&&i(m).multipath&&Zt(Fa,1)})}X(ve,W)};Je(fe,ve=>{i(m).actionIndex<=i(w)&&!i(me)&&(i(m).visible||i(m).erasedAtIndex&&i(m).erasedAtIndex>i(w))&&ve(Yt)})}X(j,M)});var B=ii(S);{var L=j=>{var m=nt(),k=Ve(m);{var R=ve=>{var W=da();oe(()=>{T(W,"x",i(K)),T(W,"y",i(Z)),T(W,"width",i(J)-i(K)),T(W,"height",i(G)-i(Z))}),X(ve,W)},M=ve=>{var W=ha();oe(()=>{T(W,"x",i(J)),T(W,"y",i(Z)),T(W,"width",i(K)-i(J)),T(W,"height",i(G)-i(Z))}),X(ve,W)},fe=ve=>{var W=va();oe(()=>{T(W,"x",i(K)),T(W,"y",i(G)),T(W,"width",i(J)-i(K)),T(W,"height",i(Z)-i(G))}),X(ve,W)},Yt=ve=>{var W=pa();oe(()=>{T(W,"x",i(J)),T(W,"y",i(G)),T(W,"width",i(K)-i(J)),T(W,"height",i(Z)-i(G))}),X(ve,W)};Je(k,ve=>{i(K)<=i(J)&&i(Z)<=i(G)?ve(R):i(K)>i(J)&&i(Z)<i(G)?ve(M,1):i(K)<i(J)&&i(Z)>i(G)?ve(fe,2):ve(Yt,-1)})}X(j,m)};Je(B,j=>{E()==="select"&&j(L)})}lt(x),X(u,x)};Je(La,u=>{i(F)&&u(qa)})}return lt(Kt),lt(ts),oe(()=>{ki(Rn,`display:${D()==="yes"?"block":"none"}`),ln(Pa,`${i(Fe)??""} b: ${i(yt)??""}`),ki(Kt,`background-color:${c()??""};cursor:${i(U)===!0?"move":"default"}`)}),ir("pointerdown",Kt,Oa),ir("pointermove",Kt,Na),ir("pointerup",Kt,Ra),X(e,es),Cr(Ca)}ho(["pointerdown","pointermove","pointerup"]),customElements.define("hb-stylus-paper",Lo(Ki,{id:{},load_draw:{},draw_id:{},background_color:{},pen_color:{},insert_image:{},insert_text:{},pen_opacity:{},options:{},goto:{},mode:{},debug:{},save_as:{},size:{},view:{}},[],[],{mode:"open"})),wr.Component=Ki,Object.defineProperty(wr,Symbol.toStringTag,{value:"Module"})})(this["stylus-paper"]=this["stylus-paper"]||{});
|
|
3
3
|
//# sourceMappingURL=main.iife.js.map
|