@contember/echo 0.0.22 → 0.0.23

Sign up to get free protection for your applications and to get access to all the features.
package/dist/echo.es.js CHANGED
@@ -451,7 +451,7 @@ const ta = (e, A) => {
451
451
  fe({
452
452
  event: "keydown",
453
453
  callback: (t) => {
454
- t.key === e && A();
454
+ t.key === e && A(t);
455
455
  }
456
456
  });
457
457
  }, fe = (e) => {
package/dist/echo.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(MA,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("solid-js")):typeof define=="function"&&define.amd?define(["exports","solid-js"],u):(MA=typeof globalThis<"u"?globalThis:MA||self,u(MA.Echo={},MA.Solid))})(this,function(MA,u){"use strict";const Cs=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],Us=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...Cs]),Fs=new Set(["innerHTML","textContent","innerText","children"]),ps=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),vs=Object.assign(Object.create(null),{class:"className",formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1}});function ms(e,A){const t=vs[e];return typeof t=="object"?t[A]?t.$:void 0:t}const Es=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]);function Hs(e,A,t){let r=t.length,n=A.length,a=r,s=0,o=0,i=A[n-1].nextSibling,B=null;for(;s<n||o<a;){if(A[s]===t[o]){s++,o++;continue}for(;A[n-1]===t[a-1];)n--,a--;if(n===s){const c=a<r?o?t[o-1].nextSibling:t[a-o]:i;for(;o<a;)e.insertBefore(t[o++],c)}else if(a===o)for(;s<n;)(!B||!B.has(A[s]))&&A[s].remove(),s++;else if(A[s]===t[a-1]&&t[o]===A[n-1]){const c=A[--n].nextSibling;e.insertBefore(t[o++],A[s++].nextSibling),e.insertBefore(t[--a],c),A[n]=t[a]}else{if(!B){B=new Map;let l=o;for(;l<a;)B.set(t[l],l++)}const c=B.get(A[s]);if(c!=null)if(o<c&&c<a){let l=s,g=1,f;for(;++l<n&&l<a&&!((f=B.get(A[l]))==null||f!==c+g);)g++;if(g>c-o){const w=A[s];for(;o<c;)e.insertBefore(t[o++],w)}else e.replaceChild(t[o++],A[s++])}else s++;else A[s++].remove()}}}const Yr="_$DX_DELEGATE";function ys(e,A,t,r={}){let n;return u.createRoot(a=>{n=a,A===document?e():y(A,e(),A.firstChild?null:void 0,t)},r.owner),()=>{n(),A.textContent=""}}function L(e,A,t){let r;const n=()=>{const s=document.createElement("template");return s.innerHTML=e,t?s.content.firstChild.firstChild:s.content.firstChild},a=A?()=>u.untrack(()=>document.importNode(r||(r=n()),!0)):()=>(r||(r=n())).cloneNode(!0);return a.cloneNode=a,a}function vA(e,A=window.document){const t=A[Yr]||(A[Yr]=new Set);for(let r=0,n=e.length;r<n;r++){const a=e[r];t.has(a)||(t.add(a),A.addEventListener(a,Ss))}}function d(e,A,t){fe(e)||(t==null?e.removeAttribute(A):e.setAttribute(A,t))}function Is(e,A,t){fe(e)||(t?e.setAttribute(A,""):e.removeAttribute(A))}function Wr(e,A){fe(e)||(A==null?e.removeAttribute("class"):e.className=A)}function ge(e,A,t,r){if(r)Array.isArray(t)?(e[`$$${A}`]=t[0],e[`$$${A}Data`]=t[1]):e[`$$${A}`]=t;else if(Array.isArray(t)){const n=t[0];e.addEventListener(A,t[0]=a=>n.call(e,t[1],a))}else e.addEventListener(A,t,typeof t!="function"&&t)}function bs(e,A,t={}){const r=Object.keys(A||{}),n=Object.keys(t);let a,s;for(a=0,s=n.length;a<s;a++){const o=n[a];!o||o==="undefined"||A[o]||(Zr(e,o,!1),delete t[o])}for(a=0,s=r.length;a<s;a++){const o=r[a],i=!!A[o];!o||o==="undefined"||t[o]===i||!i||(Zr(e,o,!0),t[o]=i)}return t}function BA(e,A,t){if(!A)return t?d(e,"style"):A;const r=e.style;if(typeof A=="string")return r.cssText=A;typeof t=="string"&&(r.cssText=t=void 0),t||(t={}),A||(A={});let n,a;for(a in t)A[a]==null&&r.removeProperty(a),delete t[a];for(a in A)n=A[a],n!==t[a]&&(r.setProperty(a,n),t[a]=n);return t}function xs(e,A={},t,r){const n={};return u.createRenderEffect(()=>n.children=we(e,A.children,n.children)),u.createRenderEffect(()=>typeof A.ref=="function"&&ue(A.ref,e)),u.createRenderEffect(()=>Ks(e,A,t,!0,n,!0)),n}function ue(e,A,t){return u.untrack(()=>e(A,t))}function y(e,A,t,r){if(t!==void 0&&!r&&(r=[]),typeof A!="function")return we(e,A,r,t);u.createRenderEffect(n=>we(e,A(),n,t),r)}function Ks(e,A,t,r,n={},a=!1){A||(A={});for(const s in n)if(!(s in A)){if(s==="children")continue;n[s]=Jr(e,s,null,n[s],t,a,A)}for(const s in A){if(s==="children")continue;const o=A[s];n[s]=Jr(e,s,o,n[s],t,a,A)}}function fe(e){return!!u.sharedConfig.context&&!u.sharedConfig.done&&(!e||e.isConnected)}function Ls(e){return e.toLowerCase().replace(/-([a-z])/g,(A,t)=>t.toUpperCase())}function Zr(e,A,t){const r=A.trim().split(/\s+/);for(let n=0,a=r.length;n<a;n++)e.classList.toggle(r[n],t)}function Jr(e,A,t,r,n,a,s){let o,i,B,c,l;if(A==="style")return BA(e,t,r);if(A==="classList")return bs(e,t,r);if(t===r)return r;if(A==="ref")a||t(e);else if(A.slice(0,3)==="on:"){const g=A.slice(3);r&&e.removeEventListener(g,r,typeof r!="function"&&r),t&&e.addEventListener(g,t,typeof t!="function"&&t)}else if(A.slice(0,10)==="oncapture:"){const g=A.slice(10);r&&e.removeEventListener(g,r,!0),t&&e.addEventListener(g,t,!0)}else if(A.slice(0,2)==="on"){const g=A.slice(2).toLowerCase(),f=Es.has(g);if(!f&&r){const w=Array.isArray(r)?r[0]:r;e.removeEventListener(g,w)}(f||t)&&(ge(e,g,t,f),f&&vA([g]))}else if(A.slice(0,5)==="attr:")d(e,A.slice(5),t);else if(A.slice(0,5)==="bool:")Is(e,A.slice(5),t);else if((l=A.slice(0,5)==="prop:")||(B=Fs.has(A))||(c=ms(A,e.tagName))||(i=Us.has(A))||(o=e.nodeName.includes("-")||"is"in s)){if(l)A=A.slice(5),i=!0;else if(fe(e))return t;A==="class"||A==="className"?Wr(e,t):o&&!i&&!B?e[Ls(A)]=t:e[c||A]=t}else d(e,ps[A]||A,t);return t}function Ss(e){if(u.sharedConfig.registry&&u.sharedConfig.events&&u.sharedConfig.events.find(([i,B])=>B===e))return;let A=e.target;const t=`$$${e.type}`,r=e.target,n=e.currentTarget,a=i=>Object.defineProperty(e,"target",{configurable:!0,value:i}),s=()=>{const i=A[t];if(i&&!A.disabled){const B=A[`${t}Data`];if(B!==void 0?i.call(A,B,e):i.call(A,e),e.cancelBubble)return}return A.host&&typeof A.host!="string"&&!A.host._$host&&A.contains(e.target)&&a(A.host),!0},o=()=>{for(;s()&&(A=A._$host||A.parentNode||A.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return A||document}}),u.sharedConfig.registry&&!u.sharedConfig.done&&(u.sharedConfig.done=_$HY.done=!0),e.composedPath){const i=e.composedPath();a(i[0]);for(let B=0;B<i.length-2&&(A=i[B],!!s());B++){if(A._$host){A=A._$host,o();break}if(A.parentNode===n)break}}else o();a(r)}function we(e,A,t,r,n){const a=fe(e);if(a){!t&&(t=[...e.childNodes]);let i=[];for(let B=0;B<t.length;B++){const c=t[B];c.nodeType===8&&c.data.slice(0,2)==="!$"?c.remove():i.push(c)}t=i}for(;typeof t=="function";)t=t();if(A===t)return t;const s=typeof A,o=r!==void 0;if(e=o&&t[0]&&t[0].parentNode||e,s==="string"||s==="number"){if(a||s==="number"&&(A=A.toString(),A===t))return t;if(o){let i=t[0];i&&i.nodeType===3?i.data!==A&&(i.data=A):i=document.createTextNode(A),t=ZA(e,t,r,i)}else t!==""&&typeof t=="string"?t=e.firstChild.data=A:t=e.textContent=A}else if(A==null||s==="boolean"){if(a)return t;t=ZA(e,t,r)}else{if(s==="function")return u.createRenderEffect(()=>{let i=A();for(;typeof i=="function";)i=i();t=we(e,i,t,r)}),()=>t;if(Array.isArray(A)){const i=[],B=t&&Array.isArray(t);if(Gt(i,A,t,n))return u.createRenderEffect(()=>t=we(e,i,t,r,!0)),()=>t;if(a){if(!i.length)return t;if(r===void 0)return t=[...e.childNodes];let c=i[0];if(c.parentNode!==e)return t;const l=[c];for(;(c=c.nextSibling)!==r;)l.push(c);return t=l}if(i.length===0){if(t=ZA(e,t,r),o)return t}else B?t.length===0?zr(e,i,r):Hs(e,t,i):(t&&ZA(e),zr(e,i));t=i}else if(A.nodeType){if(a&&A.parentNode)return t=o?[A]:A;if(Array.isArray(t)){if(o)return t=ZA(e,t,r,A);ZA(e,t,null,A)}else t==null||t===""||!e.firstChild?e.appendChild(A):e.replaceChild(A,e.firstChild);t=A}}return t}function Gt(e,A,t,r){let n=!1;for(let a=0,s=A.length;a<s;a++){let o=A[a],i=t&&t[e.length],B;if(!(o==null||o===!0||o===!1))if((B=typeof o)=="object"&&o.nodeType)e.push(o);else if(Array.isArray(o))n=Gt(e,o,i)||n;else if(B==="function")if(r){for(;typeof o=="function";)o=o();n=Gt(e,Array.isArray(o)?o:[o],Array.isArray(i)?i:[i])||n}else e.push(o),n=!0;else{const c=String(o);i&&i.nodeType===3&&i.data===c?e.push(i):e.push(document.createTextNode(c))}}return n}function zr(e,A,t=null){for(let r=0,n=A.length;r<n;r++)e.insertBefore(A[r],t)}function ZA(e,A,t,r){if(t===void 0)return e.textContent="";const n=r||document.createTextNode("");if(A.length){let a=!1;for(let s=A.length-1;s>=0;s--){const o=A[s];if(n!==o){const i=o.parentNode===e;!a&&!s?i?e.replaceChild(n,o):e.insertBefore(n,t):i&&o.remove()}else a=!0}}else e.insertBefore(n,t);return[n]}const Ds="http://www.w3.org/2000/svg";function Ts(e,A=!1){return A?document.createElementNS(Ds,e):document.createElement(e)}function Os(e){const{useShadow:A}=e,t=document.createTextNode(""),r=()=>e.mount||document.body,n=u.getOwner();let a,s=!!u.sharedConfig.context;return u.createEffect(()=>{s&&(u.getOwner().user=s=!1),a||(a=u.runWithOwner(n,()=>u.createMemo(()=>e.children)));const o=r();if(o instanceof HTMLHeadElement){const[i,B]=u.createSignal(!1),c=()=>B(!0);u.createRoot(l=>y(o,()=>i()?l():a(),null)),u.onCleanup(c)}else{const i=Ts(e.isSVG?"g":"div",e.isSVG),B=A&&i.attachShadow?i.attachShadow({mode:"open"}):i;Object.defineProperty(i,"_$host",{get(){return t.parentNode},configurable:!0}),y(B,a),o.appendChild(i),e.ref&&e.ref(i),u.onCleanup(()=>o.removeChild(i))}},void 0,{render:!s}),t}const Ms=(e,A)=>{let t;return(...r)=>{clearTimeout(t),t=window.setTimeout(()=>e(...r),A)}},Rs=(e,A)=>{JA({event:"keydown",callback:t=>{t.key===e&&A()}})},JA=e=>{const{event:A,callback:t,onMount:r,onCleanup:n}=e,a=s=>{t(s)};u.onMount(()=>{r==null||r(),window.addEventListener(A,a)}),u.onCleanup(()=>{n==null||n(),window.removeEventListener(A,a)})},Nt=e=>{const{target:A,options:t,callback:r,onMount:n,onCleanup:a}=e,s=new MutationObserver(r);u.onMount(()=>{n==null||n(),s.observe(A,t)}),u.onCleanup(()=>{a==null||a(),s.disconnect()})},ks="echo_",RA="echo_page_state",$r=()=>{window.dispatchEvent(new CustomEvent("echo-storage-change"))},jr=e=>`${ks}${e}`,qr=(e,A)=>{try{const t=localStorage.getItem(jr(e));return t?JSON.parse(t):A}catch{return A}},Vt=(e,A)=>{try{localStorage.setItem(jr(e),JSON.stringify(A))}catch(t){console.warn("Failed to save to localStorage:",t)}},Pt=()=>window.location.pathname,Gs=(e,A)=>{try{const t=localStorage.getItem(RA),r=t?JSON.parse(t):{};if(!A.feedback.comment&&(!A.drawing.shapes||A.drawing.shapes.length===0))delete r[e];else{const n=window.location.search||void 0,a={feedback:{comment:A.feedback.comment},drawing:{shapes:A.drawing.shapes},latestQuery:n};r[e]=a}localStorage.setItem(RA,JSON.stringify(r)),$r()}catch(t){console.error("Failed to save page state:",t)}},Xt=e=>{try{const A=localStorage.getItem(RA);return A&&JSON.parse(A)[e]||null}catch(A){return console.error("Failed to load page state:",A),null}},An=e=>{try{const A=localStorage.getItem(RA);if(!A)return;const t=JSON.parse(A);delete t[e],localStorage.setItem(RA,JSON.stringify(t)),$r()}catch(A){console.error("Failed to clear page state:",A)}},en=()=>{try{const e=localStorage.getItem(RA);if(!e)return 0;const A=JSON.parse(e);return Object.keys(A).length}catch(e){return console.error("Failed to get stored pages count:",e),0}},_t=()=>{try{const e=localStorage.getItem(RA);if(!e)return[];const A=JSON.parse(e);return Object.entries(A).map(([t,r])=>({path:t,state:r}))}catch(e){return console.error("Failed to get stored pages:",e),[]}},Yt=Symbol("store-raw"),zA=Symbol("store-node"),wA=Symbol("store-has"),tn=Symbol("store-self");function rn(e){let A=e[u.$PROXY];if(!A&&(Object.defineProperty(e,u.$PROXY,{value:A=new Proxy(e,Ps)}),!Array.isArray(e))){const t=Object.keys(e),r=Object.getOwnPropertyDescriptors(e);for(let n=0,a=t.length;n<a;n++){const s=t[n];r[s].get&&Object.defineProperty(e,s,{enumerable:r[s].enumerable,get:r[s].get.bind(A)})}}return A}function Ne(e){let A;return e!=null&&typeof e=="object"&&(e[u.$PROXY]||!(A=Object.getPrototypeOf(e))||A===Object.prototype||Array.isArray(e))}function de(e,A=new Set){let t,r,n,a;if(t=e!=null&&e[Yt])return t;if(!Ne(e)||A.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):A.add(e);for(let s=0,o=e.length;s<o;s++)n=e[s],(r=de(n,A))!==n&&(e[s]=r)}else{Object.isFrozen(e)?e=Object.assign({},e):A.add(e);const s=Object.keys(e),o=Object.getOwnPropertyDescriptors(e);for(let i=0,B=s.length;i<B;i++)a=s[i],!o[a].get&&(n=e[a],(r=de(n,A))!==n&&(e[a]=r))}return e}function Ve(e,A){let t=e[A];return t||Object.defineProperty(e,A,{value:t=Object.create(null)}),t}function Qe(e,A,t){if(e[A])return e[A];const[r,n]=u.createSignal(t,{equals:!1,internal:!0});return r.$=n,e[A]=r}function Ns(e,A){const t=Reflect.getOwnPropertyDescriptor(e,A);return!t||t.get||!t.configurable||A===u.$PROXY||A===zA||(delete t.value,delete t.writable,t.get=()=>e[u.$PROXY][A]),t}function nn(e){u.getListener()&&Qe(Ve(e,zA),tn)()}function Vs(e){return nn(e),Reflect.ownKeys(e)}const Ps={get(e,A,t){if(A===Yt)return e;if(A===u.$PROXY)return t;if(A===u.$TRACK)return nn(e),t;const r=Ve(e,zA),n=r[A];let a=n?n():e[A];if(A===zA||A===wA||A==="__proto__")return a;if(!n){const s=Object.getOwnPropertyDescriptor(e,A);u.getListener()&&(typeof a!="function"||e.hasOwnProperty(A))&&!(s&&s.get)&&(a=Qe(r,A,a)())}return Ne(a)?rn(a):a},has(e,A){return A===Yt||A===u.$PROXY||A===u.$TRACK||A===zA||A===wA||A==="__proto__"?!0:(u.getListener()&&Qe(Ve(e,wA),A)(),A in e)},set(){return!0},deleteProperty(){return!0},ownKeys:Vs,getOwnPropertyDescriptor:Ns};function Pe(e,A,t,r=!1){if(!r&&e[A]===t)return;const n=e[A],a=e.length;t===void 0?(delete e[A],e[wA]&&e[wA][A]&&n!==void 0&&e[wA][A].$()):(e[A]=t,e[wA]&&e[wA][A]&&n===void 0&&e[wA][A].$());let s=Ve(e,zA),o;if((o=Qe(s,A,n))&&o.$(()=>t),Array.isArray(e)&&e.length!==a){for(let i=e.length;i<a;i++)(o=s[i])&&o.$();(o=Qe(s,"length",a))&&o.$(e.length)}(o=s[tn])&&o.$()}function an(e,A){const t=Object.keys(A);for(let r=0;r<t.length;r+=1){const n=t[r];Pe(e,n,A[n])}}function Xs(e,A){if(typeof A=="function"&&(A=A(e)),A=de(A),Array.isArray(A)){if(e===A)return;let t=0,r=A.length;for(;t<r;t++){const n=A[t];e[t]!==n&&Pe(e,t,n)}Pe(e,"length",r)}else an(e,A)}function he(e,A,t=[]){let r,n=e;if(A.length>1){r=A.shift();const s=typeof r,o=Array.isArray(e);if(Array.isArray(r)){for(let i=0;i<r.length;i++)he(e,[r[i]].concat(A),t);return}else if(o&&s==="function"){for(let i=0;i<e.length;i++)r(e[i],i)&&he(e,[i].concat(A),t);return}else if(o&&s==="object"){const{from:i=0,to:B=e.length-1,by:c=1}=r;for(let l=i;l<=B;l+=c)he(e,[l].concat(A),t);return}else if(A.length>1){he(e[r],A,[r].concat(t));return}n=e[r],t=[r].concat(t)}let a=A[0];typeof a=="function"&&(a=a(n,t),a===n)||r===void 0&&a==null||(a=de(a),r===void 0||Ne(n)&&Ne(a)&&!Array.isArray(a)?an(n,a):Pe(e,r,a))}function Wt(...[e,A]){const t=de(e||{}),r=Array.isArray(t),n=rn(t);function a(...s){u.batch(()=>{r&&s.length===1?Xs(t,s[0]):he(t,s)})}return[n,a]}const mA={rectangle:{id:"rectangle",label:"Highlight",getCursor:()=>"crosshair",strokeWidth:2,opacity:{selected:1,default:1}},path:{id:"path",label:"Pen",getCursor:e=>`url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48" fill="none" stroke="${e.replace("#","%23")}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="24" cy="24" r="8"/></svg>') 24 24, auto`,strokeWidth:6,opacity:{selected:.6,default:1}}},_s=e=>{const A=e.replace("#",""),t=Number.parseInt(A.slice(0,2),16)/255,r=Number.parseInt(A.slice(2,2),16)/255,n=Number.parseInt(A.slice(4,2),16)/255;return .2126*t+.7152*r+.0722*n},Ys=e=>_s(e)<.5?"#FFFFFF":"#000000",sn=(e,A)=>{if(!A)return e;const t={...e};for(const r in A)A[r]&&typeof A[r]=="object"&&!Array.isArray(A[r])?t[r]=sn(e[r],A[r]):t[r]=A[r];return t};let dA=[],cA=null,$A=null,jA=null;const Zt=(e,A)=>(...t)=>{const r=t.map(n=>typeof n=="string"?n:n instanceof Error?n.stack||n.message:JSON.stringify(n)).join(" ");dA.push({type:e,message:r,timestamp:new Date().toISOString()}),dA.length>1e3&&(dA=dA.slice(-1e3)),A.apply(console,t)},Ws=()=>{cA||(cA={log:console.log,warn:console.warn,error:console.error},$A=window.onerror,jA=window.onunhandledrejection,window.onerror=(e,A,t,r,n)=>{const a=(n==null?void 0:n.stack)||(n==null?void 0:n.message)||e;return dA.push({type:"error",message:`Uncaught Error: ${a}
1
+ (function(MA,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("solid-js")):typeof define=="function"&&define.amd?define(["exports","solid-js"],u):(MA=typeof globalThis<"u"?globalThis:MA||self,u(MA.Echo={},MA.Solid))})(this,function(MA,u){"use strict";const Cs=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],Us=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...Cs]),Fs=new Set(["innerHTML","textContent","innerText","children"]),ps=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),vs=Object.assign(Object.create(null),{class:"className",formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1}});function ms(e,A){const t=vs[e];return typeof t=="object"?t[A]?t.$:void 0:t}const Es=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]);function Hs(e,A,t){let r=t.length,n=A.length,a=r,s=0,o=0,i=A[n-1].nextSibling,B=null;for(;s<n||o<a;){if(A[s]===t[o]){s++,o++;continue}for(;A[n-1]===t[a-1];)n--,a--;if(n===s){const c=a<r?o?t[o-1].nextSibling:t[a-o]:i;for(;o<a;)e.insertBefore(t[o++],c)}else if(a===o)for(;s<n;)(!B||!B.has(A[s]))&&A[s].remove(),s++;else if(A[s]===t[a-1]&&t[o]===A[n-1]){const c=A[--n].nextSibling;e.insertBefore(t[o++],A[s++].nextSibling),e.insertBefore(t[--a],c),A[n]=t[a]}else{if(!B){B=new Map;let l=o;for(;l<a;)B.set(t[l],l++)}const c=B.get(A[s]);if(c!=null)if(o<c&&c<a){let l=s,g=1,f;for(;++l<n&&l<a&&!((f=B.get(A[l]))==null||f!==c+g);)g++;if(g>c-o){const w=A[s];for(;o<c;)e.insertBefore(t[o++],w)}else e.replaceChild(t[o++],A[s++])}else s++;else A[s++].remove()}}}const Yr="_$DX_DELEGATE";function ys(e,A,t,r={}){let n;return u.createRoot(a=>{n=a,A===document?e():y(A,e(),A.firstChild?null:void 0,t)},r.owner),()=>{n(),A.textContent=""}}function L(e,A,t){let r;const n=()=>{const s=document.createElement("template");return s.innerHTML=e,t?s.content.firstChild.firstChild:s.content.firstChild},a=A?()=>u.untrack(()=>document.importNode(r||(r=n()),!0)):()=>(r||(r=n())).cloneNode(!0);return a.cloneNode=a,a}function vA(e,A=window.document){const t=A[Yr]||(A[Yr]=new Set);for(let r=0,n=e.length;r<n;r++){const a=e[r];t.has(a)||(t.add(a),A.addEventListener(a,Ss))}}function d(e,A,t){fe(e)||(t==null?e.removeAttribute(A):e.setAttribute(A,t))}function Is(e,A,t){fe(e)||(t?e.setAttribute(A,""):e.removeAttribute(A))}function Wr(e,A){fe(e)||(A==null?e.removeAttribute("class"):e.className=A)}function ge(e,A,t,r){if(r)Array.isArray(t)?(e[`$$${A}`]=t[0],e[`$$${A}Data`]=t[1]):e[`$$${A}`]=t;else if(Array.isArray(t)){const n=t[0];e.addEventListener(A,t[0]=a=>n.call(e,t[1],a))}else e.addEventListener(A,t,typeof t!="function"&&t)}function bs(e,A,t={}){const r=Object.keys(A||{}),n=Object.keys(t);let a,s;for(a=0,s=n.length;a<s;a++){const o=n[a];!o||o==="undefined"||A[o]||(Zr(e,o,!1),delete t[o])}for(a=0,s=r.length;a<s;a++){const o=r[a],i=!!A[o];!o||o==="undefined"||t[o]===i||!i||(Zr(e,o,!0),t[o]=i)}return t}function BA(e,A,t){if(!A)return t?d(e,"style"):A;const r=e.style;if(typeof A=="string")return r.cssText=A;typeof t=="string"&&(r.cssText=t=void 0),t||(t={}),A||(A={});let n,a;for(a in t)A[a]==null&&r.removeProperty(a),delete t[a];for(a in A)n=A[a],n!==t[a]&&(r.setProperty(a,n),t[a]=n);return t}function xs(e,A={},t,r){const n={};return u.createRenderEffect(()=>n.children=we(e,A.children,n.children)),u.createRenderEffect(()=>typeof A.ref=="function"&&ue(A.ref,e)),u.createRenderEffect(()=>Ks(e,A,t,!0,n,!0)),n}function ue(e,A,t){return u.untrack(()=>e(A,t))}function y(e,A,t,r){if(t!==void 0&&!r&&(r=[]),typeof A!="function")return we(e,A,r,t);u.createRenderEffect(n=>we(e,A(),n,t),r)}function Ks(e,A,t,r,n={},a=!1){A||(A={});for(const s in n)if(!(s in A)){if(s==="children")continue;n[s]=Jr(e,s,null,n[s],t,a,A)}for(const s in A){if(s==="children")continue;const o=A[s];n[s]=Jr(e,s,o,n[s],t,a,A)}}function fe(e){return!!u.sharedConfig.context&&!u.sharedConfig.done&&(!e||e.isConnected)}function Ls(e){return e.toLowerCase().replace(/-([a-z])/g,(A,t)=>t.toUpperCase())}function Zr(e,A,t){const r=A.trim().split(/\s+/);for(let n=0,a=r.length;n<a;n++)e.classList.toggle(r[n],t)}function Jr(e,A,t,r,n,a,s){let o,i,B,c,l;if(A==="style")return BA(e,t,r);if(A==="classList")return bs(e,t,r);if(t===r)return r;if(A==="ref")a||t(e);else if(A.slice(0,3)==="on:"){const g=A.slice(3);r&&e.removeEventListener(g,r,typeof r!="function"&&r),t&&e.addEventListener(g,t,typeof t!="function"&&t)}else if(A.slice(0,10)==="oncapture:"){const g=A.slice(10);r&&e.removeEventListener(g,r,!0),t&&e.addEventListener(g,t,!0)}else if(A.slice(0,2)==="on"){const g=A.slice(2).toLowerCase(),f=Es.has(g);if(!f&&r){const w=Array.isArray(r)?r[0]:r;e.removeEventListener(g,w)}(f||t)&&(ge(e,g,t,f),f&&vA([g]))}else if(A.slice(0,5)==="attr:")d(e,A.slice(5),t);else if(A.slice(0,5)==="bool:")Is(e,A.slice(5),t);else if((l=A.slice(0,5)==="prop:")||(B=Fs.has(A))||(c=ms(A,e.tagName))||(i=Us.has(A))||(o=e.nodeName.includes("-")||"is"in s)){if(l)A=A.slice(5),i=!0;else if(fe(e))return t;A==="class"||A==="className"?Wr(e,t):o&&!i&&!B?e[Ls(A)]=t:e[c||A]=t}else d(e,ps[A]||A,t);return t}function Ss(e){if(u.sharedConfig.registry&&u.sharedConfig.events&&u.sharedConfig.events.find(([i,B])=>B===e))return;let A=e.target;const t=`$$${e.type}`,r=e.target,n=e.currentTarget,a=i=>Object.defineProperty(e,"target",{configurable:!0,value:i}),s=()=>{const i=A[t];if(i&&!A.disabled){const B=A[`${t}Data`];if(B!==void 0?i.call(A,B,e):i.call(A,e),e.cancelBubble)return}return A.host&&typeof A.host!="string"&&!A.host._$host&&A.contains(e.target)&&a(A.host),!0},o=()=>{for(;s()&&(A=A._$host||A.parentNode||A.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return A||document}}),u.sharedConfig.registry&&!u.sharedConfig.done&&(u.sharedConfig.done=_$HY.done=!0),e.composedPath){const i=e.composedPath();a(i[0]);for(let B=0;B<i.length-2&&(A=i[B],!!s());B++){if(A._$host){A=A._$host,o();break}if(A.parentNode===n)break}}else o();a(r)}function we(e,A,t,r,n){const a=fe(e);if(a){!t&&(t=[...e.childNodes]);let i=[];for(let B=0;B<t.length;B++){const c=t[B];c.nodeType===8&&c.data.slice(0,2)==="!$"?c.remove():i.push(c)}t=i}for(;typeof t=="function";)t=t();if(A===t)return t;const s=typeof A,o=r!==void 0;if(e=o&&t[0]&&t[0].parentNode||e,s==="string"||s==="number"){if(a||s==="number"&&(A=A.toString(),A===t))return t;if(o){let i=t[0];i&&i.nodeType===3?i.data!==A&&(i.data=A):i=document.createTextNode(A),t=ZA(e,t,r,i)}else t!==""&&typeof t=="string"?t=e.firstChild.data=A:t=e.textContent=A}else if(A==null||s==="boolean"){if(a)return t;t=ZA(e,t,r)}else{if(s==="function")return u.createRenderEffect(()=>{let i=A();for(;typeof i=="function";)i=i();t=we(e,i,t,r)}),()=>t;if(Array.isArray(A)){const i=[],B=t&&Array.isArray(t);if(Gt(i,A,t,n))return u.createRenderEffect(()=>t=we(e,i,t,r,!0)),()=>t;if(a){if(!i.length)return t;if(r===void 0)return t=[...e.childNodes];let c=i[0];if(c.parentNode!==e)return t;const l=[c];for(;(c=c.nextSibling)!==r;)l.push(c);return t=l}if(i.length===0){if(t=ZA(e,t,r),o)return t}else B?t.length===0?zr(e,i,r):Hs(e,t,i):(t&&ZA(e),zr(e,i));t=i}else if(A.nodeType){if(a&&A.parentNode)return t=o?[A]:A;if(Array.isArray(t)){if(o)return t=ZA(e,t,r,A);ZA(e,t,null,A)}else t==null||t===""||!e.firstChild?e.appendChild(A):e.replaceChild(A,e.firstChild);t=A}}return t}function Gt(e,A,t,r){let n=!1;for(let a=0,s=A.length;a<s;a++){let o=A[a],i=t&&t[e.length],B;if(!(o==null||o===!0||o===!1))if((B=typeof o)=="object"&&o.nodeType)e.push(o);else if(Array.isArray(o))n=Gt(e,o,i)||n;else if(B==="function")if(r){for(;typeof o=="function";)o=o();n=Gt(e,Array.isArray(o)?o:[o],Array.isArray(i)?i:[i])||n}else e.push(o),n=!0;else{const c=String(o);i&&i.nodeType===3&&i.data===c?e.push(i):e.push(document.createTextNode(c))}}return n}function zr(e,A,t=null){for(let r=0,n=A.length;r<n;r++)e.insertBefore(A[r],t)}function ZA(e,A,t,r){if(t===void 0)return e.textContent="";const n=r||document.createTextNode("");if(A.length){let a=!1;for(let s=A.length-1;s>=0;s--){const o=A[s];if(n!==o){const i=o.parentNode===e;!a&&!s?i?e.replaceChild(n,o):e.insertBefore(n,t):i&&o.remove()}else a=!0}}else e.insertBefore(n,t);return[n]}const Ds="http://www.w3.org/2000/svg";function Ts(e,A=!1){return A?document.createElementNS(Ds,e):document.createElement(e)}function Os(e){const{useShadow:A}=e,t=document.createTextNode(""),r=()=>e.mount||document.body,n=u.getOwner();let a,s=!!u.sharedConfig.context;return u.createEffect(()=>{s&&(u.getOwner().user=s=!1),a||(a=u.runWithOwner(n,()=>u.createMemo(()=>e.children)));const o=r();if(o instanceof HTMLHeadElement){const[i,B]=u.createSignal(!1),c=()=>B(!0);u.createRoot(l=>y(o,()=>i()?l():a(),null)),u.onCleanup(c)}else{const i=Ts(e.isSVG?"g":"div",e.isSVG),B=A&&i.attachShadow?i.attachShadow({mode:"open"}):i;Object.defineProperty(i,"_$host",{get(){return t.parentNode},configurable:!0}),y(B,a),o.appendChild(i),e.ref&&e.ref(i),u.onCleanup(()=>o.removeChild(i))}},void 0,{render:!s}),t}const Ms=(e,A)=>{let t;return(...r)=>{clearTimeout(t),t=window.setTimeout(()=>e(...r),A)}},Rs=(e,A)=>{JA({event:"keydown",callback:t=>{t.key===e&&A(t)}})},JA=e=>{const{event:A,callback:t,onMount:r,onCleanup:n}=e,a=s=>{t(s)};u.onMount(()=>{r==null||r(),window.addEventListener(A,a)}),u.onCleanup(()=>{n==null||n(),window.removeEventListener(A,a)})},Nt=e=>{const{target:A,options:t,callback:r,onMount:n,onCleanup:a}=e,s=new MutationObserver(r);u.onMount(()=>{n==null||n(),s.observe(A,t)}),u.onCleanup(()=>{a==null||a(),s.disconnect()})},ks="echo_",RA="echo_page_state",$r=()=>{window.dispatchEvent(new CustomEvent("echo-storage-change"))},jr=e=>`${ks}${e}`,qr=(e,A)=>{try{const t=localStorage.getItem(jr(e));return t?JSON.parse(t):A}catch{return A}},Vt=(e,A)=>{try{localStorage.setItem(jr(e),JSON.stringify(A))}catch(t){console.warn("Failed to save to localStorage:",t)}},Pt=()=>window.location.pathname,Gs=(e,A)=>{try{const t=localStorage.getItem(RA),r=t?JSON.parse(t):{};if(!A.feedback.comment&&(!A.drawing.shapes||A.drawing.shapes.length===0))delete r[e];else{const n=window.location.search||void 0,a={feedback:{comment:A.feedback.comment},drawing:{shapes:A.drawing.shapes},latestQuery:n};r[e]=a}localStorage.setItem(RA,JSON.stringify(r)),$r()}catch(t){console.error("Failed to save page state:",t)}},Xt=e=>{try{const A=localStorage.getItem(RA);return A&&JSON.parse(A)[e]||null}catch(A){return console.error("Failed to load page state:",A),null}},An=e=>{try{const A=localStorage.getItem(RA);if(!A)return;const t=JSON.parse(A);delete t[e],localStorage.setItem(RA,JSON.stringify(t)),$r()}catch(A){console.error("Failed to clear page state:",A)}},en=()=>{try{const e=localStorage.getItem(RA);if(!e)return 0;const A=JSON.parse(e);return Object.keys(A).length}catch(e){return console.error("Failed to get stored pages count:",e),0}},_t=()=>{try{const e=localStorage.getItem(RA);if(!e)return[];const A=JSON.parse(e);return Object.entries(A).map(([t,r])=>({path:t,state:r}))}catch(e){return console.error("Failed to get stored pages:",e),[]}},Yt=Symbol("store-raw"),zA=Symbol("store-node"),wA=Symbol("store-has"),tn=Symbol("store-self");function rn(e){let A=e[u.$PROXY];if(!A&&(Object.defineProperty(e,u.$PROXY,{value:A=new Proxy(e,Ps)}),!Array.isArray(e))){const t=Object.keys(e),r=Object.getOwnPropertyDescriptors(e);for(let n=0,a=t.length;n<a;n++){const s=t[n];r[s].get&&Object.defineProperty(e,s,{enumerable:r[s].enumerable,get:r[s].get.bind(A)})}}return A}function Ne(e){let A;return e!=null&&typeof e=="object"&&(e[u.$PROXY]||!(A=Object.getPrototypeOf(e))||A===Object.prototype||Array.isArray(e))}function de(e,A=new Set){let t,r,n,a;if(t=e!=null&&e[Yt])return t;if(!Ne(e)||A.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):A.add(e);for(let s=0,o=e.length;s<o;s++)n=e[s],(r=de(n,A))!==n&&(e[s]=r)}else{Object.isFrozen(e)?e=Object.assign({},e):A.add(e);const s=Object.keys(e),o=Object.getOwnPropertyDescriptors(e);for(let i=0,B=s.length;i<B;i++)a=s[i],!o[a].get&&(n=e[a],(r=de(n,A))!==n&&(e[a]=r))}return e}function Ve(e,A){let t=e[A];return t||Object.defineProperty(e,A,{value:t=Object.create(null)}),t}function Qe(e,A,t){if(e[A])return e[A];const[r,n]=u.createSignal(t,{equals:!1,internal:!0});return r.$=n,e[A]=r}function Ns(e,A){const t=Reflect.getOwnPropertyDescriptor(e,A);return!t||t.get||!t.configurable||A===u.$PROXY||A===zA||(delete t.value,delete t.writable,t.get=()=>e[u.$PROXY][A]),t}function nn(e){u.getListener()&&Qe(Ve(e,zA),tn)()}function Vs(e){return nn(e),Reflect.ownKeys(e)}const Ps={get(e,A,t){if(A===Yt)return e;if(A===u.$PROXY)return t;if(A===u.$TRACK)return nn(e),t;const r=Ve(e,zA),n=r[A];let a=n?n():e[A];if(A===zA||A===wA||A==="__proto__")return a;if(!n){const s=Object.getOwnPropertyDescriptor(e,A);u.getListener()&&(typeof a!="function"||e.hasOwnProperty(A))&&!(s&&s.get)&&(a=Qe(r,A,a)())}return Ne(a)?rn(a):a},has(e,A){return A===Yt||A===u.$PROXY||A===u.$TRACK||A===zA||A===wA||A==="__proto__"?!0:(u.getListener()&&Qe(Ve(e,wA),A)(),A in e)},set(){return!0},deleteProperty(){return!0},ownKeys:Vs,getOwnPropertyDescriptor:Ns};function Pe(e,A,t,r=!1){if(!r&&e[A]===t)return;const n=e[A],a=e.length;t===void 0?(delete e[A],e[wA]&&e[wA][A]&&n!==void 0&&e[wA][A].$()):(e[A]=t,e[wA]&&e[wA][A]&&n===void 0&&e[wA][A].$());let s=Ve(e,zA),o;if((o=Qe(s,A,n))&&o.$(()=>t),Array.isArray(e)&&e.length!==a){for(let i=e.length;i<a;i++)(o=s[i])&&o.$();(o=Qe(s,"length",a))&&o.$(e.length)}(o=s[tn])&&o.$()}function an(e,A){const t=Object.keys(A);for(let r=0;r<t.length;r+=1){const n=t[r];Pe(e,n,A[n])}}function Xs(e,A){if(typeof A=="function"&&(A=A(e)),A=de(A),Array.isArray(A)){if(e===A)return;let t=0,r=A.length;for(;t<r;t++){const n=A[t];e[t]!==n&&Pe(e,t,n)}Pe(e,"length",r)}else an(e,A)}function he(e,A,t=[]){let r,n=e;if(A.length>1){r=A.shift();const s=typeof r,o=Array.isArray(e);if(Array.isArray(r)){for(let i=0;i<r.length;i++)he(e,[r[i]].concat(A),t);return}else if(o&&s==="function"){for(let i=0;i<e.length;i++)r(e[i],i)&&he(e,[i].concat(A),t);return}else if(o&&s==="object"){const{from:i=0,to:B=e.length-1,by:c=1}=r;for(let l=i;l<=B;l+=c)he(e,[l].concat(A),t);return}else if(A.length>1){he(e[r],A,[r].concat(t));return}n=e[r],t=[r].concat(t)}let a=A[0];typeof a=="function"&&(a=a(n,t),a===n)||r===void 0&&a==null||(a=de(a),r===void 0||Ne(n)&&Ne(a)&&!Array.isArray(a)?an(n,a):Pe(e,r,a))}function Wt(...[e,A]){const t=de(e||{}),r=Array.isArray(t),n=rn(t);function a(...s){u.batch(()=>{r&&s.length===1?Xs(t,s[0]):he(t,s)})}return[n,a]}const mA={rectangle:{id:"rectangle",label:"Highlight",getCursor:()=>"crosshair",strokeWidth:2,opacity:{selected:1,default:1}},path:{id:"path",label:"Pen",getCursor:e=>`url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48" fill="none" stroke="${e.replace("#","%23")}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="24" cy="24" r="8"/></svg>') 24 24, auto`,strokeWidth:6,opacity:{selected:.6,default:1}}},_s=e=>{const A=e.replace("#",""),t=Number.parseInt(A.slice(0,2),16)/255,r=Number.parseInt(A.slice(2,2),16)/255,n=Number.parseInt(A.slice(4,2),16)/255;return .2126*t+.7152*r+.0722*n},Ys=e=>_s(e)<.5?"#FFFFFF":"#000000",sn=(e,A)=>{if(!A)return e;const t={...e};for(const r in A)A[r]&&typeof A[r]=="object"&&!Array.isArray(A[r])?t[r]=sn(e[r],A[r]):t[r]=A[r];return t};let dA=[],cA=null,$A=null,jA=null;const Zt=(e,A)=>(...t)=>{const r=t.map(n=>typeof n=="string"?n:n instanceof Error?n.stack||n.message:JSON.stringify(n)).join(" ");dA.push({type:e,message:r,timestamp:new Date().toISOString()}),dA.length>1e3&&(dA=dA.slice(-1e3)),A.apply(console,t)},Ws=()=>{cA||(cA={log:console.log,warn:console.warn,error:console.error},$A=window.onerror,jA=window.onunhandledrejection,window.onerror=(e,A,t,r,n)=>{const a=(n==null?void 0:n.stack)||(n==null?void 0:n.message)||e;return dA.push({type:"error",message:`Uncaught Error: ${a}
2
2
  Location: ${A}:${t}:${r}`,timestamp:new Date().toISOString()}),$A?$A(e,A,t,r,n):!1},window.onunhandledrejection=e=>{const A=e.reason;dA.push({type:"error",message:`Unhandled Promise Rejection: ${(A==null?void 0:A.stack)||(A==null?void 0:A.message)||A}`,timestamp:new Date().toISOString()}),jA&&jA(e)},console.log=Zt("log",cA.log),console.warn=Zt("warn",cA.warn),console.error=Zt("error",cA.error),window.addEventListener("error",e=>{const{message:A,filename:t,lineno:r,colno:n,error:a}=e,s=(a==null?void 0:a.stack)||(a==null?void 0:a.message)||A;dA.push({type:"error",message:`Uncaught Error: ${s}
3
3
  Location: ${t}:${r}:${n}`,timestamp:new Date().toISOString()})}))},Zs=()=>{cA&&(console.log=cA.log,console.warn=cA.warn,console.error=cA.error,cA=null),$A&&(window.onerror=$A,$A=null),jA&&(window.onunhandledrejection=jA,jA=null),window.removeEventListener("error",()=>{}),dA=[]},on=()=>[...dA],Bn=()=>{var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||((e=window.matchMedia)==null?void 0:e.call(window,"(max-width: 768px)").matches)},Xe=(e,{useClientCoords:A=!1}={})=>{const r=typeof TouchEvent<"u"&&e instanceof TouchEvent?e.touches[0]:null;return{x:r?A?r.clientX:r.pageX:A?e.clientX:e.pageX,y:r?A?r.clientY:r.pageY:A?e.clientY:e.pageY}},cn=(e,A)=>{const t=A.x-e.x,r=A.y-e.y;return Math.sqrt(t*t+r*r)},ln=e=>{if(e.length!==2)return null;const[A,t]=e;return{x:Math.min(A.x,t.x),y:Math.min(A.y,t.y),width:Math.abs(t.x-A.x),height:Math.abs(t.y-A.y)}},Js=e=>e.length<2?null:`M ${e[0].x} ${e[0].y} ${e.slice(1).map(A=>`L ${A.x} ${A.y}`).join(" ")}`;/*!
4
4
  * html2canvas 1.4.1 <https://html2canvas.hertzen.com>
@@ -1,4 +1,4 @@
1
- export declare const registerKeyListener: (key: string, callback: () => void) => void;
1
+ export declare const registerKeyListener: (key: string, callback: (e: KeyboardEvent) => void) => void;
2
2
  export declare const registerWindowEventListener: {
3
3
  <K extends keyof WindowEventMap>(props: {
4
4
  event: K;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@contember/echo",
3
3
  "license": "Apache-2.0",
4
- "version": "0.0.22",
4
+ "version": "0.0.23",
5
5
  "type": "module",
6
6
  "author": "neumie@neumie.dev",
7
7
  "keywords": [