@docx-editor.dev/editor-api 2.24.0 → 2.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.mjs CHANGED
@@ -1 +1 @@
1
- import {createBrowserAutomationHost}from'@docx-editor.dev/core/editor';import {createServerAutomationHost,createAutomationPaginationProvider}from'@docx-editor.dev/core/automation';var le=Object.freeze({PropertyNotLoaded:"the property has not been loaded. Call load(...) and await context.sync() before reading it.",ValueNotLoaded:"the result has not been filled in yet. Await context.sync() before reading it.",InvalidObjectPath:"the object cannot be addressed. Await context.sync() after creating an object with an edit. Keep proxies within their run, or use context.trackedObjects.add(...) before the run ends.",ObjectInUse:"the object still belongs to a run that has not finished. Await that run before passing the object to another one.",InvalidArgument:"the argument is not one this API accepts.",ResourceLimitExceeded:"the document exceeds a supported resource limit.",ItemNotFound:"the collection has no such item.",NotSupported:"the operation or argument is outside this document or host\u2019s supported capabilities.",NotImplemented:"this version does not implement that yet.",ConflictingChanges:"these operations cannot share one atomic batch. Split them across separate context.sync() calls.",InvalidRequestContext:"the request context has finished. Start another run to continue.",RuntimeDisposed:"the runtime has been disposed.",StaleDocument:"the document changed after this context read it, so nothing was applied.",DocumentUnavailable:"the document is not available right now.",GeneralException:"the document could not complete the request."}),C=class extends Error{code;limit;target;expectedRevision;actualRevision;constructor(t){let e=t.target?`${le[t.code]} (${t.target})`:le[t.code];super(e),this.name="DocxEditorError",this.code=t.code,t.limit!==void 0&&(this.limit=t.limit),t.target!==void 0&&(this.target=t.target),t.expectedRevision!==void 0&&(this.expectedRevision=t.expectedRevision),t.actualRevision!==void 0&&(this.actualRevision=t.actualRevision);}};function je(o){return o instanceof C?true:typeof o=="object"&&o!==null&&o.name==="DocxEditorError"&&typeof o.code=="string"}function a(o){throw new C(o)}var Y=Symbol("docx-editor.runtime.internals"),St=Symbol("docx-editor.runtime.release"),jt=Symbol("docx-editor.runtime.rebind");function J(o){return o[Y]}var Te=new Set(["select","expand","top","skip"]),Ee=/^[A-Za-z][A-Za-z0-9]*$/;function ce(o,t){if(o===void 0)return [];let e=typeof o=="string"?o.split(",").map(r=>r.trim()):Array.isArray(o)?o.map(r=>typeof r=="string"?r.trim():r):a({code:"InvalidArgument",target:t}),n=[];for(let r of e)(typeof r!="string"||!Ee.test(r))&&a({code:"InvalidArgument",target:t}),n.includes(r)||n.push(r);return n.length===0&&a({code:"InvalidArgument",target:t}),n}function he(o,t){return (typeof o!="number"||!Number.isInteger(o)||o<0)&&a({code:"InvalidArgument",target:t}),o}function Ne(o,t){o===void 0||Array.isArray(o)&&o.length===0||a({code:"InvalidArgument",target:t});}function pe(o,t){if(o===void 0)return {select:[]};if(typeof o=="string"||Array.isArray(o))return {select:ce(o,t)};(typeof o!="object"||o===null)&&a({code:"InvalidArgument",target:t});let e=o;for(let n of Object.keys(e))Te.has(n)||a({code:"InvalidArgument",target:`${t}.${n}`});return Ne(e.expand,`${t}.expand`),{select:ce(e.select,`${t}.select`),...e.top===void 0?{}:{top:he(e.top,`${t}.top`)},...e.skip===void 0?{}:{skip:he(e.skip,`${t}.skip`)}}}var $=class{#t;#n;#e;#o;#i=new Map;#s=false;constructor(t,e,n={}){this.#t=t,this.#n=t[Y],this.#e=e,this.#o=n.nullable===true,this.#n.register(this);}get context(){return this.#t}get isNullObject(){return this.#e.isReleased&&a({code:"InvalidObjectPath",target:this.#e.label}),this.#o?(this.#e.isPending&&a({code:"PropertyNotLoaded",target:`${this.#e.label}.isNullObject`}),this.#e.isNull):false}load(t){this.#s=true;try{return this.requireUsablePath(),this.onLoad(pe(t,this.#e.label)),this}finally{this.#s=false;}}get path(){return this.#e}get internals(){return this.#n}handle(){return this.#e.handle()}requireAddressable(){this.#e.isAddressable||a({code:"InvalidObjectPath",target:this.#e.label}),this.#n.assertUsable(this.#e.label);}requireUsablePath(){(this.#e.isReleased||this.#e.isNull&&!(this.#s&&this.#o))&&a({code:"InvalidObjectPath",target:this.#e.label}),this.#n.assertUsable(this.#e.label);}enqueue(t){this.requireUsablePath(),this.#n.queue.push({...t,dependencies:[...t.dependencies??[],this.#e],...this.#s&&this.#o&&t.sort==="read"?{nullableLoad:this.#e}:{}});}loadedProperty(t){return this.#e.isReleased&&!this.#i.has(t)&&a({code:"InvalidObjectPath",target:this.#e.label}),this.#i.has(t)||a({code:"PropertyNotLoaded",target:`${this.#e.label}.${t}`}),this.#i.get(t)}hasLoadedProperty(t){return this.#i.has(t)}setLoadedProperty(t,e){this.#i.set(t,e);}[St](){this.#e.release();}[jt](t){this.#t=t,this.#n=t[Y];}};var Tt=class o{#t=false;#n;#e;constructor(t){this.#e=t;}get value(){return this.#t||a({code:"ValueNotLoaded",target:this.#e}),this.#n}get isLoaded(){return this.#t}static create(t){let e=new o(t);return {result:e,fill(n){e.#t=true,e.#n=n;}}}};function ue(o){return Tt.create(o)}function S(o){return new C({code:"GeneralException",target:o})}function P(o,t){if(o.kind!=="text")throw S(t);return o.text}function u(o,t){if(o.kind!=="handle")throw S(t);return o.handle}function A(o,t){if(o.kind!=="handles")throw S(t);return o.handles}function R(o,t){if(o.kind!=="span")throw S(t);return o.span}function Et(o,t){if(o.kind!=="spans")throw S(t);return o.spans}function Wt(o,t){if(o.kind!=="font")throw S(t);return o.font}function Ut(o,t){if(o.kind!=="paragraphFormat")throw S(t);return o.format}function xt(o,t){if(o.kind!=="style")throw S(t);return o.name}function Nt(o,t){if(o.kind!=="number")throw S(t);return o.value}function _(o,t){if(o.kind!=="flag")throw S(t);return o.value}function Gt(o,t){if(o.kind!=="pageSetup")throw S(t);return o.setup}function m(o,t){if(o.kind!=="applied")throw S(t)}var c=class o{label;#t;#n;constructor(t,e,n=null){this.label=t,this.#t=e,this.#n=n;}static of(t,e){return new o(t,{status:"resolved",address:{kind:"handle",handle:e}})}static ofSpan(t,e){return new o(t,{status:"resolved",address:{kind:"span",span:e}})}static pending(t){return new o(t,{status:"pending"})}static derived(t,e){return new o(t,{status:"pending"},e)}get state(){return this.#n?this.#n.state:this.#t}get isAddressable(){return this.state.status==="resolved"}get isPending(){return this.state.status==="pending"}get isNull(){return this.state.status==="null"}get isReleased(){return this.state.status==="released"}address(){let t=this.state;if(t.status==="resolved")return t.address;a({code:"InvalidObjectPath",target:this.label});}handle(){let t=this.address();return t.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.label}),t.handle}span(){let t=this.address();return t.kind!=="span"&&a({code:"InvalidObjectPath",target:this.label}),t.span}resolveTo(t){this.#e({kind:"handle",handle:t});}resolveToSpan(t){this.#e({kind:"span",span:t});}resolveNull(){this.#t.status!=="released"&&(this.#t={status:"null"});}release(){this.#n||(this.#t={status:"released"});}#e(t){this.#t.status!=="released"&&(this.#t={status:"resolved",address:t});}};function me(o){let t=[],e=false,n=false;for(let r of o)t.push(r.plan()),r.sort==="write"?n=true:e=true;return {operations:t,hasRead:e,hasWrite:n}}var De=Object.freeze({"stale-revision":"StaleDocument","invalid-handle":"InvalidObjectPath","invalid-offset":"InvalidArgument","unsupported-capability":"NotSupported",disposed:"RuntimeDisposed","transaction-refused":"GeneralException","unknown-operation":"NotSupported","unsupported-content":"InvalidArgument","unsupported-revision":"NotImplemented","ambiguous-document":"GeneralException","conflicting-operations":"ConflictingChanges","document-unavailable":"DocumentUnavailable"});function Dt(o,t={}){let e=De[o.code]??"GeneralException",n=e==="StaleDocument";return new C({code:e,...t.target===void 0?{}:{target:t.target},...n&&t.expectedRevision!==void 0?{expectedRevision:t.expectedRevision}:{},...n&&t.actualRevision!==void 0?{actualRevision:t.actualRevision}:{}})}function zt(o,t,e){for(let n=0;n<o.results.length;n+=1){let r=o.results[n];if(r?.status!=="error")continue;let i=t[n]?.label;return Dt(r.error,{...i===void 0?{}:{target:i},...e===void 0?{}:{expectedRevision:e},actualRevision:o.revision})}return new C({code:"GeneralException"})}function Qt(o,t){if(t.results.length!==o.length)throw new C({code:"GeneralException"});for(let e=0;e<o.length;e+=1){let n=t.results[e],r=o[e];if(n.status!=="ok")throw new C({code:"GeneralException",target:r.label});r.settle(n.value);}}var qt=class{#t=[];get size(){return this.#t.length}get pending(){return this.#t}push(t){this.#t.push(t);}take(){let t=this.#t;this.#t=[];for(let e of t)e.capture?.();return t}clear(){for(let t of this.#t)t.dispose?.();this.#t=[];}};function ge(o,t){if(Array.isArray(o)){for(let e of o)t(e);return}t(o);}var Ct=class{#t;#n;constructor(t,e){this.#t=t,this.#n=e;}add(t){this.#t.assertUsable(),ge(t,e=>{this.#e(e),this.#t.track(e);});}remove(t){this.#t.assertUsable(),ge(t,e=>{this.#e(e),this.#t.untrack(e);});}#e(t){this.#n(t)||a({code:"InvalidObjectPath"});}};var vt=class o{#t;#n=new qt;#e=new Set;#o=new Set;#i;#s;#r;#a=false;#l=null;#c=false;constructor(t){this.#t=t,this.#i={host:t.host,capabilities:t.capabilities,...t.author===void 0?{}:{author:t.author},revisionTextView:t.revisionTextView,queue:this.#n,session:t.id,roots:()=>t.roots(),assertUsable:e=>{this.#t.assertLive(e),this.#a&&a({code:"InvalidRequestContext",...e===void 0?{}:{target:e}});},isFinished:()=>this.#a,readRevision:()=>this.#l,register:e=>{this.#e.add(e);},track:e=>{this.#o.add(e);},untrack:e=>{this.#o.delete(e);},isTracked:e=>this.#o.has(e),disown:e=>{this.#e.delete(e),this.#o.delete(e);}},this.#s=new Ct(this.#i,e=>this.#e.has(e));}get document(){return this.#i.assertUsable("document"),this.#r??=this.#t.openDocument(this),this.#r}get capabilities(){return this.#t.capabilities}get trackedObjects(){return this.#s}async sync(){this.#i.assertUsable(),this.#c&&a({code:"InvalidRequestContext"});let t=this.#n.take();if(t.length!==0){this.#c=true;try{let e=t.filter(s=>!s.nullableLoad?.isNull),n=t.some(s=>s.sort==="write"),r,i=s=>s.dependencies?.some(d=>!d.isAddressable)??false;for(;e.some(i);){r??=n&&this.#l!==null?this.#l:this.#t.host.revision();let s=e.filter(h=>h.sort==="read"&&!i(h));s.length===0&&a({code:"InvalidObjectPath",target:e.find(i)?.label}),await this.#d(s,r);let d=new Set(s);e=e.filter(h=>!d.has(h)&&!h.nullableLoad?.isNull);}if(e.length){let s=r??(n&&this.#l!==null?this.#l:void 0);await this.#d(e,s);}}finally{for(let e of t)e.dispose?.();this.#c=false;}}}async#d(t,e){let n=me(t),r={operations:n.operations,...e===void 0?{}:{expectedRevision:e}};if(this.#t.host.prepare){let s={...r,expectedRevision:r.expectedRevision??this.#t.host.revision()};await this.#t.host.prepare(s);let d=this.#t.host.execute(s);if(!d.ok)throw zt(d,t,s.expectedRevision);Qt(t,d),this.#l=d.revision;return}let i=this.#t.host.execute(r);if(!i.ok)throw zt(i,t,e);Qt(t,i),(n.hasRead||n.hasWrite)&&(this.#l=i.revision);}get[Y](){return this.#i}static begin(t){let e=new o(t);return {context:e,adopt(n){for(let r of n)e.#h(r);},finish(){e.#u();}}}#h(t){let e=t.context;if(e===this)return;let n=e[Y];if(n.session!==this.#t.id)throw new C({code:"InvalidObjectPath"});if(!n.isFinished())throw new C({code:"ObjectInUse"});if(!n.isTracked(t))throw new C({code:"InvalidObjectPath"});let r=n.readRevision();n.disown(t),t[jt](this),this.#e.add(t),this.#o.add(t),r!==null&&this.#p(r);}#p(t){this.#l=this.#l===null?t:Math.min(this.#l,t);}#u(){if(!this.#a){this.#a=true,this.#n.clear();for(let t of this.#e)this.#o.has(t)||t[St]();this.#e.clear();}}};function At(o,t,e){if(o.select.length===0)return t;for(let n of o.select)t.includes(n)||a({code:"InvalidArgument",target:`${e}.${n}`});return o.select}function O(o,t){let e=o.address();return t==="span"?(e.kind!=="span"&&a({code:"InvalidObjectPath",target:o.label}),{start:e.span.start,end:e.span.end}):(e.kind!=="handle"&&a({code:"InvalidObjectPath",target:o.label}),t==="body"?{body:e.handle}:{paragraph:e.handle})}function at(o,t){return (typeof o!="string"||o.trim().length===0||o.length>255)&&a({code:"InvalidArgument",target:t}),o}var p=class extends ${revisionTextView(){return J(this.context).revisionTextView}loadTextInto(t,e){let n=`${this.path.label}.${t}`;this.enqueue({sort:"read",label:n,plan:e,settle:r=>{this.setLoadedProperty(t,P(r,n));}});}command(t,e,n){let r=`${this.path.label}.${t}`;this.enqueue({sort:"write",label:r,plan:e,settle:i=>m(i,r),...n?{capture:n,dispose:n}:{}});}commandDiscarding(t,e){let n=`${this.path.label}.${t}`;this.enqueue({sort:"write",label:n,plan:e,settle:()=>{}});}commandAnswering(t,e,n,r){this.enqueue({sort:"write",label:t,plan:e,settle:n,...r?{capture:r,dispose:r}:{}});}read(t,e,n){this.enqueue({sort:"read",label:t,plan:e,settle:n});}selection(t,e){return At(t,e,this.path.label)}onLoad(t){this.selection(t,[]);}};var T=class extends ${#t;#n=[];constructor(t,e){super(t,e);}get items(){return this.loadedProperty("items")}fill(t,e){this.setLoadedProperty("items",this.#o(t,e,0,void 0)),this.#t={value:t,label:e};let n=this.#n.splice(0,this.#n.length);for(let r of n)this.#e(r,t);}onLoad(t){At(t,["items"],this.path.label);let e=this.path.isPending?void 0:this.listing();if(e===null)return;let n=`${this.path.label}.items`,r=t.skip??0,i=t.top;this.enqueue({sort:"read",label:n,plan:()=>{let s=e??this.listing();return s||a({code:"InvalidObjectPath",target:this.path.label}),s},settle:s=>{this.setLoadedProperty("items",this.#o(s,n,r,i));}});}edge(t,e,n){let r=`${this.path.label}.${e}()`,i=this.promised(r,n),s=this.path.isPending?void 0:this.listing();if(s===null){let d={edge:t,target:r,nullable:n,item:i};return this.#t?this.#e(d,this.#t.value):this.#n.push(d),i}return this.enqueue({sort:"read",label:r,plan:()=>{let d=s??this.listing();return d||a({code:"InvalidObjectPath",target:this.path.label}),d},settle:d=>{this.#e({edge:t,target:r,nullable:n,item:i},d);}}),i}#e(t,e){let{edge:n,target:r,nullable:i,item:s}=t,d=this.size(e,r);if(d===0){i||a({code:"ItemNotFound",target:r}),s.hydrateNull();return}let h=this.addressAt(e,r,n==="first"?0:d-1);h||a({code:"ItemNotFound",target:r}),s.hydrateAddress(h);}#o(t,e,n,r){let i=this.size(t,e),s=r===void 0?i:Math.min(i,n+r),d=[];for(let h=n;h<s;h+=1){let v=this.addressAt(t,e,h);v&&d.push(this.itemAt(`${e}[${String(h)}]`,v));}return d}},x=class extends T{size(t,e){return A(t,e).length}addressAt(t,e,n){let r=A(t,e)[n];return r?{kind:"handle",handle:r}:void 0}};var H=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get code(){return this.loadedProperty("code")}set code(t){if(this.requireUsablePath(),(typeof t!="string"||t.length===0)&&a({code:"InvalidArgument",target:`${this.path.label}.code`}),this.#t){this.#t.code=t;return}let e={code:t};this.#t=e,this.commandAnswering(this.path.label,()=>({op:"setFieldCode",field:this.#e(),code:e.code}),n=>m(n,this.path.label),()=>{this.#t===e&&(this.#t=void 0);});}delete(){this.#n("deleteField");}updateResult(){this.#n("updateFieldResult");}#n(t){this.requireUsablePath(),this.commandAnswering(this.path.label,()=>({op:t,field:this.#e()}),e=>m(e,this.path.label));}onLoad(t){this.selection(t,["code"]).length!==0&&this.read(this.path.label,()=>({op:"getField",field:this.#e()}),e=>{e.kind!=="field"&&a({code:"GeneralException",target:this.path.label}),this.setLoadedProperty("code",e.field.code);});}#e(){this.requireAddressable();let t=this.path.address();return t.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.path.label}),t.handle}},M=class o extends T{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}getLast(){return this.edge("last","getLast",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}getLastOrNullObject(){return this.edge("last","getLastOrNullObject",true)}listing(){return {op:"getFields",span:O(this.path,this.#t)}}size(t,e){return A(t,e).length}addressAt(t,e,n){let r=A(t,e)[n];return r?{kind:"handle",handle:r}:void 0}itemAt(t,e){return H.at(this.context,t,e)}promised(t,e){return H.promised(this.context,t,e)}};var qe=["width","height","lockAspectRatio","altTextDescription"],F=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get width(){return this.loadedProperty("width")}set width(t){this.#n("width",t);}get height(){return this.loadedProperty("height")}set height(t){this.#n("height",t);}get lockAspectRatio(){return this.loadedProperty("lockAspectRatio")}set lockAspectRatio(t){typeof t!="boolean"&&a({code:"InvalidArgument",target:`${this.path.label}.lockAspectRatio`}),this.#e({lockAspectRatio:t});}get altTextDescription(){return this.loadedProperty("altTextDescription")}set altTextDescription(t){typeof t!="string"&&a({code:"InvalidArgument",target:`${this.path.label}.altTextDescription`}),this.#e({altTextDescription:t});}delete(){let t=`${this.path.label}.delete`;this.commandAnswering(t,()=>({op:"deleteInlinePicture",picture:this.#o()}),e=>m(e,t));}onLoad(t){let e=this.selection(t,qe);e.length&&this.read(this.path.label,()=>({op:"getInlinePicture",picture:this.#o()}),n=>{n.kind!=="inlinePicture"&&a({code:"GeneralException",target:this.path.label});for(let r of e)this.setLoadedProperty(r,n.picture[r]);});}#n(t,e){(typeof e!="number"||!Number.isFinite(e)||e<=0)&&a({code:"InvalidArgument",target:`${this.path.label}.${t}`}),this.#e({[t]:e});}#e(t){if(this.requireUsablePath(),this.#t){Object.assign(this.#t,t);return}let e=t;this.#t=e,this.commandAnswering(this.path.label,()=>({op:"setInlinePicture",picture:this.#o(),properties:e}),n=>m(n,this.path.label),()=>{this.#t===e&&(this.#t=void 0);});}#o(){this.requireAddressable();let t=this.path.address();return t.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.path.label}),t.handle}},V=class o extends T{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}getLast(){return this.edge("last","getLast",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}getLastOrNullObject(){return this.edge("last","getLastOrNullObject",true)}listing(){return {op:"getInlinePictures",span:O(this.path,this.#t)}}size(t,e){return A(t,e).length}addressAt(t,e,n){let r=A(t,e)[n];return r?{kind:"handle",handle:r}:void 0}itemAt(t,e){return F.at(this.context,t,e)}promised(t,e){return F.promised(this.context,t,e)}};function D(o,t,e=0){return (!Number.isInteger(o)||o<e)&&a({code:"InvalidArgument",target:t}),o}function Xt(o,t){return (!Array.isArray(o)||o.some(e=>!Array.isArray(e)||e.some(n=>typeof n!="string")))&&a({code:"InvalidArgument",target:t}),o.map(e=>[...e])}function fe(o,t){return o!=="Start"&&o!=="End"&&a({code:"InvalidArgument",target:t}),o==="Start"?"start":"end"}var W=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n=false){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get values(){return this.loadedProperty("values")}set values(t){let e=Xt(t,`${this.path.label}.values`);this.command("values",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"values",values:e}}));}get style(){return this.loadedProperty("style")}set style(t){typeof t!="string"&&a({code:"InvalidArgument",target:`${this.path.label}.style`}),this.command("style",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"properties",styleId:t}}));}get headerRowCount(){return this.loadedProperty("headerRowCount")}set headerRowCount(t){D(t,`${this.path.label}.headerRowCount`),this.command("headerRowCount",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"properties",headerRowCount:t}}));}get rowCount(){return this.loadedProperty("rowCount")}get columnCount(){return this.loadedProperty("columnCount")}get rows(){return this.#t??=dt.of(this.context,`${this.path.label}.rows`,this.path,()=>({op:"getTableRows",table:this.path.handle()}))}getCell(t,e){let n=`${this.path.label}.getCell`;D(t,n),D(e,n);let r=tt.promised(this.context,n);return this.read(n,()=>({op:"getTableCell",table:this.path.handle(),rowIndex:t,cellIndex:e}),i=>r.hydrateAddress({kind:"handle",handle:u(i,n)})),r}addRows(t,e,n){let r=`${this.path.label}.addRows`,i=fe(t,r);D(e,r,1);let s=n===void 0?void 0:Xt(n,r),d=dt.of(this.context,r,this.path,()=>null);return this.commandAnswering(r,()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"addRows",location:i,count:e,...s?{values:s}:{}}}),h=>d.fill(h,r)),d}addColumns(t,e,n){let r=`${this.path.label}.addColumns`,i=fe(t,r);D(e,r,1);let s=n===void 0?void 0:Xt(n,r);this.command("addColumns",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"addColumns",location:i,count:e,...s?{values:s}:{}}}));}deleteRows(t,e){e===void 0&&(e=1),D(t,this.path.label),D(e,this.path.label,1),this.command("deleteRows",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"deleteRows",index:t,count:e}}));}deleteColumns(t,e){e===void 0&&(e=1),D(t,this.path.label),D(e,this.path.label,1),this.command("deleteColumns",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"deleteColumns",index:t,count:e}}));}delete(){this.command("delete",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"delete"}}));}onLoad(t){let e=this.selection(t,["values","style","headerRowCount","rowCount","columnCount"]);this.read(this.path.label,()=>({op:"getTable",table:this.path.handle()}),n=>{n.kind!=="table"&&a({code:"GeneralException",target:this.path.label});for(let r of e)this.setLoadedProperty(r,n.table[r]);});}},st=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n=false){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get cells(){return this.#t??=Rt.of(this.context,`${this.path.label}.cells`,this.path,()=>({op:"getTableCells",row:this.path.handle()}))}},tt=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n=false){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get body(){if(this.#t)return this.#t;let t=`${this.path.label}.body`,e=I.promisedStory(this.context,t);return this.read(t,()=>({op:"getTableCellBody",cell:this.path.handle()}),n=>e.hydrateAddress({kind:"handle",handle:u(n,t)})),this.#t=e,e}get value(){return this.loadedProperty("value")}set value(t){typeof t!="string"&&a({code:"InvalidArgument",target:`${this.path.label}.value`}),this.command("value",()=>({op:"updateTableCell",cell:this.path.handle(),properties:{value:t}}));}get columnWidth(){return this.loadedProperty("columnWidth")}set columnWidth(t){(typeof t!="number"||!Number.isFinite(t)||t<=0)&&a({code:"InvalidArgument",target:`${this.path.label}.columnWidth`}),this.command("columnWidth",()=>({op:"updateTableCell",cell:this.path.handle(),properties:{columnWidth:t}}));}get shadingColor(){return this.loadedProperty("shadingColor")}set shadingColor(t){typeof t!="string"&&a({code:"InvalidArgument",target:`${this.path.label}.shadingColor`}),this.command("shadingColor",()=>({op:"updateTableCell",cell:this.path.handle(),properties:{shadingColor:t}}));}get verticalAlignment(){return this.loadedProperty("verticalAlignment")}set verticalAlignment(t){t!=="Top"&&t!=="Center"&&t!=="Bottom"&&a({code:"InvalidArgument",target:`${this.path.label}.verticalAlignment`}),this.command("verticalAlignment",()=>({op:"updateTableCell",cell:this.path.handle(),properties:{verticalAlignment:t}}));}onLoad(t){let e=this.selection(t,["value","columnWidth","shadingColor","verticalAlignment"]);this.read(this.path.label,()=>({op:"getTableCellProperties",cell:this.path.handle()}),n=>{n.kind!=="tableCell"&&a({code:"GeneralException",target:this.path.label});for(let r of e)this.setLoadedProperty(r,n.cell[r]);});}},U=class o extends x{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}static over(t,e,n,r){return o.of(t,e,n,()=>({op:"getTables",scope:r()}))}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}listing(){return this.#t()}itemAt(t,e){return W.at(this.context,t,e)}promised(t,e){return W.promised(this.context,t,e)}},dt=class o extends x{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}listing(){return this.#t()}itemAt(t,e){return st.at(this.context,t,e)}promised(t,e){return st.promised(this.context,t,e)}},Rt=class o extends x{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}listing(){return this.#t()}itemAt(t,e){return tt.at(this.context,t,e)}promised(t,e){return tt.promised(this.context,t,e)}};var Kt=(i=>(i.replace="Replace",i.start="Start",i.end="End",i.before="Before",i.after="After",i))(Kt||{}),Zt=(s=>(s.mixed="Mixed",s.unknown="Unknown",s.left="Left",s.centered="Centered",s.right="Right",s.justified="Justified",s))(Zt||{}),Yt=(e=>(e.portrait="Portrait",e.landscape="Landscape",e))(Yt||{}),Jt=(n=>(n.off="Off",n.trackAll="TrackAll",n.trackMineOnly="TrackMineOnly",n))(Jt||{}),_t=(r=>(r.mixed="Mixed",r.top="Top",r.center="Center",r.bottom="Bottom",r))(_t||{}),te=(d=>(d.line="Line",d.page="Page",d.next="Next",d.sectionNext="SectionNext",d.sectionContinuous="SectionContinuous",d.sectionEven="SectionEven",d.sectionOdd="SectionOdd",d))(te||{}),ee=(y=>(y.unknown="Unknown",y.richText="RichText",y.plainText="PlainText",y.picture="Picture",y.buildingBlockGallery="BuildingBlockGallery",y.checkBox="CheckBox",y.comboBox="ComboBox",y.datePicker="DatePicker",y.dropDownList="DropDownList",y.group="Group",y.repeatingSection="RepeatingSection",y.plainTextInline="PlainTextInline",y.plainTextParagraph="PlainTextParagraph",y.richTextInline="RichTextInline",y.richTextParagraphs="RichTextParagraphs",y.richTextTable="RichTextTable",y.richTextTableCell="RichTextTableCell",y.richTextTableRow="RichTextTableRow",y))(ee||{});var Be=["Replace","Start","End"],$e=["Start","End"],He=["Replace","Start","End"],Me=["Before","After"],Fe=["Replace","Start","End","Before","After"],Ve=["Select","Start","End"];function lt(o,t,e){return (typeof o!="string"||!t.includes(o))&&a({code:"InvalidArgument",target:e}),o}var be=(o,t)=>lt(o,Be,t),ye=(o,t)=>lt(o,$e,t),xe=(o,t)=>lt(o,He,t),Ce=(o,t)=>lt(o,Me,t),Pt=(o,t)=>lt(o,Fe,t),Bt=(o,t)=>o===void 0?"Select":lt(o,Ve,t);function k(o,t){return typeof o!="string"&&a({code:"InvalidArgument",target:t}),/[\r\n\v\f\u2028\u2029]/.test(o)&&a({code:"InvalidArgument",target:t}),o}var We=8,oe=(d=>(d.custom="Custom",d.solid="Solid",d.hollow="Hollow",d.square="Square",d.diamonds="Diamonds",d.arrow="Arrow",d.checkmark="Checkmark",d))(oe||{}),re=(s=>(s.none="None",s.arabic="Arabic",s.upperRoman="UpperRoman",s.lowerRoman="LowerRoman",s.upperLetter="UpperLetter",s.lowerLetter="LowerLetter",s))(re||{}),j=class o extends p{#t;#n=new Map;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get id(){return this.loadedProperty("id")}get paragraphs(){return this.#t??=L.overListing(this.context,`${this.path.label}.paragraphs`,this.path,()=>({op:"getListParagraphs",list:this.#o()})),this.#t}getLevelParagraphs(t){let e=`${this.path.label}.getLevelParagraphs`,n=ne(t,e);return L.overListing(this.context,e,this.path,()=>({op:"getListParagraphs",list:this.#o(),level:n}))}insertParagraph(t,e){let n=`${this.path.label}.insertParagraph`,r=k(t,n);e!=="Start"&&e!=="End"&&e!=="Before"&&e!=="After"&&a({code:"InvalidArgument",target:n});let i=w.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"insertListParagraph",list:this.#o(),where:e==="Start"||e==="Before"?"start":"end",text:r}),s=>{i.hydrateAddress({kind:"handle",handle:u(s,n)});}),i}setLevelBullet(t,e,n,r){this.#e(t,{bullet:e,...n===void 0?{}:{charCode:n},...r===void 0?{}:{fontName:r}});}setLevelNumbering(t,e,n){this.#e(t,{numbering:e,...n===void 0?{}:{formatString:[...n]}});}setLevelStartingNumber(t,e){this.#e(t,{startingNumber:e});}setLevelIndents(t,e,n){this.#e(t,{textIndent:e,bulletNumberPictureIndent:n});}#e(t,e){let n=`${this.path.label}.levelFormat`,r=ne(t,n);this.requireUsablePath();let i=this.#n.get(r);if(i){Object.assign(i,e),"bullet"in e&&(delete i.numbering,delete i.formatString),"numbering"in e&&(delete i.bullet,delete i.charCode,delete i.fontName);return}let s={...e};this.#n.set(r,s),this.commandAnswering(n,()=>({op:"setListLevelFormat",list:this.#o(),level:r,format:s}),d=>{m(d,n);},()=>{this.#n.get(r)===s&&this.#n.delete(r);});}onLoad(t){if(!this.selection(t,["id"]).includes("id"))return;let e=`${this.path.label}.id`;this.read(e,()=>({op:"getListId",list:this.#o()}),n=>{this.setLoadedProperty("id",Nt(n,e));});}#o(){return this.requireAddressable(),this.path.handle()}},ct=class o extends x{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}getById(t){let e=`${this.path.label}.getById`,n=Ue(t,e),r=this.#t,i=j.promised(this.context,e,false);return this.enqueue({sort:"read",label:e,plan:()=>({op:"getListById",body:r,id:n}),settle:s=>{i.hydrateAddress({kind:"handle",handle:u(s,e)});}}),i}listing(){return {op:"getLists",body:this.#t}}itemAt(t,e){return j.at(this.context,t,e)}promised(t,e){return j.promised(this.context,t,e)}},ht=class o extends p{static of(t,e,n){return new o(t,c.derived(e,n))}constructor(t,e){super(t,e);}get level(){return this.loadedProperty("level")}set level(t){let e=`${this.path.label}.level`,n=ne(t,e);this.commandAnswering(e,()=>({op:"setListLevel",paragraph:this.#t(),level:n}),r=>{m(r,e);});}onLoad(t){if(!this.selection(t,["level"]).includes("level"))return;let e=`${this.path.label}.level`;this.read(e,()=>({op:"getListLevel",paragraph:this.#t()}),n=>{this.setLoadedProperty("level",Nt(n,e));});}#t(){this.requireAddressable();let t=this.path.address();return t.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.path.label}),t.handle}};function ne(o,t){return (!Number.isInteger(o)||o<0||o>We)&&a({code:"InvalidArgument",target:t}),o}function Ue(o,t){return (!Number.isInteger(o)||o<=0)&&a({code:"InvalidArgument",target:t}),o}var ie=(f=>(f.mixed="Mixed",f.none="None",f.hidden="Hidden",f.dotLine="DotLine",f.single="Single",f.word="Word",f.double="Double",f.thick="Thick",f.dotted="Dotted",f.dottedHeavy="DottedHeavy",f.dashLine="DashLine",f.dashLineHeavy="DashLineHeavy",f.dashLineLong="DashLineLong",f.dashLineLongHeavy="DashLineLongHeavy",f.dotDashLine="DotDashLine",f.dotDashLineHeavy="DotDashLineHeavy",f.twoDotDashLine="TwoDotDashLine",f.twoDotDashLineHeavy="TwoDotDashLineHeavy",f.wave="Wave",f.waveHeavy="WaveHeavy",f.waveDouble="WaveDouble",f))(ie||{}),Ge=["bold","italic","color","name","size","underline","strikeThrough","highlightColor","subscript","superscript"],E=class o extends p{#t;#n;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}get bold(){return this.loadedProperty("bold")}set bold(t){this.#e("bold",Ot(t,`${this.path.label}.bold`));}get italic(){return this.loadedProperty("italic")}set italic(t){this.#e("italic",Ot(t,`${this.path.label}.italic`));}get color(){return this.loadedProperty("color")}set color(t){this.#e("color",$t(t,`${this.path.label}.color`));}get name(){return this.loadedProperty("name")}set name(t){this.#e("name",$t(t,`${this.path.label}.name`));}get size(){return this.loadedProperty("size")}set size(t){this.#e("size",ze(t,`${this.path.label}.size`));}get underline(){return this.loadedProperty("underline")}set underline(t){this.#e("underline",$t(t,`${this.path.label}.underline`));}get highlightColor(){return this.loadedProperty("highlightColor")}set highlightColor(t){this.#e("highlightColor",t===null?null:$t(t,`${this.path.label}.highlightColor`));}get strikeThrough(){return this.loadedProperty("strikeThrough")}set strikeThrough(t){this.#e("strikeThrough",Ot(t,`${this.path.label}.strikeThrough`));}get subscript(){return this.loadedProperty("subscript")}set subscript(t){this.#e("subscript",Ot(t,`${this.path.label}.subscript`));}get superscript(){return this.loadedProperty("superscript")}set superscript(t){this.#e("superscript",Ot(t,`${this.path.label}.superscript`));}onLoad(t){let e=this.selection(t,Ge);if(e.length===0)return;let n=`${this.path.label}.font`;this.read(n,()=>({op:"getFont",span:this.#o()}),r=>{let i=Wt(r,n);for(let s of e)this.setLoadedProperty(s,i[s]);});}#e(t,e){if(this.requireUsablePath(),this.#n){this.#n[t]=e,t==="subscript"&&e===true&&(this.#n.superscript=false),t==="superscript"&&e===true&&(this.#n.subscript=false);return}let n={[t]:e};t==="subscript"&&e===true&&(n.superscript=false),t==="superscript"&&e===true&&(n.subscript=false),this.#n=n;let r=`${this.path.label}.${t}`;this.commandAnswering(this.path.label,()=>({op:"setFont",span:this.#o(),font:n}),i=>{m(i,r);},()=>{this.#n===n&&(this.#n=void 0);});}#o(){return this.requireAddressable(),O(this.path,this.#t)}};function Ot(o,t){return typeof o!="boolean"&&a({code:"InvalidArgument",target:t}),o}function ze(o,t){return (typeof o!="number"||!Number.isFinite(o))&&a({code:"InvalidArgument",target:t}),o}function $t(o,t){return (typeof o!="string"||o.length===0)&&a({code:"InvalidArgument",target:t}),o}var Qe=16,w=class o extends p{#t;#n;#e;#o;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get text(){return this.loadedProperty("text")}get uniqueLocalId(){return this.loadedProperty("uniqueLocalId")}get style(){return this.loadedProperty("style")}set style(t){this.#i("style",at(t,`${this.path.label}.style`));}get font(){return this.#t??=E.of(this.context,`${this.path.label}.font`,this.path,"paragraph"),this.#t}get alignment(){return this.loadedProperty("alignment")}set alignment(t){this.#i("alignment",Ke(t,`${this.path.label}.alignment`));}get firstLineIndent(){return this.loadedProperty("firstLineIndent")}set firstLineIndent(t){this.#i("firstLineIndent",pt(t,`${this.path.label}.firstLineIndent`));}get leftIndent(){return this.loadedProperty("leftIndent")}set leftIndent(t){this.#i("leftIndent",pt(t,`${this.path.label}.leftIndent`));}get rightIndent(){return this.loadedProperty("rightIndent")}set rightIndent(t){this.#i("rightIndent",pt(t,`${this.path.label}.rightIndent`));}get lineSpacing(){return this.loadedProperty("lineSpacing")}set lineSpacing(t){this.#i("lineSpacing",pt(t,`${this.path.label}.lineSpacing`));}get spaceBefore(){return this.loadedProperty("spaceBefore")}set spaceBefore(t){this.#i("spaceBefore",pt(t,`${this.path.label}.spaceBefore`));}get spaceAfter(){return this.loadedProperty("spaceAfter")}set spaceAfter(t){this.#i("spaceAfter",pt(t,`${this.path.label}.spaceAfter`));}get list(){return this.#n??=this.#s(`${this.path.label}.list`),this.#n}getRange(t="Whole"){let e=`${this.path.label}.getRange`;["Whole","Content","Start","End","Before","After"].includes(t)||a({code:"InvalidArgument",target:e});let n=b.promised(this.context,e,false);return this.read(e,()=>({op:"getRange",span:{paragraph:this.#r()},location:t}),r=>{n.hydrateAddress({kind:"span",span:R(r,e)});}),n}startNewList(){let t=`${this.path.label}.startNewList`,e=j.promised(this.context,t,false);return this.commandAnswering(t,()=>({op:"startNewList",paragraph:this.#r()}),n=>{e.hydrateAddress({kind:"handle",handle:u(n,t)});}),e}attachToList(t,e){let n=`${this.path.label}.attachToList`;(!Number.isSafeInteger(t)||t<=0||!Number.isInteger(e)||e<0||e>8)&&a({code:"InvalidArgument",target:n});let r=j.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"attachToList",paragraph:this.#r(),listId:t,level:e}),i=>{r.hydrateAddress({kind:"handle",handle:u(i,n)});}),r}detachFromList(){let t=`${this.path.label}.detachFromList`;this.commandAnswering(t,()=>({op:"detachFromList",paragraph:this.#r()}),e=>{m(e,t);});}get listItem(){return this.#e??=ht.of(this.context,`${this.path.label}.listItem`,this.path),this.#e}clear(){this.commandDiscarding("clear",()=>({op:"replaceSpan",span:{paragraph:this.#r()},text:""}));}delete(){this.command("delete",()=>({op:"deleteParagraph",paragraph:this.#r()}));}insertText(t,e){let n=`${this.path.label}.insertText`,r=k(t,n),i=xe(e,n),s=b.promised(this.context,n,false);return this.commandAnswering(n,()=>i==="Replace"?{op:"replaceSpan",span:{paragraph:this.#r()},text:r}:{op:"insertText",at:{paragraph:this.#r(),at:i==="Start"?"start":"end"},text:r},d=>{s.hydrateAddress({kind:"span",span:R(d,n)});}),s}insertParagraph(t,e){let n=`${this.path.label}.insertParagraph`,r=k(t,n),i=Ce(e,n),s=o.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"insertParagraph",anchor:{paragraph:this.#r()},where:i==="Before"?"before":"after",text:r}),d=>{d.kind!=="handle"&&a({code:"GeneralException",target:n}),s.hydrateAddress({kind:"handle",handle:d.handle});}),s}split(t,e,n){let r=`${this.path.label}.split`,i=Ze(t,r),s=Ae(e,`${r}.trimDelimiters`),d=Ae(n,`${r}.trimSpacing`),h=N.answered(this.context,r,this.path);return this.commandAnswering(r,()=>({op:"splitParagraph",paragraph:this.#r(),delimiters:i,...s?{trimDelimiters:true}:{},...d?{trimSpacing:true}:{}}),v=>{h.fill(v,r);}),h}onLoad(t){let e=this.selection(t,["text","uniqueLocalId",...ve]);e.includes("text")&&this.loadTextInto("text",()=>({op:"getText",target:this.#r(),projection:this.revisionTextView()})),e.includes("uniqueLocalId")&&this.loadTextInto("uniqueLocalId",()=>({op:"getParagraphId",paragraph:this.#r()}));let n=ve.filter(i=>e.includes(i));if(n.length===0)return;let r=`${this.path.label}.paragraphFormat`;this.read(r,()=>({op:"getParagraphFormat",paragraph:{paragraph:this.#r()}}),i=>{let s=Ut(i,r);for(let d of n)this.setLoadedProperty(d,s[d]);});}#i(t,e){if(this.requireUsablePath(),this.#o){this.#o[t]=e;return}let n={[t]:e};this.#o=n;let r=`${this.path.label}.${t}`;this.commandAnswering(`${this.path.label}.paragraphFormat`,()=>({op:"setParagraphFormat",paragraph:{paragraph:this.#r()},format:n}),i=>{m(i,r);},()=>{this.#o===n&&(this.#o=void 0);});}#s(t){let e=j.promised(this.context,t,false);return this.read(t,()=>({op:"getParagraphList",paragraph:this.#r()}),n=>{e.hydrateAddress({kind:"handle",handle:u(n,t)});}),e}#r(){return this.requireAddressable(),this.path.handle()}},ve=["style","alignment","firstLineIndent","leftIndent","rightIndent","lineSpacing","spaceBefore","spaceAfter"],Xe=["Left","Centered","Right","Justified"];function Ke(o,t){return Xe.includes(o)||a({code:"InvalidArgument",target:t}),o}function pt(o,t){return (typeof o!="number"||!Number.isFinite(o))&&a({code:"InvalidArgument",target:t}),o}function Ze(o,t){(!Array.isArray(o)||o.length===0||o.length>Qe)&&a({code:"InvalidArgument",target:t});for(let e of o)(typeof e!="string"||e.length===0)&&a({code:"InvalidArgument",target:t});return [...o]}function Ae(o,t){return o!==void 0&&typeof o!="boolean"&&a({code:"InvalidArgument",target:t}),o===true}var L=class o extends T{#t;static of(t,e,n){return new o(t,c.derived(e,n),null)}static overListing(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}getLast(){return this.edge("last","getLast",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}getLastOrNullObject(){return this.edge("last","getLastOrNullObject",true)}listing(){if(this.#t)return this.#t();let t=this.path.address();return t.kind==="handle"?{op:"getParagraphs",body:t.handle}:{op:"getSpanParagraphs",span:t.span}}size(t,e){return A(t,e).length}addressAt(t,e,n){let r=A(t,e)[n];return r?{kind:"handle",handle:r}:void 0}itemAt(t,e){return w.at(this.context,t,e)}promised(t,e){return w.promised(this.context,t,e)}},N=class o extends T{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}static answered(t,e,n){return new o(t,c.derived(e,n),null)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}getLast(){return this.edge("last","getLast",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}listing(){return this.#t?this.#t():null}size(t,e){return Et(t,e).length}addressAt(t,e,n){let r=Et(t,e)[n];return r?{kind:"span",span:r}:void 0}itemAt(t,e){return b.at(this.context,t,e)}promised(t,e){return b.promised(this.context,t,e)}};var Pe=4096,q=class o extends p{#t;#n=new Map;#e;#o;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get id(){return this.loadedProperty("id")}get tag(){return this.loadedProperty("tag")}set tag(t){this.#s("tag",{tag:ae(t,`${this.path.label}.tag`)});}get title(){return this.loadedProperty("title")}set title(t){this.#s("title",{title:ae(t,`${this.path.label}.title`)});}get subtype(){return this.loadedProperty("subtype")}get isBound(){return this.loadedProperty("isBound")}get cannotDelete(){let t=this.loadedProperty("lock");return t==="sdtLocked"||t==="sdtContentLocked"}set cannotDelete(t){this.#r("cannotDelete",t);}get cannotEdit(){let t=this.loadedProperty("lock");return t==="contentLocked"||t==="sdtContentLocked"}set cannotEdit(t){this.#r("cannotEdit",t);}get placeholderShown(){return this.loadedProperty("placeholderShown")}get temporary(){return this.loadedProperty("temporary")}get text(){return this.loadedProperty("text")}get paragraphs(){return this.#e??=L.overListing(this.context,`${this.path.label}.paragraphs`,this.path,()=>({op:"getContentControlParagraphs",contentControl:this.#a()})),this.#e}get contentControls(){return this.#o??=B.of(this.context,`${this.path.label}.contentControls`,this.path,{contentControl:this.#a()}),this.#o}getRange(t){let e=`${this.path.label}.getRange`,n=Ye(t??"Whole",e),r=this.#n.get(n);if(r)return r;let i=this.#i(e,n);return this.#n.set(n,i),i}setValue(t){let e=`${this.path.label}.setValue`,n=Je(t,e);this.command("setValue",()=>({op:"setContentControlValue",contentControl:this.#a(),value:n}));}insertText(t,e){let n=`${this.path.label}.insertText`,r=k(t,n),i=e==="Replace"?"replace":e==="Start"?"start":e==="End"?"end":a({code:"InvalidArgument",target:n}),s=b.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"insertContentControlText",contentControl:this.#a(),text:r,at:i}),d=>{s.hydrateAddress({kind:"span",span:R(d,n)});}),s}delete(t){let e=`${this.path.label}.delete`;typeof t!="boolean"&&a({code:"InvalidArgument",target:e}),this.command("delete",()=>({op:"deleteContentControl",contentControl:this.#a(),keepContent:t}));}onLoad(t){let e=this.selection(t,["id","tag","title","subtype","isBound","text","cannotDelete","cannotEdit","placeholderShown","temporary"]);if(e.includes("id")&&this.loadTextInto("id",()=>({op:"getContentControlFileId",contentControl:this.#a()})),e.includes("tag")&&this.loadTextInto("tag",()=>({op:"getContentControlTag",contentControl:this.#a()})),e.includes("title")&&this.loadTextInto("title",()=>({op:"getContentControlTitle",contentControl:this.#a()})),e.includes("subtype")&&this.loadTextInto("subtype",()=>({op:"getContentControlSubtype",contentControl:this.#a()})),e.includes("isBound")){let r=`${this.path.label}.isBound`;this.read(r,()=>({op:"getContentControlIsBound",contentControl:this.#a()}),i=>{this.setLoadedProperty("isBound",_(i,r));});}if(e.includes("text")&&this.loadTextInto("text",()=>({op:"getContentControlText",contentControl:this.#a(),projection:this.revisionTextView()})),e.includes("cannotDelete")||e.includes("cannotEdit")){let r=`${this.path.label}.lock`;this.read(r,()=>({op:"getContentControlLock",contentControl:this.#a()}),i=>{this.setLoadedProperty("lock",P(i,r));});}if(e.includes("placeholderShown")){let r=`${this.path.label}.placeholderShown`;this.read(r,()=>({op:"getContentControlPlaceholderShown",contentControl:this.#a()}),i=>{this.setLoadedProperty("placeholderShown",_(i,r));});}if(!e.includes("temporary"))return;let n=`${this.path.label}.temporary`;this.read(n,()=>({op:"getContentControlTemporary",contentControl:this.#a()}),r=>{this.setLoadedProperty("temporary",_(r,n));});}#i(t,e){let n=b.promised(this.context,t,false);return this.read(t,()=>({op:"getContentControlRange",contentControl:this.#a(),location:e}),r=>{n.hydrateAddress({kind:"span",span:R(r,t)});}),n}#s(t,e){this.command(t,()=>({op:"setContentControlProperties",contentControl:this.#a(),...e}));}#r(t,e){let n=`${this.path.label}.${t}`;if(typeof e!="boolean"&&a({code:"InvalidArgument",target:n}),this.requireUsablePath(),this.#t){this.#t[t]=e;return}let r={[t]:e};this.#t=r,this.command(t,()=>({op:"setContentControlProperties",contentControl:this.#a(),...r}),()=>{this.#t===r&&(this.#t=void 0);});}#a(){return this.requireAddressable(),this.path.handle()}},B=class o extends x{#t;#n;static of(t,e,n,r){return new o(t,c.derived(e,n),r,()=>({op:"getContentControls",scope:r}))}constructor(t,e,n,r){super(t,e),this.#t=n,this.#n=r;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}getById(t){let e=`${this.path.label}.getById`;Number.isInteger(t)||a({code:"InvalidArgument",target:e});let n=this.#t,r=q.promised(this.context,e,false);return this.enqueue({sort:"read",label:e,plan:()=>({op:"getContentControlById",scope:n,id:t}),settle:i=>{r.hydrateAddress({kind:"handle",handle:u(i,e)});}}),r}getByTag(t){let e=`${this.path.label}.getByTag`,n=Re(t,e),r=this.#t;return new o(this.context,c.derived(e,this.path),r,()=>({op:"getContentControlsByTag",scope:r,tag:n}))}getByTitle(t){let e=`${this.path.label}.getByTitle`,n=Re(t,e),r=this.#t;return new o(this.context,c.derived(e,this.path),r,()=>({op:"getContentControlsByTitle",scope:r,title:n}))}listing(){return this.#n()}itemAt(t,e){return q.at(this.context,t,e)}promised(t,e){return q.promised(this.context,t,e)}};function ae(o,t){return (typeof o!="string"||o.length>Pe)&&a({code:"InvalidArgument",target:t}),o}function Re(o,t){let e=ae(o,t);return e.length===0&&a({code:"InvalidArgument",target:t}),e}function Ye(o,t){switch(o){case "Whole":return "whole";case "Content":return "content";case "Start":return "start";case "End":return "end";case "Before":return "before";case "After":return "after";default:return a({code:"InvalidArgument",target:t})}}function Je(o,t){(typeof o!="object"||o===null)&&a({code:"InvalidArgument",target:t});let e=o;if(e.kind==="text"||e.kind==="listItem"){let n=e.kind==="text"?e.text:e.value;return (typeof n!="string"||n.length>Pe)&&a({code:"InvalidArgument",target:t}),e.kind==="text"?{kind:"text",text:n}:{kind:"listItem",value:n}}if(e.kind==="checkbox")return typeof e.checked!="boolean"&&a({code:"InvalidArgument",target:t}),{kind:"checkbox",checked:e.checked};if(e.kind==="date")return (typeof e.iso!="string"||e.iso.length>64)&&a({code:"InvalidArgument",target:t}),{kind:"date",iso:e.iso};a({code:"InvalidArgument",target:t});}function _e(o,t){return t<1||t>12?0:t===2?o%4===0&&o%100!==0||o%400===0?29:28:t===4||t===6||t===9||t===11?30:31}function Oe(o){if(o.length===0)return null;let t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,9}))?(Z|[+-]\d{2}:\d{2})$/.exec(o.trim());if(!t)return null;let e=Number(t[1]),n=Number(t[2]),r=Number(t[3]),i=_e(e,n);if(e===0||i===0||r<1||r>i)return null;let s=Number(t[4]),d=Number(t[5]),h=Number(t[6]);if(s>23||d>59||h>59)return null;let v=t[7],K=v===void 0?0:Number(v.padEnd(3,"0").slice(0,3));if(Number.isNaN(K))return null;let rt=`${t[1]}-${t[2]}-${t[3]}T${t[4]}:${t[5]}:${t[6]}.${String(K).padStart(3,"0")}Z`,Lt=Date.parse(rt);if(Number.isNaN(Lt))return null;let g=t[8];if(g==="Z")return new Date(Lt);let Z=Number(g.slice(1,3)),it=Number(g.slice(4,6));if(it>59||Z>14||Z===14&&it!==0)return null;let Vt=g[0]==="+"?1:-1,wt=new Date(Lt-Vt*(Z*36e5+it*6e4));return Number.isNaN(wt.getTime())?null:wt}var Ht=class extends p{hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get authorName(){return this.loadedProperty("authorName")}get creationDate(){return this.loadedProperty("creationDate")}get id(){return this.loadedProperty("id")}get text(){return this.loadedProperty("text")}delete(){this.command("delete",()=>({op:"deleteComment",comment:this.commentHandle()}));}loadCommentFields(t,e){let n=this.selection(t,["authorName","creationDate","id","text",...e]);if(n.includes("authorName")&&this.loadTextInto("authorName",()=>({op:"getCommentAuthor",comment:this.commentHandle()})),n.includes("text")&&this.loadTextInto("text",()=>({op:"getCommentText",comment:this.commentHandle()})),n.includes("id")&&this.loadTextInto("id",()=>({op:"getCommentId",comment:this.commentHandle()})),n.includes("creationDate")){let i=`${this.path.label}.creationDate`;this.read(i,()=>({op:"getCommentDate",comment:this.commentHandle()}),s=>{this.setLoadedProperty("creationDate",Oe(P(s,i)));});}if(!n.includes("resolved"))return;let r=`${this.path.label}.resolved`;this.read(r,()=>({op:"getCommentResolved",comment:this.commentHandle()}),i=>{this.setLoadedProperty("resolved",_(i,r));});}commentHandle(){return this.requireAddressable(),this.path.handle()}},nt=class o extends Ht{static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}onLoad(t){this.loadCommentFields(t,[]);}},It=class o extends x{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#t()}itemAt(t,e){return nt.at(this.context,t,e)}promised(t,e){return nt.promised(this.context,t,e)}},G=class o extends Ht{#t;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}get resolved(){return this.loadedProperty("resolved")}set resolved(t){let e=`${this.path.label}.resolved`;typeof t!="boolean"&&a({code:"InvalidArgument",target:e}),this.commandAnswering(e,()=>({op:"setCommentResolved",comment:this.commentHandle(),resolved:t}),n=>{m(n,e);});}get replies(){return this.#t??=It.of(this.context,`${this.path.label}.replies`,this.path,()=>({op:"getCommentReplies",comment:this.commentHandle()})),this.#t}getRange(){let t=`${this.path.label}.getRange`,e=b.promised(this.context,t,false);return this.read(t,()=>({op:"getCommentRange",comment:this.commentHandle()}),n=>{e.hydrateAddress({kind:"span",span:R(n,t)});}),e}reply(t){let e=`${this.path.label}.reply`;(typeof t!="string"||t.length===0)&&a({code:"InvalidArgument",target:e});let n=this.internals.author;(typeof n!="string"||n.trim().length===0)&&a({code:"NotSupported",target:e});let r=nt.promised(this.context,e,false);return this.commandAnswering(e,()=>({op:"replyToComment",comment:this.commentHandle(),text:t,author:n}),i=>{r.hydrateAddress({kind:"handle",handle:u(i,e)});}),r}onLoad(t){this.loadCommentFields(t,["resolved"]);}},z=class o extends x{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#t()}itemAt(t,e){return G.at(this.context,t,e)}promised(t,e){return G.promised(this.context,t,e)}},et=class o extends p{static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get author(){return this.loadedProperty("author")}get date(){return this.loadedProperty("date")}get type(){return this.loadedProperty("type")}get range(){let t=`${this.path.label}.range`,e=b.promised(this.context,t,false);return this.read(t,()=>({op:"getRevisionRange",revision:this.#t()}),n=>{e.hydrateAddress({kind:"span",span:R(n,t)});}),e}accept(){this.command("accept",()=>({op:"acceptRevision",revision:this.#t()}));}reject(){this.command("reject",()=>({op:"rejectRevision",revision:this.#t()}));}onLoad(t){let e=this.selection(t,["author","date","type"]);if(e.includes("author")&&this.loadTextInto("author",()=>({op:"getRevisionAuthor",revision:this.#t()})),e.includes("type")&&this.loadTextInto("type",()=>({op:"getRevisionType",revision:this.#t()})),!e.includes("date"))return;let n=`${this.path.label}.date`;this.read(n,()=>({op:"getRevisionDate",revision:this.#t()}),r=>{this.setLoadedProperty("date",Oe(P(r,n)));});}static batchHandle(t,e){return (!(t instanceof o)||t.context!==e)&&a({code:"InvalidArgument",target:"RevisionCollection.resolve"}),t.#t()}#t(){return this.requireAddressable(),this.path.handle()}},Q=class o extends x{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}acceptAll(){let t=this.#t;this.commandOn("acceptAll",()=>({op:"acceptAllRevisions",body:t}));}rejectAll(){let t=this.#t;this.commandOn("rejectAll",()=>({op:"rejectAllRevisions",body:t}));}resolve(t,e){let n=`${this.path.label}.resolve`;(!["accept","reject"].includes(t)||e!==void 0&&!Array.isArray(e))&&a({code:"InvalidArgument",target:n});let r=e===void 0?void 0:[...e],{result:i,fill:s}=ue(n);return this.enqueue({sort:"write",label:n,plan:()=>({op:"resolveRevisionBatch",body:this.#t,action:t,...r===void 0?{}:{revisions:r.map(d=>et.batchHandle(d,this.context))}}),settle:d=>{d.kind!=="revisionBatch"&&a({code:"GeneralException",target:n}),s(d.result);}}),i}listing(){return {op:"getRevisions",body:this.#t}}itemAt(t,e){return et.at(this.context,t,e)}promised(t,e){return et.promised(this.context,t,e)}commandOn(t,e){let n=`${this.path.label}.${t}`;this.enqueue({sort:"write",label:n,plan:e,settle:r=>{m(r,n);}});}};var tn=new Set(["matchCase","matchWholeWord","ignorePunct","ignoreSpace","matchWildcards"]);function Mt(o,t){if(o===void 0)return;typeof o!="object"&&a({code:"InvalidArgument",target:t});for(let[n,r]of Object.entries(o))tn.has(n)||a({code:"InvalidArgument",target:`${t}.${n}`}),r!==void 0&&typeof r!="boolean"&&a({code:"InvalidArgument",target:`${t}.${n}`});let e={...o.matchCase===void 0?{}:{matchCase:o.matchCase},...o.matchWholeWord===void 0?{}:{matchWholeWord:o.matchWholeWord},...o.ignorePunct===void 0?{}:{ignorePunct:o.ignorePunct},...o.ignoreSpace===void 0?{}:{ignoreSpace:o.ignoreSpace},...o.matchWildcards===void 0?{}:{matchWildcards:o.matchWildcards}};return Object.keys(e).length===0?void 0:e}var b=class o extends p{#t;#n;#e;#o;#i;#s;static at(t,e,n){return n.kind!=="span"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.ofSpan(e,n.span),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="span"?this.path.resolveToSpan(t.span):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get text(){return this.loadedProperty("text")}get font(){return this.#i??=E.of(this.context,`${this.path.label}.font`,this.path,"span"),this.#i}get paragraphs(){return this.#o??=L.of(this.context,`${this.path.label}.paragraphs`,this.path),this.#o}get style(){return this.loadedProperty("style")}set style(t){let e=`${this.path.label}.style`,n=at(t,e);this.requireAddressable(),this.command("style",()=>({op:"setStyle",span:O(this.path,"span"),name:n}));}get hyperlink(){return this.loadedProperty("hyperlink")}set hyperlink(t){let e=`${this.path.label}.hyperlink`;(typeof t!="string"||t.length>2048)&&a({code:"InvalidArgument",target:e}),this.requireUsablePath(),this.command("hyperlink",()=>({op:"setHyperlink",span:this.#r(),target:t}));}get bookmarks(){let t=this.#r();return this.#s??=X.of(this.context,`${this.path.label}.bookmarks`,this.path,()=>({op:"getBookmarks",scope:{start:t.start,end:t.end}})),this.#s}search(t,e){let n=`${this.path.label}.search`;typeof t!="string"&&a({code:"InvalidArgument",target:n});let r=Mt(e,n),i=this.#r();return N.of(this.context,n,this.path,()=>({op:"search",scope:i,text:t,options:{...r??{},projection:this.revisionTextView()}}))}insertText(t,e){let n=`${this.path.label}.insertText`,r=k(t,n),i=Pt(e,n);this.requireUsablePath();let s=o.promised(this.context,n,false);return this.commandAnswering(n,()=>{let d=this.#r();return i==="Replace"?{op:"replaceSpan",span:d,text:r}:{op:"insertText",at:i==="Start"||i==="Before"?d.start:d.end,text:r}},d=>{s.hydrateAddress({kind:"span",span:R(d,n)});}),s}delete(){this.requireUsablePath(),this.commandDiscarding("delete",()=>({op:"replaceSpan",span:this.#r(),text:""}));}clear(){let t=this.#r();this.commandDiscarding("clear",()=>({op:"replaceSpan",span:t,text:""}));}insertComment(t){let e=`${this.path.label}.insertComment`;(typeof t!="string"||t.length===0)&&a({code:"InvalidArgument",target:e});let n=this.internals.author;(typeof n!="string"||n.trim().length===0)&&a({code:"NotSupported",target:e});let r=G.promised(this.context,e,false);return this.commandAnswering(e,()=>({op:"insertComment",span:this.#r(),text:t,author:n}),i=>{i.kind!=="handle"&&a({code:"GeneralException",target:e}),r.hydrateAddress(i);}),r}insertContentControl(t){let e=`${this.path.label}.insertContentControl`,n=t??"RichText";n!=="RichText"&&n!=="PlainText"&&a({code:"NotSupported",target:e});let r=q.promised(this.context,e,false);return this.commandAnswering(e,()=>({op:"insertContentControl",span:this.#r(),subtype:n==="PlainText"?"plainText":"richText",returnHandle:true}),i=>{i.kind!=="handle"&&a({code:"GeneralException",target:e}),r.hydrateAddress(i);}),r}get tables(){return this.requireUsablePath(),this.#t??=U.over(this.context,`${this.path.label}.tables`,this.path,()=>O(this.path,"span"))}get fields(){return this.requireUsablePath(),this.#n??=M.of(this.context,`${this.path.label}.fields`,this.path,"span")}insertField(t,e,n,r){let i=`${this.path.label}.insertField`;(e!==void 0&&typeof e!="string"||n!==void 0&&typeof n!="string"||r!==void 0&&typeof r!="boolean")&&a({code:"InvalidArgument",target:i});let s=Pt(t,i);this.requireUsablePath();let d=H.promised(this.context,i,false);return this.commandAnswering(i,()=>({op:"insertField",span:this.#r(),location:s,...e===void 0?{}:{fieldType:e},...n===void 0?{}:{text:n},...r===void 0?{}:{removeFormatting:r}}),h=>d.hydrateAddress({kind:"handle",handle:u(h,i)})),d}get inlinePictures(){return this.requireUsablePath(),this.#e??=V.of(this.context,`${this.path.label}.inlinePictures`,this.path,"span")}insertInlinePictureFromBase64(t,e){let n=`${this.path.label}.insertInlinePictureFromBase64`;(typeof t!="string"||t.length===0)&&a({code:"InvalidArgument",target:n});let r=Pt(e,n);this.requireUsablePath();let i=F.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"insertInlinePicture",span:this.#r(),base64:t,location:r}),s=>{i.hydrateAddress({kind:"handle",handle:u(s,n)});}),i}insertBreak(t,e){let n=`${this.path.label}.insertBreak`;e!=="Before"&&e!=="After"&&a({code:"InvalidArgument",target:n});let r=e;this.requireUsablePath(),this.commandAnswering(n,()=>({op:"insertBreak",span:this.#r(),breakType:t,location:r}),i=>m(i,n));}insertTable(t,e,n,r){let i=`${this.path.label}.insertTable`;(!Number.isInteger(t)||!Number.isInteger(e)||t<1||e<1||!["Before","After"].includes(n))&&a({code:"InvalidArgument",target:i}),r!==void 0&&(!Array.isArray(r)||r.some(h=>!Array.isArray(h)||h.some(v=>typeof v!="string")))&&a({code:"InvalidArgument",target:i});let s=r?.map(h=>[...h]),d=W.promised(this.context,i);return this.commandAnswering(i,()=>({op:"insertTable",span:O(this.path,"span"),location:n,rowCount:t,columnCount:e,...s?{values:s}:{}}),h=>{h.kind!=="handle"&&a({code:"GeneralException",target:i}),d.hydrateAddress({kind:"handle",handle:h.handle});}),d}insertParagraph(t,e){let n=`${this.path.label}.insertParagraph`,r=k(t,n),i=Pt(e,n);i!=="Before"&&i!=="After"&&a({code:"InvalidArgument",target:n});let s=this.#r(),d=i==="Before"?s.start.paragraph:s.end.paragraph,h=w.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"insertParagraph",anchor:{paragraph:d},where:i==="Before"?"before":"after",text:r}),v=>{v.kind!=="handle"&&a({code:"GeneralException",target:n}),h.hydrateAddress({kind:"handle",handle:v.handle});}),h}select(t){let e=`${this.path.label}.select`,n=Bt(t,e);this.requireAddressable(),this.internals.capabilities.selection||a({code:"NotSupported",target:e});let r=this.#r();this.command("select",()=>({op:"selectSpan",span:r,mode:n==="Select"?"select":n==="Start"?"start":"end"}));}onLoad(t){let e=this.selection(t,["text","style","hyperlink"]);if(e.includes("hyperlink")&&this.loadTextInto("hyperlink",()=>({op:"getHyperlink",span:this.#r()})),e.includes("text")){let r=`${this.path.label}.text`;this.read(r,()=>({op:"getSpanText",span:this.#r(),projection:this.revisionTextView()}),i=>{this.setLoadedProperty("text",P(i,r));});}if(!e.includes("style"))return;let n=`${this.path.label}.style`;this.requireUsablePath(),this.read(n,()=>({op:"getStyle",span:O(this.path,"span")}),r=>{this.setLoadedProperty("style",xt(r,n));});}#r(){return this.requireAddressable(),this.path.span()}};var ut=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get name(){return this.loadedProperty("name")}get range(){return this.#t??=this.#n(`${this.path.label}.range`),this.#t}select(t){let e=`${this.path.label}.select`,n=Bt(t,e);this.requireUsablePath(),this.internals.capabilities.selection||a({code:"NotSupported",target:e}),this.command("select",()=>({op:"selectBookmark",bookmark:this.#e(),mode:n==="Select"?"select":n==="Start"?"start":"end"}));}onLoad(t){if(!this.selection(t,["name"]).includes("name"))return;let e=`${this.path.label}.name`;this.read(e,()=>({op:"getBookmarkName",bookmark:this.#e()}),n=>{this.setLoadedProperty("name",P(n,e));});}#n(t){let e=b.promised(this.context,t,false);return this.read(t,()=>({op:"getBookmarkRange",bookmark:this.#e()}),n=>{e.hydrateAddress({kind:"span",span:R(n,t)});}),e}#e(){return this.requireAddressable(),this.path.handle()}},X=class o extends x{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}listing(){return this.#t()}itemAt(t,e){return ut.at(this.context,t,e)}promised(t,e){return ut.promised(this.context,t,e)}};var I=class o extends p{#t;#n;#e;#o;#i;#s;#r;#a;#l;static main(t,e){return new o(t,c.of(e,J(t).roots().body))}static promisedStory(t,e){return new o(t,c.pending(e))}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}constructor(t,e){super(t,e);}get text(){return this.loadedProperty("text")}get paragraphs(){return this.#o??=this.paragraphsUnder(`${this.path.label}.paragraphs`),this.#o}get bookmarks(){let t=this.#d();return this.#i??=X.of(this.context,`${this.path.label}.bookmarks`,this.path,()=>({op:"getBookmarks",scope:{body:t}})),this.#i}get font(){return this.#s??=E.of(this.context,`${this.path.label}.font`,this.path,"body"),this.#s}paragraphsUnder(t){return L.of(this.context,t,this.path)}get style(){return this.loadedProperty("style")}set style(t){let e=`${this.path.label}.style`,n=at(t,e);this.requireAddressable(),this.command("style",()=>({op:"setStyle",span:O(this.path,"body"),name:n}));}get lists(){return this.#r??=ct.of(this.context,`${this.path.label}.lists`,this.path,this.#d()),this.#r}get contentControls(){return this.#a??=B.of(this.context,`${this.path.label}.contentControls`,this.path,{body:this.#d()}),this.#a}getComments(){let t=`${this.path.label}.getComments`,e=this.#d();return z.of(this.context,t,this.path,()=>({op:"getComments",scope:{body:e}}))}get revisions(){return this.#l??=Q.of(this.context,`${this.path.label}.revisions`,this.path,this.#d()),this.#l}getRange(t="Whole"){let e=`${this.path.label}.getRange`;this.requireUsablePath();let n=b.promised(this.context,e,false);return this.read(e,()=>({op:"getRange",span:{body:this.path.handle()},location:t}),r=>{n.hydrateAddress({kind:"span",span:R(r,e)});}),n}search(t,e){let n=`${this.path.label}.search`;typeof t!="string"&&a({code:"InvalidArgument",target:n});let r=Mt(e,n),i=this.#d();return N.of(this.context,n,this.path,()=>({op:"search",scope:{body:i},text:t,options:{...r??{},projection:this.revisionTextView()}}))}clear(){let t=this.#d();this.commandDiscarding("clear",()=>({op:"replaceSpan",span:{body:t},text:""}));}insertText(t,e){let n=`${this.path.label}.insertText`,r=k(t,n),i=be(e,n);this.requireUsablePath();let s=b.promised(this.context,n,false);return this.commandAnswering(n,()=>i==="Replace"?{op:"replaceSpan",span:{body:this.#d()},text:r}:{op:"insertText",at:{body:this.#d(),at:i==="Start"?"start":"end"},text:r},d=>{s.hydrateAddress({kind:"span",span:R(d,n)});}),s}insertParagraph(t,e){let n=`${this.path.label}.insertParagraph`,r=k(t,n),i=ye(e,n),s=this.#d(),d=w.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"insertParagraph",anchor:{body:s,at:i==="Start"?"first":"last"},where:i==="Start"?"before":"after",text:r}),h=>{h.kind!=="handle"&&a({code:"GeneralException",target:n}),d.hydrateAddress({kind:"handle",handle:h.handle});}),d}onLoad(t){let e=this.selection(t,["text","style"]);e.includes("text")&&this.loadTextInto("text",()=>({op:"getText",target:this.#d(),projection:this.revisionTextView()})),e.includes("style")&&this.#c();}#c(){let t=`${this.path.label}.style`;this.requireUsablePath(),this.read(t,()=>({op:"getStyle",span:O(this.path,"body")}),e=>{this.setLoadedProperty("style",xt(e,t));});}get fields(){return this.requireUsablePath(),this.#n??=M.of(this.context,`${this.path.label}.fields`,this.path,"body")}get inlinePictures(){return this.requireUsablePath(),this.#e??=V.of(this.context,`${this.path.label}.inlinePictures`,this.path,"body")}get tables(){return this.requireUsablePath(),this.#t??=U.over(this.context,`${this.path.label}.tables`,this.path,()=>({body:this.#d()}))}#d(){return this.requireAddressable(),this.path.handle()}};function en(o){return o==="endnote"?"Endnote":"Footnote"}var mt=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get type(){return this.loadedProperty("type")}get text(){return this.loadedProperty("text")}get body(){if(this.#t)return this.#t;let t=`${this.path.label}.body`,e=I.promisedStory(this.context,t);return this.read(t,()=>({op:"getNoteBody",note:this.#n()}),n=>{e.hydrateAddress({kind:"handle",handle:u(n,t)});}),this.#t=e,e}delete(){this.command("delete",()=>({op:"deleteNote",note:this.#n()}));}getNext(){let t=`${this.path.label}.getNext`,e=o.promised(this.context,t,false),n=this.internals.roots().document,r=`${t}.type`,i="footnote",s=c.pending(r);return this.read(r,()=>({op:"getNoteKind",note:this.#n()}),d=>{i=P(d,r)==="endnote"?"endnote":"footnote",s.resolveTo(this.#n());}),this.enqueue({sort:"read",label:t,dependencies:[s],plan:()=>({op:"getNotes",document:n,noteKind:i}),settle:d=>{let h=A(d,t),v=h.findIndex(rt=>rt.ref===this.#n().ref),K=v<0?void 0:h[v+1];K||a({code:"ItemNotFound",target:t}),e.hydrateAddress({kind:"handle",handle:K});}}),e}onLoad(t){let e=this.selection(t,["text","type"]);if(e.includes("text")&&this.loadTextInto("text",()=>({op:"getNoteText",note:this.#n(),projection:this.revisionTextView()})),e.includes("type")){let n=`${this.path.label}.type`;this.read(n,()=>({op:"getNoteKind",note:this.#n()}),r=>{this.setLoadedProperty("type",en(P(r,n)));});}}#n(){return this.requireAddressable(),this.path.handle()}},ot=class o extends x{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#t()}itemAt(t,e){return mt.at(this.context,t,e)}promised(t,e){return mt.promised(this.context,t,e)}};var nn=Object.freeze({Primary:"default",FirstPage:"first",EvenPages:"even"}),on=["pageWidth","pageHeight","orientation","topMargin","rightMargin","bottomMargin","leftMargin"],kt=class o extends p{#t;static of(t,e,n){return new o(t,c.derived(e,n))}constructor(t,e){super(t,e);}get pageWidth(){return this.loadedProperty("pageWidth")}set pageWidth(t){this.#n("pageWidth",gt(t,`${this.path.label}.pageWidth`));}get pageHeight(){return this.loadedProperty("pageHeight")}set pageHeight(t){this.#n("pageHeight",gt(t,`${this.path.label}.pageHeight`));}get orientation(){return this.loadedProperty("orientation")}set orientation(t){let e=`${this.path.label}.orientation`;t!=="Portrait"&&t!=="Landscape"&&a({code:"InvalidArgument",target:e}),this.#n("orientation",t==="Portrait"?"portrait":"landscape");}get topMargin(){return this.loadedProperty("topMargin")}set topMargin(t){this.#n("topMargin",gt(t,`${this.path.label}.topMargin`));}get bottomMargin(){return this.loadedProperty("bottomMargin")}set bottomMargin(t){this.#n("bottomMargin",gt(t,`${this.path.label}.bottomMargin`));}get leftMargin(){return this.loadedProperty("leftMargin")}set leftMargin(t){this.#n("leftMargin",gt(t,`${this.path.label}.leftMargin`));}get rightMargin(){return this.loadedProperty("rightMargin")}set rightMargin(t){this.#n("rightMargin",gt(t,`${this.path.label}.rightMargin`));}onLoad(t){let e=this.selection(t,on);if(e.length===0)return;let n=`${this.path.label}.pageSetup`;this.read(n,()=>({op:"getPageSetup",section:this.#e()}),r=>{let i=Gt(r,n);for(let s of e)this.setLoadedProperty(s,s==="orientation"?i.orientation==="landscape"?"Landscape":"Portrait":i[s]);});}#n(t,e){if(this.requireUsablePath(),this.#t){this.#t[t]=e;return}let n={[t]:e};this.#t=n;let r=`${this.path.label}.${t}`;this.commandAnswering(`${this.path.label}.pageSetup`,()=>({op:"setPageSetup",section:this.#e(),setup:n}),i=>{m(i,r);},()=>{this.#t===n&&(this.#t=void 0);});}#e(){this.requireAddressable();let t=this.path.address();return t.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.path.label}),t.handle}},ft=class o extends p{#t;#n;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get body(){return this.#n??=I.main(this.context,`${this.path.label}.body`),this.#n}get pageSetup(){return this.#t??=kt.of(this.context,`${this.path.label}.pageSetup`,this.path),this.#t}getHeader(t){return this.#e("header",t,"getHeader")}getFooter(t){return this.#e("footer",t,"getFooter")}getNext(){let t=`${this.path.label}.getNext`,e=o.promised(this.context,t,false),n=this.internals.roots().document;return this.read(t,()=>({op:"getSections",document:n}),r=>{let i=A(r,t),s=i.findIndex(h=>h.ref===this.#o().ref),d=s<0?void 0:i[s+1];d||a({code:"ItemNotFound",target:t}),e.hydrateAddress({kind:"handle",handle:d});}),e}onLoad(t){this.selection(t,[]);}#e(t,e,n){let r=`${this.path.label}.${n}`,i=nn[e];i===void 0&&a({code:"InvalidArgument",target:r});let s=I.promisedStory(this.context,r);return this.read(r,()=>({op:"getFurniture",section:this.#o(),kind:t,variant:i}),d=>{s.hydrateAddress({kind:"handle",handle:u(d,r)});}),s}#o(){return this.requireAddressable(),this.path.handle()}},bt=class o extends x{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#t()}itemAt(t,e){return ft.at(this.context,t,e)}promised(t,e){return ft.promised(this.context,t,e)}};function gt(o,t){return (typeof o!="number"||!Number.isFinite(o)||o<0)&&a({code:"InvalidArgument",target:t}),o}var yt=class o extends p{#t;#n;#e;#o;#i;#s;#r;#a;static open(t){return new o(t)}constructor(t){super(t,c.of("document",J(t).roots().document));}get changeTrackingMode(){return this.loadedProperty("changeTrackingMode")}set changeTrackingMode(t){["Off","TrackAll","TrackMineOnly"].includes(t)||a({code:"InvalidArgument",target:"document.changeTrackingMode"});let e=this.internals.author;this.commandAnswering("document.changeTrackingMode",()=>({op:"setChangeTrackingMode",mode:t,...e===void 0?{}:{author:e}}),()=>this.setLoadedProperty("changeTrackingMode",t));}get body(){return this.#t??=I.main(this.context,"document.body"),this.#t}get paragraphs(){return this.#n??=this.body.paragraphsUnder("document.paragraphs"),this.#n}get sections(){let t=this.path.handle();return this.#e??=bt.of(this.context,"document.sections",this.path,()=>({op:"getSections",document:t})),this.#e}get contentControls(){return this.#s??=B.of(this.context,"document.contentControls",this.path,{body:this.internals.roots().body}),this.#s}get comments(){return this.#o??=z.of(this.context,"document.comments",this.path,()=>({op:"getComments",scope:{body:this.internals.roots().body}})),this.#o}get revisions(){return this.#i??=Q.of(this.context,"document.revisions",this.path,this.internals.roots().body),this.#i}get footnotes(){let t=this.path.handle();return this.#r??=ot.of(this.context,"document.footnotes",this.path,()=>({op:"getNotes",document:t,noteKind:"footnote"})),this.#r}get endnotes(){let t=this.path.handle();return this.#a??=ot.of(this.context,"document.endnotes",this.path,()=>({op:"getNotes",document:t,noteKind:"endnote"})),this.#a}onLoad(t){if(t.select.length===0)return;this.selection(t,["changeTrackingMode"]).includes("changeTrackingMode")&&this.loadTextInto("changeTrackingMode",()=>({op:"getChangeTrackingMode"}));}};function Ft(o){let t=o.host,e=Object.freeze({...t.capabilities,save:o.save&&t.capabilities.save}),n=typeof o.author=="string"&&o.author.trim().length>0?o.author:void 0,r=o.revisionTextView??"allMarkup";r!=="allMarkup"&&r!=="original"&&a({code:"InvalidArgument",target:"revisionTextView"});let i=false,s=null,d=g=>{i&&a({code:"RuntimeDisposed",...g===void 0?{}:{target:g}});},h=()=>{if(s)return s;d("document");let g=Ie(t.execute({operations:[{op:"getDocument"}]}),"document"),Z=Ie(t.execute({operations:[{op:"getBody",document:g}]}),"document.body");return s={document:g,body:Z},s},v={host:t,capabilities:e,...n===void 0?{}:{author:n},revisionTextView:r,id:{},roots:h,assertLive:d,openDocument:g=>yt.open(g)};try{h();}catch{s=null;}async function K(g,Z){d();let it=typeof g=="function"?g:Z,Vt=typeof g=="function"?[]:Array.isArray(g)?g:[g];typeof it!="function"&&a({code:"InvalidArgument",target:"run"});let{context:wt,adopt:y,finish:Se}=vt.begin(v);try{return y(Vt),await it(wt)}finally{Se();}}let rt={capabilities:e,run:K,dispose(){i||(i=true,s=null,t.dispose());}};return o.save?{...rt,async save(){d("save"),e.save||a({code:"NotSupported",target:"save"});let g=t.save();if(!g.ok)throw Dt(g.error,{target:"save"});return g.bytes}}:rt}function Ie(o,t){let e=o.results[0];if(e?.status==="error")throw Dt(e.error,{target:t});if(e?.status!=="ok")throw new C({code:"GeneralException",target:t});return u(e.value,t)}function ke(o,t={}){return Ft({host:createBrowserAutomationHost(o),save:false,...t.author===void 0?{}:{author:t.author},...t.revisionTextView===void 0?{}:{revisionTextView:t.revisionTextView}})}function Le(o){return createAutomationPaginationProvider(o)}function dn(o){if(o){for(let t of o)if(t.collaboration)return t.collaboration}}function ln(o){let t=[o?.zip?.maxEntries,o?.zip?.maxTotalBytes,o?.xml?.maxBytes,o?.xml?.maxElements,o?.maxXmlParts,o?.maxRelationships],e=o?.zip?.maxRatio;(t.some(n=>n!==void 0&&(!Number.isInteger(n)||n<0))||e!==void 0&&(!Number.isFinite(e)||e<0))&&a({code:"InvalidArgument",target:"createServer"});}async function se(o,t={}){ln(t.limits);let e=dn(t.modules),n=createServerAutomationHost(o,{...t.pagination?{pagination:Le(t.pagination)}:{},...t.limits===void 0?{}:{limits:t.limits},...e===void 0?{}:{collaborationModel:e}});if(!n.ok){let r={"too-many-entries":"zip.maxEntries","too-large":"xml.maxBytes","too-many-elements":"xml.maxElements","too-deep":"xml.maxDepth","too-many-xml-parts":"maxXmlParts","too-many-relationships":"maxRelationships"},i=n.limit??r[n.reason];a({code:i===void 0?"InvalidArgument":"ResourceLimitExceeded",target:"createServer",...i===void 0?{}:{limit:i}});}return Ft({host:n.host,save:true,...t.author===void 0?{}:{author:t.author},...t.revisionTextView===void 0?{}:{revisionTextView:t.revisionTextView}})}function we(o,t,e={}){return se(o,{...e,modules:[...e.modules??[],{id:"collaboration",collaboration:{session:t}}]})}var de=(l=>(l.addin="Addin",l.addressBlock="AddressBlock",l.advance="Advance",l.ask="Ask",l.author="Author",l.autoText="AutoText",l.autoTextList="AutoTextList",l.barCode="BarCode",l.bibliography="Bibliography",l.bidiOutline="BidiOutline",l.citation="Citation",l.comments="Comments",l.compare="Compare",l.createDate="CreateDate",l.data="Data",l.database="Database",l.date="Date",l.displayBarcode="DisplayBarcode",l.docProperty="DocProperty",l.docVariable="DocVariable",l.editTime="EditTime",l.embedded="Embedded",l.empty="Empty",l.eq="EQ",l.expression="Expression",l.fileName="FileName",l.fileSize="FileSize",l.fillIn="FillIn",l.formCheckbox="FormCheckbox",l.formDropdown="FormDropdown",l.formText="FormText",l.gotoButton="GotoButton",l.greetingLine="GreetingLine",l.hyperlink="Hyperlink",l.if="If",l.import="Import",l.include="Include",l.includePicture="IncludePicture",l.includeText="IncludeText",l.index="Index",l.info="Info",l.keywords="Keywords",l.lastSavedBy="LastSavedBy",l.link="Link",l.listNum="ListNum",l.macroButton="MacroButton",l.mergeBarcode="MergeBarcode",l.mergeField="MergeField",l.mergeRec="MergeRec",l.mergeSeq="MergeSeq",l.next="Next",l.nextIf="NextIf",l.noteRef="NoteRef",l.numChars="NumChars",l.numPages="NumPages",l.numWords="NumWords",l.ocx="OCX",l.others="Others",l.page="Page",l.pageRef="PageRef",l.print="Print",l.printDate="PrintDate",l.private="Private",l.quote="Quote",l.rd="RD",l.ref="Ref",l.revNum="RevNum",l.saveDate="SaveDate",l.section="Section",l.sectionPages="SectionPages",l.seq="Seq",l.set="Set",l.shape="Shape",l.skipIf="SkipIf",l.styleRef="StyleRef",l.subject="Subject",l.subscriber="Subscriber",l.symbol="Symbol",l.ta="TA",l.tc="TC",l.template="Template",l.time="Time",l.title="Title",l.toa="TOA",l.toc="TOC",l.undefined="Undefined",l.userAddress="UserAddress",l.userInitials="UserInitials",l.userName="UserName",l.xe="XE",l))(de||{});var Xi=Object.freeze({createBrowser:ke,createServer:se,createCollaborative:we});export{Zt as Alignment,I as Body,ut as Bookmark,X as BookmarkCollection,te as BreakType,Jt as ChangeTrackingMode,$ as ClientObject,Tt as ClientResult,G as Comment,z as CommentCollection,nt as CommentReply,It as CommentReplyCollection,q as ContentControl,B as ContentControlCollection,ee as ContentControlType,yt as Document,Xi as DocxEditor,C as DocxEditorError,H as Field,M as FieldCollection,de as FieldType,E as Font,F as InlinePicture,V as InlinePictureCollection,Kt as InsertLocation,j as List,oe as ListBullet,ct as ListCollection,ht as ListItem,re as ListNumbering,mt as NoteItem,ot as NoteItemCollection,Yt as PageOrientation,kt as PageSetup,w as Paragraph,L as ParagraphCollection,b as Range,N as RangeCollection,vt as RequestContext,et as Revision,Q as RevisionCollection,ft as Section,bt as SectionCollection,W as Table,tt as TableCell,Rt as TableCellCollection,U as TableCollection,st as TableRow,dt as TableRowCollection,Ct as TrackedObjects,ie as UnderlineType,_t as VerticalAlignment,je as isDocxEditorError};
1
+ import {createBrowserAutomationHost}from'@docx-editor.dev/core/editor';import {createServerAutomationHost,createAutomationPaginationProvider}from'@docx-editor.dev/core/automation';var pe=Object.freeze({PropertyNotLoaded:"the property has not been loaded. Call load(...) and await context.sync() before reading it.",ValueNotLoaded:"the result has not been filled in yet. Await context.sync() before reading it.",InvalidObjectPath:"the object cannot be addressed. Await context.sync() after creating an object with an edit. Keep proxies within their run, or use context.trackedObjects.add(...) before the run ends.",ObjectInUse:"the object still belongs to a run that has not finished. Await that run before passing the object to another one.",InvalidArgument:"the argument is not one this API accepts.",ResourceLimitExceeded:"the document exceeds a supported resource limit.",ItemNotFound:"the collection has no such item.",NotSupported:"the operation or argument is outside this document or host\u2019s supported capabilities.",NotImplemented:"this version does not implement that yet.",ConflictingChanges:"these operations cannot share one atomic batch. Split them across separate context.sync() calls.",InvalidRequestContext:"the request context has finished. Start another run to continue.",RuntimeDisposed:"the runtime has been disposed.",StaleDocument:"the document changed after this context read it, so nothing was applied.",DocumentUnavailable:"the document is not available right now.",GeneralException:"the document could not complete the request."}),A=class extends Error{code;limit;target;expectedRevision;actualRevision;constructor(t){let e=t.target?`${pe[t.code]} (${t.target})`:pe[t.code];super(e),this.name="DocxEditorError",this.code=t.code,t.limit!==void 0&&(this.limit=t.limit),t.target!==void 0&&(this.target=t.target),t.expectedRevision!==void 0&&(this.expectedRevision=t.expectedRevision),t.actualRevision!==void 0&&(this.actualRevision=t.actualRevision);}};function De(o){return o instanceof A?true:typeof o=="object"&&o!==null&&o.name==="DocxEditorError"&&typeof o.code=="string"}function s(o){throw new A(o)}var _=Symbol("docx-editor.runtime.internals"),Tt=Symbol("docx-editor.runtime.release"),Et=Symbol("docx-editor.runtime.rebind");function tt(o){return o[_]}var Ne=new Set(["select","expand","top","skip"]),qe=/^[A-Za-z][A-Za-z0-9]*$/;function ue(o,t){if(o===void 0)return [];let e=typeof o=="string"?o.split(",").map(r=>r.trim()):Array.isArray(o)?o.map(r=>typeof r=="string"?r.trim():r):s({code:"InvalidArgument",target:t}),n=[];for(let r of e)(typeof r!="string"||!qe.test(r))&&s({code:"InvalidArgument",target:t}),n.includes(r)||n.push(r);return n.length===0&&s({code:"InvalidArgument",target:t}),n}function me(o,t){return (typeof o!="number"||!Number.isInteger(o)||o<0)&&s({code:"InvalidArgument",target:t}),o}function Be(o,t){o===void 0||Array.isArray(o)&&o.length===0||s({code:"InvalidArgument",target:t});}function ge(o,t){if(o===void 0)return {select:[]};if(typeof o=="string"||Array.isArray(o))return {select:ue(o,t)};(typeof o!="object"||o===null)&&s({code:"InvalidArgument",target:t});let e=o;for(let n of Object.keys(e))Ne.has(n)||s({code:"InvalidArgument",target:`${t}.${n}`});return Be(e.expand,`${t}.expand`),{select:ue(e.select,`${t}.select`),...e.top===void 0?{}:{top:me(e.top,`${t}.top`)},...e.skip===void 0?{}:{skip:me(e.skip,`${t}.skip`)}}}var M=class{#t;#e;#n;#o;#i=new Map;#a=false;constructor(t,e,n={}){this.#t=t,this.#e=t[_],this.#n=e,this.#o=n.nullable===true,this.#e.register(this);}get context(){return this.#t}get isNullObject(){return this.#n.isReleased&&s({code:"InvalidObjectPath",target:this.#n.label}),this.#o?(this.#n.isPending&&s({code:"PropertyNotLoaded",target:`${this.#n.label}.isNullObject`}),this.#n.isNull):false}load(t){this.#a=true;try{return this.requireUsablePath(),this.onLoad(ge(t,this.#n.label)),this}finally{this.#a=false;}}get path(){return this.#n}get internals(){return this.#e}handle(){return this.#n.handle()}requireAddressable(){this.#n.isAddressable||s({code:"InvalidObjectPath",target:this.#n.label}),this.#e.assertUsable(this.#n.label);}requireUsablePath(){(this.#n.isReleased||this.#n.isNull&&!(this.#a&&this.#o))&&s({code:"InvalidObjectPath",target:this.#n.label}),this.#e.assertUsable(this.#n.label);}enqueue(t){this.requireUsablePath(),this.#e.queue.push({...t,dependencies:[...t.dependencies??[],this.#n],...this.#a&&this.#o&&t.sort==="read"?{nullableLoad:this.#n}:{}});}loadedProperty(t){return this.#n.isReleased&&!this.#i.has(t)&&s({code:"InvalidObjectPath",target:this.#n.label}),this.#i.has(t)||s({code:"PropertyNotLoaded",target:`${this.#n.label}.${t}`}),this.#i.get(t)}hasLoadedProperty(t){return this.#i.has(t)}setLoadedProperty(t,e){this.#i.set(t,e);}[Tt](){this.#n.release();}[Et](t){this.#t=t,this.#e=t[_];}};var Dt=class o{#t=false;#e;#n;constructor(t){this.#n=t;}get value(){return this.#t||s({code:"ValueNotLoaded",target:this.#n}),this.#e}get isLoaded(){return this.#t}static create(t){let e=new o(t);return {result:e,fill(n){e.#t=true,e.#e=n;}}}};function fe(o){return Dt.create(o)}function j(o){return new A({code:"GeneralException",target:o})}function P(o,t){if(o.kind!=="text")throw j(t);return o.text}function m(o,t){if(o.kind!=="handle")throw j(t);return o.handle}function R(o,t){if(o.kind!=="handles")throw j(t);return o.handles}function O(o,t){if(o.kind!=="span")throw j(t);return o.span}function Nt(o,t){if(o.kind!=="spans")throw j(t);return o.spans}function zt(o,t){if(o.kind!=="font")throw j(t);return o.font}function Qt(o,t){if(o.kind!=="paragraphFormat")throw j(t);return o.format}function At(o,t){if(o.kind!=="style")throw j(t);return o.name}function qt(o,t){if(o.kind!=="number")throw j(t);return o.value}function et(o,t){if(o.kind!=="flag")throw j(t);return o.value}function Xt(o,t){if(o.kind!=="pageSetup")throw j(t);return o.setup}function u(o,t){if(o.kind!=="applied")throw j(t)}var c=class o{label;#t;#e;constructor(t,e,n=null){this.label=t,this.#t=e,this.#e=n;}static of(t,e){return new o(t,{status:"resolved",address:{kind:"handle",handle:e}})}static ofSpan(t,e){return new o(t,{status:"resolved",address:{kind:"span",span:e}})}static pending(t){return new o(t,{status:"pending"})}static derived(t,e){return new o(t,{status:"pending"},e)}get state(){return this.#e?this.#e.state:this.#t}get isAddressable(){return this.state.status==="resolved"}get isPending(){return this.state.status==="pending"}get isNull(){return this.state.status==="null"}get isReleased(){return this.state.status==="released"}address(){let t=this.state;if(t.status==="resolved")return t.address;s({code:"InvalidObjectPath",target:this.label});}handle(){let t=this.address();return t.kind!=="handle"&&s({code:"InvalidObjectPath",target:this.label}),t.handle}span(){let t=this.address();return t.kind!=="span"&&s({code:"InvalidObjectPath",target:this.label}),t.span}resolveTo(t){this.#n({kind:"handle",handle:t});}resolveToSpan(t){this.#n({kind:"span",span:t});}resolveNull(){this.#t.status!=="released"&&(this.#t={status:"null"});}release(){this.#e||(this.#t={status:"released"});}#n(t){this.#t.status!=="released"&&(this.#t={status:"resolved",address:t});}};function be(o){let t=[],e=false,n=false;for(let r of o)t.push(r.plan()),r.sort==="write"?n=true:e=true;return {operations:t,hasRead:e,hasWrite:n}}var $e=Object.freeze({"stale-revision":"StaleDocument","invalid-handle":"InvalidObjectPath","invalid-offset":"InvalidArgument","unsupported-capability":"NotSupported",disposed:"RuntimeDisposed","transaction-refused":"GeneralException","unknown-operation":"NotSupported","unsupported-content":"InvalidArgument","unsupported-revision":"NotImplemented","ambiguous-document":"GeneralException","conflicting-operations":"ConflictingChanges","document-unavailable":"DocumentUnavailable"});function Bt(o,t={}){let e=$e[o.code]??"GeneralException",n=e==="StaleDocument";return new A({code:e,...t.target===void 0?{}:{target:t.target},...n&&t.expectedRevision!==void 0?{expectedRevision:t.expectedRevision}:{},...n&&t.actualRevision!==void 0?{actualRevision:t.actualRevision}:{}})}function Kt(o,t,e){for(let n=0;n<o.results.length;n+=1){let r=o.results[n];if(r?.status!=="error")continue;let i=t[n]?.label;return Bt(r.error,{...i===void 0?{}:{target:i},...e===void 0?{}:{expectedRevision:e},actualRevision:o.revision})}return new A({code:"GeneralException"})}function Zt(o,t){if(t.results.length!==o.length)throw new A({code:"GeneralException"});for(let e=0;e<o.length;e+=1){let n=t.results[e],r=o[e];if(n.status!=="ok")throw new A({code:"GeneralException",target:r.label});r.settle(n.value);}}var $t=class{#t=[];get size(){return this.#t.length}get pending(){return this.#t}push(t){this.#t.push(t);}take(){let t=this.#t;this.#t=[];for(let e of t)e.capture?.();return t}clear(){for(let t of this.#t)t.dispose?.();this.#t=[];}};function ye(o,t){if(Array.isArray(o)){for(let e of o)t(e);return}t(o);}var vt=class{#t;#e;constructor(t,e){this.#t=t,this.#e=e;}add(t){this.#t.assertUsable(),ye(t,e=>{this.#n(e),this.#t.track(e);});}remove(t){this.#t.assertUsable(),ye(t,e=>{this.#n(e),this.#t.untrack(e);});}#n(t){this.#e(t)||s({code:"InvalidObjectPath"});}};var Pt=class o{#t;#e=new $t;#n=new Set;#o=new Set;#i;#a;#r;#s=false;#d=null;#c=false;constructor(t){this.#t=t,this.#i={host:t.host,capabilities:t.capabilities,...t.author===void 0?{}:{author:t.author},revisionTextView:t.revisionTextView,queue:this.#e,session:t.id,roots:()=>t.roots(),assertUsable:e=>{this.#t.assertLive(e),this.#s&&s({code:"InvalidRequestContext",...e===void 0?{}:{target:e}});},isFinished:()=>this.#s,readRevision:()=>this.#d,register:e=>{this.#n.add(e);},track:e=>{this.#o.add(e);},untrack:e=>{this.#o.delete(e);},isTracked:e=>this.#o.has(e),disown:e=>{this.#n.delete(e),this.#o.delete(e);}},this.#a=new vt(this.#i,e=>this.#n.has(e));}get document(){return this.#i.assertUsable("document"),this.#r??=this.#t.openDocument(this),this.#r}get capabilities(){return this.#t.capabilities}get trackedObjects(){return this.#a}async sync(){this.#i.assertUsable(),this.#c&&s({code:"InvalidRequestContext"});let t=this.#e.take();if(t.length!==0){this.#c=true;try{let e=t.filter(a=>!a.nullableLoad?.isNull),n=t.some(a=>a.sort==="write"),r,i=a=>a.dependencies?.some(d=>!d.isAddressable)??false;for(;e.some(i);){r??=n&&this.#d!==null?this.#d:this.#t.host.revision();let a=e.filter(h=>h.sort==="read"&&!i(h));a.length===0&&s({code:"InvalidObjectPath",target:e.find(i)?.label}),await this.#h(a,r);let d=new Set(a);e=e.filter(h=>!d.has(h)&&!h.nullableLoad?.isNull);}if(e.length){let a=r??(n&&this.#d!==null?this.#d:void 0);await this.#h(e,a);}}finally{for(let e of t)e.dispose?.();this.#c=false;}}}async#h(t,e){let n=be(t),r={operations:n.operations,...e===void 0?{}:{expectedRevision:e}};if(this.#t.host.prepare){let a={...r,expectedRevision:r.expectedRevision??this.#t.host.revision()};await this.#t.host.prepare(a);let d=this.#t.host.execute(a);if(!d.ok)throw Kt(d,t,a.expectedRevision);Zt(t,d),this.#d=d.revision;return}let i=this.#t.host.execute(r);if(!i.ok)throw Kt(i,t,e);Zt(t,i),(n.hasRead||n.hasWrite)&&(this.#d=i.revision);}get[_](){return this.#i}static begin(t){let e=new o(t);return {context:e,adopt(n){for(let r of n)e.#p(r);},finish(){e.#u();}}}#p(t){let e=t.context;if(e===this)return;let n=e[_];if(n.session!==this.#t.id)throw new A({code:"InvalidObjectPath"});if(!n.isFinished())throw new A({code:"ObjectInUse"});if(!n.isTracked(t))throw new A({code:"InvalidObjectPath"});let r=n.readRevision();n.disown(t),t[Et](this),this.#n.add(t),this.#o.add(t),r!==null&&this.#l(r);}#l(t){this.#d=this.#d===null?t:Math.min(this.#d,t);}#u(){if(!this.#s){this.#s=true,this.#e.clear();for(let t of this.#n)this.#o.has(t)||t[Tt]();this.#n.clear();}}};function Rt(o,t,e){if(o.select.length===0)return t;for(let n of o.select)t.includes(n)||s({code:"InvalidArgument",target:`${e}.${n}`});return o.select}var p=class extends M{revisionTextView(){return tt(this.context).revisionTextView}loadTextInto(t,e){let n=`${this.path.label}.${t}`;this.enqueue({sort:"read",label:n,plan:e,settle:r=>{this.setLoadedProperty(t,P(r,n));}});}command(t,e,n){let r=`${this.path.label}.${t}`;this.enqueue({sort:"write",label:r,plan:e,settle:i=>u(i,r),...n?{capture:n,dispose:n}:{}});}commandDiscarding(t,e){let n=`${this.path.label}.${t}`;this.enqueue({sort:"write",label:n,plan:e,settle:()=>{}});}commandAnswering(t,e,n,r){this.enqueue({sort:"write",label:t,plan:e,settle:n,...r?{capture:r,dispose:r}:{}});}read(t,e,n){this.enqueue({sort:"read",label:t,plan:e,settle:n});}selection(t,e){return Rt(t,e,this.path.label)}onLoad(t){this.selection(t,[]);}};var He=["author","title","subject","keywords","comments","category","lastAuthor"],dt=class o extends p{#t;static of(t,e){return new o(t,c.derived("document.properties",e))}constructor(t,e){super(t,e);}get lastAuthor(){return this.loadedProperty("lastAuthor")}get author(){return this.loadedProperty("author")}set author(t){this.#e("author",t);}get title(){return this.loadedProperty("title")}set title(t){this.#e("title",t);}get subject(){return this.loadedProperty("subject")}set subject(t){this.#e("subject",t);}get keywords(){return this.loadedProperty("keywords")}set keywords(t){this.#e("keywords",t);}get comments(){return this.loadedProperty("comments")}set comments(t){this.#e("comments",t);}get category(){return this.loadedProperty("category")}set category(t){this.#e("category",t);}onLoad(t){for(let e of this.selection(t,He))this.read(`${this.path.label}.${e}`,()=>({op:"getDocumentProperty",name:e}),n=>this.setLoadedProperty(e,P(n,this.path.label)));}#e(t,e){if(this.requireUsablePath(),(typeof e!="string"||e.length>4096)&&s({code:"InvalidArgument",target:`${this.path.label}.${t}`}),this.#t){this.#t[t]=e;return}let n={[t]:e};this.#t=n,this.commandAnswering(this.path.label,()=>({op:"setDocumentProperties",values:n}),r=>{u(r,this.path.label);},()=>{this.#t===n&&(this.#t=void 0);});}};var E=class extends M{#t;#e=[];constructor(t,e){super(t,e);}get items(){return this.loadedProperty("items")}fill(t,e){this.setLoadedProperty("items",this.#o(t,e,0,void 0)),this.#t={value:t,label:e};let n=this.#e.splice(0,this.#e.length);for(let r of n)this.#n(r,t);}onLoad(t){Rt(t,["items"],this.path.label);let e=this.path.isPending?void 0:this.listing();if(e===null)return;let n=`${this.path.label}.items`,r=t.skip??0,i=t.top;this.enqueue({sort:"read",label:n,plan:()=>{let a=e??this.listing();return a||s({code:"InvalidObjectPath",target:this.path.label}),a},settle:a=>{this.setLoadedProperty("items",this.#o(a,n,r,i));}});}edge(t,e,n){let r=`${this.path.label}.${e}()`,i=this.promised(r,n),a=this.path.isPending?void 0:this.listing();if(a===null){let d={edge:t,target:r,nullable:n,item:i};return this.#t?this.#n(d,this.#t.value):this.#e.push(d),i}return this.enqueue({sort:"read",label:r,plan:()=>{let d=a??this.listing();return d||s({code:"InvalidObjectPath",target:this.path.label}),d},settle:d=>{this.#n({edge:t,target:r,nullable:n,item:i},d);}}),i}#n(t,e){let{edge:n,target:r,nullable:i,item:a}=t,d=this.size(e,r);if(d===0){i||s({code:"ItemNotFound",target:r}),a.hydrateNull();return}let h=this.addressAt(e,r,n==="first"?0:d-1);h||s({code:"ItemNotFound",target:r}),a.hydrateAddress(h);}#o(t,e,n,r){let i=this.size(t,e),a=r===void 0?i:Math.min(i,n+r),d=[];for(let h=n;h<a;h+=1){let v=this.addressAt(t,e,h);v&&d.push(this.itemAt(`${e}[${String(h)}]`,v));}return d}},C=class extends E{size(t,e){return R(t,e).length}addressAt(t,e,n){let r=R(t,e)[n];return r?{kind:"handle",handle:r}:void 0}};function Me(o){return o==="endnote"?"Endnote":"Footnote"}var lt=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&s({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get type(){return this.loadedProperty("type")}get text(){return this.loadedProperty("text")}get body(){if(this.#t)return this.#t;let t=`${this.path.label}.body`,e=I.promisedStory(this.context,t);return this.read(t,()=>({op:"getNoteBody",note:this.#e()}),n=>{e.hydrateAddress({kind:"handle",handle:m(n,t)});}),this.#t=e,e}delete(){this.command("delete",()=>({op:"deleteNote",note:this.#e()}));}getNext(){let t=`${this.path.label}.getNext`,e=o.promised(this.context,t,false),n=this.internals.roots().document,r=`${t}.type`,i="footnote",a=c.pending(r);return this.read(r,()=>({op:"getNoteKind",note:this.#e()}),d=>{i=P(d,r)==="endnote"?"endnote":"footnote",a.resolveTo(this.#e());}),this.enqueue({sort:"read",label:t,dependencies:[a],plan:()=>({op:"getNotes",document:n,noteKind:i}),settle:d=>{let h=R(d,t),v=h.findIndex(st=>st.ref===this.#e().ref),Y=v<0?void 0:h[v+1];Y||s({code:"ItemNotFound",target:t}),e.hydrateAddress({kind:"handle",handle:Y});}}),e}onLoad(t){let e=this.selection(t,["text","type"]);if(e.includes("text")&&this.loadTextInto("text",()=>({op:"getNoteText",note:this.#e(),projection:this.revisionTextView()})),e.includes("type")){let n=`${this.path.label}.type`;this.read(n,()=>({op:"getNoteKind",note:this.#e()}),r=>{this.setLoadedProperty("type",Me(P(r,n)));});}}#e(){return this.requireAddressable(),this.path.handle()}},D=class o extends C{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#t()}itemAt(t,e){return lt.at(this.context,t,e)}promised(t,e){return lt.promised(this.context,t,e)}};function k(o,t){let e=o.address();return t==="span"?(e.kind!=="span"&&s({code:"InvalidObjectPath",target:o.label}),{start:e.span.start,end:e.span.end}):(e.kind!=="handle"&&s({code:"InvalidObjectPath",target:o.label}),t==="body"?{body:e.handle}:{paragraph:e.handle})}function ct(o,t){return (typeof o!="string"||o.trim().length===0||o.length>255)&&s({code:"InvalidArgument",target:t}),o}var F=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&s({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get code(){return this.loadedProperty("code")}set code(t){if(this.requireUsablePath(),(typeof t!="string"||t.length===0)&&s({code:"InvalidArgument",target:`${this.path.label}.code`}),this.#t){this.#t.code=t;return}let e={code:t};this.#t=e,this.commandAnswering(this.path.label,()=>({op:"setFieldCode",field:this.#n(),code:e.code}),n=>u(n,this.path.label),()=>{this.#t===e&&(this.#t=void 0);});}delete(){this.#e("deleteField");}updateResult(){this.#e("updateFieldResult");}#e(t){this.requireUsablePath(),this.commandAnswering(this.path.label,()=>({op:t,field:this.#n()}),e=>u(e,this.path.label));}onLoad(t){this.selection(t,["code"]).length!==0&&this.read(this.path.label,()=>({op:"getField",field:this.#n()}),e=>{e.kind!=="field"&&s({code:"GeneralException",target:this.path.label}),this.setLoadedProperty("code",e.field.code);});}#n(){this.requireAddressable();let t=this.path.address();return t.kind!=="handle"&&s({code:"InvalidObjectPath",target:this.path.label}),t.handle}},V=class o extends E{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}getLast(){return this.edge("last","getLast",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}getLastOrNullObject(){return this.edge("last","getLastOrNullObject",true)}listing(){return {op:"getFields",span:k(this.path,this.#t)}}size(t,e){return R(t,e).length}addressAt(t,e,n){let r=R(t,e)[n];return r?{kind:"handle",handle:r}:void 0}itemAt(t,e){return F.at(this.context,t,e)}promised(t,e){return F.promised(this.context,t,e)}};var Fe=["width","height","lockAspectRatio","altTextDescription"],W=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&s({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get width(){return this.loadedProperty("width")}set width(t){this.#e("width",t);}get height(){return this.loadedProperty("height")}set height(t){this.#e("height",t);}get lockAspectRatio(){return this.loadedProperty("lockAspectRatio")}set lockAspectRatio(t){typeof t!="boolean"&&s({code:"InvalidArgument",target:`${this.path.label}.lockAspectRatio`}),this.#n({lockAspectRatio:t});}get altTextDescription(){return this.loadedProperty("altTextDescription")}set altTextDescription(t){typeof t!="string"&&s({code:"InvalidArgument",target:`${this.path.label}.altTextDescription`}),this.#n({altTextDescription:t});}delete(){let t=`${this.path.label}.delete`;this.commandAnswering(t,()=>({op:"deleteInlinePicture",picture:this.#o()}),e=>u(e,t));}onLoad(t){let e=this.selection(t,Fe);e.length&&this.read(this.path.label,()=>({op:"getInlinePicture",picture:this.#o()}),n=>{n.kind!=="inlinePicture"&&s({code:"GeneralException",target:this.path.label});for(let r of e)this.setLoadedProperty(r,n.picture[r]);});}#e(t,e){(typeof e!="number"||!Number.isFinite(e)||e<=0)&&s({code:"InvalidArgument",target:`${this.path.label}.${t}`}),this.#n({[t]:e});}#n(t){if(this.requireUsablePath(),this.#t){Object.assign(this.#t,t);return}let e=t;this.#t=e,this.commandAnswering(this.path.label,()=>({op:"setInlinePicture",picture:this.#o(),properties:e}),n=>u(n,this.path.label),()=>{this.#t===e&&(this.#t=void 0);});}#o(){this.requireAddressable();let t=this.path.address();return t.kind!=="handle"&&s({code:"InvalidObjectPath",target:this.path.label}),t.handle}},U=class o extends E{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}getLast(){return this.edge("last","getLast",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}getLastOrNullObject(){return this.edge("last","getLastOrNullObject",true)}listing(){return {op:"getInlinePictures",span:k(this.path,this.#t)}}size(t,e){return R(t,e).length}addressAt(t,e,n){let r=R(t,e)[n];return r?{kind:"handle",handle:r}:void 0}itemAt(t,e){return W.at(this.context,t,e)}promised(t,e){return W.promised(this.context,t,e)}};function N(o,t,e=0){return (!Number.isInteger(o)||o<e)&&s({code:"InvalidArgument",target:t}),o}function Ht(o,t){return (!Array.isArray(o)||o.some(e=>!Array.isArray(e)||e.some(n=>typeof n!="string")))&&s({code:"InvalidArgument",target:t}),o.map(e=>[...e])}function xe(o,t){return o!=="Start"&&o!=="End"&&s({code:"InvalidArgument",target:t}),o==="Start"?"start":"end"}var G=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&s({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n=false){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get values(){return this.loadedProperty("values")}set values(t){let e=Ht(t,`${this.path.label}.values`);this.command("values",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"values",values:e}}));}get style(){return this.loadedProperty("style")}set style(t){typeof t!="string"&&s({code:"InvalidArgument",target:`${this.path.label}.style`}),this.command("style",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"properties",styleId:t}}));}get headerRowCount(){return this.loadedProperty("headerRowCount")}set headerRowCount(t){N(t,`${this.path.label}.headerRowCount`),this.command("headerRowCount",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"properties",headerRowCount:t}}));}get rowCount(){return this.loadedProperty("rowCount")}get columnCount(){return this.loadedProperty("columnCount")}get rows(){return this.#t??=ot.of(this.context,`${this.path.label}.rows`,this.path,()=>({op:"getTableRows",table:this.path.handle()}))}getCell(t,e){let n=`${this.path.label}.getCell`;N(t,n),N(e,n);let r=nt.promised(this.context,n);return this.read(n,()=>({op:"getTableCell",table:this.path.handle(),rowIndex:t,cellIndex:e}),i=>r.hydrateAddress({kind:"handle",handle:m(i,n)})),r}addRows(t,e,n){let r=`${this.path.label}.addRows`,i=xe(t,r);N(e,r,1);let a=n===void 0?void 0:Ht(n,r),d=ot.of(this.context,r,this.path,()=>null);return this.commandAnswering(r,()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"addRows",location:i,count:e,...a?{values:a}:{}}}),h=>d.fill(h,r)),d}addColumns(t,e,n){let r=`${this.path.label}.addColumns`,i=xe(t,r);N(e,r,1);let a=n===void 0?void 0:Ht(n,r);this.command("addColumns",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"addColumns",location:i,count:e,...a?{values:a}:{}}}));}deleteRows(t,e){e===void 0&&(e=1),N(t,this.path.label),N(e,this.path.label,1),this.command("deleteRows",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"deleteRows",index:t,count:e}}));}deleteColumns(t,e){e===void 0&&(e=1),N(t,this.path.label),N(e,this.path.label,1),this.command("deleteColumns",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"deleteColumns",index:t,count:e}}));}delete(){this.command("delete",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"delete"}}));}onLoad(t){let e=this.selection(t,["values","style","headerRowCount","rowCount","columnCount"]);this.read(this.path.label,()=>({op:"getTable",table:this.path.handle()}),n=>{n.kind!=="table"&&s({code:"GeneralException",target:this.path.label});for(let r of e)this.setLoadedProperty(r,n.table[r]);});}},ht=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&s({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n=false){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}insertRows(t,e,n){let r=`${this.path.label}.insertRows`;t!=="Before"&&t!=="After"&&s({code:"InvalidArgument",target:r}),N(e,r,1);let i=n===void 0?void 0:Ht(n,r),a=ot.of(this.context,r,this.path,()=>null);return this.commandAnswering(r,()=>({op:"insertTableRows",row:this.path.handle(),location:t==="Before"?"before":"after",count:e,...i?{values:i}:{}}),d=>a.fill(d,r)),a}get cells(){return this.#t??=Ot.of(this.context,`${this.path.label}.cells`,this.path,()=>({op:"getTableCells",row:this.path.handle()}))}},nt=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&s({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n=false){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get body(){if(this.#t)return this.#t;let t=`${this.path.label}.body`,e=I.promisedStory(this.context,t);return this.read(t,()=>({op:"getTableCellBody",cell:this.path.handle()}),n=>e.hydrateAddress({kind:"handle",handle:m(n,t)})),this.#t=e,e}get value(){return this.loadedProperty("value")}set value(t){typeof t!="string"&&s({code:"InvalidArgument",target:`${this.path.label}.value`}),this.command("value",()=>({op:"updateTableCell",cell:this.path.handle(),properties:{value:t}}));}get columnWidth(){return this.loadedProperty("columnWidth")}set columnWidth(t){(typeof t!="number"||!Number.isFinite(t)||t<=0)&&s({code:"InvalidArgument",target:`${this.path.label}.columnWidth`}),this.command("columnWidth",()=>({op:"updateTableCell",cell:this.path.handle(),properties:{columnWidth:t}}));}get shadingColor(){return this.loadedProperty("shadingColor")}set shadingColor(t){typeof t!="string"&&s({code:"InvalidArgument",target:`${this.path.label}.shadingColor`}),this.command("shadingColor",()=>({op:"updateTableCell",cell:this.path.handle(),properties:{shadingColor:t}}));}get verticalAlignment(){return this.loadedProperty("verticalAlignment")}set verticalAlignment(t){t!=="Top"&&t!=="Center"&&t!=="Bottom"&&s({code:"InvalidArgument",target:`${this.path.label}.verticalAlignment`}),this.command("verticalAlignment",()=>({op:"updateTableCell",cell:this.path.handle(),properties:{verticalAlignment:t}}));}onLoad(t){let e=this.selection(t,["value","columnWidth","shadingColor","verticalAlignment"]);this.read(this.path.label,()=>({op:"getTableCellProperties",cell:this.path.handle()}),n=>{n.kind!=="tableCell"&&s({code:"GeneralException",target:this.path.label});for(let r of e)this.setLoadedProperty(r,n.cell[r]);});}},z=class o extends C{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}static over(t,e,n,r){return o.of(t,e,n,()=>({op:"getTables",scope:r()}))}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}listing(){return this.#t()}itemAt(t,e){return G.at(this.context,t,e)}promised(t,e){return G.promised(this.context,t,e)}},ot=class o extends C{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}listing(){return this.#t()}itemAt(t,e){return ht.at(this.context,t,e)}promised(t,e){return ht.promised(this.context,t,e)}},Ot=class o extends C{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}listing(){return this.#t()}itemAt(t,e){return nt.at(this.context,t,e)}promised(t,e){return nt.promised(this.context,t,e)}};var Yt=(i=>(i.replace="Replace",i.start="Start",i.end="End",i.before="Before",i.after="After",i))(Yt||{}),Jt=(a=>(a.mixed="Mixed",a.unknown="Unknown",a.left="Left",a.centered="Centered",a.right="Right",a.justified="Justified",a))(Jt||{}),_t=(e=>(e.portrait="Portrait",e.landscape="Landscape",e))(_t||{}),te=(n=>(n.off="Off",n.trackAll="TrackAll",n.trackMineOnly="TrackMineOnly",n))(te||{}),ee=(r=>(r.mixed="Mixed",r.top="Top",r.center="Center",r.bottom="Bottom",r))(ee||{}),ne=(d=>(d.line="Line",d.page="Page",d.next="Next",d.sectionNext="SectionNext",d.sectionContinuous="SectionContinuous",d.sectionEven="SectionEven",d.sectionOdd="SectionOdd",d))(ne||{}),oe=(y=>(y.unknown="Unknown",y.richText="RichText",y.plainText="PlainText",y.picture="Picture",y.buildingBlockGallery="BuildingBlockGallery",y.checkBox="CheckBox",y.comboBox="ComboBox",y.datePicker="DatePicker",y.dropDownList="DropDownList",y.group="Group",y.repeatingSection="RepeatingSection",y.plainTextInline="PlainTextInline",y.plainTextParagraph="PlainTextParagraph",y.richTextInline="RichTextInline",y.richTextParagraphs="RichTextParagraphs",y.richTextTable="RichTextTable",y.richTextTableCell="RichTextTableCell",y.richTextTableRow="RichTextTableRow",y))(oe||{}),re=(x=>(x.all="All",x.atMentions="AtMentions",x.commentReactions="CommentReactions",x.comments="Comments",x.contentType="ContentType",x.documentIntelligence="DocumentIntelligence",x.documentManagementPolicy="DocumentManagementPolicy",x.documentProperties="DocumentProperties",x.documentServerProperties="DocumentServerProperties",x.documentTasks="DocumentTasks",x.documentWorkspace="DocumentWorkspace",x.emailHeader="EmailHeader",x.inkAnnotations="InkAnnotations",x.removePersonalInformation="RemovePersonalInformation",x.revisions="Revisions",x.routingSlip="RoutingSlip",x.sendForReview="SendForReview",x.taskpaneWebExtensions="TaskpaneWebExtensions",x.template="Template",x.versions="Versions",x))(re||{});var Ve=["Replace","Start","End"],We=["Start","End"],Ue=["Replace","Start","End"],Ge=["Before","After"],ze=["Replace","Start","End","Before","After"],Qe=["Select","Start","End"];function pt(o,t,e){return (typeof o!="string"||!t.includes(o))&&s({code:"InvalidArgument",target:e}),o}var Ce=(o,t)=>pt(o,Ve,t),Ae=(o,t)=>pt(o,We,t),ve=(o,t)=>pt(o,Ue,t),Pe=(o,t)=>pt(o,Ge,t),kt=(o,t)=>pt(o,ze,t),Mt=(o,t)=>o===void 0?"Select":pt(o,Qe,t);function L(o,t){return typeof o!="string"&&s({code:"InvalidArgument",target:t}),/[\r\n\v\f\u2028\u2029]/.test(o)&&s({code:"InvalidArgument",target:t}),o}var Xe=8,se=(d=>(d.custom="Custom",d.solid="Solid",d.hollow="Hollow",d.square="Square",d.diamonds="Diamonds",d.arrow="Arrow",d.checkmark="Checkmark",d))(se||{}),ae=(a=>(a.none="None",a.arabic="Arabic",a.upperRoman="UpperRoman",a.lowerRoman="LowerRoman",a.upperLetter="UpperLetter",a.lowerLetter="LowerLetter",a))(ae||{}),T=class o extends p{#t;#e=new Map;static at(t,e,n){return n.kind!=="handle"&&s({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get id(){return this.loadedProperty("id")}get paragraphs(){return this.#t??=w.overListing(this.context,`${this.path.label}.paragraphs`,this.path,()=>({op:"getListParagraphs",list:this.#o()})),this.#t}getLevelParagraphs(t){let e=`${this.path.label}.getLevelParagraphs`,n=ie(t,e);return w.overListing(this.context,e,this.path,()=>({op:"getListParagraphs",list:this.#o(),level:n}))}insertParagraph(t,e){let n=`${this.path.label}.insertParagraph`,r=L(t,n);e!=="Start"&&e!=="End"&&e!=="Before"&&e!=="After"&&s({code:"InvalidArgument",target:n});let i=S.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"insertListParagraph",list:this.#o(),where:e==="Start"||e==="Before"?"start":"end",text:r}),a=>{i.hydrateAddress({kind:"handle",handle:m(a,n)});}),i}setLevelBullet(t,e,n,r){this.#n(t,{bullet:e,...n===void 0?{}:{charCode:n},...r===void 0?{}:{fontName:r}});}setLevelNumbering(t,e,n){this.#n(t,{numbering:e,...n===void 0?{}:{formatString:[...n]}});}setLevelStartingNumber(t,e){this.#n(t,{startingNumber:e});}setLevelIndents(t,e,n){this.#n(t,{textIndent:e,bulletNumberPictureIndent:n});}#n(t,e){let n=`${this.path.label}.levelFormat`,r=ie(t,n);this.requireUsablePath();let i=this.#e.get(r);if(i){Object.assign(i,e),"bullet"in e&&(delete i.numbering,delete i.formatString),"numbering"in e&&(delete i.bullet,delete i.charCode,delete i.fontName);return}let a={...e};this.#e.set(r,a),this.commandAnswering(n,()=>({op:"setListLevelFormat",list:this.#o(),level:r,format:a}),d=>{u(d,n);},()=>{this.#e.get(r)===a&&this.#e.delete(r);});}onLoad(t){if(!this.selection(t,["id"]).includes("id"))return;let e=`${this.path.label}.id`;this.read(e,()=>({op:"getListId",list:this.#o()}),n=>{this.setLoadedProperty("id",qt(n,e));});}#o(){return this.requireAddressable(),this.path.handle()}},ut=class o extends C{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}getById(t){let e=`${this.path.label}.getById`,n=Ke(t,e),r=this.#t,i=T.promised(this.context,e,false);return this.enqueue({sort:"read",label:e,plan:()=>({op:"getListById",body:r,id:n}),settle:a=>{i.hydrateAddress({kind:"handle",handle:m(a,e)});}}),i}listing(){return {op:"getLists",body:this.#t}}itemAt(t,e){return T.at(this.context,t,e)}promised(t,e){return T.promised(this.context,t,e)}},mt=class o extends p{static of(t,e,n){return new o(t,c.derived(e,n))}constructor(t,e){super(t,e);}get level(){return this.loadedProperty("level")}set level(t){let e=`${this.path.label}.level`,n=ie(t,e);this.commandAnswering(e,()=>({op:"setListLevel",paragraph:this.#t(),level:n}),r=>{u(r,e);});}onLoad(t){if(!this.selection(t,["level"]).includes("level"))return;let e=`${this.path.label}.level`;this.read(e,()=>({op:"getListLevel",paragraph:this.#t()}),n=>{this.setLoadedProperty("level",qt(n,e));});}#t(){this.requireAddressable();let t=this.path.address();return t.kind!=="handle"&&s({code:"InvalidObjectPath",target:this.path.label}),t.handle}};function ie(o,t){return (!Number.isInteger(o)||o<0||o>Xe)&&s({code:"InvalidArgument",target:t}),o}function Ke(o,t){return (!Number.isInteger(o)||o<=0)&&s({code:"InvalidArgument",target:t}),o}var de=(f=>(f.mixed="Mixed",f.none="None",f.hidden="Hidden",f.dotLine="DotLine",f.single="Single",f.word="Word",f.double="Double",f.thick="Thick",f.dotted="Dotted",f.dottedHeavy="DottedHeavy",f.dashLine="DashLine",f.dashLineHeavy="DashLineHeavy",f.dashLineLong="DashLineLong",f.dashLineLongHeavy="DashLineLongHeavy",f.dotDashLine="DotDashLine",f.dotDashLineHeavy="DotDashLineHeavy",f.twoDotDashLine="TwoDotDashLine",f.twoDotDashLineHeavy="TwoDotDashLineHeavy",f.wave="Wave",f.waveHeavy="WaveHeavy",f.waveDouble="WaveDouble",f))(de||{}),Ze=["bold","italic","color","name","size","underline","strikeThrough","highlightColor","subscript","superscript"],q=class o extends p{#t;#e;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}get bold(){return this.loadedProperty("bold")}set bold(t){this.#n("bold",It(t,`${this.path.label}.bold`));}get italic(){return this.loadedProperty("italic")}set italic(t){this.#n("italic",It(t,`${this.path.label}.italic`));}get color(){return this.loadedProperty("color")}set color(t){this.#n("color",Ft(t,`${this.path.label}.color`));}get name(){return this.loadedProperty("name")}set name(t){this.#n("name",Ft(t,`${this.path.label}.name`));}get size(){return this.loadedProperty("size")}set size(t){this.#n("size",Ye(t,`${this.path.label}.size`));}get underline(){return this.loadedProperty("underline")}set underline(t){this.#n("underline",Ft(t,`${this.path.label}.underline`));}get highlightColor(){return this.loadedProperty("highlightColor")}set highlightColor(t){this.#n("highlightColor",t===null?null:Ft(t,`${this.path.label}.highlightColor`));}get strikeThrough(){return this.loadedProperty("strikeThrough")}set strikeThrough(t){this.#n("strikeThrough",It(t,`${this.path.label}.strikeThrough`));}get subscript(){return this.loadedProperty("subscript")}set subscript(t){this.#n("subscript",It(t,`${this.path.label}.subscript`));}get superscript(){return this.loadedProperty("superscript")}set superscript(t){this.#n("superscript",It(t,`${this.path.label}.superscript`));}onLoad(t){let e=this.selection(t,Ze);if(e.length===0)return;let n=`${this.path.label}.font`;this.read(n,()=>({op:"getFont",span:this.#o()}),r=>{let i=zt(r,n);for(let a of e)this.setLoadedProperty(a,i[a]);});}#n(t,e){if(this.requireUsablePath(),this.#e){this.#e[t]=e,t==="subscript"&&e===true&&(this.#e.superscript=false),t==="superscript"&&e===true&&(this.#e.subscript=false);return}let n={[t]:e};t==="subscript"&&e===true&&(n.superscript=false),t==="superscript"&&e===true&&(n.subscript=false),this.#e=n;let r=`${this.path.label}.${t}`;this.commandAnswering(this.path.label,()=>({op:"setFont",span:this.#o(),font:n}),i=>{u(i,r);},()=>{this.#e===n&&(this.#e=void 0);});}#o(){return this.requireAddressable(),k(this.path,this.#t)}};function It(o,t){return typeof o!="boolean"&&s({code:"InvalidArgument",target:t}),o}function Ye(o,t){return (typeof o!="number"||!Number.isFinite(o))&&s({code:"InvalidArgument",target:t}),o}function Ft(o,t){return (typeof o!="string"||o.length===0)&&s({code:"InvalidArgument",target:t}),o}var Je=16,S=class o extends p{#t;#e;#n;#o;static at(t,e,n){return n.kind!=="handle"&&s({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get text(){return this.loadedProperty("text")}get uniqueLocalId(){return this.loadedProperty("uniqueLocalId")}get style(){return this.loadedProperty("style")}set style(t){this.#i("style",ct(t,`${this.path.label}.style`));}get font(){return this.#t??=q.of(this.context,`${this.path.label}.font`,this.path,"paragraph"),this.#t}get alignment(){return this.loadedProperty("alignment")}set alignment(t){this.#i("alignment",tn(t,`${this.path.label}.alignment`));}get firstLineIndent(){return this.loadedProperty("firstLineIndent")}set firstLineIndent(t){this.#i("firstLineIndent",gt(t,`${this.path.label}.firstLineIndent`));}get leftIndent(){return this.loadedProperty("leftIndent")}set leftIndent(t){this.#i("leftIndent",gt(t,`${this.path.label}.leftIndent`));}get rightIndent(){return this.loadedProperty("rightIndent")}set rightIndent(t){this.#i("rightIndent",gt(t,`${this.path.label}.rightIndent`));}get lineSpacing(){return this.loadedProperty("lineSpacing")}set lineSpacing(t){this.#i("lineSpacing",gt(t,`${this.path.label}.lineSpacing`));}get spaceBefore(){return this.loadedProperty("spaceBefore")}set spaceBefore(t){this.#i("spaceBefore",gt(t,`${this.path.label}.spaceBefore`));}get spaceAfter(){return this.loadedProperty("spaceAfter")}set spaceAfter(t){this.#i("spaceAfter",gt(t,`${this.path.label}.spaceAfter`));}get list(){return this.#e??=this.#a(`${this.path.label}.list`),this.#e}getRange(t="Whole"){let e=`${this.path.label}.getRange`;["Whole","Content","Start","End","Before","After"].includes(t)||s({code:"InvalidArgument",target:e});let n=b.promised(this.context,e,false);return this.read(e,()=>({op:"getRange",span:{paragraph:this.#r()},location:t}),r=>{n.hydrateAddress({kind:"span",span:O(r,e)});}),n}startNewList(){let t=`${this.path.label}.startNewList`,e=T.promised(this.context,t,false);return this.commandAnswering(t,()=>({op:"startNewList",paragraph:this.#r()}),n=>{e.hydrateAddress({kind:"handle",handle:m(n,t)});}),e}attachToList(t,e){let n=`${this.path.label}.attachToList`;(!Number.isSafeInteger(t)||t<=0||!Number.isInteger(e)||e<0||e>8)&&s({code:"InvalidArgument",target:n});let r=T.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"attachToList",paragraph:this.#r(),listId:t,level:e}),i=>{r.hydrateAddress({kind:"handle",handle:m(i,n)});}),r}detachFromList(){let t=`${this.path.label}.detachFromList`;this.commandAnswering(t,()=>({op:"detachFromList",paragraph:this.#r()}),e=>{u(e,t);});}get listItem(){return this.#n??=mt.of(this.context,`${this.path.label}.listItem`,this.path),this.#n}clear(){this.commandDiscarding("clear",()=>({op:"replaceSpan",span:{paragraph:this.#r()},text:""}));}delete(){this.command("delete",()=>({op:"deleteParagraph",paragraph:this.#r()}));}insertText(t,e){let n=`${this.path.label}.insertText`,r=L(t,n),i=ve(e,n),a=b.promised(this.context,n,false);return this.commandAnswering(n,()=>i==="Replace"?{op:"replaceSpan",span:{paragraph:this.#r()},text:r}:{op:"insertText",at:{paragraph:this.#r(),at:i==="Start"?"start":"end"},text:r},d=>{a.hydrateAddress({kind:"span",span:O(d,n)});}),a}insertParagraph(t,e){let n=`${this.path.label}.insertParagraph`,r=L(t,n),i=Pe(e,n),a=o.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"insertParagraph",anchor:{paragraph:this.#r()},where:i==="Before"?"before":"after",text:r}),d=>{d.kind!=="handle"&&s({code:"GeneralException",target:n}),a.hydrateAddress({kind:"handle",handle:d.handle});}),a}split(t,e,n){let r=`${this.path.label}.split`,i=en(t,r),a=Oe(e,`${r}.trimDelimiters`),d=Oe(n,`${r}.trimSpacing`),h=B.answered(this.context,r,this.path);return this.commandAnswering(r,()=>({op:"splitParagraph",paragraph:this.#r(),delimiters:i,...a?{trimDelimiters:true}:{},...d?{trimSpacing:true}:{}}),v=>{h.fill(v,r);}),h}onLoad(t){let e=this.selection(t,["text","uniqueLocalId",...Re]);e.includes("text")&&this.loadTextInto("text",()=>({op:"getText",target:this.#r(),projection:this.revisionTextView()})),e.includes("uniqueLocalId")&&this.loadTextInto("uniqueLocalId",()=>({op:"getParagraphId",paragraph:this.#r()}));let n=Re.filter(i=>e.includes(i));if(n.length===0)return;let r=`${this.path.label}.paragraphFormat`;this.read(r,()=>({op:"getParagraphFormat",paragraph:{paragraph:this.#r()}}),i=>{let a=Qt(i,r);for(let d of n)this.setLoadedProperty(d,a[d]);});}#i(t,e){if(this.requireUsablePath(),this.#o){this.#o[t]=e;return}let n={[t]:e};this.#o=n;let r=`${this.path.label}.${t}`;this.commandAnswering(`${this.path.label}.paragraphFormat`,()=>({op:"setParagraphFormat",paragraph:{paragraph:this.#r()},format:n}),i=>{u(i,r);},()=>{this.#o===n&&(this.#o=void 0);});}#a(t){let e=T.promised(this.context,t,false);return this.read(t,()=>({op:"getParagraphList",paragraph:this.#r()}),n=>{e.hydrateAddress({kind:"handle",handle:m(n,t)});}),e}#r(){return this.requireAddressable(),this.path.handle()}},Re=["style","alignment","firstLineIndent","leftIndent","rightIndent","lineSpacing","spaceBefore","spaceAfter"],_e=["Left","Centered","Right","Justified"];function tn(o,t){return _e.includes(o)||s({code:"InvalidArgument",target:t}),o}function gt(o,t){return (typeof o!="number"||!Number.isFinite(o))&&s({code:"InvalidArgument",target:t}),o}function en(o,t){(!Array.isArray(o)||o.length===0||o.length>Je)&&s({code:"InvalidArgument",target:t});for(let e of o)(typeof e!="string"||e.length===0)&&s({code:"InvalidArgument",target:t});return [...o]}function Oe(o,t){return o!==void 0&&typeof o!="boolean"&&s({code:"InvalidArgument",target:t}),o===true}var w=class o extends E{#t;static of(t,e,n){return new o(t,c.derived(e,n),null)}static overListing(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}getLast(){return this.edge("last","getLast",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}getLastOrNullObject(){return this.edge("last","getLastOrNullObject",true)}listing(){if(this.#t)return this.#t();let t=this.path.address();return t.kind==="handle"?{op:"getParagraphs",body:t.handle}:{op:"getSpanParagraphs",span:t.span}}size(t,e){return R(t,e).length}addressAt(t,e,n){let r=R(t,e)[n];return r?{kind:"handle",handle:r}:void 0}itemAt(t,e){return S.at(this.context,t,e)}promised(t,e){return S.promised(this.context,t,e)}},B=class o extends E{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}static answered(t,e,n){return new o(t,c.derived(e,n),null)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}getLast(){return this.edge("last","getLast",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}listing(){return this.#t?this.#t():null}size(t,e){return Nt(t,e).length}addressAt(t,e,n){let r=Nt(t,e)[n];return r?{kind:"span",span:r}:void 0}itemAt(t,e){return b.at(this.context,t,e)}promised(t,e){return b.promised(this.context,t,e)}};var Ie=4096,$=class o extends p{#t;#e=new Map;#n;#o;static at(t,e,n){return n.kind!=="handle"&&s({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get id(){return this.loadedProperty("id")}get tag(){return this.loadedProperty("tag")}set tag(t){this.#a("tag",{tag:le(t,`${this.path.label}.tag`)});}get title(){return this.loadedProperty("title")}set title(t){this.#a("title",{title:le(t,`${this.path.label}.title`)});}get subtype(){return this.loadedProperty("subtype")}get isBound(){return this.loadedProperty("isBound")}get cannotDelete(){let t=this.loadedProperty("lock");return t==="sdtLocked"||t==="sdtContentLocked"}set cannotDelete(t){this.#r("cannotDelete",t);}get cannotEdit(){let t=this.loadedProperty("lock");return t==="contentLocked"||t==="sdtContentLocked"}set cannotEdit(t){this.#r("cannotEdit",t);}get placeholderShown(){return this.loadedProperty("placeholderShown")}get temporary(){return this.loadedProperty("temporary")}get text(){return this.loadedProperty("text")}get paragraphs(){return this.#n??=w.overListing(this.context,`${this.path.label}.paragraphs`,this.path,()=>({op:"getContentControlParagraphs",contentControl:this.#s()})),this.#n}get contentControls(){return this.#o??=H.of(this.context,`${this.path.label}.contentControls`,this.path,{contentControl:this.#s()}),this.#o}getRange(t){let e=`${this.path.label}.getRange`,n=nn(t??"Whole",e),r=this.#e.get(n);if(r)return r;let i=this.#i(e,n);return this.#e.set(n,i),i}setValue(t){let e=`${this.path.label}.setValue`,n=on(t,e);this.command("setValue",()=>({op:"setContentControlValue",contentControl:this.#s(),value:n}));}insertText(t,e){let n=`${this.path.label}.insertText`,r=L(t,n),i=e==="Replace"?"replace":e==="Start"?"start":e==="End"?"end":s({code:"InvalidArgument",target:n}),a=b.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"insertContentControlText",contentControl:this.#s(),text:r,at:i}),d=>{a.hydrateAddress({kind:"span",span:O(d,n)});}),a}delete(t){let e=`${this.path.label}.delete`;typeof t!="boolean"&&s({code:"InvalidArgument",target:e}),this.command("delete",()=>({op:"deleteContentControl",contentControl:this.#s(),keepContent:t}));}onLoad(t){let e=this.selection(t,["id","tag","title","subtype","isBound","text","cannotDelete","cannotEdit","placeholderShown","temporary"]);if(e.includes("id")&&this.loadTextInto("id",()=>({op:"getContentControlFileId",contentControl:this.#s()})),e.includes("tag")&&this.loadTextInto("tag",()=>({op:"getContentControlTag",contentControl:this.#s()})),e.includes("title")&&this.loadTextInto("title",()=>({op:"getContentControlTitle",contentControl:this.#s()})),e.includes("subtype")&&this.loadTextInto("subtype",()=>({op:"getContentControlSubtype",contentControl:this.#s()})),e.includes("isBound")){let r=`${this.path.label}.isBound`;this.read(r,()=>({op:"getContentControlIsBound",contentControl:this.#s()}),i=>{this.setLoadedProperty("isBound",et(i,r));});}if(e.includes("text")&&this.loadTextInto("text",()=>({op:"getContentControlText",contentControl:this.#s(),projection:this.revisionTextView()})),e.includes("cannotDelete")||e.includes("cannotEdit")){let r=`${this.path.label}.lock`;this.read(r,()=>({op:"getContentControlLock",contentControl:this.#s()}),i=>{this.setLoadedProperty("lock",P(i,r));});}if(e.includes("placeholderShown")){let r=`${this.path.label}.placeholderShown`;this.read(r,()=>({op:"getContentControlPlaceholderShown",contentControl:this.#s()}),i=>{this.setLoadedProperty("placeholderShown",et(i,r));});}if(!e.includes("temporary"))return;let n=`${this.path.label}.temporary`;this.read(n,()=>({op:"getContentControlTemporary",contentControl:this.#s()}),r=>{this.setLoadedProperty("temporary",et(r,n));});}#i(t,e){let n=b.promised(this.context,t,false);return this.read(t,()=>({op:"getContentControlRange",contentControl:this.#s(),location:e}),r=>{n.hydrateAddress({kind:"span",span:O(r,t)});}),n}#a(t,e){this.command(t,()=>({op:"setContentControlProperties",contentControl:this.#s(),...e}));}#r(t,e){let n=`${this.path.label}.${t}`;if(typeof e!="boolean"&&s({code:"InvalidArgument",target:n}),this.requireUsablePath(),this.#t){this.#t[t]=e;return}let r={[t]:e};this.#t=r,this.command(t,()=>({op:"setContentControlProperties",contentControl:this.#s(),...r}),()=>{this.#t===r&&(this.#t=void 0);});}#s(){return this.requireAddressable(),this.path.handle()}},H=class o extends C{#t;#e;static of(t,e,n,r){return new o(t,c.derived(e,n),r,()=>({op:"getContentControls",scope:r}))}constructor(t,e,n,r){super(t,e),this.#t=n,this.#e=r;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}getById(t){let e=`${this.path.label}.getById`;Number.isInteger(t)||s({code:"InvalidArgument",target:e});let n=this.#t,r=$.promised(this.context,e,false);return this.enqueue({sort:"read",label:e,plan:()=>({op:"getContentControlById",scope:n,id:t}),settle:i=>{r.hydrateAddress({kind:"handle",handle:m(i,e)});}}),r}getByTag(t){let e=`${this.path.label}.getByTag`,n=ke(t,e),r=this.#t;return new o(this.context,c.derived(e,this.path),r,()=>({op:"getContentControlsByTag",scope:r,tag:n}))}getByTitle(t){let e=`${this.path.label}.getByTitle`,n=ke(t,e),r=this.#t;return new o(this.context,c.derived(e,this.path),r,()=>({op:"getContentControlsByTitle",scope:r,title:n}))}listing(){return this.#e()}itemAt(t,e){return $.at(this.context,t,e)}promised(t,e){return $.promised(this.context,t,e)}};function le(o,t){return (typeof o!="string"||o.length>Ie)&&s({code:"InvalidArgument",target:t}),o}function ke(o,t){let e=le(o,t);return e.length===0&&s({code:"InvalidArgument",target:t}),e}function nn(o,t){switch(o){case "Whole":return "whole";case "Content":return "content";case "Start":return "start";case "End":return "end";case "Before":return "before";case "After":return "after";default:return s({code:"InvalidArgument",target:t})}}function on(o,t){(typeof o!="object"||o===null)&&s({code:"InvalidArgument",target:t});let e=o;if(e.kind==="text"||e.kind==="listItem"){let n=e.kind==="text"?e.text:e.value;return (typeof n!="string"||n.length>Ie)&&s({code:"InvalidArgument",target:t}),e.kind==="text"?{kind:"text",text:n}:{kind:"listItem",value:n}}if(e.kind==="checkbox")return typeof e.checked!="boolean"&&s({code:"InvalidArgument",target:t}),{kind:"checkbox",checked:e.checked};if(e.kind==="date")return (typeof e.iso!="string"||e.iso.length>64)&&s({code:"InvalidArgument",target:t}),{kind:"date",iso:e.iso};s({code:"InvalidArgument",target:t});}function rn(o,t){return t<1||t>12?0:t===2?o%4===0&&o%100!==0||o%400===0?29:28:t===4||t===6||t===9||t===11?30:31}function Le(o){if(o.length===0)return null;let t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,9}))?(Z|[+-]\d{2}:\d{2})$/.exec(o.trim());if(!t)return null;let e=Number(t[1]),n=Number(t[2]),r=Number(t[3]),i=rn(e,n);if(e===0||i===0||r<1||r>i)return null;let a=Number(t[4]),d=Number(t[5]),h=Number(t[6]);if(a>23||d>59||h>59)return null;let v=t[7],Y=v===void 0?0:Number(v.padEnd(3,"0").slice(0,3));if(Number.isNaN(Y))return null;let st=`${t[1]}-${t[2]}-${t[3]}T${t[4]}:${t[5]}:${t[6]}.${String(Y).padStart(3,"0")}Z`,St=Date.parse(st);if(Number.isNaN(St))return null;let g=t[8];if(g==="Z")return new Date(St);let J=Number(g.slice(1,3)),at=Number(g.slice(4,6));if(at>59||J>14||J===14&&at!==0)return null;let Gt=g[0]==="+"?1:-1,jt=new Date(St-Gt*(J*36e5+at*6e4));return Number.isNaN(jt.getTime())?null:jt}var Vt=class extends p{hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get authorName(){return this.loadedProperty("authorName")}get creationDate(){return this.loadedProperty("creationDate")}get id(){return this.loadedProperty("id")}get text(){return this.loadedProperty("text")}delete(){this.command("delete",()=>({op:"deleteComment",comment:this.commentHandle()}));}loadCommentFields(t,e){let n=this.selection(t,["authorName","creationDate","id","text",...e]);if(n.includes("authorName")&&this.loadTextInto("authorName",()=>({op:"getCommentAuthor",comment:this.commentHandle()})),n.includes("text")&&this.loadTextInto("text",()=>({op:"getCommentText",comment:this.commentHandle()})),n.includes("id")&&this.loadTextInto("id",()=>({op:"getCommentId",comment:this.commentHandle()})),n.includes("creationDate")){let i=`${this.path.label}.creationDate`;this.read(i,()=>({op:"getCommentDate",comment:this.commentHandle()}),a=>{this.setLoadedProperty("creationDate",Le(P(a,i)));});}if(!n.includes("resolved"))return;let r=`${this.path.label}.resolved`;this.read(r,()=>({op:"getCommentResolved",comment:this.commentHandle()}),i=>{this.setLoadedProperty("resolved",et(i,r));});}commentHandle(){return this.requireAddressable(),this.path.handle()}},it=class o extends Vt{static at(t,e,n){return n.kind!=="handle"&&s({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}onLoad(t){this.loadCommentFields(t,[]);}},Lt=class o extends C{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#t()}itemAt(t,e){return it.at(this.context,t,e)}promised(t,e){return it.promised(this.context,t,e)}},Q=class o extends Vt{#t;static at(t,e,n){return n.kind!=="handle"&&s({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}get resolved(){return this.loadedProperty("resolved")}set resolved(t){let e=`${this.path.label}.resolved`;typeof t!="boolean"&&s({code:"InvalidArgument",target:e}),this.commandAnswering(e,()=>({op:"setCommentResolved",comment:this.commentHandle(),resolved:t}),n=>{u(n,e);});}get replies(){return this.#t??=Lt.of(this.context,`${this.path.label}.replies`,this.path,()=>({op:"getCommentReplies",comment:this.commentHandle()})),this.#t}getRange(){let t=`${this.path.label}.getRange`,e=b.promised(this.context,t,false);return this.read(t,()=>({op:"getCommentRange",comment:this.commentHandle()}),n=>{e.hydrateAddress({kind:"span",span:O(n,t)});}),e}reply(t){let e=`${this.path.label}.reply`;(typeof t!="string"||t.length===0)&&s({code:"InvalidArgument",target:e});let n=this.internals.author;(typeof n!="string"||n.trim().length===0)&&s({code:"NotSupported",target:e});let r=it.promised(this.context,e,false);return this.commandAnswering(e,()=>({op:"replyToComment",comment:this.commentHandle(),text:t,author:n}),i=>{r.hydrateAddress({kind:"handle",handle:m(i,e)});}),r}onLoad(t){this.loadCommentFields(t,["resolved"]);}},X=class o extends C{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#t()}itemAt(t,e){return Q.at(this.context,t,e)}promised(t,e){return Q.promised(this.context,t,e)}},rt=class o extends p{static at(t,e,n){return n.kind!=="handle"&&s({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get author(){return this.loadedProperty("author")}get date(){return this.loadedProperty("date")}get type(){return this.loadedProperty("type")}get range(){let t=`${this.path.label}.range`,e=b.promised(this.context,t,false);return this.read(t,()=>({op:"getRevisionRange",revision:this.#t()}),n=>{e.hydrateAddress({kind:"span",span:O(n,t)});}),e}accept(){this.command("accept",()=>({op:"acceptRevision",revision:this.#t()}));}reject(){this.command("reject",()=>({op:"rejectRevision",revision:this.#t()}));}onLoad(t){let e=this.selection(t,["author","date","type"]);if(e.includes("author")&&this.loadTextInto("author",()=>({op:"getRevisionAuthor",revision:this.#t()})),e.includes("type")&&this.loadTextInto("type",()=>({op:"getRevisionType",revision:this.#t()})),!e.includes("date"))return;let n=`${this.path.label}.date`;this.read(n,()=>({op:"getRevisionDate",revision:this.#t()}),r=>{this.setLoadedProperty("date",Le(P(r,n)));});}static batchHandle(t,e){return (!(t instanceof o)||t.context!==e)&&s({code:"InvalidArgument",target:"RevisionCollection.resolve"}),t.#t()}#t(){return this.requireAddressable(),this.path.handle()}},K=class o extends C{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}acceptAll(){let t=this.#t;this.commandOn("acceptAll",()=>({op:"acceptAllRevisions",body:t}));}rejectAll(){let t=this.#t;this.commandOn("rejectAll",()=>({op:"rejectAllRevisions",body:t}));}resolve(t,e){let n=`${this.path.label}.resolve`;(!["accept","reject"].includes(t)||e!==void 0&&!Array.isArray(e))&&s({code:"InvalidArgument",target:n});let r=e===void 0?void 0:[...e],{result:i,fill:a}=fe(n);return this.enqueue({sort:"write",label:n,plan:()=>({op:"resolveRevisionBatch",body:this.#t,action:t,...r===void 0?{}:{revisions:r.map(d=>rt.batchHandle(d,this.context))}}),settle:d=>{d.kind!=="revisionBatch"&&s({code:"GeneralException",target:n}),a(d.result);}}),i}listing(){return {op:"getRevisions",body:this.#t}}itemAt(t,e){return rt.at(this.context,t,e)}promised(t,e){return rt.promised(this.context,t,e)}commandOn(t,e){let n=`${this.path.label}.${t}`;this.enqueue({sort:"write",label:n,plan:e,settle:r=>{u(r,n);}});}};var sn=new Set(["matchCase","matchWholeWord","ignorePunct","ignoreSpace","matchWildcards"]);function Wt(o,t){if(o===void 0)return;typeof o!="object"&&s({code:"InvalidArgument",target:t});for(let[n,r]of Object.entries(o))sn.has(n)||s({code:"InvalidArgument",target:`${t}.${n}`}),r!==void 0&&typeof r!="boolean"&&s({code:"InvalidArgument",target:`${t}.${n}`});let e={...o.matchCase===void 0?{}:{matchCase:o.matchCase},...o.matchWholeWord===void 0?{}:{matchWholeWord:o.matchWholeWord},...o.ignorePunct===void 0?{}:{ignorePunct:o.ignorePunct},...o.ignoreSpace===void 0?{}:{ignoreSpace:o.ignoreSpace},...o.matchWildcards===void 0?{}:{matchWildcards:o.matchWildcards}};return Object.keys(e).length===0?void 0:e}var b=class o extends p{#t;#e;#n;#o;#i;#a;static at(t,e,n){return n.kind!=="span"&&s({code:"InvalidObjectPath",target:e}),new o(t,c.ofSpan(e,n.span),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="span"?this.path.resolveToSpan(t.span):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get text(){return this.loadedProperty("text")}get font(){return this.#i??=q.of(this.context,`${this.path.label}.font`,this.path,"span"),this.#i}get paragraphs(){return this.#o??=w.of(this.context,`${this.path.label}.paragraphs`,this.path),this.#o}get style(){return this.loadedProperty("style")}set style(t){let e=`${this.path.label}.style`,n=ct(t,e);this.requireAddressable(),this.command("style",()=>({op:"setStyle",span:k(this.path,"span"),name:n}));}get hyperlink(){return this.loadedProperty("hyperlink")}set hyperlink(t){let e=`${this.path.label}.hyperlink`;(typeof t!="string"||t.length>2048)&&s({code:"InvalidArgument",target:e}),this.requireUsablePath(),this.command("hyperlink",()=>({op:"setHyperlink",span:this.#r(),target:t}));}get bookmarks(){let t=this.#r();return this.#a??=Z.of(this.context,`${this.path.label}.bookmarks`,this.path,()=>({op:"getBookmarks",scope:{start:t.start,end:t.end}})),this.#a}search(t,e){let n=`${this.path.label}.search`;typeof t!="string"&&s({code:"InvalidArgument",target:n});let r=Wt(e,n),i=this.#r();return B.of(this.context,n,this.path,()=>({op:"search",scope:i,text:t,options:{...r??{},projection:this.revisionTextView()}}))}insertText(t,e){let n=`${this.path.label}.insertText`,r=L(t,n),i=kt(e,n);this.requireUsablePath();let a=o.promised(this.context,n,false);return this.commandAnswering(n,()=>{let d=this.#r();return i==="Replace"?{op:"replaceSpan",span:d,text:r}:{op:"insertText",at:i==="Start"||i==="Before"?d.start:d.end,text:r}},d=>{a.hydrateAddress({kind:"span",span:O(d,n)});}),a}delete(){this.requireUsablePath(),this.commandDiscarding("delete",()=>({op:"replaceSpan",span:this.#r(),text:""}));}clear(){let t=this.#r();this.commandDiscarding("clear",()=>({op:"replaceSpan",span:t,text:""}));}insertComment(t){let e=`${this.path.label}.insertComment`;(typeof t!="string"||t.length===0)&&s({code:"InvalidArgument",target:e});let n=this.internals.author;(typeof n!="string"||n.trim().length===0)&&s({code:"NotSupported",target:e});let r=Q.promised(this.context,e,false);return this.commandAnswering(e,()=>({op:"insertComment",span:this.#r(),text:t,author:n}),i=>{i.kind!=="handle"&&s({code:"GeneralException",target:e}),r.hydrateAddress(i);}),r}insertContentControl(t){let e=`${this.path.label}.insertContentControl`,n=t??"RichText";n!=="RichText"&&n!=="PlainText"&&n!=="DatePicker"&&s({code:"NotSupported",target:e});let r=$.promised(this.context,e,false);return this.commandAnswering(e,()=>({op:"insertContentControl",span:this.#r(),subtype:n==="DatePicker"?"date":n==="PlainText"?"plainText":"richText",returnHandle:true}),i=>{i.kind!=="handle"&&s({code:"GeneralException",target:e}),r.hydrateAddress(i);}),r}get tables(){return this.requireUsablePath(),this.#t??=z.over(this.context,`${this.path.label}.tables`,this.path,()=>k(this.path,"span"))}get fields(){return this.requireUsablePath(),this.#e??=V.of(this.context,`${this.path.label}.fields`,this.path,"span")}insertField(t,e,n,r){let i=`${this.path.label}.insertField`;(e!==void 0&&typeof e!="string"||n!==void 0&&typeof n!="string"||r!==void 0&&typeof r!="boolean")&&s({code:"InvalidArgument",target:i});let a=kt(t,i);this.requireUsablePath();let d=F.promised(this.context,i,false);return this.commandAnswering(i,()=>({op:"insertField",span:this.#r(),location:a,...e===void 0?{}:{fieldType:e},...n===void 0?{}:{text:n},...r===void 0?{}:{removeFormatting:r}}),h=>d.hydrateAddress({kind:"handle",handle:m(h,i)})),d}get inlinePictures(){return this.requireUsablePath(),this.#n??=U.of(this.context,`${this.path.label}.inlinePictures`,this.path,"span")}insertInlinePictureFromBase64(t,e){let n=`${this.path.label}.insertInlinePictureFromBase64`;(typeof t!="string"||t.length===0)&&s({code:"InvalidArgument",target:n});let r=kt(e,n);this.requireUsablePath();let i=W.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"insertInlinePicture",span:this.#r(),base64:t,location:r}),a=>{i.hydrateAddress({kind:"handle",handle:m(a,n)});}),i}insertBreak(t,e){let n=`${this.path.label}.insertBreak`;e!=="Before"&&e!=="After"&&s({code:"InvalidArgument",target:n});let r=e;this.requireUsablePath(),this.commandAnswering(n,()=>({op:"insertBreak",span:this.#r(),breakType:t,location:r}),i=>u(i,n));}insertTable(t,e,n,r){let i=`${this.path.label}.insertTable`;(!Number.isInteger(t)||!Number.isInteger(e)||t<1||e<1||!["Before","After"].includes(n))&&s({code:"InvalidArgument",target:i}),r!==void 0&&(!Array.isArray(r)||r.some(h=>!Array.isArray(h)||h.some(v=>typeof v!="string")))&&s({code:"InvalidArgument",target:i});let a=r?.map(h=>[...h]),d=G.promised(this.context,i);return this.commandAnswering(i,()=>({op:"insertTable",span:k(this.path,"span"),location:n,rowCount:t,columnCount:e,...a?{values:a}:{}}),h=>{h.kind!=="handle"&&s({code:"GeneralException",target:i}),d.hydrateAddress({kind:"handle",handle:h.handle});}),d}insertParagraph(t,e){let n=`${this.path.label}.insertParagraph`,r=L(t,n),i=kt(e,n);i!=="Before"&&i!=="After"&&s({code:"InvalidArgument",target:n});let a=this.#r(),d=i==="Before"?a.start.paragraph:a.end.paragraph,h=S.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"insertParagraph",anchor:{paragraph:d},where:i==="Before"?"before":"after",text:r}),v=>{v.kind!=="handle"&&s({code:"GeneralException",target:n}),h.hydrateAddress({kind:"handle",handle:v.handle});}),h}select(t){let e=`${this.path.label}.select`,n=Mt(t,e);this.requireAddressable(),this.internals.capabilities.selection||s({code:"NotSupported",target:e});let r=this.#r();this.command("select",()=>({op:"selectSpan",span:r,mode:n==="Select"?"select":n==="Start"?"start":"end"}));}onLoad(t){let e=this.selection(t,["text","style","hyperlink"]);if(e.includes("hyperlink")&&this.loadTextInto("hyperlink",()=>({op:"getHyperlink",span:this.#r()})),e.includes("text")){let r=`${this.path.label}.text`;this.read(r,()=>({op:"getSpanText",span:this.#r(),projection:this.revisionTextView()}),i=>{this.setLoadedProperty("text",P(i,r));});}if(!e.includes("style"))return;let n=`${this.path.label}.style`;this.requireUsablePath(),this.read(n,()=>({op:"getStyle",span:k(this.path,"span")}),r=>{this.setLoadedProperty("style",At(r,n));});}#r(){return this.requireAddressable(),this.path.span()}};var ft=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&s({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get name(){return this.loadedProperty("name")}get range(){return this.#t??=this.#e(`${this.path.label}.range`),this.#t}select(t){let e=`${this.path.label}.select`,n=Mt(t,e);this.requireUsablePath(),this.internals.capabilities.selection||s({code:"NotSupported",target:e}),this.command("select",()=>({op:"selectBookmark",bookmark:this.#n(),mode:n==="Select"?"select":n==="Start"?"start":"end"}));}onLoad(t){if(!this.selection(t,["name"]).includes("name"))return;let e=`${this.path.label}.name`;this.read(e,()=>({op:"getBookmarkName",bookmark:this.#n()}),n=>{this.setLoadedProperty("name",P(n,e));});}#e(t){let e=b.promised(this.context,t,false);return this.read(t,()=>({op:"getBookmarkRange",bookmark:this.#n()}),n=>{e.hydrateAddress({kind:"span",span:O(n,t)});}),e}#n(){return this.requireAddressable(),this.path.handle()}},Z=class o extends C{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}listing(){return this.#t()}itemAt(t,e){return ft.at(this.context,t,e)}promised(t,e){return ft.promised(this.context,t,e)}};var I=class o extends p{#t;#e;get footnotes(){return this.#t??=D.of(this.context,`${this.path.label}.footnotes`,this.path,()=>({op:"getNotes",document:this.internals.roots().document,scope:this.#l(),noteKind:"footnote"}))}get endnotes(){return this.#e??=D.of(this.context,`${this.path.label}.endnotes`,this.path,()=>({op:"getNotes",document:this.internals.roots().document,scope:this.#l(),noteKind:"endnote"}))}#n;#o;#i;#a;#r;#s;#d;#c;#h;static main(t,e){return new o(t,c.of(e,tt(t).roots().body))}static promisedStory(t,e){return new o(t,c.pending(e))}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}constructor(t,e){super(t,e);}get text(){return this.loadedProperty("text")}get paragraphs(){return this.#a??=this.paragraphsUnder(`${this.path.label}.paragraphs`),this.#a}get bookmarks(){let t=this.#l();return this.#r??=Z.of(this.context,`${this.path.label}.bookmarks`,this.path,()=>({op:"getBookmarks",scope:{body:t}})),this.#r}get font(){return this.#s??=q.of(this.context,`${this.path.label}.font`,this.path,"body"),this.#s}paragraphsUnder(t){return w.of(this.context,t,this.path)}get style(){return this.loadedProperty("style")}set style(t){let e=`${this.path.label}.style`,n=ct(t,e);this.requireAddressable(),this.command("style",()=>({op:"setStyle",span:k(this.path,"body"),name:n}));}get lists(){return this.#d??=ut.of(this.context,`${this.path.label}.lists`,this.path,this.#l()),this.#d}get contentControls(){return this.#c??=H.of(this.context,`${this.path.label}.contentControls`,this.path,{body:this.#l()}),this.#c}getComments(){let t=`${this.path.label}.getComments`,e=this.#l();return X.of(this.context,t,this.path,()=>({op:"getComments",scope:{body:e}}))}get revisions(){return this.#h??=K.of(this.context,`${this.path.label}.revisions`,this.path,this.#l()),this.#h}getRange(t="Whole"){let e=`${this.path.label}.getRange`;this.requireUsablePath();let n=b.promised(this.context,e,false);return this.read(e,()=>({op:"getRange",span:{body:this.path.handle()},location:t}),r=>{n.hydrateAddress({kind:"span",span:O(r,e)});}),n}search(t,e){let n=`${this.path.label}.search`;typeof t!="string"&&s({code:"InvalidArgument",target:n});let r=Wt(e,n),i=this.#l();return B.of(this.context,n,this.path,()=>({op:"search",scope:{body:i},text:t,options:{...r??{},projection:this.revisionTextView()}}))}clear(){let t=this.#l();this.commandDiscarding("clear",()=>({op:"replaceSpan",span:{body:t},text:""}));}insertText(t,e){let n=`${this.path.label}.insertText`,r=L(t,n),i=Ce(e,n);this.requireUsablePath();let a=b.promised(this.context,n,false);return this.commandAnswering(n,()=>i==="Replace"?{op:"replaceSpan",span:{body:this.#l()},text:r}:{op:"insertText",at:{body:this.#l(),at:i==="Start"?"start":"end"},text:r},d=>{a.hydrateAddress({kind:"span",span:O(d,n)});}),a}insertParagraph(t,e){let n=`${this.path.label}.insertParagraph`,r=L(t,n),i=Ae(e,n),a=this.#l(),d=S.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"insertParagraph",anchor:{body:a,at:i==="Start"?"first":"last"},where:i==="Start"?"before":"after",text:r}),h=>{h.kind!=="handle"&&s({code:"GeneralException",target:n}),d.hydrateAddress({kind:"handle",handle:h.handle});}),d}onLoad(t){let e=this.selection(t,["text","style"]);e.includes("text")&&this.loadTextInto("text",()=>({op:"getText",target:this.#l(),projection:this.revisionTextView()})),e.includes("style")&&this.#p();}#p(){let t=`${this.path.label}.style`;this.requireUsablePath(),this.read(t,()=>({op:"getStyle",span:k(this.path,"body")}),e=>{this.setLoadedProperty("style",At(e,t));});}get fields(){return this.requireUsablePath(),this.#o??=V.of(this.context,`${this.path.label}.fields`,this.path,"body")}get inlinePictures(){return this.requireUsablePath(),this.#i??=U.of(this.context,`${this.path.label}.inlinePictures`,this.path,"body")}get tables(){return this.requireUsablePath(),this.#n??=z.over(this.context,`${this.path.label}.tables`,this.path,()=>({body:this.#l()}))}#l(){return this.requireAddressable(),this.path.handle()}};var an=Object.freeze({Primary:"default",FirstPage:"first",EvenPages:"even"}),dn=["pageWidth","pageHeight","orientation","topMargin","rightMargin","bottomMargin","leftMargin"],wt=class o extends p{#t;static of(t,e,n){return new o(t,c.derived(e,n))}constructor(t,e){super(t,e);}get pageWidth(){return this.loadedProperty("pageWidth")}set pageWidth(t){this.#e("pageWidth",bt(t,`${this.path.label}.pageWidth`));}get pageHeight(){return this.loadedProperty("pageHeight")}set pageHeight(t){this.#e("pageHeight",bt(t,`${this.path.label}.pageHeight`));}get orientation(){return this.loadedProperty("orientation")}set orientation(t){let e=`${this.path.label}.orientation`;t!=="Portrait"&&t!=="Landscape"&&s({code:"InvalidArgument",target:e}),this.#e("orientation",t==="Portrait"?"portrait":"landscape");}get topMargin(){return this.loadedProperty("topMargin")}set topMargin(t){this.#e("topMargin",bt(t,`${this.path.label}.topMargin`));}get bottomMargin(){return this.loadedProperty("bottomMargin")}set bottomMargin(t){this.#e("bottomMargin",bt(t,`${this.path.label}.bottomMargin`));}get leftMargin(){return this.loadedProperty("leftMargin")}set leftMargin(t){this.#e("leftMargin",bt(t,`${this.path.label}.leftMargin`));}get rightMargin(){return this.loadedProperty("rightMargin")}set rightMargin(t){this.#e("rightMargin",bt(t,`${this.path.label}.rightMargin`));}onLoad(t){let e=this.selection(t,dn);if(e.length===0)return;let n=`${this.path.label}.pageSetup`;this.read(n,()=>({op:"getPageSetup",section:this.#n()}),r=>{let i=Xt(r,n);for(let a of e)this.setLoadedProperty(a,a==="orientation"?i.orientation==="landscape"?"Landscape":"Portrait":i[a]);});}#e(t,e){if(this.requireUsablePath(),this.#t){this.#t[t]=e;return}let n={[t]:e};this.#t=n;let r=`${this.path.label}.${t}`;this.commandAnswering(`${this.path.label}.pageSetup`,()=>({op:"setPageSetup",section:this.#n(),setup:n}),i=>{u(i,r);},()=>{this.#t===n&&(this.#t=void 0);});}#n(){this.requireAddressable();let t=this.path.address();return t.kind!=="handle"&&s({code:"InvalidObjectPath",target:this.path.label}),t.handle}},yt=class o extends p{#t;#e;static at(t,e,n){return n.kind!=="handle"&&s({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get body(){return this.#e??=I.main(this.context,`${this.path.label}.body`),this.#e}get pageSetup(){return this.#t??=wt.of(this.context,`${this.path.label}.pageSetup`,this.path),this.#t}getHeader(t){return this.#n("header",t,"getHeader")}getFooter(t){return this.#n("footer",t,"getFooter")}getNext(){let t=`${this.path.label}.getNext`,e=o.promised(this.context,t,false),n=this.internals.roots().document;return this.read(t,()=>({op:"getSections",document:n}),r=>{let i=R(r,t),a=i.findIndex(h=>h.ref===this.#o().ref),d=a<0?void 0:i[a+1];d||s({code:"ItemNotFound",target:t}),e.hydrateAddress({kind:"handle",handle:d});}),e}onLoad(t){this.selection(t,[]);}#n(t,e,n){let r=`${this.path.label}.${n}`,i=an[e];i===void 0&&s({code:"InvalidArgument",target:r});let a=I.promisedStory(this.context,r);return this.read(r,()=>({op:"getFurniture",section:this.#o(),kind:t,variant:i}),d=>{a.hydrateAddress({kind:"handle",handle:m(d,r)});}),a}#o(){return this.requireAddressable(),this.path.handle()}},xt=class o extends C{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#t()}itemAt(t,e){return yt.at(this.context,t,e)}promised(t,e){return yt.promised(this.context,t,e)}};function bt(o,t){return (typeof o!="number"||!Number.isFinite(o)||o<0)&&s({code:"InvalidArgument",target:t}),o}var Ct=class o extends p{#t;#e;#n;#o;#i;#a;#r;#s;#d;static open(t){return new o(t)}constructor(t){super(t,c.of("document",tt(t).roots().document));}get changeTrackingMode(){return this.loadedProperty("changeTrackingMode")}set changeTrackingMode(t){["Off","TrackAll","TrackMineOnly"].includes(t)||s({code:"InvalidArgument",target:"document.changeTrackingMode"});let e=this.internals.author;this.commandAnswering("document.changeTrackingMode",()=>({op:"setChangeTrackingMode",mode:t,...e===void 0?{}:{author:e}}),()=>this.setLoadedProperty("changeTrackingMode",t));}get body(){return this.#e??=I.main(this.context,"document.body"),this.#e}removeDocumentInformation(t){this.command(`${this.path.label}.removeDocumentInformation`,()=>({op:"removeDocumentInformation",removeDocInfoType:t}));}get properties(){return this.#t??=dt.of(this.context,this.path),this.#t}get paragraphs(){return this.#n??=this.body.paragraphsUnder("document.paragraphs"),this.#n}get sections(){let t=this.path.handle();return this.#o??=xt.of(this.context,"document.sections",this.path,()=>({op:"getSections",document:t})),this.#o}get contentControls(){return this.#r??=H.of(this.context,"document.contentControls",this.path,{body:this.internals.roots().body}),this.#r}get comments(){return this.#i??=X.of(this.context,"document.comments",this.path,()=>({op:"getComments",scope:{body:this.internals.roots().body}})),this.#i}get revisions(){return this.#a??=K.of(this.context,"document.revisions",this.path,this.internals.roots().body),this.#a}get footnotes(){let t=this.path.handle();return this.#s??=D.of(this.context,"document.footnotes",this.path,()=>({op:"getNotes",document:t,noteKind:"footnote"})),this.#s}get endnotes(){let t=this.path.handle();return this.#d??=D.of(this.context,"document.endnotes",this.path,()=>({op:"getNotes",document:t,noteKind:"endnote"})),this.#d}onLoad(t){if(t.select.length===0)return;this.selection(t,["changeTrackingMode"]).includes("changeTrackingMode")&&this.loadTextInto("changeTrackingMode",()=>({op:"getChangeTrackingMode"}));}};function Ut(o){let t=o.host,e=Object.freeze({...t.capabilities,save:o.save&&t.capabilities.save}),n=typeof o.author=="string"&&o.author.trim().length>0?o.author:void 0,r=o.revisionTextView??"allMarkup";r!=="allMarkup"&&r!=="original"&&s({code:"InvalidArgument",target:"revisionTextView"});let i=false,a=null,d=g=>{i&&s({code:"RuntimeDisposed",...g===void 0?{}:{target:g}});},h=()=>{if(a)return a;d("document");let g=we(t.execute({operations:[{op:"getDocument"}]}),"document"),J=we(t.execute({operations:[{op:"getBody",document:g}]}),"document.body");return a={document:g,body:J},a},v={host:t,capabilities:e,...n===void 0?{}:{author:n},revisionTextView:r,id:{},roots:h,assertLive:d,openDocument:g=>Ct.open(g)};try{h();}catch{a=null;}async function Y(g,J){d();let at=typeof g=="function"?g:J,Gt=typeof g=="function"?[]:Array.isArray(g)?g:[g];typeof at!="function"&&s({code:"InvalidArgument",target:"run"});let{context:jt,adopt:y,finish:Ee}=Pt.begin(v);try{return y(Gt),await at(jt)}finally{Ee();}}let st={capabilities:e,run:Y,dispose(){i||(i=true,a=null,t.dispose());}};return o.save?{...st,async save(){d("save"),e.save||s({code:"NotSupported",target:"save"});let g=t.save();if(!g.ok)throw Bt(g.error,{target:"save"});return g.bytes}}:st}function we(o,t){let e=o.results[0];if(e?.status==="error")throw Bt(e.error,{target:t});if(e?.status!=="ok")throw new A({code:"GeneralException",target:t});return m(e.value,t)}function Se(o,t={}){return Ut({host:createBrowserAutomationHost(o),save:false,...t.author===void 0?{}:{author:t.author},...t.revisionTextView===void 0?{}:{revisionTextView:t.revisionTextView}})}function je(o){return createAutomationPaginationProvider(o)}function pn(o){if(o){for(let t of o)if(t.collaboration)return t.collaboration}}function un(o){let t=[o?.zip?.maxEntries,o?.zip?.maxTotalBytes,o?.xml?.maxBytes,o?.xml?.maxElements,o?.maxXmlParts,o?.maxRelationships],e=o?.zip?.maxRatio;(t.some(n=>n!==void 0&&(!Number.isInteger(n)||n<0))||e!==void 0&&(!Number.isFinite(e)||e<0))&&s({code:"InvalidArgument",target:"createServer"});}async function ce(o,t={}){un(t.limits);let e=pn(t.modules),n=createServerAutomationHost(o,{...t.pagination?{pagination:je(t.pagination)}:{},...t.limits===void 0?{}:{limits:t.limits},...e===void 0?{}:{collaborationModel:e}});if(!n.ok){let r={"too-many-entries":"zip.maxEntries","too-large":"xml.maxBytes","too-many-elements":"xml.maxElements","too-deep":"xml.maxDepth","too-many-xml-parts":"maxXmlParts","too-many-relationships":"maxRelationships"},i=n.limit??r[n.reason];s({code:i===void 0?"InvalidArgument":"ResourceLimitExceeded",target:"createServer",...i===void 0?{}:{limit:i}});}return Ut({host:n.host,save:true,...t.author===void 0?{}:{author:t.author},...t.revisionTextView===void 0?{}:{revisionTextView:t.revisionTextView}})}function Te(o,t,e={}){return ce(o,{...e,modules:[...e.modules??[],{id:"collaboration",collaboration:{session:t}}]})}var he=(l=>(l.addin="Addin",l.addressBlock="AddressBlock",l.advance="Advance",l.ask="Ask",l.author="Author",l.autoText="AutoText",l.autoTextList="AutoTextList",l.barCode="BarCode",l.bibliography="Bibliography",l.bidiOutline="BidiOutline",l.citation="Citation",l.comments="Comments",l.compare="Compare",l.createDate="CreateDate",l.data="Data",l.database="Database",l.date="Date",l.displayBarcode="DisplayBarcode",l.docProperty="DocProperty",l.docVariable="DocVariable",l.editTime="EditTime",l.embedded="Embedded",l.empty="Empty",l.eq="EQ",l.expression="Expression",l.fileName="FileName",l.fileSize="FileSize",l.fillIn="FillIn",l.formCheckbox="FormCheckbox",l.formDropdown="FormDropdown",l.formText="FormText",l.gotoButton="GotoButton",l.greetingLine="GreetingLine",l.hyperlink="Hyperlink",l.if="If",l.import="Import",l.include="Include",l.includePicture="IncludePicture",l.includeText="IncludeText",l.index="Index",l.info="Info",l.keywords="Keywords",l.lastSavedBy="LastSavedBy",l.link="Link",l.listNum="ListNum",l.macroButton="MacroButton",l.mergeBarcode="MergeBarcode",l.mergeField="MergeField",l.mergeRec="MergeRec",l.mergeSeq="MergeSeq",l.next="Next",l.nextIf="NextIf",l.noteRef="NoteRef",l.numChars="NumChars",l.numPages="NumPages",l.numWords="NumWords",l.ocx="OCX",l.others="Others",l.page="Page",l.pageRef="PageRef",l.print="Print",l.printDate="PrintDate",l.private="Private",l.quote="Quote",l.rd="RD",l.ref="Ref",l.revNum="RevNum",l.saveDate="SaveDate",l.section="Section",l.sectionPages="SectionPages",l.seq="Seq",l.set="Set",l.shape="Shape",l.skipIf="SkipIf",l.styleRef="StyleRef",l.subject="Subject",l.subscriber="Subscriber",l.symbol="Symbol",l.ta="TA",l.tc="TC",l.template="Template",l.time="Time",l.title="Title",l.toa="TOA",l.toc="TOC",l.undefined="Undefined",l.userAddress="UserAddress",l.userInitials="UserInitials",l.userName="UserName",l.xe="XE",l))(he||{});var rs=Object.freeze({createBrowser:Se,createServer:ce,createCollaborative:Te});export{Jt as Alignment,I as Body,ft as Bookmark,Z as BookmarkCollection,ne as BreakType,te as ChangeTrackingMode,M as ClientObject,Dt as ClientResult,Q as Comment,X as CommentCollection,it as CommentReply,Lt as CommentReplyCollection,$ as ContentControl,H as ContentControlCollection,oe as ContentControlType,Ct as Document,dt as DocumentProperties,rs as DocxEditor,A as DocxEditorError,F as Field,V as FieldCollection,he as FieldType,q as Font,W as InlinePicture,U as InlinePictureCollection,Yt as InsertLocation,T as List,se as ListBullet,ut as ListCollection,mt as ListItem,ae as ListNumbering,lt as NoteItem,D as NoteItemCollection,_t as PageOrientation,wt as PageSetup,S as Paragraph,w as ParagraphCollection,b as Range,B as RangeCollection,re as RemoveDocInfoType,Pt as RequestContext,rt as Revision,K as RevisionCollection,yt as Section,xt as SectionCollection,G as Table,nt as TableCell,Ot as TableCellCollection,z as TableCollection,ht as TableRow,ot as TableRowCollection,vt as TrackedObjects,de as UnderlineType,ee as VerticalAlignment,De as isDocxEditorError};
package/dist/index.d.mts CHANGED
@@ -59,8 +59,8 @@
59
59
  * @public
60
60
  */
61
61
  import { EditorCollaborationSession } from '@docx-editor.dev/core/collaboration';
62
- import { C as CreateServerOptions, D as DocxEditorServerRuntime, a as CreateCollaborativeOptions } from './server-mLIW1Y6U.mjs';
63
- export { A as Alignment, B as BesideLocation, b as Body, c as BodyInsertParagraphLocation, d as BodyInsertTextLocation, e as Bookmark, f as BookmarkCollection, g as BreakType, h as ChangeTrackingMode, i as ClientObject, j as ClientResult, k as Comment, l as CommentCollection, m as CommentReply, n as CommentReplyCollection, o as ContentControl, p as ContentControlCollection, q as ContentControlLockState, r as ContentControlSubtype, s as ContentControlType, t as ContentControlValue, u as Document, v as DocumentCapabilities, w as DocumentLimits, x as DocumentXmlLimits, y as DocumentZipLimits, z as DocxEditorError, E as DocxEditorErrorCode, F as DocxEditorErrorInit, G as DocxEditorRuntime, H as EditorModule, I as Field, J as FieldCollection, K as FieldType, L as FieldTypeLiteral, M as Font, N as HeaderFooterType, O as InlinePicture, P as InlinePictureCollection, Q as InsertLocation, R as List, S as ListBullet, T as ListCollection, U as ListItem, V as ListNumbering, W as LoadOption, X as LoadQueryOptions, Y as NoteItem, Z as NoteItemCollection, _ as NoteItemType, $ as PageOrientation, a0 as PageSetup, a1 as Paragraph, a2 as ParagraphAlignment, a3 as ParagraphCollection, a4 as ParagraphInsertTextLocation, a5 as Range, a6 as RangeCollection, a7 as RangeInsertTextLocation, a8 as RequestContext, a9 as Revision, aa as RevisionCollection, ab as RevisionTextView, ac as RevisionType, ad as RunCallback, ae as SearchOptions, af as Section, ag as SectionCollection, ah as SelectionMode, ai as ServerPaginationOptions, aj as Table, ak as TableCell, al as TableCellCollection, am as TableCollection, an as TableRow, ao as TableRowCollection, ap as TrackedObjects, aq as UnderlineType, ar as VerticalAlignment, as as isDocxEditorError } from './server-mLIW1Y6U.mjs';
62
+ import { C as CreateServerOptions, D as DocxEditorServerRuntime, a as CreateCollaborativeOptions } from './server-Csjpe214.mjs';
63
+ export { A as Alignment, B as BesideLocation, b as Body, c as BodyInsertParagraphLocation, d as BodyInsertTextLocation, e as Bookmark, f as BookmarkCollection, g as BreakType, h as ChangeTrackingMode, i as ClientObject, j as ClientResult, k as Comment, l as CommentCollection, m as CommentReply, n as CommentReplyCollection, o as ContentControl, p as ContentControlCollection, q as ContentControlLockState, r as ContentControlSubtype, s as ContentControlType, t as ContentControlValue, u as Document, v as DocumentCapabilities, w as DocumentLimits, x as DocumentProperties, y as DocumentXmlLimits, z as DocumentZipLimits, E as DocxEditorError, F as DocxEditorErrorCode, G as DocxEditorErrorInit, H as DocxEditorRuntime, I as EditorModule, J as Field, K as FieldCollection, L as FieldType, M as FieldTypeLiteral, N as Font, O as HeaderFooterType, P as InlinePicture, Q as InlinePictureCollection, R as InsertLocation, S as List, T as ListBullet, U as ListCollection, V as ListItem, W as ListNumbering, X as LoadOption, Y as LoadQueryOptions, Z as NoteItem, _ as NoteItemCollection, $ as NoteItemType, a0 as PageOrientation, a1 as PageSetup, a2 as Paragraph, a3 as ParagraphAlignment, a4 as ParagraphCollection, a5 as ParagraphInsertTextLocation, a6 as Range, a7 as RangeCollection, a8 as RangeInsertTextLocation, a9 as RemoveDocInfoType, aa as RequestContext, ab as Revision, ac as RevisionCollection, ad as RevisionTextView, ae as RevisionType, af as RunCallback, ag as SearchOptions, ah as Section, ai as SectionCollection, aj as SelectionMode, ak as ServerPaginationOptions, al as Table, am as TableCell, an as TableCellCollection, ao as TableCollection, ap as TableRow, aq as TableRowCollection, ar as TrackedObjects, as as UnderlineType, at as VerticalAlignment, au as isDocxEditorError } from './server-Csjpe214.mjs';
64
64
  export { RevisionBatchEntry, RevisionBatchResult, RevisionBatchSkipReason } from '@docx-editor.dev/core/automation';
65
65
 
66
66
  /**
@@ -163,4 +163,5 @@ interface DocxEditorNamespace {
163
163
  */
164
164
  declare const DocxEditor: DocxEditorNamespace;
165
165
 
166
- export { CreateCollaborativeOptions, CreateServerOptions, DocxEditor, type DocxEditorNamespace, DocxEditorServerRuntime };
166
+ export { CreateCollaborativeOptions, CreateServerOptions, DocxEditor, DocxEditorServerRuntime };
167
+ export type { DocxEditorNamespace };
package/dist/index.d.ts CHANGED
@@ -59,8 +59,8 @@
59
59
  * @public
60
60
  */
61
61
  import { EditorCollaborationSession } from '@docx-editor.dev/core/collaboration';
62
- import { C as CreateServerOptions, D as DocxEditorServerRuntime, a as CreateCollaborativeOptions } from './server-mLIW1Y6U.js';
63
- export { A as Alignment, B as BesideLocation, b as Body, c as BodyInsertParagraphLocation, d as BodyInsertTextLocation, e as Bookmark, f as BookmarkCollection, g as BreakType, h as ChangeTrackingMode, i as ClientObject, j as ClientResult, k as Comment, l as CommentCollection, m as CommentReply, n as CommentReplyCollection, o as ContentControl, p as ContentControlCollection, q as ContentControlLockState, r as ContentControlSubtype, s as ContentControlType, t as ContentControlValue, u as Document, v as DocumentCapabilities, w as DocumentLimits, x as DocumentXmlLimits, y as DocumentZipLimits, z as DocxEditorError, E as DocxEditorErrorCode, F as DocxEditorErrorInit, G as DocxEditorRuntime, H as EditorModule, I as Field, J as FieldCollection, K as FieldType, L as FieldTypeLiteral, M as Font, N as HeaderFooterType, O as InlinePicture, P as InlinePictureCollection, Q as InsertLocation, R as List, S as ListBullet, T as ListCollection, U as ListItem, V as ListNumbering, W as LoadOption, X as LoadQueryOptions, Y as NoteItem, Z as NoteItemCollection, _ as NoteItemType, $ as PageOrientation, a0 as PageSetup, a1 as Paragraph, a2 as ParagraphAlignment, a3 as ParagraphCollection, a4 as ParagraphInsertTextLocation, a5 as Range, a6 as RangeCollection, a7 as RangeInsertTextLocation, a8 as RequestContext, a9 as Revision, aa as RevisionCollection, ab as RevisionTextView, ac as RevisionType, ad as RunCallback, ae as SearchOptions, af as Section, ag as SectionCollection, ah as SelectionMode, ai as ServerPaginationOptions, aj as Table, ak as TableCell, al as TableCellCollection, am as TableCollection, an as TableRow, ao as TableRowCollection, ap as TrackedObjects, aq as UnderlineType, ar as VerticalAlignment, as as isDocxEditorError } from './server-mLIW1Y6U.js';
62
+ import { C as CreateServerOptions, D as DocxEditorServerRuntime, a as CreateCollaborativeOptions } from './server-Csjpe214.js';
63
+ export { A as Alignment, B as BesideLocation, b as Body, c as BodyInsertParagraphLocation, d as BodyInsertTextLocation, e as Bookmark, f as BookmarkCollection, g as BreakType, h as ChangeTrackingMode, i as ClientObject, j as ClientResult, k as Comment, l as CommentCollection, m as CommentReply, n as CommentReplyCollection, o as ContentControl, p as ContentControlCollection, q as ContentControlLockState, r as ContentControlSubtype, s as ContentControlType, t as ContentControlValue, u as Document, v as DocumentCapabilities, w as DocumentLimits, x as DocumentProperties, y as DocumentXmlLimits, z as DocumentZipLimits, E as DocxEditorError, F as DocxEditorErrorCode, G as DocxEditorErrorInit, H as DocxEditorRuntime, I as EditorModule, J as Field, K as FieldCollection, L as FieldType, M as FieldTypeLiteral, N as Font, O as HeaderFooterType, P as InlinePicture, Q as InlinePictureCollection, R as InsertLocation, S as List, T as ListBullet, U as ListCollection, V as ListItem, W as ListNumbering, X as LoadOption, Y as LoadQueryOptions, Z as NoteItem, _ as NoteItemCollection, $ as NoteItemType, a0 as PageOrientation, a1 as PageSetup, a2 as Paragraph, a3 as ParagraphAlignment, a4 as ParagraphCollection, a5 as ParagraphInsertTextLocation, a6 as Range, a7 as RangeCollection, a8 as RangeInsertTextLocation, a9 as RemoveDocInfoType, aa as RequestContext, ab as Revision, ac as RevisionCollection, ad as RevisionTextView, ae as RevisionType, af as RunCallback, ag as SearchOptions, ah as Section, ai as SectionCollection, aj as SelectionMode, ak as ServerPaginationOptions, al as Table, am as TableCell, an as TableCellCollection, ao as TableCollection, ap as TableRow, aq as TableRowCollection, ar as TrackedObjects, as as UnderlineType, at as VerticalAlignment, au as isDocxEditorError } from './server-Csjpe214.js';
64
64
  export { RevisionBatchEntry, RevisionBatchResult, RevisionBatchSkipReason } from '@docx-editor.dev/core/automation';
65
65
 
66
66
  /**
@@ -163,4 +163,5 @@ interface DocxEditorNamespace {
163
163
  */
164
164
  declare const DocxEditor: DocxEditorNamespace;
165
165
 
166
- export { CreateCollaborativeOptions, CreateServerOptions, DocxEditor, type DocxEditorNamespace, DocxEditorServerRuntime };
166
+ export { CreateCollaborativeOptions, CreateServerOptions, DocxEditor, DocxEditorServerRuntime };
167
+ export type { DocxEditorNamespace };