@kitschpatrol/tldraw-cli 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/cli.js +2 -2
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  var So=Object.create;var vr=Object.defineProperty;var Co=Object.getOwnPropertyDescriptor;var Ao=Object.getOwnPropertyNames;var jo=Object.getPrototypeOf,Po=Object.prototype.hasOwnProperty;var ze=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var Io=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Fo=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ao(e))!Po.call(i,r)&&r!==t&&vr(i,r,{get:()=>e[r],enumerable:!(n=Co(e,r))||n.enumerable});return i};var Mo=(i,e,t)=>(t=i!=null?So(jo(i)):{},Fo(e||!i||!i.__esModule?vr(t,"default",{value:i,enumerable:!0}):t,i));var Pr=Io((pn,gn)=>{(function(i,e){typeof pn=="object"&&typeof gn<"u"?gn.exports=e():typeof define=="function"&&define.amd?define(e):(i=i||self,i.v=e())})(pn,function(){"use strict";function i(){return i=Object.assign||function(o){for(var u=1;u<arguments.length;u++){var l=arguments[u];for(var p in l)Object.prototype.hasOwnProperty.call(l,p)&&(o[p]=l[p])}return o},i.apply(this,arguments)}function e(o,u){return r(o)||c(o,u)||b()}function t(o){return n(o)||s(o)||d()}function n(o){if(Array.isArray(o)){for(var u=0,l=new Array(o.length);u<o.length;u++)l[u]=o[u];return l}}function r(o){if(Array.isArray(o))return o}function s(o){if(Symbol.iterator in Object(o)||Object.prototype.toString.call(o)==="[object Arguments]")return Array.from(o)}function c(o,u){if(Symbol.iterator in Object(o)||Object.prototype.toString.call(o)==="[object Arguments]"){var l=[],p=!0,v=!1,A=void 0;try{for(var $=o[Symbol.iterator](),te;!(p=(te=$.next()).done)&&(l.push(te.value),!(u&&l.length===u));p=!0);}catch(Z){v=!0,A=Z}finally{try{!p&&$.return!=null&&$.return()}finally{if(v)throw A}}return l}}function d(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function b(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function y(o){return o==null}function E(o){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return y(o)?u:!!o}function w(o){return typeof o=="string"}function f(o){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return y(o)?u:w(o)?o:String(o)}function _(o,u){var l=f(o),p=E(u);return l===""?"":(p&&(l=l.toLowerCase()),l.substr(0,1).toUpperCase()+l.substr(1))}function F(o){var u=f(o,"");return u.toLowerCase()}var S="\\d",x="\\s\\uFEFF\\xA0",B="\\uD800-\\uDBFF",G="\\uDC00-\\uDFFF",X="\\u0300-\\u036F\\u1AB0-\\u1AFF\\u1DC0-\\u1DFF\\u20D0-\\u20FF\\uFE20-\\uFE2F",K="\\0-\\u02FF\\u0370-\\u1AAF\\u1B00-\\u1DBF\\u1E00-\\u20CF\\u2100-\\uD7FF\\uE000-\\uFE1F\\uFE30-\\uFFFF",k=new RegExp("(["+K+"]|["+B+"]["+G+"]|["+B+"](?!["+G+"])|(?:[^"+B+"]|^)["+G+"])(["+X+"]+)","g"),de=new RegExp("(["+B+"])(["+G+"])","g"),ne=new RegExp("((?:["+K+"]|["+B+"]["+G+"]|["+B+"](?!["+G+"])|(?:[^"+B+"]|^)["+G+"])(?:["+X+"]+))|(["+B+"]["+G+"])|([\\n\\r\\u2028\\u2029])|(.)","g"),We=new RegExp("["+x+"]"),Ue=new RegExp("^["+x+"]+"),q=new RegExp("["+x+"]+$"),R=new RegExp("^"+S+"+$"),P=/[-[\]{}()*+!<=:?./\\^$|#,]/g,N=/[^A-Za-z0-9]/g,H=/[<>&"'`]/g,ee=/(%{1,2})(?:(\d+)\$)?(\+)?([ 0]|'.{1})?(-)?(\d+)?(?:\.(\d+))?([bcdiouxXeEfgGs])?/g,pe=/\.?0+$/g,Q=/<([A-Za-z0-9]+)>/g,ge="\\u2000-\\u206F",Ve="\\x00-\\x2F\\x3A-\\x40\\x5B-\\x60\\x7b-\\xBF\\xD7\\xF7",ue="\\u2700-\\u27BF",Oe="a-z\\xB5\\xDF-\\xF6\\xF8-\\xFF\\u0101\\u0103\\u0105\\u0107\\u0109\\u010B\\u010D\\u010F\\u0111\\u0113\\u0115\\u0117\\u0119\\u011B\\u011D\\u011F\\u0121\\u0123\\u0125\\u0127\\u0129\\u012B\\u012D\\u012F\\u0131\\u0133\\u0135\\u0137\\u0138\\u013A\\u013C\\u013E\\u0140\\u0142\\u0144\\u0146\\u0148\\u0149\\u014B\\u014D\\u014F\\u0151\\u0153\\u0155\\u0157\\u0159\\u015B\\u015D\\u015F\\u0161\\u0163\\u0165\\u0167\\u0169\\u016B\\u016D\\u016F\\u0171\\u0173\\u0175\\u0177\\u017A\\u017C\\u017E-\\u0180\\u0183\\u0185\\u0188\\u018C\\u018D\\u0192\\u0195\\u0199-\\u019B\\u019E\\u01A1\\u01A3\\u01A5\\u01A8\\u01AA\\u01AB\\u01AD\\u01B0\\u01B4\\u01B6\\u01B9\\u01BA\\u01BD-\\u01BF\\u01C6\\u01C9\\u01CC\\u01CE\\u01D0\\u01D2\\u01D4\\u01D6\\u01D8\\u01DA\\u01DC\\u01DD\\u01DF\\u01E1\\u01E3\\u01E5\\u01E7\\u01E9\\u01EB\\u01ED\\u01EF\\u01F0\\u01F3\\u01F5\\u01F9\\u01FB\\u01FD\\u01FF\\u0201\\u0203\\u0205\\u0207\\u0209\\u020B\\u020D\\u020F\\u0211\\u0213\\u0215\\u0217\\u0219\\u021B\\u021D\\u021F\\u0221\\u0223\\u0225\\u0227\\u0229\\u022B\\u022D\\u022F\\u0231\\u0233-\\u0239\\u023C\\u023F\\u0240\\u0242\\u0247\\u0249\\u024B\\u024D\\u024F",_e="\\x41-\\x5a\\xc0-\\xd6\\xd8-\\xde\\u0100\\u0102\\u0104\\u0106\\u0108\\u010a\\u010c\\u010e\\u0110\\u0112\\u0114\\u0116\\u0118\\u011a\\u011c\\u011e\\u0120\\u0122\\u0124\\u0126\\u0128\\u012a\\u012c\\u012e\\u0130\\u0132\\u0134\\u0136\\u0139\\u013b\\u013d\\u013f\\u0141\\u0143\\u0145\\u0147\\u014a\\u014c\\u014e\\u0150\\u0152\\u0154\\u0156\\u0158\\u015a\\u015c\\u015e\\u0160\\u0162\\u0164\\u0166\\u0168\\u016a\\u016c\\u016e\\u0170\\u0172\\u0174\\u0176\\u0178\\u0179\\u017b\\u017d\\u0181\\u0182\\u0184\\u0186\\u0187\\u0189-\\u018b\\u018e-\\u0191\\u0193\\u0194\\u0196-\\u0198\\u019c\\u019d\\u019f\\u01a0\\u01a2\\u01a4\\u01a6\\u01a7\\u01a9\\u01ac\\u01ae\\u01af\\u01b1-\\u01b3\\u01b5\\u01b7\\u01b8\\u01bc\\u01c4\\u01c5\\u01c7\\u01c8\\u01ca\\u01cb\\u01cd\\u01cf\\u01d1\\u01d3\\u01d5\\u01d7\\u01d9\\u01db\\u01de\\u01e0\\u01e2\\u01e4\\u01e6\\u01e8\\u01ea\\u01ec\\u01ee\\u01f1\\u01f2\\u01f4\\u01f6-\\u01f8\\u01fa\\u01fc\\u01fe\\u0200\\u0202\\u0204\\u0206\\u0208\\u020a\\u020c\\u020e\\u0210\\u0212\\u0214\\u0216\\u0218\\u021a\\u021c\\u021e\\u0220\\u0222\\u0224\\u0226\\u0228\\u022a\\u022c\\u022e\\u0230\\u0232\\u023a\\u023b\\u023d\\u023e\\u0241\\u0243-\\u0246\\u0248\\u024a\\u024c\\u024e",Be=new RegExp("(?:["+_e+"]["+X+"]*)?(?:["+Oe+"]["+X+"]*)+|(?:["+_e+"]["+X+"]*)+(?!["+Oe+"])|["+S+"]+|["+ue+"]|[^"+Ve+ge+x+"]+","g"),W=/[A-Z\xC0-\xD6\xD8-\xDE]?[a-z\xDF-\xF6\xF8-\xFF]+|[A-Z\xC0-\xD6\xD8-\xDE]+(?![a-z\xDF-\xF6\xF8-\xFF])|\d+/g,_t=new RegExp("^(?:["+Oe+_e+"]["+X+"]*)+$"),U=new RegExp("^((?:["+Oe+_e+"]["+X+"]*)|["+S+"])+$"),ie=/^[\x01-\xFF]*$/;function re(o,u){return o??u}function Y(o){return y(o)?null:w(o)?o:String(o)}function se(o,u,l){var p=f(o),v;if(y(u))v=ie.test(p)?W:Be;else if(u instanceof RegExp)v=u;else{var A=Y(re(l,""));v=new RegExp(Y(u),A)}return re(p.match(v),[])}function fe(o,u){return u===0?F(o):_(o,!0)}function Ae(o){var u=f(o);return u===""?"":se(u).map(fe).join("")}function je(o){var u=f(o);return u===""?"":u.substr(0,1).toLowerCase()+u.substr(1)}function tt(o){var u=f(o);return u===""?"":se(u).map(F).join("-")}function h(o){var u=f(o);return u===""?"":se(u).map(F).join("_")}function m(o){var u=f(o);return u.toUpperCase()}function C(o){var u=f(o);return u.split("").reduce(O,"")}function O(o,u){var l=u.toLowerCase(),p=u.toUpperCase();return o+(u===l?p:l)}function g(o,u){var l=f(o),p=Array.isArray(u)?u:[],v=ie.test(l)?W:Be;return l.replace(v,function(A,$){var te=$>0&&p.indexOf(l[$-1])>=0;return te?A.toLowerCase():_(A,!0)})}function I(o,u,l){return o<=u?u:o>=l?l:o}var j=9007199254740991;function M(o){return o===1/0?j:o===-1/0?-j:~~o}function me(o,u,l){var p=f(o),v=y(u)?p.length:I(M(u),0,j),A=f(l,"...");return v>=p.length?p:p.substr(0,u-A.length)+A}function ye(o,u){var l=f(o);return l.charAt(u)}var Yn=55296,$i=56319,Vn=56320,Li=57343;function Wi(o){return o>=Yn&&o<=$i}function Ui(o){return o>=Vn&&o<=Li}function Bi(o,u){return(o-Yn)*1024+u-Vn+65536}function qe(o){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return y(o)?u:typeof o=="number"?o:Number(o)}function qn(o,u){return o!==o?u:o}function Kn(o,u){var l=f(o),p=l.length,v=qe(u);if(v=qn(v,0),!(v<0||v>=p)){var A=l.charCodeAt(v),$;return Wi(A)&&p>v+1&&($=l.charCodeAt(v+1),Ui($))?Bi(A,$):A}}function Gi(o,u){var l=f(o),p=y(u)?1:I(M(u),0,j);return l.length<=p?l:l.substr(0,p)}function zi(o,u){var l=f(o),p=qe(u),v,A=0;for(p=qn(p,0);(v=ne.exec(l))!==null;){if(A===p)return ne.lastIndex=0,v[0];A++}return""}function Hi(o,u){var l=f(o),p=y(u)?1:I(M(u),0,j);return l.length<=p?l:l.substr(l.length-p,p)}function Yi(o,u,l){var p=f(o),v=y(u)?p.length:I(M(u),0,j),A=f(l,"...");if(v>=p.length)return p;var $=ie.test(p)?W:Be,te=0;return p.replace($,function(Z,be){var J=be+Z.length;J<=v-A.length&&(te=J)}),p.substr(0,te)+A}function Vi(o,u,l){return f(o).slice(u,l)}function qi(o,u,l){return f(o).substr(u,l)}function Ki(o,u,l){return f(o).substring(u,l)}function Xi(o){return f(o).length}function ki(o){return f(o).replace(k,"*").replace(de,"*").length}function Zi(o,u){var l=f(o),p=f(u),v=p.length,A=0,$=0;if(l===""||p==="")return A;do $=l.indexOf(p,$),$!==-1&&(A++,$+=v);while($!==-1);return A}var Ji=Array.prototype.reduce;function Qi(o,u,l){var p=f(o);if(p===""||typeof u!="function")return 0;var v=u.bind(l);return Ji.call(p,function(A,$,te){return v($,te,p)?A+1:A},0)}function es(o,u,l){return se(o,u,l).length}function Dt(){this.index=0}Dt.prototype.increment=function(){this.index++},Dt.prototype.incrementOnEmptyPosition=function(o){y(o)&&this.increment()},Dt.prototype.getIndexByPosition=function(o){return y(o)?this.index:o-1};var ts="i",Xn="b",kn="c",ns="d",Zn="o",rs="u",Jn="x",Qn="X",er="e",tr="E",nr="f",rr="g",nn="G",is="s",ss="'",ir="+",os="-",as="%%",us=2,cs=8,sr=16;function or(o,u){for(var l=f(o),p=y(u)?1:I(M(u),0,j),v="";p;)p&1&&(v+=l),p>1&&(l+=l),p>>=1;return v}function Tt(o,u){var l=M(u/o.length),p=u%o.length;return or(o,l+p).substr(0,u)}function ar(o,u,l){var p=f(o),v=y(u)?0:I(M(u),0,j),A=f(l," ");return v<=p.length?p:Tt(A,v-p.length)+p}function ur(o,u,l){var p=f(o),v=y(u)?0:I(M(u),0,j),A=f(l," ");return v<=p.length?p:p+Tt(A,v-p.length)}function ls(o,u){var l=u.width;if(y(l)||o.length>=l)return o;var p=u.alignmentSpecifier===os?ur:ar;return p(o,l,u.getPaddingCharacter())}function cr(o,u,l){return l.signSpecifier===ir&&o>=0&&(u=ir+u),u}function fs(o,u){var l=parseFloat(o),p;isNaN(l)&&(l=0);var v=qe(u.precision,6);switch(u.typeSpecifier){case nr:p=l.toFixed(v);break;case er:p=l.toExponential(v);break;case tr:p=l.toExponential(v).toUpperCase();break;case rr:case nn:p=hs(l,v,u);break}return p=cr(l,p,u),f(p)}function hs(o,u,l){if(o===0)return"0";var p=u===0?1:u,v=o.toPrecision(p).replace(pe,"");return l.typeSpecifier===nn&&(v=v.toUpperCase()),v}function ds(o,u){var l=parseInt(o);switch(isNaN(l)&&(l=0),l=l>>>0,u.typeSpecifier){case kn:l=String.fromCharCode(l);break;case Xn:l=l.toString(us);break;case Zn:l=l.toString(cs);break;case Jn:l=l.toString(sr);break;case Qn:l=l.toString(sr).toUpperCase();break}return f(l)}function ps(o,u){var l=parseInt(o);return isNaN(l)&&(l=0),cr(l,Y(l),u)}function gs(o,u){var l=o,p=u.precision;return!y(p)&&l.length>p&&(l=me(l,p,"")),l}function ms(o,u){var l;switch(u.typeSpecifier){case is:l=gs;break;case ns:case ts:l=ps;break;case kn:case Xn:case Zn:case Jn:case Qn:case rs:l=ds;break;case nr:case er:case tr:case rr:case nn:l=fs;break}var p=l(o,u);return ls(p,u)}function rn(o){this.percent=o.percent,this.signSpecifier=o.signSpecifier,this.paddingSpecifier=o.paddingSpecifier,this.alignmentSpecifier=o.alignmentSpecifier,this.width=o.width,this.precision=o.precision,this.typeSpecifier=o.typeSpecifier}rn.prototype.isPercentLiteral=function(){return as===this.percent},rn.prototype.getPaddingCharacter=function(){var o=re(this.paddingSpecifier," ");return o.length===2&&o[0]===ss&&(o=o[1]),o};function bs(o,u,l){if(y(l.typeSpecifier))throw new Error("sprintf(): Unknown type specifier");if(o>u-1)throw new Error("sprintf(): Too few arguments");if(o<0)throw new Error("sprintf(): Argument number must be greater than zero")}function ws(o,u,l,p,v,A,$,te,Z,be,J){var oe=new rn({percent:p,signSpecifier:A,paddingSpecifier:$,alignmentSpecifier:te,width:qe(Z,null),precision:qe(be,null),typeSpecifier:J});if(oe.isPercentLiteral())return l.slice(1);var ae=o.getIndexByPosition(v);return o.incrementOnEmptyPosition(v),bs(ae,u.length,oe),ms(u[ae],oe)}function lr(o){var u=f(o);if(u==="")return u;for(var l=arguments.length,p=new Array(l>1?l-1:0),v=1;v<l;v++)p[v-1]=arguments[v];var A=ws.bind(void 0,new Dt,p);return u.replace(ee,A)}function xs(o,u){return lr.apply(void 0,[o].concat(t(re(u,[]))))}var ys={"<":"&lt;",">":"&gt;","&":"&amp;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};function Es(o){return ys[o]}function vs(o){return f(o).replace(H,Es)}function Os(o){return f(o).replace(P,"\\$&")}var fr={"<":/(&lt;)|(&#x0*3c;)|(&#0*60;)/gi,">":/(&gt;)|(&#x0*3e;)|(&#0*62;)/gi,"&":/(&amp;)|(&#x0*26;)|(&#0*38;)/gi,'"':/(&quot;)|(&#x0*22;)|(&#0*34;)/gi,"'":/(&#x0*27;)|(&#0*39;)/gi,"`":/(&#x0*60;)|(&#0*96;)/gi},_s=Object.keys(fr);function Ss(o,u){return o.replace(fr[u],u)}function Cs(o){var u=f(o);return _s.reduce(Ss,u)}function As(o,u,l){var p=f(o);return p.indexOf(u,l)}function js(o,u,l){var p=f(o);return p.lastIndexOf(u,l)}function Ps(o,u,l){var p=f(o),v=y(l)?0:I(M(l),0,p.length),A=p.substr(v).search(u);return A!==-1&&!isNaN(v)&&(A+=v),A}function Is(o,u,l){var p=f(o),v=f(u),A=qe(l);return A<0||A>p.length||v===""?p:p.slice(0,A)+v+p.slice(A)}var hr={3:"\u039E\u03BE",8:"\u0398\u03B8",A:"A\xC0\xC1\xC2\xC3\xC4\xC5\u0100\u0102\u0104\u01CD\u01DE\u01E0\u01FA\u0200\u0202\u0226\u023A\u0386\u0391\u0410",B:"B\u0181\u0182\u0243\u0392\u0411",C:"C\xC7\u0106\u0108\u010A\u010C\u0187\u023B\u0426",D:"D\u010E\u0110\u0189\u018A\u018B\xD0\u0394\u0414",E:"E\xC8\xC9\xCA\xCB\u0112\u0114\u0116\u0118\u011A\u018E\u0190\u0204\u0206\u0228\u0388\u0395\u0415\u042D",F:"F\u0191\u03A6\u0424",G:"G\u011C\u011E\u0120\u0122\u0193\u01E4\u01E6\u01F4\u0393\u0413\u0490",H:"H\u0124\u0126\u021E\u0389\u0397\u0425",I:"I\xCC\xCD\xCE\xCF\u0128\u012A\u012C\u012E\u0130\u0197\u01CF\u0208\u020A\u038A\u0399\u03AA\u0406\u0418",J:"J\u0134\u0248\u0419",K:"K\u0136\u0198\u01E8\u039A\u041A",L:"L\u0139\u013B\u013D\u013F\u0141\u023D\u039B\u041B",M:"M\u019C\u039C\u041C",N:"N\xD1\u0143\u0145\u0147\u019D\u01F8\u0220\u039D\u041D",O:"O\xD2\xD3\xD4\xD5\xD6\xD8\u014C\u014E\u0150\u0186\u019F\u01A0\u01D1\u01EA\u01EC\u01FE\u020C\u020E\u022A\u022C\u022E\u0230\u038C\u039F\u041E",P:"P\u01A4\u03A0\u041F",Q:"Q\u024A",R:"R\u0154\u0156\u0158\u0210\u0212\u024C\u03A1\u0420",S:"S\u015A\u015C\u015E\u0160\u0218\u03A3\u0421",T:"T\u0162\u0164\u0166\u01AC\u01AE\u021A\u023E\u03A4\u0422",U:"U\xD9\xDA\xDB\xDC\u0168\u016A\u016C\u016E\u0170\u0172\u01AF\u01D3\u01D5\u01D7\u01D9\u01DB\u0214\u0216\u0244\u0423\u042A",V:"V\u01B2\u0245\u0412",W:"W\u0174\u038F\u03A9",X:"X\u03A7",Y:"Y\xDD\u0176\u0178\u01B3\u0232\u024E\u038E\u03A5\u03AB\u042B",Z:"Z\u0179\u017B\u017D\u01B5\u0224\u0396\u0417",a:"a\xE0\xE1\xE2\xE3\xE4\xE5\u0101\u0103\u0105\u01CE\u01DF\u01E1\u01FB\u0201\u0203\u0227\u0250\u03AC\u03B1\u0430",b:"b\u0180\u0183\u0253\u03B2\u0431",c:"c\xE7\u0107\u0109\u010B\u010D\u0188\u023C\u0446",d:"d\u010F\u0111\u018C\u0256\u0257\xF0\u03B4\u0434",e:"e\xE8\xE9\xEA\xEB\u0113\u0115\u0117\u0119\u011B\u01DD\u0205\u0207\u0229\u0247\u025B\u03AD\u03B5\u0435\u044D",f:"f\u0192\u03C6\u0444",g:"g\u011D\u011F\u0121\u0123\u01E5\u01E7\u01F5\u0260\u03B3\u0433\u0491",h:"h\u0125\u0127\u021F\u0265\u03AE\u03B7\u0445",i:"i\xEC\xED\xEE\xEF\u0129\u012B\u012D\u012F\u0131\u01D0\u0209\u020B\u0268\u0390\u03AF\u03B9\u03CA\u0438\u0456",j:"j\u0135\u01F0\u0249\u0439",k:"k\u0137\u0199\u01E9\u03BA\u043A",l:"l\u013A\u013C\u013E\u0140\u0142\u017F\u019A\u026B\u03BB\u043B",m:"m\u026F\u0271\u03BC\u043C",n:"n\xF1\u0144\u0146\u0148\u0149\u019E\u01F9\u0272\u03BD\u043D",o:"o\xF2\xF3\xF4\xF5\xF6\xF8\u014D\u014F\u0151\u01A1\u01D2\u01EB\u01ED\u01FF\u020D\u020F\u022B\u022D\u022F\u0231\u0254\u0275\u03BF\u03CC\u043E",p:"p\u01A5\u03C0\u043F",q:"q\u024B",r:"r\u0155\u0157\u0159\u0211\u0213\u024D\u027D\u03C1\u0440",s:"s\xDF\u015B\u015D\u015F\u0161\u0219\u023F\u03C2\u03C3\u0441",t:"t\u0163\u0165\u0167\u01AD\u021B\u0288\u03C4\u0442",u:"u\xF9\xFA\xFB\xFC\u0169\u016B\u016D\u016F\u0171\u0173\u01B0\u01D4\u01D6\u01D8\u01DA\u01DC\u0215\u0217\u0289\u0443\u044A",v:"v\u028B\u028C\u0432",w:"w\u0175\u03C9\u03CE",x:"x\u03C7",y:"y\xFD\xFF\u0177\u01B4\u0233\u024F\u03B0\u03C5\u03CB\u03CD\u044B",z:"z\u017A\u017C\u017E\u01B6\u0225\u0240\u03B6\u0437",OE:"\x8C\u0152",oe:"\x9C\u0153",AE:"\xC6\u01E2\u01FC",ae:"\xE6\u01E3\u01FD",hv:"\u0195",OI:"\u01A2",oi:"\u01A3",DZ:"\u01C4\u01F1",Dz:"\u01C5\u01F2",dz:"\u01C6\u01F3",LJ:"\u01C7",Lj:"\u01C8",lj:"\u01C9",NJ:"\u01CA",Nj:"\u01CB",nj:"\u01CC",OU:"\u0222",ou:"\u0223",TH:"\xDE",th:"\xFE",PS:"\u03A8",ps:"\u03C8",Yo:"\u0401",Ye:"\u0404",Yi:"\u0407",Zh:"\u0416",Ch:"\u0427",Sh:"\u0428\u0429","":"\u042A\u042C\u044C",Yu:"\u042E",Ya:"\u042F",zh:"\u0436",ch:"\u0447",sh:"\u0448\u0449",yu:"\u044E",ya:"\u044F",yo:"\u0451",ye:"\u0454",yi:"\u0457"},St=null;function Fs(){return St!==null||(St={},Object.keys(hr).forEach(function(o){for(var u=hr[o],l=0;l<u.length;l++){var p=u[l];St[p]=o}})),St}function Ms(o){var u=Fs()[o];return u||o}function Rs(o,u){return u}function dr(o){var u=f(o);return u===""?"":u.replace(N,Ms).replace(k,Rs)}function Ns(o,u,l){var p=f(o),v=y(u)?0:I(M(u),0,j),A=f(l," ");if(v<=p.length)return p;var $=v-p.length,te=M($/2),Z=$%2;return Tt(A,te)+p+Tt(A,te+Z)}function Ds(o,u,l){var p=f(o);return p.replace(u,l)}function pr(o,u,l){var p=f(o);if(u instanceof RegExp){if(u.flags.indexOf("g")===-1)throw new TypeError("search argument is a non-global regular expression");return p.replace(u,l)}var v=f(u),A=typeof l=="function";A||(l=f(l));var $=v.length;if($===0)return pr(o,/(?:)/g,l);for(var te=$>1?$:1,Z=[],be=p.indexOf(v,0);be!==-1;)Z.push(be),be=p.indexOf(v,be+te);for(var J=0,oe="",ae=0;ae<Z.length;ae++){var Ee=Z[ae],Se=l;A&&(Se=f(l.call(void 0,v,Ee,p))),oe+=p.slice(J,Ee)+Se,J=Ee+$}return J<p.length&&(oe+=p.slice(J)),oe}function Ts(o){var u=f(o);return u.split("").reverse().join("")}function gr(o){var u=f(o);u=u.replace(k,function(v,A,$){return gr($)+A}).replace(de,"$2$1");for(var l="",p=u.length;p--;)l+=u.charAt(p);return l}function $s(o){var u=f(o);if(u==="")return"";var l=dr(u).replace(N,"-");return tt(l)}function Ls(o,u,l,p){var v=f(o),A=f(p),$=qe(u);$<0?($=v.length+$,$<0&&($=0)):$>v.length&&($=v.length);var te=qe(l,v.length-$);return te<0&&(te=0),v.slice(0,$)+A+v.slice($+te)}function Ws(o,u,l){var p=f(o),v,A;if(w(u)&&w(l))v=u.split(""),A=l.split("");else{var $=Us(re(u,{})),te=e($,2);v=te[0],A=te[1]}var Z=v.length;if(Z===0)return p;for(var be="",J=A.length,oe=0;oe<p.length;oe++){for(var ae=!1,Ee=void 0,Se=0;Se<Z&&Se<J;Se++){var Ce=v[Se];if(p.substr(oe,Ce.length)===Ce){ae=!0,Ee=A[Se],oe=oe+Ce.length-1;break}}be+=ae?Ee:p[oe]}return be}function Us(o){var u=Object.keys(o),l=u.sort(Bs).map(function(p){return o[p]});return[u,l]}function Bs(o,u){return o.length===u.length?0:o.length<u.length?1:-1}function sn(o,u,l){var p=f(o),v=Y(u);return v===null?!1:v===""?!0:(l=y(l)?0:I(M(l),0,p.length),p.indexOf(v,l)!==-1)}var Gs=Array.prototype.reduce;function mr(o,u){var l=f(o);if(u===""||l==="")return l;var p=Y(u);if(y(p))return l.replace(Ue,"");var v=!0;return Gs.call(l,function(A,$){return v&&sn(p,$)?A:(v=!1,A+$)},"")}var zs=Array.prototype.reduceRight;function br(o,u){var l=f(o);if(u===""||l==="")return l;var p=Y(u);if(y(p))return l.replace(q,"");var v=!0;return zs.call(l,function(A,$){return v&&sn(p,$)?A:(v=!1,$+A)},"")}function Hs(o,u){var l=f(o);if(u===""||l==="")return l;var p=Y(u);return y(p)?l.trim():br(mr(l,p),p)}var Ys="width",Vs="newLine",qs="indent",Ks="cut";function Xs(o){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=f(o),p=ks(u),v=p.width,A=p.newLine,$=p.indent,te=p.cut;if(l===""||v<=0)return $;for(var Z=l.length,be=l.substring.bind(l),J=0,oe="";Z-J>v;){if(l[J]===" "){J++;continue}var ae=l.lastIndexOf(" ",v+J);ae>=J?(oe+=$+be(J,ae)+A,J=ae+1):te?(oe+=$+be(J,v+J)+A,J+=v):(ae=l.indexOf(" ",v+J),ae>=0?(oe+=$+be(J,ae)+A,J=ae+1):(oe+=$+be(J),J=Z))}return J<Z&&(oe+=$+be(J)),oe}function ks(o){return{width:qe(o[Ys],75),newLine:f(o[Vs],`
3
- `),indent:f(o[qs],""),cut:E(o[Ks],!1)}}function Zs(o,u,l){if(y(u))return!1;var p=f(o),v=f(u);if(v==="")return!0;l=y(l)?p.length:I(M(l),0,p.length),l-=v.length;var A=p.indexOf(v,l);return A!==-1&&A===l}function on(o){var u=f(o);return _t.test(u)}function Js(o){var u=f(o);return U.test(u)}function Qs(o){var u=f(o);return u.trim().length===0}function eo(o){var u=f(o);return R.test(u)}function to(o){var u=f(o);return u.length===0}function no(o){var u=f(o);return on(u)&&u.toLowerCase()===u}function ro(o){var u=typeof o=="object"&&!y(o)?Number(o):o;return(typeof u=="number"||typeof u=="string")&&!isNaN(u-parseFloat(u))}function io(o){var u=f(o);return on(u)&&u.toUpperCase()===u}function so(o,u,l){var p=f(o),v=f(l),A;if(!(u instanceof RegExp)){if(A=Y(u),A===null)return!1;u=new RegExp(A,v)}return u.test(p)}function oo(o,u,l){var p=f(o),v=Y(u);return v===null?!1:v===""?!0:(l=y(l)?0:I(M(l),0,p.length),p.substr(l,v.length)===v)}function ao(o){var u=f(o);return u.split("")}function uo(o){for(var u=f(o),l=u.length,p=[],v=0,A;v<l;)A=Kn(u,v),p.push(A),v+=A>65535?2:1;return p}function co(o){var u=f(o);return re(u.match(ne),[])}function lo(o,u,l){var p=f(o);return p.split(u,l)}var fo="\uFEFF";function ho(o){var u=f(o);return u===""?"":u[0]===fo?u.substring(1):u}function po(o,u,l){var p=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,v=0;p&&(v=-u.length+1);var A=o.substr(l+v,u.length);return A.toLowerCase()===u}function go(o){for(var u=[],l;(l=Q.exec(o))!==null;)u.push(l[1]);return u}var wr=0,xr=1,an=2;function mo(o){for(var u=wr,l="",p=0;u!==an;){var v=o[p++].toLowerCase();switch(v){case"<":break;case">":u=an;break;default:We.test(v)?u===xr&&(u=an):(u===wr&&(u=xr),v!=="/"&&(l+=v));break}}return l}var Ct=0,nt=1,$t=2,yr=3;function bo(o,u,l){if(o=f(o),o==="")return"";if(!Array.isArray(u)){var p=f(u);u=p===""?[]:go(p)}for(var v=f(l),A=o.length,$=u.length>0,te=po.bind(null,o),Z=Ct,be=0,J="",oe="",ae=null,Ee=0;Ee<A;Ee++){var Se=o[Ee],Ce=!1;switch(Se){case"<":if(ae)break;if(te("< ",Ee,!1)){Ce=!0;break}if(Z===Ct){Ce=!0,Z=nt;break}if(Z===nt){be++;break}Ce=!0;break;case"!":if(Z===nt&&te("<!",Ee)){Z=$t;break}Ce=!0;break;case"-":if(Z===$t&&te("!--",Ee)){Z=yr;break}Ce=!0;break;case'"':case"'":Z===nt&&(ae===Se?ae=null:ae||(ae=Se)),Ce=!0;break;case"E":case"e":if(Z===$t&&te("doctype",Ee)){Z=nt;break}Ce=!0;break;case">":if(be>0){be--;break}if(ae)break;if(Z===nt){if(ae=null,Z=Ct,$){oe+=">";var _o=mo(oe);u.indexOf(_o.toLowerCase())!==-1?J+=oe:J+=v,oe=""}else J+=v;break}if(Z===$t||Z===yr&&te("-->",Ee)){ae=null,Z=Ct,oe="";break}Ce=!0;break;default:Ce=!0}if(Ce)switch(Z){case Ct:J+=Se;break;case nt:$&&(oe+=Se);break}}return J}var mt=null;function wo(){return mt!==null||(typeof global=="object"&&global.Object===Object?mt=global:typeof self=="object"&&self.Object===Object?mt=self:mt=new Function("return this")()),mt}var un=wo(),xo=un.v;function yo(){return this===un.v&&(un.v=xo),this}var Eo="1.4.0",cn={camelCase:Ae,capitalize:_,decapitalize:je,kebabCase:tt,lowerCase:F,snakeCase:h,swapCase:C,titleCase:g,upperCase:m,count:Xi,countGraphemes:ki,countSubstrings:Zi,countWhere:Qi,countWords:es,escapeHtml:vs,escapeRegExp:Os,unescapeHtml:Cs,sprintf:lr,vprintf:xs,indexOf:As,lastIndexOf:js,search:Ps,charAt:ye,codePointAt:Kn,first:Gi,graphemeAt:zi,last:Hi,prune:Yi,slice:Vi,substr:qi,substring:Ki,truncate:me,insert:Is,latinise:dr,pad:Ns,padLeft:ar,padRight:ur,repeat:or,replace:Ds,replaceAll:pr,reverse:Ts,reverseGrapheme:gr,slugify:$s,splice:Ls,tr:Ws,trim:Hs,trimLeft:mr,trimRight:br,wordWrap:Xs,endsWith:Zs,includes:sn,isAlpha:on,isAlphaDigit:Js,isBlank:Qs,isDigit:eo,isEmpty:to,isLowerCase:no,isNumeric:ro,isString:w,isUpperCase:io,matches:so,startsWith:oo,chars:ao,codePoints:uo,graphemes:co,split:lo,words:se,stripBom:ho,stripTags:bo,noConflict:yo,version:Eo};function Pe(o,u){this._wrappedValue=o,this._explicitChain=u}Pe.prototype.value=function(){return this._wrappedValue},Pe.prototype.valueOf=function(){return this.value()},Pe.prototype.toJSON=function(){return this.value()},Pe.prototype.toString=function(){return String(this.value())},Pe.prototype.chain=function(){return new Pe(this._wrappedValue,!0)},Pe.prototype.thru=function(o){return typeof o=="function"?new Pe(o(this._wrappedValue),this._explicitChain):this},Pe.prototype._explicitChain=!0;function vo(o){return function(){for(var u=arguments.length,l=new Array(u),p=0;p<u;p++)l[p]=arguments[p];var v=o.apply(void 0,[this._wrappedValue].concat(l));return this._explicitChain||typeof v=="string"?new Pe(v,this._explicitChain):v}}Object.keys(cn).forEach(function(o){Pe.prototype[o]=vo(cn[o])});function Oo(o){return new Pe(o,!0)}function Er(o){return new Pe(o,!1)}return i(Er,cn,{chain:Oo}),Er})});var Or="2.0.3";import Cr from"node:path";import{fileURLToPath as $o}from"node:url";import No,{promises as Do}from"fs";async function ln(i,e,t){if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);try{return(await Do[i](t))[e]()}catch(n){if(n.code==="ENOENT")return!1;throw n}}function fn(i,e,t){if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);try{return No[i](t)[e]()}catch(n){if(n.code==="ENOENT")return!1;throw n}}var Ja=ln.bind(null,"stat","isFile"),Qa=ln.bind(null,"stat","isDirectory"),eu=ln.bind(null,"lstat","isSymbolicLink"),_r=fn.bind(null,"statSync","isFile"),tu=fn.bind(null,"statSync","isDirectory"),nu=fn.bind(null,"lstatSync","isSymbolicLink");import To from"node:os";var Sr=To.homedir();function At(i){if(typeof i!="string")throw new TypeError(`Expected a string, got ${typeof i}`);return Sr?i.replace(/^~(?=$|\/|\\)/,Sr):i}function hn(i,e={}){let{requireFileExistence:t,validFileExtensions:n,validHostnames:r}=e;if(URL.canParse(i)){let b=new URL(i);if(b.protocol==="file:")return hn($o(b),e);if(r&&!r.includes(b.hostname))throw new Error(`Bad input URL. Only ${r.join(", ")} URLs are supported.`);return b}let s=At(i),c=Cr.normalize(s);if(t&&!_r(c))throw new Error("Input is not a file.");let d=Cr.extname(c);if(n&&!n.includes(d))throw new Error(`Bad input file name. Only ${n.join(", ")} files are supported.`);return c}import Ir from"express";import Lo from"node:net";import Wo from"node:os";var Lt=class extends Error{constructor(e){super(`${e} is locked`)}},bt={old:new Set,young:new Set},Uo=1e3*15;var jt,Bo=()=>{let i=Wo.networkInterfaces(),e=new Set([void 0,"0.0.0.0"]);for(let t of Object.values(i))for(let n of t)e.add(n.address);return e},Ar=i=>new Promise((e,t)=>{let n=Lo.createServer();n.unref(),n.on("error",t),n.listen(i,()=>{let{port:r}=n.address();n.close(()=>{e(r)})})}),jr=async(i,e)=>{if(i.host||i.port===0)return Ar(i);for(let t of e)try{await Ar({port:i.port,host:t})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return i.port},Go=function*(i){i&&(yield*i),yield 0};async function dn(i){let e,t=new Set;if(i&&(i.port&&(e=typeof i.port=="number"?[i.port]:i.port),i.exclude)){let r=i.exclude;if(typeof r[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let s of r){if(typeof s!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(s))throw new TypeError(`Number ${s} in the exclude option is not a safe integer and can't be used`)}t=new Set(r)}jt===void 0&&(jt=setTimeout(()=>{jt=void 0,bt.old=bt.young,bt.young=new Set},Uo),jt.unref&&jt.unref());let n=Bo();for(let r of Go(e))try{if(t.has(r))continue;let s=await jr({...i,port:r},n);for(;bt.old.has(s)||bt.young.has(s);){if(r!==0)throw new Lt(r);s=await jr({...i,port:r},n)}return bt.young.add(s),s}catch(s){if(!["EADDRINUSE","EACCES"].includes(s.code)&&!(s instanceof Lt))throw s}throw new Error("No available ports found")}import Rr from"node:fs/promises";import Nr from"node:os";import wt from"node:path";import{dirname as zo}from"node:path";import{fileURLToPath as Ho}from"node:url";import Yo from"puppeteer";var mn=Mo(Pr(),1),Vo={darkMode:!1,format:"svg",frames:!1,output:"./",transparent:!1,verbose:!1};async function Dr(i,e){let t={...Vo,...Zo(e??{})},{darkMode:n,format:r,frames:s,output:c,transparent:d,verbose:b}=t;b&&console.time("Export time");let y=hn(i,{requireFileExistence:!0,validFileExtensions:[".tldr"],validHostnames:["www.tldraw.com"]}),E=typeof y=="string";b&&console.log(E?"Local file detected":"tldraw URL detected");let w=E?wt.basename(y,wt.extname(y)):y.pathname.split("/").pop()??y.pathname,f=0,_;if(E){b&&console.log("Starting tldraw server...");let de=zo(Ho(import.meta.url)),ne=wt.join(de,de.endsWith("/src/lib")?"../../dist/tldraw":de.endsWith("/dist/lib")?"../tldraw":"../dist/tldraw");b&&console.log(`tldraw served from "${ne}"`),_=await Ko(ne),f=_.address().port,b&&console.log(`tldraw hosted at "http://localhost:${f}"`)}b&&console.log("Starting Puppeteer...");let F=await Yo.launch({args:E?["--no-sandbox","--disable-web-security"]:[],headless:"new"}),S=await F.newPage();qo(S,b);let x=await S.target().createCDPSession();if(await x.send("Browser.setDownloadBehavior",{behavior:"allowAndName",downloadPath:Nr.tmpdir(),eventsEnabled:!0}),E){await S.setRequestInterception(!0),S.on("request",ne=>{ne.url().endsWith("favicon.ico")?ne.respond({status:200}):ne.continue()}),b&&console.log(`Loading tldr file "${y}"`);let de=await Rr.readFile(y,"utf8");await S.evaluateOnNewDocument(ne=>{localStorage.clear(),localStorage.setItem("tldrData",ne)},de)}let B=E?`http://localhost:${f}`:y.href;b&&console.log(`Navigating to: ${B}`),await S.goto(B,{waitUntil:"networkidle0"});let G=await S.evaluate("editor.getCurrentPageShapes().length");if(b&&console.log(`Shape count: ${G}`),G===0)throw new Error("The sketch is empty");b&&console.log(`Setting background transparency: ${d}`),await ea(S,d),b&&console.log(`Setting dark mode: ${n}`);let X=await Qo(S);await Mr(S,n);let K=[],k=s?await S.evaluate(`editor.getCurrentPageShapes().reduce((accumulator, shape) => {
3
+ `),indent:f(o[qs],""),cut:E(o[Ks],!1)}}function Zs(o,u,l){if(y(u))return!1;var p=f(o),v=f(u);if(v==="")return!0;l=y(l)?p.length:I(M(l),0,p.length),l-=v.length;var A=p.indexOf(v,l);return A!==-1&&A===l}function on(o){var u=f(o);return _t.test(u)}function Js(o){var u=f(o);return U.test(u)}function Qs(o){var u=f(o);return u.trim().length===0}function eo(o){var u=f(o);return R.test(u)}function to(o){var u=f(o);return u.length===0}function no(o){var u=f(o);return on(u)&&u.toLowerCase()===u}function ro(o){var u=typeof o=="object"&&!y(o)?Number(o):o;return(typeof u=="number"||typeof u=="string")&&!isNaN(u-parseFloat(u))}function io(o){var u=f(o);return on(u)&&u.toUpperCase()===u}function so(o,u,l){var p=f(o),v=f(l),A;if(!(u instanceof RegExp)){if(A=Y(u),A===null)return!1;u=new RegExp(A,v)}return u.test(p)}function oo(o,u,l){var p=f(o),v=Y(u);return v===null?!1:v===""?!0:(l=y(l)?0:I(M(l),0,p.length),p.substr(l,v.length)===v)}function ao(o){var u=f(o);return u.split("")}function uo(o){for(var u=f(o),l=u.length,p=[],v=0,A;v<l;)A=Kn(u,v),p.push(A),v+=A>65535?2:1;return p}function co(o){var u=f(o);return re(u.match(ne),[])}function lo(o,u,l){var p=f(o);return p.split(u,l)}var fo="\uFEFF";function ho(o){var u=f(o);return u===""?"":u[0]===fo?u.substring(1):u}function po(o,u,l){var p=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,v=0;p&&(v=-u.length+1);var A=o.substr(l+v,u.length);return A.toLowerCase()===u}function go(o){for(var u=[],l;(l=Q.exec(o))!==null;)u.push(l[1]);return u}var wr=0,xr=1,an=2;function mo(o){for(var u=wr,l="",p=0;u!==an;){var v=o[p++].toLowerCase();switch(v){case"<":break;case">":u=an;break;default:We.test(v)?u===xr&&(u=an):(u===wr&&(u=xr),v!=="/"&&(l+=v));break}}return l}var Ct=0,nt=1,$t=2,yr=3;function bo(o,u,l){if(o=f(o),o==="")return"";if(!Array.isArray(u)){var p=f(u);u=p===""?[]:go(p)}for(var v=f(l),A=o.length,$=u.length>0,te=po.bind(null,o),Z=Ct,be=0,J="",oe="",ae=null,Ee=0;Ee<A;Ee++){var Se=o[Ee],Ce=!1;switch(Se){case"<":if(ae)break;if(te("< ",Ee,!1)){Ce=!0;break}if(Z===Ct){Ce=!0,Z=nt;break}if(Z===nt){be++;break}Ce=!0;break;case"!":if(Z===nt&&te("<!",Ee)){Z=$t;break}Ce=!0;break;case"-":if(Z===$t&&te("!--",Ee)){Z=yr;break}Ce=!0;break;case'"':case"'":Z===nt&&(ae===Se?ae=null:ae||(ae=Se)),Ce=!0;break;case"E":case"e":if(Z===$t&&te("doctype",Ee)){Z=nt;break}Ce=!0;break;case">":if(be>0){be--;break}if(ae)break;if(Z===nt){if(ae=null,Z=Ct,$){oe+=">";var _o=mo(oe);u.indexOf(_o.toLowerCase())!==-1?J+=oe:J+=v,oe=""}else J+=v;break}if(Z===$t||Z===yr&&te("-->",Ee)){ae=null,Z=Ct,oe="";break}Ce=!0;break;default:Ce=!0}if(Ce)switch(Z){case Ct:J+=Se;break;case nt:$&&(oe+=Se);break}}return J}var mt=null;function wo(){return mt!==null||(typeof global=="object"&&global.Object===Object?mt=global:typeof self=="object"&&self.Object===Object?mt=self:mt=new Function("return this")()),mt}var un=wo(),xo=un.v;function yo(){return this===un.v&&(un.v=xo),this}var Eo="1.4.0",cn={camelCase:Ae,capitalize:_,decapitalize:je,kebabCase:tt,lowerCase:F,snakeCase:h,swapCase:C,titleCase:g,upperCase:m,count:Xi,countGraphemes:ki,countSubstrings:Zi,countWhere:Qi,countWords:es,escapeHtml:vs,escapeRegExp:Os,unescapeHtml:Cs,sprintf:lr,vprintf:xs,indexOf:As,lastIndexOf:js,search:Ps,charAt:ye,codePointAt:Kn,first:Gi,graphemeAt:zi,last:Hi,prune:Yi,slice:Vi,substr:qi,substring:Ki,truncate:me,insert:Is,latinise:dr,pad:Ns,padLeft:ar,padRight:ur,repeat:or,replace:Ds,replaceAll:pr,reverse:Ts,reverseGrapheme:gr,slugify:$s,splice:Ls,tr:Ws,trim:Hs,trimLeft:mr,trimRight:br,wordWrap:Xs,endsWith:Zs,includes:sn,isAlpha:on,isAlphaDigit:Js,isBlank:Qs,isDigit:eo,isEmpty:to,isLowerCase:no,isNumeric:ro,isString:w,isUpperCase:io,matches:so,startsWith:oo,chars:ao,codePoints:uo,graphemes:co,split:lo,words:se,stripBom:ho,stripTags:bo,noConflict:yo,version:Eo};function Pe(o,u){this._wrappedValue=o,this._explicitChain=u}Pe.prototype.value=function(){return this._wrappedValue},Pe.prototype.valueOf=function(){return this.value()},Pe.prototype.toJSON=function(){return this.value()},Pe.prototype.toString=function(){return String(this.value())},Pe.prototype.chain=function(){return new Pe(this._wrappedValue,!0)},Pe.prototype.thru=function(o){return typeof o=="function"?new Pe(o(this._wrappedValue),this._explicitChain):this},Pe.prototype._explicitChain=!0;function vo(o){return function(){for(var u=arguments.length,l=new Array(u),p=0;p<u;p++)l[p]=arguments[p];var v=o.apply(void 0,[this._wrappedValue].concat(l));return this._explicitChain||typeof v=="string"?new Pe(v,this._explicitChain):v}}Object.keys(cn).forEach(function(o){Pe.prototype[o]=vo(cn[o])});function Oo(o){return new Pe(o,!0)}function Er(o){return new Pe(o,!1)}return i(Er,cn,{chain:Oo}),Er})});var Or="2.1.0";import Cr from"node:path";import{fileURLToPath as $o}from"node:url";import No,{promises as Do}from"fs";async function ln(i,e,t){if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);try{return(await Do[i](t))[e]()}catch(n){if(n.code==="ENOENT")return!1;throw n}}function fn(i,e,t){if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);try{return No[i](t)[e]()}catch(n){if(n.code==="ENOENT")return!1;throw n}}var Ja=ln.bind(null,"stat","isFile"),Qa=ln.bind(null,"stat","isDirectory"),eu=ln.bind(null,"lstat","isSymbolicLink"),_r=fn.bind(null,"statSync","isFile"),tu=fn.bind(null,"statSync","isDirectory"),nu=fn.bind(null,"lstatSync","isSymbolicLink");import To from"node:os";var Sr=To.homedir();function At(i){if(typeof i!="string")throw new TypeError(`Expected a string, got ${typeof i}`);return Sr?i.replace(/^~(?=$|\/|\\)/,Sr):i}function hn(i,e={}){let{requireFileExistence:t,validFileExtensions:n,validHostnames:r}=e;if(URL.canParse(i)){let b=new URL(i);if(b.protocol==="file:")return hn($o(b),e);if(r&&!r.includes(b.hostname))throw new Error(`Bad input URL. Only ${r.join(", ")} URLs are supported.`);return b}let s=At(i),c=Cr.normalize(s);if(t&&!_r(c))throw new Error("Input is not a file.");let d=Cr.extname(c);if(n&&!n.includes(d))throw new Error(`Bad input file name. Only ${n.join(", ")} files are supported.`);return c}import Ir from"express";import Lo from"node:net";import Wo from"node:os";var Lt=class extends Error{constructor(e){super(`${e} is locked`)}},bt={old:new Set,young:new Set},Uo=1e3*15;var jt,Bo=()=>{let i=Wo.networkInterfaces(),e=new Set([void 0,"0.0.0.0"]);for(let t of Object.values(i))for(let n of t)e.add(n.address);return e},Ar=i=>new Promise((e,t)=>{let n=Lo.createServer();n.unref(),n.on("error",t),n.listen(i,()=>{let{port:r}=n.address();n.close(()=>{e(r)})})}),jr=async(i,e)=>{if(i.host||i.port===0)return Ar(i);for(let t of e)try{await Ar({port:i.port,host:t})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return i.port},Go=function*(i){i&&(yield*i),yield 0};async function dn(i){let e,t=new Set;if(i&&(i.port&&(e=typeof i.port=="number"?[i.port]:i.port),i.exclude)){let r=i.exclude;if(typeof r[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let s of r){if(typeof s!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(s))throw new TypeError(`Number ${s} in the exclude option is not a safe integer and can't be used`)}t=new Set(r)}jt===void 0&&(jt=setTimeout(()=>{jt=void 0,bt.old=bt.young,bt.young=new Set},Uo),jt.unref&&jt.unref());let n=Bo();for(let r of Go(e))try{if(t.has(r))continue;let s=await jr({...i,port:r},n);for(;bt.old.has(s)||bt.young.has(s);){if(r!==0)throw new Lt(r);s=await jr({...i,port:r},n)}return bt.young.add(s),s}catch(s){if(!["EADDRINUSE","EACCES"].includes(s.code)&&!(s instanceof Lt))throw s}throw new Error("No available ports found")}import Rr from"node:fs/promises";import Nr from"node:os";import wt from"node:path";import{dirname as zo}from"node:path";import{fileURLToPath as Ho}from"node:url";import Yo from"puppeteer";var mn=Mo(Pr(),1),Vo={darkMode:!1,format:"svg",frames:!1,output:"./",transparent:!1,verbose:!1};async function Dr(i,e){let t={...Vo,...Zo(e??{})},{darkMode:n,format:r,frames:s,output:c,transparent:d,verbose:b}=t;b&&console.time("Export time");let y=hn(i,{requireFileExistence:!0,validFileExtensions:[".tldr"],validHostnames:["www.tldraw.com"]}),E=typeof y=="string";b&&console.log(E?"Local file detected":"tldraw URL detected");let w=E?wt.basename(y,wt.extname(y)):y.pathname.split("/").pop()??y.pathname,f=0,_;if(E){b&&console.log("Starting tldraw server...");let de=zo(Ho(import.meta.url)),ne=wt.join(de,de.endsWith("/src/lib")?"../../dist/tldraw":de.endsWith("/dist/lib")?"../tldraw":"../dist/tldraw");b&&console.log(`tldraw served from "${ne}"`),_=await Ko(ne),f=_.address().port,b&&console.log(`tldraw hosted at "http://localhost:${f}"`)}b&&console.log("Starting Puppeteer...");let F=await Yo.launch({args:E?["--no-sandbox","--disable-web-security"]:[],headless:"new"}),S=await F.newPage();qo(S,b);let x=await S.target().createCDPSession();if(await x.send("Browser.setDownloadBehavior",{behavior:"allowAndName",downloadPath:Nr.tmpdir(),eventsEnabled:!0}),E){await S.setRequestInterception(!0),S.on("request",ne=>{ne.url().endsWith("favicon.ico")?ne.respond({status:200}):ne.continue()}),b&&console.log(`Loading tldr file "${y}"`);let de=await Rr.readFile(y,"utf8");await S.evaluateOnNewDocument(ne=>{localStorage.clear(),localStorage.setItem("tldrData",ne)},de)}let B=E?`http://localhost:${f}`:y.href;b&&console.log(`Navigating to: ${B}`),await S.goto(B,{waitUntil:"networkidle0"});let G=await S.evaluate("editor.getCurrentPageShapes().length");if(b&&console.log(`Shape count: ${G}`),G===0)throw new Error("The sketch is empty");b&&console.log(`Setting background transparency: ${d}`),await ea(S,d),b&&console.log(`Setting dark mode: ${n}`);let X=await Qo(S);await Mr(S,n);let K=[],k=s?await S.evaluate(`editor.getCurrentPageShapes().reduce((accumulator, shape) => {
4
4
  if (shape.type === 'frame') {
5
5
  accumulator.push({ id: shape.id, name: shape.props.name })
6
6
  }
@@ -71,7 +71,7 @@ ${F.join(`
71
71
  `;f.forEach(F=>{_+=F}),e.fail(_)}};let b={};s.conflicts=function(w,f){D("<string|object> [array|string]",[w,f],arguments.length),typeof w=="object"?Object.keys(w).forEach(_=>{s.conflicts(_,w[_])}):(i.global(w),b[w]||(b[w]=[]),Array.isArray(f)?f.forEach(_=>s.conflicts(w,_)):b[w].push(f))},s.getConflicting=()=>b,s.conflicting=function(w){Object.keys(w).forEach(f=>{b[f]&&b[f].forEach(_=>{_&&w[f]!==void 0&&w[_]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",f,_))})}),i.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(b).forEach(f=>{b[f].forEach(_=>{_&&w[t.Parser.camelCase(f)]!==void 0&&w[t.Parser.camelCase(_)]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",f,_))})})},s.recommendCommands=function(w,f){f=f.sort((x,B)=>B.length-x.length);let F=null,S=1/0;for(let x=0,B;(B=f[x])!==void 0;x++){let G=hi(w,B);G<=3&&G<S&&(S=G,F=B)}F&&e.fail(n("Did you mean %s?",F))},s.reset=function(w){return c=ke(c,f=>!w[f]),b=ke(b,f=>!w[f]),s};let y=[];return s.freeze=function(){y.push({implied:c,conflicting:b})},s.unfreeze=function(){let w=y.pop();ve(w,void 0,t),{implied:c,conflicting:b}=w},s}var Rn=[],Ft;function Mt(i,e,t,n){Ft=n;let r={};if(Object.prototype.hasOwnProperty.call(i,"extends")){if(typeof i.extends!="string")return r;let s=/\.json|\..*rc$/.test(i.extends),c=null;if(s)c=qa(e,i.extends);else try{c=ze.resolve(i.extends)}catch{return i}Va(c),Rn.push(c),r=s?JSON.parse(Ft.readFileSync(c,"utf8")):ze(i.extends),delete i.extends,r=Mt(r,Ft.path.dirname(c),t,Ft)}return Rn=[],t?gi(r,i):Object.assign({},r,i)}function Va(i){if(Rn.indexOf(i)>-1)throw new ce(`Circular extended configurations: '${i}'.`)}function qa(i,e){return Ft.path.resolve(i,e)}function gi(i,e){let t={};function n(r){return r&&typeof r=="object"&&!Array.isArray(r)}Object.assign(t,i);for(let r of Object.keys(e))n(e[r])&&n(t[r])?t[r]=gi(i[r],e[r]):t[r]=e[r];return t}var T=function(i,e,t,n,r){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?r.call(i,t):r?r.value=t:e.set(i,t),t},a=function(i,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(i):n?n.value:e.get(i)},we,ot,Rt,De,Fe,qt,Je,at,Kt,Te,Xt,$e,He,Me,Le,kt,Et,xe,L,Zt,Jt,Re,ut,vt,ct,Qe,Qt,z,lt,ft,ht,V,en,Ye,he;function Di(i){return(e=[],t=i.process.cwd(),n)=>{let r=new Hn(e,t,n,i);return Object.defineProperty(r,"argv",{get:()=>r.parse(),enumerable:!0}),r.help(),r.version(),r}}var mi=Symbol("copyDoubleDash"),bi=Symbol("copyDoubleDash"),Nn=Symbol("deleteFromParserHintObject"),wi=Symbol("emitWarning"),xi=Symbol("freeze"),yi=Symbol("getDollarZero"),dt=Symbol("getParserConfiguration"),Ei=Symbol("getUsageConfiguration"),Dn=Symbol("guessLocale"),vi=Symbol("guessVersion"),Oi=Symbol("parsePositionalNumbers"),Tn=Symbol("pkgUp"),et=Symbol("populateParserHintArray"),Ot=Symbol("populateParserHintSingleValueDictionary"),$n=Symbol("populateParserHintArrayDictionary"),Ln=Symbol("populateParserHintDictionary"),Wn=Symbol("sanitizeKey"),Un=Symbol("setKey"),Bn=Symbol("unfreeze"),_i=Symbol("validateAsync"),Si=Symbol("getCommandInstance"),Ci=Symbol("getContext"),Ai=Symbol("getHasOutput"),ji=Symbol("getLoggerInstance"),Pi=Symbol("getParseContext"),Ii=Symbol("getUsageInstance"),Fi=Symbol("getValidationInstance"),tn=Symbol("hasParseCallback"),Mi=Symbol("isGlobalContext"),pt=Symbol("postProcess"),Ri=Symbol("rebase"),Gn=Symbol("reset"),Nt=Symbol("runYargsParserAndExecuteCommands"),zn=Symbol("runValidation"),Ni=Symbol("setHasOutput"),gt=Symbol("kTrackManuallySetKeys"),Hn=class{constructor(e=[],t,n,r){this.customScriptName=!1,this.parsed=!1,we.set(this,void 0),ot.set(this,void 0),Rt.set(this,{commands:[],fullCommands:[]}),De.set(this,null),Fe.set(this,null),qt.set(this,"show-hidden"),Je.set(this,null),at.set(this,!0),Kt.set(this,{}),Te.set(this,!0),Xt.set(this,[]),$e.set(this,void 0),He.set(this,{}),Me.set(this,!1),Le.set(this,null),kt.set(this,!0),Et.set(this,void 0),xe.set(this,""),L.set(this,void 0),Zt.set(this,void 0),Jt.set(this,{}),Re.set(this,null),ut.set(this,null),vt.set(this,{}),ct.set(this,{}),Qe.set(this,void 0),Qt.set(this,!1),z.set(this,void 0),lt.set(this,!1),ft.set(this,!1),ht.set(this,!1),V.set(this,void 0),en.set(this,{}),Ye.set(this,null),he.set(this,void 0),T(this,z,r,"f"),T(this,Qe,e,"f"),T(this,ot,t,"f"),T(this,Zt,n,"f"),T(this,$e,new Ht(this),"f"),this.$0=this[yi](),this[Gn](),T(this,we,a(this,we,"f"),"f"),T(this,V,a(this,V,"f"),"f"),T(this,he,a(this,he,"f"),"f"),T(this,L,a(this,L,"f"),"f"),a(this,L,"f").showHiddenOpt=a(this,qt,"f"),T(this,Et,this[bi](),"f")}addHelpOpt(e,t){let n="help";return D("[string|boolean] [string]",[e,t],arguments.length),a(this,Le,"f")&&(this[Nn](a(this,Le,"f")),T(this,Le,null,"f")),e===!1&&t===void 0?this:(T(this,Le,typeof e=="string"?e:n,"f"),this.boolean(a(this,Le,"f")),this.describe(a(this,Le,"f"),t||a(this,V,"f").deferY18nLookup("Show help")),this)}help(e,t){return this.addHelpOpt(e,t)}addShowHiddenOpt(e,t){if(D("[string|boolean] [string]",[e,t],arguments.length),e===!1&&t===void 0)return this;let n=typeof e=="string"?e:a(this,qt,"f");return this.boolean(n),this.describe(n,t||a(this,V,"f").deferY18nLookup("Show hidden options")),a(this,L,"f").showHiddenOpt=n,this}showHidden(e,t){return this.addShowHiddenOpt(e,t)}alias(e,t){return D("<object|string|array> [string|array]",[e,t],arguments.length),this[$n](this.alias.bind(this),"alias",e,t),this}array(e){return D("<array|string>",[e],arguments.length),this[et]("array",e),this[gt](e),this}boolean(e){return D("<array|string>",[e],arguments.length),this[et]("boolean",e),this[gt](e),this}check(e,t){return D("<function> [boolean]",[e,t],arguments.length),this.middleware((n,r)=>st(()=>e(n,r.getOptions()),s=>(s?(typeof s=="string"||s instanceof Error)&&a(this,V,"f").fail(s.toString(),s):a(this,V,"f").fail(a(this,z,"f").y18n.__("Argument check failed: %s",e.toString())),n),s=>(a(this,V,"f").fail(s.message?s.message:s.toString(),s),n)),!1,t),this}choices(e,t){return D("<object|string|array> [string|array]",[e,t],arguments.length),this[$n](this.choices.bind(this),"choices",e,t),this}coerce(e,t){if(D("<object|string|array> [function]",[e,t],arguments.length),Array.isArray(e)){if(!t)throw new ce("coerce callback must be provided");for(let n of e)this.coerce(n,t);return this}else if(typeof e=="object"){for(let n of Object.keys(e))this.coerce(n,e[n]);return this}if(!t)throw new ce("coerce callback must be provided");return a(this,L,"f").key[e]=!0,a(this,$e,"f").addCoerceMiddleware((n,r)=>{let s;return Object.prototype.hasOwnProperty.call(n,e)?st(()=>(s=r.getAliases(),t(n[e])),d=>{n[e]=d;let b=r.getInternalMethods().getParserConfiguration()["strip-aliased"];if(s[e]&&b!==!0)for(let y of s[e])n[y]=d;return n},d=>{throw new ce(d.message)}):n},e),this}conflicts(e,t){return D("<string|object> [string|array]",[e,t],arguments.length),a(this,he,"f").conflicts(e,t),this}config(e="config",t,n){return D("[object|string] [string|function] [function]",[e,t,n],arguments.length),typeof e=="object"&&!Array.isArray(e)?(e=Mt(e,a(this,ot,"f"),this[dt]()["deep-merge-config"]||!1,a(this,z,"f")),a(this,L,"f").configObjects=(a(this,L,"f").configObjects||[]).concat(e),this):(typeof t=="function"&&(n=t,t=void 0),this.describe(e,t||a(this,V,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(e)?e:[e]).forEach(r=>{a(this,L,"f").config[r]=n||!0}),this)}completion(e,t,n){return D("[string] [string|boolean|function] [function]",[e,t,n],arguments.length),typeof t=="function"&&(n=t,t=void 0),T(this,Fe,e||a(this,Fe,"f")||"completion","f"),!t&&t!==!1&&(t="generate completion script"),this.command(a(this,Fe,"f"),t),n&&a(this,De,"f").registerFunction(n),this}command(e,t,n,r,s,c){return D("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[e,t,n,r,s,c],arguments.length),a(this,we,"f").addHandler(e,t,n,r,s,c),this}commands(e,t,n,r,s,c){return this.command(e,t,n,r,s,c)}commandDir(e,t){D("<string> [object]",[e,t],arguments.length);let n=a(this,Zt,"f")||a(this,z,"f").require;return a(this,we,"f").addDirectory(e,n,a(this,z,"f").getCallerFile(),t),this}count(e){return D("<array|string>",[e],arguments.length),this[et]("count",e),this[gt](e),this}default(e,t,n){return D("<object|string|array> [*] [string]",[e,t,n],arguments.length),n&&(jn(e,a(this,z,"f")),a(this,L,"f").defaultDescription[e]=n),typeof t=="function"&&(jn(e,a(this,z,"f")),a(this,L,"f").defaultDescription[e]||(a(this,L,"f").defaultDescription[e]=a(this,V,"f").functionDescription(t)),t=t.call()),this[Ot](this.default.bind(this),"default",e,t),this}defaults(e,t,n){return this.default(e,t,n)}demandCommand(e=1,t,n,r){return D("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,t,n,r],arguments.length),typeof t!="number"&&(n=t,t=1/0),this.global("_",!1),a(this,L,"f").demandedCommands._={min:e,max:t,minMsg:n,maxMsg:r},this}demand(e,t,n){return Array.isArray(t)?(t.forEach(r=>{ve(n,!0,a(this,z,"f")),this.demandOption(r,n)}),t=1/0):typeof t!="number"&&(n=t,t=1/0),typeof e=="number"?(ve(n,!0,a(this,z,"f")),this.demandCommand(e,t,n,n)):Array.isArray(e)?e.forEach(r=>{ve(n,!0,a(this,z,"f")),this.demandOption(r,n)}):typeof n=="string"?this.demandOption(e,n):(n===!0||typeof n>"u")&&this.demandOption(e),this}demandOption(e,t){return D("<object|string|array> [string]",[e,t],arguments.length),this[Ot](this.demandOption.bind(this),"demandedOptions",e,t),this}deprecateOption(e,t){return D("<string> [string|boolean]",[e,t],arguments.length),a(this,L,"f").deprecatedOptions[e]=t,this}describe(e,t){return D("<object|string|array> [string]",[e,t],arguments.length),this[Un](e,!0),a(this,V,"f").describe(e,t),this}detectLocale(e){return D("<boolean>",[e],arguments.length),T(this,at,e,"f"),this}env(e){return D("[string|boolean]",[e],arguments.length),e===!1?delete a(this,L,"f").envPrefix:a(this,L,"f").envPrefix=e||"",this}epilogue(e){return D("<string>",[e],arguments.length),a(this,V,"f").epilog(e),this}epilog(e){return this.epilogue(e)}example(e,t){return D("<string|array> [string]",[e,t],arguments.length),Array.isArray(e)?e.forEach(n=>this.example(...n)):a(this,V,"f").example(e,t),this}exit(e,t){T(this,Me,!0,"f"),T(this,Je,t,"f"),a(this,Te,"f")&&a(this,z,"f").process.exit(e)}exitProcess(e=!0){return D("[boolean]",[e],arguments.length),T(this,Te,e,"f"),this}fail(e){if(D("<function|boolean>",[e],arguments.length),typeof e=="boolean"&&e!==!1)throw new ce("Invalid first argument. Expected function or boolean 'false'");return a(this,V,"f").failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,t){return D("<array> [function]",[e,t],arguments.length),t?a(this,De,"f").getCompletion(e,t):new Promise((n,r)=>{a(this,De,"f").getCompletion(e,(s,c)=>{s?r(s):n(c)})})}getDemandedOptions(){return D([],0),a(this,L,"f").demandedOptions}getDemandedCommands(){return D([],0),a(this,L,"f").demandedCommands}getDeprecatedOptions(){return D([],0),a(this,L,"f").deprecatedOptions}getDetectLocale(){return a(this,at,"f")}getExitProcess(){return a(this,Te,"f")}getGroups(){return Object.assign({},a(this,He,"f"),a(this,ct,"f"))}getHelp(){if(T(this,Me,!0,"f"),!a(this,V,"f").hasCachedHelpMessage()){if(!this.parsed){let t=this[Nt](a(this,Qe,"f"),void 0,void 0,0,!0);if(le(t))return t.then(()=>a(this,V,"f").help())}let e=a(this,we,"f").runDefaultBuilderOn(this);if(le(e))return e.then(()=>a(this,V,"f").help())}return Promise.resolve(a(this,V,"f").help())}getOptions(){return a(this,L,"f")}getStrict(){return a(this,lt,"f")}getStrictCommands(){return a(this,ft,"f")}getStrictOptions(){return a(this,ht,"f")}global(e,t){return D("<string|array> [boolean]",[e,t],arguments.length),e=[].concat(e),t!==!1?a(this,L,"f").local=a(this,L,"f").local.filter(n=>e.indexOf(n)===-1):e.forEach(n=>{a(this,L,"f").local.includes(n)||a(this,L,"f").local.push(n)}),this}group(e,t){D("<string|array> <string>",[e,t],arguments.length);let n=a(this,ct,"f")[t]||a(this,He,"f")[t];a(this,ct,"f")[t]&&delete a(this,ct,"f")[t];let r={};return a(this,He,"f")[t]=(n||[]).concat(e).filter(s=>r[s]?!1:r[s]=!0),this}hide(e){return D("<string>",[e],arguments.length),a(this,L,"f").hiddenOptions.push(e),this}implies(e,t){return D("<string|object> [number|string|array]",[e,t],arguments.length),a(this,he,"f").implies(e,t),this}locale(e){return D("[string]",[e],arguments.length),e===void 0?(this[Dn](),a(this,z,"f").y18n.getLocale()):(T(this,at,!1,"f"),a(this,z,"f").y18n.setLocale(e),this)}middleware(e,t,n){return a(this,$e,"f").addMiddleware(e,!!t,n)}nargs(e,t){return D("<string|object|array> [number]",[e,t],arguments.length),this[Ot](this.nargs.bind(this),"narg",e,t),this}normalize(e){return D("<array|string>",[e],arguments.length),this[et]("normalize",e),this}number(e){return D("<array|string>",[e],arguments.length),this[et]("number",e),this[gt](e),this}option(e,t){if(D("<string|object> [object]",[e,t],arguments.length),typeof e=="object")Object.keys(e).forEach(n=>{this.options(n,e[n])});else{typeof t!="object"&&(t={}),this[gt](e),a(this,Ye,"f")&&(e==="version"||t?.alias==="version")&&this[wi](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
72
72
  `),void 0,"versionWarning"),a(this,L,"f").key[e]=!0,t.alias&&this.alias(e,t.alias);let n=t.deprecate||t.deprecated;n&&this.deprecateOption(e,n);let r=t.demand||t.required||t.require;r&&this.demand(e,r),t.demandOption&&this.demandOption(e,typeof t.demandOption=="string"?t.demandOption:void 0),t.conflicts&&this.conflicts(e,t.conflicts),"default"in t&&this.default(e,t.default),t.implies!==void 0&&this.implies(e,t.implies),t.nargs!==void 0&&this.nargs(e,t.nargs),t.config&&this.config(e,t.configParser),t.normalize&&this.normalize(e),t.choices&&this.choices(e,t.choices),t.coerce&&this.coerce(e,t.coerce),t.group&&this.group(e,t.group),(t.boolean||t.type==="boolean")&&(this.boolean(e),t.alias&&this.boolean(t.alias)),(t.array||t.type==="array")&&(this.array(e),t.alias&&this.array(t.alias)),(t.number||t.type==="number")&&(this.number(e),t.alias&&this.number(t.alias)),(t.string||t.type==="string")&&(this.string(e),t.alias&&this.string(t.alias)),(t.count||t.type==="count")&&this.count(e),typeof t.global=="boolean"&&this.global(e,t.global),t.defaultDescription&&(a(this,L,"f").defaultDescription[e]=t.defaultDescription),t.skipValidation&&this.skipValidation(e);let s=t.describe||t.description||t.desc,c=a(this,V,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(c,e)||typeof s=="string")&&this.describe(e,s),t.hidden&&this.hide(e),t.requiresArg&&this.requiresArg(e)}return this}options(e,t){return this.option(e,t)}parse(e,t,n){D("[string|array] [function|boolean|object] [function]",[e,t,n],arguments.length),this[xi](),typeof e>"u"&&(e=a(this,Qe,"f")),typeof t=="object"&&(T(this,ut,t,"f"),t=n),typeof t=="function"&&(T(this,Re,t,"f"),t=!1),t||T(this,Qe,e,"f"),a(this,Re,"f")&&T(this,Te,!1,"f");let r=this[Nt](e,!!t),s=this.parsed;return a(this,De,"f").setParsed(this.parsed),le(r)?r.then(c=>(a(this,Re,"f")&&a(this,Re,"f").call(this,a(this,Je,"f"),c,a(this,xe,"f")),c)).catch(c=>{throw a(this,Re,"f")&&a(this,Re,"f")(c,this.parsed.argv,a(this,xe,"f")),c}).finally(()=>{this[Bn](),this.parsed=s}):(a(this,Re,"f")&&a(this,Re,"f").call(this,a(this,Je,"f"),r,a(this,xe,"f")),this[Bn](),this.parsed=s,r)}parseAsync(e,t,n){let r=this.parse(e,t,n);return le(r)?r:Promise.resolve(r)}parseSync(e,t,n){let r=this.parse(e,t,n);if(le(r))throw new ce(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return r}parserConfiguration(e){return D("<object>",[e],arguments.length),T(this,Jt,e,"f"),this}pkgConf(e,t){D("<string> [string]",[e,t],arguments.length);let n=null,r=this[Tn](t||a(this,ot,"f"));return r[e]&&typeof r[e]=="object"&&(n=Mt(r[e],t||a(this,ot,"f"),this[dt]()["deep-merge-config"]||!1,a(this,z,"f")),a(this,L,"f").configObjects=(a(this,L,"f").configObjects||[]).concat(n)),this}positional(e,t){D("<string> <object>",[e,t],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];t=ke(t,(c,d)=>c==="type"&&!["string","number","boolean"].includes(d)?!1:n.includes(c));let r=a(this,Rt,"f").fullCommands[a(this,Rt,"f").fullCommands.length-1],s=r?a(this,we,"f").cmdToParseOptions(r):{array:[],alias:{},default:{},demand:{}};return xt(s).forEach(c=>{let d=s[c];Array.isArray(d)?d.indexOf(e)!==-1&&(t[c]=!0):d[e]&&!(c in t)&&(t[c]=d[e])}),this.group(e,a(this,V,"f").getPositionalGroupName()),this.option(e,t)}recommendCommands(e=!0){return D("[boolean]",[e],arguments.length),T(this,Qt,e,"f"),this}required(e,t,n){return this.demand(e,t,n)}require(e,t,n){return this.demand(e,t,n)}requiresArg(e){return D("<array|string|object> [number]",[e],arguments.length),typeof e=="string"&&a(this,L,"f").narg[e]?this:(this[Ot](this.requiresArg.bind(this),"narg",e,NaN),this)}showCompletionScript(e,t){return D("[string] [string]",[e,t],arguments.length),e=e||this.$0,a(this,Et,"f").log(a(this,De,"f").generateCompletionScript(e,t||a(this,Fe,"f")||"completion")),this}showHelp(e){if(D("[string|function]",[e],arguments.length),T(this,Me,!0,"f"),!a(this,V,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[Nt](a(this,Qe,"f"),void 0,void 0,0,!0);if(le(n))return n.then(()=>{a(this,V,"f").showHelp(e)}),this}let t=a(this,we,"f").runDefaultBuilderOn(this);if(le(t))return t.then(()=>{a(this,V,"f").showHelp(e)}),this}return a(this,V,"f").showHelp(e),this}scriptName(e){return this.customScriptName=!0,this.$0=e,this}showHelpOnFail(e,t){return D("[boolean|string] [string]",[e,t],arguments.length),a(this,V,"f").showHelpOnFail(e,t),this}showVersion(e){return D("[string|function]",[e],arguments.length),a(this,V,"f").showVersion(e),this}skipValidation(e){return D("<array|string>",[e],arguments.length),this[et]("skipValidation",e),this}strict(e){return D("[boolean]",[e],arguments.length),T(this,lt,e!==!1,"f"),this}strictCommands(e){return D("[boolean]",[e],arguments.length),T(this,ft,e!==!1,"f"),this}strictOptions(e){return D("[boolean]",[e],arguments.length),T(this,ht,e!==!1,"f"),this}string(e){return D("<array|string>",[e],arguments.length),this[et]("string",e),this[gt](e),this}terminalWidth(){return D([],0),a(this,z,"f").process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){return D("<object>",[e],arguments.length),T(this,at,!1,"f"),a(this,z,"f").y18n.updateLocale(e),this}usage(e,t,n,r){if(D("<string|null|undefined> [string|boolean] [function|object] [function]",[e,t,n,r],arguments.length),t!==void 0){if(ve(e,null,a(this,z,"f")),(e||"").match(/^\$0( |$)/))return this.command(e,t,n,r);throw new ce(".usage() description must start with $0 if being used as alias for .command()")}else return a(this,V,"f").usage(e),this}usageConfiguration(e){return D("<object>",[e],arguments.length),T(this,en,e,"f"),this}version(e,t,n){let r="version";if(D("[boolean|string] [string] [string]",[e,t,n],arguments.length),a(this,Ye,"f")&&(this[Nn](a(this,Ye,"f")),a(this,V,"f").version(void 0),T(this,Ye,null,"f")),arguments.length===0)n=this[vi](),e=r;else if(arguments.length===1){if(e===!1)return this;n=e,e=r}else arguments.length===2&&(n=t,t=void 0);return T(this,Ye,typeof e=="string"?e:r,"f"),t=t||a(this,V,"f").deferY18nLookup("Show version number"),a(this,V,"f").version(n||void 0),this.boolean(a(this,Ye,"f")),this.describe(a(this,Ye,"f"),t),this}wrap(e){return D("<number|null|undefined>",[e],arguments.length),a(this,V,"f").wrap(e),this}[(we=new WeakMap,ot=new WeakMap,Rt=new WeakMap,De=new WeakMap,Fe=new WeakMap,qt=new WeakMap,Je=new WeakMap,at=new WeakMap,Kt=new WeakMap,Te=new WeakMap,Xt=new WeakMap,$e=new WeakMap,He=new WeakMap,Me=new WeakMap,Le=new WeakMap,kt=new WeakMap,Et=new WeakMap,xe=new WeakMap,L=new WeakMap,Zt=new WeakMap,Jt=new WeakMap,Re=new WeakMap,ut=new WeakMap,vt=new WeakMap,ct=new WeakMap,Qe=new WeakMap,Qt=new WeakMap,z=new WeakMap,lt=new WeakMap,ft=new WeakMap,ht=new WeakMap,V=new WeakMap,en=new WeakMap,Ye=new WeakMap,he=new WeakMap,mi)](e){if(!e._||!e["--"])return e;e._.push.apply(e._,e["--"]);try{delete e["--"]}catch{}return e}[bi](){return{log:(...e)=>{this[tn]()||console.log(...e),T(this,Me,!0,"f"),a(this,xe,"f").length&&T(this,xe,a(this,xe,"f")+`
73
73
  `,"f"),T(this,xe,a(this,xe,"f")+e.join(" "),"f")},error:(...e)=>{this[tn]()||console.error(...e),T(this,Me,!0,"f"),a(this,xe,"f").length&&T(this,xe,a(this,xe,"f")+`
74
- `,"f"),T(this,xe,a(this,xe,"f")+e.join(" "),"f")}}}[Nn](e){xt(a(this,L,"f")).forEach(t=>{if((r=>r==="configObjects")(t))return;let n=a(this,L,"f")[t];Array.isArray(n)?n.includes(e)&&n.splice(n.indexOf(e),1):typeof n=="object"&&delete n[e]}),delete a(this,V,"f").getDescriptions()[e]}[wi](e,t,n){a(this,Kt,"f")[n]||(a(this,z,"f").process.emitWarning(e,t),a(this,Kt,"f")[n]=!0)}[xi](){a(this,Xt,"f").push({options:a(this,L,"f"),configObjects:a(this,L,"f").configObjects.slice(0),exitProcess:a(this,Te,"f"),groups:a(this,He,"f"),strict:a(this,lt,"f"),strictCommands:a(this,ft,"f"),strictOptions:a(this,ht,"f"),completionCommand:a(this,Fe,"f"),output:a(this,xe,"f"),exitError:a(this,Je,"f"),hasOutput:a(this,Me,"f"),parsed:this.parsed,parseFn:a(this,Re,"f"),parseContext:a(this,ut,"f")}),a(this,V,"f").freeze(),a(this,he,"f").freeze(),a(this,we,"f").freeze(),a(this,$e,"f").freeze()}[yi](){let e="",t;return/\b(node|iojs|electron)(\.exe)?$/.test(a(this,z,"f").process.argv()[0])?t=a(this,z,"f").process.argv().slice(1,2):t=a(this,z,"f").process.argv().slice(0,1),e=t.map(n=>{let r=this[Ri](a(this,ot,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&r.length<n.length?r:n}).join(" ").trim(),a(this,z,"f").getEnv("_")&&a(this,z,"f").getProcessArgvBin()===a(this,z,"f").getEnv("_")&&(e=a(this,z,"f").getEnv("_").replace(`${a(this,z,"f").path.dirname(a(this,z,"f").process.execPath())}/`,"")),e}[dt](){return a(this,Jt,"f")}[Ei](){return a(this,en,"f")}[Dn](){if(!a(this,at,"f"))return;let e=a(this,z,"f").getEnv("LC_ALL")||a(this,z,"f").getEnv("LC_MESSAGES")||a(this,z,"f").getEnv("LANG")||a(this,z,"f").getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[vi](){return this[Tn]().version||"unknown"}[Oi](e){let t=e["--"]?e["--"]:e._;for(let n=0,r;(r=t[n])!==void 0;n++)a(this,z,"f").Parser.looksLikeNumber(r)&&Number.isSafeInteger(Math.floor(parseFloat(`${r}`)))&&(t[n]=Number(r));return e}[Tn](e){let t=e||"*";if(a(this,vt,"f")[t])return a(this,vt,"f")[t];let n={};try{let r=e||a(this,z,"f").mainFilename;!e&&a(this,z,"f").path.extname(r)&&(r=a(this,z,"f").path.dirname(r));let s=a(this,z,"f").findUp(r,(c,d)=>{if(d.includes("package.json"))return"package.json"});ve(s,void 0,a(this,z,"f")),n=JSON.parse(a(this,z,"f").readFileSync(s,"utf8"))}catch{}return a(this,vt,"f")[t]=n||{},a(this,vt,"f")[t]}[et](e,t){t=[].concat(t),t.forEach(n=>{n=this[Wn](n),a(this,L,"f")[e].push(n)})}[Ot](e,t,n,r){this[Ln](e,t,n,r,(s,c,d)=>{a(this,L,"f")[s][c]=d})}[$n](e,t,n,r){this[Ln](e,t,n,r,(s,c,d)=>{a(this,L,"f")[s][c]=(a(this,L,"f")[s][c]||[]).concat(d)})}[Ln](e,t,n,r,s){if(Array.isArray(n))n.forEach(c=>{e(c,r)});else if((c=>typeof c=="object")(n))for(let c of xt(n))e(c,n[c]);else s(t,this[Wn](n),r)}[Wn](e){return e==="__proto__"?"___proto___":e}[Un](e,t){return this[Ot](this[Un].bind(this),"key",e,t),this}[Bn](){var e,t,n,r,s,c,d,b,y,E,w,f;let _=a(this,Xt,"f").pop();ve(_,void 0,a(this,z,"f"));let F;e=this,t=this,n=this,r=this,s=this,c=this,d=this,b=this,y=this,E=this,w=this,f=this,{options:{set value(S){T(e,L,S,"f")}}.value,configObjects:F,exitProcess:{set value(S){T(t,Te,S,"f")}}.value,groups:{set value(S){T(n,He,S,"f")}}.value,output:{set value(S){T(r,xe,S,"f")}}.value,exitError:{set value(S){T(s,Je,S,"f")}}.value,hasOutput:{set value(S){T(c,Me,S,"f")}}.value,parsed:this.parsed,strict:{set value(S){T(d,lt,S,"f")}}.value,strictCommands:{set value(S){T(b,ft,S,"f")}}.value,strictOptions:{set value(S){T(y,ht,S,"f")}}.value,completionCommand:{set value(S){T(E,Fe,S,"f")}}.value,parseFn:{set value(S){T(w,Re,S,"f")}}.value,parseContext:{set value(S){T(f,ut,S,"f")}}.value}=_,a(this,L,"f").configObjects=F,a(this,V,"f").unfreeze(),a(this,he,"f").unfreeze(),a(this,we,"f").unfreeze(),a(this,$e,"f").unfreeze()}[_i](e,t){return st(t,n=>(e(n),n))}getInternalMethods(){return{getCommandInstance:this[Si].bind(this),getContext:this[Ci].bind(this),getHasOutput:this[Ai].bind(this),getLoggerInstance:this[ji].bind(this),getParseContext:this[Pi].bind(this),getParserConfiguration:this[dt].bind(this),getUsageConfiguration:this[Ei].bind(this),getUsageInstance:this[Ii].bind(this),getValidationInstance:this[Fi].bind(this),hasParseCallback:this[tn].bind(this),isGlobalContext:this[Mi].bind(this),postProcess:this[pt].bind(this),reset:this[Gn].bind(this),runValidation:this[zn].bind(this),runYargsParserAndExecuteCommands:this[Nt].bind(this),setHasOutput:this[Ni].bind(this)}}[Si](){return a(this,we,"f")}[Ci](){return a(this,Rt,"f")}[Ai](){return a(this,Me,"f")}[ji](){return a(this,Et,"f")}[Pi](){return a(this,ut,"f")||{}}[Ii](){return a(this,V,"f")}[Fi](){return a(this,he,"f")}[tn](){return!!a(this,Re,"f")}[Mi](){return a(this,kt,"f")}[pt](e,t,n,r){return n||le(e)||(t||(e=this[mi](e)),(this[dt]()["parse-positional-numbers"]||this[dt]()["parse-positional-numbers"]===void 0)&&(e=this[Oi](e)),r&&(e=it(e,this,a(this,$e,"f").getMiddleware(),!1))),e}[Gn](e={}){T(this,L,a(this,L,"f")||{},"f");let t={};t.local=a(this,L,"f").local||[],t.configObjects=a(this,L,"f").configObjects||[];let n={};t.local.forEach(c=>{n[c]=!0,(e[c]||[]).forEach(d=>{n[d]=!0})}),Object.assign(a(this,ct,"f"),Object.keys(a(this,He,"f")).reduce((c,d)=>{let b=a(this,He,"f")[d].filter(y=>!(y in n));return b.length>0&&(c[d]=b),c},{})),T(this,He,{},"f");let r=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],s=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return r.forEach(c=>{t[c]=(a(this,L,"f")[c]||[]).filter(d=>!n[d])}),s.forEach(c=>{t[c]=ke(a(this,L,"f")[c],d=>!n[d])}),t.envPrefix=a(this,L,"f").envPrefix,T(this,L,t,"f"),T(this,V,a(this,V,"f")?a(this,V,"f").reset(n):ui(this,a(this,z,"f")),"f"),T(this,he,a(this,he,"f")?a(this,he,"f").reset(n):pi(this,a(this,V,"f"),a(this,z,"f")),"f"),T(this,we,a(this,we,"f")?a(this,we,"f").reset():si(a(this,V,"f"),a(this,he,"f"),a(this,$e,"f"),a(this,z,"f")),"f"),a(this,De,"f")||T(this,De,fi(this,a(this,V,"f"),a(this,we,"f"),a(this,z,"f")),"f"),a(this,$e,"f").reset(),T(this,Fe,null,"f"),T(this,xe,"","f"),T(this,Je,null,"f"),T(this,Me,!1,"f"),this.parsed=!1,this}[Ri](e,t){return a(this,z,"f").path.relative(e,t)}[Nt](e,t,n,r=0,s=!1){let c=!!n||s;e=e||a(this,Qe,"f"),a(this,L,"f").__=a(this,z,"f").y18n.__,a(this,L,"f").configuration=this[dt]();let d=!!a(this,L,"f").configuration["populate--"],b=Object.assign({},a(this,L,"f").configuration,{"populate--":!0}),y=a(this,z,"f").Parser.detailed(e,Object.assign({},a(this,L,"f"),{configuration:{"parse-positional-numbers":!1,...b}})),E=Object.assign(y.argv,a(this,ut,"f")),w,f=y.aliases,_=!1,F=!1;Object.keys(E).forEach(S=>{S===a(this,Le,"f")&&E[S]?_=!0:S===a(this,Ye,"f")&&E[S]&&(F=!0)}),E.$0=this.$0,this.parsed=y,r===0&&a(this,V,"f").clearCachedHelpMessage();try{if(this[Dn](),t)return this[pt](E,d,!!n,!1);a(this,Le,"f")&&[a(this,Le,"f")].concat(f[a(this,Le,"f")]||[]).filter(X=>X.length>1).includes(""+E._[E._.length-1])&&(E._.pop(),_=!0),T(this,kt,!1,"f");let S=a(this,we,"f").getCommands(),x=a(this,De,"f").completionKey in E,B=_||x||s;if(E._.length){if(S.length){let G;for(let X=r||0,K;E._[X]!==void 0;X++)if(K=String(E._[X]),S.includes(K)&&K!==a(this,Fe,"f")){let k=a(this,we,"f").runCommand(K,this,y,X+1,s,_||F||s);return this[pt](k,d,!!n,!1)}else if(!G&&K!==a(this,Fe,"f")){G=K;break}!a(this,we,"f").hasDefaultCommand()&&a(this,Qt,"f")&&G&&!B&&a(this,he,"f").recommendCommands(G,S)}a(this,Fe,"f")&&E._.includes(a(this,Fe,"f"))&&!x&&(a(this,Te,"f")&&Ze(!0),this.showCompletionScript(),this.exit(0))}if(a(this,we,"f").hasDefaultCommand()&&!B){let G=a(this,we,"f").runCommand(null,this,y,0,s,_||F||s);return this[pt](G,d,!!n,!1)}if(x){a(this,Te,"f")&&Ze(!0),e=[].concat(e);let G=e.slice(e.indexOf(`--${a(this,De,"f").completionKey}`)+1);return a(this,De,"f").getCompletion(G,(X,K)=>{if(X)throw new ce(X.message);(K||[]).forEach(k=>{a(this,Et,"f").log(k)}),this.exit(0)}),this[pt](E,!d,!!n,!1)}if(a(this,Me,"f")||(_?(a(this,Te,"f")&&Ze(!0),c=!0,this.showHelp("log"),this.exit(0)):F&&(a(this,Te,"f")&&Ze(!0),c=!0,a(this,V,"f").showVersion("log"),this.exit(0))),!c&&a(this,L,"f").skipValidation.length>0&&(c=Object.keys(E).some(G=>a(this,L,"f").skipValidation.indexOf(G)>=0&&E[G]===!0)),!c){if(y.error)throw new ce(y.error.message);if(!x){let G=this[zn](f,{},y.error);n||(w=it(E,this,a(this,$e,"f").getMiddleware(),!0)),w=this[_i](G,w??E),le(w)&&!n&&(w=w.then(()=>it(E,this,a(this,$e,"f").getMiddleware(),!1)))}}}catch(S){if(S instanceof ce)a(this,V,"f").fail(S.message,S);else throw S}return this[pt](w??E,d,!!n,!0)}[zn](e,t,n,r){let s={...this.getDemandedOptions()};return c=>{if(n)throw new ce(n.message);a(this,he,"f").nonOptionCount(c),a(this,he,"f").requiredArguments(c,s);let d=!1;a(this,ft,"f")&&(d=a(this,he,"f").unknownCommands(c)),a(this,lt,"f")&&!d?a(this,he,"f").unknownArguments(c,e,t,!!r):a(this,ht,"f")&&a(this,he,"f").unknownArguments(c,e,{},!1,!1),a(this,he,"f").limitedChoices(c),a(this,he,"f").implications(c),a(this,he,"f").conflicting(c)}}[Ni](){T(this,Me,!0,"f")}[gt](e){if(typeof e=="string")a(this,L,"f").key[e]=!0;else for(let t of e)a(this,L,"f").key[t]=!0}};function oi(i){return!!i&&typeof i.getInternalMethods=="function"}var Ka=Di(An),Ti=Ka;await Ti(Sn(process.argv)).command("$0 <file-or-url>",'Convert a tldraw ".tldr" file or tldraw.com URL to an svg or png image',i=>i.positional("file-or-url",{demandOption:!0,describe:'The sketch to convert to an image \u2014 either a path to a local ".tldr" file, or a tldraw.com sketch URL',type:"string"}).option("format",{alias:"f",choices:["png","svg"],default:"svg",describe:"Output image format",type:"string"}).option("output",{alias:"o",default:"./",describe:"Output image directory",type:"string"}).option("transparent",{alias:"t",default:!1,describe:"Output an image with a transparent background",type:"boolean"}).option("dark-mode",{alias:"d",default:!1,describe:"Output a dark theme version of the image",type:"boolean"}).option("frames",{coerce(e){return e.length===0?!0:e},defaultDescription:"false",describe:'Export each sketch "frame" as a separate image, use the option flag alone to export all frames, or pass one or more frame names or IDs',type:"array"}).option("verbose",{default:!1,describe:"Enable verbose output",type:"boolean"}),async i=>{let{darkMode:e,fileOrUrl:t,format:n,frames:r,output:s,transparent:c,verbose:d}=i;try{await Dr(t,{darkMode:e,format:n,frames:r,output:s,transparent:c,verbose:d}),process.exit(0)}catch(b){console.error("Conversion failed:",b),process.exit(1)}}).alias("h","help").version("version",Or).alias("v","version").help().parse();
74
+ `,"f"),T(this,xe,a(this,xe,"f")+e.join(" "),"f")}}}[Nn](e){xt(a(this,L,"f")).forEach(t=>{if((r=>r==="configObjects")(t))return;let n=a(this,L,"f")[t];Array.isArray(n)?n.includes(e)&&n.splice(n.indexOf(e),1):typeof n=="object"&&delete n[e]}),delete a(this,V,"f").getDescriptions()[e]}[wi](e,t,n){a(this,Kt,"f")[n]||(a(this,z,"f").process.emitWarning(e,t),a(this,Kt,"f")[n]=!0)}[xi](){a(this,Xt,"f").push({options:a(this,L,"f"),configObjects:a(this,L,"f").configObjects.slice(0),exitProcess:a(this,Te,"f"),groups:a(this,He,"f"),strict:a(this,lt,"f"),strictCommands:a(this,ft,"f"),strictOptions:a(this,ht,"f"),completionCommand:a(this,Fe,"f"),output:a(this,xe,"f"),exitError:a(this,Je,"f"),hasOutput:a(this,Me,"f"),parsed:this.parsed,parseFn:a(this,Re,"f"),parseContext:a(this,ut,"f")}),a(this,V,"f").freeze(),a(this,he,"f").freeze(),a(this,we,"f").freeze(),a(this,$e,"f").freeze()}[yi](){let e="",t;return/\b(node|iojs|electron)(\.exe)?$/.test(a(this,z,"f").process.argv()[0])?t=a(this,z,"f").process.argv().slice(1,2):t=a(this,z,"f").process.argv().slice(0,1),e=t.map(n=>{let r=this[Ri](a(this,ot,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&r.length<n.length?r:n}).join(" ").trim(),a(this,z,"f").getEnv("_")&&a(this,z,"f").getProcessArgvBin()===a(this,z,"f").getEnv("_")&&(e=a(this,z,"f").getEnv("_").replace(`${a(this,z,"f").path.dirname(a(this,z,"f").process.execPath())}/`,"")),e}[dt](){return a(this,Jt,"f")}[Ei](){return a(this,en,"f")}[Dn](){if(!a(this,at,"f"))return;let e=a(this,z,"f").getEnv("LC_ALL")||a(this,z,"f").getEnv("LC_MESSAGES")||a(this,z,"f").getEnv("LANG")||a(this,z,"f").getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[vi](){return this[Tn]().version||"unknown"}[Oi](e){let t=e["--"]?e["--"]:e._;for(let n=0,r;(r=t[n])!==void 0;n++)a(this,z,"f").Parser.looksLikeNumber(r)&&Number.isSafeInteger(Math.floor(parseFloat(`${r}`)))&&(t[n]=Number(r));return e}[Tn](e){let t=e||"*";if(a(this,vt,"f")[t])return a(this,vt,"f")[t];let n={};try{let r=e||a(this,z,"f").mainFilename;!e&&a(this,z,"f").path.extname(r)&&(r=a(this,z,"f").path.dirname(r));let s=a(this,z,"f").findUp(r,(c,d)=>{if(d.includes("package.json"))return"package.json"});ve(s,void 0,a(this,z,"f")),n=JSON.parse(a(this,z,"f").readFileSync(s,"utf8"))}catch{}return a(this,vt,"f")[t]=n||{},a(this,vt,"f")[t]}[et](e,t){t=[].concat(t),t.forEach(n=>{n=this[Wn](n),a(this,L,"f")[e].push(n)})}[Ot](e,t,n,r){this[Ln](e,t,n,r,(s,c,d)=>{a(this,L,"f")[s][c]=d})}[$n](e,t,n,r){this[Ln](e,t,n,r,(s,c,d)=>{a(this,L,"f")[s][c]=(a(this,L,"f")[s][c]||[]).concat(d)})}[Ln](e,t,n,r,s){if(Array.isArray(n))n.forEach(c=>{e(c,r)});else if((c=>typeof c=="object")(n))for(let c of xt(n))e(c,n[c]);else s(t,this[Wn](n),r)}[Wn](e){return e==="__proto__"?"___proto___":e}[Un](e,t){return this[Ot](this[Un].bind(this),"key",e,t),this}[Bn](){var e,t,n,r,s,c,d,b,y,E,w,f;let _=a(this,Xt,"f").pop();ve(_,void 0,a(this,z,"f"));let F;e=this,t=this,n=this,r=this,s=this,c=this,d=this,b=this,y=this,E=this,w=this,f=this,{options:{set value(S){T(e,L,S,"f")}}.value,configObjects:F,exitProcess:{set value(S){T(t,Te,S,"f")}}.value,groups:{set value(S){T(n,He,S,"f")}}.value,output:{set value(S){T(r,xe,S,"f")}}.value,exitError:{set value(S){T(s,Je,S,"f")}}.value,hasOutput:{set value(S){T(c,Me,S,"f")}}.value,parsed:this.parsed,strict:{set value(S){T(d,lt,S,"f")}}.value,strictCommands:{set value(S){T(b,ft,S,"f")}}.value,strictOptions:{set value(S){T(y,ht,S,"f")}}.value,completionCommand:{set value(S){T(E,Fe,S,"f")}}.value,parseFn:{set value(S){T(w,Re,S,"f")}}.value,parseContext:{set value(S){T(f,ut,S,"f")}}.value}=_,a(this,L,"f").configObjects=F,a(this,V,"f").unfreeze(),a(this,he,"f").unfreeze(),a(this,we,"f").unfreeze(),a(this,$e,"f").unfreeze()}[_i](e,t){return st(t,n=>(e(n),n))}getInternalMethods(){return{getCommandInstance:this[Si].bind(this),getContext:this[Ci].bind(this),getHasOutput:this[Ai].bind(this),getLoggerInstance:this[ji].bind(this),getParseContext:this[Pi].bind(this),getParserConfiguration:this[dt].bind(this),getUsageConfiguration:this[Ei].bind(this),getUsageInstance:this[Ii].bind(this),getValidationInstance:this[Fi].bind(this),hasParseCallback:this[tn].bind(this),isGlobalContext:this[Mi].bind(this),postProcess:this[pt].bind(this),reset:this[Gn].bind(this),runValidation:this[zn].bind(this),runYargsParserAndExecuteCommands:this[Nt].bind(this),setHasOutput:this[Ni].bind(this)}}[Si](){return a(this,we,"f")}[Ci](){return a(this,Rt,"f")}[Ai](){return a(this,Me,"f")}[ji](){return a(this,Et,"f")}[Pi](){return a(this,ut,"f")||{}}[Ii](){return a(this,V,"f")}[Fi](){return a(this,he,"f")}[tn](){return!!a(this,Re,"f")}[Mi](){return a(this,kt,"f")}[pt](e,t,n,r){return n||le(e)||(t||(e=this[mi](e)),(this[dt]()["parse-positional-numbers"]||this[dt]()["parse-positional-numbers"]===void 0)&&(e=this[Oi](e)),r&&(e=it(e,this,a(this,$e,"f").getMiddleware(),!1))),e}[Gn](e={}){T(this,L,a(this,L,"f")||{},"f");let t={};t.local=a(this,L,"f").local||[],t.configObjects=a(this,L,"f").configObjects||[];let n={};t.local.forEach(c=>{n[c]=!0,(e[c]||[]).forEach(d=>{n[d]=!0})}),Object.assign(a(this,ct,"f"),Object.keys(a(this,He,"f")).reduce((c,d)=>{let b=a(this,He,"f")[d].filter(y=>!(y in n));return b.length>0&&(c[d]=b),c},{})),T(this,He,{},"f");let r=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],s=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return r.forEach(c=>{t[c]=(a(this,L,"f")[c]||[]).filter(d=>!n[d])}),s.forEach(c=>{t[c]=ke(a(this,L,"f")[c],d=>!n[d])}),t.envPrefix=a(this,L,"f").envPrefix,T(this,L,t,"f"),T(this,V,a(this,V,"f")?a(this,V,"f").reset(n):ui(this,a(this,z,"f")),"f"),T(this,he,a(this,he,"f")?a(this,he,"f").reset(n):pi(this,a(this,V,"f"),a(this,z,"f")),"f"),T(this,we,a(this,we,"f")?a(this,we,"f").reset():si(a(this,V,"f"),a(this,he,"f"),a(this,$e,"f"),a(this,z,"f")),"f"),a(this,De,"f")||T(this,De,fi(this,a(this,V,"f"),a(this,we,"f"),a(this,z,"f")),"f"),a(this,$e,"f").reset(),T(this,Fe,null,"f"),T(this,xe,"","f"),T(this,Je,null,"f"),T(this,Me,!1,"f"),this.parsed=!1,this}[Ri](e,t){return a(this,z,"f").path.relative(e,t)}[Nt](e,t,n,r=0,s=!1){let c=!!n||s;e=e||a(this,Qe,"f"),a(this,L,"f").__=a(this,z,"f").y18n.__,a(this,L,"f").configuration=this[dt]();let d=!!a(this,L,"f").configuration["populate--"],b=Object.assign({},a(this,L,"f").configuration,{"populate--":!0}),y=a(this,z,"f").Parser.detailed(e,Object.assign({},a(this,L,"f"),{configuration:{"parse-positional-numbers":!1,...b}})),E=Object.assign(y.argv,a(this,ut,"f")),w,f=y.aliases,_=!1,F=!1;Object.keys(E).forEach(S=>{S===a(this,Le,"f")&&E[S]?_=!0:S===a(this,Ye,"f")&&E[S]&&(F=!0)}),E.$0=this.$0,this.parsed=y,r===0&&a(this,V,"f").clearCachedHelpMessage();try{if(this[Dn](),t)return this[pt](E,d,!!n,!1);a(this,Le,"f")&&[a(this,Le,"f")].concat(f[a(this,Le,"f")]||[]).filter(X=>X.length>1).includes(""+E._[E._.length-1])&&(E._.pop(),_=!0),T(this,kt,!1,"f");let S=a(this,we,"f").getCommands(),x=a(this,De,"f").completionKey in E,B=_||x||s;if(E._.length){if(S.length){let G;for(let X=r||0,K;E._[X]!==void 0;X++)if(K=String(E._[X]),S.includes(K)&&K!==a(this,Fe,"f")){let k=a(this,we,"f").runCommand(K,this,y,X+1,s,_||F||s);return this[pt](k,d,!!n,!1)}else if(!G&&K!==a(this,Fe,"f")){G=K;break}!a(this,we,"f").hasDefaultCommand()&&a(this,Qt,"f")&&G&&!B&&a(this,he,"f").recommendCommands(G,S)}a(this,Fe,"f")&&E._.includes(a(this,Fe,"f"))&&!x&&(a(this,Te,"f")&&Ze(!0),this.showCompletionScript(),this.exit(0))}if(a(this,we,"f").hasDefaultCommand()&&!B){let G=a(this,we,"f").runCommand(null,this,y,0,s,_||F||s);return this[pt](G,d,!!n,!1)}if(x){a(this,Te,"f")&&Ze(!0),e=[].concat(e);let G=e.slice(e.indexOf(`--${a(this,De,"f").completionKey}`)+1);return a(this,De,"f").getCompletion(G,(X,K)=>{if(X)throw new ce(X.message);(K||[]).forEach(k=>{a(this,Et,"f").log(k)}),this.exit(0)}),this[pt](E,!d,!!n,!1)}if(a(this,Me,"f")||(_?(a(this,Te,"f")&&Ze(!0),c=!0,this.showHelp("log"),this.exit(0)):F&&(a(this,Te,"f")&&Ze(!0),c=!0,a(this,V,"f").showVersion("log"),this.exit(0))),!c&&a(this,L,"f").skipValidation.length>0&&(c=Object.keys(E).some(G=>a(this,L,"f").skipValidation.indexOf(G)>=0&&E[G]===!0)),!c){if(y.error)throw new ce(y.error.message);if(!x){let G=this[zn](f,{},y.error);n||(w=it(E,this,a(this,$e,"f").getMiddleware(),!0)),w=this[_i](G,w??E),le(w)&&!n&&(w=w.then(()=>it(E,this,a(this,$e,"f").getMiddleware(),!1)))}}}catch(S){if(S instanceof ce)a(this,V,"f").fail(S.message,S);else throw S}return this[pt](w??E,d,!!n,!0)}[zn](e,t,n,r){let s={...this.getDemandedOptions()};return c=>{if(n)throw new ce(n.message);a(this,he,"f").nonOptionCount(c),a(this,he,"f").requiredArguments(c,s);let d=!1;a(this,ft,"f")&&(d=a(this,he,"f").unknownCommands(c)),a(this,lt,"f")&&!d?a(this,he,"f").unknownArguments(c,e,t,!!r):a(this,ht,"f")&&a(this,he,"f").unknownArguments(c,e,{},!1,!1),a(this,he,"f").limitedChoices(c),a(this,he,"f").implications(c),a(this,he,"f").conflicting(c)}}[Ni](){T(this,Me,!0,"f")}[gt](e){if(typeof e=="string")a(this,L,"f").key[e]=!0;else for(let t of e)a(this,L,"f").key[t]=!0}};function oi(i){return!!i&&typeof i.getInternalMethods=="function"}var Ka=Di(An),Ti=Ka;await Ti(Sn(process.argv)).command("$0 <file-or-url>",'Convert a tldraw ".tldr" file or tldraw.com URL to an svg or png image',i=>i.scriptName("tldraw-cli").positional("file-or-url",{demandOption:!0,describe:'The sketch to convert to an image \u2014 either a path to a local ".tldr" file, or a tldraw.com sketch URL',type:"string"}).option("format",{alias:"f",choices:["png","svg"],default:"svg",describe:"Output image format",type:"string"}).option("output",{alias:"o",default:"./",describe:"Output image directory",type:"string"}).option("transparent",{alias:"t",default:!1,describe:"Output an image with a transparent background",type:"boolean"}).option("dark-mode",{alias:"d",default:!1,describe:"Output a dark theme version of the image",type:"boolean"}).option("frames",{coerce(e){return e.length===0?!0:e},defaultDescription:"false",describe:'Export each sketch "frame" as a separate image, use the option flag alone to export all frames, or pass one or more frame names or IDs',type:"array"}).option("verbose",{default:!1,describe:"Enable verbose output",type:"boolean"}),async i=>{let{darkMode:e,fileOrUrl:t,format:n,frames:r,output:s,transparent:c,verbose:d}=i;try{await Dr(t,{darkMode:e,format:n,frames:r,output:s,transparent:c,verbose:d}),process.exit(0)}catch(b){console.error("Conversion failed:",b),process.exit(1)}}).alias("h","help").version("version",Or).alias("v","version").help().parse();
75
75
  /*! Bundled license information:
76
76
 
77
77
  voca/index.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitschpatrol/tldraw-cli",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "type": "module",
5
5
  "description": "A tiny little CLI tool for rendering tldraw URLs and .tldr files into svg or png images.",
6
6
  "repository": {