tosijs-ui 1.6.16 → 1.6.17

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.17
4
+
5
+ ### Fixed
6
+
7
+ - **`@resvg/resvg-js` is now an optional peer dependency** (it was only a dev
8
+ dependency). It rasterizes the generated ePub cover and belongs to the same
9
+ doc-site pipeline as `happy-dom`, which was already an optional peer — so an
10
+ adopter building ePubs via `tosijs-ui/site` got `happy-dom` surfaced by their
11
+ package manager but not `resvg`, and their book's cover silently failed to
12
+ generate. Both are still lazy-loaded with a graceful warning when absent.
13
+
3
14
  ## 1.6.16
4
15
 
5
16
  Doc-system: prose/book adoption. Component APIs are unchanged; everything here is
package/dist/iife.js CHANGED
@@ -208,7 +208,7 @@ ${l.join(`
208
208
  `)||"(idle)"}`}).join(`
209
209
  `)}var{slot:y9}=K;class x9 extends U{static preferredTagName="tosi-row";static initAttributes={gap:"",wrap:!1,align:"",justify:""};content=[y9()];static shadowStyleSpec={":host":{display:"flex",flexDirection:"row",gap:P.tosiRowGap("0"),alignItems:P.tosiRowAlign("stretch"),justifyContent:P.tosiRowJustify("flex-start")}};render(){if(super.render(),this.gap)this.style.setProperty("--tosi-row-gap",this.gap);else this.style.removeProperty("--tosi-row-gap");if(this.align)this.style.setProperty("--tosi-row-align",this.align);else this.style.removeProperty("--tosi-row-align");if(this.justify)this.style.setProperty("--tosi-row-justify",this.justify);else this.style.removeProperty("--tosi-row-justify");this.style.flexWrap=this.wrap?"wrap":""}}var yC=x9.elementCreator();class h9 extends U{static preferredTagName="tosi-column";static initAttributes={gap:"",wrap:!1,align:"",justify:""};content=[y9()];static shadowStyleSpec={":host":{display:"flex",flexDirection:"column",gap:P.tosiColumnGap("0"),alignItems:P.tosiColumnAlign("stretch"),justifyContent:P.tosiColumnJustify("flex-start")}};render(){if(super.render(),this.gap)this.style.setProperty("--tosi-column-gap",this.gap);else this.style.removeProperty("--tosi-column-gap");if(this.align)this.style.setProperty("--tosi-column-align",this.align);else this.style.removeProperty("--tosi-column-align");if(this.justify)this.style.setProperty("--tosi-column-justify",this.justify);else this.style.removeProperty("--tosi-column-justify");this.style.flexWrap=this.wrap?"wrap":""}}var xC=h9.elementCreator();class l9 extends U{static preferredTagName="tosi-grid";static initAttributes={columns:"",rows:"",gap:""};content=[y9()];static shadowStyleSpec={":host":{display:"grid",gridTemplateColumns:P.tosiGridColumns("1fr"),gridTemplateRows:P.tosiGridRows("auto"),gap:P.tosiGridGap("0")}};render(){if(super.render(),this.columns)this.style.setProperty("--tosi-grid-columns",this.columns);else this.style.removeProperty("--tosi-grid-columns");if(this.rows)this.style.setProperty("--tosi-grid-rows",this.rows);else this.style.removeProperty("--tosi-grid-rows");if(this.gap)this.style.setProperty("--tosi-grid-gap",this.gap);else this.style.removeProperty("--tosi-grid-gap")}}var hC=l9.elementCreator(),{span:O7}=K,lC=(...y)=>O7({style:{flex:"1 1 var(--tosi-space, 0.5em)"}},...y),i9=(...y)=>O7({style:{flex:"0 0 var(--tosi-space, 0.5em)"}},...y);var b1={accent:O.fromCss("#EE257B"),background:O.fromCss("#fafafa"),text:O.fromCss("#222222")},F7={_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 X7(y){let{accent:x,background:h,text:l}=y,i=y.accentText??x.contrasting(),C=y.backgroundInset??h.darken(0.03),k=y.border??l.opacity(0.15),g=y.shadow??l.opacity(0.1),w=y.focus??x.opacity(0.5);return{_tosiAccent:x,_tosiAccentLight:x.brighten(0.15),_tosiAccentDark:x.darken(0.15),_tosiAccentText:i,_tosiBg:h,_tosiBgInset:C,_tosiBgHover:h.darken(0.05),_tosiBgActive:h.darken(0.1),_tosiText:l,_tosiTextMuted:l.opacity(0.6),_tosiTextDisabled:l.opacity(0.4),_tosiBorder:k,_tosiBorderFocus:x,_tosiShadow:g,_tosiShadowColor:g,_tosiFocusRing:`0 0 0 2px ${w}`,_tosiInputBg:h,_tosiInputBorder:k,_tosiInputBorderFocus:x,_tosiButtonBg:h,_tosiButtonText:l,_tosiButtonBorder:k,_tosiButtonHoverBg:h.darken(0.05),_tosiButtonActiveBg:x,_tosiButtonActiveText:i}}function H2(y){return{":root":{...F7,...X7(y)}}}function D4(y){let h=H2(y)[":root"];return{":root":x0(h)}}function C9(y,x="tosi-theme"){Q1(x,y)}var iC=H2(b1),CC=D4(b1),Y7={"--xin-icon-size":z.tosiIconSize,"--xin-icon-fill":z.tosiIconFill,"--xin-icon-stroke":z.tosiIconStroke,"--xin-tabs-bar-color":z.tosiTabsBarColor,"--xin-tabs-bar-height":z.tosiTabsBarHeight,"--xin-tabs-selected-color":z.tosiTabsSelectedColor,"--spacing":z.tosiSpacing,"--gap":z.tosiSpacingSm,"--touch-size":z.tosiTouchSize,"--background":z.tosiBg,"--text-color":z.tosiText,"--brand-color":z.tosiAccent,"--brand-text-color":z.tosiAccentText};function kC(y){return{":root":{...H2(y)[":root"],...Y7}}}function gC(y,x){let h={};for(let[l,i]of Object.entries(x)){let C=`--tosi-${y}-${l.replace(/([A-Z])/g,"-$1").toLowerCase()}`;h[l]=`var(${C}, ${i})`}return h}var{div:D2,label:b4,input:f4,span:wC,button:Z7}=K,{liveTheme:r}=e({liveTheme:{accent:String(b1.accent),background:String(b1.background),text:String(b1.text),dark:!1}}),S4=!1;function Z0(){if(!S4)return;let y={accent:O.fromCss(r.accent.value),background:O.fromCss(r.background.value),text:O.fromCss(r.text.value)},x=r.dark.value?D4(y):H2(y);C9(x,"tosi-live-theme")}function v7(){if(S4)return;S4=!0,r.accent.observe(Z0),r.background.observe(Z0),r.text.observe(Z0),r.dark.observe(Z0),Z0()}function BC(){S4=!1}class k9 extends U{static preferredTagName="tosi-theme-editor";static shadowStyleSpec={":host":{display:"block",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"14px",lineHeight:"1.5",background:"#ffffff",color:"#222222",padding:"16px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",maxWidth:"320px"},":host .field":{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},":host label":{flex:"1",fontWeight:"500"},':host input[type="color"]':{width:"48px",height:"32px",border:"1px solid #ccc",borderRadius:"4px",cursor:"pointer",padding:"2px"},':host input[type="checkbox"]':{width:"18px",height:"18px",cursor:"pointer"},":host .preview":{marginTop:"12px",padding:"12px",borderRadius:"4px",transition:"all 0.15s ease-out"},":host .preview-button":{border:"none",padding:"6px 12px",borderRadius:"4px",cursor:"pointer",fontFamily:"inherit",fontSize:"13px"},":host .actions":{marginTop:"8px",display:"flex",gap:"8px"},":host .actions button":{flex:"1",padding:"6px 12px",border:"1px solid #ccc",borderRadius:"4px",background:"#f5f5f5",color:"#222",cursor:"pointer",fontFamily:"inherit",fontSize:"13px"},":host .actions button:hover":{background:"#e8e8e8"}};content=()=>[D2({class:"field"},b4("Accent"),f4({type:"color",part:"accent"})),D2({class:"field"},b4("Background"),f4({type:"color",part:"background"})),D2({class:"field"},b4("Text"),f4({type:"color",part:"text"})),D2({class:"field"},b4("Dark mode"),f4({type:"checkbox",part:"dark"})),D2({class:"preview",part:"preview",style:{background:"var(--tosi-bg, #fafafa)",color:"var(--tosi-text, #222)"}},wC("Preview "),Z7({class:"preview-button",style:{background:"var(--tosi-accent, #EE257B)",color:"var(--tosi-accent-text, white)"}},"Button")),D2({class:"actions"},Z7({part:"reset"},"Reset"))];connectedCallback(){super.connectedCallback(),v7();let y=()=>{this.parts.accent.value=r.accent.value,this.parts.background.value=r.background.value,this.parts.text.value=r.text.value,this.parts.dark.checked=r.dark.value};y(),r.accent.observe(y),r.background.observe(y),r.text.observe(y),r.dark.observe(y),this.parts.accent.addEventListener("input",()=>{r.accent.value=this.parts.accent.value}),this.parts.background.addEventListener("input",()=>{r.background.value=this.parts.background.value}),this.parts.text.addEventListener("input",()=>{r.text.value=this.parts.text.value}),this.parts.dark.addEventListener("change",()=>{r.dark.value=this.parts.dark.checked}),this.parts.reset.addEventListener("click",()=>{r.accent.value=String(b1.accent),r.background.value=String(b1.background),r.text.value=String(b1.text),r.dark.value=!1})}}var zC=k9.elementCreator();var{div:jC}=K;class P2 extends U{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(y){}formResetCallback(){this.value="",this.coords="65.01715565258993,25.48081004203459,12"}content=jC({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(P2.mapboxCSSAvailable===void 0)P2.mapboxCSSAvailable=y4("https://api.mapbox.com/mapbox-gl-js/v3.15.0/mapbox-gl.css").catch((y)=>{console.error("failed to load mapbox-gl.css",y)}),P2.mapboxAvailable=G1("https://api.mapbox.com/mapbox-gl-js/v3.15.0/mapbox-gl.js").catch((y)=>{console.error("failed to load mapbox-gl.js",y)})}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[i,C,k]=this.coords.split(",").map((g)=>Number(g));this._map.setCenter([C,i]),this._map.setZoom(k),this._lastCoords=this.coords}if(this.mapStyle!==this._lastStyle)this._map.setStyle(this.mapStyle),this._lastStyle=this.mapStyle;return}let{div:y}=this.parts,[x,h,l]=this.coords.split(",").map((i)=>Number(i));this._lastCoords=this.coords,this._lastStyle=this.mapStyle,P2.mapboxAvailable.then(({mapboxgl:i})=>{console.log("%cmapbox may complain about missing css -- don't panic!","background: orange; color: black; padding: 0 5px;"),i.accessToken=this.token,this._map=new i.Map({container:y,style:this.mapStyle,zoom:l,center:[h,x]}),this._map.on("render",()=>this._map.resize()),this._map.on("moveend",()=>{let C=this._map.getCenter(),k=this._map.getZoom(),g=`${C.lat.toFixed(6)},${C.lng.toFixed(6)},${k.toFixed(1)}`;if(g!==this.value){if(this.internals)this.internals.setFormValue(g)}})})}}var qC=P2.elementCreator();function N7(y,x){if(x==null)x="";else if(typeof x!=="string")x=String(x);return x.replace(/\{\{([^}]+)\}\}/g,(h,l)=>{let i=E[`${y}${l.startsWith("[")?l:"."+l}`];return i===void 0?h:N7(y,String(i))})}class d4 extends U{static preferredTagName="tosi-md";static initAttributes={src:"",elements:!1};context={};value="";content=null;options={};connectedCallback(){if(super.connectedCallback(),this.src!=="")(async()=>{let y=await fetch(this.src);this.value=await y.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 y=N7(this.instanceId,this.value);if(this.elements){let x=y.split(`
210
210
  `).reduce((h,l)=>{if(l.startsWith("<")||h.length===0)h.push(l);else{let i=h[h.length-1];if(!i.startsWith("<")||!i.endsWith(">"))h[h.length-1]+=`
211
- `+l;else h.push(l)}return h},[]);this.innerHTML=x.map((h)=>h.startsWith("<")&&h.endsWith(">")?h:R(h,this.options)).join("")}else this.innerHTML=R(y,this.options);this.didRender()}}var VC=d4,g9=d4.elementCreator(),PC=g9,_C=g9;var{div:w9,span:I4,button:B9}=K,v0=86400000,GC=[0,1,2,3,4,5,6],AC=[1,2,3,4,5,6,7,8,9,10,11,12],z9=(y,x=2,h="0")=>String(y).padStart(x,h),N0=(y,x,h)=>new Date(`${y}-${z9(x)}-${z9(h)}`);class j9 extends U{static preferredTagName="tosi-month";static lightStyleSpec={":host":{display:"block"},":host [part=header]":{display:"flex",alignItems:"stretch",justifyContent:"stretch"},":host[disabled]":{pointerEvents:"none",opacity:P.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:P.monthTodayBackground("transparent"),boxShadow:P.monthTodayShadow("none"),backdropFilter:P.monthTodayBackdropFilter("brightness(0.9)"),fontWeight:P.monthTodayFontWeight("800")},":host .day, :host .date":{padding:5,display:"flex",justifyContent:"center",userSelect:"none"},":host .day":{color:P.monthDayColor("hotpink"),background:P.monthDayBackground("white"),fontWeight:P.monthDayFontWeight("800")},":host .date":{cursor:"default"},":host .weekend":{background:P.monthWeekendBackground("#eee")},":host .date:not(.in-month)":{opacity:0.5},":host .date.checked":{color:P.monthDateCheckedColor("white"),background:P.monthDateCheckedBackground("hotpink")},":host:not([range]) .date.checked":{borderRadius:P.monthDateCheckedBorderRadius("10px")},":host .range-start":{borderTopLeftRadius:P.monthDateCheckedBorderRadius("10px"),borderBottomLeftRadius:P.monthDateCheckedBorderRadius("10px")},":host .range-end":{borderTopRightRadius:P.monthDateCheckedBorderRadius("10px"),borderBottomRightRadius:P.monthDateCheckedBorderRadius("10px")}};static formAssociated=!0;static initAttributes={month:NaN,year:NaN,weekStart:0,minDate:N0(new Date().getFullYear()-100,1,1).toISOString().split("T")[0],maxDate:N0(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(y){this.disabled=y}formResetCallback(){this.value="",this.selectedDays=[]}get endDay(){return 1-this.weekStart}get months(){return AC.map((y)=>({caption:N0(2025,y,1).toString().split(" ")[1],value:String(y)}))}get years(){let y=Number(this.minDate.split("-")[0]),x=Number(this.maxDate.split("-")[0]),h=[];for(let l=y;l<=x;l++)h.push(String(l));return h}monthChanged=(y,x)=>{};gotoMonth(y,x){if(this.month!==x||this.year!==y)this.month=x,this.year=y,this.monthChanged(y,x)}setMonth=()=>{this.gotoMonth(Number(this.parts.year.value),Number(this.parts.month.value))};get to(){return this.selectedDays[1]||""}set to(y){this.selectedDays[1]=y,this.selectedDays.splice(2)}get from(){return this.selectedDays[0]||""}set from(y){this.selectedDays[0]=y,this.selectedDays.splice(2)}clickDate=(y)=>{let x=y.target.getAttribute("title");this.selectDate(x)};keyDate=(y)=>{let x=!1;switch(y.code){case"Space":{let h=y.target.getAttribute("title");this.selectDate(h),x=!0;break}case"Tab":break;default:console.log(y)}if(x)y.preventDefault(),y.stopPropagation()};#y="";selectDate=(y)=>{if(this.#y=y,this.range){if(!this.to)this.selectedDays=[y,y];else if(this.from===y&&this.to===y)this.selectedDays=[];else if(this.from===y)this.from=this.to;else if(this.to===y)this.to=this.from;else if(y<this.from)this.from=y;else if(y>this.to)this.to=y;else this.to=y;this.value=`${this.from},${this.to}`}else if(this.multiple){if(this.selectedDays.includes(y))this.selectedDays.splice(this.selectedDays.indexOf(y),1);else this.selectedDays.push(y),this.selectedDays.sort();this.value=this.selectedDays.join(",")}else if(this.selectable)if(this.selectedDays.includes(y))this.value="",this.selectedDays=[];else this.value=y,this.selectedDays=[y]};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=(y)=>{if(!this.range)return this.selectedDays.includes(y);else if(this.range)return this.from&&y>=this.from&&y<=this.to;return!1};dateMenuItem=(y,x="")=>{return y=y.split("T")[0],{caption:x||y,enabled:()=>!y.startsWith(`${this.year}-${z9(this.month)}-`),action:()=>{this.gotoDate(y)}}};jumpMenu=()=>{o({target:this.parts.jump,menuItems:[this.dateMenuItem(new Date().toISOString(),"This Month"),...this.selectedDays.length===0?[]:[null],...this.selectedDays.map((y)=>this.dateMenuItem(y))]})};content=()=>[w9({part:"header"},B9({part:"previous",onClick:this.previousMonth},p.chevronLeft()),I4({style:{flex:"1"}}),B9({part:"jump",onClick:this.jumpMenu},p.calendar()),A1({part:"month",options:this.months,onChange:this.setMonth}),A1({part:"year",options:[this.year],onChange:this.setMonth}),I4({style:{flex:"1"}}),B9({part:"next",onClick:this.nextMonth},p.chevronRight())),w9({part:"week"}),w9({part:"days"})];gotoDate(y){let x=new Date(y);this.gotoMonth(x.getFullYear(),x.getMonth()+1)}connectedCallback(){super.connectedCallback();let y=new Date(this.value.split(",").pop()||Date.now());if(isNaN(this.month))this.month=y.getMonth()+1;if(isNaN(this.year))this.year=y.getFullYear()}days=[];render(){super.render();let{week:y,days:x,jump:h,month:l,year:i,previous:C,next:k}=this.parts;this.selectedDays=this.value?this.value.split(","):[];let g=N0(this.year,this.month,1),w=new Date(g.valueOf()-(7+g.getDay()-this.weekStart)%7*v0),B=this.month===12?1:this.month+1,j=new Date(N0(this.year+(this.month===12?1:0),B,1).valueOf()-v0),V=new Date(j.valueOf()+(this.weekStart*2+5+this.endDay-j.getDay())%7*v0),_=GC.map((X)=>new Date(w.valueOf()+X*v0).toString().split(" ")[0]);this.days=[];let Q=new Date().toISOString().split("T")[0];for(let X=w.valueOf();X<=V.valueOf();X+=v0){let s=new Date(X),c=s.toISOString().split("T")[0];this.days.push({date:s,selected:!1,inMonth:s.getMonth()+1===this.month,isToday:c===Q,isWeekend:s.getDay()%6===0,inRange:!!(this.from&&c>=this.from&&c<=this.to)})}l.value=String(this.month),i.value=String(this.year),l.disabled=i.disabled=h.disabled=C.disabled=k.disabled=this.disabled||this.readonly,i.options=this.years,y.textContent="",y.append(..._.map((X)=>I4({class:"day"},X))),x.textContent="";let A=null,{to:F,from:Y}=this;x.append(...this.days.map((X)=>{let s=["date"];if(X.inMonth)s.push("in-month");if(X.isToday)s.push("today");let c=X.date.toISOString().split("T")[0];if(this.checkDay(c))s.push("checked");if(s.push(X.isWeekend?"weekend":"weekday"),this.range){if(F===c)s.push("range-end");if(Y===c)s.push("range-start")}let T=I4({class:s.join(" "),title:c,onClick:this.clickDate,onKeydown:this.keyDate,tabindex:"0"},X.date.getDate());if(c===this.#y)A=T;return T})),A?.focus()}}var KC=j9.elementCreator();var{div:q9,button:UC}=K,pC={error:"red",warn:"orange",info:"royalblue",log:"gray",success:"green",progress:"royalblue"};class x2 extends U{static preferredTagName="tosi-notification";static singleton;static shadowStyleSpec={":host":{_notificationSpacing:8,_notificationWidth:360,_notificationPadding:`${z.notificationSpacing} ${z.notificationSpacing50} ${z.notificationSpacing} ${z.notificationSpacing200}`,_notificationBg:"#fafafa",_notificationAccentColor:"#aaa",_notificationTextColor:"#444",_notificationIconSize:z.notificationSpacing300,_notificationButtonSize:48,_notificationBorderWidth:"3px 0 0",_notificationBorderRadius:z.notificationSpacing50,position:"fixed",left:0,right:0,bottom:0,paddingBottom:z.notificationSpacing,width:z.notificationWidth,display:"flex",flexDirection:"column-reverse",margin:"0 auto",gap:z.notificationSpacing,maxHeight:"50vh",overflow:"hidden auto",boxShadow:"none !important",color:z.notificationTextColor},":host .note":{display:"grid",background:z.notificationBg,padding:z.notificationPadding,gridTemplateColumns:`${z.notificationIconSize} 1fr ${z.notificationButtonSize}`,gap:z.notificationSpacing,alignItems:"center",borderRadius:z.notificationBorderRadius,boxShadow:`0 2px 8px #0006, inset 0 0 0 2px ${z.notificationAccentColor}`,borderColor:z.notificationAccentColor,borderWidth:z.notificationBorderWidth,borderStyle:"solid",transition:"0.5s ease-in",transitionProperty:"margin, opacity",zIndex:1},":host .note button":{display:"flex",lineHeight:z.notificationButtonSize,padding:0,margin:0,height:z.notificationButtonSize,width:z.notificationButtonSize,background:"transparent",alignItems:"center",justifyContent:"center",boxShadow:"none",border:"none",position:"relative"},":host .note button:hover svg":{stroke:z.notificationAccentColor},":host .note button:active svg":{borderRadius:99,stroke:z.notificationBg,background:z.notificationAccentColor,padding:z.spacing50},":host .note svg":{height:z.notificationIconSize,width:z.notificationIconSize,pointerEvents:"none",color:z.notificationAccentColor},":host .message":{display:"flex",flexDirection:"column",alignItems:"center",gap:z.notificationSpacing},":host .note.closing":{opacity:0,zIndex:0}};static removeNote(y){y.classList.add("closing"),y.style.marginBottom=-y.offsetHeight+"px";let x=()=>{y.remove()};y.addEventListener("transitionend",x),setTimeout(x,1000)}static post(y){let{message:x,duration:h,type:l,close:i,progress:C,icon:k,color:g}=Object.assign({type:"info",duration:-1},typeof y==="string"?{message:y}:y);if(!this.singleton)this.singleton=V9();let w=this.singleton;document.body.append(w),w.style.zIndex=String(g2()+1);let B=g||pC[l],j=C||l==="progress"?K.progress():{},V=()=>{if(i)i();x2.removeNote(A)},_=k instanceof SVGElement?k:k?p[k]():p.info(),Q=l==="error"||l==="warn",A=q9({class:`note ${l}`,role:Q?"alert":"status",ariaLive:Q?"assertive":"polite",style:{_notificationAccentColor:B}},_,q9({class:"message"},q9(x),j),UC({class:"close",title:"close",ariaLabel:"Close notification",apply(F){F.addEventListener("click",V)}},p.x()));if(w.shadowRoot.append(A),j instanceof HTMLProgressElement&&C instanceof Function){j.setAttribute("max",String(100)),j.value=C();let F=setInterval(()=>{if(!w.shadowRoot.contains(A)){clearInterval(F);return}let Y=C();if(j.value=Y,Y>=100)x2.removeNote(A)},1000)}if(h>0)setTimeout(()=>{x2.removeNote(A)},h*1000);return A.scrollIntoView(),V}content=null}var QC=x2,V9=x2.elementCreator(),WC=V9;function OC(y){return x2.post(y)}var $7=async(y,x="SHA-1")=>{let l=new TextEncoder().encode(y),i=await crypto.subtle.digest(x,l);return Array.from(new Uint8Array(i)).map((g)=>g.toString(16).padStart(2,"0")).join("")},s7=async(y)=>{let x=await $7(y),h=await fetch(`https://weakpass.com/api/v1/search/${x}`);if(h.ok){let l=await h.json();console.log("password found in weakpass database",l)}return h.status!==404},{span:P9,tosiSlot:FC}=K;class T4 extends U{static preferredTagName="tosi-password-strength";static lightStyleSpec={":host":{display:"inline-flex",flexDirection:"column",gap:z.spacing50,position:"relative"},":host tosi-slot":{display:"flex"},':host [part="meter"]':{display:"block",position:"relative",height:P.meterHeight("24px"),background:P.indicatorBg("white"),borderRadius:P.meterRadius("4px"),boxShadow:P.meterShadow(`inset 0 0 0 2px ${z.indicatorColor}`)},':host [part="level"]':{height:P.levelHeight("20px"),content:'" "',display:"inline-block",width:0,transition:"0.15s ease-out",background:z.indicatorColor,margin:P.levelMargin("2px"),borderRadius:P.levelRadius("2px")},':host [part="description"]':{position:"absolute",inset:"0",color:z.descriptionColor,height:P.meterHeight("24px"),lineHeight:P.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(y){return this.issues={tooShort:y.length<this.minLength,short:y.length<this.goodLength,noUpper:!y.match(/[A-Z]/),noLower:!y.match(/[a-z]/),noNumber:!y.match(/[0-9]/),noSpecial:!y.match(/[^a-zA-Z0-9]/)},this.issues.tooShort?0:Object.values(this.issues).filter((x)=>!x).length-1}async isBreached(){let y=this.querySelector("input")?.value;if(!y||typeof y!=="string")return!0;return await s7(y)}updateIndicator=(y)=>{let{level:x,description:h}=this.parts,l=this.indicatorColors.split(","),i=this.descriptionColors.split(","),C=this.strength(y);if(this.value!==C)this.value=C,this.dispatchEvent(new Event("change"));x.style.width=`${(C+1)*16.67}%`,this.style.setProperty("--indicator-color",l[C]),this.style.setProperty("--description-color",i[C]),h.textContent=this.strengthDescriptions[C]};update=(y)=>{let x=y.target.closest("input");this.updateIndicator(x?.value||"")};content=()=>[FC({onInput:this.update}),P9({part:"meter"},P9({part:"level"}),P9({part:"description"}))];render(){super.render();let y=this.querySelector("input");this.updateIndicator(y?.value)}}var XC=T4,R7=T4.elementCreator(),YC=R7;var{span:_9}=K;class r4 extends U{static preferredTagName="tosi-rating";static formAssociated=!0;static initAttributes={max:5,min:1,icon:"star",step:1,ratingStroke:"#e81",ratingFill:"#f91",emptyStroke:"#ccc",emptyFill:"#ccc",readonly:!1,iconSize:24,hollow:!1,required:!1,name:""};value="";formDisabledCallback(y){this.readonly=y}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=()=>_9({part:"container"},_9({part:"empty"}),_9({part:"filled"}));displayValue(y){let{empty:x,filled:h}=this.parts,i=Math.round((typeof y==="string"?0:y||0)/this.step)*this.step;h.style.width=i/this.max*x.offsetWidth+"px"}update=(y)=>{if(this.readonly)return;let{empty:x}=this.parts,h=y instanceof MouseEvent?y.pageX-x.getBoundingClientRect().x:0,l=Math.min(Math.max(this.min,Math.round(h/x.offsetWidth*this.max/this.step+this.step*0.5)*this.step),this.max);if(y.type==="click")this.value=l;else if(y.type==="mousemove")this.displayValue(l);else this.displayValue(this.value||0)};handleKey=(y)=>{let x=this.value===""?NaN:Number(this.value);if(isNaN(x))x=Math.round((this.min+this.max)*0.5*this.step)*this.step;let h=!1;switch(y.key){case"ArrowUp":case"ArrowRight":x+=this.step,h=!0;break;case"ArrowDown":case"ArrowLeft":x-=this.step,h=!0;break}if(this.value=Math.max(Math.min(x,this.max),this.min),h)y.stopPropagation(),y.preventDefault()};connectedCallback(){super.connectedCallback();let{container:y}=this.parts;y.tabIndex=0,y.addEventListener("mousemove",this.update,!0),y.addEventListener("mouseleave",this.update),y.addEventListener("blur",this.update),y.addEventListener("click",this.update),y.addEventListener("keydown",this.handleKey)}_renderedIcon="";render(){super.render();let y=this.iconSize+"px";if(this.style.setProperty("--tosi-icon-size",y),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:x,filled:h}=this.parts;if(x.style.setProperty("--tosi-icon-fill",this.hollow?"none":this.emptyFill),x.style.setProperty("--tosi-icon-stroke",this.emptyStroke),h.style.setProperty("--tosi-icon-fill",this.ratingFill),h.style.setProperty("--tosi-icon-stroke",this.ratingStroke),this._renderedIcon!==this.icon){this._renderedIcon=this.icon;for(let l=0;l<this.max;l++)x.append(p[this.icon]()),h.append(p[this.icon]())}this.displayValue(this.value)}}var ZC=r4,c7=r4.elementCreator(),vC=B1((...y)=>c7(...y),"xinRating is deprecated, use tosiRating instead (tag is now <tosi-rating>)");var{tosiSlot:J7,div:NC,button:$C}=K,sC=[{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 G9(y=sC){return A1({title:"paragraph style",slot:"toolbar",class:"block-style",options:y.map(({caption:x,tagType:h})=>({caption:x,value:`formatBlock,${h}`}))})}var $0=()=>i9({slot:"toolbar"});function N1(y,x,h){return $C({slot:"toolbar",dataCommand:x,title:y},h)}var RC=()=>[N1("left-justify","justifyLeft",p.alignLeft()),N1("center","justifyCenter",p.alignCenter()),N1("right-justify","justifyRight",p.alignRight()),$0(),N1("bullet list","insertUnorderedList",p.listBullet()),N1("numbered list","insertOrderedList",p.listNumber()),$0(),N1("indent","indent",p.indent()),N1("indent","outdent",p.outdent())],H7=()=>[N1("bold","bold",p.fontBold()),N1("italic","italic",p.fontItalic()),N1("underline","underline",p.fontUnderline())],cC=()=>[G9(),$0(),...H7()],D7=()=>[G9(),$0(),...RC(),$0(),...H7()];class L4 extends U{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(y){if(this.isInitialized)this.parts.doc.contentEditable=y?"false":"true"}formResetCallback(){this.value=""}_value="";get value(){return this.isInitialized?this.parts.doc.innerHTML:this._value}set value(y){let x=this._value;if(this._value=y,this.isInitialized){if(this.parts.doc.innerHTML!==y)this.parts.doc.innerHTML=y}if(x!==y&&this.internals)this.internals.setFormValue(y)}blockElement(y){let{doc:x}=this.parts;while(y.parentElement!==null&&y.parentElement!==x)y=y.parentElement;return y.parentElement===x?y:void 0}get selectedBlocks(){let{doc:y}=this.parts,x=window.getSelection();if(x===null)return[];let h=[];for(let l=0;l<x.rangeCount;l++){let i=x.getRangeAt(l);if(!y.contains(i.commonAncestorContainer))continue;let C=this.blockElement(i.startContainer),k=this.blockElement(i.endContainer);h.push(C);while(C!==k&&C!==null)C=C.nextElementSibling,h.push(C)}return h}get selectedText(){let y=window.getSelection();if(y===null)return"";return this.selectedBlocks.length?y.toString():""}selectionChange=()=>{};_updatingBlockStyle=!1;handleSelectChange=(y)=>{if(this._updatingBlockStyle)return;let h=y.target?.closest(c1.tagName);if(h==null)return;this.doCommand(h.value)};handleButtonClick=(y)=>{let h=y.target?.closest("button");if(h==null)return;this.doCommand(h.dataset.command)};content=[J7({name:"toolbar",part:"toolbar",onClick:this.handleButtonClick,onChange:this.handleSelectChange}),NC({part:"doc",contenteditable:!0,style:{flex:"1 1 auto",outline:"none"}}),J7({part:"content"})];doCommand(y){if(y===void 0)return;let x=y.split(",");console.log("execCommand",x[0],!1,...x.slice(1)),document.execCommand(x[0],!1,...x.slice(1))}updateBlockStyle(){let y=this.parts.toolbar.querySelector(".block-style");if(y===null)return;let x=this.selectedBlocks.map((h)=>h.tagName);x=[...new Set(x)],this._updatingBlockStyle=!0,y.value=x.length===1?`formatBlock,${x[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:y,content:x}=this.parts;if(x.innerHTML!==""&&y.innerHTML==="")y.innerHTML=x.innerHTML,x.innerHTML="";this.isInitialized=!0,x.style.display="none",y.addEventListener("input",this.handleInput),this.updateValidity(),document.addEventListener("selectionchange",(h)=>{this.updateBlockStyle(),this.selectionChange(h,this)})}render(){let{toolbar:y}=this.parts;if(super.render(),y.children.length===0)switch(this.widgets){case"minimal":y.append(...cC());break;case"default":y.append(...D7());break}}}var JC=L4,b7=L4.elementCreator(),HC=B1((...y)=>b7(...y),"richText is deprecated, use tosiRichText instead (tag is now <tosi-rich-text>)");var{router:s0}=e({router:{path:"",hash:"",pattern:""}}),A9={};function DC(){return{...A9}}var o4=[],K9=!1,M4=new Set;function bC(y){let x=[];if(y==="")return{regex:/^\/?$/,paramNames:x};let h=y.split("/").map((i)=>{if(i.startsWith(":"))return x.push(i.slice(1)),"([^/]+)";return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});return{regex:new RegExp("^/?"+h.join("/")+"/?$"),paramNames:x}}function fC(y){let x=y.split("?")[0].split("#")[0];for(let l of o4){if(l.fallback)continue;let i=x.match(l.regex);if(i){let C={};return l.paramNames.forEach((k,g)=>{C[k]=decodeURIComponent(i[g+1])}),{route:l,params:C}}}let h=o4.find((l)=>l.fallback);if(h)return{route:h,params:{}};return null}function R0(){let y=K9?window.location.hash.replace(/^#\/?/,""):window.location.pathname;s0.path.value=y,s0.hash.value=window.location.hash;let x=fC(y);if(x){A9=x.params,s0.pattern.value=x.route.regex.source;let h=new Map;for(let l of x.route.targets)h.set(l.view??"default",l);for(let l of M4){let i=l.name||"default",C=h.get(i);if(C)l.replaceChildren(C.component(x.params));else l.replaceChildren()}}else{A9={},s0.pattern.value="";for(let h of M4)h.replaceChildren()}}var f7=!1;function S7(){if(f7)return;f7=!0,window.addEventListener("popstate",R0),window.addEventListener("hashchange",R0)}function SC(y,x={}){K9=x.hashRouting??!1,o4=y.map((h)=>{let{regex:l,paramNames:i}=bC(h.pattern);return{regex:l,paramNames:i,targets:h.targets,fallback:h.fallback??!1}}),S7(),R0()}function dC(y){if(S7(),K9)window.location.hash="#/"+y.replace(/^\//,"");else window.history.pushState({},"","/"+y.replace(/^\//,""));R0()}class U9 extends U{static preferredTagName="tosi-route-view";static initAttributes={name:"default"};content=null;connectedCallback(){if(super.connectedCallback(),M4.add(this),o4.length>0)R0()}disconnectedCallback(){super.disconnectedCallback(),M4.delete(this)}}var IC=U9.elementCreator();var{div:TC,slot:rC,label:LC,span:oC,input:d7}=K;class b2 extends U{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(y){if(typeof y==="string")this._choices=b2.parseChoicesString(y);else this._choices=y;this.queueRender()}static parseChoicesString(y){return y.split(",").filter((x)=>x.trim()!=="").map((x)=>{let[h,l]=x.split("=").map((g)=>g.trim()),[i,C]=(l||h).split(":").map((g)=>g.trim()),k=C?p[C]():"";return{value:h,icon:k,caption:i}})}value="";formDisabledCallback(y){}formResetCallback(){this.value=""}get values(){return(this.value||"").split(",").map((y)=>y.trim()).filter((y)=>y!=="")}content=()=>[rC(),TC({part:"options"},d7({part:"custom",hidden:!0}))];static shadowStyleSpec={":host":{display:"inline-flex",gap:P.segmentedOptionGap("8px"),alignItems:P.segmentedAlignItems("center")},":host, :host::part(options)":{flexDirection:P.segmentedDirection("row")},":host label":{display:"inline-grid",alignItems:"center",gap:P.segmentedOptionGap("8px"),gridTemplateColumns:P.segmentedOptionGridColumns("0px 24px 1fr"),padding:P.segmentedOptionPadding("4px 12px"),font:P.segmentedOptionFont("16px")},":host label:focus":{outline:"none",boxShadow:P.segmentedFocusShadow(`inset 0 0 0 2px ${P.segmentedOptionCurrentBackground("#44a")}`),borderRadius:P.segmentedOptionsBorderRadius("8px")},":host label.current":{color:P.segmentedOptionCurrentColor("#eee"),background:P.segmentedOptionCurrentBackground("#44a")},":host label.current:focus":{boxShadow:P.segmentedCurrentFocusShadow(`inset 0 0 0 2px ${P.segmentedOptionCurrentColor("#eee")}`)},":host svg":{height:P.segmentOptionIconSize("16px"),stroke:P.segmentedOptionIconColor("currentColor")},":host label.no-icon":{gap:0,gridTemplateColumns:P.segmentedOptionGridColumns("0px 1fr")},':host input[type="radio"], :host input[type="checkbox"]':{visibility:P.segmentedInputVisibility("hidden")},":host::part(options)":{display:"flex",borderRadius:P.segmentedOptionsBorderRadius("8px"),background:P.segmentedOptionsBackground("#fff"),color:P.segmentedOptionColor("#222"),overflow:"hidden",alignItems:P.segmentedOptionAlignItems("stretch")},":host::part(custom)":{padding:P.segmentedOptionPadding("4px 12px"),color:P.segmentedOptionCurrentColor("#eee"),background:P.segmentedOptionCurrentBackground("#44a"),font:P.segmentedOptionFont("16px"),border:"0",outline:"none"},":host::part(custom)::placeholder":{color:P.segmentedOptionCurrentColor("#eee"),opacity:P.segmentedPlaceholderOpacity(0.75)}};syncCurrent(){let{options:y}=this.parts;y.querySelectorAll("label").forEach((x)=>{let h=x.querySelector("input");x.classList.toggle("current",Boolean(h&&h.checked))})}valueChanged=!1;handleChange=()=>{let{options:y,custom:x}=this.parts;if(this.multiple){let h=[...y.querySelectorAll("input:checked")];this.value=h.map((l)=>l.value).join(",")}else{let h=y.querySelector("input:checked");if(!h)this.value="";else if(h.value)x.setAttribute("hidden",""),this.value=h.value;else x.removeAttribute("hidden"),x.focus(),x.select(),this.value=x.value}this.syncCurrent(),this.valueChanged=!0};handleKey=(y)=>{let x=!1;switch(y.code){case"Space":if(y.target instanceof HTMLLabelElement)y.target.click(),x=!0;break;case"Tab":if(!(y.target instanceof HTMLLabelElement))y.target.closest("label").focus();break;case"ArrowLeft":case"ArrowUp":{let h=y.target.closest("label");if(h.previousElementSibling instanceof HTMLLabelElement)h.previousElementSibling.focus()}x=!0;break;case"ArrowRight":case"ArrowDown":{let h=y.target.closest("label");if(h.nextElementSibling instanceof HTMLLabelElement)h.nextElementSibling.focus()}x=!0;break}if(x)y.preventDefault(),y.stopPropagation()};connectedCallback(){super.connectedCallback();let y=this.getAttribute("choices");if(y&&this._choices.length===0)this._choices=b2.parseChoicesString(y);let{options:x}=this.parts;if(this.name==="")this.name=this.instanceId;if(x.addEventListener("change",this.handleChange),x.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 y=[...this.choices];if(this.other&&!this.multiple){let[x,h]=this.other.split(":");y.push({value:"",caption:x,icon:h})}return y}get isOtherValue(){return Boolean(this.value===""||this.value&&!this._choicesWithOther.find((y)=>y.value===this.value))}render(){if(super.render(),this.valueChanged){this.valueChanged=!1;return}let{options:y,custom:x}=this.parts;y.textContent="";let h=this.multiple?"checkbox":"radio",{values:l,isOtherValue:i}=this;if(y.append(...this._choicesWithOther.map((C)=>{return LC({tabindex:0},d7({type:h,name:this.name,value:C.value,checked:l.includes(C.value)||C.value===""&&i,tabIndex:-1}),C.icon||{class:"no-icon"},this.localized?W1(C.caption):oC(C.caption))})),this.other&&!this.multiple)x.hidden=!i,x.value=i?this.value:"",x.placeholder=this.placeholder,y.append(x);this.syncCurrent()}}var MC=b2,I7=b2.elementCreator(),nC=B1((...y)=>I7(...y),"xinSegmented is deprecated, use tosiSegmented instead (tag is now <tosi-segmented>)");var{slot:T7}=K;class p9 extends U{static preferredTagName="tosi-sizebreak";static initAttributes={minWidth:0,minHeight:0};value="normal";content=[T7({part:"normal"}),T7({part:"small",name:"small"})];static shadowStyleSpec={":host":{display:"inline-block",position:"relative"}};onResize=()=>{let{normal:y,small:x}=this.parts,h=this.offsetParent;if(!(h instanceof HTMLElement))return;else if(h.offsetWidth<this.minWidth||h.offsetHeight<this.minHeight)y.hidden=!0,x.hidden=!1,this.value="small";else y.hidden=!1,x.hidden=!0,this.value="normal"};connectedCallback(){super.connectedCallback(),globalThis.addEventListener("resize",this.onResize)}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("resize",this.onResize)}}var uC=p9.elementCreator();class n4 extends U{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:z.resizeIconFill}};content=p.resize();get minSize(){let{minWidth:y,minHeight:x}=getComputedStyle(this.target);return{width:parseFloat(y)||32,height:parseFloat(x)||32}}resizeTarget=(y)=>{let{target:x}=this;if(!x)return;let{offsetWidth:h,offsetHeight:l}=x;x.style.left=x.offsetLeft+"px",x.style.top=x.offsetTop+"px",x.style.bottom="",x.style.right="";let{minSize:i}=this;V1(y,(C,k,g)=>{if(x.style.width=Math.max(i.width,h+C)+"px",x.style.height=Math.max(i.height,l+k)+"px",g.type==="mouseup")return!0},"nwse-resize")};connectedCallback(){if(super.connectedCallback(),!this.target)this.target=this.parentElement;let y={passive:!0};this.addEventListener("mousedown",this.resizeTarget,y),this.addEventListener("touchstart",this.resizeTarget,y)}}var aC=n4,r7=n4.elementCreator(),mC=r7;var{div:tC,input:EC,span:eC,button:Q9}=K,L7=(y)=>y.split(/(?<!\\),/).map((x)=>x.trim().replace(/\\,/g,",")),yk=(y)=>y.map((x)=>x.replace(/,/g,"\\,")).join(",");class c0 extends U{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":P.brandColor("blue"),"--tag-text-color":P.brandTextColor("white"),display:"inline-flex",borderRadius:P.tagRoundedRadius(z.spacing50),color:z.tagTextColor,background:z.tagBg,padding:`0 ${z.spacing75} 0 ${z.spacing75}`,height:`calc(${z.lineHeight} + ${z.spacing50})`,lineHeight:`calc(${z.lineHeight} + ${z.spacing50})`},':host > [part="caption"]':{position:"relative",whiteSpace:"nowrap",overflow:"hidden",flex:"1 1 auto",fontSize:P.fontSize("16px"),color:z.tagTextColor,textOverflow:"ellipsis"},':host [part="remove"]':{boxShadow:"none",margin:`0 ${z.spacing_50} 0 ${z.spacing25}`,padding:0,display:"inline-flex",alignItems:"center",alignSelf:"center",justifyContent:"center",height:z.spacing150,width:z.spacing150,color:z.tagCloseButtonColor,background:z.tagCloseButtonBg,borderRadius:P.tagCloseButtonRadius("99px"),opacity:z.tagButtonOpacity},':host [part="remove"]:hover':{background:z.tagCloseButtonBg,opacity:z.tagButtonHoverOpacity}};static initAttributes={caption:"",removeable:!1};removeCallback=()=>{this.remove()};content=()=>[eC({part:"caption"},this.caption),Q9(p.x(),{type:"button",part:"remove",hidden:!this.removeable,ariaLabel:`Remove ${this.caption}`,onClick:this.removeCallback})]}var xk=c0,W9=c0.elementCreator(),hk=B1((...y)=>W9(...y),"xinTag is deprecated, use tosiTag instead (tag is now <tosi-tag>)");class f2 extends U{static preferredTagName="tosi-tag-list";static lightStyleSpec={":host":{"--tag-list-bg":"#f8f8f8","--touch-size":"44px","--spacing":"16px",display:"grid",gridTemplateColumns:"auto",alignItems:"center",background:z.tagListBg,gap:z.spacing25,borderRadius:P.taglistRoundedRadius(z.spacing50),overflow:"hidden"},":host[editable]":{gridTemplateColumns:`0px auto ${z.touchSize}`},":host[editable][text-entry]":{gridTemplateColumns:`0px 2fr 1fr ${z.touchSize}`},':host [part="tagContainer"]':{display:"flex",content:'" "',alignItems:"center",background:z.inputBg,borderRadius:P.tagContainerRadius(z.spacing50),boxShadow:z.borderShadow,flexWrap:"nowrap",overflow:"auto hidden",gap:z.spacing25,minHeight:`calc(${z.lineHeight} + ${z.spacing})`,padding:z.spacing25},':host [part="tagMenu"]':{width:z.touchSize,height:z.touchSize,lineHeight:z.touchSize,textAlign:"center",padding:0,margin:0},":host [hidden]":{display:"none !important"},':host button[part="tagMenu"]':{background:z.brandColor,color:z.brandTextColor}};static formAssociated=!0;static initAttributes={name:"",textEntry:!1,editable:!1,placeholder:"enter tags",disabled:!1,required:!1};value="";get tags(){return L7(this.value).filter((y)=>y!=="")}set tags(y){this.value=yk(y)}_availableTags=[];get availableTags(){return this._availableTags}set availableTags(y){if(typeof y==="string")this._availableTags=f2.parseAvailableTagsString(y);else this._availableTags=y;this.queueRender()}static parseAvailableTagsString(y){return L7(y).map((x)=>x===""?null:x)}connectedCallback(){super.connectedCallback();let y=this.getAttribute("available-tags");if(y&&this._availableTags.length===0)this._availableTags=f2.parseAvailableTagsString(y)}formDisabledCallback(y){this.disabled=y}formResetCallback(){this.value=""}addTag=(y)=>{let x=y.trim();if(x===""||this.tags.includes(x))return;this.tags=[...this.tags,x],this.queueRender(!0)};toggleTag=(y)=>{if(this.tags.includes(y))this.tags=this.tags.filter((x)=>x!==y),this.queueRender(!0);else this.addTag(y)};enterTag=(y)=>{let{tagInput:x}=this.parts;switch(y.key){case",":{let h=x.value.split(",")[0];this.addTag(h)}break;case"Enter":{let h=x.value.split(",")[0];this.addTag(h)}y.stopPropagation(),y.preventDefault();break;default:}};popSelectMenu=()=>{let{toggleTag:y}=this,{tagMenu:x}=this.parts,h=[...this.availableTags],l=this.tags.filter((C)=>!h.includes(C));if(l.length)h.push(null,...l);let i=h.map((C)=>{if(C===""||C===null)return null;else if(typeof C==="object")return{checked:()=>this.tags.includes(C.value),caption:C.caption,action(){y(C.value)}};else return{checked:()=>this.tags.includes(C),caption:C,action(){y(C)}}});o({target:x,width:"auto",menuItems:i})};content=()=>[Q9({type:"button",style:{visibility:"hidden"},tabindex:-1}),tC({part:"tagContainer",class:"row",role:"list",ariaLabel:"Selected tags"}),EC({part:"tagInput",class:"elastic",ariaLabel:"Enter new tag",onKeydown:this.enterTag}),Q9({type:"button",title:"add tag",ariaLabel:"Select tags from list",ariaHaspopup:"listbox",part:"tagMenu",onClick:this.popSelectMenu},p.chevronDown())];removeTag=(y)=>{if(this.editable&&!this.disabled){let x=y.target.closest(c0.tagName);this.tags=this.tags.filter((h)=>h!==x.caption),x.remove(),this.queueRender(!0)}y.stopPropagation(),y.preventDefault()};render(){super.render();let{tagContainer:y,tagMenu:x,tagInput:h}=this.parts;if(x.disabled=this.disabled,h.value="",h.setAttribute("placeholder",this.placeholder),this.editable&&!this.disabled)x.toggleAttribute("hidden",!1),h.toggleAttribute("hidden",!this.textEntry);else x.toggleAttribute("hidden",!0),h.toggleAttribute("hidden",!0);y.textContent="";for(let l of this.tags)y.append(W9({caption:l,removeable:this.editable&&!this.disabled,removeCallback:this.removeTag}))}}var lk=f2,o7=f2.elementCreator(),ik=B1((...y)=>o7(...y),"xinTagList is deprecated, use tosiTagList instead (tag is now <tosi-tag-list>)");var M7="1.6.16";var{span:Ck}=K,J0=null,u4=null,a4=null,f1="tosi-tooltip",kk={[`.${f1}`]:{pointerEvents:"none",padding:P.tosiTooltipPadding("4px 10px"),borderRadius:P.tosiTooltipRadius("6px"),background:P.tosiTooltipBg("#333"),color:P.tosiTooltipColor("#fff"),fontSize:P.tosiTooltipFontSize("13px"),lineHeight:"1.4",maxWidth:P.tosiTooltipMaxWidth("280px"),whiteSpace:"pre-line",boxShadow:"0 2px 8px #0003",position:"relative"},[`.${f1} p`]:{margin:"0"},[`.${f1} code`]:{background:"#fff2",padding:"0 4px",borderRadius:"3px",fontSize:"0.9em"},[`.${f1} a`]:{color:"inherit"},[`.${f1}::before`]:{content:'""',position:"absolute",width:"8px",height:"8px",background:"inherit",transform:"rotate(45deg)"},[`.${f1}.tt-s::before`]:{top:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${f1}.tt-n::before`]:{bottom:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${f1}.tt-e::before`]:{left:"-4px",top:"var(--tosi-tooltip-arrow)"},[`.${f1}.tt-w::before`]:{right:"-4px",top:"var(--tosi-tooltip-arrow)"}},n7=!1;function u7(){if(n7)return;n7=!0,Q1("tosi-tooltip",kk)}function S2(){if(u4!==null)clearTimeout(u4),u4=null;if(J0!==null)J0.remove(),J0=null;a4=null}function gk(y){if(y.startsWith("s"))return"tt-s";if(y.startsWith("n"))return"tt-n";if(y.startsWith("e"))return"tt-e";if(y.startsWith("w"))return"tt-w";return"tt-s"}function wk(y,x,h){let l=x.getBoundingClientRect(),i=y.getBoundingClientRect(),C=l.left+l.width*0.5,k=l.top+l.height*0.5,g;if(h.startsWith("s")||h.startsWith("n"))g=Math.max(8,Math.min(i.width-8,C-i.left))-4;else g=Math.max(8,Math.min(i.height-8,k-i.top))-4;y.style.setProperty("--tosi-tooltip-arrow",g+"px")}function Bk(y,x){if(x)y=b(y);let h=Ck({class:f1});return h.innerHTML=R.parseInline(y),h}function zk(y,x,h){u7(),S2(),a4=y;let{top:l,left:i,width:C}=y.getBoundingClientRect(),k=i+C*0.5,g=window.innerHeight,w=window.innerWidth,B=(l>g*0.5?"n":"s")+(k>w*0.5?"w":"e"),j=Bk(x,h);j.classList.add(gk(B)),J0=k0({content:j,target:y,position:B,remainOnScroll:"remove",remainOnResize:"remove"}),requestAnimationFrame(()=>{if(J0&&a4)wk(j,y,B)})}function jk(y){for(let x of y.composedPath())if(x instanceof HTMLElement&&x.dataset.tooltip)return x;return null}function qk(y={}){u7();let{convertTitles:x=!0,delay:h=250,localize:l=!1}=y;document.addEventListener("pointermove",(i)=>{if(x){for(let g of i.composedPath())if(g instanceof HTMLElement&&g.title&&!g.dataset.tooltip){g.dataset.tooltip=g.title,g.removeAttribute("title");break}}let C=jk(i);if(C===a4)return;if(S2(),!C)return;let k=C.dataset.tooltip||null;if(!k)return;u4=setTimeout(()=>zk(C,k,l),h)}),document.addEventListener("pointerleave",S2),document.addEventListener("pointerdown",S2),document.addEventListener("keydown",S2),window.addEventListener("scroll",S2,!0)}Object.assign(globalThis,{xinjs:h0,xinjsui:O9});})();
211
+ `+l;else h.push(l)}return h},[]);this.innerHTML=x.map((h)=>h.startsWith("<")&&h.endsWith(">")?h:R(h,this.options)).join("")}else this.innerHTML=R(y,this.options);this.didRender()}}var VC=d4,g9=d4.elementCreator(),PC=g9,_C=g9;var{div:w9,span:I4,button:B9}=K,v0=86400000,GC=[0,1,2,3,4,5,6],AC=[1,2,3,4,5,6,7,8,9,10,11,12],z9=(y,x=2,h="0")=>String(y).padStart(x,h),N0=(y,x,h)=>new Date(`${y}-${z9(x)}-${z9(h)}`);class j9 extends U{static preferredTagName="tosi-month";static lightStyleSpec={":host":{display:"block"},":host [part=header]":{display:"flex",alignItems:"stretch",justifyContent:"stretch"},":host[disabled]":{pointerEvents:"none",opacity:P.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:P.monthTodayBackground("transparent"),boxShadow:P.monthTodayShadow("none"),backdropFilter:P.monthTodayBackdropFilter("brightness(0.9)"),fontWeight:P.monthTodayFontWeight("800")},":host .day, :host .date":{padding:5,display:"flex",justifyContent:"center",userSelect:"none"},":host .day":{color:P.monthDayColor("hotpink"),background:P.monthDayBackground("white"),fontWeight:P.monthDayFontWeight("800")},":host .date":{cursor:"default"},":host .weekend":{background:P.monthWeekendBackground("#eee")},":host .date:not(.in-month)":{opacity:0.5},":host .date.checked":{color:P.monthDateCheckedColor("white"),background:P.monthDateCheckedBackground("hotpink")},":host:not([range]) .date.checked":{borderRadius:P.monthDateCheckedBorderRadius("10px")},":host .range-start":{borderTopLeftRadius:P.monthDateCheckedBorderRadius("10px"),borderBottomLeftRadius:P.monthDateCheckedBorderRadius("10px")},":host .range-end":{borderTopRightRadius:P.monthDateCheckedBorderRadius("10px"),borderBottomRightRadius:P.monthDateCheckedBorderRadius("10px")}};static formAssociated=!0;static initAttributes={month:NaN,year:NaN,weekStart:0,minDate:N0(new Date().getFullYear()-100,1,1).toISOString().split("T")[0],maxDate:N0(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(y){this.disabled=y}formResetCallback(){this.value="",this.selectedDays=[]}get endDay(){return 1-this.weekStart}get months(){return AC.map((y)=>({caption:N0(2025,y,1).toString().split(" ")[1],value:String(y)}))}get years(){let y=Number(this.minDate.split("-")[0]),x=Number(this.maxDate.split("-")[0]),h=[];for(let l=y;l<=x;l++)h.push(String(l));return h}monthChanged=(y,x)=>{};gotoMonth(y,x){if(this.month!==x||this.year!==y)this.month=x,this.year=y,this.monthChanged(y,x)}setMonth=()=>{this.gotoMonth(Number(this.parts.year.value),Number(this.parts.month.value))};get to(){return this.selectedDays[1]||""}set to(y){this.selectedDays[1]=y,this.selectedDays.splice(2)}get from(){return this.selectedDays[0]||""}set from(y){this.selectedDays[0]=y,this.selectedDays.splice(2)}clickDate=(y)=>{let x=y.target.getAttribute("title");this.selectDate(x)};keyDate=(y)=>{let x=!1;switch(y.code){case"Space":{let h=y.target.getAttribute("title");this.selectDate(h),x=!0;break}case"Tab":break;default:console.log(y)}if(x)y.preventDefault(),y.stopPropagation()};#y="";selectDate=(y)=>{if(this.#y=y,this.range){if(!this.to)this.selectedDays=[y,y];else if(this.from===y&&this.to===y)this.selectedDays=[];else if(this.from===y)this.from=this.to;else if(this.to===y)this.to=this.from;else if(y<this.from)this.from=y;else if(y>this.to)this.to=y;else this.to=y;this.value=`${this.from},${this.to}`}else if(this.multiple){if(this.selectedDays.includes(y))this.selectedDays.splice(this.selectedDays.indexOf(y),1);else this.selectedDays.push(y),this.selectedDays.sort();this.value=this.selectedDays.join(",")}else if(this.selectable)if(this.selectedDays.includes(y))this.value="",this.selectedDays=[];else this.value=y,this.selectedDays=[y]};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=(y)=>{if(!this.range)return this.selectedDays.includes(y);else if(this.range)return this.from&&y>=this.from&&y<=this.to;return!1};dateMenuItem=(y,x="")=>{return y=y.split("T")[0],{caption:x||y,enabled:()=>!y.startsWith(`${this.year}-${z9(this.month)}-`),action:()=>{this.gotoDate(y)}}};jumpMenu=()=>{o({target:this.parts.jump,menuItems:[this.dateMenuItem(new Date().toISOString(),"This Month"),...this.selectedDays.length===0?[]:[null],...this.selectedDays.map((y)=>this.dateMenuItem(y))]})};content=()=>[w9({part:"header"},B9({part:"previous",onClick:this.previousMonth},p.chevronLeft()),I4({style:{flex:"1"}}),B9({part:"jump",onClick:this.jumpMenu},p.calendar()),A1({part:"month",options:this.months,onChange:this.setMonth}),A1({part:"year",options:[this.year],onChange:this.setMonth}),I4({style:{flex:"1"}}),B9({part:"next",onClick:this.nextMonth},p.chevronRight())),w9({part:"week"}),w9({part:"days"})];gotoDate(y){let x=new Date(y);this.gotoMonth(x.getFullYear(),x.getMonth()+1)}connectedCallback(){super.connectedCallback();let y=new Date(this.value.split(",").pop()||Date.now());if(isNaN(this.month))this.month=y.getMonth()+1;if(isNaN(this.year))this.year=y.getFullYear()}days=[];render(){super.render();let{week:y,days:x,jump:h,month:l,year:i,previous:C,next:k}=this.parts;this.selectedDays=this.value?this.value.split(","):[];let g=N0(this.year,this.month,1),w=new Date(g.valueOf()-(7+g.getDay()-this.weekStart)%7*v0),B=this.month===12?1:this.month+1,j=new Date(N0(this.year+(this.month===12?1:0),B,1).valueOf()-v0),V=new Date(j.valueOf()+(this.weekStart*2+5+this.endDay-j.getDay())%7*v0),_=GC.map((X)=>new Date(w.valueOf()+X*v0).toString().split(" ")[0]);this.days=[];let Q=new Date().toISOString().split("T")[0];for(let X=w.valueOf();X<=V.valueOf();X+=v0){let s=new Date(X),c=s.toISOString().split("T")[0];this.days.push({date:s,selected:!1,inMonth:s.getMonth()+1===this.month,isToday:c===Q,isWeekend:s.getDay()%6===0,inRange:!!(this.from&&c>=this.from&&c<=this.to)})}l.value=String(this.month),i.value=String(this.year),l.disabled=i.disabled=h.disabled=C.disabled=k.disabled=this.disabled||this.readonly,i.options=this.years,y.textContent="",y.append(..._.map((X)=>I4({class:"day"},X))),x.textContent="";let A=null,{to:F,from:Y}=this;x.append(...this.days.map((X)=>{let s=["date"];if(X.inMonth)s.push("in-month");if(X.isToday)s.push("today");let c=X.date.toISOString().split("T")[0];if(this.checkDay(c))s.push("checked");if(s.push(X.isWeekend?"weekend":"weekday"),this.range){if(F===c)s.push("range-end");if(Y===c)s.push("range-start")}let T=I4({class:s.join(" "),title:c,onClick:this.clickDate,onKeydown:this.keyDate,tabindex:"0"},X.date.getDate());if(c===this.#y)A=T;return T})),A?.focus()}}var KC=j9.elementCreator();var{div:q9,button:UC}=K,pC={error:"red",warn:"orange",info:"royalblue",log:"gray",success:"green",progress:"royalblue"};class x2 extends U{static preferredTagName="tosi-notification";static singleton;static shadowStyleSpec={":host":{_notificationSpacing:8,_notificationWidth:360,_notificationPadding:`${z.notificationSpacing} ${z.notificationSpacing50} ${z.notificationSpacing} ${z.notificationSpacing200}`,_notificationBg:"#fafafa",_notificationAccentColor:"#aaa",_notificationTextColor:"#444",_notificationIconSize:z.notificationSpacing300,_notificationButtonSize:48,_notificationBorderWidth:"3px 0 0",_notificationBorderRadius:z.notificationSpacing50,position:"fixed",left:0,right:0,bottom:0,paddingBottom:z.notificationSpacing,width:z.notificationWidth,display:"flex",flexDirection:"column-reverse",margin:"0 auto",gap:z.notificationSpacing,maxHeight:"50vh",overflow:"hidden auto",boxShadow:"none !important",color:z.notificationTextColor},":host .note":{display:"grid",background:z.notificationBg,padding:z.notificationPadding,gridTemplateColumns:`${z.notificationIconSize} 1fr ${z.notificationButtonSize}`,gap:z.notificationSpacing,alignItems:"center",borderRadius:z.notificationBorderRadius,boxShadow:`0 2px 8px #0006, inset 0 0 0 2px ${z.notificationAccentColor}`,borderColor:z.notificationAccentColor,borderWidth:z.notificationBorderWidth,borderStyle:"solid",transition:"0.5s ease-in",transitionProperty:"margin, opacity",zIndex:1},":host .note button":{display:"flex",lineHeight:z.notificationButtonSize,padding:0,margin:0,height:z.notificationButtonSize,width:z.notificationButtonSize,background:"transparent",alignItems:"center",justifyContent:"center",boxShadow:"none",border:"none",position:"relative"},":host .note button:hover svg":{stroke:z.notificationAccentColor},":host .note button:active svg":{borderRadius:99,stroke:z.notificationBg,background:z.notificationAccentColor,padding:z.spacing50},":host .note svg":{height:z.notificationIconSize,width:z.notificationIconSize,pointerEvents:"none",color:z.notificationAccentColor},":host .message":{display:"flex",flexDirection:"column",alignItems:"center",gap:z.notificationSpacing},":host .note.closing":{opacity:0,zIndex:0}};static removeNote(y){y.classList.add("closing"),y.style.marginBottom=-y.offsetHeight+"px";let x=()=>{y.remove()};y.addEventListener("transitionend",x),setTimeout(x,1000)}static post(y){let{message:x,duration:h,type:l,close:i,progress:C,icon:k,color:g}=Object.assign({type:"info",duration:-1},typeof y==="string"?{message:y}:y);if(!this.singleton)this.singleton=V9();let w=this.singleton;document.body.append(w),w.style.zIndex=String(g2()+1);let B=g||pC[l],j=C||l==="progress"?K.progress():{},V=()=>{if(i)i();x2.removeNote(A)},_=k instanceof SVGElement?k:k?p[k]():p.info(),Q=l==="error"||l==="warn",A=q9({class:`note ${l}`,role:Q?"alert":"status",ariaLive:Q?"assertive":"polite",style:{_notificationAccentColor:B}},_,q9({class:"message"},q9(x),j),UC({class:"close",title:"close",ariaLabel:"Close notification",apply(F){F.addEventListener("click",V)}},p.x()));if(w.shadowRoot.append(A),j instanceof HTMLProgressElement&&C instanceof Function){j.setAttribute("max",String(100)),j.value=C();let F=setInterval(()=>{if(!w.shadowRoot.contains(A)){clearInterval(F);return}let Y=C();if(j.value=Y,Y>=100)x2.removeNote(A)},1000)}if(h>0)setTimeout(()=>{x2.removeNote(A)},h*1000);return A.scrollIntoView(),V}content=null}var QC=x2,V9=x2.elementCreator(),WC=V9;function OC(y){return x2.post(y)}var $7=async(y,x="SHA-1")=>{let l=new TextEncoder().encode(y),i=await crypto.subtle.digest(x,l);return Array.from(new Uint8Array(i)).map((g)=>g.toString(16).padStart(2,"0")).join("")},s7=async(y)=>{let x=await $7(y),h=await fetch(`https://weakpass.com/api/v1/search/${x}`);if(h.ok){let l=await h.json();console.log("password found in weakpass database",l)}return h.status!==404},{span:P9,tosiSlot:FC}=K;class T4 extends U{static preferredTagName="tosi-password-strength";static lightStyleSpec={":host":{display:"inline-flex",flexDirection:"column",gap:z.spacing50,position:"relative"},":host tosi-slot":{display:"flex"},':host [part="meter"]':{display:"block",position:"relative",height:P.meterHeight("24px"),background:P.indicatorBg("white"),borderRadius:P.meterRadius("4px"),boxShadow:P.meterShadow(`inset 0 0 0 2px ${z.indicatorColor}`)},':host [part="level"]':{height:P.levelHeight("20px"),content:'" "',display:"inline-block",width:0,transition:"0.15s ease-out",background:z.indicatorColor,margin:P.levelMargin("2px"),borderRadius:P.levelRadius("2px")},':host [part="description"]':{position:"absolute",inset:"0",color:z.descriptionColor,height:P.meterHeight("24px"),lineHeight:P.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(y){return this.issues={tooShort:y.length<this.minLength,short:y.length<this.goodLength,noUpper:!y.match(/[A-Z]/),noLower:!y.match(/[a-z]/),noNumber:!y.match(/[0-9]/),noSpecial:!y.match(/[^a-zA-Z0-9]/)},this.issues.tooShort?0:Object.values(this.issues).filter((x)=>!x).length-1}async isBreached(){let y=this.querySelector("input")?.value;if(!y||typeof y!=="string")return!0;return await s7(y)}updateIndicator=(y)=>{let{level:x,description:h}=this.parts,l=this.indicatorColors.split(","),i=this.descriptionColors.split(","),C=this.strength(y);if(this.value!==C)this.value=C,this.dispatchEvent(new Event("change"));x.style.width=`${(C+1)*16.67}%`,this.style.setProperty("--indicator-color",l[C]),this.style.setProperty("--description-color",i[C]),h.textContent=this.strengthDescriptions[C]};update=(y)=>{let x=y.target.closest("input");this.updateIndicator(x?.value||"")};content=()=>[FC({onInput:this.update}),P9({part:"meter"},P9({part:"level"}),P9({part:"description"}))];render(){super.render();let y=this.querySelector("input");this.updateIndicator(y?.value)}}var XC=T4,R7=T4.elementCreator(),YC=R7;var{span:_9}=K;class r4 extends U{static preferredTagName="tosi-rating";static formAssociated=!0;static initAttributes={max:5,min:1,icon:"star",step:1,ratingStroke:"#e81",ratingFill:"#f91",emptyStroke:"#ccc",emptyFill:"#ccc",readonly:!1,iconSize:24,hollow:!1,required:!1,name:""};value="";formDisabledCallback(y){this.readonly=y}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=()=>_9({part:"container"},_9({part:"empty"}),_9({part:"filled"}));displayValue(y){let{empty:x,filled:h}=this.parts,i=Math.round((typeof y==="string"?0:y||0)/this.step)*this.step;h.style.width=i/this.max*x.offsetWidth+"px"}update=(y)=>{if(this.readonly)return;let{empty:x}=this.parts,h=y instanceof MouseEvent?y.pageX-x.getBoundingClientRect().x:0,l=Math.min(Math.max(this.min,Math.round(h/x.offsetWidth*this.max/this.step+this.step*0.5)*this.step),this.max);if(y.type==="click")this.value=l;else if(y.type==="mousemove")this.displayValue(l);else this.displayValue(this.value||0)};handleKey=(y)=>{let x=this.value===""?NaN:Number(this.value);if(isNaN(x))x=Math.round((this.min+this.max)*0.5*this.step)*this.step;let h=!1;switch(y.key){case"ArrowUp":case"ArrowRight":x+=this.step,h=!0;break;case"ArrowDown":case"ArrowLeft":x-=this.step,h=!0;break}if(this.value=Math.max(Math.min(x,this.max),this.min),h)y.stopPropagation(),y.preventDefault()};connectedCallback(){super.connectedCallback();let{container:y}=this.parts;y.tabIndex=0,y.addEventListener("mousemove",this.update,!0),y.addEventListener("mouseleave",this.update),y.addEventListener("blur",this.update),y.addEventListener("click",this.update),y.addEventListener("keydown",this.handleKey)}_renderedIcon="";render(){super.render();let y=this.iconSize+"px";if(this.style.setProperty("--tosi-icon-size",y),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:x,filled:h}=this.parts;if(x.style.setProperty("--tosi-icon-fill",this.hollow?"none":this.emptyFill),x.style.setProperty("--tosi-icon-stroke",this.emptyStroke),h.style.setProperty("--tosi-icon-fill",this.ratingFill),h.style.setProperty("--tosi-icon-stroke",this.ratingStroke),this._renderedIcon!==this.icon){this._renderedIcon=this.icon;for(let l=0;l<this.max;l++)x.append(p[this.icon]()),h.append(p[this.icon]())}this.displayValue(this.value)}}var ZC=r4,c7=r4.elementCreator(),vC=B1((...y)=>c7(...y),"xinRating is deprecated, use tosiRating instead (tag is now <tosi-rating>)");var{tosiSlot:J7,div:NC,button:$C}=K,sC=[{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 G9(y=sC){return A1({title:"paragraph style",slot:"toolbar",class:"block-style",options:y.map(({caption:x,tagType:h})=>({caption:x,value:`formatBlock,${h}`}))})}var $0=()=>i9({slot:"toolbar"});function N1(y,x,h){return $C({slot:"toolbar",dataCommand:x,title:y},h)}var RC=()=>[N1("left-justify","justifyLeft",p.alignLeft()),N1("center","justifyCenter",p.alignCenter()),N1("right-justify","justifyRight",p.alignRight()),$0(),N1("bullet list","insertUnorderedList",p.listBullet()),N1("numbered list","insertOrderedList",p.listNumber()),$0(),N1("indent","indent",p.indent()),N1("indent","outdent",p.outdent())],H7=()=>[N1("bold","bold",p.fontBold()),N1("italic","italic",p.fontItalic()),N1("underline","underline",p.fontUnderline())],cC=()=>[G9(),$0(),...H7()],D7=()=>[G9(),$0(),...RC(),$0(),...H7()];class L4 extends U{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(y){if(this.isInitialized)this.parts.doc.contentEditable=y?"false":"true"}formResetCallback(){this.value=""}_value="";get value(){return this.isInitialized?this.parts.doc.innerHTML:this._value}set value(y){let x=this._value;if(this._value=y,this.isInitialized){if(this.parts.doc.innerHTML!==y)this.parts.doc.innerHTML=y}if(x!==y&&this.internals)this.internals.setFormValue(y)}blockElement(y){let{doc:x}=this.parts;while(y.parentElement!==null&&y.parentElement!==x)y=y.parentElement;return y.parentElement===x?y:void 0}get selectedBlocks(){let{doc:y}=this.parts,x=window.getSelection();if(x===null)return[];let h=[];for(let l=0;l<x.rangeCount;l++){let i=x.getRangeAt(l);if(!y.contains(i.commonAncestorContainer))continue;let C=this.blockElement(i.startContainer),k=this.blockElement(i.endContainer);h.push(C);while(C!==k&&C!==null)C=C.nextElementSibling,h.push(C)}return h}get selectedText(){let y=window.getSelection();if(y===null)return"";return this.selectedBlocks.length?y.toString():""}selectionChange=()=>{};_updatingBlockStyle=!1;handleSelectChange=(y)=>{if(this._updatingBlockStyle)return;let h=y.target?.closest(c1.tagName);if(h==null)return;this.doCommand(h.value)};handleButtonClick=(y)=>{let h=y.target?.closest("button");if(h==null)return;this.doCommand(h.dataset.command)};content=[J7({name:"toolbar",part:"toolbar",onClick:this.handleButtonClick,onChange:this.handleSelectChange}),NC({part:"doc",contenteditable:!0,style:{flex:"1 1 auto",outline:"none"}}),J7({part:"content"})];doCommand(y){if(y===void 0)return;let x=y.split(",");console.log("execCommand",x[0],!1,...x.slice(1)),document.execCommand(x[0],!1,...x.slice(1))}updateBlockStyle(){let y=this.parts.toolbar.querySelector(".block-style");if(y===null)return;let x=this.selectedBlocks.map((h)=>h.tagName);x=[...new Set(x)],this._updatingBlockStyle=!0,y.value=x.length===1?`formatBlock,${x[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:y,content:x}=this.parts;if(x.innerHTML!==""&&y.innerHTML==="")y.innerHTML=x.innerHTML,x.innerHTML="";this.isInitialized=!0,x.style.display="none",y.addEventListener("input",this.handleInput),this.updateValidity(),document.addEventListener("selectionchange",(h)=>{this.updateBlockStyle(),this.selectionChange(h,this)})}render(){let{toolbar:y}=this.parts;if(super.render(),y.children.length===0)switch(this.widgets){case"minimal":y.append(...cC());break;case"default":y.append(...D7());break}}}var JC=L4,b7=L4.elementCreator(),HC=B1((...y)=>b7(...y),"richText is deprecated, use tosiRichText instead (tag is now <tosi-rich-text>)");var{router:s0}=e({router:{path:"",hash:"",pattern:""}}),A9={};function DC(){return{...A9}}var o4=[],K9=!1,M4=new Set;function bC(y){let x=[];if(y==="")return{regex:/^\/?$/,paramNames:x};let h=y.split("/").map((i)=>{if(i.startsWith(":"))return x.push(i.slice(1)),"([^/]+)";return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});return{regex:new RegExp("^/?"+h.join("/")+"/?$"),paramNames:x}}function fC(y){let x=y.split("?")[0].split("#")[0];for(let l of o4){if(l.fallback)continue;let i=x.match(l.regex);if(i){let C={};return l.paramNames.forEach((k,g)=>{C[k]=decodeURIComponent(i[g+1])}),{route:l,params:C}}}let h=o4.find((l)=>l.fallback);if(h)return{route:h,params:{}};return null}function R0(){let y=K9?window.location.hash.replace(/^#\/?/,""):window.location.pathname;s0.path.value=y,s0.hash.value=window.location.hash;let x=fC(y);if(x){A9=x.params,s0.pattern.value=x.route.regex.source;let h=new Map;for(let l of x.route.targets)h.set(l.view??"default",l);for(let l of M4){let i=l.name||"default",C=h.get(i);if(C)l.replaceChildren(C.component(x.params));else l.replaceChildren()}}else{A9={},s0.pattern.value="";for(let h of M4)h.replaceChildren()}}var f7=!1;function S7(){if(f7)return;f7=!0,window.addEventListener("popstate",R0),window.addEventListener("hashchange",R0)}function SC(y,x={}){K9=x.hashRouting??!1,o4=y.map((h)=>{let{regex:l,paramNames:i}=bC(h.pattern);return{regex:l,paramNames:i,targets:h.targets,fallback:h.fallback??!1}}),S7(),R0()}function dC(y){if(S7(),K9)window.location.hash="#/"+y.replace(/^\//,"");else window.history.pushState({},"","/"+y.replace(/^\//,""));R0()}class U9 extends U{static preferredTagName="tosi-route-view";static initAttributes={name:"default"};content=null;connectedCallback(){if(super.connectedCallback(),M4.add(this),o4.length>0)R0()}disconnectedCallback(){super.disconnectedCallback(),M4.delete(this)}}var IC=U9.elementCreator();var{div:TC,slot:rC,label:LC,span:oC,input:d7}=K;class b2 extends U{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(y){if(typeof y==="string")this._choices=b2.parseChoicesString(y);else this._choices=y;this.queueRender()}static parseChoicesString(y){return y.split(",").filter((x)=>x.trim()!=="").map((x)=>{let[h,l]=x.split("=").map((g)=>g.trim()),[i,C]=(l||h).split(":").map((g)=>g.trim()),k=C?p[C]():"";return{value:h,icon:k,caption:i}})}value="";formDisabledCallback(y){}formResetCallback(){this.value=""}get values(){return(this.value||"").split(",").map((y)=>y.trim()).filter((y)=>y!=="")}content=()=>[rC(),TC({part:"options"},d7({part:"custom",hidden:!0}))];static shadowStyleSpec={":host":{display:"inline-flex",gap:P.segmentedOptionGap("8px"),alignItems:P.segmentedAlignItems("center")},":host, :host::part(options)":{flexDirection:P.segmentedDirection("row")},":host label":{display:"inline-grid",alignItems:"center",gap:P.segmentedOptionGap("8px"),gridTemplateColumns:P.segmentedOptionGridColumns("0px 24px 1fr"),padding:P.segmentedOptionPadding("4px 12px"),font:P.segmentedOptionFont("16px")},":host label:focus":{outline:"none",boxShadow:P.segmentedFocusShadow(`inset 0 0 0 2px ${P.segmentedOptionCurrentBackground("#44a")}`),borderRadius:P.segmentedOptionsBorderRadius("8px")},":host label.current":{color:P.segmentedOptionCurrentColor("#eee"),background:P.segmentedOptionCurrentBackground("#44a")},":host label.current:focus":{boxShadow:P.segmentedCurrentFocusShadow(`inset 0 0 0 2px ${P.segmentedOptionCurrentColor("#eee")}`)},":host svg":{height:P.segmentOptionIconSize("16px"),stroke:P.segmentedOptionIconColor("currentColor")},":host label.no-icon":{gap:0,gridTemplateColumns:P.segmentedOptionGridColumns("0px 1fr")},':host input[type="radio"], :host input[type="checkbox"]':{visibility:P.segmentedInputVisibility("hidden")},":host::part(options)":{display:"flex",borderRadius:P.segmentedOptionsBorderRadius("8px"),background:P.segmentedOptionsBackground("#fff"),color:P.segmentedOptionColor("#222"),overflow:"hidden",alignItems:P.segmentedOptionAlignItems("stretch")},":host::part(custom)":{padding:P.segmentedOptionPadding("4px 12px"),color:P.segmentedOptionCurrentColor("#eee"),background:P.segmentedOptionCurrentBackground("#44a"),font:P.segmentedOptionFont("16px"),border:"0",outline:"none"},":host::part(custom)::placeholder":{color:P.segmentedOptionCurrentColor("#eee"),opacity:P.segmentedPlaceholderOpacity(0.75)}};syncCurrent(){let{options:y}=this.parts;y.querySelectorAll("label").forEach((x)=>{let h=x.querySelector("input");x.classList.toggle("current",Boolean(h&&h.checked))})}valueChanged=!1;handleChange=()=>{let{options:y,custom:x}=this.parts;if(this.multiple){let h=[...y.querySelectorAll("input:checked")];this.value=h.map((l)=>l.value).join(",")}else{let h=y.querySelector("input:checked");if(!h)this.value="";else if(h.value)x.setAttribute("hidden",""),this.value=h.value;else x.removeAttribute("hidden"),x.focus(),x.select(),this.value=x.value}this.syncCurrent(),this.valueChanged=!0};handleKey=(y)=>{let x=!1;switch(y.code){case"Space":if(y.target instanceof HTMLLabelElement)y.target.click(),x=!0;break;case"Tab":if(!(y.target instanceof HTMLLabelElement))y.target.closest("label").focus();break;case"ArrowLeft":case"ArrowUp":{let h=y.target.closest("label");if(h.previousElementSibling instanceof HTMLLabelElement)h.previousElementSibling.focus()}x=!0;break;case"ArrowRight":case"ArrowDown":{let h=y.target.closest("label");if(h.nextElementSibling instanceof HTMLLabelElement)h.nextElementSibling.focus()}x=!0;break}if(x)y.preventDefault(),y.stopPropagation()};connectedCallback(){super.connectedCallback();let y=this.getAttribute("choices");if(y&&this._choices.length===0)this._choices=b2.parseChoicesString(y);let{options:x}=this.parts;if(this.name==="")this.name=this.instanceId;if(x.addEventListener("change",this.handleChange),x.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 y=[...this.choices];if(this.other&&!this.multiple){let[x,h]=this.other.split(":");y.push({value:"",caption:x,icon:h})}return y}get isOtherValue(){return Boolean(this.value===""||this.value&&!this._choicesWithOther.find((y)=>y.value===this.value))}render(){if(super.render(),this.valueChanged){this.valueChanged=!1;return}let{options:y,custom:x}=this.parts;y.textContent="";let h=this.multiple?"checkbox":"radio",{values:l,isOtherValue:i}=this;if(y.append(...this._choicesWithOther.map((C)=>{return LC({tabindex:0},d7({type:h,name:this.name,value:C.value,checked:l.includes(C.value)||C.value===""&&i,tabIndex:-1}),C.icon||{class:"no-icon"},this.localized?W1(C.caption):oC(C.caption))})),this.other&&!this.multiple)x.hidden=!i,x.value=i?this.value:"",x.placeholder=this.placeholder,y.append(x);this.syncCurrent()}}var MC=b2,I7=b2.elementCreator(),nC=B1((...y)=>I7(...y),"xinSegmented is deprecated, use tosiSegmented instead (tag is now <tosi-segmented>)");var{slot:T7}=K;class p9 extends U{static preferredTagName="tosi-sizebreak";static initAttributes={minWidth:0,minHeight:0};value="normal";content=[T7({part:"normal"}),T7({part:"small",name:"small"})];static shadowStyleSpec={":host":{display:"inline-block",position:"relative"}};onResize=()=>{let{normal:y,small:x}=this.parts,h=this.offsetParent;if(!(h instanceof HTMLElement))return;else if(h.offsetWidth<this.minWidth||h.offsetHeight<this.minHeight)y.hidden=!0,x.hidden=!1,this.value="small";else y.hidden=!1,x.hidden=!0,this.value="normal"};connectedCallback(){super.connectedCallback(),globalThis.addEventListener("resize",this.onResize)}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("resize",this.onResize)}}var uC=p9.elementCreator();class n4 extends U{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:z.resizeIconFill}};content=p.resize();get minSize(){let{minWidth:y,minHeight:x}=getComputedStyle(this.target);return{width:parseFloat(y)||32,height:parseFloat(x)||32}}resizeTarget=(y)=>{let{target:x}=this;if(!x)return;let{offsetWidth:h,offsetHeight:l}=x;x.style.left=x.offsetLeft+"px",x.style.top=x.offsetTop+"px",x.style.bottom="",x.style.right="";let{minSize:i}=this;V1(y,(C,k,g)=>{if(x.style.width=Math.max(i.width,h+C)+"px",x.style.height=Math.max(i.height,l+k)+"px",g.type==="mouseup")return!0},"nwse-resize")};connectedCallback(){if(super.connectedCallback(),!this.target)this.target=this.parentElement;let y={passive:!0};this.addEventListener("mousedown",this.resizeTarget,y),this.addEventListener("touchstart",this.resizeTarget,y)}}var aC=n4,r7=n4.elementCreator(),mC=r7;var{div:tC,input:EC,span:eC,button:Q9}=K,L7=(y)=>y.split(/(?<!\\),/).map((x)=>x.trim().replace(/\\,/g,",")),yk=(y)=>y.map((x)=>x.replace(/,/g,"\\,")).join(",");class c0 extends U{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":P.brandColor("blue"),"--tag-text-color":P.brandTextColor("white"),display:"inline-flex",borderRadius:P.tagRoundedRadius(z.spacing50),color:z.tagTextColor,background:z.tagBg,padding:`0 ${z.spacing75} 0 ${z.spacing75}`,height:`calc(${z.lineHeight} + ${z.spacing50})`,lineHeight:`calc(${z.lineHeight} + ${z.spacing50})`},':host > [part="caption"]':{position:"relative",whiteSpace:"nowrap",overflow:"hidden",flex:"1 1 auto",fontSize:P.fontSize("16px"),color:z.tagTextColor,textOverflow:"ellipsis"},':host [part="remove"]':{boxShadow:"none",margin:`0 ${z.spacing_50} 0 ${z.spacing25}`,padding:0,display:"inline-flex",alignItems:"center",alignSelf:"center",justifyContent:"center",height:z.spacing150,width:z.spacing150,color:z.tagCloseButtonColor,background:z.tagCloseButtonBg,borderRadius:P.tagCloseButtonRadius("99px"),opacity:z.tagButtonOpacity},':host [part="remove"]:hover':{background:z.tagCloseButtonBg,opacity:z.tagButtonHoverOpacity}};static initAttributes={caption:"",removeable:!1};removeCallback=()=>{this.remove()};content=()=>[eC({part:"caption"},this.caption),Q9(p.x(),{type:"button",part:"remove",hidden:!this.removeable,ariaLabel:`Remove ${this.caption}`,onClick:this.removeCallback})]}var xk=c0,W9=c0.elementCreator(),hk=B1((...y)=>W9(...y),"xinTag is deprecated, use tosiTag instead (tag is now <tosi-tag>)");class f2 extends U{static preferredTagName="tosi-tag-list";static lightStyleSpec={":host":{"--tag-list-bg":"#f8f8f8","--touch-size":"44px","--spacing":"16px",display:"grid",gridTemplateColumns:"auto",alignItems:"center",background:z.tagListBg,gap:z.spacing25,borderRadius:P.taglistRoundedRadius(z.spacing50),overflow:"hidden"},":host[editable]":{gridTemplateColumns:`0px auto ${z.touchSize}`},":host[editable][text-entry]":{gridTemplateColumns:`0px 2fr 1fr ${z.touchSize}`},':host [part="tagContainer"]':{display:"flex",content:'" "',alignItems:"center",background:z.inputBg,borderRadius:P.tagContainerRadius(z.spacing50),boxShadow:z.borderShadow,flexWrap:"nowrap",overflow:"auto hidden",gap:z.spacing25,minHeight:`calc(${z.lineHeight} + ${z.spacing})`,padding:z.spacing25},':host [part="tagMenu"]':{width:z.touchSize,height:z.touchSize,lineHeight:z.touchSize,textAlign:"center",padding:0,margin:0},":host [hidden]":{display:"none !important"},':host button[part="tagMenu"]':{background:z.brandColor,color:z.brandTextColor}};static formAssociated=!0;static initAttributes={name:"",textEntry:!1,editable:!1,placeholder:"enter tags",disabled:!1,required:!1};value="";get tags(){return L7(this.value).filter((y)=>y!=="")}set tags(y){this.value=yk(y)}_availableTags=[];get availableTags(){return this._availableTags}set availableTags(y){if(typeof y==="string")this._availableTags=f2.parseAvailableTagsString(y);else this._availableTags=y;this.queueRender()}static parseAvailableTagsString(y){return L7(y).map((x)=>x===""?null:x)}connectedCallback(){super.connectedCallback();let y=this.getAttribute("available-tags");if(y&&this._availableTags.length===0)this._availableTags=f2.parseAvailableTagsString(y)}formDisabledCallback(y){this.disabled=y}formResetCallback(){this.value=""}addTag=(y)=>{let x=y.trim();if(x===""||this.tags.includes(x))return;this.tags=[...this.tags,x],this.queueRender(!0)};toggleTag=(y)=>{if(this.tags.includes(y))this.tags=this.tags.filter((x)=>x!==y),this.queueRender(!0);else this.addTag(y)};enterTag=(y)=>{let{tagInput:x}=this.parts;switch(y.key){case",":{let h=x.value.split(",")[0];this.addTag(h)}break;case"Enter":{let h=x.value.split(",")[0];this.addTag(h)}y.stopPropagation(),y.preventDefault();break;default:}};popSelectMenu=()=>{let{toggleTag:y}=this,{tagMenu:x}=this.parts,h=[...this.availableTags],l=this.tags.filter((C)=>!h.includes(C));if(l.length)h.push(null,...l);let i=h.map((C)=>{if(C===""||C===null)return null;else if(typeof C==="object")return{checked:()=>this.tags.includes(C.value),caption:C.caption,action(){y(C.value)}};else return{checked:()=>this.tags.includes(C),caption:C,action(){y(C)}}});o({target:x,width:"auto",menuItems:i})};content=()=>[Q9({type:"button",style:{visibility:"hidden"},tabindex:-1}),tC({part:"tagContainer",class:"row",role:"list",ariaLabel:"Selected tags"}),EC({part:"tagInput",class:"elastic",ariaLabel:"Enter new tag",onKeydown:this.enterTag}),Q9({type:"button",title:"add tag",ariaLabel:"Select tags from list",ariaHaspopup:"listbox",part:"tagMenu",onClick:this.popSelectMenu},p.chevronDown())];removeTag=(y)=>{if(this.editable&&!this.disabled){let x=y.target.closest(c0.tagName);this.tags=this.tags.filter((h)=>h!==x.caption),x.remove(),this.queueRender(!0)}y.stopPropagation(),y.preventDefault()};render(){super.render();let{tagContainer:y,tagMenu:x,tagInput:h}=this.parts;if(x.disabled=this.disabled,h.value="",h.setAttribute("placeholder",this.placeholder),this.editable&&!this.disabled)x.toggleAttribute("hidden",!1),h.toggleAttribute("hidden",!this.textEntry);else x.toggleAttribute("hidden",!0),h.toggleAttribute("hidden",!0);y.textContent="";for(let l of this.tags)y.append(W9({caption:l,removeable:this.editable&&!this.disabled,removeCallback:this.removeTag}))}}var lk=f2,o7=f2.elementCreator(),ik=B1((...y)=>o7(...y),"xinTagList is deprecated, use tosiTagList instead (tag is now <tosi-tag-list>)");var M7="1.6.17";var{span:Ck}=K,J0=null,u4=null,a4=null,f1="tosi-tooltip",kk={[`.${f1}`]:{pointerEvents:"none",padding:P.tosiTooltipPadding("4px 10px"),borderRadius:P.tosiTooltipRadius("6px"),background:P.tosiTooltipBg("#333"),color:P.tosiTooltipColor("#fff"),fontSize:P.tosiTooltipFontSize("13px"),lineHeight:"1.4",maxWidth:P.tosiTooltipMaxWidth("280px"),whiteSpace:"pre-line",boxShadow:"0 2px 8px #0003",position:"relative"},[`.${f1} p`]:{margin:"0"},[`.${f1} code`]:{background:"#fff2",padding:"0 4px",borderRadius:"3px",fontSize:"0.9em"},[`.${f1} a`]:{color:"inherit"},[`.${f1}::before`]:{content:'""',position:"absolute",width:"8px",height:"8px",background:"inherit",transform:"rotate(45deg)"},[`.${f1}.tt-s::before`]:{top:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${f1}.tt-n::before`]:{bottom:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${f1}.tt-e::before`]:{left:"-4px",top:"var(--tosi-tooltip-arrow)"},[`.${f1}.tt-w::before`]:{right:"-4px",top:"var(--tosi-tooltip-arrow)"}},n7=!1;function u7(){if(n7)return;n7=!0,Q1("tosi-tooltip",kk)}function S2(){if(u4!==null)clearTimeout(u4),u4=null;if(J0!==null)J0.remove(),J0=null;a4=null}function gk(y){if(y.startsWith("s"))return"tt-s";if(y.startsWith("n"))return"tt-n";if(y.startsWith("e"))return"tt-e";if(y.startsWith("w"))return"tt-w";return"tt-s"}function wk(y,x,h){let l=x.getBoundingClientRect(),i=y.getBoundingClientRect(),C=l.left+l.width*0.5,k=l.top+l.height*0.5,g;if(h.startsWith("s")||h.startsWith("n"))g=Math.max(8,Math.min(i.width-8,C-i.left))-4;else g=Math.max(8,Math.min(i.height-8,k-i.top))-4;y.style.setProperty("--tosi-tooltip-arrow",g+"px")}function Bk(y,x){if(x)y=b(y);let h=Ck({class:f1});return h.innerHTML=R.parseInline(y),h}function zk(y,x,h){u7(),S2(),a4=y;let{top:l,left:i,width:C}=y.getBoundingClientRect(),k=i+C*0.5,g=window.innerHeight,w=window.innerWidth,B=(l>g*0.5?"n":"s")+(k>w*0.5?"w":"e"),j=Bk(x,h);j.classList.add(gk(B)),J0=k0({content:j,target:y,position:B,remainOnScroll:"remove",remainOnResize:"remove"}),requestAnimationFrame(()=>{if(J0&&a4)wk(j,y,B)})}function jk(y){for(let x of y.composedPath())if(x instanceof HTMLElement&&x.dataset.tooltip)return x;return null}function qk(y={}){u7();let{convertTitles:x=!0,delay:h=250,localize:l=!1}=y;document.addEventListener("pointermove",(i)=>{if(x){for(let g of i.composedPath())if(g instanceof HTMLElement&&g.title&&!g.dataset.tooltip){g.dataset.tooltip=g.title,g.removeAttribute("title");break}}let C=jk(i);if(C===a4)return;if(S2(),!C)return;let k=C.dataset.tooltip||null;if(!k)return;u4=setTimeout(()=>zk(C,k,l),h)}),document.addEventListener("pointerleave",S2),document.addEventListener("pointerdown",S2),document.addEventListener("keydown",S2),window.addEventListener("scroll",S2,!0)}Object.assign(globalThis,{xinjs:h0,xinjsui:O9});})();
212
212
 
213
- //# debugId=3D727A80E960845F64756E2164756E21
213
+ //# debugId=1097BF7817411F9964756E2164756E21
214
214
  //# sourceMappingURL=iife.js.map