@stacksjs/stx 0.2.662 → 0.2.664
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/{chunk-8n78w5kh.js → chunk-02e1s1k9.js} +1 -1
- package/dist/{chunk-4jyehvz3.js → chunk-08fpcex5.js} +2 -2
- package/dist/{chunk-e3crw545.js → chunk-0y05x1ef.js} +1 -1
- package/dist/{chunk-q5h1reph.js → chunk-1kn1at1y.js} +1 -1
- package/dist/{chunk-sknazxqf.js → chunk-1mf9658r.js} +1 -1
- package/dist/{chunk-1hny5z72.js → chunk-2jkq8n45.js} +1 -1
- package/dist/{chunk-pm76dy07.js → chunk-2kqdaehp.js} +1 -1
- package/dist/{chunk-zxbw2gr0.js → chunk-2xxmhmmj.js} +2 -2
- package/dist/{chunk-rxqv3p90.js → chunk-32rg1d9j.js} +2 -2
- package/dist/{chunk-h6633jna.js → chunk-39nvwdn6.js} +6 -6
- package/dist/{chunk-a3mmhzpa.js → chunk-3bpts69r.js} +1 -1
- package/dist/{chunk-3ay916gv.js → chunk-43m1rvh3.js} +1 -1
- package/dist/chunk-4q9g7893.js +2 -0
- package/dist/{chunk-vp9hse5k.js → chunk-5z1n02nd.js} +1 -1
- package/dist/{chunk-k6fyn9gk.js → chunk-6cd5jwvt.js} +1 -1
- package/dist/chunk-76j40sff.js +2 -0
- package/dist/{chunk-dw5bsya8.js → chunk-8hmds6dt.js} +1 -1
- package/dist/{chunk-h2a40417.js → chunk-8x8ndh72.js} +1 -1
- package/dist/{chunk-m7wb991z.js → chunk-aq3mpxrm.js} +1 -1
- package/dist/{chunk-adzrhca1.js → chunk-c3qd0dk8.js} +1 -1
- package/dist/{chunk-m2h91ccn.js → chunk-ckmgf9x1.js} +1 -1
- package/dist/{chunk-fr4hs814.js → chunk-djkjc1hj.js} +1 -1
- package/dist/chunk-ehy44811.js +2 -0
- package/dist/{chunk-pwjre3b2.js → chunk-etpjy429.js} +1 -1
- package/dist/{chunk-creeaceg.js → chunk-f0mrs38w.js} +1 -1
- package/dist/chunk-f4nrk8sv.js +2 -0
- package/dist/{chunk-61pvye5k.js → chunk-f85dmqn3.js} +1 -1
- package/dist/{chunk-v0byvxty.js → chunk-fnm6bb59.js} +1 -1
- package/dist/{chunk-d419kwfp.js → chunk-g4qz56km.js} +1 -1
- package/dist/{chunk-9jcxrc6t.js → chunk-g90jymnr.js} +1 -1
- package/dist/{chunk-51n5rfsk.js → chunk-gd14j4h8.js} +1 -1
- package/dist/{chunk-7m5sqtq5.js → chunk-gm026tmh.js} +1 -1
- package/dist/{chunk-zzk3a426.js → chunk-hj6fjqn8.js} +1 -1
- package/dist/{chunk-vzk09hvw.js → chunk-hm4fzr68.js} +1 -1
- package/dist/{chunk-mayr8s0x.js → chunk-m040f3x9.js} +1 -1
- package/dist/chunk-mhhg2sfa.js +2 -0
- package/dist/{chunk-ky5kmg7t.js → chunk-mmwg485j.js} +1 -1
- package/dist/{chunk-vsxws200.js → chunk-nz5t3kt9.js} +1 -1
- package/dist/chunk-p69f9sdh.js +2 -0
- package/dist/{chunk-j0dsavn2.js → chunk-paedp1tc.js} +1 -1
- package/dist/chunk-pazbwfkm.js +2 -0
- package/dist/{chunk-qvdx99py.js → chunk-pq5qr44q.js} +1 -1
- package/dist/{chunk-smyeg8cr.js → chunk-qdvv7h6r.js} +1 -1
- package/dist/{chunk-5m8j11b0.js → chunk-qfdy33jq.js} +1 -1
- package/dist/chunk-qhx8htx2.js +2 -0
- package/dist/{chunk-ftskxb7f.js → chunk-rcwqm2qq.js} +5 -5
- package/dist/{chunk-ptx6n9hd.js → chunk-rjekha6p.js} +1 -1
- package/dist/{chunk-4f4agvd0.js → chunk-scea207h.js} +9 -9
- package/dist/{chunk-r6kbpwzd.js → chunk-tgm4mnn4.js} +2 -2
- package/dist/{chunk-q341v4gv.js → chunk-tpyhs3rq.js} +6 -6
- package/dist/{chunk-n48cshgz.js → chunk-v6zdb66z.js} +4 -4
- package/dist/{chunk-xz261gkh.js → chunk-vmht7yf9.js} +1 -1
- package/dist/{chunk-m89yndgc.js → chunk-w0hby6q6.js} +1 -1
- package/dist/{chunk-d8kfbhhw.js → chunk-wtfjk49r.js} +1 -1
- package/dist/{chunk-4xdpeky6.js → chunk-xn51xrjd.js} +1 -1
- package/dist/chunk-xr3nknmb.js +2 -0
- package/dist/{chunk-adxt8qcy.js → chunk-y4crq495.js} +2 -2
- package/dist/{chunk-z248e3gj.js → chunk-yeb4yc8a.js} +1 -1
- package/dist/{chunk-vc2xzscw.js → chunk-yyfcg26x.js} +2 -2
- package/dist/{chunk-msvpb1ax.js → chunk-ze3p2wf6.js} +4 -4
- package/dist/{chunk-6dz6tpkp.js → chunk-zk537c7a.js} +1 -1
- package/dist/chunk-zv2v281j.js +2 -0
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/native/compiler/render-screen.js +9 -6
- package/dist/native/runtime/native-host.d.ts +1 -1
- package/dist/native/runtime/native-host.js +10 -2
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-4xfpq9yp.js +0 -2
- package/dist/chunk-6fbxh1we.js +0 -2
- package/dist/chunk-721ba72m.js +0 -2
- package/dist/chunk-ap1sydzw.js +0 -2
- package/dist/chunk-fdfnk654.js +0 -2
- package/dist/chunk-mxdm8sw0.js +0 -2
- package/dist/chunk-r1hg1yc4.js +0 -2
- package/dist/chunk-tr4hseng.js +0 -2
- package/dist/chunk-tywr9wc5.js +0 -2
- package/dist/chunk-vpa06pyx.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{E,t,a}from"./chunk-hb08vrbb.js";import{K}from"./chunk-
|
|
2
|
+
import{E,t,a}from"./chunk-hb08vrbb.js";import{K}from"./chunk-39nvwdn6.js";import{fo}from"./chunk-a3d0g4mr.js";import C from"path";var S;async function J(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var P={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function G(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function Y(e,s){if({...P,...s.i18n}.cache&&v[e]){let r=v[e],l=s.i18n?.cacheMaxAge??0;if(!G(r,l))return r.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let n=T(e,s).then((r)=>(k[e]="loaded",delete L[e],r)).catch((r)=>{throw k[e]="error",L[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return L[e]={promise:n,state:"loading"},n}async function T(e,s){let i={...P,...s.i18n},n=C.isAbsolute(i.translationsDir)?i.translationsDir:C.resolve(s.root||process.cwd(),i.translationsDir);try{let r=await J(),l=r?await r(e,{translationsDir:n,defaultLocale:i.defaultLocale,sources:te(i.format)}):await Z(e,i,n);if(l===void 0){let u=e!==i.defaultLocale?await T(i.defaultLocale,s):{};if(i.cache)v[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let c=l;if(i.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}catch(r){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==i.defaultLocale)return T(i.defaultLocale,s);return{}}}async function Z(e,s,i){let n=C.join(i,`${e}${Q(s.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let l=await Bun.file(n).text();if(s.format==="yaml"||s.format==="yml")return X(l);if(s.format==="json")return JSON.parse(l);throw r}catch{return}}}function Q(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function X(e){let s={},i=e.split(`
|
|
3
3
|
`),n=[{obj:s,indent:-1}];for(let r of i){let l=r.replace(/#.*$/,"").trimEnd();if(!l.trim())continue;let c=l.search(/\S/);if(c===-1)continue;while(n.length>1&&n[n.length-1].indent>=c)n.pop();let u=n[n.length-1].obj,o=l.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(o){let[,,g,p]=o,f=g.trim(),m=p.trim();if(m==="")u[f]={},n.push({obj:u[f],indent:c});else u[f]=ee(m)}}return s}function ee(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function te(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function re(e,s){return Y(e,s)}function ne(e,s){for(let i of e){let n=i.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let c=Number.parseInt(r[1],10);if(s===c)return r[2];continue}let l=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(l){let c=Number.parseInt(l[1],10),u=l[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(l[2],10);if(s>=c&&s<=u)return l[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ie(e,s={}){return j(e,s)}function j(e,s){let i="",n=0;while(n<e.length)if(e[n]==="{"){let r=se(e,n);if(r===-1){i+=e[n],n++;continue}let l=e.slice(n+1,r);i+=ae(l,s),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")i+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")i+=e[n+1],n+=2;else i+=e[n],n++;else i+=e[n],n++;return i}function se(e,s){let i=0;for(let n=s;n<e.length;n++)if(e[n]==="{")i++;else if(e[n]==="}"){if(i--,i===0)return n}return-1}function ae(e,s){let i=oe(e);if(i.length===0)return`{${e}}`;let n=i[0].trim(),r=s[n];if(i.length===1)return r!==void 0?String(r):`{${n}}`;switch(i[1].trim().toLowerCase()){case"plural":return le(r,i.slice(2).join(","),s);case"select":return ue(r,i.slice(2).join(","));case"selectordinal":return de(r,i.slice(2).join(","));case"number":return pe(r,i[2]?.trim());case"date":return fe(r,i[2]?.trim());case"time":return me(r,i[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function oe(e){let s=[],i="",n=0;for(let r=0;r<e.length;r++){let l=e[r];if(l==="{")n++,i+=l;else if(l==="}")n--,i+=l;else if(l===","&&n===0)s.push(i),i="";else i+=l}if(i)s.push(i);return s}function le(e,s,i){let n=Number(e)||0,r=I(s),l=`=${n}`;if(r[l])return R(r[l],n,i);let c=ce(n);if(r[c])return R(r[c],n,i);if(r.other)return R(r.other,n,i);return String(n)}function R(e,s,i){let n=e.replace(/#/g,String(s));return j(n,i)}function ce(e){let s=Math.abs(e),i=Math.floor(s),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&n===0)return"one";return"other"}function ue(e,s){let i=String(e||""),n=I(s);if(n[i])return n[i];return n.other||String(e)}function de(e,s){let i=Number(e)||0,n=I(s),r=ge(i);if(n[r])return n[r].replace(/#/g,String(i));if(n.other)return n.other.replace(/#/g,String(i));return String(i)}function ge(e){let s=Math.abs(e),i=s%10,n=s%100;if(i===1&&n!==11)return"one";if(i===2&&n!==12)return"two";if(i===3&&n!==13)return"few";return"other"}function I(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=i.exec(e);while(n!==null)s[n[1]]=n[2],n=i.exec(e);return s}function pe(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return i.toLocaleDateString(void 0,n)}function me(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return i.toLocaleTimeString(void 0,n)}function be(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,n={}){let r=e.split("."),l=s;for(let u of r){if(l===void 0||l===null)break;l=l[u]}if(l===void 0||l===null)return i?e:"";let c=String(l);if(be(c))return ie(c,n);if(c.includes("|")&&"count"in n){let u=Number(n.count),o=c.split("|");c=ne(o,u)}for(let[u,o]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");c=c.replace(new RegExp(`:${g}`,"g"),()=>String(o))}return c}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),he=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function q(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let n=s[1]?.length===4?s[1]:void 0;if(n)return he.has(n)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function fa(e,s,i,n){let r=e,l=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,c={...P,...n.i18n},u=await re(c.locale,n);s.__translations=u,s.__locale=c.locale,s.__i18nConfig=c,r=await F(r,l,async(p,f,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>E(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}let y=O(f,u,c.fallbackToKey,b);return y?K(r,h,y,!1,p.length):w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return a("Translate",`Error in @translate('${f}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let p=[...r.matchAll(o)];console.warn(`Found ${p.length} @translate matches`),p.forEach((f,m)=>console.warn(`Match ${m}: ${f[0]}, Key: ${f[1]}, Params: ${f[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(p,f,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>E(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return K(r,w,O(f,u,c.fallbackToKey,h),!1,p.length)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return a("Translate",`Error in @translate('${f}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,s,i){let n=[];return e.replace(s,(l,...c)=>{let u=i(l,...c).then((o)=>({match:l,replacement:o}));return n.push(u),l}),(await Promise.all(n)).reduce((l,{match:c,replacement:u})=>l.replace(c,()=>u),e)}function _(e,s){if(!e||q(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function U(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function ga(e,s,i,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,u,o)=>{let p={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${o||p} -->`});let l=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(l,(c,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(c,u,o)=>`<span id="${`desc-${u}`}" class="sr-only">${o}</span>`),r}function ye(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function xe(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,l,c)=>{let u=s.get(c);if(!u)u=`stx-a11y-component-${s.size}`,s.set(c,u);return`<${l}${u}`}),n=new Map([...s.entries()].map(([r,l])=>[l,r]));return{protectedSource:i,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(l,c,u)=>{let o=n.get(u);return o?`<${c}${o}`:l})}}function we(e,s){let i=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:r[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});r=n.exec(e)}let l=/<button([^>]*)>\s*<\/button>/gi;r=l.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:r[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});r=l.exec(e)}let c=/<a\s+([^>]*)>\s*<\/a>/gi;r=c.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"link-missing-text",element:r[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});r=c.exec(e)}let u=/<(input|select|textarea)\s+([^>]*)>/gi;r=u.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=u.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),M=r.index,N=e.substring(0,M),Se=e.substring(M),H=(N.match(/<label\b/gi)||[]).length,z=(N.match(/<\/label>/gi)||[]).length,W=H>z;if(!B&&!W)i.push({type:"input-missing-label",element:r[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}r=u.exec(e)}let o=/<h([1-6])[^>]*>/gi,g=[];r=o.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=o.exec(e);let p=0;for(let d of g){if(p>0&&d>p+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${p} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});p=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let f=e.match(/<html\b([^>]*)>/i);if(f&&_(U(f[1],"lang"),U(f[1],"dir")))i.push({type:"missing-dir",element:f[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(U(r[1],"role"))&&!/<th\b/i.test(d))i.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))i.push({type:"autoplay-audio",element:`<${r[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)i.push({type:"positive-tabindex",element:`tabindex="${r[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:r[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});r=y.exec(e)}return i}async function Ae(e,s){let{protectedSource:i}=xe(e);if(!ye())return we(i,s);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=i,r.querySelectorAll("img").forEach((o)=>{if(!o.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${o.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((o)=>{if(!(o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby")||o.textContent&&o.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${o.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),r.querySelectorAll("input, select, textarea").forEach((o)=>{let g=o.getAttribute("id"),p=g&&r.querySelector(`label[for="${g}"]`),f=o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"),m=o.closest("label")!==null;if(!p&&!f&&!m)n.push({type:"input-missing-label",element:`<${o.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let l=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),c=0;for(let o of l){let g=Number.parseInt(o.tagName.charAt(1));if(c>0&&g>c+1)n.push({type:"heading-skip",element:`<${o.outerHTML}>`,message:`Heading level skipped from h${c} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});c=g}let u=r.querySelector("html");if(i.includes("<html")&&u&&!u.hasAttribute("lang"))n.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(u&&_(u.getAttribute("lang"),u.getAttribute("dir")))n.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(r.querySelectorAll("a").forEach((o)=>{let g=o.textContent&&o.textContent.trim().length>0,p=o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"),f=o.hasAttribute("title"),m=o.querySelector("img[alt]");if(!g&&!p&&!f&&!m)n.push({type:"link-missing-text",element:`<${o.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),i.includes("<nav")||i.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(r.querySelectorAll("table").forEach((o)=>{if(V(o.getAttribute("role")))return;let g=o.querySelector("caption");if(!o.querySelector("th"))n.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!o.hasAttribute("aria-label")&&!o.hasAttribute("aria-labelledby"))n.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),r.querySelectorAll('[style*="color"]').forEach((o)=>{let g=o.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${o.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((o)=>{if(!o.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${o.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),r.querySelectorAll("[tabindex]").forEach((o)=>{if(Number.parseInt(o.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${o.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),r.querySelectorAll('[role="button"]').forEach((o)=>{if(!o.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${o.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),i.includes("<body")&&!r.querySelector('main, [role="main"]'))n.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});r.querySelectorAll("iframe").forEach((o)=>{if(!o.hasAttribute("title")&&!o.hasAttribute("aria-label"))n.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(r){console.error(`Error checking accessibility in ${s}:`,r)}return n}async function ma(e,s={}){let i={},{recursive:n=!0,ignorePaths:r=[]}=s,l=Array.isArray(e)?e:[e],c=await fo(l,{recursive:n,ignorePaths:r}),u=[];for(let o of c)try{let g=await Bun.file(o).text();if(o.endsWith("good-a11y.stx"))continue;let p=await Ae(g,o);if(u.push(o),p.length>0)i[o]=p}catch(g){console.error(`Error scanning ${o}:`,g)}return{results:i,scannedFiles:u}}var ha={name:"a11y",handler:(e,s,i,n)=>{if(!s.length)return e;let r=s[0].replace(/['"]/g,""),l=s.length>1?s[1].replace(/['"]/g,""):"",u={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[r]||"Make this element accessible";return`<!-- a11y-hint: ${l||u} -->${e}`},hasEndTag:!1},ya={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
|
|
4
4
|
export{fa,ga,ma,ha,ya};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ye,Io,Oo,Kl,Pt,Wa,No,qa,$p,Ie,dn,Oe}from"./chunk-
|
|
2
|
+
import{ye,Io,Oo,Kl,Pt,Wa,No,qa,$p,Ie,dn,Oe}from"./chunk-39nvwdn6.js";import{Za,i}from"./chunk-eqrkhc18.js";import"./chunk-yeb4yc8a.js";import"./chunk-2h8ea0we.js";import"./chunk-hb08vrbb.js";import"./chunk-ce6zddpf.js";import"./chunk-7rta163c.js";export{ye as BROWSER_CORE_IMPORTS,Kl as STX_AUTO_IMPORTS,Io as extractAndStripCssImports,Ie as extractBridgeData,Za as findInterpolationEnd,qa as generateAutoImportDestructuring,$p as generateBrowserAutoImportDestructuring,dn as generateServerDataBridge,Pt as injectBrowserCoreAutoImports,Oe as processClientScript,No as referencesName,Oo as renderVendorStyleTags,i as stripCommentsAndLiterals,Wa as transformAutoImports};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Bd,Fd}from"./chunk-pq5qr44q.js";import"./chunk-djkjc1hj.js";import"./chunk-g4qz56km.js";import"./chunk-v2x9vzgw.js";import"./chunk-tgm4mnn4.js";import"./chunk-v6zdb66z.js";import"./chunk-8nryyqb5.js";import"./chunk-y4crq495.js";import"./chunk-3bpts69r.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-t9mfztcs.js";import"./chunk-zaaeneq6.js";import"./chunk-39nvwdn6.js";import"./chunk-yeb4yc8a.js";import"./chunk-2h8ea0we.js";import"./chunk-hb08vrbb.js";import"./chunk-ce6zddpf.js";import"./chunk-7rta163c.js";export{Fd as clearStoreCache,Bd as getStoreScript};
|
|
@@ -923,7 +923,7 @@ NoDisplay=true`:""}
|
|
|
923
923
|
`;if(!q(i))st(i,{recursive:!0});lt(n,l,"utf-8")}else if(q(n))ct(n)}async function vo(e){return q(ut(e))}async function Po(e){let t=pt(e);if(!q(t))return!1;try{let r=bo(t,"utf-8");if(r.includes("X-GNOME-Autostart-enabled=false"))return!1;if(r.includes("Hidden=true"))return!1;return!0}catch{return!1}}function So(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function ko(e,t={}){let r=dt();switch(r){case"darwin":return xo(e,t);case"linux":return yo(e,t);default:throw Error(`Auto-launch is not yet supported on ${r}`)}}async function Ao(e){let t=e||"StxApp";switch(dt()){case"darwin":return vo(t);case"linux":return Po(t);default:return!1}}var R=new Map,Co=0,se=!1;function ft(e){let t=e.split("+").map((n)=>n.trim()),r={key:"",meta:!1,ctrl:!1,shift:!1,alt:!1};for(let n of t){let i=n.toLowerCase();switch(i){case"cmd":case"command":case"meta":case"\u2318":r.meta=!0;break;case"ctrl":case"control":case"\u2303":r.ctrl=!0;break;case"shift":case"\u21E7":r.shift=!0;break;case"alt":case"option":case"opt":case"\u2325":r.alt=!0;break;case"cmdorctrl":case"commandorcontrol":if(typeof process<"u"&&process.platform==="darwin")r.meta=!0;else r.ctrl=!0;break;default:r.key=i}}return r}function Io(e){let t=[];if(e.ctrl)t.push("\u2303");if(e.alt)t.push("\u2325");if(e.shift)t.push("\u21E7");if(e.meta)t.push("\u2318");return t.push(e.key.toUpperCase()),t.join("")}function $o(e,t){if(t.meta!==e.metaKey)return!1;if(t.ctrl!==e.ctrlKey)return!1;if(t.shift!==e.shiftKey)return!1;if(t.alt!==e.altKey)return!1;return e.key.toLowerCase()===t.key||e.code.toLowerCase()===`key${t.key}`}function mt(e){for(let[,t]of R)if($o(e,t.parsed)){e.preventDefault(),e.stopPropagation();try{t.handler()}catch{}break}}function To(){if(se)return;if(typeof document>"u")return;document.addEventListener("keydown",mt,!0),se=!0}function ke(){if(!se)return;if(typeof document>"u")return;document.removeEventListener("keydown",mt,!0),se=!1}async function Eo(e,t){if(typeof window>"u")return!1;let r=window.craft;if(!r?.hotkeys?.register)return!1;try{return await r.hotkeys.register(e,t),!0}catch{return!1}}async function Ae(e){if(typeof window>"u")return;let t=window.craft;if(!t?.hotkeys?.unregister)return;try{await t.hotkeys.unregister(e)}catch{}}function Mo(e,t){let r=`hotkey_${++Co}_${Date.now()}`,n=ft(e);R.set(r,{shortcut:e,handler:t,parsed:n}),Eo(r,e),To();let i={shortcut:e,id:r,unregister(){gt(i)}};return i}function gt(e){if(R.delete(e.id),Ae(e.id),R.size===0)ke()}function Do(){for(let[e]of R)Ae(e);R.clear(),ke()}function Bo(){return Array.from(R.entries()).map(([e,t])=>({shortcut:t.shortcut,id:e,unregister(){if(R.delete(e),Ae(e),R.size===0)ke()}}))}class ht{_duration;_tickInterval;_remaining;_running=!1;_paused=!1;_complete=!1;_intervalId=null;_lastTick=0;_completionHandlers=new Set;_tickHandlers=new Set;constructor(e){if(this._duration=e.duration,this._tickInterval=e.tickInterval||1000,this._remaining=e.duration,e.onComplete)this._completionHandlers.add(e.onComplete);if(e.onTick)this._tickHandlers.add(e.onTick);if(e.autoStart)this.start()}get isRunning(){return this._running&&!this._paused}get isPaused(){return this._paused}get isComplete(){return this._complete}get remaining(){if(this._running&&!this._paused){let e=Date.now()-this._lastTick;return Math.max(0,this._remaining-e)}return Math.max(0,this._remaining)}get elapsed(){return this._duration-this.remaining}get duration(){return this._duration}get progress(){if(this._duration===0)return 1;return Math.min(1,this.elapsed/this._duration)}start(){if(this._running)return;this._running=!0,this._paused=!1,this._complete=!1,this._lastTick=Date.now(),this._startInterval()}stop(){this._clearInterval(),this._running=!1,this._paused=!1,this._remaining=this._duration}pause(){if(!this._running||this._paused)return;let e=Date.now()-this._lastTick;this._remaining=Math.max(0,this._remaining-e),this._clearInterval(),this._paused=!0}resume(){if(!this._paused)return;this._paused=!1,this._lastTick=Date.now(),this._startInterval()}reset(){this._clearInterval(),this._running=!1,this._paused=!1,this._complete=!1,this._remaining=this._duration}onComplete(e){return this._completionHandlers.add(e),()=>{this._completionHandlers.delete(e)}}onTick(e){return this._tickHandlers.add(e),()=>{this._tickHandlers.delete(e)}}_startInterval(){this._clearInterval(),this._intervalId=setInterval(()=>{let e=Date.now(),t=e-this._lastTick;this._lastTick=e,this._remaining=Math.max(0,this._remaining-t);for(let r of this._tickHandlers)try{r(this._remaining)}catch{}if(this._remaining<=0){this._clearInterval(),this._running=!1,this._complete=!0;for(let r of this._completionHandlers)try{r()}catch{}}},this._tickInterval)}_clearInterval(){if(this._intervalId!==null)clearInterval(this._intervalId),this._intervalId=null}}class wt{_interval;_handler;_immediate;_running=!1;_intervalId=null;constructor(e){if(this._interval=e.interval,this._handler=e.handler,this._immediate=e.immediate!==!1,this._immediate)this.start()}get isRunning(){return this._running}start(){if(this._running)return;this._running=!0,this._intervalId=setInterval(()=>{try{this._handler()}catch{}},this._interval)}stop(){if(this._intervalId!==null)clearInterval(this._intervalId),this._intervalId=null;this._running=!1}}function Oo(e){return new ht(e)}function Ro(e){return new wt(e)}function Lo(e){return new Promise((t)=>setTimeout(t,e))}function _o(e){let t=Math.ceil(e/1000),r=Math.floor(t/3600),n=Math.floor(t%3600/60),i=t%60;if(r>0)return`${r}:${String(n).padStart(2,"0")}:${String(i).padStart(2,"0")}`;return`${n}:${String(i).padStart(2,"0")}`}function No(e){let t=Math.ceil(e/1000),r=Math.floor(t/3600),n=Math.floor(t%3600/60),i=t%60;if(r>0){if(n>0)return`${r}h ${n}m`;return`${r}h`}if(n>0){if(i>0)return`${n}m ${i}s`;return`${n}m`}return`${i}s`}function o(e){if(typeof window>"u")return!1;let t=window.craft;return!!(t&&t[e])}function v(e){if(!o(e))throw Error(`craft.${e} is not available \u2014 this API requires a Craft native window`);return window.craft[e]}function h(e,t){if(typeof window>"u")return()=>{};let r=(n)=>t(n.detail??{});return window.addEventListener(e,r),()=>window.removeEventListener(e,r)}var Fo={async writeText(e){if(o("clipboard")){await window.craft.clipboard.writeText(e);return}if(typeof navigator<"u"&&navigator.clipboard)await navigator.clipboard.writeText(e)},async readText(){if(o("clipboard")){let e=await window.craft.clipboard.readText();return typeof e==="string"?e:""}if(typeof navigator<"u"&&navigator.clipboard?.readText)try{return await navigator.clipboard.readText()}catch{return""}return""},async writeHTML(e){if(o("clipboard")){await window.craft.clipboard.writeHTML(e);return}if(typeof navigator<"u"&&navigator.clipboard?.write)try{let t=new window.ClipboardItem({"text/html":new Blob([e],{type:"text/html"}),"text/plain":new Blob([Wo(e)],{type:"text/plain"})});await navigator.clipboard.write([t])}catch{}},async readHTML(){if(o("clipboard")){let e=await window.craft.clipboard.readHTML();return typeof e==="string"?e:""}if(typeof navigator<"u"&&navigator.clipboard?.read)try{let e=await navigator.clipboard.read();for(let t of e)if(t.types.includes("text/html"))return await(await t.getType("text/html")).text()}catch{}return""},async clear(){if(o("clipboard")){await window.craft.clipboard.clear();return}if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{await navigator.clipboard.writeText("")}catch{}},async hasText(){if(o("clipboard"))return await window.craft.clipboard.hasText();return(await this.readText()).length>0},async hasHTML(){if(o("clipboard"))return await window.craft.clipboard.hasHTML();return(await this.readHTML()).length>0},async hasImage(){if(o("clipboard"))return await window.craft.clipboard.hasImage();return!1}};function Wo(e){return e.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/gi,"").replace(/<\/?(br|p|div|li|h[1-6])\b[^>]*>/gi,`
|
|
924
924
|
`).replace(/<[^>]+>/g,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/\n{3,}/g,`
|
|
925
925
|
|
|
926
|
-
`).trim()}var zo={async show(e){if(!e.title)throw Error("notification title is required");if(o("notifications")){await window.craft.notifications.show(e);return}if(typeof window<"u"&&"Notification"in window){let t=window.Notification;if(t.permission==="granted")new t(e.title,{body:e.body,icon:e.icon});else if(t.permission==="default"){if(await t.requestPermission()==="granted")new t(e.title,{body:e.body,icon:e.icon})}}},async schedule(e){if(o("notifications")){let n={...e};if(n.triggerAt instanceof Date)n.triggerAt=n.triggerAt.toISOString();await window.craft.notifications.schedule(n);return}let t=Ho(e.triggerAt),r=Math.max(0,t-Date.now());setTimeout(()=>{this.show(e).catch(()=>{})},r)},async cancel(e){if(o("notifications"))await window.craft.notifications.cancel(e)},async cancelAll(){if(o("notifications"))await window.craft.notifications.cancelAll()},async setBadge(e){let t=Math.max(0,Math.round(Number.isFinite(e)?e:0));if(o("notifications")){await window.craft.notifications.setBadge(t);return}if(typeof navigator<"u"&&navigator.setAppBadge)try{await navigator.setAppBadge(t)}catch{}},async clearBadge(){if(o("notifications")){await window.craft.notifications.clearBadge();return}if(typeof navigator<"u"&&navigator.clearAppBadge)try{await navigator.clearAppBadge()}catch{}},async requestPermission(){if(o("notifications"))return await window.craft.notifications.requestPermission();if(typeof window<"u"&&"Notification"in window){let e=window.Notification;if(e.permission==="granted")return!0;if(e.permission==="denied")return!1;return await e.requestPermission()==="granted"}return!1},async registerCategories(e){if(!Array.isArray(e)||e.length===0)return;if(o("notifications")){let t=window.craft.notifications.registerCategories;if(typeof t==="function")await t(e)}},onActionClicked(e){return h("craft:notification:actionClicked",e)},onReply(e){return h("craft:notification:reply",e)}};function Ho(e){if(e==null)return Date.now();if(e instanceof Date)return e.getTime();if(typeof e==="number")return e;let t=Date.parse(e);return Number.isNaN(t)?Date.now():t}var Uo={async readFile(e){let t=await v("fs").readFile(e);return t&&t.data||""},async readBuffer(e){let t=await v("fs").readFile(e),r=t&&t.data||"";if(t&&t.base64===!0)return Vo(r);return new TextEncoder().encode(r)},async writeFile(e,t){await v("fs").writeFile(e,t)},async writeBuffer(e,t){let r=qo(t),n=v("fs");if(typeof n.writeFileBytes==="function")await n.writeFileBytes(e,r);else await n.writeFile(e,r)},async copy(e,t){if(e===t)throw Error("fs.copy: source and destination must differ");await v("fs").copy(e,t)},async move(e,t){if(e===t)throw Error("fs.move: source and destination must differ");await v("fs").move(e,t)},async appendFile(e,t){await v("fs").appendFile(e,t)},async deleteFile(e){await v("fs").deleteFile(e)},async exists(e){return await v("fs").exists(e)},async stat(e){return jo(await v("fs").stat(e))},async readDir(e){let t=await v("fs").readDir(e),r=t&&t.entries||[],n=e.endsWith("/")?e.slice(0,-1):e;return r.map((i)=>({name:i.name,path:`${n}/${i.name}`,isDirectory:!!i.isDirectory}))},async mkdir(e,t){await v("fs").mkdir(e,t)},async rmdir(e,t){await v("fs").rmdir(e,t)},async watch(e,t){await v("fs").watch(e,t)},async unwatch(e){await v("fs").unwatch(e)},onChange(e){return h("craft:fs:change",e)},async watchTree(e,t,r){let n=`watch-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,i=v("fs");await i.watch(e,n,{recursive:!!t.recursive});let a=t.kinds&&t.kinds.length>0?new Set(t.kinds):null,s=Math.max(0,Math.floor(t.coalesceMs??0)),c=[],l=null,d=!1,f=()=>{if(l=null,c.length===0)return;let u=c;c=[];try{r(u)}catch{}},m=h("craft:fs:change",(u)=>{if(d)return;if(u.id!==n)return;if(a&&u.kind&&!a.has(u.kind))return;if(c.push(u),s===0){f();return}if(l==null)l=setTimeout(f,s)});return{id:n,async stop(){if(d)return;if(d=!0,m(),l)clearTimeout(l),l=null;if(c.length>0)f();try{await i.unwatch(n)}catch{}}}},async homeDir(){return await v("fs").homeDir()},async tempDir(){return await v("fs").tempDir()},async appDataDir(){return await v("fs").appDataDir()}};function qo(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return typeof btoa==="function"?btoa(t):Buffer.from(e).toString("base64")}function Vo(e){let t=typeof atob==="function"?atob(e):Buffer.from(e,"base64").toString("binary"),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function jo(e){return{isFile:!!e.isFile,isDirectory:!!e.isDirectory,isSymlink:!!e.isSymlink,size:Number(e.size)||0,modifiedAt:e.modifiedAt!=null?e.modifiedAt<1000000000000?e.modifiedAt*1000:e.modifiedAt:0}}var X=new Set,bt=!1;function Ko(){if(bt)return;if(typeof window>"u"||typeof window.addEventListener!=="function")return;window.addEventListener("craft:shell:exit",(e)=>{let t=e.detail;if(t?.id)X.delete(t.id)}),bt=!0}var Go=new Set(["javascript:","data:","file:","vbscript:"]),Yo={async openExternal(e){let t=e.trim().toLowerCase();for(let r of Go)if(t.startsWith(r))throw Error(`shell.openExternal: ${r} URLs are blocked for safety`);if(o("shell")){await window.craft.shell.openExternal(e);return}if(typeof window<"u"&&typeof window.open==="function")window.open(e,"_blank","noopener,noreferrer")},async openPath(e){await v("shell").openPath(e)},async showInFinder(e){await v("shell").showInFinder(e)},async spawn(e,t,r=[],n={}){if(Ko(),!e||typeof e!=="string")throw Error("shell.spawn: id must be a non-empty string");if(!t||typeof t!=="string")throw Error("shell.spawn: command must be a non-empty string");if(!Array.isArray(r))throw Error("shell.spawn: args must be an array");for(let i of r)if(typeof i!=="string")throw Error("shell.spawn: args entries must be strings");if(X.has(e))throw Error(`shell.spawn: id "${e}" is already in use \u2014 call kill(id) first or pick a different id`);X.add(e);try{await v("shell").spawn(e,t,r,n)}catch(i){throw X.delete(e),i}},async kill(e){await v("shell").kill(e),X.delete(e)},async getEnv(e){if(o("shell")){let t=await window.craft.shell.getEnv(e);return t==null?void 0:String(t)}return},async setEnv(e,t){await v("shell").setEnv(e,t)},onStdout(e){return h("craft:shell:stdout",e)},onStderr(e){return h("craft:shell:stderr",e)},onExit(e){return h("craft:shell:exit",e)}};function W(){return window.craft.shortcuts}var Xo={async register(e,t,r){if(!o("shortcuts"))return;await W().register(e,t,r)},async unregister(e){if(!o("shortcuts"))return;await W().unregister(e)},async unregisterAll(){if(!o("shortcuts"))return;await W().unregisterAll()},async enable(e){if(!o("shortcuts"))return;await W().enable(e)},async disable(e){if(!o("shortcuts"))return;await W().disable(e)},async isRegistered(e){if(!o("shortcuts"))return!1;return await W().isRegistered(e)},async list(){if(!o("shortcuts"))return[];return await W().list()},on(e){return h("craft:shortcut",e)}};var Jo={get(){if(o("theme"))try{return window.craft.theme.get()}catch{}return{appearance:Qo()}},onChange(e){if(e(this.get()),o("theme"))return h("craft:theme",e);if(typeof window<"u"&&window.matchMedia){let t=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>e({appearance:t.matches?"dark":"light"});return t.addEventListener("change",r),()=>t.removeEventListener("change",r)}return()=>{}},async current(){return this.get()}};function Qo(){if(typeof window>"u"||!window.matchMedia)return"light";return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}async function Zo(e,t={}){if(!o("dragOut"))throw Error("dragOut requires a Craft native window");let r=Array.isArray(e)?e:[e];if(r.length===0)throw Error("dragOut: at least one path required");await window.craft.dragOut.start(r,t)}function ei(){return o("dragOut")}var ti={onUrl(e){if(!o("deepLink"))return()=>{};return h("craft:deepLink",e)},getInitialUrl(){if(typeof window>"u")return null;if(o("deepLink"))try{return window.craft.deepLink.getInitialUrl()}catch{return null}return window.__craftPendingDeepLink||null},consumeInitialUrl(){let e=this.getInitialUrl();if(typeof window<"u")window.__craftPendingDeepLink=void 0;return e},isAvailable(){return o("deepLink")}};var ri={async isCharging(){if(o("power"))return await window.craft.power.isCharging();let e=await ce();return e?!!e.charging:!1},async isPluggedIn(){if(o("power"))return await window.craft.power.isPluggedIn();let e=await ce();return e?!!e.charging||e.level>=0.999:!1},async isLowPowerMode(){if(o("power"))return await window.craft.power.isLowPowerMode();return!1},async level(){if(o("power")){let t=await window.craft.power.batteryLevel();return typeof t==="number"?t:null}let e=await ce();return e?e.level:null},async timeRemaining(){if(o("power")){let r=await window.craft.power.timeRemaining();return typeof r==="number"?r:null}let e=await ce();if(!e)return null;let t=e.charging?e.chargingTime:e.dischargingTime;return Number.isFinite(t)?Math.round(t/60):null},async thermalState(){if(o("power"))return await window.craft.power.thermalState()||"unknown";return"unknown"},async uptimeSeconds(){if(o("power"))return await window.craft.power.uptimeSeconds();if(typeof performance<"u"&&typeof performance.now==="function")return Math.round(performance.now()/1000);return 0},async preventSleep(e="app is busy"){if(o("power")){await window.craft.power.preventSleep(e);return}if(typeof navigator>"u"||!navigator.wakeLock)return;let t=window;if(t.__craftWebWakeLock?.release){try{await t.__craftWebWakeLock.release()}catch{}t.__craftWebWakeLock=null}try{let r=await navigator.wakeLock.request("screen");t.__craftWebWakeLock=r}catch{}},async allowSleep(){if(o("power")){await window.craft.power.allowSleep();return}let e=window.__craftWebWakeLock;if(e&&typeof e.release==="function"){try{await e.release()}catch{}window.__craftWebWakeLock=null}},onSleep(e){return h("craft:powerSleep",e)},onWake(e){return h("craft:powerWake",e)}};async function ce(){if(typeof navigator>"u")return null;let e=navigator;if(typeof e.getBattery!=="function")return null;try{return await e.getBattery()}catch{return null}}var ni={async connectionType(){if(o("network"))return await window.craft.network.connectionType();return xt()},async wifiSSID(){if(o("network"))return await window.craft.network.wifiSSID()||void 0;return},async wifiSignalStrength(){if(o("network")){let e=await window.craft.network.wifiSignalStrength();return typeof e==="number"?e:void 0}return},async ipAddress(){if(o("network"))return await window.craft.network.ipAddress();return""},async macAddress(){if(o("network"))return await window.craft.network.macAddress();return""},async interfaces(){if(o("network"))return await window.craft.network.interfaces();return[]},async isVPNConnected(){if(o("network"))return await window.craft.network.isVPNConnected();return!1},async proxySettings(){if(o("network"))return await window.craft.network.proxySettings()||{};return{}},async openPreferences(){if(o("network"))await window.craft.network.openPreferences()},onChange(e){if(o("network"))return h("craft:networkChange",e);if(typeof window>"u")return()=>{};let t=()=>e({type:xt(),online:!0}),r=()=>e({type:"none",online:!1});return window.addEventListener("online",t),window.addEventListener("offline",r),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}};function xt(){if(typeof navigator>"u")return"unknown";if(navigator.onLine===!1)return"none";let e=navigator.connection;if(!e)return"unknown";let t=String(e.type||e.effectiveType||"unknown").toLowerCase();if(t==="wifi"||t==="cellular"||t==="ethernet"||t==="bluetooth"||t==="none")return t;return"unknown"}var oi={async checkForUpdates(){if(!o("updater"))return;await window.craft.updater.checkForUpdates()},async checkInBackground(){if(!o("updater"))return;await window.craft.updater.checkInBackground()},async setAutomaticChecks(e){if(!o("updater"))return;await window.craft.updater.setAutomaticChecks(e)},async setCheckInterval(e){if(!o("updater"))return;if(!Number.isFinite(e))throw Error("setCheckInterval: must be a finite number");let t=e<=0?0:Math.max(60,Math.round(e));await window.craft.updater.setCheckInterval(t)},async setFeedURL(e){if(!o("updater"))return;await window.craft.updater.setFeedURL(e)},async getLastUpdateCheckDate(){if(!o("updater"))return null;return await window.craft.updater.getLastUpdateCheckDate()||null},async getUpdateInfo(){if(!o("updater"))return null;let e=await window.craft.updater.getUpdateInfo();if(!e||typeof e.version!=="string"||e.version.length===0)return null;return e},onAvailable(e){return h("craft:updateAvailable",e)},onDownloaded(e){return h("craft:updateDownloaded",e)},async verifySignature({payload:e,signatureB64:t,publicKeyB64:r}){let n=yt(e),i;try{i=await crypto.subtle.importKey("raw",le(r),{name:"Ed25519"},!1,["verify"])}catch{return!1}try{return await crypto.subtle.verify("Ed25519",i,le(t),n)}catch{return!1}},async verifyDownload({url:e,signatureB64:t,publicKeyB64:r,fetchInit:n}){let i;try{i=await fetch(e,n)}catch{return{ok:!1,reason:"fetch-failed"}}if(!i.ok)return{ok:!1,reason:"http-error",status:i.status};let a=new Uint8Array(await i.arrayBuffer()),s;try{s=await crypto.subtle.importKey("raw",le(r),{name:"Ed25519"},!1,["verify"])}catch{return{ok:!1,reason:"bad-key"}}let c=!1;try{c=await crypto.subtle.verify("Ed25519",s,le(t),yt(a))}catch{c=!1}if(!c)return{ok:!1,reason:"bad-signature"};return{ok:!0,payload:a}}};function yt(e){if(e instanceof ArrayBuffer)return new Uint8Array(e);let t=new ArrayBuffer(e.byteLength),r=new Uint8Array(t);return r.set(e),r}function le(e){if(typeof atob==="function"){let n=atob(e),i=new ArrayBuffer(n.length),a=new Uint8Array(i);for(let s=0;s<n.length;s++)a[s]=n.charCodeAt(s);return a}let t=Buffer.from(e,"base64"),r=new ArrayBuffer(t.length);return new Uint8Array(r).set(t),new Uint8Array(r)}var ii={onFocus(e){if(o("window"))return h("craft:window:focus",()=>e());return Ce("focus",e)},onBlur(e){if(o("window"))return h("craft:window:blur",()=>e());return Ce("blur",e)},onResize(e){if(o("window"))return h("craft:window:resize",e);if(typeof window>"u")return()=>{};let t=()=>e({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},onMove(e){if(o("window"))return h("craft:window:move",e);return()=>{}},onClose(e){if(o("window"))return h("craft:window:close",()=>e());return Ce("beforeunload",e)},onMinimize(e){if(o("window"))return h("craft:window:minimize",()=>e());if(typeof document>"u")return()=>{};let t=()=>{if(document.visibilityState==="hidden")e()};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},onRestore(e){if(o("window"))return h("craft:window:restore",()=>e());if(typeof document>"u")return()=>{};let t=()=>{if(document.visibilityState==="visible")e()};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)}};function Ce(e,t){if(typeof window>"u")return()=>{};let r=()=>t();return window.addEventListener(e,r),()=>window.removeEventListener(e,r)}var vt={name:"",version:"0.0.0"},ai={async hideDockIcon(){if(o("app"))await window.craft.app.hideDockIcon()},async showDockIcon(){if(o("app"))await window.craft.app.showDockIcon()},async quit(){if(o("app"))await window.craft.app.quit()},async getInfo(){if(!o("app"))return vt;let e=await window.craft.app.getInfo();return{...vt,...e||{}}},async notify(e){if(!e.title)throw Error("notify: title is required");if(o("app"))await window.craft.app.notify(e)},async setBadge(e){if(o("app"))await window.craft.app.setBadge(e)},async bounce(e="informational"){if(o("app"))await window.craft.app.bounce(e)}};var si={app(e,t={}){return{label:e,items:[{label:`About ${e}`,role:"about"},{separator:!0},...t.settings?[{id:"stx.menu.settings",label:"Settings\u2026",shortcut:"cmd+,",onClick:t.settings},{separator:!0}]:[],{label:`Hide ${e}`,role:"hide",shortcut:"cmd+h"},{label:"Hide Others",role:"hideOthers",shortcut:"cmd+alt+h"},{label:"Show All",role:"showAll"},{separator:!0},{label:`Quit ${e}`,role:"quit",shortcut:"cmd+q"}]}},edit(){return{label:"Edit",items:[{label:"Undo",role:"undo",shortcut:"cmd+z"},{label:"Redo",role:"redo",shortcut:"cmd+shift+z"},{separator:!0},{label:"Cut",role:"cut",shortcut:"cmd+x"},{label:"Copy",role:"copy",shortcut:"cmd+c"},{label:"Paste",role:"paste",shortcut:"cmd+v"},{label:"Select All",role:"selectAll",shortcut:"cmd+a"}]}},window(){return{label:"Window",items:[{label:"Minimize",role:"minimize",shortcut:"cmd+m"},{label:"Zoom",role:"zoom"},{separator:!0},{label:"Close Window",role:"close",shortcut:"cmd+w"}]}},leading(e,t={}){return[this.app(e,t),this.edit()]}},ci=0;function li(e){let t=new Map;return{payload:{menus:e.menus.map((n)=>({label:n.label,items:n.items.map((i)=>{let{onClick:a,...s}=i;if(s.separator)return s;let c=s.id??`stx.menu.${ci++}`;if(a)t.set(c,a);return{...s,id:c}})}))},handlers:t}}var Ie=null,di={async set(e){if(!o("menu"))return!1;let{payload:t,handlers:r}=li(e);if(Ie?.(),Ie=null,r.size>0)Ie=h("craft:menu:action",(n)=>{r.get(n.id)?.()});return await window.craft.menu.set(t),!0},async setDock(e){if(o("menu"))await window.craft.menu.setDock(e)},async addItem(e,t){if(o("menu"))await window.craft.menu.addItem(e,t)},async removeItem(e){if(o("menu"))await window.craft.menu.removeItem(e)},async enableItem(e){if(o("menu"))await window.craft.menu.enableItem(e)},async disableItem(e){if(o("menu"))await window.craft.menu.disableItem(e)},async checkItem(e){if(o("menu"))await window.craft.menu.checkItem(e)},async uncheckItem(e){if(o("menu"))await window.craft.menu.uncheckItem(e)},async setItemLabel(e,t){if(o("menu"))await window.craft.menu.setItemLabel(e,t)},async clearDock(){if(o("menu"))await window.craft.menu.clearDock()},onAction(e){return h("craft:menu:action",e)}};function St(e){if(e.separator)return{id:e.id||"",title:"",type:"separator"};return{id:e.id||"",title:e.title||"",icon:e.icon,shortcut:e.shortcut,enabled:e.disabled?!1:void 0,checked:e.checked?!0:void 0,type:e.submenu?"submenu":void 0,submenu:e.submenu?.map(St)}}async function Pt(e){if(!e.items||e.items.length===0)throw Error("contextMenu.show requires at least one item");if(!o("nativeUI"))return null;let t=window.craft?.nativeUI;if(!t)return null;let r=await t.showContextMenu({targetId:e.targetId||"",targetType:"general",x:Math.round(e.x),y:Math.round(e.y),items:e.items.map(St)});return{id:typeof r?.id==="string"?r.id:null,targetId:r?.targetId}}var ui={available(){return o("nativeUI")},async show(e){return await Pt(e)!==null},async pick(e){return(await Pt(e))?.id??null},onAction(e){return h("craft:contextmenu:action",(t)=>{if(typeof t.id==="string")e({id:t.id,targetId:t.targetId??""})})}};function $e(e){if(e===null||e===void 0||e===0)return"";return String(e)}function kt(e){return e.map((t)=>({id:t.id,header:t.header,items:t.items.map((r)=>({id:r.id,label:r.label,icon:r.icon,badge:$e(r.badge)||void 0}))}))}function At(e){return JSON.stringify(e.map((t)=>[t.id,t.header??"",t.items.map((r)=>[r.id,r.label,r.icon??""])]))}function Ct(e){return new Map(e.flatMap((t)=>t.items.map((r)=>[r.id,$e(r.badge)])))}var It={available(){return o("nativeUI")&&typeof window.craft?.nativeUI?._emitSidebarSelect==="function"},create(e){if(!It.available())return null;let t=window.craft?.nativeUI;if(!t)return null;let r=t.createSidebar({id:e.id,sections:kt(e.sections),selected:e.selected}),n=e.sections,i=new Set;return r.onSelect((a)=>{for(let s of[...i])s(a)}),{id:r.id,update(a){if(At(a)===At(n)){let s=Ct(n);for(let[c,l]of Ct(a))if(s.get(c)!==l)r.updateItem(c,{badge:l})}else r.setSections(kt(a));n=a},updateItem(a,s){r.updateItem(a,{...s.label!==void 0?{label:s.label}:{},...s.icon!==void 0?{icon:s.icon}:{},..."badge"in s?{badge:$e(s.badge)}:{}}),n=n.map((c)=>({...c,items:c.items.map((l)=>l.id===a?{...l,...s}:l)}))},select(a){r.setSelectedItem(a)},onSelect(a){return i.add(a),()=>i.delete(a)},destroy(){i.clear(),r.destroy()}}}};var pi={accentColor:()=>E("system","accentColor",()=>""),highlightColor:()=>E("system","highlightColor",()=>""),language:()=>E("system","language",()=>{if(typeof navigator>"u")return"";return navigator.language?.split("-")[0]||""}),locale:()=>E("system","locale",()=>{if(typeof navigator>"u")return"";return navigator.language||""}),timezone:()=>E("system","timezone",()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{return""}}),is24HourTime:()=>E("system","is24HourTime",()=>{try{let e=new Intl.DateTimeFormat([],{hour:"numeric"}).resolvedOptions();return e.hourCycle==="h23"||e.hourCycle==="h24"}catch{return!1}}),reduceMotion:()=>E("system","reduceMotion",()=>Te("(prefers-reduced-motion: reduce)")),reduceTransparency:()=>E("system","reduceTransparency",()=>Te("(prefers-reduced-transparency: reduce)")),increaseContrast:()=>E("system","increaseContrast",()=>Te("(prefers-contrast: more)")),systemVersion:()=>E("system","systemVersion",()=>""),hostname:()=>E("system","hostname",()=>""),username:()=>E("system","username",()=>""),async openPreferences(){if(o("system"))await window.craft.system.openPreferences()}};async function E(e,t,r){if(o(e))return await window.craft[e][t]();return await r()}function Te(e){if(typeof window>"u"||!window.matchMedia)return!1;return window.matchMedia(e).matches}var fi={async getDisplays(){if(o("screen"))return await window.craft.screen.getDisplays();return $t()},async getPrimary(){if(o("screen")){let e=await window.craft.screen.getPrimary();return e&&typeof e.width==="number"?e:null}return $t()[0]??null},onChange(e){if(o("screen"))return h("craft:screen:change",()=>e());if(typeof window>"u")return()=>{};let t=()=>e();return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)}};function $t(){if(typeof window>"u"||!window.screen)return[];let e=window.screen;return[{id:0,x:e.left??0,y:e.top??0,width:e.width||0,height:e.height||0,workX:e.availLeft??0,workY:e.availTop??0,workWidth:e.availWidth??e.width??0,workHeight:e.availHeight??e.height??0,scaleFactor:window.devicePixelRatio||1}]}var mi={async set(e,t,r){if(!e)throw Error("keychain.set: service is required");if(!t)throw Error("keychain.set: account is required");await v("keychain").set(e,t,r)},async get(e,t){if(!e)throw Error("keychain.get: service is required");if(!t)throw Error("keychain.get: account is required");let r=await v("keychain").get(e,t);return typeof r==="string"?r:null},async delete(e,t){if(!e)throw Error("keychain.delete: service is required");if(!t)throw Error("keychain.delete: account is required");await v("keychain").delete(e,t)},async has(e,t){if(!e)throw Error("keychain.has: service is required");if(!t)throw Error("keychain.has: account is required");return await v("keychain").has(e,t)}};var gi={async check(e){if(o("permissions"))return await window.craft.permissions.check(e);return await Tt(e)},async request(e){if(o("permissions"))return await window.craft.permissions.request(e);return await hi(e)},async openSettings(e){if(o("permissions"))await window.craft.permissions.openSettings(e)}};async function Tt(e){if(typeof navigator>"u"||!navigator.permissions?.query)return"not-supported";try{let t=await navigator.permissions.query({name:e});return wi(t.state)}catch{return"not-supported"}}async function hi(e){if(e==="notifications"&&typeof window<"u"&&"Notification"in window){let t=await window.Notification.requestPermission();return t==="granted"?"granted":t==="denied"?"denied":"undetermined"}return await Tt(e)}function wi(e){if(e==="granted")return"granted";if(e==="denied")return"denied";if(e==="prompt")return"undetermined";return"undetermined"}var bi={async print(){if(o("printing")){await window.craft.printing.print();return}if(typeof window<"u"&&typeof window.print==="function")window.print()},async printToPDF(e){if(!e)throw Error("printToPDF: path is required");let t=e.startsWith("/"),r=/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith("\\\\");if(!t&&!r)throw Error("printToPDF: path must be absolute");let n=await v("printing").printToPDF(e);return{ok:!!(n&&n.ok),path:n?.path}}};var xi={async enable(){if(!o("autoLaunch"))return!1;return await window.craft.autoLaunch.enable()},async disable(){if(!o("autoLaunch"))return!1;return await window.craft.autoLaunch.disable()},async isEnabled(){if(!o("autoLaunch"))return!1;return await window.craft.autoLaunch.isEnabled()}};async function Ee(e){if(!o("tray"))return;let t=window.craft.tray;await e(t)}var yi={setIcon:(e)=>Ee((t)=>t.setIcon({icon:e})),setTitle:(e)=>Ee((t)=>t.setTitle({title:e})),setTooltip:(e)=>Ee((t)=>t.setTooltip({tooltip:e}))};function Me(){if(!o("window"))return null;return window.craft.window}function D(e){let t=Me();if(!t)return Promise.resolve();try{return Promise.resolve(e(t)).then(()=>{return},()=>{return})}catch{return Promise.resolve()}}var vi={get available(){return Me()!==null},open(e){let t=()=>{if(typeof window<"u"&&e.url)window.open(e.url,e.name);return{name:e.name}},r=Me();if(!r?.open)return Promise.resolve(t());return r.open(e).then((n)=>({name:n?.name||e.name})).catch(t)},close:()=>D((e)=>e.close?.()),show:()=>D((e)=>e.show?.()),hide:()=>D((e)=>e.hide?.()),focus:()=>D((e)=>e.focus?.()),minimize:()=>D((e)=>e.minimize?.()),maximize:()=>D((e)=>e.maximize?.()),center:()=>D((e)=>e.center?.()),startDrag:()=>D((e)=>e.startDrag?.()),setTitle:(e)=>D((t)=>t.setTitle?.(e)),setSize:(e,t)=>D((r)=>r.setSize?.(e,t)),setAppearance:(e)=>D((t)=>t.setAppearance?.(e))};var Pi={async addItem(e){if(o("touchbar"))await window.craft.touchbar.addItem(e)},async removeItem(e){if(o("touchbar"))await window.craft.touchbar.removeItem(e)},async updateItem(e,t){if(o("touchbar"))await window.craft.touchbar.updateItem(e,t)},async setLabel(e,t){if(o("touchbar"))await window.craft.touchbar.setLabel(e,t)},async setIcon(e,t){if(o("touchbar"))await window.craft.touchbar.setIcon(e,t)},async setEnabled(e,t){if(o("touchbar"))await window.craft.touchbar.setEnabled(e,t)},async setSliderValue(e,t){if(o("touchbar"))await window.craft.touchbar.setSliderValue(e,t)},async clear(){if(o("touchbar"))await window.craft.touchbar.clear()},async show(){if(o("touchbar"))await window.craft.touchbar.show()},async hide(){if(o("touchbar"))await window.craft.touchbar.hide()},onAction(e){return h("craft:touchbar:action",e)}};var Si=/^[\da-f]*$/i;function ki(e,t){if(typeof t!=="string"||!Si.test(t)||t.length%2!==0)throw Error(`${e}: must be a hex string with even length, got ${JSON.stringify(t)}`)}var Ai={async isEnabled(){return o("bluetooth")?await window.craft.bluetooth.isEnabled():!1},async powerState(){return o("bluetooth")?await window.craft.bluetooth.powerState():"unknown"},async connectedDevices(){return o("bluetooth")?await window.craft.bluetooth.connectedDevices():[]},async pairedDevices(){return o("bluetooth")?await window.craft.bluetooth.pairedDevices():[]},async startDiscovery(){if(o("bluetooth"))await window.craft.bluetooth.startDiscovery()},async stopDiscovery(){if(o("bluetooth"))await window.craft.bluetooth.stopDiscovery()},async isDiscovering(){return o("bluetooth")?await window.craft.bluetooth.isDiscovering():!1},async connect(e){if(o("bluetooth"))await window.craft.bluetooth.connect(e)},async disconnect(e){if(o("bluetooth"))await window.craft.bluetooth.disconnect(e)},async openPreferences(){if(o("bluetooth"))await window.craft.bluetooth.openPreferences()},async discoverServices(e){if(!e)throw Error("bluetooth.discoverServices: deviceId is required");if(!o("bluetooth"))return[];let t=await window.craft.bluetooth.discoverServices(e);return Array.isArray(t)?t:[]},async discoverCharacteristics(e,t){if(!e||!t)throw Error("bluetooth.discoverCharacteristics: deviceId and serviceUuid are required");if(!o("bluetooth"))return[];let r=await window.craft.bluetooth.discoverCharacteristics(e,t);return Array.isArray(r)?r:[]},async readCharacteristic(e,t,r){if(!e||!t||!r)throw Error("bluetooth.readCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if(!o("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.readCharacteristic(e,t,r)},async writeCharacteristic(e,t,r,n,i="with-response"){if(!e||!t||!r)throw Error("bluetooth.writeCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if(ki("bluetooth.writeCharacteristic.valueHex",n),!o("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.writeCharacteristic(e,t,r,n,i)},async setCharacteristicNotify(e,t,r,n){if(!e||!t||!r)throw Error("bluetooth.setCharacteristicNotify: deviceId, serviceUuid, characteristicUuid are required");if(!o("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.setCharacteristicNotify(e,t,r,n)},onDeviceFound(e){return h("craft:bluetooth:deviceFound",e)},onDeviceConnected(e){return h("craft:bluetooth:deviceConnected",e)},onDeviceDisconnected(e){return h("craft:bluetooth:deviceDisconnected",e)},onCharacteristicValue(e){return h("craft:bluetooth:characteristicValue",e)}};var Ci={async speak(e,t){if(!e)throw Error("speech.speak: text is required");if(o("speech")){await window.craft.speech.speak(e,t);return}if(typeof window<"u"&&window.speechSynthesis){let r=new window.SpeechSynthesisUtterance(e);if(t){if(t.rate!=null)r.rate=t.rate;if(t.pitch!=null)r.pitch=t.pitch;if(t.volume!=null)r.volume=t.volume;if(t.voice){let i=window.speechSynthesis.getVoices().find((a)=>a.voiceURI===t.voice||a.name===t.voice||a.lang===t.voice);if(i)r.voice=i}}window.speechSynthesis.speak(r)}},async stop(){if(o("speech")){await window.craft.speech.stop();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.cancel()},async pause(){if(o("speech")){await window.craft.speech.pause();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.pause()},async resume(){if(o("speech")){await window.craft.speech.resume();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.resume()},async isSpeaking(){if(o("speech"))return await window.craft.speech.isSpeaking();if(typeof window<"u"&&window.speechSynthesis)return!!window.speechSynthesis.speaking;return!1},async getVoices(){if(o("speech"))return await window.craft.speech.getVoices();if(typeof window<"u"&&window.speechSynthesis)return window.speechSynthesis.getVoices().map((t)=>({id:t.voiceURI||t.name,name:t.name,language:t.lang||"",quality:"default"}));return[]}};var J=[],De=!0,Be,Oe,Q={async report(e){if(o("crashReporter")){await window.craft.crashReporter.report(e);return}if(!De)return;let t=e instanceof Error?{timestamp:Date.now(),severity:"error",message:e.message,source:"js",stack:e.stack||"",userId:Be,appVersion:Oe}:{timestamp:Date.now(),severity:e.severity||"error",message:e.message||"",source:e.source||"js",stack:e.stack||"",userId:Be,appVersion:Oe};if(J.length>=64)J.shift();J.push(t)},async flush(){if(o("crashReporter"))return await window.craft.crashReporter.flush();return[...J]},async clear(){if(o("crashReporter")){await window.craft.crashReporter.clear();return}J.length=0},async setEnabled(e){if(o("crashReporter")){await window.craft.crashReporter.setEnabled(e);return}De=e},async isEnabled(){if(o("crashReporter"))return await window.craft.crashReporter.isEnabled();return De},async setUser(e){if(o("crashReporter")){await window.craft.crashReporter.setUser(e);return}Be=e||void 0},async setAppVersion(e){if(o("crashReporter")){await window.craft.crashReporter.setAppVersion(e);return}Oe=e||void 0},attachGlobalHandlers(){if(o("crashReporter")&&window.craft.crashReporter.attachGlobalHandlers)return window.craft.crashReporter.attachGlobalHandlers();if(typeof window>"u")return()=>{};let e=(r)=>{Q.report({severity:"error",message:r.message,source:"js",stack:r.error?.stack||`${r.message}
|
|
926
|
+
`).trim()}var zo={async show(e){if(!e.title)throw Error("notification title is required");if(o("notifications")){await window.craft.notifications.show(e);return}if(typeof window<"u"&&"Notification"in window){let t=window.Notification;if(t.permission==="granted")new t(e.title,{body:e.body,icon:e.icon});else if(t.permission==="default"){if(await t.requestPermission()==="granted")new t(e.title,{body:e.body,icon:e.icon})}}},async schedule(e){if(o("notifications")){let n={...e};if(n.triggerAt instanceof Date)n.triggerAt=n.triggerAt.toISOString();await window.craft.notifications.schedule(n);return}let t=Ho(e.triggerAt),r=Math.max(0,t-Date.now());setTimeout(()=>{this.show(e).catch(()=>{})},r)},async cancel(e){if(o("notifications"))await window.craft.notifications.cancel(e)},async cancelAll(){if(o("notifications"))await window.craft.notifications.cancelAll()},async setBadge(e){let t=Math.max(0,Math.round(Number.isFinite(e)?e:0));if(o("notifications")){await window.craft.notifications.setBadge(t);return}if(typeof navigator<"u"&&navigator.setAppBadge)try{await navigator.setAppBadge(t)}catch{}},async clearBadge(){if(o("notifications")){await window.craft.notifications.clearBadge();return}if(typeof navigator<"u"&&navigator.clearAppBadge)try{await navigator.clearAppBadge()}catch{}},async requestPermission(){if(o("notifications"))return await window.craft.notifications.requestPermission();if(typeof window<"u"&&"Notification"in window){let e=window.Notification;if(e.permission==="granted")return!0;if(e.permission==="denied")return!1;return await e.requestPermission()==="granted"}return!1},async registerCategories(e){if(!Array.isArray(e)||e.length===0)return;if(o("notifications")){let t=window.craft.notifications.registerCategories;if(typeof t==="function")await t(e)}},onActionClicked(e){return h("craft:notification:actionClicked",e)},onReply(e){return h("craft:notification:reply",e)}};function Ho(e){if(e==null)return Date.now();if(e instanceof Date)return e.getTime();if(typeof e==="number")return e;let t=Date.parse(e);return Number.isNaN(t)?Date.now():t}var Uo={async readFile(e){let t=await v("fs").readFile(e);return t&&t.data||""},async readBuffer(e){let t=await v("fs").readFile(e),r=t&&t.data||"";if(t&&t.base64===!0)return Vo(r);return new TextEncoder().encode(r)},async writeFile(e,t){await v("fs").writeFile(e,t)},async writeBuffer(e,t){let r=qo(t),n=v("fs");if(typeof n.writeFileBytes==="function")await n.writeFileBytes(e,r);else await n.writeFile(e,r)},async copy(e,t){if(e===t)throw Error("fs.copy: source and destination must differ");await v("fs").copy(e,t)},async move(e,t){if(e===t)throw Error("fs.move: source and destination must differ");await v("fs").move(e,t)},async appendFile(e,t){await v("fs").appendFile(e,t)},async deleteFile(e){await v("fs").deleteFile(e)},async exists(e){return await v("fs").exists(e)},async stat(e){return jo(await v("fs").stat(e))},async readDir(e){let t=await v("fs").readDir(e),r=t&&t.entries||[],n=e.endsWith("/")?e.slice(0,-1):e;return r.map((i)=>({name:i.name,path:`${n}/${i.name}`,isDirectory:!!i.isDirectory}))},async mkdir(e,t){await v("fs").mkdir(e,t)},async rmdir(e,t){await v("fs").rmdir(e,t)},async watch(e,t){await v("fs").watch(e,t)},async unwatch(e){await v("fs").unwatch(e)},onChange(e){return h("craft:fs:change",e)},async watchTree(e,t,r){let n=`watch-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,i=v("fs");await i.watch(e,n,{recursive:!!t.recursive});let a=t.kinds&&t.kinds.length>0?new Set(t.kinds):null,s=Math.max(0,Math.floor(t.coalesceMs??0)),c=[],l=null,d=!1,f=()=>{if(l=null,c.length===0)return;let u=c;c=[];try{r(u)}catch{}},m=h("craft:fs:change",(u)=>{if(d)return;if(u.id!==n)return;if(a&&u.kind&&!a.has(u.kind))return;if(c.push(u),s===0){f();return}if(l==null)l=setTimeout(f,s)});return{id:n,async stop(){if(d)return;if(d=!0,m(),l)clearTimeout(l),l=null;if(c.length>0)f();try{await i.unwatch(n)}catch{}}}},async homeDir(){return await v("fs").homeDir()},async tempDir(){return await v("fs").tempDir()},async appDataDir(){return await v("fs").appDataDir()}};function qo(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return typeof btoa==="function"?btoa(t):Buffer.from(e).toString("base64")}function Vo(e){let t=typeof atob==="function"?atob(e):Buffer.from(e,"base64").toString("binary"),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function jo(e){return{isFile:!!e.isFile,isDirectory:!!e.isDirectory,isSymlink:!!e.isSymlink,size:Number(e.size)||0,modifiedAt:e.modifiedAt!=null?e.modifiedAt<1000000000000?e.modifiedAt*1000:e.modifiedAt:0}}var X=new Set,bt=!1;function Ko(){if(bt)return;if(typeof window>"u"||typeof window.addEventListener!=="function")return;window.addEventListener("craft:shell:exit",(e)=>{let t=e.detail;if(t?.id)X.delete(t.id)}),bt=!0}var Go=new Set(["javascript:","data:","file:","vbscript:"]),Yo={async openExternal(e){let t=e.trim().toLowerCase();for(let r of Go)if(t.startsWith(r))throw Error(`shell.openExternal: ${r} URLs are blocked for safety`);if(o("shell")){await window.craft.shell.openExternal(e);return}if(typeof window<"u"&&typeof window.open==="function")window.open(e,"_blank","noopener,noreferrer")},async openPath(e){await v("shell").openPath(e)},async showInFinder(e){await v("shell").showInFinder(e)},async spawn(e,t,r=[],n={}){if(Ko(),!e||typeof e!=="string")throw Error("shell.spawn: id must be a non-empty string");if(!t||typeof t!=="string")throw Error("shell.spawn: command must be a non-empty string");if(!Array.isArray(r))throw Error("shell.spawn: args must be an array");for(let i of r)if(typeof i!=="string")throw Error("shell.spawn: args entries must be strings");if(X.has(e))throw Error(`shell.spawn: id "${e}" is already in use \u2014 call kill(id) first or pick a different id`);X.add(e);try{await v("shell").spawn(e,t,r,n)}catch(i){throw X.delete(e),i}},async kill(e){await v("shell").kill(e),X.delete(e)},async getEnv(e){if(o("shell")){let t=await window.craft.shell.getEnv(e);return t==null?void 0:String(t)}return},async setEnv(e,t){await v("shell").setEnv(e,t)},onStdout(e){return h("craft:shell:stdout",e)},onStderr(e){return h("craft:shell:stderr",e)},onExit(e){return h("craft:shell:exit",e)}};function W(){return window.craft.shortcuts}var Xo={async register(e,t,r){if(!o("shortcuts"))return;await W().register(e,t,r)},async unregister(e){if(!o("shortcuts"))return;await W().unregister(e)},async unregisterAll(){if(!o("shortcuts"))return;await W().unregisterAll()},async enable(e){if(!o("shortcuts"))return;await W().enable(e)},async disable(e){if(!o("shortcuts"))return;await W().disable(e)},async isRegistered(e){if(!o("shortcuts"))return!1;return await W().isRegistered(e)},async list(){if(!o("shortcuts"))return[];return await W().list()},on(e){return h("craft:shortcut",e)}};var Jo={get(){if(o("theme"))try{return window.craft.theme.get()}catch{}return{appearance:Qo()}},onChange(e){if(e(this.get()),o("theme"))return h("craft:theme",e);if(typeof window<"u"&&window.matchMedia){let t=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>e({appearance:t.matches?"dark":"light"});return t.addEventListener("change",r),()=>t.removeEventListener("change",r)}return()=>{}},async current(){return this.get()}};function Qo(){if(typeof window>"u"||!window.matchMedia)return"light";return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}async function Zo(e,t={}){if(!o("dragOut"))throw Error("dragOut requires a Craft native window");let r=Array.isArray(e)?e:[e];if(r.length===0)throw Error("dragOut: at least one path required");await window.craft.dragOut.start(r,t)}function ei(){return o("dragOut")}var ti={onUrl(e){if(!o("deepLink"))return()=>{};return h("craft:deepLink",e)},getInitialUrl(){if(typeof window>"u")return null;if(o("deepLink"))try{return window.craft.deepLink.getInitialUrl()}catch{return null}return window.__craftPendingDeepLink||null},consumeInitialUrl(){let e=this.getInitialUrl();if(typeof window<"u")window.__craftPendingDeepLink=void 0;return e},isAvailable(){return o("deepLink")}};var ri={async isCharging(){if(o("power"))return await window.craft.power.isCharging();let e=await ce();return e?!!e.charging:!1},async isPluggedIn(){if(o("power"))return await window.craft.power.isPluggedIn();let e=await ce();return e?!!e.charging||e.level>=0.999:!1},async isLowPowerMode(){if(o("power"))return await window.craft.power.isLowPowerMode();return!1},async level(){if(o("power")){let t=await window.craft.power.batteryLevel();return typeof t==="number"?t:null}let e=await ce();return e?e.level:null},async timeRemaining(){if(o("power")){let r=await window.craft.power.timeRemaining();return typeof r==="number"?r:null}let e=await ce();if(!e)return null;let t=e.charging?e.chargingTime:e.dischargingTime;return Number.isFinite(t)?Math.round(t/60):null},async thermalState(){if(o("power"))return await window.craft.power.thermalState()||"unknown";return"unknown"},async uptimeSeconds(){if(o("power"))return await window.craft.power.uptimeSeconds();if(typeof performance<"u"&&typeof performance.now==="function")return Math.round(performance.now()/1000);return 0},async preventSleep(e="app is busy"){if(o("power")){await window.craft.power.preventSleep(e);return}if(typeof navigator>"u"||!navigator.wakeLock)return;let t=window;if(t.__craftWebWakeLock?.release){try{await t.__craftWebWakeLock.release()}catch{}t.__craftWebWakeLock=null}try{let r=await navigator.wakeLock.request("screen");t.__craftWebWakeLock=r}catch{}},async allowSleep(){if(o("power")){await window.craft.power.allowSleep();return}let e=window.__craftWebWakeLock;if(e&&typeof e.release==="function"){try{await e.release()}catch{}window.__craftWebWakeLock=null}},onSleep(e){return h("craft:powerSleep",e)},onWake(e){return h("craft:powerWake",e)}};async function ce(){if(typeof navigator>"u")return null;let e=navigator;if(typeof e.getBattery!=="function")return null;try{return await e.getBattery()}catch{return null}}var ni={async connectionType(){if(o("network"))return await window.craft.network.connectionType();return xt()},async wifiSSID(){if(o("network"))return await window.craft.network.wifiSSID()||void 0;return},async wifiSignalStrength(){if(o("network")){let e=await window.craft.network.wifiSignalStrength();return typeof e==="number"?e:void 0}return},async ipAddress(){if(o("network"))return await window.craft.network.ipAddress();return""},async macAddress(){if(o("network"))return await window.craft.network.macAddress();return""},async interfaces(){if(o("network"))return await window.craft.network.interfaces();return[]},async isVPNConnected(){if(o("network"))return await window.craft.network.isVPNConnected();return!1},async proxySettings(){if(o("network"))return await window.craft.network.proxySettings()||{};return{}},async openPreferences(){if(o("network"))await window.craft.network.openPreferences()},onChange(e){if(o("network"))return h("craft:networkChange",e);if(typeof window>"u")return()=>{};let t=()=>e({type:xt(),online:!0}),r=()=>e({type:"none",online:!1});return window.addEventListener("online",t),window.addEventListener("offline",r),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}};function xt(){if(typeof navigator>"u")return"unknown";if(navigator.onLine===!1)return"none";let e=navigator.connection;if(!e)return"unknown";let t=String(e.type||e.effectiveType||"unknown").toLowerCase();if(t==="wifi"||t==="cellular"||t==="ethernet"||t==="bluetooth"||t==="none")return t;return"unknown"}var oi={async checkForUpdates(){if(!o("updater"))return;await window.craft.updater.checkForUpdates()},async checkInBackground(){if(!o("updater"))return;await window.craft.updater.checkInBackground()},async setAutomaticChecks(e){if(!o("updater"))return;await window.craft.updater.setAutomaticChecks(e)},async setCheckInterval(e){if(!o("updater"))return;if(!Number.isFinite(e))throw Error("setCheckInterval: must be a finite number");let t=e<=0?0:Math.max(60,Math.round(e));await window.craft.updater.setCheckInterval(t)},async setFeedURL(e){if(!o("updater"))return;await window.craft.updater.setFeedURL(e)},async getLastUpdateCheckDate(){if(!o("updater"))return null;return await window.craft.updater.getLastUpdateCheckDate()||null},async getUpdateInfo(){if(!o("updater"))return null;let e=await window.craft.updater.getUpdateInfo();if(!e||typeof e.version!=="string"||e.version.length===0)return null;return e},onAvailable(e){return h("craft:updateAvailable",e)},onDownloaded(e){return h("craft:updateDownloaded",e)},async verifySignature({payload:e,signatureB64:t,publicKeyB64:r}){let n=yt(e),i;try{i=await crypto.subtle.importKey("raw",le(r),{name:"Ed25519"},!1,["verify"])}catch{return!1}try{return await crypto.subtle.verify("Ed25519",i,le(t),n)}catch{return!1}},async verifyDownload({url:e,signatureB64:t,publicKeyB64:r,fetchInit:n}){let i;try{i=await fetch(e,n)}catch{return{ok:!1,reason:"fetch-failed"}}if(!i.ok)return{ok:!1,reason:"http-error",status:i.status};let a=new Uint8Array(await i.arrayBuffer()),s;try{s=await crypto.subtle.importKey("raw",le(r),{name:"Ed25519"},!1,["verify"])}catch{return{ok:!1,reason:"bad-key"}}let c=!1;try{c=await crypto.subtle.verify("Ed25519",s,le(t),yt(a))}catch{c=!1}if(!c)return{ok:!1,reason:"bad-signature"};return{ok:!0,payload:a}}};function yt(e){if(e instanceof ArrayBuffer)return new Uint8Array(e);let t=new ArrayBuffer(e.byteLength),r=new Uint8Array(t);return r.set(e),r}function le(e){if(typeof atob==="function"){let n=atob(e),i=new ArrayBuffer(n.length),a=new Uint8Array(i);for(let s=0;s<n.length;s++)a[s]=n.charCodeAt(s);return a}let t=Buffer.from(e,"base64"),r=new ArrayBuffer(t.length);return new Uint8Array(r).set(t),new Uint8Array(r)}var ii={onFocus(e){if(o("window"))return h("craft:window:focus",()=>e());return Ce("focus",e)},onBlur(e){if(o("window"))return h("craft:window:blur",()=>e());return Ce("blur",e)},onResize(e){if(o("window"))return h("craft:window:resize",e);if(typeof window>"u")return()=>{};let t=()=>e({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},onMove(e){if(o("window"))return h("craft:window:move",e);return()=>{}},onClose(e){if(o("window"))return h("craft:window:close",()=>e());return Ce("beforeunload",e)},onMinimize(e){if(o("window"))return h("craft:window:minimize",()=>e());if(typeof document>"u")return()=>{};let t=()=>{if(document.visibilityState==="hidden")e()};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},onRestore(e){if(o("window"))return h("craft:window:restore",()=>e());if(typeof document>"u")return()=>{};let t=()=>{if(document.visibilityState==="visible")e()};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)}};function Ce(e,t){if(typeof window>"u")return()=>{};let r=()=>t();return window.addEventListener(e,r),()=>window.removeEventListener(e,r)}var vt={name:"",version:"0.0.0"},ai={async hideDockIcon(){if(o("app"))await window.craft.app.hideDockIcon()},async showDockIcon(){if(o("app"))await window.craft.app.showDockIcon()},async quit(){if(o("app"))await window.craft.app.quit()},async getInfo(){if(!o("app"))return vt;let e=await window.craft.app.getInfo();return{...vt,...e||{}}},async notify(e){if(!e.title)throw Error("notify: title is required");if(o("app"))await window.craft.app.notify(e)},async setBadge(e){if(o("app"))await window.craft.app.setBadge(e)},async bounce(e="informational"){if(o("app"))await window.craft.app.bounce(e)}};var si={app(e,t={}){return{label:e,items:[{label:`About ${e}`,role:"about"},{separator:!0},...t.settings?[{id:"stx.menu.settings",label:"Settings\u2026",shortcut:"cmd+,",onClick:t.settings},{separator:!0}]:[],{label:`Hide ${e}`,role:"hide",shortcut:"cmd+h"},{label:"Hide Others",role:"hideOthers",shortcut:"cmd+alt+h"},{label:"Show All",role:"showAll"},{separator:!0},{label:`Quit ${e}`,role:"quit",shortcut:"cmd+q"}]}},edit(){return{label:"Edit",items:[{label:"Undo",role:"undo",shortcut:"cmd+z"},{label:"Redo",role:"redo",shortcut:"cmd+shift+z"},{separator:!0},{label:"Cut",role:"cut",shortcut:"cmd+x"},{label:"Copy",role:"copy",shortcut:"cmd+c"},{label:"Paste",role:"paste",shortcut:"cmd+v"},{label:"Select All",role:"selectAll",shortcut:"cmd+a"}]}},window(){return{label:"Window",items:[{label:"Minimize",role:"minimize",shortcut:"cmd+m"},{label:"Zoom",role:"zoom"},{separator:!0},{label:"Close Window",role:"close",shortcut:"cmd+w"}]}},leading(e,t={}){return[this.app(e,t),this.edit()]}},ci=0;function li(e){let t=new Map;return{payload:{menus:e.menus.map((n)=>({label:n.label,items:n.items.map((i)=>{let{onClick:a,...s}=i;if(s.separator)return s;let c=s.id??`stx.menu.${ci++}`;if(a)t.set(c,a);return{...s,id:c}})}))},handlers:t}}var Ie=null,di={async set(e){if(!o("menu"))return!1;let{payload:t,handlers:r}=li(e);if(Ie?.(),Ie=null,r.size>0)Ie=h("craft:menu:action",(n)=>{r.get(n.id)?.()});return await window.craft.menu.set(t),!0},async setDock(e){if(o("menu"))await window.craft.menu.setDock(e)},async addItem(e,t){if(o("menu"))await window.craft.menu.addItem(e,t)},async removeItem(e){if(o("menu"))await window.craft.menu.removeItem(e)},async enableItem(e){if(o("menu"))await window.craft.menu.enableItem(e)},async disableItem(e){if(o("menu"))await window.craft.menu.disableItem(e)},async checkItem(e){if(o("menu"))await window.craft.menu.checkItem(e)},async uncheckItem(e){if(o("menu"))await window.craft.menu.uncheckItem(e)},async setItemLabel(e,t){if(o("menu"))await window.craft.menu.setItemLabel(e,t)},async clearDock(){if(o("menu"))await window.craft.menu.clearDock()},onAction(e){return h("craft:menu:action",e)}};function St(e){if(e.separator)return{id:e.id||"",title:"",type:"separator"};return{id:e.id||"",title:e.title||"",icon:e.icon,shortcut:e.shortcut,enabled:e.disabled?!1:void 0,checked:e.checked?!0:void 0,type:e.submenu?"submenu":void 0,submenu:e.submenu?.map(St)}}async function Pt(e){if(!e.items||e.items.length===0)throw Error("contextMenu.show requires at least one item");if(!o("nativeUI"))return null;let t=window.craft?.nativeUI;if(!t)return null;let r=await t.showContextMenu({targetId:e.targetId||"",targetType:"general",x:Math.round(e.x),y:Math.round(e.y),items:e.items.map(St)});return{id:typeof r?.id==="string"?r.id:null,targetId:r?.targetId}}var ui={available(){return o("nativeUI")},async show(e){return await Pt(e)!==null},async pick(e){return(await Pt(e))?.id??null},onAction(e){return h("craft:contextmenu:action",(t)=>{if(typeof t.id==="string")e({id:t.id,targetId:t.targetId??""})})}};function $e(e){if(e===null||e===void 0||e===0)return"";return String(e)}function kt(e){return e.map((t)=>({id:t.id,header:t.header,items:t.items.map((r)=>({id:r.id,label:r.label,icon:r.icon,badge:$e(r.badge)||void 0}))}))}function At(e){return JSON.stringify(e.map((t)=>[t.id,t.header??"",t.items.map((r)=>[r.id,r.label,r.icon??""])]))}function Ct(e){return new Map(e.flatMap((t)=>t.items.map((r)=>[r.id,$e(r.badge)])))}var It={available(){return o("nativeUI")&&typeof window.craft?.nativeUI?._emitSidebarSelect==="function"},create(e){if(!It.available())return null;let t=window.craft?.nativeUI;if(!t)return null;let r=t.createSidebar({id:e.id,sections:kt(e.sections),selected:e.selected}),n=e.sections,i=new Set;return r.onSelect((a)=>{for(let s of[...i])s(a)}),{id:r.id,update(a){if(At(a)===At(n)){let s=Ct(n);for(let[c,l]of Ct(a))if(s.get(c)!==l)r.updateItem(c,{badge:l})}else r.setSections(kt(a));n=a},updateItem(a,s){r.updateItem(a,{...s.label!==void 0?{label:s.label}:{},...s.icon!==void 0?{icon:s.icon}:{},..."badge"in s?{badge:$e(s.badge)}:{}}),n=n.map((c)=>({...c,items:c.items.map((l)=>l.id===a?{...l,...s}:l)}))},select(a){r.setSelectedItem(a)},onSelect(a){return i.add(a),()=>i.delete(a)},destroy(){i.clear(),r.destroy()}}}};var pi={accentColor:()=>E("system","accentColor",()=>""),highlightColor:()=>E("system","highlightColor",()=>""),language:()=>E("system","language",()=>{if(typeof navigator>"u")return"";return navigator.language?.split("-")[0]||""}),locale:()=>E("system","locale",()=>{if(typeof navigator>"u")return"";return navigator.language||""}),timezone:()=>E("system","timezone",()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{return""}}),is24HourTime:()=>E("system","is24HourTime",()=>{try{let e=new Intl.DateTimeFormat([],{hour:"numeric"}).resolvedOptions();return e.hourCycle==="h23"||e.hourCycle==="h24"}catch{return!1}}),reduceMotion:()=>E("system","reduceMotion",()=>Te("(prefers-reduced-motion: reduce)")),reduceTransparency:()=>E("system","reduceTransparency",()=>Te("(prefers-reduced-transparency: reduce)")),increaseContrast:()=>E("system","increaseContrast",()=>Te("(prefers-contrast: more)")),systemVersion:()=>E("system","systemVersion",()=>""),hostname:()=>E("system","hostname",()=>""),username:()=>E("system","username",()=>""),async openPreferences(){if(o("system"))await window.craft.system.openPreferences()}};async function E(e,t,r){if(o(e))return await window.craft[e][t]();return await r()}function Te(e){if(typeof window>"u"||!window.matchMedia)return!1;return window.matchMedia(e).matches}var fi={async getDisplays(){if(o("screen"))return await window.craft.screen.getDisplays();return $t()},async getPrimary(){if(o("screen")){let e=await window.craft.screen.getPrimary();return e&&typeof e.width==="number"?e:null}return $t()[0]??null},onChange(e){if(o("screen"))return h("craft:screen:change",()=>e());if(typeof window>"u")return()=>{};let t=()=>e();return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)}};function $t(){if(typeof window>"u"||!window.screen)return[];let e=window.screen;return[{id:0,x:e.left??0,y:e.top??0,width:e.width||0,height:e.height||0,workX:e.availLeft??0,workY:e.availTop??0,workWidth:e.availWidth??e.width??0,workHeight:e.availHeight??e.height??0,scaleFactor:window.devicePixelRatio||1}]}var mi={async set(e,t,r){if(!e)throw Error("keychain.set: service is required");if(!t)throw Error("keychain.set: account is required");await v("keychain").set(e,t,r)},async get(e,t){if(!e)throw Error("keychain.get: service is required");if(!t)throw Error("keychain.get: account is required");let r=await v("keychain").get(e,t);return typeof r==="string"?r:null},async delete(e,t){if(!e)throw Error("keychain.delete: service is required");if(!t)throw Error("keychain.delete: account is required");await v("keychain").delete(e,t)},async has(e,t){if(!e)throw Error("keychain.has: service is required");if(!t)throw Error("keychain.has: account is required");return await v("keychain").has(e,t)}};var gi={async check(e){if(o("permissions"))return await window.craft.permissions.check(e);return await Tt(e)},async request(e){if(o("permissions"))return await window.craft.permissions.request(e);return await hi(e)},async openSettings(e){if(o("permissions"))await window.craft.permissions.openSettings(e)}};async function Tt(e){if(typeof navigator>"u"||!navigator.permissions?.query)return"not-supported";try{let t=await navigator.permissions.query({name:e});return wi(t.state)}catch{return"not-supported"}}async function hi(e){if(e==="notifications"&&typeof window<"u"&&"Notification"in window){let t=await window.Notification.requestPermission();return t==="granted"?"granted":t==="denied"?"denied":"undetermined"}return await Tt(e)}function wi(e){if(e==="granted")return"granted";if(e==="denied")return"denied";if(e==="prompt")return"undetermined";return"undetermined"}var bi={async print(){if(o("printing")){await window.craft.printing.print();return}if(typeof window<"u"&&typeof window.print==="function")window.print()},async printToPDF(e){if(!e)throw Error("printToPDF: path is required");let t=e.startsWith("/"),r=/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith("\\\\");if(!t&&!r)throw Error("printToPDF: path must be absolute");let n=await v("printing").printToPDF(e);return{ok:!!(n&&n.ok),path:n?.path}}};var xi={async enable(){if(!o("autoLaunch"))return!1;return await window.craft.autoLaunch.enable()},async disable(){if(!o("autoLaunch"))return!1;return await window.craft.autoLaunch.disable()},async isEnabled(){if(!o("autoLaunch"))return!1;return await window.craft.autoLaunch.isEnabled()}};async function Ee(e){if(!o("tray"))return;let t=window.craft.tray;await e(t)}var yi={setIcon:(e)=>Ee((t)=>t.setIcon(e)),setTitle:(e)=>Ee((t)=>t.setTitle(e)),setTooltip:(e)=>Ee((t)=>t.setTooltip(e))};function Me(){if(!o("window"))return null;return window.craft.window}function D(e){let t=Me();if(!t)return Promise.resolve();try{return Promise.resolve(e(t)).then(()=>{return},()=>{return})}catch{return Promise.resolve()}}var vi={get available(){return Me()!==null},open(e){let t=()=>{if(typeof window<"u"&&e.url)window.open(e.url,e.name);return{name:e.name}},r=Me();if(!r?.open)return Promise.resolve(t());return r.open(e).then((n)=>({name:n?.name||e.name})).catch(t)},close:()=>D((e)=>e.close?.()),show:()=>D((e)=>e.show?.()),hide:()=>D((e)=>e.hide?.()),focus:()=>D((e)=>e.focus?.()),minimize:()=>D((e)=>e.minimize?.()),maximize:()=>D((e)=>e.maximize?.()),center:()=>D((e)=>e.center?.()),startDrag:()=>D((e)=>e.startDrag?.()),setTitle:(e)=>D((t)=>t.setTitle?.(e)),setSize:(e,t)=>D((r)=>r.setSize?.(e,t)),setAppearance:(e)=>D((t)=>t.setAppearance?.(e))};var Pi={async addItem(e){if(o("touchbar"))await window.craft.touchbar.addItem(e)},async removeItem(e){if(o("touchbar"))await window.craft.touchbar.removeItem(e)},async updateItem(e,t){if(o("touchbar"))await window.craft.touchbar.updateItem(e,t)},async setLabel(e,t){if(o("touchbar"))await window.craft.touchbar.setLabel(e,t)},async setIcon(e,t){if(o("touchbar"))await window.craft.touchbar.setIcon(e,t)},async setEnabled(e,t){if(o("touchbar"))await window.craft.touchbar.setEnabled(e,t)},async setSliderValue(e,t){if(o("touchbar"))await window.craft.touchbar.setSliderValue(e,t)},async clear(){if(o("touchbar"))await window.craft.touchbar.clear()},async show(){if(o("touchbar"))await window.craft.touchbar.show()},async hide(){if(o("touchbar"))await window.craft.touchbar.hide()},onAction(e){return h("craft:touchbar:action",e)}};var Si=/^[\da-f]*$/i;function ki(e,t){if(typeof t!=="string"||!Si.test(t)||t.length%2!==0)throw Error(`${e}: must be a hex string with even length, got ${JSON.stringify(t)}`)}var Ai={async isEnabled(){return o("bluetooth")?await window.craft.bluetooth.isEnabled():!1},async powerState(){return o("bluetooth")?await window.craft.bluetooth.powerState():"unknown"},async connectedDevices(){return o("bluetooth")?await window.craft.bluetooth.connectedDevices():[]},async pairedDevices(){return o("bluetooth")?await window.craft.bluetooth.pairedDevices():[]},async startDiscovery(){if(o("bluetooth"))await window.craft.bluetooth.startDiscovery()},async stopDiscovery(){if(o("bluetooth"))await window.craft.bluetooth.stopDiscovery()},async isDiscovering(){return o("bluetooth")?await window.craft.bluetooth.isDiscovering():!1},async connect(e){if(o("bluetooth"))await window.craft.bluetooth.connect(e)},async disconnect(e){if(o("bluetooth"))await window.craft.bluetooth.disconnect(e)},async openPreferences(){if(o("bluetooth"))await window.craft.bluetooth.openPreferences()},async discoverServices(e){if(!e)throw Error("bluetooth.discoverServices: deviceId is required");if(!o("bluetooth"))return[];let t=await window.craft.bluetooth.discoverServices(e);return Array.isArray(t)?t:[]},async discoverCharacteristics(e,t){if(!e||!t)throw Error("bluetooth.discoverCharacteristics: deviceId and serviceUuid are required");if(!o("bluetooth"))return[];let r=await window.craft.bluetooth.discoverCharacteristics(e,t);return Array.isArray(r)?r:[]},async readCharacteristic(e,t,r){if(!e||!t||!r)throw Error("bluetooth.readCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if(!o("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.readCharacteristic(e,t,r)},async writeCharacteristic(e,t,r,n,i="with-response"){if(!e||!t||!r)throw Error("bluetooth.writeCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if(ki("bluetooth.writeCharacteristic.valueHex",n),!o("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.writeCharacteristic(e,t,r,n,i)},async setCharacteristicNotify(e,t,r,n){if(!e||!t||!r)throw Error("bluetooth.setCharacteristicNotify: deviceId, serviceUuid, characteristicUuid are required");if(!o("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.setCharacteristicNotify(e,t,r,n)},onDeviceFound(e){return h("craft:bluetooth:deviceFound",e)},onDeviceConnected(e){return h("craft:bluetooth:deviceConnected",e)},onDeviceDisconnected(e){return h("craft:bluetooth:deviceDisconnected",e)},onCharacteristicValue(e){return h("craft:bluetooth:characteristicValue",e)}};var Ci={async speak(e,t){if(!e)throw Error("speech.speak: text is required");if(o("speech")){await window.craft.speech.speak(e,t);return}if(typeof window<"u"&&window.speechSynthesis){let r=new window.SpeechSynthesisUtterance(e);if(t){if(t.rate!=null)r.rate=t.rate;if(t.pitch!=null)r.pitch=t.pitch;if(t.volume!=null)r.volume=t.volume;if(t.voice){let i=window.speechSynthesis.getVoices().find((a)=>a.voiceURI===t.voice||a.name===t.voice||a.lang===t.voice);if(i)r.voice=i}}window.speechSynthesis.speak(r)}},async stop(){if(o("speech")){await window.craft.speech.stop();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.cancel()},async pause(){if(o("speech")){await window.craft.speech.pause();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.pause()},async resume(){if(o("speech")){await window.craft.speech.resume();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.resume()},async isSpeaking(){if(o("speech"))return await window.craft.speech.isSpeaking();if(typeof window<"u"&&window.speechSynthesis)return!!window.speechSynthesis.speaking;return!1},async getVoices(){if(o("speech"))return await window.craft.speech.getVoices();if(typeof window<"u"&&window.speechSynthesis)return window.speechSynthesis.getVoices().map((t)=>({id:t.voiceURI||t.name,name:t.name,language:t.lang||"",quality:"default"}));return[]}};var J=[],De=!0,Be,Oe,Q={async report(e){if(o("crashReporter")){await window.craft.crashReporter.report(e);return}if(!De)return;let t=e instanceof Error?{timestamp:Date.now(),severity:"error",message:e.message,source:"js",stack:e.stack||"",userId:Be,appVersion:Oe}:{timestamp:Date.now(),severity:e.severity||"error",message:e.message||"",source:e.source||"js",stack:e.stack||"",userId:Be,appVersion:Oe};if(J.length>=64)J.shift();J.push(t)},async flush(){if(o("crashReporter"))return await window.craft.crashReporter.flush();return[...J]},async clear(){if(o("crashReporter")){await window.craft.crashReporter.clear();return}J.length=0},async setEnabled(e){if(o("crashReporter")){await window.craft.crashReporter.setEnabled(e);return}De=e},async isEnabled(){if(o("crashReporter"))return await window.craft.crashReporter.isEnabled();return De},async setUser(e){if(o("crashReporter")){await window.craft.crashReporter.setUser(e);return}Be=e||void 0},async setAppVersion(e){if(o("crashReporter")){await window.craft.crashReporter.setAppVersion(e);return}Oe=e||void 0},attachGlobalHandlers(){if(o("crashReporter")&&window.craft.crashReporter.attachGlobalHandlers)return window.craft.crashReporter.attachGlobalHandlers();if(typeof window>"u")return()=>{};let e=(r)=>{Q.report({severity:"error",message:r.message,source:"js",stack:r.error?.stack||`${r.message}
|
|
927
927
|
at ${r.filename}:${r.lineno}:${r.colno}`}).catch(()=>{})},t=(r)=>{let n=r.reason;Q.report({severity:"error",message:n?.message||String(n),source:"js",stack:n?.stack||""}).catch(()=>{})};return window.addEventListener("error",e),window.addEventListener("unhandledrejection",t),()=>{window.removeEventListener("error",e),window.removeEventListener("unhandledrejection",t)}},forwardTo(e){return Di(e)}},Ii="craft:crashReporter:pending",$i=/[\w.+-]+@[\w-]+\.[\w.-]+/g,Ti=/\b(?:\d{1,3}\.){3}\d{1,3}\b/g,Ei=/\/(?:Users|home)\/[^\s/'"`]+/g;function Mt(e){let t=(r)=>r.replace($i,"<email>").replace(Ti,"<ip>").replace(Ei,"/<home>");return{...e,message:t(e.message),stack:t(e.stack)}}async function Dt(e,t){let r=new TextEncoder,n=await crypto.subtle.importKey("raw",r.encode(e),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),i=await crypto.subtle.sign("HMAC",n,r.encode(t));return[...new Uint8Array(i)].map((a)=>a.toString(16).padStart(2,"0")).join("")}function Mi(e){if(!e||typeof localStorage>"u")return[];try{let t=localStorage.getItem(e);if(!t)return[];let r=JSON.parse(t);return Array.isArray(r)?r:[]}catch{return[]}}function Et(e,t){if(!e||typeof localStorage>"u")return;try{if(t.length===0)localStorage.removeItem(e);else localStorage.setItem(e,JSON.stringify(t))}catch{}}function Di(e){let{endpoint:t,intervalMs:r=60000,signingSecret:n,redact:i=!0,headers:a={},maxRetries:s=5,persistKey:c}=e,l=c===null?null:c??Ii,d=Mi(l),f=!1,m=null,u=null,w=typeof i==="function"?i:i===!1?(k)=>k:Mt;async function b(k){let A=JSON.stringify({entries:k}),B={"Content-Type":"application/json",...a};if(n)B["X-Craft-Signature"]=await Dt(n,A);let ee=0,O=1000;while(!f)try{let z=await fetch(t,{method:"POST",headers:B,body:A});if(z.ok)return;if(z.status>=400&&z.status<500)return;throw Error(`HTTP ${z.status}`)}catch(z){if(ee+=1,ee>s)throw d=[...k,...d],Et(l,d),z;await new Promise((Ft)=>{setTimeout(Ft,O)}),O=Math.min(O*2,60000)}}async function S(){if(f||u)return u??void 0;let k=await Q.flush();if(k.length>0)await Q.clear();if(d=[...d,...k.map((B)=>w(B))],d.length===0)return;let A=d;return d=[],Et(l,d),u=b(A).catch(()=>{}).finally(()=>{u=null}),u}if(r>0)m=setInterval(()=>{S().catch(()=>{})},r);return{async flushNow(){await S()},stop(){if(f=!0,m)clearInterval(m);m=null},pending(){return[...d]}}}var Bi={async isAvailable(){if(!o("iap"))return!1;return await window.craft.iap.isAvailable()},async getProducts(e){if(!o("iap"))return[];let t=Array.isArray(e)?e:[String(e)];return await window.craft.iap.getProducts(t)},async purchase(e){if(!o("iap"))return{queued:!1,productId:e,reason:"IAP bridge not available"};let t=await window.craft.iap.purchase(e);return{queued:!!(t&&t.queued),productId:t?.productId,reason:t?.reason}},async restorePurchases(){if(!o("iap"))return{ok:!1};let e=await window.craft.iap.restorePurchases();return{ok:!!(e&&e.ok)}},async finishTransaction(e){if(!o("iap"))return;await window.craft.iap.finishTransaction(e)},async getReceiptData(){if(!o("iap"))return null;let e=await window.craft.iap.getReceiptData();return e?String(e):null},onPurchased(e){return h("craft:iap:purchased",e)},onFailed(e){return h("craft:iap:failed",e)},onRestored(e){return h("craft:iap:restored",e)},onProductsLoaded(e){return h("craft:iap:productsLoaded",(t)=>e(t.products||[]))},onRefunded(e){return h("craft:iap:refunded",e)},onSubscriptionStatusChanged(e){return h("craft:iap:subscriptionStatusChanged",e)},async getActiveSubscriptions(){if(!o("iap"))return[];let e=window.craft.iap.getActiveSubscriptions;if(typeof e!=="function")return[];let t=await e();return Array.isArray(t)?t:[]},async isEligibleForIntroOffer(e){if(!o("iap"))return!1;let t=window.craft.iap.isEligibleForIntroOffer;if(typeof t!=="function")return!1;return!!await t(e)}};var Z={async startActivity(e,t){if(!e)throw Error("handoff.startActivity: type is required");if(!o("handoff"))return!1;let r=await window.craft.handoff.startActivity(e,t);return typeof r==="boolean"?r:!!(r&&r.ok)},async updateActivity(e){if(!o("handoff"))return!1;let t=await window.craft.handoff.updateActivity(e);return typeof t==="boolean"?t:!!(t&&t.ok)},async stopActivity(){if(!o("handoff"))return;await window.craft.handoff.stopActivity()},async getCurrentActivity(){if(!o("handoff"))return null;let e=await window.craft.handoff.getCurrentActivity();return e&&typeof e.type==="string"?e:null},onIncoming(e){return h("craft:handoff:incoming",e)}};var Oi={async start(e,t){return Z.startActivity(e,{title:t?.title,webpageURL:t?.webpageURL,userInfo:t?.state})},async update(e){return Z.updateActivity({title:e.title,webpageURL:e.webpageURL,userInfo:e.state})},async stop(){await Z.stopActivity()}};var Ri={async requestPermission(e="whenInUse"){if(o("location"))return await window.craft.location.requestPermission(e);if(typeof navigator<"u"&&navigator.geolocation)return"undetermined";return"not-supported"},async getAuthorization(){if(o("location"))return await window.craft.location.getAuthorization();return"unknown"},async getCurrentLocation(){if(o("location"))return await window.craft.location.getCurrentLocation();if(typeof navigator<"u"&&navigator.geolocation)return navigator.geolocation.getCurrentPosition((e)=>{window.dispatchEvent(new CustomEvent("craft:location:update",{detail:{latitude:e.coords.latitude,longitude:e.coords.longitude,altitude:e.coords.altitude,horizontalAccuracy:e.coords.accuracy,verticalAccuracy:e.coords.altitudeAccuracy,speed:e.coords.speed}}))},(e)=>{window.dispatchEvent(new CustomEvent("craft:location:error",{detail:{message:e.message||String(e)}}))}),{requested:!0};return{requested:!1}},async startWatching(e){if(o("location"))return await window.craft.location.startWatching(e);if(typeof navigator<"u"&&navigator.geolocation){let t=navigator.geolocation.watchPosition((r)=>{window.dispatchEvent(new CustomEvent("craft:location:update",{detail:{latitude:r.coords.latitude,longitude:r.coords.longitude,altitude:r.coords.altitude,horizontalAccuracy:r.coords.accuracy,verticalAccuracy:r.coords.altitudeAccuracy,speed:r.coords.speed}}))});return window.__craftWebLocationWatchId=t,!0}return!1},async stopWatching(){if(o("location")){await window.craft.location.stopWatching();return}if(typeof navigator<"u"&&navigator.geolocation){let e=window.__craftWebLocationWatchId;if(e!=null)navigator.geolocation.clearWatch(e),window.__craftWebLocationWatchId=null}},onUpdate(e){return h("craft:location:update",e)},onError(e){return h("craft:location:error",e)},onAuthChanged(e){return h("craft:location:authChanged",e)}};var Li={async captureScreen(){if(!o("screenCapture"))return null;let e=await window.craft.screenCapture.captureScreen();return e?String(e):null},async captureWindow(e){if(!o("screenCapture"))return null;if(!Number.isFinite(e)||e<=0)throw Error("captureWindow: id must be a positive number");let t=await window.craft.screenCapture.captureWindow(e);return t?String(t):null},async listWindows(){if(!o("screenCapture"))return[];return await window.craft.screenCapture.listWindows()}};var Ot=250,Rt=60000,ue=2000,Bt={sharing:!1,signals:{systemScreenShare:!1,remoteSession:!1,conferenceSharing:!1,screenRecording:!1},sources:[]};function _i(){return{...Bt,signals:{...Bt.signals},sources:[]}}var de={async getState(){if(!o("screenSharing"))return _i();return await window.craft.screenSharing.getState()},async watch(e=ue){let t=Number.isFinite(e)?Math.min(Rt,Math.max(Ot,Math.round(e))):ue;if(!o("screenSharing"))return t;let r=await window.craft.screenSharing.watch(t);return r&&r.intervalMs||t},async stop(){if(!o("screenSharing"))return;await window.craft.screenSharing.unwatch()},onChange(e){return h("craft:screenSharing:change",e)}};async function Ni(e,t=ue){let r=de.onChange(e);try{await de.watch(t)}catch(i){throw r(),i}let n;return()=>{if(!n)r(),n=de.stop();return n}}var Fi={supported:!1,isFocused:null,authorization:"unsupported"};function Lt(){return{ok:!1,error:"Focus control is only available in a Craft window on macOS"}}var Re={async getStatus(){if(!o("focus"))return{...Fi};return await window.craft.focus.getStatus()},async requestAuthorization(){if(!o("focus"))return"unsupported";return await window.craft.focus.requestAuthorization()},async setEnabled(e,t={}){if(!o("focus"))return Lt();if(!(e?t.onShortcut:t.offShortcut))return{ok:!1,error:`focus.setEnabled: no ${e?"onShortcut":"offShortcut"} configured`};return await window.craft.focus.setEnabled(e,t)},async runShortcut(e){if(!o("focus"))return Lt();if(!e)throw Error("focus.runShortcut: name is required");return await window.craft.focus.runShortcut(e)},async listShortcuts(){if(!o("focus"))return[];return await window.craft.focus.listShortcuts()},async listShortcutsResult(){if(!o("focus"))return{canList:!1,shortcuts:[]};let t=await window.craft.focus.listShortcutsResult?.();return{canList:Boolean(t?.canList),shortcuts:t?.shortcuts??[]}}};async function Wi(...e){if(e.length===0)return!1;let t=new Set(await Re.listShortcuts());return e.every((r)=>t.has(r))}async function zi(...e){if(e.length===0)return!1;let{canList:t,shortcuts:r}=await Re.listShortcutsResult();if(!t)return"unknown";let n=new Set(r);return e.every((i)=>n.has(i))}var Hi={async start(e=0,t="127.0.0.1"){if(!o("localServer"))return{port:0,started:!1,reason:"bridge unavailable"};return await window.craft.localServer.start(e,t)},async stop(){if(!o("localServer"))return;await window.craft.localServer.stop()},async respond(e){if(!o("localServer"))return;await window.craft.localServer.respond(e||{status:200,body:"OK"})},onRequest(e){return h("craft:localServer:request",e)},async awaitOAuthCallback(e={}){v("localServer");let{port:t=0,host:r="127.0.0.1",timeoutMs:n=300000,successHTML:i}=e,a=await this.start(t,r);if(!a.started)throw Error(`localServer: start failed${a.reason?` \u2014 ${a.reason}`:""}`);return new Promise((s,c)=>{let l=setTimeout(()=>{d(),this.stop().catch(()=>{}),c(Error("localServer: OAuth callback timed out"))},n),d=this.onRequest(({url:f})=>{clearTimeout(l),d();let m=i??`<!doctype html><meta charset="utf-8"><title>Done</title>
|
|
928
928
|
<style>body{font-family:-apple-system,BlinkMacSystemFont,sans-serif;display:flex;align-items:center;justify-content:center;height:100vh;margin:0;background:#f5f5f7}</style>
|
|
929
929
|
<div><h1>You can close this tab.</h1><p>Returning to the app\u2026</p></div>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Lc,Ju,jc,Bc,Yu,Zu}from"./chunk-
|
|
2
|
+
import{Lc,Ju,jc,Bc,Yu,Zu}from"./chunk-c3qd0dk8.js";import"./chunk-39nvwdn6.js";import"./chunk-yeb4yc8a.js";import"./chunk-2h8ea0we.js";import"./chunk-hb08vrbb.js";import"./chunk-ce6zddpf.js";import"./chunk-7rta163c.js";export{Zu as applySlots,Yu as extractSlotContent,Ju as parseSlotElement,Lc as parseSlots,Bc as processSlots,jc as renderSlot};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Tu}from"./chunk-fnm6bb59.js";import"./chunk-rcwqm2qq.js";import"./chunk-yyfcg26x.js";import"./chunk-prf164ct.js";import"./chunk-etpjy429.js";import"./chunk-ze3p2wf6.js";import"./chunk-hm4fzr68.js";import"./chunk-r7kmsq3n.js";import"./chunk-tgm4mnn4.js";import"./chunk-v6zdb66z.js";import"./chunk-8nryyqb5.js";import"./chunk-1kn1at1y.js";import"./chunk-y4crq495.js";import"./chunk-3bpts69r.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-t9mfztcs.js";import"./chunk-zaaeneq6.js";import"./chunk-39nvwdn6.js";import"./chunk-yeb4yc8a.js";import"./chunk-2h8ea0we.js";import"./chunk-hb08vrbb.js";import"./chunk-ce6zddpf.js";import"./chunk-7rta163c.js";export{Tu as startInteractive};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{f,g,m}from"./chunk-
|
|
2
|
+
import{f,g,m}from"./chunk-39nvwdn6.js";import{N}from"./chunk-y4crq495.js";import{s}from"./chunk-rcwqm2qq.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let r=n[1],i=n[2];t.push({type:"suspense",name:r,content:i}),o=n.index+n[0].length}if(o<e.length){let r=e.slice(o);if(r.trim())t.push({type:t.length===0?"shell":"content",content:r})}if(t.length===0)t.push({type:"shell",content:e});return t}async function rd(e,t={},o={}){let n={...N,...o,streaming:{...q,...o.streaming}},r=n.streaming?.bufferSize||16384;return new ReadableStream({async start(i){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),p=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),h={...t,__filename:e,__dirname:k.dirname(e)};if(p.trim())await f(p,h,e);let E=H(c),l=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let u=await s(c,h,e,n,l);for(let b=0;b<u.length;b+=r)i.enqueue(u.slice(b,b+r)),await new Promise((y)=>setTimeout(y,0))}else{let u=[],b=new RegExp(T.source,"g"),y;while((y=b.exec(c))!==null)u.push({name:y[1],content:y[2],start:y.index,end:y.index+y[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await s(I,h,e,n,l);i.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await s(_.content,h,e,n,l);i.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await s(_,h,e,n,l);i.enqueue(C)}}}}else{let w=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await s(d.content,h,e,n,l);i.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;i.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
|
|
3
3
|
<template data-suspense-fallback>Loading...</template>
|
|
4
4
|
</div>`),w.set(d.name,s(d.content,h,e,n,l))}i.enqueue(`
|
|
5
5
|
<script>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Qs,eo,to,dp,jr,pp}from"./chunk-
|
|
2
|
+
import{Qs,eo,to,dp,jr,pp}from"./chunk-hm4fzr68.js";export{jr as clearImageDeliveryCatalog,dp as deliveredImage,to as efficientDeliverySources,Qs as getImageDelivery,eo as isTransparentImage,pp as prepareImageDelivery};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ll,ul,_e,dl,Qi,Gt,Kt,rp,ea,Xt,Fn,pl,fl,gl,qs,Jt,ml,Yt,hl}from"./chunk-
|
|
2
|
+
import{ll,ul,_e,dl,Qi,Gt,Kt,rp,ea,Xt,Fn,pl,fl,gl,qs,Jt,ml,Yt,hl}from"./chunk-djkjc1hj.js";import"./chunk-g4qz56km.js";import"./chunk-v2x9vzgw.js";import"./chunk-y4crq495.js";import"./chunk-3bpts69r.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-t9mfztcs.js";import"./chunk-zaaeneq6.js";import"./chunk-39nvwdn6.js";import"./chunk-yeb4yc8a.js";import"./chunk-2h8ea0we.js";import"./chunk-hb08vrbb.js";import"./chunk-ce6zddpf.js";import"./chunk-7rta163c.js";export{Fn as MODULE_SPECIFIER_PREFIX,ll as bundleCacheDir,ul as bundleCacheEntryLimit,Yt as bundleClientScript,Kt as clearBundleFailures,_e as clientBundleDependencies,Gt as getBundleFailures,Xt as hasUserImports,Jt as moduleSubstitutionKey,fl as normalizeRegistrySpecifiers,ml as queueClientBundleBuild,Qi as recordBundleFailure,pl as registryIdForPath,ea as resolveBundlerFallback,gl as rewriteRegistryImports,rp as setBundlerFallbackMode,dl as shouldLogBundlerDiagnostics,hl as tempBuildName,qs as withModuleSubstitutes};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{d,u}from"./chunk-hb08vrbb.js";import{ue,m}from"./chunk-
|
|
2
|
+
import{d,u}from"./chunk-hb08vrbb.js";import{ue,m}from"./chunk-39nvwdn6.js";function A(t,o){let i=1,r=o,n="<template",e="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(n,r)&&(r+n.length>=t.length||/[\s>\/]/.test(t[r+n.length]))){i++,r+=n.length;continue}if(t.startsWith(e,r)){let a=t.indexOf(">",r+e.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var x=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function b(t,o){let i=null;for(let r=o;r<t.length;r++){let n=t[r];if(i){if(n==="\\"){r++;continue}if(n===i)i=null;continue}if(n==='"'||n==="'"){i=n;continue}if(n===">")return r+1}return-1}function N(t,o,i){let r=o.toLowerCase(),n=1,e=i;while(e<t.length){let s=t.indexOf("<",e);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);e=g===-1?t.length:g+3;continue}let a=b(t,s+1);if(a===-1)return-1;let f=t.slice(s,a),c=f.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(c&&c[2].toLowerCase()===r){if(c[1]==="/"){if(n--,n===0)return a}else if(!/\/\s*>$/.test(f))n++}e=a}return-1}function R(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,n=0;while(n<t.length){let e=t.indexOf("<",n);if(e===-1)break;if(t.startsWith("<!--",e)){let l=t.indexOf("-->",e+4);n=l===-1?t.length:l+3;continue}let s=b(t,e+1);if(s===-1)break;let a=t.slice(e,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){n=s;continue}let c=f[2].toLowerCase();if(f[1]==="/"){let l=i.lastIndexOf(c);if(l!==-1)i.splice(l);n=s;continue}let g=/\/\s*>$/.test(a),h=i.length===0?a.match(r):null;if(h){let l=h[1]||h[2],p=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),S=g||x.has(c)?-1:N(t,c,s);if(S===-1)o.push({start:e,end:s,slotName:l,element:p}),n=s;else o.push({start:e,end:S,slotName:l,element:p+t.slice(s,S)}),n=S;continue}if(!g&&!x.has(c)){if(i.push(c),c==="script"||c==="style"){let l=t.toLowerCase().indexOf(`</${c}>`,s);if(l!==-1){n=l;continue}}}n=s}return o}function O(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,n=0;while(n<t.length){let e=t.indexOf("<",n);if(e===-1)break;if(t.startsWith("<!--",e)){let l=t.indexOf("-->",e+4);n=l===-1?t.length:l+3;continue}let s=b(t,e+1);if(s===-1)break;let a=t.slice(e,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){n=s;continue}let c=f[1]==="/",g=f[2].toLowerCase();if(c){let l=i.lastIndexOf(g);if(l!==-1)i.splice(l);n=s;continue}if(g==="template"&&i.length===0){let l=a.match(r);if(l){let p=A(t,s);if(p!==-1){let S=l[1]||l[2]||l[3];o.push({start:e,end:p,slotName:S,content:t.slice(s,p-11).trim(),propsBinding:l[4]||void 0}),n=p;continue}}}if(!/\/\s*>$/.test(a)&&!x.has(g)){if(i.push(g),g==="script"||g==="style"){let l=t.toLowerCase().indexOf(`</${g}>`,s);if(l!==-1){n=l;continue}}}n=s}return o}function Lc(t){let o={default:"",named:new Map},i=t,r=O(t);for(let e of r)o.named.set(e.slotName,{name:e.slotName,content:e.content,propsBinding:e.propsBinding});r.sort((e,s)=>s.start-e.start);for(let e of r)i=i.slice(0,e.start)+i.slice(e.end);let n=R(i);for(let e of n){let s=o.named.get(e.slotName);if(s)s.content+=e.element;else o.named.set(e.slotName,{name:e.slotName,content:e.element})}for(let e=n.length-1;e>=0;e--){let s=n[e];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function Ju(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},n=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,e;while((e=n.exec(t))!==null)r[e[1]]=e[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function jc(t,o,i,r){if(!t)return i;let n=t.content;if(t.propsBinding&&Object.keys(o).length>0){let e=t.propsBinding.trim(),s={...r},a=new Set,f=new Set;if(e.startsWith("{")&&e.endsWith("}")){let c=e.slice(1,-1).split(",").map((g)=>g.trim()).filter(Boolean);for(let g of c){let[h,l]=g.split(":").map((S)=>S.trim()),p=l||h;if(s[p]=o[h],o[h]!==void 0)f.add(p);else a.add(p)}}else if(s[e]=o,Object.values(o).some((c)=>c===void 0))a.add(e);else f.add(e);n=C(n,s,a,f)}return n}function C(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(n,e)=>{try{let s=e.trim();if(ue(s,i))return n;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!ue(s,r))return n;let a=k(s,o);if(a===void 0)return n;return m(String(a??""))}catch{return`{{ ${e} }}`}})}function k(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),n=o;for(let e of r)if(n&&typeof n==="object"&&e in n)n=n[e];else return;return n}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,n,e]=i,s=o[r],a=parseInt(e,10);if(typeof s==="number")switch(n){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!d(t))return;return u(t,Object.keys(o))(...Object.values(o))}catch{return}}async function Bc(t,o,i){let r=t;r=await M(r,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(s,a,f,c)=>{let g=o.named.get(a),h=c?.trim()||"",l=f||"",p={},S=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,w;while((w=S.exec(l))!==null){let y=w[1],E=w[2];p[y]=k(E,i)}return await jc(g,p,h,i)});let e=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return r=r.replace(e,(s,a,f)=>{if(/\bname\s*=/.test(a||""))return s;let c=f?.trim()||"";return o.default||c}),r}async function M(t,o,i){let r=[],n=[];t.replace(o,(a,...f)=>{let c=f[f.length-2];return n.push({match:a,index:c}),r.push(i(a,...f.slice(0,-2))),a});let e=await Promise.all(r),s=t;for(let a=n.length-1;a>=0;a--){let{match:f,index:c}=n[a];s=s.slice(0,c)+e[a]+s.slice(c+f.length)}return s}function Yu(t){let o=Lc(t);return{defaultSlot:o.default,namedSlots:o.named}}async function Zu(t,o,i,r){return await Bc(t,{default:o,named:i},r)}
|
|
3
3
|
export{Lc,Ju,jc,Bc,Yu,Zu};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import m from"path";var y=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function I(...o){let r=new Set;for(let s of o){if(!s||!s.includes("__stxModules["))continue;for(let e of s.matchAll(y))try{r.add(JSON.parse(`"${e[1]}"`))}catch{}}return[...r].sort()}async function w(o,r={}){if(o.length===0)return null;let s=process.cwd(),e=[],a=[];o.forEach((t,c)=>{let i=t.startsWith("npm:")?t.slice(4):m.resolve(s,t),l=`__stxRegistered${c}`,p=JSON.stringify(t);e.push(`import * as ${l} from ${JSON.stringify(i)};`),a.push(`if (!globalThis.__stxModules[${p}]) globalThis.__stxModules[${p}] = ${l};`)});let d=[...e,"globalThis.__stxModules = globalThis.__stxModules || {};",...a].join(`
|
|
3
|
-
`),n;try{let{bundleClientScript:t}=await import("./chunk-
|
|
3
|
+
`),n;try{let{bundleClientScript:t}=await import("./chunk-aq3mpxrm.js");n=await t(d,m.join(s,".stx-module-registry.ts"),{projectRoot:s,minify:r.minify,externalizeUserModules:!1,collectInputs:r.collectInputs,throwOnFailure:!0})}catch(t){let{formatBuildFailure:c}=await import("./chunk-a2bw46t9.js"),i=c(t);console.warn(`[stx] could not build the page module registry (#1957): ${i}`);let l=`[stx] the page module registry did not build, so ${o.join(", ")} cannot load (#1957): ${i}`;return`;console.error(${JSON.stringify(l)});`}let{transformAutoImports:f,generateAutoImportDestructuring:_}=await import("./chunk-43m1rvh3.js"),u=f(n),h=_(u.stxImports,u.browserImports),{transformStoreImports:x}=await import("./chunk-hvtzw1jh.js");n=x(u.code);let g=JSON.stringify(new Bun.CryptoHasher("md5").update(d).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${g}]) return;`,` __stxBundles[${g}] = true;`,h,n,"})();"].join(`
|
|
4
4
|
`)}export{w as buildModuleRegistryScript,I as registeredModuleIdsIn};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{zn,Ce}from"./chunk-v2x9vzgw.js";import{L,y,rr,as,S}from"./chunk-h6633jna.js";import{o,R}from"./chunk-adxt8qcy.js";import{Js}from"./chunk-d419kwfp.js";import{Ye}from"./chunk-x34scshq.js";import{c}from"./chunk-zhf01af3.js";import{i,Qe}from"./chunk-eqrkhc18.js";import d from"path";import b from"fs";import{AsyncLocalStorage as gt}from"async_hooks";var ht=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||Js(t,e,n)}var ot=2;function ll(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):c(t,"bundle-cache")}function nt(t,e){let n=t;for(let r of xt(e))if(r!==d.sep)n=n.split(r).join("\x00root");return n}var st=new Map;function xt(t){let e=d.resolve(t),n=st.get(e);if(!n){let r=e;try{r=b.realpathSync(e)}catch{}n=[...new Set([e,r])].sort((u,m)=>m.length-u.length),st.set(e,n)}return n}function $t(t,e){try{let n=b.statSync(t),r=d.resolve(e),u=t.startsWith(`${r}${d.sep}`);return{path:u?d.relative(r,t):t,...u?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(b.readFileSync(t)).toString(36)}}catch{return null}}function at(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function yt(t,e){for(let n of t){let r=at(n,e);try{let u=b.statSync(r);if(u.size!==n.size)return!1;if(u.mtimeMs!==n.mtimeMs&&Bun.hash(b.readFileSync(r)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var ct=new Map,bt=100;function ul(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var G=new Map;async function wt(t){let e=G.get(t)??0;if(e>0&&e<bt){G.set(t,e+1);return}G.set(t,1);try{let n=(await b.promises.readdir(t)).filter((l)=>l.endsWith(".js")),r=ul();if(n.length<=r)return;let m=(await Promise.all(n.map(async(l)=>{try{return{name:l,at:(await b.promises.stat(d.join(t,l))).mtimeMs}}catch{return null}}))).filter((l)=>l!==null);m.sort((l,w)=>w.at-l.at);for(let l of m.slice(r)){let w=l.name.slice(0,-3);await b.promises.rm(d.join(t,`${w}.js`),{force:!0}),await b.promises.rm(d.join(t,`${w}.deps.json`),{force:!0})}C("pruned bundle cache to",r,"entries")}catch{}}function _e(t){return ct.get(t)??[]}function q(t,e){if(t)ct.set(t,e)}function dl(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function C(...t){if(dl())console.log("[stx:bundler]",...t)}var Y=[];function Qi(t,e,n){Y.push({filePath:t||"<inline>",message:e,details:n})}function Gt(){return Y.slice()}function Kt(){Y.length=0}var Z;function rp(t){Z=t}function ea(){if(Z)return Z;try{let t=R.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Q=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function Xt(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let u=n[1];if(!Q.some((l)=>l.test(u)))return C("detected user import:",u),!0}let r=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=r.exec(t))!==null){let u=n[1];if(/\.css(?:\?.*)?$/.test(u))continue;if(!Q.some((l)=>l.test(u)))return C("detected side-effect import:",u),!0}return!1}var Fn="stx-module:",St=/\.(?:[cm]?[jt]sx?|json)$/i;function pl(t,e){return d.relative(t,e).split(d.sep).join("/")}function fl(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,r,u,m)=>{let l=e.get(m);return l&&!m.startsWith(Fn)?`${r}${u}${l}${u}`:n})}function gl(t,e){let n=0,r=(m)=>{let l=`__stxMod${n++}`,w=JSON.stringify(m);return e.push(`var ${l} = globalThis.__stxModules && globalThis.__stxModules[${w}];`,`if (${l} === undefined) throw new Error("[stx] module " + ${JSON.stringify(w)} + " is not registered on this page (#1957)");`),l},u=(m,l)=>{for(let w of m.split(",")){let F=w.trim();if(!F)continue;let j=F.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!j)continue;let p=j[1].startsWith('"')?JSON.parse(j[1]):j[1],s=j[2]??p;e.push(`var ${s} = ${l}[${JSON.stringify(p)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,l,w)=>{let F=w.slice(Fn.length),j=r(F),p=l.trim(),s=p.match(/^([\w$]+)\s*(?:,\s*|$)/);if(s&&!p.startsWith("{")&&!p.startsWith("*"))e.push(`var ${s[1]} = ${j}.default;`),p=p.slice(s[0].length).trim();let a=p.match(/^\*\s*as\s+([\w$]+)$/);if(a)e.push(`var ${a[1]} = ${j};`);else if(p.startsWith("{"))u(p.replace(/^\{|\}$/g,""),j);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,l)=>(r(l.slice(Fn.length)),"")),t}function rt(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let n of e)try{if(b.existsSync(n)&&b.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var K=new gt;function qs(t,e){let n=new Bun.CryptoHasher("md5");for(let[r,u]of[...t].sort(([m],[l])=>m<l?-1:m>l?1:0))n.update(`${r}\x00${u}\x00`);return K.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function Jt(){return K.getStore()?.key??""}function vt(t,e,n,r,u,m=new Map,l,w){let F=(p,s,a)=>{if(X(s,t,l))return null;if(!u||p!==n||!St.test(s))return null;try{if(!b.statSync(s,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}r.add(s);let h=`${Fn}${pl(process.cwd(),s)}`;return m.set(a,h),{path:h,external:!0}},j=(p,s)=>{let a=p===n?e:d.dirname(p),h=d.resolve(a,s);return rt(h)??h};return{name:"stx-client-bundle",setup(p){if(p.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(s)=>({path:s.path,external:!0})),p.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(s)=>({path:s.path,external:!0})),p.onResolve({filter:/^\//},(s)=>{let a=rt(s.path);if(a){let h=F(s.importer,a,s.path);if(h)return h;if(a!==n)r.add(a);return{path:a}}return{path:s.path,external:!0}}),p.onResolve({filter:/^\.\.?\//},(s)=>{let a=j(s.importer,s.path),h=F(s.importer,a,s.path);if(h)return h;return r.add(a),{path:a}}),p.onResolve({filter:/^[@~]\//},(s)=>{let a=d.resolve(t,s.path.slice(2)),h=[a,`${a}.ts`,`${a}.tsx`,`${a}.js`,`${a}.mjs`,`${a}.jsx`,d.join(a,"index.ts"),d.join(a,"index.tsx"),d.join(a,"index.js"),d.join(a,"index.mjs")];for(let I of h)if(b.existsSync(I)&&b.statSync(I,{throwIfNoEntry:!1})?.isFile()){let E=F(s.importer,I,s.path);if(E)return E;return C(`resolved ${s.path[0]}/ import:`,s.path,"\u2192",I),r.add(I),{path:I}}return console.warn(`[stx:bundler] could not resolve ${s.path[0]}/ import:`,s.path),{path:a}}),u)p.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(s)=>{if(s.importer!==n)return;let a=`${Fn}npm:${s.path}`;return m.set(s.path,a),{path:a,external:!0}});p.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(s)=>{if(X(s.path,t,l))throw Error(`Server-only API source cannot be imported by a client script: ${s.path}`);let a=d.extname(s.path).toLowerCase(),h=a===".json"?"json":a===".tsx"?"tsx":a===".jsx"?"jsx":a===".ts"||a===".mts"||a===".cts"?"ts":"js";if(s.path!==n)r.add(s.path);let I=w?.get(s.path);if(I!==void 0)return{contents:I,loader:"js"};return{contents:b.readFileSync(s.path,"utf8"),loader:h}})}}}var H=new Map,z=y(64),it=Symbol.for("stx.client-bundle-build-queue");function ml(t){let e=globalThis,r=(e[it]??Promise.resolve()).then(t,t);return e[it]=r.then(()=>{return},()=>{return}),r}async function Yt(t,e,n={}){let r=n.projectRoot||process.cwd(),u=(await o(r)).serverApi,m=n.minify??!1,l=n.externalizeUserModules??!0,w=n.expose?.length?[...new Set(n.expose)].sort():void 0,F=n.cacheDir||ll(r),j=K.getStore(),p=new Bun.CryptoHasher("md5");p.update(`${ht}\x00${Ye()}\x00${JSON.stringify(u??!1)}\x00${l?"registry":"inline"}\x00${w?w.join(","):"*"}\x00${m?"minified":"readable"}\x00${j?.key??""}\x00${nt(t,r)}\x00${nt(e,r)}`);let s=p.digest("hex").slice(0,12),a=d.join(F,`${s}.js`),h=z.get(a);if(h){if(as(h.files)&&h.files.every((M)=>!X(M.path,r,u))){C("memo hit:",s);let M=h.files.map((A)=>A.path);return q(e,M),n.collectInputs?.push(...M),h.code}z.delete(a),C("memo invalidated by dep change:",s)}let I=d.join(F,`${s}.deps.json`),E=Bun.file(a);if(await E.exists()){let M=Bun.file(I),A=!1,O=null;if(await M.exists())try{let D=JSON.parse(await M.text());if(D.metadataVersion===ot&&Array.isArray(D.files)&&yt(D.files,r))O=rr(D.files.map((g)=>at(g,r))),A=O.length===D.files.length&&!O.some((g)=>X(g.path,r,u))}catch{A=!1}if(A){if(C("cache hit:",s),O)q(e,O.map((T)=>T.path)),n.collectInputs?.push(...O.map((T)=>T.path));let D=await E.text(),g=new Date;if(b.promises.utimes(a,g,g).catch(()=>{}),O)z.set(a,{code:D,files:O});return D}C("cache invalidated by dep change:",s)}let P=H.get(s);if(P){let M=await P;if(n.collectInputs)n.collectInputs.push(...(z.get(a)?.files??[]).map((A)=>A.path));return M}let V=ml(()=>jt(t,e,{projectRoot:r,minify:m,cacheDir:F,hash:s,cachePath:a,depsPath:I,collectInputs:n.collectInputs,externalizeUserModules:l,serverApi:u,expose:w,throwOnFailure:n.throwOnFailure,substitutes:j?.modules}));H.set(s,V);try{return await V}finally{H.delete(s)}}var Bt=0;function hl(t){return`${t}-${process.pid}-${++Bt}`}async function jt(t,e,n){let{projectRoot:r,minify:u,cacheDir:m,hash:l,cachePath:w,depsPath:F,externalizeUserModules:j}=n,p=c(r,"bundle-tmp"),s=hl(l),a=d.join(p,`${s}.ts`),h=d.join(p,"out",s);b.mkdirSync(p,{recursive:!0}),b.mkdirSync(h,{recursive:!0});let I=d.dirname(e),E=new Set,P=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,V=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,M=i(t),{depths:A,balanced:O}=Qe(M),D=(B)=>!O||A[B]===0,g;while((g=P.exec(M))!==null){if(g[1])continue;if(!D(g.index))continue;if(g[2])g[2].split(",").forEach((B)=>{let f=Et(B);if(f)E.add(f)});else if(g[3])E.add(g[3])}while((g=V.exec(M))!==null){if(g[1])continue;if(!D(g.index))continue;E.add(g[2])}let T=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=T.exec(M))!==null){if(!D(g.index))continue;let B=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(B&&Q.some((f)=>f.test(B)))continue;if(g[1])E.add(g[1]);if(g[2])E.add(g[2]);for(let f of(g[3]??"").split(",")){let v=f.trim();if(!v||/^type\s/.test(v))continue;let U=/\bas\s+(\w+)\s*$/.exec(v)?.[1]??/^\w+$/.exec(v)?.[0];if(U)E.add(U)}}for(let B of M.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let f of B[1].split(",")){let v=/\bas\s+(\w+)\s*$/.exec(f)?.[1]??/^\s*(\w+)\s*$/.exec(f)?.[1];if(v)E.delete(v)}let lt=E.size>0?`
|
|
2
|
+
import{zn,Ce}from"./chunk-v2x9vzgw.js";import{L,y,rr,as,S}from"./chunk-39nvwdn6.js";import{o,R}from"./chunk-y4crq495.js";import{Js}from"./chunk-g4qz56km.js";import{Ye}from"./chunk-x34scshq.js";import{c}from"./chunk-zhf01af3.js";import{i,Qe}from"./chunk-eqrkhc18.js";import d from"path";import b from"fs";import{AsyncLocalStorage as gt}from"async_hooks";var ht=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||Js(t,e,n)}var ot=2;function ll(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):c(t,"bundle-cache")}function nt(t,e){let n=t;for(let r of xt(e))if(r!==d.sep)n=n.split(r).join("\x00root");return n}var st=new Map;function xt(t){let e=d.resolve(t),n=st.get(e);if(!n){let r=e;try{r=b.realpathSync(e)}catch{}n=[...new Set([e,r])].sort((u,m)=>m.length-u.length),st.set(e,n)}return n}function $t(t,e){try{let n=b.statSync(t),r=d.resolve(e),u=t.startsWith(`${r}${d.sep}`);return{path:u?d.relative(r,t):t,...u?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(b.readFileSync(t)).toString(36)}}catch{return null}}function at(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function yt(t,e){for(let n of t){let r=at(n,e);try{let u=b.statSync(r);if(u.size!==n.size)return!1;if(u.mtimeMs!==n.mtimeMs&&Bun.hash(b.readFileSync(r)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var ct=new Map,bt=100;function ul(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var G=new Map;async function wt(t){let e=G.get(t)??0;if(e>0&&e<bt){G.set(t,e+1);return}G.set(t,1);try{let n=(await b.promises.readdir(t)).filter((l)=>l.endsWith(".js")),r=ul();if(n.length<=r)return;let m=(await Promise.all(n.map(async(l)=>{try{return{name:l,at:(await b.promises.stat(d.join(t,l))).mtimeMs}}catch{return null}}))).filter((l)=>l!==null);m.sort((l,w)=>w.at-l.at);for(let l of m.slice(r)){let w=l.name.slice(0,-3);await b.promises.rm(d.join(t,`${w}.js`),{force:!0}),await b.promises.rm(d.join(t,`${w}.deps.json`),{force:!0})}C("pruned bundle cache to",r,"entries")}catch{}}function _e(t){return ct.get(t)??[]}function q(t,e){if(t)ct.set(t,e)}function dl(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function C(...t){if(dl())console.log("[stx:bundler]",...t)}var Y=[];function Qi(t,e,n){Y.push({filePath:t||"<inline>",message:e,details:n})}function Gt(){return Y.slice()}function Kt(){Y.length=0}var Z;function rp(t){Z=t}function ea(){if(Z)return Z;try{let t=R.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Q=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function Xt(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let u=n[1];if(!Q.some((l)=>l.test(u)))return C("detected user import:",u),!0}let r=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=r.exec(t))!==null){let u=n[1];if(/\.css(?:\?.*)?$/.test(u))continue;if(!Q.some((l)=>l.test(u)))return C("detected side-effect import:",u),!0}return!1}var Fn="stx-module:",St=/\.(?:[cm]?[jt]sx?|json)$/i;function pl(t,e){return d.relative(t,e).split(d.sep).join("/")}function fl(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,r,u,m)=>{let l=e.get(m);return l&&!m.startsWith(Fn)?`${r}${u}${l}${u}`:n})}function gl(t,e){let n=0,r=(m)=>{let l=`__stxMod${n++}`,w=JSON.stringify(m);return e.push(`var ${l} = globalThis.__stxModules && globalThis.__stxModules[${w}];`,`if (${l} === undefined) throw new Error("[stx] module " + ${JSON.stringify(w)} + " is not registered on this page (#1957)");`),l},u=(m,l)=>{for(let w of m.split(",")){let F=w.trim();if(!F)continue;let j=F.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!j)continue;let p=j[1].startsWith('"')?JSON.parse(j[1]):j[1],s=j[2]??p;e.push(`var ${s} = ${l}[${JSON.stringify(p)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,l,w)=>{let F=w.slice(Fn.length),j=r(F),p=l.trim(),s=p.match(/^([\w$]+)\s*(?:,\s*|$)/);if(s&&!p.startsWith("{")&&!p.startsWith("*"))e.push(`var ${s[1]} = ${j}.default;`),p=p.slice(s[0].length).trim();let a=p.match(/^\*\s*as\s+([\w$]+)$/);if(a)e.push(`var ${a[1]} = ${j};`);else if(p.startsWith("{"))u(p.replace(/^\{|\}$/g,""),j);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,l)=>(r(l.slice(Fn.length)),"")),t}function rt(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let n of e)try{if(b.existsSync(n)&&b.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var K=new gt;function qs(t,e){let n=new Bun.CryptoHasher("md5");for(let[r,u]of[...t].sort(([m],[l])=>m<l?-1:m>l?1:0))n.update(`${r}\x00${u}\x00`);return K.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function Jt(){return K.getStore()?.key??""}function vt(t,e,n,r,u,m=new Map,l,w){let F=(p,s,a)=>{if(X(s,t,l))return null;if(!u||p!==n||!St.test(s))return null;try{if(!b.statSync(s,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}r.add(s);let h=`${Fn}${pl(process.cwd(),s)}`;return m.set(a,h),{path:h,external:!0}},j=(p,s)=>{let a=p===n?e:d.dirname(p),h=d.resolve(a,s);return rt(h)??h};return{name:"stx-client-bundle",setup(p){if(p.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(s)=>({path:s.path,external:!0})),p.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(s)=>({path:s.path,external:!0})),p.onResolve({filter:/^\//},(s)=>{let a=rt(s.path);if(a){let h=F(s.importer,a,s.path);if(h)return h;if(a!==n)r.add(a);return{path:a}}return{path:s.path,external:!0}}),p.onResolve({filter:/^\.\.?\//},(s)=>{let a=j(s.importer,s.path),h=F(s.importer,a,s.path);if(h)return h;return r.add(a),{path:a}}),p.onResolve({filter:/^[@~]\//},(s)=>{let a=d.resolve(t,s.path.slice(2)),h=[a,`${a}.ts`,`${a}.tsx`,`${a}.js`,`${a}.mjs`,`${a}.jsx`,d.join(a,"index.ts"),d.join(a,"index.tsx"),d.join(a,"index.js"),d.join(a,"index.mjs")];for(let I of h)if(b.existsSync(I)&&b.statSync(I,{throwIfNoEntry:!1})?.isFile()){let E=F(s.importer,I,s.path);if(E)return E;return C(`resolved ${s.path[0]}/ import:`,s.path,"\u2192",I),r.add(I),{path:I}}return console.warn(`[stx:bundler] could not resolve ${s.path[0]}/ import:`,s.path),{path:a}}),u)p.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(s)=>{if(s.importer!==n)return;let a=`${Fn}npm:${s.path}`;return m.set(s.path,a),{path:a,external:!0}});p.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(s)=>{if(X(s.path,t,l))throw Error(`Server-only API source cannot be imported by a client script: ${s.path}`);let a=d.extname(s.path).toLowerCase(),h=a===".json"?"json":a===".tsx"?"tsx":a===".jsx"?"jsx":a===".ts"||a===".mts"||a===".cts"?"ts":"js";if(s.path!==n)r.add(s.path);let I=w?.get(s.path);if(I!==void 0)return{contents:I,loader:"js"};return{contents:b.readFileSync(s.path,"utf8"),loader:h}})}}}var H=new Map,z=y(64),it=Symbol.for("stx.client-bundle-build-queue");function ml(t){let e=globalThis,r=(e[it]??Promise.resolve()).then(t,t);return e[it]=r.then(()=>{return},()=>{return}),r}async function Yt(t,e,n={}){let r=n.projectRoot||process.cwd(),u=(await o(r)).serverApi,m=n.minify??!1,l=n.externalizeUserModules??!0,w=n.expose?.length?[...new Set(n.expose)].sort():void 0,F=n.cacheDir||ll(r),j=K.getStore(),p=new Bun.CryptoHasher("md5");p.update(`${ht}\x00${Ye()}\x00${JSON.stringify(u??!1)}\x00${l?"registry":"inline"}\x00${w?w.join(","):"*"}\x00${m?"minified":"readable"}\x00${j?.key??""}\x00${nt(t,r)}\x00${nt(e,r)}`);let s=p.digest("hex").slice(0,12),a=d.join(F,`${s}.js`),h=z.get(a);if(h){if(as(h.files)&&h.files.every((M)=>!X(M.path,r,u))){C("memo hit:",s);let M=h.files.map((A)=>A.path);return q(e,M),n.collectInputs?.push(...M),h.code}z.delete(a),C("memo invalidated by dep change:",s)}let I=d.join(F,`${s}.deps.json`),E=Bun.file(a);if(await E.exists()){let M=Bun.file(I),A=!1,O=null;if(await M.exists())try{let D=JSON.parse(await M.text());if(D.metadataVersion===ot&&Array.isArray(D.files)&&yt(D.files,r))O=rr(D.files.map((g)=>at(g,r))),A=O.length===D.files.length&&!O.some((g)=>X(g.path,r,u))}catch{A=!1}if(A){if(C("cache hit:",s),O)q(e,O.map((T)=>T.path)),n.collectInputs?.push(...O.map((T)=>T.path));let D=await E.text(),g=new Date;if(b.promises.utimes(a,g,g).catch(()=>{}),O)z.set(a,{code:D,files:O});return D}C("cache invalidated by dep change:",s)}let P=H.get(s);if(P){let M=await P;if(n.collectInputs)n.collectInputs.push(...(z.get(a)?.files??[]).map((A)=>A.path));return M}let V=ml(()=>jt(t,e,{projectRoot:r,minify:m,cacheDir:F,hash:s,cachePath:a,depsPath:I,collectInputs:n.collectInputs,externalizeUserModules:l,serverApi:u,expose:w,throwOnFailure:n.throwOnFailure,substitutes:j?.modules}));H.set(s,V);try{return await V}finally{H.delete(s)}}var Bt=0;function hl(t){return`${t}-${process.pid}-${++Bt}`}async function jt(t,e,n){let{projectRoot:r,minify:u,cacheDir:m,hash:l,cachePath:w,depsPath:F,externalizeUserModules:j}=n,p=c(r,"bundle-tmp"),s=hl(l),a=d.join(p,`${s}.ts`),h=d.join(p,"out",s);b.mkdirSync(p,{recursive:!0}),b.mkdirSync(h,{recursive:!0});let I=d.dirname(e),E=new Set,P=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,V=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,M=i(t),{depths:A,balanced:O}=Qe(M),D=(B)=>!O||A[B]===0,g;while((g=P.exec(M))!==null){if(g[1])continue;if(!D(g.index))continue;if(g[2])g[2].split(",").forEach((B)=>{let f=Et(B);if(f)E.add(f)});else if(g[3])E.add(g[3])}while((g=V.exec(M))!==null){if(g[1])continue;if(!D(g.index))continue;E.add(g[2])}let T=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=T.exec(M))!==null){if(!D(g.index))continue;let B=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(B&&Q.some((f)=>f.test(B)))continue;if(g[1])E.add(g[1]);if(g[2])E.add(g[2]);for(let f of(g[3]??"").split(",")){let v=f.trim();if(!v||/^type\s/.test(v))continue;let U=/\bas\s+(\w+)\s*$/.exec(v)?.[1]??/^\w+$/.exec(v)?.[0];if(U)E.add(U)}}for(let B of M.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let f of B[1].split(",")){let v=/\bas\s+(\w+)\s*$/.exec(f)?.[1]??/^\s*(\w+)\s*$/.exec(f)?.[1];if(v)E.delete(v)}let lt=E.size>0?`
|
|
3
3
|
export { ${[...E].join(", ")} }`:"";await Bun.write(a,t+lt),C("bundling:",l,"from:",d.basename(e));let tt=new Set,et=new Map;try{let B=await Bun.build({entrypoints:[a],outdir:h,target:"browser",format:"esm",minify:u?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[vt(r,I,a,tt,j,et,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":u?'"production"':'"development"',...S()},root:r});if(!B.success){let _=B.logs.filter((N)=>N.level==="error").map((N)=>N.message).join(", ")||`Unable to bundle ${d.basename(e)}`,k=zn(B.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",_),Qi(e||"",_,k),n.throwOnFailure||ea()==="error")throw Error(_);return t}let f="";for(let x of B.outputs){f=await x.text();break}let v=[];for(let x of f.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let _ of x[1].split(",")){let k=_.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k){v.push([k[2],k[1]]);continue}let N=_.trim();if(/^[A-Za-z_$][\w$]*$/.test(N))v.push([N,N])}if(n.expose){let x=new Set(n.expose);for(let _=v.length-1;_>=0;_--)if(!x.has(v[_][0]))v.splice(_,1)}let U=[];f=gl(fl(f,et),U);let ut=f.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(f=f.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),u&&f)try{f=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(f)}catch{}let J=`__stxBundle_${l}`,dt=new Set(L(t,!0).split(",").map((x)=>x.trim())),pt=v.map(([x,_])=>`get ${JSON.stringify(x)}() { return ${_} }${dt.has(x)?`, set ${JSON.stringify(x)}(__stxValue_${_}) { ${_} = __stxValue_${_} }`:""}`).join(", "),ft=v.map(([x])=>`var ${x} = undefined;`).join(`
|
|
4
4
|
`),mt=v.map(([x])=>`${x} = ${J}[${JSON.stringify(x)}];`).join(`
|
|
5
5
|
`);if(f=`${ut.join(`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Mu}from"./chunk-f0mrs38w.js";import"./chunk-2xxmhmmj.js";import"./chunk-pxqh758g.js";import"./chunk-g4qz56km.js";import"./chunk-rcwqm2qq.js";import"./chunk-yyfcg26x.js";import"./chunk-prf164ct.js";import"./chunk-etpjy429.js";import"./chunk-ze3p2wf6.js";import"./chunk-hm4fzr68.js";import"./chunk-r7kmsq3n.js";import"./chunk-tgm4mnn4.js";import"./chunk-v6zdb66z.js";import"./chunk-8nryyqb5.js";import"./chunk-1kn1at1y.js";import"./chunk-y4crq495.js";import"./chunk-3bpts69r.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-t9mfztcs.js";import"./chunk-zaaeneq6.js";import"./chunk-39nvwdn6.js";import"./chunk-yeb4yc8a.js";import"./chunk-2h8ea0we.js";import"./chunk-hb08vrbb.js";import"./chunk-ce6zddpf.js";import"./chunk-7rta163c.js";export{Mu as buildForProduction};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Fo,vs,l,d,E,et,u,ws,t,a,w}from"./chunk-hb08vrbb.js";import{he,Et,It,K,k}from"./chunk-
|
|
2
|
+
import{Fo,vs,l,d,E,et,u,ws,t,a,w}from"./chunk-hb08vrbb.js";import{he,Et,It,K,k}from"./chunk-39nvwdn6.js";import{ee}from"./chunk-r7kmsq3n.js";import{Ur}from"./chunk-8nryyqb5.js";var ae=1000,ue=!1;function fe(n,r){let o=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",s=0,i;while((i=o.exec(n))!==null){let p=i.index+i[0].length,y=i.index+i[0].indexOf("("),m=w(n,"(",")",y);if(m===-1)continue;let c=n.slice(p,m).trim();if(!c)continue;if(!Object.keys(r).some((b)=>new RegExp(`(?:^|[^\\w$.])${b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(c)))continue;let g;try{let b=E(c,r);if(!b||typeof b!=="object")continue;g=JSON.stringify(b)}catch{continue}e+=n.slice(s,p)+g,s=m,o.lastIndex=m}return s===0?n:e+n.slice(s)}function ge(n,r){let o=/@component\s*\(/g,e=n,s,i=[];while((s=o.exec(e))!==null){let p=s.index,y=p+s[0].length-1,m=1,c=y+1;while(c<e.length&&m>0){if(e[c]==="(")m++;else if(e[c]===")"){if(m--,m===0)break}c++}if(m!==0)continue;let f=e.substring(y+1,c),g=c+1,b=f.match(/^\s*['"]([^'"]+)['"]/);if(!b)continue;let x=b[1],h=f.slice(b[0].length),_=h.match(/^\s*,\s*/);if(!_)continue;let S=h.slice(_[0].length).trim();if(!S)continue;try{let P=E(S,r),F=JSON.stringify(P),R=`@component('${x}', ${F})`;i.push({start:p,end:g,replacement:R})}catch{continue}}for(let p=i.length-1;p>=0;p--){let{start:y,end:m,replacement:c}=i[p];e=e.substring(0,y)+c+e.substring(m)}return e}function te(n,r,o){let e=n,s=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),i;while((i=s.exec(e))!==null){let p=i.index,y=p+i[0].length-1,m=1,c=y+1,f=null,g=!1;while(c<e.length&&m>0){let h=e[c];if(g){g=!1,c++;continue}if(h==="\\"&&f){g=!0,c++;continue}if(f){if(h===f)f=null;c++;continue}if(h==='"'||h==="'"||h==="`"){f=h,c++;continue}if(h==="(")m++;else if(h===")"){if(m--,m===0)break}c++}if(m!==0)break;let b=e.substring(y+1,c),x=o(b);e=e.substring(0,p)+x+e.substring(c+1)}return e}function pe(n,r){let o=n;return o=o.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,s)=>{if(s in r)return`:${s}="${s}"`;return e}),o=o.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,s,i)=>{try{let p=Object.keys(r),y=Object.values(r);Fo(i);let c=u(i,p)(...y),f=JSON.stringify(c);if(f===void 0){if(!et(i).some((x)=>!(x in r)))return"";return e}let g=Buffer.from(f,"utf8").toString("base64");return`__stx_${s}="${g}"`}catch(p){return e}}),o}var Y="<!--__STX_BREAK__-->",G="<!--__STX_CONTINUE__-->";function se(n,r){let o=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",s=0;for(let i=o.exec(n);i;i=o.exec(n)){if(!i[1]){let c=i[0].length===3&&i[0]==="{{{"?3:2,f=i[0]==="{!!"?n.indexOf("!!}",o.lastIndex):he(n,i.index,c);if(f<0)break;o.lastIndex=f+(i[0]==="{!!"?3:c);continue}let p=o.lastIndex,y=!0,m=/^\s*\(/.exec(n.slice(p));if(m){let c=p+m[0].length-1,f=w(n,"(",")",c);if(f<0)break;p=f+1;try{let g=`!!(${n.slice(c+1,f).trim()})`;y=d(g)?Boolean(u(g,Object.keys(r))(...Object.values(r))):Boolean(l(g,r))}catch{y=!1}}if(e+=n.slice(s,i.index),y)return e+(i[1]==="break"?Y:G);s=p,o.lastIndex=p}return e+n.slice(s)}function oe(n){let r=(s)=>s.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),o="",e=0;return It(n,(s,i,p)=>(o+=ne(r(n.slice(e,p))),o+=`\${__stxRenderLoopValue(${p}, (${i}), ${s.length})}`,e=p+s.length,s)),o+ne(r(n.slice(e)))}function ie(n,r,o,e){return K(n,r,o==null?"":String(o),!1,e)}function ne(n){let r=n;return r=te(r,"@break",(o)=>{let e=o.trim();if(!ws(e))return"";return`\`; if (${e}) { break; } result += \``}),r=te(r,"@continue",(o)=>{let e=o.trim();if(!ws(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function de(n){let r=/@forelse\s*\(/g,o,e=[],s=/@foreach\s*\(/g,i=/@endforeach/g,p;while((p=s.exec(n))!==null)e.push({pos:p.index,delta:1});while((p=i.exec(n))!==null)e.push({pos:p.index,delta:-1});e.sort((f,g)=>f.pos-g.pos);let y=[],m=0;for(let f of e)m+=f.delta,y.push({pos:f.pos,depth:m});function c(f){let g=0,b=y.length-1,x=0;while(g<=b){let h=g+b>>1;if(y[h].pos<=f)x=y[h].depth,g=h+1;else b=h-1}return x}while((o=r.exec(n))!==null){if(c(o.index)>0)continue;let f=o.index,g=o.index+o[0].length-1,b=1,x=g+1,h=-1;while(x<n.length&&b>0){if(n[x]==="(")b++;else if(n[x]===")"){if(b--,b===0){h=x;break}}x++}if(h===-1)continue;let _=n.substring(g+1,h),S=Et(_);if(!S)continue;let{arrayExpr:P,itemVar:F}=S,R=h+1,N=1,U=R,v=/@forelse\s*\(/g,V=/@endforelse/g,I=-1;while(N>0&&U<n.length){v.lastIndex=U,V.lastIndex=U;let A=v.exec(n),T=V.exec(n);if(!T)break;if(A&&A.index<T.index)N++,U=A.index+A[0].length;else{if(N--,N===0){I=T.index;break}U=T.index+11}}if(I===-1)continue;let j=n.substring(R,I),z=I+11,M=-1,W=0,O=0;while(O<j.length){let A=j.indexOf("@",O);if(A===-1)break;let T=j.substring(A);if(/^@forelse\s*\(/.test(T))W++,O=A+1;else if(T.startsWith("@endforelse"))W--,O=A+11;else if(W===0&&T.startsWith("@empty")){if(j.length<=A+6||!/[a-z]/i.test(j[A+6])){M=A;break}O=A+1}else O=A+1}if(M===-1)continue;return{start:f,end:z,arrayExpr:P,itemVar:F,foreachContent:j.substring(0,M),emptyContent:j.substring(M+6)}}return null}function re(n,r){let o=n;while(!0){let e=de(o);if(!e)break;let{start:s,end:i,arrayExpr:p,itemVar:y,foreachContent:m,emptyContent:c}=e;try{let f;if(d(p))f=u(p,Object.keys(r))(...Object.values(r));else f=l(p,r);let g;if(!Array.isArray(f)||f.length===0)g=c;else g=`@foreach (${p} as ${y})${m}@endforeach`;o=o.substring(0,s)+g+o.substring(i)}catch(f){let g=f instanceof Error?f.message:String(f),b=a("Forelse",`Error in @forelse(${p} as ${y}): ${g}`,t.EVALUATION_ERROR);o=o.substring(0,s)+b+o.substring(i)}}return o}var ce="<!--stx:foreach-not-iterable:",me=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function be(n,r){return`${ce}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function xe(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function Nr(n){if(!n.includes(ce))return n;return n.replace(me,(r,o,e)=>(xe(decodeURIComponent(o),decodeURIComponent(e)),""))}function qn(n,r,o,e,s=!1){let i=n;i=re(i,r);function p(c){let f=/@foreach\s*\(/g,g;while((g=f.exec(c))!==null){let b=g.index,x=g.index+g[0].length-1,h=1,_=x+1,S=-1;while(_<c.length&&h>0){if(c[_]==="(")h++;else if(c[_]===")"){if(h--,h===0){S=_;break}}_++}if(S===-1)continue;let P=c.substring(x+1,S),F=Et(P);if(!F)continue;let R=b,{arrayExpr:N,itemVar:U}=F,v=S+1,V=1,I=v,j=/@foreach\s*\(/g,z=/@endforeach/g;while(V>0&&I<c.length){j.lastIndex=I,z.lastIndex=I;let M=j.exec(c),W=z.exec(c);if(!W)break;if(M&&M.index<W.index)V++,I=M.index+M[0].length;else{if(V--,V===0){let O=c.substring(v,W.index),A=W.index+11;return{start:R,end:A,arrayExpr:N,itemVar:U,content:O}}I=W.index+11}}}return null}function y(c,f){let g=c;while(!0){let b=p(g);if(!b)break;let{start:x,end:h,arrayExpr:_,itemVar:S,content:P}=b;try{let F=_.trim(),R;if(d(F))R=u(F,Object.keys(f))(...Object.values(f));else R=l(F,f);let N=!1;if(!Array.isArray(R))if(R instanceof Map)R=Array.from(R),N=!0;else if(R instanceof Set)R=Array.from(R);else if(typeof R==="string")R=Array.from(R);else if(R&&typeof R==="object"&&!(R instanceof Date)&&!(R instanceof RegExp))R=Object.entries(R),N=!0;else{let O=be(F,o)+a("Foreach",`Error in @foreach: ${F} is not iterable`,t.TYPE_ERROR);g=g.substring(0,x)+O+g.substring(h);continue}let U=e?.loops?.useAltLoopVariable??ue,v=S.trim(),V=null,I,j=!1;if(v.includes("=>")){let O=v.split("=>").map((A)=>A.trim());if(O.length===2&&O[0]&&O[1])V=O[0],I=O[1];else I=v}else if(!v.startsWith("[")&&!v.startsWith("{")&&v.includes(",")){let O=v.split(",").map((A)=>A.trim());if(O.length===2&&O[0]&&O[1])I=O[0],V=O[1],j=!0;else I=v}else I=v;let z="",M=R,W=f[vs]??new WeakMap;for(let O=0;O<M.length;O++){let A=M[O],T={index:O,iteration:O+1,first:O===0,last:O===M.length-1,count:M.length},L={...f,loop:T,$loop:T,[vs]:W};if(I.startsWith("[")&&I.endsWith("]")){let J=I.slice(1,-1).split(",").map((B)=>B.trim());if(Array.isArray(A))J.forEach((B,D)=>{if(B)L[B]=A[D]});else L[I]=A}else if(I.startsWith("{")&&I.endsWith("}")){let J=I.slice(1,-1).split(",").map((B)=>B.trim()).filter(Boolean);if(A!==null&&typeof A==="object")J.forEach((B)=>{let D=B.indexOf(":"),q=(D===-1?B:B.slice(0,D)).trim(),Q=D===-1?q:B.slice(D+1).trim();if(q&&Q)L[Q]=A[q]});else L[I]=A}else L[I]=A;if(V)if(!j&&N&&Array.isArray(A)&&A.length===2)L[V]=A[0],L[I]=A[1];else L[V]=O;let C=re(P,L);C=qn(C,L,o,e,!0),C=ee(C,L,o),C=se(C,L);let Z=C.indexOf(Y),H=C.indexOf(G),X=Z<0?H:H<0?Z:Math.min(Z,H);if(X>=0)C=C.slice(0,X);if(C=k(C,L,o),C=pe(C,L),C=ge(C,L),C=fe(C,L),z+=C,X>=0&&X===Z)break}g=g.substring(0,x)+z+g.substring(h)}catch(F){let R=a("Foreach",`Error in @foreach(${_.trim()} as ${S.trim()}): ${F instanceof Error?F.message:String(F)}`,t.EVALUATION_ERROR);g=g.substring(0,x)+R+g.substring(h)}}return g}i=y(i,r),i=ye(i,r,o,e);let m=e?.loops?.maxWhileIterations??ae;return i=Re(i,r,m),s?i:Nr(i)}function xl(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function le(n){return ws(n)}function ye(n,r,o,e){let s=n,i=!0;while(i){i=!1;let p=s.match(/@for\s*\(/);if(!p||p.index===void 0)break;let y=p.index,m=y+p[0].length-1,c=w(s,"(",")",m);if(c===-1)break;let f=xl(s.slice(m+1,c)),g=c+1,b=Ur(s.slice(y),"for","endfor");if(b.length===0)break;let x=b[0].content,h=y+b[0].end;if(!le(f)){let _=a("For",`Unsafe expression in @for: ${f}`,t.UNSAFE_EXPRESSION);s=s.substring(0,y)+_+s.substring(h),i=!0;continue}try{let _=Ee(f),S=/@(?:for|foreach|if|unless)\s*\(/.test(x);if(_.length>0&&S){let v=$e({forExpr:f,content:x,iterVarNames:_,context:r,filePath:o,options:e});s=s.substring(0,y)+v+s.substring(h),i=!0;continue}let P=Object.keys(r),F=Object.values(r),R=oe(x),U=Function(...P,"__stxRenderLoopValue",`
|
|
3
3
|
let result = '';
|
|
4
4
|
for (${f}) {
|
|
5
5
|
result += \`${R}\`;
|