{"version":3,"file":"PageLockContentY.Bs7YAODD.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/sjOUAq6Y29lzO63Z4ce8/wDCqsMsJIqve0q7shv7s/PageLockContentY.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect}from\"react\";import{createPortal}from\"react-dom\";// __HOSTED_RUNTIME_BEGIN__\n// AUTO-GENERATED — DO NOT EDIT inline.\n// Source: hosted-components/_runtime/{constants,runtime}.ts\n// Re-sync: node pagelock-plugin-v7/scripts/sync-hosted-runtime.mjs\nconst FALLBACK_API_URL=\"https://fallback.proofly.ae\";const LOCK_TOKEN_PREFIX=\"proofly_v5_token_\";const AUTH_EVENT_PREFIX=\"proofly:auth:\";const GROUP_TOKEN_PREFIX=\"proofly_v5_group_token_\";const GROUP_AUTH_EVENT_PREFIX=\"proofly:group-auth:\";const Z_BACKDROP_TINT=9997;const Z_BACKDROP=9998;const Z_OVERLAY=9999;const FETCH_TIMEOUT_MS=6e3;const CANVAS_HOSTS=[\"framer.com\",\"www.framer.com\"];const VIEWPORT_META_CONTENT=\"width=device-width, initial-scale=1\";// The sync script strips this import — hosted components already\n// `import { useEffect } from \"react\"` at the top of their file. Same for\n// the constants (the script inlines their values from `./constants.ts`\n// alongside this body, so callers see them as plain consts in scope).\n/** True when the host page is inside Framer's editor canvas (not a live\n *  customer site). Hosted components render bounded previews when this\n *  is true, and full-screen portal overlays otherwise. The match list\n *  is inlined from `CANVAS_HOSTS` to keep this function callable from\n *  any scope in a hosted component. */function isCanvasHost(){if(typeof window===\"undefined\")return false;const h=window.location.hostname;return h===\"framer.com\"||h===\"www.framer.com\";}/** Patch the host page's `<meta name=\"viewport\">` so 100vw resolves to\n *  the real device width on mobile, then restore the original on unmount.\n *\n *  Must be called UNCONDITIONALLY at the top of a hosted component (React\n *  rule of hooks). Pass `disabled=true` when the gate isn't active to\n *  skip the patch — the cleanup still registers, fixing audit §8.7\n *  where CmsGate's not-locked branch leaked a permanently rewritten\n *  meta tag. */function useViewportMetaPatch(disabled){useEffect(()=>{if(disabled)return;if(typeof document===\"undefined\")return;if(isCanvasHost())return;let meta=document.querySelector('meta[name=\"viewport\"]');const origContent=meta?meta.getAttribute(\"content\"):null;const created=!meta;if(meta){meta.setAttribute(\"content\",VIEWPORT_META_CONTENT);}else{meta=document.createElement(\"meta\");meta.name=\"viewport\";meta.content=VIEWPORT_META_CONTENT;document.head.appendChild(meta);}return()=>{if(!meta)return;if(created){meta.remove();}else if(origContent!==null){meta.setAttribute(\"content\",origContent);}};},[disabled]);}/** Build a fetch wrapper that races a 6s timeout and falls back to\n *  `fallbackUrl ?? FALLBACK_API_URL` on timeout, abort, or 5xx.\n *\n *  Returned function preserves the standard `(path, options) => Response`\n *  shape callers already use. The fallback is best-effort: if it also\n *  fails, the rejection propagates so callers can surface the error. */function createResilientFetch(apiUrl,fallbackUrl){return async function resilientFetch(path,options={}){const controller=new AbortController;const timeout=setTimeout(()=>controller.abort(),FETCH_TIMEOUT_MS);try{const res=await fetch(apiUrl+path,{...options,signal:controller.signal});clearTimeout(timeout);if(res.status>=500)throw new Error(\"server\");return res;}catch{clearTimeout(timeout);const fb=fallbackUrl||FALLBACK_API_URL;return fetch(fb+path,options);}};}/** Token storage + auth event bus for one lock. Wraps the\n *  `${LOCK_TOKEN_PREFIX}${lockId}` localStorage key plus the\n *  `${AUTH_EVENT_PREFIX}${lockId}` window CustomEvent so the login form\n *  and content-display iframe stay in sync.\n *\n *  Returns:\n *   - `get()` — current token or null.\n *   - `set(token)` — writes storage AND dispatches the auth event.\n *   - `clear()` — removes storage; does NOT dispatch (logout is a reload).\n *   - `onAuthChange(handler)` — listens for the auth event; returns an\n *     unsubscribe function. Handler receives the token from the event\n *     detail. */function lockSession(lockId){const storageKey=LOCK_TOKEN_PREFIX+lockId;const eventName=AUTH_EVENT_PREFIX+lockId;return{get(){try{return localStorage.getItem(storageKey);}catch{return null;}},set(token){try{localStorage.setItem(storageKey,token);}catch{/* quota / private mode */}try{window.dispatchEvent(new CustomEvent(eventName,{detail:{token}}));}catch{/* no window */}},clear(){try{localStorage.removeItem(storageKey);}catch{/* skip */}},onAuthChange(handler){const listener=e=>{const ce=e;if(ce.detail&&typeof ce.detail.token===\"string\")handler(ce.detail.token);};window.addEventListener(eventName,listener);return()=>window.removeEventListener(eventName,listener);}};}/** Token storage + auth event bus for one PROTECTED GROUP. Same shape as\n *  `lockSession` but keyed by groupId, wrapping the\n *  `${GROUP_TOKEN_PREFIX}${groupId}` localStorage key and the\n *  `${GROUP_AUTH_EVENT_PREFIX}${groupId}` window CustomEvent. A group token\n *  unlocks every member page in the group (the content endpoint validates\n *  membership server-side), so one session is shared across the group's pages. */function lockGroupSession(groupId){const storageKey=GROUP_TOKEN_PREFIX+groupId;const eventName=GROUP_AUTH_EVENT_PREFIX+groupId;return{get(){try{return localStorage.getItem(storageKey);}catch{return null;}},set(token){try{localStorage.setItem(storageKey,token);}catch{/* quota / private mode */}try{window.dispatchEvent(new CustomEvent(eventName,{detail:{token}}));}catch{/* no window */}},clear(){try{localStorage.removeItem(storageKey);}catch{/* skip */}},onAuthChange(handler){const listener=e=>{const ce=e;if(ce.detail&&typeof ce.detail.token===\"string\")handler(ce.detail.token);};window.addEventListener(eventName,listener);return()=>window.removeEventListener(eventName,listener);}};}/** Parse a `lockedSlugs` JSON map. Returns an OK shape with the parsed\n *  map, or a fail-CLOSED FAIL shape when the JSON is invalid / not an\n *  object. Callers MUST treat fail as \"render closed gate\" — never\n *  fall back to \"no slug locked\", which would render the page\n *  unprotected (audit §8.3 / §4.4). */function parseLockedSlugs(json){if(json===undefined||json===null||json===\"\"){return{ok:true,map:{}};}try{const parsed=JSON.parse(json);if(parsed&&typeof parsed===\"object\"&&!Array.isArray(parsed)){const out={};for(const[k,v]of Object.entries(parsed)){if(typeof v===\"string\")out[k]=v;}return{ok:true,map:out};}return{ok:false,reason:\"Locked slugs map must be a JSON object.\"};}catch{return{ok:false,reason:\"Locked slugs JSON failed to parse.\"};}}/** Resolve which lock (if any) gates the current path. Walks the URL\n *  segments back-to-front and returns the first one that appears in the\n *  slugs map. Fixes audit §4.4 nested CMS template gap (`/projects/:slug/details`\n *  whose terminal segment is `details`, not the slug). */function pickSlugFromPath(pathname,slugMap){const parts=pathname.split(\"/\").filter(Boolean);for(let i=parts.length-1;i>=0;i--){const candidate=parts[i];const lockId=slugMap[candidate];if(lockId)return{slug:candidate,lockId};}return null;}// __HOSTED_RUNTIME_END__\nfunction injectPageLockMarkup(html,headMarkup,bodyMarkup){let next=html;if(/<\\/head>/i.test(next)){next=next.replace(/<\\/head>/i,headMarkup+\"</head>\");}else if(/<html([^>]*)>/i.test(next)){next=next.replace(/<html([^>]*)>/i,\"<html$1><head>\"+headMarkup+\"</head>\");}else{next=headMarkup+next;}if(/<\\/body>/i.test(next)){next=next.replace(/<\\/body>/i,bodyMarkup+\"</body>\");}else if(/<body([^>]*)>/i.test(next)){next=next.replace(/<body([^>]*)>/i,\"<body$1>\"+bodyMarkup);}else{next+=bodyMarkup;}return next;}function buildProtectedContentHtml(html,lockId){const scrollStyle=`\n<style id=\"pagelock-content-scroll-style\">\nhtml,\nbody {\n    height: auto !important;\n    min-height: 100% !important;\n    overflow-x: hidden !important;\n    overflow-y: auto !important;\n    overscroll-behavior-y: auto !important;\n    -webkit-overflow-scrolling: touch !important;\n}\nbody {\n    margin: 0;\n}\n</style>`;// Defeat Framer's smooth-scroll (Lenis) at the page level. Lenis adds a\n// NON-passive wheel/touchmove listener on `window` that preventDefaults every\n// tick and animates scroll itself — inside this iframe that FIGHTS the browser's\n// native scroll of the same document (native jumps, Lenis eases toward its own\n// target for ~800ms), so the page lags and jitters (worst on Safari). We patch\n// addEventListener BEFORE Lenis boots and DROP the page-level hijacker: an\n// explicitly non-passive ({ passive: false }) wheel/touchmove/mousewheel listener\n// on window/document/documentElement/body is simply not registered, so the\n// snapshot scrolls 100% natively (one scroller, smooth). Passive listeners and\n// NESTED-element listeners (galleries, maps) pass through untouched. This MUST be\n// injected at <head> start so it runs before Framer's deferred Lenis module.\n//\n// MIRRORED server-side in\n// proofly/src/app/api/v5/content/[lockId]/route.ts (buildProtectedContentHtmlServer).\n// Keep this block byte-identical with the server copy — enforced by\n// scripts/check-snapshot-inject-drift.mjs.\nconst scrollUnjacker=`\n<script>\n(function () {\n    try {\n        var orig = EventTarget.prototype.addEventListener;\n        function pageLevel(t) {\n            return t === window || t === document || t === document.documentElement || (document.body && t === document.body);\n        }\n        EventTarget.prototype.addEventListener = function (type, listener, opts) {\n            if ((type === \"wheel\" || type === \"touchmove\" || type === \"mousewheel\")\n                && pageLevel(this)\n                && opts && typeof opts === \"object\" && opts.passive === false) {\n                return;\n            }\n            return orig.call(this, type, listener, opts);\n        };\n    } catch (e) {}\n})();\n</script>`;const scrollUnlock=`\n<script>\n(function () {\n    function apply(el) {\n        if (!el || !el.style) return;\n        el.style.setProperty(\"height\", \"auto\", \"important\");\n        el.style.setProperty(\"min-height\", \"100%\", \"important\");\n        el.style.setProperty(\"overflow-x\", \"hidden\", \"important\");\n        el.style.setProperty(\"overflow-y\", \"auto\", \"important\");\n        el.style.setProperty(\"overscroll-behavior-y\", \"auto\", \"important\");\n        el.style.setProperty(\"-webkit-overflow-scrolling\", \"touch\", \"important\");\n    }\n    function unlockScroll() {\n        try {\n            apply(document.documentElement);\n            apply(document.body);\n        } catch (e) {}\n    }\n    unlockScroll();\n    if (document.readyState === \"loading\") {\n        document.addEventListener(\"DOMContentLoaded\", unlockScroll, { once: true });\n    }\n    window.addEventListener(\"load\", unlockScroll);\n    var frames = 0;\n    function settle() {\n        unlockScroll();\n        frames++;\n        if (frames < 20) requestAnimationFrame(settle);\n    }\n    requestAnimationFrame(settle);\n})();\n</script>`;// Inject the paint probe inside the returned document. Prepending it\n// before <!doctype html> forces quirks mode and can break iframe scroll.\nconst paintProbe=`\n<script>\n(function () {\n    var sent = false;\n    var lastH = -1;\n    var stableFrames = 0;\n    var startedAt = Date.now();\n    function readBg() {\n        try {\n            var el = document.body || document.documentElement;\n            var bg = window.getComputedStyle(el).backgroundColor;\n            if (!bg || bg === \"rgba(0, 0, 0, 0)\" || bg === \"transparent\") {\n                bg = window.getComputedStyle(document.documentElement).backgroundColor;\n            }\n            return bg && bg !== \"rgba(0, 0, 0, 0)\" && bg !== \"transparent\" ? bg : null;\n        } catch (e) { return null; }\n    }\n    function pageHeight() {\n        var b = document.body;\n        var d = document.documentElement;\n        return Math.max(\n            b ? b.scrollHeight : 0,\n            d ? d.scrollHeight : 0\n        );\n    }\n    function tell() {\n        if (sent) return;\n        sent = true;\n        try {\n            window.parent.postMessage({\n                type: \"pagelock-painted\",\n                lockId: ${JSON.stringify(lockId)},\n                bgColor: readBg(),\n            }, \"*\");\n        } catch (e) {}\n    }\n    function tick() {\n        if (sent) return;\n        if (Date.now() - startedAt > 5000) return tell();\n        var b = document.body;\n        var h = pageHeight();\n        var n = b ? b.children.length : 0;\n        var loaded = document.readyState === \"complete\";\n        if (loaded && n > 5 && h > window.innerHeight) {\n            if (h === lastH) stableFrames++;\n            else { lastH = h; stableFrames = 0; }\n            if (stableFrames >= 4) return tell();\n        }\n        requestAnimationFrame(tick);\n    }\n    if (document.readyState === \"loading\") {\n        document.addEventListener(\"DOMContentLoaded\", tick);\n    } else {\n        tick();\n    }\n})();\n</script>`;// Iframe nav-interceptor. The protected HTML serves the full Framer\n// SPA, so once authenticated the visitor can navigate anywhere via\n// Framer's client router — including other locked pages whose lock\n// components weren't included in this lock's snapshot. That bypasses\n// the gate (e.g. unlocking /home shows a stripped /work/<slug> teaser\n// with no PIN prompt).\n//\n// Fix: capture-phase click listener registered on `window` so it runs\n// BEFORE Framer's own router handler. If the resolved destination is a\n// different parent-side path than the one this iframe was opened for,\n// prevent default and force a top-level navigation. That re-enters\n// Framer's normal load → the per-page gate mounts and gates the\n// destination correctly. Fallback: postMessage to parent if\n// window.top.location.href ever fails (sandbox without\n// allow-top-navigation).\nconst navInterceptor=`\n<script>\n(function () {\n    function anchor(t) {\n        var el = t;\n        while (el && el !== document.body) {\n            if (el.tagName === \"A\") return el;\n            el = el.parentElement;\n        }\n        return null;\n    }\n    var parentBase;\n    var parentPath;\n    var parentOrigin;\n    try {\n        parentBase = window.parent.location.href;\n        parentPath = window.parent.location.pathname;\n        parentOrigin = window.parent.location.origin;\n    } catch (e) {\n        return;\n    }\n    window.addEventListener(\"click\", function (e) {\n        var a = anchor(e.target);\n        if (!a) return;\n        var href = a.getAttribute(\"href\");\n        if (!href) return;\n        if (href.charAt(0) === \"#\") return;\n        if (href.indexOf(\"javascript:\") === 0) return;\n        if (a.target === \"_blank\") return;\n        if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) return;\n        var u;\n        try { u = new URL(href, parentBase); } catch (err) { return; }\n        if (u.origin !== parentOrigin) return;\n        if (u.pathname === parentPath) return;\n        e.preventDefault();\n        e.stopImmediatePropagation();\n        try { window.top.location.href = u.href; } catch (err2) {\n            try { window.parent.postMessage({ type: \"proofly-nav\", url: u.href }, \"*\"); } catch (err3) {}\n        }\n    }, true);\n})();\n`+\"<\"+\"/script>\";const withMarkup=injectPageLockMarkup(html,scrollStyle,navInterceptor+scrollUnlock+paintProbe);// scrollUnjacker MUST run before Framer's deferred Lenis module, so inject it\n// at the START of <head> (injectPageLockMarkup put scrollStyle at the END).\nif(/<head([^>]*)>/i.test(withMarkup)){return withMarkup.replace(/<head([^>]*)>/i,\"<head$1>\"+scrollUnjacker);}if(/<html([^>]*)>/i.test(withMarkup)){return withMarkup.replace(/<html([^>]*)>/i,\"<html$1><head>\"+scrollUnjacker+\"</head>\");}return scrollUnjacker+withMarkup;}/**\n * @framerDisableUnlink\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 600\n */export default function PageLockContent(props){const{lockId,groupId,apiUrl,fallbackUrl,backgroundColor,spinnerColor,errorText,sandboxPermissions,errorPageMode}=props;// A page that belongs to a protected group authenticates via the shared\n// GROUP session (one login unlocks every member page); a standalone locked\n// page uses its own per-lock session. Both expose the same get/clear/\n// onAuthChange interface, and content is always fetched per lockId — the\n// content endpoint decides authorization from whichever token is sent.\nconst groupIdStr=typeof groupId===\"string\"?groupId.trim():\"\";const useGroup=groupIdStr.length>0;const sessionFor=()=>useGroup?lockGroupSession(groupIdStr):lockSession(lockId);const[mounted,setMounted]=useState(false);const[isCanvas,setIsCanvas]=useState(false);const[blobUrl,setBlobUrl]=useState(null);const[error,setError]=useState(false);/** Page-side background color sampled by the in-iframe paint probe.\n     *  Used to tint the backdrop so the moment the login form unmounts the\n     *  user sees a color matching the protected page, not white/transparent. */const[bgColor,setBgColor]=useState(null);// Patch viewport meta unconditionally so cleanup always registers\n// (audit §8.7). The runtime hook no-ops on canvas internally.\nuseViewportMetaPatch();const resilientFetch=createResilientFetch(apiUrl,fallbackUrl);const fetchContent=async token=>{setError(false);// Build the real-URL `?format=html` serve URL. Used for the /404 page AND\n// for any page containing a cross-origin embed: such content can't render\n// inside a `blob:` iframe because the embed gets no Referer (YouTube error\n// 153). Served from a real URL, the iframe is parented by the real\n// published page, so it sends a real Referer (domain-binding) and the\n// embed validates. We reuse `blobUrl` state to drive the iframe (here it\n// holds an https: URL, not a blob:), so the iframe JSX / backdrop / paint\n// listener are unchanged.\nconst realUrlSrc=tok=>apiUrl+\"/api/v5/content/\"+lockId+\"?format=html\"+\"&token=\"+encodeURIComponent(tok)+\"&domain=\"+encodeURIComponent(window.location.hostname)+\"&parentPath=\"+encodeURIComponent(window.location.pathname)+\"&parentOrigin=\"+encodeURIComponent(window.location.origin);// 404-page real-URL mode. A `blob:` iframe src crashes Framer's runtime on\n// the /404 (catch-all, non-absolute) route. There is no observable HTTP\n// status for an iframe src, so the 401 reload guard below does not run in\n// this branch; an empty token would load an unauthenticated error page, so\n// we bail to the error UI instead. The auth event re-invokes fetchContent\n// with a fresh token (same as today).\nif(errorPageMode){if(!token){setError(true);return;}setBlobUrl(realUrlSrc(token));return;}try{const domainParam=encodeURIComponent(window.location.hostname);const res=await resilientFetch(\"/api/v5/content/\"+lockId+\"?domain=\"+domainParam,{headers:{Authorization:\"Bearer \"+token}});if(!res.ok){if(res.status===401){// Token rejected (expired, domain mismatch, server invalidated, etc.).\n// Clear local state and reload so the login gate re-mounts on the next\n// frame. Leaving the backdrop without content would render a blank\n// screen (the iframe is conditional on blobUrl). Matches the existing\n// \"logout is a reload\" convention in lockSession.clear.\n// For a group member, clearing the group token re-gates\n// every member page (the group session is dead); also purge\n// any stale per-lock fallback token on this page.\nsessionFor().clear();if(useGroup)lockSession(lockId).clear();// Reload-storm guard. A persistently-rejected token would\n// 401 every mount → reload → re-mount → 401 forever, faster\n// than React can paint the LoginForm sibling. We stamp the\n// last reload timestamp in sessionStorage (per-tab, per-\n// lockId) and fall through to the error UI when a second\n// 401 lands inside the window. The \"Try Again\" button on\n// that UI clears state and lets the visitor retry manually.\ntry{const guardKey=\"pagelock_401_reload_\"+lockId;const last=parseInt(sessionStorage.getItem(guardKey)||\"0\",10);const now=Date.now();if(now-last<5e3){setError(true);return;}sessionStorage.setItem(guardKey,String(now));}catch{/* sessionStorage unavailable — fall through and reload once */}if(typeof window!==\"undefined\")window.location.reload();return;}// Other errors (404 missing content, 5xx) — surface the error UI\n// with the Try Again button rather than silently going blank.\nsetError(true);return;}const data=await res.json();const html=data.html||\"\";// Group sessions store their token ONLY under the group key, but a\n// snapshot captured while the page was in Edit Mode carries the\n// temporary edit-mode gate baked in — and that gate self-hides by\n// checking the PER-LOCK key (`proofly_v5_token_<lockId>`) at mount,\n// with no group awareness. Alias the just-proven-valid group token\n// onto the per-lock key BEFORE the iframe mounts so the embedded\n// gate stays hidden (the content endpoint accepts either token\n// type). The 401 handler and logout path above already purge this\n// per-lock key alongside the group session, so the alias can't\n// outlive the session it mirrors.\nif(useGroup){try{localStorage.setItem(LOCK_TOKEN_PREFIX+lockId,token);}catch{/* storage unavailable — embedded gate may show; non-fatal */}}// Embed pages: the server omitted the html and asked us to render from\n// a real URL instead of a blob, so the page's cross-origin embeds get\n// a real Referer (a blob iframe sends none → YouTube error 153). Same\n// host-parented `?format=html` serve the /404 page uses. The token was\n// just validated by the fetch above, so this serve won't 401. Every\n// non-embed page keeps the unchanged blob render below.\nif(data.embedServe){setBlobUrl(realUrlSrc(token));return;}const blob=new Blob([buildProtectedContentHtml(html,lockId)],{type:\"text/html\"});setBlobUrl(URL.createObjectURL(blob));}catch{setError(true);}};useEffect(()=>{setMounted(true);setIsCanvas(isCanvasHost());if(!lockId||isCanvasHost())return;const session=sessionFor();// Prefer the active session's token. When this page is in a group, fall\n// back to a leftover per-lock token (e.g. the visitor authenticated to\n// this page before it joined the group) so they aren't forced to log in\n// again; the content endpoint accepts either token type.\nconst stored=session.get()||(useGroup?lockSession(lockId).get():null);if(stored)fetchContent(stored);const unsubscribe=session.onAuthChange(token=>fetchContent(token));// Listen for the paint-stability ping from the injected probe and\n// tint the backdrop to match the protected page's actual body bg.\n// The previous `proofly:content-ready:<lockId>` re-emit had no\n// listener anywhere and was removed.\nconst onMessage=event=>{const data=event.data;if(!data||typeof data!==\"object\")return;if(data.type!==\"pagelock-painted\")return;if(data.lockId!==lockId)return;if(typeof data.bgColor===\"string\"&&data.bgColor.length>0){setBgColor(data.bgColor);}};window.addEventListener(\"message\",onMessage);return()=>{unsubscribe();window.removeEventListener(\"message\",onMessage);};},[lockId,groupIdStr]);if(!mounted)return null;// Canvas preview\nif(isCanvas){return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",background:backgroundColor,flexDirection:\"column\",gap:12},children:[/*#__PURE__*/_jsxs(\"svg\",{width:\"40\",height:\"40\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:spinnerColor,strokeWidth:\"1.5\",children:[/*#__PURE__*/_jsx(\"rect\",{x:\"3\",y:\"11\",width:\"18\",height:\"11\",rx:\"2\",ry:\"2\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M7 11V7a5 5 0 0 1 10 0v4\"})]}),/*#__PURE__*/_jsx(\"p\",{style:{margin:0,fontSize:13,color:spinnerColor,textAlign:\"center\",maxWidth:200},children:\"Protected content appears here after authentication\"})]});}// Error state\nif(error){return /*#__PURE__*/createPortal(/*#__PURE__*/_jsxs(\"div\",{style:{position:\"fixed\",top:0,left:0,width:\"100vw\",height:\"100vh\",zIndex:Z_BACKDROP,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",background:backgroundColor,flexDirection:\"column\",gap:12},children:[/*#__PURE__*/_jsx(\"p\",{style:{margin:0,fontSize:14,color:\"#ef4444\",textAlign:\"center\"},children:errorText}),/*#__PURE__*/_jsx(\"button\",{onClick:()=>{sessionFor().clear();if(useGroup)lockSession(lockId).clear();setError(false);},style:{padding:\"8px 20px\",background:\"#ef4444\",color:\"#fff\",border:\"none\",borderRadius:8,cursor:\"pointer\",fontSize:13},children:\"Try Again\"})]}),document.body);}// Authenticated — colored backdrop + iframe layered on top. The\n// backdrop covers the underlying live page so when the login form on\n// top of us unmounts, the viewer never sees the unprotected page\n// peek through. Once the in-iframe probe reports paint, we tint the\n// backdrop to match the protected page's actual body bg color.\nconst backdropColor=bgColor||backgroundColor||\"#ffffff\";return /*#__PURE__*/createPortal(/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"fixed\",top:0,left:0,width:\"100vw\",height:\"100vh\",zIndex:Z_BACKDROP_TINT,background:backdropColor}}),blobUrl&&/*#__PURE__*/_jsx(\"iframe\",{src:blobUrl,style:{position:\"fixed\",top:0,left:0,width:\"100vw\",height:\"100vh\",border:\"none\",zIndex:Z_BACKDROP,overflow:\"auto\",WebkitOverflowScrolling:\"touch\",overscrollBehavior:\"contain\"},scrolling:\"yes\",sandbox:sandboxPermissions,title:\"Protected Content\"})]}),document.body);}addPropertyControls(PageLockContent,{lockId:{type:ControlType.String,title:\"Lock ID\",defaultValue:\"\"},groupId:{type:ControlType.String,title:\"Group ID\",defaultValue:\"\"},apiUrl:{type:ControlType.String,title:\"API URL\",defaultValue:\"https://proofly.ae\"},fallbackUrl:{type:ControlType.String,title:\"Fallback URL\",defaultValue:\"https://fallback.proofly.ae\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#ffffff\"},spinnerColor:{type:ControlType.Color,title:\"Spinner Color\",defaultValue:\"#000000\"},errorText:{type:ControlType.String,title:\"Error Text\",defaultValue:\"Failed to load content. Please try again.\"},sandboxPermissions:{type:ControlType.String,title:\"Sandbox\",defaultValue:\"allow-scripts allow-same-origin allow-forms allow-popups allow-top-navigation\"},errorPageMode:{type:ControlType.Boolean,title:\"Error Page Mode\",defaultValue:false}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PageLockContent\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"600\",\"framerDisableUnlink\":\"* @framerIntrinsicWidth 400\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PageLockContentY.map"],"mappings":"iNAYuC,SAAS,GAAc,CAAC,GAAU,IAAS,OAAY,MAAO,GAAM,IAAM,EAAE,EAAO,SAAS,SAAS,OAAO,IAAI,cAAc,IAAI,gBAAiB,CAO1K,SAAS,EAAqB,EAAS,CAAC,MAAc,CAA4D,GAAxD,GAAmB,OAAO,SAAW,KAAsB,EAAa,EAAE,OAAO,IAAI,EAAK,SAAS,cAAc,uBAAuB,EAAQ,EAAY,EAAK,EAAK,aAAa,SAAS,EAAE,KAAW,EAAQ,CAAC,EAAoM,OAA5L,EAAM,EAAK,aAAa,UAAU,CAAqB,GAAQ,EAAK,SAAS,cAAc,MAAM,EAAE,EAAK,KAAK,WAAW,EAAK,QAAQ,EAAsB,SAAS,KAAK,YAAY,CAAI,OAAa,CAAK,IAAe,EAAS,EAAK,OAAO,EAAW,IAAc,MAAM,EAAK,aAAa,UAAU,CAAW,EAAG,CAAE,EAAE,CAAC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