@tinkerlandai/indiana-sdk 0.6.4 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -4
- package/README.md +4 -4
- package/README.zh-CN.md +3 -3
- package/dist/{ai-usage-B4W5m4Ie.d.ts → ai-usage-BsrSG955.d.ts} +334 -518
- package/dist/chunk-3SONNXFG.js +1 -0
- package/dist/chunk-467Z5ISI.js +11 -0
- package/dist/{chunk-2EJSV6BA.js → chunk-4AWSZWZD.js} +1 -1
- package/dist/{chunk-5TEZEOHX.js → chunk-6MO6Y24B.js} +1 -1
- package/dist/chunk-HD74AAFS.js +1 -0
- package/dist/chunk-J4RHVU3W.js +1 -0
- package/dist/chunk-KQCTDXVD.js +17 -0
- package/dist/chunk-NOFNOHUI.js +1 -0
- package/dist/chunk-QO4YQLZ4.js +1 -0
- package/dist/chunk-RRII2DMC.js +1 -0
- package/dist/chunk-WCFVNF5D.js +1 -0
- package/dist/chunk-YAFMBXIE.js +4 -0
- package/dist/{client-OYRHOMUQ.js → client-F6UPJMHR.js} +1 -1
- package/dist/{configuration-sync-C2mytNwU.d.ts → configuration-sync-Bvd956GL.d.ts} +333 -25
- package/dist/controls-XG46TKUU.js +2 -0
- package/dist/funnel-runtime-host-26QI2W3S.js +1 -0
- package/dist/{funnel-runtime-start-sZ8ZCNlq.d.ts → funnel-runtime-start-ChVYbLzV.d.ts} +6655 -2785
- package/dist/iam.js +1 -1
- package/dist/index.d.ts +3634 -1485
- package/dist/index.js +1 -1
- package/dist/native-shell.js +1 -1
- package/dist/openrouter.d.ts +2 -3
- package/dist/openrouter.js +1 -1
- package/dist/page.d.ts +13 -13
- package/dist/page.js +1 -1
- package/dist/paywall-WKOHBYW7.js +1 -0
- package/dist/popup.d.ts +9 -16
- package/dist/popup.js +12 -12
- package/dist/react-native.d.ts +14 -14
- package/dist/react-native.js +1 -1
- package/dist/server.d.ts +4 -4
- package/dist/server.js +1 -1
- package/dist/src-UHLPVD6E.js +1 -0
- package/dist/visual.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-63BWE27V.js +0 -1
- package/dist/chunk-CB63JLGT.js +0 -1
- package/dist/chunk-D7YHFS6B.js +0 -4
- package/dist/chunk-HTRQPMJO.js +0 -11
- package/dist/chunk-ISUXYPYL.js +0 -1
- package/dist/chunk-QG3WUJG5.js +0 -1
- package/dist/chunk-RMJJOSVZ.js +0 -1
- package/dist/chunk-S2MSIA57.js +0 -17
- package/dist/chunk-VVSQKVE7.js +0 -1
- package/dist/funnel-runtime-host-NWS3URFA.js +0 -1
- package/dist/paywall-4XZ6NDMY.js +0 -1
- package/dist/src-WV6GZYWA.js +0 -1
- package/dist/{customer-page-B4FGCVpt.d.ts → customer-page-B4LkIr5q.d.ts} +4 -4
- package/dist/{screen-16d-xADb.d.ts → screen-iFngkxaL.d.ts} +185 -185
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Fe}from"./chunk-CB63JLGT.js";import{a as Ue,b as ve,c as Pe,d as ce,e as Le,f as pe,g as De,h as Me,i as xe,j as he,k as S,l as ke,m as Be,n as He,o as Ve,p as Ge,q as Ye}from"./chunk-U6S6AZM6.js";import{a as Ce,b as se,c as ie}from"./chunk-4K25DELJ.js";function me(c){return c.nodeType===1&&c.hasAttribute("data-indiana-capture-controls")&&c.hasAttribute("data-indiana-private")}async function Se(c,l){let o=[];async function e(a){if(a===null||typeof a!="object"){o.push(Ge(a));return}let _=Array.isArray(a),U=_?Object.keys(a):Object.keys(a).sort();o.push(_?"[":"{");for(let y=0;y<U.length;y++)y&&o.push(","),_||o.push(JSON.stringify(U[y]),":"),await e(a[U[y]]),await l();o.push(_?"]":"}")}return await e(c),o.join("")}async function We(c,l,o){if(!Number.isSafeInteger(l)||l<0)throw new RangeError("Invalid byte limit");if(c.length>l)return null;let e=new TextEncoder,a=[],_=0;for(let f=0;f<c.length;){let r=Math.min(c.length,f+4096),T=c.charCodeAt(r-1),h=c.charCodeAt(r);r<c.length&&T>=55296&&T<=56319&&h>=56320&&h<=57343&&r--;let D=e.encode(c.slice(f,r));if(_+=D.byteLength,_>l)return null;a.push(D),f=r,await o()}let U=new Uint8Array(_),y=0;for(let f of a)U.set(f,y),y+=f.byteLength,await o();return U}import{default as qe}from"css-tree/parser";import{default as J}from"css-tree/walker";import{default as Ee}from"css-tree/generator";function we(c,l=[],o=!1,e="https://iam.invalid/",a="masked-default-v2",_=new URL(e).origin){if(a!=="masked-default-v2")throw Error("Unsupported capture privacy");if(c.length>524288||/<\/(?:style|script)/i.test(c))throw Error("CSS budget or boundary");let U=new Set,y=new Set(l),f=qe(c,{context:o?"declarationList":"stylesheet",parseCustomProperty:!0,onParseError:()=>{U.add("CSS_SYNTAX_RECOVERED")}});return J(f,function(r,T,h){if((r.type==="Rule"||r.type==="Atrule")&&r.prelude){let D=Ee(r.prelude);if(ce(D)||Pe(D)!==D)return T&&h&&h.remove(T),U.add("CSS_PRIVATE_SELECTOR_OMITTED"),J.skip}}),J(f,{visit:"Atrule",enter(r,T,h){if(["import","namespace","charset"].includes(r.name.toLowerCase()))return T&&h&&h.remove(T),U.add("CSS_EXTERNAL_RULE_OMITTED"),J.skip}}),J(f,{visit:"Declaration",enter(r,T,h){if(/^(?:content|-moz-binding|behavior)$/i.test(r.property))return T&&h&&h.remove(T),U.add("CSS_CONTENT_OMITTED"),J.skip;let D=Ee(r.value),k=!1;if(k=/(?:password|secret|token|email|phone|(?:user|customer|session|account|tenant)[_-]?id)/i.test(r.property),J(r.value,u=>{(u.type==="Identifier"&&ce(u.name)||(u.type==="String"||u.type==="Hash")&&ce(u.value)||u.type==="Dimension"&&ce(u.unit))&&(k=!0)}),/(?:[\w.%+-]+@[\w.-]+\.[a-z]{2,}|sk_(?:live|test)_\w{12,}|\bBearer\s+|eyJ[\w-]+\.[\w-]+\.)/i.test(D)||k)return T&&h&&h.remove(T),U.add("CSS_PRIVATE_VALUE_OMITTED"),J.skip}}),J(f,r=>{if(r.type==="Raw")throw Error("Unparsed CSS cannot be captured");if(r.type==="Url"){let T="";try{let h=new URL(r.value,e);h.origin===_&&!h.search&&!h.hash&&!h.username&&!h.password&&(T=h.pathname)}catch{}y.has(T)?r.value=T:(r.value="",U.add("CSS_RESOURCE_OMITTED"))}}),{css:Ee(f),gaps:[...U]}}async function Ke(c,l,o,e,a,_,U,y){let f=new Set,r=(u,v=!1)=>{if(u.length>8192)throw Error("Atomic CSS budget");let g=we(u,l.assetPaths,v,o,l.privacy,l.origin);return g.gaps.forEach(p=>a.add(p)),g.css};function T(u){let v;try{v=r(u+(u.startsWith("@keyframes ")?"{from{opacity:1}}":u.startsWith("@")?"{.iam-capture-probe{opacity:1}}":"{opacity:1}"))}catch(p){if(p instanceof Error&&p.message==="Unparsed CSS cannot be captured")return a.add("CSS_SELECTOR_UNSUPPORTED"),"";throw p}let g=v.indexOf("{");return g<0?"":v.slice(0,g+1)}async function h(u){if(u.length>512)throw Error("Atomic CSS budget");let v=0,g=!1,p=[];for(let n=0;n<u.length;n++){await _();let d=u[n],R=u.getPropertyValue(d),C=u.getPropertyPriority(d);if(v+=d.length+R.length+C.length+3,v>8192)throw Error("Atomic CSS budget");p.push({property:d,value:R,priority:C})}if(p.some(n=>n.value==="")){let n=r(u.cssText,!0);return n&&e(n),await _(),!!n}for(let{property:n,value:d,priority:R}of p){await _(),y.cssText="",y.setProperty(n,d,R);let C=r(y.cssText,!0);C&&(g&&e(";"),e(C),g=!0),await _()}return g}async function D(u,v){if(v>20)throw Error("CSS nesting budget");for(let g of u){if(await _(),++U.count>S.maxCssRules)throw Error("CSS rule budget");let p=g.constructor.name;if(p==="CSSImportRule"){let n=g;if(!n.styleSheet){a.add("CSS_EXTERNAL_RULE_OMITTED");continue}let d=n,R=[d.layerName!==null&&d.layerName!==void 0?"@layer "+d.layerName:null,d.supportsText?"@supports "+d.supportsText:null,n.media?.mediaText?"@media "+n.media.mediaText:null].filter(G=>G!==null),C=R.map(T);if(C.some(G=>!G)){a.add("CSS_GROUP_UNSUPPORTED");continue}C.forEach(e),await k(n.styleSheet,v+1),C.forEach(()=>e("}"))}else if(p==="CSSKeyframesRule"){let n=g,d=T("@keyframes "+n.name);if(!d){a.add("CSS_GROUP_UNSUPPORTED");continue}e(d);for(let R of n.cssRules){if(++U.count>S.maxCssRules)throw Error("CSS rule budget");let C=R,G=C.keyText.replace(/\s/g,"");if(!/^(?:(?:from|to|\d+(?:\.\d+)?%)(?:,|$))+$/.test(G)){a.add("CSS_GROUP_UNSUPPORTED");continue}e(G+"{"),await h(C.style),e("}"),await _()}e("}")}else{let n=g,d="cssRules"in g?n.cssRules:null,R=null;if(p==="CSSLayerBlockRule"?R="@layer "+(n.name??""):p==="CSSMediaRule"?R="@media "+n.conditionText:p==="CSSSupportsRule"?R="@supports "+n.conditionText:p==="CSSContainerRule"?R="@container "+n.conditionText:p==="CSSStartingStyleRule"?R="@starting-style":p==="CSSStyleRule"&&(R=n.selectorText??null),R!==null&&(d||p==="CSSStyleRule")){let C=T(R);if(!C){a.add("CSS_GROUP_UNSUPPORTED");continue}e(C),p==="CSSStyleRule"&&n.style&&await h(n.style)&&d?.length&&e(";"),d&&await D(d,v+1),e("}")}else if(d?.length)a.add("CSS_GROUP_UNSUPPORTED");else{let C=g.cssText;if(C.length>32768)throw Error("Atomic CSS budget");e(r(C))}}await _()}}async function k(u,v){if(u.disabled){a.add("DISABLED_STYLESHEET_OMITTED");return}if(f.has(u)){a.add("CSS_IMPORT_CYCLE");return}let g;try{g=u.cssRules}catch{a.add("CROSS_ORIGIN_STYLESHEET");return}f.add(u);let p=o;o=u.href||o;try{let n=u.media?.mediaText,d=n&&n!=="all"?T("@media "+n):"";if(n&&n!=="all"&&!d){a.add("CSS_GROUP_UNSUPPORTED");return}d&&e(d),await D(g,v),d&&e("}")}finally{o=p,f.delete(u)}}await k(c,0)}var i=class extends Error{constructor(o,e){super(o);this.code=o;this.metrics=e}code;metrics},z=()=>performance.now(),je=new URL(import.meta.url).pathname.match(/^\/web-view\/visual-sdk\/([a-f0-9]{64})\//)?.[1],nt=async c=>[...new Uint8Array(await crypto.subtle.digest("SHA-256",c))].map(l=>l.toString(16).padStart(2,"0")).join("");async function Je(c){let{document:l,policy:o,signal:e}=c,a=l.defaultView;if(!he.safeParse(c.label).success)throw new i("PRIVATE_OR_INVALID_LABEL");if(!a||l.hidden||a.location.origin!==o.origin||!l.documentElement.getAttribute("data-indiana-release")?.split(/\s+/).includes(o.manifestDigest))throw new i("SCOPE_OR_VISIBILITY");let _=Ye(o.routes,a.location.pathname);if(!_)throw new i("ROUTE_NOT_ALLOWED");for(let P of[...o.publicSelectors,...o.blockedSelectors])l.querySelector(P);let U=a.location.href,y=z(),f=new Set,r=[],T=[],h=z(),D=0,k=0,u=0,v=0,g="dom",p=()=>{if(e.throwIfAborted(),l.hidden||c.changed()||a.location.origin!==o.origin||a.location.href!==U||!l.documentElement.getAttribute("data-indiana-release")?.split(/\s+/).includes(o.manifestDigest))throw new i("UNSTABLE");if(z()-y>S.deadlineMs)throw new i("DEADLINE")};async function n(P=!1){let M=z()-h;if(!(!P&&M<S.sliceMs)){if(D=Math.max(D,M),k+=M,M>S.maxSliceMs)throw new i("SLICE_BUDGET",{maxSliceMs:D,totalWorkMs:k,elapsedMs:z()-y,phase:g});p(),await new Promise((V,ne)=>{let X=()=>{clearTimeout(re),ne(new i("ABORTED"))},re=setTimeout(()=>{e.removeEventListener("abort",X),V()},0);e.addEventListener("abort",X,{once:!0})}),h=z(),p()}}let d=[{node:l.documentElement,parent:null,depth:0,shadow:!1}],R=[],C=new Map,G=new WeakMap,$=new Map,B=new Map,Q=[],ee=l.adoptedStyleSheets??[];if(l.styleSheets.length+ee.length>S.maxStyleSheets)throw new i("STYLESHEET_BUDGET");function Y(P,M){let V=B.get(M);if(!V?.has(P)){if(R.length>=S.maxStyleSheets)throw new i("STYLESHEET_BUDGET");V||(V=new Set,B.set(M,V)),V.add(P),R.push({sheet:P,hostId:M})}}try{for(;d.length;){await n(),p();let b=d.pop(),E=b.node;if(r.length>=S.maxNodes||b.depth>S.maxDepth)throw new i("NODE_BUDGET");if(E.nodeType!==1&&E.nodeType!==3)continue;let t=E.nodeType===1?E:null;if(me(E))continue;if(t&&(t.tagName==="STYLE"||t.tagName==="LINK")){if(pe(t,o)){f.add("PRIVATE_STYLESHEET_OMITTED");continue}let m=t.sheet;if(m){let N=t.getRootNode(),W=N instanceof a.ShadowRoot?G.get(N):null;W===void 0?f.add("STYLESHEET_SCOPE_UNKNOWN"):($.set(m,W),Y(m,W))}continue}if(t&&ve.has(t.tagName.toLowerCase())){["IFRAME","CANVAS","IMG","PICTURE","VIDEO","AUDIO","OBJECT","EMBED"].includes(t.tagName)&&f.add("NON_DOM_OR_EXTERNAL_OMITTED");continue}if(t){let m=t.getAttributeNames();if(m.length>S.maxAttributes)throw new i("ATTRIBUTE_BUDGET");let N=0;for(let W of m){let oe=t.getAttribute(W)??"";if(N+=oe.length,oe.length>S.maxText||N>8192)throw new i("ATTRIBUTE_BUDGET")}}else if((E.nodeValue?.length??0)>S.maxText)throw new i("TEXT_BUDGET");let H=t&&pe(t,o);if(H&&!["INPUT","TEXTAREA","SELECT"].includes(t.tagName)){f.add("PRIVATE_SUBTREE_OMITTED");continue}let A=t?Me(t,o):{};if(t&&["fill","stroke"].some(m=>/url\s*\(/i.test(t.getAttribute(m)??"")&&!A[m])&&f.add("SVG_RESOURCE_OMITTED"),t?.hasAttribute("data-indiana-id")&&!A["data-indiana-id"]&&f.add("UNKNOWN_ANCHOR_OMITTED"),t?.tagName==="IMG"){let m=Ue(t.getAttribute("src")||"",l.baseURI,o.assetPaths);m?A["data-indiana-asset"]=m:f.add("UNKNOWN_IMAGE_OMITTED")}if(t?.tagName==="DIALOG"&&t.open)try{A.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch{A.rr_open_mode="non-modal"}if(A.style){let m=we(A.style,o.assetPaths,!0,l.baseURI,o.privacy,o.origin);A.style=m.css,m.gaps.forEach(N=>f.add(N))}let I=r.length,F={id:I,parentId:b.parent,kind:t?"element":"text",tag:t?.tagName.toLowerCase()??null,text:t?null:De(E.nodeValue??"",E.parentElement,o),attributes:A,shadow:b.shadow};if(u+=new TextEncoder().encode(JSON.stringify(F)).length,u>S.maxBytes-S.maxCssBytes-4096)throw new i("BYTE_BUDGET");if(r.push(F),t&&Q.push({element:t,id:I}),t&&!H){if(r.length+d.length+t.childNodes.length+(t.shadowRoot?.childNodes.length??0)>S.maxNodes)throw new i("NODE_BUDGET");if(t.shadowRoot){if(C.size>=128)throw new i("SHADOW_BUDGET");c.onShadowRoot?.(t.shadowRoot),C.set(I,[]),G.set(t.shadowRoot,I);let m=t.shadowRoot.adoptedStyleSheets??[];if(m.length>S.maxStyleSheets)throw new i("STYLESHEET_BUDGET");for(let N of m)Y(N,I);for(let N=t.shadowRoot.childNodes.length-1;N>=0;N--)d.push({node:t.shadowRoot.childNodes[N],parent:I,depth:b.depth+1,shadow:!0})}for(let m=E.childNodes.length-1;m>=0;m--)d.push({node:E.childNodes[m],parent:I,depth:b.depth+1,shadow:!1})}}await n(!0),g="css";for(let b of l.styleSheets){await n();let E=b.ownerNode;if(E instanceof a.Element&&pe(E,o)){f.add("PRIVATE_STYLESHEET_OMITTED");continue}$.has(b)?Y(b,$.get(b)):E&&E.getRootNode()===l?Y(b,null):f.add("STYLESHEET_OWNER_UNKNOWN")}for(let b of ee)Y(b,null);let P={count:0},M=l.createElement("span").style;for(let{sheet:b,hostId:E}of R)p(),await Ke(b,o,l.baseURI,t=>{if(v+=new TextEncoder().encode(t).length,v>S.maxCssBytes)throw new i("CSS_BUDGET");(E===null?T:C.get(E)).push(t)},f,()=>n(),P,M);await n(!0),g="scroll",await new Promise((b,E)=>{let t=0,H,A=!1,I=N=>{A||(A=!0,a.cancelAnimationFrame(t),clearTimeout(H),clearTimeout(m),e.removeEventListener("abort",F),N?E(N):b())},F=()=>I(new i("ABORTED"));e.addEventListener("abort",F,{once:!0}),t=a.requestAnimationFrame(()=>{H=setTimeout(()=>I(),0)});let m=setTimeout(()=>I(new i("FRAME_UNAVAILABLE")),250);e.aborted&&F()}),h=z(),p();for(let{element:b,id:E}of Q){for(let[t,H]of[["scrollLeft","rr_scrollLeft"],["scrollTop","rr_scrollTop"]]){let A=b[t];if(!Number.isFinite(A)||Math.abs(A)>1e7)throw new i("SCROLL_BUDGET");A&&(r[E].attributes[H]=String(A))}if(Object.keys(r[E].attributes).length>S.maxAttributes)throw new i("ATTRIBUTE_BUDGET");await n()}await n(!0),g="hash",xe(r),await n(!0),p();let V={nodes:r,css:T.join(""),shadowCss:[...C].map(([b,E])=>({hostId:b,css:E.join("")})),scroll:{x:Math.max(0,a.scrollX),y:Math.max(0,a.scrollY)}},ne={width:Math.max(100,a.innerWidth),height:Math.max(100,a.innerHeight),dpr:a.devicePixelRatio},X={sourceVersionId:o.sourceVersionId,manifestDigest:o.manifestDigest,pageKey:_.pageKey,viewport:ne,document:V,privacy:o.privacy},re=await Se(Ve(X),n),le=new TextEncoder().encode(re);await n(!0);let ue=await nt(le);return h=z(),p(),{format:"indiana-runtime-snapshot",schemaVersion:1,collector:{name:"indiana-bounded-dom",version:2,...je?{buildSha256:je}:{}},...X,routeTemplate:_.path,sequence:c.sequence,label:c.label,contentHash:ue,previousContentHash:c.previousContentHash,gaps:[...f].slice(0,32),metrics:{maxSliceMs:D,totalWorkMs:k,elapsedMs:z()-y}}}catch(P){throw P instanceof i||e.aborted?P:new i(g==="css"?"CSS_UNSUPPORTED":"SERIALIZATION_UNSUPPORTED",{maxSliceMs:D,totalWorkMs:k,elapsedMs:z()-y,phase:g})}finally{Q.length=0,d.length=0,R.length=0}}var ze=1081344,Re=16*1024;function be(c,l,o){return Fe(c,l,o,{message:"CAPTURE_SERVICE_RESPONSE"})}async function Ut(c){if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(c.environmentId))throw Error("Invalid capture environment");let l=c.document??document,o=l.defaultView;if(!o)throw Error("Capture requires a window");let e=o;if(!e.navigator.onLine)throw new i("OFFLINE");let a=c.grant,_=c.onStatus,U=c.transport,y=new URL(c.baseUrl);if(y.pathname!=="/"||y.search||y.hash||y.username||y.password||!Ce(y.origin))throw Error("Invalid capture service origin");let f=new AbortController,r=c.signal?AbortSignal.any([f.signal,c.signal]):f.signal;r.throwIfAborted();let T=y.origin+"/api/app-manifest-captures",h=async s=>{let O=AbortSignal.any([r,AbortSignal.timeout(45e3)]),L=await fetch(T,{method:"POST",credentials:"omit",redirect:"error",cache:"no-store",headers:{Authorization:"Bearer "+a,[se]:ie,"Content-Type":"application/json"},body:JSON.stringify(s),signal:O});if(!L.ok)throw L.body?.cancel().catch(()=>{}),new i("AUTH_OR_SERVICE_"+L.status);if(L.headers.get(se)!==ie)throw L.body?.cancel().catch(()=>{}),new i("CAPTURE_VERSION_MISMATCH");try{return await be(L,s.action==="policy"?ze:Re,O)}catch{throw new i("SERVICE_RESPONSE_INVALID")}},D=performance.now(),k;try{k=ke.parse(await h({action:"policy"}))}catch(s){throw s instanceof i?s:new i("SERVICE_RESPONSE_INVALID")}let{policy:u,progress:v}=k,g=Math.min(k.expiresAt-k.serverTime,9e5)-(performance.now()-D),p=Date.now()+g;if(u.environmentId!==c.environmentId)throw Error("Foreign capture environment");if(g<=0||u.origin!==e.location.origin||!Ce(u.origin))throw Error("Capture authorization expired or foreign origin");let n=0,d=v.sequence,R=v.readyCount,C=v.lastContentHash,G=-1/0,$=!0,B=!1,Q=!1,ee=!1,Y=!1,P=!1,M=!1,V=0,ne=-1/0,X=!1,re=performance.now(),le=performance.now(),ue=e.location.href,de="initial",b=!1,E=!1,t=null,H=null,A=null,I=(s,O,L)=>{try{_?.({state:s,reason:O,snapshots:R,expiresAt:p,pending:+!!t+ +!!H,...L?{metrics:L}:{}})}catch{}},F=()=>{B||M||(M=!0,Y=!0,P=!0,A?.abort(),I("paused","OFFLINE"))};e.addEventListener("offline",F);let m=(s=!1)=>{$=!0,n++,re=performance.now(),s===!0&&(b=!0)},N=new e.MutationObserver(s=>{let O=["[data-indiana-private]","[data-private]",...u.blockedSelectors].join(","),L=!1,Z=!1;for(let w of s.slice(0,16)){if(w.type==="childList"){let K=w.addedNodes.length+w.removedNodes.length;if(K>0&&K<=8&&[...w.addedNodes,...w.removedNodes].every(me))continue}let x=w.target.nodeType===1?w.target:w.target.parentElement;x&&Le(x,O)||(L=!0,(x?.tagName==="DIALOG"||["dialog","menu","listbox","tooltip"].includes(x?.getAttribute("role")??""))&&(Z=!0))}(s.length>16||L)&&m(Z)}),W=new Set,oe=s=>{W.has(s)||(N.observe(s,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),W.add(s))};oe(l);let _e=s=>{let O=s.target instanceof e.Element&&s.target.closest('input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]),textarea,[contenteditable="true"],[contenteditable=""]');O&&["input","beforeinput","compositionend"].includes(s.type)&&(ne=performance.now()),O&&s.type==="compositionstart"&&(X=!0),(s.type==="compositionend"||s.type==="focusout")&&(X=!1),m(s.type==="click"||s.type==="change")},Ae=["input","beforeinput","compositionstart","compositionend","change","click","focusout","popstate","hashchange","resize","scroll","visibilitychange"],Ie=new Set(["input","beforeinput","compositionstart","compositionend","change","click","focusout","scroll","visibilitychange"]);for(let s of Ae)(Ie.has(s)?l:e).addEventListener(s,_e,{capture:!0,passive:!0});let Xe=U??(async(s,O,L,Z)=>{let w=[...new Uint8Array(await crypto.subtle.digest("SHA-256",O))].map(Te=>Te.toString(16).padStart(2,"0")).join(""),x=Be.parse(await h({action:"register",requestId:Z,sha256:w,bytes:O.byteLength,pageKey:s.pageKey,sequence:s.sequence,contentHash:s.contentHash}));if(x.ready)return;let K=new URL(T+"/"+x.versionId+"/content"),q=AbortSignal.any([L,AbortSignal.timeout(9e4)]),j=await fetch(K,{method:"PUT",body:O,headers:{Authorization:"Bearer "+a,[se]:ie,"Content-Type":"application/json"},credentials:"omit",redirect:"error",signal:q});if(!j.ok)throw j.body?.cancel().catch(()=>{}),new i("UPLOAD_"+j.status);if(j.headers.get(se)!==ie)throw j.body?.cancel().catch(()=>{}),new i("CAPTURE_VERSION_MISMATCH");if(He.parse(await be(j,Re,q)).versionId!==x.versionId)throw new i("SERVICE_RESPONSE_INVALID")}),$e=e.setInterval(()=>{Ze()},250),Qe=e.setTimeout(()=>te("EXPIRED"),Math.min(p-Date.now(),9e5));async function ae(){if(B||ee||P)return;if(H||(H=t,t=null),!H){d>=S.maxSnapshots&&!Q&&te("QUOTA");return}ee=!0;let s=H;I("uploading",void 0,s.metrics);try{if(await Xe(s.snapshot,s.bytes,r,s.requestId),B)return;R++,H=null,E=!1,I(M?"paused":"idle",M?"OFFLINE":void 0)}catch(O){if(B)return;let L=O instanceof i?O.code:"UPLOAD_FAILED";if(L==="CAPTURE_VERSION_MISMATCH"||/^(?:AUTH_OR_SERVICE|UPLOAD)_426$/.test(L)){te("CAPTURE_UPGRADE_REQUIRED");return}if(/^(?:AUTH_OR_SERVICE|UPLOAD)_(?:401|403|409)$/.test(L)){te("REVOKED_OR_CHANGED");return}P=!0,I("paused",M?"OFFLINE":L)}finally{ee=!1,!B&&!P&&ae()}}async function Ze(){if(B||Q||r.aborted)return;if(!e.navigator.onLine){F();return}if(e.location.href!==ue&&(ue=e.location.href,de="navigation",Y=!1,V=0,m(!0)),Y||P)return;let s=!1;for(let w of W)w instanceof e.ShadowRoot&&!w.host.isConnected&&(W.delete(w),s=!0);if(s){N.takeRecords().length&&m(),N.disconnect();for(let w of W)N.observe(w,{childList:!0,attributes:!0,characterData:!0,subtree:!0})}if(d>=S.maxSnapshots){ae();return}if(performance.now()-le>15e3&&(le=performance.now(),m()),!$||l.hidden||!e.navigator.onLine||performance.now()-re<S.quietMs||performance.now()-G<(b?S.urgentIntervalMs:S.minIntervalMs)||X||performance.now()-ne<1e3)return;if(t&&H){E||(E=!0,I("waiting","UPLOAD_BACKPRESSURE"));return}Q=!0;let O=n,L=de;b=!1,A=new AbortController;let Z=AbortSignal.any([r,A.signal]);I("capturing");try{let w=await Je({document:l,policy:u,sequence:d+1,label:L,previousContentHash:C,signal:Z,changed:()=>n!==O,onShadowRoot:oe});if(B)return;if(w.contentHash===C){$=n!==O,I(ee?"uploading":"idle");return}let x=performance.now(),K=0,q=0,j=x,ge=async()=>{let fe=performance.now()-x;if(fe>=S.sliceMs){if(K+=fe,q=Math.max(q,fe),fe>S.maxSliceMs)throw new i("ENCODING_BUDGET",{maxSliceMs:q,totalWorkMs:K,elapsedMs:performance.now()-j,phase:"encoding"});await new Promise(et=>setTimeout(et,0)),Z.throwIfAborted(),x=performance.now()}},Te=await Se(w,ge),ye=await We(Te,S.maxBytes,ge);if(!ye)throw new i("BYTE_BUDGET");let Ne=performance.now()-x;if(K+=Ne,q=Math.max(q,Ne),q>S.maxSliceMs)throw new i("ENCODING_BUDGET",{maxSliceMs:q,totalWorkMs:K,elapsedMs:performance.now()-j,phase:"encoding"});if(ye.length>S.maxBytes)throw new i("BYTE_BUDGET");Z.throwIfAborted(),t={snapshot:w,bytes:ye,requestId:crypto.randomUUID(),metrics:{maxSliceMs:Math.max(w.metrics.maxSliceMs,q),totalWorkMs:w.metrics.totalWorkMs+K,elapsedMs:w.metrics.elapsedMs+performance.now()-j,phase:"capture-and-encoding"}},d=w.sequence,C=w.contentHash,G=performance.now(),$=n!==O,V=0,E=!1,ae()}catch(w){if(B)return;let x=w instanceof i?w.code:"CAPTURE_FAILED";G=performance.now(),["UNSTABLE","ROUTE_NOT_ALLOWED","SCOPE_OR_VISIBILITY"].includes(x)&&++V<3?I("idle",x):(Y=!0,I("paused",M?"OFFLINE":x,w instanceof i?w.metrics:void 0))}finally{Q=!1,A=null}}function te(s="DESTROYED"){if(!B){B=!0,r.removeEventListener("abort",Oe),f.abort(),A?.abort(),N.disconnect(),W.clear(),t=null,H=null,a="",e.clearInterval($e),e.clearTimeout(Qe),e.removeEventListener("offline",F);for(let O of Ae)(Ie.has(O)?l:e).removeEventListener(O,_e,!0);I("stopped",s)}}let Oe=()=>te("ABORTED");return r.addEventListener("abort",Oe,{once:!0}),r.aborted&&te("ABORTED"),B||(e.navigator.onLine?I("idle"):F()),{checkpoint(s="checkpoint"){if(!B){if(!he.safeParse(s).success)throw Error("Invalid checkpoint label");if(de=s,!e.navigator.onLine){F();return}M=!1,Y=!1,P=!1,V=0,m(!0),ae()}},retry(){if(!B){if(!e.navigator.onLine){F();return}M=!1,Y=!1,P=!1,V=0,ae()}},destroy:te,get paused(){return Y||P},get snapshots(){return R}}}export{Ut as startCapture};
|
|
1
|
+
import{a as Fe}from"./chunk-WCFVNF5D.js";import{a as Ue,b as ve,c as Pe,d as ce,e as Le,f as pe,g as De,h as Me,i as xe,j as he,k as S,l as ke,m as Be,n as He,o as Ve,p as Ge,q as Ye}from"./chunk-U6S6AZM6.js";import{a as Ce,b as se,c as ie}from"./chunk-4K25DELJ.js";function me(c){return c.nodeType===1&&c.hasAttribute("data-indiana-capture-controls")&&c.hasAttribute("data-indiana-private")}async function Se(c,l){let o=[];async function e(a){if(a===null||typeof a!="object"){o.push(Ge(a));return}let _=Array.isArray(a),U=_?Object.keys(a):Object.keys(a).sort();o.push(_?"[":"{");for(let y=0;y<U.length;y++)y&&o.push(","),_||o.push(JSON.stringify(U[y]),":"),await e(a[U[y]]),await l();o.push(_?"]":"}")}return await e(c),o.join("")}async function We(c,l,o){if(!Number.isSafeInteger(l)||l<0)throw new RangeError("Invalid byte limit");if(c.length>l)return null;let e=new TextEncoder,a=[],_=0;for(let f=0;f<c.length;){let r=Math.min(c.length,f+4096),T=c.charCodeAt(r-1),h=c.charCodeAt(r);r<c.length&&T>=55296&&T<=56319&&h>=56320&&h<=57343&&r--;let D=e.encode(c.slice(f,r));if(_+=D.byteLength,_>l)return null;a.push(D),f=r,await o()}let U=new Uint8Array(_),y=0;for(let f of a)U.set(f,y),y+=f.byteLength,await o();return U}import{default as qe}from"css-tree/parser";import{default as J}from"css-tree/walker";import{default as Ee}from"css-tree/generator";function we(c,l=[],o=!1,e="https://iam.invalid/",a="masked-default-v2",_=new URL(e).origin){if(a!=="masked-default-v2")throw Error("Unsupported capture privacy");if(c.length>524288||/<\/(?:style|script)/i.test(c))throw Error("CSS budget or boundary");let U=new Set,y=new Set(l),f=qe(c,{context:o?"declarationList":"stylesheet",parseCustomProperty:!0,onParseError:()=>{U.add("CSS_SYNTAX_RECOVERED")}});return J(f,function(r,T,h){if((r.type==="Rule"||r.type==="Atrule")&&r.prelude){let D=Ee(r.prelude);if(ce(D)||Pe(D)!==D)return T&&h&&h.remove(T),U.add("CSS_PRIVATE_SELECTOR_OMITTED"),J.skip}}),J(f,{visit:"Atrule",enter(r,T,h){if(["import","namespace","charset"].includes(r.name.toLowerCase()))return T&&h&&h.remove(T),U.add("CSS_EXTERNAL_RULE_OMITTED"),J.skip}}),J(f,{visit:"Declaration",enter(r,T,h){if(/^(?:content|-moz-binding|behavior)$/i.test(r.property))return T&&h&&h.remove(T),U.add("CSS_CONTENT_OMITTED"),J.skip;let D=Ee(r.value),k=!1;if(k=/(?:password|secret|token|email|phone|(?:user|customer|session|account|tenant)[_-]?id)/i.test(r.property),J(r.value,u=>{(u.type==="Identifier"&&ce(u.name)||(u.type==="String"||u.type==="Hash")&&ce(u.value)||u.type==="Dimension"&&ce(u.unit))&&(k=!0)}),/(?:[\w.%+-]+@[\w.-]+\.[a-z]{2,}|sk_(?:live|test)_\w{12,}|\bBearer\s+|eyJ[\w-]+\.[\w-]+\.)/i.test(D)||k)return T&&h&&h.remove(T),U.add("CSS_PRIVATE_VALUE_OMITTED"),J.skip}}),J(f,r=>{if(r.type==="Raw")throw Error("Unparsed CSS cannot be captured");if(r.type==="Url"){let T="";try{let h=new URL(r.value,e);h.origin===_&&!h.search&&!h.hash&&!h.username&&!h.password&&(T=h.pathname)}catch{}y.has(T)?r.value=T:(r.value="",U.add("CSS_RESOURCE_OMITTED"))}}),{css:Ee(f),gaps:[...U]}}async function Ke(c,l,o,e,a,_,U,y){let f=new Set,r=(u,v=!1)=>{if(u.length>8192)throw Error("Atomic CSS budget");let g=we(u,l.assetPaths,v,o,l.privacy,l.origin);return g.gaps.forEach(p=>a.add(p)),g.css};function T(u){let v;try{v=r(u+(u.startsWith("@keyframes ")?"{from{opacity:1}}":u.startsWith("@")?"{.iam-capture-probe{opacity:1}}":"{opacity:1}"))}catch(p){if(p instanceof Error&&p.message==="Unparsed CSS cannot be captured")return a.add("CSS_SELECTOR_UNSUPPORTED"),"";throw p}let g=v.indexOf("{");return g<0?"":v.slice(0,g+1)}async function h(u){if(u.length>512)throw Error("Atomic CSS budget");let v=0,g=!1,p=[];for(let n=0;n<u.length;n++){await _();let d=u[n],R=u.getPropertyValue(d),C=u.getPropertyPriority(d);if(v+=d.length+R.length+C.length+3,v>8192)throw Error("Atomic CSS budget");p.push({property:d,value:R,priority:C})}if(p.some(n=>n.value==="")){let n=r(u.cssText,!0);return n&&e(n),await _(),!!n}for(let{property:n,value:d,priority:R}of p){await _(),y.cssText="",y.setProperty(n,d,R);let C=r(y.cssText,!0);C&&(g&&e(";"),e(C),g=!0),await _()}return g}async function D(u,v){if(v>20)throw Error("CSS nesting budget");for(let g of u){if(await _(),++U.count>S.maxCssRules)throw Error("CSS rule budget");let p=g.constructor.name;if(p==="CSSImportRule"){let n=g;if(!n.styleSheet){a.add("CSS_EXTERNAL_RULE_OMITTED");continue}let d=n,R=[d.layerName!==null&&d.layerName!==void 0?"@layer "+d.layerName:null,d.supportsText?"@supports "+d.supportsText:null,n.media?.mediaText?"@media "+n.media.mediaText:null].filter(G=>G!==null),C=R.map(T);if(C.some(G=>!G)){a.add("CSS_GROUP_UNSUPPORTED");continue}C.forEach(e),await k(n.styleSheet,v+1),C.forEach(()=>e("}"))}else if(p==="CSSKeyframesRule"){let n=g,d=T("@keyframes "+n.name);if(!d){a.add("CSS_GROUP_UNSUPPORTED");continue}e(d);for(let R of n.cssRules){if(++U.count>S.maxCssRules)throw Error("CSS rule budget");let C=R,G=C.keyText.replace(/\s/g,"");if(!/^(?:(?:from|to|\d+(?:\.\d+)?%)(?:,|$))+$/.test(G)){a.add("CSS_GROUP_UNSUPPORTED");continue}e(G+"{"),await h(C.style),e("}"),await _()}e("}")}else{let n=g,d="cssRules"in g?n.cssRules:null,R=null;if(p==="CSSLayerBlockRule"?R="@layer "+(n.name??""):p==="CSSMediaRule"?R="@media "+n.conditionText:p==="CSSSupportsRule"?R="@supports "+n.conditionText:p==="CSSContainerRule"?R="@container "+n.conditionText:p==="CSSStartingStyleRule"?R="@starting-style":p==="CSSStyleRule"&&(R=n.selectorText??null),R!==null&&(d||p==="CSSStyleRule")){let C=T(R);if(!C){a.add("CSS_GROUP_UNSUPPORTED");continue}e(C),p==="CSSStyleRule"&&n.style&&await h(n.style)&&d?.length&&e(";"),d&&await D(d,v+1),e("}")}else if(d?.length)a.add("CSS_GROUP_UNSUPPORTED");else{let C=g.cssText;if(C.length>32768)throw Error("Atomic CSS budget");e(r(C))}}await _()}}async function k(u,v){if(u.disabled){a.add("DISABLED_STYLESHEET_OMITTED");return}if(f.has(u)){a.add("CSS_IMPORT_CYCLE");return}let g;try{g=u.cssRules}catch{a.add("CROSS_ORIGIN_STYLESHEET");return}f.add(u);let p=o;o=u.href||o;try{let n=u.media?.mediaText,d=n&&n!=="all"?T("@media "+n):"";if(n&&n!=="all"&&!d){a.add("CSS_GROUP_UNSUPPORTED");return}d&&e(d),await D(g,v),d&&e("}")}finally{o=p,f.delete(u)}}await k(c,0)}var i=class extends Error{constructor(o,e){super(o);this.code=o;this.metrics=e}code;metrics},z=()=>performance.now(),je=new URL(import.meta.url).pathname.match(/^\/web-view\/visual-sdk\/([a-f0-9]{64})\//)?.[1],nt=async c=>[...new Uint8Array(await crypto.subtle.digest("SHA-256",c))].map(l=>l.toString(16).padStart(2,"0")).join("");async function Je(c){let{document:l,policy:o,signal:e}=c,a=l.defaultView;if(!he.safeParse(c.label).success)throw new i("PRIVATE_OR_INVALID_LABEL");if(!a||l.hidden||a.location.origin!==o.origin||!l.documentElement.getAttribute("data-indiana-release")?.split(/\s+/).includes(o.manifestDigest))throw new i("SCOPE_OR_VISIBILITY");let _=Ye(o.routes,a.location.pathname);if(!_)throw new i("ROUTE_NOT_ALLOWED");for(let P of[...o.publicSelectors,...o.blockedSelectors])l.querySelector(P);let U=a.location.href,y=z(),f=new Set,r=[],T=[],h=z(),D=0,k=0,u=0,v=0,g="dom",p=()=>{if(e.throwIfAborted(),l.hidden||c.changed()||a.location.origin!==o.origin||a.location.href!==U||!l.documentElement.getAttribute("data-indiana-release")?.split(/\s+/).includes(o.manifestDigest))throw new i("UNSTABLE");if(z()-y>S.deadlineMs)throw new i("DEADLINE")};async function n(P=!1){let M=z()-h;if(!(!P&&M<S.sliceMs)){if(D=Math.max(D,M),k+=M,M>S.maxSliceMs)throw new i("SLICE_BUDGET",{maxSliceMs:D,totalWorkMs:k,elapsedMs:z()-y,phase:g});p(),await new Promise((V,ne)=>{let X=()=>{clearTimeout(re),ne(new i("ABORTED"))},re=setTimeout(()=>{e.removeEventListener("abort",X),V()},0);e.addEventListener("abort",X,{once:!0})}),h=z(),p()}}let d=[{node:l.documentElement,parent:null,depth:0,shadow:!1}],R=[],C=new Map,G=new WeakMap,$=new Map,B=new Map,Q=[],ee=l.adoptedStyleSheets??[];if(l.styleSheets.length+ee.length>S.maxStyleSheets)throw new i("STYLESHEET_BUDGET");function Y(P,M){let V=B.get(M);if(!V?.has(P)){if(R.length>=S.maxStyleSheets)throw new i("STYLESHEET_BUDGET");V||(V=new Set,B.set(M,V)),V.add(P),R.push({sheet:P,hostId:M})}}try{for(;d.length;){await n(),p();let b=d.pop(),E=b.node;if(r.length>=S.maxNodes||b.depth>S.maxDepth)throw new i("NODE_BUDGET");if(E.nodeType!==1&&E.nodeType!==3)continue;let t=E.nodeType===1?E:null;if(me(E))continue;if(t&&(t.tagName==="STYLE"||t.tagName==="LINK")){if(pe(t,o)){f.add("PRIVATE_STYLESHEET_OMITTED");continue}let m=t.sheet;if(m){let N=t.getRootNode(),W=N instanceof a.ShadowRoot?G.get(N):null;W===void 0?f.add("STYLESHEET_SCOPE_UNKNOWN"):($.set(m,W),Y(m,W))}continue}if(t&&ve.has(t.tagName.toLowerCase())){["IFRAME","CANVAS","IMG","PICTURE","VIDEO","AUDIO","OBJECT","EMBED"].includes(t.tagName)&&f.add("NON_DOM_OR_EXTERNAL_OMITTED");continue}if(t){let m=t.getAttributeNames();if(m.length>S.maxAttributes)throw new i("ATTRIBUTE_BUDGET");let N=0;for(let W of m){let oe=t.getAttribute(W)??"";if(N+=oe.length,oe.length>S.maxText||N>8192)throw new i("ATTRIBUTE_BUDGET")}}else if((E.nodeValue?.length??0)>S.maxText)throw new i("TEXT_BUDGET");let H=t&&pe(t,o);if(H&&!["INPUT","TEXTAREA","SELECT"].includes(t.tagName)){f.add("PRIVATE_SUBTREE_OMITTED");continue}let A=t?Me(t,o):{};if(t&&["fill","stroke"].some(m=>/url\s*\(/i.test(t.getAttribute(m)??"")&&!A[m])&&f.add("SVG_RESOURCE_OMITTED"),t?.hasAttribute("data-indiana-id")&&!A["data-indiana-id"]&&f.add("UNKNOWN_ANCHOR_OMITTED"),t?.tagName==="IMG"){let m=Ue(t.getAttribute("src")||"",l.baseURI,o.assetPaths);m?A["data-indiana-asset"]=m:f.add("UNKNOWN_IMAGE_OMITTED")}if(t?.tagName==="DIALOG"&&t.open)try{A.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch{A.rr_open_mode="non-modal"}if(A.style){let m=we(A.style,o.assetPaths,!0,l.baseURI,o.privacy,o.origin);A.style=m.css,m.gaps.forEach(N=>f.add(N))}let I=r.length,F={id:I,parentId:b.parent,kind:t?"element":"text",tag:t?.tagName.toLowerCase()??null,text:t?null:De(E.nodeValue??"",E.parentElement,o),attributes:A,shadow:b.shadow};if(u+=new TextEncoder().encode(JSON.stringify(F)).length,u>S.maxBytes-S.maxCssBytes-4096)throw new i("BYTE_BUDGET");if(r.push(F),t&&Q.push({element:t,id:I}),t&&!H){if(r.length+d.length+t.childNodes.length+(t.shadowRoot?.childNodes.length??0)>S.maxNodes)throw new i("NODE_BUDGET");if(t.shadowRoot){if(C.size>=128)throw new i("SHADOW_BUDGET");c.onShadowRoot?.(t.shadowRoot),C.set(I,[]),G.set(t.shadowRoot,I);let m=t.shadowRoot.adoptedStyleSheets??[];if(m.length>S.maxStyleSheets)throw new i("STYLESHEET_BUDGET");for(let N of m)Y(N,I);for(let N=t.shadowRoot.childNodes.length-1;N>=0;N--)d.push({node:t.shadowRoot.childNodes[N],parent:I,depth:b.depth+1,shadow:!0})}for(let m=E.childNodes.length-1;m>=0;m--)d.push({node:E.childNodes[m],parent:I,depth:b.depth+1,shadow:!1})}}await n(!0),g="css";for(let b of l.styleSheets){await n();let E=b.ownerNode;if(E instanceof a.Element&&pe(E,o)){f.add("PRIVATE_STYLESHEET_OMITTED");continue}$.has(b)?Y(b,$.get(b)):E&&E.getRootNode()===l?Y(b,null):f.add("STYLESHEET_OWNER_UNKNOWN")}for(let b of ee)Y(b,null);let P={count:0},M=l.createElement("span").style;for(let{sheet:b,hostId:E}of R)p(),await Ke(b,o,l.baseURI,t=>{if(v+=new TextEncoder().encode(t).length,v>S.maxCssBytes)throw new i("CSS_BUDGET");(E===null?T:C.get(E)).push(t)},f,()=>n(),P,M);await n(!0),g="scroll",await new Promise((b,E)=>{let t=0,H,A=!1,I=N=>{A||(A=!0,a.cancelAnimationFrame(t),clearTimeout(H),clearTimeout(m),e.removeEventListener("abort",F),N?E(N):b())},F=()=>I(new i("ABORTED"));e.addEventListener("abort",F,{once:!0}),t=a.requestAnimationFrame(()=>{H=setTimeout(()=>I(),0)});let m=setTimeout(()=>I(new i("FRAME_UNAVAILABLE")),250);e.aborted&&F()}),h=z(),p();for(let{element:b,id:E}of Q){for(let[t,H]of[["scrollLeft","rr_scrollLeft"],["scrollTop","rr_scrollTop"]]){let A=b[t];if(!Number.isFinite(A)||Math.abs(A)>1e7)throw new i("SCROLL_BUDGET");A&&(r[E].attributes[H]=String(A))}if(Object.keys(r[E].attributes).length>S.maxAttributes)throw new i("ATTRIBUTE_BUDGET");await n()}await n(!0),g="hash",xe(r),await n(!0),p();let V={nodes:r,css:T.join(""),shadowCss:[...C].map(([b,E])=>({hostId:b,css:E.join("")})),scroll:{x:Math.max(0,a.scrollX),y:Math.max(0,a.scrollY)}},ne={width:Math.max(100,a.innerWidth),height:Math.max(100,a.innerHeight),dpr:a.devicePixelRatio},X={sourceVersionId:o.sourceVersionId,manifestDigest:o.manifestDigest,pageKey:_.pageKey,viewport:ne,document:V,privacy:o.privacy},re=await Se(Ve(X),n),le=new TextEncoder().encode(re);await n(!0);let ue=await nt(le);return h=z(),p(),{format:"indiana-runtime-snapshot",schemaVersion:1,collector:{name:"indiana-bounded-dom",version:2,...je?{buildSha256:je}:{}},...X,routeTemplate:_.path,sequence:c.sequence,label:c.label,contentHash:ue,previousContentHash:c.previousContentHash,gaps:[...f].slice(0,32),metrics:{maxSliceMs:D,totalWorkMs:k,elapsedMs:z()-y}}}catch(P){throw P instanceof i||e.aborted?P:new i(g==="css"?"CSS_UNSUPPORTED":"SERIALIZATION_UNSUPPORTED",{maxSliceMs:D,totalWorkMs:k,elapsedMs:z()-y,phase:g})}finally{Q.length=0,d.length=0,R.length=0}}var ze=1081344,Re=16*1024;function be(c,l,o){return Fe(c,l,o,{message:"CAPTURE_SERVICE_RESPONSE"})}async function Ut(c){if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(c.environmentId))throw Error("Invalid capture environment");let l=c.document??document,o=l.defaultView;if(!o)throw Error("Capture requires a window");let e=o;if(!e.navigator.onLine)throw new i("OFFLINE");let a=c.grant,_=c.onStatus,U=c.transport,y=new URL(c.baseUrl);if(y.pathname!=="/"||y.search||y.hash||y.username||y.password||!Ce(y.origin))throw Error("Invalid capture service origin");let f=new AbortController,r=c.signal?AbortSignal.any([f.signal,c.signal]):f.signal;r.throwIfAborted();let T=y.origin+"/api/app-manifest-captures",h=async s=>{let O=AbortSignal.any([r,AbortSignal.timeout(45e3)]),L=await fetch(T,{method:"POST",credentials:"omit",redirect:"error",cache:"no-store",headers:{Authorization:"Bearer "+a,[se]:ie,"Content-Type":"application/json"},body:JSON.stringify(s),signal:O});if(!L.ok)throw L.body?.cancel().catch(()=>{}),new i("AUTH_OR_SERVICE_"+L.status);if(L.headers.get(se)!==ie)throw L.body?.cancel().catch(()=>{}),new i("CAPTURE_VERSION_MISMATCH");try{return await be(L,s.action==="policy"?ze:Re,O)}catch{throw new i("SERVICE_RESPONSE_INVALID")}},D=performance.now(),k;try{k=ke.parse(await h({action:"policy"}))}catch(s){throw s instanceof i?s:new i("SERVICE_RESPONSE_INVALID")}let{policy:u,progress:v}=k,g=Math.min(k.expiresAt-k.serverTime,9e5)-(performance.now()-D),p=Date.now()+g;if(u.environmentId!==c.environmentId)throw Error("Foreign capture environment");if(g<=0||u.origin!==e.location.origin||!Ce(u.origin))throw Error("Capture authorization expired or foreign origin");let n=0,d=v.sequence,R=v.readyCount,C=v.lastContentHash,G=-1/0,$=!0,B=!1,Q=!1,ee=!1,Y=!1,P=!1,M=!1,V=0,ne=-1/0,X=!1,re=performance.now(),le=performance.now(),ue=e.location.href,de="initial",b=!1,E=!1,t=null,H=null,A=null,I=(s,O,L)=>{try{_?.({state:s,reason:O,snapshots:R,expiresAt:p,pending:+!!t+ +!!H,...L?{metrics:L}:{}})}catch{}},F=()=>{B||M||(M=!0,Y=!0,P=!0,A?.abort(),I("paused","OFFLINE"))};e.addEventListener("offline",F);let m=(s=!1)=>{$=!0,n++,re=performance.now(),s===!0&&(b=!0)},N=new e.MutationObserver(s=>{let O=["[data-indiana-private]","[data-private]",...u.blockedSelectors].join(","),L=!1,Z=!1;for(let w of s.slice(0,16)){if(w.type==="childList"){let K=w.addedNodes.length+w.removedNodes.length;if(K>0&&K<=8&&[...w.addedNodes,...w.removedNodes].every(me))continue}let x=w.target.nodeType===1?w.target:w.target.parentElement;x&&Le(x,O)||(L=!0,(x?.tagName==="DIALOG"||["dialog","menu","listbox","tooltip"].includes(x?.getAttribute("role")??""))&&(Z=!0))}(s.length>16||L)&&m(Z)}),W=new Set,oe=s=>{W.has(s)||(N.observe(s,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),W.add(s))};oe(l);let _e=s=>{let O=s.target instanceof e.Element&&s.target.closest('input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]),textarea,[contenteditable="true"],[contenteditable=""]');O&&["input","beforeinput","compositionend"].includes(s.type)&&(ne=performance.now()),O&&s.type==="compositionstart"&&(X=!0),(s.type==="compositionend"||s.type==="focusout")&&(X=!1),m(s.type==="click"||s.type==="change")},Ae=["input","beforeinput","compositionstart","compositionend","change","click","focusout","popstate","hashchange","resize","scroll","visibilitychange"],Ie=new Set(["input","beforeinput","compositionstart","compositionend","change","click","focusout","scroll","visibilitychange"]);for(let s of Ae)(Ie.has(s)?l:e).addEventListener(s,_e,{capture:!0,passive:!0});let Xe=U??(async(s,O,L,Z)=>{let w=[...new Uint8Array(await crypto.subtle.digest("SHA-256",O))].map(Te=>Te.toString(16).padStart(2,"0")).join(""),x=Be.parse(await h({action:"register",requestId:Z,sha256:w,bytes:O.byteLength,pageKey:s.pageKey,sequence:s.sequence,contentHash:s.contentHash}));if(x.ready)return;let K=new URL(T+"/"+x.versionId+"/content"),q=AbortSignal.any([L,AbortSignal.timeout(9e4)]),j=await fetch(K,{method:"PUT",body:O,headers:{Authorization:"Bearer "+a,[se]:ie,"Content-Type":"application/json"},credentials:"omit",redirect:"error",signal:q});if(!j.ok)throw j.body?.cancel().catch(()=>{}),new i("UPLOAD_"+j.status);if(j.headers.get(se)!==ie)throw j.body?.cancel().catch(()=>{}),new i("CAPTURE_VERSION_MISMATCH");if(He.parse(await be(j,Re,q)).versionId!==x.versionId)throw new i("SERVICE_RESPONSE_INVALID")}),$e=e.setInterval(()=>{Ze()},250),Qe=e.setTimeout(()=>te("EXPIRED"),Math.min(p-Date.now(),9e5));async function ae(){if(B||ee||P)return;if(H||(H=t,t=null),!H){d>=S.maxSnapshots&&!Q&&te("QUOTA");return}ee=!0;let s=H;I("uploading",void 0,s.metrics);try{if(await Xe(s.snapshot,s.bytes,r,s.requestId),B)return;R++,H=null,E=!1,I(M?"paused":"idle",M?"OFFLINE":void 0)}catch(O){if(B)return;let L=O instanceof i?O.code:"UPLOAD_FAILED";if(L==="CAPTURE_VERSION_MISMATCH"||/^(?:AUTH_OR_SERVICE|UPLOAD)_426$/.test(L)){te("CAPTURE_UPGRADE_REQUIRED");return}if(/^(?:AUTH_OR_SERVICE|UPLOAD)_(?:401|403|409)$/.test(L)){te("REVOKED_OR_CHANGED");return}P=!0,I("paused",M?"OFFLINE":L)}finally{ee=!1,!B&&!P&&ae()}}async function Ze(){if(B||Q||r.aborted)return;if(!e.navigator.onLine){F();return}if(e.location.href!==ue&&(ue=e.location.href,de="navigation",Y=!1,V=0,m(!0)),Y||P)return;let s=!1;for(let w of W)w instanceof e.ShadowRoot&&!w.host.isConnected&&(W.delete(w),s=!0);if(s){N.takeRecords().length&&m(),N.disconnect();for(let w of W)N.observe(w,{childList:!0,attributes:!0,characterData:!0,subtree:!0})}if(d>=S.maxSnapshots){ae();return}if(performance.now()-le>15e3&&(le=performance.now(),m()),!$||l.hidden||!e.navigator.onLine||performance.now()-re<S.quietMs||performance.now()-G<(b?S.urgentIntervalMs:S.minIntervalMs)||X||performance.now()-ne<1e3)return;if(t&&H){E||(E=!0,I("waiting","UPLOAD_BACKPRESSURE"));return}Q=!0;let O=n,L=de;b=!1,A=new AbortController;let Z=AbortSignal.any([r,A.signal]);I("capturing");try{let w=await Je({document:l,policy:u,sequence:d+1,label:L,previousContentHash:C,signal:Z,changed:()=>n!==O,onShadowRoot:oe});if(B)return;if(w.contentHash===C){$=n!==O,I(ee?"uploading":"idle");return}let x=performance.now(),K=0,q=0,j=x,ge=async()=>{let fe=performance.now()-x;if(fe>=S.sliceMs){if(K+=fe,q=Math.max(q,fe),fe>S.maxSliceMs)throw new i("ENCODING_BUDGET",{maxSliceMs:q,totalWorkMs:K,elapsedMs:performance.now()-j,phase:"encoding"});await new Promise(et=>setTimeout(et,0)),Z.throwIfAborted(),x=performance.now()}},Te=await Se(w,ge),ye=await We(Te,S.maxBytes,ge);if(!ye)throw new i("BYTE_BUDGET");let Ne=performance.now()-x;if(K+=Ne,q=Math.max(q,Ne),q>S.maxSliceMs)throw new i("ENCODING_BUDGET",{maxSliceMs:q,totalWorkMs:K,elapsedMs:performance.now()-j,phase:"encoding"});if(ye.length>S.maxBytes)throw new i("BYTE_BUDGET");Z.throwIfAborted(),t={snapshot:w,bytes:ye,requestId:crypto.randomUUID(),metrics:{maxSliceMs:Math.max(w.metrics.maxSliceMs,q),totalWorkMs:w.metrics.totalWorkMs+K,elapsedMs:w.metrics.elapsedMs+performance.now()-j,phase:"capture-and-encoding"}},d=w.sequence,C=w.contentHash,G=performance.now(),$=n!==O,V=0,E=!1,ae()}catch(w){if(B)return;let x=w instanceof i?w.code:"CAPTURE_FAILED";G=performance.now(),["UNSTABLE","ROUTE_NOT_ALLOWED","SCOPE_OR_VISIBILITY"].includes(x)&&++V<3?I("idle",x):(Y=!0,I("paused",M?"OFFLINE":x,w instanceof i?w.metrics:void 0))}finally{Q=!1,A=null}}function te(s="DESTROYED"){if(!B){B=!0,r.removeEventListener("abort",Oe),f.abort(),A?.abort(),N.disconnect(),W.clear(),t=null,H=null,a="",e.clearInterval($e),e.clearTimeout(Qe),e.removeEventListener("offline",F);for(let O of Ae)(Ie.has(O)?l:e).removeEventListener(O,_e,!0);I("stopped",s)}}let Oe=()=>te("ABORTED");return r.addEventListener("abort",Oe,{once:!0}),r.aborted&&te("ABORTED"),B||(e.navigator.onLine?I("idle"):F()),{checkpoint(s="checkpoint"){if(!B){if(!he.safeParse(s).success)throw Error("Invalid checkpoint label");if(de=s,!e.navigator.onLine){F();return}M=!1,Y=!1,P=!1,V=0,m(!0),ae()}},retry(){if(!B){if(!e.navigator.onLine){F();return}M=!1,Y=!1,P=!1,V=0,ae()}},destroy:te,get paused(){return Y||P},get snapshots(){return R}}}export{Ut as startCapture};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { S as StackNode } from './screen-
|
|
2
|
+
import { S as StackNode } from './screen-iFngkxaL.js';
|
|
3
3
|
|
|
4
4
|
declare const configurationScopeSchema: z.ZodObject<{
|
|
5
5
|
projectId: z.ZodString;
|
|
@@ -32,6 +32,7 @@ declare const sdkConfigurationManifestSchema: z.ZodObject<{
|
|
|
32
32
|
}, z.core.$strict>;
|
|
33
33
|
artifacts: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
34
34
|
kind: z.ZodEnum<{
|
|
35
|
+
paywall: "paywall";
|
|
35
36
|
funnel: "funnel";
|
|
36
37
|
gb_features: "gb_features";
|
|
37
38
|
gb_page_experiments: "gb_page_experiments";
|
|
@@ -66,6 +67,19 @@ declare const sdkConfigurationManifestSchema: z.ZodObject<{
|
|
|
66
67
|
couponDigests: z.ZodOptional<z.ZodRecord<z.ZodUUID, z.ZodString>>;
|
|
67
68
|
}, z.core.$strict>>;
|
|
68
69
|
}, z.core.$strict>>;
|
|
70
|
+
paywalls: z.ZodOptional<z.ZodRecord<z.ZodUUID, z.ZodObject<{
|
|
71
|
+
state: z.ZodEnum<{
|
|
72
|
+
archived: "archived";
|
|
73
|
+
published: "published";
|
|
74
|
+
}>;
|
|
75
|
+
controlRevision: z.ZodNumber;
|
|
76
|
+
currentVersionId: z.ZodUUID;
|
|
77
|
+
versions: z.ZodRecord<z.ZodUUID, z.ZodObject<{
|
|
78
|
+
version: z.ZodNumber;
|
|
79
|
+
artifact: z.ZodString;
|
|
80
|
+
sourceDigest: z.ZodString;
|
|
81
|
+
}, z.core.$strict>>;
|
|
82
|
+
}, z.core.$strict>>>;
|
|
69
83
|
}, z.core.$strict>;
|
|
70
84
|
type SdkConfigurationManifest = z.infer<typeof sdkConfigurationManifestSchema>;
|
|
71
85
|
type ConfigurationScope = z.infer<typeof configurationScopeSchema>;
|
|
@@ -117,7 +131,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
117
131
|
pageExperiments: string | null;
|
|
118
132
|
};
|
|
119
133
|
artifacts: Record<string, {
|
|
120
|
-
kind: "funnel" | "gb_features" | "gb_page_experiments";
|
|
134
|
+
kind: "paywall" | "funnel" | "gb_features" | "gb_page_experiments";
|
|
121
135
|
formatVersion: number;
|
|
122
136
|
url: string;
|
|
123
137
|
sha256: string;
|
|
@@ -141,15 +155,21 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
141
155
|
couponDigests?: Record<string, string> | undefined;
|
|
142
156
|
}>;
|
|
143
157
|
}>;
|
|
158
|
+
paywalls?: Record<string, {
|
|
159
|
+
state: "archived" | "published";
|
|
160
|
+
controlRevision: number;
|
|
161
|
+
currentVersionId: string;
|
|
162
|
+
versions: Record<string, {
|
|
163
|
+
version: number;
|
|
164
|
+
artifact: string;
|
|
165
|
+
sourceDigest: string;
|
|
166
|
+
}>;
|
|
167
|
+
}> | undefined;
|
|
144
168
|
} | null;
|
|
145
169
|
readonly remainingMs: number;
|
|
146
170
|
features(): Promise<{
|
|
147
171
|
evaluatedAt: string;
|
|
148
172
|
expiresAt: string;
|
|
149
|
-
scope: {
|
|
150
|
-
projectId: string;
|
|
151
|
-
environment: "sandbox" | "live";
|
|
152
|
-
};
|
|
153
173
|
features: Record<string, {
|
|
154
174
|
defaultValue?: z.core.util.JSONType | undefined;
|
|
155
175
|
rules?: {
|
|
@@ -246,6 +266,10 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
246
266
|
phase?: string | undefined;
|
|
247
267
|
}[] | undefined;
|
|
248
268
|
}>;
|
|
269
|
+
scope: {
|
|
270
|
+
projectId: string;
|
|
271
|
+
environment: "sandbox" | "live";
|
|
272
|
+
};
|
|
249
273
|
generation: string;
|
|
250
274
|
savedGroups: Record<string, {
|
|
251
275
|
type: "hashed";
|
|
@@ -317,33 +341,32 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
317
341
|
variations: {
|
|
318
342
|
urlRedirect: string;
|
|
319
343
|
}[];
|
|
344
|
+
filters?: {
|
|
345
|
+
seed: string;
|
|
346
|
+
hashVersion: 2;
|
|
347
|
+
ranges: [number, number][];
|
|
348
|
+
attribute?: string | undefined;
|
|
349
|
+
}[] | undefined;
|
|
320
350
|
name?: string | undefined;
|
|
321
|
-
coverage?: number | undefined;
|
|
322
|
-
condition?: Record<string, z.core.util.JSONType> | undefined;
|
|
323
351
|
seed?: string | undefined;
|
|
324
352
|
hashVersion?: 2 | undefined;
|
|
325
353
|
ranges?: [number, number][] | undefined;
|
|
326
|
-
|
|
354
|
+
condition?: Record<string, z.core.util.JSONType> | undefined;
|
|
327
355
|
urlPatterns?: {
|
|
328
356
|
include: boolean;
|
|
329
357
|
type: "regex" | "simple";
|
|
330
358
|
pattern: string;
|
|
331
359
|
}[] | undefined;
|
|
360
|
+
force?: number | undefined;
|
|
332
361
|
persistQueryString?: boolean | undefined;
|
|
333
362
|
hashAttribute?: string | undefined;
|
|
334
|
-
phase?: string | undefined;
|
|
335
|
-
filters?: {
|
|
336
|
-
seed: string;
|
|
337
|
-
hashVersion: 2;
|
|
338
|
-
ranges: [number, number][];
|
|
339
|
-
attribute?: string | undefined;
|
|
340
|
-
}[] | undefined;
|
|
341
363
|
parentConditions?: {
|
|
342
364
|
id: string;
|
|
343
365
|
condition: Record<string, z.core.util.JSONType>;
|
|
344
366
|
gate?: boolean | undefined;
|
|
345
367
|
}[] | undefined;
|
|
346
368
|
weights?: number[] | undefined;
|
|
369
|
+
coverage?: number | undefined;
|
|
347
370
|
fallbackAttribute?: string | undefined;
|
|
348
371
|
disableStickyBucketing?: boolean | undefined;
|
|
349
372
|
bucketVersion?: number | undefined;
|
|
@@ -353,6 +376,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
353
376
|
name?: string | undefined;
|
|
354
377
|
passthrough?: boolean | undefined;
|
|
355
378
|
}[] | undefined;
|
|
379
|
+
phase?: string | undefined;
|
|
356
380
|
}[];
|
|
357
381
|
savedGroups: Record<string, {
|
|
358
382
|
type: "hashed";
|
|
@@ -584,7 +608,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
584
608
|
event: string;
|
|
585
609
|
} | {
|
|
586
610
|
type: "api";
|
|
587
|
-
operation: "
|
|
611
|
+
operation: "attach" | "refund" | "update" | "readBalanceSource" | "adjustBalance" | "readUsage" | "setUsage" | "manageBalanceGrant" | "listBalanceGrants" | "restoreNativePurchase" | "setupPayment" | "readPaymentSetup" | "verifySubscriptions" | "previewAttach" | "readSubscriptionOperation" | "previewUpdate" | "readSubscriptionUpdate" | "previewRefund" | "readRefund" | "readBillingControls" | "prepareBillingAuthorization" | "confirmBillingAuthorization" | "setBillingCoupons" | "revokeBillingAuthorization" | "listBillingInvoices" | "confirmBillingAdjustment" | "manageBillingLimits" | "manageUsageEntity" | "readUsageAnalytics" | "readCreditAnalytics" | "submitUsageBatch" | "readUsageBatch" | "checkEntitlement" | "resolveOffering" | "readHoldings" | "readLedger" | "readBillingInvoice" | "readCreditStatement" | "quoteBalance" | "trackUsage" | "mutateBalance" | "redeemReward" | "createReferralCode" | "claimRewardProduct" | "readSeats" | "manageSeat" | "redeemCoupon" | "listOffers" | "grantOffer";
|
|
588
612
|
inputs: Record<string, {
|
|
589
613
|
source: "literal";
|
|
590
614
|
value: z.core.util.JSONType;
|
|
@@ -696,7 +720,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
696
720
|
kind: "screen";
|
|
697
721
|
schemaVersion: 4;
|
|
698
722
|
name: string;
|
|
699
|
-
surface: "
|
|
723
|
+
surface: "popup" | "paywall" | "page" | "onboarding";
|
|
700
724
|
presentation: {
|
|
701
725
|
type: "modal";
|
|
702
726
|
size: "sm" | "md" | "lg";
|
|
@@ -777,8 +801,8 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
777
801
|
nodes: Record<string, {
|
|
778
802
|
base: {
|
|
779
803
|
couponId?: string | undefined;
|
|
780
|
-
label?: string | undefined;
|
|
781
804
|
text?: string | undefined;
|
|
805
|
+
label?: string | undefined;
|
|
782
806
|
alt?: string | undefined;
|
|
783
807
|
html?: string | undefined;
|
|
784
808
|
countdownAt?: string | undefined;
|
|
@@ -864,10 +888,6 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
864
888
|
growth: {
|
|
865
889
|
evaluatedAt: string;
|
|
866
890
|
expiresAt: string;
|
|
867
|
-
scope: {
|
|
868
|
-
projectId: string;
|
|
869
|
-
environment: "sandbox" | "live";
|
|
870
|
-
};
|
|
871
891
|
features: Record<string, {
|
|
872
892
|
defaultValue?: z.core.util.JSONType | undefined;
|
|
873
893
|
rules?: {
|
|
@@ -964,6 +984,10 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
964
984
|
phase?: string | undefined;
|
|
965
985
|
}[] | undefined;
|
|
966
986
|
}>;
|
|
987
|
+
scope: {
|
|
988
|
+
projectId: string;
|
|
989
|
+
environment: "sandbox" | "live";
|
|
990
|
+
};
|
|
967
991
|
generation: string;
|
|
968
992
|
savedGroups: Record<string, {
|
|
969
993
|
type: "hashed";
|
|
@@ -1062,7 +1086,281 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
1062
1086
|
pageExperiments: string | null;
|
|
1063
1087
|
};
|
|
1064
1088
|
artifacts: Record<string, {
|
|
1065
|
-
kind: "funnel" | "gb_features" | "gb_page_experiments";
|
|
1089
|
+
kind: "paywall" | "funnel" | "gb_features" | "gb_page_experiments";
|
|
1090
|
+
formatVersion: number;
|
|
1091
|
+
url: string;
|
|
1092
|
+
sha256: string;
|
|
1093
|
+
byteLength: number;
|
|
1094
|
+
generation?: string | undefined;
|
|
1095
|
+
}>;
|
|
1096
|
+
funnels: Record<string, {
|
|
1097
|
+
state: "active" | "archived" | "paused";
|
|
1098
|
+
controlRevision: number;
|
|
1099
|
+
evaluationMode: "local" | "remote";
|
|
1100
|
+
evaluationRevision: number;
|
|
1101
|
+
currentVersionId: string;
|
|
1102
|
+
versions: Record<string, {
|
|
1103
|
+
artifact: string;
|
|
1104
|
+
dependencies: {
|
|
1105
|
+
features: string[];
|
|
1106
|
+
experiments: Record<string, string[]>;
|
|
1107
|
+
savedGroups: string[];
|
|
1108
|
+
};
|
|
1109
|
+
definitionDigest?: string | undefined;
|
|
1110
|
+
couponDigests?: Record<string, string> | undefined;
|
|
1111
|
+
}>;
|
|
1112
|
+
}>;
|
|
1113
|
+
paywalls?: Record<string, {
|
|
1114
|
+
state: "archived" | "published";
|
|
1115
|
+
controlRevision: number;
|
|
1116
|
+
currentVersionId: string;
|
|
1117
|
+
versions: Record<string, {
|
|
1118
|
+
version: number;
|
|
1119
|
+
artifact: string;
|
|
1120
|
+
sourceDigest: string;
|
|
1121
|
+
}>;
|
|
1122
|
+
}> | undefined;
|
|
1123
|
+
};
|
|
1124
|
+
}>;
|
|
1125
|
+
paywall: (paywallId: string, versionId?: string) => Promise<{
|
|
1126
|
+
document: {
|
|
1127
|
+
kind: "paywall";
|
|
1128
|
+
formatVersion: 1;
|
|
1129
|
+
name: string;
|
|
1130
|
+
offeringVersionId: string;
|
|
1131
|
+
presentation: {
|
|
1132
|
+
type: "modal";
|
|
1133
|
+
size: "sm" | "md" | "lg";
|
|
1134
|
+
} | {
|
|
1135
|
+
type: "sheet";
|
|
1136
|
+
size: "sm" | "md" | "lg";
|
|
1137
|
+
} | {
|
|
1138
|
+
type: "fullscreen";
|
|
1139
|
+
} | {
|
|
1140
|
+
type: "inline";
|
|
1141
|
+
};
|
|
1142
|
+
screen: {
|
|
1143
|
+
kind: "screen";
|
|
1144
|
+
schemaVersion: 4;
|
|
1145
|
+
name: string;
|
|
1146
|
+
surface: "popup" | "paywall" | "page" | "onboarding";
|
|
1147
|
+
presentation: {
|
|
1148
|
+
type: "modal";
|
|
1149
|
+
size: "sm" | "md" | "lg";
|
|
1150
|
+
} | {
|
|
1151
|
+
type: "sheet";
|
|
1152
|
+
size: "sm" | "md" | "lg";
|
|
1153
|
+
} | {
|
|
1154
|
+
type: "fullscreen";
|
|
1155
|
+
};
|
|
1156
|
+
theme: {
|
|
1157
|
+
primary: string;
|
|
1158
|
+
background: string;
|
|
1159
|
+
text: string;
|
|
1160
|
+
radius: "none" | "full" | "sm" | "md" | "lg";
|
|
1161
|
+
font: "system" | "serif" | "rounded" | "mono";
|
|
1162
|
+
};
|
|
1163
|
+
pages: {
|
|
1164
|
+
id: string;
|
|
1165
|
+
name: string;
|
|
1166
|
+
root: StackNode;
|
|
1167
|
+
theme?: {
|
|
1168
|
+
primary: string;
|
|
1169
|
+
background: string;
|
|
1170
|
+
text: string;
|
|
1171
|
+
radius: "none" | "full" | "sm" | "md" | "lg";
|
|
1172
|
+
font: "system" | "serif" | "rounded" | "mono";
|
|
1173
|
+
} | undefined;
|
|
1174
|
+
editorPosition?: {
|
|
1175
|
+
x: number;
|
|
1176
|
+
y: number;
|
|
1177
|
+
} | undefined;
|
|
1178
|
+
}[];
|
|
1179
|
+
strings: {
|
|
1180
|
+
defaultLocale: string;
|
|
1181
|
+
locales: Record<string, Record<string, string>>;
|
|
1182
|
+
};
|
|
1183
|
+
actions: ({
|
|
1184
|
+
type: "navigate";
|
|
1185
|
+
close: false;
|
|
1186
|
+
pageId: string;
|
|
1187
|
+
id: string;
|
|
1188
|
+
event: string;
|
|
1189
|
+
properties: Record<string, string | number | boolean | null>;
|
|
1190
|
+
} | {
|
|
1191
|
+
type: "event";
|
|
1192
|
+
close: boolean;
|
|
1193
|
+
id: string;
|
|
1194
|
+
event: string;
|
|
1195
|
+
properties: Record<string, string | number | boolean | null>;
|
|
1196
|
+
} | {
|
|
1197
|
+
type: "close";
|
|
1198
|
+
close: true;
|
|
1199
|
+
id: string;
|
|
1200
|
+
event: string;
|
|
1201
|
+
properties: Record<string, string | number | boolean | null>;
|
|
1202
|
+
} | {
|
|
1203
|
+
type: "open_url";
|
|
1204
|
+
close: boolean;
|
|
1205
|
+
url: string;
|
|
1206
|
+
id: string;
|
|
1207
|
+
event: string;
|
|
1208
|
+
properties: Record<string, string | number | boolean | null>;
|
|
1209
|
+
} | {
|
|
1210
|
+
type: "claim_offer";
|
|
1211
|
+
close: boolean;
|
|
1212
|
+
couponId: string;
|
|
1213
|
+
id: string;
|
|
1214
|
+
event: string;
|
|
1215
|
+
properties: Record<string, string | number | boolean | null>;
|
|
1216
|
+
})[];
|
|
1217
|
+
initialPageId?: string | undefined;
|
|
1218
|
+
};
|
|
1219
|
+
products: {
|
|
1220
|
+
items: {
|
|
1221
|
+
productVersionId: string;
|
|
1222
|
+
label: string;
|
|
1223
|
+
}[];
|
|
1224
|
+
defaultProductVersionId: string | null;
|
|
1225
|
+
grouping?: {
|
|
1226
|
+
tiers: {
|
|
1227
|
+
id: string;
|
|
1228
|
+
name: string;
|
|
1229
|
+
}[];
|
|
1230
|
+
assignments: {
|
|
1231
|
+
productVersionId: string;
|
|
1232
|
+
tierId: string;
|
|
1233
|
+
period: "month" | "year";
|
|
1234
|
+
}[];
|
|
1235
|
+
} | undefined;
|
|
1236
|
+
};
|
|
1237
|
+
catalog: Record<string, {
|
|
1238
|
+
name: string;
|
|
1239
|
+
interval: "week" | "month" | "year" | "free" | "one_time";
|
|
1240
|
+
intervalCount: number;
|
|
1241
|
+
trial: {
|
|
1242
|
+
days: number;
|
|
1243
|
+
cardRequired: boolean;
|
|
1244
|
+
} | null;
|
|
1245
|
+
benefits: {
|
|
1246
|
+
featureId: string;
|
|
1247
|
+
name: string;
|
|
1248
|
+
allowance: string | null;
|
|
1249
|
+
access: boolean;
|
|
1250
|
+
}[];
|
|
1251
|
+
channels: {
|
|
1252
|
+
stripe?: {
|
|
1253
|
+
prices: {
|
|
1254
|
+
currency: "USD" | "EUR" | "CNY" | "GBP" | "JPY" | "CAD" | "AUD" | "NZD" | "CHF" | "HKD" | "SGD" | "KRW" | "INR" | "BRL" | "MXN" | "TWD" | "THB" | "IDR" | "MYR" | "PHP" | "VND" | "ZAR" | "AED" | "SAR" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "HUF" | "ILS" | "TRY" | "RON";
|
|
1255
|
+
amountMinor: number;
|
|
1256
|
+
}[];
|
|
1257
|
+
} | undefined;
|
|
1258
|
+
apple?: {
|
|
1259
|
+
productIds: string[];
|
|
1260
|
+
} | undefined;
|
|
1261
|
+
google?: {
|
|
1262
|
+
products: {
|
|
1263
|
+
productId: string;
|
|
1264
|
+
basePlanId: string | null;
|
|
1265
|
+
}[];
|
|
1266
|
+
} | undefined;
|
|
1267
|
+
};
|
|
1268
|
+
}>;
|
|
1269
|
+
buttons: Record<string, {
|
|
1270
|
+
type: "checkout";
|
|
1271
|
+
product: {
|
|
1272
|
+
type: "picker";
|
|
1273
|
+
pickerId: string;
|
|
1274
|
+
allowedProductVersionIds: string[];
|
|
1275
|
+
} | {
|
|
1276
|
+
type: "fixed";
|
|
1277
|
+
productVersionId: string;
|
|
1278
|
+
};
|
|
1279
|
+
} | {
|
|
1280
|
+
type: "close";
|
|
1281
|
+
} | {
|
|
1282
|
+
type: "action";
|
|
1283
|
+
action: {
|
|
1284
|
+
type: "event";
|
|
1285
|
+
event: string;
|
|
1286
|
+
} | {
|
|
1287
|
+
type: "open_url";
|
|
1288
|
+
url: string;
|
|
1289
|
+
};
|
|
1290
|
+
}>;
|
|
1291
|
+
coupons: Record<string, {
|
|
1292
|
+
digest: string;
|
|
1293
|
+
content: {
|
|
1294
|
+
discount: {
|
|
1295
|
+
type: "percent";
|
|
1296
|
+
percentOff: number;
|
|
1297
|
+
} | {
|
|
1298
|
+
type: "amount";
|
|
1299
|
+
amountOffCents: number;
|
|
1300
|
+
currency: "USD" | "EUR" | "CNY" | "GBP" | "JPY" | "CAD" | "AUD" | "NZD" | "CHF" | "HKD" | "SGD" | "KRW" | "INR" | "BRL" | "MXN" | "TWD" | "THB" | "IDR" | "MYR" | "PHP" | "VND" | "ZAR" | "AED" | "SAR" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "HUF" | "ILS" | "TRY" | "RON";
|
|
1301
|
+
};
|
|
1302
|
+
duration: {
|
|
1303
|
+
type: "once";
|
|
1304
|
+
} | {
|
|
1305
|
+
type: "repeating";
|
|
1306
|
+
months: number;
|
|
1307
|
+
} | {
|
|
1308
|
+
type: "forever";
|
|
1309
|
+
};
|
|
1310
|
+
appliesTo: {
|
|
1311
|
+
type: "all";
|
|
1312
|
+
} | {
|
|
1313
|
+
type: "plans";
|
|
1314
|
+
planIds: string[];
|
|
1315
|
+
};
|
|
1316
|
+
displayCopy: {
|
|
1317
|
+
defaultLocale: string;
|
|
1318
|
+
locales: Record<string, {
|
|
1319
|
+
name: string;
|
|
1320
|
+
description: string;
|
|
1321
|
+
}>;
|
|
1322
|
+
} | null;
|
|
1323
|
+
firstPurchaseOnly: boolean;
|
|
1324
|
+
qualificationRequired: boolean;
|
|
1325
|
+
startsAt: string | null;
|
|
1326
|
+
endsAt: string | null;
|
|
1327
|
+
grantWindowHours: number;
|
|
1328
|
+
perCustomerLimit: number;
|
|
1329
|
+
};
|
|
1330
|
+
}>;
|
|
1331
|
+
};
|
|
1332
|
+
versionId: string;
|
|
1333
|
+
version: number;
|
|
1334
|
+
control: {
|
|
1335
|
+
state: "archived" | "published";
|
|
1336
|
+
controlRevision: number;
|
|
1337
|
+
currentVersionId: string;
|
|
1338
|
+
versions: Record<string, {
|
|
1339
|
+
version: number;
|
|
1340
|
+
artifact: string;
|
|
1341
|
+
sourceDigest: string;
|
|
1342
|
+
}>;
|
|
1343
|
+
};
|
|
1344
|
+
manifest: {
|
|
1345
|
+
kind: "sdk_configuration";
|
|
1346
|
+
schemaVersion: 1;
|
|
1347
|
+
scope: {
|
|
1348
|
+
projectId: string;
|
|
1349
|
+
environment: "sandbox" | "live";
|
|
1350
|
+
environmentId: string;
|
|
1351
|
+
};
|
|
1352
|
+
revision: number;
|
|
1353
|
+
generation: string;
|
|
1354
|
+
policy: {
|
|
1355
|
+
refreshIntervalSeconds: number;
|
|
1356
|
+
maxControlAgeSeconds: number;
|
|
1357
|
+
};
|
|
1358
|
+
gb: {
|
|
1359
|
+
features: string | null;
|
|
1360
|
+
pageExperiments: string | null;
|
|
1361
|
+
};
|
|
1362
|
+
artifacts: Record<string, {
|
|
1363
|
+
kind: "paywall" | "funnel" | "gb_features" | "gb_page_experiments";
|
|
1066
1364
|
formatVersion: number;
|
|
1067
1365
|
url: string;
|
|
1068
1366
|
sha256: string;
|
|
@@ -1086,6 +1384,16 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
1086
1384
|
couponDigests?: Record<string, string> | undefined;
|
|
1087
1385
|
}>;
|
|
1088
1386
|
}>;
|
|
1387
|
+
paywalls?: Record<string, {
|
|
1388
|
+
state: "archived" | "published";
|
|
1389
|
+
controlRevision: number;
|
|
1390
|
+
currentVersionId: string;
|
|
1391
|
+
versions: Record<string, {
|
|
1392
|
+
version: number;
|
|
1393
|
+
artifact: string;
|
|
1394
|
+
sourceDigest: string;
|
|
1395
|
+
}>;
|
|
1396
|
+
}> | undefined;
|
|
1089
1397
|
};
|
|
1090
1398
|
}>;
|
|
1091
1399
|
localFunnel(funnelId: string, versionId?: string): Promise<{
|
|
@@ -1264,7 +1572,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
1264
1572
|
entry: string;
|
|
1265
1573
|
nodes: {
|
|
1266
1574
|
id: string;
|
|
1267
|
-
type: "output" | "
|
|
1575
|
+
type: "output" | "feature" | "split" | "action" | "condition" | "coupon" | "end" | "screen" | "offering" | "coupons" | "entry" | "external_page" | "wait";
|
|
1268
1576
|
outputs: Record<string, string>;
|
|
1269
1577
|
writes: Record<string, string>;
|
|
1270
1578
|
resources: {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var N={connecting:["\u6B63\u5728\u8FDE\u63A5\u91C7\u96C6\u670D\u52A1\u2026","Connecting to the capture service\u2026"],authorized:["\u91C7\u96C6\u6388\u6743\u5DF2\u786E\u8BA4\uFF0C\u6B63\u5728\u52A0\u8F7D\u2026","Capture authorized; loading\u2026"],idle:["\u9875\u9762\u7A33\u5B9A\u540E\u81EA\u52A8\u91C7\u96C6\uFF0C\u8F93\u5165\u6587\u672C\u4F1A\u906E\u853D\u3002","Stable page states are captured automatically. Input text is masked."],capturing:["\u6B63\u5728\u91C7\u96C6\u9875\u9762\u7ED3\u6784\u2026","Capturing page structure\u2026"],uploading:["\u6B63\u5728\u4FDD\u5B58\u8131\u654F\u5FEB\u7167\u2026","Saving a masked snapshot\u2026"],waiting:["\u4E0A\u4F20\u5904\u7406\u4E2D\uFF0C\u540E\u7EED\u53D8\u5316\u5DF2\u5408\u5E76\u7B49\u5F85\u3002","Upload in progress; later changes are coalesced."],paused:["\u91C7\u96C6\u5DF2\u6682\u505C\u3002\u68C0\u67E5\u9875\u9762\u6216\u8FDE\u63A5\u540E\uFF0C\u53EF\u624B\u52A8\u91CD\u8BD5\u3002","Capture paused. Check the page or connection, then retry."],stopped:["\u91C7\u96C6\u5DF2\u505C\u6B62\u3002","Capture stopped."]},O=["\u6B64\u9875\u9762\u4E0D\u5728\u672C\u6B21\u6388\u6743\u7684\u9875\u9762\u8303\u56F4\u5185\u3002\u6253\u5F00\u5DF2\u6388\u6743\u7684\u9875\u9762\u540E\u4F1A\u81EA\u52A8\u7EE7\u7EED\u91C7\u96C6\u3002","This page is not one of the authorized pages for this link. Open an authorized page and capture continues automatically."],R=["\u672C\u9875\u7684\u5B9E\u9A8C\u548C\u8DF3\u8F6C\u4ECD\u5904\u4E8E\u6682\u505C\u72B6\u6001\uFF0C\u5237\u65B0\u9875\u9762\u540E\u6062\u590D\u3002","Experiments and redirects stay paused on this page until you reload it."];function I(o,e){let t=o.reason??"";if(o.state==="idle"){if(t==="ROUTE_NOT_ALLOWED")return O;if(t==="UNSTABLE")return["\u9875\u9762\u4ECD\u5728\u53D8\u5316\uFF0C\u7A33\u5B9A\u540E\u4F1A\u81EA\u52A8\u91CD\u8BD5\u3002","The page is still changing; capture retries once it settles."]}if(o.state==="paused"){if(t==="ROUTE_NOT_ALLOWED")return O;if(t==="UNSTABLE")return["\u91C7\u96C6\u671F\u95F4\u9875\u9762\u6301\u7EED\u53D8\u5316\u3002\u8BF7\u7B49\u5F85\u9875\u9762\u7A33\u5B9A\u540E\u91CD\u8BD5\u3002","The page kept changing during capture. Wait for it to settle, then retry."];if(t==="OFFLINE")return["\u7F51\u7EDC\u5DF2\u65AD\u5F00\u3002\u6062\u590D\u8FDE\u63A5\u540E\uFF0C\u8BF7\u624B\u52A8\u91CD\u8BD5\u3002","You are offline. Reconnect, then retry explicitly."];if(/(?:SLICE|ENCODING|NODE|BYTE|TEXT|ATTRIBUTE|CSS|DEADLINE)/.test(t))return["\u9875\u9762\u8D85\u51FA\u91C7\u96C6\u9884\u7B97\u3002\u7F29\u5C0F\u9875\u9762\u72B6\u6001\u540E\u518D\u8BD5\u3002","This page exceeds the capture budget. Reduce the page state before retrying."];if(/(?:429|QUOTA)/.test(t))return["\u5DF2\u8FBE\u5230\u91C7\u96C6\u914D\u989D\uFF0C\u8BF7\u8FD4\u56DE\u63A7\u5236\u53F0\u67E5\u770B\u3002","Capture quota reached. Check the Console before retrying."]}if(o.state==="stopped"){if(t==="QUOTA")return[`\u91C7\u96C6\u5B8C\u6210\uFF1A\u5DF2\u4FDD\u5B58 ${e} \u4E2A\u9875\u9762\u72B6\u6001\u3002\u8BF7\u56DE\u5230\u63A7\u5236\u53F0 \u203A App \u9875\u9762\u76EE\u5F55\uFF0C\u5237\u65B0\u5DF2\u91C7\u96C6\u72B6\u6001\u3002`,`Capture complete: ${e} page states saved. Return to Console \u203A App page map and refresh captured states.`];if(t==="EXPIRED")return[`\u91C7\u96C6\u94FE\u63A5\u5DF2\u8FC7\u671F\uFF0C\u5DF2\u4FDD\u5B58 ${e} \u4E2A\u9875\u9762\u72B6\u6001\u3002\u5982\u9700\u7EE7\u7EED\u91C7\u96C6\uFF0C\u8BF7\u5728\u63A7\u5236\u53F0 \u203A App \u9875\u9762\u76EE\u5F55\u83B7\u53D6\u65B0\u94FE\u63A5\u3002`,`This capture link has expired after saving ${e} page states. To capture more, get a new link in Console \u203A App page map.`];if(/REVOKED/.test(t))return["\u91C7\u96C6\u94FE\u63A5\u5DF2\u64A4\u9500\u6216\u6743\u9650\u5DF2\u53D8\u66F4\u3002\u8BF7\u5728\u63A7\u5236\u53F0 \u203A App \u9875\u9762\u76EE\u5F55\u83B7\u53D6\u65B0\u94FE\u63A5\u3002","This capture link was revoked or its access changed. Get a new link in Console \u203A App page map."];if(t==="CAPTURE_UPGRADE_REQUIRED")return["\u91C7\u96C6\u7248\u672C\u4E0D\u5339\u914D\u3002\u8BF7\u5237\u65B0\u9875\u9762\u6216\u66F4\u65B0 SDK\uFF0C\u7136\u540E\u5728\u63A7\u5236\u53F0 \u203A App \u9875\u9762\u76EE\u5F55\u83B7\u53D6\u65B0\u94FE\u63A5\u3002","Capture versions differ. Reload the page or update the SDK, then get a new link in Console \u203A App page map."];if(t==="AUTH_OR_SERVICE_UNAVAILABLE")return["\u65E0\u6CD5\u786E\u8BA4\u91C7\u96C6\u6388\u6743\u3002\u8BF7\u5728\u63A7\u5236\u53F0 \u203A App \u9875\u9762\u76EE\u5F55\u83B7\u53D6\u65B0\u94FE\u63A5\u540E\u91CD\u8BD5\u3002","This capture link could not be authorized. Get a new link in Console \u203A App page map and try again."]}return N[o.state]??N.paused}function L(o){let e=o.document,t=/^zh\b/i.test(e.documentElement.lang),n=e.createElement("div"),T=n.attachShadow({mode:"open"}),g=e.createElement("style");n.setAttribute("data-indiana-private",""),n.setAttribute("data-indiana-capture-controls",""),n.setAttribute("aria-live","off");let S=typeof n.showPopover=="function";S&&n.setAttribute("popover","manual"),n.hidden=!0,o.nonce&&(g.nonce=o.nonce),g.textContent=":host{all:initial!important;position:fixed!important;margin:0!important;inset:auto!important;right:12px!important;bottom:12px!important;z-index:2147483647!important;display:block!important;width:340px!important;max-width:calc(100vw - 24px)!important;color:#17202d!important;font:13px/1.4 system-ui,sans-serif!important;color-scheme:light!important}:host([hidden]){display:none!important}*{box-sizing:border-box}.panel{background:white;border:1px solid #98a4b4;border-radius:2px;padding:12px;box-shadow:0 2px 10px #17202d20}.top,.actions{display:flex;align-items:center;gap:8px}.top{justify-content:space-between}strong{font-weight:600}small{font-size:12px;font-variant-numeric:tabular-nums}.message{margin:6px 0;color:#465467;overflow-wrap:anywhere;white-space:pre-line}.actions{justify-content:flex-end}button{font:inherit;min-height:40px;border:1px solid #98a4b4;border-radius:2px;padding:6px 12px;background:white;color:#17202d;cursor:pointer}button:focus-visible{outline:2px solid #155eef;outline-offset:2px}button:disabled{cursor:default;color:#5b6778;background:#f2f4f7}button.primary:enabled{background:#155eef;border-color:#155eef;color:white}@media(forced-colors:active){.panel,button{border:1px solid CanvasText}button:focus-visible{outline:2px solid Highlight}}";let u=e.createElement("section"),x=e.createElement("div"),w=e.createElement("strong"),k=e.createElement("small"),m=e.createElement("p"),y=e.createElement("div"),p=e.createElement("button"),h=e.createElement("button");if(u.className="panel",x.className="top",y.className="actions",u.setAttribute("aria-label",t?"Indiana \u9875\u9762\u91C7\u96C6":"Indiana page capture"),u.setAttribute("role","region"),w.textContent=t?"Indiana \u9875\u9762\u91C7\u96C6":"Indiana page capture",m.className="message",m.setAttribute("role","status"),p.type=h.type="button",p.className="primary",p.textContent=t?"\u91CD\u8BD5\u91C7\u96C6":"Retry capture",x.append(w,k),y.append(p,h),u.append(x,m,y),T.append(g,u),(e.body??e.documentElement).append(n),!g.sheet)throw n.remove(),Object.assign(Error("Authoring controls blocked by style policy"),{code:"AUTHORING_CONTROLS_BLOCKED"});n.hidden=!1;let r={state:"connecting",snapshots:0},l=!1,b,d;function E(a=e.activeElement){if(l||a===n||a&&n.contains(a))return;let s,i=a;for(let c=0;i&&c<80;c++,i=i.parentElement)if(i.matches('dialog[open],[role="dialog"],[role="alertdialog"],[role="menu"],[role="listbox"]')&&i.getAttribute("aria-hidden")!=="true"){s=i;break}b=s;let f=s??e.body??e.documentElement;if(n.parentElement!==f&&f.append(n),n.removeAttribute("aria-hidden"),S)try{n.showPopover()}catch{}}let A=a=>{a.target instanceof e.defaultView.Element&&E(a.target)},v=a=>{a.target===b&&E(e.body)};e.addEventListener("focusin",A,!0),e.addEventListener("close",v,!0);function C(){if(l)return;if(n.isConnected||b&&!b.isConnected&&E(),!n.isConnected){l=!0,clearInterval(d),e.removeEventListener("focusin",A,!0),e.removeEventListener("close",v,!0),o.stop();return}let a=Number.isInteger(r.snapshots)?Math.min(10,Math.max(0,r.snapshots)):0,s=r.expiresAt&&Number.isFinite(r.expiresAt)?Math.max(0,Math.ceil((r.expiresAt-Date.now())/1e3)):null,i=s===null?"":`${Math.floor(s/60)}:${String(s%60).padStart(2,"0")}`;k.textContent=t?`\u5DF2\u4FDD\u5B58 ${a}/10`+(i&&` \xB7 \u5269\u4F59 ${i}`):`${a}/10 saved`+(i&&` \xB7 ${i} left`);let f=t?0:1,c=I(r,a)[f];r.state==="stopped"&&r.reloadRequired&&(c+=`
|
|
2
|
+
`+R[f]),m.textContent!==c&&(m.textContent=c),p.hidden=r.state==="stopped",p.disabled=r.state!=="paused"||s===0,h.textContent=r.state==="stopped"?t?"\u5173\u95ED":"Close":t?"\u505C\u6B62\u91C7\u96C6":"Stop capture"}for(let a of["click","pointerdown","pointerup","keydown","keyup"])T.addEventListener(a,s=>s.stopPropagation());return p.onclick=()=>{p.disabled||o.retry()},h.onclick=()=>{r.state==="stopped"?o.close():o.stop()},E(),C(),{update(a){l||(r=a,d&&clearInterval(d),d=void 0,r.state!=="stopped"&&r.expiresAt&&Number.isFinite(r.expiresAt)&&(d=setInterval(C,1e3)),C())},destroy(){l||(l=!0,clearInterval(d),e.removeEventListener("focusin",A,!0),e.removeEventListener("close",v,!0),n.remove())},get active(){return!l&&n.isConnected}}}export{L as createCaptureControls};
|