lecodes-cli 2.1.1 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -7
- package/package.json +9 -9
- package/runtime/sdk-types.json +1 -1
- package/runtime/web/VERSION.json +3 -3
- package/runtime/web/assets/{inspect-DdJ50Kun.js → inspect-CE4HRex9.js} +1 -1
- package/runtime/web/player.js +16 -16
- package/runtime/web-lite/lite.js +1 -1
- package/runtime/web-page/page.js +23 -5
package/runtime/web-lite/lite.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var Dn=Object.defineProperty;var Bn=(e,t,n)=>t in e?Dn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var je=(e,t,n)=>Bn(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();const Vn=e=>{if(typeof e=="string")return e;if(e instanceof Error)return e.stack?`${String(e)}
|
|
2
|
-
${e.stack}`:String(e);try{return JSON.stringify(e)}catch{return String(e)}},zn=(e,t)=>{const n=o=>{fetch(`${e}/log`,{method:"POST",body:JSON.stringify(o),headers:{"content-type":"application/json"},keepalive:!0}).catch(()=>{})};let r=-1;const i=async()=>{try{const{v:o}=await(await fetch(`${e}/version`,{cache:"no-store"})).json();typeof o=="number"&&t(o)}catch{}setTimeout(i,2500)};setTimeout(i,2500);const s=()=>{let o;try{o=new WebSocket(e.replace(/^http/,"ws")+"/ws")}catch{return}o.onopen=()=>o.send(JSON.stringify({type:"hello",v:r})),o.onmessage=l=>{let d={};try{d=JSON.parse(String(l.data))}catch{return}d.type==="reload"&&typeof d.v=="number"&&t(d.v)},o.onclose=()=>{setTimeout(s,2e3)}};return s(),{bundleUrl:o=>`${e}/bundle.js?t=web&v=${o}`,versionOf(o,l){const d=Number(o.headers.get("x-lecodes-v"));return o.headers.has("x-lecodes-v")&&Number.isFinite(d)?d:l},ran(o){r=o},log:(o,l)=>n({type:"log",level:o,text:l.map(Vn).join(" ")}),error:o=>n({type:"error",text:o})}},Wn=(e,t)=>{try{const n=new URL(e,t);return n.origin===new URL(t).origin&&(n.protocol==="http:"||n.protocol==="https:")?n.href:null}catch{return null}},Gn="modulepreload",Hn=function(e,t){return new URL(e,t).href},Et={},ce=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(y){return Promise.all(y.map(k=>Promise.resolve(k).then(A=>({status:"fulfilled",value:A}),A=>({status:"rejected",reason:A}))))};const l=document.getElementsByTagName("link"),d=document.querySelector("meta[property=csp-nonce]"),f=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));i=o(n.map(y=>{if(y=Hn(y,r),y in Et)return;Et[y]=!0;const k=y.endsWith(".css"),A=k?'[rel="stylesheet"]':"";if(!!r)for(let E=l.length-1;E>=0;E--){const b=l[E];if(b.href===y&&(!k||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${y}"]${A}`))return;const p=document.createElement("link");if(p.rel=k?"stylesheet":Gn,k||(p.as="script"),p.crossOrigin="",p.href=y,f&&p.setAttribute("nonce",f),document.head.appendChild(p),k)return new Promise((E,b)=>{p.addEventListener("load",E),p.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${y}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})},wt="2.1.1",Ke=e=>{const t=e==null?void 0:e.match(/^(\d+)\.\d+\.\d+/);return t?Number(t[1]):null},jn=(e,t)=>Ke(e)!==null&&Ke(e)===Ke(t),Kn=(e,t="woff2")=>{const n=/^\/\/ fonts: (.+)$/m.exec(e);if(!n)return[];const r=[];for(const i of n[1].split(";")){const s=i.indexOf("=");if(s===-1)continue;const o=/^(.+)@(\d+)(i?)$/.exec(i.slice(0,s));o&&r.push({family:o[1],weight:parseInt(o[2],10),italic:o[3]==="i",url:i.slice(s+1).replace("{fmt}",t)})}return r},Yn=async(e,t,n=2e3)=>{const r=t??(typeof document>"u"?void 0:document);if(!(r!=null&&r.fonts)||e.length===0)return;const i=[];for(const s of e)try{const o=new FontFace(s.family,`url("${s.url}")`,{weight:String(s.weight),style:s.italic?"italic":"normal"});r.fonts.add(o),i.push(o.load().catch(()=>{}))}catch{}await Promise.race([Promise.all(i),new Promise(s=>setTimeout(s,n))])},qn=e=>{var d,f,y,k;const t=e.slice(0,2e3),n=new Set,r=t.match(/\/\/ preload: (.+)/);if(r)for(const A of r[1].split(";"))n.add(A);const i=t.includes("// gl: disable")?"off":t.includes("// gl: defer")?"defer":"on",s=((d=t.match(/^\/\/ sdk: (\d+\.\d+\.\d+\S*)/m))==null?void 0:d[1])??null,o=((y=(f=t.match(/^\/\/ name: (.+)$/m))==null?void 0:f[1])==null?void 0:y.trim())??null,l=new Set((((k=t.match(/^\/\/ plugins: (.+)$/m))==null?void 0:k[1])??"").split(";").map(A=>A.trim()).filter(Boolean));return{sdk:s,name:o,preloads:n,gl:i,is2d:t.includes("// 2d: enable"),plugins:l,bootFonts:Kn(t)}},Xn=1,Jn=2,Qn=3,Zn=4,er=5,tr=6,St=7,nr=8,_t=9,rr=10,or=11,sr=12,ir=13,ar=14,lr=15,cr=16,kt=17,ur=18,fr=19,Oe=20,ai=21,li=22,ci=23,ui=24,fi=25,dr=26,pr=27,hr=28,mr=29,Tt=30,Lt=31,gr=32,br=33,xt=34,Rt=35,Ct=36,Pe=1,yr=2,vr=4,de=8,Er=16,Ye=32,wr=64,qe=128,Sr=256,_r=512,kr=1024,Tr=2048,Lr=4096,At=8192,di=16384,xr=32768,Rr=1<<18,Cr=255,$t=256,Ot=512,Ar=1024,Q=0,$r=1,Or=2,Ur=3,De=4,be=255,un=e=>{const t=e.clientWidth;if(!t)return 1;const n=e.getBoundingClientRect().width;return n>0?n/t:1},Ut={text:{type:"text"},password:{type:"password"},search:{type:"search"},tel:{type:"tel"},email:{type:"email"},url:{type:"url"},number:{type:"text",mode:"numeric"},decimal:{type:"text",mode:"decimal"},date:{type:"date"},time:{type:"time"}},Nt=(e,t)=>e==null?t:e===!0||e==="true"||e==="1"||typeof e=="number"&&e>.5,oe=(e,t,n)=>{n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)},Nr=(e,t)=>{if(e.type!=="input"&&e.type!=="textarea")return;const n=e.el,r=t("placeholder");if(oe(n,"placeholder",r==null?null:String(r)),e.type==="input"){const l=Ut[String(t("type")??"text")]??Ut.text,d=n;d.type!==l.type&&(d.type=l.type),oe(n,"inputmode",l.mode??null);const f=t("enterKey");oe(n,"enterkeyhint",f==null?null:String(f))}const i=t("autocapitalize");oe(n,"autocapitalize",i==null?null:String(i));const s=t("autocorrect");s==null?(oe(n,"autocorrect",null),oe(n,"spellcheck",null)):(oe(n,"autocorrect",Nt(s,!0)?"on":"off"),oe(n,"spellcheck",Nt(s,!0)?"true":"false"));const o=Number(t("maxLength")??0);oe(n,"maxlength",o>0?String(Math.round(o)):null)},Be={width:"layout",height:"layout",minWidth:"layout",minHeight:"layout",maxWidth:"layout",maxHeight:"layout",flexBasis:"layout",flexGrow:"layout",flexShrink:"layout",aspectRatio:"layout",gap:"layout",rowGap:"layout",columnGap:"layout",padding:"layout",paddingTop:"layout",paddingRight:"layout",paddingBottom:"layout",paddingLeft:"layout",paddingHorizontal:"layout",paddingVertical:"layout",paddingStart:"layout",paddingEnd:"layout",margin:"layout",marginTop:"layout",marginRight:"layout",marginBottom:"layout",marginLeft:"layout",marginHorizontal:"layout",marginVertical:"layout",marginStart:"layout",marginEnd:"layout",left:"layout",right:"layout",top:"layout",bottom:"layout",start:"layout",end:"layout",inset:"layout",flexDirection:"enum",justifyContent:"enum",alignItems:"enum",alignSelf:"enum",position:"enum",flexWrap:"enum",boxSizing:"enum",display:"enum",overflow:"enum",scrollDirection:"enum",borderWidth:"len",borderTopWidth:"len",borderRightWidth:"len",borderBottomWidth:"len",borderLeftWidth:"len",borderHorizontalWidth:"len",borderVerticalWidth:"len",borderStartWidth:"len",borderEndWidth:"len",color:"color",backgroundColor:"color",borderColor:"color",borderTopColor:"color",borderRightColor:"color",borderBottomColor:"color",borderLeftColor:"color",placeholderColor:"color",refreshControlColor:"color",tintColor:"color",rippleColor:"color",overlayColor:"color",backgroundImage:"str",backgroundSize:"enum",backgroundGradient:"str",borderRadius:"len",borderTopLeftRadius:"len",borderTopRightRadius:"len",borderBottomRightRadius:"len",borderBottomLeftRadius:"len",opacity:"num",transform:"str",transformOrigin:"str",pointerEvents:"enum",fontSize:"len",fontWeight:"num",fontStyle:"enum",fontFamily:"str",lineHeight:"len",letterSpacing:"len",textAlign:"enum",textDecoration:"enum",lineClamp:"num",textOverflow:"enum",objectFit:"enum",placeholder:"str",type:"enum",enterKey:"enum",autocapitalize:"enum",autocorrect:"num",maxLength:"num",keyboardShrink:"num",keyboardDismiss:"num",showScrollbar:"num",overscrollMode:"enum",keyboardDismissMode:"enum",snap:"enum",sheetDetents:"str",sheetDetent:"num",sheetDismissible:"num",dim:"num"},Mr={p:"padding",pt:"paddingTop",pr:"paddingRight",pb:"paddingBottom",pl:"paddingLeft",px:"paddingHorizontal",py:"paddingVertical",m:"margin",mt:"marginTop",mr:"marginRight",mb:"marginBottom",ml:"marginLeft",mx:"marginHorizontal",my:"marginVertical",bgColor:"backgroundColor",bgImage:"backgroundImage",bgSize:"backgroundSize",bgGradient:"backgroundGradient"},Fr=["placeholderColor","refreshControlColor","tintColor","rippleColor","overlayColor","backgroundGradient"],Pr={display:"flex",overflow:"visible",scrollDirection:"vertical",borderWidth:0,borderTopWidth:0,borderRightWidth:0,borderBottomWidth:0,borderLeftWidth:0,borderHorizontalWidth:0,borderVerticalWidth:0,borderStartWidth:0,borderEndWidth:0,backgroundColor:0,borderColor:0,borderTopColor:0,borderRightColor:0,borderBottomColor:0,borderLeftColor:0,backgroundImage:"",backgroundSize:"cover",borderRadius:0,borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomRightRadius:0,borderBottomLeftRadius:0,opacity:1,transform:"identity",transformOrigin:"50% 50%",pointerEvents:"all",fontSize:14,fontWeight:400,fontStyle:"normal",lineHeight:"normal",letterSpacing:0,textAlign:"start",textDecoration:"none",lineClamp:0,textOverflow:"ellipsis",objectFit:"cover",placeholder:"",type:"text",enterKey:"done",autocapitalize:"sentences",autocorrect:1,maxLength:0,keyboardShrink:1,keyboardDismiss:1,showScrollbar:1,overscrollMode:"default",keyboardDismissMode:"interactive",snap:"none",sheetDetents:"",sheetDetent:0,sheetDismissible:1,dim:0},Ir=["duration","delay","layer","commit","loop","loopMode","name"];function fn(e){let t=e.trim();/\sxmlns\s*=/.test(t)||(t=t.replace(/<svg\b/,'<svg xmlns="http://www.w3.org/2000/svg"'));const n=new TextEncoder().encode(t);let r="";for(const i of n)r+=String.fromCharCode(i);return`data:image/svg+xml;base64,${btoa(r)}`}function Dr(e){const t=e.match(/viewBox\s*=\s*["']([^"']+)["']/);return t?t[1]:null}const Br=/\b(?:calc|min|max|clamp)\(/,Vr=e=>{if(!Br.test(e))return e;let t="";for(let n=0;n<e.length;n++){if(e.startsWith("var(",n)){let i=0;const s=n;for(;n<e.length;n++)if(e[n]==="(")i++;else if(e[n]===")"&&--i===0)break;t+=e.slice(s,Math.min(n+1,e.length));continue}const r=e[n];if(r==="+"||r==="-"){const i=t[t.length-1]??"";if(!(r==="-"&&(i==="e"&&"btlr".includes(e[n+1]??"")||e.slice(Math.max(0,n-7),n)==="comfort"))&&/[\w%.)]/.test(i)){for(t=t.trimEnd()+" "+r+" ";e[n+1]===" ";)n++;continue}}t+=r}return t.replace(/\d*\.\d+|\d+/g,(n,r,i)=>{const s=i.slice(0,r).trimEnd(),o=i.slice(r+n.length).trimStart();return/[\w.%]$/.test(s)||/^[\w.%]/.test(o)||/[*/]$/.test(s)||/^[*/]/.test(o)?n:n+"px"})},zr={top:"12px",bottom:"4px",left:"16px",right:"16px"},dn=e=>`max(var(--safe-${e}, 0px), calc(var(--safe-${e}-bar, 0px) + var(--comfort-${e}, ${zr[e]})))`,Wr={vw:"cqw",vh:"cqh",vmin:"cqmin",vmax:"cqmax"},Re=e=>Vr(e).replace(new RegExp("(?<![-\\w])comfort-(top|bottom|left|right)\\b","g"),(t,n)=>dn(n)).replace(new RegExp("(?<![-\\w])safe-(top|bottom|left|right)\\b","g"),(t,n)=>`var(--safe-${n}, 0px)`).replace(/(\d)(vmin|vmax|vw|vh)\b/g,(t,n,r)=>n+Wr[r]),pt=/^-?\d*\.?\d+$/,se=e=>{if(typeof e=="number")return e+"px";const t=String(e).trim();return pt.test(t)?t+"px":Re(t)},Ce=e=>{if(typeof e=="number")return"#"+(e>>>0).toString(16).padStart(e<=16777215?6:8,"0");const t=String(e);return t==="clear"?"transparent":t},Gr=/^(rotate|skew)/,Hr=/^translate/,jr=e=>{const t=String(e).trim();return t===""||t==="identity"?"none":t.replace(/([a-zA-Z0-9]+)\s*\(([^)]*)\)/g,(n,r,i)=>{const s=Hr.test(r)?"px":Gr.test(r)?"deg":null;return s===null?n:`${r}(${i.split(",").map(o=>{const l=o.trim();return pt.test(l)?l+s:Re(l)}).join(", ")})`})},pn=e=>typeof e=="number"?e+"px":String(e).trim().split(/\s+/).map(t=>pt.test(t)?t+"px":Re(t)).join(" "),ne=0,re=1,_e=2,Ie=["top","right","bottom","left"],Kr=(e,t)=>e==="safe-all"?`var(--safe-${t}, 0px)`:e==="comfort-all"||e==="comfort-x"||e==="comfort-y"?dn(t):se(e),at=(e,t)=>{const n=(i,s)=>({rank:s,to:o=>i.map(l=>[t(l),Kr(o,l)])}),r=i=>({rank:re,to:s=>[[t(i),se(s)]]});return{[e]:n(Ie,ne),[`${e}Horizontal`]:n(["left","right"],re),[`${e}Vertical`]:n(["top","bottom"],re),[`${e}Start`]:r("inline-start"),[`${e}End`]:r("inline-end"),[`${e}Top`]:n(["top"],_e),[`${e}Right`]:n(["right"],_e),[`${e}Bottom`]:n(["bottom"],_e),[`${e}Left`]:n(["left"],_e)}},Yr=()=>{const e=at("border",n=>`border-${n}-width`),t={};for(const n of Object.keys(e))t[`${n}Width`]=e[n];return t},ht=e=>{const t=[];let n=0,r="";for(const i of e.trim()){if(i==="("&&n++,i===")"&&n--,/\s/.test(i)&&n===0){r&&t.push(r),r="";continue}r+=i}return r&&t.push(r),t},qr=new Set(["none","solid","dashed","dotted","double","hidden"]),Xr=/^-?\d*\.?\d+([a-z%]*)$|^(calc|min|max|clamp)\(/,we=(e,t)=>({rank:t,to:n=>{let r=null,i=null,s=null;if(typeof n=="number")r=n+"px";else for(const l of ht(String(n)))qr.has(l)?s=l:Xr.test(l)?r=se(l):i=Ce(l);const o=[];for(const l of e)o.push([`border-${l}-width`,r??(i?"1px":"0px")]),o.push([`border-${l}-color`,i??"transparent"]),s&&o.push([`border-${l}-style`,s]);return o}}),Jr=e=>{const t=String(e).trim(),n=(s,o,l)=>[["flex-grow",s],["flex-shrink",o],["flex-basis",l]];if(t==="none")return n("0","0","auto");if(t==="auto")return n("1","1","auto");if(t==="initial")return n("0","1","auto");const r=ht(t),i=s=>s!==void 0&&/^-?\d*\.?\d+$/.test(s);return i(r[0])?r.length===1?n(r[0],"1","0%"):i(r[1])?n(r[0],r[1],r[2]!==void 0?se(r[2]):"0%"):n(r[0],"1",se(r[1])):n("1","1",se(r[0]??"auto"))},hn=e=>{var t;return typeof e=="object"&&e!==null&&"_h"in e&&typeof((t=e._h)==null?void 0:t.id)=="number"},Qr=e=>e.replace(/<svg\b[^>]*>/,t=>t.replace(/\spreserveAspectRatio\s*=\s*("[^"]*"|'[^']*')/,"").replace(/^<svg\b/,'<svg preserveAspectRatio="none"')),mn=(e,t)=>{if(hn(e))return`url("${t.bufferUrl(e._h.id)}")`;const n=String(e??"");return n===""?"none":n.startsWith("id:")?`url("${t.bufferUrl(Number(n.slice(3)))}")`:n.startsWith("svg:")?`url("${fn(Qr(n.slice(4)))}")`:`url("${n.replace(/["\\\n]/g,r=>"\\"+r)}")`},Zr=/^\s*(repeating-)?(linear|radial|conic)-gradient\(/,gn=e=>{const t=String(e??"").trim();return t===""?"none":Re(t)},eo=(e,t)=>{const n=typeof e=="string"&&Zr.test(e),r=hn(e)||typeof e=="string"&&/^(id:|https?:|data:|blob:|\.{0,2}\/)/.test(e);return[["--lc-bg-grad",n?gn(e):"none"],["--lc-bg-img",r?mn(e,t):"none"],["background-color",n||r?"transparent":Ce(e)]]},to=e=>{const t=typeof e=="number"?[e+"px"]:ht(String(e)).map(o=>pn(o)),[n,r=n,i=n,s=r]=t;return[["border-top-left-radius",n??"0px"],["border-top-right-radius",r??"0px"],["border-bottom-right-radius",i??"0px"],["border-bottom-left-radius",s??"0px"]]},no=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-monospace","ui-sans-serif","ui-serif","inherit"]),ro=e=>{const t=String(e).trim();return t==="monospaced"?"monospace":t.startsWith("var(")||t.includes(",")||/^["']/.test(t)||no.has(t)?t:`"${t.replace(/"/g,'\\"')}"`},oo=e=>e===!0||e==="true"||typeof e=="number"&&e>.5||e==="1",so=e=>t=>e[String(t)]??String(t),Ae={width:{css:"width",as:"len"},height:{css:"height",as:"len"},minWidth:{css:"min-width",as:"len"},minHeight:{css:"min-height",as:"len"},maxWidth:{css:"max-width",as:"len"},maxHeight:{css:"max-height",as:"len"},flexBasis:{css:"flex-basis",as:"len"},flexGrow:{css:"flex-grow",as:"num"},flexShrink:{css:"flex-shrink",as:"num"},aspectRatio:{css:"aspect-ratio",as:"num"},gap:{css:["row-gap","column-gap"],as:"len",rank:ne},rowGap:{css:"row-gap",as:"len"},columnGap:{css:"column-gap",as:"len"},...at("padding",e=>`padding-${e}`),...at("margin",e=>`margin-${e}`),inset:{css:Ie,as:"len",rank:ne},top:{css:"top",as:"len"},right:{css:"right",as:"len"},bottom:{css:"bottom",as:"len"},left:{css:"left",as:"len"},start:{css:"inset-inline-start",as:"len",rank:re},end:{css:"inset-inline-end",as:"len",rank:re},flexDirection:{css:"flex-direction",as:"raw"},justifyContent:{css:"justify-content",as:"raw"},alignItems:{css:"align-items",as:"raw"},alignSelf:{css:"align-self",as:"raw"},position:{css:"position",as:"raw"},flexWrap:{css:"flex-wrap",as:"raw"},boxSizing:{css:"box-sizing",as:"raw"},display:{css:"display",as:"raw"},overflow:{rank:ne,to:e=>{const t=e==="scroll"?"auto":String(e);return[["overflow-x",t],["overflow-y",t]]}},scrollDirection:{to:e=>e==="horizontal"?[["overflow-x","auto"],["overflow-y","hidden"],["flex-direction","row"]]:e==="all"?[["overflow-x","auto"],["overflow-y","auto"]]:[["overflow-x","hidden"],["overflow-y","auto"],["flex-direction","column"]],rank:re},...Yr(),color:{css:"color"},backgroundColor:{css:"background-color"},borderColor:{css:Ie.map(e=>`border-${e}-color`),rank:ne},borderTopColor:{css:"border-top-color"},borderRightColor:{css:"border-right-color"},borderBottomColor:{css:"border-bottom-color"},borderLeftColor:{css:"border-left-color"},placeholderColor:{css:"--lc-placeholder"},refreshControlColor:{css:"--lc-refresh"},tintColor:{css:"--lc-tint"},overlayColor:{css:"--lc-overlay"},rippleColor:{none:"a browser has no ripple: the press feedback of a page is `$pressed`"},backgroundImage:{to:(e,t)=>[["--lc-bg-img",mn(e,t)]]},backgroundGradient:{to:e=>[["--lc-bg-grad",gn(e)]]},backgroundSize:{to:e=>e==="tile"?[["background-size","auto"],["background-repeat","repeat"],["background-position","0 0"]]:[["background-size",e==="fill"?"100% 100%":String(e)],["background-repeat","no-repeat"],["background-position","center"]]},borderRadius:{to,rank:ne},borderTopLeftRadius:{css:"border-top-left-radius"},borderTopRightRadius:{css:"border-top-right-radius"},borderBottomRightRadius:{css:"border-bottom-right-radius"},borderBottomLeftRadius:{css:"border-bottom-left-radius"},opacity:{css:"opacity"},transform:{to:e=>[["transform",jr(e)]]},transformOrigin:{css:"transform-origin",as:"lens"},pointerEvents:{to:e=>[["pointer-events",e==="none"?"none":"auto"]]},dim:{css:"--lc-dim"},fontSize:{css:"font-size"},fontWeight:{css:"font-weight",as:"raw"},fontStyle:{to:e=>[["font-style",e===2?"italic":e===0?"normal":String(e)]]},fontFamily:{to:e=>[["font-family",ro(e)]]},lineHeight:{to:e=>[["line-height",e==="normal"?"1.2":se(e)]]},letterSpacing:{css:"letter-spacing"},textAlign:{css:"text-align"},textDecoration:{css:"text-decoration-line"},lineClamp:{rank:ne,to:e=>Number(e)>0?[["display","-webkit-box"],["-webkit-box-orient","vertical"],["-webkit-line-clamp",String(Math.round(Number(e)))],["overflow-x","hidden"],["overflow-y","hidden"]]:[["-webkit-line-clamp","none"]]},textOverflow:{css:"text-overflow"},objectFit:{to:e=>[["object-fit",String(e)],["--lc-fit",e==="fill"?"100% 100%":String(e)]]},placeholder:{attr:!0},type:{attr:!0},enterKey:{attr:!0},autocapitalize:{attr:!0},autocorrect:{attr:!0},maxLength:{attr:!0},keyboardShrink:{attr:!0},keyboardDismiss:{attr:!0},showScrollbar:{to:e=>[["scrollbar-width",oo(e)?"thin":"none"]]},overscrollMode:{to:e=>[["overscroll-behavior",so({default:"auto",none:"none",absorb:"contain"})(e)]]},keyboardDismissMode:{attr:!0},snap:{to:e=>e==="none"?[["scroll-snap-type","none"],["--lc-snap","none"]]:[["scroll-snap-type","both mandatory"],["--lc-snap",String(e)]]},sheetDetents:{attr:!0},sheetDetent:{attr:!0},sheetDismissible:{attr:!0},background:{to:eo,rank:ne},border:we(Ie,ne),borderTop:we(["top"],re),borderRight:we(["right"],re),borderBottom:we(["bottom"],re),borderLeft:we(["left"],re),flex:{to:Jr,rank:ne}},Xe=e=>Mr[e]??e,io=e=>e in Ae,bn=e=>{const t=Ae[e];return!!t&&"attr"in t},ao={overflow:"overflow-x",pointerEvents:"pointer-events",fontFamily:"font-family",fontStyle:"font-style",lineHeight:"line-height",objectFit:"object-fit",transform:"transform",borderRadius:"border-top-left-radius",borderWidth:"border-top-width",borderColor:"border-top-color",backgroundImage:"--lc-bg-img",backgroundGradient:"--lc-bg-grad",backgroundSize:"background-size",showScrollbar:"scrollbar-width",overscrollMode:"overscroll-behavior",snap:"--lc-snap",lineClamp:"-webkit-line-clamp",borderTopWidth:"border-top-width",borderRightWidth:"border-right-width",borderBottomWidth:"border-bottom-width",borderLeftWidth:"border-left-width",borderHorizontalWidth:"border-left-width",borderVerticalWidth:"border-top-width",borderStartWidth:"border-inline-start-width",borderEndWidth:"border-inline-end-width"},lo=e=>{const t=Ae[e];return t&&"css"in t&&typeof t.css=="string"?t.css:ao[e]??null},co={len:se,lens:pn,num:e=>String(e),raw:e=>String(e),color:Ce},uo={color:"color",len:"len",enum:"raw",num:"num",str:"raw",layout:"raw"},Mt=e=>{const t=Ae[e];return t&&"rank"in t&&t.rank!==void 0?t.rank:_e},Je=(e,t,n)=>{const r=[...e].filter(([,s])=>s!=null);r.sort((s,o)=>Mt(s[0])-Mt(o[0]));const i=new Map;for(const[s,o]of r){const l=Ae[s];if(!l){n==null||n(s);continue}if("attr"in l||"none"in l)continue;if("to"in l){for(const[y,k]of l.to(o,t))i.set(y,k);continue}const d=co[l.as??uo[Be[s]??"layout"]],f=d(o);if(typeof l.css=="string")i.set(l.css,f);else for(const y of l.css)i.set(y,f)}return i},Ft=e=>[...e].sort((t,n)=>t[0]<n[0]?-1:t[0]>n[0]?1:0).map(([t,n])=>`${t}:${n}`).join(";"),yn=0,vn=1,Le=2,xe=3,En=4,me=65,Ve=1.70158,Ue=Ve*1.525,Pt=Ve+1,It=2*Math.PI/3,Dt=2*Math.PI/4.5,Ne=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,lt=[["linear",e=>e],["inSine",e=>1-Math.cos(e*Math.PI/2)],["outSine",e=>Math.sin(e*Math.PI/2)],["inOutSine",e=>-(Math.cos(Math.PI*e)-1)/2],["inQuad",e=>e*e],["outQuad",e=>1-(1-e)*(1-e)],["inOutQuad",e=>e<.5?2*e*e:1-(-2*e+2)**2/2],["inCubic",e=>e*e*e],["outCubic",e=>1-(1-e)**3],["inOutCubic",e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2],["inQuart",e=>e**4],["outQuart",e=>1-(1-e)**4],["inOutQuart",e=>e<.5?8*e**4:1-(-2*e+2)**4/2],["inExpo",e=>e===0?0:2**(10*e-10)],["outExpo",e=>e===1?1:1-2**(-10*e)],["inOutExpo",e=>e===0?0:e===1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2],["inCirc",e=>1-Math.sqrt(1-e*e)],["outCirc",e=>Math.sqrt(1-(e-1)**2)],["inOutCirc",e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2],["inBack",e=>Pt*e*e*e-Ve*e*e],["outBack",e=>1+Pt*(e-1)**3+Ve*(e-1)**2],["inOutBack",e=>e<.5?(2*e)**2*((Ue+1)*2*e-Ue)/2:((2*e-2)**2*((Ue+1)*(e*2-2)+Ue)+2)/2],["inElastic",e=>e===0?0:e===1?1:-(2**(10*e-10))*Math.sin((e*10-10.75)*It)],["outElastic",e=>e===0?0:e===1?1:2**(-10*e)*Math.sin((e*10-.75)*It)+1],["inOutElastic",e=>e===0?0:e===1?1:e<.5?-(2**(20*e-10)*Math.sin((20*e-11.125)*Dt))/2:2**(-20*e+10)*Math.sin((20*e-11.125)*Dt)/2+1],["inBounce",e=>1-Ne(1-e)],["outBounce",Ne],["inOutBounce",e=>e<.5?(1-Ne(1-2*e))/2:(1+Ne(2*e-1))/2],["smoothstep",e=>e*e*(3-2*e)]],fo={in:"inQuad",out:"outQuad",inOut:"inOutQuad",easeIn:"inQuad",easeOut:"outQuad",easeInOut:"inOutQuad","ease-in":"inQuad","ease-out":"outQuad","ease-in-out":"inOutQuad"},po=e=>{const t=fo[e]??e;for(let n=0;n<lt.length;n++)if(lt[n][0]===t)return n;return-1},ho=[.25,.1,.25,1],Me={kind:yn,p:[0,0,0,0]},mo=e=>{const t=new Float32Array(me);for(let n=0;n<me;n++)t[n]=e(n/(me-1));return t[0]=0,t[me-1]=1,t},go=e=>{if(e===void 0)return Me;if(typeof e=="function")return{kind:En,p:[0,0,0,0],table:mo(e)};if(Array.isArray(e)){const[i,s,o,l]=e;return{kind:Le,p:[i,s,o,l]}}const t=e.trim();if(t==="linear")return Me;if(t==="ease")return{kind:Le,p:ho};if(t==="steps")return{kind:xe,p:[1,0,0,0]};let n=/^steps\(\s*(\d+)\s*(?:,\s*(start|end|jump-start|jump-end)\s*)?\)$/.exec(t);if(n)return{kind:xe,p:[Math.max(1,parseInt(n[1],10)),n[2]==="start"||n[2]==="jump-start"?1:0,0,0]};if(n=/^cubic-bezier\(\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*\)$/.exec(t),n)return{kind:Le,p:[parseFloat(n[1]),parseFloat(n[2]),parseFloat(n[3]),parseFloat(n[4])]};const r=po(t);return r===0?Me:r>0?{kind:vn,p:[r,0,0,0]}:(console.warn(`[tween] unknown easing "${t}" — using linear`),Me)},bo=(e,t,n,r,i)=>{const s=1-3*r+3*t,o=3*r-6*t,l=3*t,d=1-3*i+3*n,f=3*i-6*n,y=3*n;let k=e;for(let A=0;A<8;A++){const _=((s*k+o)*k+l)*k-e,p=(3*s*k+2*o)*k+l;if(Math.abs(_)<1e-6||Math.abs(p)<1e-6)break;k-=_/p}return k=Math.min(1,Math.max(0,k)),((d*k+f)*k+y)*k},yo=(e,t)=>{if(t<=0)return e.kind===xe&&e.p[1]===1?1/e.p[0]:0;if(t>=1)return 1;switch(e.kind){case vn:return lt[e.p[0]][1](t);case Le:return bo(t,e.p[0],e.p[1],e.p[2],e.p[3]);case xe:{const n=e.p[0];return e.p[1]===1?Math.min(1,Math.ceil(t*n)/n):Math.floor(t*n)/n}case En:{const n=e.table,r=t*(me-1),i=Math.floor(r),s=n[i],o=n[Math.min(i+1,me-1)];return s+(o-s)*(r-i)}default:return t}},Bt=24,Vt=e=>String(Math.round(e*1e4)/1e4),vo="cubic-bezier(0.3333, 0, 0.6667, 1)",Eo=e=>{switch(e.kind){case yn:return"linear";case Le:return`cubic-bezier(${e.p.map(Vt).join(", ")})`;case xe:return`steps(${e.p[0]}, ${e.p[1]===1?"jump-start":"jump-end"})`}const t=[];for(let n=0;n<=Bt;n++)t.push(Vt(yo(e,n/Bt)));return`linear(${t.join(", ")})`},wo=e=>e===void 0||e==="smoothstep"?vo:Eo(go(e)),wn=["lc-base","lc-bag","lc-own","lc-orient","lc-class","lc-hover","lc-press","lc-focus"],So=["--lc-bg-grad","--lc-bg-img","--lc-tint","--lc-overlay","--lc-refresh","--lc-fit","--lc-src","--lc-src-tint","--lc-iw","--lc-ih","--lc-ir","--lc-crop-size","--lc-crop-pos"],Sn="lc-app",_o=`
|
|
2
|
+
${e.stack}`:String(e);try{return JSON.stringify(e)}catch{return String(e)}},zn=(e,t)=>{const n=o=>{fetch(`${e}/log`,{method:"POST",body:JSON.stringify(o),headers:{"content-type":"application/json"},keepalive:!0}).catch(()=>{})};let r=-1;const i=async()=>{try{const{v:o}=await(await fetch(`${e}/version`,{cache:"no-store"})).json();typeof o=="number"&&t(o)}catch{}setTimeout(i,2500)};setTimeout(i,2500);const s=()=>{let o;try{o=new WebSocket(e.replace(/^http/,"ws")+"/ws")}catch{return}o.onopen=()=>o.send(JSON.stringify({type:"hello",v:r})),o.onmessage=l=>{let d={};try{d=JSON.parse(String(l.data))}catch{return}d.type==="reload"&&typeof d.v=="number"&&t(d.v)},o.onclose=()=>{setTimeout(s,2e3)}};return s(),{bundleUrl:o=>`${e}/bundle.js?t=web&v=${o}`,versionOf(o,l){const d=Number(o.headers.get("x-lecodes-v"));return o.headers.has("x-lecodes-v")&&Number.isFinite(d)?d:l},ran(o){r=o},log:(o,l)=>n({type:"log",level:o,text:l.map(Vn).join(" ")}),error:o=>n({type:"error",text:o})}},Wn=(e,t)=>{try{const n=new URL(e,t);return n.origin===new URL(t).origin&&(n.protocol==="http:"||n.protocol==="https:")?n.href:null}catch{return null}},Gn="modulepreload",Hn=function(e,t){return new URL(e,t).href},Et={},ce=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(y){return Promise.all(y.map(k=>Promise.resolve(k).then(A=>({status:"fulfilled",value:A}),A=>({status:"rejected",reason:A}))))};const l=document.getElementsByTagName("link"),d=document.querySelector("meta[property=csp-nonce]"),f=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));i=o(n.map(y=>{if(y=Hn(y,r),y in Et)return;Et[y]=!0;const k=y.endsWith(".css"),A=k?'[rel="stylesheet"]':"";if(!!r)for(let E=l.length-1;E>=0;E--){const b=l[E];if(b.href===y&&(!k||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${y}"]${A}`))return;const p=document.createElement("link");if(p.rel=k?"stylesheet":Gn,k||(p.as="script"),p.crossOrigin="",p.href=y,f&&p.setAttribute("nonce",f),document.head.appendChild(p),k)return new Promise((E,b)=>{p.addEventListener("load",E),p.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${y}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})},wt="2.2.1",Ke=e=>{const t=e==null?void 0:e.match(/^(\d+)\.\d+\.\d+/);return t?Number(t[1]):null},jn=(e,t)=>Ke(e)!==null&&Ke(e)===Ke(t),Kn=(e,t="woff2")=>{const n=/^\/\/ fonts: (.+)$/m.exec(e);if(!n)return[];const r=[];for(const i of n[1].split(";")){const s=i.indexOf("=");if(s===-1)continue;const o=/^(.+)@(\d+)(i?)$/.exec(i.slice(0,s));o&&r.push({family:o[1],weight:parseInt(o[2],10),italic:o[3]==="i",url:i.slice(s+1).replace("{fmt}",t)})}return r},Yn=async(e,t,n=2e3)=>{const r=t??(typeof document>"u"?void 0:document);if(!(r!=null&&r.fonts)||e.length===0)return;const i=[];for(const s of e)try{const o=new FontFace(s.family,`url("${s.url}")`,{weight:String(s.weight),style:s.italic?"italic":"normal"});r.fonts.add(o),i.push(o.load().catch(()=>{}))}catch{}await Promise.race([Promise.all(i),new Promise(s=>setTimeout(s,n))])},qn=e=>{var d,f,y,k;const t=e.slice(0,2e3),n=new Set,r=t.match(/\/\/ preload: (.+)/);if(r)for(const A of r[1].split(";"))n.add(A);const i=t.includes("// gl: disable")?"off":t.includes("// gl: defer")?"defer":"on",s=((d=t.match(/^\/\/ sdk: (\d+\.\d+\.\d+\S*)/m))==null?void 0:d[1])??null,o=((y=(f=t.match(/^\/\/ name: (.+)$/m))==null?void 0:f[1])==null?void 0:y.trim())??null,l=new Set((((k=t.match(/^\/\/ plugins: (.+)$/m))==null?void 0:k[1])??"").split(";").map(A=>A.trim()).filter(Boolean));return{sdk:s,name:o,preloads:n,gl:i,is2d:t.includes("// 2d: enable"),plugins:l,bootFonts:Kn(t)}},Xn=1,Jn=2,Qn=3,Zn=4,er=5,tr=6,St=7,nr=8,_t=9,rr=10,or=11,sr=12,ir=13,ar=14,lr=15,cr=16,kt=17,ur=18,fr=19,Oe=20,ai=21,li=22,ci=23,ui=24,fi=25,dr=26,pr=27,hr=28,mr=29,Tt=30,Lt=31,gr=32,br=33,xt=34,Rt=35,Ct=36,Pe=1,yr=2,vr=4,de=8,Er=16,Ye=32,wr=64,qe=128,Sr=256,_r=512,kr=1024,Tr=2048,Lr=4096,At=8192,di=16384,xr=32768,Rr=1<<18,Cr=255,$t=256,Ot=512,Ar=1024,Q=0,$r=1,Or=2,Ur=3,De=4,be=255,un=e=>{const t=e.clientWidth;if(!t)return 1;const n=e.getBoundingClientRect().width;return n>0?n/t:1},Ut={text:{type:"text"},password:{type:"password"},search:{type:"search"},tel:{type:"tel"},email:{type:"email"},url:{type:"url"},number:{type:"text",mode:"numeric"},decimal:{type:"text",mode:"decimal"},date:{type:"date"},time:{type:"time"}},Nt=(e,t)=>e==null?t:e===!0||e==="true"||e==="1"||typeof e=="number"&&e>.5,oe=(e,t,n)=>{n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)},Nr=(e,t)=>{if(e.type!=="input"&&e.type!=="textarea")return;const n=e.el,r=t("placeholder");if(oe(n,"placeholder",r==null?null:String(r)),e.type==="input"){const l=Ut[String(t("type")??"text")]??Ut.text,d=n;d.type!==l.type&&(d.type=l.type),oe(n,"inputmode",l.mode??null);const f=t("enterKey");oe(n,"enterkeyhint",f==null?null:String(f))}const i=t("autocapitalize");oe(n,"autocapitalize",i==null?null:String(i));const s=t("autocorrect");s==null?(oe(n,"autocorrect",null),oe(n,"spellcheck",null)):(oe(n,"autocorrect",Nt(s,!0)?"on":"off"),oe(n,"spellcheck",Nt(s,!0)?"true":"false"));const o=Number(t("maxLength")??0);oe(n,"maxlength",o>0?String(Math.round(o)):null)},Be={width:"layout",height:"layout",minWidth:"layout",minHeight:"layout",maxWidth:"layout",maxHeight:"layout",flexBasis:"layout",flexGrow:"layout",flexShrink:"layout",aspectRatio:"layout",gap:"layout",rowGap:"layout",columnGap:"layout",padding:"layout",paddingTop:"layout",paddingRight:"layout",paddingBottom:"layout",paddingLeft:"layout",paddingHorizontal:"layout",paddingVertical:"layout",paddingStart:"layout",paddingEnd:"layout",margin:"layout",marginTop:"layout",marginRight:"layout",marginBottom:"layout",marginLeft:"layout",marginHorizontal:"layout",marginVertical:"layout",marginStart:"layout",marginEnd:"layout",left:"layout",right:"layout",top:"layout",bottom:"layout",start:"layout",end:"layout",inset:"layout",flexDirection:"enum",justifyContent:"enum",alignItems:"enum",alignSelf:"enum",position:"enum",flexWrap:"enum",boxSizing:"enum",display:"enum",overflow:"enum",scrollDirection:"enum",borderWidth:"len",borderTopWidth:"len",borderRightWidth:"len",borderBottomWidth:"len",borderLeftWidth:"len",borderHorizontalWidth:"len",borderVerticalWidth:"len",borderStartWidth:"len",borderEndWidth:"len",color:"color",backgroundColor:"color",borderColor:"color",borderTopColor:"color",borderRightColor:"color",borderBottomColor:"color",borderLeftColor:"color",placeholderColor:"color",refreshControlColor:"color",tintColor:"color",rippleColor:"color",overlayColor:"color",backgroundImage:"str",backgroundSize:"enum",backgroundGradient:"str",borderRadius:"len",borderTopLeftRadius:"len",borderTopRightRadius:"len",borderBottomRightRadius:"len",borderBottomLeftRadius:"len",opacity:"num",transform:"str",transformOrigin:"str",pointerEvents:"enum",fontSize:"len",fontWeight:"num",fontStyle:"enum",fontFamily:"str",lineHeight:"len",letterSpacing:"len",textAlign:"enum",textDecoration:"enum",lineClamp:"num",textOverflow:"enum",objectFit:"enum",placeholder:"str",type:"enum",enterKey:"enum",autocapitalize:"enum",autocorrect:"num",maxLength:"num",keyboardShrink:"num",keyboardDismiss:"num",showScrollbar:"num",overscrollMode:"enum",keyboardDismissMode:"enum",snap:"enum",sheetDetents:"str",sheetDetent:"num",sheetDismissible:"num",dim:"num"},Mr={p:"padding",pt:"paddingTop",pr:"paddingRight",pb:"paddingBottom",pl:"paddingLeft",px:"paddingHorizontal",py:"paddingVertical",m:"margin",mt:"marginTop",mr:"marginRight",mb:"marginBottom",ml:"marginLeft",mx:"marginHorizontal",my:"marginVertical",bgColor:"backgroundColor",bgImage:"backgroundImage",bgSize:"backgroundSize",bgGradient:"backgroundGradient"},Fr=["placeholderColor","refreshControlColor","tintColor","rippleColor","overlayColor","backgroundGradient"],Pr={display:"flex",overflow:"visible",scrollDirection:"vertical",borderWidth:0,borderTopWidth:0,borderRightWidth:0,borderBottomWidth:0,borderLeftWidth:0,borderHorizontalWidth:0,borderVerticalWidth:0,borderStartWidth:0,borderEndWidth:0,backgroundColor:0,borderColor:0,borderTopColor:0,borderRightColor:0,borderBottomColor:0,borderLeftColor:0,backgroundImage:"",backgroundSize:"cover",borderRadius:0,borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomRightRadius:0,borderBottomLeftRadius:0,opacity:1,transform:"identity",transformOrigin:"50% 50%",pointerEvents:"all",fontSize:14,fontWeight:400,fontStyle:"normal",lineHeight:"normal",letterSpacing:0,textAlign:"start",textDecoration:"none",lineClamp:0,textOverflow:"ellipsis",objectFit:"cover",placeholder:"",type:"text",enterKey:"done",autocapitalize:"sentences",autocorrect:1,maxLength:0,keyboardShrink:1,keyboardDismiss:1,showScrollbar:1,overscrollMode:"default",keyboardDismissMode:"interactive",snap:"none",sheetDetents:"",sheetDetent:0,sheetDismissible:1,dim:0},Ir=["duration","delay","layer","commit","loop","loopMode","name"];function fn(e){let t=e.trim();/\sxmlns\s*=/.test(t)||(t=t.replace(/<svg\b/,'<svg xmlns="http://www.w3.org/2000/svg"'));const n=new TextEncoder().encode(t);let r="";for(const i of n)r+=String.fromCharCode(i);return`data:image/svg+xml;base64,${btoa(r)}`}function Dr(e){const t=e.match(/viewBox\s*=\s*["']([^"']+)["']/);return t?t[1]:null}const Br=/\b(?:calc|min|max|clamp)\(/,Vr=e=>{if(!Br.test(e))return e;let t="";for(let n=0;n<e.length;n++){if(e.startsWith("var(",n)){let i=0;const s=n;for(;n<e.length;n++)if(e[n]==="(")i++;else if(e[n]===")"&&--i===0)break;t+=e.slice(s,Math.min(n+1,e.length));continue}const r=e[n];if(r==="+"||r==="-"){const i=t[t.length-1]??"";if(!(r==="-"&&(i==="e"&&"btlr".includes(e[n+1]??"")||e.slice(Math.max(0,n-7),n)==="comfort"))&&/[\w%.)]/.test(i)){for(t=t.trimEnd()+" "+r+" ";e[n+1]===" ";)n++;continue}}t+=r}return t.replace(/\d*\.\d+|\d+/g,(n,r,i)=>{const s=i.slice(0,r).trimEnd(),o=i.slice(r+n.length).trimStart();return/[\w.%]$/.test(s)||/^[\w.%]/.test(o)||/[*/]$/.test(s)||/^[*/]/.test(o)?n:n+"px"})},zr={top:"12px",bottom:"4px",left:"16px",right:"16px"},dn=e=>`max(var(--safe-${e}, 0px), calc(var(--safe-${e}-bar, 0px) + var(--comfort-${e}, ${zr[e]})))`,Wr={vw:"cqw",vh:"cqh",vmin:"cqmin",vmax:"cqmax"},Re=e=>Vr(e).replace(new RegExp("(?<![-\\w])comfort-(top|bottom|left|right)\\b","g"),(t,n)=>dn(n)).replace(new RegExp("(?<![-\\w])safe-(top|bottom|left|right)\\b","g"),(t,n)=>`var(--safe-${n}, 0px)`).replace(/(\d)(vmin|vmax|vw|vh)\b/g,(t,n,r)=>n+Wr[r]),pt=/^-?\d*\.?\d+$/,se=e=>{if(typeof e=="number")return e+"px";const t=String(e).trim();return pt.test(t)?t+"px":Re(t)},Ce=e=>{if(typeof e=="number")return"#"+(e>>>0).toString(16).padStart(e<=16777215?6:8,"0");const t=String(e);return t==="clear"?"transparent":t},Gr=/^(rotate|skew)/,Hr=/^translate/,jr=e=>{const t=String(e).trim();return t===""||t==="identity"?"none":t.replace(/([a-zA-Z0-9]+)\s*\(([^)]*)\)/g,(n,r,i)=>{const s=Hr.test(r)?"px":Gr.test(r)?"deg":null;return s===null?n:`${r}(${i.split(",").map(o=>{const l=o.trim();return pt.test(l)?l+s:Re(l)}).join(", ")})`})},pn=e=>typeof e=="number"?e+"px":String(e).trim().split(/\s+/).map(t=>pt.test(t)?t+"px":Re(t)).join(" "),ne=0,re=1,_e=2,Ie=["top","right","bottom","left"],Kr=(e,t)=>e==="safe-all"?`var(--safe-${t}, 0px)`:e==="comfort-all"||e==="comfort-x"||e==="comfort-y"?dn(t):se(e),at=(e,t)=>{const n=(i,s)=>({rank:s,to:o=>i.map(l=>[t(l),Kr(o,l)])}),r=i=>({rank:re,to:s=>[[t(i),se(s)]]});return{[e]:n(Ie,ne),[`${e}Horizontal`]:n(["left","right"],re),[`${e}Vertical`]:n(["top","bottom"],re),[`${e}Start`]:r("inline-start"),[`${e}End`]:r("inline-end"),[`${e}Top`]:n(["top"],_e),[`${e}Right`]:n(["right"],_e),[`${e}Bottom`]:n(["bottom"],_e),[`${e}Left`]:n(["left"],_e)}},Yr=()=>{const e=at("border",n=>`border-${n}-width`),t={};for(const n of Object.keys(e))t[`${n}Width`]=e[n];return t},ht=e=>{const t=[];let n=0,r="";for(const i of e.trim()){if(i==="("&&n++,i===")"&&n--,/\s/.test(i)&&n===0){r&&t.push(r),r="";continue}r+=i}return r&&t.push(r),t},qr=new Set(["none","solid","dashed","dotted","double","hidden"]),Xr=/^-?\d*\.?\d+([a-z%]*)$|^(calc|min|max|clamp)\(/,we=(e,t)=>({rank:t,to:n=>{let r=null,i=null,s=null;if(typeof n=="number")r=n+"px";else for(const l of ht(String(n)))qr.has(l)?s=l:Xr.test(l)?r=se(l):i=Ce(l);const o=[];for(const l of e)o.push([`border-${l}-width`,r??(i?"1px":"0px")]),o.push([`border-${l}-color`,i??"transparent"]),s&&o.push([`border-${l}-style`,s]);return o}}),Jr=e=>{const t=String(e).trim(),n=(s,o,l)=>[["flex-grow",s],["flex-shrink",o],["flex-basis",l]];if(t==="none")return n("0","0","auto");if(t==="auto")return n("1","1","auto");if(t==="initial")return n("0","1","auto");const r=ht(t),i=s=>s!==void 0&&/^-?\d*\.?\d+$/.test(s);return i(r[0])?r.length===1?n(r[0],"1","0%"):i(r[1])?n(r[0],r[1],r[2]!==void 0?se(r[2]):"0%"):n(r[0],"1",se(r[1])):n("1","1",se(r[0]??"auto"))},hn=e=>{var t;return typeof e=="object"&&e!==null&&"_h"in e&&typeof((t=e._h)==null?void 0:t.id)=="number"},Qr=e=>e.replace(/<svg\b[^>]*>/,t=>t.replace(/\spreserveAspectRatio\s*=\s*("[^"]*"|'[^']*')/,"").replace(/^<svg\b/,'<svg preserveAspectRatio="none"')),mn=(e,t)=>{if(hn(e))return`url("${t.bufferUrl(e._h.id)}")`;const n=String(e??"");return n===""?"none":n.startsWith("id:")?`url("${t.bufferUrl(Number(n.slice(3)))}")`:n.startsWith("svg:")?`url("${fn(Qr(n.slice(4)))}")`:`url("${n.replace(/["\\\n]/g,r=>"\\"+r)}")`},Zr=/^\s*(repeating-)?(linear|radial|conic)-gradient\(/,gn=e=>{const t=String(e??"").trim();return t===""?"none":Re(t)},eo=(e,t)=>{const n=typeof e=="string"&&Zr.test(e),r=hn(e)||typeof e=="string"&&/^(id:|https?:|data:|blob:|\.{0,2}\/)/.test(e);return[["--lc-bg-grad",n?gn(e):"none"],["--lc-bg-img",r?mn(e,t):"none"],["background-color",n||r?"transparent":Ce(e)]]},to=e=>{const t=typeof e=="number"?[e+"px"]:ht(String(e)).map(o=>pn(o)),[n,r=n,i=n,s=r]=t;return[["border-top-left-radius",n??"0px"],["border-top-right-radius",r??"0px"],["border-bottom-right-radius",i??"0px"],["border-bottom-left-radius",s??"0px"]]},no=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-monospace","ui-sans-serif","ui-serif","inherit"]),ro=e=>{const t=String(e).trim();return t==="monospaced"?"monospace":t.startsWith("var(")||t.includes(",")||/^["']/.test(t)||no.has(t)?t:`"${t.replace(/"/g,'\\"')}"`},oo=e=>e===!0||e==="true"||typeof e=="number"&&e>.5||e==="1",so=e=>t=>e[String(t)]??String(t),Ae={width:{css:"width",as:"len"},height:{css:"height",as:"len"},minWidth:{css:"min-width",as:"len"},minHeight:{css:"min-height",as:"len"},maxWidth:{css:"max-width",as:"len"},maxHeight:{css:"max-height",as:"len"},flexBasis:{css:"flex-basis",as:"len"},flexGrow:{css:"flex-grow",as:"num"},flexShrink:{css:"flex-shrink",as:"num"},aspectRatio:{css:"aspect-ratio",as:"num"},gap:{css:["row-gap","column-gap"],as:"len",rank:ne},rowGap:{css:"row-gap",as:"len"},columnGap:{css:"column-gap",as:"len"},...at("padding",e=>`padding-${e}`),...at("margin",e=>`margin-${e}`),inset:{css:Ie,as:"len",rank:ne},top:{css:"top",as:"len"},right:{css:"right",as:"len"},bottom:{css:"bottom",as:"len"},left:{css:"left",as:"len"},start:{css:"inset-inline-start",as:"len",rank:re},end:{css:"inset-inline-end",as:"len",rank:re},flexDirection:{css:"flex-direction",as:"raw"},justifyContent:{css:"justify-content",as:"raw"},alignItems:{css:"align-items",as:"raw"},alignSelf:{css:"align-self",as:"raw"},position:{css:"position",as:"raw"},flexWrap:{css:"flex-wrap",as:"raw"},boxSizing:{css:"box-sizing",as:"raw"},display:{css:"display",as:"raw"},overflow:{rank:ne,to:e=>{const t=e==="scroll"?"auto":String(e);return[["overflow-x",t],["overflow-y",t]]}},scrollDirection:{to:e=>e==="horizontal"?[["overflow-x","auto"],["overflow-y","hidden"],["flex-direction","row"]]:e==="all"?[["overflow-x","auto"],["overflow-y","auto"]]:[["overflow-x","hidden"],["overflow-y","auto"],["flex-direction","column"]],rank:re},...Yr(),color:{css:"color"},backgroundColor:{css:"background-color"},borderColor:{css:Ie.map(e=>`border-${e}-color`),rank:ne},borderTopColor:{css:"border-top-color"},borderRightColor:{css:"border-right-color"},borderBottomColor:{css:"border-bottom-color"},borderLeftColor:{css:"border-left-color"},placeholderColor:{css:"--lc-placeholder"},refreshControlColor:{css:"--lc-refresh"},tintColor:{css:"--lc-tint"},overlayColor:{css:"--lc-overlay"},rippleColor:{none:"a browser has no ripple: the press feedback of a page is `$pressed`"},backgroundImage:{to:(e,t)=>[["--lc-bg-img",mn(e,t)]]},backgroundGradient:{to:e=>[["--lc-bg-grad",gn(e)]]},backgroundSize:{to:e=>e==="tile"?[["background-size","auto"],["background-repeat","repeat"],["background-position","0 0"]]:[["background-size",e==="fill"?"100% 100%":String(e)],["background-repeat","no-repeat"],["background-position","center"]]},borderRadius:{to,rank:ne},borderTopLeftRadius:{css:"border-top-left-radius"},borderTopRightRadius:{css:"border-top-right-radius"},borderBottomRightRadius:{css:"border-bottom-right-radius"},borderBottomLeftRadius:{css:"border-bottom-left-radius"},opacity:{css:"opacity"},transform:{to:e=>[["transform",jr(e)]]},transformOrigin:{css:"transform-origin",as:"lens"},pointerEvents:{to:e=>[["pointer-events",e==="none"?"none":"auto"]]},dim:{css:"--lc-dim"},fontSize:{css:"font-size"},fontWeight:{css:"font-weight",as:"raw"},fontStyle:{to:e=>[["font-style",e===2?"italic":e===0?"normal":String(e)]]},fontFamily:{to:e=>[["font-family",ro(e)]]},lineHeight:{to:e=>[["line-height",e==="normal"?"1.2":se(e)]]},letterSpacing:{css:"letter-spacing"},textAlign:{css:"text-align"},textDecoration:{css:"text-decoration-line"},lineClamp:{rank:ne,to:e=>Number(e)>0?[["display","-webkit-box"],["-webkit-box-orient","vertical"],["-webkit-line-clamp",String(Math.round(Number(e)))],["overflow-x","hidden"],["overflow-y","hidden"]]:[["-webkit-line-clamp","none"]]},textOverflow:{css:"text-overflow"},objectFit:{to:e=>[["object-fit",String(e)],["--lc-fit",e==="fill"?"100% 100%":String(e)]]},placeholder:{attr:!0},type:{attr:!0},enterKey:{attr:!0},autocapitalize:{attr:!0},autocorrect:{attr:!0},maxLength:{attr:!0},keyboardShrink:{attr:!0},keyboardDismiss:{attr:!0},showScrollbar:{to:e=>[["scrollbar-width",oo(e)?"thin":"none"]]},overscrollMode:{to:e=>[["overscroll-behavior",so({default:"auto",none:"none",absorb:"contain"})(e)]]},keyboardDismissMode:{attr:!0},snap:{to:e=>e==="none"?[["scroll-snap-type","none"],["--lc-snap","none"]]:[["scroll-snap-type","both mandatory"],["--lc-snap",String(e)]]},sheetDetents:{attr:!0},sheetDetent:{attr:!0},sheetDismissible:{attr:!0},background:{to:eo,rank:ne},border:we(Ie,ne),borderTop:we(["top"],re),borderRight:we(["right"],re),borderBottom:we(["bottom"],re),borderLeft:we(["left"],re),flex:{to:Jr,rank:ne}},Xe=e=>Mr[e]??e,io=e=>e in Ae,bn=e=>{const t=Ae[e];return!!t&&"attr"in t},ao={overflow:"overflow-x",pointerEvents:"pointer-events",fontFamily:"font-family",fontStyle:"font-style",lineHeight:"line-height",objectFit:"object-fit",transform:"transform",borderRadius:"border-top-left-radius",borderWidth:"border-top-width",borderColor:"border-top-color",backgroundImage:"--lc-bg-img",backgroundGradient:"--lc-bg-grad",backgroundSize:"background-size",showScrollbar:"scrollbar-width",overscrollMode:"overscroll-behavior",snap:"--lc-snap",lineClamp:"-webkit-line-clamp",borderTopWidth:"border-top-width",borderRightWidth:"border-right-width",borderBottomWidth:"border-bottom-width",borderLeftWidth:"border-left-width",borderHorizontalWidth:"border-left-width",borderVerticalWidth:"border-top-width",borderStartWidth:"border-inline-start-width",borderEndWidth:"border-inline-end-width"},lo=e=>{const t=Ae[e];return t&&"css"in t&&typeof t.css=="string"?t.css:ao[e]??null},co={len:se,lens:pn,num:e=>String(e),raw:e=>String(e),color:Ce},uo={color:"color",len:"len",enum:"raw",num:"num",str:"raw",layout:"raw"},Mt=e=>{const t=Ae[e];return t&&"rank"in t&&t.rank!==void 0?t.rank:_e},Je=(e,t,n)=>{const r=[...e].filter(([,s])=>s!=null);r.sort((s,o)=>Mt(s[0])-Mt(o[0]));const i=new Map;for(const[s,o]of r){const l=Ae[s];if(!l){n==null||n(s);continue}if("attr"in l||"none"in l)continue;if("to"in l){for(const[y,k]of l.to(o,t))i.set(y,k);continue}const d=co[l.as??uo[Be[s]??"layout"]],f=d(o);if(typeof l.css=="string")i.set(l.css,f);else for(const y of l.css)i.set(y,f)}return i},Ft=e=>[...e].sort((t,n)=>t[0]<n[0]?-1:t[0]>n[0]?1:0).map(([t,n])=>`${t}:${n}`).join(";"),yn=0,vn=1,Le=2,xe=3,En=4,me=65,Ve=1.70158,Ue=Ve*1.525,Pt=Ve+1,It=2*Math.PI/3,Dt=2*Math.PI/4.5,Ne=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,lt=[["linear",e=>e],["inSine",e=>1-Math.cos(e*Math.PI/2)],["outSine",e=>Math.sin(e*Math.PI/2)],["inOutSine",e=>-(Math.cos(Math.PI*e)-1)/2],["inQuad",e=>e*e],["outQuad",e=>1-(1-e)*(1-e)],["inOutQuad",e=>e<.5?2*e*e:1-(-2*e+2)**2/2],["inCubic",e=>e*e*e],["outCubic",e=>1-(1-e)**3],["inOutCubic",e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2],["inQuart",e=>e**4],["outQuart",e=>1-(1-e)**4],["inOutQuart",e=>e<.5?8*e**4:1-(-2*e+2)**4/2],["inExpo",e=>e===0?0:2**(10*e-10)],["outExpo",e=>e===1?1:1-2**(-10*e)],["inOutExpo",e=>e===0?0:e===1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2],["inCirc",e=>1-Math.sqrt(1-e*e)],["outCirc",e=>Math.sqrt(1-(e-1)**2)],["inOutCirc",e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2],["inBack",e=>Pt*e*e*e-Ve*e*e],["outBack",e=>1+Pt*(e-1)**3+Ve*(e-1)**2],["inOutBack",e=>e<.5?(2*e)**2*((Ue+1)*2*e-Ue)/2:((2*e-2)**2*((Ue+1)*(e*2-2)+Ue)+2)/2],["inElastic",e=>e===0?0:e===1?1:-(2**(10*e-10))*Math.sin((e*10-10.75)*It)],["outElastic",e=>e===0?0:e===1?1:2**(-10*e)*Math.sin((e*10-.75)*It)+1],["inOutElastic",e=>e===0?0:e===1?1:e<.5?-(2**(20*e-10)*Math.sin((20*e-11.125)*Dt))/2:2**(-20*e+10)*Math.sin((20*e-11.125)*Dt)/2+1],["inBounce",e=>1-Ne(1-e)],["outBounce",Ne],["inOutBounce",e=>e<.5?(1-Ne(1-2*e))/2:(1+Ne(2*e-1))/2],["smoothstep",e=>e*e*(3-2*e)]],fo={in:"inQuad",out:"outQuad",inOut:"inOutQuad",easeIn:"inQuad",easeOut:"outQuad",easeInOut:"inOutQuad","ease-in":"inQuad","ease-out":"outQuad","ease-in-out":"inOutQuad"},po=e=>{const t=fo[e]??e;for(let n=0;n<lt.length;n++)if(lt[n][0]===t)return n;return-1},ho=[.25,.1,.25,1],Me={kind:yn,p:[0,0,0,0]},mo=e=>{const t=new Float32Array(me);for(let n=0;n<me;n++)t[n]=e(n/(me-1));return t[0]=0,t[me-1]=1,t},go=e=>{if(e===void 0)return Me;if(typeof e=="function")return{kind:En,p:[0,0,0,0],table:mo(e)};if(Array.isArray(e)){const[i,s,o,l]=e;return{kind:Le,p:[i,s,o,l]}}const t=e.trim();if(t==="linear")return Me;if(t==="ease")return{kind:Le,p:ho};if(t==="steps")return{kind:xe,p:[1,0,0,0]};let n=/^steps\(\s*(\d+)\s*(?:,\s*(start|end|jump-start|jump-end)\s*)?\)$/.exec(t);if(n)return{kind:xe,p:[Math.max(1,parseInt(n[1],10)),n[2]==="start"||n[2]==="jump-start"?1:0,0,0]};if(n=/^cubic-bezier\(\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*\)$/.exec(t),n)return{kind:Le,p:[parseFloat(n[1]),parseFloat(n[2]),parseFloat(n[3]),parseFloat(n[4])]};const r=po(t);return r===0?Me:r>0?{kind:vn,p:[r,0,0,0]}:(console.warn(`[tween] unknown easing "${t}" — using linear`),Me)},bo=(e,t,n,r,i)=>{const s=1-3*r+3*t,o=3*r-6*t,l=3*t,d=1-3*i+3*n,f=3*i-6*n,y=3*n;let k=e;for(let A=0;A<8;A++){const _=((s*k+o)*k+l)*k-e,p=(3*s*k+2*o)*k+l;if(Math.abs(_)<1e-6||Math.abs(p)<1e-6)break;k-=_/p}return k=Math.min(1,Math.max(0,k)),((d*k+f)*k+y)*k},yo=(e,t)=>{if(t<=0)return e.kind===xe&&e.p[1]===1?1/e.p[0]:0;if(t>=1)return 1;switch(e.kind){case vn:return lt[e.p[0]][1](t);case Le:return bo(t,e.p[0],e.p[1],e.p[2],e.p[3]);case xe:{const n=e.p[0];return e.p[1]===1?Math.min(1,Math.ceil(t*n)/n):Math.floor(t*n)/n}case En:{const n=e.table,r=t*(me-1),i=Math.floor(r),s=n[i],o=n[Math.min(i+1,me-1)];return s+(o-s)*(r-i)}default:return t}},Bt=24,Vt=e=>String(Math.round(e*1e4)/1e4),vo="cubic-bezier(0.3333, 0, 0.6667, 1)",Eo=e=>{switch(e.kind){case yn:return"linear";case Le:return`cubic-bezier(${e.p.map(Vt).join(", ")})`;case xe:return`steps(${e.p[0]}, ${e.p[1]===1?"jump-start":"jump-end"})`}const t=[];for(let n=0;n<=Bt;n++)t.push(Vt(yo(e,n/Bt)));return`linear(${t.join(", ")})`},wo=e=>e===void 0||e==="smoothstep"?vo:Eo(go(e)),wn=["lc-base","lc-bag","lc-own","lc-orient","lc-class","lc-hover","lc-press","lc-focus"],So=["--lc-bg-grad","--lc-bg-img","--lc-tint","--lc-overlay","--lc-refresh","--lc-fit","--lc-src","--lc-src-tint","--lc-iw","--lc-ih","--lc-ir","--lc-crop-size","--lc-crop-pos"],Sn="lc-app",_o=`
|
|
3
3
|
@layer ${wn.join(", ")};
|
|
4
4
|
|
|
5
5
|
@layer lc-base {
|
package/runtime/web-page/page.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var ft=Object.defineProperty;var mt=(i,o,t)=>o in i?ft(i,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[o]=t;var p=(i,o,t)=>mt(i,typeof o!="symbol"?o+"":o,t);(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))e(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const a of r.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&e(a)}).observe(document,{childList:!0,subtree:!0});function t(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function e(s){if(s.ep)return;s.ep=!0;const r=t(s);fetch(s.href,r)}})();const q=[{id:"iphone",name:"iPhone",width:393,height:852,radius:55,bezel:10,keyboard:336,keyboardLook:"ios",insets:{portrait:{top:59,right:0,bottom:34,left:0},landscape:{top:0,right:59,bottom:21,left:59}},marks:{island:{width:126,height:37,inset:11},homeIndicator:{width:139,height:5,inset:8},status:{height:59}}},{id:"android",name:"Android",width:412,height:915,radius:28,bezel:8,keyboard:300,keyboardLook:"android",insets:{portrait:{top:24,right:0,bottom:48,left:0,bars:["top","bottom"]},landscape:{top:24,right:0,bottom:48,left:0,bars:["top","bottom"]}},marks:{camera:{size:12,inset:6},navigation:{height:48},status:{height:24}}},{id:"tablet",name:"Tablet",width:820,height:1180,radius:18,bezel:14,keyboard:0,keyboardLook:"ios",insets:{portrait:{top:24,right:0,bottom:20,left:0},landscape:{top:24,right:0,bottom:20,left:0}},marks:{homeIndicator:{width:260,height:5,inset:7},status:{height:24}}}],rt=i=>q.find(o=>o.id===i)??null,Q=(i,o)=>o==="landscape"?{width:i.height,height:i.width}:{width:i.width,height:i.height},bt=(i,o,t)=>{const e=Q(i,o),s=e.width+i.bezel*2,r=e.height+i.bezel*2;return t.width<=0||t.height<=0?1:Math.min(1,t.width/s,t.height/r)},kt=(i,o,t)=>{if(i>=1)return 1;const e=Math.floor(o*i*t);return e>0?e/(o*t):i},yt=`
|
|
2
2
|
.marks { position: absolute; inset: 0; pointer-events: none; color: var(--lecodes-frame-marks, #ffffff); font: 600 15px/1 system-ui, sans-serif; }
|
|
3
3
|
/* what the system draws OVER the app is seen on any app: light on a dark one, dark on a light one */
|
|
4
4
|
.marks > * { position: absolute; mix-blend-mode: difference; }
|
|
@@ -12,7 +12,24 @@ var ot=Object.defineProperty;var rt=(i,o,t)=>o in i?ot(i,o,{enumerable:!0,config
|
|
|
12
12
|
.navigation .back { border: 0; width: 0; height: 0; border-style: solid; border-width: 8px 13px 8px 0; border-color: transparent currentColor transparent transparent; }
|
|
13
13
|
.navigation .homeButton { border-radius: 50%; }
|
|
14
14
|
.navigation .recent { border-radius: 3px; }
|
|
15
|
-
`,
|
|
15
|
+
`,y=i=>`${i}px`,B=(i,o,t)=>{const e=i.createElement("div");return e.className=o,Object.assign(e.style,t),e},wt=(i,o,t)=>{const e=i.ownerDocument,{marks:s}=o,r=t==="landscape",a=[];if(s.island){const{width:h,height:b,inset:w}=s.island;a.push(r?B(e,"island solid",{left:y(w),top:"50%",width:y(b),height:y(h),transform:"translateY(-50%)"}):B(e,"island solid",{top:y(w),left:"50%",width:y(h),height:y(b),transform:"translateX(-50%)"}))}if(s.camera){const{size:h,inset:b}=s.camera;a.push(r?B(e,"camera solid",{left:y(b),top:"50%",width:y(h),height:y(h),transform:"translateY(-50%)"}):B(e,"camera solid",{top:y(b),left:"50%",width:y(h),height:y(h),transform:"translateX(-50%)"}))}if(s.homeIndicator){const{width:h,height:b,inset:w}=s.homeIndicator;a.push(B(e,"home",{bottom:y(w),left:"50%",width:y(h),height:y(b),transform:"translateX(-50%)"}))}const g=o.insets[t].top;if(s.status&&g>0){const h=B(e,"clock",{top:"0",left:y(s.island?34:18),height:y(Math.min(g,s.status.height))});h.textContent="9:41",s.island||(h.style.fontSize="13px"),a.push(h)}if(s.navigation){const h=B(e,"navigation",{height:y(s.navigation.height)});for(const b of["back","homeButton","recent"]){const w=e.createElement("i");w.className=b,h.appendChild(w)}a.push(h)}i.replaceChildren(...a)},vt=`
|
|
16
|
+
.keys { position: absolute; left: 0; right: 0; bottom: 0; overflow: hidden; box-sizing: border-box; font: 400 22px/1 -apple-system, "SF Pro Text", Roboto, system-ui, sans-serif; color: #000; transform: translateY(100%); will-change: transform; }
|
|
17
|
+
.keys.shown { transform: translateY(0); }
|
|
18
|
+
.keys.ios { background: #d1d3d9; }
|
|
19
|
+
.keys.android { background: #eceff1; color: #202124; }
|
|
20
|
+
.keys .bar { position: absolute; left: 0; right: 0; display: flex; align-items: center; justify-content: space-evenly; }
|
|
21
|
+
.keys.ios .bar i { display: block; width: 1px; height: 24px; background: rgba(0, 0, 0, 0.14); }
|
|
22
|
+
.keys.android .bar i { display: block; width: 18px; height: 18px; border-radius: 50%; background: rgba(0, 0, 0, 0.08); }
|
|
23
|
+
.keys .k { position: absolute; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 5px; box-shadow: 0 1px 0 #8d8f94; white-space: nowrap; }
|
|
24
|
+
.keys.android .k { border-radius: 6px; box-shadow: none; }
|
|
25
|
+
.keys .k.s { background: #acb1ba; font-size: 16px; }
|
|
26
|
+
.keys.android .k.s { background: #d4d8dd; }
|
|
27
|
+
.keys.ios .k.space { background: #fff; font-size: 16px; }
|
|
28
|
+
.keys.android .k.space { background: #fff; }
|
|
29
|
+
.keys .k.shift::before { content: ""; display: block; width: 0; height: 0; border-style: solid; border-width: 0 9px 10px 9px; border-color: transparent transparent #000 transparent; }
|
|
30
|
+
.keys .k.del::before { content: "⌫"; font-size: 20px; }
|
|
31
|
+
.keys .k.emoji::before { content: "☺"; font-size: 20px; }
|
|
32
|
+
`,xt="cubic-bezier(0.38, 0.7, 0.125, 1)",Et={en:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]],ru:[["й","ц","у","к","е","н","г","ш","щ","з","х"],["ф","ы","в","а","п","р","о","л","д","ж","э"],["я","ч","с","м","и","т","ь","б","ю"]]},$t={en:{space:"space",enter:"return"},ru:{space:"Пробел",enter:"Ввод"}},N=i=>`${Math.round(i*2)/2}px`,Lt=(i,o)=>{const{look:t,width:e,height:s,inset:r}=o,a=o.language.slice(0,2)==="ru"?"ru":"en",g=Et[a],h=$t[a],b=t==="ios",w=[],f=(k,I,G,V,_,gt)=>{const H=i.createElement("div");H.className=`k${I?` ${I}`:""}`,H.textContent=k,Object.assign(H.style,{left:N(G),top:N(V),width:N(_),height:N(gt)}),w.push(H)},z=b?44:40,j=i.createElement("div");j.className="bar",Object.assign(j.style,{top:"0",height:N(z)});for(let k=0;k<(b?2:3);k++)j.append(i.createElement("i"));w.push(j);const m=3,x=6,M=b?11:9,P=g[0].length,S=(e-m*2-x*(P-1))/P,n=s-z-r,c=Math.min(b?42:46,(n-M*5)/4),d=z+Math.max(M,(n-(c*4+M*3))/2-2),l=k=>d+k*(c+M),E=k=>(e-k*S-(k-1)*x)/2;g.forEach((k,I)=>{const G=E(k.length);k.forEach((V,_)=>f(V,"",G+_*(S+x),l(I),S,c))});const C=g[2],L=E(C.length)-x-m;f("","s shift",m,l(2),L,c),f("","s del",e-m-L,l(2),L,c);const v=l(3),A=S*2+x;if(b){f("123","s",m,v,A,c),f("","s emoji",m+A+x,v,S,c);const k=m+A+x+S+x;f(h.space,"space",k,v,e-k-m-A-x,c),f(h.enter,"s",e-m-A,v,A,c)}else{f("?123","s",m,v,A,c),f(",","",m+A+x,v,S,c);const k=m+A+x+S+x,I=e-m-A-x-S;f("","space",k,v,I-x-k,c),f(".","",I,v,S,c),f("↵","s",e-m-A,v,A,c)}return w},St=i=>{if(i.dataset.pointer)return;i.dataset.pointer="taken",i.style.pointerEvents="auto";const o=t=>{t.preventDefault(),t.stopPropagation()};for(const t of["pointerdown","mousedown","touchstart","click"])i.addEventListener(t,o,{passive:!1})},it=(i,o)=>{const{look:t,height:e}=o,s=o.duration??0;o.live&&St(i);const r=i.classList.contains("shown");if(i.style.transition=s>0?`transform ${s}ms ${xt}`:"",e<=0){if(!r){i.replaceChildren(),i.style.height="0";return}i.classList.remove("shown");const a=()=>{i.classList.contains("shown")||(i.replaceChildren(),i.style.height="0")};s>0?i.addEventListener("transitionend",a,{once:!0}):a();return}i.className=`keys ${t}${r?" shown":""}`,i.style.height=N(e),i.replaceChildren(...Lt(i.ownerDocument,o)),r||(s>0&&i.offsetHeight,i.classList.add("shown"))},At=`
|
|
16
33
|
:host { display: block; position: relative; overflow: hidden; min-width: 0; min-height: 0; }
|
|
17
34
|
.stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
|
|
18
35
|
.device { position: relative; flex: none; box-sizing: content-box; background: var(--lecodes-frame-body, #0b0b0d); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.10), 0 24px 60px rgba(0, 0, 0, 0.35); }
|
|
@@ -26,6 +43,7 @@ iframe { display: block; width: 100%; height: 100%; border: 0; background: #000;
|
|
|
26
43
|
.found > i { position: absolute; display: block; background: rgba(120, 200, 140, 0.35); }
|
|
27
44
|
.found > b { position: absolute; left: 0; bottom: 100%; margin-bottom: 3px; padding: 2px 6px; border-radius: 4px; white-space: nowrap; background: #1f2126; color: #e6e7ea; font: 500 11px/1.4 system-ui, sans-serif; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }
|
|
28
45
|
.found.low > b { bottom: auto; top: 100%; margin: 3px 0 0; }
|
|
29
|
-
${
|
|
30
|
-
`,pt=600,ut=["player","src","device","orientation","language","bare","inspect"],gt=3e3,B=class B extends HTMLElement{constructor(){super();h(this,"stage");h(this,"body");h(this,"screen");h(this,"over");h(this,"marks");h(this,"pick");h(this,"found");h(this,"asked",new Map);h(this,"requests",0);h(this,"pointing",null);h(this,"pointed",!1);h(this,"iframe",null);h(this,"observer");h(this,"loaded",!1);h(this,"mounting",!1);h(this,"turned",null);h(this,"locked",!1);h(this,"shownScale",1);h(this,"onWindow",()=>{this.layout(),this.tellSafeArea()});h(this,"onMessage",t=>{var s;if(!this.iframe||t.source!==this.iframe.contentWindow)return;const e=t.data;if(!(!e||typeof e!="object"))switch(e.type){case"lecodes:ready":this.highlight(null),this.emit("app-ready",{src:String(e.src)});break;case"lecodes:error":this.emit("app-error",e.error);break;case"lecodes:log":this.emit("app-log",{level:e.level,text:String(e.text)});break;case"lecodes:inspected":(s=this.asked.get(e.request))==null||s(e.answer);break;case"lecodes:orientation":{e.mode==="landscape"||e.mode==="portrait"?(this.turned=e.mode,this.locked=!0):this.locked=!1,this.layout(),this.tellSafeArea(),this.emit("app-orientation",{orientation:this.orientation,locked:this.locked});break}}});const t=this.attachShadow({mode:"open"}),e=this.ownerDocument,s=e.createElement("style");s.textContent=ht;const r=a=>{const m=e.createElement("div");return m.className=a,m};this.stage=r("stage"),this.body=r("device"),this.screen=r("screen"),this.over=r("over"),this.marks=r("marks"),this.pick=r("pick"),this.found=r("found"),this.found.append(e.createElement("i"),e.createElement("b")),this.over.append(this.found,this.marks,this.pick),this.pick.addEventListener("pointermove",a=>this.point(a)),this.pick.addEventListener("pointerleave",()=>{this.pointing=null,this.picking&&(this.highlight(null),this.emit("app-point",null))}),this.pick.addEventListener("click",a=>{this.at(a).then(m=>{m&&(this.highlight(m),this.emit("app-pick",m))})}),this.screen.appendChild(this.over),this.body.appendChild(this.screen),this.stage.appendChild(this.body),t.append(s,this.stage),this.observer=new ResizeObserver(()=>this.layout())}static get noRoom(){return window.innerWidth<pt}get player(){return this.getAttribute("player")??""}set player(t){this.setAttribute("player",t)}get src(){return this.getAttribute("src")??""}set src(t){this.setAttribute("src",t)}get device(){return this.getAttribute("device")??R[0].id}set device(t){this.setAttribute("device",t)}get language(){return this.getAttribute("language")??""}set language(t){this.setAttribute("language",t)}get orientation(){return this.turned??(this.getAttribute("orientation")==="landscape"?"landscape":"portrait")}set orientation(t){this.turned=null,this.locked=!1,this.setAttribute("orientation",t)}get orientationLocked(){return this.locked}get bare(){return this.hasAttribute("bare")||this.current===null}get inspect(){return this.hasAttribute("inspect")}set inspect(t){this.toggleAttribute("inspect",t)}get picking(){return this.hasAttribute("picking")}set picking(t){this.toggleAttribute("picking",t),t||this.highlight(null)}get scale(){return this.shownScale}get current(){return this.hasAttribute("bare")||B.noRoom?null:K(this.device)}get playerUrl(){return this.urlFor(null)}rotate(){this.locked||(this.orientation=this.orientation==="portrait"?"landscape":"portrait",this.emit("app-orientation",{orientation:this.orientation,locked:!1}))}ask(t){return new Promise(e=>{const s=++this.requests,r=a=>{this.asked.delete(s)&&e(a&&a.ask===t.ask?a:null)};this.asked.set(s,r),window.setTimeout(()=>r(null),gt),this.post({type:"lecodes:inspect",request:s,question:t})})}highlight(t){const e=this.found;if(!t){e.style.display="none";return}const{rect:s,padding:r}=t;Object.assign(e.style,{display:"block",left:`${s.x}px`,top:`${s.y}px`,width:`${s.width}px`,height:`${s.height}px`}),Object.assign(e.firstElementChild.style,{left:`${r.left}px`,top:`${r.top}px`,right:`${r.right}px`,bottom:`${r.bottom}px`}),e.lastElementChild.textContent=`${t.type}${t.name?` "${t.name}"`:""} ${Math.round(s.width)} × ${Math.round(s.height)}`,e.classList.toggle("low",s.y<24)}reload(){this.post({type:"lecodes:reload"})}connectedCallback(){this.observer.observe(this),window.addEventListener("message",this.onMessage),window.addEventListener("resize",this.onWindow),this.remount()}disconnectedCallback(){var t;this.observer.disconnect(),window.removeEventListener("message",this.onMessage),window.removeEventListener("resize",this.onWindow),(t=this.iframe)==null||t.remove(),this.iframe=null}attributeChangedCallback(t,e,s){if(!(!this.isConnected||e===s))switch(t){case"player":this.remount();break;case"src":this.loaded?s&&this.post({type:"lecodes:run",src:s}):this.remount();break;case"language":this.loaded?s&&this.post({type:"lecodes:language",language:s}):this.remount();break;case"inspect":this.remount();break;default:this.layout(),this.tellSafeArea()}}toApp(t){const e=this.screen.getBoundingClientRect();return{x:(t.clientX-e.left)/this.shownScale,y:(t.clientY-e.top)/this.shownScale}}async at(t){var e;return((e=await this.ask({ask:"at",...this.toApp(t)}))==null?void 0:e.node)??null}point(t){this.pointing=this.toApp(t),!this.pointed&&(this.pointed=!0,(async()=>{var e;for(;this.pointing&&this.picking;){const{x:s,y:r}=this.pointing;this.pointing=null;const a=((e=await this.ask({ask:"at",x:s,y:r}))==null?void 0:e.node)??null;if(!this.picking)break;this.highlight(a),this.emit("app-point",a)}this.pointed=!1})())}remount(){this.mounting||(this.mounting=!0,queueMicrotask(()=>{this.mounting=!1,this.isConnected&&this.mount()}))}mount(){var e;if((e=this.iframe)==null||e.remove(),this.iframe=null,this.loaded=!1,!this.player)return;const t=this.ownerDocument.createElement("iframe");t.addEventListener("load",()=>{this.iframe===t&&(this.loaded=!0,this.tellSafeArea())}),t.setAttribute("allow","autoplay; fullscreen; camera; microphone; geolocation; clipboard-read; clipboard-write; gamepad"),t.title="LeCodes app",t.src=this.urlFor(this.current),this.screen.prepend(t),this.iframe=t,this.layout()}urlFor(t){var s;const e=new URL(this.player,this.ownerDocument.baseURI);if(this.src&&e.searchParams.set("src",this.src),this.language&&e.searchParams.set("lang",this.language),this.inspect&&e.searchParams.set("inspect",""),t){const r=t.insets[this.orientation];e.searchParams.set("safe-area",[r.top,r.right,r.bottom,r.left].join(",")),(s=r.bars)!=null&&s.length&&e.searchParams.set("bars",r.bars.join(","))}return e.href}layout(){const t=this.current;this.toggleAttribute("framed",t!==null);const e=this.body.style;if(!t){this.shownScale=1,Object.assign(e,{width:"100%",height:"100%",padding:"0",borderRadius:"0",zoom:""}),this.screen.style.borderRadius="0",this.marks.replaceChildren();return}const s=this.orientation,r=V(t,s);this.shownScale=lt(at(t,s,{width:this.clientWidth,height:this.clientHeight}),r.width,window.devicePixelRatio||1),Object.assign(e,{width:`${r.width}px`,height:`${r.height}px`,padding:`${t.bezel}px`,borderRadius:`${t.radius+t.bezel}px`,zoom:String(this.shownScale)}),this.screen.style.borderRadius=`${t.radius}px`,dt(this.marks,t,s)}post(t){var s;const e=(s=this.iframe)==null?void 0:s.contentWindow;!e||!this.player||e.postMessage(t,new URL(this.player,this.ownerDocument.baseURI).origin)}tellSafeArea(){const t=this.current;this.post({type:"lecodes:safe-area",insets:t?{...t.insets[this.orientation]}:null})}emit(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e}))}};h(B,"observedAttributes",ut);let O=B;const mt=(i="lecodes-frame")=>{customElements.get(i)||customElements.define(i,O)};typeof customElements<"u"&&mt();const f=(i,o,t)=>{const e=document.createElement(i);return o&&(e.className=o),t!==void 0&&(e.textContent=t),e},X=i=>i.type+(i.name?` "${i.name}"`:""),F=/^(width|height|minWidth|minHeight|maxWidth|maxHeight|aspectRatio|flex|flexGrow|flexShrink|flexBasis|flexDirection|flexWrap|alignItems|alignSelf|alignContent|justifyContent|gap|rowGap|columnGap|position|left|top|right|bottom|inset|display|overflow|zIndex|m|mx|my|mt|mr|mb|ml|margin\w*|p|px|py|pt|pr|pb|pl|padding\w*)$/,w=i=>typeof i=="string"?i:typeof i=="number"?String(Math.round(i*100)/100):Array.isArray(i)?i.map(w).join(" "):typeof i=="object"&&i!==null?Object.entries(i).map(([o,t])=>`${o}: ${w(t)}`).join(", "):String(i),ft=(i,o,t)=>{const e=o.querySelector("#pick"),s=o.querySelector("#tree"),r=o.querySelector("#details"),a=new Set;let m=0,u=!1;const k=(n,d,l)=>{const c=f("div","node");c.dataset.id=String(n.id),c.style.paddingLeft=`${8+d*14}px`,c.classList.toggle("chosen",n.id===m);const y=f("span","fold",n.children.length===0?"":a.has(n.id)?"▸":"▾");if(y.addEventListener("click",E=>{E.stopPropagation(),a.has(n.id)?a.delete(n.id):a.add(n.id),b()}),c.append(y,f("span","type",n.type)),n.name&&c.append(f("span","name",` "${n.name}"`)),n.text&&c.append(f("span","text",` ${n.text.replace(/\s+/g," ")}`)),c.addEventListener("mouseenter",()=>i.highlight({...n,padding:{top:0,right:0,bottom:0,left:0}})),c.addEventListener("click",()=>void st(n.id)),l.append(c),!a.has(n.id))for(const E of n.children)k(E,d+1,l)},b=async()=>{if(!u)return;const n=await i.ask({ask:"tree"}),d=f("div");n||d.append(f("div","empty","No app is running."));for(const l of(n==null?void 0:n.layers)??[])l.kind==="widget"&&d.append(f("div","layer","widget")),k(l.tree,0,d);s.replaceChildren(d)};s.addEventListener("mouseleave",()=>{nt()});const $=(n,d)=>{if(d.length===0)return null;const l=f("div","section");l.append(f("div","title",n));for(const[c,y]of d){const E=f("div","pair");E.append(f("span","key",c),f("span","value",y)),l.append(E)}return l},P=n=>typeof n=="object"&&n!==null&&!Array.isArray(n),N=(n,d)=>Object.entries(n??{}).filter(([l,c])=>d(l,c)).map(([l,c])=>[l,w(c)]),I=n=>{var Y;if(!n){r.replaceChildren(f("div","empty","Pick an element: in the app, or in the outline."));return}const d=f("div","head",X(n)),l=f("div","path",n.path.slice(0,-1).map(X).join(" › ")),{rect:c,padding:y}=n,E=[$("Box",[["size",`${w(c.width)} × ${w(c.height)}`],["position",`${w(c.x)}, ${w(c.y)}`],...y.top||y.right||y.bottom||y.left?[["padding",`${y.top} ${y.right} ${y.bottom} ${y.left}`]]:[],...n.scroll?[["scroll",`${n.scroll.axis}: ${w(n.scroll.offset)} of ${w(n.scroll.content)}`]]:[],...(Y=n.state)!=null&&Y.length?[["state",n.state.join(", ")]]:[]]),n.text!==void 0?$("Text",[["",n.text]]):null,$("Layout",N(n.set,(v,S)=>F.test(v)&&!P(S))),$("Set by the app",N(n.set,(v,S)=>!F.test(v)&&!P(S))),...Object.entries(n.set??{}).filter(([,v])=>P(v)).map(([v,S])=>$(v,N(S,()=>!0))),$("Painted",Object.entries(n.style).map(([v,S])=>[v,w(S)])),n.source?$("Made at",[["",`${n.source.file}:${n.source.line}:${n.source.column}`]]):null];r.replaceChildren(d,l,...E.filter(v=>v!==null))},st=async n=>{var l;m=n;const d=((l=await i.ask({ask:"node",node:n}))==null?void 0:l.node)??null;i.highlight(d),I(d);for(const c of s.querySelectorAll(".node"))c.classList.toggle("chosen",c.dataset.id===String(n))},nt=async()=>{var n;i.picking||i.highlight(m?((n=await i.ask({ask:"node",node:m}))==null?void 0:n.node)??null:null)},T=n=>{i.picking=n,e.setAttribute("aria-pressed",String(n))};e.addEventListener("click",()=>T(!i.picking)),i.addEventListener("app-pick",n=>{const d=n.detail;T(!1),i.highlight(d),m=d.id;for(const l of d.path)a.delete(l.id);I(d),b().then(()=>{var l;return(l=s.querySelector(".node.chosen"))==null?void 0:l.scrollIntoView({block:"nearest"})})}),i.addEventListener("app-ready",()=>{m=0,a.clear(),I(null),b()});const D=n=>{u=n,o.hidden=!n,t.setAttribute("aria-pressed",String(n)),n?b():(T(!1),i.highlight(null))};return t.addEventListener("click",()=>D(!u)),o.querySelector("#refresh").addEventListener("click",()=>void b()),I(null),{setOpen:D,get open(){return u}}},C=new URLSearchParams(location.search),p=document.getElementById("frame");p.player=C.get("player")??"player/?dev=../..";C.get("src")&&(p.src=C.get("src"));p.inspect=!0;O.noRoom&&location.replace(p.playerUrl);const j=i=>{try{return localStorage.getItem(`lecodes-dev:${i}`)}catch{return null}},z=(i,o)=>{try{localStorage.setItem(`lecodes-dev:${i}`,o)}catch{}},_="none",W=C.get("device")??j("device")??R[0].id;p.device=W===_||K(W)?W:R[0].id;p.orientation=(C.get("orientation")??j("orientation"))==="landscape"?"landscape":"portrait";const J=document.getElementById("devices"),q=document.getElementById("rotate"),bt=document.getElementById("scale"),M=()=>{for(const o of J.querySelectorAll("button"))o.setAttribute("aria-pressed",String(o.dataset.device===p.device));const i=!p.bare;q.disabled=!i||p.orientationLocked,q.title=p.orientationLocked?"The app holds the orientation (app.setOrientation)":"Turn the device",bt.textContent=i&&p.scale<1?`${Math.round(p.scale*100)}%`:""};for(const{id:i,name:o}of[...R,{id:_,name:"No frame"}]){const t=document.createElement("button");t.type="button",t.dataset.device=i,t.textContent=o,t.addEventListener("click",()=>{p.device=i,z("device",i),M()}),J.appendChild(t)}q.addEventListener("click",()=>{p.rotate(),z("orientation",p.orientation)});document.getElementById("reload").addEventListener("click",()=>p.reload());p.addEventListener("app-orientation",M);new ResizeObserver(M).observe(p);M();const Q=document.getElementById("console"),x=document.getElementById("console-lines"),Z=document.getElementById("console-toggle"),G=document.getElementById("console-count"),yt=500;let A=0;const H=i=>{Q.hidden=!i,Z.setAttribute("aria-pressed",String(i)),z("console",i?"1":"0")},U=()=>{G.textContent=A>0?String(A):"",G.classList.toggle("errors",A>0)},tt=(i,o,t)=>{const e=x.scrollTop+x.clientHeight>=x.scrollHeight-4,s=document.createElement("div");if(s.className=`line ${i}`,s.textContent=o,t){const r=document.createElement("span");r.className="where",r.textContent=`
|
|
31
|
-
at ${t}`,s.appendChild(r)}for(x.appendChild(s);x.childElementCount>yt;)x.firstElementChild.remove();e&&(x.scrollTop=x.scrollHeight)};p.addEventListener("app-log",i=>{var s;const{level:o,text:t}=i.detail,e=(s=/^\[(ERROR|WARN)\]/.exec(t))==null?void 0:s[1];tt(e==="ERROR"?"error":e==="WARN"?"warn":o,t)});p.addEventListener("app-error",i=>{var e,s;const o=i.detail,t=(e=o.frames)==null?void 0:e[0];A++,U(),tt("error",o.detail?`${o.message}: ${o.detail}`:o.message,t?`${t.source}:${t.line}:${t.column}${t.fn?` (${t.fn})`:""}`:(s=o.nativeFrames)==null?void 0:s[0]),H(!0)});p.addEventListener("app-ready",()=>{A=0,U()});const et=document.getElementById("inspect-toggle"),it=ft(p,document.getElementById("inspector"),et);et.addEventListener("click",()=>z("inspect",it.open?"1":"0"));it.setOpen(j("inspect")==="1");Z.addEventListener("click",()=>H(Q.hidden));document.getElementById("console-clear").addEventListener("click",()=>{x.replaceChildren(),A=0,U()});H(j("console")==="1");
|
|
46
|
+
${yt}
|
|
47
|
+
${vt}
|
|
48
|
+
`,Ct=600,Rt=["player","src","device","orientation","language","bare","inspect"],Ot=3e3,D=class D extends HTMLElement{constructor(){super();p(this,"stage");p(this,"body");p(this,"screen");p(this,"over");p(this,"marks");p(this,"keys");p(this,"pick");p(this,"found");p(this,"asked",new Map);p(this,"requests",0);p(this,"pointing",null);p(this,"pointed",!1);p(this,"iframe",null);p(this,"observer");p(this,"loaded",!1);p(this,"mounting",!1);p(this,"turned",null);p(this,"locked",!1);p(this,"shownScale",1);p(this,"onWindow",()=>{this.layout(),this.tellSafeArea()});p(this,"onMessage",t=>{var s;if(!this.iframe||t.source!==this.iframe.contentWindow)return;const e=t.data;if(!(!e||typeof e!="object"))switch(e.type){case"lecodes:ready":this.highlight(null),this.emit("app-ready",{src:String(e.src)});break;case"lecodes:error":this.emit("app-error",e.error);break;case"lecodes:log":this.emit("app-log",{level:e.level,text:String(e.text)});break;case"lecodes:inspected":(s=this.asked.get(e.request))==null||s(e.answer);break;case"lecodes:keyboard":this.drawKeyboard(e.height,e.duration);break;case"lecodes:orientation":{e.mode==="landscape"||e.mode==="portrait"?(this.turned=e.mode,this.locked=!0):this.locked=!1,this.layout(),this.tellSafeArea(),this.emit("app-orientation",{orientation:this.orientation,locked:this.locked});break}}});const t=this.attachShadow({mode:"open"}),e=this.ownerDocument,s=e.createElement("style");s.textContent=At;const r=a=>{const g=e.createElement("div");return g.className=a,g};this.stage=r("stage"),this.body=r("device"),this.screen=r("screen"),this.over=r("over"),this.marks=r("marks"),this.keys=r("keys"),this.pick=r("pick"),this.found=r("found"),this.found.append(e.createElement("i"),e.createElement("b")),this.over.append(this.found,this.keys,this.marks,this.pick),this.pick.addEventListener("pointermove",a=>this.point(a)),this.pick.addEventListener("pointerleave",()=>{this.pointing=null,this.picking&&(this.highlight(null),this.emit("app-point",null))}),this.pick.addEventListener("click",a=>{this.at(a).then(g=>{g&&(this.highlight(g),this.emit("app-pick",g))})}),this.screen.appendChild(this.over),this.body.appendChild(this.screen),this.stage.appendChild(this.body),t.append(s,this.stage),this.observer=new ResizeObserver(()=>this.layout())}static get noRoom(){return window.innerWidth<Ct}get player(){return this.getAttribute("player")??""}set player(t){this.setAttribute("player",t)}get src(){return this.getAttribute("src")??""}set src(t){this.setAttribute("src",t)}get device(){return this.getAttribute("device")??q[0].id}set device(t){this.setAttribute("device",t)}get language(){return this.getAttribute("language")??""}set language(t){this.setAttribute("language",t)}get orientation(){return this.turned??(this.getAttribute("orientation")==="landscape"?"landscape":"portrait")}set orientation(t){this.turned=null,this.locked=!1,this.setAttribute("orientation",t)}get orientationLocked(){return this.locked}get bare(){return this.hasAttribute("bare")||this.current===null}get inspect(){return this.hasAttribute("inspect")}set inspect(t){this.toggleAttribute("inspect",t)}get picking(){return this.hasAttribute("picking")}set picking(t){this.toggleAttribute("picking",t),t||this.highlight(null)}get scale(){return this.shownScale}get current(){return this.hasAttribute("bare")||D.noRoom?null:rt(this.device)}get playerUrl(){return this.urlFor(null)}rotate(){this.locked||(this.orientation=this.orientation==="portrait"?"landscape":"portrait",this.emit("app-orientation",{orientation:this.orientation,locked:!1}))}ask(t){return new Promise(e=>{const s=++this.requests,r=a=>{this.asked.delete(s)&&e(a&&a.ask===t.ask?a:null)};this.asked.set(s,r),window.setTimeout(()=>r(null),Ot),this.post({type:"lecodes:inspect",request:s,question:t})})}highlight(t){const e=this.found;if(!t){e.style.display="none";return}const{rect:s,padding:r}=t;Object.assign(e.style,{display:"block",left:`${s.x}px`,top:`${s.y}px`,width:`${s.width}px`,height:`${s.height}px`}),Object.assign(e.firstElementChild.style,{left:`${r.left}px`,top:`${r.top}px`,right:`${r.right}px`,bottom:`${r.bottom}px`}),e.lastElementChild.textContent=`${t.type}${t.name?` "${t.name}"`:""} ${Math.round(s.width)} × ${Math.round(s.height)}`,e.classList.toggle("low",s.y<24)}reload(){this.post({type:"lecodes:reload"})}connectedCallback(){this.observer.observe(this),window.addEventListener("message",this.onMessage),window.addEventListener("resize",this.onWindow),this.remount()}disconnectedCallback(){var t;this.observer.disconnect(),window.removeEventListener("message",this.onMessage),window.removeEventListener("resize",this.onWindow),(t=this.iframe)==null||t.remove(),this.iframe=null}attributeChangedCallback(t,e,s){if(!(!this.isConnected||e===s))switch(t){case"player":this.remount();break;case"src":this.loaded?s&&this.post({type:"lecodes:run",src:s}):this.remount();break;case"language":this.loaded?s&&this.post({type:"lecodes:language",language:s}):this.remount();break;case"inspect":this.remount();break;default:this.layout(),this.tellSafeArea()}}toApp(t){const e=this.screen.getBoundingClientRect();return{x:(t.clientX-e.left)/this.shownScale,y:(t.clientY-e.top)/this.shownScale}}async at(t){var e;return((e=await this.ask({ask:"at",...this.toApp(t)}))==null?void 0:e.node)??null}point(t){this.pointing=this.toApp(t),!this.pointed&&(this.pointed=!0,(async()=>{var e;for(;this.pointing&&this.picking;){const{x:s,y:r}=this.pointing;this.pointing=null;const a=((e=await this.ask({ask:"at",x:s,y:r}))==null?void 0:e.node)??null;if(!this.picking)break;this.highlight(a),this.emit("app-point",a)}this.pointed=!1})())}remount(){this.mounting||(this.mounting=!0,queueMicrotask(()=>{this.mounting=!1,this.isConnected&&this.mount()}))}mount(){var e;if((e=this.iframe)==null||e.remove(),this.iframe=null,this.loaded=!1,!this.player)return;const t=this.ownerDocument.createElement("iframe");t.addEventListener("load",()=>{this.iframe===t&&(this.loaded=!0,this.tellSafeArea())}),t.setAttribute("allow","autoplay; fullscreen; camera; microphone; geolocation; clipboard-read; clipboard-write; gamepad"),t.title="LeCodes app",t.src=this.urlFor(this.current),this.screen.prepend(t),this.iframe=t,this.layout()}urlFor(t){var s;const e=new URL(this.player,this.ownerDocument.baseURI);if(this.src&&e.searchParams.set("src",this.src),this.language&&e.searchParams.set("lang",this.language),this.inspect&&e.searchParams.set("inspect",""),t){const r=t.insets[this.orientation];e.searchParams.set("safe-area",[r.top,r.right,r.bottom,r.left].join(",")),(s=r.bars)!=null&&s.length&&e.searchParams.set("bars",r.bars.join(","));const a=this.keyboardBand(t);a>0&&e.searchParams.set("keyboard-band",String(a))}return e.href}layout(){const t=this.current;this.toggleAttribute("framed",t!==null);const e=this.body.style;if(!t){this.shownScale=1,Object.assign(e,{width:"100%",height:"100%",padding:"0",borderRadius:"0",zoom:""}),this.screen.style.borderRadius="0",this.marks.replaceChildren();return}const s=this.orientation,r=Q(t,s);this.shownScale=kt(bt(t,s,{width:this.clientWidth,height:this.clientHeight}),r.width,window.devicePixelRatio||1),Object.assign(e,{width:`${r.width}px`,height:`${r.height}px`,padding:`${t.bezel}px`,borderRadius:`${t.radius+t.bezel}px`,zoom:String(this.shownScale)}),this.screen.style.borderRadius=`${t.radius}px`,wt(this.marks,t,s)}post(t){var s;const e=(s=this.iframe)==null?void 0:s.contentWindow;!e||!this.player||e.postMessage(t,new URL(this.player,this.ownerDocument.baseURI).origin)}tellSafeArea(){const t=this.current;this.post({type:"lecodes:safe-area",insets:t?{...t.insets[this.orientation]}:null});const e=t?this.keyboardBand(t):0;this.post({type:"lecodes:keyboard-band",height:e>0?e:null}),e===0&&this.drawKeyboard(0)}keyboardBand(t){return this.orientation==="portrait"?t.keyboard:0}drawKeyboard(t,e=0){const s=this.current;if(!s||t<=0){it(this.keys,{look:"ios",language:"",width:0,height:0,inset:0,duration:e,live:!0});return}const r=Q(s,this.orientation);it(this.keys,{look:s.keyboardLook,language:this.language,width:r.width,height:t,inset:s.insets[this.orientation].bottom,duration:e,live:!0})}emit(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e}))}};p(D,"observedAttributes",Rt);let Y=D;const jt=(i="lecodes-frame")=>{customElements.get(i)||customElements.define(i,Y)};typeof customElements<"u"&&jt();const $=(i,o,t)=>{const e=document.createElement(i);return o&&(e.className=o),t!==void 0&&(e.textContent=t),e},st=i=>i.type+(i.name?` "${i.name}"`:""),nt=/^(width|height|minWidth|minHeight|maxWidth|maxHeight|aspectRatio|flex|flexGrow|flexShrink|flexBasis|flexDirection|flexWrap|alignItems|alignSelf|alignContent|justifyContent|gap|rowGap|columnGap|position|left|top|right|bottom|inset|display|overflow|zIndex|m|mx|my|mt|mr|mb|ml|margin\w*|p|px|py|pt|pr|pb|pl|padding\w*)$/,R=i=>typeof i=="string"?i:typeof i=="number"?String(Math.round(i*100)/100):Array.isArray(i)?i.map(R).join(" "):typeof i=="object"&&i!==null?Object.entries(i).map(([o,t])=>`${o}: ${R(t)}`).join(", "):String(i),zt=(i,o,t)=>{const e=o.querySelector("#pick"),s=o.querySelector("#tree"),r=o.querySelector("#details"),a=new Set;let g=0,h=!1;const b=(n,c,d)=>{const l=$("div","node");l.dataset.id=String(n.id),l.style.paddingLeft=`${8+c*14}px`,l.classList.toggle("chosen",n.id===g);const E=$("span","fold",n.children.length===0?"":a.has(n.id)?"▸":"▾");if(E.addEventListener("click",C=>{C.stopPropagation(),a.has(n.id)?a.delete(n.id):a.add(n.id),w()}),l.append(E,$("span","type",n.type)),n.name&&l.append($("span","name",` "${n.name}"`)),n.text&&l.append($("span","text",` ${n.text.replace(/\s+/g," ")}`)),l.addEventListener("mouseenter",()=>i.highlight({...n,padding:{top:0,right:0,bottom:0,left:0}})),l.addEventListener("click",()=>void x(n.id)),d.append(l),!a.has(n.id))for(const C of n.children)b(C,c+1,d)},w=async()=>{if(!h)return;const n=await i.ask({ask:"tree"}),c=$("div");n||c.append($("div","empty","No app is running."));for(const d of(n==null?void 0:n.layers)??[])d.kind==="widget"&&c.append($("div","layer","widget")),b(d.tree,0,c);s.replaceChildren(c)};s.addEventListener("mouseleave",()=>{M()});const f=(n,c)=>{if(c.length===0)return null;const d=$("div","section");d.append($("div","title",n));for(const[l,E]of c){const C=$("div","pair");C.append($("span","key",l),$("span","value",E)),d.append(C)}return d},z=n=>typeof n=="object"&&n!==null&&!Array.isArray(n),j=(n,c)=>Object.entries(n??{}).filter(([d,l])=>c(d,l)).map(([d,l])=>[d,R(l)]),m=n=>{var F;if(!n){r.replaceChildren($("div","empty","Pick an element: in the app, or in the outline."));return}const c=$("div","head",st(n)),d=$("div","path",n.path.slice(0,-1).map(st).join(" › ")),{rect:l,padding:E}=n,C=[f("Box",[["size",`${R(l.width)} × ${R(l.height)}`],["position",`${R(l.x)}, ${R(l.y)}`],...E.top||E.right||E.bottom||E.left?[["padding",`${E.top} ${E.right} ${E.bottom} ${E.left}`]]:[],...n.scroll?[["scroll",`${n.scroll.axis}: ${R(n.scroll.offset)} of ${R(n.scroll.content)}`]]:[],...(F=n.state)!=null&&F.length?[["state",n.state.join(", ")]]:[]]),n.text!==void 0?f("Text",[["",n.text]]):null,f("Layout",j(n.set,(L,v)=>nt.test(L)&&!z(v))),f("Set by the app",j(n.set,(L,v)=>!nt.test(L)&&!z(v))),...Object.entries(n.set??{}).filter(([,L])=>z(L)).map(([L,v])=>f(L,j(v,()=>!0))),f("Painted",Object.entries(n.style).map(([L,v])=>[L,R(v)])),n.source?f("Made at",[["",`${n.source.file}:${n.source.line}:${n.source.column}`]]):null];r.replaceChildren(c,d,...C.filter(L=>L!==null))},x=async n=>{var d;g=n;const c=((d=await i.ask({ask:"node",node:n}))==null?void 0:d.node)??null;i.highlight(c),m(c);for(const l of s.querySelectorAll(".node"))l.classList.toggle("chosen",l.dataset.id===String(n))},M=async()=>{var n;i.picking||i.highlight(g?((n=await i.ask({ask:"node",node:g}))==null?void 0:n.node)??null:null)},P=n=>{i.picking=n,e.setAttribute("aria-pressed",String(n))};e.addEventListener("click",()=>P(!i.picking)),i.addEventListener("app-pick",n=>{const c=n.detail;P(!1),i.highlight(c),g=c.id;for(const d of c.path)a.delete(d.id);m(c),w().then(()=>{var d;return(d=s.querySelector(".node.chosen"))==null?void 0:d.scrollIntoView({block:"nearest"})})}),i.addEventListener("app-ready",()=>{g=0,a.clear(),m(null),w()});const S=n=>{h=n,o.hidden=!n,t.setAttribute("aria-pressed",String(n)),n?w():(P(!1),i.highlight(null))};return t.addEventListener("click",()=>S(!h)),o.querySelector("#refresh").addEventListener("click",()=>void w()),m(null),{setOpen:S,get open(){return h}}},W=new URLSearchParams(location.search),u=document.getElementById("frame");u.player=W.get("player")??"player/?dev=../..";W.get("src")&&(u.src=W.get("src"));u.inspect=!0;Y.noRoom&&location.replace(u.playerUrl);const U=i=>{try{return localStorage.getItem(`lecodes-dev:${i}`)}catch{return null}},X=(i,o)=>{try{localStorage.setItem(`lecodes-dev:${i}`,o)}catch{}},at="none",J=W.get("device")??U("device")??q[0].id;u.device=J===at||rt(J)?J:q[0].id;u.orientation=(W.get("orientation")??U("orientation"))==="landscape"?"landscape":"portrait";const ct=document.getElementById("devices"),Z=document.getElementById("rotate"),It=document.getElementById("scale"),K=()=>{for(const o of ct.querySelectorAll("button"))o.setAttribute("aria-pressed",String(o.dataset.device===u.device));const i=!u.bare;Z.disabled=!i||u.orientationLocked,Z.title=u.orientationLocked?"The app holds the orientation (app.setOrientation)":"Turn the device",It.textContent=i&&u.scale<1?`${Math.round(u.scale*100)}%`:""};for(const{id:i,name:o}of[...q,{id:at,name:"No frame"}]){const t=document.createElement("button");t.type="button",t.dataset.device=i,t.textContent=o,t.addEventListener("click",()=>{u.device=i,X("device",i),K()}),ct.appendChild(t)}Z.addEventListener("click",()=>{u.rotate(),X("orientation",u.orientation)});document.getElementById("reload").addEventListener("click",()=>u.reload());u.addEventListener("app-orientation",K);new ResizeObserver(K).observe(u);K();const lt=document.getElementById("console"),O=document.getElementById("console-lines"),dt=document.getElementById("console-toggle"),ot=document.getElementById("console-count"),Bt=500;let T=0;const tt=i=>{lt.hidden=!i,dt.setAttribute("aria-pressed",String(i)),X("console",i?"1":"0")},et=()=>{ot.textContent=T>0?String(T):"",ot.classList.toggle("errors",T>0)},ht=(i,o,t)=>{const e=O.scrollTop+O.clientHeight>=O.scrollHeight-4,s=document.createElement("div");if(s.className=`line ${i}`,s.textContent=o,t){const r=document.createElement("span");r.className="where",r.textContent=`
|
|
49
|
+
at ${t}`,s.appendChild(r)}for(O.appendChild(s);O.childElementCount>Bt;)O.firstElementChild.remove();e&&(O.scrollTop=O.scrollHeight)};u.addEventListener("app-log",i=>{var s;const{level:o,text:t}=i.detail,e=(s=/^\[(ERROR|WARN)\]/.exec(t))==null?void 0:s[1];ht(e==="ERROR"?"error":e==="WARN"?"warn":o,t)});u.addEventListener("app-error",i=>{var e,s;const o=i.detail,t=(e=o.frames)==null?void 0:e[0];T++,et(),ht("error",o.detail?`${o.message}: ${o.detail}`:o.message,t?`${t.source}:${t.line}:${t.column}${t.fn?` (${t.fn})`:""}`:(s=o.nativeFrames)==null?void 0:s[0]),tt(!0)});u.addEventListener("app-ready",()=>{T=0,et()});const pt=document.getElementById("inspect-toggle"),ut=zt(u,document.getElementById("inspector"),pt);pt.addEventListener("click",()=>X("inspect",ut.open?"1":"0"));ut.setOpen(U("inspect")==="1");dt.addEventListener("click",()=>tt(lt.hidden));document.getElementById("console-clear").addEventListener("click",()=>{O.replaceChildren(),T=0,et()});tt(U("console")==="1");
|