import{dZ as S,bU as $,O as T,d_ as W,e4 as C,D as O,K as j,o as E,ao as N}from"./index-CNZMR1GT.js";import{F}from"./File-Kold2EZA.js";import"./icon-BZFY9fuK.js";import"./index-DsSWFirV.js";import"./Layout-CjSD56n-.js";import"./useTitle-BClow7LS.js";import"./FolderTree-CTh3_qOS.js";import"./index-B-NmelxC.js";import"./index-DvQYEsdd.js";import"./share-BRMiJJnc.js";import"./index-DUl6hczb.js";var b,I;function J(){if(I)return b;I=1;const{hasOwnProperty:y}=Object.prototype,p=(e,t={})=>{typeof t=="string"&&(t={section:t}),t.align=t.align===!0,t.newline=t.newline===!0,t.sort=t.sort===!0,t.whitespace=t.whitespace===!0||t.align===!0,t.platform=t.platform||typeof process<"u"&&process.platform,t.bracketedArray=t.bracketedArray!==!1;const s=t.platform==="win32"?"\r\n":"\n",n=t.whitespace?" = ":"=",c=[],o=t.sort?Object.keys(e).sort():Object.keys(e);let _=0;t.align&&(_=u(o.filter(r=>e[r]===null||Array.isArray(e[r])||typeof e[r]!="object").map(r=>Array.isArray(e[r])?"".concat(r,"[]"):r).concat([""]).reduce((r,i)=>u(r).length>=u(i).length?r:i)).length);let a="";const w=t.bracketedArray?"[]":"";for(const r of o){const i=e[r];if(i&&Array.isArray(i))for(const l of i)a+=u("".concat(r).concat(w)).padEnd(_," ")+n+u(l)+s;else i&&typeof i=="object"?c.push(r):a+=u(r).padEnd(_," ")+n+u(i)+s}t.section&&a.length&&(a="["+u(t.section)+"]"+(t.newline?s+s:s)+a);for(const r of c){const i=g(r,".").join("\\."),l=(t.section?t.section+".":"")+i,h=p(e[r],{...t,section:l});a.length&&h.length&&(a+=s),a+=h}return a};function g(e,t){var s=0,n=0,c=0,o=[];do if(c=e.indexOf(t,s),c!==-1){if(s=c+t.length,c>0&&e[c-1]==="\\")continue;o.push(e.slice(n,c)),n=c+t.length}while(c!==-1);return o.push(e.slice(n)),o}const m=(e,t={})=>{t.bracketedArray=t.bracketedArray!==!1;const s=Object.create(null);let n=s,c=null;const o=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,_=e.split(/[\r\n]+/g),a={};for(const r of _){if(!r||r.match(/^\s*[;#]/)||r.match(/^\s*$/))continue;const i=r.match(o);if(!i)continue;if(i[1]!==void 0){if(c=d(i[1]),c==="__proto__"){n=Object.create(null);continue}n=s[c]=s[c]||Object.create(null);continue}const l=d(i[2]);let h;t.bracketedArray?h=l.length>2&&l.slice(-2)==="[]":(a[l]=((a==null?void 0:a[l])||0)+1,h=a[l]>1);const f=h&&l.endsWith("[]")?l.slice(0,-2):l;if(f==="__proto__")continue;const k=i[3]?d(i[4]):!0,x=k==="true"||k==="false"||k==="null"?JSON.parse(k):k;h&&(y.call(n,f)?Array.isArray(n[f])||(n[f]=[n[f]]):n[f]=[]),Array.isArray(n[f])?n[f].push(x):n[f]=x}const w=[];for(const r of Object.keys(s)){if(!y.call(s,r)||typeof s[r]!="object"||Array.isArray(s[r]))continue;const i=g(r,".");n=s;const l=i.pop(),h=l.replace(/\\\./g,".");for(const f of i)f!=="__proto__"&&((!y.call(n,f)||typeof n[f]!="object")&&(n[f]=Object.create(null)),n=n[f]);n===s&&h===l||(n[h]=s[r],w.push(r))}for(const r of w)delete s[r];return s},A=e=>e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"),u=e=>typeof e!="string"||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&A(e)||e!==e.trim()?JSON.stringify(e):e.split(";").join("\\;").split("#").join("\\#"),d=e=>{if(e=(e||"").trim(),A(e)){e.charAt(0)==="'"&&(e=e.slice(1,-1));try{e=JSON.parse(e)}catch(t){}}else{let t=!1,s="";for(let n=0,c=e.length;n<c;n++){const o=e.charAt(n);if(t)"\\;#".indexOf(o)!==-1?s+=o:s+="\\"+o,t=!1;else{if(";#".indexOf(o)!==-1)break;o==="\\"?t=!0:s+=o}}return t&&(s+="\\"),s.trim()}return e};return b={parse:m,decode:m,stringify:p,encode:p,safe:u,unsafe:d},b}var M=J();function G(){const[y]=S(),{copy:p}=$(),g=T(()=>{var A,u;try{const d=((A=y())==null?void 0:A.content)||"",{text:e}=W(d);return((u=C(M.parse(e()||"")).internetshortcut)==null?void 0:u.url)||"#"}catch(d){return console.error("Error parsing INI content:",d),"#"}}),m=E();return O(N,{get loading(){return y.loading},get children(){return O(F,{get children(){return[O(j,{colorScheme:"accent",onClick:()=>p(g()),get children(){return m("home.toolbar.copy_link")}}),O(j,{as:"a",get href(){return g()},target:"_blank",rel:"noopener noreferrer",get children(){return m("home.preview.open_in_new_window")}})]}})}})}export{G as default};
