tosijs-ui 1.3.6 → 1.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/iife.js CHANGED
@@ -73,7 +73,7 @@ ${l}</tr>
73
73
  `+this.renderer.text(r);y?s+=this.renderer.paragraph({type:"paragraph",raw:c,text:c,tokens:[{type:"text",raw:c,text:c,escaped:!0}]}):s+=c;continue}default:{let r='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(r),"";throw Error(r)}}}return s}parseInline(i,y=this.renderer){let s="";for(let h=0;h<i.length;h++){let x=i[h];if(this.options.extensions?.renderers?.[x.type]){let r=this.options.extensions.renderers[x.type].call({parser:this},x);if(r!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(x.type)){s+=r||"";continue}}let o=x;switch(o.type){case"escape":{s+=y.text(o);break}case"html":{s+=y.html(o);break}case"link":{s+=y.link(o);break}case"image":{s+=y.image(o);break}case"strong":{s+=y.strong(o);break}case"em":{s+=y.em(o);break}case"codespan":{s+=y.codespan(o);break}case"br":{s+=y.br(o);break}case"del":{s+=y.del(o);break}case"text":{s+=y.text(o);break}default:{let r='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(r),"";throw Error(r)}}}return s}},H2=class{options;block;constructor(l){this.options=l||m1}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(l){return l}postprocess(l){return l}processAllTokens(l){return l}emStrongMask(l){return l}provideLexer(){return this.block?o1.lex:o1.lexInline}provideParser(){return this.block?r1.parse:r1.parseInline}},o8=class{defaults=y5();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=r1;Renderer=O0;TextRenderer=g5;Lexer=o1;Tokenizer=F0;Hooks=H2;constructor(...l){this.use(...l)}walkTokens(l,i){let y=[];for(let s of l)switch(y=y.concat(i.call(this,s)),s.type){case"table":{let h=s;for(let x of h.header)y=y.concat(this.walkTokens(x.tokens,i));for(let x of h.rows)for(let o of x)y=y.concat(this.walkTokens(o.tokens,i));break}case"list":{let h=s;y=y.concat(this.walkTokens(h.items,i));break}default:{let h=s;this.defaults.extensions?.childTokens?.[h.type]?this.defaults.extensions.childTokens[h.type].forEach((x)=>{let o=h[x].flat(1/0);y=y.concat(this.walkTokens(o,i))}):h.tokens&&(y=y.concat(this.walkTokens(h.tokens,i)))}}return y}use(...l){let i=this.defaults.extensions||{renderers:{},childTokens:{}};return l.forEach((y)=>{let s={...y};if(s.async=this.defaults.async||s.async||!1,y.extensions&&(y.extensions.forEach((h)=>{if(!h.name)throw Error("extension name required");if("renderer"in h){let x=i.renderers[h.name];x?i.renderers[h.name]=function(...o){let r=h.renderer.apply(this,o);return r===!1&&(r=x.apply(this,o)),r}:i.renderers[h.name]=h.renderer}if("tokenizer"in h){if(!h.level||h.level!=="block"&&h.level!=="inline")throw Error("extension level must be 'block' or 'inline'");let x=i[h.level];x?x.unshift(h.tokenizer):i[h.level]=[h.tokenizer],h.start&&(h.level==="block"?i.startBlock?i.startBlock.push(h.start):i.startBlock=[h.start]:h.level==="inline"&&(i.startInline?i.startInline.push(h.start):i.startInline=[h.start]))}"childTokens"in h&&h.childTokens&&(i.childTokens[h.name]=h.childTokens)}),s.extensions=i),y.renderer){let h=this.defaults.renderer||new O0(this.defaults);for(let x in y.renderer){if(!(x in h))throw Error(`renderer '${x}' does not exist`);if(["options","parser"].includes(x))continue;let o=x,r=y.renderer[o],c=h[o];h[o]=(...C)=>{let g=r.apply(h,C);return g===!1&&(g=c.apply(h,C)),g||""}}s.renderer=h}if(y.tokenizer){let h=this.defaults.tokenizer||new F0(this.defaults);for(let x in y.tokenizer){if(!(x in h))throw Error(`tokenizer '${x}' does not exist`);if(["options","rules","lexer"].includes(x))continue;let o=x,r=y.tokenizer[o],c=h[o];h[o]=(...C)=>{let g=r.apply(h,C);return g===!1&&(g=c.apply(h,C)),g}}s.tokenizer=h}if(y.hooks){let h=this.defaults.hooks||new H2;for(let x in y.hooks){if(!(x in h))throw Error(`hook '${x}' does not exist`);if(["options","block"].includes(x))continue;let o=x,r=y.hooks[o],c=h[o];H2.passThroughHooks.has(x)?h[o]=(C)=>{if(this.defaults.async&&H2.passThroughHooksRespectAsync.has(x))return(async()=>{let k=await r.call(h,C);return c.call(h,k)})();let g=r.call(h,C);return c.call(h,g)}:h[o]=(...C)=>{if(this.defaults.async)return(async()=>{let k=await r.apply(h,C);return k===!1&&(k=await c.apply(h,C)),k})();let g=r.apply(h,C);return g===!1&&(g=c.apply(h,C)),g}}s.hooks=h}if(y.walkTokens){let h=this.defaults.walkTokens,x=y.walkTokens;s.walkTokens=function(o){let r=[];return r.push(x.call(this,o)),h&&(r=r.concat(h.call(this,o))),r}}this.defaults={...this.defaults,...s}}),this}setOptions(l){return this.defaults={...this.defaults,...l},this}lexer(l,i){return o1.lex(l,i??this.defaults)}parser(l,i){return r1.parse(l,i??this.defaults)}parseMarkdown(l){return(i,y)=>{let s={...y},h={...this.defaults,...s},x=this.onError(!!h.silent,!!h.async);if(this.defaults.async===!0&&s.async===!1)return x(Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof i>"u"||i===null)return x(Error("marked(): input parameter is undefined or null"));if(typeof i!="string")return x(Error("marked(): input parameter is of type "+Object.prototype.toString.call(i)+", string expected"));if(h.hooks&&(h.hooks.options=h,h.hooks.block=l),h.async)return(async()=>{let o=h.hooks?await h.hooks.preprocess(i):i,r=await(h.hooks?await h.hooks.provideLexer():l?o1.lex:o1.lexInline)(o,h),c=h.hooks?await h.hooks.processAllTokens(r):r;h.walkTokens&&await Promise.all(this.walkTokens(c,h.walkTokens));let C=await(h.hooks?await h.hooks.provideParser():l?r1.parse:r1.parseInline)(c,h);return h.hooks?await h.hooks.postprocess(C):C})().catch(x);try{h.hooks&&(i=h.hooks.preprocess(i));let o=(h.hooks?h.hooks.provideLexer():l?o1.lex:o1.lexInline)(i,h);h.hooks&&(o=h.hooks.processAllTokens(o)),h.walkTokens&&this.walkTokens(o,h.walkTokens);let r=(h.hooks?h.hooks.provideParser():l?r1.parse:r1.parseInline)(o,h);return h.hooks&&(r=h.hooks.postprocess(r)),r}catch(o){return x(o)}}}onError(l,i){return(y)=>{if(y.message+=`
74
74
  Please report this to https://github.com/markedjs/marked.`,l){let s="<p>An error occurred:</p><pre>"+j1(y.message+"",!0)+"</pre>";return i?Promise.resolve(s):s}if(i)return Promise.reject(y);throw y}}},u1=new o8;function X(l,i){return u1.parse(l,i)}X.options=X.setOptions=function(l){return u1.setOptions(l),X.defaults=u1.defaults,pl(X.defaults),X};X.getDefaults=y5;X.defaults=m1;X.use=function(...l){return u1.use(...l),X.defaults=u1.defaults,pl(X.defaults),X};X.walkTokens=function(l,i){return u1.walkTokens(l,i)};X.parseInline=u1.parseInline;X.Parser=r1;X.parser=r1.parse;X.Renderer=O0;X.TextRenderer=g5;X.Lexer=o1;X.lexer=o1.lex;X.Tokenizer=F0;X.Hooks=H2;X.parse=X;var{options:Vs,setOptions:qs,use:_s,walkTokens:Ps,parseInline:Fs}=X;var Os=r1.parse,Us=o1.lex;function _l(l,i){if(i==null)i="";else if(typeof i!=="string")i=String(i);return i.replace(/\{\{([^}]+)\}\}/g,(y,s)=>{let h=e[`${l}${s.startsWith("[")?s:"."+s}`];return h===void 0?y:_l(l,String(h))})}class N0 extends t{static preferredTagName="tosi-md";static initAttributes={src:"",elements:!1};context={};value="";content=null;options={};connectedCallback(){if(super.connectedCallback(),this.src!=="")(async()=>{let l=await fetch(this.src);this.value=await l.text()})();else if(this.value==="")if(this.elements)this.value=this.innerHTML;else this.value=this.textContent!=null?this.textContent:""}didRender=()=>{};render(){super.render(),e[this.instanceId]=typeof this.context==="string"?JSON.parse(this.context):this.context;let l=_l(this.instanceId,this.value);if(this.elements){let i=l.split(`
75
75
  `).reduce((y,s)=>{if(s.startsWith("<")||y.length===0)y.push(s);else{let h=y[y.length-1];if(!h.startsWith("<")||!h.endsWith(">"))y[y.length-1]+=`
76
- `+s;else y.push(s)}return y},[]);this.innerHTML=i.map((y)=>y.startsWith("<")&&y.endsWith(">")?y:X(y,this.options)).join("")}else this.innerHTML=X(l,this.options);this.didRender()}}var r8=N0,w2=N0.elementCreator(),c8=w2,C8=w2;var{div:L1,slot:Pl,span:g8,button:n8}=a;class K0 extends t{static preferredTagName="tosi-tabs";static initAttributes={localized:!1};value=0;makeTab(l,i,y){let s=i.getAttribute("name"),h=i.querySelector('template[role="tab"]')?.content.cloneNode(!0)||(this.localized?z1(s):g8(s));return L1(h,{part:"tab",tabindex:0,role:"tab",ariaControls:y},i.hasAttribute("data-close")?n8({title:"close",class:"close"},w.x()):{})}static shadowStyleSpec={":host":{"--tosi-tabs-selected-color":"var(--xin-tabs-selected-color, var(--tosi-accent, currentColor))","--tosi-tabs-bar-color":"var(--xin-tabs-bar-color, #ccc)","--tosi-tabs-bar-height":"var(--xin-tabs-bar-height, 2px)",display:"flex",flexDirection:"column",position:"relative",overflow:"hidden",boxShadow:"none !important"},slot:{position:"relative",display:"block",flex:"1",overflow:"hidden",overflowY:"auto"},'slot[name="after-tabs"]':{flex:"0 0 auto"},"::slotted([hidden])":{display:"none !important"},":host::part(tabpanel)":{display:"flex",flexDirection:"column",overflowX:"auto"},":host::part(tabrow)":{display:"flex"},":host .tabs":{display:"flex",userSelect:"none",whiteSpace:"nowrap"},":host .tabs > div":{padding:`${n.spacing50} ${n.spacing}`,cursor:"default",display:"flex",alignItems:"baseline"},':host .tabs > [aria-selected="true"]':{"--text-color":n.tosiTabsSelectedColor,color:n.textColor},":host .elastic":{flex:"1"},":host .border":{background:n.tosiTabsBarColor},":host .border > .selected":{content:" ",width:0,height:n.tosiTabsBarHeight,background:n.tosiTabsSelectedColor,transition:"ease-out 0.2s"},":host button.close":{border:0,background:"transparent",textAlign:"center",marginLeft:n.spacing50,padding:0},":host button.close > svg":{height:"12px"}};onCloseTab=null;content=[L1({role:"tabpanel",part:"tabpanel"},L1({part:"tabrow"},L1({class:"tabs",part:"tabs"}),L1({class:"elastic"}),Pl({name:"after-tabs"})),L1({class:"border"},L1({class:"selected",part:"selected"}))),Pl()];addTabBody(l,i=!1){if(!l.hasAttribute("name"))throw console.error("element has no name attribute",l),Error("element has no name attribute");if(this.append(l),this.setupTabs(),i)this.value=this.bodies.length-1;this.queueRender()}removeTabBody(l){l.remove(),this.setupTabs(),this.queueRender()}keyTab=(l)=>{let{tabs:i}=this.parts,y=[...i.children].indexOf(l.target);switch(l.key){case"ArrowLeft":this.value=(y+Number(i.children.length)-1)%i.children.length,i.children[this.value].focus(),l.preventDefault();break;case"ArrowRight":this.value=(y+1)%i.children.length,i.children[this.value].focus(),l.preventDefault();break;case" ":this.pickTab(l),l.preventDefault();break;default:}};get bodies(){return[...this.children].filter((l)=>l.hasAttribute("name"))}pickTab=(l)=>{let{tabs:i}=this.parts,y=l.target,s=y.closest("button.close")!==null,h=y.closest(".tabs > div"),x=[...i.children].indexOf(h);if(s){let o=this.bodies[x];if(!this.onCloseTab||this.onCloseTab(o)!==!1)this.removeTabBody(this.bodies[x])}else if(x>-1)this.value=x};setupTabs=()=>{let{tabs:l}=this.parts,i=[...this.children].filter((y)=>!y.hasAttribute("slot")&&y.hasAttribute("name"));if(l.textContent="",this.value>=i.length)this.value=i.length-1;for(let y in i){let s=i[y],h=`${this.instanceId}-${y}`;s.id=h;let x=this.makeTab(this,s,h);l.append(x)}};connectedCallback(){super.connectedCallback();let{tabs:l}=this.parts;l.addEventListener("click",this.pickTab),l.addEventListener("keydown",this.keyTab),this.setupTabs(),t1.allInstances.add(this)}disconnectedCallback(){super.disconnectedCallback(),t1.allInstances.delete(this)}localeChanged=()=>{this.queueRender()};onResize(){this.queueRender()}render(){let{tabs:l,selected:i}=this.parts,y=this.bodies;for(let s=0;s<y.length;s++){let h=y[s],x=l.children[s];if(this.value===Number(s))x.setAttribute("aria-selected","true"),i.style.marginLeft=`${x.offsetLeft-l.offsetLeft}px`,i.style.width=`${x.offsetWidth}px`,h.toggleAttribute("hidden",!1);else x.toggleAttribute("aria-selected",!1),h.toggleAttribute("hidden",!0)}}}var k8=K0,e2=K0.elementCreator(),d8=e2,p8=e2;var w8=()=>"https://cdn.jsdelivr.net/npm/sucrase@3.35.0/+esm",I2=(async()=>{}).constructor;function Q1(l,i){let y=l;for(let s of i)y=y.replace(new RegExp(`import \\{([\\s\\S]*?)\\} from '${s}'`,"g"),(h,x)=>{return`const { ${x.replace(/\s+/g," ").trim()} } = ${s.replace(/-/g,"")}`});return y}async function Fl(l,i,y){let s=Q1(l,Object.keys(i)),h=y(s,{transforms:["typescript"]}).code,x=Object.keys(i).map((c)=>c.replace(/-/g,"")),o=Object.values(i);await new I2(...x,h)(...o)}async function Q0(){let{transform:l}=await import(w8());return l}var G0="live-example-payload";function Ol(l,i,y){return y!==""?`${l}-${y}`:`${l}-${i}`}function n5(l,i){try{localStorage.setItem(l,JSON.stringify(i))}catch(y){console.warn("live-example: failed to write to localStorage",y)}}function a8(l){if(l===null)return null;try{return JSON.parse(l)}catch{return null}}function Ul(l,i,y,s,h){let x=location.href.split("?")[0]+`?${l}=${i}`;n5(y,{remoteKey:s,sentAt:Date.now(),...h}),window.open(x)}var v8=typeof BroadcastChannel<"u";class Y2{storageKey;remoteKey;lastUpdate=0;interval;channel;listening=!1;onReceive;constructor(l,i,y){this.storageKey=l,this.remoteKey=i,this.onReceive=y}handlePayload=(l)=>{if(l.sentAt<=this.lastUpdate)return;if(l.remoteKey!==this.remoteKey)return;this.lastUpdate=l.sentAt,this.onReceive(l)};handleMessage=(l)=>{let i=l.data;if(i)this.handlePayload(i)};handlePoll=()=>{let l=null;try{l=localStorage.getItem(this.storageKey)}catch{return}let i=a8(l);if(i)this.handlePayload(i)};startListening(){if(this.listening)return;if(this.listening=!0,v8)this.channel=new BroadcastChannel(this.storageKey),this.channel.onmessage=this.handleMessage;this.interval=setInterval(this.handlePoll,500)}stopListening(){if(!this.listening)return;if(this.listening=!1,this.channel)this.channel.close(),this.channel=void 0;if(this.interval)clearInterval(this.interval),this.interval=void 0}send(l){let i={remoteKey:this.remoteKey,sentAt:Date.now(),...l};if(n5(this.storageKey,i),this.channel)this.channel.postMessage(i)}sendClose(){let l={remoteKey:this.remoteKey,sentAt:Date.now(),css:"",html:"",js:"",close:!0};if(n5(this.storageKey,l),this.channel)this.channel.postMessage(l)}}var{div:B8}=a;function t8(l,i){let y=l.customElements;if(!y)return;let s=(x)=>{if(!x||y.get(x))return;let o=customElements.get(x);if(o)try{y.define(x,o)}catch{}};for(let x of Object.values(i))if(x&&typeof x==="object"){for(let o of Object.values(x))if(typeof o==="function"&&"tagName"in o)s(o.tagName)}let h=l.document;if(h){let x=h.querySelectorAll("*");for(let o of x){let r=o.tagName.toLowerCase();if(r.includes("-"))s(r)}}}async function b0(l){let{html:i,css:y,js:s,context:h,transform:x,exampleElement:o,styleElement:r,widgetsElement:c,onError:C}=l,g=B8({class:"preview"});g.innerHTML=i,r.innerText=y;let k=o.querySelector(".preview");if(k)k.replaceWith(g);else o.insertBefore(g,c);let p={preview:g,...h};try{let z=Q1(s,Object.keys(h)),v=x(z,{transforms:["typescript"]}).code,V=Object.keys(p).map((q)=>q.replace(/-/g,"")),P=Object.values(p);await new I2(...V,v)(...P)}catch(z){if(console.error(z),C)C(z);else window.alert(`Error: ${z}, the console may have more information…`)}return g}async function W0(l){let{html:i,css:y,js:s,context:h,transform:x,exampleElement:o,widgetsElement:r,onError:c}=l,C=o.querySelector("iframe.preview-iframe");if(!C){C=document.createElement("iframe"),C.className="preview-iframe",C.style.cssText="width: 100%; height: 100%; border: none;";let v=o.querySelector(".preview");if(v)v.replaceWith(C);else o.insertBefore(C,r)}let g=C.contentDocument;if(!g)return console.error("Could not access iframe document"),null;let k=C.contentWindow;if(h.tosijs)k.tosijs=h.tosijs;if(h["tosijs-ui"])k.tosijsui=h["tosijs-ui"];g.open(),g.write(`<!DOCTYPE html>
76
+ `+s;else y.push(s)}return y},[]);this.innerHTML=i.map((y)=>y.startsWith("<")&&y.endsWith(">")?y:X(y,this.options)).join("")}else this.innerHTML=X(l,this.options);this.didRender()}}var r8=N0,w2=N0.elementCreator(),c8=w2,C8=w2;var{div:L1,slot:Pl,span:g8,button:n8}=a;class K0 extends t{static preferredTagName="tosi-tabs";static initAttributes={localized:!1};value=0;makeTab(l,i,y){let s=i.getAttribute("name"),h=i.querySelector('template[role="tab"]')?.content.cloneNode(!0)||(this.localized?z1(s):g8(s));return L1(h,{part:"tab",tabindex:0,role:"tab",ariaControls:y},i.hasAttribute("data-close")?n8({title:"close",class:"close"},w.x()):{})}static shadowStyleSpec={":host":{"--tosi-tabs-selected-color":"var(--xin-tabs-selected-color, var(--tosi-accent, currentColor))","--tosi-tabs-bar-color":"var(--xin-tabs-bar-color, #ccc)","--tosi-tabs-bar-height":"var(--xin-tabs-bar-height, 2px)",display:"flex",flexDirection:"column",position:"relative",overflow:"hidden",boxShadow:"none !important"},slot:{position:"relative",display:"block",flex:"1",overflow:"hidden",overflowY:"auto"},'slot[name="after-tabs"]':{flex:"0 0 auto"},"::slotted([hidden])":{display:"none !important"},":host::part(tabpanel)":{display:"flex",flexDirection:"column",overflowX:"auto"},":host::part(tabrow)":{display:"flex"},":host .tabs":{display:"flex",userSelect:"none",whiteSpace:"nowrap"},":host .tabs > div":{padding:`${n.spacing50} ${n.spacing}`,cursor:"default",display:"flex",alignItems:"baseline"},':host .tabs > [aria-selected="true"]':{"--text-color":n.tosiTabsSelectedColor,color:n.textColor},":host .elastic":{flex:"1"},":host .border":{background:n.tosiTabsBarColor},":host .border > .selected":{content:" ",width:0,height:n.tosiTabsBarHeight,background:n.tosiTabsSelectedColor,transition:"ease-out 0.2s"},":host button.close":{border:0,background:"transparent",textAlign:"center",marginLeft:n.spacing50,padding:0},":host button.close > svg":{height:"12px"}};onCloseTab=null;content=[L1({role:"tabpanel",part:"tabpanel"},L1({part:"tabrow"},L1({class:"tabs",part:"tabs"}),L1({class:"elastic"}),Pl({name:"after-tabs"})),L1({class:"border"},L1({class:"selected",part:"selected"}))),Pl()];addTabBody(l,i=!1){if(!l.hasAttribute("name"))throw console.error("element has no name attribute",l),Error("element has no name attribute");if(this.append(l),this.setupTabs(),i)this.value=this.bodies.length-1;this.queueRender()}removeTabBody(l){l.remove(),this.setupTabs(),this.queueRender()}keyTab=(l)=>{let{tabs:i}=this.parts,y=[...i.children].indexOf(l.target);switch(l.key){case"ArrowLeft":this.value=(y+Number(i.children.length)-1)%i.children.length,i.children[this.value].focus(),l.preventDefault();break;case"ArrowRight":this.value=(y+1)%i.children.length,i.children[this.value].focus(),l.preventDefault();break;case" ":this.pickTab(l),l.preventDefault();break;default:}};get bodies(){return[...this.children].filter((l)=>l.hasAttribute("name"))}pickTab=(l)=>{let{tabs:i}=this.parts,y=l.target,s=y.closest("button.close")!==null,h=y.closest(".tabs > div"),x=[...i.children].indexOf(h);if(s){let o=this.bodies[x];if(!this.onCloseTab||this.onCloseTab(o)!==!1)this.removeTabBody(this.bodies[x])}else if(x>-1)this.value=x};setupTabs=()=>{let{tabs:l}=this.parts,i=[...this.children].filter((y)=>!y.hasAttribute("slot")&&y.hasAttribute("name"));if(l.textContent="",this.value>=i.length)this.value=i.length-1;for(let y in i){let s=i[y],h=`${this.instanceId}-${y}`;s.id=h;let x=this.makeTab(this,s,h);l.append(x)}};connectedCallback(){super.connectedCallback();let{tabs:l}=this.parts;l.addEventListener("click",this.pickTab),l.addEventListener("keydown",this.keyTab),this.setupTabs(),t1.allInstances.add(this)}disconnectedCallback(){super.disconnectedCallback(),t1.allInstances.delete(this)}localeChanged=()=>{this.queueRender()};onResize(){this.queueRender()}render(){let{tabs:l,selected:i}=this.parts,y=this.bodies;for(let s=0;s<y.length;s++){let h=y[s],x=l.children[s];if(this.value===Number(s))x.setAttribute("aria-selected","true"),i.style.marginLeft=`${x.offsetLeft-l.offsetLeft}px`,i.style.width=`${x.offsetWidth}px`,h.toggleAttribute("hidden",!1);else x.toggleAttribute("aria-selected",!1),h.toggleAttribute("hidden",!0)}}}var k8=K0,e2=K0.elementCreator(),d8=e2,p8=e2;var w8=()=>"https://cdn.jsdelivr.net/npm/sucrase@3.35.0/+esm",I2=(async()=>{}).constructor;function Q1(l,i){let y=l;for(let s of i)y=y.replace(new RegExp(`import \\{([^}]*)\\} from '${s}'`,"g"),(h,x)=>{return`const { ${x.replace(/\s+/g," ").trim()} } = ${s.replace(/-/g,"")}`});return y}async function Fl(l,i,y){let s=Q1(l,Object.keys(i)),h=y(s,{transforms:["typescript"]}).code,x=Object.keys(i).map((c)=>c.replace(/-/g,"")),o=Object.values(i);await new I2(...x,h)(...o)}async function Q0(){let{transform:l}=await import(w8());return l}var G0="live-example-payload";function Ol(l,i,y){return y!==""?`${l}-${y}`:`${l}-${i}`}function n5(l,i){try{localStorage.setItem(l,JSON.stringify(i))}catch(y){console.warn("live-example: failed to write to localStorage",y)}}function a8(l){if(l===null)return null;try{return JSON.parse(l)}catch{return null}}function Ul(l,i,y,s,h){let x=location.href.split("?")[0]+`?${l}=${i}`;n5(y,{remoteKey:s,sentAt:Date.now(),...h}),window.open(x)}var v8=typeof BroadcastChannel<"u";class Y2{storageKey;remoteKey;lastUpdate=0;interval;channel;listening=!1;onReceive;constructor(l,i,y){this.storageKey=l,this.remoteKey=i,this.onReceive=y}handlePayload=(l)=>{if(l.sentAt<=this.lastUpdate)return;if(l.remoteKey!==this.remoteKey)return;this.lastUpdate=l.sentAt,this.onReceive(l)};handleMessage=(l)=>{let i=l.data;if(i)this.handlePayload(i)};handlePoll=()=>{let l=null;try{l=localStorage.getItem(this.storageKey)}catch{return}let i=a8(l);if(i)this.handlePayload(i)};startListening(){if(this.listening)return;if(this.listening=!0,v8)this.channel=new BroadcastChannel(this.storageKey),this.channel.onmessage=this.handleMessage;this.interval=setInterval(this.handlePoll,500)}stopListening(){if(!this.listening)return;if(this.listening=!1,this.channel)this.channel.close(),this.channel=void 0;if(this.interval)clearInterval(this.interval),this.interval=void 0}send(l){let i={remoteKey:this.remoteKey,sentAt:Date.now(),...l};if(n5(this.storageKey,i),this.channel)this.channel.postMessage(i)}sendClose(){let l={remoteKey:this.remoteKey,sentAt:Date.now(),css:"",html:"",js:"",close:!0};if(n5(this.storageKey,l),this.channel)this.channel.postMessage(l)}}var{div:B8}=a;function t8(l,i){let y=l.customElements;if(!y)return;let s=(x)=>{if(!x||y.get(x))return;let o=customElements.get(x);if(o)try{y.define(x,o)}catch{}};for(let x of Object.values(i))if(x&&typeof x==="object"){for(let o of Object.values(x))if(typeof o==="function"&&"tagName"in o)s(o.tagName)}let h=l.document;if(h){let x=h.querySelectorAll("*");for(let o of x){let r=o.tagName.toLowerCase();if(r.includes("-"))s(r)}}}async function b0(l){let{html:i,css:y,js:s,context:h,transform:x,exampleElement:o,styleElement:r,widgetsElement:c,onError:C}=l,g=B8({class:"preview"});g.innerHTML=i,r.innerText=y;let k=o.querySelector(".preview");if(k)k.replaceWith(g);else o.insertBefore(g,c);let p={preview:g,...h};try{let z=Q1(s,Object.keys(h)),v=x(z,{transforms:["typescript"]}).code,V=Object.keys(p).map((q)=>q.replace(/-/g,"")),P=Object.values(p);await new I2(...V,v)(...P)}catch(z){if(console.error(z),C)C(z);else window.alert(`Error: ${z}, the console may have more information…`)}return g}async function W0(l){let{html:i,css:y,js:s,context:h,transform:x,exampleElement:o,widgetsElement:r,onError:c}=l,C=o.querySelector("iframe.preview-iframe");if(!C){C=document.createElement("iframe"),C.className="preview-iframe",C.style.cssText="width: 100%; height: 100%; border: none;";let v=o.querySelector(".preview");if(v)v.replaceWith(C);else o.insertBefore(C,r)}let g=C.contentDocument;if(!g)return console.error("Could not access iframe document"),null;let k=C.contentWindow;if(h.tosijs)k.tosijs=h.tosijs;if(h["tosijs-ui"])k.tosijsui=h["tosijs-ui"];g.open(),g.write(`<!DOCTYPE html>
77
77
  <html>
78
78
  <head>
79
79
  <style>
@@ -94,7 +94,7 @@ ${x}`}).join(`
94
94
  `)}function y7(l){let i={};return l.input.onControllerAddedObservable.add((y)=>{y.onMotionControllerInitObservable.add((s)=>{let h={};s.getComponentIds().forEach((o)=>{let r=s.getComponent(o);if(h[o]={pressed:r.pressed,touched:r.touched,value:r.value,axes:{x:r.axes.x,y:r.axes.y}},r.onButtonStateChangedObservable.add((c)=>{h[o].pressed=c.pressed,h[o].touched=c.touched,h[o].value=c.value}),r.onAxisValueChangedObservable)r.onAxisValueChangedObservable.add((c)=>{h[o].axes={x:c.x,y:c.y}})}),i[s.handedness]=h})}),i}function s7(l){if(l===void 0||Object.keys(l).length===0)return"no xr inputs";return Object.keys(l).map((i)=>{let y=l[i],s=[];for(let[h,x]of Object.entries(y)){let o=[];if(x.pressed)o.push("P");if(x.touched)o.push("T");let r=x.value>0,c=x.axes.x!==0||x.axes.y!==0;if(o.length>0||r||c){let C=`${h}[${o.join("")}]`;if(r)C+=` v:${x.value.toFixed(2)}`;if(c)C+=` x:${x.axes.x.toFixed(2)} y:${x.axes.y.toFixed(2)}`;s.push(C)}}return`${i}
95
95
  ${s.join(`
96
96
  `)||"(idle)"}`}).join(`
97
- `)}var{div:h7}=a;class i2 extends t{static preferredTagName="tosi-map";static formAssociated=!0;static initAttributes={coords:"65.01715565258993,25.48081004203459,12",token:"",mapStyle:"mapbox://styles/mapbox/streets-v12",name:""};value="";formDisabledCallback(l){}formResetCallback(){this.value="",this.coords="65.01715565258993,25.48081004203459,12"}content=h7({style:{width:"100%",height:"100%"}});get map(){return this._map}static mapboxCSSAvailable;static mapboxAvailable;_map;static shadowStyleSpec={":host":{display:"inline-block",position:"relative",width:"400px",height:"400px",textAlign:"left"}};constructor(){super();if(i2.mapboxCSSAvailable===void 0)i2.mapboxCSSAvailable=n0("https://api.mapbox.com/mapbox-gl-js/v3.15.0/mapbox-gl.css").catch((l)=>{console.error("failed to load mapbox-gl.css",l)}),i2.mapboxAvailable=L("https://api.mapbox.com/mapbox-gl-js/v3.15.0/mapbox-gl.js").catch((l)=>{console.error("failed to load mapbox-gl.js",l)})}connectedCallback(){if(super.connectedCallback(),!this.token)console.error("mapbox requires an access token which you can provide via the token attribute")}_lastCoords="";_lastStyle="";render(){if(super.render(),!this.token)return;if(this._map){if(this.coords!==this._lastCoords){let[h,x,o]=this.coords.split(",").map((r)=>Number(r));this._map.setCenter([x,h]),this._map.setZoom(o),this._lastCoords=this.coords}if(this.mapStyle!==this._lastStyle)this._map.setStyle(this.mapStyle),this._lastStyle=this.mapStyle;return}let{div:l}=this.parts,[i,y,s]=this.coords.split(",").map((h)=>Number(h));this._lastCoords=this.coords,this._lastStyle=this.mapStyle,i2.mapboxAvailable.then(({mapboxgl:h})=>{console.log("%cmapbox may complain about missing css -- don't panic!","background: orange; color: black; padding: 0 5px;"),h.accessToken=this.token,this._map=new h.Map({container:l,style:this.mapStyle,zoom:s,center:[y,i]}),this._map.on("render",()=>this._map.resize()),this._map.on("moveend",()=>{let x=this._map.getCenter(),o=this._map.getZoom(),r=`${x.lat.toFixed(6)},${x.lng.toFixed(6)},${o.toFixed(1)}`;if(r!==this.value){if(this.internals)this.internals.setFormValue(r)}})})}}var x7=i2.elementCreator();var{div:q5,span:I0,button:_5}=a,T2=86400000,o7=[0,1,2,3,4,5,6],r7=[1,2,3,4,5,6,7,8,9,10,11,12],P5=(l,i=2,y="0")=>String(l).padStart(i,y),M2=(l,i,y)=>new Date(`${l}-${P5(i)}-${P5(y)}`);class F5 extends t{static preferredTagName="tosi-month";static lightStyleSpec={":host":{display:"block"},":host [part=header]":{display:"flex",alignItems:"stretch",justifyContent:"stretch"},":host[disabled]":{pointerEvents:"none",opacity:d.disabledOpacity(0.6)},':host [part="month"], :host [part="year"]':{_fieldWidth:"4em",flex:"1"},":host [part=week], :host [part=days]":{display:"grid",gridTemplateColumns:"auto auto auto auto auto auto auto",justifyItems:"stretch"},":host .today":{background:d.monthTodayBackground("transparent"),boxShadow:d.monthTodayShadow("none"),backdropFilter:d.monthTodayBackdropFilter("brightness(0.9)"),fontWeight:d.monthTodayFontWeight("800")},":host .day, :host .date":{padding:5,display:"flex",justifyContent:"center",userSelect:"none"},":host .day":{color:d.monthDayColor("hotpink"),background:d.monthDayBackground("white"),fontWeight:d.monthDayFontWeight("800")},":host .date":{cursor:"default"},":host .weekend":{background:d.monthWeekendBackground("#eee")},":host .date:not(.in-month)":{opacity:0.5},":host .date.checked":{color:d.monthDateCheckedColor("white"),background:d.monthDateCheckedBackground("hotpink")},":host:not([range]) .date.checked":{borderRadius:d.monthDateCheckedBorderRadius("10px")},":host .range-start":{borderTopLeftRadius:d.monthDateCheckedBorderRadius("10px"),borderBottomLeftRadius:d.monthDateCheckedBorderRadius("10px")},":host .range-end":{borderTopRightRadius:d.monthDateCheckedBorderRadius("10px"),borderBottomRightRadius:d.monthDateCheckedBorderRadius("10px")}};static formAssociated=!0;static initAttributes={month:NaN,year:NaN,weekStart:0,minDate:M2(new Date().getFullYear()-100,1,1).toISOString().split("T")[0],maxDate:M2(new Date().getFullYear()+10,12,31).toISOString().split("T")[0],selectable:!1,multiple:!1,range:!1,disabled:!1,readonly:!1,required:!1,name:""};selectedDays=[];value="";formDisabledCallback(l){this.disabled=l}formResetCallback(){this.value="",this.selectedDays=[]}get endDay(){return 1-this.weekStart}get months(){return r7.map((l)=>({caption:M2(2025,l,1).toString().split(" ")[1],value:String(l)}))}get years(){let l=Number(this.minDate.split("-")[0]),i=Number(this.maxDate.split("-")[0]),y=[];for(let s=l;s<=i;s++)y.push(String(s));return y}monthChanged=(l,i)=>{};gotoMonth(l,i){if(this.month!==i||this.year!==l)this.month=i,this.year=l,this.monthChanged(l,i)}setMonth=()=>{this.gotoMonth(Number(this.parts.year.value),Number(this.parts.month.value))};get to(){return this.selectedDays[1]||""}set to(l){this.selectedDays[1]=l,this.selectedDays.splice(2)}get from(){return this.selectedDays[0]||""}set from(l){this.selectedDays[0]=l,this.selectedDays.splice(2)}clickDate=(l)=>{let i=l.target.getAttribute("title");this.selectDate(i)};keyDate=(l)=>{let i=!1;switch(l.code){case"Space":{let y=l.target.getAttribute("title");this.selectDate(y),i=!0;break}case"Tab":break;default:console.log(l)}if(i)l.preventDefault(),l.stopPropagation()};#l="";selectDate=(l)=>{if(this.#l=l,this.range){if(!this.to)this.selectedDays=[l,l];else if(this.from===l&&this.to===l)this.selectedDays=[];else if(this.from===l)this.from=this.to;else if(this.to===l)this.to=this.from;else if(l<this.from)this.from=l;else if(l>this.to)this.to=l;else this.to=l;this.value=`${this.from},${this.to}`}else if(this.multiple){if(this.selectedDays.includes(l))this.selectedDays.splice(this.selectedDays.indexOf(l),1);else this.selectedDays.push(l),this.selectedDays.sort();this.value=this.selectedDays.join(",")}else if(this.selectable)if(this.selectedDays.includes(l))this.value="",this.selectedDays=[];else this.value=l,this.selectedDays=[l]};nextMonth=()=>{if(this.month<12)this.gotoMonth(this.year,this.month+1);else this.gotoMonth(this.year+1,1)};previousMonth=()=>{if(this.month>1)this.gotoMonth(this.year,this.month-1);else this.gotoMonth(this.year-1,12)};checkDay=(l)=>{if(!this.range)return this.selectedDays.includes(l);else if(this.range)return this.from&&l>=this.from&&l<=this.to;return!1};dateMenuItem=(l,i="")=>{return l=l.split("T")[0],{caption:i||l,enabled:()=>!l.startsWith(`${this.year}-${P5(this.month)}-`),action:()=>{this.gotoDate(l)}}};jumpMenu=()=>{W({target:this.parts.jump,menuItems:[this.dateMenuItem(new Date().toISOString(),"This Month"),...this.selectedDays.length===0?[]:[null],...this.selectedDays.map((l)=>this.dateMenuItem(l))]})};content=()=>[q5({part:"header"},_5({part:"previous",onClick:this.previousMonth},w.chevronLeft()),I0({style:{flex:"1"}}),_5({part:"jump",onClick:this.jumpMenu},w.calendar()),E({part:"month",options:this.months,onChange:this.setMonth}),E({part:"year",options:[this.year],onChange:this.setMonth}),I0({style:{flex:"1"}}),_5({part:"next",onClick:this.nextMonth},w.chevronRight())),q5({part:"week"}),q5({part:"days"})];gotoDate(l){let i=new Date(l);this.gotoMonth(i.getFullYear(),i.getMonth()+1)}connectedCallback(){super.connectedCallback();let l=new Date(this.value.split(",").pop()||Date.now());if(isNaN(this.month))this.month=l.getMonth()+1;if(isNaN(this.year))this.year=l.getFullYear()}days=[];render(){super.render();let{week:l,days:i,jump:y,month:s,year:h,previous:x,next:o}=this.parts;this.selectedDays=this.value?this.value.split(","):[];let r=M2(this.year,this.month,1),c=new Date(r.valueOf()-(7+r.getDay()-this.weekStart)%7*T2),C=this.month===12?1:this.month+1,g=new Date(M2(this.year+(this.month===12?1:0),C,1).valueOf()-T2),k=new Date(g.valueOf()+(this.weekStart*2+5+this.endDay-g.getDay())%7*T2),p=o7.map((F)=>new Date(c.valueOf()+F*T2).toString().split(" ")[0]);this.days=[];let z=new Date().toISOString().split("T")[0];for(let F=c.valueOf();F<=k.valueOf();F+=T2){let q=new Date(F),_=q.toISOString().split("T")[0];this.days.push({date:q,selected:!1,inMonth:q.getMonth()+1===this.month,isToday:_===z,isWeekend:q.getDay()%6===0,inRange:!!(this.from&&_>=this.from&&_<=this.to)})}s.value=String(this.month),h.value=String(this.year),s.disabled=h.disabled=y.disabled=x.disabled=o.disabled=this.disabled||this.readonly,h.options=this.years,l.textContent="",l.append(...p.map((F)=>I0({class:"day"},F))),i.textContent="";let v=null,{to:V,from:P}=this;i.append(...this.days.map((F)=>{let q=["date"];if(F.inMonth)q.push("in-month");if(F.isToday)q.push("today");let _=F.date.toISOString().split("T")[0];if(this.checkDay(_))q.push("checked");if(q.push(F.isWeekend?"weekend":"weekday"),this.range){if(V===_)q.push("range-end");if(P===_)q.push("range-start")}let N=I0({class:q.join(" "),title:_,onClick:this.clickDate,onKeydown:this.keyDate,tabindex:"0"},F.date.getDate());if(_===this.#l)v=N;return N})),v?.focus()}}var c7=F5.elementCreator();var{div:O5,button:C7}=a,g7={error:"red",warn:"orange",info:"royalblue",log:"gray",success:"green",progress:"royalblue"};class f1 extends t{static preferredTagName="tosi-notification";static singleton;static shadowStyleSpec={":host":{_notificationSpacing:8,_notificationWidth:360,_notificationPadding:`${n.notificationSpacing} ${n.notificationSpacing50} ${n.notificationSpacing} ${n.notificationSpacing200}`,_notificationBg:"#fafafa",_notificationAccentColor:"#aaa",_notificationTextColor:"#444",_notificationIconSize:n.notificationSpacing300,_notificationButtonSize:48,_notificationBorderWidth:"3px 0 0",_notificationBorderRadius:n.notificationSpacing50,position:"fixed",left:0,right:0,bottom:0,paddingBottom:n.notificationSpacing,width:n.notificationWidth,display:"flex",flexDirection:"column-reverse",margin:"0 auto",gap:n.notificationSpacing,maxHeight:"50vh",overflow:"hidden auto",boxShadow:"none !important"},":host *":{color:n.notificationTextColor},":host .note":{display:"grid",background:n.notificationBg,padding:n.notificationPadding,gridTemplateColumns:`${n.notificationIconSize} 1fr ${n.notificationButtonSize}`,gap:n.notificationSpacing,alignItems:"center",borderRadius:n.notificationBorderRadius,boxShadow:`0 2px 8px #0006, inset 0 0 0 2px ${n.notificationAccentColor}`,borderColor:n.notificationAccentColor,borderWidth:n.notificationBorderWidth,borderStyle:"solid",transition:"0.5s ease-in",transitionProperty:"margin, opacity",zIndex:1},":host .note .icon":{stroke:n.notificationAccentColor},":host .note button":{display:"flex",lineHeight:n.notificationButtonSize,padding:0,margin:0,height:n.notificationButtonSize,width:n.notificationButtonSize,background:"transparent",alignItems:"center",justifyContent:"center",boxShadow:"none",border:"none",position:"relative"},":host .note button:hover svg":{stroke:n.notificationAccentColor},":host .note button:active svg":{borderRadius:99,stroke:n.notificationBg,background:n.notificationAccentColor,padding:n.spacing50},":host .note svg":{height:n.notificationIconSize,width:n.notificationIconSize,pointerEvents:"none"},":host .message":{display:"flex",flexDirection:"column",alignItems:"center",gap:n.notificationSpacing},":host .note.closing":{opacity:0,zIndex:0}};static removeNote(l){l.classList.add("closing"),l.style.marginBottom=-l.offsetHeight+"px";let i=()=>{l.remove()};l.addEventListener("transitionend",i),setTimeout(i,1000)}static post(l){let{message:i,duration:y,type:s,close:h,progress:x,icon:o,color:r}=Object.assign({type:"info",duration:-1},typeof l==="string"?{message:l}:l);if(!this.singleton)this.singleton=U5();let c=this.singleton;document.body.append(c),c.style.zIndex=String(M1()+1);let C=r||g7[s],g=x||s==="progress"?a.progress():{},k=()=>{if(h)h();f1.removeNote(v)},p=o instanceof SVGElement?o:o?w[o]({class:"icon"}):w.info({class:"icon"}),z=s==="error"||s==="warn",v=O5({class:`note ${s}`,role:z?"alert":"status",ariaLive:z?"assertive":"polite",style:{_notificationAccentColor:C}},p,O5({class:"message"},O5(i),g),C7({class:"close",title:"close",ariaLabel:"Close notification",apply(V){V.addEventListener("click",k)}},w.x()));if(c.shadowRoot.append(v),g instanceof HTMLProgressElement&&x instanceof Function){g.setAttribute("max",String(100)),g.value=x();let V=setInterval(()=>{if(!c.shadowRoot.contains(v)){clearInterval(V);return}let P=x();if(g.value=P,P>=100)f1.removeNote(v)},1000)}if(y>0)setTimeout(()=>{f1.removeNote(v)},y*1000);return v.scrollIntoView(),k}content=null}var n7=f1,U5=f1.elementCreator(),k7=U5;function d7(l){return f1.post(l)}var Dl=async(l,i="SHA-1")=>{let s=new TextEncoder().encode(l),h=await crypto.subtle.digest(i,s);return Array.from(new Uint8Array(h)).map((r)=>r.toString(16).padStart(2,"0")).join("")},Sl=async(l)=>{let i=await Dl(l),y=await fetch(`https://weakpass.com/api/v1/search/${i}`);if(y.ok){let s=await y.json();console.log("password found in weakpass database",s)}return y.status!==404},{span:X5,xinSlot:p7}=a;class Y0 extends t{static preferredTagName="tosi-password-strength";static lightStyleSpec={":host":{display:"inline-flex",flexDirection:"column",gap:n.spacing50,position:"relative"},":host xin-slot":{display:"flex"},':host [part="meter"]':{display:"block",position:"relative",height:d.meterHeight("24px"),background:d.indicatorBg("white"),borderRadius:d.meterRadius("4px"),boxShadow:d.meterShadow(`inset 0 0 0 2px ${n.indicatorColor}`)},':host [part="level"]':{height:d.levelHeight("20px"),content:'" "',display:"inline-block",width:0,transition:"0.15s ease-out",background:n.indicatorColor,margin:d.levelMargin("2px"),borderRadius:d.levelRadius("2px")},':host [part="description"]':{position:"absolute",inset:"0",color:n.descriptionColor,height:d.meterHeight("24px"),lineHeight:d.meterHeight("24px"),textAlign:"center"}};static initAttributes={minLength:8,goodLength:12,indicatorColors:"#f00,#f40,#f80,#ef0,#8f0,#0a2"};descriptionColors="#000,#000,#000,#000,#000,#fff";issues={tooShort:!0,short:!0,noUpper:!0,noLower:!0,noNumber:!0,noSpecial:!0};issueDescriptions={tooShort:"too short",short:"short",noUpper:"no upper case",noLower:"no lower case",noNumber:"no digits",noSpecial:"no unusual characters"};value=0;strengthDescriptions=["unacceptable","very weak","weak","moderate","strong","very strong"];strength(l){return this.issues={tooShort:l.length<this.minLength,short:l.length<this.goodLength,noUpper:!l.match(/[A-Z]/),noLower:!l.match(/[a-z]/),noNumber:!l.match(/[0-9]/),noSpecial:!l.match(/[^a-zA-Z0-9]/)},this.issues.tooShort?0:Object.values(this.issues).filter((i)=>!i).length-1}async isBreached(){let l=this.querySelector("input")?.value;if(!l||typeof l!=="string")return!0;return await Sl(l)}updateIndicator=(l)=>{let{level:i,description:y}=this.parts,s=this.indicatorColors.split(","),h=this.descriptionColors.split(","),x=this.strength(l);if(this.value!==x)this.value=x,this.dispatchEvent(new Event("change"));i.style.width=`${(x+1)*16.67}%`,this.style.setProperty("--indicator-color",s[x]),this.style.setProperty("--description-color",h[x]),y.textContent=this.strengthDescriptions[x]};update=(l)=>{let i=l.target.closest("input");this.updateIndicator(i?.value||"")};content=()=>[p7({onInput:this.update}),X5({part:"meter"},X5({part:"level"}),X5({part:"description"}))];render(){super.render();let l=this.querySelector("input");this.updateIndicator(l?.value)}}var w7=Y0,Tl=Y0.elementCreator(),a7=Tl;var{span:N5}=a;class D0 extends t{static preferredTagName="tosi-rating";static formAssociated=!0;static initAttributes={max:5,min:1,icon:"star",step:1,ratingStroke:"#e81",ratingFill:"#f91",emptyStroke:"none",emptyFill:"#ccc",readonly:!1,iconSize:24,hollow:!1,required:!1,name:""};value="";formDisabledCallback(l){this.readonly=l}formResetCallback(){this.value=""}static shadowStyleSpec={":host":{display:"inline-block",position:"relative",width:"fit-content"},":host::part(container)":{position:"relative",display:"inline-block"},":host::part(empty), :host::part(filled)":{height:"100%",whiteSpace:"nowrap",overflow:"hidden"},":host::part(empty)":{pointerEvents:"none"},":host::part(filled)":{position:"absolute",left:0,transition:"width 0.15s ease-out"},":host svg":{transform:"scale(0.9)",pointerEvents:"all !important",transition:"0.25s ease-in-out"},":host svg:hover":{transform:"scale(1)"},":host svg:active":{transform:"scale(1.1)"}};content=()=>N5({part:"container"},N5({part:"empty"}),N5({part:"filled"}));displayValue(l){let{empty:i,filled:y}=this.parts,h=Math.round((typeof l==="string"?0:l||0)/this.step)*this.step;y.style.width=h/this.max*i.offsetWidth+"px"}update=(l)=>{if(this.readonly)return;let{empty:i}=this.parts,y=l instanceof MouseEvent?l.pageX-i.getBoundingClientRect().x:0,s=Math.min(Math.max(this.min,Math.round(y/i.offsetWidth*this.max/this.step+this.step*0.5)*this.step),this.max);if(l.type==="click")this.value=s;else if(l.type==="mousemove")this.displayValue(s);else this.displayValue(this.value||0)};handleKey=(l)=>{let i=this.value===""?NaN:Number(this.value);if(isNaN(i))i=Math.round((this.min+this.max)*0.5*this.step)*this.step;let y=!1;switch(l.key){case"ArrowUp":case"ArrowRight":i+=this.step,y=!0;break;case"ArrowDown":case"ArrowLeft":i-=this.step,y=!0;break}if(this.value=Math.max(Math.min(i,this.max),this.min),y)l.stopPropagation(),l.preventDefault()};connectedCallback(){super.connectedCallback();let{container:l}=this.parts;l.tabIndex=0,l.addEventListener("mousemove",this.update,!0),l.addEventListener("mouseleave",this.update),l.addEventListener("blur",this.update),l.addEventListener("click",this.update),l.addEventListener("keydown",this.handleKey)}_renderedIcon="";render(){super.render();let l=this.iconSize+"px";if(this.style.setProperty("--tosi-icon-size",l),this.readonly)this.role="image";else this.role="slider";this.ariaLabel=`rating ${this.value} out of ${this.max}`,this.ariaValueMax=String(this.max),this.ariaValueMin=String(this.min),this.ariaValueNow=this.value===""?String(-1):String(this.value);let{empty:i,filled:y}=this.parts;if(i.classList.toggle("hollow",this.hollow),i.style.setProperty("--tosi-icon-fill",this.emptyFill),i.style.setProperty("--tosi-icon-stroke",this.emptyStroke),y.style.setProperty("--tosi-icon-fill",this.ratingFill),y.style.setProperty("--tosi-icon-stroke",this.ratingStroke),this._renderedIcon!==this.icon){this._renderedIcon=this.icon;for(let s=0;s<this.max;s++)i.append(w[this.icon]()),y.append(w[this.icon]())}this.displayValue(this.value)}}var v7=D0,Ml=D0.elementCreator(),B7=D((...l)=>Ml(...l),"xinRating is deprecated, use tosiRating instead (tag is now <tosi-rating>)");var{xinSlot:ul,div:t7,button:z7,span:ml}=a,j7=[{caption:"Title",tagType:"H1"},{caption:"Heading",tagType:"H2"},{caption:"Subheading",tagType:"H3"},{caption:"Minor heading",tagType:"H4"},{caption:"Body",tagType:"P"},{caption:"Code Block",tagType:"PRE"}];function K5(l=j7){return E({title:"paragraph style",slot:"toolbar",class:"block-style",options:l.map(({caption:i,tagType:y})=>({caption:i,value:`formatBlock,${y}`}))})}function B2(l="10px"){return ml({slot:"toolbar",style:{flex:`0 0 ${l}`,content:" "}})}function A7(l="10px"){return ml({slot:"toolbar",style:{flex:`0 0 ${l}`,content:" "}})}function g1(l,i,y){return z7({slot:"toolbar",dataCommand:i,title:l},y)}var V7=()=>[g1("left-justify","justifyLeft",w.alignLeft()),g1("center","justifyCenter",w.alignCenter()),g1("right-justify","justifyRight",w.alignRight()),B2(),g1("bullet list","insertUnorderedList",w.listBullet()),g1("numbered list","insertOrderedList",w.listNumber()),B2(),g1("indent","indent",w.indent()),g1("indent","outdent",w.outdent())],Ll=()=>[g1("bold","bold",w.fontBold()),g1("italic","italic",w.fontItalic()),g1("underline","underline",w.fontUnderline())],q7=()=>[K5(),B2(),...Ll()],El=()=>[K5(),B2(),...V7(),B2(),...Ll()];class S0 extends t{static preferredTagName="tosi-rich-text";static lightStyleSpec={":host":{display:"flex",flexDirection:"column",height:"100%"},':host [part="toolbar"]':{padding:4,display:"flex",gap:"0px",flex:"0 0 auto",flexWrap:"wrap"},':host [part="toolbar"] > button':{_xinIconSize:18}};static formAssociated=!0;static initAttributes={widgets:"default",name:"",required:!1};isInitialized=!1;savedValue="";formDisabledCallback(l){if(this.isInitialized)this.parts.doc.contentEditable=l?"false":"true"}formResetCallback(){this.value=""}_value="";get value(){return this.isInitialized?this.parts.doc.innerHTML:this._value}set value(l){let i=this._value;if(this._value=l,this.isInitialized){if(this.parts.doc.innerHTML!==l)this.parts.doc.innerHTML=l}if(i!==l&&this.internals)this.internals.setFormValue(l)}blockElement(l){let{doc:i}=this.parts;while(l.parentElement!==null&&l.parentElement!==i)l=l.parentElement;return l.parentElement===i?l:void 0}get selectedBlocks(){let{doc:l}=this.parts,i=window.getSelection();if(i===null)return[];let y=[];for(let s=0;s<i.rangeCount;s++){let h=i.getRangeAt(s);if(!l.contains(h.commonAncestorContainer))continue;let x=this.blockElement(h.startContainer),o=this.blockElement(h.endContainer);y.push(x);while(x!==o&&x!==null)x=x.nextElementSibling,y.push(x)}return y}get selectedText(){let l=window.getSelection();if(l===null)return"";return this.selectedBlocks.length?l.toString():""}selectionChange=()=>{};_updatingBlockStyle=!1;handleSelectChange=(l)=>{if(this._updatingBlockStyle)return;let y=l.target?.closest(B1.tagName);if(y==null)return;this.doCommand(y.value)};handleButtonClick=(l)=>{let y=l.target?.closest("button");if(y==null)return;this.doCommand(y.dataset.command)};content=[ul({name:"toolbar",part:"toolbar",onClick:this.handleButtonClick,onChange:this.handleSelectChange}),t7({part:"doc",contenteditable:!0,style:{flex:"1 1 auto",outline:"none"}}),ul({part:"content"})];doCommand(l){if(l===void 0)return;let i=l.split(",");console.log("execCommand",i[0],!1,...i.slice(1)),document.execCommand(i[0],!1,...i.slice(1))}updateBlockStyle(){let l=this.parts.toolbar.querySelector(".block-style");if(l===null)return;let i=this.selectedBlocks.map((y)=>y.tagName);i=[...new Set(i)],this._updatingBlockStyle=!0,l.value=i.length===1?`formatBlock,${i[0]}`:"",this._updatingBlockStyle=!1}hasContent(){return(this.parts.doc.textContent||"").trim().length>0}handleInput=()=>{if(this.internals)this.internals.setFormValue(this.parts.doc.innerHTML),this.updateValidity()};updateValidity(){if(this.internals)if(this.required&&!this.hasContent())this.internals.setValidity({valueMissing:!0},"Please enter some content",this.parts.doc);else this.internals.setValidity({})}connectedCallback(){super.connectedCallback();let{doc:l,content:i}=this.parts;if(i.innerHTML!==""&&l.innerHTML==="")l.innerHTML=i.innerHTML,i.innerHTML="";this.isInitialized=!0,i.style.display="none",l.addEventListener("input",this.handleInput),this.updateValidity(),document.addEventListener("selectionchange",(y)=>{this.updateBlockStyle(),this.selectionChange(y,this)})}render(){let{toolbar:l}=this.parts;if(super.render(),l.children.length===0)switch(this.widgets){case"minimal":l.append(...q7());break;case"default":l.append(...El());break}}}var _7=S0,li=S0.elementCreator(),P7=D((...l)=>li(...l),"richText is deprecated, use tosiRichText instead (tag is now <tosi-rich-text>)");var{div:F7,slot:O7,label:U7,span:X7,input:ii}=a;class t2 extends t{static preferredTagName="tosi-segmented";static formAssociated=!0;static initAttributes={direction:"row",other:"",multiple:!1,name:"",placeholder:"Please specify…",localized:!1,required:!1};_choices=[];get choices(){return this._choices}set choices(l){if(typeof l==="string")this._choices=t2.parseChoicesString(l);else this._choices=l;this.queueRender()}static parseChoicesString(l){return l.split(",").filter((i)=>i.trim()!=="").map((i)=>{let[y,s]=i.split("=").map((r)=>r.trim()),[h,x]=(s||y).split(":").map((r)=>r.trim()),o=x?w[x]():"";return{value:y,icon:o,caption:h}})}value="";formDisabledCallback(l){}formResetCallback(){this.value=""}get values(){return(this.value||"").split(",").map((l)=>l.trim()).filter((l)=>l!=="")}content=()=>[O7(),F7({part:"options"},ii({part:"custom",hidden:!0}))];static shadowStyleSpec={":host":{display:"inline-flex",gap:d.segmentedOptionGap("8px"),alignItems:d.segmentedAlignItems("center")},":host, :host::part(options)":{flexDirection:d.segmentedDirection("row")},":host label":{display:"inline-grid",alignItems:"center",gap:d.segmentedOptionGap("8px"),gridTemplateColumns:d.segmentedOptionGridColumns("0px 24px 1fr"),padding:d.segmentedOptionPadding("4px 12px"),font:d.segmentedOptionFont("16px")},":host label:focus":{outline:"none",boxShadow:d.segmentedFocusShadow(`inset 0 0 0 2px ${d.segmentedOptionCurrentBackground("#44a")}`),borderRadius:d.segmentedOptionsBorderRadius("8px")},":host label:has(:checked)":{color:d.segmentedOptionCurrentColor("#eee"),background:d.segmentedOptionCurrentBackground("#44a")},":host label:has(:checked):focus":{boxShadow:d.segmentedCurrentFocusShadow(`inset 0 0 0 2px ${d.segmentedOptionCurrentColor("#eee")}`)},":host svg":{height:d.segmentOptionIconSize("16px"),stroke:d.segmentedOptionIconColor("currentColor")},":host label.no-icon":{gap:0,gridTemplateColumns:d.segmentedOptionGridColumns("0px 1fr")},':host input[type="radio"], :host input[type="checkbox"]':{visibility:d.segmentedInputVisibility("hidden")},":host::part(options)":{display:"flex",borderRadius:d.segmentedOptionsBorderRadius("8px"),background:d.segmentedOptionsBackground("#fff"),color:d.segmentedOptionColor("#222"),overflow:"hidden",alignItems:d.segmentedOptionAlignItems("stretch")},":host::part(custom)":{padding:d.segmentedOptionPadding("4px 12px"),color:d.segmentedOptionCurrentColor("#eee"),background:d.segmentedOptionCurrentBackground("#44a"),font:d.segmentedOptionFont("16px"),border:"0",outline:"none"},":host::part(custom)::placeholder":{color:d.segmentedOptionCurrentColor("#eee"),opacity:d.segmentedPlaceholderOpacity(0.75)}};valueChanged=!1;handleChange=()=>{let{options:l,custom:i}=this.parts;if(this.multiple){let y=[...l.querySelectorAll("input:checked")];this.value=y.map((s)=>s.value).join(",")}else{let y=l.querySelector("input:checked");if(!y)this.value="";else if(y.value)i.setAttribute("hidden",""),this.value=y.value;else i.removeAttribute("hidden"),i.focus(),i.select(),this.value=i.value}this.valueChanged=!0};handleKey=(l)=>{let i=!1;switch(l.code){case"Space":if(l.target instanceof HTMLLabelElement)l.target.click(),i=!0;break;case"Tab":if(!(l.target instanceof HTMLLabelElement))l.target.closest("label").focus();break;case"ArrowLeft":case"ArrowUp":{let y=l.target.closest("label");if(y.previousElementSibling instanceof HTMLLabelElement)y.previousElementSibling.focus()}i=!0;break;case"ArrowRight":case"ArrowDown":{let y=l.target.closest("label");if(y.nextElementSibling instanceof HTMLLabelElement)y.nextElementSibling.focus()}i=!0;break}if(i)l.preventDefault(),l.stopPropagation()};connectedCallback(){super.connectedCallback();let l=this.getAttribute("choices");if(l&&this._choices.length===0)this._choices=t2.parseChoicesString(l);let{options:i}=this.parts;if(this.name==="")this.name=this.instanceId;if(i.addEventListener("change",this.handleChange),i.addEventListener("keydown",this.handleKey),this.other&&this.multiple)console.warn(this,"is set to [other] and [multiple]; [other] will be ignored"),this.other=""}get _choicesWithOther(){let l=[...this.choices];if(this.other&&!this.multiple){let[i,y]=this.other.split(":");l.push({value:"",caption:i,icon:y})}return l}get isOtherValue(){return Boolean(this.value===""||this.value&&!this._choicesWithOther.find((l)=>l.value===this.value))}render(){if(super.render(),this.valueChanged){this.valueChanged=!1;return}let{options:l,custom:i}=this.parts;l.textContent="";let y=this.multiple?"checkbox":"radio",{values:s,isOtherValue:h}=this;if(l.append(...this._choicesWithOther.map((x)=>{return U7({tabindex:0},ii({type:y,name:this.name,value:x.value,checked:s.includes(x.value)||x.value===""&&h,tabIndex:-1}),x.icon||{class:"no-icon"},this.localized?z1(x.caption):X7(x.caption))})),this.other&&!this.multiple)i.hidden=!h,i.value=h?this.value:"",i.placeholder=this.placeholder,l.append(i)}}var N7=t2,yi=t2.elementCreator(),K7=D((...l)=>yi(...l),"xinSegmented is deprecated, use tosiSegmented instead (tag is now <tosi-segmented>)");var{slot:si}=a;class Q5 extends t{static preferredTagName="tosi-sizebreak";static initAttributes={minWidth:0,minHeight:0};value="normal";content=[si({part:"normal"}),si({part:"small",name:"small"})];static shadowStyleSpec={":host":{display:"inline-block",position:"relative"}};onResize=()=>{let{normal:l,small:i}=this.parts,y=this.offsetParent;if(!(y instanceof HTMLElement))return;else if(y.offsetWidth<this.minWidth||y.offsetHeight<this.minHeight)l.hidden=!0,i.hidden=!1,this.value="small";else l.hidden=!1,i.hidden=!0,this.value="normal"};connectedCallback(){super.connectedCallback(),globalThis.addEventListener("resize",this.onResize)}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("resize",this.onResize)}}var Q7=Q5.elementCreator();class T0 extends t{static preferredTagName="tosi-sizer";target=null;static shadowStyleSpec={":host":{_resizeIconFill:"#222",display:"block",position:"absolute",bottom:-7,right:-7,padding:14,width:44,height:44,opacity:0.25,transition:"opacity 0.25s ease-out"},":host(:hover)":{opacity:0.5},":host svg":{width:16,height:16,stroke:n.resizeIconFill}};content=w.resize();get minSize(){let{minWidth:l,minHeight:i}=getComputedStyle(this.target);return{width:parseFloat(l)||32,height:parseFloat(i)||32}}resizeTarget=(l)=>{let{target:i}=this;if(!i)return;let{offsetWidth:y,offsetHeight:s}=i;i.style.left=i.offsetLeft+"px",i.style.top=i.offsetTop+"px",i.style.bottom="",i.style.right="";let{minSize:h}=this;T(l,(x,o,r)=>{if(i.style.width=Math.max(h.width,y+x)+"px",i.style.height=Math.max(h.height,s+o)+"px",r.type==="mouseup")return!0},"nwse-resize")};connectedCallback(){if(super.connectedCallback(),!this.target)this.target=this.parentElement;let l={passive:!0};this.addEventListener("mousedown",this.resizeTarget,l),this.addEventListener("touchstart",this.resizeTarget,l)}}var G7=T0,hi=T0.elementCreator(),b7=hi;var{div:W7,input:f7,span:R7,button:G5}=a;class u2 extends t{static preferredTagName="tosi-tag";static lightStyleSpec={":host":{"--tag-close-button-color":"#000c","--tag-close-button-bg":"#fffc","--tag-button-opacity":"0.5","--tag-button-hover-opacity":"0.75","--tag-bg":d.brandColor("blue"),"--tag-text-color":d.brandTextColor("white"),display:"inline-flex",borderRadius:d.tagRoundedRadius(n.spacing50),color:n.tagTextColor,background:n.tagBg,padding:`0 ${n.spacing75} 0 ${n.spacing75}`,height:`calc(${n.lineHeight} + ${n.spacing50})`,lineHeight:`calc(${n.lineHeight} + ${n.spacing50})`},':host > [part="caption"]':{position:"relative",whiteSpace:"nowrap",overflow:"hidden",flex:"1 1 auto",fontSize:d.fontSize("16px"),color:n.tagTextColor,textOverflow:"ellipsis"},':host [part="remove"]':{boxShadow:"none",margin:`0 ${n.spacing_50} 0 ${n.spacing25}`,padding:0,display:"inline-flex",alignItems:"center",alignSelf:"center",justifyContent:"center",height:n.spacing150,width:n.spacing150,color:n.tagCloseButtonColor,background:n.tagCloseButtonBg,borderRadius:d.tagCloseButtonRadius("99px"),opacity:n.tagButtonOpacity},':host [part="remove"]:hover':{background:n.tagCloseButtonBg,opacity:n.tagButtonHoverOpacity}};static initAttributes={caption:"",removeable:!1};removeCallback=()=>{this.remove()};content=()=>[R7({part:"caption"},this.caption),G5(w.x(),{type:"button",part:"remove",hidden:!this.removeable,ariaLabel:`Remove ${this.caption}`,onClick:this.removeCallback})]}var Z7=u2,b5=u2.elementCreator(),H7=D((...l)=>b5(...l),"xinTag is deprecated, use tosiTag instead (tag is now <tosi-tag>)");class z2 extends t{static preferredTagName="tosi-tag-list";static lightStyleSpec={":host":{"--tag-list-bg":"#f8f8f8","--touch-size":"44px","--spacing":"16px",display:"grid",gridTemplateColumns:"auto",alignItems:"center",background:n.tagListBg,gap:n.spacing25,borderRadius:d.taglistRoundedRadius(n.spacing50),overflow:"hidden"},":host[editable]":{gridTemplateColumns:`0px auto ${n.touchSize}`},":host[editable][text-entry]":{gridTemplateColumns:`0px 2fr 1fr ${n.touchSize}`},':host [part="tagContainer"]':{display:"flex",content:'" "',alignItems:"center",background:n.inputBg,borderRadius:d.tagContainerRadius(n.spacing50),boxShadow:n.borderShadow,flexWrap:"nowrap",overflow:"auto hidden",gap:n.spacing25,minHeight:`calc(${n.lineHeight} + ${n.spacing})`,padding:n.spacing25},':host [part="tagMenu"]':{width:n.touchSize,height:n.touchSize,lineHeight:n.touchSize,textAlign:"center",padding:0,margin:0},":host [hidden]":{display:"none !important"},':host button[part="tagMenu"]':{background:n.brandColor,color:n.brandTextColor}};static formAssociated=!0;static initAttributes={name:"",textEntry:!1,editable:!1,placeholder:"enter tags",disabled:!1,required:!1};value="";get tags(){return this.value.split(",").map((l)=>l.trim()).filter((l)=>l!=="")}set tags(l){this.value=l.join(",")}_availableTags=[];get availableTags(){return this._availableTags}set availableTags(l){if(typeof l==="string")this._availableTags=z2.parseAvailableTagsString(l);else this._availableTags=l;this.queueRender()}static parseAvailableTagsString(l){return l.split(",").map((i)=>{let y=i.trim();return y===""?null:y})}connectedCallback(){super.connectedCallback();let l=this.getAttribute("available-tags");if(l&&this._availableTags.length===0)this._availableTags=z2.parseAvailableTagsString(l)}formDisabledCallback(l){this.disabled=l}formResetCallback(){this.value=""}addTag=(l)=>{let i=l.trim();if(i===""||this.tags.includes(i))return;this.tags=[...this.tags,i],this.queueRender(!0)};toggleTag=(l)=>{if(this.tags.includes(l))this.tags=this.tags.filter((i)=>i!==l),this.queueRender(!0);else this.addTag(l)};enterTag=(l)=>{let{tagInput:i}=this.parts;switch(l.key){case",":{let y=i.value.split(",")[0];this.addTag(y)}break;case"Enter":{let y=i.value.split(",")[0];this.addTag(y)}l.stopPropagation(),l.preventDefault();break;default:}};popSelectMenu=()=>{let{toggleTag:l}=this,{tagMenu:i}=this.parts,y=[...this.availableTags],s=this.tags.filter((x)=>!y.includes(x));if(s.length)y.push(null,...s);let h=y.map((x)=>{if(x===""||x===null)return null;else if(typeof x==="object")return{checked:()=>this.tags.includes(x.value),caption:x.caption,action(){l(x.value)}};else return{checked:()=>this.tags.includes(x),caption:x,action(){l(x)}}});W({target:i,width:"auto",menuItems:h})};content=()=>[G5({type:"button",style:{visibility:"hidden"},tabindex:-1}),W7({part:"tagContainer",class:"row",role:"list",ariaLabel:"Selected tags"}),f7({part:"tagInput",class:"elastic",ariaLabel:"Enter new tag",onKeydown:this.enterTag}),G5({type:"button",title:"add tag",ariaLabel:"Select tags from list",ariaHaspopup:"listbox",part:"tagMenu",onClick:this.popSelectMenu},w.chevronDown())];removeTag=(l)=>{if(this.editable&&!this.disabled){let i=l.target.closest(u2.tagName);this.tags=this.tags.filter((y)=>y!==i.caption),i.remove(),this.queueRender(!0)}l.stopPropagation(),l.preventDefault()};render(){super.render();let{tagContainer:l,tagMenu:i,tagInput:y}=this.parts;if(i.disabled=this.disabled,y.value="",y.setAttribute("placeholder",this.placeholder),this.editable&&!this.disabled)i.toggleAttribute("hidden",!1),y.toggleAttribute("hidden",!this.textEntry);else i.toggleAttribute("hidden",!0),y.toggleAttribute("hidden",!0);l.textContent="";for(let s of this.tags)l.append(b5({caption:s,removeable:this.editable&&!this.disabled,removeCallback:this.removeTag}))}}var J7=z2,xi=z2.elementCreator(),$7=D((...l)=>xi(...l),"xinTagList is deprecated, use tosiTagList instead (tag is now <tosi-tag-list>)");var oi="1.3.6";var W5={accent:j.fromCss("#EE257B"),background:j.fromCss("#fafafa"),text:j.fromCss("#222222")},ri={_tosiSpacingXs:"4px",_tosiSpacingSm:"8px",_tosiSpacing:"12px",_tosiSpacingLg:"16px",_tosiSpacingXl:"24px",_tosiFontFamily:"system-ui, -apple-system, sans-serif",_tosiFontSize:"16px",_tosiLineHeight:"1.5",_tosiCodeFontFamily:"ui-monospace, monospace",_tosiCodeFontSize:"14px",_tosiTouchSize:"44px",_tosiBorderRadius:"4px",_tosiBorderRadiusLg:"8px",_tosiTransition:"0.15s ease-out"};function e7(l){let{accent:i,background:y,text:s}=l,h=l.accentText??i.contrasting(),x=l.backgroundInset??y.darken(0.03),o=l.border??s.opacity(0.15),r=l.shadow??s.opacity(0.1),c=l.focus??i.opacity(0.5);return{_tosiAccent:i,_tosiAccentLight:i.brighten(0.15),_tosiAccentDark:i.darken(0.15),_tosiAccentText:h,_tosiBg:y,_tosiBgInset:x,_tosiBgHover:y.darken(0.05),_tosiBgActive:y.darken(0.1),_tosiText:s,_tosiTextMuted:s.opacity(0.6),_tosiTextDisabled:s.opacity(0.4),_tosiBorder:o,_tosiBorderFocus:i,_tosiShadow:r,_tosiShadowColor:r,_tosiFocusRing:`0 0 0 2px ${c}`,_tosiInputBg:y,_tosiInputBorder:o,_tosiInputBorderFocus:i,_tosiButtonBg:y,_tosiButtonText:s,_tosiButtonBorder:o,_tosiButtonHoverBg:y.darken(0.05),_tosiButtonActiveBg:i,_tosiButtonActiveText:h}}function M0(l){return{":root":{...ri,...e7(l)}}}function ci(l){let y=M0(l)[":root"];return{":root":j4(y)}}function I7(l,i="tosi-theme"){D1(i,l)}var Y7=M0(W5),D7=ci(W5),Ci={"--xin-icon-size":n.tosiIconSize,"--xin-icon-fill":n.tosiIconFill,"--xin-icon-stroke":n.tosiIconStroke,"--xin-tabs-bar-color":n.tosiTabsBarColor,"--xin-tabs-bar-height":n.tosiTabsBarHeight,"--xin-tabs-selected-color":n.tosiTabsSelectedColor,"--spacing":n.tosiSpacing,"--gap":n.tosiSpacingSm,"--touch-size":n.tosiTouchSize,"--background":n.tosiBg,"--text-color":n.tosiText,"--brand-color":n.tosiAccent,"--brand-text-color":n.tosiAccentText};function S7(l){return{":root":{...M0(l)[":root"],...Ci}}}function T7(l,i){let y={};for(let[s,h]of Object.entries(i)){let x=`--tosi-${l}-${s.replace(/([A-Z])/g,"-$1").toLowerCase()}`;y[s]=`var(${x}, ${h})`}return y}Object.assign(globalThis,{xinjs:K2,xinjsui:f5});})();
97
+ `)}var{div:h7}=a;class i2 extends t{static preferredTagName="tosi-map";static formAssociated=!0;static initAttributes={coords:"65.01715565258993,25.48081004203459,12",token:"",mapStyle:"mapbox://styles/mapbox/streets-v12",name:""};value="";formDisabledCallback(l){}formResetCallback(){this.value="",this.coords="65.01715565258993,25.48081004203459,12"}content=h7({style:{width:"100%",height:"100%"}});get map(){return this._map}static mapboxCSSAvailable;static mapboxAvailable;_map;static shadowStyleSpec={":host":{display:"inline-block",position:"relative",width:"400px",height:"400px",textAlign:"left"}};constructor(){super();if(i2.mapboxCSSAvailable===void 0)i2.mapboxCSSAvailable=n0("https://api.mapbox.com/mapbox-gl-js/v3.15.0/mapbox-gl.css").catch((l)=>{console.error("failed to load mapbox-gl.css",l)}),i2.mapboxAvailable=L("https://api.mapbox.com/mapbox-gl-js/v3.15.0/mapbox-gl.js").catch((l)=>{console.error("failed to load mapbox-gl.js",l)})}connectedCallback(){if(super.connectedCallback(),!this.token)console.error("mapbox requires an access token which you can provide via the token attribute")}_lastCoords="";_lastStyle="";render(){if(super.render(),!this.token)return;if(this._map){if(this.coords!==this._lastCoords){let[h,x,o]=this.coords.split(",").map((r)=>Number(r));this._map.setCenter([x,h]),this._map.setZoom(o),this._lastCoords=this.coords}if(this.mapStyle!==this._lastStyle)this._map.setStyle(this.mapStyle),this._lastStyle=this.mapStyle;return}let{div:l}=this.parts,[i,y,s]=this.coords.split(",").map((h)=>Number(h));this._lastCoords=this.coords,this._lastStyle=this.mapStyle,i2.mapboxAvailable.then(({mapboxgl:h})=>{console.log("%cmapbox may complain about missing css -- don't panic!","background: orange; color: black; padding: 0 5px;"),h.accessToken=this.token,this._map=new h.Map({container:l,style:this.mapStyle,zoom:s,center:[y,i]}),this._map.on("render",()=>this._map.resize()),this._map.on("moveend",()=>{let x=this._map.getCenter(),o=this._map.getZoom(),r=`${x.lat.toFixed(6)},${x.lng.toFixed(6)},${o.toFixed(1)}`;if(r!==this.value){if(this.internals)this.internals.setFormValue(r)}})})}}var x7=i2.elementCreator();var{div:q5,span:I0,button:_5}=a,T2=86400000,o7=[0,1,2,3,4,5,6],r7=[1,2,3,4,5,6,7,8,9,10,11,12],P5=(l,i=2,y="0")=>String(l).padStart(i,y),M2=(l,i,y)=>new Date(`${l}-${P5(i)}-${P5(y)}`);class F5 extends t{static preferredTagName="tosi-month";static lightStyleSpec={":host":{display:"block"},":host [part=header]":{display:"flex",alignItems:"stretch",justifyContent:"stretch"},":host[disabled]":{pointerEvents:"none",opacity:d.disabledOpacity(0.6)},':host [part="month"], :host [part="year"]':{_fieldWidth:"4em",flex:"1"},":host [part=week], :host [part=days]":{display:"grid",gridTemplateColumns:"auto auto auto auto auto auto auto",justifyItems:"stretch"},":host .today":{background:d.monthTodayBackground("transparent"),boxShadow:d.monthTodayShadow("none"),backdropFilter:d.monthTodayBackdropFilter("brightness(0.9)"),fontWeight:d.monthTodayFontWeight("800")},":host .day, :host .date":{padding:5,display:"flex",justifyContent:"center",userSelect:"none"},":host .day":{color:d.monthDayColor("hotpink"),background:d.monthDayBackground("white"),fontWeight:d.monthDayFontWeight("800")},":host .date":{cursor:"default"},":host .weekend":{background:d.monthWeekendBackground("#eee")},":host .date:not(.in-month)":{opacity:0.5},":host .date.checked":{color:d.monthDateCheckedColor("white"),background:d.monthDateCheckedBackground("hotpink")},":host:not([range]) .date.checked":{borderRadius:d.monthDateCheckedBorderRadius("10px")},":host .range-start":{borderTopLeftRadius:d.monthDateCheckedBorderRadius("10px"),borderBottomLeftRadius:d.monthDateCheckedBorderRadius("10px")},":host .range-end":{borderTopRightRadius:d.monthDateCheckedBorderRadius("10px"),borderBottomRightRadius:d.monthDateCheckedBorderRadius("10px")}};static formAssociated=!0;static initAttributes={month:NaN,year:NaN,weekStart:0,minDate:M2(new Date().getFullYear()-100,1,1).toISOString().split("T")[0],maxDate:M2(new Date().getFullYear()+10,12,31).toISOString().split("T")[0],selectable:!1,multiple:!1,range:!1,disabled:!1,readonly:!1,required:!1,name:""};selectedDays=[];value="";formDisabledCallback(l){this.disabled=l}formResetCallback(){this.value="",this.selectedDays=[]}get endDay(){return 1-this.weekStart}get months(){return r7.map((l)=>({caption:M2(2025,l,1).toString().split(" ")[1],value:String(l)}))}get years(){let l=Number(this.minDate.split("-")[0]),i=Number(this.maxDate.split("-")[0]),y=[];for(let s=l;s<=i;s++)y.push(String(s));return y}monthChanged=(l,i)=>{};gotoMonth(l,i){if(this.month!==i||this.year!==l)this.month=i,this.year=l,this.monthChanged(l,i)}setMonth=()=>{this.gotoMonth(Number(this.parts.year.value),Number(this.parts.month.value))};get to(){return this.selectedDays[1]||""}set to(l){this.selectedDays[1]=l,this.selectedDays.splice(2)}get from(){return this.selectedDays[0]||""}set from(l){this.selectedDays[0]=l,this.selectedDays.splice(2)}clickDate=(l)=>{let i=l.target.getAttribute("title");this.selectDate(i)};keyDate=(l)=>{let i=!1;switch(l.code){case"Space":{let y=l.target.getAttribute("title");this.selectDate(y),i=!0;break}case"Tab":break;default:console.log(l)}if(i)l.preventDefault(),l.stopPropagation()};#l="";selectDate=(l)=>{if(this.#l=l,this.range){if(!this.to)this.selectedDays=[l,l];else if(this.from===l&&this.to===l)this.selectedDays=[];else if(this.from===l)this.from=this.to;else if(this.to===l)this.to=this.from;else if(l<this.from)this.from=l;else if(l>this.to)this.to=l;else this.to=l;this.value=`${this.from},${this.to}`}else if(this.multiple){if(this.selectedDays.includes(l))this.selectedDays.splice(this.selectedDays.indexOf(l),1);else this.selectedDays.push(l),this.selectedDays.sort();this.value=this.selectedDays.join(",")}else if(this.selectable)if(this.selectedDays.includes(l))this.value="",this.selectedDays=[];else this.value=l,this.selectedDays=[l]};nextMonth=()=>{if(this.month<12)this.gotoMonth(this.year,this.month+1);else this.gotoMonth(this.year+1,1)};previousMonth=()=>{if(this.month>1)this.gotoMonth(this.year,this.month-1);else this.gotoMonth(this.year-1,12)};checkDay=(l)=>{if(!this.range)return this.selectedDays.includes(l);else if(this.range)return this.from&&l>=this.from&&l<=this.to;return!1};dateMenuItem=(l,i="")=>{return l=l.split("T")[0],{caption:i||l,enabled:()=>!l.startsWith(`${this.year}-${P5(this.month)}-`),action:()=>{this.gotoDate(l)}}};jumpMenu=()=>{W({target:this.parts.jump,menuItems:[this.dateMenuItem(new Date().toISOString(),"This Month"),...this.selectedDays.length===0?[]:[null],...this.selectedDays.map((l)=>this.dateMenuItem(l))]})};content=()=>[q5({part:"header"},_5({part:"previous",onClick:this.previousMonth},w.chevronLeft()),I0({style:{flex:"1"}}),_5({part:"jump",onClick:this.jumpMenu},w.calendar()),E({part:"month",options:this.months,onChange:this.setMonth}),E({part:"year",options:[this.year],onChange:this.setMonth}),I0({style:{flex:"1"}}),_5({part:"next",onClick:this.nextMonth},w.chevronRight())),q5({part:"week"}),q5({part:"days"})];gotoDate(l){let i=new Date(l);this.gotoMonth(i.getFullYear(),i.getMonth()+1)}connectedCallback(){super.connectedCallback();let l=new Date(this.value.split(",").pop()||Date.now());if(isNaN(this.month))this.month=l.getMonth()+1;if(isNaN(this.year))this.year=l.getFullYear()}days=[];render(){super.render();let{week:l,days:i,jump:y,month:s,year:h,previous:x,next:o}=this.parts;this.selectedDays=this.value?this.value.split(","):[];let r=M2(this.year,this.month,1),c=new Date(r.valueOf()-(7+r.getDay()-this.weekStart)%7*T2),C=this.month===12?1:this.month+1,g=new Date(M2(this.year+(this.month===12?1:0),C,1).valueOf()-T2),k=new Date(g.valueOf()+(this.weekStart*2+5+this.endDay-g.getDay())%7*T2),p=o7.map((F)=>new Date(c.valueOf()+F*T2).toString().split(" ")[0]);this.days=[];let z=new Date().toISOString().split("T")[0];for(let F=c.valueOf();F<=k.valueOf();F+=T2){let q=new Date(F),_=q.toISOString().split("T")[0];this.days.push({date:q,selected:!1,inMonth:q.getMonth()+1===this.month,isToday:_===z,isWeekend:q.getDay()%6===0,inRange:!!(this.from&&_>=this.from&&_<=this.to)})}s.value=String(this.month),h.value=String(this.year),s.disabled=h.disabled=y.disabled=x.disabled=o.disabled=this.disabled||this.readonly,h.options=this.years,l.textContent="",l.append(...p.map((F)=>I0({class:"day"},F))),i.textContent="";let v=null,{to:V,from:P}=this;i.append(...this.days.map((F)=>{let q=["date"];if(F.inMonth)q.push("in-month");if(F.isToday)q.push("today");let _=F.date.toISOString().split("T")[0];if(this.checkDay(_))q.push("checked");if(q.push(F.isWeekend?"weekend":"weekday"),this.range){if(V===_)q.push("range-end");if(P===_)q.push("range-start")}let N=I0({class:q.join(" "),title:_,onClick:this.clickDate,onKeydown:this.keyDate,tabindex:"0"},F.date.getDate());if(_===this.#l)v=N;return N})),v?.focus()}}var c7=F5.elementCreator();var{div:O5,button:C7}=a,g7={error:"red",warn:"orange",info:"royalblue",log:"gray",success:"green",progress:"royalblue"};class f1 extends t{static preferredTagName="tosi-notification";static singleton;static shadowStyleSpec={":host":{_notificationSpacing:8,_notificationWidth:360,_notificationPadding:`${n.notificationSpacing} ${n.notificationSpacing50} ${n.notificationSpacing} ${n.notificationSpacing200}`,_notificationBg:"#fafafa",_notificationAccentColor:"#aaa",_notificationTextColor:"#444",_notificationIconSize:n.notificationSpacing300,_notificationButtonSize:48,_notificationBorderWidth:"3px 0 0",_notificationBorderRadius:n.notificationSpacing50,position:"fixed",left:0,right:0,bottom:0,paddingBottom:n.notificationSpacing,width:n.notificationWidth,display:"flex",flexDirection:"column-reverse",margin:"0 auto",gap:n.notificationSpacing,maxHeight:"50vh",overflow:"hidden auto",boxShadow:"none !important"},":host *":{color:n.notificationTextColor},":host .note":{display:"grid",background:n.notificationBg,padding:n.notificationPadding,gridTemplateColumns:`${n.notificationIconSize} 1fr ${n.notificationButtonSize}`,gap:n.notificationSpacing,alignItems:"center",borderRadius:n.notificationBorderRadius,boxShadow:`0 2px 8px #0006, inset 0 0 0 2px ${n.notificationAccentColor}`,borderColor:n.notificationAccentColor,borderWidth:n.notificationBorderWidth,borderStyle:"solid",transition:"0.5s ease-in",transitionProperty:"margin, opacity",zIndex:1},":host .note .icon":{stroke:n.notificationAccentColor},":host .note button":{display:"flex",lineHeight:n.notificationButtonSize,padding:0,margin:0,height:n.notificationButtonSize,width:n.notificationButtonSize,background:"transparent",alignItems:"center",justifyContent:"center",boxShadow:"none",border:"none",position:"relative"},":host .note button:hover svg":{stroke:n.notificationAccentColor},":host .note button:active svg":{borderRadius:99,stroke:n.notificationBg,background:n.notificationAccentColor,padding:n.spacing50},":host .note svg":{height:n.notificationIconSize,width:n.notificationIconSize,pointerEvents:"none"},":host .message":{display:"flex",flexDirection:"column",alignItems:"center",gap:n.notificationSpacing},":host .note.closing":{opacity:0,zIndex:0}};static removeNote(l){l.classList.add("closing"),l.style.marginBottom=-l.offsetHeight+"px";let i=()=>{l.remove()};l.addEventListener("transitionend",i),setTimeout(i,1000)}static post(l){let{message:i,duration:y,type:s,close:h,progress:x,icon:o,color:r}=Object.assign({type:"info",duration:-1},typeof l==="string"?{message:l}:l);if(!this.singleton)this.singleton=U5();let c=this.singleton;document.body.append(c),c.style.zIndex=String(M1()+1);let C=r||g7[s],g=x||s==="progress"?a.progress():{},k=()=>{if(h)h();f1.removeNote(v)},p=o instanceof SVGElement?o:o?w[o]({class:"icon"}):w.info({class:"icon"}),z=s==="error"||s==="warn",v=O5({class:`note ${s}`,role:z?"alert":"status",ariaLive:z?"assertive":"polite",style:{_notificationAccentColor:C}},p,O5({class:"message"},O5(i),g),C7({class:"close",title:"close",ariaLabel:"Close notification",apply(V){V.addEventListener("click",k)}},w.x()));if(c.shadowRoot.append(v),g instanceof HTMLProgressElement&&x instanceof Function){g.setAttribute("max",String(100)),g.value=x();let V=setInterval(()=>{if(!c.shadowRoot.contains(v)){clearInterval(V);return}let P=x();if(g.value=P,P>=100)f1.removeNote(v)},1000)}if(y>0)setTimeout(()=>{f1.removeNote(v)},y*1000);return v.scrollIntoView(),k}content=null}var n7=f1,U5=f1.elementCreator(),k7=U5;function d7(l){return f1.post(l)}var Dl=async(l,i="SHA-1")=>{let s=new TextEncoder().encode(l),h=await crypto.subtle.digest(i,s);return Array.from(new Uint8Array(h)).map((r)=>r.toString(16).padStart(2,"0")).join("")},Sl=async(l)=>{let i=await Dl(l),y=await fetch(`https://weakpass.com/api/v1/search/${i}`);if(y.ok){let s=await y.json();console.log("password found in weakpass database",s)}return y.status!==404},{span:X5,xinSlot:p7}=a;class Y0 extends t{static preferredTagName="tosi-password-strength";static lightStyleSpec={":host":{display:"inline-flex",flexDirection:"column",gap:n.spacing50,position:"relative"},":host xin-slot":{display:"flex"},':host [part="meter"]':{display:"block",position:"relative",height:d.meterHeight("24px"),background:d.indicatorBg("white"),borderRadius:d.meterRadius("4px"),boxShadow:d.meterShadow(`inset 0 0 0 2px ${n.indicatorColor}`)},':host [part="level"]':{height:d.levelHeight("20px"),content:'" "',display:"inline-block",width:0,transition:"0.15s ease-out",background:n.indicatorColor,margin:d.levelMargin("2px"),borderRadius:d.levelRadius("2px")},':host [part="description"]':{position:"absolute",inset:"0",color:n.descriptionColor,height:d.meterHeight("24px"),lineHeight:d.meterHeight("24px"),textAlign:"center"}};static initAttributes={minLength:8,goodLength:12,indicatorColors:"#f00,#f40,#f80,#ef0,#8f0,#0a2"};descriptionColors="#000,#000,#000,#000,#000,#fff";issues={tooShort:!0,short:!0,noUpper:!0,noLower:!0,noNumber:!0,noSpecial:!0};issueDescriptions={tooShort:"too short",short:"short",noUpper:"no upper case",noLower:"no lower case",noNumber:"no digits",noSpecial:"no unusual characters"};value=0;strengthDescriptions=["unacceptable","very weak","weak","moderate","strong","very strong"];strength(l){return this.issues={tooShort:l.length<this.minLength,short:l.length<this.goodLength,noUpper:!l.match(/[A-Z]/),noLower:!l.match(/[a-z]/),noNumber:!l.match(/[0-9]/),noSpecial:!l.match(/[^a-zA-Z0-9]/)},this.issues.tooShort?0:Object.values(this.issues).filter((i)=>!i).length-1}async isBreached(){let l=this.querySelector("input")?.value;if(!l||typeof l!=="string")return!0;return await Sl(l)}updateIndicator=(l)=>{let{level:i,description:y}=this.parts,s=this.indicatorColors.split(","),h=this.descriptionColors.split(","),x=this.strength(l);if(this.value!==x)this.value=x,this.dispatchEvent(new Event("change"));i.style.width=`${(x+1)*16.67}%`,this.style.setProperty("--indicator-color",s[x]),this.style.setProperty("--description-color",h[x]),y.textContent=this.strengthDescriptions[x]};update=(l)=>{let i=l.target.closest("input");this.updateIndicator(i?.value||"")};content=()=>[p7({onInput:this.update}),X5({part:"meter"},X5({part:"level"}),X5({part:"description"}))];render(){super.render();let l=this.querySelector("input");this.updateIndicator(l?.value)}}var w7=Y0,Tl=Y0.elementCreator(),a7=Tl;var{span:N5}=a;class D0 extends t{static preferredTagName="tosi-rating";static formAssociated=!0;static initAttributes={max:5,min:1,icon:"star",step:1,ratingStroke:"#e81",ratingFill:"#f91",emptyStroke:"none",emptyFill:"#ccc",readonly:!1,iconSize:24,hollow:!1,required:!1,name:""};value="";formDisabledCallback(l){this.readonly=l}formResetCallback(){this.value=""}static shadowStyleSpec={":host":{display:"inline-block",position:"relative",width:"fit-content"},":host::part(container)":{position:"relative",display:"inline-block"},":host::part(empty), :host::part(filled)":{height:"100%",whiteSpace:"nowrap",overflow:"hidden"},":host::part(empty)":{pointerEvents:"none"},":host::part(filled)":{position:"absolute",left:0,transition:"width 0.15s ease-out"},":host svg":{transform:"scale(0.9)",pointerEvents:"all !important",transition:"0.25s ease-in-out"},":host svg:hover":{transform:"scale(1)"},":host svg:active":{transform:"scale(1.1)"}};content=()=>N5({part:"container"},N5({part:"empty"}),N5({part:"filled"}));displayValue(l){let{empty:i,filled:y}=this.parts,h=Math.round((typeof l==="string"?0:l||0)/this.step)*this.step;y.style.width=h/this.max*i.offsetWidth+"px"}update=(l)=>{if(this.readonly)return;let{empty:i}=this.parts,y=l instanceof MouseEvent?l.pageX-i.getBoundingClientRect().x:0,s=Math.min(Math.max(this.min,Math.round(y/i.offsetWidth*this.max/this.step+this.step*0.5)*this.step),this.max);if(l.type==="click")this.value=s;else if(l.type==="mousemove")this.displayValue(s);else this.displayValue(this.value||0)};handleKey=(l)=>{let i=this.value===""?NaN:Number(this.value);if(isNaN(i))i=Math.round((this.min+this.max)*0.5*this.step)*this.step;let y=!1;switch(l.key){case"ArrowUp":case"ArrowRight":i+=this.step,y=!0;break;case"ArrowDown":case"ArrowLeft":i-=this.step,y=!0;break}if(this.value=Math.max(Math.min(i,this.max),this.min),y)l.stopPropagation(),l.preventDefault()};connectedCallback(){super.connectedCallback();let{container:l}=this.parts;l.tabIndex=0,l.addEventListener("mousemove",this.update,!0),l.addEventListener("mouseleave",this.update),l.addEventListener("blur",this.update),l.addEventListener("click",this.update),l.addEventListener("keydown",this.handleKey)}_renderedIcon="";render(){super.render();let l=this.iconSize+"px";if(this.style.setProperty("--tosi-icon-size",l),this.readonly)this.role="image";else this.role="slider";this.ariaLabel=`rating ${this.value} out of ${this.max}`,this.ariaValueMax=String(this.max),this.ariaValueMin=String(this.min),this.ariaValueNow=this.value===""?String(-1):String(this.value);let{empty:i,filled:y}=this.parts;if(i.classList.toggle("hollow",this.hollow),i.style.setProperty("--tosi-icon-fill",this.emptyFill),i.style.setProperty("--tosi-icon-stroke",this.emptyStroke),y.style.setProperty("--tosi-icon-fill",this.ratingFill),y.style.setProperty("--tosi-icon-stroke",this.ratingStroke),this._renderedIcon!==this.icon){this._renderedIcon=this.icon;for(let s=0;s<this.max;s++)i.append(w[this.icon]()),y.append(w[this.icon]())}this.displayValue(this.value)}}var v7=D0,Ml=D0.elementCreator(),B7=D((...l)=>Ml(...l),"xinRating is deprecated, use tosiRating instead (tag is now <tosi-rating>)");var{xinSlot:ul,div:t7,button:z7,span:ml}=a,j7=[{caption:"Title",tagType:"H1"},{caption:"Heading",tagType:"H2"},{caption:"Subheading",tagType:"H3"},{caption:"Minor heading",tagType:"H4"},{caption:"Body",tagType:"P"},{caption:"Code Block",tagType:"PRE"}];function K5(l=j7){return E({title:"paragraph style",slot:"toolbar",class:"block-style",options:l.map(({caption:i,tagType:y})=>({caption:i,value:`formatBlock,${y}`}))})}function B2(l="10px"){return ml({slot:"toolbar",style:{flex:`0 0 ${l}`,content:" "}})}function A7(l="10px"){return ml({slot:"toolbar",style:{flex:`0 0 ${l}`,content:" "}})}function g1(l,i,y){return z7({slot:"toolbar",dataCommand:i,title:l},y)}var V7=()=>[g1("left-justify","justifyLeft",w.alignLeft()),g1("center","justifyCenter",w.alignCenter()),g1("right-justify","justifyRight",w.alignRight()),B2(),g1("bullet list","insertUnorderedList",w.listBullet()),g1("numbered list","insertOrderedList",w.listNumber()),B2(),g1("indent","indent",w.indent()),g1("indent","outdent",w.outdent())],Ll=()=>[g1("bold","bold",w.fontBold()),g1("italic","italic",w.fontItalic()),g1("underline","underline",w.fontUnderline())],q7=()=>[K5(),B2(),...Ll()],El=()=>[K5(),B2(),...V7(),B2(),...Ll()];class S0 extends t{static preferredTagName="tosi-rich-text";static lightStyleSpec={":host":{display:"flex",flexDirection:"column",height:"100%"},':host [part="toolbar"]':{padding:4,display:"flex",gap:"0px",flex:"0 0 auto",flexWrap:"wrap"},':host [part="toolbar"] > button':{_xinIconSize:18}};static formAssociated=!0;static initAttributes={widgets:"default",name:"",required:!1};isInitialized=!1;savedValue="";formDisabledCallback(l){if(this.isInitialized)this.parts.doc.contentEditable=l?"false":"true"}formResetCallback(){this.value=""}_value="";get value(){return this.isInitialized?this.parts.doc.innerHTML:this._value}set value(l){let i=this._value;if(this._value=l,this.isInitialized){if(this.parts.doc.innerHTML!==l)this.parts.doc.innerHTML=l}if(i!==l&&this.internals)this.internals.setFormValue(l)}blockElement(l){let{doc:i}=this.parts;while(l.parentElement!==null&&l.parentElement!==i)l=l.parentElement;return l.parentElement===i?l:void 0}get selectedBlocks(){let{doc:l}=this.parts,i=window.getSelection();if(i===null)return[];let y=[];for(let s=0;s<i.rangeCount;s++){let h=i.getRangeAt(s);if(!l.contains(h.commonAncestorContainer))continue;let x=this.blockElement(h.startContainer),o=this.blockElement(h.endContainer);y.push(x);while(x!==o&&x!==null)x=x.nextElementSibling,y.push(x)}return y}get selectedText(){let l=window.getSelection();if(l===null)return"";return this.selectedBlocks.length?l.toString():""}selectionChange=()=>{};_updatingBlockStyle=!1;handleSelectChange=(l)=>{if(this._updatingBlockStyle)return;let y=l.target?.closest(B1.tagName);if(y==null)return;this.doCommand(y.value)};handleButtonClick=(l)=>{let y=l.target?.closest("button");if(y==null)return;this.doCommand(y.dataset.command)};content=[ul({name:"toolbar",part:"toolbar",onClick:this.handleButtonClick,onChange:this.handleSelectChange}),t7({part:"doc",contenteditable:!0,style:{flex:"1 1 auto",outline:"none"}}),ul({part:"content"})];doCommand(l){if(l===void 0)return;let i=l.split(",");console.log("execCommand",i[0],!1,...i.slice(1)),document.execCommand(i[0],!1,...i.slice(1))}updateBlockStyle(){let l=this.parts.toolbar.querySelector(".block-style");if(l===null)return;let i=this.selectedBlocks.map((y)=>y.tagName);i=[...new Set(i)],this._updatingBlockStyle=!0,l.value=i.length===1?`formatBlock,${i[0]}`:"",this._updatingBlockStyle=!1}hasContent(){return(this.parts.doc.textContent||"").trim().length>0}handleInput=()=>{if(this.internals)this.internals.setFormValue(this.parts.doc.innerHTML),this.updateValidity()};updateValidity(){if(this.internals)if(this.required&&!this.hasContent())this.internals.setValidity({valueMissing:!0},"Please enter some content",this.parts.doc);else this.internals.setValidity({})}connectedCallback(){super.connectedCallback();let{doc:l,content:i}=this.parts;if(i.innerHTML!==""&&l.innerHTML==="")l.innerHTML=i.innerHTML,i.innerHTML="";this.isInitialized=!0,i.style.display="none",l.addEventListener("input",this.handleInput),this.updateValidity(),document.addEventListener("selectionchange",(y)=>{this.updateBlockStyle(),this.selectionChange(y,this)})}render(){let{toolbar:l}=this.parts;if(super.render(),l.children.length===0)switch(this.widgets){case"minimal":l.append(...q7());break;case"default":l.append(...El());break}}}var _7=S0,li=S0.elementCreator(),P7=D((...l)=>li(...l),"richText is deprecated, use tosiRichText instead (tag is now <tosi-rich-text>)");var{div:F7,slot:O7,label:U7,span:X7,input:ii}=a;class t2 extends t{static preferredTagName="tosi-segmented";static formAssociated=!0;static initAttributes={direction:"row",other:"",multiple:!1,name:"",placeholder:"Please specify…",localized:!1,required:!1};_choices=[];get choices(){return this._choices}set choices(l){if(typeof l==="string")this._choices=t2.parseChoicesString(l);else this._choices=l;this.queueRender()}static parseChoicesString(l){return l.split(",").filter((i)=>i.trim()!=="").map((i)=>{let[y,s]=i.split("=").map((r)=>r.trim()),[h,x]=(s||y).split(":").map((r)=>r.trim()),o=x?w[x]():"";return{value:y,icon:o,caption:h}})}value="";formDisabledCallback(l){}formResetCallback(){this.value=""}get values(){return(this.value||"").split(",").map((l)=>l.trim()).filter((l)=>l!=="")}content=()=>[O7(),F7({part:"options"},ii({part:"custom",hidden:!0}))];static shadowStyleSpec={":host":{display:"inline-flex",gap:d.segmentedOptionGap("8px"),alignItems:d.segmentedAlignItems("center")},":host, :host::part(options)":{flexDirection:d.segmentedDirection("row")},":host label":{display:"inline-grid",alignItems:"center",gap:d.segmentedOptionGap("8px"),gridTemplateColumns:d.segmentedOptionGridColumns("0px 24px 1fr"),padding:d.segmentedOptionPadding("4px 12px"),font:d.segmentedOptionFont("16px")},":host label:focus":{outline:"none",boxShadow:d.segmentedFocusShadow(`inset 0 0 0 2px ${d.segmentedOptionCurrentBackground("#44a")}`),borderRadius:d.segmentedOptionsBorderRadius("8px")},":host label:has(:checked)":{color:d.segmentedOptionCurrentColor("#eee"),background:d.segmentedOptionCurrentBackground("#44a")},":host label:has(:checked):focus":{boxShadow:d.segmentedCurrentFocusShadow(`inset 0 0 0 2px ${d.segmentedOptionCurrentColor("#eee")}`)},":host svg":{height:d.segmentOptionIconSize("16px"),stroke:d.segmentedOptionIconColor("currentColor")},":host label.no-icon":{gap:0,gridTemplateColumns:d.segmentedOptionGridColumns("0px 1fr")},':host input[type="radio"], :host input[type="checkbox"]':{visibility:d.segmentedInputVisibility("hidden")},":host::part(options)":{display:"flex",borderRadius:d.segmentedOptionsBorderRadius("8px"),background:d.segmentedOptionsBackground("#fff"),color:d.segmentedOptionColor("#222"),overflow:"hidden",alignItems:d.segmentedOptionAlignItems("stretch")},":host::part(custom)":{padding:d.segmentedOptionPadding("4px 12px"),color:d.segmentedOptionCurrentColor("#eee"),background:d.segmentedOptionCurrentBackground("#44a"),font:d.segmentedOptionFont("16px"),border:"0",outline:"none"},":host::part(custom)::placeholder":{color:d.segmentedOptionCurrentColor("#eee"),opacity:d.segmentedPlaceholderOpacity(0.75)}};valueChanged=!1;handleChange=()=>{let{options:l,custom:i}=this.parts;if(this.multiple){let y=[...l.querySelectorAll("input:checked")];this.value=y.map((s)=>s.value).join(",")}else{let y=l.querySelector("input:checked");if(!y)this.value="";else if(y.value)i.setAttribute("hidden",""),this.value=y.value;else i.removeAttribute("hidden"),i.focus(),i.select(),this.value=i.value}this.valueChanged=!0};handleKey=(l)=>{let i=!1;switch(l.code){case"Space":if(l.target instanceof HTMLLabelElement)l.target.click(),i=!0;break;case"Tab":if(!(l.target instanceof HTMLLabelElement))l.target.closest("label").focus();break;case"ArrowLeft":case"ArrowUp":{let y=l.target.closest("label");if(y.previousElementSibling instanceof HTMLLabelElement)y.previousElementSibling.focus()}i=!0;break;case"ArrowRight":case"ArrowDown":{let y=l.target.closest("label");if(y.nextElementSibling instanceof HTMLLabelElement)y.nextElementSibling.focus()}i=!0;break}if(i)l.preventDefault(),l.stopPropagation()};connectedCallback(){super.connectedCallback();let l=this.getAttribute("choices");if(l&&this._choices.length===0)this._choices=t2.parseChoicesString(l);let{options:i}=this.parts;if(this.name==="")this.name=this.instanceId;if(i.addEventListener("change",this.handleChange),i.addEventListener("keydown",this.handleKey),this.other&&this.multiple)console.warn(this,"is set to [other] and [multiple]; [other] will be ignored"),this.other=""}get _choicesWithOther(){let l=[...this.choices];if(this.other&&!this.multiple){let[i,y]=this.other.split(":");l.push({value:"",caption:i,icon:y})}return l}get isOtherValue(){return Boolean(this.value===""||this.value&&!this._choicesWithOther.find((l)=>l.value===this.value))}render(){if(super.render(),this.valueChanged){this.valueChanged=!1;return}let{options:l,custom:i}=this.parts;l.textContent="";let y=this.multiple?"checkbox":"radio",{values:s,isOtherValue:h}=this;if(l.append(...this._choicesWithOther.map((x)=>{return U7({tabindex:0},ii({type:y,name:this.name,value:x.value,checked:s.includes(x.value)||x.value===""&&h,tabIndex:-1}),x.icon||{class:"no-icon"},this.localized?z1(x.caption):X7(x.caption))})),this.other&&!this.multiple)i.hidden=!h,i.value=h?this.value:"",i.placeholder=this.placeholder,l.append(i)}}var N7=t2,yi=t2.elementCreator(),K7=D((...l)=>yi(...l),"xinSegmented is deprecated, use tosiSegmented instead (tag is now <tosi-segmented>)");var{slot:si}=a;class Q5 extends t{static preferredTagName="tosi-sizebreak";static initAttributes={minWidth:0,minHeight:0};value="normal";content=[si({part:"normal"}),si({part:"small",name:"small"})];static shadowStyleSpec={":host":{display:"inline-block",position:"relative"}};onResize=()=>{let{normal:l,small:i}=this.parts,y=this.offsetParent;if(!(y instanceof HTMLElement))return;else if(y.offsetWidth<this.minWidth||y.offsetHeight<this.minHeight)l.hidden=!0,i.hidden=!1,this.value="small";else l.hidden=!1,i.hidden=!0,this.value="normal"};connectedCallback(){super.connectedCallback(),globalThis.addEventListener("resize",this.onResize)}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("resize",this.onResize)}}var Q7=Q5.elementCreator();class T0 extends t{static preferredTagName="tosi-sizer";target=null;static shadowStyleSpec={":host":{_resizeIconFill:"#222",display:"block",position:"absolute",bottom:-7,right:-7,padding:14,width:44,height:44,opacity:0.25,transition:"opacity 0.25s ease-out"},":host(:hover)":{opacity:0.5},":host svg":{width:16,height:16,stroke:n.resizeIconFill}};content=w.resize();get minSize(){let{minWidth:l,minHeight:i}=getComputedStyle(this.target);return{width:parseFloat(l)||32,height:parseFloat(i)||32}}resizeTarget=(l)=>{let{target:i}=this;if(!i)return;let{offsetWidth:y,offsetHeight:s}=i;i.style.left=i.offsetLeft+"px",i.style.top=i.offsetTop+"px",i.style.bottom="",i.style.right="";let{minSize:h}=this;T(l,(x,o,r)=>{if(i.style.width=Math.max(h.width,y+x)+"px",i.style.height=Math.max(h.height,s+o)+"px",r.type==="mouseup")return!0},"nwse-resize")};connectedCallback(){if(super.connectedCallback(),!this.target)this.target=this.parentElement;let l={passive:!0};this.addEventListener("mousedown",this.resizeTarget,l),this.addEventListener("touchstart",this.resizeTarget,l)}}var G7=T0,hi=T0.elementCreator(),b7=hi;var{div:W7,input:f7,span:R7,button:G5}=a;class u2 extends t{static preferredTagName="tosi-tag";static lightStyleSpec={":host":{"--tag-close-button-color":"#000c","--tag-close-button-bg":"#fffc","--tag-button-opacity":"0.5","--tag-button-hover-opacity":"0.75","--tag-bg":d.brandColor("blue"),"--tag-text-color":d.brandTextColor("white"),display:"inline-flex",borderRadius:d.tagRoundedRadius(n.spacing50),color:n.tagTextColor,background:n.tagBg,padding:`0 ${n.spacing75} 0 ${n.spacing75}`,height:`calc(${n.lineHeight} + ${n.spacing50})`,lineHeight:`calc(${n.lineHeight} + ${n.spacing50})`},':host > [part="caption"]':{position:"relative",whiteSpace:"nowrap",overflow:"hidden",flex:"1 1 auto",fontSize:d.fontSize("16px"),color:n.tagTextColor,textOverflow:"ellipsis"},':host [part="remove"]':{boxShadow:"none",margin:`0 ${n.spacing_50} 0 ${n.spacing25}`,padding:0,display:"inline-flex",alignItems:"center",alignSelf:"center",justifyContent:"center",height:n.spacing150,width:n.spacing150,color:n.tagCloseButtonColor,background:n.tagCloseButtonBg,borderRadius:d.tagCloseButtonRadius("99px"),opacity:n.tagButtonOpacity},':host [part="remove"]:hover':{background:n.tagCloseButtonBg,opacity:n.tagButtonHoverOpacity}};static initAttributes={caption:"",removeable:!1};removeCallback=()=>{this.remove()};content=()=>[R7({part:"caption"},this.caption),G5(w.x(),{type:"button",part:"remove",hidden:!this.removeable,ariaLabel:`Remove ${this.caption}`,onClick:this.removeCallback})]}var Z7=u2,b5=u2.elementCreator(),H7=D((...l)=>b5(...l),"xinTag is deprecated, use tosiTag instead (tag is now <tosi-tag>)");class z2 extends t{static preferredTagName="tosi-tag-list";static lightStyleSpec={":host":{"--tag-list-bg":"#f8f8f8","--touch-size":"44px","--spacing":"16px",display:"grid",gridTemplateColumns:"auto",alignItems:"center",background:n.tagListBg,gap:n.spacing25,borderRadius:d.taglistRoundedRadius(n.spacing50),overflow:"hidden"},":host[editable]":{gridTemplateColumns:`0px auto ${n.touchSize}`},":host[editable][text-entry]":{gridTemplateColumns:`0px 2fr 1fr ${n.touchSize}`},':host [part="tagContainer"]':{display:"flex",content:'" "',alignItems:"center",background:n.inputBg,borderRadius:d.tagContainerRadius(n.spacing50),boxShadow:n.borderShadow,flexWrap:"nowrap",overflow:"auto hidden",gap:n.spacing25,minHeight:`calc(${n.lineHeight} + ${n.spacing})`,padding:n.spacing25},':host [part="tagMenu"]':{width:n.touchSize,height:n.touchSize,lineHeight:n.touchSize,textAlign:"center",padding:0,margin:0},":host [hidden]":{display:"none !important"},':host button[part="tagMenu"]':{background:n.brandColor,color:n.brandTextColor}};static formAssociated=!0;static initAttributes={name:"",textEntry:!1,editable:!1,placeholder:"enter tags",disabled:!1,required:!1};value="";get tags(){return this.value.split(",").map((l)=>l.trim()).filter((l)=>l!=="")}set tags(l){this.value=l.join(",")}_availableTags=[];get availableTags(){return this._availableTags}set availableTags(l){if(typeof l==="string")this._availableTags=z2.parseAvailableTagsString(l);else this._availableTags=l;this.queueRender()}static parseAvailableTagsString(l){return l.split(",").map((i)=>{let y=i.trim();return y===""?null:y})}connectedCallback(){super.connectedCallback();let l=this.getAttribute("available-tags");if(l&&this._availableTags.length===0)this._availableTags=z2.parseAvailableTagsString(l)}formDisabledCallback(l){this.disabled=l}formResetCallback(){this.value=""}addTag=(l)=>{let i=l.trim();if(i===""||this.tags.includes(i))return;this.tags=[...this.tags,i],this.queueRender(!0)};toggleTag=(l)=>{if(this.tags.includes(l))this.tags=this.tags.filter((i)=>i!==l),this.queueRender(!0);else this.addTag(l)};enterTag=(l)=>{let{tagInput:i}=this.parts;switch(l.key){case",":{let y=i.value.split(",")[0];this.addTag(y)}break;case"Enter":{let y=i.value.split(",")[0];this.addTag(y)}l.stopPropagation(),l.preventDefault();break;default:}};popSelectMenu=()=>{let{toggleTag:l}=this,{tagMenu:i}=this.parts,y=[...this.availableTags],s=this.tags.filter((x)=>!y.includes(x));if(s.length)y.push(null,...s);let h=y.map((x)=>{if(x===""||x===null)return null;else if(typeof x==="object")return{checked:()=>this.tags.includes(x.value),caption:x.caption,action(){l(x.value)}};else return{checked:()=>this.tags.includes(x),caption:x,action(){l(x)}}});W({target:i,width:"auto",menuItems:h})};content=()=>[G5({type:"button",style:{visibility:"hidden"},tabindex:-1}),W7({part:"tagContainer",class:"row",role:"list",ariaLabel:"Selected tags"}),f7({part:"tagInput",class:"elastic",ariaLabel:"Enter new tag",onKeydown:this.enterTag}),G5({type:"button",title:"add tag",ariaLabel:"Select tags from list",ariaHaspopup:"listbox",part:"tagMenu",onClick:this.popSelectMenu},w.chevronDown())];removeTag=(l)=>{if(this.editable&&!this.disabled){let i=l.target.closest(u2.tagName);this.tags=this.tags.filter((y)=>y!==i.caption),i.remove(),this.queueRender(!0)}l.stopPropagation(),l.preventDefault()};render(){super.render();let{tagContainer:l,tagMenu:i,tagInput:y}=this.parts;if(i.disabled=this.disabled,y.value="",y.setAttribute("placeholder",this.placeholder),this.editable&&!this.disabled)i.toggleAttribute("hidden",!1),y.toggleAttribute("hidden",!this.textEntry);else i.toggleAttribute("hidden",!0),y.toggleAttribute("hidden",!0);l.textContent="";for(let s of this.tags)l.append(b5({caption:s,removeable:this.editable&&!this.disabled,removeCallback:this.removeTag}))}}var J7=z2,xi=z2.elementCreator(),$7=D((...l)=>xi(...l),"xinTagList is deprecated, use tosiTagList instead (tag is now <tosi-tag-list>)");var oi="1.3.7";var W5={accent:j.fromCss("#EE257B"),background:j.fromCss("#fafafa"),text:j.fromCss("#222222")},ri={_tosiSpacingXs:"4px",_tosiSpacingSm:"8px",_tosiSpacing:"12px",_tosiSpacingLg:"16px",_tosiSpacingXl:"24px",_tosiFontFamily:"system-ui, -apple-system, sans-serif",_tosiFontSize:"16px",_tosiLineHeight:"1.5",_tosiCodeFontFamily:"ui-monospace, monospace",_tosiCodeFontSize:"14px",_tosiTouchSize:"44px",_tosiBorderRadius:"4px",_tosiBorderRadiusLg:"8px",_tosiTransition:"0.15s ease-out"};function e7(l){let{accent:i,background:y,text:s}=l,h=l.accentText??i.contrasting(),x=l.backgroundInset??y.darken(0.03),o=l.border??s.opacity(0.15),r=l.shadow??s.opacity(0.1),c=l.focus??i.opacity(0.5);return{_tosiAccent:i,_tosiAccentLight:i.brighten(0.15),_tosiAccentDark:i.darken(0.15),_tosiAccentText:h,_tosiBg:y,_tosiBgInset:x,_tosiBgHover:y.darken(0.05),_tosiBgActive:y.darken(0.1),_tosiText:s,_tosiTextMuted:s.opacity(0.6),_tosiTextDisabled:s.opacity(0.4),_tosiBorder:o,_tosiBorderFocus:i,_tosiShadow:r,_tosiShadowColor:r,_tosiFocusRing:`0 0 0 2px ${c}`,_tosiInputBg:y,_tosiInputBorder:o,_tosiInputBorderFocus:i,_tosiButtonBg:y,_tosiButtonText:s,_tosiButtonBorder:o,_tosiButtonHoverBg:y.darken(0.05),_tosiButtonActiveBg:i,_tosiButtonActiveText:h}}function M0(l){return{":root":{...ri,...e7(l)}}}function ci(l){let y=M0(l)[":root"];return{":root":j4(y)}}function I7(l,i="tosi-theme"){D1(i,l)}var Y7=M0(W5),D7=ci(W5),Ci={"--xin-icon-size":n.tosiIconSize,"--xin-icon-fill":n.tosiIconFill,"--xin-icon-stroke":n.tosiIconStroke,"--xin-tabs-bar-color":n.tosiTabsBarColor,"--xin-tabs-bar-height":n.tosiTabsBarHeight,"--xin-tabs-selected-color":n.tosiTabsSelectedColor,"--spacing":n.tosiSpacing,"--gap":n.tosiSpacingSm,"--touch-size":n.tosiTouchSize,"--background":n.tosiBg,"--text-color":n.tosiText,"--brand-color":n.tosiAccent,"--brand-text-color":n.tosiAccentText};function S7(l){return{":root":{...M0(l)[":root"],...Ci}}}function T7(l,i){let y={};for(let[s,h]of Object.entries(i)){let x=`--tosi-${l}-${s.replace(/([A-Z])/g,"-$1").toLowerCase()}`;y[s]=`var(${x}, ${h})`}return y}Object.assign(globalThis,{xinjs:K2,xinjsui:f5});})();
98
98
 
99
- //# debugId=4E01D9F836D77FA364756E2164756E21
99
+ //# debugId=50C4501100957BDA64756E2164756E21
100
100
  //# sourceMappingURL=iife.js.map