sliccy 0.1.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/LICENSE +191 -0
- package/README.md +512 -0
- package/dist/cli/chrome-launch.d.ts +47 -0
- package/dist/cli/chrome-launch.js +324 -0
- package/dist/cli/cli-log-dedup.d.ts +19 -0
- package/dist/cli/cli-log-dedup.js +62 -0
- package/dist/cli/electron-controller.d.ts +38 -0
- package/dist/cli/electron-controller.js +287 -0
- package/dist/cli/electron-main.d.ts +1 -0
- package/dist/cli/electron-main.js +183 -0
- package/dist/cli/electron-runtime.d.ts +58 -0
- package/dist/cli/electron-runtime.js +133 -0
- package/dist/cli/file-logger.d.ts +38 -0
- package/dist/cli/file-logger.js +207 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +1023 -0
- package/dist/cli/launch-url.d.ts +9 -0
- package/dist/cli/launch-url.js +34 -0
- package/dist/cli/qa-setup.d.ts +1 -0
- package/dist/cli/qa-setup.js +36 -0
- package/dist/cli/release-package.d.ts +17 -0
- package/dist/cli/release-package.js +232 -0
- package/dist/cli/runtime-flags.d.ts +21 -0
- package/dist/cli/runtime-flags.js +154 -0
- package/dist/cli/sync-release-version.d.ts +2 -0
- package/dist/cli/sync-release-version.js +34 -0
- package/dist/tray-url-shared.d.ts +11 -0
- package/dist/tray-url-shared.js +56 -0
- package/dist/ui/assets/___vite-browser-external_commonjs-proxy-7ULRRj69.js +1 -0
- package/dist/ui/assets/__vite-browser-external-D7Ct-6yo.js +1 -0
- package/dist/ui/assets/addon-fit-DOCEibfw.js +12 -0
- package/dist/ui/assets/bsh-watchdog-D19WB0U1.js +2 -0
- package/dist/ui/assets/index-BVQAdk-Y.js +8 -0
- package/dist/ui/assets/index-BjJrFm2K.js +43 -0
- package/dist/ui/assets/index-C1dglHrI.js +3 -0
- package/dist/ui/assets/index-D3Enm5ux.js +13091 -0
- package/dist/ui/assets/index-D7hjyFh1.js +2 -0
- package/dist/ui/assets/index-D8uSC2sl.js +45 -0
- package/dist/ui/assets/index-DEglHp2j.js +1 -0
- package/dist/ui/assets/index-DvjzakYY.js +14406 -0
- package/dist/ui/assets/index-deZeJCgO.js +1 -0
- package/dist/ui/assets/index-mz3VYh0I.js +131 -0
- package/dist/ui/assets/index-r2m8Dpaz.js +54 -0
- package/dist/ui/assets/index-ygVJ3eFG.js +11 -0
- package/dist/ui/assets/lick-manager-proxy-G3WuipZ-.js +1 -0
- package/dist/ui/assets/magic-string.es-BPLJknd7.js +10 -0
- package/dist/ui/assets/oauth-service-DIahkF-o.js +1 -0
- package/dist/ui/assets/offscreen-client-ByVIJGHW.js +1 -0
- package/dist/ui/assets/pdfjs-uyZuKmOq.js +59 -0
- package/dist/ui/assets/pyodide-D73G_Ygx.mjs +4 -0
- package/dist/ui/assets/sql-wasm-BggYNCID.js +2 -0
- package/dist/ui/assets/stream-lEC9OYG2.js +1 -0
- package/dist/ui/assets/xterm-Bb8UKAlD.js +27 -0
- package/dist/ui/assets/xterm-DOrYoP_4.css +32 -0
- package/dist/ui/electron-overlay-entry.js +360 -0
- package/dist/ui/favicon.png +0 -0
- package/dist/ui/fonts/AdobeClean-Bold.otf +0 -0
- package/dist/ui/fonts/AdobeClean-ExtraBold.otf +0 -0
- package/dist/ui/fonts/AdobeClean-Medium.otf +0 -0
- package/dist/ui/fonts/AdobeClean-Regular.otf +0 -0
- package/dist/ui/index.html +1981 -0
- package/dist/ui/preview-sw.js +4 -0
- package/package.json +81 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{_ as M}from"./index-DvjzakYY.js";let w;const _=globalThis.process?.release?.name==="node",E=typeof window<"u";async function g(t,e={}){const{getDocument:a}=await p();return await a({data:t,isEvalSupported:!1,useSystemFonts:!0,...e}).promise}async function p(){return w||await f(),w}async function f(t,{reload:e=!1}={}){if(!(w&&!e)){if(t)try{w=await D(t());return}catch(a){throw new Error(`PDF.js could not be resolved: ${a}`)}try{w=await M(()=>import("./pdfjs-uyZuKmOq.js"),[])}catch(a){throw new Error(`Serverless PDF.js bundle could not be resolved: ${a}`)}}}function h(t){return typeof t=="object"&&t!==null&&"_pdfInfo"in t}async function D(t){const e=await t;return e.default||e}let d;/**
|
|
2
|
+
* Derived from the PDF.js project by the Mozilla Foundation.
|
|
3
|
+
* @see https://github.com/mozilla/pdf.js/blob/b8de9a372f9bbf7e33adb362eeae5ef1919dba73/src/display/canvas_factory.js#L18
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/class x{#t=!1;constructor({enableHWA:e=!1}={}){this.#t=e}create(e,a){const n=this._createCanvas(e,a);return{canvas:n,context:n.getContext("2d",{willReadFrequently:!this.#t})}}reset({canvas:e},a,n){if(!e)throw new Error("Canvas is not specified");e.width=a,e.height=n}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=void 0,e.context=void 0}_createCanvas(e,a){throw new Error("Not implemented")}}/**
|
|
6
|
+
* Derived from the PDF.js project by the Mozilla Foundation.
|
|
7
|
+
* @see https://github.com/mozilla/pdf.js/blob/b8de9a372f9bbf7e33adb362eeae5ef1919dba73/src/display/canvas_factory.js#L18
|
|
8
|
+
* @license Apache-2.0
|
|
9
|
+
*/class I extends x{_document;constructor({ownerDocument:e=globalThis.document,enableHWA:a=!1}={}){super({enableHWA:a}),this._document=e}_createCanvas(e,a){const n=this._document.createElement("canvas");return n.width=e,n.height=a,n}}class F extends x{constructor({enableHWA:e=!1}={}){super({enableHWA:e})}_createCanvas(e,a){if(!d)throw new Error("@napi-rs/canvas module is not resolved");return d.createCanvas(e,a)}}async function T(t){d??=await D(t())}function O(){d&&(typeof globalThis.DOMMatrix>"u"&&(globalThis.DOMMatrix=d.DOMMatrix),typeof globalThis.ImageData>"u"&&(globalThis.ImageData=d.ImageData),typeof globalThis.Path2D>"u"&&(globalThis.Path2D=d.Path2D))}async function j(t,e){const a=h(t)?t:await g(t);if(e<1||e>a.numPages)throw new Error(`Invalid page number. Must be between 1 and ${a.numPages}.`);const n=await a.getPage(e),r=await n.getOperatorList(),{OPS:s}=await p(),c=[];for(let o=0;o<r.fnArray.length;o++){if(r.fnArray[o]!==s.paintImageXObject)continue;const i=r.argsArray[o][0],u=await new Promise(b=>(i.startsWith("g_")?n.commonObjs:n.objs).get(i,b));if(!u||!u.data||!u.width||!u.height)continue;const{width:m,height:y,data:v}=u,P=v.length/(m*y);if(![1,3,4].includes(P))continue;const C=P;c.push({data:v,width:m,height:y,channels:C,key:i})}return c}async function A(t,e,a={}){const n=await L(a.canvasImport),r=h(t)?t:await g(t,{CanvasFactory:n}),s=await r.getPage(e);if(e<1||e>r.numPages)throw new Error(`Invalid page number. Must be between 1 and ${r.numPages}.`);const c=s.getViewport({scale:1});let o=a.scale||1;a.width?o=a.width/c.width:a.height&&(o=a.height/c.height);const l=s.getViewport({scale:Math.max(0,o)}),i=new n().create(l.width,l.height);await s.render({canvas:i.canvas,canvasContext:i.context,viewport:l}).promise;const u=i.canvas.toDataURL();return a.toDataURL?u:await(await fetch(u)).arrayBuffer()}async function L(t){if(E)return I;if(_){if(!t)throw new Error('Parameter "canvasImport" is required in Node.js environment.');return await T(t),O(),F}throw new Error("Unsupported environment for canvas creation.")}async function S(t){const e=h(t)?t:await g(t),a=await Promise.all(Array.from({length:e.numPages},(n,r)=>$(e,r+1)));return{totalPages:e.numPages,links:a.flat()}}async function $(t,e){const n=await(await t.getPage(e)).getAnnotations(),r=[];for(const s of n)s.subtype==="Link"&&s.url&&r.push(s.url);return r}const k=["xmp:createdate","xmp:modifydate","xmp:metadatadate","xap:createdate","xap:modifydate","xap:metadatadate"];async function R(t,e={}){const n=await(h(t)?t:await g(t)).getMetadata(),r=n?.info||{};if(e.parseDates){const{PDFDateString:s}=await p();r?.CreationDate&&(r.CreationDate=s.toDateObject(r?.CreationDate)),r?.ModDate&&(r.ModDate=s.toDateObject(r?.ModDate)),n.metadata&&(n.metadata=new Proxy(n.metadata,{get(c,o){return o==="get"?l=>{const i=c.get(l);return k.includes(l)&&i?U(i):i}:c[o]}}))}return{info:r,metadata:n?.metadata||{}}}function U(t){if(!t)return;const e=Date.parse(t);if(!Number.isNaN(e))return new Date(e)}async function V(t,e={}){const{mergePages:a=!1}=e,n=h(t)?t:await g(t),r=await Promise.all(Array.from({length:n.numPages},(s,c)=>B(n,c+1)));return{totalPages:n.numPages,text:a?r.join(`
|
|
10
|
+
`).replace(/\s+/g," "):r}}async function B(t,e){return(await(await t.getPage(e)).getTextContent()).items.filter(r=>r.str!=null).map(r=>r.str+(r.hasEOL?`
|
|
11
|
+
`:"")).join("")}async function N(t){await f(t,{reload:!0})}async function q(t){await f(t.pdfjs,{reload:!0})}const W=async(...t)=>(await f(),await R(...t)),X=async(...t)=>(await f(),await V(...t)),H=async(...t)=>(await f(),await j(...t)),K=async(...t)=>(await f(),await A(...t)),z=async(...t)=>(await f(),await S(...t));export{q as configureUnPDF,L as createIsomorphicCanvasFactory,N as definePDFJSModule,H as extractImages,z as extractLinks,X as extractText,g as getDocumentProxy,W as getMeta,p as getResolvedPDFJS,K as renderPageAsImage,f as resolvePDFJSImport};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const l="slicc-lick-manager";function p(n){const r=new BroadcastChannel(l);r.onmessage=async a=>{const s=a.data;if(!s||s.type!=="lick-op")return;const{id:o,op:c,args:e}=s;try{let t;switch(c){case"createCronTask":t=await n.createCronTask(e[0],e[1],e[2],e[3]);break;case"listCronTasks":t=n.listCronTasks();break;case"deleteCronTask":t=await n.deleteCronTask(e[0]);break;default:throw new Error(`Unknown lick-manager op: ${c}`)}r.postMessage({type:"lick-op-response",id:o,result:t})}catch(t){r.postMessage({type:"lick-op-response",id:o,error:t instanceof Error?t.message:String(t)})}}}function T(){function n(r,a=[]){const s=`lm-${Date.now()}-${Math.random().toString(36).slice(2)}`,o=new BroadcastChannel(l);return new Promise((c,e)=>{const t=setTimeout(()=>{o.close(),e(new Error("LickManager operation timed out"))},5e3);o.onmessage=k=>{const i=k.data;!i||i.type!=="lick-op-response"||i.id!==s||(clearTimeout(t),o.close(),i.error?e(new Error(i.error)):c(i.result))},o.postMessage({type:"lick-op",id:s,op:r,args:a})})}return{createCronTask:(r,a,s,o)=>n("createCronTask",[r,a,s,o]),listCronTasks:()=>{throw new Error("Use listCronTasksAsync instead")},deleteCronTask:r=>n("deleteCronTask",[r])}}function m(){const n=`lm-${Date.now()}-${Math.random().toString(36).slice(2)}`,r=new BroadcastChannel(l);return new Promise((a,s)=>{const o=setTimeout(()=>{r.close(),s(new Error("LickManager operation timed out"))},5e3);r.onmessage=c=>{const e=c.data;!e||e.type!=="lick-op-response"||e.id!==n||(clearTimeout(o),r.close(),e.error?s(new Error(e.error)):a(e.result))},r.postMessage({type:"lick-op",id:n,op:"listCronTasks",args:[]})})}export{T as createLickManagerProxy,m as listCronTasksAsync,p as startLickManagerHost};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var x=44,E=59,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=new Uint8Array(64),k=new Uint8Array(128);for(let u=0;u<m.length;u++){const t=m.charCodeAt(u);y[u]=t,k[t]=u}function c(u,t,e){let i=t-e;i=i<0?-i<<1|1:i<<1;do{let n=i&31;i>>>=5,i>0&&(n|=32),u.write(y[n])}while(i>0);return t}var b=1024*16,C=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(u){return Buffer.from(u.buffer,u.byteOffset,u.byteLength).toString()}}:{decode(u){let t="";for(let e=0;e<u.length;e++)t+=String.fromCharCode(u[e]);return t}},L=class{constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(b)}write(u){const{buffer:t}=this;t[this.pos++]=u,this.pos===b&&(this.out+=C.decode(t),this.pos=0)}flush(){const{buffer:u,out:t,pos:e}=this;return e>0?t+C.decode(u.subarray(0,e)):t}};function R(u){const t=new L;let e=0,i=0,n=0,r=0;for(let s=0;s<u.length;s++){const h=u[s];if(s>0&&t.write(E),h.length===0)continue;let o=0;for(let l=0;l<h.length;l++){const a=h[l];l>0&&t.write(x),o=c(t,a[0],o),a.length!==1&&(e=c(t,a[1],e),i=c(t,a[2],i),n=c(t,a[3],n),a.length!==4&&(r=c(t,a[4],r)))}}return t.flush()}class p{constructor(t){this.bits=t instanceof p?t.bits.slice():[]}add(t){this.bits[t>>5]|=1<<(t&31)}has(t){return!!(this.bits[t>>5]&1<<(t&31))}}class d{constructor(t,e,i){this.start=t,this.end=e,this.original=i,this.intro="",this.outro="",this.content=i,this.storeName=!1,this.edited=!1,this.previous=null,this.next=null}appendLeft(t){this.outro+=t}appendRight(t){this.intro=this.intro+t}clone(){const t=new d(this.start,this.end,this.original);return t.intro=this.intro,t.outro=this.outro,t.content=this.content,t.storeName=this.storeName,t.edited=this.edited,t}contains(t){return this.start<t&&t<this.end}eachNext(t){let e=this;for(;e;)t(e),e=e.next}eachPrevious(t){let e=this;for(;e;)t(e),e=e.previous}edit(t,e,i){return this.content=t,i||(this.intro="",this.outro=""),this.storeName=e,this.edited=!0,this}prependLeft(t){this.outro=t+this.outro}prependRight(t){this.intro=t+this.intro}reset(){this.intro="",this.outro="",this.edited&&(this.content=this.original,this.storeName=!1,this.edited=!1)}split(t){const e=t-this.start,i=this.original.slice(0,e),n=this.original.slice(e);this.original=i;const r=new d(t,this.end,n);return r.outro=this.outro,this.outro="",this.end=t,this.edited?(r.edit("",!1),this.content=""):this.content=i,r.next=this.next,r.next&&(r.next.previous=r),r.previous=this,this.next=r,r}toString(){return this.intro+this.content+this.outro}trimEnd(t){if(this.outro=this.outro.replace(t,""),this.outro.length)return!0;const e=this.content.replace(t,"");if(e.length)return e!==this.content&&(this.split(this.start+e.length).edit("",void 0,!0),this.edited&&this.edit(e,this.storeName,!0)),!0;if(this.edit("",void 0,!0),this.intro=this.intro.replace(t,""),this.intro.length)return!0}trimStart(t){if(this.intro=this.intro.replace(t,""),this.intro.length)return!0;const e=this.content.replace(t,"");if(e.length){if(e!==this.content){const i=this.split(this.end-e.length);this.edited&&i.edit(e,this.storeName,!0),this.edit("",void 0,!0)}return!0}else if(this.edit("",void 0,!0),this.outro=this.outro.replace(t,""),this.outro.length)return!0}}function _(){return typeof globalThis<"u"&&typeof globalThis.btoa=="function"?u=>globalThis.btoa(unescape(encodeURIComponent(u))):typeof Buffer=="function"?u=>Buffer.from(u,"utf-8").toString("base64"):()=>{throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.")}}const O=_();class N{constructor(t){this.version=3,this.file=t.file,this.sources=t.sources,this.sourcesContent=t.sourcesContent,this.names=t.names,this.mappings=R(t.mappings),typeof t.x_google_ignoreList<"u"&&(this.x_google_ignoreList=t.x_google_ignoreList),typeof t.debugId<"u"&&(this.debugId=t.debugId)}toString(){return JSON.stringify(this)}toUrl(){return"data:application/json;charset=utf-8;base64,"+O(this.toString())}}function I(u){const t=u.split(`
|
|
2
|
+
`),e=t.filter(r=>/^\t+/.test(r)),i=t.filter(r=>/^ {2,}/.test(r));if(e.length===0&&i.length===0)return null;if(e.length>=i.length)return" ";const n=i.reduce((r,s)=>{const h=/^ +/.exec(s)[0].length;return Math.min(h,r)},1/0);return new Array(n+1).join(" ")}function A(u,t){const e=u.split(/[/\\]/),i=t.split(/[/\\]/);for(e.pop();e[0]===i[0];)e.shift(),i.shift();if(e.length){let n=e.length;for(;n--;)e[n]=".."}return e.concat(i).join("/")}const T=Object.prototype.toString;function j(u){return T.call(u)==="[object Object]"}function v(u){const t=u.split(`
|
|
3
|
+
`),e=[];for(let i=0,n=0;i<t.length;i++)e.push(n),n+=t[i].length+1;return function(n){let r=0,s=e.length;for(;r<s;){const l=r+s>>1;n<e[l]?s=l:r=l+1}const h=r-1,o=n-e[h];return{line:h,column:o}}}const $=/\w/;class U{constructor(t){this.hires=t,this.generatedCodeLine=0,this.generatedCodeColumn=0,this.raw=[],this.rawSegments=this.raw[this.generatedCodeLine]=[],this.pending=null}addEdit(t,e,i,n){if(e.length){const r=e.length-1;let s=e.indexOf(`
|
|
4
|
+
`,0),h=-1;for(;s>=0&&r>s;){const l=[this.generatedCodeColumn,t,i.line,i.column];n>=0&&l.push(n),this.rawSegments.push(l),this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,h=s,s=e.indexOf(`
|
|
5
|
+
`,s+1)}const o=[this.generatedCodeColumn,t,i.line,i.column];n>=0&&o.push(n),this.rawSegments.push(o),this.advance(e.slice(h+1))}else this.pending&&(this.rawSegments.push(this.pending),this.advance(e));this.pending=null}addUneditedChunk(t,e,i,n,r){let s=e.start,h=!0,o=!1;for(;s<e.end;){if(i[s]===`
|
|
6
|
+
`)n.line+=1,n.column=0,this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,h=!0,o=!1;else{if(this.hires||h||r.has(s)){const l=[this.generatedCodeColumn,t,n.line,n.column];this.hires==="boundary"?$.test(i[s])?o||(this.rawSegments.push(l),o=!0):(this.rawSegments.push(l),o=!1):this.rawSegments.push(l)}n.column+=1,this.generatedCodeColumn+=1,h=!1}s+=1}this.pending=null}advance(t){if(!t)return;const e=t.split(`
|
|
7
|
+
`);if(e.length>1){for(let i=0;i<e.length-1;i++)this.generatedCodeLine++,this.raw[this.generatedCodeLine]=this.rawSegments=[];this.generatedCodeColumn=0}this.generatedCodeColumn+=e[e.length-1].length}}const g=`
|
|
8
|
+
`,f={insertLeft:!1,insertRight:!1,storeName:!1};class S{constructor(t,e={}){const i=new d(0,t.length,t);Object.defineProperties(this,{original:{writable:!0,value:t},outro:{writable:!0,value:""},intro:{writable:!0,value:""},firstChunk:{writable:!0,value:i},lastChunk:{writable:!0,value:i},lastSearchedChunk:{writable:!0,value:i},byStart:{writable:!0,value:{}},byEnd:{writable:!0,value:{}},filename:{writable:!0,value:e.filename},indentExclusionRanges:{writable:!0,value:e.indentExclusionRanges},sourcemapLocations:{writable:!0,value:new p},storedNames:{writable:!0,value:{}},indentStr:{writable:!0,value:void 0},ignoreList:{writable:!0,value:e.ignoreList},offset:{writable:!0,value:e.offset||0}}),this.byStart[0]=i,this.byEnd[t.length]=i}addSourcemapLocation(t){this.sourcemapLocations.add(t)}append(t){if(typeof t!="string")throw new TypeError("outro content must be a string");return this.outro+=t,this}appendLeft(t,e){if(t=t+this.offset,typeof e!="string")throw new TypeError("inserted content must be a string");this._split(t);const i=this.byEnd[t];return i?i.appendLeft(e):this.intro+=e,this}appendRight(t,e){if(t=t+this.offset,typeof e!="string")throw new TypeError("inserted content must be a string");this._split(t);const i=this.byStart[t];return i?i.appendRight(e):this.outro+=e,this}clone(){const t=new S(this.original,{filename:this.filename,offset:this.offset});let e=this.firstChunk,i=t.firstChunk=t.lastSearchedChunk=e.clone();for(;e;){t.byStart[i.start]=i,t.byEnd[i.end]=i;const n=e.next,r=n&&n.clone();r&&(i.next=r,r.previous=i,i=r),e=n}return t.lastChunk=i,this.indentExclusionRanges&&(t.indentExclusionRanges=this.indentExclusionRanges.slice()),t.sourcemapLocations=new p(this.sourcemapLocations),t.intro=this.intro,t.outro=this.outro,t}generateDecodedMap(t){t=t||{};const e=0,i=Object.keys(this.storedNames),n=new U(t.hires),r=v(this.original);return this.intro&&n.advance(this.intro),this.firstChunk.eachNext(s=>{const h=r(s.start);s.intro.length&&n.advance(s.intro),s.edited?n.addEdit(e,s.content,h,s.storeName?i.indexOf(s.original):-1):n.addUneditedChunk(e,s,this.original,h,this.sourcemapLocations),s.outro.length&&n.advance(s.outro)}),this.outro&&n.advance(this.outro),{file:t.file?t.file.split(/[/\\]/).pop():void 0,sources:[t.source?A(t.file||"",t.source):t.file||""],sourcesContent:t.includeContent?[this.original]:void 0,names:i,mappings:n.raw,x_google_ignoreList:this.ignoreList?[e]:void 0}}generateMap(t){return new N(this.generateDecodedMap(t))}_ensureindentStr(){this.indentStr===void 0&&(this.indentStr=I(this.original))}_getRawIndentString(){return this._ensureindentStr(),this.indentStr}getIndentString(){return this._ensureindentStr(),this.indentStr===null?" ":this.indentStr}indent(t,e){const i=/^[^\r\n]/gm;if(j(t)&&(e=t,t=void 0),t===void 0&&(this._ensureindentStr(),t=this.indentStr||" "),t==="")return this;e=e||{};const n={};e.exclude&&(typeof e.exclude[0]=="number"?[e.exclude]:e.exclude).forEach(a=>{for(let w=a[0];w<a[1];w+=1)n[w]=!0});let r=e.indentStart!==!1;const s=l=>r?`${t}${l}`:(r=!0,l);this.intro=this.intro.replace(i,s);let h=0,o=this.firstChunk;for(;o;){const l=o.end;if(o.edited)n[h]||(o.content=o.content.replace(i,s),o.content.length&&(r=o.content[o.content.length-1]===`
|
|
9
|
+
`));else for(h=o.start;h<l;){if(!n[h]){const a=this.original[h];a===`
|
|
10
|
+
`?r=!0:a!=="\r"&&r&&(r=!1,h===o.start||(this._splitChunk(o,h),o=o.next),o.prependRight(t))}h+=1}h=o.end,o=o.next}return this.outro=this.outro.replace(i,s),this}insert(){throw new Error("magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)")}insertLeft(t,e){return f.insertLeft||(console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"),f.insertLeft=!0),this.appendLeft(t,e)}insertRight(t,e){return f.insertRight||(console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"),f.insertRight=!0),this.prependRight(t,e)}move(t,e,i){if(t=t+this.offset,e=e+this.offset,i=i+this.offset,i>=t&&i<=e)throw new Error("Cannot move a selection inside itself");this._split(t),this._split(e),this._split(i);const n=this.byStart[t],r=this.byEnd[e],s=n.previous,h=r.next,o=this.byStart[i];if(!o&&r===this.lastChunk)return this;const l=o?o.previous:this.lastChunk;return s&&(s.next=h),h&&(h.previous=s),l&&(l.next=n),o&&(o.previous=r),n.previous||(this.firstChunk=r.next),r.next||(this.lastChunk=n.previous,this.lastChunk.next=null),n.previous=l,r.next=o||null,l||(this.firstChunk=n),o||(this.lastChunk=r),this}overwrite(t,e,i,n){return n=n||{},this.update(t,e,i,{...n,overwrite:!n.contentOnly})}update(t,e,i,n){if(t=t+this.offset,e=e+this.offset,typeof i!="string")throw new TypeError("replacement content must be a string");if(this.original.length!==0){for(;t<0;)t+=this.original.length;for(;e<0;)e+=this.original.length}if(e>this.original.length)throw new Error("end is out of bounds");if(t===e)throw new Error("Cannot overwrite a zero-length range – use appendLeft or prependRight instead");this._split(t),this._split(e),n===!0&&(f.storeName||(console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"),f.storeName=!0),n={storeName:!0});const r=n!==void 0?n.storeName:!1,s=n!==void 0?n.overwrite:!1;if(r){const l=this.original.slice(t,e);Object.defineProperty(this.storedNames,l,{writable:!0,value:!0,enumerable:!0})}const h=this.byStart[t],o=this.byEnd[e];if(h){let l=h;for(;l!==o;){if(l.next!==this.byStart[l.end])throw new Error("Cannot overwrite across a split point");l=l.next,l.edit("",!1)}h.edit(i,r,!s)}else{const l=new d(t,e,"").edit(i,r);o.next=l,l.previous=o}return this}prepend(t){if(typeof t!="string")throw new TypeError("outro content must be a string");return this.intro=t+this.intro,this}prependLeft(t,e){if(t=t+this.offset,typeof e!="string")throw new TypeError("inserted content must be a string");this._split(t);const i=this.byEnd[t];return i?i.prependLeft(e):this.intro=e+this.intro,this}prependRight(t,e){if(t=t+this.offset,typeof e!="string")throw new TypeError("inserted content must be a string");this._split(t);const i=this.byStart[t];return i?i.prependRight(e):this.outro=e+this.outro,this}remove(t,e){if(t=t+this.offset,e=e+this.offset,this.original.length!==0){for(;t<0;)t+=this.original.length;for(;e<0;)e+=this.original.length}if(t===e)return this;if(t<0||e>this.original.length)throw new Error("Character is out of bounds");if(t>e)throw new Error("end must be greater than start");this._split(t),this._split(e);let i=this.byStart[t];for(;i;)i.intro="",i.outro="",i.edit(""),i=e>i.end?this.byStart[i.end]:null;return this}reset(t,e){if(t=t+this.offset,e=e+this.offset,this.original.length!==0){for(;t<0;)t+=this.original.length;for(;e<0;)e+=this.original.length}if(t===e)return this;if(t<0||e>this.original.length)throw new Error("Character is out of bounds");if(t>e)throw new Error("end must be greater than start");this._split(t),this._split(e);let i=this.byStart[t];for(;i;)i.reset(),i=e>i.end?this.byStart[i.end]:null;return this}lastChar(){if(this.outro.length)return this.outro[this.outro.length-1];let t=this.lastChunk;do{if(t.outro.length)return t.outro[t.outro.length-1];if(t.content.length)return t.content[t.content.length-1];if(t.intro.length)return t.intro[t.intro.length-1]}while(t=t.previous);return this.intro.length?this.intro[this.intro.length-1]:""}lastLine(){let t=this.outro.lastIndexOf(g);if(t!==-1)return this.outro.substr(t+1);let e=this.outro,i=this.lastChunk;do{if(i.outro.length>0){if(t=i.outro.lastIndexOf(g),t!==-1)return i.outro.substr(t+1)+e;e=i.outro+e}if(i.content.length>0){if(t=i.content.lastIndexOf(g),t!==-1)return i.content.substr(t+1)+e;e=i.content+e}if(i.intro.length>0){if(t=i.intro.lastIndexOf(g),t!==-1)return i.intro.substr(t+1)+e;e=i.intro+e}}while(i=i.previous);return t=this.intro.lastIndexOf(g),t!==-1?this.intro.substr(t+1)+e:this.intro+e}slice(t=0,e=this.original.length-this.offset){if(t=t+this.offset,e=e+this.offset,this.original.length!==0){for(;t<0;)t+=this.original.length;for(;e<0;)e+=this.original.length}let i="",n=this.firstChunk;for(;n&&(n.start>t||n.end<=t);){if(n.start<e&&n.end>=e)return i;n=n.next}if(n&&n.edited&&n.start!==t)throw new Error(`Cannot use replaced character ${t} as slice start anchor.`);const r=n;for(;n;){n.intro&&(r!==n||n.start===t)&&(i+=n.intro);const s=n.start<e&&n.end>=e;if(s&&n.edited&&n.end!==e)throw new Error(`Cannot use replaced character ${e} as slice end anchor.`);const h=r===n?t-n.start:0,o=s?n.content.length+e-n.end:n.content.length;if(i+=n.content.slice(h,o),n.outro&&(!s||n.end===e)&&(i+=n.outro),s)break;n=n.next}return i}snip(t,e){const i=this.clone();return i.remove(0,t),i.remove(e,i.original.length),i}_split(t){if(this.byStart[t]||this.byEnd[t])return;let e=this.lastSearchedChunk,i=e;const n=t>e.end;for(;e;){if(e.contains(t))return this._splitChunk(e,t);if(e=n?this.byStart[e.end]:this.byEnd[e.start],e===i)return;i=e}}_splitChunk(t,e){if(t.edited&&t.content.length){const n=v(this.original)(e);throw new Error(`Cannot split a chunk that has already been edited (${n.line}:${n.column} – "${t.original}")`)}const i=t.split(e);return this.byEnd[e]=t,this.byStart[e]=i,this.byEnd[i.end]=i,t===this.lastChunk&&(this.lastChunk=i),this.lastSearchedChunk=t,!0}toString(){let t=this.intro,e=this.firstChunk;for(;e;)t+=e.toString(),e=e.next;return t+this.outro}isEmpty(){let t=this.firstChunk;do if(t.intro.length&&t.intro.trim()||t.content.length&&t.content.trim()||t.outro.length&&t.outro.trim())return!1;while(t=t.next);return!0}length(){let t=this.firstChunk,e=0;do e+=t.intro.length+t.content.length+t.outro.length;while(t=t.next);return e}trimLines(){return this.trim("[\\r\\n]")}trim(t){return this.trimStart(t).trimEnd(t)}trimEndAborted(t){const e=new RegExp((t||"\\s")+"+$");if(this.outro=this.outro.replace(e,""),this.outro.length)return!0;let i=this.lastChunk;do{const n=i.end,r=i.trimEnd(e);if(i.end!==n&&(this.lastChunk===i&&(this.lastChunk=i.next),this.byEnd[i.end]=i,this.byStart[i.next.start]=i.next,this.byEnd[i.next.end]=i.next),r)return!0;i=i.previous}while(i);return!1}trimEnd(t){return this.trimEndAborted(t),this}trimStartAborted(t){const e=new RegExp("^"+(t||"\\s")+"+");if(this.intro=this.intro.replace(e,""),this.intro.length)return!0;let i=this.firstChunk;do{const n=i.end,r=i.trimStart(e);if(i.end!==n&&(i===this.lastChunk&&(this.lastChunk=i.next),this.byEnd[i.end]=i,this.byStart[i.next.start]=i.next,this.byEnd[i.next.end]=i.next),r)return!0;i=i.next}while(i);return!1}trimStart(t){return this.trimStartAborted(t),this}hasChanged(){return this.original!==this.toString()}_replaceRegexp(t,e){function i(r,s){return typeof e=="string"?e.replace(/\$(\$|&|\d+)/g,(h,o)=>o==="$"?"$":o==="&"?r[0]:+o<r.length?r[+o]:`$${o}`):e(...r,r.index,s,r.groups)}function n(r,s){let h;const o=[];for(;h=r.exec(s);)o.push(h);return o}if(t.global)n(t,this.original).forEach(s=>{if(s.index!=null){const h=i(s,this.original);h!==s[0]&&this.overwrite(s.index,s.index+s[0].length,h)}});else{const r=this.original.match(t);if(r&&r.index!=null){const s=i(r,this.original);s!==r[0]&&this.overwrite(r.index,r.index+r[0].length,s)}}return this}_replaceString(t,e){const{original:i}=this,n=i.indexOf(t);return n!==-1&&(typeof e=="function"&&(e=e(t,n,i)),t!==e&&this.overwrite(n,n+t.length,e)),this}replace(t,e){return typeof t=="string"?this._replaceString(t,e):this._replaceRegexp(t,e)}_replaceAllString(t,e){const{original:i}=this,n=t.length;for(let r=i.indexOf(t);r!==-1;r=i.indexOf(t,r+n)){const s=i.slice(r,r+n);let h=e;typeof e=="function"&&(h=e(s,r,i)),s!==h&&this.overwrite(r,r+n,h)}return this}replaceAll(t,e){if(typeof t=="string")return this._replaceAllString(t,e);if(!t.global)throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");return this._replaceRegexp(t,e)}}export{N as SourceMap,S as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const s=typeof chrome<"u"&&!!chrome?.runtime?.id;function f(){return s?d:h}async function h(u){return new Promise(t=>{const i=window.open(u,"_blank","width=500,height=700,popup=yes");let n=!1,o=null;const a=()=>{n||(n=!0,window.removeEventListener("message",r),clearTimeout(l),o&&clearInterval(o))},r=e=>{if(e.data?.type==="oauth-callback"){if(a(),e.data.error){console.error("[oauth-service] CLI OAuth error:",e.data.error),t(null);return}t(e.data.redirectUrl??null)}};window.addEventListener("message",r),(location.pathname.startsWith("/electron")||new URLSearchParams(location.search).get("runtime")==="electron-overlay")&&(o=setInterval(async()=>{if(!n)try{const e=await fetch("/api/oauth-result");if(e.status===204)return;const c=await e.json();if(n)return;if(a(),c.error){console.error("[oauth-service] Server relay OAuth error:",c.error),t(null);return}t(c.redirectUrl??null)}catch(e){console.warn("[oauth-service] Poll failed:",e instanceof Error?e.message:String(e))}},1e3));const l=setTimeout(()=>{a();try{i?.close()}catch{}t(null)},12e4)})}async function d(u){return new Promise(t=>{let i=!1;const n=()=>{i||(i=!0,chrome.runtime.onMessage.removeListener(o),clearTimeout(a))},o=r=>{if(r?.source==="service-worker"&&r?.payload?.type==="oauth-result"){if(n(),r.payload.error){console.error("[oauth-service] Extension OAuth error:",r.payload.error),t(null);return}t(r.payload.redirectUrl??null)}};chrome.runtime.onMessage.addListener(o),chrome.runtime.sendMessage({source:"panel",payload:{type:"oauth-request",providerId:"oauth",authorizeUrl:u}}).catch(r=>{console.error("[oauth-service] Failed to send OAuth request to service worker:",r)});const a=setTimeout(()=>{n(),t(null)},12e4)})}export{f as createOAuthLauncher};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as d}from"./index-DvjzakYY.js";const i=d("offscreen-client");class h{eventListeners=new Set;callbacks;scoops=[];scoopStatuses=new Map;currentMessageId=new Map;ready=!1;stateRetryTimer=null;localFs=null;selectedScoopJid=null;constructor(e){this.callbacks=e,this.setupMessageListener()}setLocalFS(e){this.localFs=e}createAgentHandle(){return{sendMessage:(e,s)=>{if(!this.selectedScoopJid){this.emitToUI({type:"error",error:"No scoop selected"});return}this.send({type:"user-message",scoopJid:this.selectedScoopJid,text:e,messageId:s??`msg-${Date.now()}-${Math.random().toString(36).slice(2,8)}`})},onEvent:e=>(this.eventListeners.add(e),()=>this.eventListeners.delete(e)),stop:()=>{this.selectedScoopJid&&this.send({type:"abort",scoopJid:this.selectedScoopJid})}}}getScoops(){return this.scoops}getScoop(e){return this.scoops.find(s=>s.jid===e)}isProcessing(e){return this.scoopStatuses.get(e)==="processing"}async registerScoop(e){this.scoops.find(s=>s.name===e.name)||(this.scoops.push(e),this.scoopStatuses.set(e.jid,"initializing")),this.send({type:"scoop-create",name:e.name,isCone:e.isCone})}async unregisterScoop(e){this.send({type:"scoop-drop",scoopJid:e}),this.scoops=this.scoops.filter(s=>s.jid!==e),this.scoopStatuses.delete(e)}createScoopTab(e){}async getGlobalMemory(){if(!this.localFs)return"";try{const e=await this.localFs.readFile("/shared/CLAUDE.md",{encoding:"utf-8"});return typeof e=="string"?e:new TextDecoder().decode(e)}catch{return""}}getScoopContext(e){if(this.localFs)return{getFS:()=>this.localFs}}getSharedFS(){return this.localFs}stopScoop(e){this.send({type:"abort",scoopJid:e})}async clearQueuedMessages(e){}async deleteQueuedMessage(e,s){}updateModel(){this.send({type:"refresh-model"})}async clearAllMessages(){this.send({type:"clear-chat"})}clearFilesystem(){this.send({type:"clear-filesystem"})}requestState(){this.send({type:"request-state"});let e=0;this.stateRetryTimer=setInterval(()=>{if(e++,this.ready||e>20){this.stateRetryTimer&&(clearInterval(this.stateRetryTimer),this.stateRetryTimer=null);return}i.debug("Retrying request-state",{attempt:e}),this.send({type:"request-state"})},500)}isReady(){return this.ready}sprinkleOpHandler=null;sendSprinkleLick(e,s){this.send({type:"sprinkle-lick",sprinkleName:e,body:s})}setSprinkleOpHandler(e){this.sprinkleOpHandler=e}setupMessageListener(){chrome.runtime.onMessage.addListener((e,s,t)=>{if(!p(e))return!1;const a=e;if(a.source==="offscreen"){const r=a.payload;if(r?.type==="debug-tabs"){const c=window.__slicc_debug_tabs;c?.(!!r.show)}else r?.type==="sprinkle-op"&&this.sprinkleOpHandler?this.sprinkleOpHandler(r):this.handleOffscreenMessage(a.payload)}return!1})}handleOffscreenMessage(e){switch(e.type){case"offscreen-ready":i.info("Offscreen engine ready"),this.ready||this.send({type:"request-state"});break;case"agent-event":this.handleAgentEvent(e);break;case"scoop-status":this.handleScoopStatus(e);break;case"scoop-created":this.handleScoopCreated(e);break;case"scoop-list":this.handleScoopList(e);break;case"state-snapshot":this.handleStateSnapshot(e);break;case"error":this.handleError(e);break;case"incoming-message":this.handleIncomingMessage(e);break}}handleAgentEvent(e){if(e.scoopJid===this.selectedScoopJid)switch(e.eventType){case"text_delta":{let s=this.currentMessageId.get(e.scoopJid);s||(s=`scoop-${e.scoopJid}-${n()}`,this.currentMessageId.set(e.scoopJid,s),this.emitToUI({type:"message_start",messageId:s})),this.emitToUI({type:"content_delta",messageId:s,text:e.text??""});break}case"tool_start":{let s=this.currentMessageId.get(e.scoopJid);s||(s=`scoop-${e.scoopJid}-${n()}`,this.currentMessageId.set(e.scoopJid,s),this.emitToUI({type:"message_start",messageId:s})),this.emitToUI({type:"tool_use_start",messageId:s,toolName:e.toolName??"",toolInput:e.toolInput});break}case"tool_end":{const s=this.currentMessageId.get(e.scoopJid);s&&this.emitToUI({type:"tool_result",messageId:s,toolName:e.toolName??"",result:e.toolResult??"",isError:e.isError});break}case"response_done":{const s=this.currentMessageId.get(e.scoopJid);s&&(this.emitToUI({type:"content_done",messageId:s}),this.currentMessageId.delete(e.scoopJid));break}case"turn_end":{const s=this.currentMessageId.get(e.scoopJid)??`done-${e.scoopJid}-${n()}`;this.currentMessageId.delete(e.scoopJid),this.emitToUI({type:"turn_end",messageId:s});break}}}handleScoopStatus(e){this.scoopStatuses.set(e.scoopJid,e.status),this.callbacks.onStatusChange(e.scoopJid,e.status)}handleScoopCreated(e){const s=this.msgScoopToRegistered(e.scoop);this.scoops=this.scoops.filter(t=>t.name!==s.name||t.jid===s.jid),this.scoops.find(t=>t.jid===s.jid)||this.scoops.push(s),this.scoopStatuses.set(s.jid,e.scoop.status),this.callbacks.onScoopCreated(s)}handleScoopList(e){this.scoops=e.scoops.map(s=>this.msgScoopToRegistered(s));for(const s of e.scoops)this.scoopStatuses.set(s.jid,s.status);this.callbacks.onScoopListUpdate(e.scoops)}handleStateSnapshot(e){i.info("Received state snapshot",{scoopCount:e.scoops.length}),this.scoops=e.scoops.map(t=>this.msgScoopToRegistered(t));for(const t of e.scoops)this.scoopStatuses.set(t.jid,t.status);const s=!this.ready;s&&(this.ready=!0,this.stateRetryTimer&&(clearInterval(this.stateRetryTimer),this.stateRetryTimer=null)),this.callbacks.onScoopListUpdate(e.scoops),s&&this.callbacks.onReady?.()}handleError(e){e.scoopJid===this.selectedScoopJid&&this.emitToUI({type:"error",error:e.error})}handleIncomingMessage(e){this.callbacks.onIncomingMessage(e.scoopJid,e.message)}msgScoopToRegistered(e){return{jid:e.jid,name:e.name,folder:e.folder,isCone:e.isCone,type:e.isCone?"cone":"scoop",requiresTrigger:!e.isCone,assistantLabel:e.assistantLabel,addedAt:new Date().toISOString()}}emitToUI(e){for(const s of this.eventListeners)try{s(e)}catch(t){i.error("Listener error",{error:t instanceof Error?t.message:String(t)})}}send(e){chrome.runtime.sendMessage({source:"panel",payload:e}).catch(s=>{i.error("Failed to send to offscreen",{error:s instanceof Error?s.message:String(s)})})}}function n(){return Date.now().toString(36)+Math.random().toString(36).slice(2,8)}function p(o){return typeof o=="object"&&o!==null&&"source"in o&&"payload"in o}export{h as OffscreenClient};
|