{"version":3,"file":"MagicLock.DLNkd6vY.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/Nhnx1UVtWOsDzxI2Ffso/yGErmaftSjR1FoW2oYDM/MagicLock.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";const STAMP_NAME=\"kagi_open\";const URL_MEMO_KEY=\"last_article_url\"// ★URLを覚えるためのキー\n;// ----------------------------------------\n// 1. カバー（ふた）& URL記憶\n// ----------------------------------------\nexport function Gate(Component){return props=>{const[isUnlocked,setIsUnlocked]=useState(false);useEffect(()=>{// ★追加：今の記事のURLをメモしておく！\nwindow.localStorage.setItem(URL_MEMO_KEY,window.location.href);const stamp=window.localStorage.getItem(STAMP_NAME);if(stamp===\"true\"){setIsUnlocked(true);}},[]);if(isUnlocked)return null;return /*#__PURE__*/_jsx(Component,{...props});};}// ----------------------------------------\n// 2. 解除ボタン（変更なし）\n// ----------------------------------------\nexport function KeyButton(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,onClick:()=>{window.localStorage.setItem(STAMP_NAME,\"true\");window.location.reload();}});};}// ----------------------------------------\n// 3. サンクスページ用（自動スタンプ）\n// ----------------------------------------\nexport function AutoStamp(Component){return props=>{useEffect(()=>{window.localStorage.setItem(STAMP_NAME,\"true\");},[]);return /*#__PURE__*/_jsx(Component,{...props});};}// ----------------------------------------\n// 4. 高さ制限（コンテナ用）\n// ----------------------------------------\nexport function HeightLimiter(Component){return props=>{const[isUnlocked,setIsUnlocked]=useState(false);useEffect(()=>{// ★ここでも念のためURLをメモ\nwindow.localStorage.setItem(URL_MEMO_KEY,window.location.href);const stamp=window.localStorage.getItem(STAMP_NAME);if(stamp===\"true\")setIsUnlocked(true);},[]);return /*#__PURE__*/_jsx(Component,{...props,style:{...props.style,height:isUnlocked?\"auto\":\"400px\",overflow:\"hidden\"}});};}// ----------------------------------------\n// 5. 【新機能】記事に戻るボタン\n// メモしておいたURLへ移動する\n// ----------------------------------------\nexport function BackToArticle(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,onClick:()=>{// メモしたURLを読み出す\nconst lastUrl=window.localStorage.getItem(URL_MEMO_KEY);if(lastUrl){// メモがあればそこへ戻る\nwindow.location.href=lastUrl;}else{// メモがなければトップページなどへ（予備）\nwindow.location.href=\"/\";}}});};}\nexport const __FramerMetadata__ = {\"exports\":{\"HeightLimiter\":{\"type\":\"reactHoc\",\"name\":\"HeightLimiter\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"AutoStamp\":{\"type\":\"reactHoc\",\"name\":\"AutoStamp\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"BackToArticle\":{\"type\":\"reactHoc\",\"name\":\"BackToArticle\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"KeyButton\":{\"type\":\"reactHoc\",\"name\":\"KeyButton\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"Gate\":{\"type\":\"reactHoc\",\"name\":\"Gate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./MagicLock.map"],"mappings":"uIAIA,SAAgB,EAAK,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,EAAW,GAAeA,EAAS,GAAM,CAC6F,OAD5F,MAAc,CAC7G,EAAO,aAAa,QAAQ,EAAa,EAAO,SAAS,KAAK,CAAa,EAAO,aAAa,QAAQ,EAAW,GAAY,QAAQ,EAAc,GAAK,EAAI,EAAE,CAAC,CAAI,EAAkB,KAAyB,EAAK,EAAU,CAAC,GAAG,EAAM,CAAC,EAMzO,SAAgB,EAAU,EAAU,CAAC,MAAO,KAAQ,MAAc,CAAC,EAAO,aAAa,QAAQ,EAAW,OAAO,EAAG,EAAE,CAAC,CAAqB,EAAK,EAAU,CAAC,GAAG,EAAM,CAAC,EAGtK,SAAgB,EAAc,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,EAAW,GAAeA,EAAS,GAAM,CACwD,OADvD,MAAc,CACtH,EAAO,aAAa,QAAQ,EAAa,EAAO,SAAS,KAAK,CAAa,EAAO,aAAa,QAAQ,EAAW,GAAY,QAAO,EAAc,GAAK,EAAG,EAAE,CAAC,CAAqB,EAAK,EAAU,CAAC,GAAG,EAAM,MAAM,CAAC,GAAG,EAAM,MAAM,OAAO,EAAW,OAAO,QAAQ,SAAS,SAAS,CAAC,CAAC,EAIvR,SAAgB,EAAc,EAAU,CAAC,MAAO,IAA4B,EAAK,EAAU,CAAC,GAAG,EAAM,YAAY,CACjH,IAAM,EAAQ,EAAO,aAAa,QAAQ,EAAa,CAAI,EAC3D,EAAO,SAAS,KAAK,EACrB,EAAO,SAAS,KAAK,KAAO,CAAC,0BAtBc,IAAsC,CAAM,EAAW,YAAkB,EAAa"}