dsh-open-artifact 0.16.2 → 0.16.3

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.
Files changed (109) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/icon.svg +1 -1
  3. package/lib/client.js +2504 -2430
  4. package/lib/index.js +26 -8
  5. package/package.json +1 -1
  6. package/skills/open-artifact/SKILL.md +8 -5
  7. package/vendor/frame-host/client/comments.js +1 -1
  8. package/vendor/frame-host/frame-host.mjs +15 -2
  9. package/vendor/harnesses/antigravity.json +3 -0
  10. package/vendor/harnesses/chatgpt.json +3 -0
  11. package/vendor/harnesses/claude-code.json +3 -0
  12. package/vendor/harnesses/codex.json +3 -0
  13. package/vendor/harnesses/copilot.json +3 -0
  14. package/vendor/harnesses/cursor.json +3 -0
  15. package/vendor/harnesses/dsh.json +3 -0
  16. package/vendor/harnesses/zcode.json +3 -0
  17. package/vendor/home/assets/index-BMcfb5B7.css +1 -0
  18. package/vendor/home/assets/index-CxVzqoE0.js +43 -0
  19. package/vendor/home/index.html +2 -2
  20. package/vendor/open-artifact.mjs +1278 -456
  21. package/vendor/runtime.json +1 -1
  22. package/vendor/shell/assets/index-BMcfb5B7.css +1 -0
  23. package/vendor/{type-server/shell/assets/index-xloVcJb_.js → shell/assets/index-C_XsG-Qe.js} +1 -1
  24. package/vendor/shell/index.html +2 -2
  25. package/vendor/type-server/cli.mjs +16 -3
  26. package/vendor/type-server/editors/data/assets/{index-DcaVBiGm.js → index-CMhqwoHV.js} +1 -1
  27. package/vendor/type-server/editors/data/index.html +1 -1
  28. package/vendor/type-server/editors/design/assets/{index-B5Wv_tnf.js → index-DUW-k3ks.js} +1 -1
  29. package/vendor/type-server/editors/design/index.html +1 -1
  30. package/vendor/type-server/editors/design-system/assets/{index-BqDGbG4f.js → index-l9dVDF3y.js} +1 -1
  31. package/vendor/type-server/editors/design-system/index.html +1 -1
  32. package/vendor/type-server/editors/docs/assets/{abnfDiagram-WEYOIA3C-CDTl-yCx.js → abnfDiagram-WEYOIA3C-C7HiIlhQ.js} +1 -1
  33. package/vendor/type-server/editors/docs/assets/{architectureDiagram-ZHVYKT53-BOl_bS-V.js → architectureDiagram-ZHVYKT53-BNtmYbnl.js} +1 -1
  34. package/vendor/type-server/editors/docs/assets/{blockDiagram-RJAE7QA3-CkMxyQ6a.js → blockDiagram-RJAE7QA3-CmB3Jqrq.js} +1 -1
  35. package/vendor/type-server/editors/docs/assets/{c4Diagram-XDPPPE54-BLHAzoyQ.js → c4Diagram-XDPPPE54-BInEfPqU.js} +1 -1
  36. package/vendor/type-server/editors/docs/assets/channel-BT2p6jtG.js +1 -0
  37. package/vendor/type-server/editors/docs/assets/{chunk-2E7WHVMD-B2ZKLsyS.js → chunk-2E7WHVMD-DERsVzyR.js} +1 -1
  38. package/vendor/type-server/editors/docs/assets/{chunk-2Q5K7J3B-DkNtD1xL.js → chunk-2Q5K7J3B-C5h24pTP.js} +1 -1
  39. package/vendor/type-server/editors/docs/assets/{chunk-4EMNKR2T-C3xRZwqt.js → chunk-4EMNKR2T-CtlMesOe.js} +1 -1
  40. package/vendor/type-server/editors/docs/assets/{chunk-55XCU76K-DEOjkZqt.js → chunk-55XCU76K-BcHXSlto.js} +1 -1
  41. package/vendor/type-server/editors/docs/assets/{chunk-5VM5RSS4-DCKBSHxZ.js → chunk-5VM5RSS4-DnqXPWSg.js} +1 -1
  42. package/vendor/type-server/editors/docs/assets/{chunk-JWPE2WC7-DrvooUmN.js → chunk-JWPE2WC7-Bls1jQHy.js} +1 -1
  43. package/vendor/type-server/editors/docs/assets/{chunk-VQ5W62QI-DYMeK3pU.js → chunk-VQ5W62QI-B-9NPBBl.js} +1 -1
  44. package/vendor/type-server/editors/docs/assets/{chunk-XXDRQBXY-Cvl-anAV.js → chunk-XXDRQBXY-DqHJwIOI.js} +1 -1
  45. package/vendor/type-server/editors/docs/assets/{chunk-ZCHMQSOR-gWl3U20G.js → chunk-ZCHMQSOR-CO0N7boC.js} +2 -2
  46. package/vendor/type-server/editors/docs/assets/{classDiagram-v2-4MYWR3UA-On9X3_w5.js → classDiagram-v2-4MYWR3UA-Dm4tBHd-.js} +1 -1
  47. package/vendor/type-server/editors/docs/assets/{core-Cw4Llisp.js → core-CMnn1N7u.js} +1 -1
  48. package/vendor/type-server/editors/docs/assets/{cose-bilkent-JH36ORCC-B72D_yQn.js → cose-bilkent-JH36ORCC-DGyUtGAA.js} +1 -1
  49. package/vendor/type-server/editors/docs/assets/{cynefin-EF2NZ3EQ-B_v4ABxk.js → cynefin-EF2NZ3EQ-BdlZazYw.js} +1 -1
  50. package/vendor/type-server/editors/docs/assets/{cynefinDiagram-WF24UDRP-Bu9uLebD.js → cynefinDiagram-WF24UDRP-BjKufr-c.js} +1 -1
  51. package/vendor/type-server/editors/docs/assets/{dagre-NK4GIZVX-DOkgWNtI.js → dagre-NK4GIZVX-BZlO2--v.js} +1 -1
  52. package/vendor/type-server/editors/docs/assets/{diagram-CBK3MWTC-CgIhmBRJ.js → diagram-CBK3MWTC-3STWIa1n.js} +1 -1
  53. package/vendor/type-server/editors/docs/assets/{diagram-I5XIIV2D-HpeiOnYm.js → diagram-I5XIIV2D-BIiZBp1S.js} +1 -1
  54. package/vendor/type-server/editors/docs/assets/{diagram-ODIL2UCW-CWmar6iG.js → diagram-ODIL2UCW-Cxn7JmvU.js} +1 -1
  55. package/vendor/type-server/editors/docs/assets/{diagram-PFBEJUXE-CXcCGIYn.js → diagram-PFBEJUXE-D2k1jJ3f.js} +1 -1
  56. package/vendor/type-server/editors/docs/assets/{diagram-RJA3I4VV-jEFt8GAQ.js → diagram-RJA3I4VV-7ZRL3Uk6.js} +1 -1
  57. package/vendor/type-server/editors/docs/assets/{diagram-TYUNFSNR-Da-kw_Xm.js → diagram-TYUNFSNR-Jyx-ylJA.js} +1 -1
  58. package/vendor/type-server/editors/docs/assets/{ebnfDiagram-V4P3TTPT-BaZ03UMA.js → ebnfDiagram-V4P3TTPT-DGfWrKui.js} +1 -1
  59. package/vendor/type-server/editors/docs/assets/{elk-QONTBCTQ-Bri5BDi4.js → elk-QONTBCTQ-B7tKj3Ar.js} +1 -1
  60. package/vendor/type-server/editors/docs/assets/{erDiagram-KYQIGQAA-aju23vzr.js → erDiagram-KYQIGQAA-D06HHDAP.js} +1 -1
  61. package/vendor/type-server/editors/docs/assets/{flowDiagram-IUGLLWBU-DezRFFND.js → flowDiagram-IUGLLWBU-CZJZKHIM.js} +1 -1
  62. package/vendor/type-server/editors/docs/assets/{ganttDiagram-R7GPNTJY-DDDYA5M0.js → ganttDiagram-R7GPNTJY-BaBRsp-X.js} +1 -1
  63. package/vendor/type-server/editors/docs/assets/{gitGraphDiagram-PDYL7XHY-Brbvftki.js → gitGraphDiagram-PDYL7XHY-B2bt-1sQ.js} +1 -1
  64. package/vendor/type-server/editors/docs/assets/{index-rie6Fmea.js → index-YZPGEMCI.js} +3 -3
  65. package/vendor/type-server/editors/docs/assets/{infoDiagram-MVDRKAX5-Buk7jjzD.js → infoDiagram-MVDRKAX5-C1qijMFd.js} +1 -1
  66. package/vendor/type-server/editors/docs/assets/{ishikawaDiagram-HPEHV2GE-k1-dGoms.js → ishikawaDiagram-HPEHV2GE-C2fcPeVy.js} +1 -1
  67. package/vendor/type-server/editors/docs/assets/{journeyDiagram-BOSHW7O7-fuODgQ0y.js → journeyDiagram-BOSHW7O7-DAdGOjA_.js} +1 -1
  68. package/vendor/type-server/editors/docs/assets/{kanban-definition-FNSA4HC5-0EJOb8QO.js → kanban-definition-FNSA4HC5-Cjm2BYYa.js} +1 -1
  69. package/vendor/type-server/editors/docs/assets/{mermaid.core-rflC9T3b.js → mermaid.core-T4owCd57.js} +4 -4
  70. package/vendor/type-server/editors/docs/assets/{mindmap-definition-6OY57UG3-BA4jPnUz.js → mindmap-definition-6OY57UG3-DqNbrCsa.js} +1 -1
  71. package/vendor/type-server/editors/docs/assets/{pegDiagram-ECIUJNBX-D1mSs1Df.js → pegDiagram-ECIUJNBX-B8pnl9eq.js} +1 -1
  72. package/vendor/type-server/editors/docs/assets/{pieDiagram-GNMPY74T-DISpmq94.js → pieDiagram-GNMPY74T-CqN2ryDn.js} +1 -1
  73. package/vendor/type-server/editors/docs/assets/{quadrantDiagram-D57K4MC3-C_DveStJ.js → quadrantDiagram-D57K4MC3-D6ZHYaMj.js} +1 -1
  74. package/vendor/type-server/editors/docs/assets/{railroadDiagram-Y72NRBL7-XkLhMgFv.js → railroadDiagram-Y72NRBL7-DbFNy0DV.js} +1 -1
  75. package/vendor/type-server/editors/docs/assets/{requirementDiagram-EQYSW5RA-DKtU2dUB.js → requirementDiagram-EQYSW5RA-CBjn24a2.js} +1 -1
  76. package/vendor/type-server/editors/docs/assets/{sankeyDiagram-SY24JHO5-DXnpKoyA.js → sankeyDiagram-SY24JHO5-Be5yf8X0.js} +1 -1
  77. package/vendor/type-server/editors/docs/assets/{sequenceDiagram-BLEHNHQU-D3XryRDT.js → sequenceDiagram-BLEHNHQU-CM75oaFL.js} +1 -1
  78. package/vendor/type-server/editors/docs/assets/{sizeCapture-INFHLROL-Ce0anhUv.js → sizeCapture-INFHLROL-BS3ZKpfq.js} +1 -1
  79. package/vendor/type-server/editors/docs/assets/{stateDiagram-v2-A6IESKWZ-C_-4V6la.js → stateDiagram-v2-A6IESKWZ-DBao6lhy.js} +1 -1
  80. package/vendor/type-server/editors/docs/assets/{swimlanes-B3ENRKFQ-DsaAidHj.js → swimlanes-B3ENRKFQ-OBdPnY1S.js} +1 -1
  81. package/vendor/type-server/editors/docs/assets/swimlanesDiagram-AYQRV4AK-D73Zrbfj.js +8 -0
  82. package/vendor/type-server/editors/docs/assets/{timeline-definition-JXYKGLGB-DfKECQ2o.js → timeline-definition-JXYKGLGB-BqkDYP31.js} +1 -1
  83. package/vendor/type-server/editors/docs/assets/{usecaseDiagram-WPOLBNNX-Dc8tWzRe.js → usecaseDiagram-WPOLBNNX-0IvdCTW3.js} +1 -1
  84. package/vendor/type-server/editors/docs/assets/{vennDiagram-Q3Y3IDCW-tc61BjSp.js → vennDiagram-Q3Y3IDCW-Dt2rtwRE.js} +1 -1
  85. package/vendor/type-server/editors/docs/assets/{wardleyDiagram-IVAIDKWA-DyVqcsy4.js → wardleyDiagram-IVAIDKWA-G9f9s0F7.js} +1 -1
  86. package/vendor/type-server/editors/docs/assets/{xychartDiagram-4URNHDU4-B8VxiLaY.js → xychartDiagram-4URNHDU4-CaUTu_0n.js} +1 -1
  87. package/vendor/type-server/editors/docs/index.html +1 -1
  88. package/vendor/type-server/editors/motion/assets/{gif-jobs-DY7KR2r5.js → gif-jobs-C1zQj3s9.js} +1 -1
  89. package/vendor/type-server/editors/motion/assets/{index-DBRxctvJ.js → index-Cw_UcKR5.js} +3 -3
  90. package/vendor/type-server/editors/motion/assets/{src-CP9lpzx7.js → src-wn9P_DUt.js} +1 -1
  91. package/vendor/type-server/editors/motion/index.html +1 -1
  92. package/vendor/type-server/editors/sheets/assets/{index-B6FKM2kq.js → index-C3CIL5GM.js} +2 -2
  93. package/vendor/type-server/editors/sheets/assets/{workbook-worker-D4VqJhLz.js → workbook-worker-CbhVg0YQ.js} +1 -1
  94. package/vendor/type-server/editors/sheets/index.html +1 -1
  95. package/vendor/type-server/editors/slides/assets/{index-DI_AWWuc.js → index-fJEPQZQY.js} +2 -2
  96. package/vendor/type-server/editors/slides/assets/{src-CWCcr2Hw.js → src-mZdWgqty.js} +1 -1
  97. package/vendor/type-server/editors/slides/index.html +1 -1
  98. package/vendor/type-server/editors/whiteboard/assets/{drawing-look-worker-CS2Hv0Nf.js → drawing-look-worker-gMYrygDq.js} +2 -2
  99. package/vendor/type-server/editors/whiteboard/assets/{index-BkWtA61j.js → index-BtZ30wGI.js} +2 -2
  100. package/vendor/type-server/editors/whiteboard/index.html +1 -1
  101. package/vendor/type-server/shell/assets/index-BMcfb5B7.css +1 -0
  102. package/vendor/{shell/assets/index-xloVcJb_.js → type-server/shell/assets/index-C_XsG-Qe.js} +1 -1
  103. package/vendor/type-server/shell/index.html +2 -2
  104. package/vendor/home/assets/index-CQTGVxZi.js +0 -43
  105. package/vendor/home/assets/index-CkjifzaW.css +0 -1
  106. package/vendor/shell/assets/index-CkjifzaW.css +0 -1
  107. package/vendor/type-server/editors/docs/assets/channel-CR_04g-H.js +0 -1
  108. package/vendor/type-server/editors/docs/assets/swimlanesDiagram-AYQRV4AK-iNMg14LW.js +0 -8
  109. package/vendor/type-server/shell/assets/index-CkjifzaW.css +0 -1
@@ -1,6 +1,6 @@
1
1
  function Cb(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(s){if(s!=="default"&&!(s in e)){var a=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:function(){return n[s]}})}})}),Object.freeze(e)}function Fo(e,t,n){let[s,a]=[0,e.length];for(;s<a;){let r=Math.floor((s+a)/2),i=e[r];i!==void 0&&t(i)<=n?s=r+1:a=r}return s}function Ob(e,t){let[n,s]=[0,e.length];for(;n<s;){let a=Math.floor((n+s)/2);(e[a]??t)<t?n=a+1:s=a}return n}function Ef(e){let t=e.lastIndexOf("."),n=e.slice(t+1);return t===-1||!Sb.test(n)?null:{base:e.slice(0,t),first:Number(n),count:1}}function Sn(e){let t=[],n=new Map,s=0;for(let r of e){let i={...r,startIndex:s};t.push(i);let o=n.get(r.base);o===void 0?n.set(r.base,[i]):o.push(i),s+=r.count}for(let r of n.values())r.sort((i,o)=>i.first-o.first);let a=({base:r,first:i,count:o})=>{let l=n.get(r)??[],u=[];for(let c=Math.max(0,Fo(l,d=>d.first,i)-1);c<l.length;c+=1){let d=l[c];if(d===void 0||d.first>=i+o)break;let f=Math.max(i,d.first),m=Math.min(i+o,d.first+d.count)-f;m>0&&u.push({firstIndex:d.startIndex+f-d.first,count:m})}return u};return{count:s,idAt(r){if(!Number.isInteger(r)||r<0||r>=s)return null;let i=Fa(t,({startIndex:o})=>o,r);return i===void 0?null:`${i.base}.${i.first+r-i.startIndex}`},indexOf(r){let i=Ef(r);return i===null?null:a(i)[0]?.firstIndex??null},stretchesOf:a,runsIn({firstIndex:r,count:i}){let o=[];for(let l=Math.max(0,Fo(t,u=>u.startIndex,r)-1);l<t.length;l+=1){let u=t[l];if(u===void 0||u.startIndex>=r+i)break;let c=Math.max(r,u.startIndex),d=Math.min(r+i,u.startIndex+u.count)-c;d>0&&o.push({base:u.base,first:u.first+c-u.startIndex,count:d})}return o}}}function xb(e){let t=Sn(e),n=new Map;return{...t,indexOf(s){let a=n.get(s);if(a!==void 0)return a;let r=t.indexOf(s);return n.set(s,r),r}}}function eu(e,t,n=Sn){let s=e?.runsIn({firstIndex:0,count:e.count}),a=s?.length===t.length&&s.every((r,i)=>{let o=t[i];return o?.base===r.base&&o.first===r.first&&o.count===r.count});return e!==void 0&&a?e:n(t)}function is(e,t,n){let s=[];for(let a of t[e==="seen"?"stored":"seen"].runsIn(n))for(let r of t[e].stretchesOf(a)){let i=s.at(-1);i!==void 0&&Tt(i)+1===r.firstIndex?s[s.length-1]={...i,count:i.count+r.count}:s.push(r)}return s}function ws(e){let t=[...e];t.sort((s,a)=>s.firstIndex-a.firstIndex);let n=[];for(let s of t){let a=n.at(-1);a!==void 0&&s.firstIndex<=Tt(a)+1?n[n.length-1]={...a,count:Math.max(Tt(a),Tt(s))-a.firstIndex+1}:n.push(s)}return n}function dr(e,t,n){if(t===null||!fr(t,n))return[n];if(n.count===1)return is(e,t,n);let s=tu.get(t)??new Map;tu.set(t,s);let a=`${e} ${n.firstIndex} ${n.count}`,r=s.get(a)??ws(is(e,t,n));return s.size>=Rb&&!s.has(a)&&s.clear(),s.set(a,r),r}function Sf(e,t,n){let[s,...a]=dr(e,t,n);return a.length>0?null:s??n}function jt(e,t,n){let s=dr(e,t,n),[a,r]=[s[0],s.at(-1)];return a===void 0||r===void 0?n:{firstIndex:a.firstIndex,count:Tt(r)-a.firstIndex+1}}function Eb(e,t,n){let s=t.flatMap(c=>e.stretchesOf(c)),a=ws(s),[r,i]=[a[0],a.at(-1)];if(r===void 0||i===void 0)return null;let o=new Map;for(let[c,d]of a.entries()){let f=a[c+1];if(f===void 0)break;let m=Tt(d)+1,g=e.runsIn({firstIndex:m,count:f.firstIndex-m});if(g.some(I=>n.stretchesOf(I).length>0))return"givenUp";o.set(Tt(d),g)}let l=Tt(i)+1,u=Sn([...e.runsIn({firstIndex:0,count:r.firstIndex}),...s.flatMap(c=>e.runsIn(c).concat(o.get(Tt(c))??[])),...e.runsIn({firstIndex:l,count:e.count-l})]);return{stored:e,seen:u,firstIndex:r.firstIndex,count:l-r.firstIndex}}const Fa=(e,t,n)=>e[Math.max(0,Fo(e,t,n)-1)],Sb=/^(?:0|[1-9]\d*)$/,Tt=({firstIndex:e,count:t})=>e+t-1,fr=(e,t)=>t.firstIndex<=Tt(e)&&Tt(t)>=e.firstIndex&&(t.firstIndex>e.firstIndex||Tt(t)<Tt(e)),Rb=16,tu=new WeakMap;function Mb(e){let t="";for(let n=e+1;n>0;n=Math.floor((n-1)/nu))t=String.fromCharCode(Nb+(n-1)%nu)+t;return t}function Rn(e,t){let n=/^\$?([a-z]{1,3})\$?(\d*)(?::\$?([a-z]{1,3})\$?(\d*))?$/i.exec(e.trim());if(n===null)return null;let[,s="",a="",r=s,i=a]=n;if(a===""!=(i==="")||a===""&&n[3]===void 0)return null;let o=[su(s),su(r)],l=a===""?[0,t.rowCount-1]:[Number(a)-1,Number(i)-1],[u,c]=[Math.min(...o),Math.max(...o)],[d,f]=[Math.min(...l),Math.max(...l)];return d<0||f>=t.rowCount||c>=t.columnCount?null:{topRowIndex:d,leftColumnIndex:u,rowCount:f-d+1,columnCount:c-u+1}}function Ei(e){let[t,n]=[1/0,-1/0];for(let s of e)s<t&&(t=s),s>n&&(n=s);return{firstIndex:t,count:n-t+1}}const Nb=65,nu=26,su=e=>Array.from(e.toUpperCase()).reduce((t,n)=>t*26+n.charCodeAt(0)-64,0)-1;function qt(e,[t,n]){let[s,a]=[e.indexOf(t),e.indexOf(n)];return s===null||a===null?null:Ei([s,a])}function Dt(e,t,n,s){let a=qt(t[pr(e)],n);return a===null?n:Mn(t[e],ls(s(e,t,a)))}function mr(e,t,n){let s=new Map,a=[];for(let r of n){let i=qt(t[pr(e)],[r.topLeft.r,r.bottomRight.r]);if(i===null){a.push(r);continue}let o=`${r.topLeft.c} ${r.bottomRight.c}`,l=s.get(o)??{like:r,rows:[]};s.set(o,{...l,rows:l.rows.concat(dr(e,t,i))})}return[...s.values()].flatMap(({like:r,rows:i})=>ws(i).map(o=>Ws(r,Mn(t[e],o)))).concat(a)}function au(e,t){let n=mr("stored",e,t);return Vt(n.length>t.length),Fn(n)}function Oa(e,{sheetId:t,oneCorner:n,otherCorner:s},a=Sf){let[r,i]=Dt("stored",e,[n.r,s.r],a);return{sheetId:t,oneCorner:{...n,r},otherCorner:{...s,r:i}}}function Rf(e,t,n){let s=[n.firstRowOfBody,n.lastRowOfBody],[a,r]=Dt(e,t,s,jt),i=n.runs.flatMap(o=>{let l=qt(t[pr(e)],[o.firstRow,o.lastRow]);return l===null?[o]:dr(e,t,l).map(u=>{let[c,d]=Mn(t[e],u);return{role:o.role,firstRow:c,lastRow:d}})});return{...n,firstRowOfBody:a,lastRowOfBody:r,runs:i}}function Mf(e,{headerRows:t,footerRows:n}){for(let s of[t,n]){let a=s===null?null:qt(e.seen,[s.firstRow,s.lastRow]);Vt(a!==null&&cn(e,a))}}function _b(e,t){let n=Ua(e,t);Vt(n!==null&&cn(e,n)&&is("stored",e,n).length>1)}function Bb(e,t,n){let s=ls(e.seen.indexOf(t)),[a]=is("stored",e,{firstIndex:s,count:e.seen.count-s}),r=ls(a),i=n?.flatMap(o=>e.stored.stretchesOf(o))??[r];return Fn(i.flatMap(o=>{let l=Math.max(o.firstIndex,r.firstIndex),u=Math.min(o.firstIndex+o.count,r.firstIndex+r.count);return e.stored.runsIn({firstIndex:l,count:Math.max(0,u-l)})}))}function Nf(e){return e.kind==="setBorders"?e.cells.sheetId:e.kind==="fillCells"?e.linesToFill.kind==="rows"?e.source.sheetId:null:"selected"in e?e.selected.sheetId:null}function Hb(e,t){let n=Mi(t),s=(a,r)=>n(a,e,i=>(r(i),e));switch(e.kind){case"moveCells":return s(e.cells.sheetId,a=>_b(a,e.cells.rows)),n(e.toSheetId,e,a=>({...e,mayLandIn:Bb(a,e.toTopLeft.r,e.mayLandIn)}));case"pasteValuesOfCells":return Vt(t(e.cells.sheetId)!==null||t(e.toSheetId)!==null),e;case"importTableIntoSheet":return s(e.table.sheetId,()=>Vt(e.table.how.kind!=="addRows"));case"mergeCells":return s(e.cells.sheetId,a=>{let r=Ua(a,e.cells.rows);Vt(r!==null&&r.count>1&&cn(a,r))});case"hideRows":return s(e.sheetId,a=>{let r=Ua(a,e.rows);Vt(r!==null&&cn(a,r))});case"insertRows":return n(e.sheetId,e,a=>{let r=e.afterRow===null?0:(a.seen.indexOf(e.afterRow)??0)+1;if(r>a.firstIndex&&r<a.firstIndex+a.count)return e;let i=o=>o==null?null:Ri("stored",a,o);return{...e,afterRow:ou(a,e.afterRow),formatsFromRow:i(e.formatsFromRow),groupsFromRow:i(e.groupsFromRow),formulasFromRow:i(e.formulasFromRow)}});case"moveRows":return n(e.sheetId,e,a=>{let[r,i]=Dt("stored",a,[e.oneRow,e.otherRow],jr),o=e.afterRow===null?0:(a.seen.indexOf(e.afterRow)??0)+1;return Vt(o>a.firstIndex&&o<a.firstIndex+a.count),{...e,oneRow:r,otherRow:i,afterRow:ou(a,e.afterRow)}});case"sortRows":case"groupRows":case"ungroupRows":return n(e.sheetId,e,a=>{let[r,i]=Dt("stored",a,[e.oneRow,e.otherRow],jr);return{...e,oneRow:r,otherRow:i}});case"sortCells":case"moveColumnsOfCells":return n(e.cells.sheetId,e,a=>({...e,cells:Oa(a,e.cells,jr)}));case"addConditionalFormats":return n(e.sheetId,e,a=>({...e,rules:Fn(e.rules.map(r=>({...r,ranges:au(a,r.ranges)})))}));case"changeConditionalFormat":{let{ranges:a}=e;return a===void 0?e:n(e.sheetId,e,r=>({...e,ranges:au(r,a)}))}case"addPlacedView":{let a=e.inputs.map(r=>n(r.range.sheetId,r,i=>{let{topLeft:o,bottomRight:l}=r.range,u=Dt("stored",i,[o.r,l.r],Sf);return{name:r.name,range:{...r.range,...Ws(r.range,u)}}}));return n(e.sheetId,{...e,inputs:a},r=>({...e,inputs:a,topLeft:Go("stored",r,e.topLeft)}))}case"movePlacedView":case"resizePlacedView":case"copyPlacedView":return n("toSheetId"in e?e.toSheetId:e.sheetId,e,a=>({...e,topLeft:Go("stored",a,e.topLeft)}));case"declareCellTable":case"changeCellTable":return s(e.sheetId,a=>Mf(a,e.cellTable));case"setSheetSettings":{let{lastFrozenRow:a}=e.settings;return a==null?e:s(e.sheetId,r=>{let i=r.seen.indexOf(a)??-1;Vt(cn(r,{firstIndex:i,count:1}))})}case"pasteRowsOfTexts":case"pasteCopiedCells":case"pasteValuesOfCopiedCells":case"pasteCellsOfAnotherProgram":case"fillCells":case"setBorders":case"enter":case"addUserToCell":case"removeUserFromCell":case"setListLineChecked":case"enterInCells":case"enterTextWithLooksInCells":case"pasteTexts":case"clearCells":case"unmergeCells":case"formatCells":case"setColumnWidths":case"fitColumns":case"setRowHeights":case"insertColumns":case"moveColumns":case"deleteRows":case"deleteColumns":case"groupColumns":case"ungroupColumns":case"setRowGroupsCollapsed":case"setColumnGroupsCollapsed":case"showRowGroupsToDepth":case"showColumnGroupsToDepth":case"hideColumns":case"moveConditionalFormat":case"removeConditionalFormat":case"deletePlacedView":case"replaceWidgetNodeOfPlacedView":case"removeCellTable":case"insertPivotTable":case"changePivotTable":case"saveNamedView":case"removeNamedView":case"addSheet":case"importTableAsNewSheet":case"duplicateSheet":case"deleteSheet":case"moveSheet":case"renameSheet":case"reseed":case"writeFromInteractive":case"resetInteractive":case"saveDefaultsOfInteractive":case"setTimeZone":case"setLocale":case"makeDropdown":case"addDropdownOption":case"setDropdownOptions":return e;default:throw new Zs}}function Pb(e,t){let{sheetId:n,oneCorner:s,otherCorner:a}=t.cells,r=qt(e.seen,[s.r,a.r]);if(r===null||is("stored",e,r).length===1)return t;let i=(t.rowsOutOfView??[]).flatMap(c=>e.seen.stretchesOf(c)),o=r.firstIndex+r.count,l=[],u=r.firstIndex;for(let{firstIndex:c,count:d}of[...ws(i),{firstIndex:o,count:0}]){let f=Math.min(c,o);if(f>u)for(let m of e.seen.runsIn({firstIndex:u,count:f-u}))l.push(m);u=Math.max(u,c+d)}return{kind:"readCellsToCopyInTheOrderOfTheirRows",cells:{sheetId:n,rows:Fn(l),oneColumn:s.c,otherColumn:a.c}}}function Vb(e,t){let n=Mi(t);switch(e.kind){case"queueEdit":{let s=l=>({...l,edit:Hb(l.edit,t)}),{editsBefore:a,editsThatGoAlong:r}=e,i=[...a??[],e,...r??[]].flatMap(({edit:l})=>{let u=Nf(l),c=u===null?null:t(u);return u===null||c===null?[]:[{sheetId:u,order:c}]}),[o]=i;return Vt(i.some(({sheetId:l})=>l!==o?.sheetId)),{...s(e),...o!==void 0&&{ownRowOrder:{sheetId:o.sheetId,rows:Fn(o.order.seen.runsIn(o.order))}},...a!==void 0&&{editsBefore:a.map(s)},...r!==void 0&&{editsThatGoAlong:r.map(s)}}}case"readCellsToCopy":return n(e.cells.sheetId,e,s=>Pb(s,e));case"readConditionalFormatSuggestions":case"readCellsThatADropdownWouldClear":return n(e.cells.sheetId,e,s=>({...e,cells:Oa(s,e.cells)}));case"readConditionalFormatsAsAgentIsTold":return n(e.cells.sheetId,e,s=>({...e,cells:Oa(s,e.cells,jt)}));case"readDropdownOptionsToOffer":return n(e.sheetId,e,s=>({...e,...Oa(s,e,jt)}));case"readRowsInSortedOrder":return n(e.sheetId,e,s=>{let[a,r]=Dt("stored",s,[e.oneRow,e.otherRow],jt);return{...e,oneRow:a,otherRow:r}});case"readFilteredRows":case"readValuesOfFilteredColumn":return n(e.table.sheetId,e,s=>({...e,table:Rf("stored",s,e.table)}));case"readCellTableDeclaredAs":return n(e.sheetId,e,s=>(Mf(s,e.cellTable),e));case"readFormatsGiven":{let{asIf:s}=e;return s===void 0?e:n(e.sheetId,e,a=>({...e,asIf:s.map(r=>ns("stored",a,r))}))}case"readConditionalFormatsByAddress":return n(e.sheetId,e,s=>({...e,rules:e.rules.map(a=>ns("stored",s,a))}));case"readTablesOfSheet":return e;case"queueNextUndo":case"queueNextRedo":case"queueEditsThatTakeBack":case"receiveStreamedEdit":case"receiveSendOutcome":case"receiveServerRevision":case"receiveLoadPage":case"receiveLinesOfLoad":case"answerBeforeCalculating":case"calculate":case"receiveClockReading":case"readWorkbook":case"readCells":case"readWorkbookWithCellsPacked":case"readRowsWithCellsPacked":case"readCauseOfError":case"readSheetLayout":case"readXlsxFile":case"readTimeZone":case"readViews":case"readInputsOfView":case"readTableAtCell":case"readCellTables":case"readCellTableAt":case"readPivotTableAt":case"readValuesToFilterPivotTableBy":case"readConditionalFormatsInIds":case"readProposedFormulaValue":case"readWhatATableChanges":case"readCellsOfTheDropdownAt":case"readTypedFormula":case"readTextToEdit":case"readCellsToCopyInTheOrderOfTheirRows":return e;default:throw new Zs}}function Lb(e,t){let[n,s]=Dt("seen",e,[t.ends.first,t.ends.last],jt);return{...t,ends:{first:n,last:s}}}function ru(e,t){if(t===null)return e;if(t==="givenUp")return{...e,ownRowOrder:t};let{seen:n,firstIndex:s,count:a}=t,{rowHeights:r,conditionalFormats:i,placements:o,rowGroups:l}=e;return{...e,rows:[...n.runsIn({firstIndex:0,count:n.count})],ownRowOrder:{firstIndex:s,count:a,asStored:{rows:e.rows,...r!==void 0&&{rowHeights:r},...i!==void 0&&{conditionalFormats:i},...o!==void 0&&{placements:o},...l!==void 0&&{rowGroups:l}}},...r!==void 0&&{rowHeights:r.flatMap(({rows:u,heightInPixels:c})=>n.stretchesOf(u).flatMap(d=>n.runsIn(d)).map(d=>({rows:d,heightInPixels:c})))},...i!==void 0&&{conditionalFormats:i.map(u=>Ub(t,u))},...o!==void 0&&{placements:o.map(u=>Wb(t,u))},...l!==void 0&&{rowGroups:l.map(u=>Lb(t,u))}}}function Db(e,t){let{mergedRanges:n=[],rowGroups:s=[],lastFrozenRow:a}=t,r=a===void 0?null:e.stored.indexOf(a);return(r===null||!cn(e,{firstIndex:r,count:1}))&&n.every(({liveTopLeft:i,liveBottomRight:o})=>{let l=qt(e.stored,[i.r,o.r]);return l===null||l.count===1||!cn(e,l)})&&s.every(({ends:i})=>{let o=qt(e.stored,[i.first,i.last]);return o===null||o.count===1||!fr(e,o)})}function Fb(e,t){let n=qt(e.stored,[t.top.r,t.bottom.r]);if(n===null)return[t];let s=fr(e,n)?is("seen",e,n):null,a=/^[A-Z]+/.exec(t.range)?.[0]??"";return(s??[n]).map(r=>{let[i,o]=Mn(e.seen,r),l=(e.stored.indexOf(i)??0)+1,u=r.count===1?"":`:${a}${l+r.count-1}`;return{range:s===null?t.range:`${a}${l}${u}`,top:{...t.top,r:i},bottom:{...t.bottom,r:o}}})}function Wr(e,t,n){let s=Mi(n),a=(l,u)=>{let c=l?.cells??null;return l===null||c===null?l:s(l.sheetId,l,d=>{if(u!==void 0&&Nf(u)!==null)return(d.seen.indexOf(c.topLeft.r)??0)>(d.seen.indexOf(c.bottomRight.r)??1/0)?{...l,cells:Ws(c,[c.bottomRight.r,c.topLeft.r])}:l;let f=u===void 0?null:jb(u),m=ws(f?.rows.flatMap(h=>d.stored.stretchesOf(h))??[]),[g,I]=[m[0],m.at(-1)],b=g!==void 0&&I!==void 0&&Mn(d.stored,g)[0]===c.topLeft.r&&Mn(d.stored,I)[1]===c.bottomRight.r?Ua(d,f?.rows??[]):null;return{...l,cells:b===null?ks(d,c):Ws(c,Mn(d.seen,b))}})},r=l=>({...l,...l.editsOfOthers!==void 0&&{editsOfOthers:l.editsOfOthers.map(u=>({...u,placeChanged:a(u.placeChanged)}))}});if(t.kind==="syncState")return r(t);if(t.kind==="editQueued"){let l=e.kind==="queueEdit"?e:null,u=a(t.placeChanged,l?.edit),{placesChangedBefore:c,editsThatWentAlong:d}=t,f=l?.editsBefore?.filter(({isPointedAt:g})=>g)??[],m=f.length===c?.length?f:[];return{...t,placeChanged:u,...c!==void 0&&{placesChangedBefore:c.map((g,I)=>a(g,m[I]?.edit)??g)},...d!==void 0&&{editsThatWentAlong:d.map((g,I)=>g.kind==="made"?{kind:"made",placeChanged:a(g.placeChanged,l?.editsThatGoAlong?.[I]?.edit)}:g)},syncState:r(t.syncState)}}let i="cells"in e&&"sheetId"in e.cells?e.cells:"table"in e?e.table:e,o="sheetId"in i?n(i.sheetId):null;if(o===null)return t;switch(t.kind){case"formatsGiven":return{...t,colorScales:t.colorScales.map(({ranges:l,stops:u})=>({ranges:mr("seen",o,l),stops:u}))};case"table":return{...t,read:Si("seen",o,t.read)};case"cellTableAt":return{...t,cellTable:t.cellTable===null?null:Ga("seen",o,t.cellTable)};case"cellTables":return{...t,cellTables:t.cellTables.map(l=>Ga("seen",o,l))};case"filteredRows":{let l=[t.firstRowOfBody,t.lastRowOfBody],[u,c]=Dt("seen",o,l,jt),d=t.cellsBesideTheTableOutOfView.map(f=>ks(o,f));return{...t,firstRowOfBody:u,lastRowOfBody:c,cellsBesideTheTableOutOfView:d}}case"conditionalFormatSuggestions":return{...t,about:ks(o,t.about),ruleToStartFrom:ns("seen",o,t.ruleToStartFrom),suggestions:t.suggestions.map(({rules:l,matches:u})=>({rules:Fn(l.map(c=>ns("seen",o,c))),matches:u})),table:{...t.table,cells:ks(o,t.table.cells),records:ks(o,t.table.records)}};case"conditionalFormatsInIds":{let{read:l}=t;return l.kind!=="rules"?t:{...t,read:{...l,rules:l.rules.map(u=>ns("seen",o,u))}}}case"cellsOfDropdown":{let l=t.stretches.map(m=>Fb(o,m)),u=l.flat(),c="cell"in e?o.seen.indexOf(e.cell.r):null,d=l[t.indexOfTheStretchWithTheCell]?.find(({top:m,bottom:g})=>{let I=qt(o.seen,[m.r,g.r]);return I!==null&&c!==null&&cn(I,{firstIndex:c,count:1})}),f=Math.max(0,d===void 0?0:u.indexOf(d));return{...t,stretches:u,indexOfTheStretchWithTheCell:f}}case"nothingToChange":case"toBeShownFirst":case"editBeforeRefused":case"nothingToReverse":case"stepGivenUp":case"workbookContents":case"cellsContents":case"workbookContentsWithCellsPacked":case"rowsWithCellsPacked":case"sheetLayout":case"xlsxFile":case"views":case"inputsOfView":case"tablesOfSheet":case"pivotTableAt":case"conditionalFormatsByAddress":case"conditionalFormatsAsAgentIsTold":case"valuesOfFilteredColumn":case"rowsInSortedOrder":case"typedFormula":case"causeOfError":case"proposedFormulaValue":case"textToEdit":case"cellsToCopy":case"dropdownOptionsToOffer":case"cellsThatADropdownWouldClear":case"sharedCellFormat":case"whatATableChanges":case"timeZone":case"refused":return t}}function Gb(e){let t=new Map,n=new Map,s=u=>{let c=t.get(u.sheetId);if(c===void 0)return null;let d=n.get(u.sheetId);if(d!==void 0)return d;let f=Eb(Sn(u.rows),c.rows,c.storedThen),m=f===null||f==="givenUp"||Db(f,u);return n.set(u.sheetId,m?f:"givenUp"),m?f:"givenUp"},a=u=>{let c=e.answer({kind:"readSheetLayout",sheetId:u});return c.kind==="sheetLayout"?c:null},r=u=>{if(!t.has(u))return null;let c=n.has(u)?null:a(u),d=c===null?n.get(u):s(c);return d===void 0||d==="givenUp"?null:d},i=u=>{let{changes:c}=u;if(c.kind==="nothing")return u;if(c.kind!=="inSheets")return n.clear(),u;let d=c.sheets.map(f=>!f.isLayoutChanged||!t.has(f.sheetId)?f:(n.delete(f.sheetId),Object.assign({},f,{areFormatsGivenChanged:!0})));return{...u,changes:{...c,sheets:d}}},o=(u,c)=>{if(u.kind!=="insertRows"||u.afterRow===null||c===null)return;let d=a(u.sheetId),f=c.firstIndex+c.count,m=(c.seen.indexOf(u.afterRow)??f)+1;if(d===null||m>=f||c.stored.indexOf(u.afterRow)!==f-1)return;let g=[...c.seen.runsIn({firstIndex:c.firstIndex,count:m-c.firstIndex}),...Sn(d.rows).runsIn({firstIndex:f,count:u.count}),...c.seen.runsIn({firstIndex:m,count:f-m})];t.set(u.sheetId,{rows:g,storedThen:c.stored})},l=u=>(n.clear(),{...u,sheets:u.sheets.map(c=>ru(c,s(c)))});return{seeRowsInOwnOrder(u,c){n.delete(u);let d=c===null?null:a(u);c===null||d===null?t.delete(u):t.set(u,{rows:c,storedThen:Sn(d.rows)})},answer(u){if(t.size===0)return e.answer(u);let c;try{c=Vb(u,r)}catch(g){if(!(g instanceof Zs))throw g;return{kind:"refused",refusal:"rowNotNamedInTheWay"}}let d=u.kind==="queueEdit"?u.edit:null,f=d?.kind==="insertRows"?r(d.sheetId):null,m=e.answer(c);if(m.kind==="workbookContents"||m.kind==="workbookContentsWithCellsPacked")return l(m);if(m.kind==="sheetLayout")return ru(m,s(m));if(m.kind==="syncState")return Wr(u,i(m),r);if(m.kind==="editQueued"){d!==null&&o(d,f);let g=i(m.syncState);return Wr(u,{...m,syncState:g},r)}return Wr(u,m,r)}}}const Zs=class extends Error{},ls=e=>{if(e==null)throw new Zs;return e},Vt=e=>{if(e)throw new Zs},Fn=([e,...t])=>[ls(e),...t],pr=e=>e==="seen"?"stored":"seen",Mn=(e,{firstIndex:t,count:n})=>[ls(e.idAt(t)),ls(e.idAt(t+n-1))],jr=(e,t,n)=>fr(t,n)?null:n,Ws=({topLeft:e,bottomRight:t},[n,s])=>({topLeft:{...e,r:n},bottomRight:{...t,r:s}}),ks=(e,t)=>Ws(t,Dt("seen",e,[t.topLeft.r,t.bottomRight.r],jt)),ns=(e,t,n)=>({...n,ranges:Fn(mr(e,t,n.ranges))}),Si=(e,t,n)=>n===null?null:{...n,table:Rf(e,t,n.table)},Ga=(e,t,n)=>({...n,table:Si(e,t,n.table)}),cn=(e,t)=>e.firstIndex<t.firstIndex+t.count&&t.firstIndex<e.firstIndex+e.count,Ri=(e,t,n)=>t[e].idAt(t[pr(e)].indexOf(n)??-1)??n,Go=(e,t,n)=>({...n,r:Ri(e,t,n.r)}),ou=(e,t)=>t!==null&&e.seen.indexOf(t)===e.firstIndex+e.count-1?Ri("stored",e,t):t,Ua=(e,t)=>{let n=ws(t.flatMap(r=>e.seen.stretchesOf(r))),[s,a]=[n[0],n.at(-1)];return s===void 0||a===void 0?null:Ei([s.firstIndex,a.firstIndex+a.count-1])},Mi=e=>(t,n,s)=>{let a=e(t);return a===null?n:s(a)},Ub=(e,t)=>({...ns("seen",e,t),liveRanges:mr("seen",e,t.liveRanges)}),Wb=(e,t)=>({...t,liveTopLeft:Go("seen",e,t.liveTopLeft)}),jb=e=>{let t="cells"in e?e.cells:null;return t!==null&&"rows"in t?t:null},zb=(e,t)=>Dt("seen",e,t,jt),$b=8,Yb=64;function Kb({store:e,isWanted:t,noteLoaded:n,letOthersRun:s}){let a=null,r=0;const i=(o,{revision:l,v:u,ops:c})=>{const d=o+$b,f=d<c.length?d:null;return f===null&&(a=null),{revision:l,v:u,ops:c.slice(o,d),next:f}};return{async loadPage(o){const l=r;if(o>0){if(a===null)throw Error("a later page of a load with no operations");return o%Yb===0&&await s(),r===l&&a!==null?i(o,a):"calledOff"}a=null;const u=await e.loadOps();return u===null||u==="pageOutOfDate"||"busyForMs"in u?u:(n(),r!==l||!t()?"calledOff":(a=u,i(0,u)))},drop(){r+=1,a=null}}}function Xb(e){if(!(e instanceof Error))return"notAnError";let{name:t,message:n}=e;switch(t){case"RuntimeError":return Zb.test(n)?"wasmUnreachable":"wasmOtherTrap";case"CompileError":return"wasmCompileError";case"LinkError":return"wasmLinkError";case"ChunkLoadError":return"fileNotFetched";case"RangeError":case"InternalError":return Jb.test(n)?"stackOverflow":Qb.test(n)?"outOfMemory":t==="RangeError"?t:"otherError";case"TypeError":case"Error":return t;default:return"otherError"}}function qb(e){try{return Xb(e)}catch{return"otherError"}}const Zb=/^(?:unreachable|unreachable executed|Unreachable code should not be executed\b.*)$/s,Jb=/^(?:Maximum call stack size exceeded\.?|too much recursion)$/,Qb=/^(?:(?:WebAssembly\.[\w.]+\(\): )?(?:[Oo]ut of memory\b.*|could not allocate memory)|Array buffer allocation failed)$/s;function _f(e){return e==="overflow"?!1:e==="wrap"?!0:e}function us(e,t){let n=e.flatMap(a=>t.stretchesOf(a));n.sort((a,r)=>a.firstIndex-r.firstIndex);let s=[];for(let a of n){let r=s.at(-1);r===void 0||a.firstIndex>r.firstIndex+r.count?s.push(a):s[s.length-1]={firstIndex:r.firstIndex,count:Math.max(r.count,a.firstIndex+a.count-r.firstIndex)}}return s}function ev(e,t,n){return e.flatMap(s=>s.format.numberFormat===void 0||fv(s.format.numberFormat.pattern)?[]:{pattern:s.format.numberFormat.pattern,rows:us(s.rows,t),columns:us(s.columns,n)})}function cs(e,t,n){let[s,a]=[0,e.length];for(;s<a;){let i=Math.floor((s+a)/2),o=e[i];o!==void 0&&o.firstIndex+o.count<=t?s=i+1:a=i}let r=[];for(let i=s;i<e.length;i+=1){let o=e[i];if(o===void 0||o.firstIndex>=t+n)break;r.push(o.firstIndex,o.firstIndex+o.count)}return r}function tv(e,t){let n=new Set,s=new Set;for(let a of e){let r=cs(a.rows,t.topRowIndex-1,t.rowCount+2),i=cs(a.columns,t.leftColumnIndex-1,t.columnCount+2);if(!(r.length===0||i.length===0)){for(let o of r)n.add(o);for(let o of i)s.add(o)}}return{rows:[...n],columns:[...s]}}function nv(e,t){let n=e.filter(({rows:s,columns:a})=>cs(s,t.topRowIndex,t.rowCount).length>0&&cs(a,t.leftColumnIndex,t.columnCount).length>0);return[...new Set(n.map(({pattern:s})=>s))]}function Wa(e,t,n){let s=cs(e,t,n),a=0;for(let r=0;r+1<s.length;r+=2)a+=Math.min(s[r+1]??0,t+n)-Math.max(s[r]??0,t);return a}function sv(e,t){let n=e.flatMap(({rows:o,columns:l,format:u})=>{let c=Wa(l,t.leftColumnIndex,t.columnCount),d=c===0?0:c*Wa(o,t.topRowIndex,t.rowCount);return d===0?[]:{format:u,cellCount:d}}),s=(o,l)=>{let u=null,c=0;for(let d of n){let f=o(d.format);if(f===void 0)continue;let m=JSON.stringify(f);if(u??={value:f,written:m},u.written!==m)return null;c+=d.cellCount}return u===null?l:c===t.rowCount*t.columnCount?u.value:null},{alignment:a,border:r,font:i}=lt;return{numberFormat:s(o=>o.numberFormat,lt.numberFormat),alignment:{horizontal:s(o=>o.alignment?.horizontal,a.horizontal),vertical:s(o=>o.alignment?.vertical,a.vertical),wrap:s(Ni,a.wrap)},fillColor:s(o=>o.fillColor,lt.fillColor),cellControl:s(o=>o.cellControl,lt.cellControl),border:{top:s(o=>o.border?.top,r.top),right:s(o=>o.border?.right,r.right),bottom:s(o=>o.border?.bottom,r.bottom),left:s(o=>o.border?.left,r.left)},font:{bold:s(o=>o.font?.bold,i.bold),italic:s(o=>o.font?.italic,i.italic),underline:s(o=>o.font?.underline,i.underline),strikethrough:s(o=>o.font?.strikethrough,i.strikethrough),color:s(o=>o.font?.color,i.color),size:s(o=>o.font?.size,i.size)}}}function av(e){let t=new Set;for(let n of e)if(!(n?.kind!=="rgb"||yv.has(n.hex))&&(t.add(n.hex),t.size===gv))break;return[...t]}function*rv(e,t){for(let{format:n}of e){yield*[n.fillColor,n.font?.color];for(let s of Pf){let a=n.border?.[s];a?.kind==="line"&&(yield a.color)}}for(let{options:n}of t)for(let{color:s}of n)yield s}function ov(e){let t=new Map;e.forEach((s,a)=>{for(let{base:r,first:i,count:o}of s){let l=t.get(r)??[];l.push({at:i,list:a,isStart:!0},{at:i+o,list:a,isStart:!1}),t.set(r,l)}});let n=new Map;for(let[s,a]of t){a.sort((o,l)=>o.at===l.at?Number(o.isStart)-Number(l.isStart):o.at-l.at);let r=new Set,i=[];a.forEach(({at:o,list:l,isStart:u},c)=>{u?r.add(l):r.delete(l),a[c+1]?.at!==o&&i.push({first:o,heldBy:[...r]})}),n.set(s,i)}return n}function iu(e){let t=ov(e);return n=>{let s=Ef(n),a=s===null?void 0:t.get(s.base);if(s===null||a===void 0)return uu;let r=Fa(a,({first:i})=>i,s.first);return r===void 0||r.first>s.first?uu:r.heldBy}}function Bf(e){let t=iu(e.map(({columns:a})=>a)),n=new Map,s=(a,r)=>{let i=n.get(a);if(i===void 0){let o=iu([e[a]?.rows??[]]);i=l=>o(l).length>0,n.set(a,i)}return i(r)};return(a,r)=>t(r).filter(i=>s(i,a))}function Hf(e){let t=JSON.stringify(e),n=lu.get(t)??e;return lu.set(t,n),n}function iv(e,t){let n=e.map(({format:r})=>Vf(r,t)),s=Bf(e),a=new Map;return{formatOf(r,i){let o=s(r,i);if(o.length===0)return lt;let l=o.join(),u=a.get(l);if(u!==void 0)return u;let c=Hf(o.reduce((d,f)=>Lf(d,n[f]??{}),lt));return a.set(l,c),c}}}function lv(e){if(e.length===0)return Iv;let t=Bf(e),n=new Map,s=new WeakMap,a=(r,i)=>{let o=t(r,i);if(o.length===0)return null;let l=o.join(),u=n.get(l);if(u!==void 0)return u;let c=o.map(g=>e[g]?.format??{}),d=c.find(g=>g.fillColor!==void 0)?.fillColor,f={};for(let g of c)Object.assign(f,g.font);let m={...d!==void 0&&{fillColor:d},font:f};return n.set(l,m),m};return{lookGivenTo:a,formatDrawnOf(r,i,o){let l=a(i,o);if(l===null)return r;let u=s.get(r)??new Map;s.set(r,u);let c=u.get(l);if(c!==void 0)return c;let d=Hf(Lf(r,l));return u.set(l,d),d}}}const Pf=["top","bottom","left","right"],lt={font:{bold:!1,italic:!1,underline:"none",strikethrough:!1,color:{kind:"none"},size:10},numberFormat:{kind:"general",pattern:"General"},alignment:{horizontal:"general",vertical:"top",wrap:!1},fillColor:{kind:"none"},cellControl:{kind:"none"},border:{top:{kind:"none"},bottom:{kind:"none"},left:{kind:"none"},right:{kind:"none"}}},Ni=({alignment:e})=>e?.wrap===void 0?void 0:_f(e.wrap),Vf=({numberFormat:e,...t},n)=>e===void 0?t:{...t,numberFormat:{kind:n(e.pattern),pattern:e.pattern}},Lf=(e,{alignment:t,border:n,font:s,...a})=>({...e,...a,alignment:{...e.alignment,...t,wrap:_f(t?.wrap??e.alignment.wrap)},border:{...e.border,...n},font:{...e.font,...s}}),uv=e=>e.some(({format:t})=>Pf.some(n=>t.border?.[n]?.kind==="line")),Df=(e,t,n)=>e.map(s=>({rows:us(s.rows,t),columns:us(s.columns,n)})),cv=(e,t,n)=>Df(e.filter(({format:s})=>s.border!==void 0),t,n),dv=(e,t,n)=>Df(e.filter(({format:s})=>Ni(s)===!0),t,n),fv=e=>/^general$/i.test(e),mv=(e,t,n,s)=>e.map(a=>({rows:us(a.rows,t),columns:us(a.columns,n),format:Vf(a.format,s)})),pv=(e,t)=>e.flatMap(({rows:n,format:s},a)=>Object.keys(s).some(r=>r!=="border")&&cs(n,t,1).length>0?[a]:[]).join(),hv=(e,t)=>e.some(({rows:n,columns:s,format:a})=>Ni(a)==="clip"&&Wa(s,t.leftColumnIndex,t.columnCount)>0&&Wa(n,t.topRowIndex,t.rowCount)>0),gv=8,yv=new Set(["#ffffff","#f3f3f3","#000000"]),wv=(e,t)=>av(rv(e,t)),lu=new Map,uu=[],Iv={lookGivenTo:()=>null,formatDrawnOf:e=>e};function cu(e){let t=Object.values(kv).filter(n=>n!==Ff[e]).join("");return new RegExp(`(?<=\\d)[${t}](?=(?:\\d{2}[${t}])*\\d{3}(?!\\d))`,"g")}function bv(e,t){let n=0,s=e.length;for(;n<s&&e[n]===" ";)n+=1;for(;s>n&&e[s-1]===" ";)s-=1;let a=e.slice(n,s);if(!Av[t].test(a))return null;let r=Number(a.replace(",","."));return Number.isFinite(r)?r===0?0:r:null}const vv=e=>e==="comma"?";":",",Ff={point:".",comma:","},kv={comma:",",point:".",noBreakSpace:" ",narrowNoBreakSpace:" ",apostrophe:"'"},hr=(e,t)=>e.replace(".",Ff[t]);cu("point"),cu("comma");const Av={point:/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,comma:/^[+-]?(?:\d+(?:,\d*)?|,\d+)(?:[eE][+-]?\d+)?$/},Tv=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,Cv="�",Ov=/[^\P{Cc}\t\n\r]/gu,Gf=e=>e.replaceAll(Ov,"").replaceAll(Tv,Cv),gr="'",du=(e,t)=>e.length>t.length&&e.startsWith(t),xv=e=>{let t=/^(?:(true)|false)$/i.exec(e);return t===null?null:t[1]!==void 0},Ev=(e,t)=>bv(e,t)===null&&xv(e)===null&&!du(e,gr)&&!du(e,"="),_i=e=>e?"TRUE":"FALSE",Uf=(e,t)=>Ev(e,t)?e:gr+e,Sv=e=>Date.parse(`${e}T00:00:00Z`)/864e5+25569,Wf=15;function Rv(e,t){let n=e!==null&&"input"in e&&e.input.kind==="number"?e.numberIsEditedAs:void 0;return n!==void 0&&Lv.test(n)&&e?.shown?.kind==="text"&&Vv.test(e.shown.text)&&t()===Pv?n:null}function Mv(e,t,n){let s=Gn(e),[,a]=Dv.exec(t)??[],r=a===void 0?null:n(a);return r!==null&&s?.kind==="number"&&Sv(r)!==Math.floor(s.value)}function fu(e,t,n){let s=Gn(e);return s?.kind==="text"?Uo(t??s.value):s?.kind!=="number"?Wo(s,1/0,n):t===null||jv(e)?hr(String(s.value).toUpperCase(),n):Fv(t)?t:Uo(t)}const Nv=/^(?=[^\S\t\n\r]*[=+\-@\uFF1D\uFF0B\uFF0D\uFF20])|[\t\n\r](?='*[^\S\t\n\r]*[=+\-@\uFF1D\uFF0B\uFF0D\uFF20])/g,_v=/[\v\f\x85\u2028\u2029]/g,Bv=e=>Gf(e.replaceAll(_v,`
2
2
  `)),Uo=e=>Bv(e).replaceAll(Nv,t=>t+gr),Hv=/^ *[+-](?:[\p{Sc} %]*[\d.,\u00a0\u202f']+(?:(?<=\d)E[+-]?\d+)?)?[\p{Sc} %]*$/u,Pv="m/d h:mm",Vv=/^\d{1,2}[/.-]\d{1,2} \d{1,2}:\d{2}$/,Lv=/^\d+[/.-]\d+[/.-]\d+/,Dv=/^(\d{1,4}[/.-]\d{1,2}[/.-]\d{1,4})(?: \d{1,2}:\d{2}(?::\d{2})?(?: ?[AP]M)?)?$/i,Fv=e=>Hv.test(e)||Uo(e)===e,mu=(e,t)=>String(Number(e.toFixed(t))).toUpperCase(),Gv=new Intl.NumberFormat("en-US",{useGrouping:!1,maximumSignificantDigits:Wf});function pu(e){let t=jf(e,Bi);return t.includes("E")?Math.abs(e)>=1?Gv.format(e):"0":t}function jf(e,t){if(mu(e,0).length>t&&hu(e,0).length>t)return pu(e);for(let a=Wf;a>=1;a-=1){let r=Uv(e,a);if(r.length<=t)return r}for(let a=zv;a>=0;a-=1){let r=hu(e,a);if(r.length<=t)return r}let n=e<0?3:2,s=mu(e,Math.max(0,t-n));return s==="0"?pu(e):s}function Uv(e,t){let n=Number(e.toPrecision(t));return String(Number.isFinite(n)?n:e).toUpperCase()}function Wo(e,t,n){switch(e?.kind){case void 0:return"";case"text":case"error":return e.value;case"boolean":return _i(e.value);case"number":return hr(jf(e.value,Math.min(t,Bi)),n)}}function Wv(e,t,n,s=()=>!1){let a=e?.shown;if(a?.kind==="text")return{text:a.text,textColor:a.textColor};let r=Math.floor(t);if(a!==void 0&&a.reason!=="notPrintedYet"){let l=Math.max(1,Math.min(r,Bi));return{text:$v.repeat(l),textColor:null}}let i=Gn(e),o=Wo(i,r,n);if(i?.kind!=="number")return{text:o,textColor:null};for(;o.length<=r&&s(o);)r=o.length-1,o=Wo(i,r,n);return{text:o,textColor:null}}function jv(e){let t=Gn(e),n=e?.shown;return n?.kind==="text"&&n.textColor!==null&&t?.kind==="number"&&t.value<0&&/\d/.test(n.text)&&!Yv.test(n.text)}const hu=(e,t)=>e.toExponential(t).toUpperCase().replace(/\.?0*E/,"E"),Bi=11,zv=5,$v="#",Yv=/(?:^|[^Ee])[-\u2212(]/;function zf(e){if(e.value?.kind!=="text")throw Error("a dropdown option was read without its label");return e.value.value}function Kv(e){return e===null||!("input"in e)?gu:e.input.kind==="user"?[e.input]:e.input.kind==="users"?e.input.users:gu}function Xv(e){if(e.value?.kind!=="text")throw Error("people were read without their labels");return e.value.value}function Hi(e){if(e.value?.kind!=="text")throw Error("a rich text was read without its plain text");return e.value.value}function qv(e){if(e?.input.kind!=="richText")return yu;let t=wu.get(e);if(t!==void 0)return t;let{paragraphs:n}=e.input,s=Wv(e,1/0,"point").text===Hi(e)&&n.some(({list:a})=>a.kind!=="none")?n.map(({list:a},r)=>({list:a,number:e.numbersOfListLines?.[r]??null})):yu;return wu.set(e,s),s}function Zv(e,t){let n=e?.textIsEditedAfterTheMark===!0?gr:"";switch(e?.input.kind){case void 0:return"";case"number":return e.numberIsEditedAs??hr(String(e.input.value),t);case"text":return n+e.input.value;case"dropdownOption":return n+zf(e);case"user":case"users":return n+Xv(e);case"richText":return n+Hi(e);case"boolean":return _i(e.input.value);case"formula":return Jv(e)}}function Jv({formulaText:e}){if(e===void 0)throw Error("a formula was read without its text");return e}function Qv(e,t){return e!==null&&"input"in e&&e.input.kind==="dropdownOption"?Uf(zf(e),t):e===null||"input"in e?Zv(e,t):$f(e.value,t)}function $f(e,t){switch(e.kind){case"number":return hr(String(e.value).toUpperCase(),t);case"text":return Uf(Gf(e.value),t);case"boolean":return _i(e.value);case"error":return e.value}}function ek(e,t){return e===null||"input"in e&&e.input.kind!=="formula"?null:e.value===void 0?"":$f(e.value,t)}function Gn(e){if(e===null)return null;if(!("input"in e))return e.value;if(e.input.kind==="number"||e.input.kind==="text"||e.input.kind==="boolean")return e.input;if(e.value===void 0&&e.input.kind!=="formula")throw Error(`a ${e.input.kind} was read without its value`);return e.value??null}const gu=[],tk=e=>e.kind==="none"?null:e.level,yu=[],wu=new WeakMap;function jo(e,t,n){let s=[],[a,r]=[0,0],i=(l,u)=>{l!==0&&(s.push({firstIndex:a,count:l,sizeInPixels:u,start:r}),a+=l,r+=l*u)};for(let l of t){if(l.firstIndex<a)throw Error("a row or column was given two sizes");i(l.firstIndex-a,n),i(l.count,l.sizeInPixels)}if(a>e)throw Error("a row or column past the last was given a size");i(e-a,n);let o=l=>Fa(s,({firstIndex:u})=>u,l);return{totalSize:r,startOf(l){let u=o(l);return u===void 0?0:u.start+(l-u.firstIndex)*u.sizeInPixels},sizeOf:l=>o(l)?.sizeInPixels??n,indexAt(l){if(l<0)return-1;let u=Fa(s,({start:c})=>c,l);return u===void 0||l>=r?e:u.firstIndex+Math.floor((l-u.start)/u.sizeInPixels)}}}const nk=2e3;function sk(e){let t=Math.max(0,...e.map(i=>i.length)),n=e.map(()=>new Set),s=new Set,a=0,r=null;for(let i=0;i<t;i+=1){let o=e.map(c=>c[i]);if(o.every(ck)){r??=i;continue}let l=o.some((c=[])=>c.some(({value:d})=>typeof d=="number")),u=o.some((c=[],d)=>c.some(({value:f,text:m},g)=>typeof f=="string"&&m!==""&&d+g>0&&n[d]?.has(g)===!0));if(!l){let c=JSON.stringify(o.map((f=[])=>f.map(({text:m})=>m))),d=!s.has(c);if(r!==null&&a>=2&&u&&d)return r;s.add(c)}r=null,a+=1;for(let[c,d]of o.entries())for(let[f,{value:m}]of(d??[]).entries())typeof m=="number"&&n[c]?.add(f)}return t}function Yf(e,t,n){let s=new Map(n.map(a=>[a.viewId,a]));return new Map(t.map(({viewId:a,view:r})=>{let i=s.get(a),o=i===void 0?e.get(a):pk(r,i);if(o===void 0)throw Error("sheets-core named a view whose inputs the page has not read");return[a,o]}))}function ak(e,t,n){let s=[],a=(l,u)=>{for(let{firstIndex:c,count:d}of l)s.push({at:c,isStart:!0,...u},{at:c+d,isStart:!1,...u})};for(let{rows:l,heightInPixels:u}of t)a(e.stretchesOf(l),{heightInPixels:u});for(let{rows:l,format:u}of n){let c=u.font?.size;if(!(c===void 0||c<=lt.font.size))for(let d of l)a(e.stretchesOf(d),{fontSizeInPoints:c})}s.sort((l,u)=>l.at===u.at?Number(l.isStart)-Number(u.isStart):l.at-u.at);let r=[],i=null,o=new Map;return s.forEach((l,u)=>{if("heightInPixels"in l)i=l.isStart?l.heightInPixels:null;else{let g=l.fontSizeInPoints,I=(o.get(g)??0)+(l.isStart?1:-1);I===0?o.delete(g):o.set(g,I)}let c=s[u+1];if(c===void 0||c.at===l.at)return;let d=Math.max(lt.font.size,...o.keys());if(i===null&&o.size===0)return;let f=r.at(-1),m=f!==void 0&&f.firstIndex+f.count===l.at&&f.heightInPixels===i&&f.largestFontSizeInPoints===d;m&&r.pop(),r.push({firstIndex:m?f.firstIndex:l.at,count:c.at-(m?f.firstIndex:l.at),heightInPixels:i,largestFontSizeInPoints:d})}),r}function zr(e,t,n){let s=new Map(e);if(s.size>0)for(let r of t)s.delete(r);let a=new Map;for(let r of n){let i=a.get(r.r)??new Map;a.set(r.r,i.set(r.c,r))}for(let[r,i]of a)s.set(r,i);return s}function Kf(e,t,n,s,a){let r=t==="all"?[...e.rowsAsTheyStand.keys()]:t,i=new Map(e.cellCountByUserId),o=(I,b)=>{for(let{userId:h}of Kv(I)){let y=(i.get(h)??0)+b;y===0?i.delete(h):i.set(h,y)}},l=new Map(a?e.columnIndexesOnShowByRow:[]),u=new Map(e.cellsByRow);for(let I of r){for(let b of u.get(I)?.cellsWithUsersARichTextOrASpill()??[])o(b,-1);n.has(I)||u.delete(I),l.delete(I)}let c=[],d=[];for(let[I,b]of n){e.cellsByRow.size>0&&u.get(I)?.goesOnAs(b)!==!0&&u.set(I,b);for(let h of b.cellsWithUsersARichTextOrASpill())o(h,1),h.spill!==void 0&&c.push(h),qv(h).length>0&&d.push(h)}let f=e.cellsByRow.size>0?u:n,m=zr(e.spilledCellsByRow,r,s),g=m.size===0?null:new Map(e.rowsAsTheyStand);if(g!==null)for(let I of new Set([...r,...n.keys(),...s.map(({r:b})=>b)])){let[b,h]=[f.get(I),m.get(I)];if(b===e.cellsByRow.get(I)&&h===e.spilledCellsByRow.get(I))continue;let y=b!==void 0&&h!==void 0?{}:b??h;y===void 0?g.delete(I):g.set(I,y)}return{cellsByRow:f,spilledCellsByRow:m,cellsWithSpillByRow:zr(e.cellsWithSpillByRow,r,c),cellsWithListsByRow:zr(e.cellsWithListsByRow,r,d),rowsAsTheyStand:g??f,cellCountByUserId:i,columnIndexesOnShowByRow:l}}function Pi(e,t,n,s){let{sheetId:a,name:r,rows:i,columns:o,ownRowOrder:l}=e,{mergedRanges:u=[],columnWidths:c=[],rowHeights:d=[]}=e,{cellFormats:f=[],dropdowns:m=[],rowGroups:g=[],columnGroups:I=[]}=e,{conditionalFormats:b=[],placements:h=[],cellTables:y=Jf}=e,w=eu(s?.rows,i),A=eu(s?.columns,o,xb),O=e.lastFrozenRow===void 0?-1:w.indexOf(e.lastFrozenRow),v=e.lastFrozenColumn===void 0?-1:A.indexOf(e.lastFrozenColumn);if(O===null||v===null)throw Error("sheets-core named a frozen row or column that is not in the sheet");let k=c.map(({columns:P,widthInPixels:G})=>{let U=A.indexOf(`${P.base}.${P.first}`),Y=A.indexOf(`${P.base}.${P.first+P.count-1}`);if(U===null||Y===null||Y-U!==P.count-1)throw Error("sheets-core named sized columns that are not side by side in the sheet");return{firstIndex:U,count:P.count,sizeInPixels:G}}),C=null,x=null,R=null,M=null,L=null,N=null,V=null,_=null;return{summary:{sheetId:a,name:r,rowCount:w.count,columnCount:A.count,columnEdges:jo(A.count,k,t),frozenRowCount:O+1,frozenColumnCount:v+1,areGridlinesHidden:e.areGridlinesHidden===!0,interactive:e.interactive??null,rowGroups:bu(g,w),columnGroups:bu(I,A),ownRowOrder:l===void 0||l==="givenUp"?null:{stored:Sn(l.asStored.rows),seen:w,firstIndex:l.firstIndex,count:l.count},isOwnRowOrderGivenUp:l==="givenUp"},rows:w,columns:A,isLaidOutAsNew:e.lastFrozenRow===void 0&&e.lastFrozenColumn===void 0&&e.areGridlinesHidden!==!0&&e.interactive===void 0&&[u,c,d,f,g,I,b,h].every(({length:P})=>P===0),cellFormats:iv(f,n),rowSizing:()=>C??=ak(w,d,f),hasBorderLine:()=>R??=uv(f),entriesWithBorders:()=>M??=cv(f,w,A),entriesThatWrapText:()=>L??=dv(f,w,A),numberFormats:()=>N??=ev(f,w,A),formats:()=>V??=mv(f,w,A,n),hexColors:()=>x??=wv(f,m),dropdownsById:new Map(m.map(P=>[P.dropdownId,P])),conditionalFormats:b,placements:gk(h,w,A),cellTables:y,namedViews:e.namedViews??Qf,asStored(){if(l===void 0||l==="givenUp")return null;let{ownRowOrder:P,...G}=e;return _??=Pi({...G,...l.asStored},t,n)},mergedAreas:u.map(({liveTopLeft:P,liveBottomRight:G})=>{let U=qf({rows:w,columns:A},P,G);if(U===null)throw Error("sheets-core named merged cells that are not in the sheet");return U})}}function Xf(e,t){let n=e.rows.idAt(t);if(n===null)return[];let s=e.cellsByRow.get(n),a=e.spilledCellsByRow.get(n);if(s===void 0&&a===void 0)return[];let r=e.columnIndexesOnShowByRow.get(n);if(r!==void 0)return r;let i=[...s?.keys()??[],...a?.keys()??[]].map(o=>e.columns.indexOf(o)).filter(o=>o!==null);return i.sort((o,l)=>o-l),e.columnIndexesOnShowByRow.set(n,i),i}function $r(e,t,n){let{sheetId:s}=e.summary,a=[],r=(i,o)=>{for(let l of o.keys()){let u=e.columns.indexOf(l);u!==null&&mn(u,n.leftColumnIndex,n.columnCount)&&a.push({sheetId:s,rowId:i,columnId:l})}};if(n.rowCount<t.size){for(let i=0;i<n.rowCount;i+=1){let o=e.rows.idAt(n.topRowIndex+i),l=o===null?void 0:t.get(o);o!==null&&l!==void 0&&r(o,l)}return a}for(let[i,o]of t){let l=e.rows.indexOf(i);l!==null&&mn(l,n.topRowIndex,n.rowCount)&&r(i,o)}return a}function rk(e,t){let[n,s,a,r]=[1/0,-1/0,1/0,-1/0],i=o=>{let l=Xf(e,o).filter(d=>mn(d,t.leftColumnIndex,t.columnCount)),[u,c]=[l[0],l.at(-1)];u===void 0||c===void 0||([n,s]=[Math.min(n,o),Math.max(s,o)],[a,r]=[Math.min(a,u),Math.max(r,c)])};if(t.rowCount<e.cellsByRow.size+e.spilledCellsByRow.size)for(let o=0;o<t.rowCount;o+=1)i(t.topRowIndex+o);else for(let o of[...e.cellsByRow.keys(),...e.spilledCellsByRow.keys()]){let l=e.rows.indexOf(o);l!==null&&mn(l,t.topRowIndex,t.rowCount)&&i(l)}return n===1/0?null:{topRowIndex:n,leftColumnIndex:a,rowCount:s-n+1,columnCount:r-a+1}}function qf({rows:e,columns:t},n,s){let a=e.indexOf(n.r),r=t.indexOf(n.c),i=e.indexOf(s.r),o=t.indexOf(s.c);return a===null||r===null||i===null||o===null?null:{topRowIndex:a,leftColumnIndex:r,rowCount:i-a+1,columnCount:o-r+1}}function Iu(e,t,n){let[s,a]=[e.indexOf(t),e.indexOf(n)];return s===null||a===null?null:Ei([s,a])}function ok(e,{rowId:t,columnId:n}){let s=e.rows.indexOf(t),a=e.columns.indexOf(n);if(s===null||a===null)return null;let r=e.cellsByRow.get(t)?.get(n),i=e.spilledCellsByRow.get(t)?.get(n)?.from,o=i===void 0?void 0:e.cellsByRow.get(i.r)?.get(i.c),l=(r??o)===void 0?[...e.cellsWithSpillByRow.values()].flatMap(u=>Array.from(u.values())):[r??o];for(let u of l){if(u?.spill?.kind!=="fills"||u.formulaText===void 0)continue;let c=qf(e,u,u.spill.to);if(c!==null&&mn(s,c.topRowIndex,c.rowCount)&&mn(a,c.leftColumnIndex,c.columnCount))return{formulaText:u.formulaText,area:c}}return null}function ik({sheets:e,calculationTookTooLong:t,timeZone:n,locale:s,decimalSign:a="point",groupSign:r="comma",sizesOfGroups:i="threes",patternOfATimeOfDay:o=bk,views:l=[]},{defaultColumnWidthInPixels:u,localeOfANewWorkbook:c,limits:{mostBytesOfATableToImport:d,mostOptionsInADropdown:f,longestSheetNameInCharacters:m,mostCells:g,mostNamedViewsInASheet:I,longestNameOfANamedViewInCharacters:b,deepestGroup:h,mostCheckboxesOfOneInsert:y,mostEditsInAStep:w,mostRangesInAConditionalFormat:A,mostTestsInAConditionalFormat:O,longestTextOfAConditionInCharacters:v,largestCountInACondition:k,smallestSideOfAPlacementInPixels:C,largestSideOfAPlacementInPixels:x}},R,M=[],L=[]){return{sheets:e.map(N=>({...Pi(N,u,R),...Kf(Rs,[],N.cells,N.spilledCells??[],!1),formatsGiven:M.find(({sheetId:V})=>V===N.sheetId)?.formatsGiven??em})),views:Yf(new Map,l,L),calculationTookTooLong:t===!0,timeZone:n??null,locale:s??c,decimalSign:a,signsOfNumbers:{decimalSign:a,groupSign:r,sizesOfGroups:i},patternOfATimeOfDay:o,defaultColumnWidthInPixels:u,mostBytesOfATableToImport:d,mostOptionsInADropdown:f,longestSheetNameInCharacters:m,mostCells:g,limitsOfNamedViews:{mostNamedViewsInASheet:I,longestNameOfANamedViewInCharacters:b},deepestGroup:h,mostCheckboxesOfOneInsert:y,mostEditsInAStep:w,limitsOfConditionalFormats:{mostRangesInAConditionalFormat:A,mostTestsInAConditionalFormat:O,longestTextOfAConditionInCharacters:v,largestCountInACondition:k},limitsOfPlacements:{smallestSideOfAPlacementInPixels:C,largestSideOfAPlacementInPixels:x},kindOfPattern:R}}function Zf(e,t,n=null){let{defaultColumnWidthInPixels:s,kindOfPattern:a}=e,r=new Map(t.map(o=>[o.sheetId,o]));if(r.size<t.length)throw Error("sheets-core listed a sheet twice");let i=e.sheets.map(o=>{let l=r.get(o.summary.sheetId);if(l===void 0)return o;r.delete(o.summary.sheetId);let{rowsListed:u,cellsNow:c,spilledCellsNow:d,layoutNow:f,formatsGivenNow:m}=l;return{...f===null?o:Pi(f,s,a,o),...Kf(o,u,c,d,f===null),formatsGiven:m??o.formatsGiven}});if(r.size>0)throw Error("sheets-core listed a sheet that the page has not read");return{...e,sheets:i,views:n===null?e.views:Yf(e.views,n.viewsNow,n.inputsNow)}}function zo(e,t){let{sheets:n,calculationTookTooLong:s,timeZone:a,locale:r,decimalSign:i}=e,{signsOfNumbers:o,patternOfATimeOfDay:l}=e,u=new Map(n.map(h=>[h.summary.sheetId,h])),c=n.map(({summary:h})=>h),d=new Set;for(let h of n)for(let y of h.cellCountByUserId.keys())d.add(y);let f=[...d],m=null,g=null,I=c.some(({ownRowOrder:h})=>h!==null),b={listSheets:()=>c,asStored:()=>I?g??=zo({...e,sheets:n.map(h=>({...h,...h.asStored()}))},lk(t,h=>u.get(h)?.summary.ownRowOrder??null)):null,sheetAsItStands:h=>u.get(h)??null,rowsAsTheyStand:h=>(u.get(h)??Rs).rowsAsTheyStand,cellsHeldByRow:h=>(u.get(h)??Rs).cellsByRow,cellsWithSpillIn:h=>[...(u.get(h)??Rs).cellsWithSpillByRow.values()].flatMap(y=>Array.from(y.values())),isSheetAsNew(h){let y=u.get(h);return y!==void 0&&y.isLaidOutAsNew&&y.cellsByRow.size===0},mostBytesOfATableToImport:()=>e.mostBytesOfATableToImport,mostOptionsInADropdown:()=>e.mostOptionsInADropdown,longestSheetNameInCharacters:()=>e.longestSheetNameInCharacters,mostFilledCells:()=>e.mostCells,limitsOfNamedViews:()=>e.limitsOfNamedViews,deepestGroup:()=>e.deepestGroup,mostCheckboxesOfOneInsert:()=>e.mostCheckboxesOfOneInsert,mostEditsInAStep:()=>e.mostEditsInAStep,limitsOfConditionalFormats:()=>e.limitsOfConditionalFormats,limitsOfPlacements:()=>e.limitsOfPlacements,positionOfCell({sheetId:h,rowId:y,columnId:w}){let A=u.get(h),O=A?.rows.indexOf(y)??null,v=A?.columns.indexOf(w)??null;return O===null||v===null?null:{rowIndex:O,columnIndex:v}},rowIndexOf:(h,y)=>u.get(h)?.rows.indexOf(y)??null,columnIndexOf:(h,y)=>u.get(h)?.columns.indexOf(y)??null,cellIdAt(h,y,w){let A=u.get(h),O=A?.rows.idAt(y)??null,v=A?.columns.idAt(w)??null;return O===null||v===null?null:{sheetId:h,rowId:O,columnId:v}},linesOf:h=>u.get(h)??null,cellOf:({sheetId:h,rowId:y,columnId:w})=>u.get(h)?.cellsByRow.get(y)?.get(w)??null,spilledCellOf:({sheetId:h,rowId:y,columnId:w})=>u.get(h)?.spilledCellsByRow.get(y)?.get(w)??null,cellOnShowIn({sheetId:h,rowId:y,columnId:w}){let A=u.get(h);return A?.cellsByRow.get(y)?.get(w)??A?.spilledCellsByRow.get(y)?.get(w)??null},formatOf:({sheetId:h,rowId:y,columnId:w})=>u.get(h)?.cellFormats.formatOf(y,w)??lt,sharedFormatBetween(h,y){let w=u.get(h.sheetId);if(w===void 0||h.sheetId!==y.sheetId)return null;let A=Iu(w.rows,h.rowId,y.rowId),O=Iu(w.columns,h.columnId,y.columnId);return A===null||O===null?null:sv(w.formats(),{topRowIndex:A.firstIndex,leftColumnIndex:O.firstIndex,rowCount:A.count,columnCount:O.count})},lookOfRow:(h,y)=>pv(u.get(h)?.formats()??[],y),conditionalFormatsOf:h=>u.get(h)?.conditionalFormats??[],formatsGivenIn:h=>u.get(h)?.formatsGiven??em,placementsIn:h=>u.get(h)?.placements??wk,cellTablesDeclaredIn:h=>u.get(h)?.cellTables??Jf,namedViewsIn:h=>u.get(h)?.namedViews??Qf,viewAsItStands:h=>e.views.get(h)??null,rowSizingOf:h=>u.get(h)?.rowSizing()??[],whereTextWraps:h=>u.get(h)?.entriesThatWrapText()??[],cellsWithListsIn:h=>u.get(h)?.cellsWithListsByRow??Rs.cellsWithListsByRow,hasBorderLine:h=>u.get(h)?.hasBorderLine()??!1,bordersMayChangeBefore:(h,y)=>tv(u.get(h)?.entriesWithBorders()??[],y),isTextClippedIn:(h,y)=>hv(u.get(h)?.formats()??[],y),numberFormatPatternsIn:(h,y)=>nv(u.get(h)?.numberFormats()??[],y),hexColorsOf:h=>u.get(h)?.hexColors()??[],dropdownOf({sheetId:h,rowId:y,columnId:w}){let A=u.get(h),O=A?.cellFormats.formatOf(y,w).cellControl;if(A===void 0||O?.kind!=="dropdown")return null;let v=A.dropdownsById.get(O.dropdownId);if(v===void 0)throw Error("sheets-core named a dropdown that is not among the sheet’s");return v},spillOver(h){let y=`${h.sheetId} ${h.rowId} ${h.columnId}`;if(m?.key===y)return m.over;let w=u.get(h.sheetId),A=w?.summary.ownRowOrder??null,O=A===null?null:b.asStored()?.spillOver(h)??null,v=O===null?null:jt("seen",A,{firstIndex:O.area.topRowIndex,count:O.area.rowCount}),k=O===null||v===null?null:{...O,area:{...O.area,topRowIndex:v.firstIndex,rowCount:v.count}},C=w===void 0||A!==null?k:ok(w,h);return m={key:y,over:C},C},filledCellsIn(h,y){let w=u.get(h);return w===void 0?[]:$r(w,w.cellsByRow,y)},cellsOnShowIn(h,y){let w=u.get(h);if(w===void 0)return[];let A=$r(w,w.cellsByRow,y);return w.spilledCellsByRow.size===0?A:[...A,...$r(w,w.spilledCellsByRow,y)]},areaOnShowIn(h,y){let w=u.get(h);return w===void 0?null:rk(w,y)},columnIndexesOnShowIn(h,y){let w=u.get(h);return w===void 0?[]:Xf(w,y)},mergedAreaAt:(h,{rowIndex:y,columnIndex:w})=>u.get(h)?.mergedAreas.find(A=>mn(y,A.topRowIndex,A.rowCount)&&mn(w,A.leftColumnIndex,A.columnCount))??null,mergedAreasIn:(h,y)=>u.get(h)?.mergedAreas.filter(w=>Ik(w,y))??[],userIds:()=>f,isEveryCellBlank:n.every(({cellsByRow:h})=>h.size===0),filledCellCount(){let h=0;for(let{cellsByRow:y}of n)for(let w of y.values())h+=w.size;return h},calculationTookTooLong:s,timeZone:a,locale:r,decimalSign:i,signsOfNumbers:o,patternOfATimeOfDay:l,...t,...vk(r,t)};return b}function lk(e,t){return{...e,tableAtCell(n){let[s,a]=[e.tableAtCell(n),t(n.sheetId)];return a===null||s==="nowhere"?s:Si("stored",a,s)},cellTableAt(n){let[s,a]=[e.cellTableAt(n),t(n.sheetId)];return a===null||s===null?s:Ga("stored",a,s)},cellTables(n){let[s,a]=[e.cellTables(n),t(n)];return a===null||s===null||s==="tookTooLong"?s:s.map(r=>Ga("stored",a,r))},conditionalFormatsAsAgentIsTold(n,s){let[a,r]=[[n.rowId,s.rowId],t(n.sheetId)],[i,o]=r===null?a:zb(r,a);return e.conditionalFormatsAsAgentIsTold({...n,rowId:i},{...s,rowId:o})}}}function uk(e,t){let n=e.cellOnShowIn(t);if(n?.shown?.kind!=="text")return null;let s=Gn(n),{pattern:a}=tm(e,t);return s?.kind==="number"&&kk.test(a)?e.shownWithRoomForAll(s,a)??n.shown.text:n.shown.text}const ck=e=>e===void 0||e.every(({value:t,text:n})=>n===""&&(t===null||t==="")),dk=({range:{sheetId:e,topLeft:t,bottomRight:n}})=>JSON.stringify([e,...t.r<n.r?[t.r,n.r]:[n.r,t.r]]),fk=e=>Object.fromEntries(e.map(({name:t,rows:n})=>[t,n])),mk=({answer:e},t)=>"refusal"in e?e:{byElement:new Map(e.elements.map(({elementId:n,inputs:s})=>{let a=t.elements.find(o=>o.elementId===n);if(a?.kind==="interactive")return[n,fk(s)];let r=a?.inputs,i=s.map(({name:o})=>{let l=r?.find(u=>u.name===o);return l===void 0?JSON.stringify(o):dk(l)});return[n,Object.fromEntries(s.map(({name:o,rows:l},u)=>{let c=s.filter((f,m)=>i[m]===i[u]),d=sk(c.map(f=>f.rows));return[o,d<l.length?l.slice(0,d):l]}))]}))},pk=(e,t)=>({view:e,inputs:mk(t,e),..."canBeReset"in t.answer&&{canBeReset:!0},..."hasDefaultsToSave"in t.answer&&{hasDefaultsToSave:!0}}),hk={xInPixels:0,yInPixels:0},gk=(e,t,n)=>e.map(({placementId:s,placement:a,liveTopLeft:r})=>{let[i,o]=[t.indexOf(r.r),n.indexOf(r.c)];if(i===null||o===null)throw Error("sheets-core placed a view at a cell that is not in the sheet");let{shows:l,widthInPixels:u,heightInPixels:c}=a;return{placementId:s,viewId:l.viewId,rowIndex:i,columnIndex:o,offsetFromAnchorCell:a.offsetFromAnchorCell??hk,widthInPixels:u,heightInPixels:c}}),rn=({rowId:e,columnId:t})=>({r:e,c:t}),As=(e,t)=>({sheetId:e.sheetId,oneCorner:rn(e),otherCorner:rn(t)}),yk={currency:"$#,##0.00",roundedCurrency:"$#,##0",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",monthAndDay:"mmm d",monthAndYear:"mmm yyyy"},wk=[],Jf=[],Qf=[],em={notWorkedOut:null,formats:[],colorScales:[],matches:[]},Rs={cellsByRow:new Map,spilledCellsByRow:new Map,cellsWithSpillByRow:new Map,cellsWithListsByRow:new Map,rowsAsTheyStand:new Map,cellCountByUserId:new Map,columnIndexesOnShowByRow:new Map},bu=(e,t)=>e.map(({groupId:n,ends:s,depth:a,isCollapsed:r})=>{let[i,o]=[t.indexOf(s.first),t.indexOf(s.last)];if(i===null||o===null||o<i)throw Error("sheets-core named a group whose ends are not in the sheet in that order");return{groupId:n,firstIndex:i,count:o-i+1,depth:a,isCollapsed:r}}),mn=(e,t,n)=>e>=t&&e<t+n,Ik=(e,t)=>e.topRowIndex<t.topRowIndex+t.rowCount&&t.topRowIndex<e.topRowIndex+e.rowCount&&e.leftColumnIndex<t.leftColumnIndex+t.columnCount&&t.leftColumnIndex<e.leftColumnIndex+e.columnCount,bk="h:mm AM/PM",vk=(e,{dayTypedInLocaleAs:t,shownInLocaleWithRoomForAll:n,patternReadInLocale:s,formulaInLocale:a,patternsOfLocale:r,fitOfColumnReadingsInLocale:i,textsUnderAColumnReadingInLocale:o})=>({dayTypedAs:(...l)=>t(e,...l),shownWithRoomForAll:(...l)=>n(e,...l),patternRead:(...l)=>s(e,...l),formulaAsTyped:l=>a(e,l),patternsOfItsLocale:r(e)??yk,fitOfColumnReadings:(...l)=>i(e,...l),textsUnderAColumnReading:(...l)=>o(e,...l)}),kk=/general|@/i,tm=(e,t)=>e.cellOnShowIn(t)?.numberFormatBrought??e.formatOf(t).numberFormat;function Ak(e){let t=new Map;return(n,s)=>{let a=`${n.sheetId}/${n.rowId}/${n.columnId}`,r=e(n,s);if(r!=="yetToCome"&&r!=="neverToCome"){t.delete(a),t.set(a,{cellNow:s,said:r});for(let l of[...t.keys()].slice(0,-29))t.delete(l);return{said:r,isLatest:!0}}let i=t.get(a),o=i?.cellNow===s?i.said:null;return r==="neverToCome"?{said:o??nm,isLatest:!0}:o===null?null:{said:o,isLatest:!1}}}const nm={cause:null,passedOnFrom:null},Tk=({editsBefore:e=[],edit:t,editsThatGoAlong:n=[]})=>[...e.map(s=>s.edit),t,...n];function $o(e,t){if(Array.isArray(e))return e.map(s=>$o(s,t));if(typeof e!="object"||e===null)return e;let n={};for(let s in e)n[s]=s==="r"&&e.r===null?t:$o(e[s],t);return n}function vu(e,t,n){let s=n.get(t);return s===void 0&&(s=JSON.parse(e),n.size<64&&n.set(t,s)),s}function Ck(e,t){for(let n of e){let s=new Ek(n),a=0;s.rowIds().forEach((r,i)=>{let o=s.rowEnds[i];t(r,new Sk(s,r,a,o)),a=o})}}function sm(e){let t=new Map;return Ck(e,(n,s)=>t.set(n,s)),t}const Ok=Object.freeze([]),xk=e=>JSON.parse(JSON.stringify(e)),Yr=[];let es,Ms,xa;[es,Ms,xa]=[0,0,0];const Ek=class Yo{#e=new WeakRef(this);#s=new Map;#t=new Map;#n;#r;#o;#i;#l;#u;#c;#d;#f=new Map;#m=new Map;constructor({lists:t,texts:n}){let[s,a,r,i]=new Uint32Array(t,0,4),o=4*Uint32Array.BYTES_PER_ELEMENT,l=(d,f)=>{let m=new d(t,o,f);return o+=m.byteLength,m};this.#n=n,this.#r=l(Float64Array,r),this.#o=l(Uint32Array,s),this.rowEnds=l(Uint32Array,s);let u=l(Uint32Array,a),c=l(Uint32Array,a);this.#i=l(Uint32Array,i),this.columns=l(Uint32Array,r),this.#l=l(Uint32Array,r),this.#u=l(Uint32Array,r),this.#c=l(Uint32Array,r),this.#d=l(Uint32Array,r),this.forms=l(Uint8Array,r),this.#p(u).forEach((d,f)=>{this.#f.set(c[f],d),this.#m.set(d,c[f])})}#a(t){let n=t===1?0:this.#i[t-2];return this.#n.substring(n,this.#i[t-1])}#p(t){return xk(Array.from(t,n=>this.#a(n)))}rowIds(){return this.#p(this.#o)}#y(t,n){let[s,a]=[this.#a(t),this.#t],r;return{kind:"formula",get formula(){if(r===void 0){let{textBetweenReferences:i,references:o}=vu(s,t,a);r={textBetweenReferences:i,references:$o(o,n)}}return r}}}columnIdAt(t){return this.#f.get(this.columns[t])}indexOf(t,n,s){let a=this.#m.get(t);if(a===void 0)return-1;let{columns:r}=this,i=n+a-r[n];if(i<n)return-1;if(i<s&&r[i]===a)return i;let[o,l]=[n,s-1];for(;o<=l;){let u=o+l>>>1;if(r[u]===a)return u;r[u]<a?o=u+1:l=u-1}return-1}keptCellAt(t,n){return this.#s.get(n)?.cells[t-n]}static#h(){let{block:t,startOfRow:n,count:s}=Yr[es],a=t.deref();a!==void 0&&a.#s.delete(n),Yr[es]=void 0,es=(es+1)%4096,Ms-=1,xa-=s.ofCells}keepCell(t,n,s){for(;xa>=65536;)Yo.#h();let a=this.#s.get(s);return a===void 0&&(Ms===4096&&Yo.#h(),a={cells:[],count:{ofCells:0}},this.#s.set(s,a),Yr[(es+Ms)%4096]={block:this.#e,startOfRow:s,count:a.count},Ms+=1),a.cells[n-s]=t,a.count.ofCells+=1,xa+=1,t}#g(t,n,s){return t===0||s===0?t===s:this.#a(t)===n.#a(s)}isCellAsIn(t,n,s){let a=this.forms[t];if(a!==n.forms[s])return!1;let r=this.#r[t],i=n.#r[s],o=(a&7)===1||(a&24)===16,l=(u,c)=>this.#g(u[t],n,c[s]);return(o?this.#g(r,n,i):Object.is(r,i))&&l(this.#l,n.#l)&&l(this.#u,n.#u)&&l(this.#c,n.#c)&&l(this.#d,n.#d)}newCellAt(t,n){let s=this.forms[t],a=this.#r[t],r=this.#u[t],i=this.columnIdAt(t),o;switch(s&7){case 0:o={r:n,c:i,input:{kind:"number",value:a}},r!==0&&(o.numberIsEditedAs=this.#a(r));break;case 1:o={r:n,c:i,input:{kind:"text",value:this.#a(a)}};break;case 2:o={r:n,c:i,input:{kind:"boolean",value:a===1}};break;case 3:o={r:n,c:i,input:this.#y(this.#c[t],n)},r!==0&&(o.formulaText=this.#a(r));break;default:o={r:n,c:i}}switch((s&32)!==0&&(o.textIsEditedAfterTheMark=!0),s&24){case 8:o.value={kind:"number",value:a};break;case 16:o.value={kind:"text",value:this.#a(a)};break;case 24:o.value={kind:"boolean",value:a===1};break}let[l,u]=[this.#l[t],this.#d[t]];if(l!==0&&(o.shown={kind:"text",text:this.#a(l),textColor:null}),u===0)return o;let c=vu(this.#a(u),u,this.#t);return Object.assign(o,c)}},Sk=class{#e;#s;#t;#n;constructor(t,n,s,a){this.#e=t,this.#s=n,this.#t=s,this.#n=a}#r(t){return this.#e.keptCellAt(t,this.#t)??this.#e.newCellAt(t,this.#s)}#o(t){let n=[];for(let s=this.#t;s<this.#n;s+=1)n.push(t(s));return n}#i(t){let{forms:n}=this.#e;for(let s=this.#t;s<this.#n;s+=1)if((n[s]&t)!==0)return!0;return!1}get size(){return this.#n-this.#t}get(t){let n=this.#e.indexOf(t,this.#t,this.#n);if(n!==-1)return this.#e.keptCellAt(n,this.#t)??this.#e.keepCell(this.#e.newCellAt(n,this.#s),n,this.#t)}has(t){return this.#e.indexOf(t,this.#t,this.#n)!==-1}keys(){return this.#o(t=>this.#e.columnIdAt(t)).values()}values(){return this.#o(t=>this.#r(t)).values()}entries(){return Array.from(this.values(),t=>[t.c,t]).values()}[Symbol.iterator](){return this.entries()}forEach(t,n){for(let[s,a]of this)t.call(n,a,s,this)}hasAnError(){return this.#i(128)}cellsWithUsersARichTextOrASpill(){if(!this.#i(64))return Ok;let{forms:t}=this.#e,n=s=>(t[s]&64)!==0;return this.#o(s=>s).filter(n).map(s=>this.#r(s))}columnsThatReadOtherwiseIn(t){if(!(#e in t)||t.#s!==this.#s)return[...this.keys()];let n=[];for(let s=this.#t;s<this.#n;s+=1){let a=this.#e.columnIdAt(s),r=t.#e.indexOf(a,t.#t,t.#n);(r===-1||!this.#e.isCellAsIn(s,t.#e,r))&&n.push(a)}return n}goesOnAs(t){let n=this.size===t.size&&this.columnsThatReadOtherwiseIn(t).length===0;return n&&(this.#e=t.#e,this.#t=t.#t,this.#n=t.#n),n}};function am(e,t){let n=e.answer({kind:"readTableAtCell",sheetId:t.sheetId,cell:rn(t)});if(n.kind==="table")return n.read??"nowhere";if(n.kind==="refused")return null;throw Error("sheets-core did not say where a table is")}function Rk(e,t){let n=e.answer({kind:"readTablesOfSheet",sheetId:t});if(n.kind==="tablesOfSheet")return n.tables;if(n.kind==="refused")return null;throw Error("sheets-core did not list the tables of a sheet")}function ku(e){if(e.kind==="cellTableAt")return e.cellTable;if(e.kind==="refused")return null;throw Error("sheets-core did not say where a cell table is")}function rm(e,t){let n=e.answer({kind:"readXlsxFile",...t});if(n.kind==="xlsxFile")return n;if(n.kind!=="refused")throw Error("sheets-core did not write the workbook as a file");return(t.charts??[]).length>0?rm(e,{...t,charts:[]}):null}function om(e){let t=e.answer({kind:"readLocales"});if(t.kind!=="locales")throw Error("sheets-core did not list the locales");return t}function Mk(e){let t=(s,a)=>{let r=e.answer({kind:"readTypedDay",text:a,locale:s});if(r.kind==="typedDay")return r.day;if(r.kind==="refused")return null;throw Error("sheets-core did not say which day a text spells")},n=(s,a,r)=>{let i={kind:"asText"},o={pattern:r},l=e.answer({kind:"readShownValue",value:a,numberFormat:o,room:i,locale:s});if(l.kind!=="shownValue")throw Error("sheets-core did not say what a cell shows");return l.shown};return{dayTypedInLocaleAs:t,shownInLocaleWithRoomForAll:(s,a,r)=>{let i=n(s,a,r);return i.kind==="text"?i.text:null},patternReadInLocale:(s,a,r)=>{let i=e.answer({kind:"readKindOfPattern",pattern:a});if(i.kind==="refused")return i;if(i.kind!=="kindOfPattern")throw Error("sheets-core did not read a pattern");let o={kind:"number",value:r(i.numberFormatKind)},l=n(s,o,a);return{kind:"numberFormat",numberFormat:{pattern:a},shown:l}},formulaInLocale:(s,a)=>{let r=e.answer({kind:"readFormulaTextInLocale",text:a,locale:s});if(r.kind==="formulaTextInLocale")return r.text;if(r.kind==="refused")return null;throw Error("sheets-core did not write a formula in a locale")},patternsOfLocale:s=>{let a=e.answer({kind:"readPatternsOfMoney",locale:s});if(a.kind!=="patternsOfMoney")throw Error("sheets-core did not say how a locale writes its money");let r=e.answer({kind:"readPatternsOfDatesWithTheMonthNamed",locale:s});if(r.kind!=="patternsOfDatesWithTheMonthNamed")throw Error("sheets-core did not say how a locale writes a date with the month named");return{currency:a.withTwoDecimals,roundedCurrency:a.withNoDecimals,mediumDate:r.withTheMonthForShort,longDate:r.withTheMonthInFull,monthAndDay:r.monthAndDay,monthAndYear:r.monthAndYear}},fitOfColumnReadingsInLocale:(s,a,r)=>{let i=e.answer({kind:"readFitOfColumnReadings",readings:a,texts:r,locale:s});if(i.kind==="fitOfColumnReadings")return i.fits;if(i.kind==="refused")return null;throw Error("sheets-core did not say how a column takes its readings")},textsUnderAColumnReadingInLocale:(s,a,r)=>{let i=e.answer({kind:"readTextsUnderAColumnReading",reading:a,texts:r,locale:s});if(i.kind==="textsUnderAColumnReading")return i;if(i.kind==="refused")return null;throw Error("sheets-core did not read the texts of a column")},labelsOfADropdownColumn:s=>{let a=e.answer({kind:"readLabelsOfADropdownColumn",texts:s});if(a.kind!=="labelsOfADropdownColumn")throw Error("sheets-core did not say what the options of a column would say");return a.labels},listLinesAsKept:s=>{let a=e.answer({kind:"readListLinesAsKept",lists:[...s]});if(a.kind!=="listLinesAsKept")throw Error("sheets-core did not say how a cell keeps the lines of lists");return a.lines},timeZones:()=>{let s=e.answer({kind:"readTimeZones"});if(s.kind!=="timeZones")throw Error("sheets-core did not list the time zones");return s.timeZones},timeZoneNamed:s=>{let a=e.answer({kind:"readTimeZoneNamed",name:s});if(a.kind==="timeZoneNamed")return a.timeZone;if(a.kind==="refused")return null;throw Error("sheets-core did not say which time zone a name stands for")},locales:()=>om(e).locales}}function Nk(e,t,n){let s=(x,R,M)=>{if(x.sheetId!==R.sheetId)return null;let L=e.answer({kind:"readCellsToCopy",cells:As(x,R),...M.length>0&&{rowsOutOfView:[...M]}});if(L.kind==="cellsToCopy")return L;if(L.kind==="refused")return null;throw Error("sheets-core did not write cells for a copy")},a=(x,R)=>{if(x.sheetId!==R.sheetId)return null;let M=e.answer({kind:"readDropdownOptionsToOffer",...As(x,R)});if(M.kind==="dropdownOptionsToOffer")return M.options;if(M.kind==="refused")return null;throw Error("sheets-core did not say which options to offer")},r=(x,R,M)=>{if(x.sheetId!==R.sheetId)return null;let L=e.answer({kind:"readCellsThatADropdownWouldClear",cells:As(x,R),dropdown:M});if(L.kind==="cellsThatADropdownWouldClear")return L;if(L.kind==="refused")return null;throw Error("sheets-core did not say what a dropdown would clear")},i=x=>{let R=e.answer({kind:"readCellsOfTheDropdownAt",sheetId:x.sheetId,cell:rn(x)});if(R.kind==="cellsOfDropdown")return R;if(R.kind==="refused")return null;throw Error("sheets-core did not say where the cells of a dropdown are")},o=x=>{let R=e.answer({kind:"readWhatATableChanges",table:x,newIdCode:t()});if(R.kind==="whatATableChanges"||R.kind==="refused")return R;throw Error("sheets-core did not say what a table changes in a sheet")},l=(x,R)=>{let M=e.answer({kind:"readFormatsGiven",sheetId:x,asIf:[...R]});if(M.kind==="formatsGiven")return M.notWorkedOut===null?M:null;if(M.kind==="refused")return null;throw Error("sheets-core did not say what conditional formats would give")},u=(x,R)=>{if(x.sheetId!==R.sheetId)return null;let M=As(x,R),L=e.answer({kind:"readConditionalFormatSuggestions",cells:M});if(L.kind==="conditionalFormatSuggestions")return L;if(L.kind==="refused")return null;throw Error("sheets-core did not suggest conditional formats")},c=x=>am(e,x),d=x=>{let[{sheetId:R},M]=[x,rn(x)];return ku(e.answer({kind:"readCellTableAt",sheetId:R,cell:M}))},f=(x,R)=>{let M=e.answer({kind:"readCellTableDeclaredAs",sheetId:x,cellTable:R});return M.kind==="refused"&&M.refusal==="readTookTooLong"?"tookTooLong":ku(M)??"nowhere"},m=x=>{let R=e.answer({kind:"readCellTables",sheetId:x});if(R.kind==="cellTables")return R.cellTables;if(R.kind==="refused")return R.refusal==="readTookTooLong"?"tookTooLong":null;throw Error("sheets-core did not list the cell tables of a sheet")},g=(x,R)=>{if(x.sheetId!==R.sheetId)return null;let M=As(x,R),L=e.answer({kind:"readConditionalFormatsAsAgentIsTold",cells:M});if(L.kind==="conditionalFormatsAsAgentIsTold")return L.told;if(L.kind==="refused")return null;throw Error("sheets-core did not say what Agent is told of conditional formats")},I=(x,R)=>{let M=e.answer({kind:"readConditionalFormatsInIds",sheetId:x,written:R});if(M.kind==="conditionalFormatsInIds")return M.read;if(M.kind==="refused")return null;throw Error("sheets-core did not read conditional formats in ids")},b=(x,R)=>{let M=e.answer({kind:"readConditionalFormatsByAddress",sheetId:x,rules:[...R]});if(M.kind==="conditionalFormatsByAddress")return M.rules;if(M.kind==="refused")return null;throw Error("sheets-core did not read conditional formats by address")},h=(x,R)=>{let M=e.answer({kind:"readProposedFormulaValue",sheetId:x.sheetId,cell:rn(x),text:R});if(M.kind==="proposedFormulaValue")return{cell:M.cell};if(M.kind==="refused")return null;throw Error("sheets-core did not say what an entry comes to")},y=(x,R)=>{let M=e.answer({kind:"readFilteredRows",table:x,filter:R});if(M.kind==="filteredRows"||M.kind==="refused")return M;throw Error("sheets-core did not say which rows a filter takes out of view")},w=(x,R,M)=>{let L=e.answer({kind:"readValuesOfFilteredColumn",table:x,filter:R,c:M});if(L.kind==="valuesOfFilteredColumn"||L.kind==="refused")return L;throw Error("sheets-core did not say what a column of a filtered table holds")},A=x=>{let R=e.answer({kind:"readRowsInSortedOrder",...x});if(R.kind==="rowsInSortedOrder"||R.kind==="refused")return R;throw Error("sheets-core did not say in which order a sort would put rows")},O=x=>{let R=e.answer({kind:"readTablesOfSheet",sheetId:x});if(R.kind==="tablesOfSheet"||R.kind==="refused")return R;throw Error("sheets-core did not say which tables a sheet has")},v=x=>{let[{sheetId:R},M]=[x,rn(x)],L=e.answer({kind:"readPivotTableAt",sheetId:R,cell:M});if(L.kind==="pivotTableAt"||L.kind==="refused")return L;throw Error("sheets-core did not say which pivot table a cell is part of")},k=(x,R,M,L)=>{let N=e.answer({kind:"readValuesToFilterPivotTableBy",source:x,c:R,keeps:M,listed:[...L]});if(N.kind==="valuesOfFilteredColumn"||N.kind==="refused")return N;throw Error("sheets-core did not say what a pivot table can be filtered by")},C=({sheetId:x,cell:R})=>{let M=e.answer({kind:"readCauseOfError",sheetId:x,cell:R});if(M.kind==="causeOfError")return M.cause;if(M.kind!=="refused")throw Error("sheets-core did not say why a formula comes to an error")};return{filteredRows:y,valuesOfFilteredColumn:w,rowsInSortedOrder:A,tablesOfSheet:O,pivotTableAt:v,valuesToFilterPivotTableBy:k,proposedFormulaValue:h,causeOfError:x=>{let R=C({sheetId:x.sheetId,cell:rn(x)});if(R===void 0)return{said:nm,isLatest:!0};let M=n()+Gk,L=null,N=R;for(let _=Fk;_>0&&N?.kind==="showsTheSameError"&&n()<M;_-=1)L=N.cell,N=C(L);let V=N?.kind!=="showsTheSameError";return{said:{cause:R,passedOnFrom:V?L:null},isLatest:!0}},formatsGivenAsIf:l,conditionalFormatSuggestions:u,tableAtCell:c,cellTableAt:d,cellTables:m,cellTableDeclaredAs:f,conditionalFormatsAsAgentIsTold:g,conditionalFormatsInIds:I,conditionalFormatsByAddress:b,cellsToCopy:s,dropdownOptionsToOffer:a,cellsThatADropdownWouldClear:r,cellsOfTheDropdownAt:i,whatATableChanges:o}}function im(e,t){let n=e.answer({kind:"readFormatsGiven",sheetId:t});if(n.kind!=="formatsGiven")throw Error("sheets-core did not say what conditional formats give");return n}function lm(e,t){let n=e.answer({kind:"readInputsOfView",viewId:t});if(n.kind!=="inputsOfView"&&n.kind!=="refused")throw Error("sheets-core did not read the inputs of a view");return{viewId:t,answer:n}}function _k(e,t){let n=t.answer({kind:"describeSharedCode"});if(n.kind!=="sharedCodeDescription")throw Error("sheets-core did not describe itself");let s=e.answer({kind:"readWorkbookWithCellsPacked"});if(s.kind!=="workbookContentsWithCellsPacked")throw Error("sheets-core did not read the workbook");let a=s.sheets.flatMap(o=>o.conditionalFormats===void 0?[]:[{sheetId:o.sheetId,formatsGiven:im(e,o.sheetId)}]),r=(s.views??[]).map(({viewId:o})=>lm(e,o)),{localeOfANewWorkbook:i}=om(t);return{kind:"everything",description:n,localeOfANewWorkbook:i,contents:s,given:a,inputsOfViews:r}}function Bk(e,t){let n=e.answer({kind:"readViews"});if(n.kind!=="views")throw Error("sheets-core did not read the views");let s=new Set(n.views.map(({viewId:a})=>a));return{viewsNow:n.views,inputsNow:t.filter(a=>s.has(a)).map(a=>lm(e,a))}}function um(e,t,n,s){if(n.length===0)return{rowsListed:n,cellsNow:[],spilledCellsNow:[]};let a=n==="all"?null:n,r=e.answer({kind:"readRowsWithCellsPacked",sheetId:t,rows:a,columns:s});if(r.kind==="refused")return null;if(r.kind!=="rowsWithCellsPacked")throw Error("sheets-core did not read rows");return{rowsListed:n,cellsNow:r.cells,spilledCellsNow:r.spilledCells??[]}}function Hk(e,t,n,s,a){let r=({sheetId:o,cells:l,isLayoutChanged:u,areFormatsGivenChanged:c})=>{let d=a(o)?"all":[...new Set(l.map(({r:g})=>g))],f=um(e,o,d,null);if(f===null)throw Error("sheets-core did not read rows");let m=u?e.answer({kind:"readSheetLayout",sheetId:o}):null;if(m!==null&&m.kind!=="sheetLayout")throw Error("sheets-core did not read the layout of a sheet");return{sheetId:o,...f,layoutNow:m,formatsGivenNow:c===!0?im(e,o):null}},i=s?e.answer({kind:"readTimeZone"}):null;if(i!==null&&i.kind!=="timeZone")throw Error("sheets-core did not read the time zone");return{kind:"changed",sheets:t.map(r),views:n.length===0?null:Bk(e,n),timeZone:i}}function Pk(e,t,n){if(t.kind==="everything"){let{contents:a}=t;return ik({...a,sheets:a.sheets.map(jk)},{...t.description,localeOfANewWorkbook:t.localeOfANewWorkbook},Dk(n),t.given,t.inputsOfViews)}if(e===null)throw Error("changes were listed to a page that has read nothing");let s=Zf(e,t.sheets.map(fm),t.views);return t.timeZone===null?s:{...s,timeZone:t.timeZone.timeZone}}function Vk(){let e=new Map;return{note(t){if(t.kind==="everything"){let{sheets:n}=t.contents;e=new Map(n.map(({sheetId:s,cells:a})=>[s,{whole:Tu(a),since:0}]));return}for(let{sheetId:n,rowsListed:s,cellsNow:a}of t.sheets){let{whole:r=0,since:i=0}=e.get(n)??{},o=Tu(a);e.set(n,s==="all"?{whole:o,since:0}:{whole:r,since:i+o})}},mayBeTwiceWhatIsNeededIn(t){let{whole:n=0,since:s=0}=e.get(t)??{};return s>Math.max(n,$k)}}}function Lk(e,t,n=dm(e,t),s){let a=null,r=Vk(),i=o=>{r.note(o);let l=s===void 0?o:Wk(o);return a=Pk(a,l,t),s?.(o),zo(a,n)};return{readEverything:()=>i(_k(e,t)),readChanged(o,l,u){if(a===null)throw Error("changes were listed to a page that has read nothing");return i(Hk(e,o,l,u,r.mayBeTwiceWhatIsNeededIn))},readWithCellsIn(o,l,u){let c=um(e,o,l,u);if(a===null||c===null)return null;let d=fm({sheetId:o,...c,layoutNow:null,formatsGivenNow:null});return zo(Zf(a,[d]),n)}}}const cm=()=>[...crypto.getRandomValues(new Uint8Array(10))].map(e=>"abcdefghijkmnpqrstuvwxyz23456789"[e%32]).join(""),Au=new Map,Dk=e=>t=>{let n=Au.get(t);if(n!==void 0)return n;let s=e.answer({kind:"readKindOfPattern",pattern:t});if(s.kind!=="kindOfPattern")throw Error("sheets-core did not read the pattern of a number format that a cell has");return Au.set(t,s.numberFormatKind),s.numberFormatKind},Fk=39,Gk=50,dm=(e,t,n=cm,s=()=>performance.now())=>({...Mk(t),...Nk(e,n,s)}),Uk=(e,t)=>e.kind==="everything"?{...e,contents:{...e.contents,sheets:e.contents.sheets.map(n=>({...n,cells:t()}))}}:{...e,sheets:e.sheets.map(n=>({...n,cellsNow:t()}))},Wk=e=>e.kind==="everything"?{...e,contents:{...e.contents,sheets:e.contents.sheets.map(t=>({...t,cells:[],spilledCells:[]}))}}:{...e,sheets:e.sheets.map(t=>({...t,rowsListed:[],cellsNow:[],spilledCellsNow:[]}))},fm=e=>({...e,cellsNow:sm(e.cellsNow)}),jk=e=>({...e,cells:sm(e.cells)}),zk=1500,Tu=e=>e.reduce((t,{lists:n,texts:s})=>t+zk+n.byteLength+s.length,0),$k=8388608,Yk="comfortable",Un=e=>13*e/10,Kk=1.3,Xk=18,Wn=e=>Math.max(Xk,Math.ceil(Kk*Un(e))),qk=1.2,mm=e=>Math.round((Wn(e)-qk*Un(e))/2),pm=e=>Wn(e)-2*mm(e),Bn={comfortable:{over:5,under:4,beside:6,besideBox:3,besideBoxAtRight:4,afterMark:5,markIntoWords:2},compact:{over:2,under:2,beside:4,besideBox:4,besideBoxAtRight:4,afterMark:3,markIntoWords:0}},hm=1,Zk=(e,t,{over:n,under:s})=>Math.min(nk,n+Wn(t)+(e-1)*pm(t)+s+hm),Jk=(e,t,n)=>Zk(e,t,Bn[n]),gm=(e,t)=>Jk(1,e,t),Qk=e=>gm(lt.font.size,e);Qk(Yk);const Ko=(e,t,n)=>Math.max(t,Math.min(e,n)),Cu=(e,t,n)=>e>=t&&e<t+n;function eA(e,t,n,s,a=0,r=!1){let[i,o]=[Bn.compact,Bn[n]],l=e-aA(t),u=Ko(a,0,l),c=Ko(l-u,0,o.over-i.over+o.under-i.under),d=s==="right"?o.besideBoxAtRight:o.besideBox,f=r?d:o.beside,m={left:1,center:0,right:-1}[s]*(f-i.beside);return{over:i.over+Math.ceil(c/2),under:i.under+Math.floor(c/2)+u,left:js/2+m,right:js/2-m}}function tA({left:e,right:t},n){let s=e-(t-Im);return n==="right"?{atLeft:Math.max(0,-s),atRight:0}:{atLeft:0,atRight:Math.max(0,s)}}const nA=1.8461538461538463,sA=(e,t)=>e===null?0:(e+1)*nA*Un(t),Ou=e=>({after:Bn[e].afterMark,intoWords:Bn[e].markIntoWords}),aA=e=>gm(e,"compact"),ym=4,wm=({over:e})=>Ko(2*(e-3),0,ym),Im=1,js=8;2*Bn.comfortable.beside;js-Bn.comfortable.beside-Im;jo(0,[],0),jo(0,[],0);function Xo(e){switch(e.kind){case"standard":return`${e.hue} ${e.shade}`;case"rgb":return e.hex;case"none":return e.kind}}const rA={kind:"none"},oA={hex:"#f3f3f3"};function bm(e){let[t,n,s]=vm(e);return[Kr(t),Kr(n),Kr(s)]}function gt(e){let[t,n,s]=bm(e),a=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*s),r=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*s),i=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*s),o=1.9779984951*a-2.428592205*r+.4505937099*i,l=.0259040371*a+.7827717662*r-.808675766*i;return{lightness:.2104542553*a+.793617785*r-.0040720468*i,chroma:Math.hypot(o,l),hue:Math.atan2(l,o)}}function ds({lightness:e,chroma:t,hue:n}){let s=t*Math.cos(n),a=t*Math.sin(n),r=(e+.3963377774*s+.2158037573*a)**3,i=(e-.1055613458*s-.0638541728*a)**3,o=(e-.0894841775*s-1.291485548*a)**3;return[Xr(4.0767416621*r-3.3077115913*i+.2309699292*o),Xr(-1.2684380046*r+2.6097574011*i-.3413193965*o),Xr(-.0041960863*r-.7034186147*i+1.707614701*o)]}function ja(e,t){let n=0,s=lA;for(let a=0;a<12;a+=1){let r=(n+s)/2;iA({lightness:e,chroma:r,hue:t})?n=r:s=r}return n}function fs(e,t){if(e.chroma<km)return ps(ds({lightness:t,chroma:0,hue:0}));let n=ja(e.lightness,e.hue),s=(n===0?0:Math.min(1,e.chroma/n))*ja(t,e.hue);return ps(ds({lightness:t,chroma:s,hue:e.hue}))}function ms(e){let[t,n,s]=bm(e);return .2126*t+.7152*n+.0722*s}function Rt(e,t){let[n,s]=[ms(e),ms(t)];return(Math.max(n,s)+.05)/(Math.min(n,s)+.05)}const vm=e=>{let t=Number.parseInt(e.slice(1),16);return[(t>>16)/255,(t>>8&255)/255,(t&255)/255]},ps=e=>`#${e.map(t=>Math.round(Math.min(1,Math.max(0,t))*255).toString(16).padStart(2,"0")).join("")}`,Kr=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,Xr=e=>e<=.0031308?12.92*e:1.055*e**.4166666666666667-.055,xu=.00196078431372549,iA=e=>ds(e).every(t=>t>=-xu&&t<=1+xu),lA=.4,km=.012;function uA(e){let t=gt(e),n=Rt(e,$t.onLight),s=gt($t.onDark).lightness,a=1;for(let r=0;r<16;r+=1){let i=(s+a)/2;Rt(fs(t,i),$t.onDark)<n?s=i:a=i}return fs(t,a)}function cA(e,t){let[n,s]=Om[t],a=zt[e];return{onLight:a[t],onDark:n===s?a[n]:$a(a[n],a[s],.5)}}function za(e){switch(e.kind){case"none":return null;case"standard":return cA(e.hue,e.shade);case"rgb":return{onLight:e.hex,onDark:dA(e.hex)}}}function Am(e){switch(e.kind){case"none":return null;case"standard":return vA(e.hue,e.shade);case"rgb":return{onLight:e.hex,onDark:uA(e.hex)}}}function Vi(e,t=AA){let n=kA;for(let s of t){if(e>s.onLight){let a=(n.onLight-e)/(n.onLight-s.onLight);return n.onDark+a*(s.onDark-n.onDark)}n=s}return n.onDark}function Tm(e,t,n){let s=fs(e,t),a=Object.values(zt).map(i=>gt(i[n]).chroma),r=Math.max(e.chroma,...a);return gt(s).chroma<=r?s:ps(ds({...e,lightness:t,chroma:r}))}function dA(e){let t=gt(e),n=Vi(t.lightness,CA);return Tm(t,n,500)}function fA(e,t){let{lightness:n,chroma:s,hue:a}=gt(e),r=gt(t);if(Rt(e,$t.onLight)<Hn||s<km||r.chroma>=s)return t;let i=Vi(n),{lightness:o}=r;for(;o>i&&ja(o,a)<s;)o=Math.max(i,o-Ka);return ps(ds({lightness:o,chroma:Math.min(s,ja(o,a)),hue:a}))}function mA(e,t,n){let s=gt(t);for(let a=Ka;a<=1;a+=Ka)for(let r of[s.lightness+a,s.lightness-a]){if(r<0||r>1)continue;let i=fs(s,r);if(Rt(i,e)>=n)return i}return null}function pA(e,t,n){if(n<1.01)return e;let s=gt(t);for(let{lightness:a}=gt(e);a<=1;a+=Ka){let r=fs(s,a);if(Rt(r,e)>=n)return r}return fs(s,1)}function Eu(e){let t=Su(e,Ya.onLight,Ya.onDark);return Rt(t,e)>=Hn?t:Su(e,"#000000","#ffffff")}function Li(e,t){if(e.kind==="none")return t===null?null:{onLight:Eu(t.onLight),onDark:Eu(t.onDark)};let n=Am(e);if(n===null)return null;let s=t??$t,a=Rt(n.onLight,s.onLight);if(a<Hn)return t===null?n:{onLight:n.onLight,onDark:pA(t.onDark,n.onLight,a)};let r=e.kind==="rgb"?fA(e.hex,n.onDark):n.onDark;return{onLight:n.onLight,onDark:xm(r,s.onDark)}}function hA(e){let t=Ru.get(e);if(t!==void 0)return t;let n=gA(e.fillColor,e.font.color);return Ru.set(e,n),n}function gA(e,t){let[n,s]=[za(e),Am(t)];if(!(n!==null&&s!==null&&ms(s.onLight)>ms(n.onLight)&&Rt(s.onLight,n.onLight)>=Hn))return{fill:n,text:Li(t,n)};let a=yA(e,n.onLight);return{fill:{onLight:n.onLight,onDark:a},text:{onLight:s.onLight,onDark:xm(s.onLight,a)}}}function yA(e,t){if(e.kind==="standard"&&e.shade===600)return zt[e.hue][700];if(e.kind==="standard"&&e.shade===800)return $a(zt[e.hue][700],zt[e.hue][800],.5);let n=gt(t),s=Vi(n.lightness,OA);return Tm(n,s,700)}function wA({fill:e,text:t}){if(e===null||t===null)return!1;let[n,s,a]=vm(e.onLight),r=ps([qr(n),qr(s),qr(a)]);return ms(t.onLight)>ms(e.onLight)&&Rt(t.onLight,r)>=Hn}function $a(e,t,n){let[[s,a,r],[i,o,l]]=[Mu(e),Mu(t)],[u,c]=[Ea(a,o,n),Ea(r,l,n)];return ps(ds({lightness:Ea(s,i,n),chroma:Math.hypot(u,c),hue:Math.atan2(c,u)}))}function IA([e,...t],n){let[s,a]=[e,e];for(let o of t)if([s,a]=[a,o],n<=o.at)break;let r=a.at===s.at?n<s.at?0:1:(n-s.at)/(a.at-s.at),i=Math.round(Math.min(1,Math.max(0,r))*Em);return{from:s.color,to:a.color,step:i}}function bA({from:e,to:t,step:n},s){let a=[e,t,s].map(Xo).join("|")+`|${n}`,r=Nu.get(a);if(r!==void 0)return r;let[i,o]=[za(e)??$t,za(t)??$t],l=n/Em,u={onLight:$a(i.onLight,o.onLight,l),onDark:$a(i.onDark,o.onDark,l)},c={fill:u,text:Li(s,u)};return Nu.set(a,c),c}const zt={gray:{100:"#e0e0e0",200:"#c2c2c2",300:"#a4a4a4",400:"#878787",500:"#6b6b6b",600:"#515151",700:"#383838",800:"#202020"},red:{100:"#fad6d6",200:"#f4abab",300:"#ec7e7e",400:"#e34948",500:"#b93535",600:"#8e2626",700:"#641919",800:"#3c0e0e"},orange:{100:"#f7d8cb",200:"#f4ae94",300:"#ec835a",400:"#d95926",500:"#ae461c",600:"#863311",700:"#5d230b",800:"#371407"},yellow:{100:"#f9dca4",200:"#fab219",300:"#db9300",400:"#b77700",500:"#945d00",600:"#734500",700:"#512e00",800:"#311a00"},green:{100:"#caeac7",200:"#91d68b",300:"#55bf50",400:"#0ca30c",500:"#008300",600:"#006300",700:"#074506",800:"#11260f"},teal:{100:"#bfebdb",200:"#7ad7b4",300:"#3bbd8c",400:"#199e70",500:"#0f7e5c",600:"#065f49",700:"#034235",800:"#022720"},blue:{100:"#cde2fb",200:"#9ec5f4",300:"#6da7ec",400:"#3987e5",500:"#256abf",600:"#184f95",700:"#0d366b",800:"#032042"},purple:{100:"#dfdbfd",200:"#bfb9f5",300:"#a096eb",400:"#8173e3",500:"#6250d6",600:"#4a3aa7",700:"#322777",800:"#1d1649"},magenta:{100:"#f9d4e2",200:"#f3a8c3",300:"#e87ba4",400:"#d55181",500:"#ad3d66",600:"#862a4c",700:"#5e1c34",800:"#390f1f"}},$t={onLight:"#ffffff",onDark:"#1a1a19"},Ya={onLight:"#0b0b0b",onDark:"#f0efec"},Cm={100:800,200:700,300:600,400:500,600:400,800:100},vA=(e,t)=>({onLight:zt[e][t],onDark:zt[e][Cm[t]]}),Om={100:[700,800],200:[700,700],300:[600,700],400:[600,600],600:[500,600],800:[500,500]},Hn=4.5,Ka=.005,ht=e=>gt(zt.gray[e]).lightness,kA={onLight:1,onDark:gt($t.onDark).lightness},AA=[...[100,200,300,400,600,800].map(e=>({onLight:ht(e),onDark:ht(Cm[e])})),{onLight:0,onDark:1}],TA="#252525",CA=[{onLight:gt(oA.hex).lightness,onDark:gt(TA).lightness},...[100,200,300,400,600,800].map(e=>{let[t,n]=Om[e];return{onLight:ht(e),onDark:(ht(t)+ht(n))/2}}),{onLight:0,onDark:ht(500)}],OA=[{onLight:ht(300),onDark:(ht(600)+ht(700))/2},{onLight:ht(600),onDark:ht(700)},{onLight:ht(800),onDark:(ht(700)+ht(800))/2},{onLight:0,onDark:(ht(700)+3*ht(800))/4}],xm=(e,t)=>Rt(e,t)>=Hn?e:mA(t,e,Hn)??e,Su=(e,t,n)=>Rt(t,e)>=Rt(n,e)?t:n,xA=(e,t)=>Li(e,za(t)),Ru=new WeakMap,EA=.15,qr=e=>Ea(e,1,EA),Mu=e=>{let{lightness:t,chroma:n,hue:s}=gt(e);return[t,n*Math.cos(s),n*Math.sin(s)]},Ea=(e,t,n)=>e+(t-e)*n,Em=32,Nu=new Map;function SA(e,t){return e.kind==="none"?t.kind==="none"?null:t:t.kind==="none"?e:_u(t.style)>_u(e.style)?t:e}function RA({color:e}){let t=Bu.get(Xo(e));if(t!==void 0)return t;let n=xA(e,rA);return Bu.set(Xo(e),n),n}const MA=["dotted","dashed","thin","medium","double","thick"],_u=e=>MA.indexOf(e),Ts=e=>({width:e,strokeWidth:e,strokes:[0],dashes:null}),Sm={thin:Ts(1),medium:Ts(2),thick:Ts(3),dashed:{...Ts(1),dashes:"4 3"},dotted:{...Ts(1),dashes:"1 2"},double:{width:3,strokeWidth:1,strokes:[-1,1],dashes:null}},NA=e=>Sm[e].width;Math.max(...Object.values(Sm).map(({width:e})=>e));const Bu=new Map;function _A(e){let t=[...e.join("").matchAll(Rm)],n=0;return e.map(s=>{let[a,r]=[n,n+s.length];n=r;let[i,o]=["",a];for(let{0:l,index:u}of t){let c=u+l.length;c<=a||u>=r||(i+=s.slice(o-a,Math.max(u,a)-a)+(u>=a?" ":""),o=Math.min(c,r))}return i+s.slice(o-a)})}function BA(e){return e==="clip"?e:e?"wrap":"overflow"}const Rm=/(?<![ \t])[ \t]*[\r\n][ \t\r\n]*/g,HA=e=>e.replaceAll(Rm," "),PA=({cellControl:e})=>e?.kind==="checkbox",VA=e=>e?.kind==="boolean"?e.value:null;function LA(e){try{return new URL(e)}catch{return null}}function Mm(e){let t=e.trim(),n=FA.test(t),s=n?`https://${t}`:t;if(s.length>qo||!/^https?:\/\/\S+$/i.test(s))return null;let a=LA(s);if(a===null)return null;let{href:r,hostname:i,username:o,password:l}=a;return r.length>qo||o!==""||l!==""||i.endsWith(".")||i.length>DA||n&&!GA.test(i)||`.${i}`.endsWith(".agentusercontent.com")?null:r}function Di(e,t){let{origin:n}=new URL(t),s=t.slice(n.length);if(s.length<=e)return t;let a=Math.floor(e/3);return`${n}${s.slice(0,e-a)}…${s.slice(-a)}`}const qo=2048,DA=253,FA=/^[Ww]{3}\.[!-~]*$/,GA=/^www(?:\.[a-z\d-]+){2,}$/,Fi=240;function UA(e){let t=new Map;for(let s of e)t.set(s,(t.get(s)??0)+1);let n=e.length;for(;n>0;n-=1){let s=e.charAt(n-1);if(JA.includes(s))continue;let[a,r]=[t.get(s)??0,t.get(Hu[s]??"")];if(Hu[s]===void 0||a<=(r??0))break;t.set(s,a-1)}return e.slice(0,n)}function WA(e){if(QA.test(e))return null;let t=Mm(e);if(t===null)return null;let n=e.replace(/^https?:\/\//i,"");if(n.split("/",1)[0]?.includes("@")===!0)return null;let[s=""]=n.split(/[/?#]/),a=s.replace(/:\d*$/,"").replaceAll(/[A-Z]/g,r=>r.toLowerCase());return eT.test(a)&&a===new URL(t).hostname?t:null}function Nm(e){let t=[],n=new Set,[s,a,r]=[0,0,0];for(let{0:i,index:o}of e.matchAll(XA)){if(a===Gi||s===KA)break;if(s+=1,i.length>2*qo)continue;let l=e.charAt(o-1);if(qA.test(l)||ZA.test(l)&&/^www\./i.test(i))continue;let u=UA(i),c=WA(u);c===null||Di(Fi,c)!==c||(o>r&&t.push({text:e.slice(r,o),startsAt:r,url:null,...Zr}),t.push({text:u,startsAt:o,url:c,...Zr}),n.add(c),a+=1,r=o+u.length)}return r<e.length&&t.push({text:e.slice(r),startsAt:r,url:null,...Zr}),a===0?Sa:{parts:t,addresses:[...n]}}function jA(e){let t=Mm(e);return t!==null&&Di(Fi,t)===t?t:null}function zA({paragraphs:e},t){let n=Bm.test(t)?Nm(t).parts:[],s=new Set,a=l=>l===null||!s.has(l)&&s.size===Gi?null:(s.add(l),l),r=e.flatMap(({runs:l},u)=>[...u===0?[]:[{text:`
3
- `,marks:_m,link:null}],...l]),i=[];r.reduce((l,u,c)=>(i[c]=l,l+u.text.length),0);let o=(l,u)=>r.some(({text:c,link:d},f)=>d!==null&&(i[f]??0)<u&&(i[f]??0)+c.length>l);return{parts:r.flatMap(({text:l,marks:u,link:c},d)=>{let[f,m]=[i[d]??0,(i[d]??0)+l.length];if(c!==null||n.length===0){let g=c===null?null:a(jA(c));return[{text:l,startsAt:f,url:g,isLinkOnWords:g!==null,marks:u}]}return n.flatMap(({text:g,startsAt:I,url:b})=>{let[h,y]=[Math.max(f,I),Math.min(m,I+g.length)];if(h>=y)return[];let w=!o(I,I+g.length);return[{text:t.slice(h,y),startsAt:h,url:w?a(b):null,isLinkOnWords:!1,marks:u}]})}),addresses:[...s]}}function $A(e){let t=[];for(let n of e){let s=t.at(-1)?.at(-1);s!==void 0&&n.url!==null&&n.url===s.url&&!n.isLinkOnWords&&!s.isLinkOnWords&&n.startsAt===s.startsAt+s.text.length?t.at(-1)?.push(n):t.push([n])}return t}function YA(e,{cellControl:t},n,s){if(e===null||t.kind==="dropdown"||s!==null)return Sa;let{input:a}=e,r=a.kind==="richText"?Hi(e):null;if(!(a.kind==="text"?a.value===n:r!==null&&r===n)||a.kind!=="richText"&&!Bm.test(n))return Sa;let i=Pu.get(e);if(i?.text===n)return i.links;let o=a.kind==="richText"?zA(a,n):Nm(n);return Pu.set(e,{text:n,links:o}),o}const _m=[],Zr={isLinkOnWords:!1,marks:_m},Gi=10,KA=30,XA=/https?:\/\/[^\s<>"'`。,、;:!?]+|\bwww\.[^\s<>"'`。,、;:!?]+/gi,qA=/[A-Za-z\d@.-]/,ZA=/[/:=?&#%]/,JA=".,;:!?\f\r\uFEFF*_",Hu={")":"(","]":"[","}":"{"},QA=/[\p{C}\\]/u,eT=/^[a-z\d-]+(?:\.[a-z\d-]+)+$/,Sa={parts:[],addresses:[]},Bm=/https?:\/\/|www\./i,Pu=new WeakMap;function tT(e,t,n){let s=Wn(t),a=rT+wm(n),r=e-n.over-n.under-hm;return Math.max(1,Math.floor((r+a)/(s+a)))}const nT=12,Hm=8,sT=4,Pm=16,Vu=4,aT=e=>Math.ceil((Wn(e)+ym-Pm)/2),Lu=(e,t)=>aT(t)+Pm+Vu+(e?Vu+nT+sT:Hm),Vm=4,rT=4,Lm=(e,t,n)=>Lu(t,n)+(e-1)*(Vm+Lu(!1,n));function oT(e,t){let[n,s]=[1,0];for(let[a,r]of e.entries()){let i=s+Vm+r;a===0?s=r:i<=t?s=i:[n,s]=[n+1,r]}return n}function iT(e,t,n){let{cellWidth:s,nameWidths:a,widthOfCount:r,fontSizeInPoints:i,opensList:o}=t,l=a.slice(0,e).map((f,m)=>f+Lm(1,m===0&&o,i)),u=a.length-e,c=u===0?[]:[2*Hm+r(u)],d=s-js-(n?0:1);return oT([...l,...c],d)}function lT({lineCount:e,...t}){for(let n=t.nameWidths.length;n>1;n-=1)if(iT(n,t,e===1)<=e)return n;return 1}const uT=16,cT=(e,t)=>e-js>=Lm(1,!0,t)+uT,Ui=(e,t)=>e.listSheets().find(n=>n.sheetId===t),Du=e=>{let t;const n=new Set,s=(u,c)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const f=t;t=c??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(m=>m(t,f))}},a=()=>t,o={setState:s,getState:a,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u))},l=t=e(s,a,o);return o},dT=(e=>e?Du(e):Du);function fT(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jr={exports:{}},be={};var Fu;function mT(){if(Fu)return be;Fu=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),r=Symbol.for("react.consumer"),i=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),c=Symbol.for("react.lazy"),d=Symbol.for("react.activity"),f=Symbol.iterator;function m(E){return E===null||typeof E!="object"?null:(E=f&&E[f]||E["@@iterator"],typeof E=="function"?E:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},I=Object.assign,b={};function h(E,H,$){this.props=E,this.context=H,this.refs=b,this.updater=$||g}h.prototype.isReactComponent={},h.prototype.setState=function(E,H){if(typeof E!="object"&&typeof E!="function"&&E!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,E,H,"setState")},h.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function y(){}y.prototype=h.prototype;function w(E,H,$){this.props=E,this.context=H,this.refs=b,this.updater=$||g}var A=w.prototype=new y;A.constructor=w,I(A,h.prototype),A.isPureReactComponent=!0;var O=Array.isArray;function v(){}var k={H:null,A:null,T:null,S:null},C=Object.prototype.hasOwnProperty;function x(E,H,$){var B=$.ref;return{$$typeof:e,type:E,key:H,ref:B!==void 0?B:null,props:$}}function R(E,H){return x(E.type,H,E.props)}function M(E){return typeof E=="object"&&E!==null&&E.$$typeof===e}function L(E){var H={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function($){return H[$]})}var N=/\/+/g;function V(E,H){return typeof E=="object"&&E!==null&&E.key!=null?L(""+E.key):H.toString(36)}function _(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(v,v):(E.status="pending",E.then(function(H){E.status==="pending"&&(E.status="fulfilled",E.value=H)},function(H){E.status==="pending"&&(E.status="rejected",E.reason=H)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function P(E,H,$,B,D){var F=typeof E;(F==="undefined"||F==="boolean")&&(E=null);var j=!1;if(E===null)j=!0;else switch(F){case"bigint":case"string":case"number":j=!0;break;case"object":switch(E.$$typeof){case e:case t:j=!0;break;case c:return j=E._init,P(j(E._payload),H,$,B,D)}}if(j)return D=D(E),j=B===""?"."+V(E,0):B,O(D)?($="",j!=null&&($=j.replace(N,"$&/")+"/"),P(D,H,$,"",function(J){return J})):D!=null&&(M(D)&&(D=R(D,$+(D.key==null||E&&E.key===D.key?"":(""+D.key).replace(N,"$&/")+"/")+j)),H.push(D)),1;j=0;var K=B===""?".":B+":";if(O(E))for(var X=0;X<E.length;X++)B=E[X],F=K+V(B,X),j+=P(B,H,$,F,D);else if(X=m(E),typeof X=="function")for(E=X.call(E),X=0;!(B=E.next()).done;)B=B.value,F=K+V(B,X++),j+=P(B,H,$,F,D);else if(F==="object"){if(typeof E.then=="function")return P(_(E),H,$,B,D);throw H=String(E),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return j}function G(E,H,$){if(E==null)return E;var B=[],D=0;return P(E,B,"","",function(F){return H.call($,F,D++)}),B}function U(E){if(E._status===-1){var H=E._result;H=H(),H.then(function($){(E._status===0||E._status===-1)&&(E._status=1,E._result=$)},function($){(E._status===0||E._status===-1)&&(E._status=2,E._result=$)}),E._status===-1&&(E._status=0,E._result=H)}if(E._status===1)return E._result.default;throw E._result}var Y=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof E=="object"&&E!==null&&typeof E.message=="string"?String(E.message):String(E),error:E});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)},W={map:G,forEach:function(E,H,$){G(E,function(){H.apply(this,arguments)},$)},count:function(E){var H=0;return G(E,function(){H++}),H},toArray:function(E){return G(E,function(H){return H})||[]},only:function(E){if(!M(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return be.Activity=d,be.Children=W,be.Component=h,be.Fragment=n,be.Profiler=a,be.PureComponent=w,be.StrictMode=s,be.Suspense=l,be.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=k,be.__COMPILER_RUNTIME={__proto__:null,c:function(E){return k.H.useMemoCache(E)}},be.cache=function(E){return function(){return E.apply(null,arguments)}},be.cacheSignal=function(){return null},be.cloneElement=function(E,H,$){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var B=I({},E.props),D=E.key;if(H!=null)for(F in H.key!==void 0&&(D=""+H.key),H)!C.call(H,F)||F==="key"||F==="__self"||F==="__source"||F==="ref"&&H.ref===void 0||(B[F]=H[F]);var F=arguments.length-2;if(F===1)B.children=$;else if(1<F){for(var j=Array(F),K=0;K<F;K++)j[K]=arguments[K+2];B.children=j}return x(E.type,D,B)},be.createContext=function(E){return E={$$typeof:i,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:r,_context:E},E},be.createElement=function(E,H,$){var B,D={},F=null;if(H!=null)for(B in H.key!==void 0&&(F=""+H.key),H)C.call(H,B)&&B!=="key"&&B!=="__self"&&B!=="__source"&&(D[B]=H[B]);var j=arguments.length-2;if(j===1)D.children=$;else if(1<j){for(var K=Array(j),X=0;X<j;X++)K[X]=arguments[X+2];D.children=K}if(E&&E.defaultProps)for(B in j=E.defaultProps,j)D[B]===void 0&&(D[B]=j[B]);return x(E,F,D)},be.createRef=function(){return{current:null}},be.forwardRef=function(E){return{$$typeof:o,render:E}},be.isValidElement=M,be.lazy=function(E){return{$$typeof:c,_payload:{_status:-1,_result:E},_init:U}},be.memo=function(E,H){return{$$typeof:u,type:E,compare:H===void 0?null:H}},be.startTransition=function(E){var H=k.T,$={};k.T=$;try{var B=E(),D=k.S;D!==null&&D($,B),typeof B=="object"&&B!==null&&typeof B.then=="function"&&B.then(v,Y)}catch(F){Y(F)}finally{H!==null&&$.types!==null&&(H.types=$.types),k.T=H}},be.unstable_useCacheRefresh=function(){return k.H.useCacheRefresh()},be.use=function(E){return k.H.use(E)},be.useActionState=function(E,H,$){return k.H.useActionState(E,H,$)},be.useCallback=function(E,H){return k.H.useCallback(E,H)},be.useContext=function(E){return k.H.useContext(E)},be.useDebugValue=function(){},be.useDeferredValue=function(E,H){return k.H.useDeferredValue(E,H)},be.useEffect=function(E,H){return k.H.useEffect(E,H)},be.useEffectEvent=function(E){return k.H.useEffectEvent(E)},be.useId=function(){return k.H.useId()},be.useImperativeHandle=function(E,H,$){return k.H.useImperativeHandle(E,H,$)},be.useInsertionEffect=function(E,H){return k.H.useInsertionEffect(E,H)},be.useLayoutEffect=function(E,H){return k.H.useLayoutEffect(E,H)},be.useMemo=function(E,H){return k.H.useMemo(E,H)},be.useOptimistic=function(E,H){return k.H.useOptimistic(E,H)},be.useReducer=function(E,H,$){return k.H.useReducer(E,H,$)},be.useRef=function(E){return k.H.useRef(E)},be.useState=function(E){return k.H.useState(E)},be.useSyncExternalStore=function(E,H,$){return k.H.useSyncExternalStore(E,H,$)},be.useTransition=function(){return k.H.useTransition()},be.version="19.2.4",be}var Gu;function yr(){return Gu||(Gu=1,Jr.exports=mT()),Jr.exports}var p=yr(),Ns=fT(p),pT=Cb({__proto__:null,default:Ns},[p]);const hT=e=>e;function gT(e,t=hT){const n=Ns.useSyncExternalStore(e.subscribe,Ns.useCallback(()=>t(e.getState()),[e,t]),Ns.useCallback(()=>t(e.getInitialState()),[e,t]));return Ns.useDebugValue(n),n}const yT=e=>{const t=dT(e),n=s=>gT(t,s);return Object.assign(n,t),n},wT=(e=>yT);wT()(()=>({message:"",serial:0}));const IT="[Artifact comment sent to agent]",bT="[Artifact edit request sent to agent]",vT="[Artifact task finished]",kT="[Open Artifact] ",AT=["quickstart","list","publish","read","open","call","adopt","delete","share"],TT=["get","list","query","set","update","delete","str_replace","batch"],CT=["read","reply","resolve","reopen","wait"],OT=["share","export"],xT={type:"object",properties:{action:{type:"string",enum:AT,description:"What to do: quickstart, list, publish, read, open, call, adopt, delete or share. Omitted: publish."},intent:{type:"string",description:"quickstart: what is being made (design, design-system, slides, whiteboard, document, data, sheets, motion, page, other), or a few words about it."},scope:{type:"string",enum:["types","mine","all"],description:"list: types (the installed types), mine (this session's and this workspace's artifacts; the default) or all (every artifact)."},type:{type:"string",description:"list: only artifacts of this type (an id, or open-artifact://type/<id>). quickstart: the type already chosen (an id), to get its create call and steps without matching."},query:{type:"string",description:"list: only artifacts whose title contains this text."},limit:{type:"integer",description:"list: how many to return (default 50, at most 200)."},cursor:{type:"string",description:"list: the next_cursor of the previous page."},type_url:{type:"string",description:"publish without url: the type to create from (open-artifact://type/<id>, from quickstart). read without url: the type to describe."},title:{type:"string",description:"publish without url: the new artifact's name. quickstart: the name it will have, to find similar ones."},folder:{type:"string",description:"publish without url, or adopt: where the artifact's folder goes (absolute, or relative to the workspace). Default <workspace>/artifacts/<slug>."},url:{type:"string",description:"An artifact: open-artifact://artifact/<id>, as publish returned it."},files:{type:"object",additionalProperties:!0,description:'publish with url: files to write under the artifact root, as {"rel/path": "text"} or {"rel/path": {"content": "...", "encoding": "base64"}}; null deletes.'},if_match:{type:"object",additionalProperties:!0,description:'publish with url: {"rel/path": sha256 | null | "*"}. Write only while the file still has the sha256 you read, does not exist (null), or anyway ("*"). One mismatch writes nothing and returns the current versions.'},check:{type:"boolean",description:"publish with url: run the type's check action after writing; its result comes back as check."},capabilities:{type:"object",additionalProperties:!0,description:'publish, page artifacts only: the runtime capabilities the page may use, as {"db": true, "assets": true, ...}. Omitted: kept; {}: none; otherwise the whole set. With url it may be given without files.'},open:{type:"string",enum:["after_first_write","now","never"],description:"publish without url: after_first_write (the default) opens the page in your app once your first write lands; now opens it at once; never leaves it closed. Where your app cannot show pages by itself the result says so: open view_url in your app's built-in browser, if you have one."},related:{type:"boolean",description:"quickstart: list existing artifacts the recommended type can build on, such as design systems (default true)."},path:{type:"string",description:"read: one file or folder under the root (omitted: the record and the file list)."},paths:{type:"array",items:{type:"string"},description:"read: several files under the root at once."},name:{type:"string",description:"call: the action's name (check, upload, ...; read with url lists them)."},args:{type:"object",additionalProperties:!0,description:"call: the action's arguments. upload: {file: absolute path, name?, group?}."},panel:{type:"string",enum:OT,description:"open: also open the page's Share panel (share), for the person to share it on the network, or its Export tab (export), for them to download a file."},cloud:{type:"string",description:"share: publish the artifact to this cloud remote (its name, as `open-artifact remote list` shows it). It works only on a remote the person set up and let agents publish to (agentMayPublish); otherwise the person publishes it, from the Share panel or with `open-artifact publish <id> --remote <name>`."}}},ET={type:"object",properties:{action:{type:"string",enum:TT,description:"What to do: get, list, query, set, update, delete, str_replace or batch."},url:{type:"string",description:"The artifact (open-artifact://artifact/<id>)."},collection:{type:"string",description:"The collection: alone for list / query (query needs it), with doc_id for one document."},doc_id:{type:"string",description:"With collection: the document to get / set / update / delete / str_replace."},path:{type:"string",description:"collection/doc_id, instead of the two."},data:{type:"object",additionalProperties:!0,description:"set / update: the document's fields."},file_path:{type:"string",description:"set / update: a JSON file holding the fields, instead of data."},if_match:{description:'set / update / delete / str_replace: the sha256 get returned (write only if unchanged), null (only if it does not exist) or "*" (replace whatever is there).'},field:{type:"string",description:"str_replace: the text field, as a dot path (body, notes.text)."},old:{type:"string",description:"str_replace: the passage to replace; it must occur exactly once."},new:{type:"string",description:"str_replace: the passage that replaces it."},where:{type:"array",items:{type:"object",additionalProperties:!0},description:"query: [{field, op, value}], all must hold. op: ==, !=, <, <=, >, >=, in, not-in (up to 30 values), array-contains."},order_by:{type:"object",additionalProperties:!0,description:'query: {field, dir: "asc" | "desc"}.'},limit:{type:"integer",description:"list / query: how many documents (default 100, at most 1000)."},cursor:{type:"string",description:"list / query: the next_cursor of the previous page."},out_file:{type:"string",description:"get / list / query: write the result to this JSON file (absolute, or relative to the workspace) and return only its path and counts."},writes:{type:"array",items:{type:"object",additionalProperties:!0},description:"batch: [{op: set|update|delete|str_replace, path | collection+doc_id, data | file_path, if_match?, field?, old?, new?}], at most 500."}},required:["action","url"]},ST={type:"object",properties:{action:{type:"string",enum:CT,description:"What to do: read, reply, resolve, reopen or wait."},url:{type:"string",description:"The artifact (open-artifact://artifact/<id>). wait: optional."},thread_id:{type:"string",description:'reply / resolve / reopen: the thread (after ";thread=" in the message).'},text:{type:"string",description:"reply: the answer."},resolve:{type:"boolean",description:"reply: resolve the thread too."},all:{type:"boolean",description:"read: resolved threads too."},since:{type:"string",description:"read: only threads with a message at or after this time (ISO 8601)."},acknowledge_duplicate:{type:"boolean",description:"reply: send the same text as your last reply in this thread again, on purpose."},timeout_ms:{type:"number",description:"wait: how long (default 600000)."}},required:["action"]},Uu={Artifact:xT,ArtifactData:ET,ArtifactComments:ST},RT={Artifact:["Make and change artifacts: typed folders of files that open as live pages the person can view, edit, comment on and export. Actions:","- quickstart {intent, type?}: call first for a new artifact; recommends a type (or takes the one given) and returns the call that creates it, the steps for this app and similar artifacts that already exist.",'- list {scope: "mine" | "all" | "types", type?, query?}: find existing artifacts, or the installed types.',"- publish {type_url, title, folder?, open?}: create an artifact; the result carries its root folder and the type's instructions. publish {url, files, if_match?, check?}: write files when you have no file tools of your own. A page artifact also takes capabilities (on create or write): the runtime capabilities its page may use.","- read {url, path? | paths?}: the artifact's record, files and actions, or some of its files with their sha256. read {type_url}: a type's instructions, before creating.",`- open {url, panel?}: show it to the person in the computer's browser (or the app, when it shows pages), once its content is written. When your app has a built-in browser, open view_url there instead. panel "share" or "export" opens its Share panel or Export tab for them.`,"- call {url, name, args?}: run one of the type's actions (check, upload, ...). A long one answers {task, pending: true}; its result comes later as a message.","- adopt {url | folder}: take over an artifact, or add an existing folder. Only when the person asks.","- share {url}: whether it is shared on the local network, and its links. Only the person changes that, in the page's Share panel.","- delete {url}: forget an artifact; its folder stays. Only when the person asks."].join(`
3
+ `,marks:_m,link:null}],...l]),i=[];r.reduce((l,u,c)=>(i[c]=l,l+u.text.length),0);let o=(l,u)=>r.some(({text:c,link:d},f)=>d!==null&&(i[f]??0)<u&&(i[f]??0)+c.length>l);return{parts:r.flatMap(({text:l,marks:u,link:c},d)=>{let[f,m]=[i[d]??0,(i[d]??0)+l.length];if(c!==null||n.length===0){let g=c===null?null:a(jA(c));return[{text:l,startsAt:f,url:g,isLinkOnWords:g!==null,marks:u}]}return n.flatMap(({text:g,startsAt:I,url:b})=>{let[h,y]=[Math.max(f,I),Math.min(m,I+g.length)];if(h>=y)return[];let w=!o(I,I+g.length);return[{text:t.slice(h,y),startsAt:h,url:w?a(b):null,isLinkOnWords:!1,marks:u}]})}),addresses:[...s]}}function $A(e){let t=[];for(let n of e){let s=t.at(-1)?.at(-1);s!==void 0&&n.url!==null&&n.url===s.url&&!n.isLinkOnWords&&!s.isLinkOnWords&&n.startsAt===s.startsAt+s.text.length?t.at(-1)?.push(n):t.push([n])}return t}function YA(e,{cellControl:t},n,s){if(e===null||t.kind==="dropdown"||s!==null)return Sa;let{input:a}=e,r=a.kind==="richText"?Hi(e):null;if(!(a.kind==="text"?a.value===n:r!==null&&r===n)||a.kind!=="richText"&&!Bm.test(n))return Sa;let i=Pu.get(e);if(i?.text===n)return i.links;let o=a.kind==="richText"?zA(a,n):Nm(n);return Pu.set(e,{text:n,links:o}),o}const _m=[],Zr={isLinkOnWords:!1,marks:_m},Gi=10,KA=30,XA=/https?:\/\/[^\s<>"'`。,、;:!?]+|\bwww\.[^\s<>"'`。,、;:!?]+/gi,qA=/[A-Za-z\d@.-]/,ZA=/[/:=?&#%]/,JA=".,;:!?\f\r\uFEFF*_",Hu={")":"(","]":"[","}":"{"},QA=/[\p{C}\\]/u,eT=/^[a-z\d-]+(?:\.[a-z\d-]+)+$/,Sa={parts:[],addresses:[]},Bm=/https?:\/\/|www\./i,Pu=new WeakMap;function tT(e,t,n){let s=Wn(t),a=rT+wm(n),r=e-n.over-n.under-hm;return Math.max(1,Math.floor((r+a)/(s+a)))}const nT=12,Hm=8,sT=4,Pm=16,Vu=4,aT=e=>Math.ceil((Wn(e)+ym-Pm)/2),Lu=(e,t)=>aT(t)+Pm+Vu+(e?Vu+nT+sT:Hm),Vm=4,rT=4,Lm=(e,t,n)=>Lu(t,n)+(e-1)*(Vm+Lu(!1,n));function oT(e,t){let[n,s]=[1,0];for(let[a,r]of e.entries()){let i=s+Vm+r;a===0?s=r:i<=t?s=i:[n,s]=[n+1,r]}return n}function iT(e,t,n){let{cellWidth:s,nameWidths:a,widthOfCount:r,fontSizeInPoints:i,opensList:o}=t,l=a.slice(0,e).map((f,m)=>f+Lm(1,m===0&&o,i)),u=a.length-e,c=u===0?[]:[2*Hm+r(u)],d=s-js-(n?0:1);return oT([...l,...c],d)}function lT({lineCount:e,...t}){for(let n=t.nameWidths.length;n>1;n-=1)if(iT(n,t,e===1)<=e)return n;return 1}const uT=16,cT=(e,t)=>e-js>=Lm(1,!0,t)+uT,Ui=(e,t)=>e.listSheets().find(n=>n.sheetId===t),Du=e=>{let t;const n=new Set,s=(u,c)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const f=t;t=c??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(m=>m(t,f))}},a=()=>t,o={setState:s,getState:a,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u))},l=t=e(s,a,o);return o},dT=(e=>e?Du(e):Du);function fT(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jr={exports:{}},be={};var Fu;function mT(){if(Fu)return be;Fu=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),r=Symbol.for("react.consumer"),i=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),c=Symbol.for("react.lazy"),d=Symbol.for("react.activity"),f=Symbol.iterator;function m(E){return E===null||typeof E!="object"?null:(E=f&&E[f]||E["@@iterator"],typeof E=="function"?E:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},I=Object.assign,b={};function h(E,H,$){this.props=E,this.context=H,this.refs=b,this.updater=$||g}h.prototype.isReactComponent={},h.prototype.setState=function(E,H){if(typeof E!="object"&&typeof E!="function"&&E!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,E,H,"setState")},h.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function y(){}y.prototype=h.prototype;function w(E,H,$){this.props=E,this.context=H,this.refs=b,this.updater=$||g}var A=w.prototype=new y;A.constructor=w,I(A,h.prototype),A.isPureReactComponent=!0;var O=Array.isArray;function v(){}var k={H:null,A:null,T:null,S:null},C=Object.prototype.hasOwnProperty;function x(E,H,$){var B=$.ref;return{$$typeof:e,type:E,key:H,ref:B!==void 0?B:null,props:$}}function R(E,H){return x(E.type,H,E.props)}function M(E){return typeof E=="object"&&E!==null&&E.$$typeof===e}function L(E){var H={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function($){return H[$]})}var N=/\/+/g;function V(E,H){return typeof E=="object"&&E!==null&&E.key!=null?L(""+E.key):H.toString(36)}function _(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(v,v):(E.status="pending",E.then(function(H){E.status==="pending"&&(E.status="fulfilled",E.value=H)},function(H){E.status==="pending"&&(E.status="rejected",E.reason=H)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function P(E,H,$,B,D){var F=typeof E;(F==="undefined"||F==="boolean")&&(E=null);var j=!1;if(E===null)j=!0;else switch(F){case"bigint":case"string":case"number":j=!0;break;case"object":switch(E.$$typeof){case e:case t:j=!0;break;case c:return j=E._init,P(j(E._payload),H,$,B,D)}}if(j)return D=D(E),j=B===""?"."+V(E,0):B,O(D)?($="",j!=null&&($=j.replace(N,"$&/")+"/"),P(D,H,$,"",function(J){return J})):D!=null&&(M(D)&&(D=R(D,$+(D.key==null||E&&E.key===D.key?"":(""+D.key).replace(N,"$&/")+"/")+j)),H.push(D)),1;j=0;var K=B===""?".":B+":";if(O(E))for(var X=0;X<E.length;X++)B=E[X],F=K+V(B,X),j+=P(B,H,$,F,D);else if(X=m(E),typeof X=="function")for(E=X.call(E),X=0;!(B=E.next()).done;)B=B.value,F=K+V(B,X++),j+=P(B,H,$,F,D);else if(F==="object"){if(typeof E.then=="function")return P(_(E),H,$,B,D);throw H=String(E),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return j}function G(E,H,$){if(E==null)return E;var B=[],D=0;return P(E,B,"","",function(F){return H.call($,F,D++)}),B}function U(E){if(E._status===-1){var H=E._result;H=H(),H.then(function($){(E._status===0||E._status===-1)&&(E._status=1,E._result=$)},function($){(E._status===0||E._status===-1)&&(E._status=2,E._result=$)}),E._status===-1&&(E._status=0,E._result=H)}if(E._status===1)return E._result.default;throw E._result}var Y=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof E=="object"&&E!==null&&typeof E.message=="string"?String(E.message):String(E),error:E});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)},W={map:G,forEach:function(E,H,$){G(E,function(){H.apply(this,arguments)},$)},count:function(E){var H=0;return G(E,function(){H++}),H},toArray:function(E){return G(E,function(H){return H})||[]},only:function(E){if(!M(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return be.Activity=d,be.Children=W,be.Component=h,be.Fragment=n,be.Profiler=a,be.PureComponent=w,be.StrictMode=s,be.Suspense=l,be.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=k,be.__COMPILER_RUNTIME={__proto__:null,c:function(E){return k.H.useMemoCache(E)}},be.cache=function(E){return function(){return E.apply(null,arguments)}},be.cacheSignal=function(){return null},be.cloneElement=function(E,H,$){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var B=I({},E.props),D=E.key;if(H!=null)for(F in H.key!==void 0&&(D=""+H.key),H)!C.call(H,F)||F==="key"||F==="__self"||F==="__source"||F==="ref"&&H.ref===void 0||(B[F]=H[F]);var F=arguments.length-2;if(F===1)B.children=$;else if(1<F){for(var j=Array(F),K=0;K<F;K++)j[K]=arguments[K+2];B.children=j}return x(E.type,D,B)},be.createContext=function(E){return E={$$typeof:i,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:r,_context:E},E},be.createElement=function(E,H,$){var B,D={},F=null;if(H!=null)for(B in H.key!==void 0&&(F=""+H.key),H)C.call(H,B)&&B!=="key"&&B!=="__self"&&B!=="__source"&&(D[B]=H[B]);var j=arguments.length-2;if(j===1)D.children=$;else if(1<j){for(var K=Array(j),X=0;X<j;X++)K[X]=arguments[X+2];D.children=K}if(E&&E.defaultProps)for(B in j=E.defaultProps,j)D[B]===void 0&&(D[B]=j[B]);return x(E,F,D)},be.createRef=function(){return{current:null}},be.forwardRef=function(E){return{$$typeof:o,render:E}},be.isValidElement=M,be.lazy=function(E){return{$$typeof:c,_payload:{_status:-1,_result:E},_init:U}},be.memo=function(E,H){return{$$typeof:u,type:E,compare:H===void 0?null:H}},be.startTransition=function(E){var H=k.T,$={};k.T=$;try{var B=E(),D=k.S;D!==null&&D($,B),typeof B=="object"&&B!==null&&typeof B.then=="function"&&B.then(v,Y)}catch(F){Y(F)}finally{H!==null&&$.types!==null&&(H.types=$.types),k.T=H}},be.unstable_useCacheRefresh=function(){return k.H.useCacheRefresh()},be.use=function(E){return k.H.use(E)},be.useActionState=function(E,H,$){return k.H.useActionState(E,H,$)},be.useCallback=function(E,H){return k.H.useCallback(E,H)},be.useContext=function(E){return k.H.useContext(E)},be.useDebugValue=function(){},be.useDeferredValue=function(E,H){return k.H.useDeferredValue(E,H)},be.useEffect=function(E,H){return k.H.useEffect(E,H)},be.useEffectEvent=function(E){return k.H.useEffectEvent(E)},be.useId=function(){return k.H.useId()},be.useImperativeHandle=function(E,H,$){return k.H.useImperativeHandle(E,H,$)},be.useInsertionEffect=function(E,H){return k.H.useInsertionEffect(E,H)},be.useLayoutEffect=function(E,H){return k.H.useLayoutEffect(E,H)},be.useMemo=function(E,H){return k.H.useMemo(E,H)},be.useOptimistic=function(E,H){return k.H.useOptimistic(E,H)},be.useReducer=function(E,H,$){return k.H.useReducer(E,H,$)},be.useRef=function(E){return k.H.useRef(E)},be.useState=function(E){return k.H.useState(E)},be.useSyncExternalStore=function(E,H,$){return k.H.useSyncExternalStore(E,H,$)},be.useTransition=function(){return k.H.useTransition()},be.version="19.2.4",be}var Gu;function yr(){return Gu||(Gu=1,Jr.exports=mT()),Jr.exports}var p=yr(),Ns=fT(p),pT=Cb({__proto__:null,default:Ns},[p]);const hT=e=>e;function gT(e,t=hT){const n=Ns.useSyncExternalStore(e.subscribe,Ns.useCallback(()=>t(e.getState()),[e,t]),Ns.useCallback(()=>t(e.getInitialState()),[e,t]));return Ns.useDebugValue(n),n}const yT=e=>{const t=dT(e),n=s=>gT(t,s);return Object.assign(n,t),n},wT=(e=>yT);wT()(()=>({message:"",serial:0}));const IT="[Artifact comment sent to agent]",bT="[Artifact edit request sent to agent]",vT="[Artifact task finished]",kT="[Open Artifact] ",AT=["quickstart","list","publish","read","open","call","adopt","delete","share"],TT=["get","list","query","set","update","delete","str_replace","batch"],CT=["read","reply","resolve","reopen","wait"],OT=["share","export"],xT={type:"object",properties:{action:{type:"string",enum:AT,description:"What to do: quickstart, list, publish, read, open, call, adopt, delete or share. Omitted: publish."},intent:{type:"string",description:"quickstart: what is being made (design, design-system, slides, whiteboard, document, data, sheets, motion, page, other), or a few words about it."},scope:{type:"string",enum:["types","mine","all"],description:"list: types (the installed types), mine (this session's and this project's artifacts; the default) or all (every artifact)."},type:{type:"string",description:"list: only artifacts of this type (an id, or open-artifact://type/<id>). quickstart: the type already chosen (an id), to get its create call and steps without matching."},query:{type:"string",description:"list: only artifacts whose title contains this text."},limit:{type:"integer",description:"list: how many to return (default 50, at most 200)."},cursor:{type:"string",description:"list: the next_cursor of the previous page."},type_url:{type:"string",description:"publish without url: the type to create from (open-artifact://type/<id>, from quickstart). read without url: the type to describe."},title:{type:"string",description:"publish without url: the new artifact's name. quickstart: the name it will have, to find similar ones."},folder:{type:"string",description:"publish without url: the exact folder for the new artifact (absolute, or relative to the workspace), only when the person named one. Omitted: Open Artifact chooses the folder and its name. adopt: the folder to add."},location:{type:"string",enum:["home","workspace"],description:"publish without url: where the new artifact's folder goes when the person asked: workspace (in the project, under the working folder) or home (the person's Open Artifact folder). Omitted: what the person's settings say. The folder is named from the title either way."},url:{type:"string",description:"An artifact: open-artifact://artifact/<id>, as publish returned it."},files:{type:"object",additionalProperties:!0,description:'publish with url: files to write under the artifact root, as {"rel/path": "text"} or {"rel/path": {"content": "...", "encoding": "base64"}}; null deletes.'},if_match:{type:"object",additionalProperties:!0,description:'publish with url: {"rel/path": sha256 | null | "*"}. Write only while the file still has the sha256 you read, does not exist (null), or anyway ("*"). One mismatch writes nothing and returns the current versions.'},check:{type:"boolean",description:"publish with url: run the type's check action after writing; its result comes back as check."},capabilities:{type:"object",additionalProperties:!0,description:'publish, page artifacts only: the runtime capabilities the page may use, as {"db": true, "assets": true, ...}. Omitted: kept; {}: none; otherwise the whole set. With url it may be given without files.'},open:{type:"string",enum:["after_first_write","now","never"],description:"publish without url: after_first_write (the default) opens the page in your app once your first write lands; now opens it at once; never leaves it closed. Where your app cannot show pages by itself the result says so: open view_url in your app's built-in browser, if you have one."},related:{type:"boolean",description:"quickstart: list existing artifacts the recommended type can build on, such as design systems (default true)."},path:{type:"string",description:"read: one file or folder under the root (omitted: the record and the file list)."},paths:{type:"array",items:{type:"string"},description:"read: several files under the root at once."},name:{type:"string",description:"call: the action's name (check, upload, ...; read with url lists them)."},args:{type:"object",additionalProperties:!0,description:"call: the action's arguments. upload: {file: absolute path, name?, group?}."},panel:{type:"string",enum:OT,description:"open: also open the page's Share panel (share), for the person to share it on the network, or its Export tab (export), for them to download a file."},cloud:{type:"string",description:"share: publish the artifact to this cloud remote (its name, as `open-artifact remote list` shows it). It works only on a remote the person set up and let agents publish to (agentMayPublish); otherwise the person publishes it, from the Share panel or with `open-artifact publish <id> --remote <name>`."}}},ET={type:"object",properties:{action:{type:"string",enum:TT,description:"What to do: get, list, query, set, update, delete, str_replace or batch."},url:{type:"string",description:"The artifact (open-artifact://artifact/<id>)."},collection:{type:"string",description:"The collection: alone for list / query (query needs it), with doc_id for one document."},doc_id:{type:"string",description:"With collection: the document to get / set / update / delete / str_replace."},path:{type:"string",description:"collection/doc_id, instead of the two."},data:{type:"object",additionalProperties:!0,description:"set / update: the document's fields."},file_path:{type:"string",description:"set / update: a JSON file holding the fields, instead of data."},if_match:{description:'set / update / delete / str_replace: the sha256 get returned (write only if unchanged), null (only if it does not exist) or "*" (replace whatever is there).'},field:{type:"string",description:"str_replace: the text field, as a dot path (body, notes.text)."},old:{type:"string",description:"str_replace: the passage to replace; it must occur exactly once."},new:{type:"string",description:"str_replace: the passage that replaces it."},where:{type:"array",items:{type:"object",additionalProperties:!0},description:"query: [{field, op, value}], all must hold. op: ==, !=, <, <=, >, >=, in, not-in (up to 30 values), array-contains."},order_by:{type:"object",additionalProperties:!0,description:'query: {field, dir: "asc" | "desc"}.'},limit:{type:"integer",description:"list / query: how many documents (default 100, at most 1000)."},cursor:{type:"string",description:"list / query: the next_cursor of the previous page."},out_file:{type:"string",description:"get / list / query: write the result to this JSON file (absolute, or relative to the workspace) and return only its path and counts."},writes:{type:"array",items:{type:"object",additionalProperties:!0},description:"batch: [{op: set|update|delete|str_replace, path | collection+doc_id, data | file_path, if_match?, field?, old?, new?}], at most 500."}},required:["action","url"]},ST={type:"object",properties:{action:{type:"string",enum:CT,description:"What to do: read, reply, resolve, reopen or wait."},url:{type:"string",description:"The artifact (open-artifact://artifact/<id>). wait: optional."},thread_id:{type:"string",description:'reply / resolve / reopen: the thread (after ";thread=" in the message).'},text:{type:"string",description:"reply: the answer."},resolve:{type:"boolean",description:"reply: resolve the thread too."},all:{type:"boolean",description:"read: resolved threads too."},since:{type:"string",description:"read: only threads with a message at or after this time (ISO 8601)."},acknowledge_duplicate:{type:"boolean",description:"reply: send the same text as your last reply in this thread again, on purpose."},timeout_ms:{type:"number",description:"wait: how long (default 600000)."}},required:["action"]},Uu={Artifact:xT,ArtifactData:ET,ArtifactComments:ST},RT={Artifact:["Make and change artifacts: typed folders of files that open as live pages the person can view, edit, comment on and export. Actions:","- quickstart {intent, type?}: call first for a new artifact; recommends a type (or takes the one given) and returns the call that creates it, the steps for this app and similar artifacts that already exist.",'- list {scope: "mine" | "all" | "types", type?, query?}: find existing artifacts, or the installed types.',"- publish {type_url, title, folder?, open?}: create an artifact; the result carries its root folder and the type's instructions. publish {url, files, if_match?, check?}: write files when you have no file tools of your own. A page artifact also takes capabilities (on create or write): the runtime capabilities its page may use.","- read {url, path? | paths?}: the artifact's record, files and actions, or some of its files with their sha256. read {type_url}: a type's instructions, before creating.",`- open {url, panel?}: show it to the person in the computer's browser (or the app, when it shows pages), once its content is written. When your app has a built-in browser, open view_url there instead. panel "share" or "export" opens its Share panel or Export tab for them.`,"- call {url, name, args?}: run one of the type's actions (check, upload, ...). A long one answers {task, pending: true}; its result comes later as a message.","- adopt {url | folder}: take over an artifact, or add an existing folder. Only when the person asks.","- share {url}: whether it is shared on the local network, and its links. Only the person changes that, in the page's Share panel.","- delete {url}: forget an artifact; its folder stays. Only when the person asks."].join(`
4
4
  `),ArtifactData:'Read and write the document store of an artifact whose type keeps one (its instructions say so). get, list and query read documents with their sha256; set, update, delete, str_replace and batch write them. update merges fields, and {"__delete__": true} removes one; str_replace changes one passage of a long text field. Replacing or deleting an existing document needs if_match: the sha256 you read, or "*". Your writes show live on open pages.',ArtifactComments:`Comments the person leaves on their artifact's page, kept in the artifact's own folder on this computer (no outside service). read lists the threads; reply answers one (thread_id is after ";thread=" in the message), with resolve: true when it is done; resolve and reopen change a thread's state. A thread sent to you is the person asking for your answer in it, so replying there is what they asked for. Answer only threads sent to you, in one or two lines. wait blocks until the next message for this session: use it only when nothing else can wake you.`},Wu={Artifact:{title:"Artifact",openWorldHint:!1},ArtifactData:{title:"Artifact data",openWorldHint:!1},ArtifactComments:{title:"Artifact comments",destructiveHint:!1,openWorldHint:!1}},MT={Artifact:{quickstart:"read",list:"read",read:"read",publish:"write",call:"write",open:"ui",delete:"remove",adopt:"remove",share:"person"},ArtifactData:{get:"read",list:"read",query:"read",set:"write",update:"write",str_replace:"write",batch:"write",delete:"write"},ArtifactComments:{read:"read",wait:"read",reply:"write",resolve:"write",reopen:"write"}},NT={Artifact:["publish","open","call","share"],ArtifactData:["get","list","query","set","update","str_replace","batch","delete"],ArtifactComments:["read","reply","resolve","reopen"]};function _T(e={any:!1,actions:!1}){return Object.keys(Uu).map(t=>{const n=t==="Artifact"?e.any:e.actions;return{name:t,description:RT[t],inputSchema:Uu[t],annotations:n?{...Wu[t],openWorldHint:!0}:Wu[t],actions:MT[t],remoteActions:[...NT[t]]}})}_T();const BT=300,HT=12,ju=["Artifact","ArtifactData","ArtifactComments"];function dn(e,t=BT){const n=String(e??"").replace(/[<>]/g,"").replace(/\s+/g," ").trim();return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function PT(e){const t=dn(e,Number.MAX_SAFE_INTEGER),n=t.search(/[.!?。!?](\s|$)/);return n>=0?t.slice(0,n+1):t}function VT(e){const t=dn(e,24);return/^[a-z0-9]{1,5}$/i.test(t)?t.toUpperCase():t}const zu=e=>!e||/[.!?。!?…]$/.test(e)?e:`${e}.`;function LT(e,t=!1){const n=dn(e.title,80)||e.id;if(t)return`- ${e.id}: ${n}`;const s=dn(e.when)||dn(PT(e.description)),a=(e.exports??[]).map(VT).filter(Boolean),r=[zu(n),zu(s),a.length?`Exports: ${a.join(", ")}.`:""].filter(Boolean);return`- ${e.id}: ${r.join(" ")}`}const DT="Open Artifact lets you make artifacts: typed folders of files (a slide deck, a design canvas, a whiteboard, a data dashboard, a spreadsheet, a doc, an animated motion piece, a free HTML page and more) that open as live pages the person can view, edit, comment on and export. You make and change them with the Artifact, ArtifactData and ArtifactComments tools.",FT=`<where_output_goes>
5
5
  Decide where your output will live before you make anything.
6
6
  - Something the person will read once and move on from (an answer, an explanation, a summary, a short report) goes in your reply, however long it is. A diagram or chart that explains your answer goes in the reply too, when you can show one there.
@@ -4,7 +4,7 @@
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
6
6
  <title>Sheets</title>
7
- <script type="module" crossorigin src="./assets/index-B6FKM2kq.js"></script>
7
+ <script type="module" crossorigin src="./assets/index-C3CIL5GM.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="./assets/index-Blx6UTde.css">
9
9
  </head>
10
10
  <body>