1import{B as t,C as e}from"./2c1ab0fe.Bywc2Brn.js";function n(t,e){return t.protocol===e.protocol&&t.port===e.port&&(t.hostname===e.hostname||t.hostname.endsWith(`.${e.hostname}`))}const i="data-special-id";function r({id:t,url:e,privileges:n,title:r,name:o,iframeSpecialId:a,onLoad:s}){const d=document.getElementById(`sandbox-${t}`);if(d&&"IFRAME"===d.tagName)return d;const u=document.createElement("iframe");if(u.setAttribute("id",`sandbox-${t}`),u.setAttribute("src",e),u.setAttribute("sandbox",n.join(" ")),u.setAttribute("tabIndex","-1"),u.setAttribute("aria-hidden","true"),a&&u.setAttribute(i,a),r&&u.setAttribute("title",r),o&&u.setAttribute("name",o),u.setAttribute("style","display:none; height:0; width:0; visibility: hidden;"),c(u),s){const t=s(u);u.addEventListener("load",t,{once:!0})}return u}const o={};function a(n,i,r,a,c){const d=n.getAttribute("id");if(!d)throw Error("Endpoint cannot be created without an iframe id");a&&s(i,a);const u=`${d}-endpoint-${r}`,l=o[u];l&&(a?.leaveErrorBreadcrumb(`Terminating existing RPC endpoint ${u}`),l.terminate());const m=c?.isSandboxedWithNullOrigin?"*":new URL(i).origin,h=t(e(n,{targetOrigin:m}));return o[u]=h,h}function s(t,e){let i;try{i=new URL(t,window.location.href)}catch{return}const r=i.searchParams.get("shopHost");if(!r)return;const o=`https://${r}`,a=window.location.origin;(function(t,e,i=[]){try{const r=new URL(t),o=new URL(e),a=n(r,o)||i.some(t=>{try{const e=new URL(t);return e.origin===t&&n(r,e)}catch{return!1}});return r.origin===t&&"https:"===r.protocol&&a}catch{return!1}})(a,o,function(){const t=document.querySelector('meta[name="serialized-shop"]')?.getAttribute("content");if(t)try{return JSON.parse(t)}catch{return}}()?.origins)||e.log("sandbox_parent_origin_mismatch","Sandbox shopHost does not match the parent origin",{sandbox:i.pathname,expectedOrigin:o,actualOrigin:a})}function c(t){let e=document.querySelector("#SandboxContainer");null==e&&(e=document.createElement("div"),e.setAttribute("id","SandboxContainer"),document.body.appendChild(e)),e.appendChild(t)}export{i as D,r as a,c as b,a as c,s as r};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.