@pie-players/pie-section-player 0.3.75 → 1.0.0-beta.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/README.md +845 -964
- package/custom-elements.json +3922 -0
- package/dist/browser/assets/{evaluation-worker-CORp9m0K.js → evaluation-worker-0xRDVTJx.js} +82215 -73234
- package/dist/browser/chunks/ToolCoordinator-0a6c4088.js +1 -0
- package/dist/browser/chunks/attribute-coercion-b93b482c.js +1 -0
- package/dist/browser/chunks/calculator-element-271c142f.js +8 -9
- package/dist/browser/chunks/catalog-context-46d3e50e.js +1 -1
- package/dist/browser/chunks/classPrivateFieldGet2-338e0179.js +1 -1
- package/dist/browser/chunks/classPrivateMethodInitSpec-563cd0a5.js +1 -0
- package/dist/browser/chunks/custom-element-define-2a92deb0.js +1 -0
- package/dist/browser/chunks/dist-41b39e7f.js +1 -1
- package/dist/browser/chunks/dist-ca9b9622.js +1 -1
- package/dist/browser/chunks/focus-trap-44913bf3.js +1 -1
- package/dist/browser/chunks/math-rendering-ready-9a0fd90a.js +1 -1
- package/dist/browser/chunks/mathjax-BKrHE4xs-3ca05bf6.js +1 -1
- package/dist/browser/chunks/nl-NL-364d61b9.js +1 -1
- package/dist/browser/chunks/nl-NL-8b7e6d4b.js +1 -1
- package/dist/browser/chunks/pie-api-client-687c319a.js +1 -1
- package/dist/browser/chunks/provider-4c704118.js +1 -1
- package/dist/browser/chunks/runtime-YFqnU6ic-d5c0cb49.js +8605 -0
- package/dist/browser/chunks/{src-BcptuNS5-ed25d7fd.js → src-D_1goyPT-8cca0246.js} +81 -82
- package/dist/browser/chunks/{sre-engine-jd8cc08x-42d270e5.js → sre-engine-bj997w4b-891a4cbe.js} +1 -1
- package/dist/browser/chunks/term-lookup-632cf6b1.js +1 -0
- package/dist/browser/chunks/tool-annotation-toolbar-997438b4.js +5 -5
- package/dist/browser/chunks/tool-answer-eliminator-35483abd.js +6 -6
- package/dist/browser/chunks/tool-color-scheme-b7de5cdf.js +5 -5
- package/dist/browser/chunks/tool-dictionary-cecff3b4.js +3 -3
- package/dist/browser/chunks/tool-graph-cb0338e8.js +6 -6
- package/dist/browser/chunks/tool-host-contract-fae1c415.js +1 -0
- package/dist/browser/chunks/tool-instance-id-76ac45e2.js +1 -0
- package/dist/browser/chunks/tool-line-reader-f8ef3c6a.js +3 -3
- package/dist/browser/chunks/tool-periodic-table-43b133b8.js +13 -16
- package/dist/browser/chunks/tool-picture-dictionary-33721e91.js +3 -3
- package/dist/browser/chunks/tool-protractor-23f77028.js +6 -6
- package/dist/browser/chunks/tool-ruler-1d9a03a6.js +12 -9
- package/dist/browser/chunks/tool-tts-inline-98c2ce7a.js +24 -30
- package/dist/browser/chunks/toolbar-registration-helpers-a7ab1ad4.js +194 -0
- package/dist/browser/chunks/versioned-tag-54a76be9.js +1 -1
- package/dist/browser/pie-section-player.js +66 -65
- package/dist/chunks/nl-NL-364d61b9.js +34 -6
- package/dist/chunks/{sre-engine-jd8cc08x-42d270e5.js → sre-engine-bj997w4b-891a4cbe.js} +1 -1
- package/dist/component-definitions.d.ts +0 -2
- package/dist/components/shared/card-media-region.d.ts +3 -4
- package/dist/components/shared/framework-error-latch.d.ts +4 -2
- package/dist/components/shared/missing-tool-providers.d.ts +0 -6
- package/dist/components/shared/player-preload.d.ts +4 -9
- package/dist/components/shared/section-player-card-context.d.ts +0 -3
- package/dist/components/shared/section-player-host-runtime.d.ts +0 -2
- package/dist/components/shared/section-player-view-state.d.ts +0 -1
- package/dist/controllers/SectionController.d.ts +20 -6
- package/dist/pie-section-player.js +11279 -11191
- package/package.json +11 -9
- package/dist/browser/chunks/ToolCoordinator-cc2dc319.js +0 -1
- package/dist/browser/chunks/runtime-wcU7KOFU-ac86d7b8.js +0 -8536
- package/dist/browser/chunks/tool-host-contract-b93b482c.js +0 -1
- package/dist/browser/chunks/tool-instance-id-2a92deb0.js +0 -1
- package/dist/browser/chunks/tts-runtime-config-a7ab1ad4.js +0 -194
- /package/dist/browser/chunks/{ItemToolBar-jx38w99s-58defccc.js → ItemToolBar-66hcwmfw-3bcb82a3.js} +0 -0
- /package/dist/chunks/{ItemToolBar-jx38w99s-1287ba31.js → ItemToolBar-66hcwmfw-1287ba31.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as t,t as T}from"./logger-8b07fb72.js";var g=T("ToolCoordinator",t),O;(function(o){o[o.BASE=0]="BASE",o[o.TOOL=1e3]="TOOL",o[o.MODAL=2e3]="MODAL",o[o.CONTROL=3e3]="CONTROL",o[o.HIGHLIGHT=4e3]="HIGHLIGHT"})(O||(O={}));export{O as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function s(t,r=!1){if(typeof t=="boolean")return t;if(t==null)return r;const e=String(t).trim().toLowerCase();return e===""?r:!["false","0","off","no"].includes(e)}function a(t){return t!==null&&s(t,!0)}var c=(t,r)=>{const e=t.$$p_d;return e?Object.entries(e).some(([n,o])=>o.type==="Boolean"&&(o.attribute??n.toLowerCase())===r):!1};function l(t){const r=t.prototype.attributeChangedCallback;return class extends t{attributeChangedCallback(e,n,o){const i=o!==null&&c(this,e)&&!a(o)?null:o;r?.call(this,e,n,i)}}}export{s as n,l as t};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import{t as T}from"./defineProperty-a20a667d.js";import{a as wn,i as m,n as g,r as b,t as l}from"./classPrivateFieldGet2-338e0179.js";import{m as Mi,r as xi}from"./tool-host-contract-b93b482c.js";import{n as Si,r as Ti}from"./tool-instance-id-2a92deb0.js";import{i as Wi}from"./provider-4c704118.js";var Xr,Yr,He,At,qt,de,ce,Rt,Pt,Xt,st,pr,Bt,dt,kt,Ne,fe,j,Mr,Y,Je,lt,ne,H,tt,K,et,Mt,Lt,jt,he,Ke,Ve,Ct,gr,N,ft,bt,Q,Zt,Oe,Ie,wr,Et,it;typeof window<"u"&&((Xr=(Yr=window).__svelte??(Yr.__svelte={})).v??(Xr.v=new Set)).add("5");var ie={},R=Symbol("uninitialized"),Ci="http://www.w3.org/1999/xhtml",Ei=Array.isArray,Pi=Array.prototype.indexOf,xr=Array.prototype.includes,Ai=Array.from,er=Object.keys,_e=Object.defineProperty,Ht=Object.getOwnPropertyDescriptor,ji=Object.getOwnPropertyDescriptors,Ni=Object.prototype,Oi=Array.prototype,_n=Object.getPrototypeOf,tn=Object.isExtensible,Ii=()=>{};function Ri(t){for(var e=0;e<t.length;e++)t[e]()}function mn(){var t,e;return{promise:new Promise((r,n)=>{t=r,e=n}),resolve:t,reject:e}}var rt=1024,ct=2048,Gt=4096,Nr=8192,Li=16384,Or=32768,en=1<<25,Ir=65536,oe=1<<19,qi=1<<20,rn=1<<21,Fi=1<<22,rr=1<<23,pe=Symbol("$state"),yn=Symbol("component"),$n=Symbol("legacy props"),zi=Symbol(""),Sr=Symbol("attributes"),Tr=Symbol("class"),Di=Symbol("style"),Ge=Symbol("text"),be=new class extends Error{constructor(...t){super(...t),T(this,"name","StaleReactionError"),T(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}},Bi=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml");function Hi(){console.warn("https://svelte.dev/e/derived_inert")}function cr(t){console.warn("https://svelte.dev/e/hydration_mismatch")}function Ji(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}var E=!1;function ee(t){E=t}var C;function wt(t){if(t===null)throw cr(),ie;return C=t}function Rr(){return wt(Nt(C))}function Ue(t){if(E){if(Nt(C)!==null)throw cr(),ie;C=t}}function Ki(t=1){if(E){for(var e=t,r=C;e--;)r=Nt(r);C=r}}function bn(t=!0){for(var e=0,r=C;;){if(r.nodeType===8){var n=r.data;if(n==="]"){if(e===0)return r;e-=1}else(n==="["||n==="[!"||n[0]==="["&&!isNaN(Number(n.slice(1))))&&(e+=1)}var i=Nt(r);t&&r.remove(),r=i}}function Vi(t){if(!t||t.nodeType!==8)throw cr(),ie;return t.data}function kn(t){return t===this.v}function Gi(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Mn(t){return!Gi(t,this.v)}function Ui(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Zi(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Qi(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Xi(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Yi(t){throw new Error("https://svelte.dev/e/effect_orphan")}function ts(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function es(){throw new Error("https://svelte.dev/e/hydration_failed")}function rs(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function ns(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function is(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function ss(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function ls(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}var fr=!1,hr=!1,O=null;function se(t){O=t}function Lr(t,e=!1,r){O={p:O,i:!1,c:null,e:null,s:t,x:null,r:y,l:hr&&!e?{s:null,u:null,$:[]}:null}}function qr(t){var e=O,r=e.e;if(r!==null){e.e=null;for(var n of r)Dn(n)}return t!==void 0&&(e.x=t),e.i=!0,O=e.p,Fr(t)}function Fr(t={}){return _e(t,yn,{value:!0}),t}function ke(){return!hr||O!==null&&O.l===null}var zt=[];function xn(){var t=zt;zt=[],Ri(t)}function Kt(t){if(zt.length===0&&!ge){var e=zt;queueMicrotask(()=>{e===zt&&xn()})}zt.push(t)}function as(){for(;zt.length>0;)xn()}var os=~(ct|Gt|rt);function I(t,e){t.f=t.f&os|e}function zr(t){(t.f&512)!==0||t.deps===null?I(t,rt):I(t,Gt)}function Sn(t,e,r){(t.f&2048)!==0?e.add(t):t.f&4096&&r.add(t),I(t,rt)}function vr(t){var e=k,r=y;nt(null),_t(null);try{return t()}finally{nt(e),_t(r)}}function us(t,e,r,n){const i=ke()?me:Wn;var s=t.filter(v=>!v.settled),a=e.map(i);if(r.length===0&&s.length===0){n(a);return}var o=y,u=cs(),c=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(v=>v.promise)):null;function f(v){if((o.f&16384)===0){u();try{n([...a,...v])}catch(_){gt(_,o)}nr()}}var d=Tn();if(r.length===0){c.then(()=>f([])).finally(d);return}function w(){Promise.all(r.map(v=>fs(v))).then(f).catch(v=>gt(v,o)).finally(d)}c?c.then(()=>{u(),w(),nr()}):w()}function cs(){var t=y,e=k,r=O,n=$;return function(i=!0){_t(t),nt(e),se(r),i&&!(t.f&16384)&&(n?.activate(),n?.apply())}}function nr(t=!0){_t(null),nt(null),se(null),t&&$?.deactivate()}function Tn(){var t=y,e=t.b,r=$,n=!!e?.is_rendered();return e?.update_pending_count(1,r),r.increment(n,t),()=>{e?.update_pending_count(-1,r),r.decrement(n,t)}}function me(t){var e=2|ct;return y!==null&&(y.f|=oe),{ctx:O,deps:null,effects:null,equals:kn,f:e,fn:t,reactions:null,rv:0,v:R,wv:0,parent:y,ac:null}}var ve=Symbol("obsolete");function fs(t,e,r){let n=y;n===null&&Zi();var i=void 0,s=Me(R),a=!k,o=new Set;return Es(()=>{var u=y,c=mn();i=c.promise;try{Promise.resolve(t()).then(c.resolve,v=>{v!==be&&c.reject(v)}).finally(nr)}catch(v){c.reject(v),nr()}var f=$;if(a){if((u.f&32768)!==0)var d=Tn();if(n.b?.is_rendered())f.async_deriveds.get(u)?.reject(ve);else for(const v of o.values())v.reject(ve);o.add(c),f.async_deriveds.set(u,c)}const w=(v,_=void 0)=>{d?.(),o.delete(c),_!==ve&&(f.activate(),_?(s.f|=rr,or(s,_)):(s.f&8388608&&(s.f^=rr),or(s,v)),f.deactivate())};c.promise.then(w,v=>w(null,v||"unknown"))}),Ts(()=>{for(const u of o)u.reject(ve)}),new Promise(u=>{function c(f){function d(){f===i?u(s):c(i)}f.then(d,d)}c(i)})}function It(t){const e=me(t);return Zn(e),e}function Wn(t){const e=me(t);return e.equals=Mn,e}function hs(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;r<e.length;r+=1)V(e[r])}}function Dr(t){var e,r=y,n=t.parent;if(!St&&n!==null&&t.v!==R&&(n.f&24576)!==0)return Hi(),t.v;_t(n);try{hs(t),e=ti(t)}finally{_t(r)}return e}function Cn(t){var e=Dr(t);if(!t.equals(e)&&(t.wv=Xn(),(!$?.is_fork||t.deps===null)&&($!==null?($.capture(t,e,!0),Cr?.capture(t,e,!0)):t.v=e,t.deps===null))){I(t,rt);return}St||(z!==null?(Hr()||$?.is_fork)&&z.set(t,e):zr(t))}function vs(t){if(t.effects!==null)for(const e of t.effects)(e.teardown||e.ac)&&(e.teardown?.(),e.ac!==null&&vr(()=>{e.ac.abort(be),e.ac=null}),e.fn!==null&&(e.teardown=Ii),$e(e,0),Kr(e))}function En(t){if(t.effects!==null)for(const e of t.effects)e.teardown&&e.fn!==null&&ae(e)}var Wr=null,Yt=null,$=null,Cr=null,z=null,Er=null,ge=!1,_r=!1,ye=null,ir=null,Pn=0,ds=1,ue=(He=new WeakMap,At=new WeakMap,qt=new WeakMap,de=new WeakMap,ce=new WeakMap,Rt=new WeakMap,Pt=new WeakMap,Xt=new WeakMap,st=new WeakMap,pr=new WeakMap,Bt=new WeakMap,dt=new WeakMap,kt=new WeakMap,Ne=new WeakMap,fe=new WeakMap,j=new WeakSet,Mr=class An{constructor(){wn(this,j),T(this,"id",ds++),m(this,He,!1),T(this,"linked",!0),m(this,At,null),m(this,qt,null),T(this,"async_deriveds",new Map),T(this,"current",new Map),T(this,"previous",new Map),m(this,de,new Set),m(this,ce,new Set),m(this,Rt,0),m(this,Pt,new Map),m(this,Xt,null),m(this,st,[]),m(this,pr,[]),m(this,Bt,new Set),m(this,dt,new Set),m(this,kt,new Map),m(this,Ne,new Set),T(this,"is_fork",!1),m(this,fe,!1),Yt===null?Wr=Yt=this:(g(qt,Yt,this),g(At,this,Yt)),Yt=this}skip_effect(e){l(kt,this).has(e)||l(kt,this).set(e,{d:[],m:[]}),l(Ne,this).delete(e)}unskip_effect(e,r=n=>this.schedule(n)){var n=l(kt,this).get(e);if(n){l(kt,this).delete(e);for(var i of n.d)I(i,ct),r(i);for(i of n.m)I(i,Gt),r(i)}l(Ne,this).add(e)}capture(e,r,n=!1){e.v!==R&&!this.previous.has(e)&&this.previous.set(e,e.v),!(e.f&8388608)&&(this.current.set(e,[r,n]),z?.set(e,r)),this.is_fork||(e.v=r)}activate(){$=this}deactivate(){$=null,z=null}flush(){try{_r=!0,$=this,b(j,this,sr).call(this)}finally{Pn=0,Er=null,ye=null,ir=null,_r=!1,$=null,z=null,pt.clear()}}discard(){for(const e of l(ce,this))e(this);l(ce,this).clear();for(const e of this.async_deriveds.values())e.reject(ve);b(j,this,lr).call(this),l(Xt,this)?.resolve()}register_created_effect(e){l(pr,this).push(e)}increment(e,r){if(g(Rt,this,l(Rt,this)+1),e){let n=l(Pt,this).get(r)??0;l(Pt,this).set(r,n+1)}}decrement(e,r){if(g(Rt,this,l(Rt,this)-1),e){let n=l(Pt,this).get(r)??0;n===1?l(Pt,this).delete(r):l(Pt,this).set(r,n-1)}l(fe,this)||(g(fe,this,!0),Kt(()=>{g(fe,this,!1),this.linked&&this.flush()}))}transfer_effects(e,r){for(const n of e)l(Bt,this).add(n);for(const n of r)l(dt,this).add(n);e.clear(),r.clear()}oncommit(e){l(de,this).add(e)}ondiscard(e){l(ce,this).add(e)}settled(){return(l(Xt,this)??g(Xt,this,mn())).promise}static ensure(){if($===null){const e=$=new An;!_r&&!ge&&Kt(()=>{l(He,e)||e.flush()})}return $}apply(){if(!fr||!this.is_fork&&l(At,this)===null&&l(qt,this)===null){z=null;return}z=new Map;for(const[r,[n]]of this.current)z.set(r,n);for(let r=Wr;r!==null;r=l(qt,r))if(!(r===this||r.is_fork)){var e=!1;if(r.id<this.id){for(const[n,[,i]]of r.current)if(!i&&this.current.has(n)){e=!0;break}}if(!e)for(const[n,i]of r.previous)z.has(n)||z.set(n,i)}}schedule(e){if(Er=e,e.b?.is_pending&&(e.f&16777228)!==0&&(e.f&32768)===0){e.b.defer_effect(e);return}l(st,this).push(e)}},Mr);function nn(){if(this.is_fork)return!0;for(const r of l(Pt,this).keys()){for(var t=r,e=!1;t.parent!==null;){if(l(kt,this).has(t)){e=!0;break}t=t.parent}if(!e)return!0}return!1}function ps(){var t=[];for(const i of l(st,this))if(!((i.f&16384)!==0||(i.f&6144)===0)){for(var e=i,r=!1;e.parent!==null;){e=e.parent;var n=e.f;if((n&96)!==0){if((n&1024)===0){r=!0;break}e.f^=rt}}r||t.push(e)}return g(st,this,[]),t}function sr(){g(He,this,!0);for(const a of l(Bt,this))l(dt,this).delete(a),I(a,ct),this.schedule(a);for(const a of l(dt,this))I(a,Gt),this.schedule(a);this.apply();for(var t=ye=[],e=[],r=ir=[];l(st,this).length>0;){Pn++>1e3&&(b(j,this,lr).call(this),ms());for(const a of b(j,this,ps).call(this))try{b(j,this,gs).call(this,a,t,e)}catch(o){throw On(a),b(j,this,nn).call(this)||this.discard(),o}}if($=null,r.length>0){var n=Mr.ensure();for(const a of r)n.schedule(a)}if(ye=null,ir=null,b(j,this,nn).call(this)){b(j,this,Re).call(this,e),b(j,this,Re).call(this,t);for(const[a,o]of l(kt,this))Nn(a,o);r.length>0&&b(j,$,sr).call($);return}const i=b(j,this,ws).call(this);if(i){b(j,this,Re).call(this,e),b(j,this,Re).call(this,t),b(j,i,_s).call(i,this);return}l(Bt,this).clear(),l(dt,this).clear();for(const a of l(de,this))a(this);l(de,this).clear(),Cr=this,sn(e),sn(t),Cr=null,l(Xt,this)?.resolve();var s=$;if(l(Rt,this)===0&&(l(st,this).length===0||s!==null)&&b(j,this,lr).call(this),l(st,this).length>0)if(s!==null){for(const a of l(st,this))l(st,s).push(a);g(st,this,[])}else s=this;s!==null&&(pt.clear(),b(j,s,sr).call(s))}function gs(t,e,r){t.f^=rt;for(var n=t.first;n!==null;){var i=n.f,s=(i&96)!==0;if(!(s&&(i&1024)!==0||(i&8192)!==0||l(kt,this).has(n))&&n.fn!==null){s?n.f^=rt:(i&4)!==0?e.push(n):fr&&(i&16777224)!==0?r.push(n):Se(n)&&(i&16&&l(dt,this).add(n),ae(n));var a=n.first;if(a!==null){n=a;continue}}for(;n!==null;){var o=n.next;if(o!==null){n=o;break}n=n.parent}}}function ws(){for(var t=l(At,this);t!==null;){if(!t.is_fork){for(const[e,[,r]]of this.current)if(t.current.has(e)&&!r)return t}t=l(At,t)}return null}function _s(t){for(const[r,n]of t.current)!this.previous.has(r)&&t.previous.has(r)&&this.previous.set(r,t.previous.get(r)),this.current.set(r,n);for(const[r,n]of t.async_deriveds){const i=this.async_deriveds.get(r);i&&n.promise.then(i.resolve).catch(i.reject)}t.async_deriveds.clear(),this.transfer_effects(l(Bt,t),l(dt,t));const e=r=>{var n=r.reactions;if(n!==null&&!((r.f&2)!==0&&(r.f&6144)===0))for(const a of n){var i=a.f;if((i&2)!==0)e(a);else{var s=a;i&4194320&&!this.async_deriveds.has(s)&&(l(dt,this).delete(s),I(s,ct),this.schedule(s))}}};for(const r of this.current.keys())e(r);this.oncommit(()=>t.discard()),b(j,t,lr).call(t),$=this,b(j,this,sr).call(this)}function Re(t){for(var e=0;e<t.length;e+=1)Sn(t[e],l(Bt,this),l(dt,this))}function lr(){if(this.linked){var t=l(At,this),e=l(qt,this);t===null?Wr=e:g(qt,t,e),e===null?Yt=t:g(At,e,t),this.linked=!1}}function at(t){var e=ge;ge=!0;try{var r;for(t&&($!==null&&!$.is_fork&&$.flush(),r=t());;){if(as(),$===null)return r;$.flush()}}finally{ge=e}}function ms(){try{ts()}catch(t){gt(t,Er)}}var ht=null;function sn(t){var e=t.length;if(e!==0){for(var r=0;r<e;){var n=t[r++];if((n.f&24576)===0&&Se(n)&&(ht=new Set,ae(n),n.deps===null&&n.first===null&&n.nodes===null&&n.teardown===null&&n.ac===null&&Kn(n),ht?.size>0)){pt.clear();for(const i of ht){if((i.f&24576)!==0)continue;const s=[i];let a=i.parent;for(;a!==null;)ht.has(a)&&(ht.delete(a),s.push(a)),a=a.parent;for(let o=s.length-1;o>=0;o--){const u=s[o];!(u.f&24576)&&ae(u)}}ht.clear()}}ht=null}}function jn(t){$.schedule(t)}function Nn(t,e){if(!((t.f&32)!==0&&(t.f&1024)!==0)){(t.f&2048)!==0?e.d.push(t):t.f&4096&&e.m.push(t),I(t,rt);for(var r=t.first;r!==null;)Nn(r,e),r=r.next}}function On(t){I(t,rt);for(var e=t.first;e!==null;)On(e),e=e.next}var ar=new Set,pt=new Map,In=!1;function Me(t,e){return{f:0,v:t,reactions:null,equals:kn,rv:0,wv:0}}function D(t,e){const r=Me(t,e);return Zn(r),r}function ys(t,e=!1,r=!0){const n=Me(t);return e||(n.equals=Mn),n}function x(t,e,r=!1){return k!==null&&(!ot||k.f&131072)&&ke()&&k.f&4325394&&(ut===null||!ut.has(t))&&ss(),or(t,r?re(e):e,ir)}var Ft=null,Pr=0;function or(t,e,r=null){if(!t.equals(e)){St?pt.set(t,e):pt.has(t)||pt.set(t,t.v);var n=ue.ensure();if(n.capture(t,e),(t.f&2)!==0){const i=t;t.f&2048&&Dr(i),z===null&&zr(i)}t.wv=Xn(),Ft=null,Pr=0,Rn(t,ct,r),Ft=null,ke()&&y!==null&&y.f&1024&&!(y.f&96)&&(X===null?Ns([t]):X.push(t)),!n.is_fork&&ar.size>0&&!In&&$s()}return e}function $s(){In=!1;for(const t of ar){t.f&1024&&I(t,Gt);let e;try{e=Se(t)}catch{e=!0}e&&ae(t)}ar.clear()}function we(t){x(t,t.v+1)}function Rn(t,e,r){var n=t.reactions;if(n!==null){var i=ke(),s=n.length;if(Pr+=s,Pr>1e5&&Ft===null&&(Ft=new Set),Ft!==null){if(Ft.has(t))return;Ft.add(t)}for(var a=0;a<s;a++){var o=n[a],u=o.f;if(!(!i&&o===y)){var c=(u&ct)===0;if(c&&I(o,e),(u&131072)!==0)ar.add(o);else if((u&2)!==0){var f=o;z?.delete(f),Rn(f,Gt,r)}else if(c){var d=o;u&16&&ht!==null&&ht.add(d),r!==null?r.push(d):jn(d)}}}}}function re(t){if(typeof t!="object"||t===null||pe in t||yn in t)return t;const e=_n(t);if(e!==Ni&&e!==Oi)return t;var r=new Map,n=Ei(t),i=D(0),s=null,a=Jt,o=u=>{if(Jt===a)return u();var c=k,f=Jt;nt(null),un(a);var d=u();return nt(c),un(f),d};return n&&r.set("length",D(t.length,s)),new Proxy(t,{defineProperty(u,c,f){(!("value"in f)||f.configurable===!1||f.enumerable===!1||f.writable===!1)&&ns();var d=r.get(c);return d===void 0?o(()=>{var w=D(f.value,s);return r.set(c,w),w}):x(d,f.value,!0),!0},deleteProperty(u,c){var f=r.get(c);if(f===void 0){if(c in u){const d=o(()=>D(R,s));r.set(c,d),we(i)}}else x(f,R),we(i);return!0},get(u,c,f){if(c===pe)return t;var d=r.get(c),w=c in u;if(d===void 0&&(!w||Ht(u,c)?.writable)&&(d=o(()=>D(re(w?u[c]:R),s)),r.set(c,d)),d!==void 0){var v=h(d);return v===R?void 0:v}return Reflect.get(u,c,f)},getOwnPropertyDescriptor(u,c){this.has?.(u,c);var f=Reflect.getOwnPropertyDescriptor(u,c),d=r.get(c);if(d!==void 0){var w=h(d);if(w===R)return;if(f&&"value"in f)f.value=w;else return{enumerable:!0,configurable:!0,value:w,writable:!0}}return f},has(u,c){if(c===pe)return!0;var f=r.get(c),d=f!==void 0&&f.v!==R||Reflect.has(u,c);return(f!==void 0||y!==null&&(!d||Ht(u,c)?.writable))&&(f===void 0&&(f=o(()=>D(d?re(u[c]):R,s)),r.set(c,f)),h(f)===R)?!1:d},set(u,c,f,d){var w=r.get(c),v=c in u;if(n&&c==="length")for(var _=f;_<w.v;_+=1){var M=r.get(_+"");M!==void 0?x(M,R):_ in u&&(M=o(()=>D(R,s)),r.set(_+"",M))}if(w===void 0)(!v||Ht(u,c)?.writable)&&(w=o(()=>D(void 0,s)),x(w,re(f)),r.set(c,w));else{v=w.v!==R;var B=o(()=>re(f));x(w,B)}var L=Reflect.getOwnPropertyDescriptor(u,c);if(L?.set&&L.set.call(d,f),!v){if(n&&typeof c=="string"){var q=r.get("length"),U=Number(c);Number.isInteger(U)&&U>=q.v&&x(q,U+1)}we(i)}return!0},ownKeys(u){h(i);var c=Reflect.ownKeys(u).filter(w=>{var v=r.get(w);return v===void 0||v.v!==R});for(var[f,d]of r)d.v!==R&&!(f in u)&&c.push(f);return c},setPrototypeOf(){is()}})}var ln,Ln,qn,Fn;function Ar(){if(ln===void 0){ln=window,Ln=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,r=Text.prototype;qn=Ht(e,"firstChild").get,Fn=Ht(e,"nextSibling").get,tn(t)&&(t[Tr]=void 0,t[Sr]=null,t[Di]=void 0,t.__e=void 0),tn(r)&&(r[Ge]=void 0)}}function Vt(t=""){return document.createTextNode(t)}function le(t){return qn.call(t)}function Nt(t){return Fn.call(t)}function Ze(t,e){if(!E)return le(t);var r=le(C);if(r===null)r=C.appendChild(Vt());else if(e&&r.nodeType!==3){var n=Vt();return r?.before(n),wt(n),n}return e&&zn(r),wt(r),r}function mr(t,e=!1){if(!E)return le(t);var r=Ze(t,e);return Ue(t),r}function Le(t,e=1,r=!1){let n=E?C:t;for(var i;e--;)i=n,n=Nt(n);if(!E)return n;if(r){if(n?.nodeType!==3){var s=Vt();return n===null?i?.after(s):n.before(s),wt(s),s}zn(n)}return wt(n),n}function bs(t){t.textContent=""}function ks(){return!fr||ht!==null?!1:(y.f&Or)!==0}function Br(t,e,r){return e==null||e==="http://www.w3.org/1999/xhtml"?r?document.createElement(t,{is:r}):document.createElement(t):r?document.createElementNS(e,t,{is:r}):document.createElementNS(e,t)}function zn(t){if(t.nodeValue.length<65536)return;let e=t.nextSibling;for(;e!==null&&e.nodeType===3;)e.remove(),t.nodeValue+=e.nodeValue,e=t.nextSibling}function Ms(t){var e=y;if(e===null)return k.f|=rr,t;if((e.f&32768)===0&&(e.f&4)===0)throw t;gt(t,e)}function gt(t,e){if(!(e!==null&&(e.f&16384)!==0)){for(;e!==null;){if((e.f&128)!==0&&(e.f&33570816)===0){if((e.f&32768)===0)throw t;try{e.b.error(t);return}catch(r){t=r}}e=e.parent}throw t}}function xs(t){y===null&&(k===null&&Yi(t),Xi()),St&&Qi(t)}function Ss(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function mt(t,e){var r=y;r!==null&&r.f&8192&&(t|=Nr);var n={ctx:O,deps:null,nodes:null,f:t|ct|512,first:null,fn:e,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};$?.register_created_effect(n);var i=n;if((t&4)!==0)ye!==null?ye.push(n):ue.ensure().schedule(n);else if(e!==null){try{ae(n)}catch(a){throw V(n),a}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,t&16&&t&65536&&i!==null&&(i.f|=Ir))}if(i!==null&&(i.parent=r,r!==null&&Ss(i,r),k!==null&&(k.f&2)!==0&&(t&64)===0)){var s=k;(s.effects??(s.effects=[])).push(i)}return n}function Hr(){return k!==null&&!ot}function Ts(t){const e=mt(8,null);return I(e,rt),e.teardown=t,e}function Qe(t){xs("$effect");var e=y.f;if(!k&&(e&32)!==0&&O!==null&&!O.i){var r=O;(r.e??(r.e=[])).push(t)}else return Dn(t)}function Dn(t){return mt(4|qi,t)}function Ws(t){ue.ensure();const e=mt(64|oe,t);return()=>{V(e)}}function Cs(t){ue.ensure();const e=mt(64|oe,t);return(r={})=>new Promise(n=>{r.outro?xe(e,()=>{V(e),n(void 0)}):(V(e),n(void 0))})}function Bn(t){return mt(4,t)}function Es(t){return mt(Fi|oe,t)}function Jr(t,e=0){return mt(8|e,t)}function qe(t,e=[],r=[],n=[]){us(n,e,r,i=>{mt(8,()=>{t(...i.map(h))})})}function Hn(t,e=0){return mt(16|e,t)}function xt(t){return mt(32|oe,t)}function Jn(t){var e=t.teardown;if(e!==null){const r=St,n=k;on(!0),nt(null);try{e.call(null)}catch(i){gt(i,t.parent)}finally{on(r),nt(n)}}}function Kr(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){const i=r.ac;i!==null&&vr(()=>{i.abort(be)});var n=r.next;(r.f&64)!==0?r.parent=null:V(r,e),r=n}}function Ps(t){for(var e=t.first;e!==null;){var r=e.next;!(e.f&32)&&V(e),e=r}}function V(t,e=!0){var r=!1;(e||t.f&262144)&&t.nodes!==null&&t.nodes.end!==null&&(As(t.nodes.start,t.nodes.end),r=!0),t.f|=en,Kr(t,e&&!r),$e(t,0);var n=t.nodes&&t.nodes.t;if(n!==null)for(const s of n)s.stop();Jn(t),t.f^=en,t.f|=Li;var i=t.parent;i!==null&&i.first!==null&&Kn(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function As(t,e){for(;t!==null;){var r=t===e?null:Nt(t);t.remove(),t=r}}function Kn(t){var e=t.parent,r=t.prev,n=t.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),e!==null&&(e.first===t&&(e.first=n),e.last===t&&(e.last=r))}function xe(t,e,r=!0){var n=[];t.f|=256,Vn(t,n,!0);var i=()=>{r&&V(t),e&&e()},s=n.length;if(s>0){var a=()=>--s||i();for(var o of n)o.out(a)}else i()}function Vn(t,e,r){if((t.f&8192)===0){t.f^=Nr;var n=t.nodes&&t.nodes.t;if(n!==null)for(const o of n)(o.is_global||r)&&e.push(o);for(var i=t.first;i!==null;){var s=i.next;if((i.f&64)===0){var a=(i.f&65536)!==0||(i.f&32)!==0&&(t.f&16)!==0;Vn(i,e,a?r:!1)}i=s}}}function an(t){t.f&=-257,Gn(t,!0)}function Gn(t,e){if((t.f&256)===0&&(t.f&8192)!==0){t.f^=Nr,!(t.f&1024)&&(I(t,ct),ue.ensure().schedule(t));for(var r=t.first;r!==null;){var n=r.next,i=(r.f&65536)!==0||(r.f&32)!==0;Gn(r,i?e:!1),r=n}var s=t.nodes&&t.nodes.t;if(s!==null)for(const a of s)(a.is_global||e)&&a.in()}}function Un(t,e){if(t.nodes)for(var r=t.nodes.start,n=t.nodes.end;r!==null;){var i=r===n?null:Nt(r);e.append(r),r=i}}var js=null,Xe=!1,St=!1;function on(t){St=t}var k=null,ot=!1;function nt(t){k=t}var y=null;function _t(t){y=t}var ut=null;function Zn(t){k!==null&&(k.f&2097152||k.f&2)&&(ut??(ut=new Set)).add(t)}var J=null,G=0,X=null;function Ns(t){X=t}var Qn=1,Dt=0,Jt=Dt;function un(t){Jt=t}function Xn(){return++Qn}function Se(t){var e=t.f;if((e&2048)!==0)return!0;if((e&4096)!==0){for(var r=t.deps,n=r.length,i=0;i<n;i++){var s=r[i];if(Se(s)&&Cn(s),s.wv>t.wv)return!0}e&512&&z===null&&I(t,rt)}return!1}function Yn(t,e,r=!0){var n=t.reactions;if(n!==null&&!(!fr&&ut!==null&&ut.has(t)))for(var i=0;i<n.length;i++){var s=n[i];(s.f&2)!==0?Yn(s,e,!1):e===s&&(r?I(s,ct):s.f&1024&&I(s,Gt),jn(s))}}function ti(t){var e=J,r=G,n=X,i=k,s=ut,a=O,o=ot,u=Jt,c=t.f;J=null,G=0,X=null,k=(c&96)===0?t:null,ut=null,se(t.ctx),ot=!1,Jt=++Dt,t.ac!==null&&(vr(()=>{t.ac.abort(be)}),t.ac=null);try{t.f|=rn;var f=t.fn,d=f();t.f|=Or;var w=cn(t);if(ke()&&X!==null&&!ot&&w!==null&&(t.f&6146)===0)for(var v=0;v<X.length;v++)Yn(X[v],t);if(i!==null&&i!==t){if(Dt++,i.deps!==null)for(let _=0;_<r;_+=1)i.deps[_].rv=Dt;if(e!==null)for(const _ of e)_.rv=Dt;X!==null&&(n===null?n=X:n.push(...X))}return t.f&8388608&&(t.f^=rr),d}catch(_){return cn(t),Ms(_)}finally{t.f^=rn,J=e,G=r,X=n,k=i,ut=s,se(a),ot=o,Jt=u}}function cn(t){var e=t.deps,r=$?.is_fork;if(J!==null){var n,i;if(r||$e(t,G),e!==null&&G>0)for(e.length=G+J.length,i=0;i<J.length;i++)e[G+i]=J[i];else t.deps=e=J;if(Hr()&&(t.f&512)!==0)for(i=G;i<e.length;i++)((n=e[i]).reactions??(n.reactions=[])).push(t)}else!r&&e!==null&&G<e.length&&($e(t,G),e.length=G);return e}function Os(t,e){let r=e.reactions;if(r!==null){var n=Pi.call(r,t);if(n!==-1){var i=r.length-1;i===0?r=e.reactions=null:(r[n]=r[i],r.pop())}}if(r===null&&(e.f&2)!==0&&(J===null||!xr.call(J,e))){var s=e;s.f&512&&(s.f^=512),s.v!==R&&zr(s),s.ac!==null&&vr(()=>{s.ac.abort(be),s.ac=null,I(s,ct)}),vs(s),$e(s,0)}}function $e(t,e){var r=t.deps;if(r!==null)for(var n=e;n<r.length;n++)Os(t,r[n])}function ae(t){var e=t.f;if((e&16384)===0){I(t,rt);var r=y,n=Xe;y=t,Xe=(e&96)===0;try{(e&16777232)!==0?Ps(t):Kr(t),Jn(t);var i=ti(t);t.teardown=typeof i=="function"?i:null,t.wv=Qn}finally{Xe=n,y=r}}}function h(t){var e=(t.f&2)!==0;if(js?.add(t),k!==null&&!ot&&!(y!==null&&(y.f&16384)!==0)&&(ut===null||!ut.has(t))){var r=k.deps;if((k.f&2097152)!==0)t.rv<Dt&&(t.rv=Dt,J===null&&r!==null&&r[G]===t?G++:J===null?J=[t]:J.push(t));else{var n;(n=k).deps??(n.deps=[]),xr.call(k.deps,t)||k.deps.push(t);var i=t.reactions;i===null?t.reactions=[k]:xr.call(i,k)||i.push(k)}}if(St&&pt.has(t))return pt.get(t);if(e){var s=t;if(St){var a=s.v;return(!(s.f&1024)&&s.reactions!==null||ri(s))&&(a=Dr(s)),pt.set(s,a),a}var o=(s.f&512)===0&&!ot&&k!==null&&(Xe||(k.f&512)!==0),u=(s.f&Or)===0;Se(s)&&(o&&(s.f|=512),Cn(s)),o&&!u&&(En(s),ei(s))}if(z?.has(t))return z.get(t);if((t.f&8388608)!==0)throw t.v;return t.v}function ei(t){if(t.f|=512,t.deps!==null)for(const e of t.deps)(e.reactions??(e.reactions=[])).push(t),e.f&2&&!(e.f&512)&&(En(e),ei(e))}function ri(t){if(t.v===R)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(pt.has(e)||(e.f&2)!==0&&ri(e))return!0;return!1}function Te(t){var e=ot;try{return ot=!0,t()}finally{ot=e}}var Fe=Symbol("events"),Is=new Set,fn=new Set,yr=null,$r=!1;function hn(t){var e=this,r=e.ownerDocument,n=t.type,i=t.composedPath?.()||[],s=i[0]||t.target;yr=t,$r||($r=!0,setTimeout(()=>{$r=!1,yr=null}));var a=0,o=yr===t&&t[Fe];if(o){var u=i.indexOf(o);if(u!==-1&&(e===document||e===window)){t[Fe]=e;return}var c=i.indexOf(e);if(c===-1)return;u<=c&&(a=u)}if(s=i[a]||t.target,s!==e){_e(t,"currentTarget",{configurable:!0,get(){return s||r}});var f=k,d=y;nt(null),_t(null);try{for(var w,v=[];s!==null&&s!==e;){try{var _=s[Fe]?.[n];_!=null&&(!s.disabled||t.target===s)&&_.call(s,t)}catch(M){w?v.push(M):w=M}if(t.cancelBubble)break;a++,s=a<i.length?i[a]:null}if(w){for(let M of v)queueMicrotask(()=>{throw M});throw w}}finally{t[Fe]=e,delete t.currentTarget,nt(f),_t(d)}}}var Rs=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function Ls(t){return Rs?.createHTML(t)??t}function qs(t){var e=Br("template");return e.innerHTML=Ls(t.replaceAll("<!>","<!---->")),e.content}function Ye(t,e){var r=y;r.nodes===null&&(r.nodes={start:t,end:e,a:null,t:null})}function We(t,e){var r=(e&1)!==0,n=(e&2)!==0,i,s=!t.startsWith("<!>");return()=>{if(E)return Ye(C,null),C;i===void 0&&(i=qs(s?t:"<!>"+t),r||(i=le(i)));var a=n||Ln?document.importNode(i,!0):i.cloneNode(!0);if(r){var o=le(a),u=a.lastChild;Ye(o,u)}else Ye(a,a);return a}}function te(t,e){if(E){var r=y;(!(r.f&32768)||r.nodes.end===null)&&(r.nodes.end=C),Rr();return}t!==null&&t.before(e)}var Fs=["touchstart","touchmove"];function zs(t){return Fs.includes(t)}function Ds(t){let e=0,r=Me(0),n;return()=>{Hr()&&(h(r),Jr(()=>(e===0&&(n=Te(()=>t(()=>we(r)))),e+=1,()=>{Kt(()=>{e-=1,e===0&&(n?.(),n=void 0,we(r))})})))}}var Bs=Ir|oe;function Hs(t,e,r,n){new Js(t,e,r,n)}var Js=(Y=new WeakMap,Je=new WeakMap,lt=new WeakMap,ne=new WeakMap,H=new WeakMap,tt=new WeakMap,K=new WeakMap,et=new WeakMap,Mt=new WeakMap,Lt=new WeakMap,jt=new WeakMap,he=new WeakMap,Ke=new WeakMap,Ve=new WeakMap,Ct=new WeakMap,gr=new WeakMap,N=new WeakSet,class{constructor(t,e,r,n){wn(this,N),T(this,"parent",void 0),T(this,"is_pending",!1),T(this,"transform_error",void 0),m(this,Y,void 0),m(this,Je,E?C:null),m(this,lt,void 0),m(this,ne,void 0),m(this,H,void 0),m(this,tt,null),m(this,K,null),m(this,et,null),m(this,Mt,null),m(this,Lt,0),m(this,jt,0),m(this,he,!1),m(this,Ke,new Set),m(this,Ve,new Set),m(this,Ct,null),m(this,gr,Ds(()=>(g(Ct,this,Me(l(Lt,this))),()=>{g(Ct,this,null)}))),g(Y,this,t),g(lt,this,e),g(ne,this,i=>{var s=y;s.b=this,s.f|=128,r(i)}),this.parent=y.b,this.transform_error=n??this.parent?.transform_error??(i=>i),g(H,this,Hn(()=>{if(E){const i=l(Je,this);Rr();const s=i.data==="[!";if(i.data.startsWith("[?")){const a=JSON.parse(i.data.slice(2));b(N,this,Vs).call(this,a)}else s?b(N,this,Gs).call(this):b(N,this,Ks).call(this)}else b(N,this,ii).call(this)},Bs)),E&&g(Y,this,C)}defer_effect(t){Sn(t,l(Ke,this),l(Ve,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!l(lt,this).pending}update_pending_count(t,e){b(N,this,si).call(this,t,e),g(Lt,this,l(Lt,this)+t),l(Ct,this)&&!l(he,this)&&(g(he,this,!0),Kt(()=>{g(he,this,!1),l(Ct,this)&&or(l(Ct,this),l(Lt,this))}))}get_effect_pending(){return l(gr,this).call(this),h(l(Ct,this))}error(t){if(!l(lt,this).onerror&&!l(lt,this).failed)throw t;$?.is_fork?(l(tt,this)&&$.skip_effect(l(tt,this)),l(K,this)&&$.skip_effect(l(K,this)),l(et,this)&&$.skip_effect(l(et,this)),$.oncommit(()=>{b(N,this,vn).call(this,t)})):b(N,this,vn).call(this,t)}});function Ks(){try{g(tt,this,xt(()=>l(ne,this).call(this,l(Y,this))))}catch(t){this.error(t)}}function Vs(t){const e=l(lt,this).failed,{reset:r,invoke_onerror:n}=b(N,this,ni).call(this,t);Kt(n),e&&g(et,this,xt(()=>{e(l(Y,this),()=>t,()=>r)}))}function ni(t){var e=!1,r=!1;const n=()=>{if(e){Ji();return}e=!0,r&&ls(),l(et,this)!==null&&xe(l(et,this),()=>{g(et,this,null)}),b(N,this,Vr).call(this,()=>{b(N,this,ii).call(this)})};return{reset:n,invoke_onerror:()=>{try{r=!0,l(lt,this).onerror?.(t,n),r=!1}catch(i){gt(i,l(H,this)&&l(H,this).parent)}}}}function Gs(){const t=l(lt,this).pending;t&&(this.is_pending=!0,g(K,this,xt(()=>t(l(Y,this)))),Kt(()=>{var e=g(Mt,this,document.createDocumentFragment()),r=Vt(),n=!1;if(e.append(r),g(tt,this,b(N,this,Vr).call(this,()=>{try{return xt(()=>l(ne,this).call(this,r))}catch(i){try{this.error(i),n=!0}catch(s){gt(s,l(H,this).parent)}return null}})),l(tt,this)===null){g(Mt,this,null),n&&b(N,this,ur).call(this,$);return}l(jt,this)===0&&(l(Y,this).before(e),g(Mt,this,null),xe(l(K,this),()=>{g(K,this,null)}),b(N,this,ur).call(this,$))}))}function ii(){try{if(this.is_pending=this.has_pending_snippet(),g(jt,this,0),g(Lt,this,0),g(tt,this,xt(()=>{l(ne,this).call(this,l(Y,this))})),l(jt,this)>0){var t=g(Mt,this,document.createDocumentFragment());Un(l(tt,this),t);const e=l(lt,this).pending;g(K,this,xt(()=>e(l(Y,this))))}else b(N,this,ur).call(this,$)}catch(e){this.error(e)}}function ur(t){this.is_pending=!1,t.transfer_effects(l(Ke,this),l(Ve,this))}function Vr(t){var e=y,r=k,n=O;_t(l(H,this)),nt(l(H,this)),se(l(H,this).ctx);try{return ue.ensure(),t()}finally{_t(e),nt(r),se(n)}}function si(t,e){if(!this.has_pending_snippet()){var r;this.parent&&b(N,r=this.parent,si).call(r,t,e);return}g(jt,this,l(jt,this)+t),l(jt,this)===0&&(b(N,this,ur).call(this,e),l(K,this)&&xe(l(K,this),()=>{g(K,this,null)}),l(Mt,this)&&(l(Y,this).before(l(Mt,this)),g(Mt,this,null)))}function vn(t){l(tt,this)&&(V(l(tt,this)),g(tt,this,null)),l(K,this)&&(V(l(K,this)),g(K,this,null)),l(et,this)&&(V(l(et,this)),g(et,this,null)),E&&(wt(l(Je,this)),Ki(),wt(bn()));let e=l(lt,this).failed;const r=n=>{const{reset:i,invoke_onerror:s}=b(N,this,ni).call(this,n);s(),e&&g(et,this,b(N,this,Vr).call(this,()=>{try{return xt(()=>{var a=y;a.b=this,a.f|=128,e(l(Y,this),()=>n,()=>i)})}catch(a){return gt(a,l(H,this).parent),null}}))};Kt(()=>{var n;try{n=this.transform_error(t)}catch(i){gt(i,l(H,this)&&l(H,this).parent);return}n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(r,i=>gt(i,l(H,this)&&l(H,this).parent)):r(n)})}function br(t,e){var r=e==null?"":typeof e=="object"?`${e}`:e;r!==(t[Ge]??(t[Ge]=t.nodeValue))&&(t[Ge]=r,t.nodeValue=`${r}`)}function li(t,e){return ai(t,e)}function Us(t,e){Ar(),e.intro=e.intro??!1;const r=e.target,n=E,i=C;try{for(var s=le(r);s&&(s.nodeType!==8||s.data!=="[");)s=Nt(s);if(!s)throw ie;ee(!0),wt(s);const a=ai(t,{...e,anchor:s});return ee(!1),a}catch(a){if(a instanceof Error&&a.message.split(`
|
|
2
|
-
`).some(o=>o.startsWith("https://svelte.dev/e/")))throw a;return a!==
|
|
3
|
-
\r\f \v\uFEFF`];function tl(t,e,r){var n=t==null?"":""+t;if(e&&(n=n?n+" "+e:e),r){for(var i of Object.keys(r))if(r[i])n=n?n+" "+i:i;else if(n.length)for(var s=i.length,a=0;(a=n.indexOf(i,a))>=0;){var o=a+s;(a===0||dn.includes(n[a-1]))&&(o===n.length||dn.includes(n[o]))?n=(a===0?"":n.substring(0,a))+n.substring(o+1):a=o}}return n===""?null:n}function el(t,e,r,n,i,s){var a=t[
|
|
1
|
+
import{t as T}from"./defineProperty-a20a667d.js";import{i as _,n as g,r as b,t as l}from"./classPrivateFieldGet2-338e0179.js";import{t as wn}from"./classPrivateMethodInitSpec-563cd0a5.js";import{t as Mi}from"./attribute-coercion-b93b482c.js";import{t as xi}from"./custom-element-define-2a92deb0.js";import{r as Si}from"./tool-host-contract-fae1c415.js";import{i as Ti}from"./provider-4c704118.js";import{n as Wi}from"./tool-instance-id-76ac45e2.js";var Yr,Zr,He,jt,zt,pe,fe,qt,Pt,Zt,st,gr,Jt,dt,kt,Ne,he,P,xr,Z,Je,lt,ie,H,tt,K,et,Mt,Ft,Nt,ve,Ke,Ve,Et,wr,j,ft,bt,X,Xt,Oe,Ie,mr,At,it;typeof window<"u"&&((Yr=(Zr=window).__svelte??(Zr.__svelte={})).v??(Yr.v=new Set)).add("5");var se={},I=Symbol("uninitialized"),Ci="http://www.w3.org/1999/xhtml",Ei=Array.isArray,Ai=Array.prototype.indexOf,Sr=Array.prototype.includes,Pi=Array.from,er=Object.keys,_e=Object.defineProperty,Kt=Object.getOwnPropertyDescriptor,ji=Object.getOwnPropertyDescriptors,Ni=Object.prototype,Oi=Array.prototype,mn=Object.getPrototypeOf,tn=Object.isExtensible,Ii=()=>{};function Ri(t){for(var e=0;e<t.length;e++)t[e]()}function _n(){var t,e;return{promise:new Promise((r,n)=>{t=r,e=n}),resolve:t,reject:e}}var rt=1024,ct=2048,Qt=4096,Or=8192,Li=16384,Ir=32768,en=1<<25,Rr=65536,ue=1<<19,qi=1<<20,rn=1<<21,Fi=1<<22,rr=1<<23,ge=Symbol("$state"),yn=Symbol("component"),$n=Symbol("legacy props"),zi=Symbol(""),Tr=Symbol("attributes"),Wr=Symbol("class"),Di=Symbol("style"),Ue=Symbol("text"),ke=new class extends Error{constructor(...t){super(...t),T(this,"name","StaleReactionError"),T(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}},Bi=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml");function Hi(){console.warn("https://svelte.dev/e/derived_inert")}function cr(t){console.warn("https://svelte.dev/e/hydration_mismatch")}function Ji(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}var E=!1;function re(t){E=t}var C;function wt(t){if(t===null)throw cr(),se;return C=t}function Lr(){return wt(Ot(C))}function Ge(t){if(E){if(Ot(C)!==null)throw cr(),se;C=t}}function Ki(t=1){if(E){for(var e=t,r=C;e--;)r=Ot(r);C=r}}function bn(t=!0){for(var e=0,r=C;;){if(r.nodeType===8){var n=r.data;if(n==="]"){if(e===0)return r;e-=1}else(n==="["||n==="[!"||n[0]==="["&&!isNaN(Number(n.slice(1))))&&(e+=1)}var i=Ot(r);t&&r.remove(),r=i}}function Vi(t){if(!t||t.nodeType!==8)throw cr(),se;return t.data}function kn(t){return t===this.v}function Ui(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Mn(t){return!Ui(t,this.v)}function Gi(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Qi(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Xi(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Yi(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Zi(t){throw new Error("https://svelte.dev/e/effect_orphan")}function ts(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function es(){throw new Error("https://svelte.dev/e/hydration_failed")}function rs(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function ns(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function is(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function ss(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function ls(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}var fr=!1,hr=!1,N=null;function le(t){N=t}function qr(t,e=!1,r){N={p:N,i:!1,c:null,e:null,s:t,x:null,r:y,l:hr&&!e?{s:null,u:null,$:[]}:null}}function Fr(t){var e=N,r=e.e;if(r!==null){e.e=null;for(var n of r)Dn(n)}return t!==void 0&&(e.x=t),e.i=!0,N=e.p,zr(t)}function zr(t={}){return _e(t,yn,{value:!0}),t}function Me(){return!hr||N!==null&&N.l===null}var Bt=[];function xn(){var t=Bt;Bt=[],Ri(t)}function Ut(t){if(Bt.length===0&&!we){var e=Bt;queueMicrotask(()=>{e===Bt&&xn()})}Bt.push(t)}function as(){for(;Bt.length>0;)xn()}var os=~(ct|Qt|rt);function O(t,e){t.f=t.f&os|e}function Dr(t){(t.f&512)!==0||t.deps===null?O(t,rt):O(t,Qt)}function Sn(t,e,r){(t.f&2048)!==0?e.add(t):t.f&4096&&r.add(t),O(t,rt)}function vr(t){var e=k,r=y;nt(null),mt(null);try{return t()}finally{nt(e),mt(r)}}function us(t,e,r,n){const i=Me()?ye:Wn;var s=t.filter(v=>!v.settled),a=e.map(i);if(r.length===0&&s.length===0){n(a);return}var o=y,u=cs(),c=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(v=>v.promise)):null;function f(v){if((o.f&16384)===0){u();try{n([...a,...v])}catch(m){gt(m,o)}nr()}}var d=Tn();if(r.length===0){c.then(()=>f([])).finally(d);return}function w(){Promise.all(r.map(v=>fs(v))).then(f).catch(v=>gt(v,o)).finally(d)}c?c.then(()=>{u(),w(),nr()}):w()}function cs(){var t=y,e=k,r=N,n=$;return function(i=!0){mt(t),nt(e),le(r),i&&!(t.f&16384)&&(n?.activate(),n?.apply())}}function nr(t=!0){mt(null),nt(null),le(null),t&&$?.deactivate()}function Tn(){var t=y,e=t.b,r=$,n=!!e?.is_rendered();return e?.update_pending_count(1,r),r.increment(n,t),()=>{e?.update_pending_count(-1,r),r.decrement(n,t)}}function ye(t){var e=2|ct;return y!==null&&(y.f|=ue),{ctx:N,deps:null,effects:null,equals:kn,f:e,fn:t,reactions:null,rv:0,v:I,wv:0,parent:y,ac:null}}var de=Symbol("obsolete");function fs(t,e,r){let n=y;n===null&&Qi();var i=void 0,s=xe(I),a=!k,o=new Set;return Es(()=>{var u=y,c=_n();i=c.promise;try{Promise.resolve(t()).then(c.resolve,v=>{v!==ke&&c.reject(v)}).finally(nr)}catch(v){c.reject(v),nr()}var f=$;if(a){if((u.f&32768)!==0)var d=Tn();if(n.b?.is_rendered())f.async_deriveds.get(u)?.reject(de);else for(const v of o.values())v.reject(de);o.add(c),f.async_deriveds.set(u,c)}const w=(v,m=void 0)=>{d?.(),o.delete(c),m!==de&&(f.activate(),m?(s.f|=rr,or(s,m)):(s.f&8388608&&(s.f^=rr),or(s,v)),f.deactivate())};c.promise.then(w,v=>w(null,v||"unknown"))}),Ts(()=>{for(const u of o)u.reject(de)}),new Promise(u=>{function c(f){function d(){f===i?u(s):c(i)}f.then(d,d)}c(i)})}function Lt(t){const e=ye(t);return Qn(e),e}function Wn(t){const e=ye(t);return e.equals=Mn,e}function hs(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;r<e.length;r+=1)V(e[r])}}function Br(t){var e,r=y,n=t.parent;if(!St&&n!==null&&t.v!==I&&(n.f&24576)!==0)return Hi(),t.v;mt(n);try{hs(t),e=ti(t)}finally{mt(r)}return e}function Cn(t){var e=Br(t);if(!t.equals(e)&&(t.wv=Yn(),(!$?.is_fork||t.deps===null)&&($!==null?($.capture(t,e,!0),Er?.capture(t,e,!0)):t.v=e,t.deps===null))){O(t,rt);return}St||(z!==null?(Jr()||$?.is_fork)&&z.set(t,e):Dr(t))}function vs(t){if(t.effects!==null)for(const e of t.effects)(e.teardown||e.ac)&&(e.teardown?.(),e.ac!==null&&vr(()=>{e.ac.abort(ke),e.ac=null}),e.fn!==null&&(e.teardown=Ii),be(e,0),Vr(e))}function En(t){if(t.effects!==null)for(const e of t.effects)e.teardown&&e.fn!==null&&oe(e)}var Cr=null,te=null,$=null,Er=null,z=null,Ar=null,we=!1,_r=!1,$e=null,ir=null,An=0,ds=1,ce=(He=new WeakMap,jt=new WeakMap,zt=new WeakMap,pe=new WeakMap,fe=new WeakMap,qt=new WeakMap,Pt=new WeakMap,Zt=new WeakMap,st=new WeakMap,gr=new WeakMap,Jt=new WeakMap,dt=new WeakMap,kt=new WeakMap,Ne=new WeakMap,he=new WeakMap,P=new WeakSet,xr=class Pn{constructor(){wn(this,P),T(this,"id",ds++),_(this,He,!1),T(this,"linked",!0),_(this,jt,null),_(this,zt,null),T(this,"async_deriveds",new Map),T(this,"current",new Map),T(this,"previous",new Map),_(this,pe,new Set),_(this,fe,new Set),_(this,qt,0),_(this,Pt,new Map),_(this,Zt,null),_(this,st,[]),_(this,gr,[]),_(this,Jt,new Set),_(this,dt,new Set),_(this,kt,new Map),_(this,Ne,new Set),T(this,"is_fork",!1),_(this,he,!1),te===null?Cr=te=this:(g(zt,te,this),g(jt,this,te)),te=this}skip_effect(e){l(kt,this).has(e)||l(kt,this).set(e,{d:[],m:[]}),l(Ne,this).delete(e)}unskip_effect(e,r=n=>this.schedule(n)){var n=l(kt,this).get(e);if(n){l(kt,this).delete(e);for(var i of n.d)O(i,ct),r(i);for(i of n.m)O(i,Qt),r(i)}l(Ne,this).add(e)}capture(e,r,n=!1){e.v!==I&&!this.previous.has(e)&&this.previous.set(e,e.v),!(e.f&8388608)&&(this.current.set(e,[r,n]),z?.set(e,r)),this.is_fork||(e.v=r)}activate(){$=this}deactivate(){$=null,z=null}flush(){try{_r=!0,$=this,b(P,this,sr).call(this)}finally{An=0,Ar=null,$e=null,ir=null,_r=!1,$=null,z=null,pt.clear()}}discard(){for(const e of l(fe,this))e(this);l(fe,this).clear();for(const e of this.async_deriveds.values())e.reject(de);b(P,this,lr).call(this),l(Zt,this)?.resolve()}register_created_effect(e){l(gr,this).push(e)}increment(e,r){if(g(qt,this,l(qt,this)+1),e){let n=l(Pt,this).get(r)??0;l(Pt,this).set(r,n+1)}}decrement(e,r){if(g(qt,this,l(qt,this)-1),e){let n=l(Pt,this).get(r)??0;n===1?l(Pt,this).delete(r):l(Pt,this).set(r,n-1)}l(he,this)||(g(he,this,!0),Ut(()=>{g(he,this,!1),this.linked&&this.flush()}))}transfer_effects(e,r){for(const n of e)l(Jt,this).add(n);for(const n of r)l(dt,this).add(n);e.clear(),r.clear()}oncommit(e){l(pe,this).add(e)}ondiscard(e){l(fe,this).add(e)}settled(){return(l(Zt,this)??g(Zt,this,_n())).promise}static ensure(){if($===null){const e=$=new Pn;!_r&&!we&&Ut(()=>{l(He,e)||e.flush()})}return $}apply(){if(!fr||!this.is_fork&&l(jt,this)===null&&l(zt,this)===null){z=null;return}z=new Map;for(const[r,[n]]of this.current)z.set(r,n);for(let r=Cr;r!==null;r=l(zt,r))if(!(r===this||r.is_fork)){var e=!1;if(r.id<this.id){for(const[n,[,i]]of r.current)if(!i&&this.current.has(n)){e=!0;break}}if(!e)for(const[n,i]of r.previous)z.has(n)||z.set(n,i)}}schedule(e){if(Ar=e,e.b?.is_pending&&(e.f&16777228)!==0&&(e.f&32768)===0){e.b.defer_effect(e);return}l(st,this).push(e)}},xr);function nn(){if(this.is_fork)return!0;for(const r of l(Pt,this).keys()){for(var t=r,e=!1;t.parent!==null;){if(l(kt,this).has(t)){e=!0;break}t=t.parent}if(!e)return!0}return!1}function ps(){var t=[];for(const i of l(st,this))if(!((i.f&16384)!==0||(i.f&6144)===0)){for(var e=i,r=!1;e.parent!==null;){e=e.parent;var n=e.f;if((n&96)!==0){if((n&1024)===0){r=!0;break}e.f^=rt}}r||t.push(e)}return g(st,this,[]),t}function sr(){g(He,this,!0);for(const a of l(Jt,this))l(dt,this).delete(a),O(a,ct),this.schedule(a);for(const a of l(dt,this))O(a,Qt),this.schedule(a);this.apply();for(var t=$e=[],e=[],r=ir=[];l(st,this).length>0;){An++>1e3&&(b(P,this,lr).call(this),_s());for(const a of b(P,this,ps).call(this))try{b(P,this,gs).call(this,a,t,e)}catch(o){throw On(a),b(P,this,nn).call(this)||this.discard(),o}}if($=null,r.length>0){var n=xr.ensure();for(const a of r)n.schedule(a)}if($e=null,ir=null,b(P,this,nn).call(this)){b(P,this,Re).call(this,e),b(P,this,Re).call(this,t);for(const[a,o]of l(kt,this))Nn(a,o);r.length>0&&b(P,$,sr).call($);return}const i=b(P,this,ws).call(this);if(i){b(P,this,Re).call(this,e),b(P,this,Re).call(this,t),b(P,i,ms).call(i,this);return}l(Jt,this).clear(),l(dt,this).clear();for(const a of l(pe,this))a(this);l(pe,this).clear(),Er=this,sn(e),sn(t),Er=null,l(Zt,this)?.resolve();var s=$;if(l(qt,this)===0&&(l(st,this).length===0||s!==null)&&b(P,this,lr).call(this),l(st,this).length>0)if(s!==null){for(const a of l(st,this))l(st,s).push(a);g(st,this,[])}else s=this;s!==null&&(pt.clear(),b(P,s,sr).call(s))}function gs(t,e,r){t.f^=rt;for(var n=t.first;n!==null;){var i=n.f,s=(i&96)!==0;if(!(s&&(i&1024)!==0||(i&8192)!==0||l(kt,this).has(n))&&n.fn!==null){s?n.f^=rt:(i&4)!==0?e.push(n):fr&&(i&16777224)!==0?r.push(n):Te(n)&&(i&16&&l(dt,this).add(n),oe(n));var a=n.first;if(a!==null){n=a;continue}}for(;n!==null;){var o=n.next;if(o!==null){n=o;break}n=n.parent}}}function ws(){for(var t=l(jt,this);t!==null;){if(!t.is_fork){for(const[e,[,r]]of this.current)if(t.current.has(e)&&!r)return t}t=l(jt,t)}return null}function ms(t){for(const[r,n]of t.current)!this.previous.has(r)&&t.previous.has(r)&&this.previous.set(r,t.previous.get(r)),this.current.set(r,n);for(const[r,n]of t.async_deriveds){const i=this.async_deriveds.get(r);i&&n.promise.then(i.resolve).catch(i.reject)}t.async_deriveds.clear(),this.transfer_effects(l(Jt,t),l(dt,t));const e=r=>{var n=r.reactions;if(n!==null&&!((r.f&2)!==0&&(r.f&6144)===0))for(const a of n){var i=a.f;if((i&2)!==0)e(a);else{var s=a;i&4194320&&!this.async_deriveds.has(s)&&(l(dt,this).delete(s),O(s,ct),this.schedule(s))}}};for(const r of this.current.keys())e(r);this.oncommit(()=>t.discard()),b(P,t,lr).call(t),$=this,b(P,this,sr).call(this)}function Re(t){for(var e=0;e<t.length;e+=1)Sn(t[e],l(Jt,this),l(dt,this))}function lr(){if(this.linked){var t=l(jt,this),e=l(zt,this);t===null?Cr=e:g(zt,t,e),e===null?te=t:g(jt,e,t),this.linked=!1}}function at(t){var e=we;we=!0;try{var r;for(t&&($!==null&&!$.is_fork&&$.flush(),r=t());;){if(as(),$===null)return r;$.flush()}}finally{we=e}}function _s(){try{ts()}catch(t){gt(t,Ar)}}var ht=null;function sn(t){var e=t.length;if(e!==0){for(var r=0;r<e;){var n=t[r++];if((n.f&24576)===0&&Te(n)&&(ht=new Set,oe(n),n.deps===null&&n.first===null&&n.nodes===null&&n.teardown===null&&n.ac===null&&Kn(n),ht?.size>0)){pt.clear();for(const i of ht){if((i.f&24576)!==0)continue;const s=[i];let a=i.parent;for(;a!==null;)ht.has(a)&&(ht.delete(a),s.push(a)),a=a.parent;for(let o=s.length-1;o>=0;o--){const u=s[o];!(u.f&24576)&&oe(u)}}ht.clear()}}ht=null}}function jn(t){$.schedule(t)}function Nn(t,e){if(!((t.f&32)!==0&&(t.f&1024)!==0)){(t.f&2048)!==0?e.d.push(t):t.f&4096&&e.m.push(t),O(t,rt);for(var r=t.first;r!==null;)Nn(r,e),r=r.next}}function On(t){O(t,rt);for(var e=t.first;e!==null;)On(e),e=e.next}var ar=new Set,pt=new Map,In=!1;function xe(t,e){return{f:0,v:t,reactions:null,equals:kn,rv:0,wv:0}}function D(t,e){const r=xe(t,e);return Qn(r),r}function ys(t,e=!1,r=!0){const n=xe(t);return e||(n.equals=Mn),n}function x(t,e,r=!1){return k!==null&&(!ot||k.f&131072)&&Me()&&k.f&4325394&&(ut===null||!ut.has(t))&&ss(),or(t,r?ne(e):e,ir)}var Dt=null,Pr=0;function or(t,e,r=null){if(!t.equals(e)){St?pt.set(t,e):pt.has(t)||pt.set(t,t.v);var n=ce.ensure();if(n.capture(t,e),(t.f&2)!==0){const i=t;t.f&2048&&Br(i),z===null&&Dr(i)}t.wv=Yn(),Dt=null,Pr=0,Rn(t,ct,r),Dt=null,Me()&&y!==null&&y.f&1024&&!(y.f&96)&&(Y===null?Ns([t]):Y.push(t)),!n.is_fork&&ar.size>0&&!In&&$s()}return e}function $s(){In=!1;for(const t of ar){t.f&1024&&O(t,Qt);let e;try{e=Te(t)}catch{e=!0}e&&oe(t)}ar.clear()}function me(t){x(t,t.v+1)}function Rn(t,e,r){var n=t.reactions;if(n!==null){var i=Me(),s=n.length;if(Pr+=s,Pr>1e5&&Dt===null&&(Dt=new Set),Dt!==null){if(Dt.has(t))return;Dt.add(t)}for(var a=0;a<s;a++){var o=n[a],u=o.f;if(!(!i&&o===y)){var c=(u&ct)===0;if(c&&O(o,e),(u&131072)!==0)ar.add(o);else if((u&2)!==0){var f=o;z?.delete(f),Rn(f,Qt,r)}else if(c){var d=o;u&16&&ht!==null&&ht.add(d),r!==null?r.push(d):jn(d)}}}}}function ne(t){if(typeof t!="object"||t===null||ge in t||yn in t)return t;const e=mn(t);if(e!==Ni&&e!==Oi)return t;var r=new Map,n=Ei(t),i=D(0),s=null,a=Vt,o=u=>{if(Vt===a)return u();var c=k,f=Vt;nt(null),un(a);var d=u();return nt(c),un(f),d};return n&&r.set("length",D(t.length,s)),new Proxy(t,{defineProperty(u,c,f){(!("value"in f)||f.configurable===!1||f.enumerable===!1||f.writable===!1)&&ns();var d=r.get(c);return d===void 0?o(()=>{var w=D(f.value,s);return r.set(c,w),w}):x(d,f.value,!0),!0},deleteProperty(u,c){var f=r.get(c);if(f===void 0){if(c in u){const d=o(()=>D(I,s));r.set(c,d),me(i)}}else x(f,I),me(i);return!0},get(u,c,f){if(c===ge)return t;var d=r.get(c),w=c in u;if(d===void 0&&(!w||Kt(u,c)?.writable)&&(d=o(()=>D(ne(w?u[c]:I),s)),r.set(c,d)),d!==void 0){var v=h(d);return v===I?void 0:v}return Reflect.get(u,c,f)},getOwnPropertyDescriptor(u,c){this.has?.(u,c);var f=Reflect.getOwnPropertyDescriptor(u,c),d=r.get(c);if(d!==void 0){var w=h(d);if(w===I)return;if(f&&"value"in f)f.value=w;else return{enumerable:!0,configurable:!0,value:w,writable:!0}}return f},has(u,c){if(c===ge)return!0;var f=r.get(c),d=f!==void 0&&f.v!==I||Reflect.has(u,c);return(f!==void 0||y!==null&&(!d||Kt(u,c)?.writable))&&(f===void 0&&(f=o(()=>D(d?ne(u[c]):I,s)),r.set(c,f)),h(f)===I)?!1:d},set(u,c,f,d){var w=r.get(c),v=c in u;if(n&&c==="length")for(var m=f;m<w.v;m+=1){var M=r.get(m+"");M!==void 0?x(M,I):m in u&&(M=o(()=>D(I,s)),r.set(m+"",M))}if(w===void 0)(!v||Kt(u,c)?.writable)&&(w=o(()=>D(void 0,s)),x(w,ne(f)),r.set(c,w));else{v=w.v!==I;var B=o(()=>ne(f));x(w,B)}var R=Reflect.getOwnPropertyDescriptor(u,c);if(R?.set&&R.set.call(d,f),!v){if(n&&typeof c=="string"){var L=r.get("length"),G=Number(c);Number.isInteger(G)&&G>=L.v&&x(L,G+1)}me(i)}return!0},ownKeys(u){h(i);var c=Reflect.ownKeys(u).filter(w=>{var v=r.get(w);return v===void 0||v.v!==I});for(var[f,d]of r)d.v!==I&&!(f in u)&&c.push(f);return c},setPrototypeOf(){is()}})}var ln,Ln,qn,Fn;function jr(){if(ln===void 0){ln=window,Ln=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,r=Text.prototype;qn=Kt(e,"firstChild").get,Fn=Kt(e,"nextSibling").get,tn(t)&&(t[Wr]=void 0,t[Tr]=null,t[Di]=void 0,t.__e=void 0),tn(r)&&(r[Ue]=void 0)}}function Gt(t=""){return document.createTextNode(t)}function ae(t){return qn.call(t)}function Ot(t){return Fn.call(t)}function Qe(t,e){if(!E)return ae(t);var r=ae(C);if(r===null)r=C.appendChild(Gt());else if(e&&r.nodeType!==3){var n=Gt();return r?.before(n),wt(n),n}return e&&zn(r),wt(r),r}function yr(t,e=!1){if(!E)return ae(t);var r=Qe(t,e);return Ge(t),r}function Le(t,e=1,r=!1){let n=E?C:t;for(var i;e--;)i=n,n=Ot(n);if(!E)return n;if(r){if(n?.nodeType!==3){var s=Gt();return n===null?i?.after(s):n.before(s),wt(s),s}zn(n)}return wt(n),n}function bs(t){t.textContent=""}function ks(){return!fr||ht!==null?!1:(y.f&Ir)!==0}function Hr(t,e,r){return e==null||e==="http://www.w3.org/1999/xhtml"?r?document.createElement(t,{is:r}):document.createElement(t):r?document.createElementNS(e,t,{is:r}):document.createElementNS(e,t)}function zn(t){if(t.nodeValue.length<65536)return;let e=t.nextSibling;for(;e!==null&&e.nodeType===3;)e.remove(),t.nodeValue+=e.nodeValue,e=t.nextSibling}function Ms(t){var e=y;if(e===null)return k.f|=rr,t;if((e.f&32768)===0&&(e.f&4)===0)throw t;gt(t,e)}function gt(t,e){if(!(e!==null&&(e.f&16384)!==0)){for(;e!==null;){if((e.f&128)!==0&&(e.f&33570816)===0){if((e.f&32768)===0)throw t;try{e.b.error(t);return}catch(r){t=r}}e=e.parent}throw t}}function xs(t){y===null&&(k===null&&Zi(t),Yi()),St&&Xi(t)}function Ss(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function _t(t,e){var r=y;r!==null&&r.f&8192&&(t|=Or);var n={ctx:N,deps:null,nodes:null,f:t|ct|512,first:null,fn:e,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};$?.register_created_effect(n);var i=n;if((t&4)!==0)$e!==null?$e.push(n):ce.ensure().schedule(n);else if(e!==null){try{oe(n)}catch(a){throw V(n),a}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,t&16&&t&65536&&i!==null&&(i.f|=Rr))}if(i!==null&&(i.parent=r,r!==null&&Ss(i,r),k!==null&&(k.f&2)!==0&&(t&64)===0)){var s=k;(s.effects??(s.effects=[])).push(i)}return n}function Jr(){return k!==null&&!ot}function Ts(t){const e=_t(8,null);return O(e,rt),e.teardown=t,e}function Xe(t){xs("$effect");var e=y.f;if(!k&&(e&32)!==0&&N!==null&&!N.i){var r=N;(r.e??(r.e=[])).push(t)}else return Dn(t)}function Dn(t){return _t(4|qi,t)}function Ws(t){ce.ensure();const e=_t(64|ue,t);return()=>{V(e)}}function Cs(t){ce.ensure();const e=_t(64|ue,t);return(r={})=>new Promise(n=>{r.outro?Se(e,()=>{V(e),n(void 0)}):(V(e),n(void 0))})}function Bn(t){return _t(4,t)}function Es(t){return _t(Fi|ue,t)}function Kr(t,e=0){return _t(8|e,t)}function qe(t,e=[],r=[],n=[]){us(n,e,r,i=>{_t(8,()=>{t(...i.map(h))})})}function Hn(t,e=0){return _t(16|e,t)}function xt(t){return _t(32|ue,t)}function Jn(t){var e=t.teardown;if(e!==null){const r=St,n=k;on(!0),nt(null);try{e.call(null)}catch(i){gt(i,t.parent)}finally{on(r),nt(n)}}}function Vr(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){const i=r.ac;i!==null&&vr(()=>{i.abort(ke)});var n=r.next;(r.f&64)!==0?r.parent=null:V(r,e),r=n}}function As(t){for(var e=t.first;e!==null;){var r=e.next;!(e.f&32)&&V(e),e=r}}function V(t,e=!0){var r=!1;(e||t.f&262144)&&t.nodes!==null&&t.nodes.end!==null&&(Ps(t.nodes.start,t.nodes.end),r=!0),t.f|=en,Vr(t,e&&!r),be(t,0);var n=t.nodes&&t.nodes.t;if(n!==null)for(const s of n)s.stop();Jn(t),t.f^=en,t.f|=Li;var i=t.parent;i!==null&&i.first!==null&&Kn(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function Ps(t,e){for(;t!==null;){var r=t===e?null:Ot(t);t.remove(),t=r}}function Kn(t){var e=t.parent,r=t.prev,n=t.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),e!==null&&(e.first===t&&(e.first=n),e.last===t&&(e.last=r))}function Se(t,e,r=!0){var n=[];t.f|=256,Vn(t,n,!0);var i=()=>{r&&V(t),e&&e()},s=n.length;if(s>0){var a=()=>--s||i();for(var o of n)o.out(a)}else i()}function Vn(t,e,r){if((t.f&8192)===0){t.f^=Or;var n=t.nodes&&t.nodes.t;if(n!==null)for(const o of n)(o.is_global||r)&&e.push(o);for(var i=t.first;i!==null;){var s=i.next;if((i.f&64)===0){var a=(i.f&65536)!==0||(i.f&32)!==0&&(t.f&16)!==0;Vn(i,e,a?r:!1)}i=s}}}function an(t){t.f&=-257,Un(t,!0)}function Un(t,e){if((t.f&256)===0&&(t.f&8192)!==0){t.f^=Or,!(t.f&1024)&&(O(t,ct),ce.ensure().schedule(t));for(var r=t.first;r!==null;){var n=r.next,i=(r.f&65536)!==0||(r.f&32)!==0;Un(r,i?e:!1),r=n}var s=t.nodes&&t.nodes.t;if(s!==null)for(const a of s)(a.is_global||e)&&a.in()}}function Gn(t,e){if(t.nodes)for(var r=t.nodes.start,n=t.nodes.end;r!==null;){var i=r===n?null:Ot(r);e.append(r),r=i}}var js=null,Ye=!1,St=!1;function on(t){St=t}var k=null,ot=!1;function nt(t){k=t}var y=null;function mt(t){y=t}var ut=null;function Qn(t){k!==null&&(k.f&2097152||k.f&2)&&(ut??(ut=new Set)).add(t)}var J=null,U=0,Y=null;function Ns(t){Y=t}var Xn=1,Ht=0,Vt=Ht;function un(t){Vt=t}function Yn(){return++Xn}function Te(t){var e=t.f;if((e&2048)!==0)return!0;if((e&4096)!==0){for(var r=t.deps,n=r.length,i=0;i<n;i++){var s=r[i];if(Te(s)&&Cn(s),s.wv>t.wv)return!0}e&512&&z===null&&O(t,rt)}return!1}function Zn(t,e,r=!0){var n=t.reactions;if(n!==null&&!(!fr&&ut!==null&&ut.has(t)))for(var i=0;i<n.length;i++){var s=n[i];(s.f&2)!==0?Zn(s,e,!1):e===s&&(r?O(s,ct):s.f&1024&&O(s,Qt),jn(s))}}function ti(t){var e=J,r=U,n=Y,i=k,s=ut,a=N,o=ot,u=Vt,c=t.f;J=null,U=0,Y=null,k=(c&96)===0?t:null,ut=null,le(t.ctx),ot=!1,Vt=++Ht,t.ac!==null&&(vr(()=>{t.ac.abort(ke)}),t.ac=null);try{t.f|=rn;var f=t.fn,d=f();t.f|=Ir;var w=cn(t);if(Me()&&Y!==null&&!ot&&w!==null&&(t.f&6146)===0)for(var v=0;v<Y.length;v++)Zn(Y[v],t);if(i!==null&&i!==t){if(Ht++,i.deps!==null)for(let m=0;m<r;m+=1)i.deps[m].rv=Ht;if(e!==null)for(const m of e)m.rv=Ht;Y!==null&&(n===null?n=Y:n.push(...Y))}return t.f&8388608&&(t.f^=rr),d}catch(m){return cn(t),Ms(m)}finally{t.f^=rn,J=e,U=r,Y=n,k=i,ut=s,le(a),ot=o,Vt=u}}function cn(t){var e=t.deps,r=$?.is_fork;if(J!==null){var n,i;if(r||be(t,U),e!==null&&U>0)for(e.length=U+J.length,i=0;i<J.length;i++)e[U+i]=J[i];else t.deps=e=J;if(Jr()&&(t.f&512)!==0)for(i=U;i<e.length;i++)((n=e[i]).reactions??(n.reactions=[])).push(t)}else!r&&e!==null&&U<e.length&&(be(t,U),e.length=U);return e}function Os(t,e){let r=e.reactions;if(r!==null){var n=Ai.call(r,t);if(n!==-1){var i=r.length-1;i===0?r=e.reactions=null:(r[n]=r[i],r.pop())}}if(r===null&&(e.f&2)!==0&&(J===null||!Sr.call(J,e))){var s=e;s.f&512&&(s.f^=512),s.v!==I&&Dr(s),s.ac!==null&&vr(()=>{s.ac.abort(ke),s.ac=null,O(s,ct)}),vs(s),be(s,0)}}function be(t,e){var r=t.deps;if(r!==null)for(var n=e;n<r.length;n++)Os(t,r[n])}function oe(t){var e=t.f;if((e&16384)===0){O(t,rt);var r=y,n=Ye;y=t,Ye=(e&96)===0;try{(e&16777232)!==0?As(t):Vr(t),Jn(t);var i=ti(t);t.teardown=typeof i=="function"?i:null,t.wv=Xn}finally{Ye=n,y=r}}}function h(t){var e=(t.f&2)!==0;if(js?.add(t),k!==null&&!ot&&!(y!==null&&(y.f&16384)!==0)&&(ut===null||!ut.has(t))){var r=k.deps;if((k.f&2097152)!==0)t.rv<Ht&&(t.rv=Ht,J===null&&r!==null&&r[U]===t?U++:J===null?J=[t]:J.push(t));else{var n;(n=k).deps??(n.deps=[]),Sr.call(k.deps,t)||k.deps.push(t);var i=t.reactions;i===null?t.reactions=[k]:Sr.call(i,k)||i.push(k)}}if(St&&pt.has(t))return pt.get(t);if(e){var s=t;if(St){var a=s.v;return(!(s.f&1024)&&s.reactions!==null||ri(s))&&(a=Br(s)),pt.set(s,a),a}var o=(s.f&512)===0&&!ot&&k!==null&&(Ye||(k.f&512)!==0),u=(s.f&Ir)===0;Te(s)&&(o&&(s.f|=512),Cn(s)),o&&!u&&(En(s),ei(s))}if(z?.has(t))return z.get(t);if((t.f&8388608)!==0)throw t.v;return t.v}function ei(t){if(t.f|=512,t.deps!==null)for(const e of t.deps)(e.reactions??(e.reactions=[])).push(t),e.f&2&&!(e.f&512)&&(En(e),ei(e))}function ri(t){if(t.v===I)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(pt.has(e)||(e.f&2)!==0&&ri(e))return!0;return!1}function We(t){var e=ot;try{return ot=!0,t()}finally{ot=e}}var Fe=Symbol("events"),Is=new Set,fn=new Set,$r=null,br=!1;function hn(t){var e=this,r=e.ownerDocument,n=t.type,i=t.composedPath?.()||[],s=i[0]||t.target;$r=t,br||(br=!0,setTimeout(()=>{br=!1,$r=null}));var a=0,o=$r===t&&t[Fe];if(o){var u=i.indexOf(o);if(u!==-1&&(e===document||e===window)){t[Fe]=e;return}var c=i.indexOf(e);if(c===-1)return;u<=c&&(a=u)}if(s=i[a]||t.target,s!==e){_e(t,"currentTarget",{configurable:!0,get(){return s||r}});var f=k,d=y;nt(null),mt(null);try{for(var w,v=[];s!==null&&s!==e;){try{var m=s[Fe]?.[n];m!=null&&(!s.disabled||t.target===s)&&m.call(s,t)}catch(M){w?v.push(M):w=M}if(t.cancelBubble)break;a++,s=a<i.length?i[a]:null}if(w){for(let M of v)queueMicrotask(()=>{throw M});throw w}}finally{t[Fe]=e,delete t.currentTarget,nt(f),mt(d)}}}var Rs=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function Ls(t){return Rs?.createHTML(t)??t}function qs(t){var e=Hr("template");return e.innerHTML=Ls(t.replaceAll("<!>","<!---->")),e.content}function Ze(t,e){var r=y;r.nodes===null&&(r.nodes={start:t,end:e,a:null,t:null})}function Ce(t,e){var r=(e&1)!==0,n=(e&2)!==0,i,s=!t.startsWith("<!>");return()=>{if(E)return Ze(C,null),C;i===void 0&&(i=qs(s?t:"<!>"+t),r||(i=ae(i)));var a=n||Ln?document.importNode(i,!0):i.cloneNode(!0);if(r){var o=ae(a),u=a.lastChild;Ze(o,u)}else Ze(a,a);return a}}function ee(t,e){if(E){var r=y;(!(r.f&32768)||r.nodes.end===null)&&(r.nodes.end=C),Lr();return}t!==null&&t.before(e)}var Fs=["touchstart","touchmove"];function zs(t){return Fs.includes(t)}function Ds(t){let e=0,r=xe(0),n;return()=>{Jr()&&(h(r),Kr(()=>(e===0&&(n=We(()=>t(()=>me(r)))),e+=1,()=>{Ut(()=>{e-=1,e===0&&(n?.(),n=void 0,me(r))})})))}}var Bs=Rr|ue;function Hs(t,e,r,n){new Js(t,e,r,n)}var Js=(Z=new WeakMap,Je=new WeakMap,lt=new WeakMap,ie=new WeakMap,H=new WeakMap,tt=new WeakMap,K=new WeakMap,et=new WeakMap,Mt=new WeakMap,Ft=new WeakMap,Nt=new WeakMap,ve=new WeakMap,Ke=new WeakMap,Ve=new WeakMap,Et=new WeakMap,wr=new WeakMap,j=new WeakSet,class{constructor(t,e,r,n){wn(this,j),T(this,"parent",void 0),T(this,"is_pending",!1),T(this,"transform_error",void 0),_(this,Z,void 0),_(this,Je,E?C:null),_(this,lt,void 0),_(this,ie,void 0),_(this,H,void 0),_(this,tt,null),_(this,K,null),_(this,et,null),_(this,Mt,null),_(this,Ft,0),_(this,Nt,0),_(this,ve,!1),_(this,Ke,new Set),_(this,Ve,new Set),_(this,Et,null),_(this,wr,Ds(()=>(g(Et,this,xe(l(Ft,this))),()=>{g(Et,this,null)}))),g(Z,this,t),g(lt,this,e),g(ie,this,i=>{var s=y;s.b=this,s.f|=128,r(i)}),this.parent=y.b,this.transform_error=n??this.parent?.transform_error??(i=>i),g(H,this,Hn(()=>{if(E){const i=l(Je,this);Lr();const s=i.data==="[!";if(i.data.startsWith("[?")){const a=JSON.parse(i.data.slice(2));b(j,this,Vs).call(this,a)}else s?b(j,this,Us).call(this):b(j,this,Ks).call(this)}else b(j,this,ii).call(this)},Bs)),E&&g(Z,this,C)}defer_effect(t){Sn(t,l(Ke,this),l(Ve,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!l(lt,this).pending}update_pending_count(t,e){b(j,this,si).call(this,t,e),g(Ft,this,l(Ft,this)+t),l(Et,this)&&!l(ve,this)&&(g(ve,this,!0),Ut(()=>{g(ve,this,!1),l(Et,this)&&or(l(Et,this),l(Ft,this))}))}get_effect_pending(){return l(wr,this).call(this),h(l(Et,this))}error(t){if(!l(lt,this).onerror&&!l(lt,this).failed)throw t;$?.is_fork?(l(tt,this)&&$.skip_effect(l(tt,this)),l(K,this)&&$.skip_effect(l(K,this)),l(et,this)&&$.skip_effect(l(et,this)),$.oncommit(()=>{b(j,this,vn).call(this,t)})):b(j,this,vn).call(this,t)}});function Ks(){try{g(tt,this,xt(()=>l(ie,this).call(this,l(Z,this))))}catch(t){this.error(t)}}function Vs(t){const e=l(lt,this).failed,{reset:r,invoke_onerror:n}=b(j,this,ni).call(this,t);Ut(n),e&&g(et,this,xt(()=>{e(l(Z,this),()=>t,()=>r)}))}function ni(t){var e=!1,r=!1;const n=()=>{if(e){Ji();return}e=!0,r&&ls(),l(et,this)!==null&&Se(l(et,this),()=>{g(et,this,null)}),b(j,this,Ur).call(this,()=>{b(j,this,ii).call(this)})};return{reset:n,invoke_onerror:()=>{try{r=!0,l(lt,this).onerror?.(t,n),r=!1}catch(i){gt(i,l(H,this)&&l(H,this).parent)}}}}function Us(){const t=l(lt,this).pending;t&&(this.is_pending=!0,g(K,this,xt(()=>t(l(Z,this)))),Ut(()=>{var e=g(Mt,this,document.createDocumentFragment()),r=Gt(),n=!1;if(e.append(r),g(tt,this,b(j,this,Ur).call(this,()=>{try{return xt(()=>l(ie,this).call(this,r))}catch(i){try{this.error(i),n=!0}catch(s){gt(s,l(H,this).parent)}return null}})),l(tt,this)===null){g(Mt,this,null),n&&b(j,this,ur).call(this,$);return}l(Nt,this)===0&&(l(Z,this).before(e),g(Mt,this,null),Se(l(K,this),()=>{g(K,this,null)}),b(j,this,ur).call(this,$))}))}function ii(){try{if(this.is_pending=this.has_pending_snippet(),g(Nt,this,0),g(Ft,this,0),g(tt,this,xt(()=>{l(ie,this).call(this,l(Z,this))})),l(Nt,this)>0){var t=g(Mt,this,document.createDocumentFragment());Gn(l(tt,this),t);const e=l(lt,this).pending;g(K,this,xt(()=>e(l(Z,this))))}else b(j,this,ur).call(this,$)}catch(e){this.error(e)}}function ur(t){this.is_pending=!1,t.transfer_effects(l(Ke,this),l(Ve,this))}function Ur(t){var e=y,r=k,n=N;mt(l(H,this)),nt(l(H,this)),le(l(H,this).ctx);try{return ce.ensure(),t()}finally{mt(e),nt(r),le(n)}}function si(t,e){if(!this.has_pending_snippet()){var r;this.parent&&b(j,r=this.parent,si).call(r,t,e);return}g(Nt,this,l(Nt,this)+t),l(Nt,this)===0&&(b(j,this,ur).call(this,e),l(K,this)&&Se(l(K,this),()=>{g(K,this,null)}),l(Mt,this)&&(l(Z,this).before(l(Mt,this)),g(Mt,this,null)))}function vn(t){l(tt,this)&&(V(l(tt,this)),g(tt,this,null)),l(K,this)&&(V(l(K,this)),g(K,this,null)),l(et,this)&&(V(l(et,this)),g(et,this,null)),E&&(wt(l(Je,this)),Ki(),wt(bn()));let e=l(lt,this).failed;const r=n=>{const{reset:i,invoke_onerror:s}=b(j,this,ni).call(this,n);s(),e&&g(et,this,b(j,this,Ur).call(this,()=>{try{return xt(()=>{var a=y;a.b=this,a.f|=128,e(l(Z,this),()=>n,()=>i)})}catch(a){return gt(a,l(H,this).parent),null}}))};Ut(()=>{var n;try{n=this.transform_error(t)}catch(i){gt(i,l(H,this)&&l(H,this).parent);return}n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(r,i=>gt(i,l(H,this)&&l(H,this).parent)):r(n)})}function kr(t,e){var r=e==null?"":typeof e=="object"?`${e}`:e;r!==(t[Ue]??(t[Ue]=t.nodeValue))&&(t[Ue]=r,t.nodeValue=`${r}`)}function li(t,e){return ai(t,e)}function Gs(t,e){jr(),e.intro=e.intro??!1;const r=e.target,n=E,i=C;try{for(var s=ae(r);s&&(s.nodeType!==8||s.data!=="[");)s=Ot(s);if(!s)throw se;re(!0),wt(s);const a=ai(t,{...e,anchor:s});return re(!1),a}catch(a){if(a instanceof Error&&a.message.split(`
|
|
2
|
+
`).some(o=>o.startsWith("https://svelte.dev/e/")))throw a;return a!==se&&console.warn("Failed to hydrate: ",a),e.recover===!1&&es(),jr(),bs(r),re(!1),li(t,e)}finally{re(n),wt(i)}}var ze=new Map;function ai(t,{target:e,anchor:r,props:n={},events:i,context:s,intro:a=!0,transformError:o}){jr();var u=void 0,c=Cs(()=>{var f=r??e.appendChild(Gt());Hs(f,{pending:()=>{}},v=>{qr({});var m=N;if(s&&(m.c=s),i&&(n.$$events=i),E&&Ze(v,null),u=t(v,n)||zr(),E&&(y.nodes.end=C,C===null||C.nodeType!==8||C.data!=="]"))throw cr(),se;Fr()},o);var d=new Set,w=v=>{for(var m=0;m<v.length;m++){var M=v[m];if(!d.has(M)){d.add(M);var B=zs(M);for(const G of[e,document]){var R=ze.get(G);R===void 0&&(R=new Map,ze.set(G,R));var L=R.get(M);L===void 0?(G.addEventListener(M,hn,{passive:B}),R.set(M,1)):R.set(M,L+1)}}}};return w(Pi(Is)),fn.add(w),()=>{for(var v of d)for(const B of[e,document]){var m=ze.get(B),M=m.get(v);--M==0?(B.removeEventListener(v,hn),m.delete(v),m.size===0&&ze.delete(B)):m.set(v,M)}fn.delete(w),f!==r&&f.parentNode?.removeChild(f)}});return Nr.set(u,c),u}var Nr=new WeakMap;function Qs(t,e){const r=Nr.get(t);return r?(Nr.delete(t),r(e)):Promise.resolve()}var Xs=(ft=new WeakMap,bt=new WeakMap,X=new WeakMap,Xt=new WeakMap,Oe=new WeakMap,Ie=new WeakMap,mr=new WeakMap,class{constructor(t,e=!0){T(this,"anchor",void 0),_(this,ft,new Map),_(this,bt,new Map),_(this,X,new Map),_(this,Xt,new Set),_(this,Oe,!0),_(this,Ie,r=>{if(l(ft,this).has(r)){var n=l(ft,this).get(r),i=l(bt,this).get(n);if(i)an(i),l(Xt,this).delete(n);else{var s=l(X,this).get(n);s&&(an(s.effect),l(bt,this).set(n,s.effect),l(X,this).delete(n),s.fragment.lastChild.remove(),this.anchor.before(s.fragment),i=s.effect)}for(const[a,o]of l(ft,this)){if(l(ft,this).delete(a),a===r)break;const u=l(X,this).get(o);u&&(V(u.effect),l(X,this).delete(o))}for(const[a,o]of l(bt,this)){if(a===n||l(Xt,this).has(a))continue;const u=()=>{if(Array.from(l(ft,this).values()).includes(a)){var c=document.createDocumentFragment();Gn(o,c),c.append(Gt()),l(X,this).set(a,{effect:o,fragment:c})}else V(o);l(Xt,this).delete(a),l(bt,this).delete(a)};l(Oe,this)||!i?(l(Xt,this).add(a),Se(o,u,!1)):u()}}}),_(this,mr,r=>{l(ft,this).delete(r);const n=Array.from(l(ft,this).values());for(const[i,s]of l(X,this))n.includes(i)||(V(s.effect),l(X,this).delete(i))}),this.anchor=t,g(Oe,this,e)}ensure(t,e){var r=$,n=ks();if(e&&!l(bt,this).has(t)&&!l(X,this).has(t))if(n){var i=document.createDocumentFragment(),s=Gt();i.append(s),l(X,this).set(t,{effect:xt(()=>e(s)),fragment:i})}else l(bt,this).set(t,xt(()=>e(this.anchor)));if(l(ft,this).set(r,t),n){for(const[a,o]of l(bt,this))a===t?r.unskip_effect(o):r.skip_effect(o);for(const[a,o]of l(X,this))a===t?r.unskip_effect(o.effect):r.skip_effect(o.effect);r.oncommit(l(Ie,this)),r.ondiscard(l(mr,this))}else E&&(this.anchor=C),l(Ie,this).call(this,r)}});function Ys(t){N===null&&Gi("onMount"),hr&&N.l!==null?Zs(N).m.push(t):Xe(()=>{const e=We(t);if(typeof e=="function")return e})}function Zs(t){var e=t.l;return e.u??(e.u={a:[],b:[],m:[]})}function De(t,e,r=!1){var n;E&&(n=C,Lr());var i=new Xs(t),s=r?Rr:0;function a(o,u){if(E){var c=Vi(n);if(o!==parseInt(c.substring(1))){var f=bn();wt(f),i.anchor=f,re(!1),i.ensure(o,u),re(!0);return}}i.ensure(o,u)}Hn(()=>{var o=!1;e((u,c=0)=>{o=!0,a(c,u)}),o||a(-1,null)},s)}function oi(t,e){Bn(()=>{t=y?.parent?.nodes?.start??t;var r=t.getRootNode(),n=r.host?r:r.head??r.ownerDocument.head;if(!n.querySelector("#"+e.hash)){const i=Hr("style");i.id=e.hash,i.textContent=e.code,n.appendChild(i)}})}var dn=[...`
|
|
3
|
+
\r\f \v\uFEFF`];function tl(t,e,r){var n=t==null?"":""+t;if(e&&(n=n?n+" "+e:e),r){for(var i of Object.keys(r))if(r[i])n=n?n+" "+i:i;else if(n.length)for(var s=i.length,a=0;(a=n.indexOf(i,a))>=0;){var o=a+s;(a===0||dn.includes(n[a-1]))&&(o===n.length||dn.includes(n[o]))?n=(a===0?"":n.substring(0,a))+n.substring(o+1):a=o}}return n===""?null:n}function el(t,e,r,n,i,s){var a=t[Wr];if(E||a!==r||a===void 0){var o=tl(r,n,s);(!E||o!==t.getAttribute("class"))&&(o==null?t.removeAttribute("class"):e?t.className=o:t.setAttribute("class",o)),t[Wr]=r}else if(s&&i!==s)for(var u in s){var c=!!s[u];(i==null||c!==!!i[u])&&t.classList.toggle(u,c)}return s}var rl=Symbol("is custom element"),nl=Symbol("is html"),il=Bi?"link":"LINK";function Yt(t,e,r,n){var i=sl(t);E&&(i[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName===il)||i[e]!==(i[e]=r)&&(e==="loading"&&(t[zi]=r),r==null?t.removeAttribute(e):typeof r!="string"&&ll(t).has(e)?t[e]=r:t.setAttribute(e,r))}function sl(t){return t[Tr]??(t[Tr]={[rl]:t.nodeName.includes("-"),[nl]:t.namespaceURI===Ci})}var pn=new Map;function ll(t){var e=t.getAttribute("is")||t.nodeName,r=pn.get(e);if(r)return r;pn.set(e,r=new Set);for(var n,i=t,s=Element.prototype;s!==i;){n=ji(i);for(var a in n)n[a].set&&a!=="innerHTML"&&a!=="textContent"&&a!=="innerText"&&r.add(a);i=mn(i)}return r}function Mr(t,e){return t===e||t?.[ge]===e}function gn(t=zr(),e,r,n){var i=N.r,s=y;return Bn(()=>{var a,o;return Kr(()=>{a=o,o=n?.()||[],We(()=>{Mr(r(...o),t)||(e(t,...o),a&&Mr(r(...a),t)&&e(null,...a))})}),()=>{let u=s;for(;u!==i&&u.parent!==null&&u.parent.f&33554432;)u=u.parent;const c=()=>{o&&Mr(r(...o),t)&&e(null,...o)},f=u.teardown;u.teardown=()=>{c(),f?.()}}}),t}var Be=!1;function al(t){var e=Be;try{return Be=!1,[t(),Be]}finally{Be=e}}function vt(t,e,r,n){var i=!hr||(r&2)!==0,s=(r&8)!==0,a=(r&16)!==0,o=n,u=!0,c=void 0,f=()=>a&&i?(c??(c=ye(n)),h(c)):(u&&(u=!1,o=a?We(n):n),o);let d;if(s){var w=ge in t||$n in t;d=Kt(t,e)?.set??(w&&e in t?A=>t[e]=A:void 0)}var v,m=!1;s?[v,m]=al(()=>t[e]):v=t[e],v===void 0&&n!==void 0&&(v=f(),d&&(i&&rs(e),d(v)));var M;if(i?M=()=>{var A=t[e];return A===void 0?f():(u=!0,A)}:M=()=>{var A=t[e];return A!==void 0&&(o=void 0),A===void 0?o:A},i&&(r&4)===0)return M;if(d){var B=t.$$legacy;return(function(A,Tt){return arguments.length>0?((!i||!Tt||B||m)&&d(Tt?M():A),A):M()})}var R=!1,L=((r&1)!==0?ye:Wn)(()=>(R=!1,M()));s&&h(L);var G=y;return(function(A,Tt){if(arguments.length>0){const Wt=Tt?h(L):i&&s?ne(A):A;return x(L,Wt),R=!0,o!==void 0&&(o=Wt),A}return St&&R||(G.f&16384)!==0?L.v:h(L)})}function ol(t){return new ul(t)}var ul=(At=new WeakMap,it=new WeakMap,class{constructor(t){_(this,At,void 0),_(this,it,void 0);var e=new Map,r=(i,s)=>{var a=ys(s,!1,!1);return e.set(i,a),a};const n=new Proxy({...t.props||{},$$events:{}},{get(i,s){return h(e.get(s)??r(s,Reflect.get(i,s)))},has(i,s){return s===$n?!0:(h(e.get(s)??r(s,Reflect.get(i,s))),Reflect.has(i,s))},set(i,s,a){return x(e.get(s)??r(s,a),a),Reflect.set(i,s,a)}});g(it,this,(t.hydrate?Gs:li)(t.component,{target:t.target,anchor:t.anchor,props:n,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError})),(!t?.props?.$$host||t.sync===!1)&&at(),g(At,this,n.$$events);for(const i of Object.keys(l(it,this)))i==="$set"||i==="$destroy"||i==="$on"||_e(this,i,{get(){return l(it,this)[i]},set(s){l(it,this)[i]=s},enumerable:!0});l(it,this).$set=i=>{Object.assign(n,i)},l(it,this).$destroy=()=>{Qs(l(it,this))}}$set(t){l(it,this).$set(t)}$on(t,e){l(At,this)[t]=l(At,this)[t]||[];const r=(...n)=>e.call(this,...n);return l(At,this)[t].push(r),()=>{l(At,this)[t]=l(At,this)[t].filter(n=>n!==r)}}$destroy(){l(it,this).$destroy()}}),ui;typeof HTMLElement=="function"&&(ui=class extends HTMLElement{constructor(t,e,r){var n=(...i)=>(super(...i),T(this,"$$ctor",void 0),T(this,"$$s",void 0),T(this,"$$c",void 0),T(this,"$$cn",!1),T(this,"$$d",{}),T(this,"$$r",!1),T(this,"$$p_d",{}),T(this,"$$l",{}),T(this,"$$l_u",new Map),T(this,"$$me",void 0),T(this,"$$shadowRoot",null),this);n(),this.$$ctor=t,this.$$s=e,r&&(this.$$shadowRoot=this.attachShadow(r))}addEventListener(t,e,r){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){const n=this.$$c.$on(t,e);this.$$l_u.set(e,n)}super.addEventListener(t,e,r)}removeEventListener(t,e,r){if(super.removeEventListener(t,e,r),this.$$c){const n=this.$$l_u.get(e);n&&(n(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(n){return i=>{const s=Hr("slot");n!=="default"&&(s.name=n),ee(i,s)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const e={},r=cl(this);for(const n of this.$$s)n in r&&(n==="default"&&!this.$$d.children?(this.$$d.children=t(n),e.default=!0):e[n]=t(n));for(const n of this.attributes){const i=this.$$g_p(n.name);i in this.$$d||(this.$$d[i]=tr(i,n.value,this.$$p_d,"toProp"))}for(const n in this.$$p_d)!(n in this.$$d)&&this[n]!==void 0&&(this.$$d[n]=this[n],delete this[n]);this.$$c=ol({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:e,$$host:this}}),this.$$me=Ws(()=>{Kr(()=>{this.$$r=!0;for(const n of er(this.$$c)){if(!this.$$p_d[n]?.reflect)continue;this.$$d[n]=this.$$c[n];const i=tr(n,this.$$d[n],this.$$p_d,"toAttribute");i==null?this.removeAttribute(this.$$p_d[n].attribute||n):this.setAttribute(this.$$p_d[n].attribute||n,i)}this.$$r=!1})});for(const n in this.$$l)for(const i of this.$$l[n]){const s=this.$$c.$on(n,i);this.$$l_u.set(i,s)}this.$$l={}}}attributeChangedCallback(t,e,r){this.$$r||(t=this.$$g_p(t),this.$$d[t]=tr(t,r,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(t){return er(this.$$p_d).find(e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t)||t}});function tr(t,e,r,n){const i=r[t]?.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!r[t])return e;if(n==="toAttribute")switch(i){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(i){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function cl(t){const e={};return t.childNodes.forEach(r=>{e[r.slot||"default"]=!0}),e}function ci(t,e,r,n,i,s){let a=class extends ui{constructor(){super(t,r,i),this.$$p_d=e}static get observedAttributes(){return er(e).map(o=>(e[o].attribute||o).toLowerCase())}};return er(e).forEach(o=>{_e(a.prototype,o,{get(){return this.$$c&&o in this.$$c?this.$$c[o]:this.$$d[o]},set(u){u=tr(o,u,e),this.$$d[o]=u;var c=this.$$c;c&&(Kt(c,o)?.get?c[o]=u:c.$set({[o]:u}))}})}),n.forEach(o=>{_e(a.prototype,o,{get(){return this.$$c?.[o]}})}),s&&(a=s(a)),t.element=a,a}function fl(t){const e=new Set,r=n=>{if(n===void 0)return{$type:"undefined"};if(typeof n=="bigint")return{$type:"bigint",value:n.toString()};if(typeof n=="function")return{$type:"function",value:n.toString()};if(typeof n=="symbol")return{$type:"symbol",value:n.description??""};if(n===null||typeof n!="object")return n;if(e.has(n))return{$type:"circular-reference"};e.add(n);const i=Array.isArray(n)?n.map(r):Object.fromEntries(Object.entries(n).sort(([s],[a])=>s.localeCompare(a)).map(([s,a])=>[s,r(a)]));return e.delete(n),i};return JSON.stringify(r(t))}var hl=Ce('<a class="pie-tool-calculator__attribution svelte-16ps7c2" target="_blank" rel="noreferrer"> </a>'),vl=Ce('<div class="pie-tool-calculator__loading svelte-16ps7c2"> </div>'),dl=Ce('<div class="pie-tool-calculator__loading pie-tool-calculator__loading--error svelte-16ps7c2">Calculator failed to initialize. <div class="pie-tool-calculator__error-details svelte-16ps7c2"> </div></div>'),pl=Ce('<div role="region" tabindex="-1" translate="no"><div class="pie-tool-calculator__container svelte-16ps7c2"></div> <!> <!> <!></div>'),gl=Ce('<div class="pie-tool-calculator__context-host svelte-16ps7c2"><!></div>'),wl={hash:"svelte-16ps7c2",code:`.pie-tool-calculator__context-host.svelte-16ps7c2 {display:flex;width:100%;height:100%;min-height:0;}.pie-tool-calculator.svelte-16ps7c2 {position:relative;display:flex;flex:1 1 auto;min-width:100%;min-height:0;background:var(--pie-white, white);overflow:hidden;}.pie-tool-calculator__container.svelte-16ps7c2 {position:relative;width:100%;height:100%;min-width:100%;min-height:100%;
|
|
4
4
|
/*
|
|
5
|
-
* \`--pie-white
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* the wrong colour.
|
|
5
|
+
* \`--pie-white\` inverts by design (#ffffff light, #000000 dark, redefined per
|
|
6
|
+
* colour scheme), so this backing matches the scheme wherever a provider's own
|
|
7
|
+
* surface is not opaque. A hardcoded white shows as a white plate behind a dark
|
|
8
|
+
* calculator.
|
|
10
9
|
*/background:var(--pie-white, white);overflow:hidden;}.pie-tool-calculator__mount {width:100%;height:100%;min-width:100%;min-height:100%;}
|
|
11
10
|
|
|
12
11
|
/* The credit sits below the calculator rather than over it, where it would
|
|
13
|
-
cover the vendor's own controls. */.pie-tool-calculator--attributed.svelte-16ps7c2 {flex-direction:column;}.pie-tool-calculator--attributed.svelte-16ps7c2 .pie-tool-calculator__container:where(.svelte-16ps7c2) {flex:1 1 auto;height:auto;min-height:0;}.pie-tool-calculator__attribution.svelte-16ps7c2 {align-self:flex-end;flex:0 0 auto;padding:0.1rem 0.25rem;color:var(--pie-text, #334155);font-size:0.65rem;}.pie-tool-calculator__loading.svelte-16ps7c2 {position:absolute;inset:0;z-index:2;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb, var(--pie-white, #fff) 90%, transparent);color:var(--pie-text, #334155);font-size:0.9rem;}.pie-tool-calculator__loading--error.svelte-16ps7c2 {flex-direction:column;gap:0.5rem;padding:0.75rem;color:var(--pie-incorrect, #b91c1c);text-align:center;}.pie-tool-calculator__error-details.svelte-16ps7c2 {max-width:95%;color:var(--pie-incorrect, #7f1d1d);font-size:0.8rem;line-height:1.2;word-break:break-word;}.pie-tool-calculator__mount > * {width:100% !important;height:100% !important;}`};function fi(t,e){
|
|
12
|
+
cover the vendor's own controls. */.pie-tool-calculator--attributed.svelte-16ps7c2 {flex-direction:column;}.pie-tool-calculator--attributed.svelte-16ps7c2 .pie-tool-calculator__container:where(.svelte-16ps7c2) {flex:1 1 auto;height:auto;min-height:0;}.pie-tool-calculator__attribution.svelte-16ps7c2 {align-self:flex-end;flex:0 0 auto;padding:0.1rem 0.25rem;color:var(--pie-text, #334155);font-size:0.65rem;}.pie-tool-calculator__loading.svelte-16ps7c2 {position:absolute;inset:0;z-index:2;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb, var(--pie-white, #fff) 90%, transparent);color:var(--pie-text, #334155);font-size:0.9rem;}.pie-tool-calculator__loading--error.svelte-16ps7c2 {flex-direction:column;gap:0.5rem;padding:0.75rem;color:var(--pie-incorrect, #b91c1c);text-align:center;}.pie-tool-calculator__error-details.svelte-16ps7c2 {max-width:95%;color:var(--pie-incorrect, #7f1d1d);font-size:0.8rem;line-height:1.2;word-break:break-word;}.pie-tool-calculator__mount > * {width:100% !important;height:100% !important;}`};function fi(t,e){qr(e,!0),oi(t,wl);let r=vt(e,"visible",7,!1),n=vt(e,"toolId",7,"calculator"),i=vt(e,"calculatorType",7,"basic"),s=vt(e,"availableTypes",23,()=>["basic","scientific","graphing"]),a=vt(e,"calculatorConfig",23,()=>({})),o=D(null),u=D(null),c=D(null),f=D(null),d=D(!1),w=D(null),v=D(!1);const m=Lt(()=>Ti(h(c))),M=Lt(()=>h(c)?.toolkitCoordinator),B=Lt(()=>Wi(n())?.baseToolId??n()),R=Lt(()=>(typeof s()=="string"?s().split(",").map(p=>p.trim()):s()).filter(p=>p==="basic"||p==="scientific"||p==="graphing")),L=Lt(()=>h(R).includes(i())?i():h(R)[0]??"basic"),G=Lt(()=>fl(a())),A=Lt(()=>h(f)?.provider.attribution??null);let Tt=null,Wt=null,yt=null,Ct=0,dr=!1,Ee=null;const Ae=new Set;Xe(()=>{if(h(o))return Si(h(o),p=>{x(c,p,!0)})});function Gr(){Ee?.disconnect(),Ee=null;for(const p of Ae)clearTimeout(p);Ae.clear()}function Pe(){Ct+=1,Gr();const p=h(f),W=yt;x(f,null),yt=null;try{p?.destroy()}catch(S){console.warn("[CalculatorTool] calculator cleanup failed:",S)}W?.remove(),Tt=null,Wt=null,x(d,!1),x(v,!1)}function Qr(){requestAnimationFrame(()=>{if(!r()||!h(f)||!yt?.isConnected)return;const p=document.activeElement;p instanceof Node&&yt.contains(p)||h(f).focus?.()})}function vi(p,W){Gr(),typeof ResizeObserver<"u"&&(Ee=new ResizeObserver(()=>{r()&&W.isConnected&&p.resize?.()}),Ee.observe(W));for(const S of[60,250,1e3]){const q=setTimeout(()=>{Ae.delete(q),r()&&W.isConnected&&p.resize?.()},S);Ae.add(q)}}async function di(p,W,S){const q=()=>p!==Ct||!r()||!S.isConnected;x(d,!0),x(w,null);try{if(!h(M))throw new Error("Calculator provider registry is unavailable");const $t=await h(M).ensureProviderReady(h(B)),pr=await $t.createInstance();if(q()){S.remove();return}const It=await pr.createCalculator(h(L),S,a());if(q()){It.destroy(),S.remove();return}x(f,It,!0),Tt=W,Wt=$t,x(v,S.childElementCount>0),vi(It,S),requestAnimationFrame(()=>{p===Ct&&(It.resize?.(),x(v,S.childElementCount>0),Qr())})}catch($t){if(p!==Ct){S.remove();return}x(w,$t instanceof Error?$t.message:String($t),!0),x(f,null),yt===S&&(yt=null),S.remove(),x(v,!1)}finally{p===Ct&&x(d,!1)}}function pi(){dr=!1;const p=h(u),W=h(M);if(!r()||!p||!p.isConnected||!W){(h(f)||h(d)||yt)&&Pe(),x(w,null);return}const S=`${h(B)}:${h(L)}:${h(G)}`;if(h(f)&&Tt===S&&Wt?.isReady()){Qr();return}(h(f)||h(d)||yt)&&Pe();const q=document.createElement("div");q.className="pie-tool-calculator__mount",p.replaceChildren(q),yt=q,di(++Ct,S,q)}function Xr(){dr||(dr=!0,queueMicrotask(pi))}async function gi(){const p=Wt,W=Ct,S=h(M);if(!p||!S)return;const q=await S.ensureProviderReady(h(B)).catch(()=>null);W!==Ct||p!==Wt||q!==p&&(Pe(),Xr())}Xe(()=>{const p=h(M);if(p)return p.onPolicyChange(()=>{queueMicrotask(()=>{gi()})})}),Xe(()=>{r(),h(B),h(L),a(),h(G),h(u),h(M),We(Xr)}),Ys(()=>()=>Pe());var wi={get visible(){return r()},set visible(p=!1){r(p),at()},get toolId(){return n()},set toolId(p="calculator"){n(p),at()},get calculatorType(){return i()},set calculatorType(p="basic"){i(p),at()},get availableTypes(){return s()},set availableTypes(p=["basic","scientific","graphing"]){s(p),at()},get calculatorConfig(){return a()},set calculatorConfig(p={}){a(p),at()}},je=gl(),mi=Qe(je),_i=p=>{var W=pl();let S;var q=Qe(W);gn(q,F=>x(u,F),()=>h(u));var $t=Le(q,2),pr=F=>{var Q=hl(),Rt=yr(Q,!0);qe(()=>{Yt(Q,"href",h(A).href),kr(Rt,h(A).label)}),ee(F,Q)};De($t,F=>{h(A)&&F(pr)});var It=Le($t,2),yi=F=>{var Q=vl(),Rt=yr(Q,!0);qe(ki=>kr(Rt,ki),[()=>h(m).t("tools.calculator.loading")]),ee(F,Q)};De(It,F=>{(h(d)||!h(w)&&!h(v))&&F(yi)});var $i=Le(It,2),bi=F=>{var Q=dl(),Rt=yr(Le(Qe(Q)),!0);Ge(Q),qe(()=>kr(Rt,h(w))),ee(F,Q)};De($i,F=>{h(w)&&F(bi)}),Ge(W),qe((F,Q,Rt)=>{S=el(W,1,"pie-tool-calculator notranslate svelte-16ps7c2",null,S,{"pie-tool-calculator--attributed":h(A)!==null}),Yt(W,"data-pie-tool-id",n()),Yt(W,"lang",F),Yt(W,"dir",Q),Yt(W,"aria-label",Rt),Yt(q,"data-calculator-type",h(L)),W.dir=W.dir},[()=>h(m).getLocale(),()=>h(m).getDirection?.()??"ltr",()=>h(m).t("tools.calculator.toolA11y")]),ee(p,W)};return De(mi,p=>{r()&&p(_i)}),Ge(je),gn(je,p=>x(o,p),()=>h(o)),ee(t,je),Fr(wi)}ci(fi,{visible:{},toolId:{},calculatorType:{},availableTypes:{},calculatorConfig:{}},[],[],{mode:"open"});var ml={tag:"pie-tool-calculator"},_l={hash:"svelte-1qpsqi4",code:".pie-tool-calculator__container .dcg-container {width:100% !important;height:100% !important;}"};function hi(t,e){qr(e,!0),oi(t,_l);let r=vt(e,"visible",7,!1),n=vt(e,"toolId",7,"calculator"),i=vt(e,"calculatorType",7,"basic"),s=vt(e,"availableTypes",23,()=>["basic","scientific","graphing"]),a=vt(e,"calculatorConfig",23,()=>({}));return fi(t,{get visible(){return r()},get toolId(){return n()},get calculatorType(){return i()},get availableTypes(){return s()},get calculatorConfig(){return a()}}),Fr({get visible(){return r()},set visible(o=!1){r(o),at()},get toolId(){return n()},set toolId(o="calculator"){n(o),at()},get calculatorType(){return i()},set calculatorType(o="basic"){i(o),at()},get availableTypes(){return s()},set availableTypes(o=["basic","scientific","graphing"]){s(o),at()},get calculatorConfig(){return a()},set calculatorConfig(o={}){a(o),at()}})}ci(hi,{visible:{attribute:"visible",type:"Boolean"},toolId:{attribute:"tool-id",type:"String"},calculatorType:{attribute:"calculator-type",type:"String"},availableTypes:{attribute:"available-types",type:"Array"},calculatorConfig:{type:"Object"}},[],[],void 0,Mi);var yl=hi.element;xi(ml.tag,yl);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as d,d as f}from"./tool-host-contract-
|
|
1
|
+
import{c as d,d as f}from"./tool-host-contract-fae1c415.js";import{t as p}from"./catalog-owner-d602f784.js";var a=1,T=11,m=new Set(["pie-item-toolbar","pie-section-toolbar","pie-item-player-session-debugger"]),h=["pie-tool-","pie-section-player-tools-"],E=new Set(["style","script","noscript","template"]),s=t=>!!t&&t.nodeType===T&&t.host?.nodeType===a,v=t=>{const e=t.localName?.toLowerCase()||"";return m.has(e)?!0:h.some(o=>e.startsWith(o))},N=t=>{const e=t.localName?.toLowerCase()||"";return E.has(e)||v(t)?!0:s(t.parentNode)&&t.getAttribute("aria-hidden")==="true"},S=t=>{if(!s(t.getRootNode?.()))return null;const e=t.assignedNodes;if(typeof e!="function")return null;try{return e.call(t,{flatten:!0})}catch{return null}},C=t=>{let e=t.childNodes;if(t.nodeType===a){const r=t,n=r.shadowRoot;n?e=n.childNodes:r.localName?.toLowerCase()==="slot"&&(e=S(r)??r.childNodes)}const o=[];for(const r of Array.from(e||[]))r.nodeType===a&&N(r)||o.push(r);return o},g=(t,e)=>{const o=r=>{for(const n of C(r)){const u=e(n);if(u==="stop")return!1;if(u!=="skip"&&!o(n))return!1}return!0};o(t)},R=(t,e)=>{let o=null;return g(t,r=>{if(r.nodeType===a&&r.matches(e))return o=r,"stop"}),o},i=t=>{if(t.parentElement)return t.parentElement;const e=t.parentNode;return s(e)?e.host:null},c=(t,e,o)=>{let r=t.nodeType===a?t:i(t);for(;r;){if(r.matches(e))return r;if(o&&r===o)return null;r=i(r)}return null},F=(t,e)=>{if(!t||!e)return!1;let o=e;for(;o;){if(o===t||t.contains(o))return!0;const r=o.getRootNode?.();o=s(r)?r.host:null}return!1},L=(t,e)=>{let o=t;for(;o;){const r=o.getRootNode?.();if(r===e)return o;o=s(r)?r.host:null}return null},l="[data-region='content']",y="[data-pie-shell-root]",A=(t,e)=>{if(e){const o=c(e,l,t);if(o)return o}return t.matches?.(l)?t:t.querySelector?.(l)??R(t,l)??t},k=t=>t?c(t,y):null,_="tts-start-failed";function D(t){return typeof t=="object"&&t!==null&&t.code===_}function x(t,e,o,r){if(typeof t?.reportToolFailure=="function"){t.reportToolFailure(e,o,r);return}console.error(`[${e}] ${o} failed:`,r)}var w=(t,e)=>p({kind:t.kind,assessmentId:e?.assessmentId,sectionId:e?.sectionId,itemId:t.itemId,canonicalItemId:t.canonicalItemId||t.itemId}),H=(t,e)=>{const o=t.nodeType===1?t:i(t),r=o?f(o,d):void 0;return r?w(r,e):void 0};export{k as a,F as c,L as d,D as i,i as l,H as n,A as o,x as r,c as s,w as t,s as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function i(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function r(e,t
|
|
1
|
+
function i(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function r(e,t,n){i(e,t),t.set(e,n)}function a(e,t,n){if(typeof e=="function"?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function s(e,t,n){return e.set(a(e,t),n),n}function o(e,t){return e.get(a(e,t))}export{i as a,r as i,s as n,a as r,o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./classPrivateFieldGet2-338e0179.js";function i(t,a){e(t,a),a.add(t)}export{i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]),d=/^[a-z][a-z0-9._-]*-[a-z0-9._-]*$/,i={delivery:"",author:"-config",print:"-print"},u=(e,r="custom element tag")=>{if(!e||typeof e!="string")throw new Error(`Invalid ${r}: expected a non-empty string`);const t=e.trim();if(!t)throw new Error(`Invalid ${r}: tag is empty`);if(t!==t.toLowerCase())throw new Error(`Invalid ${r} "${t}": custom element names must be lowercase`);if(!t.includes("-"))throw new Error(`Invalid ${r} "${t}": custom element names must include a hyphen`);if(s.has(t))throw new Error(`Invalid ${r} "${t}": this name is reserved by the HTML spec`);if(!d.test(t))throw new Error(`Invalid ${r} "${t}": allowed characters are lowercase letters, numbers, ".", "_" and "-"`);return t},f=(e,r,t)=>`${e}${t??(i[r]!==void 0?i[r]:"")}`,c=e=>typeof DOMException<"u"&&e instanceof DOMException?e.name==="NotSupportedError"||e.code===DOMException.NOT_SUPPORTED_ERR:(typeof e=="object"&&e!==null&&"name"in e?String(e.name):"")==="NotSupportedError",l=(e,r,t="custom element tag",n={})=>{const a=u(e,t);if(customElements.get(a))return{outcome:"already-defined",tagName:a};try{return customElements.define(a,r),{outcome:"defined",tagName:a}}catch(o){if(!c(o))return{outcome:"error",tagName:a,error:o};if(customElements.get(a))return{outcome:"already-defined",tagName:a};if(!n.allowWrappedFallback)return{outcome:"error",tagName:a,error:o};try{return customElements.define(a,class extends r{}),{outcome:"defined-wrapped",tagName:a}}catch(m){return{outcome:"wrapped-error",tagName:a,error:m}}}},p=(e,r,t="custom element tag")=>{const n=l(e,r,t);if(n.outcome==="error"||n.outcome==="wrapped-error")throw n.error;return{status:n.outcome==="already-defined"?"already-defined":"defined",tagName:n.tagName}};export{f as n,u as r,p as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as f}from"./rolldown-runtime-1287ba31.js";import{t as c}from"./defineProperty-a20a667d.js";import{t as S}from"./preload-helper-6ad28da3.js";var u=class extends Error{constructor(e,r,t={}){var i=(...a)=>(super(...a),c(this,"code",void 0),c(this,"recoverable",void 0),this);i(r,t.cause===void 0?void 0:{cause:t.cause}),this.name="CortexCalculatorError",this.code=e,this.recoverable=t.recoverable??!0}};function F(e,r,t){return e instanceof u?e:new u(r,t,{cause:e,recoverable:r!=="worker-unavailable"})}var k={basicCalculator:"Basic calculator",scientificCalculator:"Scientific calculator",graphingCalculator:"Graphing calculator",expressionLabel:"{calculator} expression",angleMode:"Angle mode",degrees:"Degrees",radians:"Radians",calculate:"Calculate",calculating:"Calculating",backspace:"Backspace",clear:"Clear",result:"Result: {result}",calculationHistory:"Calculation history",clearHistory:"Clear history",virtualKeyboardBasic:"Basic",virtualKeyboardScientific:"Scientific",virtualKeyboardGraphing:"Graphing",keypad:"Keypad",keypadLayer:"Keypad layer",angleModeDegreesShort:"DEG",angleModeRadiansShort:"RAD",angleModeChanged:"Angle mode {mode}. Previous result cleared.",inserted:"{key}",keySine:"sin, sine",keyCosine:"cos, cosine",keyTangent:"tan, tangent",keyInverseSine:"sin, inverse sine",keyInverseCosine:"cos, inverse cosine",keyInverseTangent:"tan, inverse tangent",keyNaturalLog:"ln, natural logarithm",keyCommonLog:"log, common logarithm",keyLogBaseN:"Logarithm with a chosen base",keyFraction:"Fraction",keySquareRoot:"Square root",keyNthRoot:"Nth root",keyPower:"To the power of",keySquared:"Squared",keyCubed:"Cubed",keyExponential:"e to the power of",keyAbsoluteValue:"Absolute value",keyFactorial:"Factorial",keyPi:"Pi",keyEuler:"e, Euler's number",keyPercent:"Percent",keyOpenParenthesis:"Open parenthesis",keyCloseParenthesis:"Close parenthesis",keyDecimalSeparator:"Decimal separator",keyDigit:"{digit}",keyAdd:"Plus",keySubtract:"Minus",keyMultiply:"Times",keyDivide:"Divided by",keyVariableX:"x, variable x",graphExpressions:"Graph expressions",graphExpressionLabel:"Graph expression {index}, {lineStyle} line",seriesDescription:"Series {index}: {lineStyle} line",showExpression:"Show expression {index}",hideExpression:"Hide expression {index}",show:"Show",hide:"Hide",removeExpression:"Remove expression {index}",remove:"Remove",addExpression:"Add expression",graph:"Graph",viewportControls:"Graph view",zoomIn:"Zoom in",zoomOut:"Zoom out",panLeft:"Pan left",panRight:"Pan right",panUp:"Pan up",panDown:"Pan down",resetView:"Reset view",updatingGraph:"Updating graph",graphSummary:"Graph summary",viewportSummary:"Viewport x from {xMin} to {xMax}, y from {yMin} to {yMax}.",seriesSummary:"Series {index}, {lineStyle}: {expression}",keyboardGraphTrace:"Keyboard graph trace",keyboardTrace:"Keyboard trace",series:"Series",seriesOption:"Series {index}",previousPoint:"Previous point",nextPoint:"Next point",tracePoint:"x {x}, y {y}",noSampledPoint:"No sampled graph point is available.",lineStyleSolid:"solid",lineStyleDashed:"dashed",lineStyleDotted:"dotted",errorInvalidExpression:"Check the expression and try again.",errorUnsupportedExpression:"This expression is not available in this calculator.",errorExpressionTooComplex:"Simplify the expression and try again.",errorEvaluationTimeout:"The calculation took too long and was stopped.",errorInvalidState:"The saved calculator state could not be restored.",errorWorkerUnavailable:"The calculator is temporarily unavailable."},v={basicCalculator:"Eenvoudige rekenmachine",scientificCalculator:"Wetenschappelijke rekenmachine",graphingCalculator:"Grafische rekenmachine",expressionLabel:"Uitdrukking voor {calculator}",angleMode:"Hoekeenheid",degrees:"Graden",radians:"Radialen",calculate:"Bereken",calculating:"Bezig met berekenen",backspace:"Wis teken",clear:"Wissen",result:"Resultaat: {result}",calculationHistory:"Berekeningsgeschiedenis",clearHistory:"Geschiedenis wissen",virtualKeyboardBasic:"Eenvoudig",virtualKeyboardScientific:"Wetenschappelijk",virtualKeyboardGraphing:"Grafisch",keypad:"Toetsenblok",keypadLayer:"Laag van het toetsenblok",angleModeDegreesShort:"GR",angleModeRadiansShort:"RAD",angleModeChanged:"Hoekeenheid {mode}. Vorig resultaat gewist.",inserted:"{key}",keySine:"sin, sinus",keyCosine:"cos, cosinus",keyTangent:"tan, tangens",keyInverseSine:"sin, arcsinus",keyInverseCosine:"cos, arccosinus",keyInverseTangent:"tan, arctangens",keyNaturalLog:"ln, natuurlijke logaritme",keyCommonLog:"log, logaritme met grondtal tien",keyLogBaseN:"Logaritme met gekozen grondtal",keyFraction:"Breuk",keySquareRoot:"Vierkantswortel",keyNthRoot:"N-de wortel",keyPower:"Tot de macht",keySquared:"Kwadraat",keyCubed:"Derde macht",keyExponential:"e tot de macht",keyAbsoluteValue:"Absolute waarde",keyFactorial:"Faculteit",keyPi:"Pi",keyEuler:"e, getal van Euler",keyPercent:"Procent",keyOpenParenthesis:"Haakje openen",keyCloseParenthesis:"Haakje sluiten",keyDecimalSeparator:"Decimaalteken",keyDigit:"{digit}",keyAdd:"Plus",keySubtract:"Min",keyMultiply:"Maal",keyDivide:"Gedeeld door",keyVariableX:"x, variabele x",graphExpressions:"Grafiekuitdrukkingen",graphExpressionLabel:"Grafiekuitdrukking {index}, {lineStyle} lijn",seriesDescription:"Reeks {index}: {lineStyle} lijn",showExpression:"Uitdrukking {index} tonen",hideExpression:"Uitdrukking {index} verbergen",show:"Tonen",hide:"Verbergen",removeExpression:"Uitdrukking {index} verwijderen",remove:"Verwijderen",addExpression:"Uitdrukking toevoegen",graph:"Grafiek",viewportControls:"Grafiekweergave",zoomIn:"Inzoomen",zoomOut:"Uitzoomen",panLeft:"Naar links verschuiven",panRight:"Naar rechts verschuiven",panUp:"Naar boven verschuiven",panDown:"Naar beneden verschuiven",resetView:"Weergave herstellen",updatingGraph:"Grafiek wordt bijgewerkt",graphSummary:"Samenvatting van de grafiek",viewportSummary:"Weergave x van {xMin} tot {xMax}, y van {yMin} tot {yMax}.",seriesSummary:"Reeks {index}, {lineStyle}: {expression}",keyboardGraphTrace:"Grafiek volgen met het toetsenbord",keyboardTrace:"Volgen met het toetsenbord",series:"Reeks",seriesOption:"Reeks {index}",previousPoint:"Vorig punt",nextPoint:"Volgend punt",tracePoint:"x {x}, y {y}",noSampledPoint:"Er is geen bemonsterd grafiekpunt beschikbaar.",lineStyleSolid:"ononderbroken",lineStyleDashed:"gestreepte",lineStyleDotted:"gestippelde",errorInvalidExpression:"Controleer de uitdrukking en probeer het opnieuw.",errorUnsupportedExpression:"Deze uitdrukking is niet beschikbaar in deze rekenmachine.",errorExpressionTooComplex:"Vereenvoudig de uitdrukking en probeer het opnieuw.",errorEvaluationTimeout:"De berekening duurde te lang en is gestopt.",errorInvalidState:"De opgeslagen rekenmachinestatus kon niet worden hersteld.",errorWorkerUnavailable:"De rekenmachine is tijdelijk niet beschikbaar."},C={"invalid-expression":"errorInvalidExpression","unsupported-expression":"errorUnsupportedExpression","expression-too-complex":"errorExpressionTooComplex","evaluation-timeout":"errorEvaluationTimeout","invalid-state":"errorInvalidState","worker-unavailable":"errorWorkerUnavailable"},M={solid:"lineStyleSolid",dashed:"lineStyleDashed",dotted:"lineStyleDotted"},E=new Set(["ar","ckb","dv","fa","he","iw","ks","ku","nqo","ps","sd","syr","ug","ur","yi"]);function b(e){try{return new Intl.Locale(e.replaceAll("_","-")).language.toLowerCase()}catch{return e.replaceAll("_","-").split("-")[0]?.toLowerCase()??"en"}}function P(e){try{return new Intl.NumberFormat(e).format(1.1).includes(",")?",":"."}catch{return"."}}function x(e){try{const r=new Intl.Locale(e.replaceAll("_","-")).textInfo;if(r?.direction==="rtl"||r?.direction==="ltr")return r.direction}catch{}return E.has(b(e))?"rtl":"ltr"}function T(e){return b(e)==="nl"?v:k}function D(e,r){return e.replace(/\{([a-zA-Z][a-zA-Z0-9]*)\}/g,(t,i)=>Object.hasOwn(r,i)?String(r[i]):t)}function G(e,r={},t="auto"){const i=Object.freeze({...T(e),...r}),a=t==="auto"?x(e):t,o=P(e);let l=null,p=0;const d=(n,h={})=>D(i[n],h);return Object.freeze({locale:e,direction:a,messages:i,t:d,formatNumber(n,h=6){try{return(!l||p!==h)&&(p=h,l=new Intl.NumberFormat(e,{maximumSignificantDigits:h,useGrouping:!1})),l.format(n)}catch{return n.toPrecision(h)}},formatResult(n){return o==="."?n:n.replace(".",o)},errorMessage(n){return d(C[n])},lineStyle(n){return d(M[n])}})}var w=k,L=v,H=1024,A={xMin:-10,xMax:10,yMin:-10,yMax:10},j=["square-root"],m=["square-root","power","root","exponential","natural-log","common-log","log-base-n","sine","cosine","tangent","inverse-sine","inverse-cosine","inverse-tangent","absolute-value","factorial"];function s(e){throw new u("invalid-state",e)}function y(e,r,t,i,a){return e===void 0?r:((!Number.isInteger(e)||e<t||e>i)&&s(`${a} must be an integer from ${t} to ${i}.`),e)}function z(e){if(e===void 0)return{...A};(!e||typeof e!="object")&&s("Graph viewport must be an object.");const r=e;return[r.xMin,r.xMax,r.yMin,r.yMax].every(t=>typeof t=="number"&&Number.isFinite(t))||s("Graph viewport bounds must be finite numbers."),(r.xMin>=r.xMax||r.yMin>=r.yMax)&&s("Graph viewport minimums must be less than maximums."),r}function I(e,r){const t=e==="basic"?j:m;if(r===void 0)return new Set(t);(!Array.isArray(r)||!r.every(o=>typeof o=="string"))&&s("allowedFunctions must be an array of function identifiers.");const i=new Set(m);for(const o of r)i.has(o)||s(`Unknown calculator function: ${o}.`);const a=new Set(r);return new Set(t.filter(o=>a.has(o)))}function g(e,r,t){return e===void 0?r:(typeof e!="boolean"&&s(`${t} must be a boolean.`),e)}function R(e){if(e===void 0)return{};(!e||typeof e!="object"||Array.isArray(e))&&s("messages must be an object.");const r={};for(const[t,i]of Object.entries(e))Object.hasOwn(w,t)&&(typeof i!="string"&&s(`messages.${t} must be a string.`),r[t]=i);return r}function N(e,r={}){const t=r.settings??{},i=t.angleMode??"degree";i!=="degree"&&i!=="radian"&&s('angleMode must be "degree" or "radian".');const a=t.graph;a!==void 0&&(!a||typeof a!="object")&&s("graph settings must be an object.");const o=r.restrictedMode===!0,l=typeof r.locale=="string"&&r.locale.trim()?r.locale.trim():"en-US",p=r.theme??"auto";p!=="light"&&p!=="dark"&&p!=="auto"&&s('theme must be "light", "dark", or "auto".');const d=t.direction??"auto";d!=="ltr"&&d!=="rtl"&&d!=="auto"&&s('direction must be "ltr", "rtl", or "auto".');const n=G(l,R(t.messages),d);return Object.freeze({type:e,angleMode:i,calculationPrecision:y(t.calculationPrecision,15,1,21,"calculationPrecision"),displayPrecision:y(t.displayPrecision,10,1,12,"displayPrecision"),historyLimit:y(t.historyLimit,20,0,50,"historyLimit"),evaluationTimeLimitMs:y(t.evaluationTimeLimitMs,1e3,100,2e3,"evaluationTimeLimitMs"),allowedFunctions:I(e,t.allowedFunctions),allowClipboard:!o&&g(t.allowClipboard,!0,"allowClipboard"),restrictedMode:o,locale:l,theme:p,localization:n,graph:Object.freeze({viewport:z(a?.viewport),showAxes:g(a?.showAxes,!0,"graph.showAxes"),showGrid:g(a?.showGrid,!0,"graph.showGrid")})})}var B=f({CortexCalculatorError:()=>u,CortexCalculatorProvider:()=>O,cortexDutchMessages:()=>L,cortexEnglishMessages:()=>w,localeDirection:()=>x}),O=class{constructor(e={}){c(this,"providerId","cortex"),c(this,"providerName","PIE Open-Source Calculator"),c(this,"supportedTypes",["basic","scientific","graphing"]),c(this,"version","1"),c(this,"initialized",!1),c(this,"destroyed",!1),c(this,"instances",new Set),c(this,"onTelemetry",void 0),this.onTelemetry=e.onTelemetry}async initialize(e={}){if(!this.initialized){if(this.destroyed)throw new u("worker-unavailable","This calculator provider has been destroyed.",{recoverable:!1});if(typeof window>"u"||typeof document>"u")throw new u("worker-unavailable","Cortex calculators can only be initialized in a browser.",{recoverable:!1});if(typeof Worker>"u")throw new u("worker-unavailable","This browser does not support module workers.",{recoverable:!1});this.onTelemetry=e.onTelemetry??this.onTelemetry,this.initialized=!0}}async createCalculator(e,r,t={}){if(this.initialized||await this.initialize(),!this.supportsType(e))throw new u("unsupported-expression",`Cortex does not support calculator type: ${e}.`);if(!(r instanceof HTMLElement))throw new u("invalid-state","A valid HTML container is required.");const i=N(e,t),{createCortexCalculator:a}=await S(async()=>{const{createCortexCalculator:l}=await import("./runtime-wcU7KOFU-ac86d7b8.js");return{createCortexCalculator:l}},[],import.meta.url),o=a(this,r,i,this.onTelemetry,l=>this.instances.delete(l));return this.instances.add(o),o}supportsType(e){return this.supportedTypes.includes(e)}destroy(){if(!this.destroyed){this.destroyed=!0;for(const e of[...this.instances])e.destroy();this.instances.clear(),this.initialized=!1,this.onTelemetry=void 0}}getCapabilities(){return{supportsHistory:!0,supportsGraphing:!0,supportsExpressions:!0,canExport:!0,maxPrecision:21,inputMethods:["keyboard","mouse","touch"]}}};export{u as CortexCalculatorError,O as CortexCalculatorProvider,L as cortexDutchMessages,w as cortexEnglishMessages,P as i,x as localeDirection,F as n,H as r,B as t};
|
|
1
|
+
import{n as f}from"./rolldown-runtime-1287ba31.js";import{t as c}from"./defineProperty-a20a667d.js";import{t as S}from"./preload-helper-6ad28da3.js";var u=class extends Error{constructor(e,r,t={}){var i=(...a)=>(super(...a),c(this,"code",void 0),c(this,"recoverable",void 0),this);i(r,t.cause===void 0?void 0:{cause:t.cause}),this.name="CortexCalculatorError",this.code=e,this.recoverable=t.recoverable??!0}};function F(e,r,t){return e instanceof u?e:new u(r,t,{cause:e,recoverable:r!=="worker-unavailable"})}var k={basicCalculator:"Basic calculator",scientificCalculator:"Scientific calculator",graphingCalculator:"Graphing calculator",expressionLabel:"{calculator} expression",angleMode:"Angle mode",degrees:"Degrees",radians:"Radians",calculate:"Calculate",calculating:"Calculating",backspace:"Backspace",clear:"Clear",result:"Result: {result}",calculationHistory:"Calculation history",clearHistory:"Clear history",virtualKeyboardBasic:"Basic",virtualKeyboardScientific:"Scientific",virtualKeyboardGraphing:"Graphing",keypad:"Keypad",keypadLayer:"Keypad layer",angleModeDegreesShort:"DEG",angleModeRadiansShort:"RAD",angleModeChanged:"Angle mode {mode}. Previous result cleared.",inserted:"{key}",keySine:"sin, sine",keyCosine:"cos, cosine",keyTangent:"tan, tangent",keyInverseSine:"sin, inverse sine",keyInverseCosine:"cos, inverse cosine",keyInverseTangent:"tan, inverse tangent",keyNaturalLog:"ln, natural logarithm",keyCommonLog:"log, common logarithm",keyLogBaseN:"Logarithm with a chosen base",keyFraction:"Fraction",keySquareRoot:"Square root",keyNthRoot:"Nth root",keyPower:"To the power of",keySquared:"Squared",keyCubed:"Cubed",keyExponential:"e to the power of",keyAbsoluteValue:"Absolute value",keyFactorial:"Factorial",keyPi:"Pi",keyEuler:"e, Euler's number",keyPercent:"Percent",keyOpenParenthesis:"Open parenthesis",keyCloseParenthesis:"Close parenthesis",keyDecimalSeparator:"Decimal separator",keyDigit:"{digit}",keyAdd:"Plus",keySubtract:"Minus",keyMultiply:"Times",keyDivide:"Divided by",keyVariableX:"x, variable x",graphExpressions:"Graph expressions",graphExpressionLabel:"Graph expression {index}, {lineStyle} line",seriesDescription:"Series {index}: {lineStyle} line",showExpression:"Show expression {index}",hideExpression:"Hide expression {index}",show:"Show",hide:"Hide",removeExpression:"Remove expression {index}",remove:"Remove",addExpression:"Add expression",graph:"Graph",viewportControls:"Graph view",zoomIn:"Zoom in",zoomOut:"Zoom out",panLeft:"Pan left",panRight:"Pan right",panUp:"Pan up",panDown:"Pan down",resetView:"Reset view",updatingGraph:"Updating graph",graphSummary:"Graph summary",viewportSummary:"Viewport x from {xMin} to {xMax}, y from {yMin} to {yMax}.",seriesSummary:"Series {index}, {lineStyle}: {expression}",keyboardGraphTrace:"Keyboard graph trace",keyboardTrace:"Keyboard trace",series:"Series",seriesOption:"Series {index}",previousPoint:"Previous point",nextPoint:"Next point",tracePoint:"x {x}, y {y}",noSampledPoint:"No sampled graph point is available.",lineStyleSolid:"solid",lineStyleDashed:"dashed",lineStyleDotted:"dotted",errorInvalidExpression:"Check the expression and try again.",errorUnsupportedExpression:"This expression is not available in this calculator.",errorExpressionTooComplex:"Simplify the expression and try again.",errorEvaluationTimeout:"The calculation took too long and was stopped.",errorInvalidState:"The saved calculator state could not be restored.",errorWorkerUnavailable:"The calculator is temporarily unavailable."},v={basicCalculator:"Eenvoudige rekenmachine",scientificCalculator:"Wetenschappelijke rekenmachine",graphingCalculator:"Grafische rekenmachine",expressionLabel:"Uitdrukking voor {calculator}",angleMode:"Hoekeenheid",degrees:"Graden",radians:"Radialen",calculate:"Bereken",calculating:"Bezig met berekenen",backspace:"Wis teken",clear:"Wissen",result:"Resultaat: {result}",calculationHistory:"Berekeningsgeschiedenis",clearHistory:"Geschiedenis wissen",virtualKeyboardBasic:"Eenvoudig",virtualKeyboardScientific:"Wetenschappelijk",virtualKeyboardGraphing:"Grafisch",keypad:"Toetsenblok",keypadLayer:"Laag van het toetsenblok",angleModeDegreesShort:"GR",angleModeRadiansShort:"RAD",angleModeChanged:"Hoekeenheid {mode}. Vorig resultaat gewist.",inserted:"{key}",keySine:"sin, sinus",keyCosine:"cos, cosinus",keyTangent:"tan, tangens",keyInverseSine:"sin, arcsinus",keyInverseCosine:"cos, arccosinus",keyInverseTangent:"tan, arctangens",keyNaturalLog:"ln, natuurlijke logaritme",keyCommonLog:"log, logaritme met grondtal tien",keyLogBaseN:"Logaritme met gekozen grondtal",keyFraction:"Breuk",keySquareRoot:"Vierkantswortel",keyNthRoot:"N-de wortel",keyPower:"Tot de macht",keySquared:"Kwadraat",keyCubed:"Derde macht",keyExponential:"e tot de macht",keyAbsoluteValue:"Absolute waarde",keyFactorial:"Faculteit",keyPi:"Pi",keyEuler:"e, getal van Euler",keyPercent:"Procent",keyOpenParenthesis:"Haakje openen",keyCloseParenthesis:"Haakje sluiten",keyDecimalSeparator:"Decimaalteken",keyDigit:"{digit}",keyAdd:"Plus",keySubtract:"Min",keyMultiply:"Maal",keyDivide:"Gedeeld door",keyVariableX:"x, variabele x",graphExpressions:"Grafiekuitdrukkingen",graphExpressionLabel:"Grafiekuitdrukking {index}, {lineStyle} lijn",seriesDescription:"Reeks {index}: {lineStyle} lijn",showExpression:"Uitdrukking {index} tonen",hideExpression:"Uitdrukking {index} verbergen",show:"Tonen",hide:"Verbergen",removeExpression:"Uitdrukking {index} verwijderen",remove:"Verwijderen",addExpression:"Uitdrukking toevoegen",graph:"Grafiek",viewportControls:"Grafiekweergave",zoomIn:"Inzoomen",zoomOut:"Uitzoomen",panLeft:"Naar links verschuiven",panRight:"Naar rechts verschuiven",panUp:"Naar boven verschuiven",panDown:"Naar beneden verschuiven",resetView:"Weergave herstellen",updatingGraph:"Grafiek wordt bijgewerkt",graphSummary:"Samenvatting van de grafiek",viewportSummary:"Weergave x van {xMin} tot {xMax}, y van {yMin} tot {yMax}.",seriesSummary:"Reeks {index}, {lineStyle}: {expression}",keyboardGraphTrace:"Grafiek volgen met het toetsenbord",keyboardTrace:"Volgen met het toetsenbord",series:"Reeks",seriesOption:"Reeks {index}",previousPoint:"Vorig punt",nextPoint:"Volgend punt",tracePoint:"x {x}, y {y}",noSampledPoint:"Er is geen bemonsterd grafiekpunt beschikbaar.",lineStyleSolid:"ononderbroken",lineStyleDashed:"gestreepte",lineStyleDotted:"gestippelde",errorInvalidExpression:"Controleer de uitdrukking en probeer het opnieuw.",errorUnsupportedExpression:"Deze uitdrukking is niet beschikbaar in deze rekenmachine.",errorExpressionTooComplex:"Vereenvoudig de uitdrukking en probeer het opnieuw.",errorEvaluationTimeout:"De berekening duurde te lang en is gestopt.",errorInvalidState:"De opgeslagen rekenmachinestatus kon niet worden hersteld.",errorWorkerUnavailable:"De rekenmachine is tijdelijk niet beschikbaar."},C={"invalid-expression":"errorInvalidExpression","unsupported-expression":"errorUnsupportedExpression","expression-too-complex":"errorExpressionTooComplex","evaluation-timeout":"errorEvaluationTimeout","invalid-state":"errorInvalidState","worker-unavailable":"errorWorkerUnavailable"},M={solid:"lineStyleSolid",dashed:"lineStyleDashed",dotted:"lineStyleDotted"},E=new Set(["ar","ckb","dv","fa","he","iw","ks","ku","nqo","ps","sd","syr","ug","ur","yi"]);function b(e){try{return new Intl.Locale(e.replaceAll("_","-")).language.toLowerCase()}catch{return e.replaceAll("_","-").split("-")[0]?.toLowerCase()??"en"}}function P(e){try{return new Intl.NumberFormat(e).format(1.1).includes(",")?",":"."}catch{return"."}}function x(e){try{const r=new Intl.Locale(e.replaceAll("_","-")).textInfo;if(r?.direction==="rtl"||r?.direction==="ltr")return r.direction}catch{}return E.has(b(e))?"rtl":"ltr"}function T(e){return b(e)==="nl"?v:k}function D(e,r){return e.replace(/\{([a-zA-Z][a-zA-Z0-9]*)\}/g,(t,i)=>Object.hasOwn(r,i)?String(r[i]):t)}function G(e,r={},t="auto"){const i=Object.freeze({...T(e),...r}),a=t==="auto"?x(e):t,o=P(e);let l=null,p=0;const d=(n,h={})=>D(i[n],h);return Object.freeze({locale:e,direction:a,messages:i,t:d,formatNumber(n,h=6){try{return(!l||p!==h)&&(p=h,l=new Intl.NumberFormat(e,{maximumSignificantDigits:h,useGrouping:!1})),l.format(n)}catch{return n.toPrecision(h)}},formatResult(n){return o==="."?n:n.replace(".",o)},errorMessage(n){return d(C[n])},lineStyle(n){return d(M[n])}})}var w=k,L=v,H=1024,A={xMin:-10,xMax:10,yMin:-10,yMax:10},j=["square-root"],m=["square-root","power","root","exponential","natural-log","common-log","log-base-n","sine","cosine","tangent","inverse-sine","inverse-cosine","inverse-tangent","absolute-value","factorial"];function s(e){throw new u("invalid-state",e)}function y(e,r,t,i,a){return e===void 0?r:((!Number.isInteger(e)||e<t||e>i)&&s(`${a} must be an integer from ${t} to ${i}.`),e)}function z(e){if(e===void 0)return{...A};(!e||typeof e!="object")&&s("Graph viewport must be an object.");const r=e;return[r.xMin,r.xMax,r.yMin,r.yMax].every(t=>typeof t=="number"&&Number.isFinite(t))||s("Graph viewport bounds must be finite numbers."),(r.xMin>=r.xMax||r.yMin>=r.yMax)&&s("Graph viewport minimums must be less than maximums."),r}function I(e,r){const t=e==="basic"?j:m;if(r===void 0)return new Set(t);(!Array.isArray(r)||!r.every(o=>typeof o=="string"))&&s("allowedFunctions must be an array of function identifiers.");const i=new Set(m);for(const o of r)i.has(o)||s(`Unknown calculator function: ${o}.`);const a=new Set(r);return new Set(t.filter(o=>a.has(o)))}function g(e,r,t){return e===void 0?r:(typeof e!="boolean"&&s(`${t} must be a boolean.`),e)}function R(e){if(e===void 0)return{};(!e||typeof e!="object"||Array.isArray(e))&&s("messages must be an object.");const r={};for(const[t,i]of Object.entries(e))Object.hasOwn(w,t)&&(typeof i!="string"&&s(`messages.${t} must be a string.`),r[t]=i);return r}function N(e,r={}){const t=r.settings??{},i=t.angleMode??"degree";i!=="degree"&&i!=="radian"&&s('angleMode must be "degree" or "radian".');const a=t.graph;a!==void 0&&(!a||typeof a!="object")&&s("graph settings must be an object.");const o=r.restrictedMode===!0,l=typeof r.locale=="string"&&r.locale.trim()?r.locale.trim():"en-US",p=r.theme??"auto";p!=="light"&&p!=="dark"&&p!=="auto"&&s('theme must be "light", "dark", or "auto".');const d=t.direction??"auto";d!=="ltr"&&d!=="rtl"&&d!=="auto"&&s('direction must be "ltr", "rtl", or "auto".');const n=G(l,R(t.messages),d);return Object.freeze({type:e,angleMode:i,calculationPrecision:y(t.calculationPrecision,15,1,21,"calculationPrecision"),displayPrecision:y(t.displayPrecision,10,1,12,"displayPrecision"),historyLimit:y(t.historyLimit,20,0,50,"historyLimit"),evaluationTimeLimitMs:y(t.evaluationTimeLimitMs,1e3,100,2e3,"evaluationTimeLimitMs"),allowedFunctions:I(e,t.allowedFunctions),allowClipboard:!o&&g(t.allowClipboard,!0,"allowClipboard"),restrictedMode:o,locale:l,theme:p,localization:n,graph:Object.freeze({viewport:z(a?.viewport),showAxes:g(a?.showAxes,!0,"graph.showAxes"),showGrid:g(a?.showGrid,!0,"graph.showGrid")})})}var B=f({CortexCalculatorError:()=>u,CortexCalculatorProvider:()=>O,cortexDutchMessages:()=>L,cortexEnglishMessages:()=>w,localeDirection:()=>x}),O=class{constructor(e={}){c(this,"providerId","cortex"),c(this,"providerName","PIE Open-Source Calculator"),c(this,"supportedTypes",["basic","scientific","graphing"]),c(this,"version","1"),c(this,"initialized",!1),c(this,"destroyed",!1),c(this,"instances",new Set),c(this,"onTelemetry",void 0),this.onTelemetry=e.onTelemetry}async initialize(e={}){if(!this.initialized){if(this.destroyed)throw new u("worker-unavailable","This calculator provider has been destroyed.",{recoverable:!1});if(typeof window>"u"||typeof document>"u")throw new u("worker-unavailable","Cortex calculators can only be initialized in a browser.",{recoverable:!1});if(typeof Worker>"u")throw new u("worker-unavailable","This browser does not support module workers.",{recoverable:!1});this.onTelemetry=e.onTelemetry??this.onTelemetry,this.initialized=!0}}async createCalculator(e,r,t={}){if(this.initialized||await this.initialize(),!this.supportsType(e))throw new u("unsupported-expression",`Cortex does not support calculator type: ${e}.`);if(!(r instanceof HTMLElement))throw new u("invalid-state","A valid HTML container is required.");const i=N(e,t),{createCortexCalculator:a}=await S(async()=>{const{createCortexCalculator:l}=await import("./runtime-YFqnU6ic-d5c0cb49.js");return{createCortexCalculator:l}},[],import.meta.url),o=a(this,r,i,this.onTelemetry,l=>this.instances.delete(l));return this.instances.add(o),o}supportsType(e){return this.supportedTypes.includes(e)}destroy(){if(!this.destroyed){this.destroyed=!0;for(const e of[...this.instances])e.destroy();this.instances.clear(),this.initialized=!1,this.onTelemetry=void 0}}getCapabilities(){return{supportsHistory:!0,supportsGraphing:!0,supportsExpressions:!0,canExport:!0,maxPrecision:21,inputMethods:["keyboard","mouse","touch"]}}};export{u as CortexCalculatorError,O as CortexCalculatorProvider,L as cortexDutchMessages,w as cortexEnglishMessages,P as i,x as localeDirection,F as n,H as r,B as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as h}from"./defineProperty-a20a667d.js";import{r as B,t as W}from"./logger-8b07fb72.js";var A=e=>{const t=Number(e);return Number.isFinite(t)?t:null},E=e=>[...e].sort((t,r)=>t.time!==r.time?t.time-r.time:t.start!==r.start?t.start-r.start:t.end-r.end),N=e=>{const t=[];let r=0;for(const i of e.split(/\r?\n/)){const o=i.trim();if(o)try{const s=JSON.parse(o);if(s.type&&s.type!=="word")continue;const n=A(s.time);if(n===null)continue;const a=typeof s.value=="string"?s.value:"",d=A(s.start)??r,l=A(s.end)??d+Math.max(1,a.length);r=Math.max(l+1,r),t.push({time:n,type:"word",start:d,end:l,value:a})}catch{}}return E(t)},D=e=>{if(e.length<2)return e;const t=e.map(s=>s.time).filter(s=>s>=0),r=t.length?Math.max(...t):0,i=[];for(let s=1;s<t.length;s+=1){const n=t[s]-t[s-1];n>0&&Number.isFinite(n)&&i.push(n)}const o=i.length>0?[...i].sort((s,n)=>s-n)[Math.floor(i.length/2)]:0;return r>0&&r<100&&e.length>3||o>0&&o<10?e.map(s=>({...s,time:s.time*1e3})):e},_=(e,t)=>{if(!e.length||!t.length)return 0;const r=t.toLowerCase(),i=[];let o=0;for(const s of e){const n=s.value.trim().toLowerCase();if(!n)continue;const a=r.indexOf(n,o);if(a<0)continue;const d=s.start-a;if(d>=0&&i.push(d),o=a+n.length,i.length>=8)break}if(i.length>0){const s=[...i].sort((n,a)=>n-a);return s[Math.floor(s.length/2)]}return Math.max(0,Math.floor(e[0].start))},H=(e,t)=>{if(!e.length||!t.length)return e;const r=t.length;if(Math.max(...e.map(o=>o.end))<=r+2)return e;const i=_(e,t);return i<=0?e:e.map(o=>({...o,start:o.start-i,end:o.end-i}))},F=(e,t)=>{if(!t.length)return e;const r=t.length;return E(e.map(i=>{const o=Math.max(0,Math.min(r,Math.floor(i.start))),s=Math.max(o+1,Math.min(r,Math.floor(i.end)));return{...i,start:o,end:s}}))};function $(e,t){const r=N(e),i=D(r),o=H(i,t);return F(o,t)}function O(e,t="medium"){const r=Number(e??1);return Number.isFinite(r)?r<=.95?"slow":r>=1.5?"fast":t:t}var f=W("server-tts-provider",B),p="textToSpeech";function k(e,t){if(typeof e!="string"||e.length===0)return null;try{const r=typeof t.apiEndpoint=="string"&&/^https?:\/\//i.test(t.apiEndpoint)?t.apiEndpoint:void 0,i=r?new URL(e,r):new URL(e);return i.protocol!=="http:"&&i.protocol!=="https:"?null:i}catch{return null}}function L(e,t){const r=Array.isArray(t.assetOrigins)?t.assetOrigins.filter(i=>typeof i=="string"&&i.length>0).map(i=>{try{return new URL(i).origin}catch{return i}}):[];if(r.length===0){if(typeof t.apiEndpoint=="string"&&/^https?:\/\//i.test(t.apiEndpoint))try{return new URL(t.apiEndpoint).origin===e.origin}catch{return!1}return typeof window<"u"&&typeof window.location?.origin=="string"&&window.location.origin===e.origin}return r.includes(e.origin)}function x(e){const t={};for(const[r,i]of Object.entries(e)){const o=r.toLowerCase();o==="authorization"||o==="proxy-authorization"||o==="cookie"||o.startsWith("x-auth-")||(t[r]=i)}return t}function S(e,t=!0){return e.credentials?!t&&e.credentials==="include"?{}:{credentials:e.credentials}:{}}function U(e,t){const r={};if(!t.includeAuthOnAssetFetch)return r;for(const[i,o]of Object.entries(e))i.toLowerCase()==="authorization"&&(r[i]=o);return r}var z=e=>{const t=e.providerOptions?.__pieTelemetry;return typeof t=="function"?t:void 0},j={pie:3e3,custom:3e3},V=new Set(["polly","google"]),q=e=>{if(!e||M(e)!=="pie")return!1;const t=(e.provider||"polly").toLowerCase();return V.has(t)},R=e=>e.replace(/\/+$/,""),J=e=>{const t=R(e.apiEndpoint),r=(e.provider||"").toLowerCase();return r==="polly"||r==="google"?[`${t}/${r}/voices`,`${t}/voices`]:[`${t}/voices`]},M=e=>e.transportMode==="custom"?"custom":e.transportMode==="pie"?"pie":e.provider==="custom"?"custom":"pie",I=(e,t)=>e.endpointMode?e.endpointMode:t==="custom"?"rootPost":"synthesizePath",G=(e,t)=>e.endpointValidationMode?e.endpointValidationMode:t==="custom"?"none":"voices",K=e=>{const t=e.providerOptions?.speedRate;return typeof t=="string"?t:O(e.rate)},C=e=>{const t=e.providerOptions?.contentLanguage;return typeof t=="string"&&t.trim()?t.trim():void 0},X=e=>{if(!Array.isArray(e))return[];const t=[];let r=0;for(const i of e){if(!i||typeof i!="object")continue;const o=typeof i.type=="string"?i.type:"word",s=typeof i.time=="number"&&Number.isFinite(i.time)?i.time:0,n=typeof i.value=="string"?i.value:"",a=typeof i.start=="number"&&Number.isFinite(i.start)?i.start:null,d=typeof i.end=="number"&&Number.isFinite(i.end)?i.end:null,l=a??r,g=d??l+Math.max(1,n.length||1);r=Math.max(r,g+1),t.push({time:s,type:o,start:l,end:g,value:n})}return t.sort((i,o)=>i.time!==o.time?i.time-o.time:i.start!==o.start?i.start-o.start:i.end-o.end)},Y={pie:{id:"pie",resolveSynthesisUrl:e=>{const t=I(e,"pie"),r=R(e.apiEndpoint);return t==="rootPost"?r:`${r}/synthesize`},buildRequestBody:(e,t)=>{const r=t.providerOptions||{},i=typeof t.engine=="string"?t.engine:typeof r.engine=="string"?r.engine:void 0,o=typeof r.sampleRate=="number"&&Number.isFinite(r.sampleRate)?r.sampleRate:void 0,s=r.format==="mp3"||r.format==="ogg"||r.format==="pcm"?r.format:void 0,n=Array.isArray(r.speechMarkTypes)?r.speechMarkTypes.filter(a=>a==="word"||a==="sentence"||a==="ssml"):void 0;return{text:e,provider:t.provider||"polly",voice:t.voice,language:C(t)??t.language,rate:t.rate,engine:i,sampleRate:o,format:s,speechMarkTypes:n,includeSpeechMarks:!0}},parseResponse:async(e,t,r,i,o)=>{const s=await e.json();return{audio:{kind:"base64",data:s.audio,contentType:s.contentType},speechMarks:Array.isArray(s.speechMarks)?s.speechMarks:[]}}},custom:{id:"custom",resolveSynthesisUrl:e=>{const t=I(e,"custom"),r=R(e.apiEndpoint);return t==="synthesizePath"?`${r}/synthesize`:r},buildRequestBody:(e,t)=>{const r=t.providerOptions||{},i=(typeof r.lang_id=="string"&&r.lang_id.trim()?r.lang_id:void 0)??C(t)??(t.language||"en-US"),o=typeof r.cache=="boolean"?r.cache:!0;return{text:e,speedRate:K(t),lang_id:i,langId:i,cache:o}},parseResponse:async(e,t,r,i,o)=>{const s=await e.json(),n=U(r,t);let a=[];const d=X(s.speechMarks);if(d.length>0)a=d;else if(typeof s.word=="string"&&s.word.length>0){const g=k(s.word,t);if(g!==null){const y=L(g,t),c=y?n:x(n),u=await fetch(g.toString(),{headers:c,...S(t,y),signal:i,redirect:"error"});if(u.ok){const m=await u.text();a=$(m,o)}}}const l=k(s.audioContent,t);if(l===null)throw new Error("TTS server returned an invalid audio URL");return{audio:{kind:"url",url:l.toString()},speechMarks:a}}}},Q=class{constructor(e,t){h(this,"config",void 0),h(this,"adapter",void 0),h(this,"currentAudio",null),h(this,"pausedState",!1),h(this,"wordTimings",[]),h(this,"highlightInterval",null),h(this,"highlightCursor",-1),h(this,"intentionallyStopped",!1),h(this,"activeSynthesisController",null),h(this,"startCurrentAudio",null),h(this,"synthesisRunId",0),h(this,"telemetryReporter",void 0),h(this,"onPlaybackStart",void 0),h(this,"onWordBoundary",void 0),this.config=e,this.adapter=t,this.telemetryReporter=z(e)}async emitTelemetry(e,t){try{await this.telemetryReporter?.(e,t)}catch(r){f.warn("telemetry callback failed:",r)}}async speak(e){this.stop(),this.intentionallyStopped=!1;const t=++this.synthesisRunId,r=new AbortController;this.activeSynthesisController=r;let i;try{i=await this.synthesizeSpeech(e,r.signal,t)}catch(n){if(t!==this.synthesisRunId||r.signal.aborted)return;throw n}finally{this.activeSynthesisController===r&&(this.activeSynthesisController=null)}const{audioUrl:o,wordTimings:s}=i;if(t!==this.synthesisRunId){URL.revokeObjectURL(o);return}return this.wordTimings=s,this.highlightCursor=-1,new Promise((n,a)=>{const d=new Audio(o);this.currentAudio=d,this.config.volume!==void 0&&(d.volume=Math.max(0,Math.min(1,this.config.volume)));const l=()=>t!==this.synthesisRunId||this.currentAudio!==d;d.onplaying=()=>{if(!l()){this.pausedState=!1;try{this.onPlaybackStart?.()}catch(y){f.warn("playback-start callback failed:",y)}this.onWordBoundary&&this.wordTimings.length>0&&this.startWordHighlighting()}},d.onended=()=>{URL.revokeObjectURL(o),l()||this.clearCurrentAudio(),n()},d.onerror=()=>{if(URL.revokeObjectURL(o),l()||this.intentionallyStopped){n();return}this.clearCurrentAudio(),a(new Error("Failed to play audio from server"))},d.onpause=()=>{l()||(this.stopWordHighlighting(),this.pausedState=!0)};const g=()=>{d.play().catch(y=>{y?.name==="AbortError"&&this.pausedState&&this.currentAudio===d||a(y)})};this.startCurrentAudio=g,this.pausedState||g()})}async synthesizeSpeech(e,t,r){const i=Date.now();await this.emitTelemetry("pie-tool-backend-call-start",{toolId:p,backend:this.config.provider||"server",operation:"synthesize-speech"});const o={"Content-Type":"application/json",...this.config.headers};this.config.authToken&&(o.Authorization=`Bearer ${this.config.authToken}`);const s=this.adapter.resolveSynthesisUrl(this.config),n=this.adapter.buildRequestBody(e,this.config),a=await(async()=>{try{return await fetch(s,{method:"POST",headers:o,body:JSON.stringify(n),signal:t,...S(this.config)})}catch(c){throw t.aborted||await this.emitTelemetry("pie-tool-backend-call-error",{toolId:p,backend:this.config.provider||"server",operation:"synthesize-speech",duration:Date.now()-i,errorType:"TTSBackendNetworkError",message:c instanceof Error?c.message:String(c)}),c}})();if(!a.ok){const c=await a.text().catch(()=>"");let u={};if(c)try{u=JSON.parse(c)}catch(w){f.warn("non-OK response body was not JSON",{status:a.status,url:s,bodyLength:c.length,parseError:w instanceof Error?w.message:String(w)}),f.debug("non-OK response body",{rawBodyPreview:c.slice(0,500)})}const m=typeof u.message=="string"&&u.message||(typeof u.error?.message=="string"?u.error.message:void 0)||`Server returned ${a.status}`;await this.emitTelemetry("pie-tool-backend-call-error",{toolId:p,backend:this.config.provider||"server",operation:"synthesize-speech",duration:Date.now()-i,statusCode:a.status,errorType:"TTSBackendRequestError",message:m}),f.error("synthesize request failed",{status:a.status,url:s,backend:this.config.provider||"server",message:m,textLength:e.length});const v=e.replace(/\s+/g," ").trim().slice(0,120);throw f.debug("synthesize request failed for text",{responseBody:u,textPreview:v.length<e.length?`${v}…`:v}),new Error(m)}const d=await this.adapter.parseResponse(a,this.config,o,t,e);if(r!==this.synthesisRunId||t.aborted)throw new Error("Synthesis superseded by a newer request");let l;if(d.audio.kind==="base64")l=this.base64ToBlob(d.audio.data,d.audio.contentType);else{const c=d.audio.url,u=Date.now();await this.emitTelemetry("pie-tool-backend-call-start",{toolId:p,backend:this.config.provider||"server",operation:"fetch-synthesized-audio-asset"});const m=U(o,this.config),v=k(c,this.config);if(v===null)throw await this.emitTelemetry("pie-tool-backend-call-error",{toolId:p,backend:this.config.provider||"server",operation:"fetch-synthesized-audio-asset",duration:Date.now()-u,errorType:"TTSAssetInvalidUrl",message:"TTS asset URL rejected (non-http(s) or malformed)"}),new Error("TTS asset URL rejected (non-http(s) or malformed)");const w=L(v,this.config),P=w?m:x(m),b=await(async()=>{try{return await fetch(v.toString(),{headers:P,signal:t,...S(this.config,w),redirect:"error"})}catch(T){throw t.aborted||await this.emitTelemetry("pie-tool-backend-call-error",{toolId:p,backend:this.config.provider||"server",operation:"fetch-synthesized-audio-asset",duration:Date.now()-u,errorType:"TTSAssetNetworkError",message:T instanceof Error?T.message:String(T)}),T}})();if(!b.ok)throw await this.emitTelemetry("pie-tool-backend-call-error",{toolId:p,backend:this.config.provider||"server",operation:"fetch-synthesized-audio-asset",duration:Date.now()-u,statusCode:b.status,errorType:"TTSAssetFetchError",message:`Failed to download synthesized audio (${b.status})`}),new Error(`Failed to download synthesized audio (${b.status})`);l=await b.blob(),await this.emitTelemetry("pie-tool-backend-call-success",{toolId:p,backend:this.config.provider||"server",operation:"fetch-synthesized-audio-asset",duration:Date.now()-u})}const g=URL.createObjectURL(l),y=this.parseSpeechMarks(d.speechMarks);return await this.emitTelemetry("pie-tool-backend-call-success",{toolId:p,backend:this.config.provider||"server",operation:"synthesize-speech",duration:Date.now()-i}),{audioUrl:g,wordTimings:y}}base64ToBlob(e,t){const r=atob(e),i=new Array(r.length);for(let s=0;s<r.length;s++)i[s]=r.charCodeAt(s);const o=new Uint8Array(i);return new Blob([o],{type:t})}parseSpeechMarks(e){return e.filter(t=>t.type==="word").map((t,r)=>({time:t.time,wordIndex:r,charIndex:t.start,length:t.end-t.start,word:t.value}))}startWordHighlighting(){if(this.stopWordHighlighting(),!this.currentAudio||!this.onWordBoundary||this.wordTimings.length===0){f.debug("cannot start word highlighting",{hasAudio:!!this.currentAudio,hasCallback:!!this.onWordBoundary,wordTimingsCount:this.wordTimings.length});return}f.debug("starting word highlighting",{wordTimingsCount:this.wordTimings.length,playbackRate:this.currentAudio.playbackRate}),this.highlightInterval=window.setInterval(()=>{if(!this.currentAudio){this.stopWordHighlighting();return}const e=this.currentAudio.currentTime*1e3,t=this.resolveCurrentWordIndex(e,this.highlightCursor);if(t<0||t===this.highlightCursor)return;this.highlightCursor=t;const r=this.wordTimings[t];f.debug("word boundary",{wordIndex:r.wordIndex,charIndex:r.charIndex,length:r.length,timingMs:r.time,currentTimeMs:e}),this.onWordBoundary?.(r.word,r.charIndex,r.length)},50)}resolveCurrentWordIndex(e,t){const r=this.wordTimings;let i=t<r.length?t:-1;for(i>=0&&e<r[i].time&&(i=-1);i+1<r.length&&r[i+1].time<=e;)i++;return i}stopWordHighlighting(){this.highlightInterval!==null&&(clearInterval(this.highlightInterval),this.highlightInterval=null)}pause(){if(!this.pausedState){if(this.currentAudio)this.currentAudio.pause(),this.stopWordHighlighting();else if(!this.activeSynthesisController)return;this.pausedState=!0}}resume(){this.pausedState&&(this.pausedState=!1,this.currentAudio&&(this.startCurrentAudio?.(),this.onWordBoundary&&this.wordTimings.length>0&&this.startWordHighlighting()))}clearCurrentAudio(){this.stopWordHighlighting(),this.currentAudio=null,this.wordTimings=[],this.highlightCursor=-1}stop(){this.synthesisRunId+=1,this.startCurrentAudio=null,this.activeSynthesisController&&(this.activeSynthesisController.abort(),this.activeSynthesisController=null),this.stopWordHighlighting(),this.currentAudio&&(this.intentionallyStopped=!0,this.currentAudio.pause(),this.currentAudio.src&&URL.revokeObjectURL(this.currentAudio.src),this.currentAudio.src="",this.currentAudio=null),this.pausedState=!1,this.wordTimings=[],this.highlightCursor=-1}isPlaying(){return this.currentAudio!==null&&!this.pausedState}isPaused(){return this.pausedState}updateSettings(e){e.rate!==void 0&&(this.config.rate=e.rate,this.config.providerOptions={...this.config.providerOptions||{},speedRate:O(e.rate)}),e.pitch!==void 0&&(this.config.pitch=e.pitch),e.voice!==void 0&&(this.config.voice=e.voice),e.providerOptions&&"contentLanguage"in e.providerOptions&&(this.config.providerOptions={...this.config.providerOptions,contentLanguage:e.providerOptions.contentLanguage})}},et=class{constructor(){h(this,"providerId","server-tts"),h(this,"providerName","Server TTS"),h(this,"version","1.0.0"),h(this,"config",null),h(this,"adapter",null),h(this,"telemetryReporter",void 0)}async emitTelemetry(e,t){try{await this.telemetryReporter?.(e,t)}catch(r){f.warn("telemetry callback failed:",r)}}async initialize(e){const t=e;if(!t.apiEndpoint)throw new Error("apiEndpoint is required for ServerTTSProvider");this.config=t,this.telemetryReporter=z(t);const r=M(t);if(this.adapter=Y[r],t.validateEndpoint){const i=Date.now();if(await this.emitTelemetry("pie-tool-backend-call-start",{toolId:p,backend:t.provider||"server",operation:"validate-endpoint"}),!await this.testAPIAvailability())throw await this.emitTelemetry("pie-tool-backend-call-error",{toolId:p,backend:t.provider||"server",operation:"validate-endpoint",duration:Date.now()-i,errorType:"TTSEndpointValidationError",message:`Server TTS API not available at ${t.apiEndpoint}`}),new Error(`Server TTS API not available at ${t.apiEndpoint}`);await this.emitTelemetry("pie-tool-backend-call-success",{toolId:p,backend:t.provider||"server",operation:"validate-endpoint",duration:Date.now()-i})}return new Q(t,this.adapter)}async testAPIAvailability(){if(!this.config||!this.adapter)return!1;try{const e={...this.config.headers};this.config.authToken&&(e.Authorization=`Bearer ${this.config.authToken}`);const t=new AbortController,r=setTimeout(()=>t.abort(),5e3),i=G(this.config,this.adapter.id);if(i==="none")return clearTimeout(r),!0;const o=i==="voices"?J(this.config):[this.adapter.resolveSynthesisUrl(this.config)],s=i==="voices"?"GET":"OPTIONS";try{let n=!1;for(const a of o){const d=await fetch(a,{method:s,headers:e,signal:t.signal,...S(this.config)});if(n=d.ok||d.status===405,n||d.status!==404)break}return clearTimeout(r),n}catch{return clearTimeout(r),!1}}catch{return!1}}getCapabilities(){const e=this.config?M(this.config):"pie";return{supportsPause:!0,supportsResume:!0,supportsWordBoundary:!0,supportsVoiceSelection:!0,supportsRateControl:!0,supportsPitchControl:!1,supportsSSML:q(this.config),maxTextLength:j[e]}}destroy(){this.config=null,this.adapter=null,this.telemetryReporter=void 0}};export{et as ServerTTSProvider};
|
|
1
|
+
import{t as l}from"./defineProperty-a20a667d.js";import{r as W,t as N}from"./logger-8b07fb72.js";var A=e=>{const t=Number(e);return Number.isFinite(t)?t:null},I=e=>[...e].sort((t,r)=>t.time!==r.time?t.time-r.time:t.start!==r.start?t.start-r.start:t.end-r.end),H=e=>{const t=[];let r=0;for(const i of e.split(/\r?\n/)){const n=i.trim();if(n)try{const s=JSON.parse(n);if(s.type&&s.type!=="word")continue;const o=A(s.time);if(o===null)continue;const h=typeof s.value=="string"?s.value:"",a=A(s.start)??r,d=A(s.end)??a+Math.max(1,h.length);r=Math.max(d+1,r),t.push({time:o,type:"word",start:a,end:d,value:h})}catch{}}return I(t)},D=e=>{if(e.length<2)return e;const t=e.map(s=>s.time).filter(s=>s>=0),r=t.length?Math.max(...t):0,i=[];for(let s=1;s<t.length;s+=1){const o=t[s]-t[s-1];o>0&&Number.isFinite(o)&&i.push(o)}const n=i.length>0?[...i].sort((s,o)=>s-o)[Math.floor(i.length/2)]:0;return r>0&&r<100&&e.length>3||n>0&&n<10?e.map(s=>({...s,time:s.time*1e3})):e},M=e=>{const t=e.toLowerCase();return t.length===e.length?t:e},F=(e,t,r,i,n)=>{let s=-1;for(let o=e.indexOf(t,r);o>=0&&o<=i+n;o=e.indexOf(t,o+1))(s<0||Math.abs(o-i)<Math.abs(s-i))&&(s=o);return s>=0&&Math.abs(s-i)<=n?s:-1};function L(e,t){if(!e.length||!t.length)return e;const r=M(t),i=new Map;return I(e).map(n=>{const s=i.get(n.type)??{cursor:0,shift:null};i.set(n.type,s);const o=n.value.trim(),h=n.end-n.start,a=n.start-(s.shift??0),d=o?s.shift===null?r.indexOf(M(o),s.cursor):F(r,M(o),s.cursor,a,Math.max(8,o.length)):-1;return d<0?{...n,start:a,end:a+h}:(s.shift=n.start-d,s.cursor=d+o.length,{...n,start:d,end:d+o.length})})}var $=(e,t)=>{if(!t.length)return e;const r=t.length;return I(e.map(i=>{const n=Math.max(0,Math.min(r,Math.floor(i.start))),s=Math.max(n+1,Math.min(r,Math.floor(i.end)));return{...i,start:n,end:s}}))};function j(e,t){const r=H(e),i=L(D(r),t);return $(i,t)}function U(e,t="medium"){const r=Number(e??1);return Number.isFinite(r)?r<=.95?"slow":r>=1.5?"fast":t:t}var f=N("server-tts-provider",W),V="textToSpeech",q=50,G=5e3,J=500,K=120;function R(e,t){if(typeof e!="string"||e.length===0)return null;try{const r=typeof t.apiEndpoint=="string"&&/^https?:\/\//i.test(t.apiEndpoint)?t.apiEndpoint:void 0,i=r?new URL(e,r):new URL(e);return i.protocol!=="http:"&&i.protocol!=="https:"?null:i}catch{return null}}function x(e,t){const r=Array.isArray(t.assetOrigins)?t.assetOrigins.filter(i=>typeof i=="string"&&i.length>0).map(i=>{try{return new URL(i).origin}catch{return i}}):[];if(r.length===0){if(typeof t.apiEndpoint=="string"&&/^https?:\/\//i.test(t.apiEndpoint))try{return new URL(t.apiEndpoint).origin===e.origin}catch{return!1}return typeof window<"u"&&typeof window.location?.origin=="string"&&window.location.origin===e.origin}return r.includes(e.origin)}function P(e){const t={};for(const[r,i]of Object.entries(e)){const n=r.toLowerCase();n==="authorization"||n==="proxy-authorization"||n==="cookie"||n.startsWith("x-auth-")||(t[r]=i)}return t}function S(e,t=!0){return e.credentials?!t&&e.credentials==="include"?{}:{credentials:e.credentials}:{}}function _(e,t){const r={};if(!t.includeAuthOnAssetFetch)return r;for(const[i,n]of Object.entries(e))i.toLowerCase()==="authorization"&&(r[i]=n);return r}var z=e=>{const t=e.providerOptions?.__pieTelemetry;return typeof t=="function"?t:void 0},p=(e,t,r)=>({toolId:V,backend:e.provider||"server",operation:t,...r}),X={pie:3e3,custom:3e3},Y=new Set(["polly","google"]),Q=e=>{if(!e||k(e)!=="pie")return!1;const t=(e.provider||"polly").toLowerCase();return Y.has(t)},E=e=>e.replace(/\/+$/,""),Z=e=>{const t=E(e.apiEndpoint),r=(e.provider||"").toLowerCase();return r==="polly"||r==="google"?[`${t}/${r}/voices`,`${t}/voices`]:[`${t}/voices`]},k=e=>e.transportMode==="custom"?"custom":e.transportMode==="pie"?"pie":e.provider==="custom"?"custom":"pie",O=(e,t)=>e.endpointMode?e.endpointMode:t==="custom"?"rootPost":"synthesizePath",tt=e=>e.endpointValidationMode==="voices"||e.endpointValidationMode==="endpoint"?e.endpointValidationMode:"none",et=new Set(["slow","medium","fast"]),rt=e=>{const t=e.providerOptions?.speedRate;return et.has(t)?t:U(e.rate)},C=e=>{const t=e.providerOptions?.contentLanguage;return typeof t=="string"&&t.trim()?t.trim():void 0},it=e=>{if(!Array.isArray(e))return[];const t=[];let r=0;for(const i of e){if(!i||typeof i!="object")continue;const n=typeof i.type=="string"?i.type:"word",s=typeof i.time=="number"&&Number.isFinite(i.time)?i.time:0,o=typeof i.value=="string"?i.value:"",h=typeof i.start=="number"&&Number.isFinite(i.start)?i.start:null,a=typeof i.end=="number"&&Number.isFinite(i.end)?i.end:null,d=h??r,g=a??d+Math.max(1,o.length||1);r=Math.max(r,g+1),t.push({time:s,type:n,start:d,end:g,value:o})}return t.sort((i,n)=>i.time!==n.time?i.time-n.time:i.start!==n.start?i.start-n.start:i.end-n.end)},st={pie:{id:"pie",resolveSynthesisUrl:e=>{const t=O(e,"pie"),r=E(e.apiEndpoint);return t==="rootPost"?r:`${r}/synthesize`},buildRequestBody:(e,t)=>{const r=t.providerOptions||{},i=typeof t.engine=="string"?t.engine:typeof r.engine=="string"?r.engine:void 0,n=typeof r.sampleRate=="number"&&Number.isFinite(r.sampleRate)?r.sampleRate:void 0,s=r.format==="mp3"||r.format==="ogg"||r.format==="pcm"?r.format:void 0,o=Array.isArray(r.speechMarkTypes)?r.speechMarkTypes.filter(h=>h==="word"||h==="sentence"||h==="ssml"):void 0;return{text:e,provider:t.provider||"polly",voice:t.voice,language:C(t)??t.language,rate:t.rate,...t.pitch!==void 0?{pitch:t.pitch}:{},engine:i,sampleRate:n,format:s,speechMarkTypes:o,includeSpeechMarks:!0}},parseResponse:async(e,t,r,i,n)=>{const s=await e.json();return{audio:{kind:"base64",data:s.audio,contentType:s.contentType},speechMarks:Array.isArray(s.speechMarks)?L(s.speechMarks,n):[]}}},custom:{id:"custom",resolveSynthesisUrl:e=>{const t=O(e,"custom"),r=E(e.apiEndpoint);return t==="synthesizePath"?`${r}/synthesize`:r},buildRequestBody:(e,t)=>{const r=t.providerOptions||{},i=(typeof r.lang_id=="string"&&r.lang_id.trim()?r.lang_id:void 0)??C(t)??(t.language||"en-US"),n=typeof r.cache=="boolean"?r.cache:!0;return{text:e,speedRate:rt(t),lang_id:i,langId:i,cache:n}},parseResponse:async(e,t,r,i,n)=>{const s=await e.json(),o=_(r,t);let h=[];const a=it(s.speechMarks);if(a.length>0)h=a;else if(typeof s.word=="string"&&s.word.length>0){const g=R(s.word,t);if(g!==null){const y=x(g,t),c=y?o:P(o),u=await fetch(g.toString(),{headers:c,...S(t,y),signal:i,redirect:"error"});if(u.ok){const m=await u.text();h=j(m,n)}}}const d=R(s.audioContent,t);if(d===null)throw new Error("TTS server returned an invalid audio URL");return{audio:{kind:"url",url:d.toString()},speechMarks:h}}}},nt=class{constructor(e,t){l(this,"config",void 0),l(this,"adapter",void 0),l(this,"currentAudio",null),l(this,"pausedState",!1),l(this,"wordTimings",[]),l(this,"highlightInterval",null),l(this,"highlightCursor",-1),l(this,"intentionallyStopped",!1),l(this,"activeSynthesisController",null),l(this,"startCurrentAudio",null),l(this,"synthesisRunId",0),l(this,"telemetryReporter",void 0),l(this,"onPlaybackStart",void 0),l(this,"onWordBoundary",void 0),this.config=e,this.adapter=t,this.telemetryReporter=z(e)}async emitTelemetry(e,t){try{await this.telemetryReporter?.(e,t)}catch(r){f.warn("telemetry callback failed:",r)}}async speak(e){this.stop(),this.intentionallyStopped=!1;const t=++this.synthesisRunId,r=new AbortController;this.activeSynthesisController=r;let i;try{i=await this.synthesizeSpeech(e,r.signal,t)}catch(o){if(t!==this.synthesisRunId||r.signal.aborted)return;throw o}finally{this.activeSynthesisController===r&&(this.activeSynthesisController=null)}const{audioUrl:n,wordTimings:s}=i;if(t!==this.synthesisRunId){URL.revokeObjectURL(n);return}return this.wordTimings=s,this.highlightCursor=-1,new Promise((o,h)=>{const a=new Audio(n);this.currentAudio=a,this.config.volume!==void 0&&(a.volume=Math.max(0,Math.min(1,this.config.volume)));const d=()=>t!==this.synthesisRunId||this.currentAudio!==a;a.onplaying=()=>{if(!d()){this.pausedState=!1;try{this.onPlaybackStart?.({wordBoundaries:this.wordTimings.length>0})}catch(y){f.warn("playback-start callback failed:",y)}this.onWordBoundary&&this.wordTimings.length>0&&this.startWordHighlighting()}},a.onended=()=>{URL.revokeObjectURL(n),d()||this.clearCurrentAudio(),o()},a.onerror=()=>{if(URL.revokeObjectURL(n),d()||this.intentionallyStopped){o();return}this.clearCurrentAudio(),h(new Error("Failed to play audio from server"))},a.onpause=()=>{d()||(this.stopWordHighlighting(),this.pausedState=!0)};const g=()=>{a.play().catch(y=>{y?.name==="AbortError"&&this.pausedState&&this.currentAudio===a||h(y)})};this.startCurrentAudio=g,this.pausedState||g()})}async synthesizeSpeech(e,t,r){const i=Date.now();await this.emitTelemetry("pie-tool-backend-call-start",p(this.config,"synthesize-speech"));const n={"Content-Type":"application/json",...this.config.headers};this.config.authToken&&(n.Authorization=`Bearer ${this.config.authToken}`);const s=this.adapter.resolveSynthesisUrl(this.config),o=this.adapter.buildRequestBody(e,this.config),h=await(async()=>{try{return await fetch(s,{method:"POST",headers:n,body:JSON.stringify(o),signal:t,...S(this.config)})}catch(c){throw t.aborted||await this.emitTelemetry("pie-tool-backend-call-error",p(this.config,"synthesize-speech",{duration:Date.now()-i,errorType:"TTSBackendNetworkError",message:c instanceof Error?c.message:String(c)})),c}})();if(!h.ok){const c=await h.text().catch(()=>"");let u={};if(c)try{u=JSON.parse(c)}catch(w){f.warn("non-OK response body was not JSON",{status:h.status,url:s,bodyLength:c.length,parseError:w instanceof Error?w.message:String(w)}),f.debug("non-OK response body",{rawBodyPreview:c.slice(0,J)})}const m=typeof u.message=="string"&&u.message||(typeof u.error?.message=="string"?u.error.message:void 0)||`Server returned ${h.status}`;await this.emitTelemetry("pie-tool-backend-call-error",p(this.config,"synthesize-speech",{duration:Date.now()-i,statusCode:h.status,errorType:"TTSBackendRequestError",message:m})),f.error("synthesize request failed",{status:h.status,url:s,backend:this.config.provider||"server",message:m,textLength:e.length});const v=e.replace(/\s+/g," ").trim().slice(0,K);throw f.debug("synthesize request failed for text",{responseBody:u,textPreview:v.length<e.length?`${v}…`:v}),new Error(m)}const a=await this.adapter.parseResponse(h,this.config,n,t,e);if(r!==this.synthesisRunId||t.aborted)throw new Error("Synthesis superseded by a newer request");let d;if(a.audio.kind==="base64")d=this.base64ToBlob(a.audio.data,a.audio.contentType);else{const c=a.audio.url,u=Date.now();await this.emitTelemetry("pie-tool-backend-call-start",p(this.config,"fetch-synthesized-audio-asset"));const m=_(n,this.config),v=R(c,this.config);if(v===null)throw await this.emitTelemetry("pie-tool-backend-call-error",p(this.config,"fetch-synthesized-audio-asset",{duration:Date.now()-u,errorType:"TTSAssetInvalidUrl",message:"TTS asset URL rejected (non-http(s) or malformed)"})),new Error("TTS asset URL rejected (non-http(s) or malformed)");const w=x(v,this.config),B=w?m:P(m),T=await(async()=>{try{return await fetch(v.toString(),{headers:B,signal:t,...S(this.config,w),redirect:"error"})}catch(b){throw t.aborted||await this.emitTelemetry("pie-tool-backend-call-error",p(this.config,"fetch-synthesized-audio-asset",{duration:Date.now()-u,errorType:"TTSAssetNetworkError",message:b instanceof Error?b.message:String(b)})),b}})();if(!T.ok)throw await this.emitTelemetry("pie-tool-backend-call-error",p(this.config,"fetch-synthesized-audio-asset",{duration:Date.now()-u,statusCode:T.status,errorType:"TTSAssetFetchError",message:`Failed to download synthesized audio (${T.status})`})),new Error(`Failed to download synthesized audio (${T.status})`);d=await T.blob(),await this.emitTelemetry("pie-tool-backend-call-success",p(this.config,"fetch-synthesized-audio-asset",{duration:Date.now()-u}))}const g=URL.createObjectURL(d),y=this.parseSpeechMarks(a.speechMarks);return await this.emitTelemetry("pie-tool-backend-call-success",p(this.config,"synthesize-speech",{duration:Date.now()-i})),{audioUrl:g,wordTimings:y}}base64ToBlob(e,t){const r=atob(e),i=new Array(r.length);for(let s=0;s<r.length;s++)i[s]=r.charCodeAt(s);const n=new Uint8Array(i);return new Blob([n],{type:t})}parseSpeechMarks(e){return e.filter(t=>t.type==="word").map((t,r)=>({time:t.time,wordIndex:r,charIndex:t.start,length:t.end-t.start,word:t.value}))}startWordHighlighting(){if(this.stopWordHighlighting(),!this.currentAudio||!this.onWordBoundary||this.wordTimings.length===0){f.debug("cannot start word highlighting",{hasAudio:!!this.currentAudio,hasCallback:!!this.onWordBoundary,wordTimingsCount:this.wordTimings.length});return}f.debug("starting word highlighting",{wordTimingsCount:this.wordTimings.length,playbackRate:this.currentAudio.playbackRate}),this.highlightInterval=window.setInterval(()=>{if(!this.currentAudio){this.stopWordHighlighting();return}const e=this.currentAudio.currentTime*1e3,t=this.resolveCurrentWordIndex(e,this.highlightCursor);if(t<0||t===this.highlightCursor)return;this.highlightCursor=t;const r=this.wordTimings[t];f.debug("word boundary",{wordIndex:r.wordIndex,charIndex:r.charIndex,length:r.length,timingMs:r.time,currentTimeMs:e}),this.onWordBoundary?.(r.word,r.charIndex,r.length)},q)}resolveCurrentWordIndex(e,t){const r=this.wordTimings;let i=t<r.length?t:-1;for(i>=0&&e<r[i].time&&(i=-1);i+1<r.length&&r[i+1].time<=e;)i++;return i}stopWordHighlighting(){this.highlightInterval!==null&&(clearInterval(this.highlightInterval),this.highlightInterval=null)}pause(){if(!this.pausedState){if(this.currentAudio)this.currentAudio.pause(),this.stopWordHighlighting();else if(!this.activeSynthesisController)return;this.pausedState=!0}}resume(){this.pausedState&&(this.pausedState=!1,this.currentAudio&&(this.startCurrentAudio?.(),this.onWordBoundary&&this.wordTimings.length>0&&this.startWordHighlighting()))}clearCurrentAudio(){this.stopWordHighlighting(),this.currentAudio=null,this.wordTimings=[],this.highlightCursor=-1}stop(){this.synthesisRunId+=1,this.startCurrentAudio=null,this.activeSynthesisController&&(this.activeSynthesisController.abort(),this.activeSynthesisController=null),this.stopWordHighlighting(),this.currentAudio&&(this.intentionallyStopped=!0,this.currentAudio.pause(),this.currentAudio.src&&URL.revokeObjectURL(this.currentAudio.src),this.currentAudio.src="",this.currentAudio=null),this.pausedState=!1,this.wordTimings=[],this.highlightCursor=-1}updateSettings(e){e.rate!==void 0&&(this.config.rate=e.rate,this.config.providerOptions={...this.config.providerOptions||{},speedRate:U(e.rate)}),e.pitch!==void 0&&(this.config.pitch=e.pitch),e.volume!==void 0&&(this.config.volume=e.volume),e.voice!==void 0&&(this.config.voice=e.voice),e.providerOptions&&"contentLanguage"in e.providerOptions&&(this.config.providerOptions={...this.config.providerOptions,contentLanguage:e.providerOptions.contentLanguage})}},ht=class{constructor(){l(this,"providerId","server-tts"),l(this,"config",null),l(this,"adapter",null),l(this,"telemetryReporter",void 0)}async emitTelemetry(e,t){try{await this.telemetryReporter?.(e,t)}catch(r){f.warn("telemetry callback failed:",r)}}async initialize(e){const t=e;if(!t.apiEndpoint)throw new Error("apiEndpoint is required for ServerTTSProvider");this.config=t,this.telemetryReporter=z(t);const r=k(t);this.adapter=st[r];const i=tt(t);if(i!=="none"){const n=Date.now();if(await this.emitTelemetry("pie-tool-backend-call-start",p(t,"validate-endpoint")),!await this.testAPIAvailability(i))throw await this.emitTelemetry("pie-tool-backend-call-error",p(t,"validate-endpoint",{duration:Date.now()-n,errorType:"TTSEndpointValidationError",message:`Server TTS API not available at ${t.apiEndpoint}`})),new Error(`Server TTS API not available at ${t.apiEndpoint}`);await this.emitTelemetry("pie-tool-backend-call-success",p(t,"validate-endpoint",{duration:Date.now()-n}))}return new nt(t,this.adapter)}async testAPIAvailability(e){if(!this.config||!this.adapter)return!1;try{const t={...this.config.headers};this.config.authToken&&(t.Authorization=`Bearer ${this.config.authToken}`);const r=new AbortController,i=setTimeout(()=>r.abort(),G),n=e==="voices"?Z(this.config):[this.adapter.resolveSynthesisUrl(this.config)],s=e==="voices"?"GET":"OPTIONS";try{let o=!1;for(const h of n){const a=await fetch(h,{method:s,headers:t,signal:r.signal,...S(this.config)});if(o=a.ok||a.status===405,o||a.status!==404)break}return clearTimeout(i),o}catch{return clearTimeout(i),!1}}catch{return!1}}getCapabilities(){const e=this.config?k(this.config):"pie";return{supportsWordBoundary:!0,supportsSSML:Q(this.config),maxTextLength:X[e]}}destroy(){this.config=null,this.adapter=null,this.telemetryReporter=void 0}};export{ht as ServerTTSProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var d=["a[href]","button:not([disabled])","input:not([disabled]):not([type='hidden'])","select:not([disabled])","textarea:not([disabled])","[contenteditable]:not([contenteditable='false'])","[tabindex]:not([tabindex='-1'])"].join(",");function b(t){return!t.matches(d)||t.hasAttribute("disabled")||t.closest("[inert]")?!1:t.offsetParent!==null||t.getClientRects().length>0}function h(t){return t.getAttribute("tabindex")==="-1"?!1:b(t)}function E(t){const e=[],o=a=>{for(const n of Array.from(a.children))n instanceof HTMLElement&&(n.hasAttribute("inert")||(h(n)&&e.push(n),n.shadowRoot?o(n.shadowRoot):o(n)))};return o(t),e}function f(t){return E(t)}function c(t){let e=t.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e}function m(t,e){try{if(e&&t.contains(e)){e.focus();return}const o=f(t);if(o.length>0){o[0].focus();return}t.focus?.()}catch{}}function g(t,e={}){const o=typeof document<"u"?c(document):null,a=e.wrap??!0,n=r=>{if(r.key==="Escape"){e.onEscape?.();return}if(r.key!=="Tab")return;const s=f(t);if(!s.length){if(!a)return;r.preventDefault(),t.focus?.();return}const i=t.getRootNode(),l=c(i instanceof ShadowRoot?i:document),u=s.indexOf(l||s[0]);if(r.shiftKey){u<=0&&(a?(r.preventDefault(),s[s.length-1].focus()):e.onTabExit?.("backward",r));return}u===s.length-1&&(a?(r.preventDefault(),s[0].focus()):e.onTabExit?.("forward",r))};return queueMicrotask(()=>m(t,e.initialFocus)),t.addEventListener("keydown",n),()=>{t.removeEventListener("keydown",n);try{o?.focus?.()}catch{}}}export{b as i,d as n,E as r,g as t};
|